SqueakVM help for OLPC

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
17 messages Options
Reply | Threaded
Open this post in threaded view
|

SqueakVM help for OLPC

Chris Petsos
 
Hi all!

This is Christos Petsos... i am actively participating in localising
OLPC in greek language... I am involved in localising eToys in Greek
right now...i'll try to be brief on what i am searching...  

We are trying to make Squeak work with Unicode...Yoshiki Ohshima has
been very helpful till now and his suggestion was to let all the data
that the platform (e.g. Windows, Unix etc...) is sending,  enter the
Squeak VM as is and deal with them there (in the image side) with
InputInterpreter classes. I am a bit familiar with VMMaker ( just today
i downloaded it and managed to compile a VM for my Windows platform) and
now i want to find the place where the VM filters keycodes above 255.

Another clue is that Squeak in Windows uses ANSI versions of Windows
functions which support only 8-bit characters, such as  CreateDirectoryA
CreateEventA CreateFileA CreateMutexA CreateProcessA
DeleteFileA

Any idea on how we can work this out so that Squeak can use the Unicode
equivelant functions so that it can support Wide Characters ...
CreateFileW lstrcmpiW GetCommandLineW lstrcatW
FindFirstFileW GetFileAttributesW lstrcmpW lstrcpynW FormatMessageW
DeleteFileW GetTextExtentPoint32W ?  

Or even just tell the VM to let all the bits enter the image and deal
with them there?   Your help will speed us up a lot so any ideas are
most welcome!
Thank you in advance...  

Christos

Reply | Threaded
Open this post in threaded view
|

Re: SqueakVM help for OLPC

Bert Freudenberg
 
On May 15, 2007, at 20:51 , Chris Petsos wrote:

> We are trying to make Squeak work with Unicode...Yoshiki Ohshima has
> been very helpful till now and his suggestion was to let all the data
> that the platform (e.g. Windows, Unix etc...) is sending,  enter the
> Squeak VM as is and deal with them there (in the image side) with
> InputInterpreter classes.

Yeah, I know, for some strange historical reason the Japanese folks  
like this approach ;)

I much prefer the very simple solution that John put into the Mac VM  
- add a char32 field to each KeyStroke event containing the unicode  
value. Nice and simple.

> Another clue is that Squeak in Windows uses ANSI versions of Windows
> functions which support only 8-bit characters

That's highly irrelevant to the Unix VM. And for filenames we'd most  
likely should use UTF-8 which is 8-bit and actually supported by the  
Unix VM right now.

- Bert -


Reply | Threaded
Open this post in threaded view
|

Re: SqueakVM help for OLPC

Chris Petsos
 
> I much prefer the very simple solution that John put into the Mac VM  
> - add a char32 field to each KeyStroke event containing the unicode  
> value. Nice and simple.

Okay...i'll try to sort this out...

> > Another clue is that Squeak in Windows uses ANSI versions of Windows
> > functions which support only 8-bit characters
>
> That's highly irrelevant to the Unix VM. And for filenames we'd most  
> likely should use UTF-8 which is 8-bit and actually supported by the  
> Unix VM right now.
>
Yes...but we want Unicode support in Windows platform too since many
people will be writing educational material in Windows systems...so we
want compatibility with the OLPC VM.

Right...thanx a lot Bert...you gave the first clue...

Christos



Reply | Threaded
Open this post in threaded view
|

Re: SqueakVM help for OLPC

johnmci
In reply to this post by Bert Freudenberg
 
Well I think the unicode value has been in there in the mac vm since  
march of  2002.

Andreas suggested

        Proposal: utf32Code in sqKeyboardEvent
        Date: March 18, 2005 11:41:12 PM PST (CA)

> Folks,
>
> Since I'm not sure all of you have followed the discussion about  
> scroll events (which then went into keyboard events) here's my  
> proposal again: I would like to add a utf32Code field to  
> sqKeyboardEvent which serves the purpose to provide a UTF-32 value  
> if the VM provides extended input services (the Mac VM already  
> does; others will surely follow). The utf32Code field only needs to  
> be filled in for EventKeyChar events (e.g., neither for  
> EventKeyDown or EventKeyUp since those are used for reporting keys  
> not characters).
>
> John is already playing with this but I want to make sure there is  
> general agreement on this issue. Ian, Tim? Any extra comments?
>
> Cheers,
>   - Andreas
>

