dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: pnet/cscc/c c_types.c,1.34,1.35


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnet/cscc/c c_types.c,1.34,1.35
Date: Fri, 27 Jun 2003 22:10:57 -0400

Update of /cvsroot/dotgnu-pnet/pnet/cscc/c
In directory subversions:/tmp/cvs-serv32097/cscc/c

Modified Files:
        c_types.c 
Log Message:


Clone bit-field declarations when a struct type is cloned.


Index: c_types.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/c/c_types.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -r1.34 -r1.35
*** c_types.c   26 Jun 2003 07:05:47 -0000      1.34
--- c_types.c   28 Jun 2003 02:10:54 -0000      1.35
***************
*** 974,983 ****
   */
  static void BitFieldAdd(ILGenInfo *info, ILClass *classInfo,
!                                               const char *fieldName, const 
char *storageName,
                                                ILUInt32 posn, ILUInt32 numBits)
  {
        unsigned char fieldHeader[IL_META_COMPRESS_MAX_SIZE];
        unsigned char storageHeader[IL_META_COMPRESS_MAX_SIZE];
-       unsigned long fieldLen, storageLen;
        int fieldHeaderLen, storageHeaderLen;
        unsigned long totalLen;
--- 974,985 ----
   */
  static void BitFieldAdd(ILGenInfo *info, ILClass *classInfo,
!                                               const char *fieldName,
!                                               unsigned long fieldLen,
!                                               const char *storageName,
!                                               unsigned long storageLen,
                                                ILUInt32 posn, ILUInt32 numBits)
  {
        unsigned char fieldHeader[IL_META_COMPRESS_MAX_SIZE];
        unsigned char storageHeader[IL_META_COMPRESS_MAX_SIZE];
        int fieldHeaderLen, storageHeaderLen;
        unsigned long totalLen;
***************
*** 986,992 ****
  
        /* Determine the total length of the attribute value */
-       fieldLen = strlen(fieldName);
        fieldHeaderLen = ILMetaCompressData(fieldHeader, fieldLen);
-       storageLen = strlen(storageName);
        storageHeaderLen = ILMetaCompressData(storageHeader, storageLen);
        totalLen = 12 + fieldHeaderLen + fieldLen + storageHeaderLen + 
storageLen;
--- 988,992 ----
***************
*** 1099,1104 ****
                        posn -= numBits;
                }
!               BitFieldAdd(info, classInfo, fieldName,
!                                       ILField_Name(field), posn, numBits);
        }
  
--- 1099,1105 ----
                        posn -= numBits;
                }
!               BitFieldAdd(info, classInfo, fieldName, strlen(fieldName),
!                                       ILField_Name(field), 
strlen(ILField_Name(field)),
!                                       posn, numBits);
        }
  
***************
*** 1354,1357 ****
--- 1355,1371 ----
        ILFieldLayout *flayout;
        ILClassLayout *clayout;
+       ILMethod *ctor;
+       ILAttribute *attr;
+       const void *blob;
+       unsigned long blobLen;
+       ILSerializeReader *reader;
+       const char *str;
+       int slen;
+       const char *fieldName;
+       unsigned long fieldLen;
+       const char *storageName;
+       unsigned long storageLen;
+       ILUInt32 bitFieldStart;
+       ILUInt32 bitFieldSize;
  
        /* Clone the fields */
***************
*** 1380,1384 ****
  
        /* Clone the bit field declarations */
!       /* TODO */
  
        /* Clone the class layout information */
--- 1394,1462 ----
  
        /* Clone the bit field declarations */
!       ctor = BitFieldCtor(info);
!       attr = 0;
!       while((attr = ILProgramItemNextAttribute(ILToProgramItem(src), attr)) 
!= 0)
!       {
!               /* Skip this attribute if it is not "BitFieldAttribute" */
!               if(ILAttributeTypeAsItem(attr) != ILToProgramItem(ctor))
!               {
!                       continue;
!               }
! 
!               /* Extract the bit field definition's parameters */
!               blob = ILAttributeGetValue(attr, &blobLen);
!               if(!blob)
!               {
!                       continue;
!               }
!               reader = ILSerializeReaderInit(ctor, blob, blobLen);
!               if(!reader)
!               {
!                       continue;
!               }
!               if(ILSerializeReaderGetParamType(reader) != 
IL_META_SERIALTYPE_STRING)
!               {
!                       ILSerializeReaderDestroy(reader);
!                       continue;
!               }
!               if((slen = ILSerializeReaderGetString(reader, &str)) < 0)
!               {
!                       ILSerializeReaderDestroy(reader);
!                       continue;
!               }
!               fieldName = str;
!               fieldLen = (unsigned long)(long)slen;
!               if(ILSerializeReaderGetParamType(reader) != 
IL_META_SERIALTYPE_STRING)
!               {
!                       ILSerializeReaderDestroy(reader);
!                       continue;
!               }
!               if((slen = ILSerializeReaderGetString(reader, &str)) < 0)
!               {
!                       ILSerializeReaderDestroy(reader);
!                       continue;
!               }
!               storageName = str;
!               storageLen = (unsigned long)(long)slen;
!               if(ILSerializeReaderGetParamType(reader) != 
IL_META_SERIALTYPE_I4)
!               {
!                       ILSerializeReaderDestroy(reader);
!                       continue;
!               }
!               bitFieldStart = (ILUInt32)(ILSerializeReaderGetInt32
!                       (reader, IL_META_SERIALTYPE_I4));
!               if(ILSerializeReaderGetParamType(reader) != 
IL_META_SERIALTYPE_I4)
!               {
!                       ILSerializeReaderDestroy(reader);
!                       continue;
!               }
!               bitFieldSize = (ILUInt32)(ILSerializeReaderGetInt32
!                       (reader, IL_META_SERIALTYPE_I4));
!               ILSerializeReaderDestroy(reader);
! 
!               /* Create a new bit field declaration on the cloned copy */
!               BitFieldAdd(info, dest, fieldName, fieldLen,
!                                       storageName, storageLen, bitFieldStart, 
bitFieldSize);
!       }
  
        /* Clone the class layout information */





reply via email to

[Prev in Thread] Current Thread [Next in Thread]