3 * Copyright (C) 2006-2008, The Perl Foundation.
6 /* .NET CLI TypeRef Metadata PMC */
9 #include "parrot/extend.h"
10 #include "tableinfo.h"
11 #include "structures.h"
14 pmclass DotNetTypeRefMetadata dynpmc group dotnet {
16 /* Instance initialization. We need a custom DOD marking and destroy. */
19 PObj_custom_mark_SET(SELF);
20 PObj_active_destroy_SET(SELF);
24 /* Get string vtable function; returns the name of the referenced type. */
27 dotnet_typeref *c = (dotnet_typeref *)PMC_struct_val(SELF);
29 /* Handle cases where we've an invalid PMC. */
30 if (!c || !c->str_name)
31 real_exception(INTERP, NULL, E_StandardError,
32 "Invalid DotNetTypeRefMetadata PMC");
38 /* Garbage Collection mark routine. */
41 /* Tell the GC about stuff we're holding on to. */
42 dotnet_typeref *c = (dotnet_typeref *)PMC_struct_val(SELF);
45 pobject_lives(INTERP, (PObj*)c->str_name);
47 pobject_lives(INTERP, (PObj*)c->str_namespace);
55 /* Cleanup any memory we're using. */
56 if (PMC_struct_val(SELF)) {
57 mem_sys_free(PMC_struct_val(SELF));
58 PMC_struct_val(SELF) = NULL;
63 /* Get the namespace of the referenced type. */
64 METHOD STRING* get_namespace()
66 dotnet_typeref *c = (dotnet_typeref *)PMC_struct_val(SELF);
69 /* Handle cases where we've an invalid PMC. */
71 real_exception(INTERP, NULL, E_StandardError,
72 "Invalid DotNetTypeRefMetadata PMC");
74 result = c->str_namespace;
75 RETURN(STRING *result);
79 /* Get the resolution scope. */
80 METHOD INTVAL get_resolution_scope()
82 dotnet_typeref *c = (dotnet_typeref *)PMC_struct_val(SELF);
85 /* Handle cases where we've an invalid PMC. */
87 real_exception(INTERP, NULL, E_StandardError,
88 "Invalid DotNetTypeRefMetadata PMC");
90 result = c->resolution_scope;
91 RETURN(INTVAL result);
98 * c-file-style: "parrot"
100 * vim: expandtab shiftwidth=4: