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

Janko Mivšek janko.mivsek at eranova.si
Mon Jan 21 03:19:24 CST 2013


Dne 21. 01. 2013 09:42, piše H. Hirzel:

> 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.

Would be introducing a WideString and a Character supporting >256 code
points too hard to achieve?

Just for storing Unicode internally, which is enough for web apps, where
an UI is not part of Cuis.

Best regards
Janko


> 
> 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
>>
> _______________________________________________
> Aida mailing list
> Aida at aidaweb.si
> http://lists.aidaweb.si/mailman/listinfo/aida
> 

-- 
Janko Mivšek
Svetovalec za informatiko
Eranova d.o.o.
Ljubljana, Slovenija
www.eranova.si
tel:  01 514 22 55
faks: 01 514 22 56
gsm: 031 674 565




More information about the Cuis mailing list