fileout: file out class in UTF8 only if necessary jv
authorJan Vrany <jan.vrany@fit.cvut.cz>
Mon, 13 Apr 2015 21:42:19 +0100
branchjv
changeset 18210 d1768187cb74
parent 18209 15ddde9ccd3d
child 18212 d8a2b0f3efff
fileout: file out class in UTF8 only if necessary i.e., only if source code actually contains a character with code point > 0xFF.
Class.st
SmalltalkChunkFileSourceWriter.st
--- a/Class.st	Sat Apr 11 07:03:33 2015 +0100
+++ b/Class.st	Mon Apr 13 21:42:19 2015 +0100
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 1989 by Claus Gittinger
 	       All Rights Reserved
@@ -497,6 +495,7 @@
 ! !
 
 
+
 !Class methodsFor:'Compatibility-Dolphin'!
 
 defaultCategoryForDolphinClasses
@@ -698,11 +697,6 @@
     "Created: / 18.6.1998 / 22:08:45 / cg"
 ! !
 
-!Class methodsFor:'Compatibility-Squeak'!
-
-poolDictionaryNames
-    ^ self sharedPoolNames
-! !
 
 !Class methodsFor:'accessing'!
 
@@ -2901,7 +2895,7 @@
                             |src|
 
                             src := m source.
-                            src notNil and:[src isWideString]
+                            src notNil and:[src isWideString and:[src contains:[:c | c codePoint > 16rFF ] ] ]
                         ]]].
 
     any16Bit ifTrue:[
@@ -2916,6 +2910,7 @@
         encoder:encoder
 
     "Modified: / 18-07-2011 / 09:17:17 / cg"
+    "Modified: / 13-04-2015 / 21:15:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 fileOutOn:outStreamArg withTimeStamp:stampIt withInitialize:initIt withDefinition:withDefinition methodFilter:methodFilter encoder:encoderOrNil
--- a/SmalltalkChunkFileSourceWriter.st	Sat Apr 11 07:03:33 2015 +0100
+++ b/SmalltalkChunkFileSourceWriter.st	Mon Apr 13 21:42:19 2015 +0100
@@ -124,7 +124,7 @@
                             |src|
 
                             src := m source.
-                            src notNil and:[src isWideString]
+                            src notNil and:[src isWideString and:[ src contains: [:c | c codePoint > 16rFF ] ] ]
                         ]]].
 
     any16Bit ifTrue:[
@@ -140,6 +140,7 @@
         encoder:encoder
 
     "Created: / 04-10-2014 / 12:11:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 13-04-2015 / 21:28:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 fileOut:aClass on:outStreamArg withTimeStamp:stampIt withInitialize:initIt withDefinition:withDefinition methodFilter:methodFilter encoder:encoderOrNil
@@ -577,7 +578,7 @@
 
     |source possiblyRewrittenSource rewriteQuery|
 
-    source := aMethod source.
+    source := aMethod source asSingleByteStringIfPossible.
     source isNil ifTrue:[
         Class fileOutErrorSignal 
             raiseRequestWith:aMethod mclass
@@ -599,6 +600,8 @@
 "/    Transcript showCR: possiblyRewrittenSource.
 "/].
     ].
+
+    "Modified: / 13-04-2015 / 21:37:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 fileOutMethods: methods on: stream
@@ -715,6 +718,11 @@
     ^ '$Header: /cvs/stx/stx/libbasic/SmalltalkChunkFileSourceWriter.st,v 1.30 2015-02-03 19:14:15 cg Exp $'
 !
 
+version_HG
+
+    ^ '$Changeset: <not expanded> $'
+!
+
 version_SVN
     ^ '$ Id: SmalltalkChunkFileSourceWriter.st 10643 2011-06-08 21:53:07Z vranyj1  $'
 ! !