*** empty log message ***
authorClaus Gittinger <cg@exept.de>
Fri, 25 Jul 1997 16:25:57 +0200
changeset 2781 eca37ca06b66
parent 2780 371b1022e75a
child 2782 f97dbd085898
*** empty log message ***
SmallInt.st
SmallInteger.st
--- a/SmallInt.st	Fri Jul 25 16:25:24 1997 +0200
+++ b/SmallInt.st	Fri Jul 25 16:25:57 1997 +0200
@@ -823,7 +823,7 @@
 	RETURN ( __MKSMALLINT(-1) );
     }
 #ifdef alpha64
-    mask = 0x2000000000000000;
+    mask = 0x2000000000000000L;
     index = 62;
 #else
     mask = 0x20000000;
@@ -1066,7 +1066,7 @@
      May be useful for communication interfaces"
 
 %{  /* NOCONTEXT */
-    int i = __intVal(self);
+    INT i = __intVal(self);
 
     if (i & 0x80) {
 	i = i | 0x7FFFFF00;
@@ -1088,7 +1088,7 @@
      May be useful for communication interfaces"
 
 %{  /* NOCONTEXT */
-    int i = __intVal(self);
+    INT i = __intVal(self);
 
     if (i & 0x8000) {
 	i = i | 0x7FFF0000;
@@ -2218,7 +2218,11 @@
      */
     __BEGIN_PROTECT_REGISTERS__
 
+#if INT == long
+    sprintf(buffer, "%ld", __intVal(self));
+#else
     sprintf(buffer, "%d", __intVal(self));
+#endif
 
     __END_PROTECT_REGISTERS__
 
@@ -2242,13 +2246,25 @@
     if (__isSmallInteger(radix)) {
 	switch (__intVal(radix)) {
 	    case 10:
+#if INT == long
+		format = "%ld";
+#else
 		format = "%d";
+#endif
 		break;
 	    case 16:
+#if INT == long
+		format = "%lx";
+#else
 		format = "%x";
+#endif
 		break;
 	    case 8:
+#if INT == long
+		format = "%lo";
+#else
 		format = "%o";
+#endif
 		break;
 	}
     }
@@ -2290,7 +2306,13 @@
      function 'printf'.
      No checking for string overrun - the resulting string 
      must be shorter than 256 chars or else ...
-     This method is NONSTANDARD and may be removed without notice."
+     This method is NONSTANDARD and may be removed without notice;
+     it is provided to allow special conversions in very special
+     situaltions.
+     Notice that a conversion may not be portable; for example,
+     to correctly convert an int on a 64-bit alpha, a %ld is required,
+     while other systems may be happy with a %d ...
+     Use at your own risk (if at all)"
 
 %{  /* STACK: 400 */
 
@@ -2459,5 +2481,5 @@
 !SmallInteger class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Attic/SmallInt.st,v 1.80 1997-07-22 15:45:25 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Attic/SmallInt.st,v 1.81 1997-07-25 14:25:57 cg Exp $'
 ! !
--- a/SmallInteger.st	Fri Jul 25 16:25:24 1997 +0200
+++ b/SmallInteger.st	Fri Jul 25 16:25:57 1997 +0200
@@ -823,7 +823,7 @@
 	RETURN ( __MKSMALLINT(-1) );
     }
 #ifdef alpha64
-    mask = 0x2000000000000000;
+    mask = 0x2000000000000000L;
     index = 62;
 #else
     mask = 0x20000000;
@@ -1066,7 +1066,7 @@
      May be useful for communication interfaces"
 
 %{  /* NOCONTEXT */
-    int i = __intVal(self);
+    INT i = __intVal(self);
 
     if (i & 0x80) {
 	i = i | 0x7FFFFF00;
@@ -1088,7 +1088,7 @@
      May be useful for communication interfaces"
 
 %{  /* NOCONTEXT */
-    int i = __intVal(self);
+    INT i = __intVal(self);
 
     if (i & 0x8000) {
 	i = i | 0x7FFF0000;
@@ -2218,7 +2218,11 @@
      */
     __BEGIN_PROTECT_REGISTERS__
 
+#if INT == long
+    sprintf(buffer, "%ld", __intVal(self));
+#else
     sprintf(buffer, "%d", __intVal(self));
+#endif
 
     __END_PROTECT_REGISTERS__
 
@@ -2242,13 +2246,25 @@
     if (__isSmallInteger(radix)) {
 	switch (__intVal(radix)) {
 	    case 10:
+#if INT == long
+		format = "%ld";
+#else
 		format = "%d";
+#endif
 		break;
 	    case 16:
+#if INT == long
+		format = "%lx";
+#else
 		format = "%x";
+#endif
 		break;
 	    case 8:
+#if INT == long
+		format = "%lo";
+#else
 		format = "%o";
+#endif
 		break;
 	}
     }
@@ -2290,7 +2306,13 @@
      function 'printf'.
      No checking for string overrun - the resulting string 
      must be shorter than 256 chars or else ...
-     This method is NONSTANDARD and may be removed without notice."
+     This method is NONSTANDARD and may be removed without notice;
+     it is provided to allow special conversions in very special
+     situaltions.
+     Notice that a conversion may not be portable; for example,
+     to correctly convert an int on a 64-bit alpha, a %ld is required,
+     while other systems may be happy with a %d ...
+     Use at your own risk (if at all)"
 
 %{  /* STACK: 400 */
 
@@ -2459,5 +2481,5 @@
 !SmallInteger class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/SmallInteger.st,v 1.80 1997-07-22 15:45:25 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/SmallInteger.st,v 1.81 1997-07-25 14:25:57 cg Exp $'
 ! !