[Vm-dev] Unicode clipboard in Windows

Chris Petsos chrispetsos at sch.gr
Tue May 29 10:33:13 UTC 2007

Ok i am trying to brake down the clipboard-responsible code so that i can add unicode clipboard support.. the news are not so good.

First, i saw that the code for sending text to the clipboard is 

    int clipboardWriteFromAt(int count, int byteArrayIndex, int startIndex) 

The thing is that we are trying to create a fully Unicode VM...this means that the characters that are sent to the VM are Unicode (> 256) and we are using a unicode TT font to render them.
Now... when i evaluate this 

c:=Clipboard new.
c primitiveClipboardText:'?'    "? is unicode char 945"

the clipboardWriteFromAt is never invoked.
That's because in 
    sqInt primitiveClipboardText(void)

the following expression is evaluated to TRUE

if (!(((s & 1) == 0) && (((((usqInt) (longAt(s))) >> 8) & 15) >= 8))) {
   /* begin primitiveFail */
   successFlag = 0;
   printf("primitive failed 1\n");    "This printf is mine"
   return null;

Now what in earth is THIS?
    (!(((s & 1) == 0) && (((((usqInt) (longAt(s))) >> 8) & 15) >= 8)))
Also further down it has

if (successFlag) {
   sz = stSizeOf(s);
   clipboardWriteFromAt(sz, s + BaseHeaderSize, 0);
   /* begin pop: */
   stackPointer -= 1 * BytesPerWord;

where stSizeOf goes down to assembly...
I think i am starting to abandon the fully-unicode vision and follow your instructions from the start to use code pages and preserve the internal representation of Squeak...
I don't think that i will be able to make everything unicode in a life time (does it worth it?)...

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20070529/631e4caa/attachment.htm

More information about the Vm-dev mailing list