Revision [233]

This is an old revision of ObjectiveC made by JohnMcIntosh on 2008-10-17 21:31:29.

 

This is the third attempt at having an objective-C bridge in Squeak. Historically there is one written by Marcel Weiher, and another by Avi Brant
This plugin does work on the carbon os-x VM (3.18.x) which makes testing easier, however much of the iPhone specific features are
not available under OS-X.

The goal of this plugin was to have it coded entirely in slang and minimize the amount of code that is actually in the plugin. In general
only a handful of people actually build plugins, so the process of updating that code for fixes or enhancements is slow. If the majority
of the code is in Smalltalk then it's easier for anyone to submit a fix or enhancement to the MC server.

On the Smalltalk side a decision was made to use ProtoObject as the super class. This was a bit troublesome because it required
bringing down a large number of methods from Object to make an objective-c class/subclass to work. These methods include:

('printing' longPrintOn:limitedTo:indent: longPrintStringLimitedTo: printOn: printString printStringLimitedTo:)
and
('smalltalk methods' asExplorerString defaultLabelForInspector error: halt inspect inspectorClass instVarAt: isKindOf: isMorph isNumber isString primitiveFailed smalltalkClass)

The ObjectiveCObject class contains one instance variable externalAddress which is the address of the Objective-C object.
We note at shutdown time if quitting all instances and subinstances of ObjectiveCObject have their externalAddress to zero.
If the address is zero and an attempt is made to use it as a valid Objective C address then a walkback will occur.

a small number of accessors is available.
descriptionAsString - Invoke description against the Objective-C object and return the result as a smalltalk string
externalAddress - access the address with error check for zero
externalAddressPrivate - PRIVATE access the address with no error check, do not use this
externalAddress: - Set the address of the Objective-C object
objectiveCClass - Return the class of the object, we note asking the object for class will give you the smalltalk class.
objectiveCHash - Return the Objective-C hash
objectiveCSuperClass - Return the Objective-C super class

Compare:
= - Return false if not the same class, otherwise return true if the same address, or invoke isEqual:to:
hash - Return the objective-C hash, if the object is nil then return hash of the ObjectiveC NSNull singleton

NEED STARTUP

Other methods implemented were:

('testing' ifNil: ifNil:ifNotNil: ifNotNil: ifNotNil:ifNil: isNil isObjectiveCObject)

Which check to see if the



ObjectiveCBridge
ObjectiveCNSMethodSignature
ObjectiveCNSNull
ObjectiveCObject
ObjectiveCSEL
There are 3 comments on this page. [Show comments]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki