- Updates to latest GCC XML that apparently reports structure sizes in bits instead of bytes.
--- a/Cface__CDefinitionParser.st Fri Sep 07 23:35:53 2012 +0000
+++ b/Cface__CDefinitionParser.st Mon Sep 10 10:23:27 2012 +0000
@@ -153,7 +153,7 @@
""("" ""struct"" [ <name> ] 'name' "":size"" <number> 'size' StructField* 'fields' "")""
{ CStructNode new
cName:(name ifNotNil:[name value]);
- cByteSize: size value asNumber;
+ cBitSize: size value asNumber;
fields:fields;
foreign:false
@@ -161,7 +161,7 @@
| ""("" ""struct-foreign"" [ <name> ] 'name' "":size"" <number> 'size' StructField* 'fields' "")""
{ CStructNode new
cName:(name ifNotNil:[name value]);
- cByteSize: size value asNumber;
+ cBitSize: size value asNumber;
fields:fields;
foreign:true
@@ -172,14 +172,14 @@
""("" ""union"" [ <name> ] 'name' "":size"" <number> 'size' StructField* 'fields' "")""
{ CUnionNode new
cName:(name ifNotNil:[name value]);
- cByteSize: size value asNumber;
+ cBitSize: size value asNumber;
fields:fields;
foreign: false
}
| ""("" ""union-foreign"" [ <name> ] 'name' "":size"" <number> 'size' StructField* 'fields' "")""
{ CUnionNode new
cName:(name ifNotNil:[name value]);
- cByteSize: size value asNumber;
+ cBitSize: size value asNumber;
fields:fields;
foreign:true
}
@@ -261,7 +261,7 @@
!
startingStateForDefinitionFile
- ^2
+ ^1
! !
!CDefinitionParser methodsFor:'accessing'!
@@ -1025,7 +1025,7 @@
reduceActionForStruct1:nodes
^ (CStructNode new)
cName:((nodes at:3) ifNotNil:[ (nodes at:3) value ]);
- cByteSize:(nodes at:5) value asNumber;
+ cBitSize:(nodes at:5) value asNumber;
fields:(nodes at:6);
foreign:false
!
@@ -1033,7 +1033,7 @@
reduceActionForStruct2:nodes
^ (CStructNode new)
cName:((nodes at:3) ifNotNil:[ (nodes at:3) value ]);
- cByteSize:(nodes at:5) value asNumber;
+ cBitSize:(nodes at:5) value asNumber;
fields:(nodes at:6);
foreign:true
!
@@ -1207,7 +1207,7 @@
reduceActionForUnion1:nodes
^ (CUnionNode new)
cName:((nodes at:3) ifNotNil:[ (nodes at:3) value ]);
- cByteSize:(nodes at:5) value asNumber;
+ cBitSize:(nodes at:5) value asNumber;
fields:(nodes at:6);
foreign:false
!
@@ -1215,7 +1215,7 @@
reduceActionForUnion2:nodes
^ (CUnionNode new)
cName:((nodes at:3) ifNotNil:[ (nodes at:3) value ]);
- cByteSize:(nodes at:5) value asNumber;
+ cBitSize:(nodes at:5) value asNumber;
fields:(nodes at:6);
foreign:true
!
--- a/Cface__CStructuredNode.st Fri Sep 07 23:35:53 2012 +0000
+++ b/Cface__CStructuredNode.st Mon Sep 10 10:23:27 2012 +0000
@@ -3,7 +3,7 @@
"{ NameSpace: Cface }"
CDerivedTypeNode subclass:#CStructuredNode
- instanceVariableNames:'cByteSize fields'
+ instanceVariableNames:'cBitSize fields ffiPointerTypeSymbol'
classVariableNames:''
poolDictionaries:''
category:'Cface-C AST'
@@ -12,20 +12,38 @@
!CStructuredNode methodsFor:'accessing'!
+cBitSize
+ ^ cBitSize
+
+ "Created: / 10-09-2012 / 10:02:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+cBitSize:anInteger
+ cBitSize := anInteger
+
+ "Created: / 10-09-2012 / 10:01:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
cByteSize
- ^ cByteSize
+ ^ cBitSize // 8
"Created: / 09-09-2008 / 16:49:58 / Jan Vrany <vranyj1@fel.cvut.cz>"
+ "Modified: / 10-09-2012 / 10:02:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
cByteSize:anInteger
- cByteSize := anInteger.
+ cBitSize := anInteger * 8
"Created: / 09-09-2008 / 16:49:58 / Jan Vrany <vranyj1@fel.cvut.cz>"
+ "Modified: / 10-09-2012 / 10:02:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
ffiPointerTypeSymbol
+ ffiPointerTypeSymbol notNil ifTrue:[
+ ^ffiPointerTypeSymbol
+ ].
+
^smalltalkName notNil ifTrue:[
self smalltalkClassNameWithNamespace
] ifFalse:[
@@ -35,6 +53,10 @@
"Created: / 18-07-2011 / 16:44:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
+ffiPointerTypeSymbol:aSymbol
+ ffiPointerTypeSymbol := aSymbol.
+!
+
ffiTypeSymbol
^ self shouldNotImplement
--- a/Cface__Libgit2Mapping.st Fri Sep 07 23:35:53 2012 +0000
+++ b/Cface__Libgit2Mapping.st Mon Sep 10 10:23:27 2012 +0000
@@ -55,12 +55,43 @@
!Libgit2Mapping methodsFor:'mapping - class names'!
+smalltalkClassNameForEnum:cEnum
+
+ cEnum cName = 'git_otype' ifTrue:[
+ ^#GitObjectType
+ ].
+
+ cEnum cName = 'git_error_t' ifTrue:[
+ ^#GitErrorCode
+ ].
+
+ ^ self smalltalkClassNameForDerivedType:cEnum
+
+ "Answers class which should contain function call"
+
+ "Created: / 10-09-2012 / 09:30:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
smalltalkClassNameForFunction:cFunction
"Answers class which should contain function call"
^#GitPrimitives
"Created: / 07-09-2012 / 15:04:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+smalltalkClassNameForStruct:cStruct
+
+ "Make GitOid a pure byte array to reduce stress on GC"
+ cStruct cName = '_git_oid' ifTrue:[
+ cStruct ffiPointerTypeSymbol:#charPointer.
+ ].
+
+ ^ self smalltalkClassNameForDerivedType:cStruct
+
+ "Answers class which should contain function call"
+
+ "Created: / 10-09-2012 / 10:31:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!Libgit2Mapping methodsFor:'mapping - selectors'!
--- a/Cface__SmalltalkXGenerator.st Fri Sep 07 23:35:53 2012 +0000
+++ b/Cface__SmalltalkXGenerator.st Mon Sep 10 10:23:27 2012 +0000
@@ -147,14 +147,16 @@
^String streamContents:
[:s|
s
- nextPutAll: 'structSize'; cr; cr;
+ nextPutAll: 'structSize'; cr;
+ tab4; nextPutAll:'"Returns size of undelaying structure in bytes"'; cr;
+ cr;
tab4;
nextPutAll: '^';
nextPutAll: size printString
]
"Created: / 09-09-2008 / 17:12:01 / Jan Vrany <vranyj1@fel.cvut.cz>"
- "Modified: / 05-09-2012 / 11:48:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 10-09-2012 / 10:09:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!SmalltalkXGenerator methodsFor:'visiting'!
--- a/Cface__TypeMapping.st Fri Sep 07 23:35:53 2012 +0000
+++ b/Cface__TypeMapping.st Mon Sep 10 10:23:27 2012 +0000
@@ -86,29 +86,24 @@
!
smalltalkCategoryForEnum: enum
-
- ^self smalltalkNamespace , '-Constants'
-
- "Answers class which should contain function call"
+ ^ self smalltalkCategoryForDerivedType:enum
"Created: / 10-07-2008 / 08:07:31 / Jan Vrany <vranyj1@fel.cvut.cz>"
- "Modified: / 30-05-2012 / 21:59:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 10-09-2012 / 09:35:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
smalltalkCategoryForStruct:struct
^ self smalltalkCategoryForDerivedType:struct
- "Answers class which should contain function call"
-
"Created: / 10-07-2008 / 08:07:12 / Jan Vrany <vranyj1@fel.cvut.cz>"
+ "Modified (comment): / 10-09-2012 / 09:35:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
smalltalkCategoryForUnion:union
^ self smalltalkCategoryForDerivedType:union
- "Answers class which should contain function call"
-
"Created: / 10-07-2008 / 08:06:05 / Jan Vrany <vranyj1@fel.cvut.cz>"
+ "Modified (comment): / 10-09-2012 / 09:35:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!TypeMapping methodsFor:'mapping - class names'!
--- a/cface.rc Fri Sep 07 23:35:53 2012 +0000
+++ b/cface.rc Mon Sep 10 10:23:27 2012 +0000
@@ -25,7 +25,7 @@
VALUE "LegalCopyright", "Copyright 2008 Jan Vrany\0"
VALUE "ProductName", "CairoGraphics\0"
VALUE "ProductVersion", "6.2.3.1\0"
- VALUE "ProductDate", "Fri, 07 Sep 2012 23:35:45 GMT\0"
+ VALUE "ProductDate", "Mon, 10 Sep 2012 10:23:31 GMT\0"
END
END