1 /* # skkinput (Simple Kana-Kanji Input)
2 *
3 * This file is part of skkinput.
4 * Copyright (C) 2002
5 * Takashi SAKAMOTO (PXG01715@nifty.ne.jp)
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
10 * any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with skkinput; see the file COPYING. If not, write to
19 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
20 */
21 #include "local.h"
22 #include <stdio.h>
23 #include <assert.h>
24 #include "lmachinep.h"
25
26 /*
27 * (string-to-char-list STRING)
28 *
29 * `poem-e20 3' �ˤ���ؿ��餷����
30 * STRING ��ʸ�������ǤȤ���ꥹ�Ȥ��֤���STRING �� sequence �Ǥ��롣
31 */
32 TLMRESULT
lispMachineState_StringToCharList(register TLispMachine * pLM)33 lispMachineState_StringToCharList (
34 register TLispMachine* pLM)
35 {
36 TLispEntity* pSequence ;
37 TLispEntity* pRetval ;
38 TLispEntity* pArglist ;
39
40 lispMachineCode_GetLReg (pLM, LM_LREG_ACC, &pArglist) ;
41 lispEntity_GetCar (pLM->m_pLispMgr, pArglist, &pSequence) ;
42 if (TFAILED (lispMgr_StringToCharList (pLM->m_pLispMgr, pSequence, &pRetval))) {
43 lispMachineCode_SetError (pLM) ;
44 return LMR_RETURN ;
45 }
46 lispMachineCode_SetLReg (pLM, LM_LREG_ACC, pRetval) ;
47 return LMR_RETURN ;
48 }
49
50 TLMRESULT
lispMachineState_EventToCharacter(register TLispMachine * pLM)51 lispMachineState_EventToCharacter (
52 register TLispMachine* pLM)
53 {
54 register TLispManager* pLispMgr = pLM->m_pLispMgr ;
55 TLispEntity* pEntArglist ;
56 TLispEntity* pEntEvent ;
57 long lValue ;
58 TLispEntity* pEntRetval ;
59
60 lispMachineCode_GetLReg (pLM, LM_LREG_ACC, &pEntArglist) ;
61 if (TFAILED (lispEntity_GetCar (pLispMgr, pEntArglist, &pEntEvent)) ||
62 TFAILED (lispEntity_GetIntegerValue (pLispMgr, pEntEvent, &lValue))) {
63 lispMgr_CreateNil (pLispMgr, &pEntRetval) ;
64 } else {
65 if (TFAILED (lispMgr_CreateInteger (pLispMgr, lValue, &pEntRetval)))
66 return LMR_ERROR ;
67 }
68 lispMachineCode_SetLReg (pLM, LM_LREG_ACC, pEntRetval) ;
69 return LMR_RETURN ;
70 }
71
72 TLMRESULT
lispMachineState_CharacterToEvent(register TLispMachine * pLM)73 lispMachineState_CharacterToEvent (
74 register TLispMachine* pLM)
75 {
76 register TLispManager* pLispMgr = pLM->m_pLispMgr ;
77 TLispEntity* pEntArglist ;
78 TLispEntity* pEntEvent ;
79
80 /* �����ࡢ�פ��Ĥ��ʤ��Τǡ����Τޤޡ��ܵ��� XEvent ���ᤷ�Ƥ⤤����...*/
81 lispMachineCode_GetLReg (pLM, LM_LREG_ACC, &pEntArglist) ;
82 if (TFAILED (lispEntity_GetCar (pLispMgr, pEntArglist, &pEntEvent))) {
83 lispMachineCode_SetError (pLM) ;
84 } else {
85 lispMachineCode_SetLReg (pLM, LM_LREG_ACC, pEntEvent) ;
86 }
87 return LMR_RETURN ;
88 }
89
90