Back: CStruct class-subclass creation Up: Base classes Forward: CType class-C instance creation   Top: GNU Smalltalk Library Reference Contents: Table of Contents Index: Class index About: About this document

1.51 CType

Defined in namespace Smalltalk
Superclass: Object
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.

1.51.1 CType class: C instance creation  (class)
1.51.2 CType class: initialization  (class)
1.51.3 CType: accessing  (instance)
1.51.4 CType: basic  (instance)
1.51.5 CType: C instance creation  (instance)
1.51.6 CType: storing  (instance)


1.51.1 CType class: C instance creation

cObjectBinding: aCObjectSubclassBinding
Create a new CType for the given subclass of CObject

cObjectType: aCObjectSubclass
Create a new CType for the given subclass of CObject

computeAggregateType: type
Private - Called by from: for pointers/arrays. Format of type: (#array #int 3) or (#ptr #{FooStruct})

from: type
Private - Pass the size, alignment, and description of CType for aBlock, given the field description in `type' (the second element of each pair).


1.51.2 CType class: initialization

initialize
Initialize the receiver's TypeMap


1.51.3 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

new: anInteger
Allocate a new CObject with room for anInteger C objects of the type (class) identified by the receiver. It is the caller's responsibility to free the memory allocated for it.

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'


1.51.4 CType: basic

= anObject
Return whether the receiver and anObject are equal.

hash
Return a hash code for the receiver.


1.51.5 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).

gcNew
Allocate a new CObject with the type (class) identified by the receiver. The object is movable in memory, but on the other hand it is garbage-collected automatically.

gcNew: anInteger
Allocate a new CObject with room for anInteger C object of the type (class) identified by the receiver. The object is movable in memory, but on the other hand it is garbage-collected automatically.

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.


1.51.6 CType: storing

storeOn: aStream
Store Smalltalk code that compiles to the receiver



Back: CType-C instance creation Up: CType Forward: CUChar   Top: GNU Smalltalk Library Reference Contents: Table of Contents Index: Class index About: About this document


This document was generated on April, 16 2013 using texi2html