[aquaskk-changes 335] CVS update: AquaSKK

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[] = {
-	{ "&comma;", "," },
-	{ "&space;", " " },
-	{ "&sharp;", "#" },
-	{ "",      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(&params, 0x00, sizeof(params));
-    BIMHandleOffsetToPos(&params);
-
-    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


aquaskk-changes メーリングリストの案内