--- a/ResourcePack.st Fri May 12 20:10:19 1995 +0200
+++ b/ResourcePack.st Tue May 16 19:17:11 1995 +0200
@@ -21,7 +21,7 @@
COPYRIGHT (c) 1993 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libview/ResourcePack.st,v 1.14 1995-05-03 00:25:14 claus Exp $
+$Header: /cvs/stx/stx/libview/ResourcePack.st,v 1.15 1995-05-16 17:13:52 claus Exp $
'!
!ResourcePack class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
version
"
-$Header: /cvs/stx/stx/libview/ResourcePack.st,v 1.14 1995-05-03 00:25:14 claus Exp $
+$Header: /cvs/stx/stx/libview/ResourcePack.st,v 1.15 1995-05-16 17:13:52 claus Exp $
"
!
@@ -303,6 +303,58 @@
inStream close.
!
+processLine:aLine
+ |lineString name stream l rest macroName value|
+
+ lineString := lineString withoutSeparators.
+ name := nil.
+ (lineString at:1) == $' ifTrue:[
+ stream := ReadStream on:lineString.
+ name := String
+ readFrom:stream
+ onError:['RESOURCEPACK: invalid line <',lineString,'>' errorPrintNl. nil].
+ l := stream position.
+
+"/ l := lineString indexOf:$' startingAt:2.
+"/ l ~~ 0 ifTrue:[
+"/ name := (lineString copyFrom:2 to:l-1).
+"/ l := l + 1
+"/ ]
+ ] ifFalse:[
+ l := lineString indexOfSeparatorStartingAt:1.
+ l ~~ 0 ifTrue:[
+ name := lineString copyFrom:1 to:l-1.
+ ]
+ ].
+ name notNil ifTrue:[
+ rest := (lineString copyFrom:l) withoutSeparators.
+ "
+ skip <type> if present
+ "
+ (rest startsWith:$<) ifTrue:[
+ l := lineString indexOf:$> startingAt:l.
+ rest := (lineString copyFrom:l+1) withoutSeparators.
+ ].
+ (rest startsWith:$=) ifTrue:[
+ rest := rest copyFrom:2.
+ stream := ReadStream on:rest.
+ macroName := stream nextAlphaNumericWord.
+ rest := stream upToEnd.
+ value := self at:macroName.
+ value := Compiler evaluate:('self ' , rest)
+ receiver:value
+ notifying:nil
+ compile:false.
+ ] ifFalse:[
+ value := Compiler evaluate:rest compile:false.
+ (value == #Error) ifTrue:[
+ Transcript show:('error in resource:' , name).
+ ]
+ ].
+ self at:name put:value.
+ ]
+!
+
readFromResourceStream:inStream in:dirName
|lineString rest value ifLevel skipping l name first str macroName|