added support for signedWord and signedLong indexable classes.
--- a/ExtStream.st Tue Jul 02 20:31:37 1996 +0200
+++ b/ExtStream.st Tue Jul 02 20:34:00 1996 +0200
@@ -1604,6 +1604,8 @@
case BYTEARRAY:
case WORDARRAY:
case LONGARRAY:
+ case SWORDARRAY:
+ case SLONGARRAY:
case FLOATARRAY:
case DOUBLEARRAY:
break;
@@ -2007,6 +2009,8 @@
case BYTEARRAY:
case WORDARRAY:
case LONGARRAY:
+ case SWORDARRAY:
+ case SLONGARRAY:
case FLOATARRAY:
case DOUBLEARRAY:
break;
@@ -3474,6 +3478,6 @@
!ExternalStream class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Attic/ExtStream.st,v 1.107 1996-06-26 07:39:03 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Attic/ExtStream.st,v 1.108 1996-07-02 18:32:39 cg Exp $'
! !
ExternalStream initialize!
--- a/ExternalStream.st Tue Jul 02 20:31:37 1996 +0200
+++ b/ExternalStream.st Tue Jul 02 20:34:00 1996 +0200
@@ -1604,6 +1604,8 @@
case BYTEARRAY:
case WORDARRAY:
case LONGARRAY:
+ case SWORDARRAY:
+ case SLONGARRAY:
case FLOATARRAY:
case DOUBLEARRAY:
break;
@@ -2007,6 +2009,8 @@
case BYTEARRAY:
case WORDARRAY:
case LONGARRAY:
+ case SWORDARRAY:
+ case SLONGARRAY:
case FLOATARRAY:
case DOUBLEARRAY:
break;
@@ -3474,6 +3478,6 @@
!ExternalStream class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.107 1996-06-26 07:39:03 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.108 1996-07-02 18:32:39 cg Exp $'
! !
ExternalStream initialize!
--- a/Metaclass.st Tue Jul 02 20:31:37 1996 +0200
+++ b/Metaclass.st Tue Jul 02 20:34:00 1996 +0200
@@ -641,19 +641,8 @@
]
]
] ifFalse:[
- (variableBoolean == #float) ifTrue:[
- newFlags := Behavior flagFloats
- ] ifFalse:[
- (variableBoolean == #double) ifTrue:[
- newFlags := Behavior flagDoubles
- ] ifFalse:[
- (variableBoolean == #long) ifTrue:[
- newFlags := Behavior flagLongs
- ] ifFalse:[
- newFlags := Behavior flagNotIndexed
- ]
- ]
- ].
+ "/ false or symbol.
+ newFlags := Behavior flagForSymbolic:variableBoolean.
].
superFlags := aClass flags bitAnd:(Behavior maskIndexType bitInvert). "preserve other bits"
oldClass notNil ifTrue:[
@@ -1454,5 +1443,5 @@
!Metaclass class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Metaclass.st,v 1.59 1996-06-19 22:29:05 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Metaclass.st,v 1.60 1996-07-02 18:33:19 cg Exp $'
! !
--- a/Object.st Tue Jul 02 20:31:37 1996 +0200
+++ b/Object.st Tue Jul 02 20:34:00 1996 +0200
@@ -436,7 +436,11 @@
REGISTER char *pFirst;
unsigned char *cp;
unsigned short *sp;
- long *lp;
+ short *ssp;
+ unsigned long *lp;
+ long *slp;
+ unsigned long ul;
+ long l;
OBJ *op;
/* int nInstBytes, nInstVars, flags; */
REGISTER int n;
@@ -492,18 +496,32 @@
dp = (double *)pFirst + indx;
RETURN ( __MKFLOAT(*dp) COMMA_CON );
}
- } else if (n == __MASKSMALLINT(LONGARRAY)) {
- if ((indx >= 0) && (indx < (nbytes / sizeof(long)))) {
- lp = (long *)pFirst + indx;
- if ((*lp >= _MIN_INT) && (*lp <= _MAX_INT))
- RETURN ( __MKSMALLINT(*lp) );
- RETURN ( __MKLARGEINT(*lp) );
- }
} else if (n == __MASKSMALLINT(WORDARRAY)) {
if ((indx >= 0) && (indx < (nbytes / sizeof(short)))) {
sp = (unsigned short *)pFirst + indx;
RETURN ( __MKSMALLINT(*sp & 0xFFFF) );
}
+ } else if (n == __MASKSMALLINT(SWORDARRAY)) {
+ if ((indx >= 0) && (indx < (nbytes / sizeof(short)))) {
+ ssp = (short *)pFirst + indx;
+ RETURN ( __MKSMALLINT(*ssp) );
+ }
+ } else if (n == __MASKSMALLINT(LONGARRAY)) {
+ if ((indx >= 0) && (indx < (nbytes / sizeof(long)))) {
+ lp = (unsigned long *)pFirst + indx;
+ ul = *lp;
+ if (ul <= _MAX_INT)
+ RETURN ( __MKSMALLINT(ul) );
+ RETURN ( __MKULARGEINT(ul) );
+ }
+ } else if (n == __MASKSMALLINT(SLONGARRAY)) {
+ if ((indx >= 0) && (indx < (nbytes / sizeof(long)))) {
+ slp = (long *)pFirst + indx;
+ l = *slp;
+ if ((l >= _MIN_INT) && (l <= _MAX_INT))
+ RETURN ( __MKSMALLINT(l) );
+ RETURN ( __MKLARGEINT(l) );
+ }
}
}
%}.
@@ -525,11 +543,14 @@
OBJ myClass;
register char *pFirst;
char *cp;
- short *sp;
- long *lp;
+ unsigned short *sp;
+ short *ssp;
+ unsigned long *lp;
+ long *slp;
OBJ *op;
/* int nInstBytes, ninstvars, flags; */
REGISTER int n;
+ unsigned int u;
int val;
/* notice the missing test for self being a nonNilObject -
@@ -603,34 +624,56 @@
RETURN ( anObject );
}
}
- } else if (n == __MASKSMALLINT(LONGARRAY)) {
- if ((indx >= 0) && (indx < (nbytes / sizeof(long)))) {
- lp = (long *)pFirst + indx;
- if (__isSmallInteger(anObject)) {
- *lp = __intVal(anObject);
- RETURN ( anObject );
- } else {
- if (__Class(anObject) == LargeInteger) {
- n = __longIntVal(anObject);
- /* zero means failure ... (would be a smallInteger) */
- if (n) {
- *lp = n;
- RETURN ( anObject );
- }
- }
- }
- }
} else if (n == __MASKSMALLINT(WORDARRAY)) {
if (__isSmallInteger(anObject)) {
val = __intVal(anObject);
if ((val >= 0) && (val <= 0xFFFF)) {
if ((indx >= 0) && (indx < (nbytes / sizeof(short)))) {
- sp = (short *)pFirst + indx;
+ sp = (unsigned short *)pFirst + indx;
*sp = val;
RETURN ( anObject );
}
}
}
+ } else if (n == __MASKSMALLINT(SWORDARRAY)) {
+ if (__isSmallInteger(anObject)) {
+ val = __intVal(anObject);
+ if ((val >= -32768) && (val < 32768)) {
+ if ((indx >= 0) && (indx < (nbytes / sizeof(short)))) {
+ ssp = (short *)pFirst + indx;
+ *ssp = val;
+ RETURN ( anObject );
+ }
+ }
+ }
+ } else if (n == __MASKSMALLINT(SLONGARRAY)) {
+ if ((indx >= 0) && (indx < (nbytes / sizeof(long)))) {
+ slp = (long *)pFirst + indx;
+ if (__isSmallInteger(anObject)) {
+ *slp = __intVal(anObject);
+ RETURN ( anObject );
+ }
+ n = __signedLongIntVal(anObject);
+ /* zero means failure for an int larger than 4 bytes ... (would be a smallInteger) */
+ if (n) {
+ *slp = n;
+ RETURN ( anObject );
+ }
+ }
+ } else if (n == __MASKSMALLINT(LONGARRAY)) {
+ if ((indx >= 0) && (indx < (nbytes / sizeof(long)))) {
+ lp = (unsigned long *)pFirst + indx;
+ if (anObject == __MKSMALLINT(0)) {
+ *lp = 0;
+ RETURN ( anObject );
+ }
+ u = __longIntVal(anObject);
+ /* zero means failure for an int larger than 4 bytes ... (would be a smallInteger) */
+ if (u) {
+ *lp = u;
+ RETURN ( anObject );
+ }
+ }
}
}
%}.
@@ -4138,11 +4181,11 @@
#endif
RETURN ( __MKSMALLINT(nbytes / sizeof(double)) );
}
- if (flags == LONGARRAY) {
- RETURN ( __MKSMALLINT(nbytes / sizeof(long)) );
+ if ((flags == WORDARRAY) || (flags == SWORDARRAY)) {
+ RETURN ( __MKSMALLINT(nbytes / sizeof(short)) );
}
- if (flags == WORDARRAY) {
- RETURN ( __MKSMALLINT(nbytes / sizeof(short)) );
+ if ((flags == LONGARRAY) || (flags == SLONGARRAY)) {
+ RETURN ( __MKSMALLINT(nbytes / sizeof(long)) );
}
%}.
^ 0
@@ -5157,6 +5200,6 @@
!Object class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Object.st,v 1.124 1996-05-29 14:31:04 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Object.st,v 1.125 1996-07-02 18:34:00 cg Exp $'
! !
Object initialize!