diff options
author | Miguel de Icaza <miguel@gnome.org> | 2001-06-22 23:46:13 +0400 |
---|---|---|
committer | Miguel de Icaza <miguel@gnome.org> | 2001-06-22 23:46:13 +0400 |
commit | fe9fb1dd934a4f65c9ca2e10283e9748854a6489 (patch) | |
tree | b73cac21e93b8d69e5ab5108a4debc42f4f979af | |
parent | dc79f25c40fae2e048aa0596c1c2d8335feb78ac (diff) |
Lots of more work on the disassembler and supporting runtime
svn path=/trunk/mono/; revision=25
-rw-r--r-- | ChangeLog | 21 | ||||
-rw-r--r-- | doc/c-sharp | 4 | ||||
-rw-r--r-- | mono/dis/ChangeLog | 5 | ||||
-rw-r--r-- | mono/dis/main.c | 221 | ||||
-rw-r--r-- | mono/metadata/Makefile.am | 4 | ||||
-rw-r--r-- | mono/metadata/assembly.c | 9 | ||||
-rw-r--r-- | mono/metadata/endian.h | 13 | ||||
-rw-r--r-- | mono/metadata/metadata.c | 78 | ||||
-rw-r--r-- | mono/metadata/metadata.h | 48 | ||||
-rw-r--r-- | mono/metadata/mono-endian.h | 13 | ||||
-rw-r--r-- | mono/metadata/pedump.c | 7 | ||||
-rw-r--r-- | mono/metadata/typeattr.h | 47 | ||||
-rw-r--r-- | web/c-sharp | 4 |
13 files changed, 411 insertions, 63 deletions
diff --git a/ChangeLog b/ChangeLog index e0230d299bf..1a76f446632 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,24 +1,3 @@ -2001-06-21 Miguel de Icaza <miguel@ximian.com> - - * 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 - 2001-05-30 Miguel de Icaza <miguel@ximian.com> * NEWS: diff --git a/doc/c-sharp b/doc/c-sharp index 69f391ab323..03e58f154d0 100644 --- a/doc/c-sharp +++ b/doc/c-sharp @@ -110,6 +110,10 @@ A: Compiling MCS currently requires you to run my port of <a C#</a> on a Unix system to generate the parser, and then you need to use Microsoft's .NET csc.exe compiler to compile the compiler. + You only need to compile the compiler compiler (C code), the + samples are Java samples that I did not port, and you do not need + them. + It might be simple to port Jay.cs to Windows, but I have not tried this. diff --git a/mono/dis/ChangeLog b/mono/dis/ChangeLog new file mode 100644 index 00000000000..d41c5ad08e1 --- /dev/null +++ b/mono/dis/ChangeLog @@ -0,0 +1,5 @@ +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/main.c b/mono/dis/main.c index 49f9027c1e2..9ea7a311efc 100644 --- a/mono/dis/main.c +++ b/mono/dis/main.c @@ -8,9 +8,12 @@ */ #include <config.h> #include <stdio.h> +#include <string.h> #include <glib.h> #include <mono/metadata/assembly.h> #include <mono/metadata/cil-coff.h> +#include <mono/metadata/endian.h> +#include <mono/metadata/typeattr.h> FILE *output; @@ -28,11 +31,221 @@ dump_header_data (MonoAssembly *ass) "// Copyright (C) 2001 Ximian, Inc.\n\n"); } +#define CSIZE(x) (sizeof (x) / 4) +static void +expand (metadata_tableinfo_t *t, int idx, guint32 *res, int res_size) +{ + guint32 bitfield = t->size_bitfield; + int i, count = meta_table_count (bitfield); + char *data = t->base + idx * t->row_size; + + g_assert (res_size == count); + + for (i = 0; i < count; i++){ + int n = meta_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; + } +} + +static void +dis_directive_assembly (metadata_t *m) +{ + metadata_tableinfo_t *t = &m->tables [META_TABLE_ASSEMBLY]; + guint32 cols [9]; + + if (t->base == NULL) + return; + + expand (t, 0, cols, CSIZE (cols)); + + 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 [7]), + cols [0], + cols [1], cols [2], cols [3], cols [4], + cols [8] ? "\n .locale" : "", + cols [8] ? mono_metadata_string_heap (m, cols [8]) : "", + cols [6] ? "\n .publickey" : "" + ); +} + +static void +dis_directive_assemblyref (metadata_t *m) +{ + metadata_tableinfo_t *t = &m->tables [META_TABLE_ASSEMBLYREF]; + guint32 cols [9]; + int i; + + if (t->base == NULL) + return; + + for (i = 0; i < t->rows; i++){ + expand (t, i, cols, CSIZE (cols)); + + fprintf (output, + ".assembly extern %s\n" + "{\n" + " .ver %d.%d.%d.%d\n" + "}\n", + mono_metadata_string_heap (m, cols [6]), + cols [0], cols [1], cols [2], cols [3] + ); + } +} + +typedef struct { + int code; + char *str; +} map_t; + +static const char * +map (int code, map_t *table) +{ + int i; + + for (i = 0; table [i].str != NULL; i++) + if (table [i].code == code) + return table [i].str; + g_assert_not_reached (); + return ""; +} + +static map_t visibility_map [] = { + { TYPE_ATTRIBUTE_NOT_PUBLIC, "not-public " }, + { 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; +} + +static void +dis_fields (metadata_t *m, guint32 idx) +{ + fprintf (output, "FIELD_LIST: %d\n", idx); +} + +static void +dis_methods (metadata_t *m, guint32 idx) +{ +} + +static char * +typedef_or_ref (guint32 index) +{ + return ""; +} + +static void +dis_type (metadata_t *m, metadata_tableinfo_t *t, int n) +{ + guint32 cols [6]; + const char *name; + char *tn; + + expand (t, n, cols, CSIZE (cols)); + + name = mono_metadata_string_heap (m, cols [1]); + + if ((cols [0] & TYPE_ATTRIBUTE_CLASS_SEMANTIC_MASK) == TYPE_ATTRIBUTE_CLASS) + tn = "class"; + else + tn = "interface"; + + fprintf (output, " .%s %s%s\n", tn, typedef_flags (cols [0]), name); + fprintf (output, " \textends %s\n", typedef_or_ref (cols [3])); + fprintf (output, " {\n"); + dis_fields (m, cols [4]); + dis_methods (m, cols [5]); + fprintf (output, " }\n"); +} + +static void +dis_types (metadata_t *m) +{ + metadata_tableinfo_t *t = &m->tables [META_TABLE_TYPEDEF]; + int i; + + for (i = 0; i < t->rows; i++){ + dis_type (m, t, i); + } +} + static void disassemble_file (const char *file) { enum MonoAssemblyOpenStatus status; MonoAssembly *ass; + cli_image_info_t *ii; + metadata_t *m; + ass = mono_assembly_open (file, &status); if (ass == NULL){ @@ -42,6 +255,12 @@ disassemble_file (const char *file) dump_header_data (ass); + ii = ass->image_info; + m = &ii->cli_metadata; + dis_directive_assemblyref (m); + dis_directive_assembly (m); + dis_types (m); + mono_assembly_close (ass); } @@ -74,4 +293,6 @@ main (int argc, char *argv []) for (l = input_files; l; l = l->next) disassemble_file (l->data); + + return 0; } diff --git a/mono/metadata/Makefile.am b/mono/metadata/Makefile.am index 505141d5abc..b40e781f9a3 100644 --- a/mono/metadata/Makefile.am +++ b/mono/metadata/Makefile.am @@ -8,10 +8,12 @@ libmetadata_a_SOURCES = \ assembly.h \ assembly.c \ cil-coff.h \ + endian.h \ metadata.c \ metadata.h \ rawbuffer.c \ - rawbuffer.h + rawbuffer.h \ + typeattr.h pedump_SOURCES = \ pedump.c $(libmetadata_a_SOURCES) diff --git a/mono/metadata/assembly.c b/mono/metadata/assembly.c index 38c236c4298..ccaee480e9f 100644 --- a/mono/metadata/assembly.c +++ b/mono/metadata/assembly.c @@ -18,17 +18,10 @@ #include "assembly.h" #include "cil-coff.h" #include "rawbuffer.h" +#include "endian.h" #define INVALID_ADDRESS 0xffffffff -/* 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))) - guint32 cli_rva_image_map (cli_image_info_t *iinfo, guint32 addr) { diff --git a/mono/metadata/endian.h b/mono/metadata/endian.h new file mode 100644 index 00000000000..8da0e4126e0 --- /dev/null +++ b/mono/metadata/endian.h @@ -0,0 +1,13 @@ +#ifndef _MONO_METADATA_ENDIAN_H_ +#define _MONO_METADATA_ENDIAN_H_ 1 + +/* 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))) + +#endif /* _MONO_METADATA_ENDIAN_H_ */ diff --git a/mono/metadata/metadata.c b/mono/metadata/metadata.c index 6ebde50f877..9427b87065b 100644 --- a/mono/metadata/metadata.c +++ b/mono/metadata/metadata.c @@ -339,34 +339,36 @@ mono_meta_table_name (int table) #define rtsize(s,b) (((s) > (1 << (b)) ? 4 : 2)) static int -compute_size (metadata_t *meta, MonoMetaTable *table, int rowcount) +compute_size (metadata_t *meta, MonoMetaTable *table, int rowcount, guint32 *result_bitfield) { + guint32 bitfield = 0; int tsize = rowcount > 65536 ? 4 : 2; - int size = 0; + int size = 0, field_size; int i, n, code; + int shift = 0; for (i = 0; (code = table [i].code) != MONO_MT_END; i++){ switch (code){ case MONO_MT_UINT32: - size += 4; break; + field_size = 4; break; case MONO_MT_UINT16: - size += 2; break; + field_size = 2; break; case MONO_MT_UINT8: - size += 1; break; + field_size = 1; break; case MONO_MT_BLOB_IDX: - size += meta->idx_blob_wide ? 4 : 2; break; + field_size = meta->idx_blob_wide ? 4 : 2; break; case MONO_MT_STRING_IDX: - size += meta->idx_string_wide ? 4 : 2; break; + field_size = meta->idx_string_wide ? 4 : 2; break; case MONO_MT_GUID_IDX: - size += meta->idx_string_wide ? 4 : 2; break; + field_size = meta->idx_string_wide ? 4 : 2; break; case MONO_MT_TABLE_IDX: - size += tsize; break; + field_size = tsize; break; /* * HasConstant: ParamDef, FieldDef, Property @@ -377,7 +379,7 @@ compute_size (metadata_t *meta, MonoMetaTable *table, int rowcount) n = MAX (n, meta->tables [META_TABLE_PROPERTY].rows); /* 2 bits to encode tag */ - size += rtsize (n, 16-2); + field_size = rtsize (n, 16-2); break; /* @@ -391,7 +393,7 @@ compute_size (metadata_t *meta, MonoMetaTable *table, int rowcount) * we should consider the blob size first */ if (meta->idx_blob_wide){ - size += 4; + field_size = 4; break; } @@ -416,7 +418,7 @@ compute_size (metadata_t *meta, MonoMetaTable *table, int rowcount) n = MAX (n, meta->tables [META_TABLE_MANIFESTRESOURCE].rows); /* 5 bits to encode */ - size += rtsize (n, 16-5); + field_size = rtsize (n, 16-5); break; /* @@ -426,7 +428,7 @@ compute_size (metadata_t *meta, MonoMetaTable *table, int rowcount) case MONO_MT_CAT_IDX: /* String is a heap, if it is wide, we know the size */ if (meta->idx_string_wide){ - size += 4; + field_size = 4; break; } @@ -436,7 +438,7 @@ compute_size (metadata_t *meta, MonoMetaTable *table, int rowcount) n = MAX (n, meta->tables [META_TABLE_MEMBERREF].rows); /* 3 bits to encode */ - size += rtsize (n, 16-3); + field_size = rtsize (n, 16-3); break; /* @@ -448,7 +450,7 @@ compute_size (metadata_t *meta, MonoMetaTable *table, int rowcount) n = MAX (n, meta->tables [META_TABLE_ASSEMBLY].rows); /* 2 bits to encode */ - size += rtsize (n, 16-2); + field_size = rtsize (n, 16-2); break; /* @@ -460,7 +462,7 @@ compute_size (metadata_t *meta, MonoMetaTable *table, int rowcount) n = MAX (n, meta->tables [META_TABLE_EXPORTEDTYPE].rows); /* 2 bits to encode tag */ - size += rtsize (n, 16-2); + field_size = rtsize (n, 16-2); break; /* @@ -471,7 +473,7 @@ compute_size (metadata_t *meta, MonoMetaTable *table, int rowcount) meta->tables [META_TABLE_PARAM].rows); /* 1 bit used to encode tag */ - size += rtsize (n, 16-1); + field_size = rtsize (n, 16-1); break; /* @@ -482,7 +484,7 @@ compute_size (metadata_t *meta, MonoMetaTable *table, int rowcount) meta->tables [META_TABLE_METHOD].rows); /* 1 bit used to encode tag */ - size += rtsize (n, 16-1); + field_size = rtsize (n, 16-1); break; /* @@ -494,7 +496,7 @@ compute_size (metadata_t *meta, MonoMetaTable *table, int rowcount) n = MAX (n, meta->tables [META_TABLE_TYPESPEC].rows); /* 2 bits to encode */ - size += rtsize (n, 16-2); + field_size = rtsize (n, 16-2); break; /* @@ -508,7 +510,7 @@ compute_size (metadata_t *meta, MonoMetaTable *table, int rowcount) n = MAX (n, meta->tables [META_TABLE_TYPESPEC].rows); /* 3 bits to encode */ - size += rtsize (n, 16 - 3); + field_size = rtsize (n, 16 - 3); break; case MONO_MT_MDOR_IDX: @@ -521,7 +523,7 @@ compute_size (metadata_t *meta, MonoMetaTable *table, int rowcount) meta->tables [META_TABLE_MEMBERREF].rows); /* 1 bit used to encode tag */ - size += rtsize (n, 16-1); + field_size = rtsize (n, 16-1); break; /* @@ -534,11 +536,24 @@ compute_size (metadata_t *meta, MonoMetaTable *table, int rowcount) n = MAX (n, meta->tables [META_TABLE_TYPEREF].rows); /* 3 bits used to encode tag */ - size += rtsize (n, 16 - 3); + field_size = rtsize (n, 16 - 3); 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; } + *result_bitfield = (i << 24) | bitfield; return size; } @@ -553,7 +568,8 @@ mono_metadata_compute_table_bases (metadata_t *meta) continue; meta->tables [i].row_size = compute_size ( - meta, tables [i].table, meta->tables [i].rows); + meta, tables [i].table, meta->tables [i].rows, + &meta->tables [i].size_bitfield); meta->tables [i].base = base; base += meta->tables [i].rows * meta->tables [i].row_size; } @@ -572,3 +588,19 @@ mono_metadata_locate_token (metadata_t *meta, guint32 token) { return mono_metadata_locate (meta, token >> 24, token & 0xffffff); } + +MonoMetaTable * +mono_metadata_get_table (MetaTableEnum table) +{ + int x = (int) table; + + g_return_val_if_fail ((x > 0) && (x <= META_TABLE_LAST), NULL); + + return tables [table].table; +} + +const char * +mono_metadata_string_heap (metadata_t *meta, guint32 index) +{ + return meta->raw_metadata + meta->heap_strings.sh_offset + index; +} diff --git a/mono/metadata/metadata.h b/mono/metadata/metadata.h index f0087ab7444..1fbb662bc2e 100644 --- a/mono/metadata/metadata.h +++ b/mono/metadata/metadata.h @@ -1,10 +1,10 @@ typedef struct { - guint32 sh_offset; - guint32 sh_size; + guint32 sh_offset; + guint32 sh_size; } stream_header_t; -enum { +typedef enum { META_TABLE_MODULE, META_TABLE_TYPEREF, META_TABLE_TYPEDEF, @@ -46,14 +46,35 @@ enum { META_TABLE_FILE, META_TABLE_EXPORTEDTYPE, META_TABLE_MANIFESTRESOURCE, - META_TABLE_NESTEDCLASS -}; + META_TABLE_NESTEDCLASS, + +#define META_TABLE_LAST META_TABLE_NESTEDCLASS +} MetaTableEnum; typedef struct { guint32 rows, row_size; char *base; + + /* + * Tables contain up to 9 rows 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; } metadata_tableinfo_t; +/* + * This macro is used to extract the size of the table encoded in + * the size_bitfield of metadata_tableinfo_t. + */ +#define meta_table_size(bitfield,table) ((((bitfield) >> ((table)*2)) & 0x3) + 1) +#define meta_table_count(bitfield) ((bitfield) >> 24) + typedef struct { char *raw_metadata; @@ -70,6 +91,10 @@ typedef struct { metadata_tableinfo_t tables [64]; } metadata_t; +/* + * This enumeration is used to describe the data types in the metadata + * tables + */ enum { MONO_MT_END, @@ -135,7 +160,14 @@ typedef struct { const char *mono_meta_table_name (int table); /* Internal functions */ -void mono_metadata_compute_table_bases (metadata_t *meta); +void mono_metadata_compute_table_bases (metadata_t *meta); + +MonoMetaTable *mono_metadata_get_table (MetaTableEnum table); + +/* + * + */ +char *mono_metadata_locate (metadata_t *meta, int table, int idx); +char *mono_metadata_locate_token (metadata_t *meta, guint32 token); -char *mono_metadata_locate (metadata_t *meta, int table, int idx); -char *mono_metadata_locate_token (metadata_t *meta, guint32 token); +const char *mono_metadata_string_heap (metadata_t *meta, guint32 index); diff --git a/mono/metadata/mono-endian.h b/mono/metadata/mono-endian.h new file mode 100644 index 00000000000..8da0e4126e0 --- /dev/null +++ b/mono/metadata/mono-endian.h @@ -0,0 +1,13 @@ +#ifndef _MONO_METADATA_ENDIAN_H_ +#define _MONO_METADATA_ENDIAN_H_ 1 + +/* 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))) + +#endif /* _MONO_METADATA_ENDIAN_H_ */ diff --git a/mono/metadata/pedump.c b/mono/metadata/pedump.c index 20caeb9460d..acc3af8d98a 100644 --- a/mono/metadata/pedump.c +++ b/mono/metadata/pedump.c @@ -12,6 +12,8 @@ #include <glib.h> #include "cil-coff.h" +gboolean dump_data = TRUE; + static void hex_dump (char *buffer, int base, int count) { @@ -268,7 +270,7 @@ dump_dotnet_iinfo (cli_image_info_t *iinfo) static void usage (void) { - printf ("Usage is: pedump [-m] file.exe\n"); + printf ("Usage is: pedump file.exe\n"); exit (1); } @@ -300,7 +302,8 @@ main (int argc, char *argv []) } iinfo = assembly->image_info; - dump_dotnet_iinfo (iinfo); + if (dump_data) + dump_dotnet_iinfo (iinfo); mono_assembly_close (assembly); diff --git a/mono/metadata/typeattr.h b/mono/metadata/typeattr.h new file mode 100644 index 00000000000..63b6481cea8 --- /dev/null +++ b/mono/metadata/typeattr.h @@ -0,0 +1,47 @@ +#ifndef _MONO_METADATA_BITMASK_H_ +#define _MONO_METADATA_BITMASK_H_ +/* + * Flags for bitmasks in the metadata tables + */ + +/* + * 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 + +#endif diff --git a/web/c-sharp b/web/c-sharp index 69f391ab323..03e58f154d0 100644 --- a/web/c-sharp +++ b/web/c-sharp @@ -110,6 +110,10 @@ A: Compiling MCS currently requires you to run my port of <a C#</a> on a Unix system to generate the parser, and then you need to use Microsoft's .NET csc.exe compiler to compile the compiler. + You only need to compile the compiler compiler (C code), the + samples are Java samples that I did not port, and you do not need + them. + It might be simple to port Jay.cs to Windows, but I have not tried this. |