--- a/ExternalStructure.st Tue Feb 04 21:09:59 2014 +0100
+++ b/ExternalStructure.st Wed Apr 01 10:20:10 2015 +0100
@@ -11,6 +11,8 @@
"
"{ Package: 'stx:libbasic' }"
+"{ NameSpace: Smalltalk }"
+
ExternalBytes subclass:#ExternalStructure
instanceVariableNames:''
classVariableNames:''
@@ -66,7 +68,6 @@
"
! !
-
!ExternalStructure class methodsFor:'instance creation'!
fromExternalAddress:anExternalAddress
@@ -108,22 +109,43 @@
^ super unprotectedNew:(self sizeof)
! !
-
!ExternalStructure class methodsFor:'queries'!
cType
^ cType
!
+fields
+ "for Squeak compatibility support: may return a literal array structure definition,
+ from which the size and layout of the fields can be constructed.
+ Returns nil for ST/X subclasses, which redefine the sizeof method"
+
+ ^ nil
+!
+
sizeof
"the sizeof my instances in bytes"
+ cType isNil ifTrue:[
+ "/ second chance for Squeak external structures
+ self fields notNil ifTrue:[
+ self generateCTypeFromFieldDescription:self fields.
+ ].
+ ].
cType notNil ifTrue:[
^ cType sizeof
].
self subclassResponsibility
! !
+!ExternalStructure class methodsFor:'utilities'!
+
+generateCTypeFromFieldDescription:fieldsSpec
+ "to support Squeak external structures, which define a fields method,
+ which returns a literal array spec of fields"
+
+ self halt.
+! !
!ExternalStructure methodsFor:'private'!
@@ -131,18 +153,13 @@
self setAddress:(anExternalAddress address) size:(anExternalAddress size).
! !
-
!ExternalStructure class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/ExternalStructure.st,v 1.5 2013-01-28 18:04:13 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/ExternalStructure.st,v 1.6 2015-02-09 11:52:18 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/ExternalStructure.st,v 1.5 2013-01-28 18:04:13 cg Exp $'
-!
-
-version_SVN
- ^ '$Id: ExternalStructure.st 10761 2012-01-19 11:46:00Z vranyj1 $'
+ ^ '$Header: /cvs/stx/stx/libbasic/ExternalStructure.st,v 1.6 2015-02-09 11:52:18 cg Exp $'
! !