--- a/ShortFloat.st Thu Nov 05 17:26:29 2009 +0100
+++ b/ShortFloat.st Thu Nov 05 17:26:31 2009 +0100
@@ -236,16 +236,16 @@
especially for mass-data."
%{ /* NOCONTEXT */
- if (__isString(aString) && __isSmallInteger(startIndex)) {
- char *cp = (char *)(__stringVal(aString));
- int idx = __intVal(startIndex) - 1;
- double atof();
- double val;
+ if (__isStringLike(aString) && __isSmallInteger(startIndex)) {
+ char *cp = (char *)(__stringVal(aString));
+ int idx = __intVal(startIndex) - 1;
+ double atof();
+ double val;
- if ((unsigned)idx < __stringSize(aString)) {
- val = atof(cp + idx);
- RETURN (__MKSFLOAT(val));
- }
+ if ((unsigned)idx < __stringSize(aString)) {
+ val = atof(cp + idx);
+ RETURN (__MKSFLOAT(val));
+ }
}
%}.
self primitiveFailed.
@@ -265,22 +265,19 @@
ShortFloat fastFromString:'hello123.45E4' at:1
Time millisecondsToRun:[
- 100000 timesRepeat:[
- ShortFloat readFrom:'123.45'
- ]
+ 100000 timesRepeat:[
+ ShortFloat readFrom:'123.45'
+ ]
]
"
"
Time millisecondsToRun:[
- 100000 timesRepeat:[
- ShortFloat fastFromString:'123.45' at:1
- ]
+ 100000 timesRepeat:[
+ ShortFloat fastFromString:'123.45' at:1
+ ]
]
"
-
-
-
!
readFrom:aStringOrStream
@@ -1022,24 +1019,24 @@
OBJ s;
int len;
- if (__isString(formatString)) {
- /*
- * actually only needed on sparc: since thisContext is
- * in a global register, which gets destroyed by printf,
- * manually save it here - very stupid ...
- */
- __BEGIN_PROTECT_REGISTERS__
+ if (__isStringLike(formatString)) {
+ /*
+ * actually only needed on sparc: since thisContext is
+ * in a global register, which gets destroyed by printf,
+ * manually save it here - very stupid ...
+ */
+ __BEGIN_PROTECT_REGISTERS__
- len = snprintf(buffer, sizeof(buffer), __stringVal(formatString), __shortFloatVal(self));
+ len = snprintf(buffer, sizeof(buffer), __stringVal(formatString), __shortFloatVal(self));
- __END_PROTECT_REGISTERS__
+ __END_PROTECT_REGISTERS__
- if (len < 0) goto fail;
+ if (len < 0) goto fail;
- s = __MKSTRING_L(buffer, len);
- if (s != nil) {
- RETURN (s);
- }
+ s = __MKSTRING_L(buffer, len);
+ if (s != nil) {
+ RETURN (s);
+ }
}
fail: ;
%}.
@@ -1639,5 +1636,9 @@
!ShortFloat class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/ShortFloat.st,v 1.100 2009-09-16 17:08:24 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/ShortFloat.st,v 1.101 2009-11-05 16:26:31 stefan Exp $'
+!
+
+version_CVS
+ ^ '$Header: /cvs/stx/stx/libbasic/ShortFloat.st,v 1.101 2009-11-05 16:26:31 stefan Exp $'
! !