more for vw-XML fileIn
authorClaus Gittinger <cg@exept.de>
Sun, 26 Jan 2003 15:05:36 +0100
changeset 1196 928f537ddeac
parent 1195 bb05eb02d86b
child 1197 bc742b87f66d
more for vw-XML fileIn
ClassChange.st
ClassCommentChange.st
ClassDefinitionChange.st
MethodChange.st
--- a/ClassChange.st	Thu Jan 23 16:56:19 2003 +0100
+++ b/ClassChange.st	Sun Jan 26 15:05:36 2003 +0100
@@ -64,6 +64,9 @@
 changeClass
     "the class of the change (nil if not present)"
 
+    |className|
+
+    className := self className.
     className isNil ifTrue:[^ nil].
     ^ Smalltalk classNamed:className
 !
@@ -96,7 +99,7 @@
 className 
     "return the className of the change"
 
-    ^  className
+    ^ self cutNameSpaceOf:className
 
     "Modified: 15.7.1996 / 09:28:35 / cg"
 !
@@ -115,7 +118,13 @@
 apply
     "apply the change"
 
-    Class nameSpaceQuerySignal answer:(self nameSpace) do:[
+    |ns|
+
+    ns := Class nameSpaceQuerySignal isHandled 
+            ifTrue:[ Class nameSpaceQuerySignal query ]
+            ifFalse:[ self nameSpace ].
+
+    Class nameSpaceQuerySignal answer:ns do:[
         Parser evaluate:(self source)
     ].
 !
@@ -134,6 +143,10 @@
         "/ in a namespace
         ^ className upTo:$:.
     ].
+    (className includes:$.) ifTrue:[
+        "/ in a namespace
+        ^ className upTo:$..
+    ].
     ^ nil
 ! !
 
@@ -152,6 +165,16 @@
 
 !ClassChange methodsFor:'queries'!
 
+cutNameSpaceOf:aString
+    (aString startsWith:'Kernel.') ifTrue:[
+        ^ aString copyFrom:'Kernel.' size+1
+    ].
+    (aString startsWith:'Core.') ifTrue:[
+        ^ aString copyFrom:'Core.' size+1
+    ].
+    ^ aString
+!
+
 isClassChange
     ^ true
 ! !
@@ -159,5 +182,5 @@
 !ClassChange class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic3/ClassChange.st,v 1.29 2002-09-10 11:53:27 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic3/ClassChange.st,v 1.30 2003-01-26 14:05:19 cg Exp $'
 ! !
--- a/ClassCommentChange.st	Thu Jan 23 16:56:19 2003 +0100
+++ b/ClassCommentChange.st	Sun Jan 26 15:05:36 2003 +0100
@@ -89,9 +89,7 @@
 source
     "synthesize the changes source"
 
-    ^ className , ' comment: ' , comment storeString
-
-
+    ^ self className , ' comment: ' , comment storeString
 ! !
 
 !ClassCommentChange methodsFor:'printing & storing'!
@@ -121,5 +119,5 @@
 !ClassCommentChange class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic3/ClassCommentChange.st,v 1.27 2002-09-10 11:53:15 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic3/ClassCommentChange.st,v 1.28 2003-01-26 14:05:31 cg Exp $'
 ! !
--- a/ClassDefinitionChange.st	Thu Jan 23 16:56:19 2003 +0100
+++ b/ClassDefinitionChange.st	Sun Jan 26 15:05:36 2003 +0100
@@ -13,9 +13,10 @@
 "{ Package: 'stx:libbasic3' }"
 
 ClassChange subclass:#ClassDefinitionChange
-	instanceVariableNames:'objectType nameSpaceName package classType otherParameters
-		instanceVariableNames classVariableNames
-		classInstanceVariableNames poolDictionaries category'
+	instanceVariableNames:'objectType nameSpaceName package superClassName classType
+		indexedType otherParameters instanceVariableNames
+		classVariableNames classInstanceVariableNames poolDictionaries
+		category'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'System-Changes'
@@ -54,13 +55,26 @@
 !
 
 nameSpaceName
-    ^ nameSpaceName ? super nameSpaceName
+    ^ self cutNameSpaceOf:(nameSpaceName ? super nameSpaceName)
 !
 
