Character.st
changeset 5407 d6729266a95b
parent 5315 04052c5626bf
child 5423 e33decc83182
equal deleted inserted replaced
5406:4a6995b61c0e 5407:d6729266a95b
     7  inclusion of the above copyright notice.   This software may not
     7  inclusion of the above copyright notice.   This software may not
     8  be provided or otherwise made available to, or used by, any
     8  be provided or otherwise made available to, or used by, any
     9  other person.  No title to or ownership of the software is
     9  other person.  No title to or ownership of the software is
    10  hereby transferred.
    10  hereby transferred.
    11 "
    11 "
       
    12 
       
    13 "{ Package: 'stx:libbasic' }"
    12 
    14 
    13 Magnitude subclass:#Character
    15 Magnitude subclass:#Character
    14 	instanceVariableNames:'asciivalue'
    16 	instanceVariableNames:'asciivalue'
    15 	classVariableNames:'CharacterTable'
    17 	classVariableNames:'CharacterTable'
    16 	poolDictionaries:''
    18 	poolDictionaries:''
   563     OBJ s;
   565     OBJ s;
   564     unsigned val;
   566     unsigned val;
   565 
   567 
   566     val = __intVal(_characterVal(self));
   568     val = __intVal(_characterVal(self));
   567     if (val <= 0xFF) {
   569     if (val <= 0xFF) {
   568 	buffer[0] = (char) val;
   570         buffer[0] = (char) val;
   569 	buffer[1] = '\0';
   571         buffer[1] = '\0';
   570 	s = __MKSTRING_L(buffer, 1 COMMA_SND);
   572         s = __MKSTRING_L(buffer, 1 COMMA_SND);
   571 	if (s != nil) {
   573         if (s != nil) {
   572 	    RETURN (s);
   574             RETURN (s);
   573 	}
   575         }
   574     }
   576     }
   575 %}.
   577 %}.
   576     asciivalue > 255 ifTrue:[
   578     asciivalue > 255 ifTrue:[
   577 	^ (TwoByteString new:1) at:1 put:self; yourself
   579         ^ (TwoByteString new:1) at:1 put:self; yourself
   578     ].
   580     ].
   579 
   581 
   580 "/
   582 
   581 "/    ^ (String new:1) at:1 put:self; yourself.
   583     ^ (String new:1) at:1 put:self; yourself.
   582 "/
       
   583 
       
   584     "
       
   585      memory allocation (for the new string) failed.
       
   586      When we arrive here, there was no memory, even after a garbage collect.
       
   587      This means, that the VM wanted to get some more memory from the
       
   588      OS, which was not kind enough to give it.
       
   589      Bad luck - you should increase the swap space on your machine.
       
   590     "
       
   591 
       
   592     ^ ObjectMemory allocationFailureSignal raise.
       
   593 !
   584 !
   594 
   585 
   595 asSymbol
   586 asSymbol
   596     "return a unique symbol which prints like I print"
   587     "return a unique symbol which prints like I print"
   597 
   588 
  1080 ! !
  1071 ! !
  1081 
  1072 
  1082 !Character class methodsFor:'documentation'!
  1073 !Character class methodsFor:'documentation'!
  1083 
  1074 
  1084 version
  1075 version
  1085     ^ '$Header: /cvs/stx/stx/libbasic/Character.st,v 1.57 2000-03-21 21:21:00 cg Exp $'
  1076     ^ '$Header: /cvs/stx/stx/libbasic/Character.st,v 1.58 2000-06-23 08:19:52 cg Exp $'
  1086 ! !
  1077 ! !