/************************************************* * abc95wp.c * * * * Copyright (C) 1995-1999 Microsoft Inc. * * * *************************************************/ #include "windows.h" #include "winuser.h" #include "immdev.h" #include "abc95def.h" #include "abcbx.h" struct INPT_BF kbf={40,0,{0}}; INT_PTR WINAPI OpenDlg(HWND,UINT,WPARAM,LPARAM); int word_select_bx(int input_char); int word_long; int unit_length=2; /* single word */ int disp_tail=0; int disp_head=0; int group_no=24; int current_no; /****************************************************************** /* CharProc(ImeChar,wParam,lParam,hIMC,lpIMC,lpImcP) * /*****************************************************************/ extern HWND hCrtDlg; int WINAPI CharProc(ImeChar,wParam,lParam,hIMC,lpIMC,lpImcP) WORD ImeChar; WPARAM wParam; LPARAM lParam; HIMC hIMC; LPINPUTCONTEXT lpIMC; LPPRIVCONTEXT lpImcP; { int x; ghIMC=hIMC; glpIMCP=lpImcP; glpIMC=lpIMC; TypeOfOutMsg = 0; waitzl_flag = 0; //waitzl 3 if (cap_mode){ if(ImeChar<0x8000){ //for mouse message pass send_one_char(ImeChar/*wParam*/); // changed 94/8/6 return(0); } } if(lpIMC->fdwConversion&IME_CMODE_NATIVE){ switch(kb_mode){ case CIN_STD: //stand change if (V_Flag) v_proc(ImeChar); // V fuction else { if (sImeG.cbx_flag==1) { if (bx_allow) { if (BX_MODE(ImeChar,wParam)) return(0); } } //if (sImeG.cbx_flag) STD_MODE(ImeChar); } break; case CIN_SDA: //double hit inputing for (x=0; x<(sizeof sda_trans)/2; x++) //Note sizeof!! 1992 2 sda_trans[x]=0; //clear the transport buffer if(((!step_mode)||(step_mode==RESELECT))&&((ImeChar == 0x60)||(ImeChar == 0x27))) return (STD_MODE(ImeChar)); if (sImeG.cbx_flag==1) { if (bx_allow){ if (BX_MODE(ImeChar,wParam)) return(0); } //if (bx_allow) } //if (sImeG.cbx_flag) if ((step_mode==ONINPUT)&&(I_U_Flag==1)){ STD_MODE(ImeChar); return(0); } if ( if_zimu_or_not((BYTE)ImeChar)/*||(wParam == 0x60)*/||(wParam == 0x27) ) { if ((step_mode==START)||/*(Return==NULL)||*/(step_mode==RESELECT)) { if (((wParam&0xdf)=='U')||((wParam&0xdf)=='I')) { I_U_Flag=1; STD_MODE(ImeChar); return(0); } else { I_U_Flag=0; }//else... }//if (step_mode.... if (!Sd_Open_flag){ if(KeyBoardState){ SdaPromptOpen=1; tran_data( 0, ghIMC, Sd_Open_flag); }//if Key }//if (Sd_Open_flag) }//if (if_zimu_... if ((wParam==VK_BACK)&&(step_mode==ONINPUT) &&(Return==NULL)&&(!Sd_Open_flag)){ if(KeyBoardState){ SdaPromptOpen=1; tran_data( 0, ghIMC, Sd_Open_flag); } }//if (wParam) sda_proc(ImeChar, (LPWORD)sda_trans, step_mode, ghIMC); //change the key into standed if (sda_trans[0]==0xff) //change error or input more than 40 chars break; if (sda_trans[0]==0xf0){ //if free the dialog? if(KeyBoardState){ tran_data( 2, ghIMC, Sd_Open_flag); }//if key SdaPromptOpen=0; sda_trans[0]=sda_trans[1]; sda_trans[1]=0; } x=0; //chinese spelling while (sda_trans[x]){ if (wait_flag && (sda_trans[x]=='h')) //waitzl 4 waitzl_flag = 1; STD_MODE(sda_trans[x++]); } break; } }else send_one_char(ImeChar/*wParam*/); return (0); } /**************************************************************** v_proc(): produce the V fuction *****************************************************************/ int WINAPI v_proc(input_char) WORD input_char; { int i, n; n=0; if (V_Flag==1) { switch (input_char) { case '0': case VK_BACK: cls_inpt_bf(0); step_mode = START; V_Flag = 0; return(1); } } if ((if_number_or_not((BYTE)input_char)) && (V_Flag!=2)){ input_char &= 0x000f; //get the QUMA for (i=1; i<=94; i++){ //get WEIMA if (input_char==2){ if (i==1) i=17; if (i==67) i=69; if (i==79) i=81; } out_svw[n++]=input_char+0xa0; out_svw[n++]=i+0xa0; } group_no=94; if (input_char==2) group_no=72; unit_length=2; current_no=0; disp_tail=0; V_Flag=0; msg_type=2; //94/8/22 fmt_transfer(); SetToIMC(ghIMC,(LPSTR)&out_svw,(WORD)group_no,(WORD)(unit_length+0x1000)); move_result(); prompt_disp(); word_back_flag=0x55; //93,9,4 step_mode=SELECT; } //if (if_number_or_not) else { V_Flag=2; step_mode=ONINPUT; STD_MODE(input_char); } return (1); } int ReDrawSdaKB(hIMC, KbIndex, ShowOp) HIMC hIMC; DWORD KbIndex; DWORD ShowOp; { //return 0; if (KbIndex) // if not PC KB return 0; if (kb_mode != CIN_SDA) return 0; // if not SDA mode if (ShowOp==SW_HIDE) return 0; // if SW_SHOW.... if (SdaInst){ tran_data( 0x5678, //Return, ghIMC,//hWnd, Sd_Open_flag); return 1;} return 0; } void WINAPI DispModeEx() { cls_inpt_bf(0); step_mode=START; } /**************************************************************** FUNCTION: disp_mode(hW) PORPUSE: display the mode item at the input window. *****************************************************************/ void WINAPI DispMode(HIMC hIMC) { LPINPUTCONTEXT lpIMC; LPPRIVCONTEXT lpImcP; UINT fdwConversion; if (!hIMC) return; lpIMC =(LPINPUTCONTEXT)ImmLockIMC(hIMC); if (!lpIMC) return; lpImcP =(LPPRIVCONTEXT)ImmLockIMCC(lpIMC->hPrivate); if (!lpImcP) return; DispModeEx(); //zl#3(hW); if (SdaInst&&(kb_mode!=CIN_SDA)){ Sd_Open_flag=0; SdaPromptOpen=0; SdaInst=0; } if ((kb_mode==CIN_SDA)&&(!SdaInst)) { SdaInst = 1; // The ABCSDA.DLL is Load In. } ImmUnlockIMCC(lpIMC->hPrivate); ImmUnlockIMC(hIMC); } void WINAPI DispSpecChar(c,n) int c,n; { int i; for (i=now_cs;i=group_no){ pass_word=1; if (disp_head==0) pass_word=2; break;} }//for (i=... if (pass_word<1){ pass_word=3; if (disp_head==0) pass_word=4; } SetToIMC(ghIMC,NULL,(WORD)pass_word,(WORD)disp_head); } /**************************************************** cls_prompt *****************************************************/ int WINAPI cls_prompt() { int i; for (i=0;ihPrivate); if ( lpImcP != NULL ) lpImcP->fdwImeMsg = (lpImcP->fdwImeMsg | MSG_CLOSE_CANDIDATE) & ~(MSG_OPEN_CANDIDATE); ImmUnlockIMCC(lpIMC->hPrivate); ImmUnlockIMC(ghIMC); return 0; } int WINAPI SetCloseCompWinMsg(int ClsFlag) { LPINPUTCONTEXT lpIMC; LPPRIVCONTEXT lpImcP; if (!ghIMC) return (0); // The IMC must be a valid one. lpIMC = (LPINPUTCONTEXT)ImmLockIMC(ghIMC); if(!lpIMC) return 0; lpImcP = (LPPRIVCONTEXT)ImmLockIMCC(lpIMC->hPrivate); if (!ClsFlag ) { if ( lpImcP != NULL ) lpImcP->fdwImeMsg = (lpImcP->fdwImeMsg | MSG_END_COMPOSITION ) & ~(MSG_COMPOSITION) ; } ImmUnlockIMCC(lpIMC->hPrivate); ImmUnlockIMC(ghIMC); return 0; } void WINAPI ABCstrnset(bufferd,value,n) LPSTR bufferd; BYTE value; { int i; for (i=0; i=(CUR_START_X+(lpImeL->rcCompText.right-4))){ xx=CUR_START_X; for (i =now_cs; i>0; i--) { yy=GetText32(hDC, &InputBuffer[i-1], 1); if ( (xx+yy) >= (CUR_START_X+(lpImeL->rcCompText.right-4))) break; else xx+=yy; } cur_start_count=(WORD)i; // Adgust for Chines Word Display kk=0; for (i=0; i0xa0){ kk++; kk&=1; } else kk=0;} if (kk){ xx=xx- GetText32(hDC, &InputBuffer[cur_start_count], 1); cur_start_count++; } cur_start_ps=(WORD)GetText32(hDC, &InputBuffer[0], i); now_cs_dot=xx; ReleaseDC(hInputWnd,hDC); UpdateCompCur(hInputWnd); cur_hibit=0; return 0; } cur_hibit=0; ReleaseDC(hInputWnd,hDC); if (zz<(CUR_START_X+(lpImeL->rcCompText.right-4))){ now_cs_dot=kk-cur_start_ps; DrawInputCur(); } return 0; } /******************************************************************** Function:DrawInputCur ********************************************************************/ void WINAPI DrawInputCur() { HDC OldDC; if (!hInputWnd) return; if ((WORD)now_cs_dot!=old_curx) { if (cur_flag) { hDC=GetDC(hInputWnd); OldDC=SelectObject(hMemoryDC,cur_h); BitBlt(hDC,old_curx+lpImeL->rcCompText.left, lpImeL->rcCompText.top+3, CUR_W,CUR_H,hMemoryDC,0,0,SRCINVERT); SelectObject(hMemoryDC,OldDC); ReleaseDC(hInputWnd,hDC); cur_flag=!cur_flag; } old_curx=(WORD)now_cs_dot; } hDC=GetDC(hInputWnd); OldDC=SelectObject(hMemoryDC,cur_h); BitBlt(hDC,now_cs_dot+lpImeL->rcCompText.left, lpImeL->rcCompText.top+3, CUR_W,CUR_H,hMemoryDC,0,0,SRCINVERT); SelectObject(hMemoryDC,OldDC); ReleaseDC(hInputWnd,hDC); cur_flag=!cur_flag; return; }//#0 /************************************************************ UpdateUser(): if the user.rem has changed, clear the tmmr.rem_area and read the user.rem's index once again. *************************************************************/ void WINAPI UpdateUser() { // 94/4/16 HANDLE hd; int hd; int i; WORD op_count; OFSTRUCT ofs; if (UpdateFlag) { //increase the user.rem for (i=0; i<0x200; i++) //1993.3 tmmr.rem_area[i] = 0; last_item_name=0; //clear the date in memory flag UpdateFlag = 0; hd = OpenFile (user_lib, &ofs, OF_READ); //1993.4.15 if (hd==-1) err_exit_proc(jiyi_wenjian_cuo); _llseek(hd,0xa000l,0); op_count=(WORD)_lread(hd,&kzk_ndx,NDX_REAL_LENGTH); if (op_count!=NDX_REAL_LENGTH) err_exit_proc(jiyi_wenjian_cuo); _lclose(hd); } } //##!!extern void AddExtLib(); /////////////////////////////////////////////////////////////////////////// // STD_MODE // Deels with stdandard Chinese Pinyin input with some written_stroke // attributes when neccerry. // ////////////////////////////////////////////////////////////////////////// int WINAPI STD_MODE(input_char) WORD input_char; { int leibie,input_char_type,i; sImeG.InbxProc = 0; wait_flag=0; if (input_char==BACKWORD_KEY) return(backword_proc()); if (input_char==FORWORD_KEY){ if ((step_mode!=ONINPUT)&&(group_no>1)) step_mode=SELECT; return(0);} switch(step_mode){ //step_mode indicate the input step // step_mode take this value: // START=0 first input pinyin // SELECT=1 can select/cansel the result // RESELECT=2 use FORCE SELECT KEY // ONINPUT=3 just in inputing step case SELECT: if ((input_char==VK_HOME*0x100)|| (input_char==VK_END*0x100)|| (input_char==VK_PRIOR*0x100)|| (input_char==VK_NEXT*0x100)){ word_select(input_char); break;} if (input_char>=0x8000) input_char-=0x8000; if ((input_char==VK_SPACE)||(input_char==VK_RETURN)){ if(!out_result(0)) step_mode=RESELECT; //92/12/14 SZ break; } if (input_char==VK_ESCAPE){ cls_inpt_bf(0); step_mode=START; break; } if (input_char==VK_BACK){ if (word_back_flag!=0x55) del_and_reconvert(); break; } if (if_zimu_or_not((BYTE)input_char)){ wait_flag=1; while(out_result(0)); step_mode=START; } else{ word_select(input_char); break; } case RESELECT: case START: if (input_char >= 0x8000){ input_char -= 0x8000; if ( word_select(input_char) == 1 ) return(0); else return(send_one_char(input_char)); }//if (input_char) else{ if (if_first_key(input_char)){ if (input_char=='v') V_Flag = 1; else { V_Flag = 0; } //93,9,3 step_mode=ONINPUT; sent_back_msg(); if (wait_flag) cls_inpt_bf(1); else cls_inpt_bf(1); //1993. cock } else{ if ((kb_mode==CIN_SDA)&&(input_char==0x27)){ //1993. cock step_mode=ONINPUT; //1993. cock sent_back_msg(); //1993. cock if (wait_flag) cls_inpt_bf(1); else cls_inpt_bf(1); //1993. cock }//if(kb_mode) //1993. cock else return(send_one_char(input_char)); } } case ONINPUT: input_char_type=sent_chr1(input_char); switch(input_char_type){ case REINPUT: ImeSetCompositionString(ghIMC,SCS_SETSTR,NULL,0,&InputBuffer,now_cs);//#52224 step_mode=START; return(0); break; case CLC: return(0); // Continue input. case STC: // input finished if (V_Flag){ msg_type=2; //94/8/22 send_msg(&in.buffer[1], in.true_length-1); //1993.3 skip the 'v' V_Flag = 0; step_mode = 0; return(0);} step_mode=4 ; // enter proccessing step leibie=analize(); if (leibie==BIAODIAN_ONLY){ out_result_area[0]=(BYTE)biaodian_value; out_pointer=2; // may not used msg_type=0; out_result(0); step_mode=0; return(0); } //only bioadian case return(call_czh(leibie)); }// switch (sent_chr1) } //switch step_mode return 0; } /******************************************************************* &2: DealWithSH(): ********************************************************************/ void WINAPI DealWithSH() { int len,p; if (group_no <= 1) return; if (unit_length > 2) return; if (in.true_length != 2) return; if (in.buffer[0] != 's') return; if (in.buffer[1] != 'h') return ; current_no = 1; } /******************************************************************* &2: call_czh(): ********************************************************************/ int WINAPI call_czh(mtype) int mtype; { int x; unsigned char prompt_flag_wu[]="无!"; jiyi_mode=0; in.buffer[in.true_length]=0; sImeG.cp_ajust_flag = 0; group_no=0; unit_length=0; if (cwp_proc(mtype)!=1){ MessageBeep((UINT)-1); MessageBeep(0); //word exchange is wrong MessageBeep(0); MessageBeep(0); //word exchange is wrong if (result_area_pointer>=0){ // jiyi_mode=0; // group_no =0; // cls_prompt_only(); // unit_length=result_area_pointer; // out_result(1); // step_mode=0; // return(9); // }//result_area //else{ // show_char(prompt_flag_wu,4); step_mode=ONINPUT; return(0); } } //cwp_proc=-1 disp_jiyi(0); if (msg_type==2){ current_no=0; move_result(); out_result(1); /* special change*/ return(0); } if_jlxw_mode(); fmt_transfer(); current_no=0; DealWithSH(); if (group_no==1){ if (sImeG.cp_ajust_flag!=0) result_area_pointer-=unit_length; move_result(); step_mode=1; return(0); }//if (group_no=1) else{ disp_tail=0; if (sImeG.cp_ajust_flag==1) AutoMoveResult(); else move_result(); SetToIMC(ghIMC,(BYTE *)&out_svw,(WORD)group_no,(WORD)unit_length); prompt_disp(); step_mode=1; return(0); }//else } /**********************************************************************/ /* MoveWordIntoCand() */ /**********************************************************************/ void WINAPI MoveWordIntoCand( LPCANDIDATELIST lpCandList, LPBYTE srcBuffer, BYTE srcAttr, WORD perLength ) { int i; if (lpCandList->dwCount >= MAXCAND) { return; } // add this string into candidate list for (i=0; idwOffset[ lpCandList->dwCount]+i) =srcBuffer[i] ; // null terminator *(LPTSTR)((LPBYTE)lpCandList + lpCandList->dwOffset[ lpCandList->dwCount] + i ) = '\0'; *(LPTSTR)((LPBYTE)lpCandList + lpCandList->dwOffset[ lpCandList->dwCount] + i+1 ) = srcAttr; lpCandList->dwOffset[lpCandList->dwCount + 1] = lpCandList->dwOffset[lpCandList->dwCount] + i + sizeof(TCHAR)+1; lpCandList->dwCount++; return; } /**********************************************************************/ /* SetToIMC() */ /* Return vlaue */ /* the number of candidates in the candidate list */ /**********************************************************************/ UINT WINAPI SetToIMC(ghIMC,srcBuffer,srcCount,perLength) HIMC ghIMC; BYTE *srcBuffer; //soarce buffer (normal for out_svw) WORD srcCount; //How many candidates are. WORD perLength; //How long of each of that? { LPINPUTCONTEXT lpIMC; LPCANDIDATEINFO lpCandInfo; LPCANDIDATELIST lpCandList; LPPRIVCONTEXT lpImcP; INT i,j,nRecord,where; WORD temp[20],xx,yy; LPSTR ppt; static int CandiCount; where = 0 ; if (perLength>0x1000){ perLength -=0x1000; // if where = 1, msg_type = 2 where = 1;} if (!ghIMC) return (0); // The IMC must be a valid one. lpIMC = (LPINPUTCONTEXT)ImmLockIMC(ghIMC); if(!lpIMC) return 0; if (srcBuffer) ClearCand(lpIMC); if (!lpIMC->hCandInfo){ ImmUnlockIMC(ghIMC); return (0); } // The CandInfo must... lpCandInfo = (LPCANDIDATEINFO)ImmLockIMCC(lpIMC->hCandInfo); if (!lpCandInfo) { ImmUnlockIMC(ghIMC); return (0);} lpCandList = (LPCANDIDATELIST) ((LPBYTE)lpCandInfo + lpCandInfo->dwOffset[0]); if(srcBuffer){ CandiCount = srcCount; lpCandList->dwCount = 0; for (i=0; i<(int)srcCount; i++){ if ( where ) { ppt = (LPSTR)temp; for (j=0; jdwSelection = 0; // for showing phrase prediction string(s) nRecord = lpCandInfo->dwCount; } else { lpCandList->dwSelection = perLength; //Hack for IME aware application 9/13/96 lpCandInfo->dwCount = CandiCount; // for showing phrase prediction string(s) nRecord = lpCandInfo->dwCount; } lpImcP = (LPPRIVCONTEXT)ImmLockIMCC(lpIMC->hPrivate); if ( lpImcP != NULL ) { if ((lpImcP->fdwImeMsg & (MSG_ALREADY_OPEN|MSG_CLOSE_CANDIDATE)) == (MSG_ALREADY_OPEN|MSG_CLOSE_CANDIDATE)) { lpImcP->fdwImeMsg = (lpImcP->fdwImeMsg | MSG_CHANGE_CANDIDATE) & ~(MSG_CLOSE_CANDIDATE); } else if (lpImcP->fdwImeMsg & MSG_ALREADY_OPEN) { lpImcP->fdwImeMsg |= MSG_CHANGE_CANDIDATE; } else { lpImcP->fdwImeMsg = (lpImcP->fdwImeMsg | MSG_OPEN_CANDIDATE) & ~(MSG_CLOSE_CANDIDATE); } } ImmUnlockIMCC(lpIMC->hPrivate); ImmUnlockIMCC(lpIMC->hCandInfo); ImmUnlockIMC(ghIMC); return (nRecord); /* The real number of being moved */ } /******************************************************************** word_select(wParam): select the word or turn to the next or up page *********************************************************************/ int WINAPI word_select(input_char) int input_char; { int x; switch (input_char){ case VK_END*0x100: case VK_NEXT*0x100: case '=': //94/8/22 case ']': if (disp_tail>=group_no) MessageBeep(0); else{ if(input_char == VK_END*0x100 ){ disp_head = (group_no - 1)/now.fmt_group*now.fmt_group; disp_tail = disp_head;} fmt_transfer(); current_no=disp_tail; result_area_pointer-=unit_length; //if recall, unit_length=8 if (in.info_flag==1) //result_area_pointer maybe small result_area_pointer=0; //than zero, so reset it =0 move_result(); prompt_disp();} return(1); //means break the STD MODE case VK_HOME*0x100: case '-': //94/8/22 case '[': case VK_PRIOR*0x100: if (disp_head==0) MessageBeep(0); else{ if(input_char == VK_HOME*0x100 ) disp_head = 0; else disp_head=disp_head-now.fmt_group; disp_tail=disp_head; fmt_transfer(); current_no=disp_tail; result_area_pointer-=unit_length; //if recall, unit_length=8 if (in.info_flag==1) //result_area_pointer maybe small result_area_pointer=0; //than zero, so reset it =0 move_result(); prompt_disp(); } return(1); default: if (if_biaodian((BYTE)input_char)){ //1993.1.15 cock if (!biaodian_value){ sent_chr1(input_char); //this produce the situation bd_proc(); //when the result had display while(out_result(0)); //94-4-22 step_mode=START; return(1); //1993.1.15 cock } } if ( !if_number_or_not((BYTE)input_char)) { //1993.4.22 while(out_result(0)); //94-4-22 //if input is not number step_mode = START; //send the result and set start step return(1); } //1993.4.22 if(input_char=='0') x=disp_head+9; //92/12/21 SZ else x=(input_char-0x30-1)+disp_head; if (x>=group_no) //1994.4 current_no=group_no-1; else current_no=x; result_area_pointer-=unit_length; //if recall, unit_length=8 if (in.info_flag==1) //result_area_pointer maybe small result_area_pointer=0; //than zero, so reset it =0 else{ if((step_mode==RESELECT) &&biaodian_value &&(result_area_pointer>=biaodian_len)) result_area_pointer-=biaodian_len; } move_result(); pindu_ajust(); step_mode=RESELECT; //Note: pindu_ajust out_result(0); // must above out_result return(1); // step_mode must be set to 2(Re..) } } /********************************************* del_and_reconvert() **********************************************/ int WINAPI del_and_reconvert() { int x; if (word_back_flag==0xaa) return(same_as_backwords()); wp.dw_count--; x=wp.dw_stack[wp.dw_count+1]-wp.dw_stack[wp.dw_count]; if (x==1){ //if the single word exchange if (!wp.dw_count) return(same_as_backwords()); else{ wp.dw_count--; x=wp.dw_stack[wp.dw_count+1]-wp.dw_stack[wp.dw_count]+1; } } result_area_pointer-=x*2; word_back_flag=x-1; wp.xsyjw=wp.dw_stack[wp.dw_count]; return(call_czh(13)); } /*********************************************** backword_proc() ************************************************/ int WINAPI backword_proc() { switch(step_mode){ case SELECT: return(same_as_backwords()); break; case RESELECT: case START: if ((!msg_type)&&((kb_mode==CIN_STD)||(kb_mode==CIN_SDA))) return(same_as_backwords()); else send_msg(msg_bf,msg_count); break; case ONINPUT: return(call_czh(14)); break; } return 0; } /*********************************************** same_as_backwords() ************************************************/ int WINAPI same_as_backwords() { int i; if (in.buffer[0]!='v'){ cls_prompt_only(); if (in.true_length>=1) if (in.buffer[0]!='U') if (!cap_mode){ cs_p(input_msg_disp); show_char(in.buffer,in.true_length); cs_p(input_msg_disp+in.true_length); half_init(); if (kb_mode==CIN_STD||kb_mode==CIN_SDA){ //STD_MODE step_mode=ONINPUT; return(0); }//if (kb_mode) return(read_kb()); //double hit input_mode }//if (cap_mode) }//if (in.buffer[0]) out_length=last_out_length; return(REINPUT); } /******************************************* AutoMoveResult() ********************************************/ void WINAPI AutoMoveResult() { int i,j,ct; WORD x; BYTE *ps,*pd; x=(WORD)unit_length; j=unit_length*current_no; for (i=0;i6) return(0); if (msg_type&2) return(0); switch (unit_length){ case 2: rem_pd1((WORD *)&out_svw[current_no*unit_length]); break; case 4: rem_pd2((WORD *)&out_svw[current_no*unit_length]); break; default: rem_pd3((WORD *)&out_svw[current_no*unit_length]); break; } return (0); } /*********************************************************** cls_inpt_bf(): inputing information init. clear the display area, and give the init_value to processing paraments. ************************************************************/ void WINAPI cls_inpt_bf(int hFunc) { int i; cls_prompt_only(); input_cur=0;//input_msg_disp; for (i=0;iinput_cur){ for (i=0;i0) input_cur--; cs_p(input_cur); return (CLC); case VK_RIGHT+0x100: if (input_cur=in.true_length){ in.buffer[in.true_length++]=(BYTE)input_char; show_char(&in.buffer[input_cur],1); //1994.4.5 input_cur++; cs_p(input_cur); // zst 95.54 if (bd_find==1) return(STC); /* STC */ else return(CLC);} else{ if((!input_cur)&&((input_char&0xdf)=='V')) return(CLC); //1994.7.24 for (i=0; i& */ return(1); /* ABBR */ else return(0); /* mark of the standard change */ } /*************************************************** &4: bd_proc(): process the chinese biaodian return(FALES): have chinese biaodian and another char return(TRUE): only have the chinese biaodian ****************************************************/ BOOL bd_proc() { BYTE x; x=in.buffer[in.true_length-1]; if(!GetBDValue(x)) return(FALSE); in.true_length--; if (in.true_length==0) return(TRUE); else return(FALSE); } int WINAPI GetBDValue(bd_char) int bd_char; { if (!if_biaodian((BYTE)bd_char)) return(FALSE); biaodian_len =2; if ((bd_char=='^')||(bd_char=='^')) biaodian_len =4; biaodian_value=cc_biaodian[biaodian_pos*2]+ cc_biaodian[biaodian_pos*2+1]*0x100; if (bd_char==0x22){ if (yinhao_flag==1) biaodian_value=cc_biaodian[(biaodian_pos+2)*2] +cc_biaodian[(biaodian_pos+2)*2+1]*0x100; yinhao_flag=!yinhao_flag; //92-12-21 SZ } if (bd_char==0x27){ if (d_yinhao_flag==1) biaodian_value=cc_biaodian[(biaodian_pos+2)*2] +cc_biaodian[(biaodian_pos+2)*2+1]*0x100; d_yinhao_flag=!d_yinhao_flag; //92-12-21 SZ } if(bd_char=='<'){ if(book_name==1){ biaodian_value=cc_biaodian[(biaodian_pos+10)*2] +cc_biaodian[(biaodian_pos+10)*2+1]*0x100; book_name_sub++; } else{ book_name=1; book_name_sub=0; } } if(bd_char=='>'){ if(book_name_sub){ biaodian_value=cc_biaodian[(biaodian_pos+10)*2] +cc_biaodian[(biaodian_pos+10)*2+1]*0x100; book_name_sub--; } else book_name=0; } return(TRUE); } /******************************************************* &4: if_zimu_or_not(): judge if the input is char or number return(TRUE): is char return(FALSE): is number ********************************************************/ BOOL if_zimu_or_not(x) BYTE x; { if (('A'<=x) && (x<='Z')) return(TRUE); if (('a'<=x) && (x<='z')) return(TRUE); return(FALSE); } /*************************************************** if_number_or_not(c) ****************************************************/ int WINAPI if_number_or_not(c) BYTE c; { if ((c<'0')||(c>'9')) return(STC); else return(CLC); } /*************************************************** if_bx_number(c) ****************************************************/ int WINAPI if_bx_number(c) BYTE c; { if ((c<'1')||(c>'8')) return(STC); else return(CLC); } /********************************************************* &3: out_result(result_type): output the change result. **********************************************************/ int WINAPI out_result(result_type) int result_type; { int i; if ((jiyi_mode==1)){ if (word_back_flag==0x99){ word_back_flag=2; return(call_czh(13));} else{ if (call_czh(12)==9){ step_mode=START; } else step_mode=SELECT; return(1); } } // if (jiyi) else{ if (result_area_pointer!=unit_length) if (msg_type!=2) if (in.info_flag!=1) new_no=result_area_pointer; if (biaodian_value!=0){ result_area[result_area_pointer++]=LOBYTE(biaodian_value); result_area[result_area_pointer++]=HIBYTE(biaodian_value); if (biaodian_len==4) { result_area[result_area_pointer++]=LOBYTE(biaodian_value); result_area[result_area_pointer++]=HIBYTE(biaodian_value); } } if (!(msg_type&2)){ if (result_area_pointer>0){ temp_rem_proc(); for (i=0; iwImeStyle == IME_APRS_FIX){ if (in.info_flag==BY_RECALL) { now.fmt_group=3; //5; now.fmt_start=26; now.fmt_ttl_len=54; word_back_flag=0x55; //back convert is not allowed. } else { now.fmt_group=(WORD)form[unit_length/2]; now.fmt_start=27; now.fmt_ttl_len=53; } } else { now.fmt_group = CANDPERPAGE ; if (in.info_flag==BY_RECALL) word_back_flag=0x55; } } ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// int WINAPI sent_back_msg() { if (new_no<=2) return(0); if (new_no>18) return(0); new_word(); return(0); } ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// int WINAPI if_jlxw_mode() { int x,i,j; WORD *out_svw_p; out_svw_p=(WORD *)out_svw; if (jlxw_mode==0) return(0); if (jlxw_mode<0){ if (sImeG.cp_ajust_flag==1) result_area_pointer=result_area_pointer-unit_length+2; x=0; } // if (jlxw) else{ if (sImeG.cp_ajust_flag==1){ x=result_area_pointer-unit_length; result_area[x++]=result_area[result_area_pointer-2]; result_area[x++]=result_area[result_area_pointer-1]; result_area_pointer=x; }// if (cp_ajust) x=unit_length-2; }// else jlxw_mode=0; word_back_flag=0xaa; if (unit_length<=2) return(0); j=0; x=x/2; //out_svw_p transmit by word; for (i=0; i=2)&&(biaodian_len==4)) c = c-2; } else //+1 logging_stack struck is c=result_area_pointer+1; // result_area_pointer plus // one byte counter CopyMemory/*memmove*/(&logging_stack[c],&logging_stack[0],(logging_stack_size-c)); logging_stack[0]=c-1; //length of storing string for (i=0; ifdwConversion&IME_CMODE_SYMBOL) if(GetBDValue(chr)){ unsigned char buffer[4]; int num = 2; buffer[0]=LOBYTE(biaodian_value); buffer[1]=HIBYTE(biaodian_value); if ((chr == '_')|| (chr == '^')) { buffer[2]=LOBYTE(biaodian_value); buffer[3]=HIBYTE(biaodian_value); num = 4 ; } send_msg(buffer,num); return(0); } if(glpIMC->fdwConversion&IME_CMODE_FULLSHAPE) cap_full((WORD)chr); else TypeOfOutMsg = ABC_OUT_ONE ; return(0); } int WINAPI send_one_char0(chr) int chr; { TypeOfOutMsg = ABC_OUT_ONE ; return (0); } /**********************************************************************/ /* SetResultToIMC() */ /* Return vlaue */ /* the number of candidates in the candidate list */ /**********************************************************************/ UINT WINAPI SetResultToIMC( HIMC ghIMC, LPSTR outBuffer, //soarce buffer (normal for out_svw) WORD outCount) //How many candidates are. { LPINPUTCONTEXT lpIMC; LPCANDIDATEINFO lpCandInfo; LPCANDIDATELIST lpCandList; LPPRIVCONTEXT lpImcP; LPCOMPOSITIONSTRING lpCompStr; WORD dwCompStrLen; WORD dwReadClauseLen; WORD dwReadStrLen; if (!ghIMC) return (0); // The IMC must be a valid one. lpIMC = (LPINPUTCONTEXT)ImmLockIMC(ghIMC); if(!lpIMC) return 0; if (!lpIMC->hCandInfo){ ImmUnlockIMC(ghIMC); return (0); } // The CandInfo must... lpCandInfo = (LPCANDIDATEINFO)ImmLockIMCC(lpIMC->hCandInfo); if (!lpCandInfo) { ImmUnlockIMC(ghIMC); return (0);} lpCandList = (LPCANDIDATELIST) ((LPBYTE)lpCandInfo + lpCandInfo->dwOffset[0]); lpCompStr = (LPCOMPOSITIONSTRING)ImmLockIMCC(lpIMC->hCompStr); if (!lpCompStr) { MessageBeep((UINT)-1); ImmUnlockIMCC(lpIMC->hCandInfo); ImmUnlockIMC(ghIMC); return (0); } dwCompStrLen = 0; dwReadClauseLen = 0; dwReadStrLen = 0; InitCompStr(lpCompStr); // the result reading clause = compsotion reading clause CopyMemory((LPSTR)lpCompStr + lpCompStr->dwResultReadClauseOffset, (LPSTR)lpCompStr + lpCompStr->dwCompReadClauseOffset, dwReadClauseLen); lpCompStr->dwResultReadClauseLen = dwReadClauseLen; *(LPSTR)((LPSTR)lpCompStr+lpCompStr->dwResultReadClauseOffset+dwReadClauseLen) = '\0'; // the result reading string = compsotion reading string CopyMemory((LPSTR)lpCompStr + lpCompStr->dwResultReadStrOffset, (LPSTR)lpCompStr + lpCompStr->dwCompReadStrOffset, dwReadStrLen); lpCompStr->dwResultReadStrLen = dwReadStrLen; *(LPSTR)((LPSTR)lpCompStr+lpCompStr->dwResultReadStrOffset+dwReadStrLen) = '\0'; // calculate result string length lpCompStr->dwResultStrLen = outCount; // the result string = outBuffer; CopyMemory((LPSTR)lpCompStr + lpCompStr->dwResultStrOffset, (LPSTR)outBuffer,outCount); *(LPSTR)((LPSTR)lpCompStr+lpCompStr->dwResultStrOffset+outCount) = '\0'; lpCompStr->dwResultClauseLen = 0; *(LPUNADWORD)((LPBYTE)lpCompStr + lpCompStr->dwResultClauseOffset + sizeof(DWORD)) = 0; lpImcP = (LPPRIVCONTEXT)ImmLockIMCC(lpIMC->hPrivate); // tell application, there is a reslut string lpImcP->fdwImeMsg |= MSG_COMPOSITION; lpImcP->dwCompChar = (DWORD)0; lpImcP->fdwGcsFlag |= GCS_COMPREAD|GCS_COMP|GCS_CURSORPOS| GCS_DELTASTART|GCS_RESULTREAD|GCS_RESULT; if(TypeOfOutMsg == ABC_OUT_ASCII) lpImcP->fdwGcsFlag &=(~GCS_RESULT); if (lpImcP->fdwImeMsg & MSG_ALREADY_OPEN) { lpImcP->fdwImeMsg = (lpImcP->fdwImeMsg | MSG_CLOSE_CANDIDATE) & ~(MSG_OPEN_CANDIDATE); } // no candidate now, the right candidate string already be finalized lpCandList->dwCount = 0; lpImcP->iImeState = CST_INIT; ImmUnlockIMCC(lpIMC->hPrivate); ImmUnlockIMCC(lpIMC->hCandInfo); ImmUnlockIMC(ghIMC); return (0) ; /* The real number of being moved */ } /********************************************************** FUNCTION: cap_full() PURPOES: if the full_switch on, and in the Caps status, change the English into Chinese mode ************************************************************/ void WINAPI cap_full(wParam) WORD wParam; { if (wParam==VK_BACK){ // send_one_char(VK_BACK); send_one_char0(VK_BACK); return; } if (wParam==VK_SPACE){ result_area[0]=0xa1; //94-8-6! result_area[1]=0xa1; //04-8-6! send_msg(result_area,2); return; } if (wParam== '~'){ result_area[0]=0xa1; //94-8-6! result_area[1]=0xab; //04-8-6! send_msg(result_area,2); return; } if (wParam=='$'){ result_area[0]=0xa1; //94-8-6! result_area[1]=0xe7; //04-8-6! send_msg(result_area,2); return; } if ((wParam>0x20) && (wParam<=0x7e)){ result_area[0]=0xa3; result_area[1]=((wParam-0x20)*0x100+0xa0a3)/0x100; send_msg(result_area,2); return; } send_one_char0(wParam); } /********************************************* read_kb() **********************************************/ int WINAPI read_kb() { return(0); } ///////////////////////////////////////////////////////////////////////// // BX_MODE // // Deel with pure bx input // ///////////////////////////////////////////////////////////////////////// extern WORD last_size; BX_MODE(input_char,wParam) WORD input_char; WPARAM wParam; { if (if_number_or_not((BYTE)input_char) &&(input_char!='9') &&(input_char!='0')){ if (step_mode==START||step_mode==RESELECT){ if (input_char >= 0x8000) //1993.4.19 return(STC); //when RESELECT use the mouse reselect result else { if (!bx_inpt_on) { cls_bx_disp(1); sent_back_msg(); } step_mode=ONINPUT; bx_inpt_on=1; }//else } //if (step_mode) }//if (if_number...) if (bx_inpt_on){ bx_proc(input_char,wParam); return(CLC); } return(STC); } /********************************************************************** FUNTION: bx_proc(WORD) PURPOSE: when the pure bx were inputed, find one chinese word corespond with it and eight related words with it. ***********************************************************************/ void WINAPI bx_proc(input_char,wParam) WORD input_char; WPARAM wParam; { int i; lib_p=(BYTE *)lib_w; //lib_p point to the lib_buffer switch (bx_analize(input_char,wParam)) { case BX_CHOICE: if (input_char>=0x8000){ current_no=(input_char - 0x8000-0x31)+disp_head; sImeG.InbxProc = 0; }else current_no=((INT)wParam - 0x31)+disp_head; if(current_no>=group_no){ MessageBeep(0); disp_help_and_result(); }else send_bx_result(); break; case BX_SELECT: word_select_bx(input_char); break; case ESC: cls_bx_disp(0); break; case OTHER: MessageBeep(0); disp_help_and_result(); break; case SPACE: send_bx_result(); break; case BXMA: if(!disp_help_and_result()){ if(in.true_length>1){ in.true_length--; MessageBeep(0); disp_help_and_result(); } } break; default: break; }//swith } /******************************************************************** word_select(wParam): select the word or turn to the next or up page *********************************************************************/ word_select_bx(input_char) int input_char; { int x; switch (input_char){ case VK_END*0x100: case VK_DOWN*0x100: case '=': //94/8/22 case ']': if (disp_tail>=group_no) MessageBeep(0); else{ if(input_char == VK_END*0x100 ){ disp_head = (group_no - 1)/now.fmt_group*now.fmt_group; disp_tail = disp_head;} fmt_transfer(); current_no=disp_tail; prompt_disp();} return(1); //means break the STD MODE case VK_HOME*0x100: case '-': //94/8/22 case '[': case VK_UP*0x100: if (disp_head==0) MessageBeep(0); else{ if(input_char == VK_HOME*0x100 ) disp_head = 0; else disp_head=disp_head-now.fmt_group; disp_tail=disp_head; fmt_transfer(); current_no=disp_tail; prompt_disp(); } return(1); default: return(1); //1993.1.15 cock } } /************************************************************************ FUNTION: bx_analize(WORD) PURPOSE: analize the input char. find out if it is pure bx *************************************************************************/ int WINAPI bx_analize(input_char,wParam) WORD input_char; WPARAM wParam; { if(input_char>=0x8000) return(BX_CHOICE); if (input_char == VK_UP*0x100) return(BX_SELECT); if (input_char == VK_DOWN*0x100) return(BX_SELECT); if (input_char == VK_HOME*0x100) return(BX_SELECT); if (input_char == VK_END*0x100) return(BX_SELECT); if (input_char == ']') return(BX_SELECT); if (input_char == '[') return(BX_SELECT); if (input_char == '-') return(SELECT); if (input_char == '=') return(SELECT); if (input_char==VK_ESCAPE) return(ESC); if (input_char==VK_SPACE) { in.info_flag=0x80; //standard end flag return(SPACE); } if (input_char==VK_RETURN) { in.info_flag=0x80; //standard end flag return(SPACE); } if (input_char==VK_BACK) { if (in.true_length==1) { input_char=VK_ESCAPE; //if it has inputed only one word return(ESC); } //cls the display in.true_length--; key_bx_code_long=in.true_length; return(BXMA); } if (!if_bx_number((BYTE)input_char)) { if( ((BYTE)wParam>'0') && ((BYTE)wParam <= CANDPERPAGE+0x30)) return (BX_CHOICE); in.info_flag=(BYTE)input_char; //rest key is put into the end_flag position return(OTHER); } if ((input_char>0x30)||(input_char<0x39)) { if (in.true_length>6) { in.info_flag=(BYTE)input_char; return(OTHER); } else { in.buffer[in.true_length++]=(BYTE)input_char; key_bx_code_long=in.true_length; return(BXMA); } } else{ in.info_flag=(BYTE)input_char; return(OTHER); } } /************************************************************************ FUCTION: disp_help_and_result() PURPOSE: seach the bx_table and display the tishi result ENTRY: bx string is in inpt_bx.bf RESULT: display the result and tishi information **************************************************************************/ int WINAPI disp_help_and_result() { int i, pass_flag; if (in.true_length==1) if (in.buffer[0]!=in_mem_part) //if this part of table is in memory load_one_part_bxtab(); for (i=0; i1){ //1993.3 disp_bx_result(); //1993.3 disp_bx_prompt(); } else //1993.3 send_bx_result(); } return 1; } /*********************************************************************** FUCTION: cmp_bx_word_exactly() PURPOSE: find the correct result position, and send the result into buffer. ENTRY: the input bx is in the key_bx_code buffer RESULT: CLC--- the input bx is matched with the current bx in the table the correct result is in the out_svw buffer STC--- not match the search_pointer points the position the next bx in the table. ************************************************************************/ int WINAPI cmp_bx_word_exactly() { BYTE x; int i; for (i=0;i<20;i++) result_area[i]= 0; conbine(); //get the bx from the bx_table result_area_pointer=0; if (key_bx_code_long==current_bx_code_long){ if (cmp_subr()){ group_no=0; search_pointer++; while (lib_p[search_pointer]>0xa0){ // result_area[result_area_pointer++]=group_no|0x40; // result_area[result_area_pointer++]=0x2e; result_area[result_area_pointer++]=lib_p[search_pointer++]; //save the "quma" result_area[result_area_pointer++]=lib_p[search_pointer++]; //save the "weima" // result_area[result_area_pointer++]=0x20; group_no++; //sum of chinese word }//while return(CLC); }//if (cmp_subr()) }//if(key_bx_code_long) search_pointer++; while (lib_p[search_pointer]>=0xa0) search_pointer+=2; //move the pointer to the beginning return(STC); //of the next bx in the table } /************************************************************************** FUCTION: cmp_bx_code2() PURPOSE: search the prompt information and get the chinese word which is related with the input. **************************************************************************/ int WINAPI cmp_bx_code2() { WORD x; conbine(); //get the bx from the bx_table if (key_bx_code_long==(current_bx_code_long-1)){ if (cmp_subr()){ bx_help_flag|=0x80; x=(lib_p[search_pointer++]&0x0f)-1; if (x>7) //if the bx overflow x=7; out_svw[x*2]=lib_p[search_pointer++]; //get the prompt bx out_svw[x*2+1]=lib_p[search_pointer++]; while (lib_p[search_pointer]>0xa0) search_pointer+=2; //move the pointer to the next string return(CLC); }//if (cmp_subr()) }//if (key_bx_code_long) search_pointer++; while (lib_p[search_pointer]>0xa0) search_pointer+=2; //move the pointer to the next string return(STC); } /************************************************************************ FUCTION: conbine() PURPOSE: get the bx from the table and change the high 4 bit into the position where the last bit of bx should put in and get this string of bx's length. *************************************************************************/ void WINAPI conbine() { int x; x=(lib_p[search_pointer]>>4)&0x0f; current_bx_code[x]=lib_p[search_pointer]&0x0f; current_bx_code_long=x+1; } /*********************************************************************** FUCTION: cmp_surb() PURPOSE: compare the input bx with the bx in the table ************************************************************************/ int WINAPI cmp_subr() { int i; for (i=0; it_bf_start,PTZ_LIB_LENGTH); // 读入词素码表 if (op_count!=PTZ_LIB_LENGTH) err_exit(ERR06); //"Read WINABC.OVL Wrong!"); _llseek((HFILE)hd, PD_START_POINTER, 0); //下推指针 op_count=_lread((HFILE)hd,(LPSTR)&pindu.pd_bf0,PD_LENGTH); //读入打印机词频度表 if (op_count!=PD_LENGTH) err_exit(ERR06); //("Read WINABC.OVL Wrong!"); _llseek(hd, SPBX_START_POINTER, 0); //下推指针 op_count=_lread(hd,(LPSTR)&spbx_tab,SPBX_LENGTH); // 读入基本笔形表 if (op_count!=SPBX_LENGTH) err_exit(ERR06); //("Read WINABC.OVL Wrong!"); _lclose((HFILE)hd); if (CheckAndCreate(tmmr_rem,user_lib)){ hd = OpenFile(tmmr_rem, &ofs, OF_READWRITE); //1993.4.15 if (hd==HFILE_ERROR) err_exit(ERR13); //(jiyi_wenjian_cuo); op_count=_lread(hd,(LPSTR)&tmmr,TMMR_REAL_LENGTH); if (op_count!=TMMR_REAL_LENGTH) err_exit(ERR06); //(jiyi_wenjian_cuo); _llseek(hd,TMMR_REAL_LENGTH,0); //move the pointer to the paremeter area op_count=_lread(hd,tmp_buffer, PAREMETER_LENGTH); //read the paremeters to the buffer if (!op_count) { //1993.4.15 if old tmmr.rem hasn't this ten parameters memset(tmp_buffer, 0 , PAREMETER_LENGTH); tmp_buffer[0] = (BYTE)IfTopMost; //transfer the peremeters tmp_buffer[1] = sImeG.auto_mode ; tmp_buffer[2] = bdd_flag; tmp_buffer[3] = sImeG.cbx_flag; op_count = _lwrite((HFILE)hd, rem_area, PAREMETER_LENGTH); //writer the file if (op_count!=PAREMETER_LENGTH) err_exit (ERR09); //(TMMR_WRITE_WRONG); }//if (!op_count) else { if (op_count!=PAREMETER_LENGTH) err_exit(ERR08); //(jiyi_wenjian_cuo); }//else _lclose(hd); IfTopMost = tmp_buffer[0]; //transfer the paremeter sImeG.auto_mode = tmp_buffer[1]; //1993.4 bdd_flag = tmp_buffer[2]; sImeG.cbx_flag = tmp_buffer[3]; hd = OpenFile(user_lib, &ofs, OF_READ); //1993.4.15 if (hd==-1) err_exit(ERR10); //(jiyi_wenjian_cuo); _llseek(hd,0xa000l,0); op_count=_lread(hd,(LPSTR)&kzk_ndx,NDX_REAL_LENGTH); if (op_count!=NDX_REAL_LENGTH) err_exit(ERR11); //(jiyi_wenjian_cuo); _lclose(hd); } } // //Popose: check user_word dictionary files "TMMR.REM" // "USER.REM" // If they are not exist, created. // int WINAPI CheckAndCreate(tmmr_rem,user_rem) BYTE *tmmr_rem,*user_rem; { struct INDEX user_file_head; struct M_NDX mulu_head={ 0, 0, //MULU_START_LOW 目录读写低字节 0x1800, //MULU_LENGTH_MAX SIZELIB+SIZELIB_KZK 目录最大长度=缓冲池的长度 0x10, //MULU_TRUE_LENGTH 10H 目录的实际长度,开始只有参数. 0xA, //MULU_RECORD_LENGTH 10 目录每条记录的长度。 0, //DATA_START_HI 0 整个用户文件限制在64K之内. 0x1800, //DATA_START_LOW DW SIZE LIB_W 目录区域和数据区互相衔接. 0x20}; //DATA_RECORD_LENGTH 32 每个记录的长度. OFSTRUCT ofs; int hd,i,count; HANDLE hMem; LPSTR rem_area,p; WORD *pp; char TMMR_OPEN_WRONG[]= ERR07; //"记忆文件打开错"; char TMMR_READ_WRONG[]= ERR08; //"记忆文件读错"; char TMMR_WRITE_WRONG[]=ERR09; // "记忆文件写错"; char USER_OPEN_WRONG[]= ERR10; //"用户词库打开错"; char USER_READ_WRONG[]= ERR11; //"用户词库读错"; char USER_WRITE_WRONG[]=ERR12; // "用户词库写错"; hMem=GlobalAlloc(GMEM_FIXED|GMEM_ZEROINIT ,TMMR_LIB_LENGTH ); if ( hMem == NULL ) return 0; rem_area=GlobalLock(hMem); hd = OpenFile(tmmr_rem, &ofs, OF_READ); if (hd!=-1){ count = _lread(hd, rem_area, TMMR_LIB_LENGTH); if ((rem_area[CHECK_POINT]=='T')&& (rem_area[CHECK_POINT+1]=='X') && (rem_area[CHECK_POINT+2]=='L') && (rem_area[CHECK_POINT+3]=='N')) _lclose(hd); else _lclose(hd),hd=-1; } // if (hd!=-1).... if (hd==-1){ hd = OpenFile(tmmr_rem, &ofs, OF_CREATE|OF_SHARE_DENY_NONE); if (hd==-1) err_exit(TMMR_OPEN_WRONG); else{ for (i = 0; ix=(WORD)newPoint.x; oldPoint->y=(WORD)newPoint.y; return 0; } /******************************************************* &3: cwp_proc(): ********************************************************/ int WINAPI cwp_proc(mtype) int mtype; { int i, j, m; BYTE x; switch (mtype){ case 0: return(normal()); //normal pinyin convert case 1: abbr(); //ABBR return(normal()); case 2: // "I" capital chinese number case 3: // "i" small chinese number if (in.true_length==1){ in.buffer[1]='1'; in.true_length++;} if (in.true_length>20) in.true_length=20; m=0; for(i=1; i=10) //10 1994.4 break; if (sb.flag==TRUE) break; }while(1); wp.yjs=i; input_msg_type(); return (0); } int WINAPI slbl(s_buffer) BYTE *s_buffer; { int i=0,j; BYTE cmp_buffer[5]={0}; char *p; BYTE x,attr,y; /* analize the SHENGMU */ x=s_buffer[i++]; attr=(BYTE)getattr(x,&x); // get char's attribute if (!attr){ sb.length=i-1; sb.flag=TRUE; return(1);} if (attr==NUMBER) return(0); // error if (x=='I' || x=='U' || x=='V') return(0); // error switch (attr) { //1993.4.22 case FIRST_T: case SECOND_T: case THIRD_T: case FORTH_T: return (0); //error } //1993.4.22 sb.value=0; sb.head=0; sb.length=0; sb.tune=0; sb.bx1=0; sb.bx2=0; sb.flag=FALSE; sb.head=x; if (attr==FUYIN){ if (x=='Z' || x=='C' || x=='S' ){ if ((s_buffer[i]&0xdf)==0x48){ for (j=0; j<15; j=j+5){ if (x==slbl_tab[j]){ sb.value=(WORD)slbl_tab[j+4]<<8; sb.head=slbl_tab[j+4]; break;} }// for() i++; }// if (s_buffer) else sb.value=(WORD)x<<8; }// if (x=='z') else sb.value=(WORD)x<<8; }//if (attr==FUYIN) else{ i--; sb.value=0; } //else /* analize the YUNMU */ x=s_buffer[i]; attr=(BYTE)getattr(x,&x); if (!attr){ sb.length=(WORD)i; sb.flag=TRUE; return(1);} if (attr==YUANYIN){ //if no YUANYIN, goto step3 (BYTE)sb.value=x; cmp_buffer[0]=x; i++; for (j=1; j<4; j++){ x=s_buffer[i++]; attr=(BYTE)getattr(x,&x); if (!attr){ for (j=j; j<4; j++) cmp_buffer[j]='0'; i--; sb.flag=TRUE; break;} if (attr==NUMBER){ for (j=j; j<4; j++) cmp_buffer[j]='0'; i--; break; }// if else cmp_buffer[j]=x; }//for for (j=3; j>0; j--){ p=(LPSTR)ABCstrstr((LPSTR)slbl_tab,cmp_buffer); //search the YUNMU if (p!=NULL){ (BYTE)sb.value=*(p+4); //get the YUNMU value break; }// if (p) if (cmp_buffer[j]!=0x30){ cmp_buffer[j]='0'; i--;}//if (cmp) }// for(j) }//if (x!=YUANYIN) else (BYTE)sb.value=0; /* see if the next is YUANYIN */ x=s_buffer[i]; attr=(BYTE)getattr(x,&x); if (!attr){ sb.length=(WORD)i; sb.flag=TRUE; if (sb.value<=0xff) sb.value=sb.value<<8; return(1);} if (attr==YUANYIN){ y=s_buffer[i-1]&0xdf; if (y=='R'||y=='N'||y=='G'){ i--; (BYTE)sb.value=0; for (j=3; j>0; j--){ if (cmp_buffer[j]!=0x30){ cmp_buffer[j]='0'; break;}//if }//for for (j=3; j>0; j--){ p=(LPSTR)ABCstrstr((LPSTR)slbl_tab,cmp_buffer); //search the YUNMU if (p!=NULL){ (BYTE)sb.value=*(p+4); //get the YUNMU value break; }// if (p) if (cmp_buffer[j]!=0x30){ cmp_buffer[j]='0'; i--;}//if (cmp) }// for(j) if (!(BYTE)sb.value) (BYTE)sb.value=cmp_buffer[0]; }//if (y=='R') }//if (attr==YUANYIN) if (sb.value<=0xff) sb.value=sb.value<<8; /* analize the tune */ x=s_buffer[i]; attr=(BYTE)getattr(x,&x); if (!attr){ sb.length=(WORD)i; sb.flag=TRUE; return(1);} if (attr==FIRST_T||attr==SECOND_T||attr==THIRD_T||attr==FORTH_T){ sb.tune=attr; i++;} /* analize the BIXING */ for (j=0; j<6; j++){ x=s_buffer[i++]; attr=(BYTE)getattr(x,&x); if (!attr){ sb.flag=TRUE; sb.length=i-1; return(1);} if (attr==SEPERATOR){ sb.flag=FALSE; sb.length=(WORD)i; return(1); // if the string has seperator, move the } // pointer to the beginning of next YINJIE if (attr!=NUMBER){ do{ //1993.4.22 if (attr==YUANYIN || attr==FUYIN){ sb.flag=FALSE; sb.length=i-1; return(1);} x=s_buffer[i++]; attr=(BYTE)getattr(x,&x); if (!attr){ sb.flag=TRUE; sb.length=i-1; return(1);} }while(i<100); return (1); } //1993.4.22 if (x>'0' && x<'9'){ switch(j){ case 0: sb.bx1=x<<4; break; case 1: sb.bx1+=x&0x0f; break; case 2: sb.bx2=(WORD)x; sb.bx2<<=12; break; case 3: sb.bx2=sb.bx2+(WORD)((x&0xf)<<8); break; case 4: (BYTE)sb.bx2=x<<4; break; case 5: (BYTE)sb.bx2+=x&0x0f; break; }//switch }//if(x) }// for do{ x=s_buffer[i++]; attr=(BYTE)getattr(x,&x); if (!attr){ sb.flag=TRUE; sb.length=i-1; return(1);} if (attr==YUANYIN || attr==FUYIN){ sb.flag=FALSE; sb.length=(WORD)i; return(1);} }while(i<100); return (0); } /******************************************************* getchr(x) *******************************************************/ int WINAPI getattr(x,p) BYTE x; char *p; { if (x==0) return(FALSE); if (if_number_or_not(x)) return(NUMBER); if (if_zimu_or_not(x)){ x=x&0xdf; *p=x; if (x=='A'||x=='E'||x=='I'||x=='O'||x=='U'||x=='V') return(YUANYIN); else return(FUYIN); } if (x==SEPERATOR) return(SEPERATOR); switch(x){ case '-': return(FIRST_T); case '/': return(SECOND_T); case '~': case '^': return(THIRD_T); case '\\': return(FORTH_T); } return (FALSE); } /******************************************************* neg_slbl() ********************************************************/ int WINAPI neg_slbl(value) WORD value; { int i=0; BYTE x; s_tune(); x=HIBYTE(value); if (x>=0x41) neg.buffer[i++]=x; else{ if (x!=0) i=neg_sc(i,x); } x=LOBYTE(value); if (x>=0x41) neg.buffer[i++]=x; else{ if (x!=0) i=neg_sc(i,x); } neg.buffer[i]=sb.tune; neg.length=i; for (x=0; x9) //? word_long=9; //? if (by_cchar_flag==1) word_long=1; if (word_long==1) return(pre_nt_w1(wp.xsyjw)); for (j=word_long; j>1; j--){ word_long=j; prepare_search1(); abbr_s1(); if (group_no){ unit_length=j*2; return(CLC); }// if () }// for() return(pre_nt_w1(wp.xsyjw)); } /********************************************* copy_input() **********************************************/ int WINAPI copy_input() { int i=0, j=0; if (in.info_flag==VK_MULTIPLY) //if "*" return(0); kbf.true_length=in.true_length; if (in.buffer[0]==SEPERATOR){ kbf.true_length=in.true_length-1; i=1; }// if ((in.buffer) for (i=i; it_bf1[i]) get_the_one(i); else{ if (cmp_state&4){ if (cmp_head==HIBYTE(cisu->t_bf1[i])) get_the_one(i); else if ( cmp_head==fu_sm(HIBYTE(cisu->t_bf1[i])) ) get_the_one(i); }// if (cmp_state) }//else }//for() return(0); } /******************************************************* sc_gbdy() *******************************************************/ int WINAPI sc_gbdy() { int cnt,i; cnt=cisu->t_bf_start[2]/2; for (i=0; it_bf2[i]) get_the_one2(i); else{ if (cmp_state&4){ if (cmp_head==HIBYTE(cisu->t_bf2[i])) get_the_one2(i); else { if (cmp_head==fu_sm(HIBYTE(cisu->t_bf2[i]))) get_the_one2(i);} }// if (cmp_state) }//else }//for() return(0); } /******************************************************** get_the_one() *********************************************************/ int WINAPI get_the_one(i) int i; { BYTE x; WORD *out_svw_p=(WORD *)out_svw; BYTE *msx_p=(BYTE *)msx_area; if (cmp_bx1(i)!=0) return(0); out_svw_p[out_svw_cnt]=i+0x2020; if (i>=(55-16+1)*94) x=0x20; else x=pindu.pd_bf1[i]; if (cmp_state&0x80){ if (x<=(154+50)){ return(0); }// if (x) }// if (cmp_state) msx_p[out_svw_cnt]=x; out_svw_cnt++; return(0); } /*********************************************************** cmp_bx1() ************************************************************/ int WINAPI cmp_bx1(i) int i; { BYTE x; if (cmp_bx==0) return(0); x=spbx_tab[i]; if (x==cmp_bx) return(0); x=x&0xf0; if (x==cmp_bx) return(0); return(1); } /******************************************************** get_the_one2() *********************************************************/ int WINAPI get_the_one2(i) int i; { BYTE x; WORD *out_svw_p=(WORD *)out_svw; BYTE *msx_p=(BYTE *)msx_area; if (cmp_bx2(i)!=0) return(0); out_svw_p[out_svw_cnt]=i+0x8000; if ((i/2)>=pindu.pd_bf0[2]) x=0x20; else x=pindu.pd_bf2[i/2]; if (cmp_state&0x80){ if (x<=(154+50)){ return(0); }// if (x) }// if (cmp_state) msx_p[out_svw_cnt]=x; out_svw_cnt++; return(0); } /*********************************************************** cmp_bx2() ************************************************************/ int WINAPI cmp_bx2(i) int i; { BYTE x; WORD y; if (cmp_bx==0) return(0); i++; y=cisu->t_bf2[i]; y=((BYTE)y-0xb0)*94+(HIBYTE(y)-0xa1); x=spbx_tab[y]; if (x==cmp_bx) return(0); x=x&0xf0; if (x==cmp_bx) return(0); return(1); } /*********************************************************** paidui() ************************************************************/ int WINAPI paidui(cnt) int cnt; { int i,j,n,flag; BYTE x1,y1; WORD x,y; WORD *out_p; BYTE *msx_p=(BYTE *)msx_area; out_p=(WORD *)out_svw; if (cnt<=1) return(0); for (n=cnt-1; n>0; n--){ flag=0; for (i=0; iout_p[i+1]){ x=out_p[i]; out_p[i]=out_p[i+1]; out_p[i+1]=x; flag++; }//if (out_p) }// if (msx_p) else{ if (msx_p[i]0xa000 || x<0x2020) return(x); if (x>=0x8000){ x=(x-0x8000)+1; return(cisu->t_bf2[x]); } return((x-0x2020)/94+0xb0+((x-0x2020)%94+0xa1)*0x100); } /************************************************* prepare_search1() **************************************************/ int WINAPI prepare_search1() { BYTE f_ci1,f_ci2,x; f_ci1=wp.syj[wp.xsyjw]; f_ci2=wp.syj[wp.xsyjw+1]; f_ci1=(BYTE)fu_sm(f_ci1); f_ci2=(BYTE)fu_sm(f_ci2); if(f_ci1<0x41) f_ci1=0x41; if (word_long>=5) f_ci2=(BYTE)word_long; search_and_read(f_ci1,f_ci2); // // After reading, counting the search place is needed // First, count the STD dictionary buffers // search_start=6; search_end=6; if (word_lib_state&1){ x=word_long-2; if (x>=3){ x-=3; search_start+=4;} if (x>0) { if (sizeof lib_w=3){ x-=3; kzk_search_start+=4;} if (x>0) { if (sizeof kzk_lib_w9) return(STC); else if (HIBYTE(last_item_name)>9) return(STC); else return(CLC); return(STC); } /******************************************************** count_basic_pera(): count the sub_library address; count the page address; count the read_write length; ********************************************************/ int WINAPI count_basic_pera(f_ci1,f_ci2) BYTE f_ci1,f_ci2; { BYTE x; word_lib_state=0; item_addr=0xffff; item_length=0; (BYTE)last_item_name=f_ci2; last_item_name=last_item_name*0x100+f_ci1; if (f_ci1>'I'&& f_ci1<'U') slib_addr=(f_ci1-0x41-1)*27; else if (f_ci1>'V') slib_addr=(f_ci1-0x41-3)*27; else slib_addr=(f_ci1-0x41)*27; r_addr=ndx.dir[slib_addr+1]; r_addr+=ndx.body_start; r_addr=r_addr*16; if (f_ci2<'A') item_addr=slib_addr+MORE_THAN_5; else if (f_ci2>'I' && f_ci2<'U') item_addr=slib_addr+(f_ci2-0x41-1); else if (f_ci2>'V') item_addr=slib_addr+(f_ci2-0x41-3); else item_addr=slib_addr+(f_ci2-0x41); r_addr=r_addr+ndx.dir[item_addr+1+1]; item_length=ndx.dir[item_addr+1+1+1]; item_length-=ndx.dir[item_addr+1+1]; return(0); } /*********************************************************** read_kzk_lib(): search the expended lib ************************************************************/ int WINAPI read_kzk_lib() { r_addr=kzk_ndx.dir[slib_addr+1]; r_addr+=kzk_ndx.body_start; r_addr=r_addr*16+KZK_BASE; r_addr=r_addr+kzk_ndx.dir[item_addr+1+1]; kzk_item_length=kzk_ndx.dir[item_addr+1+1+1]; item_length-=kzk_ndx.dir[item_addr+1+1]; if (kzk_item_length<0) kzk_item_length=0; if (!kzk_item_length) return(STC); if (!read_a_page(1,r_addr,kzk_item_length)) return(STC); word_lib_state|=2; return(CLC); } /////////////////////////////////////////////////////////////////////////// // 读词库 READ_A_PAGE() // // 功能: 把需要的词库页调入指定的缓冲区 // // 入口: START_PS 读词库的起始位置 // // FILE_FLAG =0 读标准库 // // =1 扩展库 // // SIZE 所读页长(字节数) // // 出口: TRUE 成功 // // FALSE 失败 // // 注意:程序中要判断SIZE的大小是否越界,以防止不测. // // 如果越界,则按照缓冲区的大小截短. // /////////////////////////////////////////////////////////////////////////// int WINAPI read_a_page(file_flag, start_ps, size) BYTE file_flag; LONG start_ps; WORD size; { // 94/4/16 HANDLE hd; int hd = -1; if ((last_flag==file_flag)&&(last_start_ps==start_ps)&&(last_size==size)) return(1); //本次读写和赏赐完全相同,不用再做读盘操作; if (file_flag==0) { if (size> sizeof lib_w) size=sizeof lib_w; hd=OpenFile(std_dct,&openbuf,OF_READ); if (hd == -1) return(0); _llseek(hd,start_ps,0); if(_lread(hd,(LPSTR)lib_w,size)<=0) { _lclose(hd); return(0); } } if (file_flag==1) { hd=OpenFile(user_lib,&openbuf_kzk,OF_READ); if (hd == -1) return(0); if (size>sizeof kzk_lib_w) size=sizeof kzk_lib_w; //判断缓冲区是否越界完成 _llseek(hd,start_ps,0); if(_lread(hd,(LPSTR)kzk_lib_w,size)<=0) { _lclose(hd); return(0); } } if ( hd != -1 ) _lclose(hd); last_flag=file_flag; last_start_ps=start_ps; // 保存读参数 last_size=size; return(1); } /********************************************************************** Name: abbr_s1() Popurse: Find match words arrcoding to the given input message. Search order is: Temp_rem area Standard Dictionary User Dictionary If there are more than one words, judge what is the suitable one. **********************************************************************/ int WINAPI abbr_s1() { group_no=0; msx_area_cnt=0; out_svw_cnt=0; find_new_word(); // Search temp rem_area abbr_entry((BYTE *)kzk_lib_w+kzk_search_start,(BYTE *)kzk_lib_w+kzk_search_end,4); // Search User dic. abbr_entry((BYTE *)lib_w+search_start, (BYTE *)lib_w+search_end,0); // Search stndard dic. if (!group_no) return(STC); // Without any results... if (group_no==1) return(CLC); // Only one! order_result2(); // Results more than one... if (sImeG.auto_mode) find_multy_hi(); // If in frenquency ajust mode... return(CLC); // Return OK. } /******************************************************** find_new_word() *********************************************************/ void WINAPI find_new_word() { fczs1((LPSTR)tmmr.temp_rem_area,sizeof tmmr.temp_rem_area,2); fczs1((LPSTR)tmmr.rem_area,sizeof tmmr.rem_area,0x82); } /***************************************************** fczs1() ******************************************************/ int WINAPI fczs1(rem_p,end,area_flag) BYTE *rem_p; //92-12-18 SZ int end,area_flag; { int i=0,w_long,j; WORD *p; w_long=word_long*2; while(i18||(rem_p[i]&1)){ p=(WORD *)&rem_p[i]; for (j=0; j<(end-i)/2; j++){ //94.2.3 ZHU (end-i)/2 if (p[j]!=0) p[j]=0; else return(0); }// for }//if (rem_p) i+=rem_p[i]+2; }//while return (0); } /************************************************ find_long_word2() *************************************************/ int WINAPI find_long_word2(buffer) BYTE *buffer; { int yj_p,i; yj_p=wp.xsyjw; for (i=0; i=sizeof out_svw){ group_no--; return(STC); }// if (out_svw_cnt) for (i=0;i=0x8000){ if ((cmp_cisu-0x8000)>=cisu->t_bf_start[2]/2) return(STC);} else{ if ((cmp_cisu-0x2020)>=cisu->t_bf_start[1]/2) return(STC);} if (!cmp_a_slbl()) return(STC); if (!cmp_bx) return(CLC); if (!yjbx()) return(STC); return(CLC); } /******************************************* cmp_a_slbl() ********************************************/ int WINAPI cmp_a_slbl() { if (cmp_state&2) { if (cmp_cisu>=0x8000){ if (cmp_yj==cisu->t_bf2[cmp_cisu-0x8000]) return(CLC); else return(STC); //?? return(cmp_first_letter()); } //if (cmp_cisu... else{ if (cmp_yj==cisu->t_bf1[cmp_cisu-0x2020]) return(CLC); else return(STC); }//else }// if (cmp_state... return(cmp_first_letter()); } /************************************************ cmp_first_letter() *************************************************/ int WINAPI cmp_first_letter() { WORD py_nm; if (!(cmp_state&4)) //NOte!!! return(STC); py_nm=(WORD)cisu_to_py(); if ((HIBYTE(py_nm)&0x5f)==cmp_head) return(CLC); else{ py_nm=(WORD)get_head(HIBYTE(py_nm)); if ((LOBYTE(py_nm)&0xdf)==cmp_head) return(CLC); else return(STC); } } /*********************************************** cisu_to_py() ************************************************/ int WINAPI cisu_to_py() { if (cmp_cisu>=0x8000) return(cisu->t_bf2[(cmp_cisu-0x8000)]); else return(cisu->t_bf1[(cmp_cisu-0x2020)]); } /************************************************** get_head() ***************************************************/ int WINAPI get_head(first_letter) BYTE first_letter; { if (first_letter>=0x41) return(first_letter); first_letter=(first_letter-1)*5; return(slbl_tab[first_letter]); } /****************************************************** yjbx() *******************************************************/ int WINAPI yjbx() { BYTE bx; WORD pos; if (cmp_cisu<0x8000) pos = cmp_cisu-0x2020; else{ pos =cisu->t_bf2[(cmp_cisu-0x8000)+1]; pos =(HIBYTE(pos)-0xa1)+(LOBYTE(pos)-0xb0)*94; } if (pos>= 94*94) return (STC); bx=spbx_tab[pos]; if (cmp_bx==bx) return(CLC); else if (cmp_bx==(bx&0xf0)) return(CLC); else return(STC); } /**************************************************** abbr_entry() *****************************************************/ int WINAPI abbr_entry(s_start,s_end,ComeFrom) BYTE *s_start,*s_end,ComeFrom; //Search start and Ending { // position int i; while (s_start=sizeof out_svw) // If buffer out_svw // is full, sorry... return(STC); for (i=0; i0; i--){ flag=0; for (j=0; j=3) return(0); save_xsyjw=(WORD)wp.xsyjw; wp.xsyjw=wp.xsyjs; i=0; do{ x=sfx_table[i]; if (HIBYTE(x)&sfx_attr) if (LOBYTE(x)==word_long*2) if (cmp_long_word2(&sfx_p[i*2+2])){ for (j=0; jx) i+=x+1; else{ if (x>20) //if more than 10 chinese words? break; if ((i+x)>=logging_stack_size) break; //if the last word is not completely if (find_long_word3((WORD *)&logging_stack[i+1],(int)(x/2))){ trs_new_word3(x,i); group_no++; if (group_no>5) break; } i+=x+1; }//else }while(i=word_long){ err_flg=0; for (i=0; i=4)&&(unit_length<=18)) //rem word limited if(msx_area[current_no].from==2) { // If a rem word? x=msx_area[current_no].addr/2; //get word addr in temp... if (x=0x300) { count=(sizeof tmmr.rem_area) -(unit_length+2); // Push down middle rem area CopyMemory(&tmmr.rem_area[(unit_length+2)/2], tmmr.rem_area, count); for(i=0; i30) return(STC); return(CLC); } int WINAPI UpdateProc() { UpdateFlag=1; ExeCmdLine[ParaPos]='7'; WinExec(ExeCmdLine,SW_SHOW); return(0); } /*********************************************** rem_pd1() ************************************************/ int WINAPI rem_pd1(buffer) WORD *buffer; { WORD temp; temp=buffer[0]; if (wp.bx_stack[wp.xsyjs]) temp|=0x4000; else if (wp.cmp_stack[wp.xsyjs]==4) return(0); push_down_stack1(); tmmr.stack1[0]=temp; return(0); } /********************************************** push_down_stack1() ***********************************************/ int WINAPI push_down_stack1() { int i; i=(sizeof tmmr.stack1-2); CopyMemory/*memmove*/((BYTE *)&tmmr.stack1[1],(BYTE *)&tmmr.stack1[0],i); stack1_move_counter++; if (stack1_move_counter>=4) writefile(tmmr_rem, 0l, (LPSTR)&tmmr.stack1, sizeof tmmr.stack1); return(0); } /*********************************************** rem_pd2() ************************************************/ void WINAPI rem_pd2(buffer) WORD *buffer; { WORD temp1,temp2; int i; temp1=buffer[0], temp2=buffer[1]; if (wp.cmp_stack[wp.xsyjs]!=2) temp1|=0x4000; if (wp.cmp_stack[wp.xsyjs+1]!=2) temp2|=0x4000; i=(sizeof tmmr.stack2-4-4); CopyMemory/*memmove*/((BYTE *)&tmmr.stack2[2],(BYTE *)&tmmr.stack2[0],i); tmmr.stack2[0]=temp1; tmmr.stack2[1]=temp2; writefile(tmmr_rem, (LONG)sizeof tmmr.stack1, (LPSTR)&tmmr.stack2, sizeof tmmr.stack2); } /*********************************************** rem_pd3() ************************************************/ void WINAPI rem_pd3(buffer) WORD *buffer; { int i; i=(sizeof tmmr.stack3-6); CopyMemory/*memmove*/((BYTE *)&tmmr.stack3[3],(BYTE *)&tmmr.stack3[0],i); for (i=0; i<3; i++) tmmr.stack3[i]=buffer[i]; writefile(tmmr_rem, (LONG)(sizeof tmmr.stack1+sizeof tmmr.stack2), (LPSTR)&tmmr.stack3, sizeof tmmr.stack3); } //this module is come from ABCWIN.EXE BOOL CALLBACK ImeAboutDlgProc(hDlg, message, wParam, lParam) HWND hDlg; /* window handle of the dialog box */ UINT message; /* type of message */ WPARAM wParam; /* message-specific information */ LPARAM lParam; { RECT rc; LONG DlgWidth, DlgHeight; switch (message) { case WM_INITDIALOG: /* message: initialize dialog box */ hCrtDlg = hDlg; CenterWindow(hDlg); return (TRUE); // don't want to set focus to special control case WM_CLOSE: EndDialog(hDlg, TRUE); return (TRUE); case WM_PAINT: { RECT Rect; HDC hDC; PAINTSTRUCT ps; GetClientRect(hDlg, &Rect); //get the whole window area InvalidateRect(hDlg, &Rect, 1); hDC=BeginPaint(hDlg, &ps); // FillRect(hDC, &Rect, GetStockObject(LTGRAY_BRUSH)); //paint the whole area Rect.left+=10;//5; Rect.top+=8;//5; Rect.right-=10;//5; Rect.bottom-=40;//5; DrawEdge(hDC, &Rect, EDGE_RAISED,/*EDGE_SUNKEN,*/ BF_RECT); //FrameRect(hDC, &Rect, GetStockObject(WHITE_BRUSH)); //draw the frame EndPaint(hDlg, &ps); break; } case WM_COMMAND: switch (wParam) { case IDOK: EndDialog(hDlg, FALSE); break; case IDCANCEL: EndDialog(hDlg, FALSE); break; default: return (FALSE); break; } return (TRUE); } return (FALSE); /* Didn't process a message */ } int CommandProc(WPARAM wParam,HWND hWnd) { lpImeL->TempUIWnd = hWnd; switch(wParam){ case IDM_SKL1: case IDM_SKL2: case IDM_SKL3: case IDM_SKL4: case IDM_SKL5: case IDM_SKL6: case IDM_SKL7: case IDM_SKL8: case IDM_SKL9: case IDM_SKL10: case IDM_SKL11: case IDM_SKL12: case IDM_SKL13: { HIMC hIMC; LPINPUTCONTEXT lpIMC; LPPRIVCONTEXT lpImcP; DWORD fdwConversion; hIMC =(HIMC)GetWindowLongPtr(GetWindow(hWnd,GW_OWNER),IMMGWLP_IMC); lpIMC = (LPINPUTCONTEXT)ImmLockIMC(hIMC); if (!lpIMC) { return (0L); } lpImcP = (LPPRIVCONTEXT)ImmLockIMCC(lpIMC->hPrivate); if (!lpImcP) { return (0L); } { UINT i; lpImeL->dwSKWant = LOWORD(wParam) - IDM_SKL1; lpImeL->dwSKState[lpImeL->dwSKWant] = lpImeL->dwSKState[lpImeL->dwSKWant]^1; // clear other SK State for(i=0; idwSKWant) continue; lpImeL->dwSKState[i] = 0; } if(lpImeL->dwSKState[lpImeL->dwSKWant]) { if(LOWORD(wParam) == IDM_SKL1) lpImcP->iImeState = CST_INIT; else lpImcP->iImeState = CST_SOFTKB; fdwConversion = lpIMC->fdwConversion | IME_CMODE_SOFTKBD; } else { lpImcP->iImeState = CST_INIT; fdwConversion = lpIMC->fdwConversion & ~(IME_CMODE_SOFTKBD); } } ImmSetConversionStatus(hIMC, (fdwConversion & ~(IME_CMODE_SOFTKBD)), lpIMC->fdwSentence); ImmSetConversionStatus(hIMC, fdwConversion, lpIMC->fdwSentence); ImmUnlockIMCC(lpIMC->hPrivate); ImmUnlockIMC(hIMC); break; } case SC_METHOD0: break; case SC_METHOD9: DoPropertySheet(GetActiveWindow(),hWnd); ReInitIme( hWnd , lpImeL->wImeStyle ); break; case SC_METHOD4: WinExec("ABCWM.exe", SW_SHOW); break; case SC_METHOD6: return 0; // 4.20 94 case SC_METHOD7: WinHelp(hWnd,"winabc.hlp", HELP_FINDER ,0l); return 0; case SC_METHOD8: MessageBeep(0); return 0; case SC_METHOD10: { HIMC hIMC; LPINPUTCONTEXT lpIMC; HWND hUIWnd; hUIWnd = GetWindow(hWnd, GW_OWNER); if (!hUIWnd) { return (0L); } hIMC = (HIMC)GetWindowLongPtr(hUIWnd, IMMGWLP_IMC); if (!hIMC) { return (0L); } lpIMC = (LPINPUTCONTEXT)ImmLockIMC(hIMC); if (!lpIMC) { return (0L); } DialogBox(hInst,"wfc", lpIMC->hWnd, OpenDlg); ImmUnlockIMC(hIMC); break; } case SC_METHODA: return(0); case SC_ABOUT: { HIMC hIMC; LPINPUTCONTEXT lpIMC; HWND hUIWnd; hUIWnd = GetWindow(hWnd, GW_OWNER); if (!hUIWnd) { return (0L); } hIMC = (HIMC)GetWindowLongPtr(hUIWnd, IMMGWLP_IMC); if (!hIMC) { return (0L); } lpIMC = (LPINPUTCONTEXT)ImmLockIMC(hIMC); if (!lpIMC) { return (0L); } DialogBox(hInst, "ABOUT",lpIMC->hWnd,(DLGPROC)ImeAboutDlgProc); ImmUnlockIMC(hIMC); break; } default: break; } return 0; }