Tomotaka SUWA
t-suw****@users*****
2007年 8月 17日 (金) 21:57:12 JST
Index: AquaSKK/SKK.h diff -u AquaSKK/SKK.h:1.1.2.1 AquaSKK/SKK.h:removed --- AquaSKK/SKK.h:1.1.2.1 Sat Feb 3 16:53:29 2007 +++ AquaSKK/SKK.h Fri Aug 17 21:57:12 2007 @@ -1,32 +0,0 @@ -/* -*- C++ -*- - $Id: SKK.h,v 1.1.2.1 2007/02/03 07:53:29 t-suwa Exp $ - - MacOS X implementation of the SKK input method. - - Copyright (C) 2007 Tomotaka SUWA <t.suw****@mac*****> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef INC__SKK__ -#define INC__SKK__ - -namespace SKK { - enum InputMode { - Hirakana, Katakana, Jisx0201Kana, Jisx0208Latin, Ascii - }; -} - -#endif Index: AquaSKK/SKKBackEnd.cpp diff -u AquaSKK/SKKBackEnd.cpp:1.1.2.1 AquaSKK/SKKBackEnd.cpp:removed --- AquaSKK/SKKBackEnd.cpp:1.1.2.1 Sat Feb 3 16:53:29 2007 +++ AquaSKK/SKKBackEnd.cpp Fri Aug 17 21:57:12 2007 @@ -1,79 +0,0 @@ -/* -*- C++ -*- - $Id: SKKBackEnd.cpp,v 1.1.2.1 2007/02/03 07:53:29 t-suwa Exp $ - - MacOS X implementation of the SKK input method. - - Copyright (C) 2007 Tomotaka SUWA <t.suw****@mac*****> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include <sstream> -#include <algorithm> - -#include "SKKBackEnd.h" -#include "CppCFData.h" -#include "CppCFString.h" -#include "ServerConnection.h" -#include "ServerConnectionFactory.h" -#include "BIMClientServer.h" - -// è£å® -bool SKKBackEnd::Complete(const std::string& entry, std::vector<std::string>& result) { - CppCFString query(entry.c_str(), kCFStringEncodingUTF8); - CppCFData data; - data.own(query.toCFData()); - - ServerConnection connection = ServerConnectionFactory::theInstance().newConnection(); - CppCFString str(connection.send(kSKKFetchCompletions, data, kAquaSKKServerRunLoopMode).getData()); - - std::string tmp = str.toStdString(kCFStringEncodingUTF8); - std::replace(tmp.begin(), tmp.end(), (char)SKK_MSG_DELIMITER, ' '); - std::stringstream buf(tmp); - - result.clear(); - while(buf >> tmp) { - result.push_back(tmp); - } - - return !result.empty(); -} - -// æ¤ç´¢ -bool SKKBackEnd::FindOkuriAri(const std::string& entry, std::vector<std::string>& result) { - return true; -} - -bool SKKBackEnd::FindOkuriNasi(const std::string& entry, std::vector<std::string>& result) { - return true; -} - -// ç»é² -bool SKKBackEnd::RegisterOkuriAri(const std::string& entry, const std::string& candidate, const std::string& okuri) { - return true; -} - -bool SKKBackEnd::RegisterOkuriNasi(const std::string& entry, const std::string& candidate) { - return true; -} - -// åé¤ -bool SKKBackEnd::RemoveOkuriAri(const std::string& entry, const std::string& candidate) { - return true; -} - -bool SKKBackEnd::RemoveOkuriNasi(const std::string& entry, const std::string& candidate) { - return true; -} Index: AquaSKK/SKKBackEnd.h diff -u AquaSKK/SKKBackEnd.h:1.1.2.1 AquaSKK/SKKBackEnd.h:removed --- AquaSKK/SKKBackEnd.h:1.1.2.1 Sat Feb 3 16:53:29 2007 +++ AquaSKK/SKKBackEnd.h Fri Aug 17 21:57:12 2007 @@ -1,48 +0,0 @@ -/* -*- C++ -*- - $Id: SKKBackEnd.h,v 1.1.2.1 2007/02/03 07:53:29 t-suwa Exp $ - - MacOS X implementation of the SKK input method. - - Copyright (C) 2007 Tomotaka SUWA <t.suw****@mac*****> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef INC__SKKBackEnd__ -#define INC__SKKBackEnd__ - -#include <string> -#include <vector> - -// è¾æ¸é¢é£ã®æä½ -class SKKBackEnd { -public: - // è£å® - bool Complete(const std::string& entry, std::vector<std::string>& result); - - // æ¤ç´¢ - bool FindOkuriAri(const std::string& entry, std::vector<std::string>& result); - bool FindOkuriNasi(const std::string& entry, std::vector<std::string>& result); - - // ç»é² - bool RegisterOkuriAri(const std::string& entry, const std::string& candidate, const std::string& okuri); - bool RegisterOkuriNasi(const std::string& entry, const std::string& candidate); - - // åé¤ - bool RemoveOkuriAri(const std::string& entry, const std::string& candidate); - bool RemoveOkuriNasi(const std::string& entry, const std::string& candidate); -}; - -#endif Index: AquaSKK/SKKContext.h diff -u AquaSKK/SKKContext.h:1.1.2.1 AquaSKK/SKKContext.h:removed --- AquaSKK/SKKContext.h:1.1.2.1 Sat Feb 3 16:53:29 2007 +++ AquaSKK/SKKContext.h Fri Aug 17 21:57:12 2007 @@ -1,66 +0,0 @@ -/* -*- C++ -*- - $Id: SKKContext.h,v 1.1.2.1 2007/02/03 07:53:29 t-suwa Exp $ - - MacOS X implementation of the SKK input method. - - Copyright (C) 2007 Tomotaka SUWA <t.suw****@mac*****> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef INC__SKKContext__ -#define INC__SKKContext__ - -#include <string> -#include <vector> -#include "utf8iterator.h" - -// å ¥åã³ã³ããã¹ã -struct SKKContext { - std::string prompt; // ããã³ãã - std::string input; // å ¥åãããã¡ - std::string fixed; // 確å®æ¸ãããã¡ - std::string display; // 表示ç¨ãããã¡ - int caret_position; // ãã£ã¬ããã®ä½ç½® - - SKKContext() {} - SKKContext(const std::string& entry) : prompt(entry) {} - - bool pop(bool for_fixed) { - if(!input.empty()) { - input.erase(input.end() - 1); - return true; - } else { - if(for_fixed) { - if(!fixed.empty()) { - utf8iterator iter(fixed); - fixed.erase(iter.last()); - return true; - } - } - } - - return false; - } - - void clear() { - input.clear(); - fixed.clear(); - display.clear(); - caret_position = 0; - } -}; - -#endif Index: AquaSKK/SKKConverter.cpp diff -u AquaSKK/SKKConverter.cpp:1.1.2.1 AquaSKK/SKKConverter.cpp:removed --- AquaSKK/SKKConverter.cpp:1.1.2.1 Sat Feb 3 16:53:29 2007 +++ AquaSKK/SKKConverter.cpp Fri Aug 17 21:57:12 2007 @@ -1,195 +0,0 @@ -/* -*- C++ -*- - $Id: SKKConverter.cpp,v 1.1.2.1 2007/02/03 07:53:29 t-suwa Exp $ - - MacOS X implementation of the SKK input method. - - Copyright (C) 2007 Tomotaka SUWA <t.suw****@mac*****> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include <iostream> -#include <fstream> -#include <sstream> -#include "jconv.h" -#include "SKKConverter.h" - -// ====================================================================== -// ã¦ã¼ãã£ãªã㣠-// ====================================================================== - -void unescape_string(std::string& str) { - static struct { - std::string from; - const char* to; - } escape[] = { - { ",", "," }, - { "&space;", " " }, - { "♯", "#" }, - { "", 0x00 }, - }; - - for(int i = 0; escape[i].to != 0x00; ++ i) { - std::string& target = escape[i].from; - for(unsigned pos = str.find(target); pos != std::string::npos; pos = str.find(target)) { - str.replace(pos, target.length(), escape[i].to); - } - } -} - -// ====================================================================== -// ã¯ã©ã¹ã¤ã³ã¿ãã§ã¼ã¹ -// ====================================================================== - -SKKConverter::SKKConverter() { -} - -SKKConverter& SKKConverter::theInstance() { - static SKKConverter obj; - return obj; -} - -void SKKConverter::Initialize(const std::string& path) { - std::ifstream rule_list(path.c_str()); - std::string str; - - if(!rule_list) { - std::cerr << "SKKConverter::Initialize(): can't open file [" << path << "]" << std::endl; - return; - } - - // ã¯ãªã¢ - root_ = Node(); - - while(std::getline(rule_list, str)) { - if(str.empty() || str[0] == '#') continue; - - // EUC-JP â UTF-8 å¤æ - std::string utf8; - jconv::convert_eucj_to_utf8(str, utf8); - - // å ¨ã¦ã® ',' ã空ç½ã«ç½®æãã¦å解ãã - std::replace(utf8.begin(), utf8.end(), ',', ' '); - std::stringstream buf(utf8); - - // å¤æã«ã¼ã«ãèªã - Node rule; - if(buf >> rule.label >> rule.hirakana >> rule.katakana >> rule.jisx0201kana) { - // ãªãã·ã§ã³ã®æ¬¡ç¶æ ãèªã - buf >> rule.next; - - // ã¨ã¹ã±ã¼ãæåãå ã«æ»ã - unescape_string(rule.label); - unescape_string(rule.hirakana); - unescape_string(rule.katakana); - unescape_string(rule.jisx0201kana); - unescape_string(rule.next); - - Node* current = &root_; - unsigned depth; - - // ç¯ã辿ã(ãªããã°ä½ã) - for(depth = 0; depth < rule.label.size() - 1; ++ depth) { - if(!current->match(rule.label[depth], current)) { - current = current->add(rule.label.substr(depth, 1)); - } - } - - // èã追å - rule.label = rule.label[depth]; - current->add(rule); - } else { - // ä¸æ£ãªå½¢å¼ - std::cerr << "SKKConverter::Initialize(): invalid rule [" << utf8 << "]" << std::endl; - } - } -} - -SKKConverter::trace SKKConverter::traverse(Node& node, std::string& str, Node*& leaf, unsigned depth) { - // [1] ãã¼ã¿ä¸è¶³(ex. "k" ã "ch" ãªã©) - if(depth == str.size()) { - return SHORT; - } - - // è¦ã¤ãã£ãï¼ - if(node.match(str[depth], leaf)) { - // ã¾ã 辿ãããªãå帰ãã - if(leaf->has_child()) { - return traverse(*leaf, str, leaf, depth + 1); - } - - // [2] å®å ¨ä¸è´ - str = str.substr(depth + 1); - return MATCH; - } - - // [3] é¨åä¸è´(ex. "kb" ã "chm" ãªã©) - if(depth > 0) { - // ä¸è´ããé¨åãåãåã - str = str.substr(depth); - - // ç¯ãã¤èã§ããããnãã®ãããªå ´åã«ã¯ãä¸è´ã¨ãã¦æ±ã - if(!leaf->empty()) { - return MATCH; - } - - return RESTART; - } - - // [4] å ¨ãä¸è´ããªãã£ãã®ã§ãã·ãããã - return SHIFT; -} - -std::string SKKConverter::Execute(SKK::InputMode mode, const std::string& str, std::string& next) { - std::string in(str); - std::string out; - Node* leaf; - - while(!in.empty()) { - switch(traverse(root_, in, leaf)) { - case SHORT: // çãã - next = in; - break; - case MATCH: // ä¸è´ - next = leaf->next; - switch(mode) { - case SKK::Hirakana: - out += leaf->hirakana; - break; - case SKK::Katakana: - out += leaf->katakana; - break; - case SKK::Jisx0201Kana: - out += leaf->jisx0201kana; - break; - default: - std::cerr << "SKKConverter::Execute(): invalid mode [" << mode << "]" << std::endl; - break; - } - continue; - case RESTART: // ããç´ã - continue; - case SHIFT: // ã·ãã - out += in[0]; - in = in.substr(1); - continue; - } - - // SHORT ã®å ´åã¯æãã - break; - } - - return out; -} Index: AquaSKK/SKKConverter.h diff -u AquaSKK/SKKConverter.h:1.1.2.1 AquaSKK/SKKConverter.h:removed --- AquaSKK/SKKConverter.h:1.1.2.1 Sat Feb 3 16:53:29 2007 +++ AquaSKK/SKKConverter.h Fri Aug 17 21:57:12 2007 @@ -1,84 +0,0 @@ -/* -*- C++ -*- - $Id: SKKConverter.h,v 1.1.2.1 2007/02/03 07:53:29 t-suwa Exp $ - - MacOS X implementation of the SKK input method. - - Copyright (C) 2007 Tomotaka SUWA <t.suw****@mac*****> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef INC__SKKConverter__ -#define INC__SKKConverter__ - -#include <string> -#include <vector> -#include "SKK.h" - -class SKKConverter { - struct Node { - std::string label; - std::string hirakana; - std::string katakana; - std::string jisx0201kana; - std::string next; - std::vector<Node> childs; - - Node(const std::string& node = "") : label(node), hirakana(""), katakana(""), jisx0201kana(""), next("") {} - - Node* add(const Node& leaf) { - childs.push_back(leaf); - return &childs.back(); - } - - bool match(char ch, Node*& leaf) { - for(unsigned i = 0; i < childs.size(); ++ i) { - if(ch == childs[i].label[0]) { - leaf = &childs[i]; - return true; - } - } - - return false; - } - - bool has_child() const { - return !childs.empty(); - } - - bool empty() const { - return hirakana.empty() && katakana.empty() && jisx0201kana.empty(); - } - }; - - Node root_; - - enum trace { - SHORT, MATCH, RESTART, SHIFT - }; - - trace traverse(Node& node, std::string& in, Node*& leaf, unsigned depth = 0); - - SKKConverter(); - SKKConverter(const SKKConverter&); - -public: - static SKKConverter& theInstance(); - void Initialize(const std::string& path); - bool Execute(SKK::InputMode mode, const std::string& in, std::string& out, std::string& next); - std::string Execute(SKK::InputMode mode, const std::string& in, std::string& next); -}; - -#endif Index: AquaSKK/SKKEngine.h diff -u AquaSKK/SKKEngine.h:1.1.2.1 AquaSKK/SKKEngine.h:removed --- AquaSKK/SKKEngine.h:1.1.2.1 Sat Feb 3 16:53:29 2007 +++ AquaSKK/SKKEngine.h Fri Aug 17 21:57:12 2007 @@ -1,89 +0,0 @@ -/* -*- C++ -*- - $Id: SKKEngine.h,v 1.1.2.1 2007/02/03 07:53:29 t-suwa Exp $ - - MacOS X implementation of the SKK input method. - - Copyright (C) 2007 Tomotaka SUWA <t.suw****@mac*****> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef INC__SKKEngine__ -#define INC__SKKEngine__ - -#include "SKKEnvironment.h" - -template <class StateContainer> -struct DebugInvoker { - typedef typename StateContainer::Handler Handler; - typedef typename StateContainer::Event Event; - typedef typename StateContainer::State State; - - StateContainer& instance_; - -public: - DebugInvoker(StateContainer& obj) : instance_(obj) {} - - State operator()(const Handler handler, const Event& event) { - assert(handler != 0 && "Invalid handler address."); - -#define DEFINE_State(arg) { &SKKEnvironment::arg, #arg } - const static struct { - Handler handler; - const char* name; - } states[] = { - DEFINE_State(KanaInput), - DEFINE_State(Hirakana), - DEFINE_State(Katakana), - DEFINE_State(Jisx0201Kana), - DEFINE_State(LatinInput), - DEFINE_State(Ascii), - DEFINE_State(Jisx0208Latin), - DEFINE_State(PreConversion), - DEFINE_State(EntryInput), - DEFINE_State(Japanese), - DEFINE_State(Abbreviation), - DEFINE_State(EntryCompletion), - DEFINE_State(SelectCandidate), - DEFINE_State(Inline), - DEFINE_State(Window), - DEFINE_State(EntryRemove), - { 0, 0x00 } - }; -#undef DEFINE_State(arg) - - static char* system_event[] = { "<<EXIT>>", "<<INIT>>", "<<ENTRY>>" }; - - if(event != 0) { - for(int i = 0; states[i].handler != 0; ++ i) { - if(handler == states[i].handler) { - std::cerr << "SKKEnvironment::" << states[i].name << ": "; - if(event < 0) { - std::cerr << system_event[event + 3] << std::endl; - } else { - std::cerr << event.Param().dump() << std::endl; - } - break; - } - } - } - return (instance_.*handler)(event); - } -}; - -//typedef GenericStateMachine<SKKEnvironment> SKKEngine; -typedef GenericStateMachine<SKKEnvironment, DebugInvoker> SKKEngine; - -#endif Index: AquaSKK/SKKEnvironment.cpp diff -u AquaSKK/SKKEnvironment.cpp:1.1.2.1 AquaSKK/SKKEnvironment.cpp:removed --- AquaSKK/SKKEnvironment.cpp:1.1.2.1 Sat Feb 3 16:53:29 2007 +++ AquaSKK/SKKEnvironment.cpp Fri Aug 17 21:57:12 2007 @@ -1,754 +0,0 @@ -/* -*- C++ -*- - $Id: SKKEnvironment.cpp,v 1.1.2.1 2007/02/03 07:53:29 t-suwa Exp $ - - MacOS X implementation of the SKK input method. - - Copyright (C) 2007 Tomotaka SUWA <t.suw****@mac*****> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include <iostream> -#include "SKKConfig.h" -#include "SKKEnvironment.h" - -typedef SKKEnvironment::Event Event; -typedef SKKEnvironment::State State; - -// ====================================================================== -// ã¦ã¼ãã£ãªã㣠-// ====================================================================== -bool forKanaInput(const Event& event) { - const SKKEventParam& param = event.Param(); - - return - param.IsDirect() || - param.IsUpperCases() || - param.IsSwitchToAscii() || - param.IsSwitchToJisx0208Latin() || - param.IsEnterJapanese() || - param.IsEnterAbbrev(); -} - -// ====================================================================== -// ã³ã³ã¹ãã©ã¯ã¿ -// ====================================================================== -SKKEnvironment::SKKEnvironment() : converter_(SKKConverter::theInstance()) {} - -// ====================================================================== -// ã³ã³ããã¹ãæä½é¢é£ -// ====================================================================== -SKKContext& SKKEnvironment::topContext() { - if(stack_.empty()) { - return top_; - } - return stack_.back(); -} - -void SKKEnvironment::pushContext() { - stack_.push_back(topContext().display); -} - -void SKKEnvironment::commitContext() { - if(!stack_.empty()) { - std::string fixed = topContext().fixed; - rollbackContext(); - topContext().fixed += fixed; - } -} - -void SKKEnvironment::rollbackContext() { - if(!stack_.empty()) { - stack_.pop_back(); - } -} - -// ====================================================================== -// ãããã¡æä½é¢é£ -// ====================================================================== -void SKKEnvironment::push(unsigned char ch, bool entry) { - std::string& input = topContext().input; - std::string& out = topContext().fixed; - std::string next; - - serial_.update(); - - input += ch; - - do { - if(mode_ == SKK::Ascii) { - out += input; - input = next; - break; - } - - if(mode_ == SKK::Jisx0208Latin) { - out = input; // XXX å¤æãå¿ è¦ - input = next; - break; - } - - // ãã¼ãåããªå¤æ - if(entry) { - out += converter_.Execute(mode_, input, next); - } else { - out = converter_.Execute(mode_, input, next); - } - - input = next; - } while(0); - - std::cerr << "input=" << input << ", fixed=" << out << std::endl; -} - -void SKKEnvironment::pop(bool for_fixed) { - if(topContext().pop(for_fixed)) { - serial_.update(); - std::cerr << "input=" << topContext().input << ", fixed=" << topContext().fixed << std::endl; - } -} - -void SKKEnvironment::clear() { - topContext().clear(); -} - -// ====================================================================== -// level 1ï¼ããªå ¥å -// ====================================================================== -State SKKEnvironment::KanaInput(const Event& event) { - switch(event) { - case ENTRY_EVENT: - // ã¹ã¿ãã¯ã調ã¹ã¦ããã³ãããèª¿æ´ - return 0; - case INIT_EVENT: - return State::ShallowHistory(&SKKEnvironment::Hirakana); - case EXIT_EVENT: - return State::SaveHistory(); - case SKK_ENTER: - // ã¹ã¿ãã¯ãããï¼ - if(!stack_.empty()) { - // ãããã¡ãããï¼ - if(0) { - // ã¹ã¿ãã¯ãããããã - } - return State::DeepHistory(&SKKEnvironment::SelectCandidate); - } - return 0; - case SKK_LEFT: - case SKK_RIGHT: - case SKK_UP: - case SKK_DOWN: - // ã¹ã¿ãã¯ãããï¼ - if(!stack_.empty()) { - // 移å - } else { - // ç¢ºå® - } - return 0; - case SKK_BACKSPACE: - pop(); - return 0; - case SKK_CANCEL: - // ã¹ã¿ãã¯ãããã°ããããã - if(!stack_.empty()) { - return State::DeepHistory(&SKKEnvironment::SelectCandidate); - } - return 0; - case SKK_ASCII: - return State::Transition(&SKKEnvironment::Ascii); - case SKK_JISX0208LATIN: - return State::Transition(&SKKEnvironment::Jisx0208Latin); - case SKK_CHAR: - do { - const SKKEventParam& param = event.Param(); - - // ãã®ã¾ã¾å ¥å - if(param.IsDirect()) { - return 0; - } - - if(param.IsSwitchToAscii()) { - push(param.code); - if(topContext().input[0] == param.code) { - return State::Transition(&SKKEnvironment::Ascii); - } - } - - if(param.IsSwitchToJisx0208Latin()) { - push(param.code); - if(topContext().input[0] == param.code) { - return State::Transition(&SKKEnvironment::Jisx0208Latin); - } - } - - if(param.IsUpperCases()) { - topContext().fixed.clear(); // XXX å¾®å¦ãªåé¡ - compose_push(std::tolower(param.code)); - // æåãä¿åããâ - return State::Transition(&SKKEnvironment::Japanese); - } - - if(param.IsEnterJapanese()) { // Shift-Q - return State::Transition(&SKKEnvironment::Japanese); - } - - if(param.IsEnterAbbrev()) { // '/' - push(param.code); - if(topContext().fixed[0] == param.code) { - return State::Transition(&SKKEnvironment::Abbreviation); - } - } - } while(0); - } - - return State::Super(&SKKEnvironment::TopState); -} - -// ====================================================================== -// level 2 of KanaInputï¼ã²ãã㪠-// ====================================================================== -State SKKEnvironment::Hirakana(const Event& event) { - switch(event) { - case ENTRY_EVENT: - serial_.update(); - clear(); - mode_ = SKK::Hirakana; - return 0; - case SKK_KATAKANA: - return State::Transition(&SKKEnvironment::Katakana); - case SKK_JISX0201KANA: - return State::Transition(&SKKEnvironment::Jisx0201Kana); - case SKK_CHAR: - // ä¸ä½ã®ã¤ãã³ããï¼ - if(forKanaInput(event)) { - break; - } - - do { - const SKKEventParam& param = event.Param(); - - if(param.IsToggleKana()) { - return State::Transition(&SKKEnvironment::Katakana); - } - - if(param.IsToggleJisx0201Kana()) { - return State::Transition(&SKKEnvironment::Jisx0201Kana); - } - - // æåå ¥å - push(param.code); - - return 0; - } while(0); - } - - return State::Super(&SKKEnvironment::KanaInput); -} - -// ====================================================================== -// level 2 of KanaInputï¼ã«ã¿ã«ã -// ====================================================================== -State SKKEnvironment::Katakana(const Event& event) { - switch(event) { - case ENTRY_EVENT: - serial_.update(); - clear(); - mode_ = SKK::Katakana; - return 0; - case SKK_HIRAKANA: - return State::Transition(&SKKEnvironment::Hirakana); - case SKK_JISX0201KANA: - return State::Transition(&SKKEnvironment::Jisx0201Kana); - case SKK_CHAR: - // ä¸ä½ã®ã¤ãã³ããï¼ - if(forKanaInput(event)) { - break; - } - - do { - const SKKEventParam& param = event.Param(); - - if(param.IsToggleKana()) { - return State::Transition(&SKKEnvironment::Hirakana); - } - - if(param.IsToggleJisx0201Kana()) { - return State::Transition(&SKKEnvironment::Jisx0201Kana); - } - - // æåå ¥å - push(param.code); - - return 0; - } while(0); - } - - return State::Super(&SKKEnvironment::KanaInput); -} - -// ====================================================================== -// level 2 of KanaInputï¼åè§ã«ã¿ã«ã -// ====================================================================== -State SKKEnvironment::Jisx0201Kana(const Event& event) { - switch(event) { - case ENTRY_EVENT: - serial_.update(); - clear(); - mode_ = SKK::Jisx0201Kana; - return 0; - case SKK_HIRAKANA: - return State::Transition(&SKKEnvironment::Hirakana); - case SKK_CHAR: - // ä¸ä½ã®ã¤ãã³ããï¼ - if(forKanaInput(event)) { - break; - } - - do { - const SKKEventParam& param = event.Param(); - - if(param.IsToggleKana() || param.IsToggleJisx0201Kana()) { - return State::Transition(&SKKEnvironment::Hirakana); - } - - // æåå ¥å - push(param.code); - - return 0; - } while(0); - } - - return State::Super(&SKKEnvironment::KanaInput); -} - -// ====================================================================== -// level 1ï¼Latin å ¥å -// ====================================================================== -State SKKEnvironment::LatinInput(const Event& event) { - switch(event) { - case SKK_JMODE: - case SKK_HIRAKANA: - return State::Transition(&SKKEnvironment::Hirakana); - } - - return State::Super(&SKKEnvironment::TopState); -} - -// ====================================================================== -// level 2 of LatinInputï¼ASCII -// ====================================================================== -State SKKEnvironment::Ascii(const Event& event) { - switch(event) { - case ENTRY_EVENT: - serial_.update(); - clear(); - mode_ = SKK::Ascii; - return 0; - } - - return State::Super(&SKKEnvironment::LatinInput); -} - -// ====================================================================== -// level 2 of LatinInputï¼å ¨è§è±æ° -// ====================================================================== -State SKKEnvironment::Jisx0208Latin(const Event& event) { - switch(event) { - case ENTRY_EVENT: - serial_.update(); - clear(); - mode_ = SKK::Jisx0208Latin; - return 0; - case SKK_CHAR: - do { - const SKKEventParam& param = event.Param(); - - if(param.IsDirect()) { - // ç¡å¤æ - return 0; - } - - // æåå ¥å - push(param.code); - - return 0; - } while(0); - } - - return State::Super(&SKKEnvironment::LatinInput); -} - -// ====================================================================== -// level 1ï¼å¤æå -// ====================================================================== -State SKKEnvironment::PreConversion(const Event& event) { - switch(event) { - case ENTRY_EVENT: - serial_.update(); - return 0; - case SKK_ENTER: - // æ¹è¡ãããã©ããâ - case SKK_JMODE: - // ãã®ã¾ã¾ç¢ºå® - return State::Transition(&SKKEnvironment::KanaInput); - case SKK_LEFT: - case SKK_RIGHT: - case SKK_UP: - case SKK_DOWN: - // ç¡è¦ - return 0; - case SKK_CANCEL: - // ãã£ã³ã»ã« - return State::Transition(&SKKEnvironment::KanaInput); - case SKK_TAB: - // è£å®ã¢ã¼ã - completions_.clear(); - if(backend_.Complete(topContext().fixed, completions_)) { - return State::Transition(&SKKEnvironment::EntryCompletion); - } - break; - case SKK_BACKSPACE: - serial_.update(); - - // æååé¤ - compose_pop(); - - // ãããã¡ã空ã«ãªã£ãï¼ - if(compose_empty()) { - return State::Transition(&SKKEnvironment::KanaInput); - } - return 0; - case SKK_CHAR: - do { - const SKKEventParam& param = event.Param(); - - if(param.IsNextCandidate()) { - // å¤æ - return State::Transition(&SKKEnvironment::SelectCandidate); - } - } while(0); - } - - return State::Super(&SKKEnvironment::TopState); -} - -// ====================================================================== -// level 2 of PreConversionï¼è¦åºãèªå ¥å -// ====================================================================== -State SKKEnvironment::EntryInput(const Event& event) { - switch(event) { - case ENTRY_EVENT: - serial_.update(); - return 0; - case EXIT_EVENT: - return State::SaveHistory(); - case SKK_PASTE: - // ãã¼ã¹ã - serial_.update(); - return 0; - } - - return State::Super(&SKKEnvironment::PreConversion); -} - -// ====================================================================== -// level 3 of EntryInputï¼æ¥æ¬èª -// ====================================================================== -State SKKEnvironment::Japanese(const Event& event) { - switch(event) { - case ENTRY_EVENT: - serial_.update(); - return 0; - case SKK_CHAR: - do { - const SKKEventParam& param = event.Param(); - - if(param.IsNextCandidate()) { - // å¤æã¯ä¸ä½ã§ - break; - } - if(param.IsDirect()) { - // å¤æãªãå ¥å - return 0; - } - if(param.IsSwitchToAscii()) { - // ç¢ºå® - return State::Transition(&SKKEnvironment::Ascii); - } - if(param.IsSwitchToJisx0208Latin()) { - // ç¢ºå® - return State::Transition(&SKKEnvironment::Jisx0208Latin); - } - if(param.IsToggleKana()) { - // ãã°ã«å¤æ - return State::Transition(&SKKEnvironment::KanaInput); - } - if(param.IsEnterJapanese()) { - // 確å®ãã¦ãèªå·±é·ç§» - return State::Transition(&SKKEnvironment::Japanese); - } - if(param.IsUpperCases()) { - // ãéãããã - return 0; - } - - // å¤æããå ¥å - compose_push(param.code); - - return 0; - } while(0); - } - - return State::Super(&SKKEnvironment::EntryInput); -} - -// ====================================================================== -// level 3 of EntryInputï¼çç¥è¡¨è¨ -// ====================================================================== -State SKKEnvironment::Abbreviation(const Event& event) { - switch(event) { - case ENTRY_EVENT: - serial_.update(); - clear(); - mode_ = SKK::Ascii; - break; - case SKK_CHAR: - do { - const SKKEventParam& param = event.Param(); - - if(param.IsNextCandidate()) { - // å¤æã¯ä¸ä½ã§ - break; - } - - if(param.IsToggleJisx0201Kana()) { - // ãã°ã«å¤æ - return 0; - } - - // æåå ¥å - compose_push(param.code); - - return 0; - } while(0); - } - - return State::Super(&SKKEnvironment::EntryInput); -} - -// ====================================================================== -// level 2 of PreConversionï¼è¦åºãèªè£å® -// ====================================================================== -State SKKEnvironment::EntryCompletion(const Event& event) { - switch(event) { - case ENTRY_EVENT: - serial_.update(); - // æåã®åè£ã表示ãã - std::cerr << "completion=" << completions_.item() << std::endl; - return 0; - case SKK_TAB: - // 次ã®åè£ - serial_.update(); - std::cerr << "completion=" << completions_.next().item() << std::endl; - return 0; - case SKK_CHAR: - do { - const SKKEventParam& param = event.Param(); - - if(param.IsNextCandidate()) { - // å¤æã¯ä¸ä½ã§ - break; - } - - serial_.update(); - - if(param.IsNextCompletion()) { - // 次ã®åè£ - std::cerr << "completion=" << completions_.next().item() << std::endl; - return 0; - } - if(param.IsPrevCompletion()) { - // åã®åè£ - std::cerr << "completion=" << completions_.prev().item() << std::endl; - return 0; - } - - // è£å®ãã¼ä»¥å¤ãªãæãã - return State::DeepForward(&SKKEnvironment::EntryInput); - } while(0); - } - - return State::Super(&SKKEnvironment::PreConversion); -} - -// ====================================================================== -// level 1ï¼åè£é¸æ -// ====================================================================== -State SKKEnvironment::SelectCandidate(const Event& event) { - switch(event) { - case ENTRY_EVENT: - serial_.update(); - // æ¤ç´¢ - return 0; - case INIT_EVENT: - return State::Initial(&SKKEnvironment::Inline); - case EXIT_EVENT: - return State::SaveHistory(); - case SKK_ENTER: - // æ¹è¡ãããâ - case SKK_JMODE: - // ç¾å¨ã®åè£ã§ç¢ºå® - commitContext(); - // ã¹ã¿ãã¯ãããã - return State::Transition(&SKKEnvironment::KanaInput); - case SKK_CANCEL: - // ãã£ã³ã»ã«ããã - return State::DeepHistory(&SKKEnvironment::EntryInput); - case SKK_CHAR: - // ç¾å¨ã®åè£ã§ç¢ºå® - // ã¹ã¿ãã¯ãããã - commitContext(); - // ã¤ãã³ãã転é - return State::Forward(&SKKEnvironment::KanaInput); - } - - return State::Super(&SKKEnvironment::TopState); -} - -// ====================================================================== -// level 2 of SelectCandidateï¼ã¤ã³ã©ã¤ã³è¡¨ç¤º -// ====================================================================== -State SKKEnvironment::Inline(const Event& event) { - switch(event) { - case ENTRY_EVENT: - serial_.update(); - // 次ã®åè£ããªãï¼ - if(0) { - // ã¹ã¿ãã¯ãããã·ã¥ - pushContext(); - return State::Transition(&SKKEnvironment::Hirakana); - } - // åè£ã表示 - return 0; - case SKK_BACKSPACE: - // 確å®ãã¦ä¸æååé¤ - commitContext(); - return State::Transition(&SKKEnvironment::Hirakana); - case SKK_CHAR: - do { - const SKKEventParam& param = event.Param(); - - if(param.IsNextCandidate()) { - // ã¤ã³ã¯ãªã¡ã³ãã n åè£ä»¥ä¸ï¼ - if(0) { - return State::Transition(&SKKEnvironment::Window); - } - return State::Transition(&SKKEnvironment::Inline); - } - - if(param.IsPrevCandidate()) { - // ãã¯ãªã¡ã³ã - return State::Transition(&SKKEnvironment::Inline); - } - - if(param.IsRemoveTrigger()) { - return State::Transition(&SKKEnvironment::EntryRemove); - } - } while(0); - } - - return State::Super(&SKKEnvironment::SelectCandidate); -} - -// ====================================================================== -// level 2 of SelectCandidateï¼ã¦ã£ã³ãã¦è¡¨ç¤º -// ====================================================================== -State SKKEnvironment::Window(const Event& event) { - switch(event) { - case ENTRY_EVENT: - serial_.update(); - // 次ã®åè£ããªãï¼ - if(0) { - // ã¹ã¿ãã¯ãããã·ã¥ - pushContext(); - return State::Transition(&SKKEnvironment::Hirakana); - } - // åè£ã表示 - return 0; - case SKK_BACKSPACE: - // ãã¯ãªã¡ã³ãã n åè£æªæºï¼ - if(0) { - return State::Transition(&SKKEnvironment::Inline); - } - return State::Transition(&SKKEnvironment::Window); - case SKK_CHAR: - do { - const SKKEventParam& param = event.Param(); - - if(param.IsNextCandidate()) { - // ã¤ã³ã¯ãªã¡ã³ã - return State::Transition(&SKKEnvironment::Window); - } - if(param.IsPrevCandidate()) { - // ãã¯ãªã¡ã³ãã n åè£æªæºï¼ - if(0) { - return State::Transition(&SKKEnvironment::Inline); - } - return State::Transition(&SKKEnvironment::Window); - } - // åè£é¸æãã¼ãï¼ - if(0) { - // ã¹ã¿ãã¯ãããããã¦ç¢ºå® - commitContext(); - return State::Transition(&SKKEnvironment::KanaInput); - } - } while(0); - } - - return State::Super(&SKKEnvironment::SelectCandidate); -} - -// ====================================================================== -// level 1ï¼åèªåé¤ -// ====================================================================== -State SKKEnvironment::EntryRemove(const Event& event) { - switch(event) { - case ENTRY_EVENT: - serial_.update(); - // ããã³ãã表示æºå - return 0; - case SKK_YES: - // åèªåé¤ - return State::Transition(&SKKEnvironment::KanaInput); - case SKK_NO: - return State::Transition(&SKKEnvironment::Inline); - case SKK_ENTER: - if(0) { // yes - return State::Transition(&SKKEnvironment::KanaInput); - } - if(0) { // no - return State::Transition(&SKKEnvironment::Inline); - } - // ãããã¡ãã¯ãªã¢ - return 0; - case SKK_CHAR: - if(0) { - // ENTERãæ¼ãããã¾ã§æåãä¿å - } - return 0; - } - - return State::Super(&SKKEnvironment::TopState); -} Index: AquaSKK/SKKEnvironment.h diff -u AquaSKK/SKKEnvironment.h:1.1.2.1 AquaSKK/SKKEnvironment.h:removed --- AquaSKK/SKKEnvironment.h:1.1.2.1 Sat Feb 3 16:53:29 2007 +++ AquaSKK/SKKEnvironment.h Fri Aug 17 21:57:12 2007 @@ -1,159 +0,0 @@ -/* -*- C++ -*- - $Id: SKKEnvironment.h,v 1.1.2.1 2007/02/03 07:53:29 t-suwa Exp $ - - MacOS X implementation of the SKK input method. - - Copyright (C) 2007 Tomotaka SUWA <t.suw****@mac*****> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef INC__SKKEnvironment__ -#define INC__SKKEnvironment__ - -#include "SKK.h" -#include "GenericStateMachine.h" -#include "SKKEventParam.h" -#include "SKKContext.h" -#include "SKKConverter.h" -#include "SKKFrontEnd.h" -#include "SKKBackEnd.h" - -using namespace statemachinecxx_sourceforge_jp; - -class SerialNumber { - unsigned char value_; - -public: - SerialNumber() : value_(0) {} - operator int() const { - return value_; - } - void update() { - value_ = (value_ + 1) % 0xff; - } -}; - -template <typename T> -class RingBuffer { - int pos_; - std::vector<T> array_; - -public: - operator std::vector<T>&() { - return array_; - } - const T& item() const { - return array_[pos_]; - } - T& item() { - return array_[pos_]; - } - void clear() { - pos_ = 0; - array_.clear(); - } - RingBuffer& next() { - pos_ = pos_ + 1 % array_.size(); - return *this; - } - RingBuffer& prev() { - if(pos_ == 0) { - pos_ = array_.size(); - } - pos_ = pos_ - 1 % array_.size(); - return *this; - } -}; - -struct SKKEnvironment { - DECLARE_StateContainer(SKKEnvironment, SKKEventParam, SerialNumber, KanaInput); - - SKKEnvironment(); - - const Output& Result() const { - return serial_; - } - - // level 1(initial state) - State KanaInput(const Event& event); - - // level 2(sub of KanaInput) - State Hirakana(const Event& event); - State Katakana(const Event& event); - State Jisx0201Kana(const Event& event); - - // level 1 - State LatinInput(const Event& event); - - // level2 (sub of LatinInput) - State Ascii(const Event& event); - State Jisx0208Latin(const Event& event); - - // level 1 - State PreConversion(const Event& event); - - // level 2(sub of PreConversion) - State EntryInput(const Event& event); - - // lelvel 3(sub of EntryInput) - State Japanese(const Event& event); - State Abbreviation(const Event& event); - - // level 2(sub of PreConversion) - State EntryCompletion(const Event& event); - - // level 1 - State SelectCandidate(const Event& event); - - // level 2(sub of SelectCandidate) - State Inline(const Event& event); - State Window(const Event& event); - - // level 1 - State EntryRemove(const Event& event); - -private: - SKK::InputMode mode_; - SKKContext top_; - std::vector<SKKContext> stack_; - - SKKFrontEnd frontend_; - SKKBackEnd backend_; - SKKConverter& converter_; - SerialNumber serial_; - - RingBuffer<std::string> completions_; - - // ====================================================================== - // ã³ã³ããã¹ãæä½é¢é£ - // ====================================================================== - SKKContext& topContext(); - void pushContext(); - void commitContext(); - void rollbackContext(); - - // ====================================================================== - // ãããã¡æä½é¢é£ - // ====================================================================== - void push(unsigned char ch, bool entry = false); - void pop(bool entry = false); - inline void compose_push(unsigned char ch) { push(ch, true); } - inline void compose_pop() { pop(true); } - inline bool compose_empty() { return topContext().fixed.empty(); } - void clear(); -}; - -#endif Index: AquaSKK/SKKEventParam.h diff -u AquaSKK/SKKEventParam.h:1.1.2.1 AquaSKK/SKKEventParam.h:removed --- AquaSKK/SKKEventParam.h:1.1.2.1 Sat Feb 3 16:53:29 2007 +++ AquaSKK/SKKEventParam.h Fri Aug 17 21:57:12 2007 @@ -1,134 +0,0 @@ -/* -*- C++ -*- - $Id: SKKEventParam.h,v 1.1.2.1 2007/02/03 07:53:29 t-suwa Exp $ - - MacOS X implementation of the SKK input method. - - Copyright (C) 2007 Tomotaka SUWA <t.suw****@mac*****> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef INC__SKKEventParam__ -#define INC__SKKEventParam__ - -#include <sstream> -#include "GenericStateMachine.h" - -// ãã¼å ¥åã¤ãã³ã -enum { - SKK_NULL = statemachinecxx_sourceforge_jp::USER_EVENT, // ç¡å¹ãªã¤ãã³ã - SKK_JMODE, // Ctrl-J - SKK_ENTER, // Ctrl-M - SKK_BACKSPACE, // Ctrl-H - SKK_TAB, // Ctrl-I - SKK_CANCEL, // Ctrl-G - SKK_PASTE, // Ctrl-Y - SKK_LEFT, // â - SKK_UP, // â - SKK_RIGHT, // â - SKK_DOWN, // â - SKK_CHAR, // ãã®ä»å ¨ã¦ã®ãã¼å ¥å - SKK_YES, // ä»®æ³ã¤ãã³ã - SKK_NO, // ä»®æ³ã¤ãã³ã - SKK_ON, // ä»®æ³ã¤ãã³ã - SKK_OFF, // ä»®æ³ã¤ãã³ã - SKK_HIRAKANA, // å ¥åã¢ã¼ããã²ãããªã - SKK_KATAKANA, // å ¥åã¢ã¼ããã«ã¿ã«ãã - SKK_JISX0201KANA, // å ¥åã¢ã¼ããåè§ã«ãã - SKK_JISX0208LATIN, // å ¥åã¢ã¼ããå ¨è§è±æ°ã - SKK_ASCII // å ¥åã¢ã¼ããASCIIã -}; - -// SKK_CHAR å±æ§ -enum { - None, - Direct = 1, - UpperCases = 2, - ToggleKana = 4, - ToggleJisx0201Kana = 8, - SwitchToAscii = 16, - SwitchToJisx0208Latin = 32, - EnterJapanese = 64, - EnterAbbrev = 128, - NextCompletion = 256, - PrevCompletion = 512, - NextCandidate = 1024, - PrevCandidate = 2048, - RemoveTrigger = 4096 -}; - -// ã¤ãã³ããã©ã¡ã¼ã¿ -struct SKKEventParam { - SKKEventParam() : event(0), code(0), attribute(0) {} - SKKEventParam(int e, unsigned char c, int a = None) : event(e), code(c), attribute(a) {} - const static SKKEventParam& Null() { static SKKEventParam null(SKK_NULL, 0, 0); return null; } - - int event; // ã¤ãã³ã(åé·ã ãä»æ¹ããªã) - unsigned char code; // æåãã®ãã® - int attribute; // æåã®ã¿ã¤ã - - bool operator==(const SKKEventParam& rhs) const { - return (event == rhs.event && code == rhs.code && attribute == rhs.attribute); - } - - bool IsDirect() const { return attribute & Direct; } - bool IsUpperCases() const { return attribute & UpperCases; } - bool IsToggleKana() const { return attribute & ToggleKana; } - bool IsToggleJisx0201Kana() const { return attribute & ToggleJisx0201Kana; } - bool IsSwitchToAscii() const { return attribute & SwitchToAscii; } - bool IsSwitchToJisx0208Latin() const { return attribute & SwitchToJisx0208Latin; } - bool IsEnterJapanese() const { return attribute & EnterJapanese; } - bool IsEnterAbbrev() const { return attribute & EnterAbbrev; } - bool IsNextCompletion() const { return attribute & NextCompletion; } - bool IsPrevCompletion() const { return attribute & PrevCompletion; } - bool IsNextCandidate() const { return attribute & NextCandidate; } - bool IsPrevCandidate() const { return attribute & PrevCandidate; } - bool IsRemoveTrigger() const { return attribute & RemoveTrigger; } - - std::string dump() const { - const char* event_name[] = { - "SKK_NULL", - "SKK_JMODE", - "SKK_ENTER", - "SKK_BACKSPACE", - "SKK_TAB", - "SKK_CANCEL", - "SKK_PASTE", - "SKK_LEFT", - "SKK_UP", - "SKK_RIGHT", - "SKK_DOWN", - "SKK_CHAR", - "SKK_YES", - "SKK_NO", - "SKK_ON", - "SKK_OFF", - "SKK_HIRAKANA", - "SKK_KATAKANA", - "SKK_JISX0201KANA", - "SKK_JISX0208LATIN", - "SKK_ASCII" - }; - - std::stringstream buf; - buf << "event=" << event_name[event - SKK_NULL] << ", " - << "code=" << std::hex << (unsigned int)code << ", " - << "attr=" << std::dec << attribute; - - return buf.str(); - } -}; - -#endif Index: AquaSKK/SKKFrontEnd.h diff -u AquaSKK/SKKFrontEnd.h:1.1.2.1 AquaSKK/SKKFrontEnd.h:removed --- AquaSKK/SKKFrontEnd.h:1.1.2.1 Sat Feb 3 16:53:29 2007 +++ AquaSKK/SKKFrontEnd.h Fri Aug 17 21:57:12 2007 @@ -1,82 +0,0 @@ -/* -*- C++ -*- - $Id: SKKFrontEnd.h,v 1.1.2.1 2007/02/03 07:53:29 t-suwa Exp $ - - MacOS X implementation of the SKK input method. - - Copyright (C) 2007 Tomotaka SUWA <t.suw****@mac*****> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef INC__SKKFrontEnd__ -#define INC__SKKFrontEnd__ - -#include <string> -#include <vector> -#include "SKK.h" - -// ã¤ã³ã¿ãã§ã¼ã¹ -struct SKKFrontEndInterface { - virtual ~SKKFrontEndInterface() {} - - // æå種å¤æ´ - virtual void SelectInputMode(SKK::InputMode /* index */) {} - - // æªç¢ºå®æåå - virtual void ShowString(const std::string& /* str */) {} - - // 確å®æåå - virtual void FixString(const std::string& /* str */) {} - - // åæ¶ - virtual void Cancel() {} - - // è¦åºãèª - virtual void ShowEntry(const std::string& /* entry */) {} - - // åè£ - virtual void ShowCandidate(const std::string& /* candidate */) {} - - // åè£ã¦ã£ã³ã㦠- virtual void PrepareWindow(const std::string& /* labels */, const std::vector<std::string>& /* candidates */) {} - virtual void ShowWindow(int /* index */) {} - virtual void CloseWindow() {} - - // ã¦ã£ã³ãã¦æ°ã¨ãåã¦ã£ã³ãã¦å ã®åè£æ° - virtual int LastWindowIndex() { return 0; } - virtual int NumCandidatesInWindow(int /* index */) { return 0; } - - // åèªç»é² - virtual void AddEntry(const std::string& /* entry */) {} - - // åèªåé¤ - virtual void RemoveEntry(const std::string& /* entry */, const std::string& /* candidate */) {} - - // èªåãã¤ãããã¯è£å® - virtual void ShowCompletion(const std::vector<std::string>& /* completions */) {} - - // ã¦ã¼ãã£ãªãã£ã«ã¼ãã³ - virtual void ShowMessage(const std::string& /* message */) {} -}; - -class SKKFrontEnd : public SKKFrontEndInterface { -public: - SKKFrontEnd(); - virtual ~SKKFrontEnd() {} - virtual void SelectInputMode(SKK::InputMode index); - virtual void Cancel(); -}; - -#endif Index: AquaSKK/SKKFrontEnd.mm diff -u AquaSKK/SKKFrontEnd.mm:1.1.2.1 AquaSKK/SKKFrontEnd.mm:removed --- AquaSKK/SKKFrontEnd.mm:1.1.2.1 Sat Feb 3 16:53:29 2007 +++ AquaSKK/SKKFrontEnd.mm Fri Aug 17 21:57:12 2007 @@ -1,80 +0,0 @@ -/* -*- C++ -*- - $Id: SKKFrontEnd.mm,v 1.1.2.1 2007/02/03 07:53:29 t-suwa Exp $ - - MacOS X implementation of the SKK input method. - - Copyright (C) 2007 Tomotaka SUWA <t.suw****@mac*****> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include <Cocoa/Cocoa.h> -#include "SKKFrontEnd.h" -#include "BIM.h" -#include "BIMClientServer.h" -#include "BIMInputEvents.h" - -class AutoreleasePool { - NSAutoreleasePool* pool_; - -public: - AutoreleasePool() { - pool_ = [[NSAutoreleasePool alloc] init]; - } - - ~AutoreleasePool() { - [pool_ release]; - } -}; - -SKKFrontEnd::SKKFrontEnd() { - NSApplicationLoad(); -} - -void SKKFrontEnd::SelectInputMode(SKK::InputMode index) { - const CFStringRef inputModes[] = { - kTextServiceInputModeJapanese, - kTextServiceInputModeJapaneseKatakana, - kTextServiceInputModeJapaneseHalfWidthKana, - kTextServiceInputModeJapaneseFullWidthRoman, - kTextServiceInputModeRoman, - 0 - }; - - // BIM.r ãè¦ã - ComponentDescription cd; - cd.componentType = 'tsvc'; - cd.componentSubType = 'inpm'; - cd.componentManufacturer = 'askk'; - cd.componentFlags = 0; - cd.componentFlagsMask = 0; - - TSMSelectInputMode(FindNextComponent(0, &cd), inputModes[index]); -} - -void SKKFrontEnd::Cancel() { - AutoreleasePool pool; - - OffsetToPosParams params; - - memset(¶ms, 0x00, sizeof(params)); - BIMHandleOffsetToPos(¶ms); - - CGRect mainscreen = CGDisplayBounds(CGMainDisplayID()); - float cg_x = params.fReplyPoint.h; - float cg_y = mainscreen.size.height - params.fReplyPoint.v; - - NSShowAnimationEffect(NSAnimationEffectPoof, NSMakePoint(cg_x, cg_y), NSZeroSize, nil, 0, 0); -} Index: AquaSKK/SKKInputKeymap.cpp diff -u AquaSKK/SKKInputKeymap.cpp:1.1.2.2 AquaSKK/SKKInputKeymap.cpp:removed --- AquaSKK/SKKInputKeymap.cpp:1.1.2.2 Sat Feb 3 18:03:53 2007 +++ AquaSKK/SKKInputKeymap.cpp Fri Aug 17 21:57:12 2007 @@ -1,281 +0,0 @@ -/* -*- C++ -*- - $Id: SKKInputKeymap.cpp,v 1.1.2.2 2007/02/03 09:03:53 t-suwa Exp $ - - MacOS X implementation of the SKK input method. - - Copyright (C) 2007 Tomotaka SUWA <t.suw****@mac*****> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include <iostream> -#include <fstream> -#include <sstream> -#include "SKKInputKeymap.h" - -enum { TYPE_EVENT, TYPE_ATTRIBUTE }; - -const struct { - int type; - int id; - const char* name; -} values[] = { - { TYPE_EVENT, SKK_JMODE, "SKK_JMODE" }, - { TYPE_EVENT, SKK_ENTER, "SKK_ENTER" }, - { TYPE_EVENT, SKK_BACKSPACE, "SKK_BACKSPACE" }, - { TYPE_EVENT, SKK_TAB, "SKK_TAB" }, - { TYPE_EVENT, SKK_CANCEL, "SKK_CANCEL" }, - { TYPE_EVENT, SKK_PASTE, "SKK_PASTE" }, - { TYPE_EVENT, SKK_LEFT, "SKK_LEFT" }, - { TYPE_EVENT, SKK_UP, "SKK_UP" }, - { TYPE_EVENT, SKK_RIGHT, "SKK_RIGHT" }, - { TYPE_EVENT, SKK_DOWN, "SKK_DOWN" }, - { TYPE_EVENT, SKK_CHAR, "SKK_CHAR" }, - { TYPE_EVENT, SKK_YES, "SKK_YES" }, - { TYPE_EVENT, SKK_NO, "SKK_NO" }, - { TYPE_ATTRIBUTE, Direct, "Direct" }, - { TYPE_ATTRIBUTE, UpperCases, "UpperCases" }, - { TYPE_ATTRIBUTE, ToggleKana, "ToggleKana" }, - { TYPE_ATTRIBUTE, ToggleJisx0201Kana, "ToggleJisx0201Kana" }, - { TYPE_ATTRIBUTE, SwitchToAscii, "SwitchToAscii" }, - { TYPE_ATTRIBUTE, SwitchToJisx0208Latin, "SwitchToJisx0208Latin" }, - { TYPE_ATTRIBUTE, EnterJapanese, "EnterJapanese" }, - { TYPE_ATTRIBUTE, EnterAbbrev, "EnterAbbrev" }, - { TYPE_ATTRIBUTE, NextCompletion, "NextCompletion" }, - { TYPE_ATTRIBUTE, PrevCompletion, "PrevCompletion" }, - { TYPE_ATTRIBUTE, NextCandidate, "NextCandidate" }, - { TYPE_ATTRIBUTE, PrevCandidate, "PrevCandidate" }, - { TYPE_ATTRIBUTE, RemoveTrigger, "RemoveTrigger" }, - { 0, 0, 0x00 } -}; - -int fetchIndex(const std::string& key) { - for(int i = 0; values[i].name != 0x00; ++ i) { - if(key == values[i].name) { - return i; - } - } - - return -1; -} - -void SKKInputKeymap::parse(const std::string& value, int index) { - std::string str(value); - - // å ¨ã¦ã® "::" ã空ç½ã«ç½®æãã - const std::string type_separator = "::"; - for(unsigned pos = str.find(type_separator); pos != std::string::npos; pos = str.find(type_separator)) { - str.replace(pos, type_separator.size(), " "); - } - std::stringstream buf(str); - - int code = 0; - int labels = 0; - while(buf >> str) { - if(str == "group") labels += LABEL_GROUP; - if(str == "ctrl") labels += LABEL_CTRL; - if(str == "ascii") labels += LABEL_ASCII; - if(str == "keycode") labels += LABEL_KEYCODE; - } - - if(labels & LABEL_ASCII && labels & LABEL_KEYCODE) { - std::cerr << "SKKInputKeymap::parse(): invalid syntax ignored [" - << values[index].name << "]" << std::endl; - return; - } - - // åä¸ã³ã¼ãï¼ - if(!(labels & LABEL_GROUP)) { - code = get_code(str, labels); - store_state(code, labels, index); - } else { - // è¤æ°ã³ã¼ããªã®ã§ãå ¨ã¦ã® ',' ã空ç½ã«ç½®æãã - std::replace(str.begin(), str.end(), ',', ' '); - std::stringstream group_buf(str); - - while(group_buf >> str) { - // åä¸ã³ã¼ããï¼ - unsigned pos = str.find_first_of('-'); - if(pos == std::string::npos) { - code = get_code(str, labels); - store_state(code, labels, index); - } else { - // from-to ã®ç¯å²æå®ãªã®ã§ã'-' ã空ç½ã«ç½®æãã - str[pos] = ' '; - std::stringstream from_to(str); - - int from = 0; - int to = -1; - if(from_to >> str) { - from = get_code(str, labels); - } - if(from_to >> str) { - to = get_code(str, labels); - } - - if(!(from < to)) { - std::cerr << "SKKInputKeymap::parse(): invalid sequence [" - << values[index].name << "]" << std::endl; - continue; - } - - // ç¯å²ã³ã¼ãã®çæ - for(int i = from; i < to + 1; ++ i) { - store_state(i, labels, index); - } - } - } - } -} - -int SKKInputKeymap::get_code(const std::string& str, int labels) { - std::stringstream buf(str); - int result; - - if(labels & (LABEL_ASCII | LABEL_KEYCODE)) { - buf >> std::hex >> result; - } else { - result = str[0]; - } - - return result; -} - -void SKKInputKeymap::store_state(int code, int labels, int index) { - int state; - - if(labels & LABEL_KEYCODE) { - state = KeyState::Keycode(code, labels & LABEL_CTRL); - } else { - state = KeyState::Ascii(code, labels & LABEL_CTRL); - } - - if(values[index].type == TYPE_EVENT) { - events_[state] = values[index].id; - } else { - events_[state] = SKK_CHAR; - attributes_[state] |= values[index].id; - } - -#if 0 - std::cerr <<"STORE: name=" << values[index].name << ", " - << "code=" << std::hex << code << ", " - << "keycode=" << std::boolalpha << keycode << ", " - << "ctrl=" << std::boolalpha << ctrl << std::endl; -#endif -} - -// keymap.conf ã®èªã¿è¾¼ã¿ -void SKKInputKeymap::Initialize(const std::string& path) { - std::ifstream config(path.c_str()); - - if(!config) { - std::cerr << "SKKInputKeymap::Initialize(): can't open file [" << path << "]" << std::endl; - return; - } - - std::string key; - std::string value; - - events_.clear(); - attributes_.clear(); - - while(config >> key) { - do { - // ã³ã¡ã³ãã¯èªã¿é£ã°ã - if(key.empty() || key[0] == '#') break; - - // ç¡å¹ãªè¨å®ãã¼ã¯ç¡è¦ - int index = fetchIndex(key); - if(index < 0) { - std::cerr << "SKKInputKeymap::Initialize(): invalid key name[" << key << "]" << std::endl; - break; - } - - config >> value; - - // å ¨ã¦ã® "||" ã空ç½ã«ç½®æ - static const std::string separator = "||"; - for(unsigned pos = value.find(separator); pos != std::string::npos; pos = value.find(separator)) { - value.replace(pos, separator.size(), " "); - } - std::stringstream buf(value); - - // åã¨ã³ããªããã¼ã¹ - while(buf >> value) { - parse(value, index); - } - } while(0); - - // æ«å°¾ã¾ã§èªã¿é£ã°ã - config.ignore(0xff, '\n'); - } -} - -SKKEventParam SKKInputKeymap::Fetch(int ascii, int keycode, bool ctrl) { - SKKEventParam param; - Keymap* map; - Keymap::iterator iter; - - // æåã³ã¼ã - param.code = ascii; - - // ã¤ãã³ãã®æ¤ç´¢ - map = &events_; - do { - // keycode ã¤ãã³ããæåã«èª¿ã¹ã(åªå 度é«) - iter = map->find(KeyState::Keycode(keycode, ctrl)); - if(iter != map->end()) { - param.event = iter->second; - break; - } - - // ascii ã¤ãã³ã - iter = map->find(KeyState::Ascii(ascii, ctrl)); - if(iter != map->end()) { - param.event = iter->second; - break; - } - - // ããã©ã«ã - if(!ctrl) { - param.event = SKK_CHAR; - } else { - param.event = SKK_NULL; - } - } while(0); - - // SKK_CHAR ã¤ãã³ããªããå±æ§ã調ã¹ã - if(param.event == SKK_CHAR) { - map = &attributes_; - - do { - // keycode å±æ§ãæåã«èª¿ã¹ã(åªå 度é«) - iter = map->find(KeyState::Keycode(keycode, ctrl)); - if(iter != map->end()) { - param.attribute = iter->second; - break; - } - - // ascii å±æ§ - iter = map->find(KeyState::Ascii(ascii, ctrl)); - if(iter != map->end()) { - param.attribute = iter->second; - } - } while(0); - } - - return param; -} Index: AquaSKK/SKKInputKeymap.h diff -u AquaSKK/SKKInputKeymap.h:1.1.2.2 AquaSKK/SKKInputKeymap.h:removed --- AquaSKK/SKKInputKeymap.h:1.1.2.2 Sat Feb 3 18:03:53 2007 +++ AquaSKK/SKKInputKeymap.h Fri Aug 17 21:57:12 2007 @@ -1,67 +0,0 @@ -/* -*- C++ -*- - $Id: SKKInputKeymap.h,v 1.1.2.2 2007/02/03 09:03:53 t-suwa Exp $ - - MacOS X implementation of the SKK input method. - - Copyright (C) 2007 Tomotaka SUWA <t.suw****@mac*****> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef INC__SKKInputKeymap__ -#define INC__SKKInputKeymap__ - -#include <map> -#include <string> -#include "SKKEventParam.h" - -// ãã¼ããã -class SKKInputKeymap { - class KeyState { - int state_; - - public: - KeyState() : state_(0) {} - KeyState(int ascii, int keycode, bool ctrl) { - state_ = (0xff & ascii) | ((0xff & keycode) << 8) | (ctrl << 16); - } - static KeyState Keycode(int keycode, bool ctrl) { - return KeyState(0, keycode, ctrl); - } - static KeyState Ascii(int ascii, bool ctrl) { - return KeyState(ascii, 0, ctrl); - } - operator int() const { - return state_; - } - }; - - typedef std::map<int, int> Keymap; - - Keymap events_; - Keymap attributes_; - - enum { LABEL_GROUP = 1, LABEL_CTRL = 2, LABEL_ASCII = 4, LABEL_KEYCODE = 8 }; - - void parse(const std::string& value, int index); - int get_code(const std::string& str, int labels); - void store_state(int code, int labels, int index); - -public: - void Initialize(const std::string& path); - SKKEventParam Fetch(int ascii, int keycode, bool ctrl); -}; - -#endif Index: AquaSKK/SKKPreProcessor.h diff -u AquaSKK/SKKPreProcessor.h:1.1.2.1 AquaSKK/SKKPreProcessor.h:removed --- AquaSKK/SKKPreProcessor.h:1.1.2.1 Sat Feb 3 16:53:29 2007 +++ AquaSKK/SKKPreProcessor.h Fri Aug 17 21:57:12 2007 @@ -1,106 +0,0 @@ -/* -*- C++ -*- - $Id: SKKPreProcessor.h,v 1.1.2.1 2007/02/03 07:53:29 t-suwa Exp $ - - MacOS X implementation of the SKK input method. - - Copyright (C) 2007 Tomotaka SUWA <t.suw****@mac*****> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef INC__SKKPreProcessor__ -#define INC__SKKPreProcessor__ - -#include <Carbon/Carbon.h> -#include "SKKInputKeymap.h" -#include "SKKConfig.h" -#include "SKKConverter.h" - -// ãã¼å ¥ååå¦ç -class SKKPreProcessor { - SKKInputKeymap keymap_; - - SKKPreProcessor() {} - - // ====================================================================== - // Ctrl ãã¼ã¨ã®ã³ã³ããã¼ã·ã§ã³ã§ 7bit ç®ãè½ã¡ãæåã復å ãã - // http://developer.apple.com/qa/qa2005/qa1446.html - // ====================================================================== - char repair(unsigned int keycode, unsigned int kbdtype, unsigned int modifier, UniChar uc) const { - long smv = GetScriptManagerVariable(smKeyScript); - Handle uchrHandle = GetResource('uchr', GetScriptVariable(smv, smScriptKeys)); - UInt32 dummy = 0; - UCKeyTranslate((UCKeyboardLayout*)*uchrHandle, keycode, kUCKeyActionDisplay, - (modifier & ~controlKey) >> 8, kbdtype, kUCKeyTranslateNoDeadKeysMask, &dummy, 1, &dummy, &uc); - - return uc; - } - -public: - static SKKPreProcessor& theInstance() { - static SKKPreProcessor obj; - return obj; - } - - void Initialize() { - // å é¨ãã¼ãã«ã®ãã¼ã - keymap_.Initialize(SKKConfig::ResourceDirectory() + "keymap.conf"); - keymap_.Initialize(SKKConfig::LibraryDirectory() + "keymap.conf"); - - // åæå - SKKConverter::theInstance().Initialize(SKKConfig::ResourceDirectory() + "kana-rule-list"); - SKKConverter::theInstance().Initialize(SKKConfig::LibraryDirectory() + "kana-rule-list"); - } - - SKKEventParam Execute(const EventRef event) { - switch(GetEventClass(event)) { - case kEventClassKeyboard: - break; - default: - return SKKEventParam::Null(); - } - - char charcode; - unsigned int modifier; - unsigned int keycode; - unsigned int kbdtype; - UniChar uc; - - switch(GetEventKind(event)) { - case kEventRawKeyDown: - case kEventRawKeyRepeat: - GetEventParameter(event, kEventParamKeyMacCharCodes, typeChar, 0, sizeof(charcode), 0, &charcode); - GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, 0, sizeof(modifier), 0, &modifier); - GetEventParameter(event, kEventParamKeyCode, typeUInt32, 0, sizeof(keycode), 0, &keycode); - GetEventParameter(event, kEventParamKeyUnicodes, typeUnicodeText, 0, sizeof(uc), 0, &uc); - GetEventParameter(event, kEventParamKeyboardType, typeUInt32, 0, sizeof(kbdtype), 0, &kbdtype); - break; - default: - return SKKEventParam::Null(); - } - - if(modifier & cmdKey) { - return SKKEventParam::Null(); - } - - if(modifier & controlKey) { - charcode = repair(keycode, modifier, kbdtype, uc); - } - - return keymap_.Fetch(charcode, keycode, modifier & controlKey); - } -}; - -#endif