Behavior.st
changeset 18364 a693511a7c46
parent 18353 83774b46e6c5
child 18366 a6e62e167c32
child 18367 d657e5e06c1d
equal deleted inserted replaced
18363:ec65c9912329 18364:a693511a7c46
  2505      if the argument, anInteger is zero.
  2505      if the argument, anInteger is zero.
  2506      ** Do not redefine this method in any class **"
  2506      ** Do not redefine this method in any class **"
  2507 
  2507 
  2508 %{  /* NOCONTEXT */
  2508 %{  /* NOCONTEXT */
  2509 #ifdef __SCHTEAM__
  2509 #ifdef __SCHTEAM__
  2510     return __c__._RETURN( self.basicNew() );
  2510     if (anInteger.isSmallInteger()) {
       
  2511 	return __c__._RETURN( self.basicNew( anInteger.intValue()) );
       
  2512     }
  2511 #else
  2513 #else
  2512     OBJ newobj;
  2514     OBJ newobj;
  2513     unsigned INT nInstVars;
  2515     unsigned INT nInstVars;
  2514     unsigned INT instsize;
  2516     unsigned INT instsize;
  2515     INT nindexedinstvars;
  2517     INT nindexedinstvars;
  3909 
  3911 
  3910 isSubclassOf:aClass
  3912 isSubclassOf:aClass
  3911     "return true, if I am a subclass of the argument, aClass"
  3913     "return true, if I am a subclass of the argument, aClass"
  3912 
  3914 
  3913 %{  /* NOCONTEXT */
  3915 %{  /* NOCONTEXT */
       
  3916 #ifdef __SCHTEAM__
       
  3917     STClass theClass = self.superClazz();
       
  3918 
       
  3919     while (theClass != null) {
       
  3920 	if (theClass == aClass) {
       
  3921 	    return __c__._RETURN_true();
       
  3922 	}
       
  3923 	theClass = theClass.superClazz();
       
  3924     }
       
  3925     return __c__._RETURN_false();
       
  3926     /* NOTREACHED */
       
  3927 #else
  3914     OBJ __theClass = __INST(superclass);
  3928     OBJ __theClass = __INST(superclass);
  3915     int n = 0;
  3929     int n = 0;
  3916 
  3930 
  3917     while (__theClass != nil) {
  3931     while (__theClass != nil) {
  3918 	if (__theClass == aClass) {
  3932 	if (__theClass == aClass) {
  3925 	}
  3939 	}
  3926 	if (++n > 100000) goto vmError;
  3940 	if (++n > 100000) goto vmError;
  3927     }
  3941     }
  3928     RETURN (false);
  3942     RETURN (false);
  3929 vmError: ;
  3943 vmError: ;
       
  3944 #endif /* not SCHTEAM */
  3930 %}.
  3945 %}.
  3931     VMInternalError raiseErrorString:'deep inheritance'.
  3946     VMInternalError raiseErrorString:'deep inheritance'.
  3932 
  3947 
  3933 "/    |theClass|
  3948 "/    |theClass|
  3934 "/
  3949 "/
  4055 
  4070 
  4056     "Read the documentation on why there seem to be no
  4071     "Read the documentation on why there seem to be no
  4057      instances of SmallInteger and UndefinedObject"
  4072      instances of SmallInteger and UndefinedObject"
  4058 
  4073 
  4059     self allInstancesDo:[:anObject |
  4074     self allInstancesDo:[:anObject |
  4060         (predicate value:anObject) ifTrue:[
  4075 	(predicate value:anObject) ifTrue:[
  4061             action value:anObject
  4076 	    action value:anObject
  4062         ].
  4077 	].
  4063     ].
  4078     ].
  4064 
  4079 
  4065     "
  4080     "
  4066      ScrollBar allInstancesForWhich:[:s | s shown] do:[:s | Transcript showCR:s topView label]
  4081      ScrollBar allInstancesForWhich:[:s | s shown] do:[:s | Transcript showCR:s topView label]
  4067     "
  4082     "
  5280 ! !
  5295 ! !
  5281 
  5296 
  5282 !Behavior class methodsFor:'documentation'!
  5297 !Behavior class methodsFor:'documentation'!
  5283 
  5298 
  5284 version
  5299 version
  5285     ^ '$Header: /cvs/stx/stx/libbasic/Behavior.st,v 1.375 2015-05-16 09:51:38 cg Exp $'
  5300     ^ '$Header: /cvs/stx/stx/libbasic/Behavior.st,v 1.376 2015-05-18 00:16:20 cg Exp $'
  5286 !
  5301 !
  5287 
  5302 
  5288 version_CVS
  5303 version_CVS
  5289     ^ '$Header: /cvs/stx/stx/libbasic/Behavior.st,v 1.375 2015-05-16 09:51:38 cg Exp $'
  5304     ^ '$Header: /cvs/stx/stx/libbasic/Behavior.st,v 1.376 2015-05-18 00:16:20 cg Exp $'
  5290 ! !
  5305 ! !
  5291 
  5306