ClassCategoryReader.st
changeset 425 b6cdf4e23868
parent 384 cc3d110ea879
child 450 c5c7fd3dac5e
--- a/ClassCategoryReader.st	Fri Sep 08 19:38:40 1995 +0200
+++ b/ClassCategoryReader.st	Sat Sep 09 20:32:08 1995 +0200
@@ -12,7 +12,7 @@
 
 Object subclass:#ClassCategoryReader
        instanceVariableNames:'myClass myCategory privacy ignore primSpec'
-       classVariableNames:''
+       classVariableNames:'KeepSource'
        poolDictionaries:''
        category:'Kernel-Support'
 !
@@ -21,7 +21,7 @@
 COPYRIGHT (c) 1989 by Claus Gittinger
 	     All Rights Reserved
 
-$Header: /cvs/stx/stx/libbasic/ClassCategoryReader.st,v 1.18 1995-08-11 02:59:13 claus Exp $
+$Header: /cvs/stx/stx/libbasic/ClassCategoryReader.st,v 1.19 1995-09-09 18:32:08 claus Exp $
 '!
 
 !ClassCategoryReader class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libbasic/ClassCategoryReader.st,v 1.18 1995-08-11 02:59:13 claus Exp $
+$Header: /cvs/stx/stx/libbasic/ClassCategoryReader.st,v 1.19 1995-09-09 18:32:08 claus Exp $
 "
 !
 
@@ -54,6 +54,26 @@
 "
 ! !
 
+!ClassCategoryReader class methodsFor:'initialization'!
+
+initialize
+    KeepSource := true
+! !
+
+!ClassCategoryReader class methodsFor:'defaults'!
+
+keepSource:aBoolean
+    KeepSource := aBoolean
+
+    "Created: 9.9.1995 / 15:22:26 / claus"
+!
+
+keepSource
+    ^ KeepSource
+
+    "Created: 9.9.1995 / 15:22:27 / claus"
+! !
+
 !ClassCategoryReader class methodsFor:'instance creation'!
 
 class:aClass category:aCategory
@@ -114,16 +134,28 @@
      and add the methods to the class defined by the class-instance var;
      errors and notifications are passed to requestor"
 
-    |aString done method compiler|
+    |aString done method compiler makeSourceRef sourceFile pos|
 
     Smalltalk silentLoading ifFalse:[
 	Transcript show:'  '; show:myClass name; show:' -> '; showCr:myCategory.
     ].
 
+    makeSourceRef := false.
+    KeepSource == false ifTrue:[
+	aStream isFileStream ifTrue:[
+	    sourceFile := aStream pathName.
+	    sourceFile printNL.
+	    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:[
@@ -144,6 +176,7 @@
 		    "/
 		    "/ 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:[
@@ -156,6 +189,11 @@
 				     install:true
 				     skipIfSame:true.
 
+			makeSourceRef ifTrue:[
+			    method source = aString ifTrue:[
+				method sourceFilename:sourceFile position:pos 
+			    ]
+			]
 		    ] ifFalse:[
 			"/ some generated (TGEN) compiler
 			method := compiler new
@@ -178,6 +216,8 @@
 	    ]
 	]
     ]
+
+    "Modified: 9.9.1995 / 15:29:08 / claus"
 !
 
 fileInFrom:aStream