# HG changeset patch # User claus # Date 799903874 -7200 # Node ID e8658d38abfb103d249f41f4c755f1c57f0bb51f # Parent 20376737bdaf33a77944ce81ca8ee66911332e30 . diff -r 20376737bdaf -r e8658d38abfb Context.st --- a/Context.st Sat May 06 06:26:35 1995 +0200 +++ b/Context.st Mon May 08 05:31:14 1995 +0200 @@ -22,7 +22,7 @@ COPYRIGHT (c) 1988 by Claus Gittinger All Rights Reserved -$Header: /cvs/stx/stx/libbasic/Context.st,v 1.30 1995-05-01 21:29:07 claus Exp $ +$Header: /cvs/stx/stx/libbasic/Context.st,v 1.31 1995-05-08 03:29:03 claus Exp $ '! !Context class methodsFor:'documentation'! @@ -43,7 +43,7 @@ version " -$Header: /cvs/stx/stx/libbasic/Context.st,v 1.30 1995-05-01 21:29:07 claus Exp $ +$Header: /cvs/stx/stx/libbasic/Context.st,v 1.31 1995-05-08 03:29:03 claus Exp $ " ! @@ -103,7 +103,8 @@ (for super sends) or nil, for regular sends. lineNr the position where the context left off - (kind of p-counter) + (kind of p-counter). Only the low 16bits + are valid. retValTemp nil temporary - always nil, when you see the context (used in the VM as temporary) @@ -415,7 +416,8 @@ interrupted or called another method. (currently, sometimes this information is not available - in this case 0 is returned)" - ^ lineNr + lineNr isNil ifTrue:[^ nil]. + ^ lineNr bitAnd:16rFFFF ! ! !Context methodsFor:'printing & storing'! @@ -508,7 +510,7 @@ ' ' print. self argsDisplayString print ]. - ' [' print. lineNr print. ']' printNewline + ' [' print. self lineNumber print. ']' printNewline " thisContext fullPrint diff -r 20376737bdaf -r e8658d38abfb Date.st --- a/Date.st Sat May 06 06:26:35 1995 +0200 +++ b/Date.st Mon May 08 05:31:14 1995 +0200 @@ -22,7 +22,7 @@ COPYRIGHT (c) 1989 by Claus Gittinger All Rights Reserved -$Header: /cvs/stx/stx/libbasic/Date.st,v 1.20 1995-05-02 23:55:59 claus Exp $ +$Header: /cvs/stx/stx/libbasic/Date.st,v 1.21 1995-05-08 03:29:07 claus Exp $ '! !Date class methodsFor:'documentation'! @@ -43,7 +43,7 @@ version " -$Header: /cvs/stx/stx/libbasic/Date.st,v 1.20 1995-05-02 23:55:59 claus Exp $ +$Header: /cvs/stx/stx/libbasic/Date.st,v 1.21 1995-05-08 03:29:07 claus Exp $ " ! @@ -616,28 +616,32 @@ This method assumes american format (i.e. month-day-year) instead of the german/french and other day-month-year. There ought to be a nationalized variant of this." - + |month day year aStream| - aStream := ReadStream on:aString. - [aStream peek isLetterOrDigit] whileFalse:[aStream next]. - (aStream peek isDigit) ifTrue:[ - day := Integer readFrom:aStream onError:[^ exceptionBlock value] + Object errorSignal handle:[:ex | + ^ exceptionBlock value + ] do:[ + aStream := ReadStream on:aString. + [aStream peek isLetterOrDigit] whileFalse:[aStream next]. + (aStream peek isDigit) ifTrue:[ + day := Integer readFrom:aStream onError:[^ exceptionBlock value] + ]. + [aStream peek isLetterOrDigit] whileFalse:[aStream next]. + (aStream peek isLetter) ifTrue:[ + month := aStream nextAlphaNumericWord. + day isNil ifTrue:[ + [aStream peek isLetterOrDigit] whileFalse:[aStream next]. + day := Integer readFrom:aStream onError:[^ exceptionBlock value]. + ] + ] ifFalse:[ + month := self nameOfMonth:day. + day := Integer readFrom:aStream onError:[^ exceptionBlock value] + ]. + [aStream peek isLetterOrDigit] whileFalse:[aStream next]. + year := Integer readFrom:aStream onError:[^ exceptionBlock value]. + ^ self newDay:day month:month year:year ]. - [aStream peek isLetterOrDigit] whileFalse:[aStream next]. - (aStream peek isLetter) ifTrue:[ - month := aStream nextAlphaNumericWord. - day isNil ifTrue:[ - [aStream peek isLetterOrDigit] whileFalse:[aStream next]. - day := Integer readFrom:aStream onError:[^ exceptionBlock value]. - ] - ] ifFalse:[ - month := self nameOfMonth:day. - day := Integer readFrom:aStream onError:[^ exceptionBlock value] - ]. - [aStream peek isLetterOrDigit] whileFalse:[aStream next]. - year := Integer readFrom:aStream onError:[^ exceptionBlock value]. - ^ self newDay:day month:month year:year " Date readFromString:'31 December 1992' diff -r 20376737bdaf -r e8658d38abfb ExtStream.st --- a/ExtStream.st Sat May 06 06:26:35 1995 +0200 +++ b/ExtStream.st Mon May 08 05:31:14 1995 +0200 @@ -24,7 +24,7 @@ COPYRIGHT (c) 1988 by Claus Gittinger All Rights Reserved -$Header: /cvs/stx/stx/libbasic/Attic/ExtStream.st,v 1.35 1995-05-01 21:29:31 claus Exp $ +$Header: /cvs/stx/stx/libbasic/Attic/ExtStream.st,v 1.36 1995-05-08 03:29:22 claus Exp $ '! !ExternalStream primitiveDefinitions! @@ -87,7 +87,7 @@ version " -$Header: /cvs/stx/stx/libbasic/Attic/ExtStream.st,v 1.35 1995-05-01 21:29:31 claus Exp $ +$Header: /cvs/stx/stx/libbasic/Attic/ExtStream.st,v 1.36 1995-05-08 03:29:22 claus Exp $ " ! @@ -547,6 +547,15 @@ ^ self error:'argument must be a string' ! ! +!ExternalStream methodsFor:'queries'! + +isBinary + "return true, if the stream is in binary (as opposed to text-) mode. + The default when created is false." + + ^ binary +! ! + !ExternalStream methodsFor:'accessing'! readonly @@ -1731,8 +1740,14 @@ !ExternalStream methodsFor:'writing'! +commit + "write all buffered date - ignored if unbuffered" + + self synchronizeOutput +! + synchronizeOutput - "write all buffered data - for buffered mode only" + "write all buffered data - ignored if unbuffered" %{ /* NOCONTEXT */ OBJ fp; diff -r 20376737bdaf -r e8658d38abfb ExternalStream.st --- a/ExternalStream.st Sat May 06 06:26:35 1995 +0200 +++ b/ExternalStream.st Mon May 08 05:31:14 1995 +0200 @@ -24,7 +24,7 @@ COPYRIGHT (c) 1988 by Claus Gittinger All Rights Reserved -$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.35 1995-05-01 21:29:31 claus Exp $ +$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.36 1995-05-08 03:29:22 claus Exp $ '! !ExternalStream primitiveDefinitions! @@ -87,7 +87,7 @@ version " -$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.35 1995-05-01 21:29:31 claus Exp $ +$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.36 1995-05-08 03:29:22 claus Exp $ " ! @@ -547,6 +547,15 @@ ^ self error:'argument must be a string' ! ! +!ExternalStream methodsFor:'queries'! + +isBinary + "return true, if the stream is in binary (as opposed to text-) mode. + The default when created is false." + + ^ binary +! ! + !ExternalStream methodsFor:'accessing'! readonly @@ -1731,8 +1740,14 @@ !ExternalStream methodsFor:'writing'! +commit + "write all buffered date - ignored if unbuffered" + + self synchronizeOutput +! + synchronizeOutput - "write all buffered data - for buffered mode only" + "write all buffered data - ignored if unbuffered" %{ /* NOCONTEXT */ OBJ fp; diff -r 20376737bdaf -r e8658d38abfb Interval.st --- a/Interval.st Sat May 06 06:26:35 1995 +0200 +++ b/Interval.st Mon May 08 05:31:14 1995 +0200 @@ -21,7 +21,7 @@ COPYRIGHT (c) 1989 by Claus Gittinger All Rights Reserved -$Header: /cvs/stx/stx/libbasic/Interval.st,v 1.13 1995-05-01 21:30:08 claus Exp $ +$Header: /cvs/stx/stx/libbasic/Interval.st,v 1.14 1995-05-08 03:29:37 claus Exp $ '! !Interval class methodsFor:'documentation'! @@ -42,7 +42,7 @@ version " -$Header: /cvs/stx/stx/libbasic/Interval.st,v 1.13 1995-05-01 21:30:08 claus Exp $ +$Header: /cvs/stx/stx/libbasic/Interval.st,v 1.14 1995-05-08 03:29:37 claus Exp $ " ! @@ -53,6 +53,22 @@ The interresting thing is that the elements are computed, not stored. For example, the interval (1 to:5) containes the elements (1 2 3 4 5) and (1 to:6 by:2) contains (1 3 5). + + examples: + + (1 to:10) do:[:i | Transcript showCr:i] + + notice, that this is semantically equivalent to: + + 1 to:10 do:[:i | Transcript showCr:i] + + however, the second is preferred, since loops using to:do: are + much faster and do not create temporary garbage objects. + Therefore, Intervals are generally NOT used for this kind of loops. + + (1 to:10) asArray + + (1 to:10 by:2) asOrderedCollection " ! ! @@ -121,13 +137,15 @@ ! increment - "same as #step; for ST-80 compatibility" + "alias for #step; for ST-80 compatibility" ^ step ! step - "return the step increment of the range" + "return the step increment of the range. + OBSOLETE: + Please use #increment for ST-80 compatibility." ^ step ! diff -r 20376737bdaf -r e8658d38abfb Make.proto --- a/Make.proto Sat May 06 06:26:35 1995 +0200 +++ b/Make.proto Mon May 08 05:31:14 1995 +0200 @@ -1,4 +1,4 @@ -# $Header: /cvs/stx/stx/libbasic/Make.proto,v 1.27 1995-02-26 18:14:39 claus Exp $ +# $Header: /cvs/stx/stx/libbasic/Make.proto,v 1.28 1995-05-08 03:31:14 claus Exp $ # # -------------- no need to change anything below ---------- @@ -12,7 +12,9 @@ all:: abbrev.stc objs genClassList $(OBJTARGET) -objs:: \ +OBJFILES=$(OBJS) + +OBJS= \ Object.$(O) \ Autoload.$(O) \ Behavior.$(O) \ @@ -87,7 +89,7 @@ Rectangle.$(O) \ Registry.$(O) \ Signal.$(O) \ - SMALLTALK \ + Smalltalk.$(O) \ Stream.$(O) \ PeekStr.$(O) \ PosStream.$(O) \ @@ -116,9 +118,9 @@ # CONF_STRING="$(CONF)" -SMALLTALK: - @$(MAKE) Smalltalk.$(O) \ - DEFS="$(DEFS) -DCONFIGURATION_STRING='\\\"$(CONF_STRING)\\\"' " +Smalltalk.$(O): + $(STC) -CC="$(CC)" $(STCFLAGS) $(CFLAGS) -DCONFIGURATION_STRING='\"$(CONF_STRING)\"' -c Smalltalk.st + @$(TOUCH) $*.$(O) cleanjunk:: -rm -f *.c *.H diff -r 20376737bdaf -r e8658d38abfb Number.st --- a/Number.st Sat May 06 06:26:35 1995 +0200 +++ b/Number.st Mon May 08 05:31:14 1995 +0200 @@ -21,7 +21,7 @@ COPYRIGHT (c) 1988 by Claus Gittinger All Rights Reserved -$Header: /cvs/stx/stx/libbasic/Number.st,v 1.15 1995-05-01 21:37:51 claus Exp $ +$Header: /cvs/stx/stx/libbasic/Number.st,v 1.16 1995-05-08 03:29:56 claus Exp $ '! !Number class methodsFor:'documentation'! @@ -42,7 +42,7 @@ version " -$Header: /cvs/stx/stx/libbasic/Number.st,v 1.15 1995-05-01 21:37:51 claus Exp $ +$Header: /cvs/stx/stx/libbasic/Number.st,v 1.16 1995-05-08 03:29:56 claus Exp $ " ! @@ -282,64 +282,68 @@ |nextChar radix value negative signExp freakOut| - nextChar := aStream skipSeparators. - nextChar isNil ifTrue:[^ exceptionBlock value]. - - freakOut := [^ exceptionBlock value]. + Object errorSignal handle:[:ex | + ^ exceptionBlock value + ] do:[ + nextChar := aStream skipSeparators. + nextChar isNil ifTrue:[^ exceptionBlock value]. - (nextChar == $-) ifTrue:[ - negative := true. - nextChar := aStream nextPeek - ] ifFalse:[ - negative := false. - (nextChar == $+) ifTrue:[ - nextChar := aStream nextPeek - ] - ]. - nextChar isDigit ifFalse:[ - ^ exceptionBlock value. -"/ value := super readFrom:aStream. -"/ negative ifTrue:[value := value negated]. -"/ ^ value - ]. - value := Integer readFrom:aStream radix:10 onError:freakOut. - nextChar := aStream peek. - ((nextChar == $r) or:[ nextChar == $R]) ifTrue:[ - aStream next. - radix := value. - value := Integer readFrom:aStream radix:radix onError:freakOut. - ] ifFalse:[ - radix := 10 - ]. - (nextChar == $.) ifTrue:[ - nextChar := aStream nextPeek. - (nextChar notNil and:[nextChar isDigitRadix:radix]) ifTrue:[ - value := value asFloat - + (Number readMantissaFrom:aStream radix:radix). - nextChar := aStream peek - ] - ]. - ((nextChar == $e) or:[nextChar == $E]) ifTrue:[ - nextChar := aStream nextPeek. - signExp := 1. - (nextChar == $+) ifTrue:[ + freakOut := [^ exceptionBlock value]. + + (nextChar == $-) ifTrue:[ + negative := true. nextChar := aStream nextPeek ] ifFalse:[ - (nextChar == $-) ifTrue:[ - nextChar := aStream nextPeek. - signExp := -1 + negative := false. + (nextChar == $+) ifTrue:[ + nextChar := aStream nextPeek ] ]. - (nextChar notNil and:[(nextChar isDigitRadix:radix)]) ifTrue:[ - value := value asFloat - * (10.0 raisedToInteger: - ((Integer readFrom:aStream radix:radix onError:freakOut) * signExp)) - ] - ]. - negative ifTrue:[ - ^ value negated - ]. - ^ value + nextChar isDigit ifFalse:[ + ^ exceptionBlock value. +"/ value := super readFrom:aStream. +"/ negative ifTrue:[value := value negated]. +"/ ^ value + ]. + value := Integer readFrom:aStream radix:10 onError:freakOut. + nextChar := aStream peek. + ((nextChar == $r) or:[ nextChar == $R]) ifTrue:[ + aStream next. + radix := value. + value := Integer readFrom:aStream radix:radix onError:freakOut. + ] ifFalse:[ + radix := 10 + ]. + (nextChar == $.) ifTrue:[ + nextChar := aStream nextPeek. + (nextChar notNil and:[nextChar isDigitRadix:radix]) ifTrue:[ + value := value asFloat + + (Number readMantissaFrom:aStream radix:radix). + nextChar := aStream peek + ] + ]. + ((nextChar == $e) or:[nextChar == $E]) ifTrue:[ + nextChar := aStream nextPeek. + signExp := 1. + (nextChar == $+) ifTrue:[ + nextChar := aStream nextPeek + ] ifFalse:[ + (nextChar == $-) ifTrue:[ + nextChar := aStream nextPeek. + signExp := -1 + ] + ]. + (nextChar notNil and:[(nextChar isDigitRadix:radix)]) ifTrue:[ + value := value asFloat + * (10.0 raisedToInteger: + ((Integer readFrom:aStream radix:radix onError:freakOut) * signExp)) + ] + ]. + negative ifTrue:[ + ^ value negated + ]. + ^ value + ] " Number readFrom:(ReadStream on:'54.32e-01') diff -r 20376737bdaf -r e8658d38abfb ObjMem.st --- a/ObjMem.st Sat May 06 06:26:35 1995 +0200 +++ b/ObjMem.st Mon May 08 05:31:14 1995 +0200 @@ -33,7 +33,7 @@ COPYRIGHT (c) 1992 by Claus Gittinger All Rights Reserved -$Header: /cvs/stx/stx/libbasic/Attic/ObjMem.st,v 1.39 1995-05-03 15:30:06 claus Exp $ +$Header: /cvs/stx/stx/libbasic/Attic/ObjMem.st,v 1.40 1995-05-08 03:30:02 claus Exp $ '! !ObjectMemory class methodsFor:'documentation'! @@ -54,7 +54,7 @@ version " -$Header: /cvs/stx/stx/libbasic/Attic/ObjMem.st,v 1.39 1995-05-03 15:30:06 claus Exp $ +$Header: /cvs/stx/stx/libbasic/Attic/ObjMem.st,v 1.40 1995-05-08 03:30:02 claus Exp $ " ! @@ -1505,6 +1505,7 @@ ] newProcess. p name:'background collector'. p priority:aPriority. + p restartable:true. p resume. BackgroundCollectProcess := p @@ -1961,6 +1962,7 @@ ] newProcess. p name:'background finalizer'. p priority:aPriority. + p restartable:true. p resume. BackgroundFinalizationProcess := p diff -r 20376737bdaf -r e8658d38abfb Object.st --- a/Object.st Sat May 06 06:26:35 1995 +0200 +++ b/Object.st Mon May 08 05:31:14 1995 +0200 @@ -29,7 +29,7 @@ COPYRIGHT (c) 1988 by Claus Gittinger All Rights Reserved -$Header: /cvs/stx/stx/libbasic/Object.st,v 1.43 1995-05-02 18:16:56 claus Exp $ +$Header: /cvs/stx/stx/libbasic/Object.st,v 1.44 1995-05-08 03:30:12 claus Exp $ '! !Object class methodsFor:'documentation'! @@ -50,7 +50,7 @@ version " -$Header: /cvs/stx/stx/libbasic/Object.st,v 1.43 1995-05-02 18:16:56 claus Exp $ +$Header: /cvs/stx/stx/libbasic/Object.st,v 1.44 1995-05-08 03:30:12 claus Exp $ " ! @@ -680,6 +680,13 @@ ^ false ! +isLayout + "return true, if the receiver is some kind of layout; + false is returned here - the method is only redefined in Layout." + + ^ false +! + isForm "return true, if the receiver is some kind of form; false is returned here - the method is only redefined in Form." @@ -2120,9 +2127,9 @@ val = _intVal(anObject); if ((val >= 0) && (val <= 0xFFFF)) { if ((indx >= 0) && (indx < (nbytes / sizeof(short)))) { - sp = (short *)pFirst + indx; - *sp = val; - RETURN ( anObject ); + sp = (short *)pFirst + indx; + *sp = val; + RETURN ( anObject ); } } } @@ -2725,9 +2732,9 @@ if (aSelector != last0) { ilc0.ilc_func = _SEND0; if (ilc0.ilc_poly) { - __flushPolyCache(ilc0.ilc_poly); - ilc0.ilc_poly = 0; - } + __flushPolyCache(ilc0.ilc_poly); + ilc0.ilc_poly = 0; + } last0 = aSelector; } #ifdef xxTHIS_CONTEXT @@ -2749,9 +2756,9 @@ if (aSelector != last1) { ilc1.ilc_func = _SEND1; if (ilc1.ilc_poly) { - __flushPolyCache(ilc1.ilc_poly); - ilc1.ilc_poly = 0; - } + __flushPolyCache(ilc1.ilc_poly); + ilc1.ilc_poly = 0; + } last1 = aSelector; } #ifdef xxTHIS_CONTEXT @@ -2763,9 +2770,9 @@ if (aSelector != last2) { ilc2.ilc_func = _SEND2; if (ilc2.ilc_poly) { - __flushPolyCache(ilc2.ilc_poly); - ilc2.ilc_poly = 0; - } + __flushPolyCache(ilc2.ilc_poly); + ilc2.ilc_poly = 0; + } last2 = aSelector; } #ifdef xxTHIS_CONTEXT @@ -2778,9 +2785,9 @@ if (aSelector != last3) { ilc3.ilc_func = _SEND3; if (ilc3.ilc_poly) { - __flushPolyCache(ilc3.ilc_poly); - ilc3.ilc_poly = 0; - } + __flushPolyCache(ilc3.ilc_poly); + ilc3.ilc_poly = 0; + } last3 = aSelector; } #ifdef xxTHIS_CONTEXT @@ -2793,9 +2800,9 @@ if (aSelector != last4) { ilc4.ilc_func = _SEND4; if (ilc4.ilc_poly) { - __flushPolyCache(ilc4.ilc_poly); - ilc4.ilc_poly = 0; - } + __flushPolyCache(ilc4.ilc_poly); + ilc4.ilc_poly = 0; + } last4 = aSelector; } #ifdef xxTHIS_CONTEXT @@ -2808,9 +2815,9 @@ if (aSelector != last5) { ilc5.ilc_func = _SEND5; if (ilc5.ilc_poly) { - __flushPolyCache(ilc5.ilc_poly); - ilc5.ilc_poly = 0; - } + __flushPolyCache(ilc5.ilc_poly); + ilc5.ilc_poly = 0; + } last5 = aSelector; } #ifdef xxTHIS_CONTEXT @@ -2823,9 +2830,9 @@ if (aSelector != last6) { ilc6.ilc_func = _SEND6; if (ilc6.ilc_poly) { - __flushPolyCache(ilc6.ilc_poly); - ilc6.ilc_poly = 0; - } + __flushPolyCache(ilc6.ilc_poly); + ilc6.ilc_poly = 0; + } last6 = aSelector; } #ifdef xxTHIS_CONTEXT @@ -2839,9 +2846,9 @@ if (aSelector != last7) { ilc7.ilc_func = _SEND7; if (ilc7.ilc_poly) { - __flushPolyCache(ilc7.ilc_poly); - ilc7.ilc_poly = 0; - } + __flushPolyCache(ilc7.ilc_poly); + ilc7.ilc_poly = 0; + } last7 = aSelector; } #ifdef xxTHIS_CONTEXT diff -r 20376737bdaf -r e8658d38abfb ObjectMemory.st --- a/ObjectMemory.st Sat May 06 06:26:35 1995 +0200 +++ b/ObjectMemory.st Mon May 08 05:31:14 1995 +0200 @@ -33,7 +33,7 @@ COPYRIGHT (c) 1992 by Claus Gittinger All Rights Reserved -$Header: /cvs/stx/stx/libbasic/ObjectMemory.st,v 1.39 1995-05-03 15:30:06 claus Exp $ +$Header: /cvs/stx/stx/libbasic/ObjectMemory.st,v 1.40 1995-05-08 03:30:02 claus Exp $ '! !ObjectMemory class methodsFor:'documentation'! @@ -54,7 +54,7 @@ version " -$Header: /cvs/stx/stx/libbasic/ObjectMemory.st,v 1.39 1995-05-03 15:30:06 claus Exp $ +$Header: /cvs/stx/stx/libbasic/ObjectMemory.st,v 1.40 1995-05-08 03:30:02 claus Exp $ " ! @@ -1505,6 +1505,7 @@ ] newProcess. p name:'background collector'. p priority:aPriority. + p restartable:true. p resume. BackgroundCollectProcess := p @@ -1961,6 +1962,7 @@ ] newProcess. p name:'background finalizer'. p priority:aPriority. + p restartable:true. p resume. BackgroundFinalizationProcess := p diff -r 20376737bdaf -r e8658d38abfb Point.st --- a/Point.st Sat May 06 06:26:35 1995 +0200 +++ b/Point.st Mon May 08 05:31:14 1995 +0200 @@ -21,7 +21,7 @@ COPYRIGHT (c) 1989 by Claus Gittinger All Rights Reserved -$Header: /cvs/stx/stx/libbasic/Point.st,v 1.20 1995-04-02 11:07:32 claus Exp $ +$Header: /cvs/stx/stx/libbasic/Point.st,v 1.21 1995-05-08 03:30:26 claus Exp $ '! !Point class methodsFor:'documentation'! @@ -42,7 +42,7 @@ version " -$Header: /cvs/stx/stx/libbasic/Point.st,v 1.20 1995-04-02 11:07:32 claus Exp $ +$Header: /cvs/stx/stx/libbasic/Point.st,v 1.21 1995-05-08 03:30:26 claus Exp $ " ! @@ -292,6 +292,33 @@ and corner being the receiver" ^ self corner:self +! + +asLayout + "return a LayoutOrigin from the receiver. + If the receiver coordinates are between 0 and 1, take + them as fractional parts (relative to superview). + Otherwise, treat them as absolute offsets. + Notice: in 10.5.x LayoutOrigin is not yet released." + + ^ LayoutOrigin fromPoint:self +! + +asFractionalLayout + "return a LayoutOrigin from the receiver, + treating the receiver coordinates as fractional parts + (i.e. relative to superview). + Notice: in 10.5.x LayoutOrigin is not yet released." + + ^ LayoutOrigin fractionalFromPoint:self +! + +asOffsetLayout + "return a LayoutOrigin from the receiver, + treating the receiver coordinates as absolute offsets. + Notice: in 10.5.x LayoutOrigin is not yet released." + + ^ LayoutOrigin offsetFromPoint:self ! ! !Point methodsFor:'creating rectangles'! diff -r 20376737bdaf -r e8658d38abfb ProcSched.st --- a/ProcSched.st Sat May 06 06:26:35 1995 +0200 +++ b/ProcSched.st Mon May 08 05:31:14 1995 +0200 @@ -34,7 +34,7 @@ COPYRIGHT (c) 1993 by Claus Gittinger All Rights Reserved -$Header: /cvs/stx/stx/libbasic/Attic/ProcSched.st,v 1.37 1995-05-04 12:48:05 claus Exp $ +$Header: /cvs/stx/stx/libbasic/Attic/ProcSched.st,v 1.38 1995-05-08 03:30:32 claus Exp $ '! Smalltalk at:#Processor put:nil! @@ -57,7 +57,7 @@ version " -$Header: /cvs/stx/stx/libbasic/Attic/ProcSched.st,v 1.37 1995-05-04 12:48:05 claus Exp $ +$Header: /cvs/stx/stx/libbasic/Attic/ProcSched.st,v 1.38 1995-05-08 03:30:32 claus Exp $ " ! @@ -258,17 +258,20 @@ %} ! -threadCreate:aProcess +threadCreate:aProcess withId:id "physical creation of a process. (warning: low level entry, no administration done). - This may return nil, if a VM process could not be created." + This may raise an exception, if a VM process could not be created." %{ /* NOCONTEXT */ int tid; extern int __threadCreate(); - tid = __threadCreate(aProcess, 0 /* stackSize no longer needed */); - if (tid != 0) { + tid = __threadCreate(aProcess, + 0 /* stackSize: no longer needed */, + __isSmallInteger(id) ? _intVal(id) /* assign id */ + : -1 /* let VM assign one */ ); + if (tid) { RETURN ( _MKSMALLINT(tid)); } %} @@ -527,12 +530,15 @@ "how, exactly should this be done ?" p isRestartable == true ifTrue:[ + p nextLink:nil. processesToRestart add:p - ]. - p setId:nil state:#dead + ] ifFalse:[ + p setId:nil state:#dead + ] ]. scheduler setId:nil state:#dead ]. + scheduler setId:nil state:#dead. " now, start from scratch @@ -607,14 +613,30 @@ !ProcessorScheduler methodsFor:'process creation'! +newProcessFor:aProcess withId:idWant + "private entry for Process restart - do not use in your program" + + |id| + + (self class threadCreate:aProcess withId:idWant) ~~ idWant ifTrue:[ + ^ false + ]. + + aProcess state:#light. "meaning: has no stack yet" + self remember:aProcess. + ^ true +! + newProcessFor:aProcess "create a physical (VM-) process for aProcess. Return true if ok, false if something went wrong. - The process is not scheduled; to start it running, it needs a Process>>resume." + The process is not scheduled; to start it running, + it needs a Process>>resume. Once resumed, the process will later + get control in its #start method." |id| - id := self class threadCreate:aProcess. + id := self class threadCreate:aProcess withId:nil. id isNil ifTrue:[^ false]. aProcess setId:id state:#light. "meaning: has no stack yet" @@ -693,7 +715,7 @@ ^ self ]. aProcess == scheduler ifTrue:[ - 'scheduler should never be suspended' printNL. + 'scheduler should never be suspended' errorPrintNL. MiniDebugger enterWithMessage:'scheduler should never be suspended'. ^ self ]. @@ -709,7 +731,7 @@ l isNil ifTrue:[ wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. - 'bad suspend: empty run list' printNL. + 'bad suspend: empty run list' errorPrintNL. "/ MiniDebugger enterWithMessage:'bad suspend: empty run list'. self threadSwitch:scheduler. ^ self @@ -720,7 +742,7 @@ " (l remove:aProcess ifAbsent:[]) isNil ifTrue:[ wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. - 'bad suspend: not on run list' printNL. + 'bad suspend: not on run list' errorPrintNL. "/ MiniDebugger enterWithMessage:'bad suspend: not on run list'. self threadSwitch:scheduler. ^ self @@ -983,11 +1005,11 @@ highestPriorityRunnableProcess "return the highest prio runnable process" - |listArray l p maxPri "{ Class: SmallInteger }" | + |listArray l p prio "{ Class: SmallInteger }" | - maxPri := HighestPriority. + prio := HighestPriority. listArray := quiescentProcessLists. - maxPri to:1 by:-1 do:[:prio | + [prio >= 1] whileTrue:[ l := listArray at:prio. l notNil ifTrue:[ l isEmpty ifTrue:[ @@ -998,16 +1020,17 @@ ] ifFalse:[ p := l first. " - if it got corrupted somehow + if it got corrupted somehow ... " p id isNil ifTrue:[ - 'process with nil id removed' printNL. + 'process with nil id removed' errorPrintNL. l removeFirst. ^ nil. ]. ^ p ]. - ] + ]. + prio := prio - 1 ]. ^ nil ! diff -r 20376737bdaf -r e8658d38abfb Process.st --- a/Process.st Sat May 06 06:26:35 1995 +0200 +++ b/Process.st Mon May 08 05:31:14 1995 +0200 @@ -24,7 +24,7 @@ COPYRIGHT (c) 1992 by Claus Gittinger All Rights Reserved -$Header: /cvs/stx/stx/libbasic/Process.st,v 1.25 1995-05-04 12:48:11 claus Exp $ +$Header: /cvs/stx/stx/libbasic/Process.st,v 1.26 1995-05-08 03:30:40 claus Exp $ '! !Process class methodsFor:'documentation'! @@ -45,7 +45,7 @@ version " -$Header: /cvs/stx/stx/libbasic/Process.st,v 1.25 1995-05-04 12:48:11 claus Exp $ +$Header: /cvs/stx/stx/libbasic/Process.st,v 1.26 1995-05-08 03:30:40 claus Exp $ " ! @@ -232,10 +232,11 @@ "setup the new process - the receiver is not scheduled for execution, to get it running, send it #resume" - |nm| + |nm active| prio := aPrio. startBlock := aBlock. + restartable := false. (Processor newProcessFor:self) ifFalse:[ "for some reason, the Processor was unable to create @@ -246,12 +247,13 @@ " give me a user-friendly name " - (nm := Processor activeProcess name) notNil ifTrue:[ + active := Processor activeProcess. + (nm := active name) notNil ifTrue:[ " avoid name inflation " (nm endsWith:' sub') ifFalse:[ - nm := nm , ' [' , Processor activeProcess id printString , '] sub' + nm := nm , ' [' , active id printString , '] sub' ]. name := nm ] @@ -552,8 +554,9 @@ "restart the process from the beginning. This is sent by the ProcessorScheduler to all restartable processes." -('restart process ' , id printString) errorPrintNL. - (Processor newProcessFor:self) ifFalse:[ +"/ ('restart process ' , id printString) errorPrintNL. + + (Processor newProcessFor:self withId:id) ifFalse:[ "for some reason, the Processor was unable to create a VM process for me ...." diff -r 20376737bdaf -r e8658d38abfb ProcessorScheduler.st --- a/ProcessorScheduler.st Sat May 06 06:26:35 1995 +0200 +++ b/ProcessorScheduler.st Mon May 08 05:31:14 1995 +0200 @@ -34,7 +34,7 @@ COPYRIGHT (c) 1993 by Claus Gittinger All Rights Reserved -$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.37 1995-05-04 12:48:05 claus Exp $ +$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.38 1995-05-08 03:30:32 claus Exp $ '! Smalltalk at:#Processor put:nil! @@ -57,7 +57,7 @@ version " -$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.37 1995-05-04 12:48:05 claus Exp $ +$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.38 1995-05-08 03:30:32 claus Exp $ " ! @@ -258,17 +258,20 @@ %} ! -threadCreate:aProcess +threadCreate:aProcess withId:id "physical creation of a process. (warning: low level entry, no administration done). - This may return nil, if a VM process could not be created." + This may raise an exception, if a VM process could not be created." %{ /* NOCONTEXT */ int tid; extern int __threadCreate(); - tid = __threadCreate(aProcess, 0 /* stackSize no longer needed */); - if (tid != 0) { + tid = __threadCreate(aProcess, + 0 /* stackSize: no longer needed */, + __isSmallInteger(id) ? _intVal(id) /* assign id */ + : -1 /* let VM assign one */ ); + if (tid) { RETURN ( _MKSMALLINT(tid)); } %} @@ -527,12 +530,15 @@ "how, exactly should this be done ?" p isRestartable == true ifTrue:[ + p nextLink:nil. processesToRestart add:p - ]. - p setId:nil state:#dead + ] ifFalse:[ + p setId:nil state:#dead + ] ]. scheduler setId:nil state:#dead ]. + scheduler setId:nil state:#dead. " now, start from scratch @@ -607,14 +613,30 @@ !ProcessorScheduler methodsFor:'process creation'! +newProcessFor:aProcess withId:idWant + "private entry for Process restart - do not use in your program" + + |id| + + (self class threadCreate:aProcess withId:idWant) ~~ idWant ifTrue:[ + ^ false + ]. + + aProcess state:#light. "meaning: has no stack yet" + self remember:aProcess. + ^ true +! + newProcessFor:aProcess "create a physical (VM-) process for aProcess. Return true if ok, false if something went wrong. - The process is not scheduled; to start it running, it needs a Process>>resume." + The process is not scheduled; to start it running, + it needs a Process>>resume. Once resumed, the process will later + get control in its #start method." |id| - id := self class threadCreate:aProcess. + id := self class threadCreate:aProcess withId:nil. id isNil ifTrue:[^ false]. aProcess setId:id state:#light. "meaning: has no stack yet" @@ -693,7 +715,7 @@ ^ self ]. aProcess == scheduler ifTrue:[ - 'scheduler should never be suspended' printNL. + 'scheduler should never be suspended' errorPrintNL. MiniDebugger enterWithMessage:'scheduler should never be suspended'. ^ self ]. @@ -709,7 +731,7 @@ l isNil ifTrue:[ wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. - 'bad suspend: empty run list' printNL. + 'bad suspend: empty run list' errorPrintNL. "/ MiniDebugger enterWithMessage:'bad suspend: empty run list'. self threadSwitch:scheduler. ^ self @@ -720,7 +742,7 @@ " (l remove:aProcess ifAbsent:[]) isNil ifTrue:[ wasBlocked ifFalse:[OperatingSystem unblockInterrupts]. - 'bad suspend: not on run list' printNL. + 'bad suspend: not on run list' errorPrintNL. "/ MiniDebugger enterWithMessage:'bad suspend: not on run list'. self threadSwitch:scheduler. ^ self @@ -983,11 +1005,11 @@ highestPriorityRunnableProcess "return the highest prio runnable process" - |listArray l p maxPri "{ Class: SmallInteger }" | + |listArray l p prio "{ Class: SmallInteger }" | - maxPri := HighestPriority. + prio := HighestPriority. listArray := quiescentProcessLists. - maxPri to:1 by:-1 do:[:prio | + [prio >= 1] whileTrue:[ l := listArray at:prio. l notNil ifTrue:[ l isEmpty ifTrue:[ @@ -998,16 +1020,17 @@ ] ifFalse:[ p := l first. " - if it got corrupted somehow + if it got corrupted somehow ... " p id isNil ifTrue:[ - 'process with nil id removed' printNL. + 'process with nil id removed' errorPrintNL. l removeFirst. ^ nil. ]. ^ p ]. - ] + ]. + prio := prio - 1 ]. ^ nil ! diff -r 20376737bdaf -r e8658d38abfb Stream.st --- a/Stream.st Sat May 06 06:26:35 1995 +0200 +++ b/Stream.st Mon May 08 05:31:14 1995 +0200 @@ -21,7 +21,7 @@ COPYRIGHT (c) 1989 by Claus Gittinger All Rights Reserved -$Header: /cvs/stx/stx/libbasic/Stream.st,v 1.16 1995-05-03 15:30:50 claus Exp $ +$Header: /cvs/stx/stx/libbasic/Stream.st,v 1.17 1995-05-08 03:30:58 claus Exp $ '! !Stream class methodsFor:'documentation'! @@ -42,7 +42,7 @@ version " -$Header: /cvs/stx/stx/libbasic/Stream.st,v 1.16 1995-05-03 15:30:50 claus Exp $ +$Header: /cvs/stx/stx/libbasic/Stream.st,v 1.17 1995-05-08 03:30:58 claus Exp $ " ! @@ -244,6 +244,12 @@ !Stream methodsFor:'writing'! +commit + "write out all unbuffered data - ignored here, but added + to make internalStreams protocol compatible with externalStreams" + +! + nextPut:anObject "put the argument, anObject onto the receiver - we do not know here how to do it, it must be redefined in subclass" @@ -722,6 +728,13 @@ !Stream methodsFor:'queries'! +isBinary + "return true, if in binary mode. Returns false here, + to make internalStreams protocol compatible with externStreams." + + ^ false +! + isStream "return true, if the receiver is some kind of Stream."