[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnet/ildasm ildasm_class.c,1.12,1.13 ildasm_
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnet/ildasm ildasm_class.c,1.12,1.13 ildasm_method.c,1.14,1.15 |
Date: |
Tue, 18 Feb 2003 00:25:12 -0500 |
Update of /cvsroot/dotgnu-pnet/pnet/ildasm
In directory subversions:/tmp/cvs-serv8588/ildasm
Modified Files:
ildasm_class.c ildasm_method.c
Log Message:
Add support for Generic IL to "image", "ilasm", and "ildasm"; some
syntax extensions for Generic C#, but no semantic analysis (yet).
Index: ildasm_class.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ildasm/ildasm_class.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -r1.12 -r1.13
*** ildasm_class.c 30 Jan 2003 10:57:46 -0000 1.12
--- ildasm_class.c 18 Feb 2003 05:25:08 -0000 1.13
***************
*** 75,79 ****
}
}
! ILDumpMethodType(outstream, image, ILMethod_Signature(method), flags,
0, ILMethod_Name(method), method);
putc(' ', outstream);
--- 75,80 ----
}
}
! ILDumpMethodType(outstream, image, ILMethod_Signature(method),
! flags | IL_DUMP_GENERIC_PARAMS,
0, ILMethod_Name(method), method);
putc(' ', outstream);
***************
*** 333,336 ****
--- 334,414 ----
/*
+ * Dump a class name with generic parameter information.
+ */
+ static void DumpClassName(FILE *outstream, ILImage *image,
+ ILClass *info, int flags, int
withNamespace)
+ {
+ ILType *type;
+ ILUInt32 genericNum;
+ ILGenericPar *genPar;
+ const char *name;
+ ILProgramItem *constraint;
+ ILTypeSpec *spec;
+
+ /* Use a different approach if the class is a type specification */
+ type = ILClassGetSynType(info);
+ if(type)
+ {
+ ILDumpType(outstream, image, type, flags);
+ return;
+ }
+
+ /* Dump the main part of the class name */
+ if(withNamespace)
+ {
+ ILDumpClassName(outstream, image, info, flags);
+ }
+ else
+ {
+ ILDumpIdentifier(outstream, ILClass_Name(info), 0, flags);
+ }
+
+ /* Dump the generic parameters, if any are present */
+ genericNum = 0;
+ genPar = ILGenericParGetFromOwner(ILToProgramItem(info), genericNum);
+ if(genPar)
+ {
+ putc('<', outstream);
+ do
+ {
+ if(genericNum > 0)
+ {
+ fputs(", ", outstream);
+ }
+ constraint = ILGenericPar_Constraint(genPar);
+ if(constraint)
+ {
+ putc('(', outstream);
+ spec = ILProgramItemToTypeSpec(constraint);
+ if(spec)
+ {
+ ILDumpType(outstream, image,
ILTypeSpec_Type(spec), flags);
+ }
+ else
+ {
+ ILDumpType(outstream, image,
+
ILClassToType((ILClass *)constraint), flags);
+ }
+ putc(')', outstream);
+ }
+ name = ILGenericPar_Name(genPar);
+ if(name)
+ {
+ ILDumpIdentifier(outstream, name, 0, flags);
+ }
+ else
+ {
+ fprintf(outstream, "G_%d", (int)(genericNum +
1));
+ }
+ ++genericNum;
+ genPar = ILGenericParGetFromOwner
+ (ILToProgramItem(info), genericNum);
+ }
+ while(genPar != 0);
+ putc('>', outstream);
+ }
+ }
+
+ /*
* Dump information about a type definition and its nested classes.
*/
***************
*** 364,372 ****
fputs(".class ", outstream);
ILDumpFlags(outstream, ILClass_Attrs(info),
ILTypeDefinitionFlags, 0);
! ILDumpIdentifier(outstream, ILClass_Name(info), 0, flags);
if(ILClass_Parent(info))
{
fputs(" extends ", outstream);
! ILDumpClassName(outstream, image, ILClass_Parent(info),
flags);
}
first = 1;
--- 442,450 ----
fputs(".class ", outstream);
ILDumpFlags(outstream, ILClass_Attrs(info),
ILTypeDefinitionFlags, 0);
! DumpClassName(outstream, image, info, flags, 0);
if(ILClass_Parent(info))
{
fputs(" extends ", outstream);
! DumpClassName(outstream, image, ILClass_Parent(info),
flags, 1);
}
first = 1;
***************
*** 384,388 ****
fputs(", ", outstream);
}
! ILDumpClassName(outstream, image, interface, flags);
}
fputs("\n{\n", outstream);
--- 462,466 ----
fputs(", ", outstream);
}
! DumpClassName(outstream, image, interface, flags, 1);
}
fputs("\n{\n", outstream);
Index: ildasm_method.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ildasm/ildasm_method.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** ildasm_method.c 9 Jan 2003 12:32:27 -0000 1.14
--- ildasm_method.c 18 Feb 2003 05:25:08 -0000 1.15
***************
*** 108,111 ****
--- 108,112 ----
ILStandAloneSig *sig;
ILType *type;
+ ILMethodSpec *mspec;
switch(token & IL_META_TOKEN_MASK)
***************
*** 257,260 ****
--- 258,288 ----
ILDumpType(outstream, image, type,
flags);
}
+ }
+ else
+ {
+ fprintf(outstream, "#%lx", token);
+ }
+ }
+ break;
+
+ case IL_META_TOKEN_METHOD_SPEC:
+ {
+ /* A reference to a method with generic parameters */
+ mspec = ILMethodSpec_FromToken(image, token);
+ if(mspec)
+ {
+ if(prefixWithKind)
+ {
+ fputs("method ", outstream);
+ }
+ fprintf(outstream, "#%lx", token);
+ /* TODO */
+ #if 0
+ ILDumpMethodType(outstream, image,
+
ILMethod_Signature(method), flags,
+
ILMethod_Owner(method),
+
ILMethod_Name(method),
+ 0/*method*/);
+ #endif
}
else
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnet/ildasm ildasm_class.c,1.12,1.13 ildasm_method.c,1.14,1.15,
Rhys Weatherley <address@hidden> <=
- Prev by Date:
[Dotgnu-pnet-commits] CVS: pnet/cscc/csharp cs_grammar.y,1.45,1.46 cs_scanner.l,1.8,1.9
- Next by Date:
[Dotgnu-pnet-commits] CVS: pnet ChangeLog,1.2151,1.2152
- Previous by thread:
[Dotgnu-pnet-commits] CVS: pnet/cscc/csharp cs_grammar.y,1.45,1.46 cs_scanner.l,1.8,1.9
- Next by thread:
[Dotgnu-pnet-commits] CVS: pnet ChangeLog,1.2151,1.2152
- Index(es):