I could be wrong but after this discussion  utf32Code was never used  
by the Windows VM, well other than setting it to zero?

However in working with Sophie we found some shortcoming, and I had  
suggest this change (below) but was told Windows doesn't support it.


Subject: sq.h changes, grabbed reserved field in sqKeyboardEvent
        Date: March 29, 2006 1:59:49 PM PST (CA)


> In our work with Sophie we became aware of a shortcoming in how  
> keyboard events are created and what data they contain
> and what data is needed to transform keyboard command on various  
> obscure European keyboards into meaningful interactions
> within Tweak and other important applications like Sophie.
>
> In the past on the macintosh and we believe on Windows the data  
> coming up as a result of
> a keystroke was
>
> key down
> charCode:   a magic number mapping to a key on the keyboard,  
> different between mac/windows
> pressCode: 0
>
> key char
> charCode the macroman value of the key pressed
> pressCode the utf-32 value of the key pressed
>
> key up
> charCode:   a magic number mapping to a key on the keyboard,  
> different between mac/windows
> pressCode: 0
>

The suggestion was:

> Now the results will be.
>
> key down
> charCode:   a magic number mapping to a key on the keyboard,  
> different between mac/windows
> pressCode the utf-32 value of the key pressed
> additionalData the macroman value of the key pressed
>
> key char
> charCode the macroman value of the key pressed
> pressCode the utf-32 value of the key pressed
> additionalData a magic number mapping to a key on the keyboard,  
> different between mac/windows
>
>
> key up
> charCode:   a magic number mapping to a key on the keyboard,  
> different between mac/windows
> pressCode the utf-32 value of the key pressed
> additionalData the macroman value of the key pressed
>
>
> This preserves the existing behaviour, but adds the ability to  
> better support non-usa keyboards and character sets.
> I will make this change btw weekend baring a more elegant solution.
>
> /* keyboard input event */
> typedef struct sqKeyboardEvent
> {
>   int type; /* EventTypeKeyboard */
>   unsigned int timeStamp; /* time stamp */
>   int charCode; /* character code in Mac Roman encoding */
>   int pressCode; /* press code; any of EventKeyXXX */
>   int modifiers; /* combination of xxxKeyBit */
>   int utf32Code; /* UTF-32 unicode value */
>   int additionCharacterData; /* Additional data about charcter for  
> platform specific tweak dispatching */
>   int windowIndex; /* host window structure */
> } sqKeyboardEvent;



On May 15, 2007, at 12:09 PM, Bert Freudenberg wrote:

> On May 15, 2007, at 20:51 , Chris Petsos wrote:
>
>> We are trying to make Squeak work with Unicode...Yoshiki Ohshima has
>> been very helpful till now and his suggestion was to let all the data
>> that the platform (e.g. Windows, Unix etc...) is sending,  enter the
>> Squeak VM as is and deal with them there (in the image side) with
>> InputInterpreter classes.
>
> Yeah, I know, for some strange historical reason the Japanese folks  
> like this approach ;)
>
> I much prefer the very simple solution that John put into the Mac  
> VM - add a char32 field to each KeyStroke event containing the  
> unicode value. Nice and simple.
>
>> Another clue is that Squeak in Windows uses ANSI versions of Windows
>> functions which support only 8-bit characters
>
> That's highly irrelevant to the Unix VM. And for filenames we'd  
> most likely should use UTF-8 which is 8-bit and actually supported  
> by the Unix VM right now.
>
> - Bert -
>
>

--
========================================================================
===
John M. McIntosh <[hidden email]>
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
========================================================================
===


Reply | Threaded
Open this post in threaded view
|

Re: SqueakVM help for OLPC

Chris Petsos
 
I've let the contents of the Event Buffer be output to the transcript and
this is what i got...
I pressed this series of characters:
                abcA
and i got...

--------------
#(2 7187859 65 1 0 0 0 0)
--------------
--------------
#(2 7187859 97 0 0 0 0 0)
--------------
--------------
#(2 7187937 65 2 0 0 0 0)
--------------
--------------
#(2 7188656 66 1 0 0 0 0)
--------------
--------------
#(2 7188656 98 0 0 0 0 0)
--------------
--------------
#(2 7188734 66 2 0 0 0 0)
--------------
--------------
#(2 7189375 67 1 0 0 0 0)
--------------
--------------
#(2 7189375 99 0 0 0 0 0)
--------------
--------------
#(2 7189484 67 2 0 0 0 0)
--------------
--------------
#(2 7190890 16 1 1 0 0 0)
--------------
--------------
#(2 7191031 65 1 1 0 0 0)
--------------
--------------
#(2 7191031 65 0 1 0 0 0)
--------------
--------------
#(2 7191125 65 2 1 0 0 0)
--------------
--------------
#(2 7191218 16 2 0 0 0 0)
--------------

