diff options
-rw-r--r-- | docs/exdoc | 31 | ||||
-rw-r--r-- | docs/sources/mono-api-class.html | 24 | ||||
-rw-r--r-- | mono/metadata/class.c | 39 |
3 files changed, 76 insertions, 18 deletions
diff --git a/docs/exdoc b/docs/exdoc index f2711d26b13..4e60e1b90c7 100644 --- a/docs/exdoc +++ b/docs/exdoc @@ -58,26 +58,28 @@ if ($html){ } .api { - border: 1px solid; padding: 10pt; margin: 10pt; } .api-entry { border-bottom: none; - font-size: 18px; + font-size: 120%; } .prototype { - border: 1px solid; - background-color: #f2f2f2; - padding: 5pt; + border: 3px solid #ecf0f1; + border-radius: 6px; + padding: 1em 1.2em; margin-top: 5pt; - margin-bottom: 5pt; + margin-bottom: 5pt; + font-family: "Consolas", "Courier", monospace; + display: block; + overflow: auto; } .header { - border: 1px solid; + padding: 0 0 5pt 5pt; margin: 10pt; white-space: pre; @@ -104,6 +106,9 @@ EOF if ($api ne ""){ if ($api_shown == 1){ print OUT "</div>"; + if ($deprecated{$api}){ + print OUT "<p><b>DEPRECATED ${deprecated{$api}}</b>"; + } } $api_shown = 1; $proto = $prototype{$api}; @@ -121,7 +126,7 @@ print OUT<<EOF; EOF &opt_print ("Parameters", $arguments{$api}, 1); &opt_print ("Returns", $returns{$api}, 1); - &opt_print ("Remarks", $bodies{$api}, 0); + &opt_print ("Description", $bodies{$api}, 0); print OUT "\n"; } else { if ($line =~ /@API_IDX@/){ @@ -168,7 +173,8 @@ sub process_doc { $returns = ""; $body = ""; $functions[$fn++] = $func; - + $deprecated = 0; + # Process arguments while (<>){ if (/^ \*\*?\//){ @@ -179,6 +185,7 @@ sub process_doc { $body =~ s/\n/ /; $bodies{$func} = $body; $arguments{$func} = $args; + $deprecated{$func} = $deprecated; $returns{$func} = $returns; $proto = ""; while (<>){ @@ -199,7 +206,11 @@ sub process_doc { if ($inbody == 0){ if (/\s*(\w+):(.*)/){ - $args .= "<dt><i>$1:</i></dt><dd>$2</dd>"; + if ($1 eq "deprecated"){ + $deprecated = $2; + } else { + $args .= "<dt><i>$1:</i></dt><dd>$2</dd>"; + } } else { $body = "\t$_\n"; diff --git a/docs/sources/mono-api-class.html b/docs/sources/mono-api-class.html index f1c92dff1ae..328761577b8 100644 --- a/docs/sources/mono-api-class.html +++ b/docs/sources/mono-api-class.html @@ -1,15 +1,33 @@ - <h2>Class Operations</h2> + <p>The operations on <code>MonoClass*</code> allow you to + query a number of properties of a .NET class from the C API. + <h3>Getting a MonoClass</h3> -<h4><a name="api:mono_class_from_generic_parameter">mono_class_from_generic_parameter</a></h4> + <p>You typically would obtain a <code>MonoClass*</code> + pointer by using a combination of the <code>MonoImage*</code> + where the type is located, the namespace and name using the + <code><a href="api:mono_class_from_name">mono_class_from_name</a></code> + or + the <code><a href="api:mono_class_from_name_case">mono_class_from_name_case</a></code> + APIs or by using + the <code><a href="api:mono_class_from_typeref">mono_class_from_typeref</a></code> + or <code><a href="api:mono_class_from_typeref">mono_class_from_typeref_checked</a></code> + methods. + + <p>For low-level access, you can get the <code>MonoClass + *</code> from an image and an ECMA type token relative to + the <code>MonoImage*</code> by using <a href="api:mono_class_get">mono_class_get</a></h4>. + + +<h4><a name="api:mono_class_get">mono_class_get</a></h4> <h4><a name="api:mono_class_from_mono_type">mono_class_from_mono_type</a></h4> <h4><a name="api:mono_class_from_name">mono_class_from_name</a></h4> <h4><a name="api:mono_class_from_name_case">mono_class_from_name_case</a></h4> <h4><a name="api:mono_class_from_typeref">mono_class_from_typeref</a></h4> <h4><a name="api:mono_class_from_typeref_checked">mono_class_from_typeref_checked</a> -<h4><a name="api:mono_class_get">mono_class_get</a></h4> +<h4><a name="api:mono_class_from_generic_parameter">mono_class_from_generic_parameter</a></h4> <h3>Working with a MonoClass</h3> diff --git a/mono/metadata/class.c b/mono/metadata/class.c index d3ee6458d03..86a04fc0b56 100644 --- a/mono/metadata/class.c +++ b/mono/metadata/class.c @@ -6549,6 +6549,12 @@ mono_fnptr_class_get (MonoMethodSignature *sig) return result; } +/** + * mono_class_from_mono_type: + * @type: describes the type to return + * + * This returns a MonoClass for the specified MonoType, the value is never NULL. + */ MonoClass * mono_class_from_mono_type (MonoType *type) { @@ -6609,7 +6615,9 @@ mono_class_from_mono_type (MonoType *type) g_warning ("mono_class_from_mono_type: implement me 0x%02x\n", type->type); g_assert_not_reached (); } - + + // Yes, this returns NULL, even if it is documented as not doing so, but there + // is no way for the code to make it this far, due to the assert above. return NULL; } @@ -7421,7 +7429,7 @@ mono_class_get_and_inflate_typespec_checked (MonoImage *image, guint32 type_toke * @type_token: the token for the class * @error: error object to return any error * - * Returns: the MonoClass that represents @type_token in @image + * Returns: the MonoClass that represents @type_token in @image, or NULL on error. */ MonoClass * mono_class_get_checked (MonoImage *image, guint32 type_token, MonoError *error) @@ -7526,7 +7534,13 @@ mono_type_get_checked (MonoImage *image, guint32 type_token, MonoGenericContext return type; } - +/** + * mono_class_get: + * @image: image where the class token will be looked up. + * @type_token: a type token from the image + * + * Returns the MonoClass with the given @type_token on the @image + */ MonoClass * mono_class_get (MonoImage *image, guint32 type_token) { @@ -7680,7 +7694,7 @@ find_nocase (gpointer key, gpointer value, gpointer user_data) * @image: The MonoImage where the type is looked up in * @name_space: the type namespace * @name: the type short name. - * @deprecated: use the _checked variant + * @deprecated: use the mono_class_from_name_case_checked variant instead. * * Obtains a MonoClass with a given namespace and a given name which * is located in the given MonoImage. The namespace and name @@ -7695,8 +7709,23 @@ mono_class_from_name_case (MonoImage *image, const char* name_space, const char return res; } +/** + * mono_class_from_name_case: + * @image: The MonoImage where the type is looked up in + * @name_space: the type namespace + * @name: the type short name. + * @error: if + * + * Obtains a MonoClass with a given namespace and a given name which + * is located in the given MonoImage. The namespace and name + * lookups are case insensitive. + * + * Returns: the MonoClass if the given namespace and name were found, or NULL if it + * was not found. The @error object will contain information about the problem + * in that case. + */ MonoClass * -mono_class_from_name_case_checked (MonoImage *image, const char* name_space, const char *name, MonoError *error) +mono_class_from_name_case_checked (MonoImage *image, const char *name_space, const char *name, MonoError *error) { MonoTableInfo *t = &image->tables [MONO_TABLE_TYPEDEF]; guint32 cols [MONO_TYPEDEF_SIZE]; |