--- a/Array.st Thu May 12 04:07:15 1994 +0200
+++ b/Array.st Tue May 17 12:09:46 1994 +0200
@@ -22,16 +22,22 @@
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
-Arrays store general objects; the size is fixed, so add/remove is not
-allowed. Access to the elements is via an Integer index. Since Arrays
-are used very often in the system, some methods have been tuned by
-reimplementation as primitive.
-
-$Header: /cvs/stx/stx/libbasic/Array.st,v 1.9 1994-02-05 12:09:08 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Array.st,v 1.10 1994-05-17 10:06:25 claus Exp $
written spring 89 by claus
'!
+!Array class methodsFor:'documentation'!
+
+documentation
+"
+ Arrays store general objects; the size is fixed, so add/remove is not
+ allowed. Access to the elements is via an Integer index. Since Arrays
+ are used very often in the system, some methods have been tuned by
+ reimplementation as primitive.
+"
+! !
+
!Array class methodsFor:'queries'!
isBuiltInClass
@@ -42,7 +48,7 @@
!Array methodsFor:'accessing'!
-size
+basicSize
"return the number of indexed elements in the receiver"
%{ /* NOCONTEXT */
@@ -51,7 +57,7 @@
%}
!
-at:index
+basicAt:index
"return the indexed instance variable with index, anInteger
- added here for speed"
@@ -74,10 +80,10 @@
}
%}
.
- ^ super at:index
+ ^ super basicAt:index
!
-at:index put:anObject
+basicAt:index put:anObject
"store the 2nd arg, anObject as indexed instvar with index, anInteger.
- added here for speed"
@@ -102,7 +108,7 @@
}
%}
.
- ^ super at:index put:anObject
+ ^ super basicAt:index put:anObject
! !
!Array methodsFor:'converting'!
@@ -305,7 +311,6 @@
%{
REGISTER int index;
int nIndex;
- extern OBJ __eq;
static struct inlineCache eq = _ILC1;
nIndex = (_qSize(self) - OHDR_SIZE) / sizeof(OBJ);
@@ -316,7 +321,10 @@
while (index < nIndex) {
element = _InstPtr(self)->i_instvars[index++];
if (element != nil) {
- if ((*eq.ilc_func)(anObject,__eq, CON_COMMA nil,&eq,element)==true) {
+ if ((*eq.ilc_func)(anObject,
+ @symbol(=),
+ CON_COMMA nil,&eq,
+ element)==true) {
RETURN ( true );
}
}
@@ -334,7 +342,6 @@
%{
REGISTER int index;
int nIndex, nInsts;
- extern OBJ __eq;
static struct inlineCache eq = _ILC1;
if (_isSmallInteger(start)) {
@@ -348,7 +355,10 @@
element = _InstPtr(self)->i_instvars[index++];
if (element != nil) {
if ((element == anElement)
- || ((*eq.ilc_func)(anElement,__eq, CON_COMMA nil,&eq,element) == true)) {
+ || ((*eq.ilc_func)(anElement,
+ @symbol(=),
+ CON_COMMA nil,&eq,
+ element) == true)) {
RETURN ( _MKSMALLINT(index - nInsts) );
}
}
@@ -407,12 +417,29 @@
"return true, if the receiver can be used as a literal
(i.e. can be used in constant arrays)"
+ thisContext isRecursive ifTrue:[^ false].
+
self do:[:element |
element isLiteral ifFalse:[^ false]
].
^ true
!
+displayString
+ "return a printed representation of the receiver for displaying"
+
+ |s|
+
+ self isLiteral ifTrue:[
+ s := WriteStream on:String new.
+ s nextPutAll:'#('.
+ self do:[:element | s nextPutAll:element displayString. s space].
+ s nextPutAll:')'.
+ ^ s contents
+ ].
+ ^ super displayString
+!
+
storeOn:aStream
"append a printed representation of the receiver to aStream,
which allows reconstructing it via readFrom:.
@@ -438,7 +465,7 @@
REGISTER OBJFUNC codeVal;
REGISTER int index;
int nIndex;
- extern OBJ _value_, Block;
+ extern OBJ Block;
static struct inlineCache val = _ILC1;
REGISTER OBJ rHome;
@@ -477,8 +504,10 @@
for (; index < nIndex; index++) {
if (InterruptPending != nil) interruptL(__LINE__ COMMA_CON);
- (*val.ilc_func)(aBlock, _value_, CON_COMMA nil, &val,
- _InstPtr(self)->i_instvars[index]);
+ (*val.ilc_func)(aBlock,
+ @symbol(value:),
+ CON_COMMA nil, &val,
+ _InstPtr(self)->i_instvars[index]);
}
}
%}
@@ -495,7 +524,7 @@
REGISTER OBJFUNC codeVal;
REGISTER int index;
int nIndex, endIndex;
- extern OBJ _value_, Block;
+ extern OBJ Block;
static struct inlineCache val = _ILC1;
endIndex = _intVal(_ClassInstPtr(_qClass(self))->c_ninstvars);
@@ -518,8 +547,10 @@
} else {
for (index=nIndex=1; index >= endIndex; index--) {
if (InterruptPending != nil) interruptL(__LINE__ COMMA_CON);
- (*val.ilc_func)(aBlock, _value_, CON_COMMA nil, &val,
- _InstPtr(self)->i_instvars[index]);
+ (*val.ilc_func)(aBlock,
+ @symbol(value:),
+ CON_COMMA nil, &val,
+ _InstPtr(self)->i_instvars[index]);
}
}
%}
@@ -538,7 +569,7 @@
REGISTER int index;
REGISTER OBJ rHome;
int nIndex, nInsts;
- extern OBJ _value_, Block;
+ extern OBJ Block;
static struct inlineCache val = _ILC1;
int indexLow, indexHigh;
@@ -582,7 +613,10 @@
for (index=indexLow; index <= indexHigh; index++) {
if (InterruptPending != nil) interruptL(__LINE__ COMMA_CON);
element = _InstPtr(self)->i_instvars[index];
- (*val.ilc_func) (aBlock, _value_, CON_COMMA nil, &val, element);
+ (*val.ilc_func) (aBlock,
+ @symbol(value:),
+ CON_COMMA nil, &val,
+ element);
}
}
}
@@ -605,7 +639,7 @@
REGISTER int index;
REGISTER OBJ rHome;
int nIndex, nInsts;
- extern OBJ _value_, Block;
+ extern OBJ Block;
static struct inlineCache val = _ILC1;
int indexLow, indexHigh;
@@ -649,7 +683,10 @@
for (index=indexHigh; index >= indexLow; index--) {
if (InterruptPending != nil) interruptL(__LINE__ COMMA_CON);
element = _InstPtr(self)->i_instvars[index];
- (*val.ilc_func) (aBlock, _value_, CON_COMMA nil, &val, element);
+ (*val.ilc_func) (aBlock,
+ @symbol(value:),
+ CON_COMMA nil, &val,
+ element);
}
}
}
@@ -669,7 +706,7 @@
REGISTER OBJFUNC codeVal;
REGISTER int index;
int nIndex;
- extern OBJ _value_, Block;
+ extern OBJ Block;
static struct inlineCache val = _ILC1;
index = _intVal(_ClassInstPtr(_qClass(self))->c_ninstvars);
@@ -701,7 +738,10 @@
element = _InstPtr(self)->i_instvars[index];
if (element != nil)
- (*val.ilc_func)(aBlock, _value_, CON_COMMA nil, &val, element);
+ (*val.ilc_func)(aBlock,
+ @symbol(value:),
+ CON_COMMA nil, &val,
+ element);
}
}
%}