ResourcePack.st
changeset 2153 eb2d1caa5dfd
parent 2111 868ea9d9d23d
child 2291 eaac1c5f2a61
--- a/ResourcePack.st	Mon Jun 15 17:08:11 1998 +0200
+++ b/ResourcePack.st	Tue Jun 16 17:05:11 1998 +0200
@@ -435,13 +435,13 @@
 processLine:aLine encoding:encoding
     "process a single valid line (i.e. #ifdef & #include has already been processed)"
 
-    |lineString name stream l rest macroName value|
+    |lineString name stream l rest macroName value conditional|
 
     lineString := aLine withoutSeparators.
     name := nil.
     (lineString at:1) == $' ifTrue:[
         stream := ReadStream on:lineString.
-	stream signalAtEnd:false.
+        stream signalAtEnd:false.
         name := String 
                     readFrom:stream 
                     onError:[('ResourcePack [warning]: invalid line <',lineString,'>') errorPrintCR. nil].
@@ -460,6 +460,7 @@
         ]
     ].
     name notNil ifTrue:[
+
         rest := (lineString copyFrom:l) withoutSeparators.
         "
          skip <type> if present
@@ -468,6 +469,13 @@
              l := lineString indexOf:$> startingAt:l.
              rest := (lineString copyFrom:l+1) withoutSeparators.
         ].
+
+        conditional := false.
+        (rest startsWith:$?) ifTrue:[
+            rest := (rest copyFrom:2) withoutSeparators.
+            conditional := true.
+        ].
+
         (rest startsWith:$=) ifTrue:[
             rest := rest copyFrom:2.
             stream := ReadStream on:rest.
@@ -496,11 +504,14 @@
                 ]
             ]
         ].
-        self at:name put:value.
+        (conditional not
+        or:[(self includesKey:name) not]) ifTrue:[
+            self at:name put:value.
+        ]
     ]
 
     "Created: / 26.2.1996 / 19:17:07 / cg"
-    "Modified: / 31.10.1997 / 14:17:50 / cg"
+    "Modified: / 16.6.1998 / 17:02:44 / cg"
 !
 
 readFromFile:fileName directory:dirName
@@ -629,6 +640,6 @@
 !ResourcePack class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/ResourcePack.st,v 1.45 1998-05-04 08:03:37 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/ResourcePack.st,v 1.46 1998-06-16 15:05:11 cg Exp $'
 ! !
 ResourcePack initialize!