moo/stix/kernel/Apex.st

234 lines
3.9 KiB
Smalltalk
Raw Normal View History

#class Apex(nil)
{
#dcl(#class) sysdic.
## -------------------------------------------------------
## -------------------------------------------------------
#method(#class) dump
{
2015-10-15 14:40:08 +00:00
<primitive: #_dump>
}
#method dump
{
2015-10-15 14:40:08 +00:00
<primitive: #_dump>
}
## -------------------------------------------------------
## -------------------------------------------------------
#method(#class) yourself
{
^self.
}
#method yourself
{
^self.
}
## -------------------------------------------------------
## -------------------------------------------------------
2015-10-15 14:40:08 +00:00
#method(#class) basicNew
{
2015-10-15 14:40:08 +00:00
<primitive: #_basic_new>
self primitiveFailed.
}
2015-10-15 14:40:08 +00:00
#method(#class) basicNew: anInteger
{
2015-10-15 14:40:08 +00:00
<primitive: #_basic_new_with_size>
self primitiveFailed.
}
2015-10-15 14:40:08 +00:00
#method(#class) new
{
| x |
x := self basicNew.
x initialize. "TODO: assess if it's good to call 'initialize' from new."
^x.
}
#method(#class) new: anInteger
{
| x |
x := self basicNew: anInteger.
x initialize. "TODO: assess if it's good to call 'initialize' from new."
^x.
}
#method initialize
{
"a subclass may override this method."
^self.
}
## -------------------------------------------------------
## -------------------------------------------------------
#method class
{
2015-10-15 14:40:08 +00:00
<primitive: #_class>
}
#method(#class) class
{
2015-10-15 14:40:08 +00:00
<primitive: #_class>
^Class
}
## -------------------------------------------------------
## -------------------------------------------------------
#method basicSize
{
2015-10-15 14:40:08 +00:00
<primitive: #_basic_size>
self primitiveFailed.
}
#method(#class) basicSize
{
<primitive: #_basic_size>
self primitiveFailed.
}
#method basicAt: anInteger
{
2015-10-15 14:40:08 +00:00
<primitive: #_basic_at>
self error: 'out of range'.
}
#method basicAt: anInteger put: anObject
{
2015-10-15 14:40:08 +00:00
<primitive: #_basic_at_put>
self error: 'out of range'.
}
#method(#class) basicAt: anInteger
{
2015-10-15 14:40:08 +00:00
<primitive: #_basic_at>
self error: 'out of range'.
}
#method(#class) basicAt: anInteger put: anObject
{
2015-10-15 14:40:08 +00:00
<primitive: #_basic_at_put>
self error: 'out of range'.
}
## -------------------------------------------------------
## -------------------------------------------------------
#method == anObject
{
"check if the receiver is identical to anObject.
this doesn't compare the contents"
2015-10-15 14:40:08 +00:00
<primitive: #_identical>
}
#method ~~ anObject
{
2015-10-15 14:40:08 +00:00
<primitive: #_not_identical>
^(self == anObject) not.
}
#method(#class) == anObject
{
"check if the receiver is identical to anObject.
this doesn't compare the contents"
2015-10-15 14:40:08 +00:00
<primitive: #_identical>
}
#method(#class) ~~ anObject
{
2015-10-15 14:40:08 +00:00
<primitive: #_not_identical>
^(self == anObject) not.
}
## TODO: add = and ~= for equality check.
#method isNil
{
"^self == nil."
^false
}
#method notNil
{
"^(self == nil) not"
"^self ~= nil."
^true.
}
#method(#class) isNil
{
"^self == nil."
^false
}
#method(#class) notNil
{
"^(self == nil) not"
"^self ~= nil."
^true.
}
## -------------------------------------------------------
## -------------------------------------------------------
"
#method(#class) respondsTo: selectorSymbol
{
TODO: find selectorSymbol in the class method dictionary...
}
#method respondsTo: selectorSymbol
{
TODO: find selectorSymbol in the method dictionary...
}
"
## -------------------------------------------------------
## -------------------------------------------------------
#method(#class) primitiveFailed
{
## TODO: implement this
## PrimitiveFailureError signal.
'primitive failed' dump.
}
#method primitiveFailed
{
self class primitiveFailed.
}
#method(#class) doesNotUnderstand: messageSymbol
{
## TODO: implement this
## UnrecognizedMessage signal.
'does not understand' dump.
}
#method doesNotUnderstand: messageSymbol
{
self class doesNotUnderstand: messageSymbol
}
#method(#class) error: msgText
{
## TODO: implement this
## Error signal: msgText.
msgText dump.
}
#method error: aString
{
self class error: aString.
}
}