Dmitry Timoshkov wrote:
"Shachar Shemesh" [email protected] wrote:
The problem is that the Hebrew keysyms are at 0x0fe0-0x0ff9.
According to keysymdef.h Hebrew keysyms are in the range 0xcdf - 0xcfa What says xev when you type hebrew characters?
xev agrees with keysymdef.h. Strange......
I got the 0x0fxx codes by placing debug messages in the relevant places in keyboard.c. It seemed to me that keyboard.c received characters in the range 0x0fxx, but I just rechecked and it was 0x0cxx range again. Wwwwierd.
I am also having trouble editing keyboard.c with snavigator. Upon saving, it totally screws up the non-ASCII characters in the keyboard layouts. It didn't used to do that (I played with the default charset, and wound up on ASCII at the end), but what do the list have to say about converting the whole string to \x notation? Your native keyboard will be less readable on your personal machine, but the file will stand a lot less chances of corruption. Besides, there is no being in the world for which keyboard.c today shows all characters correctly anyways.
I am attaching a diff against the latest CVS (i.e. - overriding my previous patch) that does this, as well as a small C prog I used to generate this (it contains a very useful C state machine that understands comments and strings, and only replaces the files inside strings).
Oh oh, so this is not that simple. It appears that C will not terminate the \ processing, so '\x000000020' is a perfectly legal way of specifying space. As a result, we are having problems with some of the encodings being continued to the characters after the encoding. So, if the orginal string said: "F8E", after encoding that will be "\xf8E", and the compiler will try to understand it as one character. I checked, and it is defined like that in "The C programming language". We can translate it to "\xf8""E", but the resault will be way ugly.
I'm at a loss. Anyone cares to share their insight?
The second problem I encountered was that keymaps that had three letters per key, but the third letter was wrong, received the same score (i.e. - were not counted as mismatches) as keymaps that only had two letters. In fact, if the X representation had only two letters, the three letter keymaps were not penalized for trying to match a non-existing key. I believe this is not the right behaviour, but as it does not block me at the moment, I did not try to fix it.
Probably keyboard detection code need some additional work. But since it works for (almost?) all, then it's fine to leave it as it is.
Your'e right. I lack the incentive now too.
Shachar
/* * This is a small C state machine skeleton that can be used as a way to know whether your'e inside a string * or a comment when analyzing source. This code will fail miserably given creative preprocessor usage. * * This source code is copyrighted by Shachar Shemesh, and can be distributed freely under the GPL version 2 * license. You may, at your descression, use any later version of the GPL as the license. A copy of the * license can be obtained at http://www.fsf.org/licenses/gpl.txt */
#include <stdio.h>
int main() { int chr=0; enum state { PLAIN, SLASH, LCOMMENT, COMMENT, COM_STAR, DQUOTE, DQUOTE_BACKSLASH, QUOTE, QUOTE_BACKSLASH } state=PLAIN;
while( (chr=getchar())!=EOF ) { switch( state ) { case PLAIN: switch( chr ) { case '/': state=SLASH; break; case ''': state=QUOTE; break; case '"': state=DQUOTE; break; } break; case SLASH: switch( chr ) { case '/': state=LCOMMENT; break; case '*': state=COMMENT; break; default: state=PLAIN; break; } break; case LCOMMENT: switch( chr ) { case '\n': state=PLAIN; break; } break; case COMMENT: switch( chr ) { case '*': state=COM_STAR; break; } break; case COM_STAR: switch( chr ) { case '/': state=PLAIN; break; case '*': break; default: state=COMMENT; break; } break; case DQUOTE: switch( chr ) { case '"': state=PLAIN; break; case '\': state=DQUOTE_BACKSLASH; break; } break; case DQUOTE_BACKSLASH: state=DQUOTE; break; case QUOTE: switch( chr ) { case ''': state=PLAIN; break; case '\': state=QUOTE_BACKSLASH; break; } break; case QUOTE_BACKSLASH: state=QUOTE; break; }
if( chr>=0x80 && ( state==QUOTE || state==DQUOTE ) ) printf("\x%02X", chr ); else putchar(chr); }
return 0; }