It looks like the last three data members (including the utf32Code) are
never set...
>   int utf32Code; /* UTF-32 unicode value */
>   int additionCharacterData; /* Additional data about charcter for
> platform specific tweak dispatching */
>   int windowIndex; /* host window structure */

This seems to confirm your claim John...

> I could be wrong but after this discussion  utf32Code was never used
> by the Windows VM, well other than setting it to zero?
>
> However in working with Sophie we found some shortcoming, and I had
> suggest this change (below) but was told Windows doesn't support it.

OK, first step is to make the utf32 value enter the VM...or use the
additionalCharacterData data member take the true Unicode value of each
character (thus preserving compatibility with MacRoman input). Don't know
exactly what i'm going to do after wards but... let's start from there...

Any suggestions how can i work around this?

Christos

Reply | Threaded
Open this post in threaded view
|

Re: SqueakVM help for OLPC

Yoshiki Ohshima
In reply to this post by Bert Freudenberg
 
  Hello,

> > We are trying to make Squeak work with Unicode...Yoshiki Ohshima has
> > been very helpful till now and his suggestion was to let all the data
> > that the platform (e.g. Windows, Unix etc...) is sending,  enter the
> > Squeak VM as is and deal with them there (in the image side) with
> > InputInterpreter classes.
>
> Yeah, I know, for some strange historical reason the Japanese folks  
> like this approach ;)
>
> I much prefer the very simple solution that John put into the Mac VM  
> - add a char32 field to each KeyStroke event containing the unicode  
> value. Nice and simple.

  If we can replace all VMs, that would do.  Of course, the image can
check the VM version so that they can install proper "interpreter"
(including non-interpreting one for later VMs.)

  It should be better to use pre-composed chars for these chars, but
I'm not entirely sure if it makes sense for all different input
methods.

-- Yoshiki
Reply | Threaded
Open this post in threaded view
|

Re: SqueakVM help for OLPC

Chris Petsos
 
Just for the record this is what we have done till now for Unicode support
in the Windows VM...
We've made the application send Unicode chars to the image window and
forward this unicode value to the utf32Code data member with the
following...

--- sqWin32Window.c 2007/05/18 06:04:50 1.1
+++ sqWin32Window.c 2007/05/18 10:26:22
@@ -799,6 +799,9 @@
    CreatePrefsMenu();
    SetWindowTitle();
    SetForegroundWindow(stWindow);
+/* Force Unicode WM_CHAR */
+SetWindowLongW(stWindow,GWL_WNDPROC,GetWindowLong(stWindow,GWL_WNDPROC));
+SetWindowLongW(consoleWindow,GWL_WNDPROC,GetWindowLong(consoleWindow,GWL_WNDPROC));
  #ifndef NO_DROP
    /* drag and drop needs to be set up on per-window basis */
    SetupDragAndDrop();
@@ -1069,7 +1072,7 @@
    ctrl = GetKeyState(VK_CONTROL) & 0x8000;
    /* now the key code */
    virtCode = mapVirtualKey(msg->wParam);
