[Cuis] [ANN] A first port to Cuis of Sport and Swazoo

Juan Vuletich juan at jvuletich.org
Mon Jan 21 20:27:16 CST 2013


Hi Hannes,

Thanks for the clarifications.

Cheers,
Juan Vuletich

H. Hirzel wrote:
> Hello Germán
>
> Thank you for porting Sport and Swazoo.
>
>
> Regarding Unicode support I think we can say that Cuis has limited
> Unicode support
>
> 1) It reads and writes files in UTF8
> 2) The clipboard is UTF8
>
> The limitation is that only certain code points are supported
> internally -- actually only 256 of them. Internally the characters are
> 8 bit.
>
> We have the utility method
> Character class>>iso8859s15CodeForUnicodeCodePoint: codePoint
>
> which maps a Unicode code point to the internal coding system
>
> And
> String>>iso8859s15ToUtf8
> 	"Convert the given string to UTF-8 from the internal encoding: ISO
> Latin 9 (ISO 8859-15)"
>
>
> To ease porting I suggest to have a Cuis specific
>
>     UTF8TextConverter
>
>
> version in the Compabilitiy layer package.
>
> It will convert the 8859-15 properly. The other Unicode points should
> be replaced with the
> \unnnn notation (JavaScript / Java) or HTML entities ( &#nnn; ).
>
>
>
> Kind regards
>
> Hannes
>
>
>
> On 1/20/13, Germán Arduino <garduino at gmail.com> wrote:
>   
>> Hi:
>>
>> The first versions of Sport and Swazoo working in Cuis 4.1 with all
>> tests green are ready to install.
>>
>> The changes I did in Swazoo are:
>>
>>
>> - Avoid Unicode support that don't exist in Cuis
>>
>>
>> WebSocketConnection:
>>
>> fromUtf8: aString
>> "Squeak specific"
>>
>> "gsa 14/01/2013 for Cuis port"
>> "^[aString convertFromEncoding: #utf8] on: Error do: [:ex | aString ]
>> ^ aString
>>
>>
>> toUtf8: aString
>> "Squeak specific"
>> "
>> | converter in out |
>> converter := UTF8TextConverter new.
>> in := aString readStream.
>> out := WriteStream on: ''.
>> [in atEnd] whileFalse:
>> [converter nextPut: in next toStream: out].
>> ^out contents
>> "
>> ^ aString.
>>
>>
>> SwazooBuffer >>closeChunkTo: aSocket
>>
>> 	" gsa 18/01/2013 used String instead ByteString for Cuis"
>> 	"chunk := ByteString new: 5."
>>
>>
>> - Avoid #fork and #forkAt: calling #newProcess instead:
>>
>> HTTPServer >>start
>>
>> start
>> 	| swazooProcess |
>> 	self loop isNil ifTrue: [
>> 		self socket:
>> 			(SwazooSocket
>> 				serverOnIP: self ipCorrected
>> 				port: self port).
>> 		self socket listenFor: 128.
>> 		self loop: (swazooProcess _ [ [ self acceptConnection ] repeat ]
>> newProcess).
>> 		swazooProcess name: 'Swazoo ' , DateAndTime now asString.
>> 		swazooProcess priority: Processor userBackgroundPriority.
>> 		swazooProcess resume ].
>>
>> instead of the original code:
>>
>> start
>> 	self loop isNil ifTrue: [
>> 		self socket:
>> 			(SwazooSocket
>> 				serverOnIP: self ipCorrected
>> 				port: self port).
>> 		self socket listenFor: 128.
>> 		self loop: ([ [ self acceptConnection ] repeat ] forkAt: Processor
>> userBackgroundPriority) ].
>>
>>
>>
>> HTTPServer >>setUp
>>
>> setUp
>> 	| socket swazooProcess |
>> 	(Delay forMilliseconds: 100) wait.
>> 	server _ HTTPServer new.
>> 	swazooProcess _ [
>> 	server
>> 		 ip: 'localhost';
>> 		 port: 8123.
>> 	server start ] newProcess.
>> 	swazooProcess name: 'Swazoo HTTPServer Test'.
>> 	swazooProcess resume.
>> 	(Delay forMilliseconds: 100) wait.
>> 	" 	stream := (SocketAccessor newTCPclientToHost: 'localhost' port: 8123)
>> 				readAppendStream"
>> 	socket _ SpSocket
>> 		connectToServerOnHost: 'localhost'
>> 		port: 8123.
>> 	stream _ SwazooStream socket: socket.
>>
>> instead of the original code:
>>
>> setUp
>> 	| socket |
>> 	(Delay forMilliseconds: 100) wait.
>> 	server := HTTPServer new.
>> 	[server ip: 'localhost'; port: 8123.
>> 	server start]
>> 		fork.
>> 	(Delay forMilliseconds: 100) wait.
>> " 	stream := (SocketAccessor newTCPclientToHost: 'localhost' port: 8123)
>> 				readAppendStream"
>> 	socket := SpSocket connectToServerOnHost:  'localhost' port: 8123.
>> 	stream := SwazooStream socket: socket
>>
>>
>> Other considerations:
>>
>> SpFilename >>underlyingFilename (This method do not exist, but do not
>> exist neither in the original one click aida/pharo image)
>>
>> Security class don't exist neither in the pharo one click image.
>>
>> #trimSeparators, is named in SwazooMD5 but do not seems implemented.
>>
>>
>>
>>
>> To install Sport and Swazoo, follow the next steps:
>>
>> 1. Take a new Cuis 4.1 image.
>>
>> 2. From GitHub / garduino clone in your computer the repos
>> Cuis-Cryptography
>> Cuis-CompatibilityWithOtherSmalltalks
>> Cuis-Pharo14CompatibilityLayer
>> Cuis-Sport
>> Cuis-Swazoo
>>
>> 3. In a workspace run the next script:
>>
>> | slash repo |
>> slash _ FileDirectory slash.
>> repo := '/Users/Shared/YOURCODEREPOSITORYPATH/'.
>> {
>> repo, slash, 'Cuis-Cryptography', slash, 'Cuis-System-Hashing.pck.st' .
>> repo, slash, 'Cuis-CompatibilityWithOtherSmalltalks', slash,
>> 'Cuis-CompatibilityWithOtherSmalltalks.pck.st' .
>> repo, slash, 'Cuis-Pharo14CompatibilityLayer', slash,
>> 'Cuis-Network-Protocols.pck.st' .
>> repo, slash, 'Cuis-Pharo14CompatibilityLayer', slash,
>> 'Cuis-Network-Url.pck.st' .
>> repo, slash, 'Cuis-Sport', slash, 'Sport.pck.st' .
>> repo, slash, 'Cuis-Swazoo', slash, 'Swazoo.pck.st' .
>> }
>> do:
>> [ :fileName | CodePackageFile installPackageStream:
>> (FileStream concreteStream readOnlyFileNamed: fileName)
>> ].
>>
>>
>> 4. You will notice some warnings in the Transcript regarding some
>> Network-* classes, it is because I'm installing here only the minimum
>> code that I need for Swazoo and I must still end to polish the delta
>> between the Network protocol in Cuis vs Pharo/Squeak
>>
>> 5. I did also an early port of TimeStamp, not existing in Cuis, and I
>> have still 1 failing test.
>>
>>
>> But Swazoo seems to work ok, all the test pass and the tests I did in
>> the workspace seems to work, but as I'm not in expert in Swazoo, I
>> will be more than happy of receive corrections, suggestion, etc, to
>> leave the port in a stable state.
>>
>>
>>
>> --
>> Sincerely,
>> Germán Arduino
>> about.me/garduino
>>
>>     
>
> _______________________________________________
> Cuis mailing list
> Cuis at jvuletich.org
> http://jvuletich.org/mailman/listinfo/cuis_jvuletich.org
>   





More information about the Cuis mailing list