-nameSpaceName: aNameSpaceName classType: aClassType otherParameters: someOtherParameters
+nameSpaceName: aNameSpaceName classType: aClassType otherParameters:otherParametersArg
+    |indexedType private imports|
+
     nameSpaceName := aNameSpaceName.
     classType := aClassType.
-    otherParameters := someOtherParameters
+    otherParameters := Dictionary new addAll:otherParametersArg; yourself.
+
+    superClassName := otherParameters at:#superclass: ifAbsent:nil.
+    superClassName notNil ifTrue:[
+        superClassName := superClassName pathString.
+    ].
+    indexedType := otherParameters at:#indexedType: ifAbsent:nil.
+    private := otherParameters at:#private: ifAbsent:nil.
+    instanceVariableNames := otherParameters at:#instanceVariableNames: ifAbsent:nil.
+    classInstanceVariableNames := otherParameters at:#classInstanceVariableNames: ifAbsent:nil.
+    imports := otherParameters at:#imports: ifAbsent:nil.
+    category := otherParameters at:#category: ifAbsent:nil.
 !
 
 objectType
@@ -82,14 +96,24 @@
 source
     "return the source of the change"
 
-    |nsName|
+    |src nsName|
+
+    source isNil ifTrue:[
+        src := self definitionString
+    ] ifFalse:[
+        src := super source
+    ].
 
     (nsName := self nameSpaceName) notNil ifTrue:[
         ^ '"{ NameSpace: ' , nsName , ' }"' , 
           Character cr, Character cr , 
-          super source 
+          src
     ].
-    ^ super source
+    ^ src
+!
+
+superClassName 
+    ^ self cutNameSpaceOf:superClassName
 ! !
 
 !ClassDefinitionChange methodsFor:'comparing'!
@@ -121,6 +145,39 @@
 
 !ClassDefinitionChange methodsFor:'printing & storing'!
 
+definitionString
+    ^ String streamContents:[:stream |
+        objectType == #variable ifTrue:[
+            stream 
+                nextPutAll:self nameSpaceName;
+                nextPutAll:' addClassVarName:';
+                nextPutAll:self className asString storeString
+        ] ifFalse:[
+            stream 
+                nextPutAll:self superClassName;
+                nextPutAll:' subclass:';
+                nextPutAll:self className asSymbol storeString
+                ;
+                cr;
+                spaces:4;
+                nextPutAll:'instanceVariableNames: ';
+                nextPutAll:(instanceVariableNames ? '') storeString;
+                cr;
+                spaces:4;
+                nextPutAll:'classVariableNames: ';
+                nextPutAll:(classVariableNames ? '') storeString;
+                cr;
+                spaces:4;
+                nextPutAll:'poolDictionaries: ';
+                nextPutAll:(poolDictionaries ? '') storeString;
+                cr;
+                spaces:4;
+                nextPutAll:'category: ';
+                nextPutAll:(category ? '') storeString
+            ]
+        ]
+!
+
 printOn:aStream
     aStream nextPutAll:className
 !
@@ -179,5 +236,5 @@
 !ClassDefinitionChange class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic3/ClassDefinitionChange.st,v 1.27 2002-11-11 09:40:28 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic3/ClassDefinitionChange.st,v 1.28 2003-01-26 14:05:36 cg Exp $'
 ! !
--- a/MethodChange.st	Thu Jan 23 16:56:19 2003 +0100
+++ b/MethodChange.st	Sun Jan 26 15:05:36 2003 +0100
@@ -147,10 +147,11 @@
 
     |class|
 
-    class := Smalltalk classNamed:className.
+    class := Smalltalk classNamed:self className.
+    class isNil ifTrue:[
+        class := Parser evaluate:self className
+    ].
     class compile:source classified:methodCategory logged:true.
-
-
 ! !
 
 !MethodChange methodsFor:'comparing'!
@@ -189,7 +190,7 @@
     "append a user printed representation of the receiver to aStream.
      The format is suitable for a human - not meant to be read back."
 
-    aStream nextPutAll:className; 
+    aStream nextPutAll:self className; 
                  space; 
             nextPutAll:selector 
 !
@@ -220,5 +221,5 @@
 !MethodChange class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic3/MethodChange.st,v 1.28 2001-09-27 17:52:38 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic3/MethodChange.st,v 1.29 2003-01-26 14:05:26 cg Exp $'
 ! !