-  keyCode = keymap[msg->wParam];
+  keyCode = msg->wParam;
    /* press code must differentiate */
    switch(msg->message) {
      case WM_KEYDOWN:
@@ -1110,14 +1113,14 @@
    evt = (sqKeyboardEvent*) sqNextEventPut();
    evt->type = EventTypeKeyboard;
    evt->timeStamp = msg->time;
-  evt->charCode = keyCode;
+  evt->charCode = keymap[keyCode & 0xff];
    evt->pressCode = pressCode;
    evt->modifiers = 0;
    evt->modifiers |= alt ? CommandKeyBit : 0;
    evt->modifiers |= shift ? ShiftKeyBit : 0;
    evt->modifiers |= ctrl ? CtrlKeyBit : 0;
    evt->windowIndex = msg->hwnd == stWindow ? 0 : (int) msg->hwnd;
-  evt->utf32Code = 0;
+  evt->utf32Code = keyCode;
    /* clean up reserved */
    evt->reserved1 = 0;
    /* note: several keys are not reported as character events;

In the image side we've created a UnicodeInputInterpreter which is dependent
on this sixth field (the utf32Code in the evtBuf Array) for acquiring the
unicode value with the following method...

--------------------------------------------------------------------------------------------
nextCharFrom: sensor firstEvt: evtBuf

 | keyValue |
" Unicode charCode expected as the sixth data member ! "
 keyValue := evtBuf sixth.
 Transcript show: evtBuf asString; cr.
 ^ keyValue asCharacter.

--------------------------------------------------------------------------------------------

So this is it...we have unicode charcodes inside the image...

>  If we can replace all VMs, that would do.  Of course, the image can
> check the VM version so that they can install proper "interpreter"
> (including non-interpreting one for later VMs.)
>
>  It should be better to use pre-composed chars for these chars, but
> I'm not entirely sure if it makes sense for all different input
> methods.

If you have any suggestions-modifications that you feel that will help us
avoid problems in the future, they are most welcome!

Right now we trying to load a Unicode font. We've tried your font Yoshiki
(greek.out) but it has some problems. We are having a '?' character along
with every "carriage return"...
The same effect happens when we try to load TrueType fonts... we have a
small "TrueType Box" in the place of  '?' :-) .
Any help on how we can properly load a unicode font?

Christos.

Reply | Threaded
Open this post in threaded view
|

Re: SqueakVM help for OLPC

Bert Freudenberg
 
On May 21, 2007, at 21:21 , Chris Petsos wrote:

> Just for the record this is what we have done till now for Unicode  
> support in the Windows VM...
> We've made the application send Unicode chars to the image window  
> and forward this unicode value to the utf32Code data member with  
> the following...
>
> --- sqWin32Window.c 2007/05/18 06:04:50 1.1
> +++ sqWin32Window.c 2007/05/18 10:26:22
> @@ -799,6 +799,9 @@
>    CreatePrefsMenu();
>    SetWindowTitle();
>    SetForegroundWindow(stWindow);
> +/* Force Unicode WM_CHAR */
> +SetWindowLongW(stWindow,GWL_WNDPROC,GetWindowLong
> (stWindow,GWL_WNDPROC));
> +SetWindowLongW(consoleWindow,GWL_WNDPROC,GetWindowLong
> (consoleWindow,GWL_WNDPROC));
>  #ifndef NO_DROP
>    /* drag and drop needs to be set up on per-window basis */
>    SetupDragAndDrop();
> @@ -1069,7 +1072,7 @@
>    ctrl = GetKeyState(VK_CONTROL) & 0x8000;
>    /* now the key code */
>    virtCode = mapVirtualKey(msg->wParam);
> -  keyCode = keymap[msg->wParam];
> +  keyCode = msg->wParam;
>    /* press code must differentiate */
>    switch(msg->message) {
>      case WM_KEYDOWN:
> @@ -1110,14 +1113,14 @@
>    evt = (sqKeyboardEvent*) sqNextEventPut();
>    evt->type = EventTypeKeyboard;
>    evt->timeStamp = msg->time;
> -  evt->charCode = keyCode;
> +  evt->charCode = keymap[keyCode & 0xff];
>    evt->pressCode = pressCode;
>    evt->modifiers = 0;
>    evt->modifiers |= alt ? CommandKeyBit : 0;
>    evt->modifiers |= shift ? ShiftKeyBit : 0;
>    evt->modifiers |= ctrl ? CtrlKeyBit : 0;
>    evt->windowIndex = msg->hwnd == stWindow ? 0 : (int) msg->hwnd;
> -  evt->utf32Code = 0;
> +  evt->utf32Code = keyCode;
>    /* clean up reserved */
>    evt->reserved1 = 0;
>    /* note: several keys are not reported as character events;
>
> In the image side we've created a UnicodeInputInterpreter which is  
> dependent on this sixth field (the utf32Code in the evtBuf Array)  
> for acquiring the unicode value with the following method...
>
> ----------------------------------------------------------------------
> ----------------------
> nextCharFrom: sensor firstEvt: evtBuf
>
> | keyValue |
> " Unicode charCode expected as the sixth data member ! "
> keyValue := evtBuf sixth.
> Transcript show: evtBuf asString; cr.
> ^ keyValue asCharacter.
>
> ----------------------------------------------------------------------
> ----------------------
>
> So this is it...we have unicode charcodes inside the image...
>
>>  If we can replace all VMs, that would do.  Of course, the image can
>> check the VM version so that they can install proper "interpreter"
>> (including non-interpreting one for later VMs.)
>>
>>  It should be better to use pre-composed chars for these chars, but
>> I'm not entirely sure if it makes sense for all different input
>> methods.
>
> If you have any suggestions-modifications that you feel that will  
> help us avoid problems in the future, they are most welcome!
>
> Right now we trying to load a Unicode font. We've tried your font  
> Yoshiki (greek.out) but it has some problems. We are having a '?'  
> character along with every "carriage return"...
> The same effect happens when we try to load TrueType fonts... we  
> have a small "TrueType Box" in the place of  '?' :-) .
> Any help on how we can properly load a unicode font?

Squeak's TTF importer discards code points > 255. Here is a hack  
around this:

http://lists.squeakfoundation.org/pipermail/squeak-dev/2006-June/ 
105184.html

- Bert -


Reply | Threaded
Open this post in threaded view
|

Re: SqueakVM help for OLPC

Chris Petsos
 
> Squeak's TTF importer discards code points > 255. Here is a hack  around
> this:
>
> http://lists.squeakfoundation.org/pipermail/squeak-dev/2006-June/ 
> 105184.html

When i load the package i get this Syntax Error...
"Postscript:"
self inform: 'If keyboard input stops working now, please disable the
'unicodeInput'Nothing more expected -> preference'

And the keyboard input stops indeed...

Christos

Reply | Threaded
Open this post in threaded view
|

Re: SqueakVM help for OLPC

Bert Freudenberg
 

On May 21, 2007, at 21:47 , Chris Petsos wrote:

>> Squeak's TTF importer discards code points > 255. Here is a hack  
>> around this:
>>
>> http://lists.squeakfoundation.org/pipermail/squeak-dev/2006-June/ 
>> 105184.html
>
> When i load the package i get this Syntax Error...
> "Postscript:"
> self inform: 'If keyboard input stops working now, please disable  
> the 'unicodeInput'Nothing more expected -> preference'

Oops, that looks like a typo ... should have been "unicodeInput".

> And the keyboard input stops indeed...

It's probably best if you hand-pick the TT-related changes. The  
changeset also hacks the event handling which might be incompatible  
with what you did.

- Bert -


Reply | Threaded
Open this post in threaded view
|

Re: SqueakVM help for OLPC

Chris Petsos
 
> Oops, that looks like a typo ... should have been "unicodeInput".
Minor problem!
 
>> And the keyboard input stops indeed...
>
> It's probably best if you hand-pick the TT-related changes. The  
> changeset also hacks the event handling which might be incompatible  
> with what you did.

Right! I filed in only the TT related stuff and it looks good!
Well done Bert! Thanks!

Christos.
Reply | Threaded
Open this post in threaded view
|

Re: SqueakVM help for OLPC

K. K. Subramaniam
In reply to this post by Bert Freudenberg
 
On Wednesday 16 May 2007 12:39 am, Bert Freudenberg wrote:
> On May 15, 2007, at 20:51 , Chris Petsos wrote:
> > We are trying to make Squeak work with Unicode...Yoshiki Ohshima has
> > been very helpful till now and his suggestion was to let all the data
> > that the platform (e.g. Windows, Unix etc...) is sending,  enter the
> > Squeak VM as is and deal with them there (in the image side) with
> > InputInterpreter classes.
>
> Yeah, I know, for some strange historical reason the Japanese folks
> like this approach ;)

This woud be a preferred approach for Indic languages too. The ability to
switch layouts through hotkeys is crucial because of multiplicity of
languages (over 23!). I could start a paragraph in Kannada layout, switch to
US layout for English and arabic numerals, use Devanagari for Hindi and then
revert to Kannada, all in a single sentence.

Currently, lack of Indic support in Squeak is a showstopper for public schools
in my area.

Regards .. Subbu
Reply | Threaded
Open this post in threaded view
|

Re: SqueakVM help for OLPC

Chris Petsos
 
Hi Subbu...

Follow these to make your VM (in Windows) unicode capable...

--- sqWin32Window.c 2007/05/18 06:04:50 1.1
+++ sqWin32Window.c 2007/05/18 10:26:22
@@ -799,6 +799,9 @@
    CreatePrefsMenu();
    SetWindowTitle();
    SetForegroundWindow(stWindow);
+/* Force Unicode WM_CHAR */
+SetWindowLongW(stWindow,GWL_WNDPROC,GetWindowLong(stWindow,GWL_WNDPROC));
+SetWindowLongW(consoleWindow,GWL_WNDPROC,GetWindowLong(consoleWindow,GWL_WN
DPROC));
  #ifndef NO_DROP
    /* drag and drop needs to be set up on per-window basis */
    SetupDragAndDrop();
@@ -1069,7 +1072,7 @@
    ctrl = GetKeyState(VK_CONTROL) & 0x8000;
    /* now the key code */
    virtCode = mapVirtualKey(msg->wParam);
-  keyCode = keymap[msg->wParam];
+  keyCode = msg->wParam;
    /* press code must differentiate */
    switch(msg->message) {
      case WM_KEYDOWN:
@@ -1110,14 +1113,14 @@
    evt = (sqKeyboardEvent*) sqNextEventPut();
    evt->type = EventTypeKeyboard;
    evt->timeStamp = msg->time;
-  evt->charCode = keyCode;
+  evt->charCode = keymap[keyCode & 0xff];
    evt->pressCode = pressCode;
    evt->modifiers = 0;
    evt->modifiers |= alt ? CommandKeyBit : 0;
    evt->modifiers |= shift ? ShiftKeyBit : 0;
    evt->modifiers |= ctrl ? CtrlKeyBit : 0;
    evt->windowIndex = msg->hwnd == stWindow ? 0 : (int) msg->hwnd;
-  evt->utf32Code = 0;
+  evt->utf32Code = keyCode;
    /* clean up reserved */
    evt->reserved1 = 0;
    /* note: several keys are not reported as character events;

Create an input interpreter with this method...

----------------------------------------------------------------------------
----------------
nextCharFrom: sensor firstEvt: evtBuf

 | keyValue |
" Unicode charCode expected as the sixth data member ! "
 keyValue := evtBuf sixth.
 Transcript show: evtBuf asString; cr.
 ^ keyValue asCharacter.
----------------------------------------------------------------------------
----------------

Download this

>>  http://lists.squeakfoundation.org/pipermail/squeak-dev/2006-June/
>> 105184.html
>

And file-in the TrueType related stuff.
Load your favourite unicode TrueType Font...and you are there...well
almost..we will have to fix some things from this point on...

(This goes to everyone...)
What do you say we start maintaining a Unicode version of the Squeak VM for
Windows and Unix...
It is something that many countries desire as opposed by Subbu...
Also with the upcoming of OLPC with eToys inside it is something that will
be mandatory in the very near future...
It doesn't worth it for everyone trying to find glitches anf fixes for
himself...
What do you say?

Christos.

----- Original Message -----
From: "subbukk" <[hidden email]>
To: <[hidden email]>
Sent: Tuesday, May 22, 2007 8:37 AM
Subject: Re: [Vm-dev] SqueakVM help for OLPC


>
> On Wednesday 16 May 2007 12:39 am, Bert Freudenberg wrote:
> > On May 15, 2007, at 20:51 , Chris Petsos wrote:
> > > We are trying to make Squeak work with Unicode...Yoshiki Ohshima has
> > > been very helpful till now and his suggestion was to let all the data
> > > that the platform (e.g. Windows, Unix etc...) is sending,  enter the
> > > Squeak VM as is and deal with them there (in the image side) with
> > > InputInterpreter classes.
> >
> > Yeah, I know, for some strange historical reason the Japanese folks
> > like this approach ;)
>
> This woud be a preferred approach for Indic languages too. The ability to
> switch layouts through hotkeys is crucial because of multiplicity of
> languages (over 23!). I could start a paragraph in Kannada layout, switch
to
> US layout for English and arabic numerals, use Devanagari for Hindi and
then
> revert to Kannada, all in a single sentence.
>
> Currently, lack of Indic support in Squeak is a showstopper for public
schools
> in my area.
>
> Regards .. Subbu
>

Reply | Threaded
Open this post in threaded view
|

Re: SqueakVM help for OLPC

Andreas.Raab
 
Hi Chris -

Chris Petsos wrote:
> Follow these to make your VM (in Windows) unicode capable...
> +/* Force Unicode WM_CHAR */
> +SetWindowLongW(stWindow,GWL_WNDPROC,GetWindowLong(stWindow,GWL_WNDPROC));
> +SetWindowLongW(consoleWindow,GWL_WNDPROC,GetWindowLong(consoleWindow,GWL_WN
> DPROC));

Have you tried handling WM_UNICHAR instead of tricking the VM into
Unicode mode? If you do what you did above some other messages come in
with Unicode args too and while this may be desirable at some point I'm
not sure if we want this right away. For the time being I'd feel safer
if we would handle WM_UNICHAR explicitly. Also, WM_UNICHAR uses
(according to the docs) UTF-32 instead of UTF-16 as in your code. This
might come in handy at some point.

> What do you say we start maintaining a Unicode version of the Squeak VM for
> Windows and Unix...

I'm happy to fold the fixes into the mainstream version.

Cheers,
   - Andreas
Reply | Threaded
Open this post in threaded view
|

Re: SqueakVM help for OLPC

Chris Petsos
 
> Have you tried handling WM_UNICHAR instead of tricking the VM into
> Unicode mode? If you do what you did above some other messages come in
> with Unicode args too and while this may be desirable at some point I'm
> not sure if we want this right away. For the time being I'd feel safer
> if we would handle WM_UNICHAR explicitly. Also, WM_UNICHAR uses
> (according to the docs) UTF-32 instead of UTF-16 as in your code. This
> might come in handy at some point.

I would wish you are not right but i can see the firsts ghosts coming....
We are having problems with the "BackSpace" keystroke...
    "Error: subscript is out of bounds: 1"
I'll see what i can do with WM_UNICHAR...

>
> > What do you say we start maintaining a Unicode version of the Squeak VM
for
> > Windows and Unix...
>
> I'm happy to fold the fixes into the mainstream version.

That would be nice...if we reach a stable working version...
OK...let's dig down a bit...

Christos

Reply | Threaded
Open this post in threaded view
|

Re: SqueakVM help for OLPC

K. K. Subramaniam
In reply to this post by Chris Petsos
 
On Tuesday 22 May 2007 11:54 am, Chris Petsos wrote:
> Hi Subbu...
>
> Follow these to make your VM (in Windows) unicode capable...
I really appreciate you taking the time to explain the steps, but I will stick
to Linux for its compactness, flexibility and openness (as does Squeak). I
look forward to handling unicode/utf8 in Squeak itself.

Regards .. Subbu
Reply | Threaded
Open this post in threaded view
|

Re: SqueakVM help for OLPC

Chris Petsos
In reply to this post by Andreas.Raab
 
On Mon, 2007-05-21 at 23:32 -0700, Andreas Raab wrote:

> Have you tried handling WM_UNICHAR instead of tricking the VM into
> Unicode mode? If you do what you did above some other messages come
> in
> with Unicode args too and while this may be desirable at some point
> I'm
> not sure if we want this right away. For the time being I'd feel
> safer
> if we would handle WM_UNICHAR explicitly. Also, WM_UNICHAR uses
> (according to the docs) UTF-32 instead of UTF-16 as in your code.
> This
> might come in handy at some point.

OK...i've been trying to use the WM_UNICHAR solution but i haven't
managed to achieve it yet...
Does the window have to be registered to receive Unicode with

+SetWindowLongW(stWindow,GWL_WNDPROC,GetWindowLong(stWindow,GWL_WNDPROC));
+SetWindowLongW(consoleWindow,GWL_WNDPROC,GetWindowLong(consoleWindow,GWL_WNDPROC));

again in this case? ... i suppose not.
What i did is to add the following to the relevant switch statement

  switch(msg->message) {
    case WM_KEYDOWN:
    case WM_SYSKEYDOWN:
      if(virtCode) keyCode = virtCode;
    .................................
    case WM_UNICHAR: // HERE
      printf("Oops! Unicode char!\n");
      break;
    case WM_CHAR:
    case WM_SYSCHAR:
      /* Note: VK_RETURN is recorded as virtual key ONLY */
      if(keyCode == 13) return 1;
      pressCode = EventKeyChar;
      break;

Also, i defined WM_UNICHAR with

#ifndef WM_UNICHAR
#define WM_UNICHAR 0x109
#endif

I also defined those as a workaround while googling

#define UNICODE
#define _UNICODE

But,
        printf("Oops! Unicode char!\n");

is never invoked...

Has anyone implemented this solution??? Some guidelines would be most
welcome...

Sorry if this is a simple C-related thing... i'm not a very good C
programmer...but i want to become one! :-)

Thanks in advance...

Christos.