Thread View: pe.cust.sources
1 messages
1 total messages
Started by Earl Wallace
Thu, 13 Jun 1985 19:24
Little Smalltalk Source, *New* Part 8 of 20
Author: Earl Wallace
Date: Thu, 13 Jun 1985 19:24
Date: Thu, 13 Jun 1985 19:24
1367 lines
36813 bytes
36813 bytes
#! /bin/sh
#
# This is an another posting of the Little Smalltalk source, the last posting
# of this source went out in 5 parts and they were too big (>200k) for most
# sites so I redid the whole mess to keep the files around the 50k range.
#
# The complete set is now 20 parts.
#
# P.S. - If you don't receive all 20 parts within 5 days, drop me a line.
# Also, I have the Rand sources of May 1984, if someone has a more
# updated copy, I'll be happy to post them (or YOU can post them :-))
#
# -earlw@pesnta
#
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
# prelude/number.st
# prelude/object.p
# prelude/object.st
# prelude/point.p
# prelude/point.st
# prelude/process.p
# prelude/process.st
# prelude/radian.p
# prelude/radian.st
# prelude/random.p
# prelude/random.st
# prelude/savescript
# prelude/scollection.p
# prelude/scollection.st
# prelude/semaphore.p
# prelude/semaphore.st
# prelude/set.p
# prelude/set.st
# prelude/smalltalk.p
# prelude/smalltalk.st
# This archive created: Thu Jun 13 11:32:13 1985
# By: Earl Wallace (Perkin-Elmer Data Systems Group / Customer Service)
export PATH; PATH=/bin:$PATH
if test -f 'prelude/number.st'
then
echo shar: will not over-write existing file "'prelude/number.st'"
else
cat << \SHAR_EOF > 'prelude/number.st'
Class Number :Magnitude
[
maxtype: aNumber
^ <primitive 9 self aNumber>
ifTrue: [self]
ifFalse: [aNumber coerce: self ]
|
= aNumber
^ (self maxtype: aNumber) = (aNumber maxtype: self)
|
< aNumber
^ (self maxtype: aNumber) < (aNumber maxtype: self)
|
> aNumber
^ (self maxtype: aNumber) > (aNumber maxtype: self)
|
+ aNumber
^ (self maxtype: aNumber) + (aNumber maxtype: self)
|
- aNumber
^ (self maxtype: aNumber) - (aNumber maxtype: self)
|
* aNumber
^ (self maxtype: aNumber) * (aNumber maxtype: self)
|
/ aNumber
^ (self maxtype: aNumber) / (aNumber maxtype: self)
|
^ aNumber
^ self asFloat ^ aNumber asFloat
|
@ aNumber
^ ( Point new x: self ) y: aNumber
|
abs
^ (self < 0)
ifTrue: [ 0 - self ]
ifFalse: [ self ]
|
exp
^ self asFloat exp
|
gamma
^ self asFloat gamma
|
ln
^ self asFloat ln
|
log: aNumber
^ self ln / aNumber ln
|
negated
^ 0 - self
|
negative
^ self < 0
|
pi
^ self * 3.1415926
|
positive
^ self >= 0
|
radians
^ Radian new: self asFloat
|
raisedTo: aNumber
^ self asFloat ^ aNumber asFloat
|
reciprocal
^ 1.00 / self
|
roundTo: aNumber
^ (self / aNumber) rounded * aNumber
|
sign
^ (self < 0)
ifTrue: [ -1 ]
ifFalse: [ (self > 0)
ifTrue: [ 1 ]
ifFalse: [ 0 ] ]
|
sqrt
^ self asFloat sqrt
|
squared
^ self * self
|
strictlyPositive
^ self > 0
|
to: highValue
^ Interval new ; from: self to: highValue by: 1
|
to: highValue by: stepSize
^ Interval new ; from: self to: highValue by: stepSize
|
truncateTo: aNumber
^ (self / aNumber) truncated * aNumber
]
SHAR_EOF
if test 1597 -ne "`wc -c < 'prelude/number.st'`"
then
echo shar: error transmitting "'prelude/number.st'" '(should have been 1597 characters)'
fi
fi # end of overwriting check
if test -f 'prelude/object.p'
then
echo shar: will not over-write existing file "'prelude/object.p'"
else
cat << \SHAR_EOF > 'prelude/object.p'
temp <- <primitive 110 21 >
<primitive 112 temp 1 " shallowCopy " \
#( #[ 32 250 1 4 113 33 80 199 247 4 32 243 248 26 242 \
32 164 160 114 81 33 178 225 3 11 34 35 32 35 250 \
2 111 250 3 112 243 179 242 34 243 242 245] \
#( ) ) >
<primitive 112 temp 2 " respondsTo: " \
#( #[ 32 164 33 11 41 243 245] \
#( ) ) >
<primitive 112 temp 3 " printString " \
#( #[ 32 10 16 243 245] \
#( ) ) >
<primitive 112 temp 4 " print " \
#( #[ 32 169 250 1 121 242 245] \
#( ) ) >
<primitive 112 temp 5 " notNil " \
#( #[ 91 243 245] \
#( ) ) >
<primitive 112 temp 6 " next " \
#( #[ 93 243 245] \
#( ) ) >
<primitive 112 temp 7 " isNil " \
#( #[ 92 243 245] \
#( ) ) >
<primitive 112 temp 8 " isMemberOf: " \
#( #[ 33 32 164 181 243 245] \
#( ) ) >
<primitive 112 temp 9 " isKindOf: " \
#( #[ 32 164 114 34 162 247 16 34 33 181 247 2 91 243 242 \
34 10 46 241 114 242 249 20 242 92 243 245] \
#( ) ) >
<primitive 112 temp 10 " first " \
#( #[ 32 243 245] \
#( ) ) >
<primitive 112 temp 11 " error: " \
#( #[ 33 32 250 2 122 242 245] \
#( ) ) >
<primitive 112 temp 12 " do: " \
#( #[ 32 166 114 34 162 247 11 33 34 180 242 32 167 241 114 \
242 249 15 243 245] \
#( ) ) >
<primitive 112 temp 13 " deepCopy " \
#( #[ 32 250 1 4 113 33 80 199 247 4 32 243 248 28 242 \
32 164 160 114 81 33 178 225 3 13 34 35 32 35 250 \
2 111 10 20 250 3 112 243 179 242 34 243 242 245] \
#( ) ) >
<primitive 112 temp 14 " copy " \
#( #[ 32 10 42 243 245] \
#( ) ) >
<primitive 112 temp 15 " class " \
#( #[ 32 250 1 1 243 245] \
#( ) ) >
<primitive 112 temp 16 " asSymbol " \
#( #[ 32 10 16 10 17 243 245] \
#( ) ) >
<primitive 112 temp 17 " asString " \
#( #[ 32 164 169 243 245] \
#( ) ) >
<primitive 112 temp 18 " ~= " \
#( #[ 32 33 201 172 243 245] \
#( ) ) >
<primitive 112 temp 19 " = " \
#( #[ 32 33 181 243 245] \
#( ) ) >
<primitive 112 temp 20 " ~~ " \
#( #[ 32 33 181 172 243 245] \
#( ) ) >
<primitive 112 temp 21 " == " \
#( #[ 32 33 250 2 7 243 245] \
#( ) ) >
<primitive 98 #Object \
<primitive 97 #Object #Object #/u/smalltalk/prelude/object.st \
#( ) \
#( #shallowCopy #respondsTo: #printString #print #notNil #next #isNil #isMemberOf: #isKindOf: #first #error: #do: #deepCopy #copy #class #asSymbol #asString #~= #= #~~ #== ) \
temp 4 7 > >
SHAR_EOF
if test 2344 -ne "`wc -c < 'prelude/object.p'`"
then
echo shar: error transmitting "'prelude/object.p'" '(should have been 2344 characters)'
fi
fi # end of overwriting check
if test -f 'prelude/object.st'
then
echo shar: will not over-write existing file "'prelude/object.st'"
else
cat << \SHAR_EOF > 'prelude/object.st'
Class Object
[
== anObject
^ <primitive 7 self anObject >
|
~~ x
^ (self == x) not
|
= x
^ (self == x)
|
~= x
^ (self = x) not
|
asString
^ self class printString
|
asSymbol
^ self asString asSymbol
|
class
^ <primitive 1 self >
|
copy
^ self shallowCopy
|
deepCopy | size newobj |
size <- <primitive 4 self>.
(size < 0)
ifTrue: [^ self] "if special just copy object"
ifFalse: [ newobj <- self class new.
(1 to: size) do: [:i |
<primitive 112 newobj i
( <primitive 111 self i > copy ) > ].
^ newobj ]
|
do: aBlock | item |
item <- self first.
^ [item notNil] whileTrue:
[aBlock value: item. item <- self next]
|
error: aString
<primitive 122 aString self>
|
first
^ self
|
isKindOf: aClass | objectClass |
objectClass <- self class.
[objectClass notNil] whileTrue:
[(objectClass == aClass) ifTrue: [^ true].
objectClass <- objectClass superClass].
^ false
|
isMemberOf: aClass
^ aClass == self class
|
isNil
^ false
|
next
^ nil
|
notNil
^ true
|
print
<primitive 121 (self printString) >
|
printString
^ self asString
| respondsTo: cmd
^ self class respondsTo: cmd
| shallowCopy | size newobj |
size <- <primitive 4 self>.
(size < 0)
ifTrue: [^ self] "if special just copy object"
ifFalse: [ newobj <- self class new.
(1 to: size) do: [:i |
<primitive 112 newobj i
<primitive 111 self i > > ].
^ newobj ]
]
SHAR_EOF
if test 1760 -ne "`wc -c < 'prelude/object.st'`"
then
echo shar: error transmitting "'prelude/object.st'" '(should have been 1760 characters)'
fi
fi # end of overwriting check
if test -f 'prelude/point.p'
then
echo shar: will not over-write existing file "'prelude/point.p'"
else
cat << \SHAR_EOF > 'prelude/point.p'
temp <- <primitive 110 21 >
<primitive 112 temp 1 " y: " \
#( #[ 33 97 245] \
#( ) ) >
<primitive 112 temp 2 " y " \
#( #[ 17 243 245] \
#( ) ) >
<primitive 112 temp 3 " x:y: " \
#( #[ 33 96 34 97 245] \
#( ) ) >
<primitive 112 temp 4 " x: " \
#( #[ 33 96 245] \
#( ) ) >
<primitive 112 temp 5 " x " \
#( #[ 16 243 245] \
#( ) ) >
<primitive 112 temp 6 " transpose " \
#( #[ 5 53 160 17 11 50 16 11 51 243 245] \
#( ) ) >
<primitive 112 temp 7 " printString " \
#( #[ 16 169 48 11 17 17 169 11 17 243 245] \
#( ' @ ' ) ) >
<primitive 112 temp 8 " min: " \
#( #[ 5 53 160 16 33 10 49 207 11 50 17 33 10 50 207 \
11 51 243 245] \
#( ) ) >
<primitive 112 temp 9 " max: " \
#( #[ 5 53 160 16 33 10 49 12 16 11 50 17 33 10 50 \
12 16 11 51 243 245] \
#( ) ) >
<primitive 112 temp 10 " dist: " \
#( #[ 16 33 10 49 193 10 44 17 33 10 50 193 10 44 192 \
10 43 243 245] \
#( ) ) >
<primitive 112 temp 11 " asString " \
#( #[ 16 10 16 48 11 17 17 10 16 11 17 243 245] \
#( ' @ ' ) ) >
<primitive 112 temp 12 " abs " \
#( #[ 5 53 160 16 173 11 50 17 173 11 51 243 245] \
#( ) ) >
<primitive 112 temp 13 " // " \
#( #[ 5 53 160 16 33 11 18 11 50 17 33 11 18 11 51 \
243 245] \
#( ) ) >
<primitive 112 temp 14 " / " \
#( #[ 5 53 160 16 33 190 11 50 17 33 190 11 51 243 245 \
] \
#( ) ) >
<primitive 112 temp 15 " - " \
#( #[ 5 53 160 16 33 10 49 193 11 50 17 33 10 50 193 \
11 51 243 245] \
#( ) ) >
<primitive 112 temp 16 " + " \
#( #[ 5 53 160 16 33 10 49 192 11 50 17 33 10 50 192 \
11 51 243 245] \
#( ) ) >
<primitive 112 temp 17 " * " \
#( #[ 5 53 160 16 33 194 11 50 17 33 194 11 51 243 245 \
] \
#( ) ) >
<primitive 112 temp 18 " = " \
#( #[ 16 33 10 49 201 252 5 17 33 10 50 201 243 245] \
#( ) ) >
<primitive 112 temp 19 " >= " \
#( #[ 16 33 10 49 203 252 5 17 33 10 50 203 243 245] \
#( ) ) >
<primitive 112 temp 20 " <= " \
#( #[ 16 33 10 49 200 252 5 17 33 10 50 199 243 245] \
#( ) ) >
<primitive 112 temp 21 " < " \
#( #[ 16 33 10 49 199 252 5 17 33 10 50 199 243 245] \
#( ) ) >
<primitive 98 #Point \
<primitive 97 #Point #Magnitude #/u/smalltalk/prelude/point.st \
#( #xvalue #yvalue ) \
#( #y: #y #x:y: #x: #x #transpose #printString #min: #max: #dist: #asString #abs #// #/ #- #+ #* #= #>= #<= #< ) \
temp 3 4 > >
SHAR_EOF
if test 2339 -ne "`wc -c < 'prelude/point.p'`"
then
echo shar: error transmitting "'prelude/point.p'" '(should have been 2339 characters)'
fi
fi # end of overwriting check
if test -f 'prelude/point.st'
then
echo shar: will not over-write existing file "'prelude/point.st'"
else
cat << \SHAR_EOF > 'prelude/point.st'
Class Point :Magnitude
| xvalue yvalue |
[
< aPoint
^ (xvalue < aPoint x) and: [yvalue < aPoint y]
|
<= aPoint
^ (xvalue <= aPoint x) and: [yvalue < aPoint y]
|
>= aPoint
^ (xvalue >= aPoint x) and: [yvalue >= aPoint y]
|
= aPoint
^ (xvalue = aPoint x) and: [yvalue = aPoint y]
|
* scale
^ (Point new x: (xvalue * scale)) y: (yvalue * scale)
|
+ delta
^ (Point new x: (xvalue + delta x)) y: (yvalue + delta y)
|
- delta
^ (Point new x: (xvalue - delta x)) y: (yvalue - delta y)
|
/ scale
^ (Point new x: (xvalue / scale)) y: (yvalue / scale)
|
// scale
^ (Point new x: (xvalue // scale)) y: (yvalue // scale)
|
abs
^ (Point new x: xvalue abs) y: (yvalue abs)
|
asString
^ xvalue asString , ' @ ' , (yvalue asString)
|
dist: aPoint
^ ((xvalue - aPoint x) squared +
(yvalue - aPoint y) squared) sqrt
|
max: aPoint
^ (Point new x: (xvalue max: aPoint x))
y: (yvalue max: aPoint y)
|
min: aPoint
^ (Point new x: (xvalue min: aPoint x))
y: (yvalue min: aPoint y)
|
printString
^ xvalue printString , ' @ ' , (yvalue printString)
|
transpose
^ (Point new x: yvalue) y: xvalue
|
x
^ xvalue
|
x: aValue
xvalue <- aValue
|
x: xValue y: yValue
xvalue <- xValue.
yvalue <- yValue
|
y
^ yvalue
|
y: aValue
yvalue <- aValue
]
SHAR_EOF
if test 1288 -ne "`wc -c < 'prelude/point.st'`"
then
echo shar: error transmitting "'prelude/point.st'" '(should have been 1288 characters)'
fi
fi # end of overwriting check
if test -f 'prelude/process.p'
then
echo shar: will not over-write existing file "'prelude/process.p'"
else
cat << \SHAR_EOF > 'prelude/process.p'
temp <- <primitive 110 8 >
<primitive 112 temp 1 " yield " \
#( #[ 93 243 245] \
#( ) ) >
<primitive 112 temp 2 " unblock " \
#( #[ 32 10 45 48 181 247 7 32 49 11 47 242 93 243 242 \
32 83 250 2 145 242 32 10 45 243 245] \
#( #TERMINATED 'unblock' ) ) >
<primitive 112 temp 3 " termErr: " \
#( #[ 48 33 11 17 49 11 17 168 242 245] \
#( 'Cannot ' ' a terminated process.' ) ) >
<primitive 112 temp 4 " terminate " \
#( #[ 32 250 1 142 242 32 10 45 243 245] \
#( ) ) >
<primitive 112 temp 5 " state " \
#( #[ 32 250 1 146 113 33 80 201 247 4 48 113 33 243 242 \
33 81 201 247 4 49 113 33 243 242 33 82 201 247 4 \
50 113 33 243 242 33 83 201 247 4 50 113 33 243 242 \
33 84 203 247 4 51 113 33 243 242 245] \
#( #READY #SUSPENDED #BLOCKED #TERMINATED ) ) >
<primitive 112 temp 6 " suspend " \
#( #[ 32 10 45 48 181 247 7 32 49 11 47 242 93 243 242 \
32 81 250 2 145 242 32 10 45 243 245] \
#( #TERMINATED 'suspend' ) ) >
<primitive 112 temp 7 " resume " \
#( #[ 32 10 45 48 181 247 7 32 49 11 47 242 93 243 242 \
32 80 250 2 145 242 32 10 45 243 245] \
#( #TERMINATED 'resume' ) ) >
<primitive 112 temp 8 " block " \
#( #[ 32 10 45 48 181 247 7 32 49 11 47 242 93 243 242 \
32 82 250 2 145 242 32 10 45 243 245] \
#( #TERMINATED 'block' ) ) >
<primitive 98 #Process \
<primitive 97 #Process #Object #/u/smalltalk/prelude/process.st \
#( ) \
#( #yield #unblock #termErr: #terminate #state #suspend #resume #block ) \
temp 2 4 > >
SHAR_EOF
if test 1481 -ne "`wc -c < 'prelude/process.p'`"
then
echo shar: error transmitting "'prelude/process.p'" '(should have been 1481 characters)'
fi
fi # end of overwriting check
if test -f 'prelude/process.st'
then
echo shar: will not over-write existing file "'prelude/process.st'"
else
cat << \SHAR_EOF > 'prelude/process.st'
Class Process
[ block
(self state == #TERMINATED)
ifTrue: [self termErr: 'block'. ^ nil].
<primitive 145 self 2>.
^ self state
| resume
(self state == #TERMINATED)
ifTrue: [self termErr: 'resume'. ^ nil].
<primitive 145 self 0>.
^ self state
| suspend
(self state == #TERMINATED)
ifTrue: [self termErr: 'suspend'. ^ nil].
<primitive 145 self 1>.
^ self state
| state | pstate |
pstate <- <primitive 146 self>.
(pstate = 0) ifTrue: [pstate <- #READY. ^ pstate].
(pstate = 1) ifTrue: [pstate <- #SUSPENDED. ^ pstate].
(pstate = 2) ifTrue: [pstate <- #BLOCKED. ^ pstate].
(pstate = 3) ifTrue: [pstate <- #BLOCKED. ^ pstate].
(pstate >= 4) ifTrue: [pstate <- #TERMINATED. ^ pstate]
| terminate
<primitive 142 self>.
^ self state
| termErr: msgName
('Cannot ',msgName,' a terminated process.') print
| unblock
(self state == #TERMINATED)
ifTrue: [self termErr: 'unblock'. ^ nil].
<primitive 145 self 3>.
^ self state
| yield
^ nil
]
SHAR_EOF
if test 1003 -ne "`wc -c < 'prelude/process.st'`"
then
echo shar: error transmitting "'prelude/process.st'" '(should have been 1003 characters)'
fi
fi # end of overwriting check
if test -f 'prelude/radian.p'
then
echo shar: will not over-write existing file "'prelude/radian.p'"
else
cat << \SHAR_EOF > 'prelude/radian.p'
temp <- <primitive 110 8 >
<primitive 112 temp 1 " printString " \
#( #[ 16 10 16 48 11 17 243 245] \
#( ' radians' ) ) >
<primitive 112 temp 2 " asFloat " \
#( #[ 16 243 245] \
#( ) ) >
<primitive 112 temp 3 " tan " \
#( #[ 16 250 1 81 16 250 1 82 190 243 245] \
#( ) ) >
<primitive 112 temp 4 " cos " \
#( #[ 16 250 1 82 243 245] \
#( ) ) >
<primitive 112 temp 5 " sin " \
#( #[ 16 250 1 81 243 245] \
#( ) ) >
<primitive 112 temp 6 " = " \
#( #[ 16 33 175 201 243 245] \
#( ) ) >
<primitive 112 temp 7 " < " \
#( #[ 16 33 175 199 243 245] \
#( ) ) >
<primitive 112 temp 8 " new: " \
#( #[ 33 175 250 1 80 96 245] \
#( ) ) >
<primitive 98 #Radian \
<primitive 97 #Radian #Magnitude #/u/smalltalk/prelude/radian.st \
#( #value ) \
#( #printString #asFloat #tan #cos #sin #= #< #new: ) \
temp 2 3 > >
SHAR_EOF
if test 848 -ne "`wc -c < 'prelude/radian.p'`"
then
echo shar: error transmitting "'prelude/radian.p'" '(should have been 848 characters)'
fi
fi # end of overwriting check
if test -f 'prelude/radian.st'
then
echo shar: will not over-write existing file "'prelude/radian.st'"
else
cat << \SHAR_EOF > 'prelude/radian.st'
Class Radian :Magnitude
| value |
[
new: x
value <- <primitive 80 (x asFloat) >
| < arg
^ value < arg asFloat
| = arg
^ value = arg asFloat
| sin
^ <primitive 81 value>
| cos
^ <primitive 82 value>
| tan
^ <primitive 81 value> / <primitive 82 value>
| asFloat
^ value
| printString
^ value asString , ' radians'
]
SHAR_EOF
if test 459 -ne "`wc -c < 'prelude/radian.st'`"
then
echo shar: error transmitting "'prelude/radian.st'" '(should have been 459 characters)'
fi
fi # end of overwriting check
if test -f 'prelude/random.p'
then
echo shar: will not over-write existing file "'prelude/random.p'"
else
cat << \SHAR_EOF > 'prelude/random.p'
temp <- <primitive 110 7 >
<primitive 112 temp 1 " next: " \
#( #[ 5 30 33 176 114 81 33 178 225 3 6 34 35 32 167 \
208 243 179 242 34 243 245] \
#( ) ) >
<primitive 112 temp 2 " randInteger: " \
#( #[ 32 167 33 194 10 47 81 192 243 245] \
#( ) ) >
<primitive 112 temp 3 " between:and: " \
#( #[ 32 167 34 33 193 194 33 192 243 245] \
#( ) ) >
<primitive 112 temp 4 " next " \
#( #[ 16 250 1 35 241 96 250 1 32 243 245] \
#( ) ) >
<primitive 112 temp 5 " first " \
#( #[ 16 250 1 35 241 96 250 1 32 243 245] \
#( ) ) >
<primitive 112 temp 6 " randomize " \
#( #[ 250 0 161 96 245] \
#( ) ) >
<primitive 112 temp 7 " new " \
#( #[ 81 96 245] \
#( ) ) >
<primitive 98 #Random \
<primitive 97 #Random #Object #/u/smalltalk/prelude/random.st \
#( #seed ) \
#( #next: #randInteger: #between:and: #next #first #randomize #new ) \
temp 4 6 > >
SHAR_EOF
if test 880 -ne "`wc -c < 'prelude/random.p'`"
then
echo shar: error transmitting "'prelude/random.p'" '(should have been 880 characters)'
fi
fi # end of overwriting check
if test -f 'prelude/random.st'
then
echo shar: will not over-write existing file "'prelude/random.st'"
else
cat << \SHAR_EOF > 'prelude/random.st'
Class Random
| seed |
[
new
seed <- 1
|
randomize
seed <- <primitive 161>
|
first
^ <primitive 32 (seed <- <primitive 35 seed > ) >
|
next
^ <primitive 32 (seed <- <primitive 35 seed > ) >
|
between: low and: high
^ (self next * (high - low)) + low
|
randInteger: limit
^ (self next * limit) truncated + 1
|
next: n | newa |
newa <- Array new: n.
(1 to: n) do: [:x | newa at: x put: self next].
^ newa
]
SHAR_EOF
if test 494 -ne "`wc -c < 'prelude/random.st'`"
then
echo shar: error transmitting "'prelude/random.st'" '(should have been 494 characters)'
fi
fi # end of overwriting check
if test -f 'prelude/savescript'
then
echo shar: will not over-write existing file "'prelude/savescript'"
else
cat << \SHAR_EOF > 'prelude/savescript'
)s stdsave
SHAR_EOF
if test 11 -ne "`wc -c < 'prelude/savescript'`"
then
echo shar: error transmitting "'prelude/savescript'" '(should have been 11 characters)'
fi
fi # end of overwriting check
if test -f 'prelude/scollection.p'
then
echo shar: will not over-write existing file "'prelude/scollection.p'"
else
cat << \SHAR_EOF > 'prelude/scollection.p'
temp <- <primitive 110 21 >
<primitive 112 temp 1 " with:do: " \
#( #[ 32 166 115 33 166 116 35 162 247 15 34 35 36 211 242 \
32 167 115 33 167 241 116 242 249 19 242 93 243 245] \
#( ) ) >
<primitive 112 temp 2 " sort: " \
#( #[ 32 174 116 82 36 163 178 225 5 51 37 81 193 114 34 \
81 203 252 11 33 36 34 177 36 34 81 192 177 211 172 \
247 28 36 34 177 115 36 34 36 34 81 192 177 208 242 \
36 34 81 192 35 208 242 34 81 193 241 114 242 249 46 \
243 179 242 32 36 191 243 245] \
#( ) ) >
<primitive 112 temp 3 " sort " \
#( #[ 32 226 1 4 33 34 200 243 11 46 243 245] \
#( ) ) >
<primitive 112 temp 4 " select: " \
#( #[ 32 32 5 48 160 226 2 12 33 35 180 247 4 34 35 \
11 22 242 34 243 215 191 243 245] \
#( ) ) >
<primitive 112 temp 5 " reversed " \
#( #[ 5 30 32 163 241 114 176 113 32 225 3 11 33 34 35 \
208 242 34 81 193 241 114 243 179 242 32 33 191 243 245 \
] \
#( ) ) >
<primitive 112 temp 6 " reverseDo: " \
#( #[ 32 10 31 114 32 10 25 115 34 35 203 247 20 32 34 \
11 52 247 5 33 32 34 177 180 242 34 81 193 241 114 \
242 249 25 242 93 243 245] \
#( ) ) >
<primitive 112 temp 7 " replaceFrom:to:with:startingAt: " \
#( #[ 80 117 33 37 192 34 200 247 19 32 33 37 192 35 37 \
36 192 177 208 242 37 81 192 241 117 242 249 26 242 245 \
] \
#( ) ) >
<primitive 112 temp 8 " replaceFrom:to:with: " \
#( #[ 35 33 226 4 9 32 36 37 208 242 36 81 192 243 215 \
242 245] \
#( ) ) >
<primitive 112 temp 9 " last " \
#( #[ 80 32 163 201 246 5 32 32 10 31 177 243 245] \
#( ) ) >
<primitive 112 temp 10 " indexOfSubCollection:startingAt: " \
#( #[ 32 33 34 224 6 32 48 188 242 93 243 131 1 243 245 \
] \
#( 'element not found' #indexOfSubCollection:startingAt:ifAbsent: ) ) >
<primitive 112 temp 11 " indexOfSubCollection:startingAt:ifAbsent: " \
#( #[ 34 116 32 163 33 163 193 117 36 37 200 247 17 33 32 \
36 221 247 2 36 243 242 36 81 192 241 116 242 249 22 \
242 35 165 243 245] \
#( ) ) >
<primitive 112 temp 12 " findLast:ifAbsent: " \
#( #[ 32 225 3 9 33 35 180 247 3 32 171 244 243 11 42 \
242 34 165 243 245] \
#( ) ) >
<primitive 112 temp 13 " findLast: " \
#( #[ 32 33 224 4 32 48 188 243 220 242 245] \
#( 'last element not found' ) ) >
<primitive 112 temp 14 " findFirst:ifAbsent: " \
#( #[ 32 225 3 9 33 35 180 247 3 32 171 244 243 179 242 \
34 165 243 245] \
#( ) ) >
<primitive 112 temp 15 " findFirst: " \
#( #[ 32 33 224 4 32 48 188 243 219 243 245] \
#( 'first element not found' ) ) >
<primitive 112 temp 16 " equals:startingAt: " \
#( #[ 80 115 32 225 4 22 36 33 34 35 192 224 2 92 244 \
213 201 246 2 92 244 242 35 81 192 241 115 243 179 242 \
91 243 245] \
#( ) ) >
<primitive 112 temp 17 " copyWithout: " \
#( #[ 5 48 160 114 32 225 3 10 35 33 181 246 4 34 35 \
11 22 243 179 242 32 34 191 243 245] \
#( ) ) >
<primitive 112 temp 18 " copyWith: " \
#( #[ 32 5 48 160 241 32 11 20 242 241 33 11 22 242 191 \
243 245] \
#( ) ) >
<primitive 112 temp 19 " copyFrom:to: " \
#( #[ 5 48 160 115 33 34 178 225 4 7 35 32 36 177 11 \
22 243 179 242 32 35 191 243 245] \
#( ) ) >
<primitive 112 temp 20 " collect: " \
#( #[ 32 32 5 48 160 226 2 9 34 33 35 180 11 22 242 \
34 243 215 191 243 245] \
#( ) ) >
<primitive 112 temp 21 " , " \
#( #[ 32 5 48 160 241 32 11 20 242 241 33 11 20 242 191 \
243 245] \
#( ) ) >
<primitive 98 #SequenceableCollection \
<primitive 97 #SequenceableCollection #KeyedCollection #/u/smalltalk/prelude/scollection.st \
#( ) \
#( #with:do: #sort: #sort #select: #reversed #reverseDo: #replaceFrom:to:with:startingAt: #replaceFrom:to:with: #last #indexOfSubCollection:startingAt: #indexOfSubCollection:startingAt:ifAbsent: #findLast:ifAbsent: #findLast: #findFirst:ifAbsent: #findFirst: #equals:startingAt: #copyWithout: #copyWith: #copyFrom:to: #collect: #, ) \
temp 6 9 > >
SHAR_EOF
if test 3846 -ne "`wc -c < 'prelude/scollection.p'`"
then
echo shar: error transmitting "'prelude/scollection.p'" '(should have been 3846 characters)'
fi
fi # end of overwriting check
if test -f 'prelude/scollection.st'
then
echo shar: will not over-write existing file "'prelude/scollection.st'"
else
cat << \SHAR_EOF > 'prelude/scollection.st'
Class SequenceableCollection :KeyedCollection
[
, aCollection
^ self coerce: (List new ;
addAllLast: self ;
addAllLast: aCollection )
|
collect: aBlock
^ self coerce:
(self inject: List new
into: [:x :y | x addLast: (aBlock value: y) . x ] )
|
copyFrom: start to: stop | newcol |
newcol <- List new.
(start to: stop) do: [:i | newcol addLast: (self at: i)].
^ self coerce: newcol
|
copyWith: newElement
^ self coerce: (List new ;
addAllLast: self ;
addLast: newElement )
|
copyWithout: oldElement | newcol |
newcol <- List new.
self do: [ :x | (x == oldElement)
ifFalse: [ newcol addLast: x ]].
^ self coerce: newcol
|
equals: aSubCollection startingAt: anIndex | i |
i <- 0.
self do: [:x |
(x = (aSubCollection at: (anIndex + i)
ifAbsent: [^ false]))
ifFalse: [^ false].
i <- i + 1].
^ true
|
findFirst: aBlock
^ self findFirst: aBlock
ifAbsent: [self error: 'first element not found']
|
findFirst: aBlock ifAbsent: exceptionBlock
self do: [:x | (aBlock value: x)
ifTrue: [ ^ self currentKey]].
^ exceptionBlock value
|
findLast: aBlock
self findLast: aBlock
ifAbsent: [self error: 'last element not found']
|
findLast: aBlock ifAbsent: exceptionBlock
self reverseDo: [:x | (aBlock value: x)
ifTrue: [ ^ self currentKey]].
^ exceptionBlock value
|
indexOfSubCollection: aSubCollection
startingAt: anIndex
ifAbsent: exceptionBlock | n m |
n <- anIndex.
m <- self size - aSubCollection size.
[n <= m] whileTrue:
[(aSubCollection equals: self startingAt: n)
ifTrue: [^ n].
n <- n + 1].
^ exceptionBlock value
|
indexOfSubCollection: aSubCollection startingAt: anIndex
^ self indexOfSubCollection: aSubCollection
startingAt: anIndex
ifAbsent: [ self error: 'element not found'. nil]
|
last
^ (0 = self size) ifFalse: [ self at: self lastKey ]
|
replaceFrom: start to: stop with: repcol
repcol inject: start
into: [:x :y | self at: x put: y. x + 1]
|
replaceFrom: first to: stop with: repcol startingAt: repStart | i |
i <- 0 .
[(first + i) <= stop] whileTrue:
[self at: (first + i)
put: (repcol at: i + repStart).
i <- i + 1 ]
|
reverseDo: aBlock | n m |
n <- self lastKey. m <- self firstKey.
[n >= m] whileTrue:
[(self includesKey: n) ifTrue:
[aBlock value: (self at: n)].
n <- n - 1].
^ nil
|
reversed | newar i |
newar <- Array new: (i <- self size).
self do: [:x | newar at: i put: x. i <- i - 1].
^ self coerce: newar
|
select: aBlock
^ self coerce:
(self inject: List new
into: [:x :y | (aBlock value: y)
ifTrue: [x addLast: y]. x ] )
|
sort
^ self sort: [:x :y | x <= y]
|
sort: sortBlock | index temp newArray |
newArray <- self asArray.
(2 to: newArray size) do:
[ :highIndex | index <- highIndex - 1.
[(index >= 1) and:
[(sortBlock value: (newArray at: index)
value: (newArray at: (index + 1))) not]]
whileTrue: [temp <- newArray at: index.
newArray at: index
put: (newArray at: index + 1).
newArray at: index + 1 put: temp.
index <- index - 1 ]].
^ self coerce: newArray
|
with: aSequenceableCollection do: aBlock | arg1 arg2 |
arg1 <- self first. arg2 <- aSequenceableCollection first.
[ arg1 notNil] whileTrue:
[ aBlock value: arg1 value: arg2.
arg1 <- self next.
arg2 <- aSequenceableCollection next].
^ nil
]
SHAR_EOF
if test 4499 -ne "`wc -c < 'prelude/scollection.st'`"
then
echo shar: error transmitting "'prelude/scollection.st'" '(should have been 4499 characters)'
fi
fi # end of overwriting check
if test -f 'prelude/semaphore.p'
then
echo shar: will not over-write existing file "'prelude/semaphore.p'"
else
cat << \SHAR_EOF > 'prelude/semaphore.p'
temp <- <primitive 110 4 >
<primitive 112 temp 1 " wait " \
#( #[ 250 0 148 242 16 80 201 247 10 32 95 11 22 242 95 \
10 18 248 6 242 16 81 193 241 96 242 250 0 149 242 \
245] \
#( ) ) >
<primitive 112 temp 2 " signal " \
#( #[ 250 0 148 242 32 10 27 247 7 16 81 192 241 96 248 \
6 242 32 10 38 10 48 242 250 0 149 242 245] \
#( ) ) >
<primitive 112 temp 3 " new: " \
#( #[ 33 96 245] \
#( ) ) >
<primitive 112 temp 4 " new " \
#( #[ 80 96 245] \
#( ) ) >
<primitive 98 #Semaphore \
<primitive 97 #Semaphore #List #/u/smalltalk/prelude/semaphore.st \
#( #excessSignals ) \
#( #wait #signal #new: #new ) \
temp 2 4 > >
SHAR_EOF
if test 648 -ne "`wc -c < 'prelude/semaphore.p'`"
then
echo shar: error transmitting "'prelude/semaphore.p'" '(should have been 648 characters)'
fi
fi # end of overwriting check
if test -f 'prelude/semaphore.st'
then
echo shar: will not over-write existing file "'prelude/semaphore.st'"
else
cat << \SHAR_EOF > 'prelude/semaphore.st'
Class Semaphore :List
| excessSignals |
[ new
excessSignals <- 0
| new: aNumber
excessSignals <- aNumber
| signal
<primitive 148>. "start atomic action"
(self isEmpty)
ifTrue: [excessSignals <- excessSignals + 1]
ifFalse: [self removeFirst unblock].
<primitive 149> "end atomic action"
| wait
<primitive 148>. "start atomic actions"
(excessSignals = 0)
ifTrue: [self addLast: selfProcess.
selfProcess block]
ifFalse: [excessSignals <- excessSignals - 1].
<primitive 149> "end atomic actions"
]
SHAR_EOF
if test 530 -ne "`wc -c < 'prelude/semaphore.st'`"
then
echo shar: error transmitting "'prelude/semaphore.st'" '(should have been 530 characters)'
fi
fi # end of overwriting check
if test -f 'prelude/set.p'
then
echo shar: will not over-write existing file "'prelude/set.p'"
else
cat << \SHAR_EOF > 'prelude/set.p'
temp <- <primitive 110 7 >
<primitive 112 temp 1 " next " \
#( #[ 16 167 243 245] \
#( ) ) >
<primitive 112 temp 2 " first " \
#( #[ 16 166 243 245] \
#( ) ) >
<primitive 112 temp 3 " occurrencesOf: " \
#( #[ 16 33 11 30 247 3 81 248 2 242 80 243 245] \
#( ) ) >
<primitive 112 temp 4 " size " \
#( #[ 16 163 243 245] \
#( ) ) >
<primitive 112 temp 5 " remove:ifAbsent: " \
#( #[ 16 33 34 216 242 245] \
#( ) ) >
<primitive 112 temp 6 " add: " \
#( #[ 16 33 11 30 246 3 16 33 189 242 245] \
#( ) ) >
<primitive 112 temp 7 " new " \
#( #[ 5 48 160 96 245] \
#( ) ) >
<primitive 98 #Set \
<primitive 97 #Set #Collection #/u/smalltalk/prelude/set.st \
#( #list ) \
#( #next #first #occurrencesOf: #size #remove:ifAbsent: #add: #new ) \
temp 3 4 > >
SHAR_EOF
if test 788 -ne "`wc -c < 'prelude/set.p'`"
then
echo shar: error transmitting "'prelude/set.p'" '(should have been 788 characters)'
fi
fi # end of overwriting check
if test -f 'prelude/set.st'
then
echo shar: will not over-write existing file "'prelude/set.st'"
else
cat << \SHAR_EOF > 'prelude/set.st'
Class Set :Collection
| list |
[
new
list <- List new
| add: newElement
(list includes: newElement)
ifFalse: [list add: newElement]
| remove: oldElement ifAbsent: exceptionBlock
list remove: oldElement ifAbsent: exceptionBlock
| size
^ list size
| occurrencesOf: anElement
^ (list includes: anElement) ifTrue: [1] ifFalse: [0]
| first
^ list first
| next
^ list next
]
SHAR_EOF
if test 506 -ne "`wc -c < 'prelude/set.st'`"
then
echo shar: error transmitting "'prelude/set.st'" '(should have been 506 characters)'
fi
fi # end of overwriting check
if test -f 'prelude/smalltalk.p'
then
echo shar: will not over-write existing file "'prelude/smalltalk.p'"
else
cat << \SHAR_EOF > 'prelude/smalltalk.p'
temp <- <primitive 110 9 >
<primitive 112 temp 1 " time: " \
#( #[ 250 0 161 114 33 165 242 250 0 161 34 193 243 245] \
#( ) ) >
<primitive 112 temp 2 " sh: " \
#( #[ 33 250 1 125 243 245] \
#( ) ) >
<primitive 112 temp 3 " perform:withArguments: " \
#( #[ 34 33 250 2 143 243 245] \
#( ) ) >
<primitive 112 temp 4 " noDisplay " \
#( #[ 81 80 250 2 8 243 245] \
#( ) ) >
<primitive 112 temp 5 " doPrimitive:withArguments: " \
#( #[ 33 34 250 2 30 243 245] \
#( ) ) >
<primitive 112 temp 6 " displayAssign " \
#( #[ 81 82 250 2 8 243 245] \
#( ) ) >
<primitive 112 temp 7 " display " \
#( #[ 81 81 250 2 8 243 245] \
#( ) ) >
<primitive 112 temp 8 " debug: " \
#( #[ 82 33 250 2 8 243 245] \
#( ) ) >
<primitive 112 temp 9 " date " \
#( #[ 250 0 160 243 245] \
#( ) ) >
<primitive 98 #Smalltalk \
<primitive 97 #Smalltalk #Dictionary #/u/smalltalk/prelude/smalltalk.st \
#( ) \
#( #time: #sh: #perform:withArguments: #noDisplay #doPrimitive:withArguments: #displayAssign #display #debug: #date ) \
temp 3 3 > >
SHAR_EOF
if test 1062 -ne "`wc -c < 'prelude/smalltalk.p'`"
then
echo shar: error transmitting "'prelude/smalltalk.p'" '(should have been 1062 characters)'
fi
fi # end of overwriting check
if test -f 'prelude/smalltalk.st'
then
echo shar: will not over-write existing file "'prelude/smalltalk.st'"
else
cat << \SHAR_EOF > 'prelude/smalltalk.st'
Class Smalltalk :Dictionary
[
date
^ <primitive 160 >
|
debug: n
^ <primitive 8 2 n>
|
display
^ <primitive 8 1 1>
|
displayAssign
^ <primitive 8 1 2>
|
doPrimitive: primNumber withArguments: argArray
^ <primitive 30 primNumber argArray>
|
noDisplay
^ <primitive 8 1 0>
|
perform: aMessage withArguments: argArray
^ <primitive 143 argArray aMessage >
|
sh: command
^ <primitive 125 command >
|
time: aBlock | start |
start <- <primitive 161>.
aBlock value.
^ <primitive 161> - start
]
SHAR_EOF
if test 517 -ne "`wc -c < 'prelude/smalltalk.st'`"
then
echo shar: error transmitting "'prelude/smalltalk.st'" '(should have been 517 characters)'
fi
fi # end of overwriting check
# End of shell archive
exit 0
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads