--- a/Array.st Wed Jul 14 21:39:25 1999 +0200
+++ b/Array.st Thu Jul 15 01:38:38 1999 +0200
@@ -294,16 +294,19 @@
REGISTER OBJ cls;
if (__isSmallInteger(index)) {
- indx = __intVal(index) - 1;
- slf = self;
+ indx = __intVal(index) - 1;
+ slf = self;
- nIndex = __BYTES2OBJS__(__qSize(slf) - OHDR_SIZE);
- if ((cls = __qClass(slf)) != Array)
- indx += __intVal(__ClassInstPtr(cls)->c_ninstvars);
- if ((unsigned)indx < (unsigned)nIndex) {
- RETURN ( __InstPtr(slf)->i_instvars[indx] );
- }
+ nIndex = __BYTES2OBJS__(__qSize(slf) - OHDR_SIZE);
+ if ((cls = __qClass(slf)) != Array) {
+ if (indx < 0) goto badIndex;
+ indx += __intVal(__ClassInstPtr(cls)->c_ninstvars);
+ }
+ if ((unsigned)indx < (unsigned)nIndex) {
+ RETURN ( __InstPtr(slf)->i_instvars[indx] );
+ }
}
+badIndex: ;
%}.
^ super at:index
!
@@ -324,18 +327,21 @@
REGISTER OBJ cls;
if (__isSmallInteger(index)) {
- indx = __intVal(index) - 1;
- slf = self;
+ indx = __intVal(index) - 1;
+ slf = self;
- nIndex = __BYTES2OBJS__(__qSize(slf) - OHDR_SIZE);
- if ((cls = __qClass(slf)) != Array)
- indx += __intVal(__ClassInstPtr(cls)->c_ninstvars);
- if ((unsigned)indx < (unsigned)nIndex) {
- __InstPtr(slf)->i_instvars[indx] = anObject;
- __STORE(slf, anObject);
- RETURN ( anObject );
- }
+ nIndex = __BYTES2OBJS__(__qSize(slf) - OHDR_SIZE);
+ if ((cls = __qClass(slf)) != Array) {
+ if (indx < 0) goto badIndex;
+ indx += __intVal(__ClassInstPtr(cls)->c_ninstvars);
+ }
+ if ((unsigned)indx < (unsigned)nIndex) {
+ __InstPtr(slf)->i_instvars[indx] = anObject;
+ __STORE(slf, anObject);
+ RETURN ( anObject );
+ }
}
+badIndex: ;
%}.
^ super at:index put:anObject
@@ -354,16 +360,19 @@
REGISTER OBJ cls;
if (__isSmallInteger(index)) {
- indx = __intVal(index) - 1;
- slf = self;
+ indx = __intVal(index) - 1;
+ slf = self;
- nIndex = __BYTES2OBJS__(__qSize(slf) - OHDR_SIZE);
- if ((cls = __qClass(slf)) != Array)
- indx += __intVal(__ClassInstPtr(cls)->c_ninstvars);
- if ((unsigned)indx < (unsigned)nIndex) {
- RETURN ( __InstPtr(slf)->i_instvars[indx] );
- }
+ nIndex = __BYTES2OBJS__(__qSize(slf) - OHDR_SIZE);
+ if ((cls = __qClass(slf)) != Array) {
+ if (indx < 0) goto badIndex;
+ indx += __intVal(__ClassInstPtr(cls)->c_ninstvars);
+ }
+ if ((unsigned)indx < (unsigned)nIndex) {
+ RETURN ( __InstPtr(slf)->i_instvars[indx] );
+ }
}
+badIndex: ;
%}.
^ super basicAt:index
!
@@ -381,18 +390,21 @@
REGISTER OBJ cls;
if (__isSmallInteger(index)) {
- indx = __intVal(index) - 1;
- slf = self;
+ indx = __intVal(index) - 1;
+ slf = self;
- nIndex = __BYTES2OBJS__(__qSize(slf) - OHDR_SIZE);
- if ((cls = __qClass(slf)) != Array)
- indx += __intVal(__ClassInstPtr(cls)->c_ninstvars);
- if ((unsigned)indx < (unsigned)nIndex) {
- __InstPtr(slf)->i_instvars[indx] = anObject;
- __STORE(slf, anObject);
- RETURN ( anObject );
- }
+ nIndex = __BYTES2OBJS__(__qSize(slf) - OHDR_SIZE);
+ if ((cls = __qClass(slf)) != Array) {
+ if (indx < 0) goto badIndex;
+ indx += __intVal(__ClassInstPtr(cls)->c_ninstvars);
+ }
+ if ((unsigned)indx < (unsigned)nIndex) {
+ __InstPtr(slf)->i_instvars[indx] = anObject;
+ __STORE(slf, anObject);
+ RETURN ( anObject );
+ }
}
+badIndex: ;
%}.
^ super basicAt:index put:anObject
@@ -2370,5 +2382,5 @@
!Array class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Array.st,v 1.116 1999-06-24 07:38:14 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Array.st,v 1.117 1999-07-14 23:38:38 cg Exp $'
! !