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) in sqWin32Window.c
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 interp.c at 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?)...
Christos.