[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[dotgnu-pnet-commits] pnet ChangeLog ilasm/ilasm_build.c ilasm/ilasm_...
From: |
Klaus Treichel |
Subject: |
[dotgnu-pnet-commits] pnet ChangeLog ilasm/ilasm_build.c ilasm/ilasm_... |
Date: |
Tue, 03 Jul 2007 20:25:27 +0000 |
CVSROOT: /cvsroot/dotgnu-pnet
Module name: pnet
Changes by: Klaus Treichel <ktreichel> 07/07/03 20:25:26
Modified files:
. : ChangeLog
ilasm : ilasm_build.c ilasm_build.h ilasm_grammar.y
ilasm_main.c ilasm_scanner.l
image : item.c meta_index.c
include : il_program.h
Log message:
Add the .param type [n] directive to ilasm. Fix a segfault in ilasm if
a file
was compiled with errors.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pnet/ChangeLog?cvsroot=dotgnu-pnet&r1=1.3474&r2=1.3475
http://cvs.savannah.gnu.org/viewcvs/pnet/ilasm/ilasm_build.c?cvsroot=dotgnu-pnet&r1=1.28&r2=1.29
http://cvs.savannah.gnu.org/viewcvs/pnet/ilasm/ilasm_build.h?cvsroot=dotgnu-pnet&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/pnet/ilasm/ilasm_grammar.y?cvsroot=dotgnu-pnet&r1=1.46&r2=1.47
http://cvs.savannah.gnu.org/viewcvs/pnet/ilasm/ilasm_main.c?cvsroot=dotgnu-pnet&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/pnet/ilasm/ilasm_scanner.l?cvsroot=dotgnu-pnet&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/pnet/image/item.c?cvsroot=dotgnu-pnet&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/pnet/image/meta_index.c?cvsroot=dotgnu-pnet&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/pnet/include/il_program.h?cvsroot=dotgnu-pnet&r1=1.55&r2=1.56
Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ChangeLog,v
retrieving revision 1.3474
retrieving revision 1.3475
diff -u -b -r1.3474 -r1.3475
--- ChangeLog 1 Jul 2007 16:46:40 -0000 1.3474
+++ ChangeLog 3 Jul 2007 20:25:25 -0000 1.3475
@@ -1,3 +1,28 @@
+2007-07-03 Klaus Treichel <address@hidden>
+
+ * ilasm/ilasm_build.c: Add the function ILAsmFindGenericParameter to
+ fins an ILGenericPar by owner and zero based parameter number.
+
+ * ilasm/ilasm_build.h: Add the prototype for ILAsmFindGenericParameter.
+
+ * ilasm/ilasm_grammar.y: Add support for the .param type [n] directive
+ to set the custom attribute scope to a generic parameter of the class or
+ method.
+
+ * ilasm/ilasm_scanner.l: Add the `type' keyword.
+
+ * ilasm(ilasm_main.c: Fix segfaults if the il file was compiled with
+ errors. Call the reset() function pior to closing the output file
because
+ reset() calls a function that writes to the file.
+
+ * image/item.c: Add the function ILProgramItemToGenericConstraint.
+
+ * image/meta_index.c: Add the generic parameter to the possible owners
of
+ a custom attribute.
+
+ * include/il_program.h: Add the prototype for
+ ILProgramtemToGenericConstraint.
+
2007-07-01 Klaus Treichel <address@hidden>
* ilasm/ilasm_build.c: Add the function ILAsmAddGenericPars to add
Index: ilasm/ilasm_build.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ilasm/ilasm_build.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- ilasm/ilasm_build.c 1 Jul 2007 16:46:40 -0000 1.28
+++ ilasm/ilasm_build.c 3 Jul 2007 20:25:26 -0000 1.29
@@ -1090,6 +1090,21 @@
return 0;
}
+ILGenericPar *ILAsmFindGenericParameter(ILProgramItem *owner,
+
ILUInt32 paramNum)
+{
+ ILGenericPar *genPar = ILGenericParGetFromOwner(owner, paramNum);
+
+ if(!genPar)
+ {
+ ILAsmPrintMessage(ILAsmFilename, ILAsmLineNum,
+ "no generic parameter parameter numbered %lu for the current
method",
+ (unsigned long)paramNum);
+ ILAsmErrors = 1;
+ }
+ return genPar;
+}
+
void ILAsmAddSemantics(int type, ILToken token)
{
if(token)
Index: ilasm/ilasm_build.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ilasm/ilasm_build.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- ilasm/ilasm_build.h 1 Jul 2007 16:46:40 -0000 1.14
+++ ilasm/ilasm_build.h 3 Jul 2007 20:25:26 -0000 1.15
@@ -236,6 +236,14 @@
ILParameter *ILAsmFindParameter(ILMethod *method, ILUInt32 paramNum);
/*
+ * Find the generic parameter with the 0 based paramNum for the class or
+ * method.
+ * Returns NULL if not found.
+ */
+ILGenericPar *ILAsmFindGenericParameter(ILProgramItem *owner,
+
ILUInt32 paramNum);
+
+/*
* Add semantics to an event or property.
*/
void ILAsmAddSemantics(int type, ILToken token);
Index: ilasm/ilasm_grammar.y
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ilasm/ilasm_grammar.y,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -b -r1.46 -r1.47
--- ilasm/ilasm_grammar.y 1 Jul 2007 16:46:40 -0000 1.46
+++ ilasm/ilasm_grammar.y 3 Jul 2007 20:25:26 -0000 1.47
@@ -1003,6 +1003,7 @@
%token K_TLS "`tls'"
%token K_TO "`to'"
%token K_TRUE "`true'"
+%token K_TYPE "`type'"
%token K_TYPEDREF "`typedref'"
%token K_UNICODE "`unicode'"
%token K_UNMANAGED "`unmanaged'"
@@ -1493,6 +1494,20 @@
| D_CTOR { $$ =
IL_META_GENPARAM_CTOR_CONST; }
;
+GenericTypeParamDirective
+ : D_PARAM K_TYPE '[' Integer32 ']' {
+ ILGenericPar *genPar;
+ genPar =
ILAsmFindGenericParameter(ILToProgramItem(ILAsmCurrScope),
+
(ILUInt32)($4 - 1));
+ if(genPar)
+ {
+ /* Set the last token, to allow custom
attributes
+ to be attached to the parameter */
+ ILAsmLastToken =
ILProgramItem_Token(ILToProgramItem(genPar));
+ }
+ }
+ ;
+
ClassAttributes
: /* empty */ { $$ = 0; }
| ClassAttributeList { $$ = $1; }
@@ -1699,6 +1714,7 @@
}
}
}
+ | GenericTypeParamDirective
;
/*
@@ -2446,6 +2462,7 @@
ILAsmLastToken =
ILParameter_Token(param);
}
}
+ | GenericTypeParamDirective
;
JavaMethodDeclarations
Index: ilasm/ilasm_main.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ilasm/ilasm_main.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- ilasm/ilasm_main.c 5 May 2007 15:56:42 -0000 1.14
+++ ilasm/ilasm_main.c 3 Jul 2007 20:25:26 -0000 1.15
@@ -536,23 +536,23 @@
/* Exit if errors occurred during the parse */
if(ILAsmErrors)
{
+ reset();
if(outfile != NULL)
{
fclose(outfile);
ILDeleteFile(outputFile);
}
- reset();
return 1;
}
/* Finalize the output */
if(!ILAsmOutDestroy())
{
+ reset();
if(outfile != NULL)
{
fclose(outfile);
}
- reset();
return 1;
}
if(outfile != NULL)
Index: ilasm/ilasm_scanner.l
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ilasm/ilasm_scanner.l,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- ilasm/ilasm_scanner.l 22 Oct 2006 18:01:09 -0000 1.14
+++ ilasm/ilasm_scanner.l 3 Jul 2007 20:25:26 -0000 1.15
@@ -511,6 +511,7 @@
<INITIAL,JAVAMODE>"false" { return K_FALSE; }
<INITIAL,JAVAMODE>"java" { return K_JAVA; }
<INITIAL,JAVAMODE>"nullref" { return K_NULLREF; }
+<INITIAL,JAVAMODE>"type" { return K_TYPE; }
<INITIAL,JAVAMODE>"::" { return COLON_COLON; }
<INITIAL,JAVAMODE>"..." { return
DOT_DOT_DOT; }
Index: image/item.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/item.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- image/item.c 26 Jun 2005 15:56:30 -0000 1.8
+++ image/item.c 3 Jul 2007 20:25:26 -0000 1.9
@@ -908,6 +908,23 @@
}
}
+ILGenericConstraint *ILProgramItemToGenericConstraint(ILProgramItem *item)
+{
+ if(!item)
+ {
+ return 0;
+ }
+ else if((item->token & IL_META_TOKEN_MASK) ==
IL_META_TOKEN_GENERIC_CONSTRAINT)
+ {
+ return (ILGenericConstraint *)item;
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+
#ifdef __cplusplus
};
#endif
Index: image/meta_index.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/meta_index.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- image/meta_index.c 31 May 2007 15:19:06 -0000 1.12
+++ image/meta_index.c 3 Jul 2007 20:25:26 -0000 1.13
@@ -91,7 +91,7 @@
IL_META_TOKEN_FILE,
IL_META_TOKEN_EXPORTED_TYPE,
IL_META_TOKEN_MANIFEST_RESOURCE,
- 1,
+ IL_META_TOKEN_GENERIC_PAR,
1,
1,
1,
Index: include/il_program.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/include/il_program.h,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -b -r1.55 -r1.56
--- include/il_program.h 1 Jul 2007 14:15:17 -0000 1.55
+++ include/il_program.h 3 Jul 2007 20:25:26 -0000 1.56
@@ -149,6 +149,7 @@
ILExportedType *ILProgramItemToExportedType(ILProgramItem *item);
ILGenericPar *ILProgramItemToGenericPar(ILProgramItem *item);
ILMethodSpec *ILProgramItemToMethodSpec(ILProgramItem *item);
+ILGenericConstraint *ILProgramItemToGenericConstraint(ILProgramItem *item);
/*
* Helper macros for querying information about a program item.