[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnet/csdoc doc_valil.c,1.8,1.9
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnet/csdoc doc_valil.c,1.8,1.9 |
Date: |
Wed, 20 Nov 2002 20:15:39 -0500 |
Update of /cvsroot/dotgnu-pnet/pnet/csdoc
In directory subversions:/tmp/cvs-serv11258/csdoc
Modified Files:
doc_valil.c
Log Message:
Recognise the name forms of "AttributeTargets" enum values to reduce the
number of erroneous "AttributeUsage" reports.
Index: doc_valil.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/csdoc/doc_valil.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** doc_valil.c 4 May 2002 20:59:16 -0000 1.8
--- doc_valil.c 21 Nov 2002 01:15:37 -0000 1.9
***************
*** 1026,1033 ****
/*
* Append an attribute value to a name. Returns NULL
* if the value is invalid.
*/
! static char *AppendAttrValue(char *name, ILSerializeReader *reader, int type)
{
ILInt32 intValue;
--- 1026,1100 ----
/*
+ * Attribute usage flags.
+ */
+ #define AttrUsage_Assembly 0x0001
+ #define AttrUsage_Module 0x0002
+ #define AttrUsage_Class 0x0004
+ #define AttrUsage_Struct 0x0008
+ #define AttrUsage_Enum 0x0010
+ #define AttrUsage_Constructor 0x0020
+ #define AttrUsage_Method 0x0040
+ #define AttrUsage_Property 0x0080
+ #define AttrUsage_Field 0x0100
+ #define AttrUsage_Event 0x0200
+ #define AttrUsage_Interface 0x0400
+ #define AttrUsage_Parameter 0x0800
+ #define AttrUsage_Delegate 0x1000
+ #define AttrUsage_ReturnValue 0x2000
+ #define AttrUsage_All 0x3FFF
+ #define AttrUsage_ClassMembers 0x17FC
+
+ /*
+ * Append an attribute usage target value to a string.
+ */
+ static char *AppendAttrUsage(char *name, ILInt32 targets)
+ {
+ int needOr = 0;
+
+ /* Handle the easy case first */
+ if(targets == AttrUsage_All)
+ {
+ return AppendString(name, "AttributeTargets.All");
+ }
+
+ /* Add the active flag names */
+ #define AttrUsage(flag,flagName) \
+ do { \
+ if((targets & (flag)) != 0) \
+ { \
+ if(needOr) \
+ { \
+ name = AppendString(name, " | "); \
+ } \
+ else \
+ { \
+ needOr = 1; \
+ } \
+ name = AppendString(name, "AttributeTargets."
flagName); \
+ } \
+ } while (0)
+ AttrUsage(AttrUsage_Assembly, "Assembly");
+ AttrUsage(AttrUsage_Module, "Module");
+ AttrUsage(AttrUsage_Class, "Class");
+ AttrUsage(AttrUsage_Struct, "Struct");
+ AttrUsage(AttrUsage_Enum, "Enum");
+ AttrUsage(AttrUsage_Constructor, "Constructor");
+ AttrUsage(AttrUsage_Method, "Method");
+ AttrUsage(AttrUsage_Property, "Property");
+ AttrUsage(AttrUsage_Field, "Field");
+ AttrUsage(AttrUsage_Event, "Event");
+ AttrUsage(AttrUsage_Interface, "Interface");
+ AttrUsage(AttrUsage_Parameter, "Parameter");
+ AttrUsage(AttrUsage_Delegate, "Delegate");
+ AttrUsage(AttrUsage_ReturnValue, "ReturnValue");
+ return name;
+ }
+
+ /*
* Append an attribute value to a name. Returns NULL
* if the value is invalid.
*/
! static char *AppendAttrValue(char *name, ILSerializeReader *reader,
! int type, int isUsage)
{
ILInt32 intValue;
***************
*** 1065,1069 ****
{
intValue = ILSerializeReaderGetInt32(reader, type);
! sprintf(buffer, "%ld", (long)intValue);
}
break;
--- 1132,1143 ----
{
intValue = ILSerializeReaderGetInt32(reader, type);
! if(!isUsage)
! {
! sprintf(buffer, "%ld", (long)intValue);
! }
! else
! {
! return AppendAttrUsage(name, intValue);
! }
}
break;
***************
*** 1162,1166 ****
{
name = AppendAttrValue(name, reader,
!
type & ~IL_META_SERIALTYPE_ARRAYOF);
if(!name)
{
--- 1236,1241 ----
{
name = AppendAttrValue(name, reader,
!
type & ~IL_META_SERIALTYPE_ARRAYOF,
!
0);
if(!name)
{
***************
*** 1206,1209 ****
--- 1281,1285 ----
const char *memberName;
int memberNameLen;
+ int isUsage;
/* Get the attribute constructor and validate it */
***************
*** 1229,1232 ****
--- 1305,1312 ----
}
+ /* We need special handling for the first parameter of
+ the "AttributeUsage" attribute */
+ isUsage = (!strcmp(name, "AttributeUsageAttribute"));
+
/* Get the attribute value and prepare to parse it */
value = ILAttributeGetValue(attr, &len);
***************
*** 1261,1265 ****
return 0;
}
! name = AppendAttrValue(name, reader, type);
if(!name)
{
--- 1341,1345 ----
return 0;
}
! name = AppendAttrValue(name, reader, type, isUsage);
if(!name)
{
***************
*** 1297,1301 ****
ILMemCpy(name + posn, memberName, memberNameLen);
strcpy(name + posn + memberNameLen, "=");
! name = AppendAttrValue(name, reader, type);
if(!name)
{
--- 1377,1381 ----
ILMemCpy(name + posn, memberName, memberNameLen);
strcpy(name + posn + memberNameLen, "=");
! name = AppendAttrValue(name, reader, type, 0);
if(!name)
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnet/csdoc doc_valil.c,1.8,1.9,
Rhys Weatherley <address@hidden> <=