|
|
6.46 CType
- Defined in namespace Smalltalk
- Category: Language-C interface
- I am not part of the standard Smalltalk kernel class hierarchy.
I contain type information used by subclasses of CObject, which represents
external C data items.
My only instance variable, cObjectType, is used to hold onto the CObject
subclass that gets created for a given CType. Used primarily in the C part
of the interpreter because internally it cannot execute methods to get values,
so it has a simple way to access instance variable which holds the desired
subclass.
My subclasses have instances which represent the actual data types; for the
scalar types, there is only one instance created of each, but for the
aggregate types, there is at least one instance per base type and/or number of
elements.
6.46.1 CType class: C instance creation
- cObjectType: aCObjectSubclass
- Create a new CType for the given subclass of CObject
6.46.2 CType: accessing
- alignof
- Answer the size of the receiver's instances
- arrayType: size
- Answer a CArrayCType which represents an array with the given size of CObjects whose type is in turn represented by the receiver
- cObjectType
- Answer the CObject subclass whose instance is created when new is sent to the receiver
- ptrType
- Answer a CPtrCType which represents a pointer to CObjects whose type is in turn represented by the receiver
- sizeof
- Answer the size of the receiver's instances
- valueType
- valueType is used as a means to communicate to the interpreter the underlying type of the data. For anything but scalars, it's just 'self'
6.46.3 CType: C instance creation
- address: cObjOrInt
- Create a new CObject with the type (class) identified by the receiver, pointing to the given address (identified by an Integer or CObject).
- new
- Allocate a new CObject with the type (class) identified by the receiver. It is the caller's responsibility to free the memory allocated for it.
6.46.4 CType: storing
- storeOn: aStream
- Store Smalltalk code that compiles to the receiver
|