Back to index

im-sdk  12.3.91
IMHandler.c
Go to the documentation of this file.
00001 /*
00002 Copyright 1990-2001 Sun Microsystems, Inc. All Rights Reserved.
00003 
00004 Permission is hereby granted, free of charge, to any person obtaining a
00005 copy of this software and associated documentation files (the
00006 "Software"), to deal in the Software without restriction, including
00007 without limitation the rights to use, copy, modify, merge, publish,
00008 distribute, sublicense, and/or sell copies of the Software, and to
00009 permit persons to whom the Software is furnished to do so, subject to
00010 the following conditions: The above copyright notice and this
00011 permission notice shall be included in all copies or substantial
00012 portions of the Software.
00013 
00014 
00015 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00016 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00017 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00018 IN NO EVENT SHALL THE OPEN GROUP OR SUN MICROSYSTEMS, INC. BE LIABLE
00019 FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
00020 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
00021 THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE EVEN IF
00022 ADVISED IN ADVANCE OF THE POSSIBILITY OF SUCH DAMAGES.
00023 
00024 
00025 Except as contained in this notice, the names of The Open Group and/or
00026 Sun Microsystems, Inc. shall not be used in advertising or otherwise to
00027 promote the sale, use or other dealings in this Software without prior
00028 written authorization from The Open Group and/or Sun Microsystems,
00029 Inc., as applicable.
00030 
00031 
00032 X Window System is a trademark of The Open Group
00033 
00034 OSF/1, OSF/Motif and Motif are registered trademarks, and OSF, the OSF
00035 logo, LBX, X Window System, and Xinerama are trademarks of the Open
00036 Group. All other trademarks and registered trademarks mentioned herein
00037 are the property of their respective owners. No right, title or
00038 interest in or to any trademark, service mark, logo or trade name of
00039 Sun Microsystems, Inc. or its licensors is granted.
00040 
00041 */
00042 #include <stdlib.h>
00043 #include <stdio.h>
00044 #include <fcntl.h>
00045 
00046 #include "CodeTable.h"
00047 #include "UDEngine.h"
00048 #include "IMKeyMap.h"
00049 
00050 engine_info **im;
00051 
00052 int     maximum_cans = 7;
00053 
00054 im_data *im_commit();
00055 void    clear_buffer();
00056 
00057 struct im_buffer      *buffer[MAX_SESSION];
00058 im_data     *current;
00059 
00060 im_data * IM_sendEvent(int, int, int, int);
00061 
00062 int IM_open(char * ct_file_path) {
00063        int i;
00064 
00065        char ** ct_list;
00066        char ct_path[200];
00067 
00068        strcpy(ct_path, ct_file_path);
00069        ct_list = (char **) get_list_of_codetable(ct_path);
00070 
00071        if(ct_list == NULL) {
00072 
00073 #ifndef WIN32
00074               strcat(ct_path, "/../locale/zh_CN/ude/data");
00075 #else
00076               strcat(ct_path, "\\..\\locale\\zh_CN\\ude\\data");
00077 #endif
00078               ct_list = (char **) get_list_of_codetable(ct_path);
00079        }
00080 
00081        im = (engine_info **)malloc( sizeof(engine_info*) * 100);
00082        for(i =0; i < 100; i++) {
00083               if(ct_list[i] == NULL) break;
00084 
00085               im[i] = (engine_info *)malloc( sizeof(engine_info));
00086               strcpy(im[i]->name, "udim");
00087               strcpy(im[i]->locale, "zh");
00088               im[i]->next_choice = '.';
00089               im[i]->prev_choice = ',';
00090               im[i]->del_pe_char = 8;
00091               im[i]->del_pe_str = 27;
00092               im[i]->wild_char = -1;
00093               im[i]->symbol = 0;
00094               strcpy(im[i]->status_native, "udim");
00095               strcpy(im[i]->ct_file, ct_list[i]);
00096               im[i]->c_tab = NULL;
00097               im[i]->data = NULL;
00098               printf("read codetable %d\n", read_code_table(i));
00099               free(ct_list[i]);
00100        }
00101        free(ct_list);
00102        return i ;
00103 }
00104 
00105 void IM_close(int codetable_number) {
00106        int i;
00107        for(i = 0; i < codetable_number; i ++) {
00108               free(im[i]->data);
00109               free(im[i]->c_tab);
00110               free(im[i]);
00111        }
00112        free(im);
00113 }
00114 
00115 void IM_createSession(int session_id) {
00116        int i;
00117 
00118        if(current == NULL) { /* malloc struct datasun for sessions */
00119               current = (im_data *)malloc(sizeof(im_data));
00120               if(current == NULL) {
00121                      printf("can malloc i2x\n");
00122               }
00123        }
00124 
00125        if(buffer[session_id] == NULL) { /* malloc struct im_buffer for this session */
00126               buffer[session_id] = (struct im_buffer *)malloc(sizeof(struct im_buffer));
00127               if(buffer[session_id] == NULL) {
00128                      printf("can malloc input buffer\n");
00129               }
00130               clear_buffer(buffer[session_id]);
00131               buffer[session_id]->input_method = 0;
00132               Quanjiao = QUANJIAO_ON;
00133               strcpy(IM_Status, im[buffer[session_id]->input_method]->name);
00134 
00135               strcat(IM_Status, QUANJIAO_STR);
00136 
00137               for(i = 0; i < MAX_CANDIDATE; i ++) {
00138                      Candidate[i] = (char *) malloc(21);
00139               }
00140        }
00141 }
00142 
00143 void IM_resetSession(int session_id) {
00144        clear_buffer(buffer[session_id]);
00145 }
00146 
00147 void IM_destroySession(int session_id) {
00148        if(buffer[session_id]) free(buffer[session_id]);
00149 }
00150 
00151 im_data * IM_setAuxValue(int session_id, int arg, int value) {
00152        /*clear_buffer(buffer[session_id]);*/
00153        if((arg == SOFTKEYBOARD_LAYOUT) && (Input_Method != value)) {
00154               Input_Method = value;
00155               return (im_data *)IM_sendEvent(session_id, IMXK_Mode_switch, 0xff, 0);
00156        }
00157        else if((arg == PUNCTUATION_STATUS) && (Quanjiao!= value)) {
00158               strcpy(IM_Status, im[buffer[session_id]->input_method]->name);
00159               Quanjiao = value;
00160               if(Quanjiao == QUANJIAO_ON) strcat(IM_Status, QUANJIAO_STR);
00161               else strcat(IM_Status, BANJIAO_STR);
00162        }
00163        return NULL;
00164 }
00165 
00166 void IM_getValue(int session_id, int arg, char * value) {
00167        if(arg == IM_STATUS) {
00168               strcpy((char*)value, IM_Status);
00169        }
00170 }
00171 
00172 im_data * IM_sendEvent(session_id , keycode, keychar, state)
00173 int session_id;
00174 int keycode;
00175 int keychar;
00176 int state;
00177 {
00178        int     i, k;
00179        char    c, basestr[20];
00180        int    key;
00181        int    number;
00182 
00183 #ifdef DEBUG
00184        printf("keycode = %d keychar = %d\n", keycode, keychar);
00185 #endif
00186 
00187        if((0x0 <= keychar) && (keychar <= 0x7f))  key = keychar;
00188        else key = keycode & 0xff;
00189 
00190        if (key == im[Input_Method]->del_pe_char) { /* Back Space */
00191               if (Preedit_Len == 0) {
00192                      Commit_Buf[0] = key;
00193                      Commit_Buf[1] = '\0';
00194                      clear_buffer(buffer[session_id]);
00195                      This_Operation = CIM_COMMIT;
00196                      return (im_data *) im_commit(current, buffer[session_id]);
00197               }
00198 
00199               /* Delete characters in pre-edit region */
00200               if ((Preedit_Len > 0) && (Preedit_Buf[Preedit_Len - 1] == im[Input_Method]->wild_char)) {
00201                      if(WildChar_Pos == Preedit_Len - 1) WildChar_Pos = -1;
00202                      Preedit_Len --;
00203                      Inbuf_Len --;
00204                      Preedit_Buf[Preedit_Len] = '\0';
00205                      Inbuf[Inbuf_Len] = '\0';
00206               }
00207               else {
00208                      Inbuf_Len --;
00209                      /* c = Inbuf[Inbuf_Len]; */
00210                      Inbuf[Inbuf_Len] = '\0';
00211                      /*
00212                      for (k = 0; im[Input_Method]->tab_idx[idx(c)].pe_text[k] != '\0' && k < MAX_CHAR_PE; k++);
00213                      */
00214                      Preedit_Len --;
00215                      Preedit_Buf[Preedit_Len] = '\0';
00216               }
00217 
00218               if (Inbuf_Len == 0) {
00219                      clear_buffer(buffer[session_id]);
00220               }
00221 
00222               if (Inbuf_Len > 0) {
00223                      if(WildChar_Pos != -1) {
00224                             strncpy(basestr, Inbuf, WildChar_Pos);
00225                             basestr[WildChar_Pos] = '\0';
00226                      }
00227                      else strcpy(basestr, Inbuf);
00228 
00229                      find_candidate(Input_Method, basestr, &First_Candidate, &Last_Candidate);
00230                      S_Pointer = First_Candidate;
00231                      S_Direction = 1;
00232                      LUC_Number = make_selections(Input_Method, Candidate, &S_Pointer, Last_Candidate, 
00233                                    S_Direction, WildChar_Pos + 1, Preedit_Buf, maximum_cans);
00234                      if(LUC_Number >= 1) Mode = LOOKUP_CHOICE;
00235               }
00236               Commit_Buf[0] = '\0';
00237               This_Operation = CIM_INTERM;
00238               return (im_data *) im_commit(current, buffer[session_id]);
00239        }
00240 
00241        else if(keycode == IMXK_Mode_switch){
00242               clear_buffer(buffer[session_id]);
00243               Commit_Buf[0] = '\0';
00244               strcpy(IM_Status, im[Input_Method]->name);
00245 
00246               if(Quanjiao == QUANJIAO_ON) strcat(IM_Status, QUANJIAO_STR);
00247               else strcat(IM_Status, BANJIAO_STR);
00248 
00249               This_Operation = CIM_STATUS;
00250               return (im_data *) im_commit(current, buffer[session_id]);
00251        }
00252 
00253        else if(key == im[Input_Method]->del_pe_str) { /* Esc , clear preedit, lookup choice pointer, and so on */
00254               clear_buffer(buffer[session_id]);
00255               Commit_Buf[0] = '\0';
00256               This_Operation = CIM_INTERM;
00257               return (im_data *) im_commit(current, buffer[session_id]);
00258        }
00259 
00260        else if((key == im[Input_Method]->wild_char) &&
00261               !is_preedit_char(Input_Method, key)) {
00262 
00263               if(WildChar_Pos == -1) WildChar_Pos = Preedit_Len;
00264 
00265               Preedit_Buf[Preedit_Len] = Inbuf[Inbuf_Len] = key;
00266               Inbuf_Len ++; Preedit_Len ++;
00267               Preedit_Buf[Preedit_Len] = Inbuf[Inbuf_Len] = '\0';
00268 
00269               S_Pointer = First_Candidate;
00270               S_Direction = 1;
00271               LUC_Number = make_selections(Input_Method, Candidate, &S_Pointer, Last_Candidate, 
00272                      S_Direction, WildChar_Pos + 1, Preedit_Buf, maximum_cans);
00273 
00274               if ( LUC_Number >= 1) {
00275                      Mode = LOOKUP_CHOICE;
00276                      Commit_Buf[0] = '\0';
00277                      This_Operation = CIM_INTERM;
00278                      return (im_data *) im_commit(current, buffer[session_id]);
00279               }
00280               else { 
00281                      Preedit_Len --;
00282                      Inbuf_Len --;
00283                      Inbuf[Inbuf_Len] = Preedit_Buf[Preedit_Len] = '\0';
00284                      WildChar_Pos = -1;
00285                      printf("\007");
00286                      Commit_Buf[0] = '\0';
00287                      This_Operation = CIM_INTERM;
00288                      return (im_data *) im_commit(current, buffer[session_id]);
00289               }
00290        }
00291 
00292        else if(is_preedit_char(Input_Method, key)) { /* search for candidate */
00293               Inbuf[Inbuf_Len] = key;
00294               Inbuf_Len ++;
00295               Inbuf[Inbuf_Len] = '\0';
00296 
00297               if(WildChar_Pos != -1) {
00298                      strncpy(basestr, Inbuf, WildChar_Pos);
00299                      basestr[WildChar_Pos] = '\0';
00300               }
00301               else strcpy(basestr, Inbuf);
00302 
00303               find_candidate(Input_Method, basestr, &First_Candidate, &Last_Candidate);
00304               if(First_Candidate > Last_Candidate) { /* no candidate, then delete this key */
00305                      Inbuf_Len --;
00306                      Inbuf[Inbuf_Len] = '\0';
00307                      if (Inbuf_Len == 0) {
00308                             Commit_Buf[0] = key;
00309                             Commit_Buf[1] = '\0';
00310                             clear_buffer(buffer[session_id]);
00311                             This_Operation = CIM_COMMIT;
00312                             return (im_data *) im_commit(current, buffer[session_id]);
00313                      }
00314                      printf("\007");
00315                      find_candidate(Input_Method, Inbuf, &First_Candidate, &Last_Candidate);
00316               }
00317               else {
00318                      Preedit_Buf[Preedit_Len] = key;
00319                      Preedit_Len ++;
00320                      Preedit_Buf[Preedit_Len] = '\0';
00321               }
00322 
00323               S_Pointer = First_Candidate;
00324               S_Direction = 1;
00325 
00326               LUC_Number = make_selections(Input_Method, Candidate, &S_Pointer, Last_Candidate, 
00327                             S_Direction, WildChar_Pos + 1, Preedit_Buf, maximum_cans);
00328 
00329               if ( LUC_Number > 1) {
00330                      Mode = LOOKUP_CHOICE;
00331                      Commit_Buf[0] = '\0';
00332                      This_Operation = CIM_INTERM;
00333                      return (im_data *) im_commit(current, buffer[session_id]);
00334               }
00335               else if(LUC_Number == 1) {
00336                      strcpy(Commit_Buf , Candidate[0]);
00337                      clear_buffer(buffer[session_id]);
00338                      Mode = PRE_EDIT;
00339                      This_Operation = CIM_COMMIT;
00340                      return (im_data *) im_commit(current, buffer[session_id]);
00341               }
00342               else { /* some error occurs when make_selections(), then delete this key */
00343                      Preedit_Len --;
00344                      Inbuf_Len --;
00345                      Inbuf[Inbuf_Len] = Preedit_Buf[Preedit_Len] = '\0';
00346                      printf("\007");
00347                      Commit_Buf[0] = '\0';
00348                      This_Operation = CIM_INTERM;
00349                      return (im_data *) im_commit(current, buffer[session_id]);
00350               }
00351        }
00352 
00353        else if(key == 32) { /* space : commit the first one in lookup choice region */
00354 
00355               if( Mode == PRE_EDIT) {
00356                      change_symbol(key,Quanjiao,Commit_Buf);
00357               }
00358               else {
00359                      strcpy(Commit_Buf , Candidate[0]);
00360               }
00361               clear_buffer(buffer[session_id]);
00362               This_Operation = CIM_COMMIT;
00363               return (im_data *) im_commit(current, buffer[session_id]);
00364        }
00365 
00366        else if((key >= '0') && (key <= '9')) { /* select from candidata */
00367               /* here should see whether there is enough candidates */
00368               if(( Mode == PRE_EDIT) || ((key - '1') > (LUC_Number - 1))) {
00369                      change_symbol(key,Quanjiao,Commit_Buf);
00370               }
00371               else {
00372                      if (key > '0')
00373                             strcpy(Commit_Buf , Candidate[key - '1']);
00374                      else 
00375                             strcpy(Commit_Buf , Candidate[9]);
00376               }
00377               clear_buffer(buffer[session_id]);
00378               This_Operation = CIM_COMMIT;
00379               return (im_data *) im_commit(current, buffer[session_id]);
00380        }
00381 
00382        else if((key == CTRL_N) || (key == im[Input_Method]->next_choice)) { /* page down */
00383               if( Mode == PRE_EDIT) {
00384                      change_symbol(key,Quanjiao,Commit_Buf);
00385                      clear_buffer(buffer[session_id]);
00386                      This_Operation = CIM_COMMIT;
00387                      return (im_data *) im_commit(current, buffer[session_id]);
00388               }
00389               else {
00390                      if(S_Direction == -1) {
00391                             S_Pointer ++;
00392                             S_Direction = 1;
00393                             if(S_Pointer <= Last_Candidate)
00394                                    make_selections(Input_Method, Candidate, &S_Pointer, Last_Candidate,
00395                                           S_Direction, WildChar_Pos + 1, Preedit_Buf, LUC_Number);
00396                      }
00397                      if(S_Pointer <= Last_Candidate)
00398                             LUC_Number = make_selections(Input_Method, Candidate, &S_Pointer, Last_Candidate, 
00399                                    S_Direction, WildChar_Pos + 1, Preedit_Buf, maximum_cans);
00400                      This_Operation = CIM_INTERM;
00401                      return (im_data *) im_commit(current, buffer[session_id]);
00402               }
00403        }
00404 
00405        else if((key == CTRL_P) || (key == im[Input_Method]->prev_choice)) { /* page up */
00406 
00407               if( Mode == PRE_EDIT) {
00408                      change_symbol(key,Quanjiao,Commit_Buf);
00409                      clear_buffer(buffer[session_id]);
00410                      This_Operation = CIM_COMMIT;
00411                      return (im_data *) im_commit(current, buffer[session_id]);
00412               }
00413               else {
00414                      if(S_Direction == 1) {
00415                             S_Pointer --;
00416                             S_Direction = -1;
00417                             if(S_Pointer >= First_Candidate)
00418                                    make_selections(Input_Method, Candidate, &S_Pointer, First_Candidate, 
00419                                           S_Direction, WildChar_Pos + 1, Preedit_Buf, LUC_Number);
00420                      }
00421                      if(S_Pointer >= First_Candidate) 
00422                             LUC_Number = make_selections(Input_Method, Candidate, &S_Pointer, First_Candidate, 
00423                                    S_Direction, WildChar_Pos + 1, Preedit_Buf, maximum_cans);
00424 /*
00425                      if(number <= 0) return (im_data *) im_commit(current, buffer[session_id]);
00426                      LUC_Number = number;
00427 */
00428                      This_Operation = CIM_INTERM;
00429                      return (im_data *) im_commit(current, buffer[session_id]);
00430               }
00431        }
00432 
00433        else { /* need not handle here , commit it or bounce it */
00434               if(!change_symbol(key,Quanjiao,Commit_Buf)) This_Operation = CIM_COMMIT;
00435               else This_Operation = CIM_BOUNCEKEY;
00436               clear_buffer(buffer[session_id]);
00437               return (im_data *) im_commit(current, buffer[session_id]);
00438        }
00439 }
00440 
00441 change_symbol(str,flag,ch_str)
00442 char str;
00443 int flag;
00444 unsigned char *ch_str;
00445 {
00446        unsigned int chinese_symbol;
00447 
00448        if(str == 0) return 1;
00449        if(flag == QUANJIAO_ON) {
00450               chinese_symbol = to_Chinese_symbols(str);
00451               if (chinese_symbol & 0xff00) {
00452                      *ch_str = (chinese_symbol & 0xff00) >> 8;
00453                      *(ch_str + 1) = (chinese_symbol & 0xff);
00454                      *(ch_str + 2) = '\0';
00455                      return 0;
00456               }
00457        }
00458        *ch_str = str;
00459        *(ch_str + 1) = '\0';
00460        return 0;
00461 }
00462 
00463 void clear_buffer(buffer)
00464 struct im_buffer        * buffer;
00465 {
00466        buffer->preedit[0] = buffer->inbuf[0] = '\0';
00467        buffer->preedit_len = buffer->inbuf_len  = 0;
00468        buffer->wildchar_pos = -1;
00469        buffer->candidate_low = 1;
00470        buffer->candidate_high = 0;
00471        buffer->lookupchoice_low = 1;
00472        buffer->lookupchoice_high = 0;
00473        buffer->lookupchoice_number = 0;
00474        buffer->search_pointer = 1;
00475        buffer->search_direction = 1;
00476        buffer->mode = PRE_EDIT;
00477 }
00478 
00479 im_data *
00480 im_commit(i2x,buffer)
00481 im_data     * i2x;
00482 struct im_buffer    * buffer;
00483 {
00484        int i=0;
00485        int number = buffer->lookupchoice_number;
00486 
00487        strcpy(i2x->pre_str, buffer->preedit);
00488        i2x->caret_pos = 0;
00489        for(i = 0; i < number; i ++) strcpy(i2x->luc_str[i] , buffer->candidate[i]);
00490        sscanf(buffer->commit, "%s", i2x->commit_str);
00491        i2x->luc_num = number;
00492        strcpy(i2x->status_str, buffer->status);
00493        i2x->operation = buffer->this_operation;
00494        i2x->labeltype = NUMERIC_LABEL;
00495        return i2x;
00496 }
00497 
00498 to_Chinese_symbols(eng_c)
00499 char            eng_c;
00500 {
00501        unsigned        symbol;
00502        symbol = 0;
00503        switch (eng_c) {
00504        case ' ':
00505               symbol = DSPACE;
00506               break;
00507        case '.':
00508               symbol = PERIOD;
00509               break;
00510        case ',':
00511               symbol = COMMAM;
00512               break;
00513        case '!':
00514               symbol = EXCLMM;
00515               break;
00516        case ':':
00517               symbol = COLONM;
00518               break;
00519        case '-':
00520               symbol = HYPHEN;
00521               break;
00522        case '^':
00523               symbol = CARETM;
00524               break;
00525        case '(':
00526               symbol = LPARNT;
00527               break;
00528        case '{':
00529               symbol = LCUBRT;
00530               break;
00531        case '`':
00532               symbol = ACCENT;
00533               break;
00534        case '[':
00535               symbol = LSQBRT;
00536               break;
00537        case '<':
00538               symbol = LESSTH;
00539               break;
00540        case '@':
00541               symbol = COMMAT;
00542               break;
00543 
00544        case '/':
00545               symbol = SOLDUS;
00546               break;
00547        case ';':
00548               symbol = SEMCLN;
00549               break;
00550        case '?':
00551               symbol = QUESTM;
00552               break;
00553        case '&':
00554               symbol = AMPERS;
00555               break;
00556        case ')':
00557               symbol = RPARNT;
00558               break;
00559        case '}':
00560               symbol = RCUBRT;
00561               break;
00562        case '\'':
00563               symbol = SNGQUO;
00564               break;
00565        case '"':
00566               symbol = DBLQUO;
00567               break;
00568        case ']':
00569               symbol = RSQBRT;
00570               break;
00571        case '>':
00572               symbol = GREATH;
00573               break;
00574        case '|':
00575               symbol = VERBAR;
00576               break;
00577        case '=':
00578               symbol = EQUALS;
00579               break;
00580        case '#':
00581               symbol = SGNNUM;
00582               break;
00583        case '$':
00584               symbol = DALLAR;
00585               break;
00586        case '%':
00587               symbol = PERCNT;
00588               break;
00589        case '*':
00590               symbol = SGNSTR;
00591               break;
00592        case '_':
00593               symbol = UNDSCR;
00594               break;
00595        case '\\':
00596               symbol = BCKSLH;
00597               break;
00598        case '~':
00599               symbol = STILDE;
00600               break;
00601        case '+':
00602               symbol = SGNADD;
00603               break;
00604        case '0':
00605        case '1':
00606        case '2':
00607        case '3':
00608        case '4':
00609        case '5':
00610        case '6':
00611        case '7':
00612        case '8':
00613        case '9':
00614               symbol = DIGITS + eng_c - 0x30;
00615               break;
00616 
00617        case 'A':
00618        case 'B':
00619        case 'C':
00620        case 'D':
00621        case 'E':
00622        case 'F':
00623        case 'G':
00624        case 'H':
00625        case 'I':
00626        case 'J':
00627        case 'K':
00628        case 'L':
00629        case 'M':
00630        case 'N':
00631        case 'O':
00632        case 'P':
00633        case 'Q':
00634        case 'R':
00635        case 'S':
00636        case 'T':
00637        case 'U':
00638        case 'V':
00639        case 'W':
00640        case 'X':
00641        case 'Y':
00642        case 'Z':
00643               symbol = UPPERS + eng_c - 0x41;
00644               break;
00645        case 'a':
00646        case 'b':
00647        case 'c':
00648        case 'd':
00649        case 'e':
00650        case 'f':
00651        case 'g':
00652        case 'h':
00653        case 'i':
00654        case 'j':
00655        case 'k':
00656        case 'l':
00657        case 'm':
00658        case 'n':
00659        case 'o':
00660        case 'p':
00661        case 'q':
00662        case 'r':
00663        case 's':
00664        case 't':
00665        case 'u':
00666        case 'v':
00667        case 'w':
00668        case 'x':
00669        case 'y':
00670        case 'z':
00671               symbol = LOWERS + eng_c - 0x61;
00672               break;
00673        default:
00674               symbol = (eng_c & 0xff);
00675               break;
00676        };
00677 
00678        return (symbol);
00679 }
00680