use common fileFormatError reporter
authorClaus Gittinger <cg@exept.de>
Tue, 03 Feb 1998 18:21:40 +0100
changeset 817 dec0b7b06c79
parent 816 fe0abc1f956d
child 818 cd88643119dc
use common fileFormatError reporter
XPMReader.st
--- a/XPMReader.st	Tue Feb 03 18:19:55 1998 +0100
+++ b/XPMReader.st	Tue Feb 03 18:21:40 1998 +0100
@@ -157,8 +157,7 @@
 
     line := aStream nextLine.
     (line notNil and:[line startsWith:'/* XPM']) ifFalse:[
-        'XPM: format error (expected XPM)' errorPrintNL.
-        ^ nil
+        ^ self fileFormatError:'format error (expected XPM)'.
     ].
 
     line := aStream nextLine.
@@ -166,8 +165,7 @@
         line := aStream nextLine.
     ].
     (line notNil and:[line startsWith:'static char']) ifFalse:[
-        'XPM: format error (expected static char)' errorPrintNL.
-        ^ nil
+        ^ self fileFormatError:'format error (expected static char)'.
     ].
     line := aStream nextLine.
     (line notNil and:[line startsWith:'/*']) ifTrue:[
@@ -180,8 +178,7 @@
         line := line withoutSeparators
     ].
     (line notNil and:[line startsWith:'"']) ifFalse:[
-        'XPM: format error (expected "ww hh nn mm)' errorPrintNL.
-        ^ nil
+        ^ self fileFormatError:'format error (expected "ww hh nn mm)'.
     ].
     s := ReadStream on:line.
     s next.  "skip quote"
@@ -213,8 +210,7 @@
             line := line withoutSeparators
         ].
         (line notNil and:[line startsWith:'"']) ifFalse:[
-            'XPM: format error (expected color spec)' errorPrintNL.
-            ^ nil
+            ^ self fileFormatError:'format error (expected color spec)'.
         ].
 
         s := ReadStream on:line.
@@ -262,10 +258,9 @@
                                 ] ifFalse:[
                                     "/ append to name
                                     state isNil ifTrue:[
-                                        'XPM: format error got: ' errorPrint.
-                                        word errorPrint. 
-                                         ' (expected ''c'',''m'',''g'' or ''s'')' errorPrintNL.
-                                        ^ nil
+                                        ^ self fileFormatError:('format error got: ' 
+                                                                , word printString 
+                                                                , ' (expected ''c'',''m'',''g'' or ''s'')').
                                     ].
 
                                     state == $m ifTrue:[
@@ -355,8 +350,7 @@
             line := line withoutSeparators
         ].
         (line notNil and:[line startsWith:'"']) ifFalse:[
-            'XPM: format error (expected pixels)' errorPrintNL.
-            ^ nil
+            ^ self fileFormatError:'format error (expected pixels)'.
         ].
         charsPerPixel ~~ 1 ifTrue:[
             s := line readStream.
@@ -396,10 +390,10 @@
      XPMReader fromStream:('bitmaps/SBrowser.xbm' asFilename readStream)
     "
 
-    "Created: 24.9.1995 / 06:20:06 / claus"
-    "Modified: 24.9.1995 / 07:07:33 / claus"
-    "Modified: 5.7.1996 / 17:27:59 / stefan"
-    "Modified: 24.4.1997 / 20:33:04 / cg"
+    "Created: / 24.9.1995 / 06:20:06 / claus"
+    "Modified: / 24.9.1995 / 07:07:33 / claus"
+    "Modified: / 5.7.1996 / 17:27:59 / stefan"
+    "Modified: / 3.2.1998 / 18:21:30 / cg"
 ! !
 
 !XPMReader methodsFor:'writing to a file'!
@@ -521,6 +515,6 @@
 !XPMReader class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/XPMReader.st,v 1.36 1997-09-15 13:33:06 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/XPMReader.st,v 1.37 1998-02-03 17:21:40 cg Exp $'
 ! !
 XPMReader initialize!