SmalltalkChunkFileSourceWriter.st
changeset 15953 6ad068b28f7d
parent 15421 bfe697cc8b21
child 16878 19f06d12b7da
--- a/SmalltalkChunkFileSourceWriter.st	Wed Feb 05 18:17:00 2014 +0100
+++ b/SmalltalkChunkFileSourceWriter.st	Wed Feb 05 18:17:24 2014 +0100
@@ -307,12 +307,20 @@
 !
 
 fileOutAllDefinitionsOf:aNonMetaClass on:aStream
+    self fileOutAllDefinitionsOf:aNonMetaClass on:aStream withNameSpace: true.
+
+    "Created: / 15-10-1996 / 11:15:19 / cg"
+    "Modified: / 22-03-1997 / 16:11:56 / cg"
+    "Modified: / 04-02-2014 / 20:00:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+fileOutAllDefinitionsOf:aNonMetaClass on:aStream withNameSpace: withNameSpacePragma
     "append expressions on aStream, which defines myself and all of my private classes."
 
     |s|
 
     s := CharacterWriteStream on:(String new:50).
-    self fileOutDefinitionOf:aNonMetaClass on:s.
+    self fileOutDefinitionOf:aNonMetaClass on:s withNameSpace: withNameSpacePragma.
     aStream nextChunkPut:(s contents).
 
     "/ self fileOutDefinitionOf:aNonMetaClass on:aStream.
@@ -335,13 +343,12 @@
     Class fileOutNameSpaceQuerySignal answer:false do:[
         Class forceNoNameSpaceQuerySignal answer:true do:[
             aNonMetaClass privateClassesSorted do:[:aClass |
-                 self fileOutAllDefinitionsOf:aClass on:aStream
+                 self fileOutAllDefinitionsOf:aClass on:aStream withNameSpace: false
             ]
         ]
     ].
 
-    "Created: 15.10.1996 / 11:15:19 / cg"
-    "Modified: 22.3.1997 / 16:11:56 / cg"
+    "Created: / 04-02-2014 / 20:00:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 fileOutAllMethodsOf:aClass on:aStream methodFilter:methodFilter
@@ -505,6 +512,12 @@
     aNonMetaClass fileOutDefinitionOn:aStream.
 !
 
+fileOutDefinitionOf:aNonMetaClass on:aStream withNameSpace: withNameSpacePragma
+    aNonMetaClass basicFileOutDefinitionOn:aStream withNameSpace: withNameSpacePragma
+
+    "Created: / 04-02-2014 / 20:00:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 fileOutMethod:aMethod on:aStream
     "file a single method onto aStream."
 
@@ -534,11 +547,33 @@
 
 fileOutMethods: methods on: stream
 
-    methods do:
-        [:method| |cat source privacy|
+    methods do:[:method| 
+        |cat source privacy|
 
         stream nextPutChunkSeparator.
-        method mclass name printOn:stream.
+        "JV@2012-09-05: Support for filing out Java extension methods"
+        method mclass theNonMetaclass isJavaClass ifTrue:[
+            | class classBinaryName comps |
+
+            class := method mclass theNonMetaclass .
+            "Sigh, make it compatible with old and new naming of Java classes
+
+            old -> aJavaClass name == #'java/lang/Object'
+            new -> aJavaClass name == JAVA::java::lang::Object
+                   aJavaClass binaryName == #'java/lang/Object'
+            "
+            classBinaryName := (class respondsTo: #binaryName) 
+                                    ifTrue:[ class binaryName ]
+                                    ifFalse:[ class name ].      
+            stream nextPutAll:'(Java classForName:'''.
+            stream nextPutAll:(classBinaryName copyReplaceAll:$/ with: $.).
+            stream nextPutAll:''')'.
+            method mclass isMetaclass ifTrue:[
+                stream nextPutAll: ' class'.
+            ].
+        ] ifFalse:[
+            method mclass name printOn:stream.
+        ].
         "/        self printClassNameOn:aStream.
 
         (privacy := method privacy) ~~ #public ifTrue:[
@@ -558,6 +593,7 @@
         stream cr]
 
     "Created: / 30-12-2009 / 18:43:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 09-10-2013 / 08:57:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 fileOutPackageDefinition:pkg on:aStream 
@@ -610,11 +646,11 @@
 !SmalltalkChunkFileSourceWriter class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/SmalltalkChunkFileSourceWriter.st,v 1.23 2013-06-23 22:22:44 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/SmalltalkChunkFileSourceWriter.st,v 1.24 2014-02-05 17:17:24 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/SmalltalkChunkFileSourceWriter.st,v 1.23 2013-06-23 22:22:44 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/SmalltalkChunkFileSourceWriter.st,v 1.24 2014-02-05 17:17:24 cg Exp $'
 !
 
 version_SVN