ResourcePack.st
changeset 2608 a36fad717685
parent 2461 3c212ae910ec
child 2970 928387584c9c
--- a/ResourcePack.st	Wed Apr 28 22:35:13 1999 +0200
+++ b/ResourcePack.st	Wed Apr 28 22:39:58 1999 +0200
@@ -485,17 +485,17 @@
     lineString := aLine withoutSeparators.
     name := nil.
     (lineString at:1) == $' ifTrue:[
-	stream := ReadStream on:lineString.
-	stream signalAtEnd:false.
-	name := String 
-		    readFrom:stream 
-		    onError:[('ResourcePack [warning]: invalid line <'
-			     ,lineString
-			     ,'> in file:'
-			     , fileName
-			    ) errorPrintCR. nil].
+        stream := ReadStream on:lineString.
+        stream signalAtEnd:false.
+        name := String 
+                    readFrom:stream 
+                    onError:[('ResourcePack [warning]: invalid line <'
+                             ,lineString
+                             ,'> in file:'
+                             , fileName
+                            ) errorPrintCR. nil].
 "/ OLD: l := stream position
-	l := stream position + 1.
+        l := stream position + 1.
 
 "/                          l := lineString indexOf:$' startingAt:2.
 "/                          l ~~ 0 ifTrue:[
@@ -503,77 +503,79 @@
 "/                              l := l + 1
 "/                          ]
     ] ifFalse:[
-	l := lineString indexOfSeparatorStartingAt:1.
-	l ~~ 0 ifTrue:[
-	    name := lineString copyFrom:1 to:l-1.
-	]
+        l := lineString indexOfSeparatorStartingAt:1.
+        l ~~ 0 ifTrue:[
+            name := lineString copyFrom:1 to:l-1.
+        ]
     ].
     name notNil ifTrue:[
-	hasError := false.
+        hasError := false.
 
-	rest := (lineString copyFrom:l) withoutSeparators.
-	"
-	 skip <type> if present
-	"
-	(rest startsWith:$<) ifTrue:[
-	     l := lineString indexOf:$> startingAt:l.
-	     rest := (lineString copyFrom:l+1) withoutSeparators.
-	].
+        rest := (lineString copyFrom:l) withoutSeparators.
+        "
+         skip <type> if present
+        "
+        (rest startsWith:$<) ifTrue:[
+             l := lineString indexOf:$> startingAt:l.
+             rest := (lineString copyFrom:l+1) withoutSeparators.
+        ].
 
-	conditional := false.
-	(rest startsWith:$?) ifTrue:[
-	    rest := (rest copyFrom:2) withoutSeparators.
-	    conditional := true.
-	].
+        conditional := false.
+        (rest startsWith:$?) ifTrue:[
+            rest := (rest copyFrom:2) withoutSeparators.
+            conditional := true.
+        ].
 
-	(rest startsWith:$=) ifTrue:[
-	    rest := rest copyFrom:2.
-	    stream := ReadStream on:rest.
-	    macroName := stream nextAlphaNumericWord.
-	    [stream peek == $.] whileTrue:[
-		stream next.
-		stream peek notNil ifTrue:[
-		    macroName := macroName , '.' , (stream nextAlphaNumericWord)
-		]
-	    ].
-	    rest := stream upToEnd.
-	    value := self at:macroName ifAbsent:nil.
-	    (value isNil) ifTrue:[
-		hasError := true.
-		('ResourcePack [warning]: bad =-macro in line: ' , lineString) errorPrintCR.
-	    ].
-        
-	    value := Compiler evaluate:('self ' , rest)
-			      receiver:value
-			      notifying:nil
-			      compile:false.
-	    (value == #Error) ifTrue:[
-		hasError := true.
-		('ResourcePack [warning]: error in line: "self ' , rest , '"') errorPrintCR.
-	    ]
-	] ifFalse:[
-	    value := Compiler evaluate:rest compile:false.
-	    (value == #Error) ifTrue:[
-		hasError := true.
-		('ResourcePack [warning]: error in line: "' , rest , '"') errorPrintCR.
-	    ] ifFalse:[
-		encoding notNil ifTrue:[
-		    value isString ifTrue:[
-			value := value decodeFrom:encoding
-		    ]
-		]
-	    ]
-	].
-	hasError ifFalse:[
-	    (conditional not
-	    or:[(self includesKey:name) not]) ifTrue:[
-		self at:name put:value.
-	    ]
-	]
+        (rest startsWith:$=) ifTrue:[
+            rest := rest copyFrom:2.
+            stream := ReadStream on:rest.
+            macroName := stream nextAlphaNumericWord.
+            [stream peek == $.] whileTrue:[
+                stream next.
+                stream peek notNil ifTrue:[
+                    macroName := macroName , '.' , (stream nextAlphaNumericWord)
+                ]
+            ].
+            rest := stream upToEnd.
+            value := self at:macroName ifAbsent:nil.
+            (value isNil) ifTrue:[
+                hasError := true.
+                ('ResourcePack [warning]: bad =-macro in line: ' , lineString) errorPrintCR.
+            ].
+            value isBlock ifTrue:[
+                value := value value
+            ].
+            value := Compiler evaluate:('self ' , rest)
+                              receiver:value
+                              notifying:nil
+                              compile:false.
+            (value == #Error) ifTrue:[
+                hasError := true.
+                ('ResourcePack [warning]: error in line: "self ' , rest , '"') errorPrintCR.
+            ]
+        ] ifFalse:[
+            value := Compiler evaluate:rest compile:false.
+            (value == #Error) ifTrue:[
+                hasError := true.
+                ('ResourcePack [warning]: error in line: "' , rest , '"') errorPrintCR.
+            ] ifFalse:[
+                encoding notNil ifTrue:[
+                    value isString ifTrue:[
+                        value := value decodeFrom:encoding
+                    ]
+                ]
+            ]
+        ].
+        hasError ifFalse:[
+            (conditional not
+            or:[(self includesKey:name) not]) ifTrue:[
+                self at:name put:value.
+            ]
+        ]
     ]
 
-    "Modified: / 30.8.1998 / 12:33:22 / cg"
     "Created: / 30.8.1998 / 12:35:37 / cg"
+    "Modified: / 28.4.1999 / 22:23:14 / cg"
 !
 
 readFromFile:fileName directory:dirName
@@ -707,6 +709,6 @@
 !ResourcePack class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/ResourcePack.st,v 1.50 1999-02-18 13:42:32 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/ResourcePack.st,v 1.51 1999-04-28 20:39:58 cg Exp $'
 ! !
 ResourcePack initialize!