ClassCategoryReader.st
changeset 868 fc7ab02e0537
parent 784 0811a8196743
child 882 cb91ec165c55
--- a/ClassCategoryReader.st	Mon Jan 15 23:55:37 1996 +0100
+++ b/ClassCategoryReader.st	Tue Jan 16 00:21:35 1996 +0100
@@ -99,91 +99,104 @@
     |aString done method compiler makeSourceRef sourceFile pos nm|
 
     ignore ifFalse:[
-        Smalltalk silentLoading ifFalse:[
-            myClass isNil ifTrue:[
-                nm := '** UndefinedClass **'
-            ] ifFalse:[
-                nm := myClass name
-            ].
-            Transcript show:'  '; show:nm; show:' -> '; showCr:myCategory.
-        ].
+	Smalltalk silentLoading ifFalse:[
+	    myClass isNil ifTrue:[
+		nm := '** UndefinedClass **'
+	    ] ifFalse:[
+		nm := myClass name
+	    ].
+	    Transcript show:'  '; show:nm; show:' -> '; showCr:myCategory.
+	].
+
+	makeSourceRef := false.
 
-        makeSourceRef := false.
-        KeepSource == false ifTrue:[
-            aStream isFileStream ifTrue:[
-                sourceFile := aStream pathName.
-"/                sourceFile printNL.
-                makeSourceRef := true.
-            ]
-        ].
+	"/
+	"/ KeepSource controls if
+	"/ the sourceString should be kept or
+	"/ a reference to the fileStream should be placed into the
+	"/ method intead.
+	"/
+	KeepSource == false ifTrue:[
+	    aStream isFileStream ifTrue:[
+		sourceFile := aStream pathName.
+		"/
+		"/ only do it, if the sourceFiles name
+		"/ ends with '.st'
+		"/ this prevents methods to reference the changes file.
+		"/
+		(sourceFile endsWith:'.st') ifTrue:[
+		    makeSourceRef := true.
+		]
+	    ]
+	].
     ].
 
     done := false.
     [done] whileFalse:[
-        done := aStream atEnd.
-        done ifFalse:[
-            makeSourceRef ifTrue:[
-                pos := aStream position
-            ].
-            aString := aStream nextChunk.
-            done := aString isNil or:[aString isEmpty].
-            done ifFalse:[
-                primSpec notNil ifTrue:[
-                    myClass perform:primSpec with:aString.
-                    "
-                     ignore rest
-                    "
-                    ignore := true
-                ].
-                ignore ifFalse:[
-                    passChunk ifTrue:[
-                        requestor source:aString
-                    ].
+	done := aStream atEnd.
+	done ifFalse:[
+	    makeSourceRef ifTrue:[
+		pos := aStream position
+	    ].
+	    aString := aStream nextChunk.
+	    done := aString isNil or:[aString isEmpty].
+	    done ifFalse:[
+		primSpec notNil ifTrue:[
+		    myClass perform:primSpec with:aString.
+		    "
+		     ignore rest
+		    "
+		    ignore := true
+		].
+		ignore ifFalse:[
+		    passChunk ifTrue:[
+			requestor source:aString
+		    ].
 
-                    compiler := myClass compilerClass.
+		    compiler := myClass compilerClass.
 
-                    "/
-                    "/ kludge - for now;
-                    "/ have to make ST/X's compiler protocol be compatible to ST-80's
-                    "/ for other compilers to work ... (TGEN for example)
-                    "/
-                    (compiler respondsTo:#compile:forClass:inCategory:notifying:install:skipIfSame:)
-                    ifTrue:[
-                        "/ ST/X's compiler
-                        method :=compiler
-                                     compile:aString
-                                     forClass:myClass
-                                     inCategory:myCategory
-                                     notifying:requestor
-                                     install:true
-                                     skipIfSame:true.
+		    "/
+		    "/ kludge - for now;
+		    "/ have to make ST/X's compiler protocol be compatible to ST-80's
+		    "/ for other compilers to work ... (TGEN for example)
+		    "/
+		    (compiler respondsTo:#compile:forClass:inCategory:notifying:install:skipIfSame:)
+		    ifTrue:[
+			"/ ST/X's compiler
+			method :=compiler
+				     compile:aString
+				     forClass:myClass
+				     inCategory:myCategory
+				     notifying:requestor
+				     install:true
+				     skipIfSame:true.
 
-                        makeSourceRef ifTrue:[
-                            method source = aString ifTrue:[
-                                method sourceFilename:sourceFile position:pos 
-                            ]
-                        ]
-                    ] ifFalse:[
-                        "/ some generated (TGEN) compiler
-                        method := compiler new
-                                      compile:aString 
-                                      in:myClass 
-                                      notifying:requestor 
-                                      ifFail:nil
-                    ].
+			makeSourceRef ifTrue:[
+			    method source = aString ifTrue:[
+				method sourceFilename:sourceFile position:pos 
+			    ]
+			]
+		    ] ifFalse:[
+			"/ some generated (TGEN) compiler
+			method := compiler new
+				      compile:aString 
+				      in:myClass 
+				      notifying:requestor 
+				      ifFail:nil
+		    ].
 
-                    privacy notNil ifTrue:[
-                        privacy == #private ifTrue:[
-                            method setToPrivate
-                        ] ifFalse:[
-                            privacy == #protected ifTrue:[
-                                method setToProtected
-                            ]
-                        ]
-                    ]
-                ]
-            ]
-        ]
+		    privacy notNil ifTrue:[
+			privacy == #private ifTrue:[
+			    method setToPrivate
+			] ifFalse:[
+			    privacy == #protected ifTrue:[
+				method setToProtected
+			    ]
+			]
+		    ]
+		]
+	    ]
+	]
     ]
 
     "Modified: 9.9.1995 / 15:29:08 / claus"
@@ -225,6 +238,6 @@
 !ClassCategoryReader class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/ClassCategoryReader.st,v 1.24 1995-12-17 15:20:23 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ClassCategoryReader.st,v 1.25 1996-01-15 23:21:35 cg Exp $'
 ! !
 ClassCategoryReader initialize!