From t-suwa ¡÷ users.sourceforge.jp Sun Sep 2 12:45:38 2007 From: t-suwa ¡÷ users.sourceforge.jp (t-suwa ¡÷ users.sourceforge.jp) Date: Sun, 02 Sep 2007 12:45:38 +0900 Subject: [aquaskk-changes 351] CVS update: AquaSKK/src/editor Message-ID: <1188704738.905223.9918.nullmailer@users.sourceforge.jp> Index: AquaSKK/src/editor/SKKDirectInputState.h diff -u AquaSKK/src/editor/SKKDirectInputState.h:1.1.2.1 AquaSKK/src/editor/SKKDirectInputState.h:1.1.2.2 --- AquaSKK/src/editor/SKKDirectInputState.h:1.1.2.1 Sun Sep 2 12:36:25 2007 +++ AquaSKK/src/editor/SKKDirectInputState.h Sun Sep 2 12:45:38 2007 @@ -23,7 +23,7 @@ #include "SKKState.h" -// ?¶æ?????¹ã??³ã?????¼ã? +// ?´æŽ¥?¥å??¶æ? struct SKKDirectInputState : public SKKState { static SKKDirectInputState& theInstance(); From t-suwa ¡÷ users.sourceforge.jp Sun Sep 2 12:36:25 2007 From: t-suwa ¡÷ users.sourceforge.jp (t-suwa ¡÷ users.sourceforge.jp) Date: Sun, 02 Sep 2007 12:36:25 +0900 Subject: [aquaskk-changes 352] CVS update: AquaSKK/src/editor Message-ID: <1188704185.707946.4870.nullmailer@users.sourceforge.jp> Index: AquaSKK/src/editor/SKKDirectInputState.cpp diff -u /dev/null AquaSKK/src/editor/SKKDirectInputState.cpp:1.1.2.1 --- /dev/null Sun Sep 2 12:36:25 2007 +++ AquaSKK/src/editor/SKKDirectInputState.cpp Sun Sep 2 12:36:25 2007 @@ -0,0 +1,77 @@ +/* -*- C++ -*- + MacOS X implementation of the SKK input method. + + Copyright (C) 2007 Tomotaka SUWA + + 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 "SKKDirectInputState.h" +#include "SKKContext.h" +#include "SKKEventParam.h" +#include "SKKEmptySubController.h" + +SKKDirectInputState& SKKDirectInputState::theInstance() { + static SKKDirectInputState obj; + return obj; +} + +SKKSubController* SKKDirectInputState::HandleInput(SKKContext& context, const SKKEventParam& param) { + return new SKKEmptySubController(0); +} + +SKKSubController* SKKDirectInputState::HandleEnter(SKKContext& context, const SKKEventParam& param) { + return new SKKEmptySubController(0); +} + +SKKSubController* SKKDirectInputState::HandleJmode(SKKContext& context, const SKKEventParam& param) { + return new SKKEmptySubController(0); +} + +SKKSubController* SKKDirectInputState::HandleCancel(SKKContext& context, const SKKEventParam& param) { + return new SKKEmptySubController(0); +} + +SKKSubController* SKKDirectInputState::HandleBackSpace(SKKContext& context, const SKKEventParam& param) { + return new SKKEmptySubController(0); +} + +SKKSubController* SKKDirectInputState::HandleDelete(SKKContext& context, const SKKEventParam& param) { + return new SKKEmptySubController(0); +} + +SKKSubController* SKKDirectInputState::HandleTab(SKKContext& context, const SKKEventParam& param) { + return new SKKEmptySubController(0); +} + +SKKSubController* SKKDirectInputState::HandlePaste(SKKContext& context, const SKKEventParam& param) { + return new SKKEmptySubController(0); +} + +SKKSubController* SKKDirectInputState::HandleCursorLeft(SKKContext& context, const SKKEventParam& param) { + return new SKKEmptySubController(0); +} + +SKKSubController* SKKDirectInputState::HandleCursorRight(SKKContext& context, const SKKEventParam& param) { + return new SKKEmptySubController(0); +} + +SKKSubController* SKKDirectInputState::HandleCursorUp(SKKContext& context, const SKKEventParam& param) { + return new SKKEmptySubController(0); +} + +SKKSubController* SKKDirectInputState::HandleCursorDown(SKKContext& context, const SKKEventParam& param) { + return new SKKEmptySubController(0); +} Index: AquaSKK/src/editor/SKKDirectInputState.h diff -u /dev/null AquaSKK/src/editor/SKKDirectInputState.h:1.1.2.1 --- /dev/null Sun Sep 2 12:36:25 2007 +++ AquaSKK/src/editor/SKKDirectInputState.h Sun Sep 2 12:36:25 2007 @@ -0,0 +1,44 @@ +/* -*- C++ -*- + MacOS X implementation of the SKK input method. + + Copyright (C) 2007 Tomotaka SUWA + + 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__SKKDirectState__ +#define INC__SKKDirectState__ + +#include "SKKState.h" + +// ?¶æ?????¹ã??³ã?????¼ã? +struct SKKDirectInputState : public SKKState { + static SKKDirectInputState& theInstance(); + + virtual SKKSubController* HandleInput(SKKContext& context, const SKKEventParam& param); + virtual SKKSubController* HandleEnter(SKKContext& context, const SKKEventParam& param); + virtual SKKSubController* HandleJmode(SKKContext& context, const SKKEventParam& param); + virtual SKKSubController* HandleCancel(SKKContext& context, const SKKEventParam& param); + virtual SKKSubController* HandleBackSpace(SKKContext& context, const SKKEventParam& param); + virtual SKKSubController* HandleDelete(SKKContext& context, const SKKEventParam& param); + virtual SKKSubController* HandleTab(SKKContext& context, const SKKEventParam& param); + virtual SKKSubController* HandlePaste(SKKContext& context, const SKKEventParam& param); + virtual SKKSubController* HandleCursorLeft(SKKContext& context, const SKKEventParam& param); + virtual SKKSubController* HandleCursorRight(SKKContext& context, const SKKEventParam& param); + virtual SKKSubController* HandleCursorUp(SKKContext& context, const SKKEventParam& param); + virtual SKKSubController* HandleCursorDown(SKKContext& context, const SKKEventParam& param); +}; + +#endif Index: AquaSKK/src/editor/SKKEditor.cpp diff -u /dev/null AquaSKK/src/editor/SKKEditor.cpp:1.1.2.1 --- /dev/null Sun Sep 2 12:36:25 2007 +++ AquaSKK/src/editor/SKKEditor.cpp Sun Sep 2 12:36:25 2007 @@ -0,0 +1,126 @@ +/* -*- C++ -*- + MacOS X implementation of the SKK input method. + + Copyright (C) 2007 Tomotaka SUWA + + 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 "SKKEditor.h" +#include "SKKDirectInputState.h" + +SKKEditor::SKKEditor() { + initialize(); +} + +SKKEditor::SKKEditor(const std::string& prompt) : context_(prompt) { + initialize(); +} + +SKKEditor::SKKEditor(const SKKEditor& src) : context_(src.context_), state_(src.state_) { +} + +// ???çµ?? +const SKKEventResult& SKKEditor::Result() const { + return context_.Result(); +} + +// ====================================================================== +// ????¥å???????????????§»è­²ã???+// ====================================================================== +SKKSubController* SKKEditor::HandleInput(const SKKEventParam& param) { + return state_->HandleInput(context_, param); +} + +SKKSubController* SKKEditor::HandleEnter(const SKKEventParam& param) { + return state_->HandleEnter(context_, param); +} + +SKKSubController* SKKEditor::HandleJmode(const SKKEventParam& param) { + return state_->HandleJmode(context_, param); +} + +SKKSubController* SKKEditor::HandleCancel(const SKKEventParam& param) { + return state_->HandleCancel(context_, param); +} + +SKKSubController* SKKEditor::HandleBackSpace(const SKKEventParam& param) { + return state_->HandleBackSpace(context_, param); +} + +SKKSubController* SKKEditor::HandleDelete(const SKKEventParam& param) { + return state_->HandleDelete(context_, param); +} + +SKKSubController* SKKEditor::HandleTab(const SKKEventParam& param) { + return state_->HandleTab(context_, param); +} + +SKKSubController* SKKEditor::HandlePaste(const SKKEventParam& param) { + return state_->HandlePaste(context_, param); +} + +SKKSubController* SKKEditor::HandleCursorLeft(const SKKEventParam& param) { + return state_->HandleCursorLeft(context_, param); +} + +SKKSubController* SKKEditor::HandleCursorRight(const SKKEventParam& param) { + return state_->HandleCursorRight(context_, param); +} + +SKKSubController* SKKEditor::HandleCursorUp(const SKKEventParam& param) { + return state_->HandleCursorUp(context_, param); +} + +SKKSubController* SKKEditor::HandleCursorDown(const SKKEventParam& param) { + return state_->HandleCursorDown(context_, param); +} + +// ?¥å??¢ã??????+void SKKEditor::SelectInputMode(SKK::InputMode mode) { + +} + +// ????¶æ?å¤?? +void SKKEditor::ChangeState(SKK::EditState state) { + switch(state) { + case SKK::DirectInput: + state_ = &SKKDirectInputState::theInstance(); + break; + + case SKK::EntryInput: + case SKK::OkuriInput: + case SKK::AbbrevInput: + case SKK::Completion: + case SKK::SingleCandidate: + case SKK::MultipleCandidate: + case SKK::EntryRemove: + break; + } +} + +std::string SKKEditor::EditString() const { + return ""; +} + +void SKKEditor::Commit(const std::string& word) { +} + +// ====================================================================== +// private method +// ====================================================================== +void SKKEditor::initialize() { + state_ = &SKKDirectInputState::theInstance(); +} Index: AquaSKK/src/editor/SKKEditor.h diff -u /dev/null AquaSKK/src/editor/SKKEditor.h:1.1.2.1 --- /dev/null Sun Sep 2 12:36:25 2007 +++ AquaSKK/src/editor/SKKEditor.h Sun Sep 2 12:36:25 2007 @@ -0,0 +1,77 @@ +/* -*- C++ -*- + MacOS X implementation of the SKK input method. + + Copyright (C) 2007 Tomotaka SUWA + + 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__SKKEditor__ +#define INC__SKKEditor__ + +#include "SKK.h" +#include "SKKContext.h" + +class SKKState; +class SKKSubController; +class SKKEventParam; +class SKKEventResult; + +// ÊÔ½¸¥¤¥ó¥¿¥Õ¥§¡¼¥¹ +class SKKEditor { + SKKContext context_; + SKKState* state_; + + void initialize(); + +public: + // ¥­¡¼ÆþÎϥϥó¥É¥é¡¼ + typedef SKKSubController* (SKKEditor::*Handler)(const SKKEventParam&); + + SKKEditor(); + SKKEditor(const std::string& prompt); + SKKEditor(const SKKEditor& src); + + // ½èÍý·ë²Ì + const SKKEventResult& Result() const; + + // ¥­¡¼ÆþÎϽèÍý + SKKSubController* HandleInput(const SKKEventParam& param); + SKKSubController* HandleEnter(const SKKEventParam& param); + SKKSubController* HandleJmode(const SKKEventParam& param); + SKKSubController* HandleCancel(const SKKEventParam& param); + SKKSubController* HandleBackSpace(const SKKEventParam& param); + SKKSubController* HandleDelete(const SKKEventParam& param); + SKKSubController* HandleTab(const SKKEventParam& param); + SKKSubController* HandlePaste(const SKKEventParam& param); + SKKSubController* HandleCursorLeft(const SKKEventParam& param); + SKKSubController* HandleCursorRight(const SKKEventParam& param); + SKKSubController* HandleCursorUp(const SKKEventParam& param); + SKKSubController* HandleCursorDown(const SKKEventParam& param); + + // ÆþÎϥ⡼¥ÉÊѹ¹ + void SelectInputMode(SKK::InputMode mode); + + // ÆâÉô¾õÂÖÊѹ¹ + void ChangeState(SKK::EditState state); + + // ÊÔ½¸Ê¸»úÎó¤ò¼èÆÀ + std::string EditString() const; + + // ³ÎÄꤷ¤¿Ê¸»úÎó¤òÈ¿±Ç + void Commit(const std::string& word); +}; + +#endif // INC__SKKEditor__ Index: AquaSKK/src/editor/SKKState.h diff -u /dev/null AquaSKK/src/editor/SKKState.h:1.1.2.1 --- /dev/null Sun Sep 2 12:36:25 2007 +++ AquaSKK/src/editor/SKKState.h Sun Sep 2 12:36:25 2007 @@ -0,0 +1,44 @@ +/* -*- C++ -*- + MacOS X implementation of the SKK input method. + + Copyright (C) 2007 Tomotaka SUWA + + 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__SKKState__ +#define INC__SKKState__ + +class SKKContext; +class SKKEventParam; +class SKKSubController; + +// ?¶æ?????¹ã??³ã?????¼ã? +struct SKKState { + virtual SKKSubController* HandleInput(SKKContext& context, const SKKEventParam& param) = 0; + virtual SKKSubController* HandleEnter(SKKContext& context, const SKKEventParam& param) = 0; + virtual SKKSubController* HandleJmode(SKKContext& context, const SKKEventParam& param) = 0; + virtual SKKSubController* HandleCancel(SKKContext& context, const SKKEventParam& param) = 0; + virtual SKKSubController* HandleBackSpace(SKKContext& context, const SKKEventParam& param) = 0; + virtual SKKSubController* HandleDelete(SKKContext& context, const SKKEventParam& param) = 0; + virtual SKKSubController* HandleTab(SKKContext& context, const SKKEventParam& param) = 0; + virtual SKKSubController* HandlePaste(SKKContext& context, const SKKEventParam& param) = 0; + virtual SKKSubController* HandleCursorLeft(SKKContext& context, const SKKEventParam& param) = 0; + virtual SKKSubController* HandleCursorRight(SKKContext& context, const SKKEventParam& param) = 0; + virtual SKKSubController* HandleCursorUp(SKKContext& context, const SKKEventParam& param) = 0; + virtual SKKSubController* HandleCursorDown(SKKContext& context, const SKKEventParam& param) = 0; +}; + +#endif From t-suwa ¡÷ users.sourceforge.jp Sun Sep 2 12:36:26 2007 From: t-suwa ¡÷ users.sourceforge.jp (t-suwa ¡÷ users.sourceforge.jp) Date: Sun, 02 Sep 2007 12:36:26 +0900 Subject: [aquaskk-changes 353] CVS update: AquaSKK/src/statemachine Message-ID: <1188704186.087131.4897.nullmailer@users.sourceforge.jp> Index: AquaSKK/src/statemachine/SKKEngine.h diff -u /dev/null AquaSKK/src/statemachine/SKKEngine.h:1.1.2.1 --- /dev/null Sun Sep 2 12:36:26 2007 +++ AquaSKK/src/statemachine/SKKEngine.h Sun Sep 2 12:36:25 2007 @@ -0,0 +1,78 @@ +/* -*- C++ -*- + $Id: SKKEngine.h,v 1.1.2.1 2007/09/02 03:36:25 t-suwa Exp $ + + MacOS X implementation of the SKK input method. + + Copyright (C) 2007 Tomotaka SUWA + + 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 +#include "SKKEnvironment.h" + +template +struct DebugInspector { +public: + void operator()(const Handler handler, const Event& event) { +#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[] = { "<>", "<>", "<>" }; + + 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; + } + } + } + } +}; + +typedef GenericStateMachine SKKEngine; + +#endif Index: AquaSKK/src/statemachine/SKKEnvironment.cpp diff -u /dev/null AquaSKK/src/statemachine/SKKEnvironment.cpp:1.1.2.1 --- /dev/null Sun Sep 2 12:36:26 2007 +++ AquaSKK/src/statemachine/SKKEnvironment.cpp Sun Sep 2 12:36:25 2007 @@ -0,0 +1,443 @@ +/* -*- C++ -*- + MacOS X implementation of the SKK input method. + + Copyright (C) 2007 Tomotaka SUWA + + 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 "SKKEnvironment.h" +#include "SKKController.h" + +typedef SKKEnvironment::Event Event; +typedef SKKEnvironment::State State; +typedef SKKEnvironment::Output Output; + +SKKEnvironment::SKKEnvironment() { + controller_ = new SKKController(); +} + +SKKEnvironment::~SKKEnvironment() { + delete controller_; +} + +const Output& SKKEnvironment::Result() const { + return controller_->Result(); +} + +// ====================================================================== +// level 1ï¼???????+// ====================================================================== +State SKKEnvironment::KanaInput(const Event& event) { + const SKKEventParam& param = event.Param(); + + switch(event) { + case ENTRY_EVENT: + controller_->ChangeState(SKK::DirectInput); + return 0; + + case INIT_EVENT: + return State::ShallowHistory(&SKKEnvironment::Hirakana); + + case EXIT_EVENT: + return State::SaveHistory(); + + case SKK_JMODE: + return controller_->HandleJmode(); + + case SKK_ENTER: + return controller_->HandleEnter(); + + case SKK_BACKSPACE: + return controller_->HandleBackSpace(); + + case SKK_DELETE: + return controller_->HandleDelete(); + + case SKK_CANCEL: + return controller_->HandleCancel(); + + case SKK_PASTE: + return controller_->HandlePaste(); + + case SKK_LEFT: + return controller_->HandleCursorLeft(); + + case SKK_RIGHT: + return controller_->HandleCursorRight(); + + case SKK_UP: + return controller_->HandleCursorUp(); + + case SKK_DOWN: + return controller_->HandleCursorDown(); + + case SKK_ASCII: + return State::Transition(&SKKEnvironment::Ascii); + + case SKK_JISX0208LATIN: + return State::Transition(&SKKEnvironment::Jisx0208Latin); + + case SKK_CHAR: + return controller_->HandleInput(param); + } + + return &SKKEnvironment::TopState; +} + +// ====================================================================== +// level 2 (sub of KanaInput)ï¼???????+// ====================================================================== +State SKKEnvironment::Hirakana(const Event& event) { + const SKKEventParam& param = event.Param(); + + switch(event) { + case ENTRY_EVENT: + controller_->SelectInputMode(SKK::Hirakana); + return 0; + + case SKK_KATAKANA: + return State::Transition(&SKKEnvironment::Katakana); + + case SKK_JISX0201KANA: + return State::Transition(&SKKEnvironment::Jisx0201Kana); + + case SKK_CHAR: + if(param.IsToggleKana()) { + return State::Transition(&SKKEnvironment::Katakana); + } + + if(param.IsToggleJisx0201Kana()) { + return State::Transition(&SKKEnvironment::Jisx0201Kana); + } + } + + return &SKKEnvironment::KanaInput; +} + +// ====================================================================== +// level 2 (sub of KanaInput)ï¼???¿ã???+// ====================================================================== +State SKKEnvironment::Katakana(const Event& event) { + const SKKEventParam& param = event.Param(); + + switch(event) { + case ENTRY_EVENT: + controller_->SelectInputMode(SKK::Katakana); + return 0; + + case SKK_HIRAKANA: + return State::Transition(&SKKEnvironment::Hirakana); + + case SKK_JISX0201KANA: + return State::Transition(&SKKEnvironment::Jisx0201Kana); + + case SKK_CHAR: + if(param.IsToggleKana()) { + return State::Transition(&SKKEnvironment::Hirakana); + } + + if(param.IsToggleJisx0201Kana()) { + return State::Transition(&SKKEnvironment::Jisx0201Kana); + } + } + + return &SKKEnvironment::KanaInput; +} + +// ====================================================================== +// level 2 (sub of KanaInput)ï¼??è§???¿ã???+// ====================================================================== +State SKKEnvironment::Jisx0201Kana(const Event& event) { + const SKKEventParam& param = event.Param(); + + switch(event) { + case ENTRY_EVENT: + controller_->SelectInputMode(SKK::Jisx0201Kana); + return 0; + + case SKK_HIRAKANA: + return State::Transition(&SKKEnvironment::Hirakana); + + case SKK_CHAR: + if(param.IsToggleKana() || param.IsToggleJisx0201Kana()) { + return State::Transition(&SKKEnvironment::Hirakana); + } + } + + return &SKKEnvironment::KanaInput; +} + +// ====================================================================== +// level 1ï¼?atin ?¥å? +// ====================================================================== +State SKKEnvironment::LatinInput(const Event& event) { + const SKKEventParam& param = event.Param(); + + switch(event) { + case ENTRY_EVENT: + controller_->ChangeState(SKK::DirectInput); + return 0; + + case SKK_JMODE: + case SKK_HIRAKANA: + return State::Transition(&SKKEnvironment::Hirakana); + + case SKK_CHAR: + return controller_->HandleInput(param); + } + + return &SKKEnvironment::TopState; +} + +// ====================================================================== +// level 2 (sub of LatinInput)ï¼?SCII +// ====================================================================== +State SKKEnvironment::Ascii(const Event& event) { + switch(event) { + case ENTRY_EVENT: + controller_->SelectInputMode(SKK::Ascii); + return 0; + } + + return &SKKEnvironment::LatinInput; +} + +// ====================================================================== +// level 2 (sub of LatinInput)ï¼??è§????+// ====================================================================== +State SKKEnvironment::Jisx0208Latin(const Event& event) { + switch(event) { + case ENTRY_EVENT: + controller_->SelectInputMode(SKK::Jisx0208Latin); + return 0; + } + + return &SKKEnvironment::LatinInput; +} + +// ====================================================================== +// level 1ï¼????? +// ====================================================================== +State SKKEnvironment::PreConversion(const Event& event) { + switch(event) { + case SKK_ENTER: + return controller_->HandleEnter(); + + case SKK_JMODE: + return controller_->HandleJmode(); + + case SKK_TAB: + return controller_->HandleTab(); + + case SKK_BACKSPACE: + return controller_->HandleBackSpace(); + + case SKK_DELETE: + return controller_->HandleDelete(); + + case SKK_LEFT: + return controller_->HandleCursorLeft(); + + case SKK_RIGHT: + return controller_->HandleCursorRight(); + + case SKK_UP: + return controller_->HandleCursorUp(); + + case SKK_DOWN: + return controller_->HandleCursorDown(); + + case SKK_CANCEL: + return State::Transition(&SKKEnvironment::KanaInput); + } + + return &SKKEnvironment::TopState; +} + +// ====================================================================== +// level 2 (sub of PreConversion)ï¼???ºã?èª????+// ====================================================================== +State SKKEnvironment::EntryInput(const Event& event) { + const SKKEventParam& param = event.Param(); + + switch(event) { + case EXIT_EVENT: + return State::SaveHistory(); + + case SKK_PASTE: + return controller_->HandlePaste(); + + case SKK_CHAR: + return controller_->HandleInput(param); + } + + return &SKKEnvironment::PreConversion; +} + +// ====================================================================== +// level 3 (sub of EntryInput)ï¼????? +// ====================================================================== +State SKKEnvironment::Japanese(const Event& event) { + switch(event) { + case ENTRY_EVENT: + controller_->ChangeState(SKK::EntryInput); + return 0; + } + + return &SKKEnvironment::EntryInput; +} + +// ====================================================================== +// level 3 (sub of EntryInput)ï¼???¥è¡¨è¨?+// ====================================================================== +State SKKEnvironment::Abbreviation(const Event& event) { + switch(event) { + case ENTRY_EVENT: + controller_->SelectInputMode(SKK::Ascii); + controller_->ChangeState(SKK::AbbrevInput); + return 0; + } + + return &SKKEnvironment::EntryInput; +} + +// ====================================================================== +// level 2 (sub of PreConversion)ï¼???ºã?èª??å®?+// ====================================================================== +State SKKEnvironment::EntryCompletion(const Event& event) { + const SKKEventParam& param = event.Param(); + + switch(event) { + case ENTRY_EVENT: + controller_->ChangeState(SKK::Completion); + return 0; + } + + // ?·ã?????¤ã??³ã????????¡è???? + if(event.IsSystem() || + event == SKK_TAB || + (event == SKK_CHAR && (param.IsNextCandidate() || + param.IsNextCompletion() || + param.IsPrevCompletion()))) { + return &SKKEnvironment::PreConversion; + } + + // è£?????以å????å±¥æ???»¢?????+ return State::DeepForward(&SKKEnvironment::EntryInput); +} + +// ====================================================================== +// level 1ï¼??è£????+// ====================================================================== +State SKKEnvironment::SelectCandidate(const Event& event) { + switch(event) { + case INIT_EVENT: + return State::ShallowHistory(&SKKEnvironment::Inline); + + case EXIT_EVENT: + return State::SaveHistory(); + + case SKK_ENTER: + return controller_->HandleEnter(); + + case SKK_JMODE: + return controller_->HandleJmode(); + + case SKK_CANCEL: + return State::DeepHistory(&SKKEnvironment::EntryInput); + + case SKK_CHAR: + return State::Forward(&SKKEnvironment::KanaInput); + } + + return &SKKEnvironment::TopState; +} + +// ====================================================================== +// level 2 (sub of SelectCandidate)ï¼???³ã??¤ã?è¡?¤º +// ====================================================================== +State SKKEnvironment::Inline(const Event& event) { + const SKKEventParam& param = event.Param(); + + switch(event) { + case ENTRY_EVENT: + controller_->ChangeState(SKK::SingleCandidate); + return 0; + + case SKK_BACKSPACE: + return controller_->HandleBackSpace(); + + case SKK_CHAR: + return controller_->HandleInput(param); + } + + return &SKKEnvironment::SelectCandidate; +} + +// ====================================================================== +// level 2 (sub of SelectCandidate)ï¼???£ã????è¡?¤º +// ====================================================================== +State SKKEnvironment::Window(const Event& event) { + const SKKEventParam& param = event.Param(); + + switch(event) { + case ENTRY_EVENT: + controller_->ChangeState(SKK::MultipleCandidate); + return 0; + + case EXIT_EVENT: + return 0; + + case SKK_BACKSPACE: + return controller_->HandleBackSpace();; + + case SKK_CHAR: + return controller_->HandleInput(param); + } + + return &SKKEnvironment::SelectCandidate; +} + +// ====================================================================== +// level 1ï¼??èª????+// ====================================================================== +State SKKEnvironment::EntryRemove(const Event& event) { + const SKKEventParam& param = event.Param(); + + switch(event) { + case ENTRY_EVENT: + controller_->ChangeState(SKK::EntryRemove); + return 0; + + case SKK_YES: + return State::Transition(&SKKEnvironment::KanaInput); + + case SKK_CANCEL: + case SKK_NO: + return State::Transition(&SKKEnvironment::Inline); + + case SKK_ENTER: + return controller_->HandleEnter(); + + case SKK_BACKSPACE: + return controller_->HandleBackSpace(); + + case SKK_CHAR: + return controller_->HandleInput(param); + } + + return &SKKEnvironment::TopState; +} Index: AquaSKK/src/statemachine/SKKEnvironment.h diff -u /dev/null AquaSKK/src/statemachine/SKKEnvironment.h:1.1.2.1 --- /dev/null Sun Sep 2 12:36:26 2007 +++ AquaSKK/src/statemachine/SKKEnvironment.h Sun Sep 2 12:36:25 2007 @@ -0,0 +1,83 @@ +/* -*- C++ -*- + MacOS X implementation of the SKK input method. + + Copyright (C) 2007 Tomotaka SUWA + + 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 "GenericStateMachine.h" +#include "SKKEventParam.h" +#include "SKKEventResult.h" + +using namespace statemachinecxx_sourceforge_jp; + +class SKKController; + +// å®???°å? +class SKKEnvironment { + SKKController* controller_; + +public: + DECLARE_StateContainer(SKKEnvironment, SKKEventParam, SKKEventResult, KanaInput); + + SKKEnvironment(); + ~SKKEnvironment(); + + const Output& Result() const; + + // 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); +}; + +#endif Index: AquaSKK/src/statemachine/SKKEventResult.cpp diff -u /dev/null AquaSKK/src/statemachine/SKKEventResult.cpp:1.1.2.1 --- /dev/null Sun Sep 2 12:36:26 2007 +++ AquaSKK/src/statemachine/SKKEventResult.cpp Sun Sep 2 12:36:25 2007 @@ -0,0 +1,35 @@ +/* -*- C++ -*- + MacOS X implementation of the SKK input method. + + Copyright (C) 2007 Tomotaka SUWA + + 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 "SKKEventResult.h" + +SKKEventResult::SKKEventResult() : impl_(new SKKEventResultImpl()) {} + +SKKEventResult::SKKEventResult(const SKKEventResult&) : impl_(new SKKEventResultImpl()) {} + +void SKKEventResult::Update() { + impl_->Update(); +} + +bool SKKEventResult::EventIsHandled() const { + // const ?¡ã????????§ã?????³ã?çµ???§å????è£???¶æ??????+ return impl_->TestAndReset(); + // ???å®????????????????»£?¿æ????è¨???????+} Index: AquaSKK/src/statemachine/SKKEventResult.h diff -u /dev/null AquaSKK/src/statemachine/SKKEventResult.h:1.1.2.1 --- /dev/null Sun Sep 2 12:36:26 2007 +++ AquaSKK/src/statemachine/SKKEventResult.h Sun Sep 2 12:36:25 2007 @@ -0,0 +1,64 @@ +/* -*- C++ -*- + MacOS X implementation of the SKK input method. + + Copyright (C) 2007 Tomotaka SUWA + + 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__SKKEventResult__ +#define INC__SKKEventResult__ + +#include + +// ???å®?? +class SKKEventResultImpl { + bool handled_; + bool backup_; + +public: + SKKEventResultImpl() : handled_(false), backup_(false) {} + ~SKKEventResultImpl() {} + + void Update() { + handled_ = !backup_; + } + + // separate query from modifier ???????????+ bool TestAndReset() { + bool ret = handled_ == backup_; + + backup_ = handled_; + + return ret; + } +}; + +// ???çµ?? +class SKKEventResult { + std::auto_ptr impl_; + +public: + SKKEventResult(); + SKKEventResult(const SKKEventResult& src); + + // ?¤ã??³ã??????????????¼ã??ºã? + void Update(); + + // ?¤ã??³ã????????????? + bool EventIsHandled() const; +}; + +#endif From t-suwa ¡÷ users.sourceforge.jp Sun Sep 2 12:36:25 2007 From: t-suwa ¡÷ users.sourceforge.jp (t-suwa ¡÷ users.sourceforge.jp) Date: Sun, 02 Sep 2007 12:36:25 +0900 Subject: [aquaskk-changes 354] CVS update: AquaSKK/src/context Message-ID: <1188704185.234797.4839.nullmailer@users.sourceforge.jp> Index: AquaSKK/src/context/SKKContext.cpp diff -u /dev/null AquaSKK/src/context/SKKContext.cpp:1.1.2.1 --- /dev/null Sun Sep 2 12:36:25 2007 +++ AquaSKK/src/context/SKKContext.cpp Sun Sep 2 12:36:25 2007 @@ -0,0 +1,40 @@ +/* -*- C++ -*- + $Id: SKKContext.cpp,v 1.1.2.1 2007/09/02 03:36:25 t-suwa Exp $ + + MacOS X implementation of the SKK input method. + + Copyright (C) 2007 Tomotaka SUWA + + 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 "SKKContext.h" + +SKKContext::SKKContext() { +} + +SKKContext::SKKContext(const std::string& prompt) : prompt_(prompt_) { +} + +SKKContext::SKKContext(const SKKContext& src) : prompt_(src.prompt_), result_(src.result_) { +} + +const SKKEventResult& SKKContext::Result() const { + return result_; +} + +const std::string& SKKContext::Prompt() const { + return prompt_; +} Index: AquaSKK/src/context/SKKContext.h diff -u /dev/null AquaSKK/src/context/SKKContext.h:1.1.2.1 --- /dev/null Sun Sep 2 12:36:25 2007 +++ AquaSKK/src/context/SKKContext.h Sun Sep 2 12:36:25 2007 @@ -0,0 +1,43 @@ +/* -*- C++ -*- + MacOS X implementation of the SKK input method. + + Copyright (C) 2007 Tomotaka SUWA + + 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 +#include "SKKEventResult.h" + +// ?¥å??³ã?????¹ã? +class SKKContext { + std::string prompt_; // ?»é?????ºã?èª?+ SKKEventResult result_; + +public: + SKKContext(); + SKKContext(const std::string& prompt); + SKKContext(const SKKContext& src); + + // ???çµ?? + const SKKEventResult& Result() const; + + const std::string& Prompt() const; +}; + +#endif From t-suwa ¡÷ users.sourceforge.jp Sun Sep 2 12:36:25 2007 From: t-suwa ¡÷ users.sourceforge.jp (t-suwa ¡÷ users.sourceforge.jp) Date: Sun, 02 Sep 2007 12:36:25 +0900 Subject: [aquaskk-changes 355] CVS update: AquaSKK/src/keybindings Message-ID: <1188704185.896628.4882.nullmailer@users.sourceforge.jp> Index: AquaSKK/src/keybindings/SKKEventParam.h diff -u AquaSKK/src/keybindings/SKKEventParam.h:1.1.2.1 AquaSKK/src/keybindings/SKKEventParam.h:1.1.2.2 --- AquaSKK/src/keybindings/SKKEventParam.h:1.1.2.1 Sun Aug 26 01:34:45 2007 +++ AquaSKK/src/keybindings/SKKEventParam.h Sun Sep 2 12:36:25 2007 @@ -29,14 +29,14 @@ SKK_NULL = statemachinecxx_sourceforge_jp::USER_EVENT, // ?¡å????????? SKK_JMODE, // Ctrl-J SKK_ENTER, // Ctrl-M + SKK_CANCEL, // Ctrl-G SKK_BACKSPACE, // Ctrl-H SKK_DELETE, // Ctrl-D SKK_TAB, // Ctrl-I - SKK_CANCEL, // Ctrl-G SKK_PASTE, // Ctrl-Y SKK_LEFT, // ??- SKK_UP, // ?? SKK_RIGHT, // ??+ SKK_UP, // ?? SKK_DOWN, // ?? SKK_CHAR, // ???ä»?????????¥å? SKK_YES, // ä»???¤ã??³ã? @@ -106,14 +106,14 @@ "SKK_NULL", "SKK_JMODE", "SKK_ENTER", + "SKK_CANCEL", "SKK_BACKSPACE", "SKK_DELETE", "SKK_TAB", - "SKK_CANCEL", "SKK_PASTE", "SKK_LEFT", - "SKK_UP", "SKK_RIGHT", + "SKK_UP", "SKK_DOWN", "SKK_CHAR", "SKK_YES", Index: AquaSKK/src/keybindings/SKKKeymapEntry.cpp diff -u AquaSKK/src/keybindings/SKKKeymapEntry.cpp:1.1.2.1 AquaSKK/src/keybindings/SKKKeymapEntry.cpp:1.1.2.2 --- AquaSKK/src/keybindings/SKKKeymapEntry.cpp:1.1.2.1 Sun Aug 26 01:34:45 2007 +++ AquaSKK/src/keybindings/SKKKeymapEntry.cpp Sun Sep 2 12:36:25 2007 @@ -38,14 +38,14 @@ } KeymapTable[] = { { "SKK_JMODE", SKK_JMODE, TYPE_EVENT }, { "SKK_ENTER", SKK_ENTER, TYPE_EVENT }, + { "SKK_CANCEL", SKK_CANCEL, TYPE_EVENT }, { "SKK_BACKSPACE", SKK_BACKSPACE, TYPE_EVENT }, { "SKK_DELETE", SKK_DELETE, 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_UP", SKK_UP, TYPE_EVENT }, { "SKK_DOWN", SKK_DOWN, TYPE_EVENT }, { "SKK_CHAR", SKK_CHAR, TYPE_EVENT }, { "SKK_YES", SKK_YES, TYPE_EVENT }, Index: AquaSKK/src/keybindings/keymap.conf diff -u AquaSKK/src/keybindings/keymap.conf:1.1.2.1 AquaSKK/src/keybindings/keymap.conf:1.1.2.2 --- AquaSKK/src/keybindings/keymap.conf:1.1.2.1 Sun Aug 26 01:34:45 2007 +++ AquaSKK/src/keybindings/keymap.conf Sun Sep 2 12:36:25 2007 @@ -8,16 +8,16 @@ SKK_JMODE ctrl::j SKK_ENTER group::hex::0x03,0x0a,0x0d||ctrl::m -SKK_TAB hex::0x09||ctrl::i +SKK_CANCEL ctrl::g SKK_BACKSPACE hex::0x08 SKK_BACKSPACE ctrl::h SKK_DELETE hex::0x7f||ctrl::d -SKK_CANCEL ctrl::g +SKK_TAB hex::0x09||ctrl::i SKK_PASTE ctrl::y SKK_LEFT hex::0x1c||ctrl::b SKK_RIGHT hex::0x1d||ctrl::f -SKK_UP hex::0x1e||ctrl::p -SKK_DOWN hex::0x1f||ctrl::n +SKK_UP hex::0x1e||ctrl::p||ctrl::a +SKK_DOWN hex::0x1f||ctrl::n||ctrl::e # ====================================================================== # attribute section(for SKK_CHAR) From t-suwa ¡÷ users.sourceforge.jp Sun Sep 2 12:36:25 2007 From: t-suwa ¡÷ users.sourceforge.jp (t-suwa ¡÷ users.sourceforge.jp) Date: Sun, 02 Sep 2007 12:36:25 +0900 Subject: [aquaskk-changes 356] CVS update: AquaSKK/src/controller Message-ID: <1188704185.458201.4854.nullmailer@users.sourceforge.jp> Index: AquaSKK/src/controller/SKKController.cpp diff -u /dev/null AquaSKK/src/controller/SKKController.cpp:1.1.2.1 --- /dev/null Sun Sep 2 12:36:25 2007 +++ AquaSKK/src/controller/SKKController.cpp Sun Sep 2 12:36:25 2007 @@ -0,0 +1,136 @@ +/* -*- C++ -*- + + MacOS X implementation of the SKK input method. + + Copyright (C) 2007 Tomotaka SUWA + + 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 "SKKController.h" +#include "SKKSubController.h" + +typedef SKKController::Event Event; +typedef SKKController::State State; +typedef SKKController::Handler Handler; +typedef SKKController::Output Output; + +static SKKEventParam dummy; + +SKKController::SKKController() { + // ????¤ã????????¿ã???? + stack_.push_back(SKKEditor()); +} + +// ???çµ?? +const Output& SKKController::Result() const { + return editor().Result(); +} + +// ????¥å???? +State SKKController::HandleInput(const SKKEventParam& param) { + return invoke(&SKKEditor::HandleInput, param); +} + +State SKKController::HandleJmode() { + return invoke(&SKKEditor::HandleJmode, dummy); +} + +State SKKController::HandleEnter() { + return invoke(&SKKEditor::HandleEnter, dummy); +} + +State SKKController::HandleCancel() { + return invoke(&SKKEditor::HandleCancel, dummy); +} + +State SKKController::HandleBackSpace() { + return invoke(&SKKEditor::HandleBackSpace, dummy); +} + +State SKKController::HandleDelete() { + return invoke(&SKKEditor::HandleDelete, dummy); +} + +State SKKController::HandleTab() { + return invoke(&SKKEditor::HandleTab, dummy); +} + +State SKKController::HandlePaste() { + return invoke(&SKKEditor::HandlePaste, dummy); +} + +State SKKController::HandleCursorLeft() { + return invoke(&SKKEditor::HandleCursorLeft, dummy); +} + +State SKKController::HandleCursorRight() { + return invoke(&SKKEditor::HandleCursorRight, dummy); +} + +State SKKController::HandleCursorUp() { + return invoke(&SKKEditor::HandleCursorUp, dummy); +} + +State SKKController::HandleCursorDown() { + return invoke(&SKKEditor::HandleCursorDown, dummy); +} + +// ?¥å??¢ã??????+void SKKController::SelectInputMode(SKK::InputMode mode) { + editor().SelectInputMode(mode); +} + +// ????¶æ?å¤?? +void SKKController::ChangeState(SKK::EditState state) { + editor().ChangeState(state); +} + +// ?»é???? +void SKKController::BeginRegistration(const std::string& prompt) { + stack_.push_back(SKKEditor(prompt)); +} + +// ?»é?çµ?? +void SKKController::EndRegistration(bool commit) { + if(stack_.size() == 1) return; + + std::string result = editor().EditString(); + + stack_.pop_back(); + + if(commit) { + editor().Commit(result); + } +} + +// ====================================================================== +// private method +// ====================================================================== +SKKEditor& SKKController::editor() { + return stack_.back(); +} + +const SKKEditor& SKKController::editor() const { + return stack_.back(); +} + +State SKKController::invoke(SKKEditor::Handler handler, const SKKEventParam& param) { + // SKKEditor.HandleXXX ??µ·?????+ std::auto_ptr sub((editor().*handler)(param)); + + // ???????????? + return sub->Apply(*this); +} Index: AquaSKK/src/controller/SKKController.h diff -u /dev/null AquaSKK/src/controller/SKKController.h:1.1.2.1 --- /dev/null Sun Sep 2 12:36:25 2007 +++ AquaSKK/src/controller/SKKController.h Sun Sep 2 12:36:25 2007 @@ -0,0 +1,77 @@ +/* -*- C++ -*- + $Id: SKKController.h,v 1.1.2.1 2007/09/02 03:36:25 t-suwa Exp $ + + MacOS X implementation of the SKK input method. + + Copyright (C) 2007 Tomotaka SUWA + + 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__SKKController__ +#define INC__SKKController__ + +#include +#include +#include "SKK.h" +#include "SKKEventParam.h" +#include "SKKEnvironment.h" +#include "SKKEditor.h" + +struct SKKController { + typedef SKKEnvironment::State State; + typedef SKKEnvironment::Event Event; + typedef SKKEnvironment::Handler Handler; + typedef SKKEnvironment::Output Output; + + SKKController(); + + // ???çµ?? + const Output& Result() const; + + // ????¥å???? + State HandleInput(const SKKEventParam& param); + State HandleJmode(); + State HandleEnter(); + State HandleCancel(); + State HandleBackSpace(); + State HandleDelete(); + State HandleTab(); + State HandlePaste(); + State HandleCursorLeft(); + State HandleCursorRight(); + State HandleCursorUp(); + State HandleCursorDown(); + + // ?¥å??¢ã??????+ void SelectInputMode(SKK::InputMode); + + // ????¶æ?å¤?? + void ChangeState(SKK::EditState); + + // ??¸°????¸ç???+ void BeginRegistration(const std::string& prompt); + void EndRegistration(bool commit); + +private: + std::vector stack_; + + SKKEditor& editor(); + const SKKEditor& editor() const; + + State invoke(SKKEditor::Handler handler, const SKKEventParam& param); +}; + +#endif Index: AquaSKK/src/controller/SKKEmptySubController.cpp diff -u /dev/null AquaSKK/src/controller/SKKEmptySubController.cpp:1.1.2.1 --- /dev/null Sun Sep 2 12:36:25 2007 +++ AquaSKK/src/controller/SKKEmptySubController.cpp Sun Sep 2 12:36:25 2007 @@ -0,0 +1,29 @@ +/* -*- C++ -*- + + MacOS X implementation of the SKK input method. + + Copyright (C) 2007 Tomotaka SUWA + + 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 "SKKEmptySubController.h" + +SKKEmptySubController::SKKEmptySubController(State target) : state_(target) { +} + +SKKEmptySubController::State SKKEmptySubController::Apply(SKKController&) { + return state_; +} Index: AquaSKK/src/controller/SKKEmptySubController.h diff -u /dev/null AquaSKK/src/controller/SKKEmptySubController.h:1.1.2.1 --- /dev/null Sun Sep 2 12:36:25 2007 +++ AquaSKK/src/controller/SKKEmptySubController.h Sun Sep 2 12:36:25 2007 @@ -0,0 +1,39 @@ +/* -*- C++ -*- + + MacOS X implementation of the SKK input method. + + Copyright (C) 2007 Tomotaka SUWA + + 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__SKKEmptySubController__ +#define INC__SKKEmptySubController__ + +#include "SKKSubController.h" + +// 空ã???????????¿ã? +class SKKEmptySubController : public SKKSubController { + State state_; + + SKKEmptySubController(); + +public: + SKKEmptySubController(State target); + + virtual State Apply(SKKController& controller); +}; + +#endif Index: AquaSKK/src/controller/SKKSubController.h diff -u /dev/null AquaSKK/src/controller/SKKSubController.h:1.1.2.1 --- /dev/null Sun Sep 2 12:36:25 2007 +++ AquaSKK/src/controller/SKKSubController.h Sun Sep 2 12:36:25 2007 @@ -0,0 +1,37 @@ +/* -*- C++ -*- + + MacOS X implementation of the SKK input method. + + Copyright (C) 2007 Tomotaka SUWA + + 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__SKKSubController__ +#define INC__SKKSubController__ + +#include "SKKController.h" + +// SKKController ???????¥ã??¼ã???+struct SKKSubController { + typedef SKKController::State State; + typedef SKKController::Event Event; + typedef SKKController::Handler Handler; + typedef SKKController::Output Output; + + virtual State Apply(SKKController& controller) = 0; +}; + +#endif From t-suwa ¡÷ users.sourceforge.jp Sun Sep 2 12:36:24 2007 From: t-suwa ¡÷ users.sourceforge.jp (t-suwa ¡÷ users.sourceforge.jp) Date: Sun, 02 Sep 2007 12:36:24 +0900 Subject: [aquaskk-changes 357] CVS update: AquaSKK/proj Message-ID: <1188704184.515936.4811.nullmailer@users.sourceforge.jp> Index: AquaSKK/proj/AquaSKKInputMethod-Info.plist diff -u AquaSKK/proj/AquaSKKInputMethod-Info.plist:1.1.2.3 AquaSKK/proj/AquaSKKInputMethod-Info.plist:1.1.2.4 --- AquaSKK/proj/AquaSKKInputMethod-Info.plist:1.1.2.3 Sun Aug 26 01:34:44 2007 +++ AquaSKK/proj/AquaSKKInputMethod-Info.plist Sun Sep 2 12:36:24 2007 @@ -15,11 +15,11 @@ CFBundlePackageType thng CFBundleShortVersionString - brand-new-engine 0.2 + brand-new-engine 0.3 CFBundleSignature askk CFBundleVersion - 2007-08-26 + 2007-09-02 CSResourcesFileMapped yes tsInputMethodIconFileKey Index: AquaSKK/proj/AquaSKKServer-Info.plist diff -u AquaSKK/proj/AquaSKKServer-Info.plist:1.1.2.3 AquaSKK/proj/AquaSKKServer-Info.plist:1.1.2.4 --- AquaSKK/proj/AquaSKKServer-Info.plist:1.1.2.3 Sun Aug 26 01:34:44 2007 +++ AquaSKK/proj/AquaSKKServer-Info.plist Sun Sep 2 12:36:24 2007 @@ -15,11 +15,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - brand-new-engine 0.2 + brand-new-engine 0.3 CFBundleSignature askk CFBundleVersion - 2007-08-26 + 2007-09-02 NSMainNibFile Principal NSPrincipalClass From t-suwa ¡÷ users.sourceforge.jp Sun Sep 2 12:36:24 2007 From: t-suwa ¡÷ users.sourceforge.jp (t-suwa ¡÷ users.sourceforge.jp) Date: Sun, 02 Sep 2007 12:36:24 +0900 Subject: [aquaskk-changes 358] CVS update: AquaSKK/proj/AquaSKK.xcodeproj Message-ID: <1188704184.811591.4819.nullmailer@users.sourceforge.jp> Index: AquaSKK/proj/AquaSKK.xcodeproj/project.pbxproj diff -u AquaSKK/proj/AquaSKK.xcodeproj/project.pbxproj:1.1.2.3 AquaSKK/proj/AquaSKK.xcodeproj/project.pbxproj:1.1.2.4 --- AquaSKK/proj/AquaSKK.xcodeproj/project.pbxproj:1.1.2.3 Sun Aug 26 01:34:44 2007 +++ AquaSKK/proj/AquaSKK.xcodeproj/project.pbxproj Sun Sep 2 12:36:24 2007 @@ -8,6 +8,13 @@ /* Begin PBXBuildFile section */ D313A5270C808483006DA355 /* SKKKeymapEntry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D313A5240C808483006DA355 /* SKKKeymapEntry.cpp */; }; + D324B2040C80FF1C00E86DDA /* SKKEnvironment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D324B1FF0C80FF1C00E86DDA /* SKKEnvironment.cpp */; }; + D324B2100C8A47C900E86DDA /* SKKEventResult.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D324B20E0C8A47C900E86DDA /* SKKEventResult.cpp */; }; + D324B2170C8A487E00E86DDA /* SKKController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D324B2120C8A487E00E86DDA /* SKKController.cpp */; }; + D324B2190C8A487E00E86DDA /* SKKEmptySubController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D324B2140C8A487E00E86DDA /* SKKEmptySubController.cpp */; }; + D324B22C0C8A498C00E86DDA /* SKKDirectInputState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D324B2270C8A498C00E86DDA /* SKKDirectInputState.cpp */; }; + D324B22E0C8A498C00E86DDA /* SKKEditor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D324B2290C8A498C00E86DDA /* SKKEditor.cpp */; }; + D324B2330C8A49C500E86DDA /* SKKContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D324B2310C8A49C500E86DDA /* SKKContext.cpp */; }; D3416B9F0C7DC65300E845F8 /* SKKPreProcessor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D3416B9A0C7DC65300E845F8 /* SKKPreProcessor.cpp */; }; D34E8D9F0C76B23E001CD839 /* SKK.r in Rez */ = {isa = PBXBuildFile; fileRef = D34E8D990C76B23E001CD839 /* SKK.r */; }; D34E8DA00C76B23E001CD839 /* SKKComponent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D34E8D9A0C76B23E001CD839 /* SKKComponent.cpp */; }; @@ -142,6 +149,23 @@ D313A5240C808483006DA355 /* SKKKeymapEntry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SKKKeymapEntry.cpp; path = ../src/keybindings/SKKKeymapEntry.cpp; sourceTree = SOURCE_ROOT; }; D313A5250C808483006DA355 /* SKKKeymapEntry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SKKKeymapEntry.h; path = ../src/keybindings/SKKKeymapEntry.h; sourceTree = SOURCE_ROOT; }; D313A5260C808483006DA355 /* SKKKeyState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SKKKeyState.h; path = ../src/keybindings/SKKKeyState.h; sourceTree = SOURCE_ROOT; }; + D324B1FE0C80FF1C00E86DDA /* SKKEngine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SKKEngine.h; path = ../src/statemachine/SKKEngine.h; sourceTree = SOURCE_ROOT; }; + D324B1FF0C80FF1C00E86DDA /* SKKEnvironment.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SKKEnvironment.cpp; path = ../src/statemachine/SKKEnvironment.cpp; sourceTree = SOURCE_ROOT; }; + D324B2000C80FF1C00E86DDA /* SKKEnvironment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SKKEnvironment.h; path = ../src/statemachine/SKKEnvironment.h; sourceTree = SOURCE_ROOT; }; + D324B20E0C8A47C900E86DDA /* SKKEventResult.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SKKEventResult.cpp; path = ../src/statemachine/SKKEventResult.cpp; sourceTree = SOURCE_ROOT; }; + D324B20F0C8A47C900E86DDA /* SKKEventResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SKKEventResult.h; path = ../src/statemachine/SKKEventResult.h; sourceTree = SOURCE_ROOT; }; + D324B2120C8A487E00E86DDA /* SKKController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SKKController.cpp; path = ../src/controller/SKKController.cpp; sourceTree = SOURCE_ROOT; }; + D324B2130C8A487E00E86DDA /* SKKController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SKKController.h; path = ../src/controller/SKKController.h; sourceTree = SOURCE_ROOT; }; + D324B2140C8A487E00E86DDA /* SKKEmptySubController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SKKEmptySubController.cpp; path = ../src/controller/SKKEmptySubController.cpp; sourceTree = SOURCE_ROOT; }; + D324B2150C8A487E00E86DDA /* SKKEmptySubController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SKKEmptySubController.h; path = ../src/controller/SKKEmptySubController.h; sourceTree = SOURCE_ROOT; }; + D324B2160C8A487E00E86DDA /* SKKSubController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SKKSubController.h; path = ../src/controller/SKKSubController.h; sourceTree = SOURCE_ROOT; }; + D324B2270C8A498C00E86DDA /* SKKDirectInputState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SKKDirectInputState.cpp; path = ../src/editor/SKKDirectInputState.cpp; sourceTree = SOURCE_ROOT; }; + D324B2280C8A498C00E86DDA /* SKKDirectInputState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SKKDirectInputState.h; path = ../src/editor/SKKDirectInputState.h; sourceTree = SOURCE_ROOT; }; + D324B2290C8A498C00E86DDA /* SKKEditor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SKKEditor.cpp; path = ../src/editor/SKKEditor.cpp; sourceTree = SOURCE_ROOT; }; + D324B22A0C8A498C00E86DDA /* SKKEditor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SKKEditor.h; path = ../src/editor/SKKEditor.h; sourceTree = SOURCE_ROOT; }; + D324B22B0C8A498C00E86DDA /* SKKState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SKKState.h; path = ../src/editor/SKKState.h; sourceTree = SOURCE_ROOT; }; + D324B2310C8A49C500E86DDA /* SKKContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SKKContext.cpp; path = ../src/context/SKKContext.cpp; sourceTree = SOURCE_ROOT; }; + D324B2320C8A49C500E86DDA /* SKKContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SKKContext.h; path = ../src/context/SKKContext.h; sourceTree = SOURCE_ROOT; }; D3416B970C7DC65300E845F8 /* SKKEventParam.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SKKEventParam.h; path = ../src/keybindings/SKKEventParam.h; sourceTree = SOURCE_ROOT; }; D3416B9A0C7DC65300E845F8 /* SKKPreProcessor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SKKPreProcessor.cpp; path = ../src/keybindings/SKKPreProcessor.cpp; sourceTree = SOURCE_ROOT; }; D3416B9B0C7DC65300E845F8 /* SKKPreProcessor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SKKPreProcessor.h; path = ../src/keybindings/SKKPreProcessor.h; sourceTree = SOURCE_ROOT; }; @@ -429,6 +453,8 @@ D37894290C74881E00BE9E85 /* context */ = { isa = PBXGroup; children = ( + D324B2320C8A49C500E86DDA /* SKKContext.h */, + D324B2310C8A49C500E86DDA /* SKKContext.cpp */, ); name = context; sourceTree = ""; @@ -436,6 +462,11 @@ D378942A0C74882600BE9E85 /* controller */ = { isa = PBXGroup; children = ( + D324B2130C8A487E00E86DDA /* SKKController.h */, + D324B2120C8A487E00E86DDA /* SKKController.cpp */, + D324B2160C8A487E00E86DDA /* SKKSubController.h */, + D324B2150C8A487E00E86DDA /* SKKEmptySubController.h */, + D324B2140C8A487E00E86DDA /* SKKEmptySubController.cpp */, ); name = controller; sourceTree = ""; @@ -443,6 +474,11 @@ D378942B0C74882B00BE9E85 /* editor */ = { isa = PBXGroup; children = ( + D324B22A0C8A498C00E86DDA /* SKKEditor.h */, + D324B2290C8A498C00E86DDA /* SKKEditor.cpp */, + D324B22B0C8A498C00E86DDA /* SKKState.h */, + D324B2280C8A498C00E86DDA /* SKKDirectInputState.h */, + D324B2270C8A498C00E86DDA /* SKKDirectInputState.cpp */, ); name = editor; sourceTree = ""; @@ -474,6 +510,11 @@ isa = PBXGroup; children = ( D3416BA10C7DC67600E845F8 /* GenericStateMachine.h */, + D324B1FE0C80FF1C00E86DDA /* SKKEngine.h */, + D324B2000C80FF1C00E86DDA /* SKKEnvironment.h */, + D324B1FF0C80FF1C00E86DDA /* SKKEnvironment.cpp */, + D324B20F0C8A47C900E86DDA /* SKKEventResult.h */, + D324B20E0C8A47C900E86DDA /* SKKEventResult.cpp */, ); name = statemachine; sourceTree = ""; @@ -929,6 +970,13 @@ D3416B9F0C7DC65300E845F8 /* SKKPreProcessor.cpp in Sources */, D3C4FFC00C7EF88E007AE470 /* SKKKeymap.cpp in Sources */, D313A5270C808483006DA355 /* SKKKeymapEntry.cpp in Sources */, + D324B2040C80FF1C00E86DDA /* SKKEnvironment.cpp in Sources */, + D324B2100C8A47C900E86DDA /* SKKEventResult.cpp in Sources */, + D324B2170C8A487E00E86DDA /* SKKController.cpp in Sources */, + D324B2190C8A487E00E86DDA /* SKKEmptySubController.cpp in Sources */, + D324B22C0C8A498C00E86DDA /* SKKDirectInputState.cpp in Sources */, + D324B22E0C8A498C00E86DDA /* SKKEditor.cpp in Sources */, + D324B2330C8A49C500E86DDA /* SKKContext.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; From t-suwa ¡÷ users.sourceforge.jp Sun Sep 2 12:52:18 2007 From: t-suwa ¡÷ users.sourceforge.jp (t-suwa ¡÷ users.sourceforge.jp) Date: Sun, 02 Sep 2007 12:52:18 +0900 Subject: [aquaskk-changes 359] CVS update: AquaSKK/src/editor Message-ID: <1188705138.750826.14162.nullmailer@users.sourceforge.jp> Index: AquaSKK/src/editor/SKKEditor.h diff -u AquaSKK/src/editor/SKKEditor.h:1.1.2.1 AquaSKK/src/editor/SKKEditor.h:1.1.2.2 --- AquaSKK/src/editor/SKKEditor.h:1.1.2.1 Sun Sep 2 12:36:25 2007 +++ AquaSKK/src/editor/SKKEditor.h Sun Sep 2 12:52:18 2007 @@ -29,7 +29,7 @@ class SKKEventParam; class SKKEventResult; -// ÊÔ½¸¥¤¥ó¥¿¥Õ¥§¡¼¥¹ +// ç·???¤ã??¿ã??§ã??? class SKKEditor { SKKContext context_; SKKState* state_; @@ -37,17 +37,17 @@ void initialize(); public: - // ¥­¡¼ÆþÎϥϥó¥É¥é¡¼ + // ????¥å???³ã???? typedef SKKSubController* (SKKEditor::*Handler)(const SKKEventParam&); SKKEditor(); SKKEditor(const std::string& prompt); SKKEditor(const SKKEditor& src); - // ½èÍý·ë²Ì + // ???çµ?? const SKKEventResult& Result() const; - // ¥­¡¼ÆþÎϽèÍý + // ????¥å???? SKKSubController* HandleInput(const SKKEventParam& param); SKKSubController* HandleEnter(const SKKEventParam& param); SKKSubController* HandleJmode(const SKKEventParam& param); @@ -61,16 +61,16 @@ SKKSubController* HandleCursorUp(const SKKEventParam& param); SKKSubController* HandleCursorDown(const SKKEventParam& param); - // ÆþÎϥ⡼¥ÉÊѹ¹ + // ?¥å??¢ã?????? void SelectInputMode(SKK::InputMode mode); - // ÆâÉô¾õÂÖÊѹ¹ + // ????¶æ?å¤?? void ChangeState(SKK::EditState state); - // ÊÔ½¸Ê¸»úÎó¤ò¼èÆÀ + // ç·??????????? std::string EditString() const; - // ³ÎÄꤷ¤¿Ê¸»úÎó¤òÈ¿±Ç + // 確å????????????? void Commit(const std::string& word); }; From t-suwa ¡÷ users.sourceforge.jp Sun Sep 2 12:36:25 2007 From: t-suwa ¡÷ users.sourceforge.jp (t-suwa ¡÷ users.sourceforge.jp) Date: Sun, 02 Sep 2007 12:36:25 +0900 Subject: [aquaskk-changes 360] CVS update: AquaSKK/src/component Message-ID: <1188704185.049587.4830.nullmailer@users.sourceforge.jp> Index: AquaSKK/src/component/SKK.h diff -u AquaSKK/src/component/SKK.h:1.1.2.1 AquaSKK/src/component/SKK.h:1.1.2.2 --- AquaSKK/src/component/SKK.h:1.1.2.1 Sun Aug 19 19:00:32 2007 +++ AquaSKK/src/component/SKK.h Sun Sep 2 12:36:24 2007 @@ -1,5 +1,5 @@ /* -*- C++ -*- - $Id: SKK.h,v 1.1.2.1 2007/08/19 10:00:32 t-suwa Exp $ + $Id: SKK.h,v 1.1.2.2 2007/09/02 03:36:24 t-suwa Exp $ MacOS X implementation of the SKK input method. @@ -31,6 +31,17 @@ Jisx0208Latin, Ascii }; + + enum EditState { + DirectInput, + EntryInput, + OkuriInput, + AbbrevInput, + Completion, + SingleCandidate, + MultipleCandidate, + EntryRemove + }; } #endif Index: AquaSKK/src/component/SKKSession.cpp diff -u AquaSKK/src/component/SKKSession.cpp:1.1.2.2 AquaSKK/src/component/SKKSession.cpp:1.1.2.3 --- AquaSKK/src/component/SKKSession.cpp:1.1.2.2 Sun Aug 26 01:34:45 2007 +++ AquaSKK/src/component/SKKSession.cpp Sun Sep 2 12:36:24 2007 @@ -1,5 +1,5 @@ /* -*- C++ -*- - $Id: SKKSession.cpp,v 1.1.2.2 2007/08/25 16:34:45 t-suwa Exp $ + $Id: SKKSession.cpp,v 1.1.2.3 2007/09/02 03:36:24 t-suwa Exp $ MacOS X implementation of the SKK input method. @@ -29,6 +29,7 @@ #include "SKKConfig.h" SKKSession::SKKSession(const ComponentInstance instance) : instance_(instance) { + engine_.Start(); } // ?¤ã??³ã? @@ -36,6 +37,8 @@ SKKEventParam param = SKKPreProcessor::theInstance().Execute(event); std::cerr << param.dump() << std::endl; + engine_.Dispatch(Event(param.event, param)); + // ????·ã?????¸ã? SKKEvent legacy_event(event); @@ -66,38 +69,48 @@ // ?¥å??¢ã?????? void SKKSession::SelectInputMode(SKK::InputMode mode) { + SKKEventParam param; + // ?¥å??¢ã????å¤????? switch(mode) { case SKK::Hirakana: + param.event = SKK_HIRAKANA; if(!legacy_.isHiraganaInputMode()) { legacy_.goHiraganaInputMode(); } break; case SKK::Katakana: + param.event = SKK_KATAKANA; if(!legacy_.isZenKataInputMode()) { legacy_.goZenKataInputMode(); } break; case SKK::Jisx0201Kana: + param.event = SKK_JISX0201KANA; if(!legacy_.isHanKataInputMode()) { legacy_.goHanKataInputMode(); } break; case SKK::Jisx0208Latin: + param.event = SKK_JISX0208LATIN; if(!legacy_.isZenAscInputMode()) { legacy_.goZenAscInputMode(); } break; case SKK::Ascii: + param.event = SKK_ASCII; if(!legacy_.isHanAscInputMode()) { legacy_.goHanAscInputMode(); } break; } + + // ?°ã??³ã??³ã??¥å??¢ã??????+ engine_.Dispatch(Event(param.event, param)); } Point SKKSession::GetInputPosition(long offset) const { Index: AquaSKK/src/component/SKKSession.h diff -u AquaSKK/src/component/SKKSession.h:1.1.2.1 AquaSKK/src/component/SKKSession.h:1.1.2.2 --- AquaSKK/src/component/SKKSession.h:1.1.2.1 Sun Aug 19 19:00:32 2007 +++ AquaSKK/src/component/SKKSession.h Sun Sep 2 12:36:24 2007 @@ -1,5 +1,5 @@ /* -*- C++ -*- - $Id: SKKSession.h,v 1.1.2.1 2007/08/19 10:00:32 t-suwa Exp $ + $Id: SKKSession.h,v 1.1.2.2 2007/09/02 03:36:24 t-suwa Exp $ MacOS X implementation of the SKK input method. @@ -28,9 +28,11 @@ #include "SKK.h" #include "SKKEvent.h" #include "IMSessionInputMode.h" +#include "SKKEngine.h" -class SKKSession { +class SKKSession : StateContainerTraits { ComponentInstance instance_; + SKKEngine engine_; IMSessionInputMode legacy_; struct buffer_size { From t-suwa ¡÷ users.sourceforge.jp Thu Sep 6 21:13:23 2007 From: t-suwa ¡÷ users.sourceforge.jp (t-suwa ¡÷ users.sourceforge.jp) Date: Thu, 06 Sep 2007 21:13:23 +0900 Subject: [aquaskk-changes 361] CVS update: htdocs/images Message-ID: <1189080803.988608.6815.nullmailer@users.sourceforge.jp> Index: htdocs/images/ManipulatorPattern.png From t-suwa ¡÷ users.sourceforge.jp Sat Sep 8 22:35:18 2007 From: t-suwa ¡÷ users.sourceforge.jp (t-suwa ¡÷ users.sourceforge.jp) Date: Sat, 08 Sep 2007 22:35:18 +0900 Subject: [aquaskk-changes 362] CVS update: AquaSKK/src/context Message-ID: <1189258518.989115.8059.nullmailer@users.sourceforge.jp> Index: AquaSKK/src/context/SKKRomanKanaConverter.cpp diff -u /dev/null AquaSKK/src/context/SKKRomanKanaConverter.cpp:1.1.2.1 --- /dev/null Sat Sep 8 22:35:18 2007 +++ AquaSKK/src/context/SKKRomanKanaConverter.cpp Sat Sep 8 22:35:18 2007 @@ -0,0 +1,240 @@ +/* -*- C++ -*- + MacOS X implementation of the SKK input method. + + Copyright (C) 2007 Tomotaka SUWA + + 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 +#include +#include +#include +#include "jconv.h" +#include "SKKRomanKanaConverter.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); + } + } +} + +// ====================================================================== +// SKKRomanKanaConverter::Node ?¤ã??¿ã??§ã???+// ====================================================================== +class SKKRomanKanaConverter::Node { + std::string hirakana_; + std::string katakana_; + std::string jisx0201kana_; + std::string next_; + + std::map children_; + +public: + Node() {} + Node(const std::string& hirakana, const std::string& katakana, + const std::string& jisx0201kana, const std::string& next) + : hirakana_(hirakana), katakana_(katakana), jisx0201kana_(jisx0201kana), next_(next) {} + + // ?????+ void Clear() { + children_.clear(); + } + + // ?????¿½??+ void Add(const std::string& str, const Node& node, int depth = 0) { + // ?????? + if(str.size() - 1 == depth) { + children_[str[depth]] = node; + } else { + children_[str[depth]].Add(str, node, depth + 1); // ??¸°è¿½å? + } + } + + // ??????ç´?+ const Node* Traverse(const std::string& str, int& match_length, int depth = 0) { + // [1] ????¿ä?è¶?ex. "k" ??"ch" ???) + if(depth == str.size()) { + match_length = 0; + return 0; + } + + // ä¸??ï¼?+ if(children_.find(str[depth]) != children_.end()) { + Node& leaf = children_[str[depth]]; + + // ????§ã???????帰æ?ç´?+ if(!leaf.children_.empty()) { + return leaf.Traverse(str, match_length, depth + 1); + } + + // [2] å®??ä¸?? + match_length = depth + 1; + return &leaf; + } + + // [3] ???ä¸??(ex. "kb" ??"chm" ???) + if(0 < depth) { + match_length = depth; + + // ç¯???¤è??§ã?????????????????????ä¸??????????+ if(!hirakana_.empty()) { + return this; + } + + return 0; + } + + // [4] ???ä¸??????????+ match_length = -1; + return 0; + } + + // ??????å­????? + const std::string& KanaString(SKK::InputMode mode) const { + switch(mode) { + case SKK::Hirakana: + return hirakana_; + + case SKK::Katakana: + return katakana_; + + case SKK::Jisx0201Kana: + return jisx0201kana_; + + default: + std::cerr << "SKKRomanKanaConverter::Node::KanaString(): invalid mode [" << mode << "]" << std::endl; + break; + } + } + + // 次ç????å­????? + const std::string& NextState() const { + return next_; + } +}; + +// ====================================================================== +// SKKRomanKanaConverter ?¤ã??¿ã??§ã???+// ====================================================================== +SKKRomanKanaConverter& SKKRomanKanaConverter::theInstance() { + static Node root; + static SKKRomanKanaConverter obj(root); + return obj; +} + +// Node ????³ã?????¼ã????????????????è£?+SKKRomanKanaConverter::SKKRomanKanaConverter(Node& node) : root_(node) { +} + +void SKKRomanKanaConverter::Initialize(const std::string& path) { + std::ifstream rule(path.c_str()); + std::string str; + + if(!rule) { + std::cerr << "SKKRomanKanaConverter::Initialize(): can't open file [" << path << "]" << std::endl; + return; + } + + // ?????+ root_.Clear(); + + while(std::getline(rule, 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::istringstream buf(utf8); + + // å¤????¼ã??????+ std::string label, hirakana, katakana, jisx0201kana, next; + if(buf >> label >> hirakana >> katakana >> jisx0201kana) { + // ????·ã??³ã?次ç????èª?? + buf >> next; + + // ????±ã????å­??????»ã? + unescape_string(label); + unescape_string(hirakana); + unescape_string(katakana); + unescape_string(jisx0201kana); + unescape_string(next); + + // 追å? + root_.Add(label, Node(hirakana, katakana, jisx0201kana, next)); + } else { + // ä¸????½¢å¼? std::cerr << "SKKRomanKanaConverter::Initialize(): invalid rule [" << utf8 << "]" << std::endl; + } + } +} + +bool SKKRomanKanaConverter::Execute(SKK::InputMode mode, const std::string& in, std::string& out, std::string& next) { + bool converted = false; + std::string str(in); + + out.clear(); + next.clear(); + + while(!str.empty()) { + int match_length; + const Node* node = root_.Traverse(str, match_length); + + // å¤??????ï¼?+ if(node) { + out += node->KanaString(mode); + next = node->NextState(); + converted = true; + } else { + converted = false; + } + + // ??????ä¸????????????¼ã?ä¸?¶³????????»¥ä¸??????????+ if(!match_length) { + next = str; + return false; + } + + // ?????????????´ã?????´å????????³ã??¼ã???????å­??調ã???+ if(match_length < 0) { + out += str[0]; + match_length = 1; + } + + // ä¸?????????????????????å­??調ã???+ str = str.substr(match_length); + } + + return converted; +} Index: AquaSKK/src/context/SKKRomanKanaConverter.h diff -u /dev/null AquaSKK/src/context/SKKRomanKanaConverter.h:1.1.2.1 --- /dev/null Sat Sep 8 22:35:18 2007 +++ AquaSKK/src/context/SKKRomanKanaConverter.h Sat Sep 8 22:35:18 2007 @@ -0,0 +1,53 @@ +/* -*- C++ -*- + MacOS X implementation of the SKK input method. + + Copyright (C) 2007 Tomotaka SUWA + + 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__SKKRomanKanaConverter__ +#define INC__SKKRomanKanaConverter__ + +#include +#include "SKK.h" + +class SKKRomanKanaConverter { + class Node; + Node& root_; + + SKKRomanKanaConverter(); + SKKRomanKanaConverter(Node& node); + SKKRomanKanaConverter(const SKKRomanKanaConverter&); + +public: + static SKKRomanKanaConverter& theInstance(); + + void Initialize(const std::string& path); + + // ?????????å¤??+ // + // å¼??ï¼?+ // in=???????????+ // out=çµ???????å¤??????????è¨??????????????) + // next=次ç????å­?? + // + // ?»ã??¤ï? + // true=å¤????????alse=å¤???????????+ // + bool Execute(SKK::InputMode mode, const std::string& in, std::string& out, std::string& next); +}; + +#endif Index: AquaSKK/src/context/kana-rule-list diff -u /dev/null AquaSKK/src/context/kana-rule-list:1.1.2.1 --- /dev/null Sat Sep 8 22:35:18 2007 +++ AquaSKK/src/context/kana-rule-list Sat Sep 8 22:35:18 2007 @@ -0,0 +1,276 @@ +# $Id: kana-rule-list,v 1.1.2.1 2007/09/08 13:35:18 t-suwa Exp $ + +# ¤³¤Î¥Õ¥¡¥¤¥ë¤Ï²þ¹Ô¥³¡¼¥É¤¬LF¡¢Ê¸»ú¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°¤¬EUC-JP¤Ç¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡£ +# ¸Þ¤ÄÌܤιàÌܤϼ¡¾õÂ֤Ǥ¹¡£Ìµ¤±¤ì¤Ð¹àÌܼ«ÂΤò¾Êά¤·¤Þ¤¹¡£ +# ¥¨¥ó¥È¥ê¤Î½ç½ø¤Ë¤Ïµ¤¤òÉÕ¤±¤Æ²¼¤µ¤¤¡£Î㤨¤Ð¡Öba¡×¤È¤¤¤¦¥¨¥ó¥È¥ê¤Ë½Ð²ñ¤¦¤È¡¢ +# AquaSKK¤Ï¤Þ¤º¡Öb¡×¤È¤¤¤¦»Þ¤òõ¤·¤Þ¤¹¤¬¡¢¤³¤³¤Ç¤Ï¤Þ¤À¸ºß¤·¤Ê¤¤¤Î¤Ç +# ¡Öb¡×¤È¤¤¤¦¶õ¤Î»Þ¤òºîÀ®¤·¤Þ¤¹¡£¤³¤Î¸å¤Ë¡Öb¡×¤È¤¤¤¦¥¨¥ó¥È¥ê¤¬¸½¤ì¤ë¤È +# ¤½¤Î¥¨¥ó¥È¥ê¡Öb¡×¤Ï´û¤ËÄêµÁ¤µ¤ì¤Æ¤¤¤ë¤Î¤Ç¤É¤¦¤Ê¤ë¤«Ê¬¤«¤ê¤Þ¤»¤ó¡£ + +# ºÇ½é¤Î¹àÌܤÎ,¤ÏȾ³Ñ¥«¥ó¥Þ¤ËÃÖ´¹¤µ¤ì¤Þ¤¹¡£ + +a,¤¢,¥¢,Ž± + +bb,¤Ã,¥Ã,Ž¯,b +ba,¤Ð,¥Ð,ŽÊŽÞ +bi,¤Ó,¥Ó,ŽËŽÞ +bu,¤Ö,¥Ö,ŽÌŽÞ +be,¤Ù,¥Ù,ŽÍŽÞ +bo,¤Ü,¥Ü,ŽÎŽÞ +bya,¤Ó¤ã,¥Ó¥ã,ŽËŽÞŽ¬ +byi,¤Ó¤£,¥Ó¥£,ŽËŽÞŽ¨ +byu,¤Ó¤å,¥Ó¥å,ŽËŽÞŽ­ +bye,¤Ó¤§,¥Ó¥§,ŽËŽÞŽª +byo,¤Ó¤ç,¥Ó¥ç,ŽËŽÞŽ® + +cc,¤Ã,¥Ã,Ž¯,c +cha,¤Á¤ã,¥Á¥ã,ŽÁŽ¬ +chi,¤Á,¥Á,ŽÁ +chu,¤Á¤å,¥Á¥å,ŽÁŽ­ +che,¤Á¤§,¥Á¥§,ŽÁŽª +cho,¤Á¤ç,¥Á¥ç,ŽÁŽ® +cya,¤Á¤ã,¥Á¥ã,ŽÁŽ¬ +cyi,¤Á¤£,¥Á¥£,ŽÁŽ¨ +cyu,¤Á¤å,¥Á¥å,ŽÁŽ­ +cye,¤Á¤§,¥Á¥§,ŽÁŽª +cyo,¤Á¤ç,¥Á¥ç,ŽÁŽ® + +dd,¤Ã,¥Ã,Ž¯,d +da,¤À,¥À,ŽÀŽÞ +di,¤Â,¥Â,ŽÁŽÞ +du,¤Å,¥Å,ŽÂŽÞ +de,¤Ç,¥Ç,ŽÃŽÞ +do,¤É,¥É,ŽÄŽÞ +dha,¤Ç¤ã,¥Ç¥ã,ŽÃŽÞŽ¬ +dhi,¤Ç¤£,¥Ç¥£,ŽÃŽÞŽ¨ +dhu,¤Ç¤å,¥Ç¥å,ŽÃŽÞŽ­ +dhe,¤Ç¤§,¥Ç¥§,ŽÃŽÞŽª +dho,¤Ç¤ç,¥Ç¥ç,ŽÃŽÞŽ® +dya,¤Â¤ã,¥Â¥ã,ŽÁŽÞŽ¬ +dyi,¤Â¤£,¥Â¥£,ŽÁŽÞŽ¨ +dyu,¤Â¤å,¥Â¥å,ŽÁŽÞŽ­ +dye,¤Â¤§,¥Â¥§,ŽÁŽÞŽª +dyo,¤Â¤ç,¥Â¥ç,ŽÁŽÞŽ® + +e,¤¨,¥¨,Ž´ + +ff,¤Ã,¥Ã,Ž¯,f +fa,¤Õ¤¡,¥Õ¥¡,ŽÌŽ§ +fi,¤Õ¤£,¥Õ¥£,ŽÌŽ¨ +fu,¤Õ,¥Õ,ŽÌ +fe,¤Õ¤§,¥Õ¥§,ŽÌŽª +fo,¤Õ¤©,¥Õ¥©,ŽÌŽ« +fya,¤Õ¤ã,¥Õ¥ã,ŽÌŽ¬ +fyi,¤Õ¤£,¥Õ¥£,ŽÌŽ¨ +fyu,¤Õ¤å,¥Õ¥å,ŽÌŽ­ +fye,¤Õ¤§,¥Õ¥§,ŽÌŽª +fyo,¤Õ¤ç,¥Õ¥ç,ŽÌŽ® + +gg,¤Ã,¥Ã,Ž¯,g +ga,¤¬,¥¬,Ž¶ŽÞ +gi,¤®,¥®,Ž·ŽÞ +gu,¤°,¥°,Ž¸ŽÞ +ge,¤²,¥²,Ž¹ŽÞ +go,¤´,¥´,ŽºŽÞ +gya,¤®¤ã,¥®¥ã,Ž·ŽÞŽ¬ +gyi,¤®¤£,¥®¥£,Ž·ŽÞŽ¨ +gyu,¤®¤å,¥®¥å,Ž·ŽÞŽ­ +gye,¤®¤§,¥®¥§,Ž·ŽÞŽª +gyo,¤®¤ç,¥®¥ç,Ž·ŽÞŽ® + +hh,¤Ã,¥Ã,Ž¯,h +ha,¤Ï,¥Ï,ŽÊ +hi,¤Ò,¥Ò,ŽË +hu,¤Õ,¥Õ,ŽÌ +he,¤Ø,¥Ø,ŽÍ +ho,¤Û,¥Û,ŽÎ +hya,¤Ò¤ã,¥Ò¥ã,ŽËŽ¬ +hyi,¤Ò¤£,¥Ò¥£,ŽËŽ¨ +hyu,¤Ò¤å,¥Ò¥å,ŽËŽ­ +hye,¤Ò¤§,¥Ò¥§,ŽËŽª +hyo,¤Ò¤ç,¥Ò¥ç,ŽËŽ® + +i,¤¤,¥¤,Ž² + +jj,¤Ã,¥Ã,Ž¯,j +ja,¤¸¤ã,¥¸¥ã,Ž¼ŽÞŽ¬ +ji,¤¸,¥¸,Ž¼ŽÞ +ju,¤¸¤å,¥¸¥å,Ž¼ŽÞŽ­ +je,¤¸¤§,¥¸¥§,Ž¼ŽÞŽª +jo,¤¸¤ç,¥¸¥ç,Ž¼ŽÞŽ® +jya,¤¸¤ã,¥¸¥ã,Ž¼ŽÞŽ¬ +jyi,¤¸¤£,¥¸¥£,Ž¼ŽÞŽ¨ +jyu,¤¸¤å,¥¸¥å,Ž¼ŽÞŽ­ +jye,¤¸¤§,¥¸¥§,Ž¼ŽÞŽª +jyo,¤¸¤ç,¥¸¥ç,Ž¼ŽÞŽ® + +kk,¤Ã,¥Ã,Ž¯,k +ka,¤«,¥«,Ž¶ +ki,¤­,¥­,Ž· +ku,¤¯,¥¯,Ž¸ +ke,¤±,¥±,Ž¹ +ko,¤³,¥³,Žº +kya,¤­¤ã,¥­¥ã,Ž·Ž¬ +kyi,¤­¤£,¥­¥£,Ž·Ž¨ +kyu,¤­¤å,¥­¥å,Ž·Ž­ +kye,¤­¤§,¥­¥§,Ž·Žª +kyo,¤­¤ç,¥­¥ç,Ž·Ž® + +mm,¤Ã,¥Ã,Ž¯,m +ma,¤Þ,¥Þ,ŽÏ +mi,¤ß,¥ß,ŽÐ +mu,¤à,¥à,ŽÑ +me,¤á,¥á,ŽÒ +mo,¤â,¥â,ŽÓ +mya,¤ß¤ã,¥ß¥ã,ŽÐŽ¬ +myi,¤ß¤£,¥ß¥£,ŽÐŽ¨ +myu,¤ß¤å,¥ß¥å,ŽÐŽ­ +mye,¤ß¤§,¥ß¥§,ŽÐŽª +myo,¤ß¤ç,¥ß¥ç,ŽÐŽ® + +n,¤ó,¥ó,ŽÝ +n',¤ó,¥ó,ŽÝ +nn,¤ó,¥ó,ŽÝ +na,¤Ê,¥Ê,ŽÅ +ni,¤Ë,¥Ë,ŽÆ +nu,¤Ì,¥Ì,ŽÇ +ne,¤Í,¥Í,ŽÈ +no,¤Î,¥Î,ŽÉ +nya,¤Ë¤ã,¥Ë¥ã,ŽÆŽ¬ +nyi,¤Ë¤£,¥Ë¥£,ŽÆŽ¨ +nyu,¤Ë¤å,¥Ë¥å,ŽÆŽ­ +nye,¤Ë¤§,¥Ë¥§,ŽÆŽª +nyo,¤Ë¤ç,¥Ë¥ç,ŽÆŽ® + +o,¤ª,¥ª,Žµ + +pp,¤Ã,¥Ã,Ž¯,p +pa,¤Ñ,¥Ñ,ŽÊŽß +pi,¤Ô,¥Ô,ŽËŽß +pu,¤×,¥×,ŽÌŽß +pe,¤Ú,¥Ú,ŽÍŽß +po,¤Ý,¥Ý,ŽÎŽß +pya,¤Ô¤ã,¥Ô¥ã,ŽËŽßŽ¬ +pyi,¤Ô¤£,¥Ô¥£,ŽËŽßŽ¨ +pyu,¤Ô¤å,¥Ô¥å,ŽËŽßŽ­ +pye,¤Ô¤§,¥Ô¥§,ŽËŽßŽª +pyo,¤Ô¤ç,¥Ô¥ç,ŽËŽßŽ® + +rr,¤Ã,¥Ã,Ž¯,r +ra,¤é,¥é,Ž× +ri,¤ê,¥ê,ŽØ +ru,¤ë,¥ë,ŽÙ +re,¤ì,¥ì,ŽÚ +ro,¤í,¥í,ŽÛ +rya,¤ê¤ã,¥ê¥ã,ŽØŽ¬ +ryi,¤ê¤£,¥ê¥£,ŽØŽ¨ +ryu,¤ê¤å,¥ê¥å,ŽØŽ­ +rye,¤ê¤§,¥ê¥§,ŽØŽª +ryo,¤ê¤ç,¥ê¥ç,ŽØŽ® + +ss,¤Ã,¥Ã,Ž¯,s +sa,¤µ,¥µ,Ž» +si,¤·,¥·,Ž¼ +su,¤¹,¥¹,Ž½ +se,¤»,¥»,Ž¾ +so,¤½,¥½,Ž¿ +sha,¤·¤ã,¥·¥ã,Ž¼Ž¬ +shi,¤·,¥·,Ž¼ +shu,¤·¤å,¥·¥å,Ž¼Ž­ +she,¤·¤§,¥·¥§,Ž¼Žª +sho,¤·¤ç,¥·¥ç,Ž¼Ž® +sya,¤·¤ã,¥·¥ã,Ž¼Ž¬ +syi,¤·¤£,¥·¥£,Ž¼Ž¨ +syu,¤·¤å,¥·¥å,Ž¼Ž­ +sye,¤·¤§,¥·¥§,Ž¼Žª +syo,¤·¤ç,¥·¥ç,Ž¼Ž® + +tt,¤Ã,¥Ã,Ž¯,t +ta,¤¿,¥¿,ŽÀ +ti,¤Á,¥Á,ŽÁ +tu,¤Ä,¥Ä,ŽÂ +te,¤Æ,¥Æ,ŽÃ +to,¤È,¥È,ŽÄ +tha,¤Æ¤¡,¥Æ¥¡,ŽÃŽ§ +thi,¤Æ¤£,¥Æ¥£,ŽÃŽ¨ +thu,¤Æ¤å,¥Æ¥å,ŽÃŽ­ +the,¤Æ¤§,¥Æ¥§,ŽÃŽª +tho,¤Æ¤ç,¥Æ¥ç,ŽÃŽ® +tsu,¤Ä,¥Ä,ŽÂ +tya,¤Á¤ã,¥Á¥ã,ŽÁŽ¬ +tyi,¤Á¤£,¥Á¥£,ŽÁŽ¨ +tyu,¤Á¤å,¥Á¥å,ŽÁŽ­ +tye,¤Á¤§,¥Á¥§,ŽÁŽª +tyo,¤Á¤ç,¥Á¥ç,ŽÁŽ® + +u,¤¦,¥¦,Ž³ + +vv,¤Ã,¥Ã,Ž¯,v +va,¤¦¡«¤¡,¥ô¥¡,Ž³ŽÞŽ§ +vi,¤¦¡«¤£,¥ô¥£,Ž³ŽÞŽ¨ +vu,¤¦¡«,¥ô,Ž³ŽÞ +ve,¤¦¡«¤§,¥ô¥§,Ž³ŽÞŽª +vo,¤¦¡«¤©,¥ô¥©,Ž³ŽÞŽ« + +ww,¤Ã,¥Ã,Ž¯,w +wa,¤ï,¥ï,ŽÜ +wi,¤¦¤£,¥¦¥£,Ž³Ž¨ +wu,¤¦,¥¦,Ž³ +we,¤¦¤§,¥¦¥§,Ž³Žª +wo,¤ò,¥ò,Ž¦ + +xx,¤Ã,¥Ã,Ž¯,x +xa,¤¡,¥¡,Ž§ +xi,¤£,¥£,Ž¨ +xu,¤¥,¥¥,Ž© +xe,¤§,¥§,Žª +xo,¤©,¥©,Ž« +xka,¥õ,¥õ,Ž¶ +xke,¥ö,¥ö,Ž¹ +xtsu,¤Ã,¥Ã,Ž¯ +xtu,¤Ã,¥Ã,Ž¯ +xu,¤¥,¥¥,Ž© +xwa,¤î,¥î,ŽÜ +xwe,¤ñ,¥ñ,Ž´ +xwi,¤ð,¥ð,Ž² +xya,¤ã,¥ã,Ž¬ +xyo,¤ç,¥ç,Ž® +xyu,¤å,¥å,Ž­ + +yy,¤Ã,¥Ã,Ž¯,y +ya,¤ä,¥ä,ŽÔ +yi,¤¤,¥¤,Ž² +yu,¤æ,¥æ,ŽÕ +ye,¤¤¤§,¥¤¥§,Ž²Žª +yo,¤è,¥è,ŽÖ + +zz,¤Ã,¥Ã,Ž¯,z +za,¤¶,¥¶,Ž»ŽÞ +zi,¤¸,¥¸,Ž¼ŽÞ +zu,¤º,¥º,Ž½ŽÞ +ze,¤¼,¥¼,Ž¾ŽÞ +zo,¤¾,¥¾,Ž¿ŽÞ +zya,¤¸¤ã,¥¸¥ã,Ž¼ŽÞŽ¬ +zyi,¤¸¤£,¥¸¥£,Ž¼ŽÞŽ¨ +zyu,¤¸¤å,¥¸¥å,Ž¼ŽÞŽ­ +zye,¤¸¤§,¥¸¥§,Ž¼ŽÞŽª +zyo,¤¸¤ç,¥¸¥ç,Ž¼ŽÞŽ® +z,,¡Å,¡Å,¡Å +z-,¡Á,¡Á,¡Á +z.,¡Ä,¡Ä,¡Ä +z/,¡¦,¡¦,Ž¥ +z[,¡Ø,¡Ø,¡Ø +z],¡Ù,¡Ù,¡Ù +zh,¢«,¢«,¢« +zj,¢­,¢­,¢­ +zk,¢¬,¢¬,¢¬ +zl,¢ª,¢ª,¢ª + +-,¡¼,¡¼,Ž° +:,¡§,¡§,¡§ +;,¡¨,¡¨,¡¨ +[,¡Ö,¡Ö,Ž¢ +],¡×,¡×,Ž£ + +.,¡£,¡£,Ž¡ +,,¡¢,¡¢,Ž¤ From t-suwa ¡÷ users.sourceforge.jp Sat Sep 8 22:35:19 2007 From: t-suwa ¡÷ users.sourceforge.jp (t-suwa ¡÷ users.sourceforge.jp) Date: Sat, 08 Sep 2007 22:35:19 +0900 Subject: [aquaskk-changes 363] CVS update: AquaSKK/src/test Message-ID: <1189258519.156652.8073.nullmailer@users.sourceforge.jp> Index: AquaSKK/src/test/Makefile diff -u AquaSKK/src/test/Makefile:1.1.2.1 AquaSKK/src/test/Makefile:1.1.2.2 --- AquaSKK/src/test/Makefile:1.1.2.1 Sun Aug 26 01:34:45 2007 +++ AquaSKK/src/test/Makefile Sat Sep 8 22:35:19 2007 @@ -5,7 +5,7 @@ VPATH = $(shell find .. -type d -a ! -name CVS -a ! -name test -a ! -name ..) ../.. CXXFLAGS= -g $(foreach dir,$(VPATH),-I$(dir)) -TARGET = SKKKeymapEntry_TEST SKKKeymap_TEST +TARGET = SKKKeymapEntry_TEST SKKKeymap_TEST SKKRomanKanaConverter_TEST define BUILD_template $(1): $(1).o @@ -22,10 +22,10 @@ ### rule ### clean: - $(RM) $(TARGET) *.o + $(RM) $(TARGET) *.o $(LOG) test: build - for i in $(TARGET); do ./$$i; done + for i in $(TARGET); do ./$$i ; done ### ### dependencies @@ -33,3 +33,4 @@ SKKKeymapEntry_TEST.o: SKKKeymapEntry_TEST.cpp SKKKeymapEntry.cpp SKKKeymapEntry.h SKKKeymap_TEST.o: SKKKeymap_TEST.cpp SKKKeymapEntry.cpp SKKKeymapEntry.h SKKKeymap.cpp SKKKeymap.h +SKKRomanKanaConverter_TEST.o: SKKRomanKanaConverter_TEST.cpp SKKRomanKanaConverter.h SKKRomanKanaConverter.cpp Index: AquaSKK/src/test/SKKKeymap_TEST.cpp diff -u AquaSKK/src/test/SKKKeymap_TEST.cpp:1.1.2.1 AquaSKK/src/test/SKKKeymap_TEST.cpp:1.1.2.2 --- AquaSKK/src/test/SKKKeymap_TEST.cpp:1.1.2.1 Sun Aug 26 01:34:45 2007 +++ AquaSKK/src/test/SKKKeymap_TEST.cpp Sat Sep 8 22:35:19 2007 @@ -33,5 +33,4 @@ param = keymap.Fetch('f', 0, true); assert(param == SKKEventParam(SKK_RIGHT, 'f', 0)); - std::cerr << param.dump() << std::endl; } Index: AquaSKK/src/test/SKKRomanKanaConverter_TEST.cpp diff -u /dev/null AquaSKK/src/test/SKKRomanKanaConverter_TEST.cpp:1.1.2.1 --- /dev/null Sat Sep 8 22:35:19 2007 +++ AquaSKK/src/test/SKKRomanKanaConverter_TEST.cpp Sat Sep 8 22:35:19 2007 @@ -0,0 +1,75 @@ +#include "SKKRomanKanaConverter.cpp" +#include "jconv.cpp" + +int main() { + SKKRomanKanaConverter& conv = SKKRomanKanaConverter::theInstance(); + + conv.Initialize("kana-rule-list.test"); + + bool result; + std::string in; + std::string out; + std::string next; + + result = conv.Execute(SKK::Hirakana, "a", out, next); + assert(result == true && next == "" && out == "??); + + result = conv.Execute(SKK::Katakana, "a", out, next); + assert(next == "" && out == "??); + result = conv.Execute(SKK::Jisx0201Kana, "a", out, next); + assert(next == "" && out == "ï½?); + + result = conv.Execute(SKK::Hirakana, "gg", out, next); + assert(next == "g" && out == "??); + + result = conv.Execute(SKK::Hirakana, ",", out, next); + assert(next == "" && out == "??); + + result = conv.Execute(SKK::Hirakana, "#", out, next); + assert(next == "" && out == "ï¼?); + + result = conv.Execute(SKK::Hirakana, " ", out, next); + assert(next == "" && out == " "); + + result = conv.Execute(SKK::Hirakana, "kyl", out, next); + assert(next == "" && out == "l"); + + result = conv.Execute(SKK::Hirakana, "z,", out, next); + assert(next == "" && out == "??); + + result = conv.Execute(SKK::Hirakana, "co", out, next); + assert(next == "" && out == "??); + + result = conv.Execute(SKK::Hirakana, "'", out, next); + assert(next == "" && out == "'"); + + result = conv.Execute(SKK::Hirakana, "k1", out, next); + assert(next == "" && out == "1"); + + result = conv.Execute(SKK::Hirakana, "kgya", out, next); + assert(next == "" && out == "???"); + + result = conv.Execute(SKK::Hirakana, "k1234gya", out, next); + assert(next == "" && out == "1234???"); + + result = conv.Execute(SKK::Hirakana, "gyagyugyo", out, next); + assert(next == "" && out == "?????????"); + + result = conv.Execute(SKK::Hirakana, "chho", out, next); + assert(next == "" && out == "??); + + result = conv.Execute(SKK::Hirakana, "c", out, next); + assert(next == "c" && out == ""); + + result = conv.Execute(SKK::Hirakana, "pmp", out, next); + assert(next == "p" && out == ""); + + result = conv.Execute(SKK::Hirakana, "pmpo", out, next); + assert(next == "" && out == "??); + + result = conv.Execute(SKK::Hirakana, "kanji", out, next); + assert(next == "" && out == "?????); + + result = conv.Execute(SKK::Hirakana, "/", out, next); + assert(next == "" && out == "/"); +} Index: AquaSKK/src/test/kana-rule-list.test diff -u /dev/null AquaSKK/src/test/kana-rule-list.test:1.1.2.1 --- /dev/null Sat Sep 8 22:35:19 2007 +++ AquaSKK/src/test/kana-rule-list.test Sat Sep 8 22:35:19 2007 @@ -0,0 +1,278 @@ +# $Id: kana-rule-list.test,v 1.1.2.1 2007/09/08 13:35:19 t-suwa Exp $ + +# ¤³¤Î¥Õ¥¡¥¤¥ë¤Ï²þ¹Ô¥³¡¼¥É¤¬LF¡¢Ê¸»ú¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°¤¬EUC-JP¤Ç¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡£ +# ¸Þ¤ÄÌܤιàÌܤϼ¡¾õÂ֤Ǥ¹¡£Ìµ¤±¤ì¤Ð¹àÌܼ«ÂΤò¾Êά¤·¤Þ¤¹¡£ +# ¥¨¥ó¥È¥ê¤Î½ç½ø¤Ë¤Ïµ¤¤òÉÕ¤±¤Æ²¼¤µ¤¤¡£Î㤨¤Ð¡Öba¡×¤È¤¤¤¦¥¨¥ó¥È¥ê¤Ë½Ð²ñ¤¦¤È¡¢ +# AquaSKK¤Ï¤Þ¤º¡Öb¡×¤È¤¤¤¦»Þ¤òõ¤·¤Þ¤¹¤¬¡¢¤³¤³¤Ç¤Ï¤Þ¤À¸ºß¤·¤Ê¤¤¤Î¤Ç +# ¡Öb¡×¤È¤¤¤¦¶õ¤Î»Þ¤òºîÀ®¤·¤Þ¤¹¡£¤³¤Î¸å¤Ë¡Öb¡×¤È¤¤¤¦¥¨¥ó¥È¥ê¤¬¸½¤ì¤ë¤È +# ¤½¤Î¥¨¥ó¥È¥ê¡Öb¡×¤Ï´û¤ËÄêµÁ¤µ¤ì¤Æ¤¤¤ë¤Î¤Ç¤É¤¦¤Ê¤ë¤«Ê¬¤«¤ê¤Þ¤»¤ó¡£ + +# ºÇ½é¤Î¹àÌܤÎ,¤ÏȾ³Ñ¥«¥ó¥Þ¤ËÃÖ´¹¤µ¤ì¤Þ¤¹¡£ + +a,¤¢,¥¢,Ž± + +bb,¤Ã,¥Ã,Ž¯,b +ba,¤Ð,¥Ð,ŽÊŽÞ +bi,¤Ó,¥Ó,ŽËŽÞ +bu,¤Ö,¥Ö,ŽÌŽÞ +be,¤Ù,¥Ù,ŽÍŽÞ +bo,¤Ü,¥Ü,ŽÎŽÞ +bya,¤Ó¤ã,¥Ó¥ã,ŽËŽÞŽ¬ +byi,¤Ó¤£,¥Ó¥£,ŽËŽÞŽ¨ +byu,¤Ó¤å,¥Ó¥å,ŽËŽÞŽ­ +bye,¤Ó¤§,¥Ó¥§,ŽËŽÞŽª +byo,¤Ó¤ç,¥Ó¥ç,ŽËŽÞŽ® + +cc,¤Ã,¥Ã,Ž¯,c +cha,¤Á¤ã,¥Á¥ã,ŽÁŽ¬ +chi,¤Á,¥Á,ŽÁ +chu,¤Á¤å,¥Á¥å,ŽÁŽ­ +che,¤Á¤§,¥Á¥§,ŽÁŽª +cho,¤Á¤ç,¥Á¥ç,ŽÁŽ® +cya,¤Á¤ã,¥Á¥ã,ŽÁŽ¬ +cyi,¤Á¤£,¥Á¥£,ŽÁŽ¨ +cyu,¤Á¤å,¥Á¥å,ŽÁŽ­ +cye,¤Á¤§,¥Á¥§,ŽÁŽª +cyo,¤Á¤ç,¥Á¥ç,ŽÁŽ® + +dd,¤Ã,¥Ã,Ž¯,d +da,¤À,¥À,ŽÀŽÞ +di,¤Â,¥Â,ŽÁŽÞ +du,¤Å,¥Å,ŽÂŽÞ +de,¤Ç,¥Ç,ŽÃŽÞ +do,¤É,¥É,ŽÄŽÞ +dha,¤Ç¤ã,¥Ç¥ã,ŽÃŽÞŽ¬ +dhi,¤Ç¤£,¥Ç¥£,ŽÃŽÞŽ¨ +dhu,¤Ç¤å,¥Ç¥å,ŽÃŽÞŽ­ +dhe,¤Ç¤§,¥Ç¥§,ŽÃŽÞŽª +dho,¤Ç¤ç,¥Ç¥ç,ŽÃŽÞŽ® +dya,¤Â¤ã,¥Â¥ã,ŽÁŽÞŽ¬ +dyi,¤Â¤£,¥Â¥£,ŽÁŽÞŽ¨ +dyu,¤Â¤å,¥Â¥å,ŽÁŽÞŽ­ +dye,¤Â¤§,¥Â¥§,ŽÁŽÞŽª +dyo,¤Â¤ç,¥Â¥ç,ŽÁŽÞŽ® + +e,¤¨,¥¨,Ž´ + +ff,¤Ã,¥Ã,Ž¯,f +fa,¤Õ¤¡,¥Õ¥¡,ŽÌŽ§ +fi,¤Õ¤£,¥Õ¥£,ŽÌŽ¨ +fu,¤Õ,¥Õ,ŽÌ +fe,¤Õ¤§,¥Õ¥§,ŽÌŽª +fo,¤Õ¤©,¥Õ¥©,ŽÌŽ« +fya,¤Õ¤ã,¥Õ¥ã,ŽÌŽ¬ +fyi,¤Õ¤£,¥Õ¥£,ŽÌŽ¨ +fyu,¤Õ¤å,¥Õ¥å,ŽÌŽ­ +fye,¤Õ¤§,¥Õ¥§,ŽÌŽª +fyo,¤Õ¤ç,¥Õ¥ç,ŽÌŽ® + +gg,¤Ã,¥Ã,Ž¯,g +ga,¤¬,¥¬,Ž¶ŽÞ +gi,¤®,¥®,Ž·ŽÞ +gu,¤°,¥°,Ž¸ŽÞ +ge,¤²,¥²,Ž¹ŽÞ +go,¤´,¥´,ŽºŽÞ +gya,¤®¤ã,¥®¥ã,Ž·ŽÞŽ¬ +gyi,¤®¤£,¥®¥£,Ž·ŽÞŽ¨ +gyu,¤®¤å,¥®¥å,Ž·ŽÞŽ­ +gye,¤®¤§,¥®¥§,Ž·ŽÞŽª +gyo,¤®¤ç,¥®¥ç,Ž·ŽÞŽ® + +hh,¤Ã,¥Ã,Ž¯,h +ha,¤Ï,¥Ï,ŽÊ +hi,¤Ò,¥Ò,ŽË +hu,¤Õ,¥Õ,ŽÌ +he,¤Ø,¥Ø,ŽÍ +ho,¤Û,¥Û,ŽÎ +hya,¤Ò¤ã,¥Ò¥ã,ŽËŽ¬ +hyi,¤Ò¤£,¥Ò¥£,ŽËŽ¨ +hyu,¤Ò¤å,¥Ò¥å,ŽËŽ­ +hye,¤Ò¤§,¥Ò¥§,ŽËŽª +hyo,¤Ò¤ç,¥Ò¥ç,ŽËŽ® + +i,¤¤,¥¤,Ž² + +jj,¤Ã,¥Ã,Ž¯,j +ja,¤¸¤ã,¥¸¥ã,Ž¼ŽÞŽ¬ +ji,¤¸,¥¸,Ž¼ŽÞ +ju,¤¸¤å,¥¸¥å,Ž¼ŽÞŽ­ +je,¤¸¤§,¥¸¥§,Ž¼ŽÞŽª +jo,¤¸¤ç,¥¸¥ç,Ž¼ŽÞŽ® +jya,¤¸¤ã,¥¸¥ã,Ž¼ŽÞŽ¬ +jyi,¤¸¤£,¥¸¥£,Ž¼ŽÞŽ¨ +jyu,¤¸¤å,¥¸¥å,Ž¼ŽÞŽ­ +jye,¤¸¤§,¥¸¥§,Ž¼ŽÞŽª +jyo,¤¸¤ç,¥¸¥ç,Ž¼ŽÞŽ® + +kk,¤Ã,¥Ã,Ž¯,k +ka,¤«,¥«,Ž¶ +ki,¤­,¥­,Ž· +ku,¤¯,¥¯,Ž¸ +ke,¤±,¥±,Ž¹ +ko,¤³,¥³,Žº +kya,¤­¤ã,¥­¥ã,Ž·Ž¬ +kyi,¤­¤£,¥­¥£,Ž·Ž¨ +kyu,¤­¤å,¥­¥å,Ž·Ž­ +kye,¤­¤§,¥­¥§,Ž·Žª +kyo,¤­¤ç,¥­¥ç,Ž·Ž® + +mm,¤Ã,¥Ã,Ž¯,m +ma,¤Þ,¥Þ,ŽÏ +mi,¤ß,¥ß,ŽÐ +mu,¤à,¥à,ŽÑ +me,¤á,¥á,ŽÒ +mo,¤â,¥â,ŽÓ +mya,¤ß¤ã,¥ß¥ã,ŽÐŽ¬ +myi,¤ß¤£,¥ß¥£,ŽÐŽ¨ +myu,¤ß¤å,¥ß¥å,ŽÐŽ­ +mye,¤ß¤§,¥ß¥§,ŽÐŽª +myo,¤ß¤ç,¥ß¥ç,ŽÐŽ® + +n,¤ó,¥ó,ŽÝ +n',¤ó,¥ó,ŽÝ +nn,¤ó,¥ó,ŽÝ +na,¤Ê,¥Ê,ŽÅ +ni,¤Ë,¥Ë,ŽÆ +nu,¤Ì,¥Ì,ŽÇ +ne,¤Í,¥Í,ŽÈ +no,¤Î,¥Î,ŽÉ +nya,¤Ë¤ã,¥Ë¥ã,ŽÆŽ¬ +nyi,¤Ë¤£,¥Ë¥£,ŽÆŽ¨ +nyu,¤Ë¤å,¥Ë¥å,ŽÆŽ­ +nye,¤Ë¤§,¥Ë¥§,ŽÆŽª +nyo,¤Ë¤ç,¥Ë¥ç,ŽÆŽ® + +o,¤ª,¥ª,Žµ + +pp,¤Ã,¥Ã,Ž¯,p +pa,¤Ñ,¥Ñ,ŽÊŽß +pi,¤Ô,¥Ô,ŽËŽß +pu,¤×,¥×,ŽÌŽß +pe,¤Ú,¥Ú,ŽÍŽß +po,¤Ý,¥Ý,ŽÎŽß +pya,¤Ô¤ã,¥Ô¥ã,ŽËŽßŽ¬ +pyi,¤Ô¤£,¥Ô¥£,ŽËŽßŽ¨ +pyu,¤Ô¤å,¥Ô¥å,ŽËŽßŽ­ +pye,¤Ô¤§,¥Ô¥§,ŽËŽßŽª +pyo,¤Ô¤ç,¥Ô¥ç,ŽËŽßŽ® + +rr,¤Ã,¥Ã,Ž¯,r +ra,¤é,¥é,Ž× +ri,¤ê,¥ê,ŽØ +ru,¤ë,¥ë,ŽÙ +re,¤ì,¥ì,ŽÚ +ro,¤í,¥í,ŽÛ +rya,¤ê¤ã,¥ê¥ã,ŽØŽ¬ +ryi,¤ê¤£,¥ê¥£,ŽØŽ¨ +ryu,¤ê¤å,¥ê¥å,ŽØŽ­ +rye,¤ê¤§,¥ê¥§,ŽØŽª +ryo,¤ê¤ç,¥ê¥ç,ŽØŽ® + +ss,¤Ã,¥Ã,Ž¯,s +sa,¤µ,¥µ,Ž» +si,¤·,¥·,Ž¼ +su,¤¹,¥¹,Ž½ +se,¤»,¥»,Ž¾ +so,¤½,¥½,Ž¿ +sha,¤·¤ã,¥·¥ã,Ž¼Ž¬ +shi,¤·,¥·,Ž¼ +shu,¤·¤å,¥·¥å,Ž¼Ž­ +she,¤·¤§,¥·¥§,Ž¼Žª +sho,¤·¤ç,¥·¥ç,Ž¼Ž® +sya,¤·¤ã,¥·¥ã,Ž¼Ž¬ +syi,¤·¤£,¥·¥£,Ž¼Ž¨ +syu,¤·¤å,¥·¥å,Ž¼Ž­ +sye,¤·¤§,¥·¥§,Ž¼Žª +syo,¤·¤ç,¥·¥ç,Ž¼Ž® + +tt,¤Ã,¥Ã,Ž¯,t +ta,¤¿,¥¿,ŽÀ +ti,¤Á,¥Á,ŽÁ +tu,¤Ä,¥Ä,ŽÂ +te,¤Æ,¥Æ,ŽÃ +to,¤È,¥È,ŽÄ +tha,¤Æ¤¡,¥Æ¥¡,ŽÃŽ§ +thi,¤Æ¤£,¥Æ¥£,ŽÃŽ¨ +thu,¤Æ¤å,¥Æ¥å,ŽÃŽ­ +the,¤Æ¤§,¥Æ¥§,ŽÃŽª +tho,¤Æ¤ç,¥Æ¥ç,ŽÃŽ® +tsu,¤Ä,¥Ä,ŽÂ +tya,¤Á¤ã,¥Á¥ã,ŽÁŽ¬ +tyi,¤Á¤£,¥Á¥£,ŽÁŽ¨ +tyu,¤Á¤å,¥Á¥å,ŽÁŽ­ +tye,¤Á¤§,¥Á¥§,ŽÁŽª +tyo,¤Á¤ç,¥Á¥ç,ŽÁŽ® + +u,¤¦,¥¦,Ž³ + +vv,¤Ã,¥Ã,Ž¯,v +va,¤¦¡«¤¡,¥ô¥¡,Ž³ŽÞŽ§ +vi,¤¦¡«¤£,¥ô¥£,Ž³ŽÞŽ¨ +vu,¤¦¡«,¥ô,Ž³ŽÞ +ve,¤¦¡«¤§,¥ô¥§,Ž³ŽÞŽª +vo,¤¦¡«¤©,¥ô¥©,Ž³ŽÞŽ« + +ww,¤Ã,¥Ã,Ž¯,w +wa,¤ï,¥ï,ŽÜ +wi,¤¦¤£,¥¦¥£,Ž³Ž¨ +wu,¤¦,¥¦,Ž³ +we,¤¦¤§,¥¦¥§,Ž³Žª +wo,¤ò,¥ò,Ž¦ + +xx,¤Ã,¥Ã,Ž¯,x +xa,¤¡,¥¡,Ž§ +xi,¤£,¥£,Ž¨ +xu,¤¥,¥¥,Ž© +xe,¤§,¥§,Žª +xo,¤©,¥©,Ž« +xka,¥õ,¥õ,Ž¶ +xke,¥ö,¥ö,Ž¹ +xtsu,¤Ã,¥Ã,Ž¯ +xtu,¤Ã,¥Ã,Ž¯ +xu,¤¥,¥¥,Ž© +xwa,¤î,¥î,ŽÜ +xwe,¤ñ,¥ñ,Ž´ +xwi,¤ð,¥ð,Ž² +xya,¤ã,¥ã,Ž¬ +xyo,¤ç,¥ç,Ž® +xyu,¤å,¥å,Ž­ + +yy,¤Ã,¥Ã,Ž¯,y +ya,¤ä,¥ä,ŽÔ +yi,¤¤,¥¤,Ž² +yu,¤æ,¥æ,ŽÕ +ye,¤¤¤§,¥¤¥§,Ž²Žª +yo,¤è,¥è,ŽÖ + +zz,¤Ã,¥Ã,Ž¯,z +za,¤¶,¥¶,Ž»ŽÞ +zi,¤¸,¥¸,Ž¼ŽÞ +zu,¤º,¥º,Ž½ŽÞ +ze,¤¼,¥¼,Ž¾ŽÞ +zo,¤¾,¥¾,Ž¿ŽÞ +zya,¤¸¤ã,¥¸¥ã,Ž¼ŽÞŽ¬ +zyi,¤¸¤£,¥¸¥£,Ž¼ŽÞŽ¨ +zyu,¤¸¤å,¥¸¥å,Ž¼ŽÞŽ­ +zye,¤¸¤§,¥¸¥§,Ž¼ŽÞŽª +zyo,¤¸¤ç,¥¸¥ç,Ž¼ŽÞŽ® +z,,¡Å,¡Å,¡Å +z-,¡Á,¡Á,¡Á +z.,¡Ä,¡Ä,¡Ä +z/,¡¦,¡¦,Ž¥ +z[,¡Ø,¡Ø,¡Ø +z],¡Ù,¡Ù,¡Ù +zh,¢«,¢«,¢« +zj,¢­,¢­,¢­ +zk,¢¬,¢¬,¢¬ +zl,¢ª,¢ª,¢ª + +-,¡¼,¡¼,Ž° +:,¡§,¡§,¡§ +;,¡¨,¡¨,¡¨ +[,¡Ö,¡Ö,Ž¢ +],¡×,¡×,Ž£ + +.,¡£,¡£,Ž¡ +,,¡¢,¡¢,Ž¤ +♯,¡ô,¡ô,♯ +&space;,&space;,&space;,&space; From t-suwa ¡÷ users.sourceforge.jp Sun Sep 9 11:59:49 2007 From: t-suwa ¡÷ users.sourceforge.jp (t-suwa ¡÷ users.sourceforge.jp) Date: Sun, 09 Sep 2007 11:59:49 +0900 Subject: [aquaskk-changes 364] CVS update: AquaSKK/src/context Message-ID: <1189306789.391887.25987.nullmailer@users.sourceforge.jp> Index: AquaSKK/src/context/SKKRomanKanaConverter.cpp diff -u AquaSKK/src/context/SKKRomanKanaConverter.cpp:1.1.2.1 AquaSKK/src/context/SKKRomanKanaConverter.cpp:1.1.2.2 --- AquaSKK/src/context/SKKRomanKanaConverter.cpp:1.1.2.1 Sat Sep 8 22:35:18 2007 +++ AquaSKK/src/context/SKKRomanKanaConverter.cpp Sun Sep 9 11:59:49 2007 @@ -21,7 +21,6 @@ #include #include #include -#include #include "jconv.h" #include "SKKRomanKanaConverter.h" @@ -48,126 +47,28 @@ } // ====================================================================== -// SKKRomanKanaConverter::Node ?¤ã??¿ã??§ã???-// ====================================================================== -class SKKRomanKanaConverter::Node { - std::string hirakana_; - std::string katakana_; - std::string jisx0201kana_; - std::string next_; - - std::map children_; - -public: - Node() {} - Node(const std::string& hirakana, const std::string& katakana, - const std::string& jisx0201kana, const std::string& next) - : hirakana_(hirakana), katakana_(katakana), jisx0201kana_(jisx0201kana), next_(next) {} - - // ?????- void Clear() { - children_.clear(); - } - - // ?????¿½??- void Add(const std::string& str, const Node& node, int depth = 0) { - // ?????? - if(str.size() - 1 == depth) { - children_[str[depth]] = node; - } else { - children_[str[depth]].Add(str, node, depth + 1); // ??¸°è¿½å? - } - } - - // ??????ç´?- const Node* Traverse(const std::string& str, int& match_length, int depth = 0) { - // [1] ????¿ä?è¶?ex. "k" ??"ch" ???) - if(depth == str.size()) { - match_length = 0; - return 0; - } - - // ä¸??ï¼?- if(children_.find(str[depth]) != children_.end()) { - Node& leaf = children_[str[depth]]; - - // ????§ã???????帰æ?ç´?- if(!leaf.children_.empty()) { - return leaf.Traverse(str, match_length, depth + 1); - } - - // [2] å®??ä¸?? - match_length = depth + 1; - return &leaf; - } - - // [3] ???ä¸??(ex. "kb" ??"chm" ???) - if(0 < depth) { - match_length = depth; - - // ç¯???¤è??§ã?????????????????????ä¸??????????- if(!hirakana_.empty()) { - return this; - } - - return 0; - } - - // [4] ???ä¸??????????- match_length = -1; - return 0; - } - - // ??????å­????? - const std::string& KanaString(SKK::InputMode mode) const { - switch(mode) { - case SKK::Hirakana: - return hirakana_; - - case SKK::Katakana: - return katakana_; - - case SKK::Jisx0201Kana: - return jisx0201kana_; - - default: - std::cerr << "SKKRomanKanaConverter::Node::KanaString(): invalid mode [" << mode << "]" << std::endl; - break; - } - } - - // 次ç????å­????? - const std::string& NextState() const { - return next_; - } -}; - -// ====================================================================== // SKKRomanKanaConverter ?¤ã??¿ã??§ã??? // ====================================================================== +SKKRomanKanaConverter::SKKRomanKanaConverter() {} + SKKRomanKanaConverter& SKKRomanKanaConverter::theInstance() { - static Node root; - static SKKRomanKanaConverter obj(root); + static SKKRomanKanaConverter obj; return obj; } -// Node ????³ã?????¼ã????????????????è£?-SKKRomanKanaConverter::SKKRomanKanaConverter(Node& node) : root_(node) { -} - void SKKRomanKanaConverter::Initialize(const std::string& path) { - std::ifstream rule(path.c_str()); + std::ifstream ifs(path.c_str()); std::string str; - if(!rule) { + if(!ifs) { std::cerr << "SKKRomanKanaConverter::Initialize(): can't open file [" << path << "]" << std::endl; return; } - // ?????+ // ??????????? root_.Clear(); - while(std::getline(rule, str)) { + while(std::getline(ifs, str)) { if(str.empty() || str[0] == '#') continue; // EUC-JP ??UTF-8 å¤??@@ -179,20 +80,20 @@ std::istringstream buf(utf8); // å¤????¼ã??????- std::string label, hirakana, katakana, jisx0201kana, next; - if(buf >> label >> hirakana >> katakana >> jisx0201kana) { + std::string roman, hirakana, katakana, jisx0201kana, next; + if(buf >> roman >> hirakana >> katakana >> jisx0201kana) { // ????·ã??³ã?次ç????èª?? buf >> next; // ????±ã????å­??????»ã? - unescape_string(label); + unescape_string(roman); unescape_string(hirakana); unescape_string(katakana); unescape_string(jisx0201kana); unescape_string(next); - // 追å? - root_.Add(label, Node(hirakana, katakana, jisx0201kana, next)); + // ????????¿½??+ root_.Add(roman, SKKRuleTreeNode(hirakana, katakana, jisx0201kana, next)); } else { // ä¸????½¢å¼? std::cerr << "SKKRomanKanaConverter::Initialize(): invalid rule [" << utf8 << "]" << std::endl; @@ -208,8 +109,8 @@ next.clear(); while(!str.empty()) { - int match_length; - const Node* node = root_.Traverse(str, match_length); + int state; + const SKKRuleTreeNode* node = root_.Traverse(str, state); // å¤??????ï¼? if(node) { @@ -221,19 +122,19 @@ } // ??????ä¸????????????¼ã?ä¸?¶³????????»¥ä¸??????????- if(!match_length) { + if(!state) { next = str; return false; } - // ?????????????´ã?????´å????????³ã??¼ã???????å­??調ã???- if(match_length < 0) { + // ??????????????????????´å????????³ã??¼ã???????å­??調ã???+ if(state < 0) { out += str[0]; - match_length = 1; + state = 1; } - // ä¸?????????????????????å­??調ã???- str = str.substr(match_length); + // 調ã???????????????????å­??調ã???+ str = str.substr(state); } return converted; Index: AquaSKK/src/context/SKKRomanKanaConverter.h diff -u AquaSKK/src/context/SKKRomanKanaConverter.h:1.1.2.1 AquaSKK/src/context/SKKRomanKanaConverter.h:1.1.2.2 --- AquaSKK/src/context/SKKRomanKanaConverter.h:1.1.2.1 Sat Sep 8 22:35:18 2007 +++ AquaSKK/src/context/SKKRomanKanaConverter.h Sun Sep 9 11:59:49 2007 @@ -23,13 +23,12 @@ #include #include "SKK.h" +#include "SKKRuleTreeNode.h" class SKKRomanKanaConverter { - class Node; - Node& root_; + SKKRuleTreeNode root_; SKKRomanKanaConverter(); - SKKRomanKanaConverter(Node& node); SKKRomanKanaConverter(const SKKRomanKanaConverter&); public: Index: AquaSKK/src/context/SKKRuleTreeNode.cpp diff -u /dev/null AquaSKK/src/context/SKKRuleTreeNode.cpp:1.1.2.1 --- /dev/null Sun Sep 9 11:59:49 2007 +++ AquaSKK/src/context/SKKRuleTreeNode.cpp Sun Sep 9 11:59:49 2007 @@ -0,0 +1,104 @@ +/* -*- C++ -*- + MacOS X implementation of the SKK input method. + + Copyright (C) 2007 Tomotaka SUWA + + 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 +#include "SKKRuleTreeNode.h" + +SKKRuleTreeNode::SKKRuleTreeNode() : leaf_(false) { +} + +SKKRuleTreeNode::SKKRuleTreeNode(const std::string& hirakana, const std::string& katakana, + const std::string& jisx0201kana, const std::string& next) + : leaf_(true), hirakana_(hirakana), katakana_(katakana), jisx0201kana_(jisx0201kana), next_(next) { +} + +void SKKRuleTreeNode::Clear() { + children_.clear(); +} + +void SKKRuleTreeNode::Add(const std::string& str, const SKKRuleTreeNode& node, int depth) { + // ?????? + if(depth == str.size() - 1) { + children_[str[depth]] = node; + } else { + children_[str[depth]].Add(str, node, depth + 1); // ??¸°è¿½å? + } +} + +const SKKRuleTreeNode* SKKRuleTreeNode::Traverse(const std::string& str, int& state, int depth) { + // [1] ????¿ä?è¶?ex. "k" ??"ch" ???) + if(depth == str.size()) { + state = 0; + return 0; + } + + // ä¸??ï¼?+ if(children_.find(str[depth]) != children_.end()) { + SKKRuleTreeNode* node = &children_[str[depth]]; + + // ????§ã???????帰æ?ç´?+ if(!node->children_.empty()) { + return node->Traverse(str, state, depth + 1); + } + + // [2] å®??ä¸?? + state = depth + 1; + return node; + } + + // [3] ???ä¸??(ex. "kb" ??"chm" ???) + if(0 < depth) { + state = depth; + + // ç¯???¤è??§ã?????????????????????ä¸??????????+ if(leaf_) { + return this; + } + + return 0; + } + + // [4] ????????????????????? + state = -1; + return 0; +} + +const std::string& SKKRuleTreeNode::KanaString(SKK::InputMode mode) const { + static std::string nothing; + + switch(mode) { + case SKK::Hirakana: + return hirakana_; + + case SKK::Katakana: + return katakana_; + + case SKK::Jisx0201Kana: + return jisx0201kana_; + + default: + std::cerr << "SKKRomanKanaConverter::Node::KanaString(): invalid mode [" << mode << "]" << std::endl; + return nothing; + } +} + +const std::string& SKKRuleTreeNode::NextState() const { + return next_; +} Index: AquaSKK/src/context/SKKRuleTreeNode.h diff -u /dev/null AquaSKK/src/context/SKKRuleTreeNode.h:1.1.2.1 --- /dev/null Sun Sep 9 11:59:49 2007 +++ AquaSKK/src/context/SKKRuleTreeNode.h Sun Sep 9 11:59:49 2007 @@ -0,0 +1,80 @@ +/* -*- C++ -*- + MacOS X implementation of the SKK input method. + + Copyright (C) 2007 Tomotaka SUWA + + 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 +#include +#include "SKK.h" + +#ifndef INC__SKKRuleTreeNode__ +#define INC__SKKRuleTreeNode__ + +// kana-rule-list ???è¡??+class SKKRuleTreeNode { + bool leaf_; + std::string hirakana_; + std::string katakana_; + std::string jisx0201kana_; + std::string next_; + + std::map children_; + +public: + SKKRuleTreeNode(); + SKKRuleTreeNode(const std::string& hirakana, const std::string& katakana, + const std::string& jisx0201kana, const std::string& next); + + // ?????+ void Clear(); + + // ??¸°????¼ã?追å? + // + // å¼??ï¼?+ // str=å¤???å­?? + // node=追å??????+ // depth=?¢ç´¢??·±åº???¸°å°??) + // + // ä¾?? + // node.Add("gya", SKKRuleTreeNode("???", "???", "ï½·ï?ï½?, "")); + // + void Add(const std::string& str, const SKKRuleTreeNode& node, int depth = 0); + + // ??¸°????¼ã?æ¤?´¢ + // + // å¼??ï¼?+ // str=å¤???å­?? + // state=?¶æ? + // -1 ??????????????????????????¤º??+ // 0 ???ä¸?????????????¤º??å¤???????????????) + // 1 以ä? å¤???å­???????????????°ã?示ã?(std::string::substr ????? + // depth=?¢ç´¢??·±åº???¸°å°??) + // + // ?»ã??¤ï? + // å¤???????¼ã??¸ã?????³ã??????????????????? 0 + // + const SKKRuleTreeNode* Traverse(const std::string& str, int& state, int depth = 0); + + // ?????????? + const std::string& KanaString(SKK::InputMode mode) const; + + // 次ç????å­????? + const std::string& NextState() const; +}; + +#endif From t-suwa ¡÷ users.sourceforge.jp Sun Sep 9 11:59:49 2007 From: t-suwa ¡÷ users.sourceforge.jp (t-suwa ¡÷ users.sourceforge.jp) Date: Sun, 09 Sep 2007 11:59:49 +0900 Subject: [aquaskk-changes 365] CVS update: AquaSKK/src/test Message-ID: <1189306789.584814.25999.nullmailer@users.sourceforge.jp> Index: AquaSKK/src/test/Makefile diff -u AquaSKK/src/test/Makefile:1.1.2.2 AquaSKK/src/test/Makefile:1.1.2.3 --- AquaSKK/src/test/Makefile:1.1.2.2 Sat Sep 8 22:35:19 2007 +++ AquaSKK/src/test/Makefile Sun Sep 9 11:59:49 2007 @@ -5,7 +5,7 @@ VPATH = $(shell find .. -type d -a ! -name CVS -a ! -name test -a ! -name ..) ../.. CXXFLAGS= -g $(foreach dir,$(VPATH),-I$(dir)) -TARGET = SKKKeymapEntry_TEST SKKKeymap_TEST SKKRomanKanaConverter_TEST +TARGET = SKKKeymapEntry_TEST SKKKeymap_TEST SKKRuleTreeNode_TEST SKKRomanKanaConverter_TEST define BUILD_template $(1): $(1).o @@ -33,4 +33,6 @@ SKKKeymapEntry_TEST.o: SKKKeymapEntry_TEST.cpp SKKKeymapEntry.cpp SKKKeymapEntry.h SKKKeymap_TEST.o: SKKKeymap_TEST.cpp SKKKeymapEntry.cpp SKKKeymapEntry.h SKKKeymap.cpp SKKKeymap.h -SKKRomanKanaConverter_TEST.o: SKKRomanKanaConverter_TEST.cpp SKKRomanKanaConverter.h SKKRomanKanaConverter.cpp +SKKRuleTreeNode_TEST.o: SKKRuleTreeNode_TEST.cpp SKKRuleTreeNode.h SKKRuleTreeNode.cpp +SKKRomanKanaConverter_TEST.o: SKKRomanKanaConverter_TEST.cpp SKKRomanKanaConverter.h SKKRomanKanaConverter.cpp \ + SKKRuleTreeNode.h SKKRuleTreeNode.cpp Index: AquaSKK/src/test/SKKRomanKanaConverter_TEST.cpp diff -u AquaSKK/src/test/SKKRomanKanaConverter_TEST.cpp:1.1.2.1 AquaSKK/src/test/SKKRomanKanaConverter_TEST.cpp:1.1.2.2 --- AquaSKK/src/test/SKKRomanKanaConverter_TEST.cpp:1.1.2.1 Sat Sep 8 22:35:19 2007 +++ AquaSKK/src/test/SKKRomanKanaConverter_TEST.cpp Sun Sep 9 11:59:49 2007 @@ -1,4 +1,5 @@ #include "SKKRomanKanaConverter.cpp" +#include "SKKRuleTreeNode.cpp" #include "jconv.cpp" int main() { Index: AquaSKK/src/test/SKKRuleTreeNode_TEST.cpp diff -u /dev/null AquaSKK/src/test/SKKRuleTreeNode_TEST.cpp:1.1.2.1 --- /dev/null Sun Sep 9 11:59:49 2007 +++ AquaSKK/src/test/SKKRuleTreeNode_TEST.cpp Sun Sep 9 11:59:49 2007 @@ -0,0 +1,44 @@ +#include "SKKRuleTreeNode.cpp" + +int main() { + SKKRuleTreeNode root; + const SKKRuleTreeNode* node; + int state; + + node = root.Traverse("a", state); + assert(state == -1 && !node); + + root.Add("a", SKKRuleTreeNode("??, "??, "ï½?, "")); + root.Add("kya", SKKRuleTreeNode("???", "???", "キャ", "")); + root.Add("ka", SKKRuleTreeNode("??, "??, "ï½?, "")); + root.Add("n", SKKRuleTreeNode("??, "??, "ï¾?, "")); + root.Add("nn", SKKRuleTreeNode("??, "??, "ï¾?, "")); + root.Add("xx", SKKRuleTreeNode("??, "??, "ï½?, "x")); + + node = root.Traverse("m", state); + assert(state == -1 && !node); + + node = root.Traverse("a", state); + assert(state == 1 && node && node->KanaString(SKK::Hirakana) == "??); + + node = root.Traverse("kya", state); + assert(state == 3 && node && node->KanaString(SKK::Katakana) == "???"); + + node = root.Traverse("ki", state); + assert(state == 1 && !node); + + node = root.Traverse("ky", state); + assert(state == 0 && !node); + + node = root.Traverse("n", state); + assert(state == 0 && !node); + + node = root.Traverse("ng", state); + assert(state == 1 && node && node->KanaString(SKK::Jisx0201Kana) == "ï¾?); + + node = root.Traverse("nn", state); + assert(state == 2 && node && node->KanaString(SKK::Jisx0201Kana) == "ï¾?); + + node = root.Traverse("xx", state); + assert(state == 2 && node && node->NextState() == "x"); +} From t-suwa ¡÷ users.sourceforge.jp Tue Sep 11 23:08:20 2007 From: t-suwa ¡÷ users.sourceforge.jp (t-suwa ¡÷ users.sourceforge.jp) Date: Tue, 11 Sep 2007 23:08:20 +0900 Subject: [aquaskk-changes 366] CVS update: AquaSKK Message-ID: <1189519700.049289.12472.nullmailer@users.sourceforge.jp> Index: AquaSKK/jconv.cpp diff -u AquaSKK/jconv.cpp:1.1.2.1 AquaSKK/jconv.cpp:1.1.2.2 --- AquaSKK/jconv.cpp:1.1.2.1 Mon Nov 27 15:16:27 2006 +++ AquaSKK/jconv.cpp Tue Sep 11 23:08:19 2007 @@ -46,4 +46,152 @@ void convert_eucj_to_utf8(const std::string& from, std::string& to) { std::for_each(from.begin(), from.end(), eucj_to_utf8(to)); } + + struct kana { + const char* hirakana; + const char* katakana; + const char* jisx0201_kana; + }; + + // data member pointer + typedef const char* kana::*kana_member; + + static kana primary_kana_table[] = { + { "??, "??, "カï?" }, { "??, "??, "ï½·ï?" }, { "??, "??, "クï?" }, { "??, "??, "ï½¹ï?" }, { "??, "??, "コï?" }, + { "??, "??, "ï½»ï?" }, { "??, "??, "ï½¼ï?" }, { "??, "??, "ï½½ï?" }, { "??, "??, "ï½¾ï?" }, { "??, "??, "ソï?" }, + { "??, "??, "ï¾??" }, { "??, "??, "ï¾??" }, { "??, "??, "ï¾??" }, { "??, "??, "ï¾??" }, { "??, "??, "ï¾??" }, + { "??, "??, "ï¾??" }, { "??, "??, "ï¾??" }, { "??, "??, "ï¾??" }, { "??, "??, "ï¾??" }, { "??, "??, "ï¾??" }, + { "??, "??, "ï¾??" }, { "??, "??, "ï¾??" }, { "??, "??, "ï¾??" }, { "??, "??, "ï¾??" }, { "??, "??, "ï¾??" }, + { "???", "??, "ï½³ï?" }, { 0, 0, 0 } + }; + + static kana secondary_kana_table[] = { + { "??, "??, "ï½? }, { "??, "??, "ï½? }, { "??, "??, "ï½? }, { "??, "??, "ï½? }, { "??, "??, "ï½? }, + { "??, "??, "ï½? }, { "??, "??, "ï½? }, { "?? "??, "ï½? }, { "??, "??, "ï½? }, { "??, "??, "ï½? }, + { "??, "??, "ï½? }, { "??, "??, "ï½? }, { "??, "??, "ï½? }, { "??, "??, "ï½? }, { "??, "??, "ï½? }, + { "??, "??, "ï¾? }, { "??, "??, "ï¾? }, { "??, "??, "ï¾? }, { "??, "??, "ï¾? }, { "??, "??, "ï¾? }, + { "??, "??, "ï¾? }, { "??, "??, "ï¾? }, { "??, "??, "ï¾? }, { "??, "??, "ï¾? }, { "??, "??, "ï¾? }, + { "??, "?? "ï¾? }, { "??, "??, "ï¾? }, { "??, "??, "ï¾? }, { "??, "??, "ï¾? }, { "??, "??, "ï¾? }, + { "??, "??, "ï¾?}, { "??, "??, "ï¾? }, { "??, "??, "ï¾? }, { "??, "??, "ï¾? }, { "??, "??, "ï¾? }, + { "??, "??, "ï¾? }, { "??, "??, "ï½? }, { "??, "??, "ï¾? }, { "??, "??, "ï½? }, { "??, "??, "ï¾? }, + { "??, "??, "ï¾? }, { "??, "??, "ï¾? }, { "??, "??, "ï¾? }, { "??, "??, "ï¾? }, { "??, "??, "ï¾? }, + { "?? "??, "ï¾? }, { "??, "??, "ï½? }, { "??, "??, "ï¾? }, + { "??, "??, "ï½? }, { "??, "??, "ï½? }, { "??, "??, "ï½? }, { "??, "??, "ï½? }, { "??, "??, "ï½? }, + { "??, "??, "ï½? }, { "??, "??, "ï½? }, { "??, "??, "ï½? }, { "??, "??, "ï½? }, { "??, "??, " " }, + { "??, "??, "ï½? }, { "??, "??, "ï½? }, { "??, "??, "ï½? }, { "??, "??, "ï½? }, { "??, "??, "ï½? }, + { "??, "??, "ï¾? }, { "??, "??, "ï¾? }, { 0, 0, 0 } + }; + + static kana* kana_tables[] = { primary_kana_table, secondary_kana_table, 0 }; + + class translate { + std::string from_; + std::string to_; + + public: + translate(const char* from, const char* to) : from_(from), to_(to) {} + + unsigned operator()(std::string& str, unsigned remain, unsigned offset = 0) { + if(!remain) return 0; + + unsigned pos = str.find(from_, offset); + if(pos == std::string::npos) return remain; + + str.replace(pos, from_.size(), to_); + + return this->operator()(str, remain - from_.size(), pos + to_.size()); + } + }; + + static void kana_convert(kana_member target, kana_member replacement, std::string& str) { + unsigned remain = str.size(); + + for(kana** tbl = kana_tables; *tbl != 0; ++ tbl) { + for(kana* ptr = *tbl; remain && ptr->hirakana; ++ ptr) { + remain = translate(ptr->*target, ptr->*replacement)(str, remain); + } + } + } + + void hirakana_to_katakana(const std::string& from, std::string& to) { + to = from; + kana_convert(&kana::hirakana, &kana::katakana, to); + } + + void hirakana_to_jisx0201_kana(const std::string& from, std::string& to) { + to = from; + kana_convert(&kana::hirakana, &kana::jisx0201_kana, to); + } + + void katakana_to_hirakana(const std::string& from, std::string& to) { + to = from; + kana_convert(&kana::katakana, &kana::hirakana, to); + } + + void katakana_to_jisx0201_kana(const std::string& from, std::string& to) { + to = from; + kana_convert(&kana::katakana, &kana::jisx0201_kana, to); + } + + void jisx0201_kana_to_hirakana(const std::string& from, std::string& to) { + to = from; + kana_convert(&kana::jisx0201_kana, &kana::hirakana, to); + } + + void jisx0201_kana_to_katakana(const std::string& from, std::string& to) { + to = from; + kana_convert(&kana::jisx0201_kana, &kana::katakana, to); + } + + // latin record + struct latin { + const char* ascii; + const char* jisx0208_latin; + }; + + static latin latin_table[] = { + { " ", "?? }, { "!", "ï¼? }, { "\"", "?? }, { "#", "ï¼? }, + { "$", "ï¼? }, { "%", "ï¼? }, { "&", "ï¼? }, { "'", "?? }, + { "(", "ï¼? }, { ")", "ï¼? }, { "*", "ï¼? }, { "+", "ï¼? }, + { ",", "ï¼? }, { "-", "?? }, { ".", "ï¼? }, { "/", "ï¼?}, + { "0", "ï¼? }, { "1", "ï¼? }, { "2", "ï¼? }, { "3", "ï¼? }, + { "4", "ï¼? }, { "5", "ï¼? }, { "6", "ï¼? }, { "7", "ï¼? }, + { "8", "ï¼? }, { "9", "ï¼? }, { ":", "ï¼? }, { ";", "ï¼? }, + { "<", "ï¼? }, { "=", "ï¼? }, { ">", "ï¼? }, { "?", "ï¼? }, + { "@", "ï¼? }, { "A", "ï¼? }, { "B", "ï¼? }, { "C", "ï¼? }, + { "D", "ï¼? }, { "E", "ï¼? }, { "F", "ï¼? }, { "G", "ï¼? }, + { "H", "ï¼? }, { "I", "ï¼? }, { "J", "ï¼? }, { "K", "ï¼? }, + { "L", "ï¼? }, { "M", "ï¼? }, { "N", "ï¼? }, { "O", "ï¼? }, + { "P", "ï¼? }, { "Q", "ï¼? }, { "R", "ï¼? }, { "S", "ï¼? }, + { "T", "ï¼? }, { "U", "ï¼? }, { "V", "ï¼? }, { "W", "ï¼? }, + { "X", "ï¼? }, { "Y", "ï¼? }, { "Z", "ï¼? }, { "[", "ï¼? }, + { "\\", "ï¼? }, { "]", "ï¼? }, { "^", "ï¼? }, { "_", "ï¼? }, + { "`", "?? }, { "a", "ï½? }, { "b", "ï½? }, { "c", "ï½? }, + { "d", "ï½? }, { "e", "ï½? }, { "f", "ï½? }, { "g", "ï½? }, + { "h", "ï½? }, { "i", "ï½? }, { "j", "ï½? }, { "k", "ï½? }, + { "l", "ï½? }, { "m", "ï½? }, { "n", "ï½? }, { "o", "ï½?}, + { "p", "ï½? }, { "q", "ï½? }, { "r", "ï½? }, { "s", "ï½? }, + { "t", "ï½? }, { "u", "ï½? }, { "v", "ï½? }, { "w", "ï½? }, + { "x", "ï½? }, { "y", "ï½? }, { "z", "ï½? }, { "{", "ï½? }, + { "|", "ï½? }, { "}", "ï½? }, { "~", "?? }, { 0, 0 } + }; + + void ascii_to_jisx0208_latin(const std::string& from, std::string& to) { + to.clear(); + for(unsigned i = 0; i < from.size(); ++ i) { + if(from[i] < 0x20 || 0x7e < from[i]) { + to += from[i]; + } else { + to += latin_table[from[i] - 0x20].jisx0208_latin; + } + } + } + + void jisx0208_latin_to_ascii(const std::string& from, std::string& to) { + to = from; + unsigned remain = to.size(); + for(latin* ptr = latin_table; remain && ptr->ascii; ++ ptr) { + remain = translate(ptr->jisx0208_latin, ptr->ascii)(to, remain); + } + } } Index: AquaSKK/jconv.h diff -u AquaSKK/jconv.h:1.1.2.1 AquaSKK/jconv.h:1.1.2.2 --- AquaSKK/jconv.h:1.1.2.1 Mon Nov 27 15:16:27 2006 +++ AquaSKK/jconv.h Tue Sep 11 23:08:19 2007 @@ -355,6 +355,18 @@ void convert_utf8_to_eucj(const std::string& from, std::string& to); void convert_eucj_to_utf8(const std::string& from, std::string& to); + // translator(UTF-8 only) + void hirakana_to_katakana(const std::string& from, std::string& to); + void hirakana_to_jisx0201_kana(const std::string& from, std::string& to); + + void katakana_to_hirakana(const std::string& from, std::string& to); + void katakana_to_jisx0201_kana(const std::string& from, std::string& to); + + void jisx0201_kana_to_hirakana(const std::string& from, std::string& to); + void jisx0201_kana_to_katakana(const std::string& from, std::string& to); + + void ascii_to_jisx0208_latin(const std::string& from, std::string& to); + void jisx0208_latin_to_ascii(const std::string& from, std::string& to); } // namespace jconv #endif // INC__jconv__ From t-suwa ¡÷ users.sourceforge.jp Tue Sep 11 23:08:20 2007 From: t-suwa ¡÷ users.sourceforge.jp (t-suwa ¡÷ users.sourceforge.jp) Date: Tue, 11 Sep 2007 23:08:20 +0900 Subject: [aquaskk-changes 367] CVS update: AquaSKK/src/test Message-ID: <1189519700.290572.12488.nullmailer@users.sourceforge.jp> Index: AquaSKK/src/test/Makefile diff -u AquaSKK/src/test/Makefile:1.1.2.3 AquaSKK/src/test/Makefile:1.1.2.4 --- AquaSKK/src/test/Makefile:1.1.2.3 Sun Sep 9 11:59:49 2007 +++ AquaSKK/src/test/Makefile Tue Sep 11 23:08:20 2007 @@ -2,37 +2,37 @@ ### unit test ### -VPATH = $(shell find .. -type d -a ! -name CVS -a ! -name test -a ! -name ..) ../.. -CXXFLAGS= -g $(foreach dir,$(VPATH),-I$(dir)) +VPATH = $(filter-out %/CVS,$(wildcard ../*)) ../.. +CPPFLAGS= $(foreach dir,$(VPATH),-I$(dir)) +SRCS = $(wildcard *_TEST.cpp) +OBJS = $(SRCS:.cpp=.o) +PROGS = $(SRCS:.cpp=) +LIB = libtest.a +LDFLAGS = -L. -ltest -TARGET = SKKKeymapEntry_TEST SKKKeymap_TEST SKKRuleTreeNode_TEST SKKRomanKanaConverter_TEST +LIBOBJS = SKKKeymapEntry.o SKKKeymap.o SKKRuleTreeNode.o SKKRomanKanaConverter.o \ + SKKInputBuffer.o jconv.o -define BUILD_template -$(1): $(1).o - $(CXX) -o $(1) $(1).o -endef +all: $(LIB) $(PROGS) -all: build +test: all + for prog in $(PROGS); do ./$$prog; done -$(foreach prog,$(TARGET),$(eval $(call BUILD_template,$(prog)))) +clean: + $(RM) -rf $(PROGS) $(LIB) *.o .depend -build: $(TARGET) +$(LIB): $(LIBOBJS) + $(AR) -rsu $@ $(LIBOBJS) -### -### rule -### -clean: - $(RM) $(TARGET) *.o $(LOG) +$(PROGS): %: %.o $(LIB) + $(CXX) -o $@ $< $(LDFLAGS) + +.depend/%.d: %.cpp .depend + $(CXX) -MM $(CPPFLAGS) $< | sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' > $@ -test: build - for i in $(TARGET); do ./$$i ; done +.depend: + mkdir .depend -### -### dependencies -### - -SKKKeymapEntry_TEST.o: SKKKeymapEntry_TEST.cpp SKKKeymapEntry.cpp SKKKeymapEntry.h -SKKKeymap_TEST.o: SKKKeymap_TEST.cpp SKKKeymapEntry.cpp SKKKeymapEntry.h SKKKeymap.cpp SKKKeymap.h -SKKRuleTreeNode_TEST.o: SKKRuleTreeNode_TEST.cpp SKKRuleTreeNode.h SKKRuleTreeNode.cpp -SKKRomanKanaConverter_TEST.o: SKKRomanKanaConverter_TEST.cpp SKKRomanKanaConverter.h SKKRomanKanaConverter.cpp \ - SKKRuleTreeNode.h SKKRuleTreeNode.cpp +ifneq ($(MAKECMDGOALS), clean) +-include $(addprefix .depend/,$(LIBOBJS:.o=.d) $(OBJS:.o=.d)) +endif Index: AquaSKK/src/test/SKKKeymapEntry_TEST.cpp diff -u AquaSKK/src/test/SKKKeymapEntry_TEST.cpp:1.1.2.1 AquaSKK/src/test/SKKKeymapEntry_TEST.cpp:1.1.2.2 --- AquaSKK/src/test/SKKKeymapEntry_TEST.cpp:1.1.2.1 Sun Aug 26 01:34:45 2007 +++ AquaSKK/src/test/SKKKeymapEntry_TEST.cpp Tue Sep 11 23:08:20 2007 @@ -1,6 +1,7 @@ -#include "SKKKeyState.h" -#include "SKKKeymapEntry.cpp" #include +#include "SKKEventParam.h" +#include "SKKKeyState.h" +#include "SKKKeymapEntry.h" int main() { SKKKeymapEntry entry; Index: AquaSKK/src/test/SKKKeymap_TEST.cpp diff -u AquaSKK/src/test/SKKKeymap_TEST.cpp:1.1.2.2 AquaSKK/src/test/SKKKeymap_TEST.cpp:1.1.2.3 --- AquaSKK/src/test/SKKKeymap_TEST.cpp:1.1.2.2 Sat Sep 8 22:35:19 2007 +++ AquaSKK/src/test/SKKKeymap_TEST.cpp Tue Sep 11 23:08:20 2007 @@ -1,6 +1,6 @@ #include -#include "SKKKeymap.cpp" -#include "SKKKeymapEntry.cpp" +#include "SKKKeymap.h" +#include "SKKKeymapEntry.h" int main() { SKKKeymap keymap; Index: AquaSKK/src/test/SKKRomanKanaConverter_TEST.cpp diff -u AquaSKK/src/test/SKKRomanKanaConverter_TEST.cpp:1.1.2.2 AquaSKK/src/test/SKKRomanKanaConverter_TEST.cpp:1.1.2.3 --- AquaSKK/src/test/SKKRomanKanaConverter_TEST.cpp:1.1.2.2 Sun Sep 9 11:59:49 2007 +++ AquaSKK/src/test/SKKRomanKanaConverter_TEST.cpp Tue Sep 11 23:08:20 2007 @@ -1,6 +1,4 @@ -#include "SKKRomanKanaConverter.cpp" -#include "SKKRuleTreeNode.cpp" -#include "jconv.cpp" +#include "SKKRomanKanaConverter.h" int main() { SKKRomanKanaConverter& conv = SKKRomanKanaConverter::theInstance(); Index: AquaSKK/src/test/SKKRuleTreeNode_TEST.cpp diff -u AquaSKK/src/test/SKKRuleTreeNode_TEST.cpp:1.1.2.1 AquaSKK/src/test/SKKRuleTreeNode_TEST.cpp:1.1.2.2 --- AquaSKK/src/test/SKKRuleTreeNode_TEST.cpp:1.1.2.1 Sun Sep 9 11:59:49 2007 +++ AquaSKK/src/test/SKKRuleTreeNode_TEST.cpp Tue Sep 11 23:08:20 2007 @@ -1,4 +1,4 @@ -#include "SKKRuleTreeNode.cpp" +#include "SKKRuleTreeNode.h" int main() { SKKRuleTreeNode root; From t-suwa ¡÷ users.sourceforge.jp Wed Sep 12 22:45:16 2007 From: t-suwa ¡÷ users.sourceforge.jp (t-suwa ¡÷ users.sourceforge.jp) Date: Wed, 12 Sep 2007 22:45:16 +0900 Subject: [aquaskk-changes 368] CVS update: AquaSKK/src/context Message-ID: <1189604716.122768.31253.nullmailer@users.sourceforge.jp> Index: AquaSKK/src/context/SKKInputBuffer.cpp diff -u /dev/null AquaSKK/src/context/SKKInputBuffer.cpp:1.1.2.1 --- /dev/null Wed Sep 12 22:45:16 2007 +++ AquaSKK/src/context/SKKInputBuffer.cpp Wed Sep 12 22:45:15 2007 @@ -0,0 +1,83 @@ +/* -*- C++ -*- + MacOS X implementation of the SKK input method. + + Copyright (C) 2007 Tomotaka SUWA + + 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 "SKKInputBuffer.h" +#include "SKKRomanKanaConverter.h" +#include "jconv.h" +#include "utf8util.h" + +SKKInputBuffer::SKKInputBuffer() { + SelectInputMode(SKK::Hirakana); +} + +bool SKKInputBuffer::Input(char ch) { + bool converted = true; + + fixed_.clear(); + + switch(input_mode_) { + case SKK::Hirakana: + case SKK::Katakana: + case SKK::Jisx0201Kana: + buf_ += ch; + converted = SKKRomanKanaConverter::theInstance().Execute(input_mode_, buf_, fixed_, next_); + buf_ = next_; + break; + + case SKK::Ascii: + fixed_ += ch; + break; + + case SKK::Jisx0208Latin: + buf_ += ch; + jconv::ascii_to_jisx0208_latin(buf_, fixed_); + buf_.clear(); + break; + } + + return converted; +} + +void SKKInputBuffer::BackSpace() { + utf8::pop(buf_); +} + +void SKKInputBuffer::Clear() { + buf_.clear(); + fixed_.clear(); +} + +bool SKKInputBuffer::IsEmpty() const { + return buf_.empty(); +} + +void SKKInputBuffer::SelectInputMode(SKK::InputMode mode) { + input_mode_ = mode; + + Clear(); +} + +const std::string& SKKInputBuffer::InputString() const { + return buf_; +} + +const std::string& SKKInputBuffer::FixedString() const { + return fixed_; +} Index: AquaSKK/src/context/SKKInputBuffer.h diff -u /dev/null AquaSKK/src/context/SKKInputBuffer.h:1.1.2.1 --- /dev/null Wed Sep 12 22:45:16 2007 +++ AquaSKK/src/context/SKKInputBuffer.h Wed Sep 12 22:45:15 2007 @@ -0,0 +1,50 @@ +/* -*- C++ -*- + MacOS X implementation of the SKK input method. + + Copyright (C) 2007 Tomotaka SUWA + + 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__SKKInputBuffer__ +#define INC__SKKInputBuffer__ + +#include +#include "SKK.h" + +// ?¥å??????? +class SKKInputBuffer { + SKK::InputMode input_mode_; + std::string buf_; + std::string fixed_; + std::string next_; + +public: + SKKInputBuffer(); + + // ç·?? + bool Input(char ch); + void BackSpace(); + void Clear(); + + bool IsEmpty() const; + + void SelectInputMode(SKK::InputMode mode); + + const std::string& InputString() const; + const std::string& FixedString() const; +}; + +#endif From t-suwa ¡÷ users.sourceforge.jp Wed Sep 12 22:45:16 2007 From: t-suwa ¡÷ users.sourceforge.jp (t-suwa ¡÷ users.sourceforge.jp) Date: Wed, 12 Sep 2007 22:45:16 +0900 Subject: [aquaskk-changes 369] CVS update: AquaSKK/src/test Message-ID: <1189604716.282218.31263.nullmailer@users.sourceforge.jp> Index: AquaSKK/src/test/Makefile diff -u AquaSKK/src/test/Makefile:1.1.2.4 AquaSKK/src/test/Makefile:1.1.2.5 --- AquaSKK/src/test/Makefile:1.1.2.4 Tue Sep 11 23:08:20 2007 +++ AquaSKK/src/test/Makefile Wed Sep 12 22:45:16 2007 @@ -16,7 +16,7 @@ all: $(LIB) $(PROGS) test: all - for prog in $(PROGS); do ./$$prog; done + @for prog in $(PROGS); do ./$$prog; done clean: $(RM) -rf $(PROGS) $(LIB) *.o .depend @@ -31,7 +31,7 @@ $(CXX) -MM $(CPPFLAGS) $< | sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' > $@ .depend: - mkdir .depend + @mkdir .depend ifneq ($(MAKECMDGOALS), clean) -include $(addprefix .depend/,$(LIBOBJS:.o=.d) $(OBJS:.o=.d)) Index: AquaSKK/src/test/SKKInputBuffer_TEST.cpp diff -u /dev/null AquaSKK/src/test/SKKInputBuffer_TEST.cpp:1.1.2.1 --- /dev/null Wed Sep 12 22:45:16 2007 +++ AquaSKK/src/test/SKKInputBuffer_TEST.cpp Wed Sep 12 22:45:16 2007 @@ -0,0 +1,50 @@ +#include "SKKInputBuffer.h" +#include "SKKRomanKanaConverter.h" + +int main() { + SKKRomanKanaConverter& conv = SKKRomanKanaConverter::theInstance(); + SKKInputBuffer buffer; + + conv.Initialize("../context/kana-rule-list"); + + assert(!buffer.Input('k')); + assert(buffer.Input('a') && buffer.InputString() == "" && buffer.FixedString() == "?? && buffer.IsEmpty()); + + assert(!buffer.Input('c') && buffer.FixedString() == "" && !buffer.IsEmpty()); + assert(!buffer.Input('h') && buffer.FixedString() == "" && !buffer.IsEmpty()); + assert(!buffer.Input('l') && buffer.FixedString() == "l" && buffer.IsEmpty()); + + assert(!buffer.Input('z') && buffer.InputString() == "z"); + assert(buffer.Input('l') && buffer.FixedString() == "??); + + buffer.SelectInputMode(SKK::Katakana); + assert(buffer.Input('a') && buffer.FixedString() == "??); + + buffer.SelectInputMode(SKK::Jisx0201Kana); + assert(buffer.Input('a') && buffer.FixedString() == "ï½?); + + buffer.SelectInputMode(SKK::Jisx0208Latin); + assert(buffer.Input('Q') && buffer.FixedString() == "ï¼?); + + buffer.SelectInputMode(SKK::Ascii); + assert(buffer.Input('k') && buffer.FixedString() == "k"); + + buffer.SelectInputMode(SKK::Hirakana); + buffer.Input('c'); + buffer.Input('h'); + buffer.BackSpace(); + assert(buffer.InputString() == "c" && buffer.FixedString() == ""); + + buffer.Input('y'); + assert(buffer.Input('a') && buffer.IsEmpty() && buffer.FixedString() == "?¡ã?"); + + buffer.Input('k'); + buffer.Input('y'); + buffer.Clear(); + assert(buffer.IsEmpty()); + + buffer.Input('h'); + buffer.BackSpace(); + buffer.BackSpace(); + assert(buffer.IsEmpty()); +} From t-suwa ¡÷ users.sourceforge.jp Wed Sep 12 22:45:16 2007 From: t-suwa ¡÷ users.sourceforge.jp (t-suwa ¡÷ users.sourceforge.jp) Date: Wed, 12 Sep 2007 22:45:16 +0900 Subject: [aquaskk-changes 370] CVS update: AquaSKK/src/utility Message-ID: <1189604716.444570.31270.nullmailer@users.sourceforge.jp> Index: AquaSKK/src/utility/utf8util.h diff -u /dev/null AquaSKK/src/utility/utf8util.h:1.1.2.1 --- /dev/null Wed Sep 12 22:45:16 2007 +++ AquaSKK/src/utility/utf8util.h Wed Sep 12 22:45:16 2007 @@ -0,0 +1,181 @@ +/* -*- C++ -*- + * + * utf8util.h - UTF-8 utilities + * + * Copyright (c) 2007 Tomotaka SUWA, All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the authors nor the names of its contributors + * may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef INC__utf8util__ +#define INC__utf8util__ + +#include + +// UTF8 ?¤ã??????+template +class utf8iterator { + Iterator curr_; + + unsigned size() const { + static unsigned table[] = { + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x00 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x80 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xc0 + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 0xe0 + 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 0, 0 // 0xf0 + }; + + return table[(unsigned char)*curr_]; + } + + bool leadbyte() const { return size() != 0; } + + utf8iterator& next(int count = 1) { + for(int i = 0; i < count; ++ i) { + for(++ curr_; !leadbyte(); ++ curr_) {} + } + return *this; + } + + utf8iterator& prev(int count = 1) { + for(int i = 0; i < count; ++ i) { + for(-- curr_; !leadbyte(); -- curr_) {} + } + return *this; + } + +public: + utf8iterator() : curr_(0) {} + utf8iterator(Iterator iter) : curr_(iter) {} + utf8iterator& operator=(Iterator iter) { + curr_ = iter; + return *this; + } + + Iterator iterator() { return curr_; } + unsigned charsize() const { return size(); } + + std::string operator*() const { + return std::string(curr_, curr_ + size()); + } + + utf8iterator& operator++() { return next(); } + utf8iterator operator++(int) { + utf8iterator iter(*this); + ++ curr_; + return iter; + } + + utf8iterator& operator--() { return prev(); } + utf8iterator operator--(int) { + utf8iterator iter(*this); + -- curr_; + return iter; + } + + utf8iterator& operator+=(int count) { return 0 < count ? next(count) : prev(abs(count)); } + utf8iterator& operator-=(int count) { return 0 < count ? prev(count) : next(abs(count)); } + + friend bool operator==(const utf8iterator& lhs, const utf8iterator& rhs) { return lhs.curr_ == rhs.curr_; } + friend bool operator!=(const utf8iterator& lhs, const utf8iterator& rhs) { return lhs.curr_ != rhs.curr_; } + friend bool operator<(const utf8iterator& lhs, const utf8iterator& rhs) { return lhs.curr_ < rhs.curr_; } +}; + +template +int operator-(utf8iterator end, utf8iterator beg) { + int size = 0; + for(utf8iterator cur = beg; beg != end; ++ beg) { ++ size; } + return size; +} + +template +utf8iterator operator+(utf8iterator beg, int count) { return beg += count; } +template +utf8iterator operator-(utf8iterator beg, int count) { return beg -= count; } + +// ???????????+namespace utf8 { + typedef utf8iterator iterator; + typedef utf8iterator const_iterator; + + // UTF8 ????????? + unsigned length(const std::string& str) { + return const_iterator(str.end()) - const_iterator(str.begin()); + } + + // ???ä½?½®???å­???¿å? + // + // ä¾?? + // std::string str = "?????; + // utf8::push(str, "a", -3); // "a?????; + // utf8::push(str, "b"); // "a?????"; + // + void push(std::string& target, const std::string& str, int offset = 0) { + if(0 <= offset || target.empty()) { + target += str; + } else { + iterator end(target.end()); + iterator pos(end + offset); + + if(pos.iterator() < target.begin()) { + pos = target.begin(); + } + target.insert(pos.iterator() - target.begin(), str); + } + } + + // ???ä½?½®???ä¸??å­??????????+ // + // ä¾?? + // std::string str = "?????; + // utf8::pop(str); // "???"; + // utf8::pop(str, -1); // "å­?; + // + void pop(std::string& target, int offset = 0) { + iterator end(target.end()); + iterator pos(end + (0 < offset ? 0 : offset) - 1); + + if(!(pos.iterator() < target.begin())) { + target.erase(pos.iterator() - target.begin(), pos.charsize()); + } + } +}; + +#endif From t-suwa ¡÷ users.sourceforge.jp Sun Sep 16 09:15:12 2007 From: t-suwa ¡÷ users.sourceforge.jp (t-suwa ¡÷ users.sourceforge.jp) Date: Sun, 16 Sep 2007 09:15:12 +0900 Subject: [aquaskk-changes 371] CVS update: AquaSKK/src/context Message-ID: <1189901712.547359.2750.nullmailer@users.sourceforge.jp> Index: AquaSKK/src/context/SKKContext.cpp diff -u AquaSKK/src/context/SKKContext.cpp:1.1.2.1 AquaSKK/src/context/SKKContext.cpp:1.1.2.2 --- AquaSKK/src/context/SKKContext.cpp:1.1.2.1 Sun Sep 2 12:36:25 2007 +++ AquaSKK/src/context/SKKContext.cpp Sun Sep 16 09:15:12 2007 @@ -1,5 +1,5 @@ /* -*- C++ -*- - $Id: SKKContext.cpp,v 1.1.2.1 2007/09/02 03:36:25 t-suwa Exp $ + $Id: SKKContext.cpp,v 1.1.2.2 2007/09/16 00:15:12 t-suwa Exp $ MacOS X implementation of the SKK input method. @@ -31,10 +31,22 @@ SKKContext::SKKContext(const SKKContext& src) : prompt_(src.prompt_), result_(src.result_) { } +const std::string& SKKContext::Prompt() const { + return prompt_; +} + +SKKEventResult& SKKContext::Result() { + return result_; +} + const SKKEventResult& SKKContext::Result() const { return result_; } -const std::string& SKKContext::Prompt() const { - return prompt_; +SKKInputBuffer& SKKContext::InputBuffer() { + return input_; +} + +SKKEditBuffer& SKKContext::EditBuffer() { + return entry_; } Index: AquaSKK/src/context/SKKContext.h diff -u AquaSKK/src/context/SKKContext.h:1.1.2.1 AquaSKK/src/context/SKKContext.h:1.1.2.2 --- AquaSKK/src/context/SKKContext.h:1.1.2.1 Sun Sep 2 12:36:25 2007 +++ AquaSKK/src/context/SKKContext.h Sun Sep 16 09:15:12 2007 @@ -23,21 +23,27 @@ #include #include "SKKEventResult.h" +#include "SKKInputBuffer.h" +#include "SKKEditBuffer.h" // ?¥å??³ã?????¹ã? class SKKContext { std::string prompt_; // ?»é?????ºã?èª?- SKKEventResult result_; + SKKEventResult result_; // ???çµ?? + SKKInputBuffer input_; // ?¥å??????? + SKKEditBuffer entry_; // è¦??????????? public: SKKContext(); SKKContext(const std::string& prompt); SKKContext(const SKKContext& src); - // ???çµ?? + const std::string& Prompt() const; + SKKEventResult& Result(); const SKKEventResult& Result() const; - const std::string& Prompt() const; + SKKInputBuffer& InputBuffer(); + SKKEditBuffer& EditBuffer(); }; #endif Index: AquaSKK/src/context/SKKEditBuffer.cpp diff -u /dev/null AquaSKK/src/context/SKKEditBuffer.cpp:1.1.2.1 --- /dev/null Sun Sep 16 09:15:12 2007 +++ AquaSKK/src/context/SKKEditBuffer.cpp Sun Sep 16 09:15:12 2007 @@ -0,0 +1,106 @@ +/* -*- C++ -*- + MacOS X implementation of the SKK input method. + + Copyright (C) 2007 Tomotaka SUWA + + 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 "SKKEditBuffer.h" +#include "utf8util.h" + +/* + ??????½ã?ä½?½®?????? + + ?¥å???????????????????å°¾ã???¿½???????§ã?????????????ä¿?? + ???????½ã?ä½?½®?????????å°¾ã????????»ã????????????+*/ + +SKKEditBuffer::SKKEditBuffer() { + initialize(); +} + +SKKEditBuffer::SKKEditBuffer(const std::string& buf) : buf_(buf) { + initialize(); +} + +void SKKEditBuffer::Insert(unsigned char ch) { + std::string tmp; + + tmp += ch; + + Insert(tmp); +} + +void SKKEditBuffer::Insert(const std::string& str) { + utf8::push(buf_, str, - cursor_pos_); +} + +void SKKEditBuffer::BackSpace() { + if(cursor_pos_ == utf8::length(buf_)) return; + + utf8::pop(buf_, - cursor_pos_); +} + +void SKKEditBuffer::Delete() { + if(cursor_pos_ == 0) return; + + utf8::pop(buf_, - (cursor_pos_ - 1)); + CursorRight(); +} + +void SKKEditBuffer::Clear() { + buf_.clear(); + cursor_pos_ = 0; +} + +bool SKKEditBuffer::IsEmpty() const { + return buf_.empty(); +} + +void SKKEditBuffer::CursorLeft() { + if(cursor_pos_ < utf8::length(buf_)) { + ++ cursor_pos_; + } +} + +void SKKEditBuffer::CursorRight() { + if(cursor_pos_) { + -- cursor_pos_; + } +} + +void SKKEditBuffer::CursorUp() { + cursor_pos_ = utf8::length(buf_); +} + +void SKKEditBuffer::CursorDown() { + cursor_pos_ = 0; +} + +const std::string& SKKEditBuffer::EditString() const { + return buf_; +} + +unsigned SKKEditBuffer::CursorPosition() const { + return utf8::length(buf_) - cursor_pos_; +} + +// ====================================================================== +// private +// ====================================================================== +void SKKEditBuffer::initialize() { + cursor_pos_ = 0; +} Index: AquaSKK/src/context/SKKEditBuffer.h diff -u /dev/null AquaSKK/src/context/SKKEditBuffer.h:1.1.2.1 --- /dev/null Sun Sep 16 09:15:12 2007 +++ AquaSKK/src/context/SKKEditBuffer.h Sun Sep 16 09:15:12 2007 @@ -0,0 +1,57 @@ +/* -*- C++ -*- + MacOS X implementation of the SKK input method. + + Copyright (C) 2007 Tomotaka SUWA + + 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__SKKEditBuffer__ +#define INC__SKKEditBuffer__ + +#include + +// UTF8 ??????ç·?? & ????½ã?移å?????????+class SKKEditBuffer { + std::string buf_; + unsigned cursor_pos_; // ??°¾????????+ + void initialize(); + +public: + SKKEditBuffer(); + SKKEditBuffer(const std::string& buf); + + // ç·?? + void Insert(unsigned char ch); + void Insert(const std::string& str); + void BackSpace(); + void Delete(); + void Clear(); + + bool IsEmpty() const; + + // ????½ã?移å? + void CursorLeft(); + void CursorRight(); + void CursorUp(); // å·?? + void CursorDown(); // ?³ç? + + // ???ä»?+ const std::string& EditString() const; + unsigned CursorPosition() const; // ???????????0 ????? +}; + +#endif Index: AquaSKK/src/context/SKKInputBuffer.cpp diff -u AquaSKK/src/context/SKKInputBuffer.cpp:1.1.2.1 AquaSKK/src/context/SKKInputBuffer.cpp:1.1.2.2 --- AquaSKK/src/context/SKKInputBuffer.cpp:1.1.2.1 Wed Sep 12 22:45:15 2007 +++ AquaSKK/src/context/SKKInputBuffer.cpp Sun Sep 16 09:15:12 2007 @@ -74,6 +74,10 @@ Clear(); } +SKK::InputMode SKKInputBuffer::InputMode() const { + return input_mode_; +} + const std::string& SKKInputBuffer::InputString() const { return buf_; } Index: AquaSKK/src/context/SKKInputBuffer.h diff -u AquaSKK/src/context/SKKInputBuffer.h:1.1.2.1 AquaSKK/src/context/SKKInputBuffer.h:1.1.2.2 --- AquaSKK/src/context/SKKInputBuffer.h:1.1.2.1 Wed Sep 12 22:45:15 2007 +++ AquaSKK/src/context/SKKInputBuffer.h Sun Sep 16 09:15:12 2007 @@ -42,6 +42,7 @@ bool IsEmpty() const; void SelectInputMode(SKK::InputMode mode); + SKK::InputMode InputMode() const; const std::string& InputString() const; const std::string& FixedString() const; From t-suwa ¡÷ users.sourceforge.jp Sun Sep 16 09:15:43 2007 From: t-suwa ¡÷ users.sourceforge.jp (t-suwa ¡÷ users.sourceforge.jp) Date: Sun, 16 Sep 2007 09:15:43 +0900 Subject: [aquaskk-changes 372] CVS update: AquaSKK/src/test Message-ID: <1189901743.100677.2850.nullmailer@users.sourceforge.jp> Index: AquaSKK/src/test/Makefile diff -u AquaSKK/src/test/Makefile:1.1.2.5 AquaSKK/src/test/Makefile:1.1.2.6 --- AquaSKK/src/test/Makefile:1.1.2.5 Wed Sep 12 22:45:16 2007 +++ AquaSKK/src/test/Makefile Sun Sep 16 09:15:42 2007 @@ -11,7 +11,7 @@ LDFLAGS = -L. -ltest LIBOBJS = SKKKeymapEntry.o SKKKeymap.o SKKRuleTreeNode.o SKKRomanKanaConverter.o \ - SKKInputBuffer.o jconv.o + SKKInputBuffer.o jconv.o SKKEditBuffer.o all: $(LIB) $(PROGS) Index: AquaSKK/src/test/SKKEditBuffer_TEST.cpp diff -u /dev/null AquaSKK/src/test/SKKEditBuffer_TEST.cpp:1.1.2.1 --- /dev/null Sun Sep 16 09:15:43 2007 +++ AquaSKK/src/test/SKKEditBuffer_TEST.cpp Sun Sep 16 09:15:42 2007 @@ -0,0 +1,46 @@ +#include "SKKEditBuffer.h" + +int main() { + SKKEditBuffer buffer; + + assert(buffer.IsEmpty() && buffer.CursorPosition() == 0); + + buffer.Insert("abc"); + assert(!buffer.IsEmpty()); + + buffer.BackSpace(); + assert(buffer.EditString() == "ab"); + + buffer.CursorLeft(); + buffer.BackSpace(); + assert(buffer.EditString() == "b"); + + buffer.Clear(); + assert(buffer.IsEmpty()); + + buffer.Insert('a'); + assert(buffer.EditString() == "a"); + + buffer.Clear(); + buffer.Insert("????????¼¢å­???????"); + + buffer.CursorUp(); + buffer.Delete(); + assert(buffer.EditString() == "??????æ¼¢å?!??????"); + + buffer.CursorDown(); + buffer.CursorLeft(); + buffer.CursorLeft(); + buffer.CursorLeft(); + buffer.CursorLeft(); + buffer.CursorLeft(); + buffer.Delete(); + assert(buffer.EditString() == "??????æ¼¢å???????"); + assert(buffer.CursorPosition() == 6); + + buffer.CursorRight(); + buffer.CursorRight(); + buffer.BackSpace(); + buffer.BackSpace(); + assert(buffer.EditString() == "??????æ¼¢å????"); +} From t-suwa ¡÷ users.sourceforge.jp Sun Sep 16 09:18:52 2007 From: t-suwa ¡÷ users.sourceforge.jp (t-suwa ¡÷ users.sourceforge.jp) Date: Sun, 16 Sep 2007 09:18:52 +0900 Subject: [aquaskk-changes 373] CVS update: AquaSKK/src/editor Message-ID: <1189901932.285821.4831.nullmailer@users.sourceforge.jp> Index: AquaSKK/src/editor/SKKDirectInputState.cpp diff -u AquaSKK/src/editor/SKKDirectInputState.cpp:1.1.2.1 AquaSKK/src/editor/SKKDirectInputState.cpp:1.1.2.2 --- AquaSKK/src/editor/SKKDirectInputState.cpp:1.1.2.1 Sun Sep 2 12:36:25 2007 +++ AquaSKK/src/editor/SKKDirectInputState.cpp Sun Sep 16 09:18:52 2007 @@ -18,6 +18,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include #include "SKKDirectInputState.h" #include "SKKContext.h" #include "SKKEventParam.h" @@ -29,49 +30,121 @@ } SKKSubController* SKKDirectInputState::HandleInput(SKKContext& context, const SKKEventParam& param) { - return new SKKEmptySubController(0); + // ?´æŽ¥?¥å???????è¦????+ if(param.IsDirect()) { + // port ?¼ã??ºã? + return 0; + } + + SKKInputBuffer& buffer = context.InputBuffer(); + if(buffer.Input(param.code)) { + std::cerr << buffer.FixedString(); + } else { + State state = 0; + // 確å??????????????????? + do { + if(param.IsSwitchToAscii()) { + state = State::Transition(&SKKEnvironment::Ascii); + break; + } + + if(param.IsSwitchToJisx0208Latin()) { + state = State::Transition(&SKKEnvironment::Jisx0208Latin); + break; + } + + if(param.IsUpperCases()) { + state = State::Forward(&SKKEnvironment::Japanese); + break; + } + + if(param.IsEnterJapanese()) { + state = State::Transition(&SKKEnvironment::Japanese); + break; + } + + if(param.IsEnterAbbrev()) { + state = State::Transition(&SKKEnvironment::Abbreviation); + break; + } + } while(0); + + if(state) { + buffer.Clear(); + return new SKKEmptySubController(state); + } + + if(!buffer.FixedString().empty()) { + std::cerr << buffer.FixedString() << std::endl; + } + } + std::cerr << buffer.InputString() << std::endl; + + return 0; } -SKKSubController* SKKDirectInputState::HandleEnter(SKKContext& context, const SKKEventParam& param) { - return new SKKEmptySubController(0); +SKKSubController* SKKDirectInputState::HandleEnter(SKKContext&, const SKKEventParam&) { + // ?»é?å®??????????? + return 0; } -SKKSubController* SKKDirectInputState::HandleJmode(SKKContext& context, const SKKEventParam& param) { - return new SKKEmptySubController(0); +SKKSubController* SKKDirectInputState::HandleJmode(SKKContext&, const SKKEventParam&) { + return 0; } -SKKSubController* SKKDirectInputState::HandleCancel(SKKContext& context, const SKKEventParam& param) { - return new SKKEmptySubController(0); +SKKSubController* SKKDirectInputState::HandleCancel(SKKContext& context, const SKKEventParam&) { + SKKInputBuffer& buffer = context.InputBuffer(); + + if(!buffer.IsEmpty()) { + buffer.Clear(); + } else { + // port ?¼ã??ºã? + } + std::cerr << buffer.InputString() << std::endl; + + return 0; } -SKKSubController* SKKDirectInputState::HandleBackSpace(SKKContext& context, const SKKEventParam& param) { - return new SKKEmptySubController(0); +SKKSubController* SKKDirectInputState::HandleBackSpace(SKKContext& context, const SKKEventParam&) { + SKKInputBuffer& buffer = context.InputBuffer(); + + if(!buffer.IsEmpty()) { + buffer.BackSpace(); + } + std::cerr << buffer.InputString() << std::endl; + + return 0; } -SKKSubController* SKKDirectInputState::HandleDelete(SKKContext& context, const SKKEventParam& param) { - return new SKKEmptySubController(0); +SKKSubController* SKKDirectInputState::HandleDelete(SKKContext&, const SKKEventParam&) { + return 0; } -SKKSubController* SKKDirectInputState::HandleTab(SKKContext& context, const SKKEventParam& param) { - return new SKKEmptySubController(0); +SKKSubController* SKKDirectInputState::HandleTab(SKKContext&, const SKKEventParam&) { + return 0; } -SKKSubController* SKKDirectInputState::HandlePaste(SKKContext& context, const SKKEventParam& param) { - return new SKKEmptySubController(0); +SKKSubController* SKKDirectInputState::HandlePaste(SKKContext&, const SKKEventParam&) { + // port ?¼ã??ºã? + return 0; } -SKKSubController* SKKDirectInputState::HandleCursorLeft(SKKContext& context, const SKKEventParam& param) { - return new SKKEmptySubController(0); +SKKSubController* SKKDirectInputState::HandleCursorLeft(SKKContext&, const SKKEventParam&) { + // port ?¼ã??ºã? + return 0; } -SKKSubController* SKKDirectInputState::HandleCursorRight(SKKContext& context, const SKKEventParam& param) { - return new SKKEmptySubController(0); +SKKSubController* SKKDirectInputState::HandleCursorRight(SKKContext&, const SKKEventParam&) { + // port ?¼ã??ºã? + return 0; } -SKKSubController* SKKDirectInputState::HandleCursorUp(SKKContext& context, const SKKEventParam& param) { - return new SKKEmptySubController(0); +SKKSubController* SKKDirectInputState::HandleCursorUp(SKKContext&, const SKKEventParam&) { + // port ?¼ã??ºã? + return 0; } -SKKSubController* SKKDirectInputState::HandleCursorDown(SKKContext& context, const SKKEventParam& param) { - return new SKKEmptySubController(0); +SKKSubController* SKKDirectInputState::HandleCursorDown(SKKContext&, const SKKEventParam&) { + // port ?¼ã??ºã? + return 0; } Index: AquaSKK/src/editor/SKKDirectInputState.h diff -u AquaSKK/src/editor/SKKDirectInputState.h:1.1.2.2 AquaSKK/src/editor/SKKDirectInputState.h:1.1.2.3 --- AquaSKK/src/editor/SKKDirectInputState.h:1.1.2.2 Sun Sep 2 12:45:38 2007 +++ AquaSKK/src/editor/SKKDirectInputState.h Sun Sep 16 09:18:52 2007 @@ -18,8 +18,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef INC__SKKDirectState__ -#define INC__SKKDirectState__ +#ifndef INC__SKKDirectInputState__ +#define INC__SKKDirectInputState__ #include "SKKState.h" Index: AquaSKK/src/editor/SKKEditor.cpp diff -u AquaSKK/src/editor/SKKEditor.cpp:1.1.2.1 AquaSKK/src/editor/SKKEditor.cpp:1.1.2.2 --- AquaSKK/src/editor/SKKEditor.cpp:1.1.2.1 Sun Sep 2 12:36:25 2007 +++ AquaSKK/src/editor/SKKEditor.cpp Sun Sep 16 09:18:52 2007 @@ -20,6 +20,7 @@ #include "SKKEditor.h" #include "SKKDirectInputState.h" +#include "SKKEntryInputState.h" SKKEditor::SKKEditor() { initialize(); @@ -90,7 +91,7 @@ // ?¥å??¢ã?????? void SKKEditor::SelectInputMode(SKK::InputMode mode) { - + context_.InputBuffer().SelectInputMode(mode); } // ????¶æ?å¤?? @@ -101,6 +102,9 @@ break; case SKK::EntryInput: + state_ = &SKKEntryInputState::theInstance(); + break; + case SKK::OkuriInput: case SKK::AbbrevInput: case SKK::Completion: Index: AquaSKK/src/editor/SKKEntryInputState.cpp diff -u /dev/null AquaSKK/src/editor/SKKEntryInputState.cpp:1.1.2.1 --- /dev/null Sun Sep 16 09:18:52 2007 +++ AquaSKK/src/editor/SKKEntryInputState.cpp Sun Sep 16 09:18:52 2007 @@ -0,0 +1,300 @@ +/* -*- C++ -*- + MacOS X implementation of the SKK input method. + + Copyright (C) 2007 Tomotaka SUWA + + 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 +#include "SKKEntryInputState.h" +#include "SKKContext.h" +#include "SKKEventParam.h" +#include "SKKEmptySubController.h" +#include "jconv.h" + +SKKEntryInputState& SKKEntryInputState::theInstance() { + static SKKEntryInputState obj; + return obj; +} + +SKKSubController* SKKEntryInputState::HandleInput(SKKContext& context, const SKKEventParam& param) { + SKKInputBuffer& buffer = context.InputBuffer(); + SKKEditBuffer& edit = context.EditBuffer(); + + if(!edit.IsEmpty()) { + State state = 0; + + do { + // ????????#1 + if(param.IsToggleKana()) { + std::string result; + toggleKana(buffer.InputMode(), edit.EditString(), result); + edit.Clear(); + std::cerr << result << std::endl; + state = State::Transition(&SKKEnvironment::KanaInput); + break; + } + + // ????????#2 + if(param.IsToggleJisx0201Kana()) { + std::string result; + toggleJisx0201Kana(buffer.InputMode(), edit.EditString(), result); + edit.Clear(); + std::cerr << result << std::endl; + state = State::Transition(&SKKEnvironment::KanaInput); + break; + } + + // ?????? + if(param.IsUpperCases()) { + std::cerr << "?????????" << std::endl; + break; + } + + // å¤??+ if(param.IsNextCandidate()) { + std::cerr << "å¤???å§? << std::endl; + break; + } + } while(0); + + if(state) { + return new SKKEmptySubController(state); + } + } + + if(buffer.Input(std::tolower(param.code))) { + edit.Insert(buffer.FixedString()); + } else { + State state = 0; + + do { + if(param.IsSwitchToAscii()) { + state = State::Transition(&SKKEnvironment::Ascii); + break; + } + + if(param.IsSwitchToJisx0208Latin()) { + state = State::Transition(&SKKEnvironment::Jisx0208Latin); + break; + } + + if(param.IsEnterJapanese() && !edit.IsEmpty()) { + state = State::Transition(&SKKEnvironment::Japanese); + break; + } + } while(0); + + if(state) { + std::cerr << edit.EditString() << std::endl; + edit.Clear(); + buffer.Clear(); + return new SKKEmptySubController(state); + } + + if(!buffer.FixedString().empty()) { + edit.Insert(buffer.FixedString()); + } + } + + std::cerr << edit.EditString() << buffer.InputString() << std::endl; + + return 0; +} + +SKKSubController* SKKEntryInputState::HandleEnter(SKKContext& context, const SKKEventParam& param) { + SKKSubController* result = HandleJmode(context, param); + + // ?¹è??????????ï¼?egg-like-new-line) + + return result; +} + +SKKSubController* SKKEntryInputState::HandleJmode(SKKContext& context, const SKKEventParam&) { + SKKInputBuffer& buffer = context.InputBuffer(); + SKKEditBuffer& edit = context.EditBuffer(); + + // ?¾å????è£??確å? + std::cerr << edit.EditString() << std::endl; + + edit.Clear(); + buffer.Clear(); + + return new SKKEmptySubController(State::Transition(&SKKEnvironment::KanaInput)); +} + +SKKSubController* SKKEntryInputState::HandleCancel(SKKContext& context, const SKKEventParam&) { + SKKInputBuffer& buffer = context.InputBuffer(); + SKKEditBuffer& edit = context.EditBuffer(); + + edit.Clear(); + buffer.Clear(); + + // 空ã???? + std::cerr << edit.EditString() << std::endl; + + return new SKKEmptySubController(State::Transition(&SKKEnvironment::KanaInput)); +} + +SKKSubController* SKKEntryInputState::HandleBackSpace(SKKContext& context, const SKKEventParam&) { + SKKInputBuffer& buffer = context.InputBuffer(); + SKKEditBuffer& edit = context.EditBuffer(); + + if(!buffer.IsEmpty()) { + buffer.BackSpace(); + } else { + if(!edit.IsEmpty()) { + edit.BackSpace(); + } else { + return new SKKEmptySubController(State::Transition(&SKKEnvironment::KanaInput)); + } + } + + std::cerr << edit.EditString() << buffer.InputString() << std::endl; + + return 0; +} + +SKKSubController* SKKEntryInputState::HandleDelete(SKKContext& context, const SKKEventParam&) { + SKKInputBuffer& buffer = context.InputBuffer(); + SKKEditBuffer& edit = context.EditBuffer(); + + if(buffer.IsEmpty() && !edit.IsEmpty()) { + edit.Delete(); + + std::cerr << edit.EditString() << std::endl; + } + + return 0; +} + +SKKSubController* SKKEntryInputState::HandleTab(SKKContext& context, const SKKEventParam&) { + // æ¤?´¢?§ã???? + if(0) { + // è£???¢ã???+ return new SKKEmptySubController(State::Transition(&SKKEnvironment::EntryCompletion)); + } else { + return 0; + } +} + +SKKSubController* SKKEntryInputState::HandlePaste(SKKContext& context, const SKKEventParam&) { + // ????¹ã??????? + if(0) { + SKKInputBuffer& buffer = context.InputBuffer(); + SKKEditBuffer& edit = context.EditBuffer(); + + buffer.Clear(); + edit.Insert("paste string"); + + std::cerr << edit.EditString() << std::endl; + } + + return 0; +} + +SKKSubController* SKKEntryInputState::HandleCursorLeft(SKKContext& context, const SKKEventParam&) { + SKKInputBuffer& buffer = context.InputBuffer(); + SKKEditBuffer& edit = context.EditBuffer(); + + buffer.Clear(); + edit.CursorLeft(); + + std::cerr << edit.EditString() << std::endl; + + return 0; +} + +SKKSubController* SKKEntryInputState::HandleCursorRight(SKKContext& context, const SKKEventParam&) { + SKKInputBuffer& buffer = context.InputBuffer(); + SKKEditBuffer& edit = context.EditBuffer(); + + buffer.Clear(); + edit.CursorRight(); + + std::cerr << edit.EditString() << std::endl; + + return 0; +} + +SKKSubController* SKKEntryInputState::HandleCursorUp(SKKContext& context, const SKKEventParam&) { + SKKInputBuffer& buffer = context.InputBuffer(); + SKKEditBuffer& edit = context.EditBuffer(); + + buffer.Clear(); + edit.CursorUp(); + + std::cerr << edit.EditString() << std::endl; + + return 0; +} + +SKKSubController* SKKEntryInputState::HandleCursorDown(SKKContext& context, const SKKEventParam&) { + SKKInputBuffer& buffer = context.InputBuffer(); + SKKEditBuffer& edit = context.EditBuffer(); + + buffer.Clear(); + edit.CursorDown(); + + std::cerr << edit.EditString() << std::endl; + + return 0; +} + +// ====================================================================== +// private method +// ====================================================================== +void SKKEntryInputState::toggleKana(SKK::InputMode mode, const std::string& from, std::string& to) { + to.clear(); + + switch(mode) { + case SKK::Hirakana: + jconv::hirakana_to_katakana(from, to); + break; + + case SKK::Katakana: + jconv::katakana_to_hirakana(from, to); + break; + + case SKK::Jisx0201Kana: + jconv::jisx0201_kana_to_katakana(from, to); + break; + + default: + break; + } +} + +void SKKEntryInputState::toggleJisx0201Kana(SKK::InputMode mode, const std::string& from, std::string& to) { + to.clear(); + + switch(mode) { + case SKK::Hirakana: + jconv::hirakana_to_jisx0201_kana(from, to); + break; + + case SKK::Katakana: + jconv::katakana_to_jisx0201_kana(from, to); + break; + + case SKK::Jisx0201Kana: + jconv::jisx0201_kana_to_hirakana(from, to); + break; + + default: + break; + } +} Index: AquaSKK/src/editor/SKKEntryInputState.h diff -u /dev/null AquaSKK/src/editor/SKKEntryInputState.h:1.1.2.1 --- /dev/null Sun Sep 16 09:18:52 2007 +++ AquaSKK/src/editor/SKKEntryInputState.h Sun Sep 16 09:18:52 2007 @@ -0,0 +1,50 @@ +/* -*- C++ -*- + MacOS X implementation of the SKK input method. + + Copyright (C) 2007 Tomotaka SUWA + + 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__SKKEntryInputState__ +#define INC__SKKEntryInputState__ + +#include +#include "SKK.h" +#include "SKKState.h" + +// è¦??????¥å??¶æ? +struct SKKEntryInputState : public SKKState { + static SKKEntryInputState& theInstance(); + + virtual SKKSubController* HandleInput(SKKContext& context, const SKKEventParam& param); + virtual SKKSubController* HandleEnter(SKKContext& context, const SKKEventParam& param); + virtual SKKSubController* HandleJmode(SKKContext& context, const SKKEventParam& param); + virtual SKKSubController* HandleCancel(SKKContext& context, const SKKEventParam& param); + virtual SKKSubController* HandleBackSpace(SKKContext& context, const SKKEventParam& param); + virtual SKKSubController* HandleDelete(SKKContext& context, const SKKEventParam& param); + virtual SKKSubController* HandleTab(SKKContext& context, const SKKEventParam& param); + virtual SKKSubController* HandlePaste(SKKContext& context, const SKKEventParam& param); + virtual SKKSubController* HandleCursorLeft(SKKContext& context, const SKKEventParam& param); + virtual SKKSubController* HandleCursorRight(SKKContext& context, const SKKEventParam& param); + virtual SKKSubController* HandleCursorUp(SKKContext& context, const SKKEventParam& param); + virtual SKKSubController* HandleCursorDown(SKKContext& context, const SKKEventParam& param); + +private: + void toggleKana(SKK::InputMode mode, const std::string& from, std::string& to); + void toggleJisx0201Kana(SKK::InputMode mode, const std::string& from, std::string& to); +}; + +#endif Index: AquaSKK/src/editor/SKKState.h diff -u AquaSKK/src/editor/SKKState.h:1.1.2.1 AquaSKK/src/editor/SKKState.h:1.1.2.2 --- AquaSKK/src/editor/SKKState.h:1.1.2.1 Sun Sep 2 12:36:25 2007 +++ AquaSKK/src/editor/SKKState.h Sun Sep 16 09:18:52 2007 @@ -21,12 +21,14 @@ #ifndef INC__SKKState__ #define INC__SKKState__ +#include "SKKEngine.h" + class SKKContext; class SKKEventParam; class SKKSubController; // ?¶æ?????¹ã??³ã?????¼ã? -struct SKKState { +struct SKKState : public StateContainerTraits { virtual SKKSubController* HandleInput(SKKContext& context, const SKKEventParam& param) = 0; virtual SKKSubController* HandleEnter(SKKContext& context, const SKKEventParam& param) = 0; virtual SKKSubController* HandleJmode(SKKContext& context, const SKKEventParam& param) = 0; From t-suwa ¡÷ users.sourceforge.jp Sun Sep 16 09:21:44 2007 From: t-suwa ¡÷ users.sourceforge.jp (t-suwa ¡÷ users.sourceforge.jp) Date: Sun, 16 Sep 2007 09:21:44 +0900 Subject: [aquaskk-changes 374] CVS update: AquaSKK/proj/AquaSKK.xcodeproj Message-ID: <1189902104.773496.6075.nullmailer@users.sourceforge.jp> Index: AquaSKK/proj/AquaSKK.xcodeproj/project.pbxproj diff -u AquaSKK/proj/AquaSKK.xcodeproj/project.pbxproj:1.1.2.4 AquaSKK/proj/AquaSKK.xcodeproj/project.pbxproj:1.1.2.5 --- AquaSKK/proj/AquaSKK.xcodeproj/project.pbxproj:1.1.2.4 Sun Sep 2 12:36:24 2007 +++ AquaSKK/proj/AquaSKK.xcodeproj/project.pbxproj Sun Sep 16 09:21:44 2007 @@ -104,8 +104,13 @@ D37896C90C759A4800BE9E85 /* AquaSKK-Katakana.tif in Resources */ = {isa = PBXBuildFile; fileRef = D37896C30C759A4800BE9E85 /* AquaSKK-Katakana.tif */; }; D37896CA0C759A4800BE9E85 /* AquaSKK-Roman.tif in Resources */ = {isa = PBXBuildFile; fileRef = D37896C40C759A4800BE9E85 /* AquaSKK-Roman.tif */; }; D37896E10C759B3B00BE9E85 /* AquaSKKServer.app in CopyFiles */ = {isa = PBXBuildFile; fileRef = D37894180C74851300BE9E85 /* AquaSKKServer.app */; }; + D397D36B0C9BF755002497FE /* SKKEntryInputState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D397D3690C9BF755002497FE /* SKKEntryInputState.cpp */; }; + D397D36F0C9BF779002497FE /* SKKEditBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D397D36D0C9BF779002497FE /* SKKEditBuffer.cpp */; }; D3A256AC0C7DD6B4007A6A1A /* keymap.conf in Resources */ = {isa = PBXBuildFile; fileRef = D3A256AB0C7DD6B4007A6A1A /* keymap.conf */; }; D3C4FFC00C7EF88E007AE470 /* SKKKeymap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D3C4FFBE0C7EF88E007AE470 /* SKKKeymap.cpp */; }; + D3CD14470C9826A000C10019 /* SKKInputBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D3CD14400C9826A000C10019 /* SKKInputBuffer.cpp */; }; + D3CD14490C9826A000C10019 /* SKKRomanKanaConverter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D3CD14420C9826A000C10019 /* SKKRomanKanaConverter.cpp */; }; + D3CD144B0C9826A000C10019 /* SKKRuleTreeNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D3CD14440C9826A000C10019 /* SKKRuleTreeNode.cpp */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -302,9 +307,20 @@ D37896C20C759A4800BE9E85 /* AquaSKK-InputMethod.tif */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = "AquaSKK-InputMethod.tif"; path = "../Icons/AquaSKK-InputMethod.tif"; sourceTree = SOURCE_ROOT; }; D37896C30C759A4800BE9E85 /* AquaSKK-Katakana.tif */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = "AquaSKK-Katakana.tif"; path = "../Icons/AquaSKK-Katakana.tif"; sourceTree = SOURCE_ROOT; }; D37896C40C759A4800BE9E85 /* AquaSKK-Roman.tif */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = "AquaSKK-Roman.tif"; path = "../Icons/AquaSKK-Roman.tif"; sourceTree = SOURCE_ROOT; }; + D397D3690C9BF755002497FE /* SKKEntryInputState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SKKEntryInputState.cpp; path = ../src/editor/SKKEntryInputState.cpp; sourceTree = SOURCE_ROOT; }; + D397D36A0C9BF755002497FE /* SKKEntryInputState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SKKEntryInputState.h; path = ../src/editor/SKKEntryInputState.h; sourceTree = SOURCE_ROOT; }; + D397D36D0C9BF779002497FE /* SKKEditBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SKKEditBuffer.cpp; path = ../src/context/SKKEditBuffer.cpp; sourceTree = SOURCE_ROOT; }; + D397D36E0C9BF779002497FE /* SKKEditBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SKKEditBuffer.h; path = ../src/context/SKKEditBuffer.h; sourceTree = SOURCE_ROOT; }; D3A256AB0C7DD6B4007A6A1A /* keymap.conf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = keymap.conf; path = ../src/keybindings/keymap.conf; sourceTree = SOURCE_ROOT; }; D3C4FFBE0C7EF88E007AE470 /* SKKKeymap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SKKKeymap.cpp; path = ../src/keybindings/SKKKeymap.cpp; sourceTree = SOURCE_ROOT; }; D3C4FFBF0C7EF88E007AE470 /* SKKKeymap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SKKKeymap.h; path = ../src/keybindings/SKKKeymap.h; sourceTree = SOURCE_ROOT; }; + D3CD14400C9826A000C10019 /* SKKInputBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SKKInputBuffer.cpp; path = ../src/context/SKKInputBuffer.cpp; sourceTree = SOURCE_ROOT; }; + D3CD14410C9826A000C10019 /* SKKInputBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SKKInputBuffer.h; path = ../src/context/SKKInputBuffer.h; sourceTree = SOURCE_ROOT; }; + D3CD14420C9826A000C10019 /* SKKRomanKanaConverter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SKKRomanKanaConverter.cpp; path = ../src/context/SKKRomanKanaConverter.cpp; sourceTree = SOURCE_ROOT; }; + D3CD14430C9826A000C10019 /* SKKRomanKanaConverter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SKKRomanKanaConverter.h; path = ../src/context/SKKRomanKanaConverter.h; sourceTree = SOURCE_ROOT; }; + D3CD14440C9826A000C10019 /* SKKRuleTreeNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SKKRuleTreeNode.cpp; path = ../src/context/SKKRuleTreeNode.cpp; sourceTree = SOURCE_ROOT; }; + D3CD14450C9826A000C10019 /* SKKRuleTreeNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SKKRuleTreeNode.h; path = ../src/context/SKKRuleTreeNode.h; sourceTree = SOURCE_ROOT; }; + D3CD144D0C98277100C10019 /* utf8util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = utf8util.h; path = ../src/utility/utf8util.h; sourceTree = SOURCE_ROOT; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -455,6 +471,14 @@ children = ( D324B2320C8A49C500E86DDA /* SKKContext.h */, D324B2310C8A49C500E86DDA /* SKKContext.cpp */, + D3CD14410C9826A000C10019 /* SKKInputBuffer.h */, + D3CD14400C9826A000C10019 /* SKKInputBuffer.cpp */, + D397D36E0C9BF779002497FE /* SKKEditBuffer.h */, + D397D36D0C9BF779002497FE /* SKKEditBuffer.cpp */, + D3CD14430C9826A000C10019 /* SKKRomanKanaConverter.h */, + D3CD14420C9826A000C10019 /* SKKRomanKanaConverter.cpp */, + D3CD14450C9826A000C10019 /* SKKRuleTreeNode.h */, + D3CD14440C9826A000C10019 /* SKKRuleTreeNode.cpp */, ); name = context; sourceTree = ""; @@ -479,6 +503,8 @@ D324B22B0C8A498C00E86DDA /* SKKState.h */, D324B2280C8A498C00E86DDA /* SKKDirectInputState.h */, D324B2270C8A498C00E86DDA /* SKKDirectInputState.cpp */, + D397D36A0C9BF755002497FE /* SKKEntryInputState.h */, + D397D3690C9BF755002497FE /* SKKEntryInputState.cpp */, ); name = editor; sourceTree = ""; @@ -574,6 +600,7 @@ D37894720C752D3200BE9E85 /* utility */ = { isa = PBXGroup; children = ( + D3CD144D0C98277100C10019 /* utf8util.h */, ); name = utility; sourceTree = ""; @@ -977,6 +1004,11 @@ D324B22C0C8A498C00E86DDA /* SKKDirectInputState.cpp in Sources */, D324B22E0C8A498C00E86DDA /* SKKEditor.cpp in Sources */, D324B2330C8A49C500E86DDA /* SKKContext.cpp in Sources */, + D3CD14470C9826A000C10019 /* SKKInputBuffer.cpp in Sources */, + D3CD14490C9826A000C10019 /* SKKRomanKanaConverter.cpp in Sources */, + D3CD144B0C9826A000C10019 /* SKKRuleTreeNode.cpp in Sources */, + D397D36B0C9BF755002497FE /* SKKEntryInputState.cpp in Sources */, + D397D36F0C9BF779002497FE /* SKKEditBuffer.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; From t-suwa ¡÷ users.sourceforge.jp Sun Sep 16 09:21:44 2007 From: t-suwa ¡÷ users.sourceforge.jp (t-suwa ¡÷ users.sourceforge.jp) Date: Sun, 16 Sep 2007 09:21:44 +0900 Subject: [aquaskk-changes 375] CVS update: AquaSKK/src/component Message-ID: <1189902104.993669.6083.nullmailer@users.sourceforge.jp> Index: AquaSKK/src/component/SKKComponent.cpp diff -u AquaSKK/src/component/SKKComponent.cpp:1.1.2.2 AquaSKK/src/component/SKKComponent.cpp:1.1.2.3 --- AquaSKK/src/component/SKKComponent.cpp:1.1.2.2 Sun Aug 26 01:34:45 2007 +++ AquaSKK/src/component/SKKComponent.cpp Sun Sep 16 09:21:44 2007 @@ -1,5 +1,5 @@ /* -*- C++ -*- - $Id: SKKComponent.cpp,v 1.1.2.2 2007/08/25 16:34:45 t-suwa Exp $ + $Id: SKKComponent.cpp,v 1.1.2.3 2007/09/16 00:21:44 t-suwa Exp $ MacOS X implementation of the SKK input method. @@ -21,6 +21,7 @@ */ #include +#include #include #include #include @@ -36,6 +37,7 @@ #include "SKKComponent.h" #include "SKKSession.h" #include "SKKPreProcessor.h" +#include "SKKRomanKanaConverter.h" enum { kAboutCommand = 'abou', @@ -108,6 +110,16 @@ // ?????????????? SKKPreProcessor::theInstance().Initialize(); + + // ?????????å¤????¼ã??????? + std::string path(SKKConfig::LibraryDirectory() + "kana-rule-list"); + std::ifstream ifs(path.c_str()); + if(ifs) { + SKKRomanKanaConverter::theInstance().Initialize(path); + } else { + SKKRomanKanaConverter::theInstance().Initialize(SKKConfig::ResourceDirectory() + "kana-rule-list"); + } + } SKKComponent::~SKKComponent() { From t-suwa ¡÷ users.sourceforge.jp Sun Sep 16 09:21:45 2007 From: t-suwa ¡÷ users.sourceforge.jp (t-suwa ¡÷ users.sourceforge.jp) Date: Sun, 16 Sep 2007 09:21:45 +0900 Subject: [aquaskk-changes 376] CVS update: AquaSKK/src/controller Message-ID: <1189902105.188904.6090.nullmailer@users.sourceforge.jp> Index: AquaSKK/src/controller/SKKController.cpp diff -u AquaSKK/src/controller/SKKController.cpp:1.1.2.1 AquaSKK/src/controller/SKKController.cpp:1.1.2.2 --- AquaSKK/src/controller/SKKController.cpp:1.1.2.1 Sun Sep 2 12:36:25 2007 +++ AquaSKK/src/controller/SKKController.cpp Sun Sep 16 09:21:45 2007 @@ -128,9 +128,15 @@ } State SKKController::invoke(SKKEditor::Handler handler, const SKKEventParam& param) { - // SKKEditor.HandleXXX ??µ·?????- std::auto_ptr sub((editor().*handler)(param)); + SKKSubController* result = (editor().*handler)(param); - // ???????????? - return sub->Apply(*this); + if(result) { + // SKKEditor.HandleXXX ??µ·?????+ std::auto_ptr sub(result); + + // ???????????? + return sub->Apply(*this); + } + + return 0; } From t-suwa ¡÷ users.sourceforge.jp Sun Sep 16 09:21:45 2007 From: t-suwa ¡÷ users.sourceforge.jp (t-suwa ¡÷ users.sourceforge.jp) Date: Sun, 16 Sep 2007 09:21:45 +0900 Subject: [aquaskk-changes 377] CVS update: AquaSKK/src/keybindings Message-ID: <1189902105.366459.6098.nullmailer@users.sourceforge.jp> Index: AquaSKK/src/keybindings/SKKPreProcessor.cpp diff -u AquaSKK/src/keybindings/SKKPreProcessor.cpp:1.1.2.1 AquaSKK/src/keybindings/SKKPreProcessor.cpp:1.1.2.2 --- AquaSKK/src/keybindings/SKKPreProcessor.cpp:1.1.2.1 Sun Aug 26 01:34:45 2007 +++ AquaSKK/src/keybindings/SKKPreProcessor.cpp Sun Sep 16 09:21:45 2007 @@ -1,5 +1,5 @@ /* -*- C++ -*- - $Id: SKKPreProcessor.cpp,v 1.1.2.1 2007/08/25 16:34:45 t-suwa Exp $ + $Id: SKKPreProcessor.cpp,v 1.1.2.2 2007/09/16 00:21:45 t-suwa Exp $ MacOS X implementation of the SKK input method. @@ -20,6 +20,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include #include "SKKConfig.h" #include "SKKPreProcessor.h" @@ -32,8 +33,14 @@ } void SKKPreProcessor::Initialize() { - keymap_.Initialize(SKKConfig::ResourceDirectory() + "keymap.conf"); - keymap_.Initialize(SKKConfig::LibraryDirectory() + "keymap.conf"); + std::string path(SKKConfig::LibraryDirectory() + "keymap.conf"); + std::ifstream ifs(path.c_str()); + + if(ifs) { + keymap_.Initialize(path); + } else { + keymap_.Initialize(SKKConfig::ResourceDirectory() + "keymap.conf"); + } } SKKEventParam SKKPreProcessor::Execute(const EventRef event) { From t-suwa ¡÷ users.sourceforge.jp Sun Sep 16 09:21:45 2007 From: t-suwa ¡÷ users.sourceforge.jp (t-suwa ¡÷ users.sourceforge.jp) Date: Sun, 16 Sep 2007 09:21:45 +0900 Subject: [aquaskk-changes 378] CVS update: AquaSKK/src/statemachine Message-ID: <1189902105.621155.6105.nullmailer@users.sourceforge.jp> Index: AquaSKK/src/statemachine/GenericStateMachine.h diff -u AquaSKK/src/statemachine/GenericStateMachine.h:1.1.2.1 AquaSKK/src/statemachine/GenericStateMachine.h:1.1.2.2 --- AquaSKK/src/statemachine/GenericStateMachine.h:1.1.2.1 Sun Aug 26 01:34:45 2007 +++ AquaSKK/src/statemachine/GenericStateMachine.h Sun Sep 16 09:21:45 2007 @@ -231,11 +231,13 @@ // ====================================================================== template class Inspector = EmptyInspector> class GenericStateMachine { + public: typedef typename StateContainer::Handler Handler; typedef typename StateContainer::Event Event; typedef typename StateContainer::State State; typedef typename StateContainer::Output Output; + private: StateContainer container_; Inspector inspector_; From t-suwa ¡÷ users.sourceforge.jp Sun Sep 16 09:21:45 2007 From: t-suwa ¡÷ users.sourceforge.jp (t-suwa ¡÷ users.sourceforge.jp) Date: Sun, 16 Sep 2007 09:21:45 +0900 Subject: [aquaskk-changes 379] CVS update: AquaSKK/src/utility Message-ID: <1189902105.807266.6112.nullmailer@users.sourceforge.jp> Index: AquaSKK/src/utility/utf8util.h diff -u AquaSKK/src/utility/utf8util.h:1.1.2.1 AquaSKK/src/utility/utf8util.h:1.1.2.2 --- AquaSKK/src/utility/utf8util.h:1.1.2.1 Wed Sep 12 22:45:16 2007 +++ AquaSKK/src/utility/utf8util.h Sun Sep 16 09:21:45 2007 @@ -131,12 +131,12 @@ utf8iterator operator-(utf8iterator beg, int count) { return beg -= count; } // ???????????-namespace utf8 { +struct utf8 { typedef utf8iterator iterator; typedef utf8iterator const_iterator; // UTF8 ????????? - unsigned length(const std::string& str) { + static unsigned length(const std::string& str) { return const_iterator(str.end()) - const_iterator(str.begin()); } @@ -147,7 +147,7 @@ // utf8::push(str, "a", -3); // "a?????; // utf8::push(str, "b"); // "a?????"; // - void push(std::string& target, const std::string& str, int offset = 0) { + static void push(std::string& target, const std::string& str, int offset = 0) { if(0 <= offset || target.empty()) { target += str; } else { @@ -168,7 +168,7 @@ // utf8::pop(str); // "???"; // utf8::pop(str, -1); // "å­?; // - void pop(std::string& target, int offset = 0) { + static void pop(std::string& target, int offset = 0) { iterator end(target.end()); iterator pos(end + (0 < offset ? 0 : offset) - 1); From t-suwa ¡÷ users.sourceforge.jp Wed Sep 19 22:57:17 2007 From: t-suwa ¡÷ users.sourceforge.jp (t-suwa ¡÷ users.sourceforge.jp) Date: Wed, 19 Sep 2007 22:57:17 +0900 Subject: [aquaskk-changes 380] CVS update: AquaSKK Message-ID: <1190210237.820387.1082.nullmailer@users.sourceforge.jp> Index: AquaSKK/BIMInputEvents.cpp diff -u AquaSKK/BIMInputEvents.cpp:1.3 AquaSKK/BIMInputEvents.cpp:1.4 --- AquaSKK/BIMInputEvents.cpp:1.3 Wed Apr 26 22:36:12 2006 +++ AquaSKK/BIMInputEvents.cpp Wed Sep 19 22:57:17 2007 @@ -1,5 +1,5 @@ /* - $Id: BIMInputEvents.cpp,v 1.3 2006/04/26 13:36:12 t-suwa Exp $ + $Id: BIMInputEvents.cpp,v 1.4 2007/09/19 13:57:17 t-suwa Exp $ MacOS X implementation of the SKK input method. @@ -228,10 +228,7 @@ // ????????????????B void BIMHandleOffsetToPos(struct OffsetToPosParams *offsetToPosParams) { - BIMHandleOffsetToPos(BIMGetActiveSession(), offsetToPosParams); -} - -void BIMHandleOffsetToPos(BIMSessionHandle inSessionHandle, struct OffsetToPosParams *offsetToPosParams) { + BIMSessionHandle inSessionHandle = BIMGetActiveSession(); OSStatus status; ComponentInstance componentInstance; EventRef event; Index: AquaSKK/ChangeLog diff -u AquaSKK/ChangeLog:1.43 AquaSKK/ChangeLog:1.44 --- AquaSKK/ChangeLog:1.43 Fri Jun 15 22:18:28 2007 +++ AquaSKK/ChangeLog Wed Sep 19 22:57:17 2007 @@ -1,3 +1,18 @@ +2007-09-19 Tomotaka SUWA + + * BIMInputEvents.cpp (BIMHandleOffsetToPos): ?»ã??·ã??³ã??³ã????è¦?+ æ±??????¼ã??¼ã??¼ã????æ­¢ã? + + * skkserv.cpp: ?µã????è£??è¦????????示ç????è¦????????ä¿????+ + * SKKDictionary.cpp: ?????????ä¸?????ç´¢ã??¤åŽ»??+ + * KotoeriDictionary.cpp: æ¤?´¢?§ã????ä¸?????ä¿????????æ¤?´¢çµ????+ ????³ã????å¿??????????¿½??? + + * KanjiConversionMode.cpp: ???対象???????³ã??¼ã????????????? + ????¤ã???????????·å???¿®æ­£ã? + 2007-06-15 Tomotaka SUWA * AquaSKK.pbproj/project.pbxproj: Panther ?§ã?????§ã???????ä¿?Index: AquaSKK/Info-AquaSKKInputMethod.plist diff -u AquaSKK/Info-AquaSKKInputMethod.plist:1.16 AquaSKK/Info-AquaSKKInputMethod.plist:1.17 --- AquaSKK/Info-AquaSKKInputMethod.plist:1.16 Sat Jun 9 10:53:53 2007 +++ AquaSKK/Info-AquaSKKInputMethod.plist Wed Sep 19 22:57:17 2007 @@ -19,11 +19,11 @@ CFBundlePackageType thng CFBundleShortVersionString - 3.4 + modest-learning 1.1 CFBundleSignature askk CFBundleVersion - 2007-06-09 + 2007-09-18 CSResourcesFileMapped tsInputMethodIconFileKey Index: AquaSKK/Info-AquaSKKServer.plist diff -u AquaSKK/Info-AquaSKKServer.plist:1.16 AquaSKK/Info-AquaSKKServer.plist:1.17 --- AquaSKK/Info-AquaSKKServer.plist:1.16 Sat Jun 9 10:53:53 2007 +++ AquaSKK/Info-AquaSKKServer.plist Wed Sep 19 22:57:17 2007 @@ -19,11 +19,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 3.4 + modest-learning 1.1 CFBundleSignature askk CFBundleVersion - 2007-06-09 + 2007-09-18 NSMainNibFile Principal NSPrincipalClass Index: AquaSKK/KanjiConversionMode.cpp diff -u AquaSKK/KanjiConversionMode.cpp:1.13 AquaSKK/KanjiConversionMode.cpp:1.14 --- AquaSKK/KanjiConversionMode.cpp:1.13 Thu Jun 14 21:00:16 2007 +++ AquaSKK/KanjiConversionMode.cpp Wed Sep 19 22:57:17 2007 @@ -1,5 +1,5 @@ /* - $Id: KanjiConversionMode.cpp,v 1.13 2007/06/14 12:00:16 t-suwa Exp $ + $Id: KanjiConversionMode.cpp,v 1.14 2007/09/19 13:57:17 t-suwa Exp $ MacOS X implementation of the SKK input method. @@ -1028,7 +1028,7 @@ // ??? ä»?????????? ä»?? // èª???????????è§?»®??????ä»????¹³ä»??????? query.append('-').append(HiraganaInputMode::convert(root)).append(SKK_MSG_DELIMITER); - query.append(candidates[current_candidate_index]); + query.append(candidates[current_candidate_index].encode()); } // é¯??渡ã? Index: AquaSKK/KotoeriDictionary.cpp diff -u AquaSKK/KotoeriDictionary.cpp:1.4 AquaSKK/KotoeriDictionary.cpp:1.5 --- AquaSKK/KotoeriDictionary.cpp:1.4 Mon Dec 18 00:05:41 2006 +++ AquaSKK/KotoeriDictionary.cpp Wed Sep 19 22:57:17 2007 @@ -1,5 +1,5 @@ /* - $Id: KotoeriDictionary.cpp,v 1.4 2006/12/17 15:05:41 t-suwa Exp $ + $Id: KotoeriDictionary.cpp,v 1.5 2007/09/19 13:57:17 t-suwa Exp $ MacOS X implementation of the SKK input method. @@ -24,10 +24,11 @@ Directory Maneger対å???002.09.25 Shin_ichi Abe. */ -#include #include #include #include "KotoeriDictionary.h" +#include "CppCFData.h" +#include "CppCFString.h" KotoeriDictionary::KotoeriDictionary() : path_(0), isRegistered_(false), id_(0) { // empty @@ -129,7 +130,7 @@ // Get one data from AERecord status = AEGetParamPtr(&dataList, kDCMJapaneseHyokiTag, - typeUTF8Text, + 'ut16', // typeUTF16ExternalRepresentation &actualType, dataBuffer, kMaxKanjiLengthInAppleJapaneseDictionary, @@ -140,8 +141,10 @@ if(status != noErr) break; + CppCFString tmp(CppCFData(dataBuffer, actualSize).getData()); + result += '/'; - result.append(dataBuffer, actualSize); + result += tmp.encode().toStdString(kCFStringEncodingUTF8); } DCMDisposeRecordIterator(iterator); @@ -162,12 +165,13 @@ // ????¼ã????ç´? OSStatus status; DCMFieldTag dataFieldTagList[] = { kDCMJapaneseHyokiTag }; - CFStringRef keydata = CFStringCreateWithCString(NULL, key.c_str(), kCFStringEncodingUTF8); + CFStringRef keydata = CppCFString(key.c_str(), kCFStringEncodingUTF8).toBigEndianCFString(); + status = DCMFindRecords(ref, // Dictionary reference - kDCMJapaneseYomiTag, // key field tag - CFStringGetLength(keydata) * sizeof(UInt16), // key data length + kDCMJapaneseYomiTag, // key field tag + CFStringGetLength(keydata) * sizeof(UniChar), // key data length CFStringGetCharactersPtr(keydata), // key data - kDCMFindMethodExactMatch, // find method + kDCMFindMethodExactMatch, // find method 1, // number of data field dataFieldTagList, // data field tag list 0, 0, // search all records Index: AquaSKK/KotoeriDictionary.h diff -u AquaSKK/KotoeriDictionary.h:1.3 AquaSKK/KotoeriDictionary.h:1.4 --- AquaSKK/KotoeriDictionary.h:1.3 Mon Dec 18 00:05:41 2006 +++ AquaSKK/KotoeriDictionary.h Wed Sep 19 22:57:17 2007 @@ -1,5 +1,5 @@ /* - $Id: KotoeriDictionary.h,v 1.3 2006/12/17 15:05:41 t-suwa Exp $ + $Id: KotoeriDictionary.h,v 1.4 2007/09/19 13:57:17 t-suwa Exp $ MacOS X implementation of the SKK input method. @@ -27,6 +27,7 @@ #ifndef INC__KotoeriDictionary__ #define INC__KotoeriDictionary__ +#include #include "Dictionary.h" class KotoeriDictionary: public Dictionary { Index: AquaSKK/SKKDictionary.cpp diff -u AquaSKK/SKKDictionary.cpp:1.15 AquaSKK/SKKDictionary.cpp:1.16 --- AquaSKK/SKKDictionary.cpp:1.15 Fri Dec 29 00:37:03 2006 +++ AquaSKK/SKKDictionary.cpp Wed Sep 19 22:57:17 2007 @@ -1,5 +1,5 @@ /* - $Id: SKKDictionary.cpp,v 1.15 2006/12/28 15:37:03 t-suwa Exp $ + $Id: SKKDictionary.cpp,v 1.16 2007/09/19 13:57:17 t-suwa Exp $ MacOS X implementation of the SKK input method. @@ -462,7 +462,7 @@ // è¦???????? if(i != okuriAri_.end()) { entry = SKKEntry::ParseOkuriAri(i->first, i->second); - okuriAri_.erase(std::remove(okuriAri_.begin(), okuriAri_.end(), *i), okuriAri_.end()); + okuriAri_.erase(i); } entry.Update(SKKCandidate(kanji), okuri); @@ -479,7 +479,7 @@ // è¦???????? if(i != okuriNasi_.end()) { entry = SKKEntry::ParseOkuriNasi(i->first, i->second); - okuriNasi_.erase(std::remove(okuriNasi_.begin(), okuriNasi_.end(), *i), okuriNasi_.end()); + okuriNasi_.erase(i); } entry.Update(SKKCandidate(kanji)); @@ -506,7 +506,7 @@ *i = SKKPair(entry.Key(), entry.Candidate()); } else { // ????????????????????- okuriAri_.erase(std::remove(okuriAri_.begin(), okuriAri_.end(), *i), okuriAri_.end()); + okuriAri_.erase(i); } // ä¿????? @@ -530,7 +530,7 @@ *i = SKKPair(entry.Key(), entry.Candidate()); } else { // ????????????????????- okuriNasi_.erase(std::remove(okuriNasi_.begin(), okuriNasi_.end(), *i), okuriNasi_.end()); + okuriNasi_.erase(i); } // ä¿????? Index: AquaSKK/skkserv.cpp diff -u AquaSKK/skkserv.cpp:1.5 AquaSKK/skkserv.cpp:1.6 --- AquaSKK/skkserv.cpp:1.5 Sat Jan 27 12:52:30 2007 +++ AquaSKK/skkserv.cpp Wed Sep 19 22:57:17 2007 @@ -1,5 +1,5 @@ /* - $Id: skkserv.cpp,v 1.5 2007/01/27 03:52:30 t-suwa Exp $ + $Id: skkserv.cpp,v 1.6 2007/09/19 13:57:17 t-suwa Exp $ MacOS X implementation of the SKK input method. @@ -93,6 +93,7 @@ switch(cmd) { case '0': // ??? break; + case '1': { // æ¤?´¢ std::string word; sock >> word; @@ -114,23 +115,32 @@ if(result != "//") { std::string candidates; jconv::convert_utf8_to_eucj(result, candidates); - sock << "1" << candidates << "\n"; + sock << '1' << candidates << std::endl; } else { - sock << "4" << word << "\n"; + sock << '4' << word << ' '; } sock.flush(); } break; + case '2': // ????¸ã???- sock << "AquaSKKServer (skkserv emulation)" << std::endl; + sock << "AquaSKKServer1.0 "; sock.flush(); break; + case '3': // ????????- sock << ip_address::getsockname(sock.socket()) << ":0.0.0.0:" << std::endl; + sock << ip_address::getsockname(sock.socket()) << ":0.0.0.0: "; sock.flush(); break; + + case '4': // ?µã????è£?? + // ä»????????対å? + sock.ignore(0xff, ' '); + default: // ?¡å????????? fprintf(stderr, "AquaSKK(skkserv): Unknown command[0x%02x]\n", cmd); + sock << '0'; + sock.flush(); break; } } while(sock.good() && cmd != '0'); From t-suwa ¡÷ users.sourceforge.jp Thu Sep 20 00:10:20 2007 From: t-suwa ¡÷ users.sourceforge.jp (t-suwa ¡÷ users.sourceforge.jp) Date: Thu, 20 Sep 2007 00:10:20 +0900 Subject: [aquaskk-changes 381] CVS update: AquaSKK Message-ID: <1190214620.256840.8910.nullmailer@users.sourceforge.jp> Index: AquaSKK/KotoeriDictionary.cpp diff -u AquaSKK/KotoeriDictionary.cpp:1.5 AquaSKK/KotoeriDictionary.cpp:1.6 --- AquaSKK/KotoeriDictionary.cpp:1.5 Wed Sep 19 22:57:17 2007 +++ AquaSKK/KotoeriDictionary.cpp Thu Sep 20 00:10:20 2007 @@ -1,5 +1,5 @@ /* - $Id: KotoeriDictionary.cpp,v 1.5 2007/09/19 13:57:17 t-suwa Exp $ + $Id: KotoeriDictionary.cpp,v 1.6 2007/09/19 15:10:20 t-suwa Exp $ MacOS X implementation of the SKK input method. @@ -124,13 +124,17 @@ if(status != noErr) break; DescType actualType; - char dataBuffer[kMaxKanjiLengthInAppleJapaneseDictionary]; + UInt8 dataBuffer[kMaxKanjiLengthInAppleJapaneseDictionary]; Size actualSize; // Get one data from AERecord status = AEGetParamPtr(&dataList, kDCMJapaneseHyokiTag, - 'ut16', // typeUTF16ExternalRepresentation +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 + typeUTF16ExternalRepresentation, +#else + typeUnicodeText, +#endif &actualType, dataBuffer, kMaxKanjiLengthInAppleJapaneseDictionary, @@ -141,7 +145,13 @@ if(status != noErr) break; +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 CppCFString tmp(CppCFData(dataBuffer, actualSize).getData()); +#else + CFStringRef entry = CFStringCreateWithBytes(0, dataBuffer, actualSize, kCFStringEncodingUnicode, 0); + CppCFString tmp(entry); + CFRelease(entry); +#endif result += '/'; result += tmp.encode().toStdString(kCFStringEncodingUTF8); From t-suwa ¡÷ users.sourceforge.jp Sat Sep 22 08:35:02 2007 From: t-suwa ¡÷ users.sourceforge.jp (t-suwa ¡÷ users.sourceforge.jp) Date: Sat, 22 Sep 2007 08:35:02 +0900 Subject: [aquaskk-changes 382] CVS update: AquaSKK Message-ID: <1190417702.188379.8908.nullmailer@users.sourceforge.jp> Index: AquaSKK/ChangeLog diff -u AquaSKK/ChangeLog:1.44 AquaSKK/ChangeLog:1.45 --- AquaSKK/ChangeLog:1.44 Wed Sep 19 22:57:17 2007 +++ AquaSKK/ChangeLog Sat Sep 22 08:35:01 2007 @@ -1,3 +1,8 @@ +2007-09-22 Tomotaka SUWA + + * KotoeriDictionary.cpp: æ¤?´¢çµ???????ºã??¿ã???? + typeUnicodeText ??µ±ä¸??????³ã??¤ã??????????????¤åŽ»??+ 2007-09-19 Tomotaka SUWA * BIMInputEvents.cpp (BIMHandleOffsetToPos): ?»ã??·ã??³ã??³ã????è¦?Index: AquaSKK/Info-AquaSKKInputMethod.plist diff -u AquaSKK/Info-AquaSKKInputMethod.plist:1.17 AquaSKK/Info-AquaSKKInputMethod.plist:1.18 --- AquaSKK/Info-AquaSKKInputMethod.plist:1.17 Wed Sep 19 22:57:17 2007 +++ AquaSKK/Info-AquaSKKInputMethod.plist Sat Sep 22 08:35:01 2007 @@ -23,7 +23,7 @@ CFBundleSignature askk CFBundleVersion - 2007-09-18 + 2007-09-22 CSResourcesFileMapped tsInputMethodIconFileKey Index: AquaSKK/Info-AquaSKKServer.plist diff -u AquaSKK/Info-AquaSKKServer.plist:1.17 AquaSKK/Info-AquaSKKServer.plist:1.18 --- AquaSKK/Info-AquaSKKServer.plist:1.17 Wed Sep 19 22:57:17 2007 +++ AquaSKK/Info-AquaSKKServer.plist Sat Sep 22 08:35:01 2007 @@ -23,7 +23,7 @@ CFBundleSignature askk CFBundleVersion - 2007-09-18 + 2007-09-22 NSMainNibFile Principal NSPrincipalClass Index: AquaSKK/KotoeriDictionary.cpp diff -u AquaSKK/KotoeriDictionary.cpp:1.6 AquaSKK/KotoeriDictionary.cpp:1.7 --- AquaSKK/KotoeriDictionary.cpp:1.6 Thu Sep 20 00:10:20 2007 +++ AquaSKK/KotoeriDictionary.cpp Sat Sep 22 08:35:01 2007 @@ -1,10 +1,10 @@ /* - $Id: KotoeriDictionary.cpp,v 1.6 2007/09/19 15:10:20 t-suwa Exp $ + $Id: KotoeriDictionary.cpp,v 1.7 2007/09/21 23:35:01 t-suwa Exp $ MacOS X implementation of the SKK input method. Copyright (C) 2002 phonohawk - Copyright (C) 2005-2006 Tomotaka SUWA + Copyright (C) 2005-2007 Tomotaka SUWA 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 @@ -130,11 +130,7 @@ // Get one data from AERecord status = AEGetParamPtr(&dataList, kDCMJapaneseHyokiTag, -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 - typeUTF16ExternalRepresentation, -#else typeUnicodeText, -#endif &actualType, dataBuffer, kMaxKanjiLengthInAppleJapaneseDictionary, @@ -145,13 +141,9 @@ if(status != noErr) break; -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 - CppCFString tmp(CppCFData(dataBuffer, actualSize).getData()); -#else CFStringRef entry = CFStringCreateWithBytes(0, dataBuffer, actualSize, kCFStringEncodingUnicode, 0); CppCFString tmp(entry); CFRelease(entry); -#endif result += '/'; result += tmp.encode().toStdString(kCFStringEncodingUTF8); From t-suwa ¡÷ users.sourceforge.jp Sun Sep 23 23:48:09 2007 From: t-suwa ¡÷ users.sourceforge.jp (t-suwa ¡÷ users.sourceforge.jp) Date: Sun, 23 Sep 2007 23:48:09 +0900 Subject: [aquaskk-changes 383] CVS update: AquaSKK/src/statemachine Message-ID: <1190558889.142375.7404.nullmailer@users.sourceforge.jp> Index: AquaSKK/src/statemachine/GenericStateMachine.h diff -u AquaSKK/src/statemachine/GenericStateMachine.h:1.1.2.2 AquaSKK/src/statemachine/GenericStateMachine.h:1.1.2.3 --- AquaSKK/src/statemachine/GenericStateMachine.h:1.1.2.2 Sun Sep 16 09:21:45 2007 +++ AquaSKK/src/statemachine/GenericStateMachine.h Sun Sep 23 23:48:08 2007 @@ -74,8 +74,8 @@ const ParamType& Param() const { return param_; } void SetParam(const ParamType& arg) { param_ = arg; } - bool IsSystem() const { return signal_ < USER_EVENT; } - bool IsUser() const { return !IsSystem(); } + bool IsSystem() const { return signal_ < USER_EVENT; } + bool IsUser() const { return !IsSystem(); } static GenericEvent& Probe() { static GenericEvent evt(PROBE); return evt; } static GenericEvent& Entry() { static GenericEvent evt(ENTRY_EVENT); return evt; } @@ -229,13 +229,13 @@ // ====================================================================== // state machine // ====================================================================== - template class Inspector = EmptyInspector> + template class Inspector = EmptyInspector> class GenericStateMachine { public: - typedef typename StateContainer::Handler Handler; - typedef typename StateContainer::Event Event; - typedef typename StateContainer::State State; - typedef typename StateContainer::Output Output; + typedef typename StateContainer::State State; + typedef typename StateContainer::Event Event; + typedef typename StateContainer::Handler Handler; + typedef typename StateContainer::Output Output; private: StateContainer container_; @@ -410,6 +410,8 @@ GenericStateMachine(const StateContainer& src) : container_(src), top_(&StateContainer::TopState), active_(0) {} ~GenericStateMachine() { + if(!container_.ExitOnDestruct()) return; + for(Handler tmp = active_; tmp != 0; tmp = getSuperState(tmp)) { exitAction(tmp); } @@ -464,6 +466,30 @@ }; // ====================================================================== + // base state container + // ====================================================================== + template + struct BaseStateContainer { + typedef GenericState State; + typedef GenericEvent Event; + typedef State (StateContainer::*Handler)(const Event&); + typedef ResultType Output; + + // derived class must define this method + virtual const Handler InitialState() const = 0; + + virtual bool ExitOnDestruct() const { return true; } + + virtual State TopState(const Event& event) { + switch(event) { + case INIT_EVENT: + return State::Initial(InitialState()); + } + return 0; + } + }; + + // ====================================================================== // state container traits // ====================================================================== template @@ -475,27 +501,4 @@ }; } -// ====================================================================== -// helper macro -// ====================================================================== - -#define DECLARE_ImportantTypes(container, param, result) \ - typedef GenericState State; \ - typedef GenericEvent Event; \ - typedef State (container::*Handler)(const Event&); \ - typedef result Output; - -#define DECLARE_TopState(container, initial) \ - State TopState(const Event& event) { \ - switch(event) { \ - case INIT_EVENT: \ - return State::Initial(&container::initial); \ - } \ - return 0; \ - } - -#define DECLARE_StateContainer(container, param, result, initial) \ - DECLARE_ImportantTypes(container, param, result) \ - DECLARE_TopState(container, initial) - #endif // INC__GenericStateMachine__ Index: AquaSKK/src/statemachine/SKKEngine.h diff -u AquaSKK/src/statemachine/SKKEngine.h:1.1.2.1 AquaSKK/src/statemachine/SKKEngine.h:1.1.2.2 --- AquaSKK/src/statemachine/SKKEngine.h:1.1.2.1 Sun Sep 2 12:36:25 2007 +++ AquaSKK/src/statemachine/SKKEngine.h Sun Sep 23 23:48:08 2007 @@ -1,5 +1,5 @@ /* -*- C++ -*- - $Id: SKKEngine.h,v 1.1.2.1 2007/09/02 03:36:25 t-suwa Exp $ + $Id: SKKEngine.h,v 1.1.2.2 2007/09/23 14:48:08 t-suwa Exp $ MacOS X implementation of the SKK input method. @@ -42,9 +42,10 @@ DEFINE_State(LatinInput), DEFINE_State(Ascii), DEFINE_State(Jisx0208Latin), - DEFINE_State(PreConversion), + DEFINE_State(Compose), DEFINE_State(EntryInput), DEFINE_State(Japanese), + DEFINE_State(Okuri), DEFINE_State(Abbreviation), DEFINE_State(EntryCompletion), DEFINE_State(SelectCandidate), Index: AquaSKK/src/statemachine/SKKEnvironment.cpp diff -u AquaSKK/src/statemachine/SKKEnvironment.cpp:1.1.2.1 AquaSKK/src/statemachine/SKKEnvironment.cpp:1.1.2.2 --- AquaSKK/src/statemachine/SKKEnvironment.cpp:1.1.2.1 Sun Sep 2 12:36:25 2007 +++ AquaSKK/src/statemachine/SKKEnvironment.cpp Sun Sep 23 23:48:08 2007 @@ -33,10 +33,6 @@ delete controller_; } -const Output& SKKEnvironment::Result() const { - return controller_->Result(); -} - // ====================================================================== // level 1ï¼??????? // ====================================================================== @@ -229,9 +225,9 @@ } // ====================================================================== -// level 1ï¼????? +// level 1ï¼???ºã?èª??ç¯? // ====================================================================== -State SKKEnvironment::PreConversion(const Event& event) { +State SKKEnvironment::Compose(const Event& event) { switch(event) { case SKK_ENTER: return controller_->HandleEnter(); @@ -268,7 +264,7 @@ } // ====================================================================== -// level 2 (sub of PreConversion)ï¼???ºã?èª????+// level 2 (sub of Compose)ï¼???ºã?èª???? // ====================================================================== State SKKEnvironment::EntryInput(const Event& event) { const SKKEventParam& param = event.Param(); @@ -284,7 +280,7 @@ return controller_->HandleInput(param); } - return &SKKEnvironment::PreConversion; + return &SKKEnvironment::Compose; } // ====================================================================== @@ -301,6 +297,19 @@ } // ====================================================================== +// level 3 (sub of EntryInput)ï¼????+// ====================================================================== +State SKKEnvironment::Okuri(const Event& event) { + switch(event) { + case ENTRY_EVENT: + controller_->ChangeState(SKK::OkuriInput); + return 0; + } + + return &SKKEnvironment::EntryInput; +} + +// ====================================================================== // level 3 (sub of EntryInput)ï¼???¥è¡¨è¨? // ====================================================================== State SKKEnvironment::Abbreviation(const Event& event) { @@ -315,7 +324,7 @@ } // ====================================================================== -// level 2 (sub of PreConversion)ï¼???ºã?èª??å®?+// level 2 (sub of Compose)ï¼???ºã?èª??å®? // ====================================================================== State SKKEnvironment::EntryCompletion(const Event& event) { const SKKEventParam& param = event.Param(); @@ -332,7 +341,7 @@ (event == SKK_CHAR && (param.IsNextCandidate() || param.IsNextCompletion() || param.IsPrevCompletion()))) { - return &SKKEnvironment::PreConversion; + return &SKKEnvironment::Compose; } // è£?????以å????å±¥æ???»¢?????Index: AquaSKK/src/statemachine/SKKEnvironment.h diff -u AquaSKK/src/statemachine/SKKEnvironment.h:1.1.2.1 AquaSKK/src/statemachine/SKKEnvironment.h:1.1.2.2 --- AquaSKK/src/statemachine/SKKEnvironment.h:1.1.2.1 Sun Sep 2 12:36:25 2007 +++ AquaSKK/src/statemachine/SKKEnvironment.h Sun Sep 23 23:48:08 2007 @@ -23,23 +23,20 @@ #include "GenericStateMachine.h" #include "SKKEventParam.h" -#include "SKKEventResult.h" using namespace statemachinecxx_sourceforge_jp; class SKKController; // å®???°å? -class SKKEnvironment { +class SKKEnvironment : public BaseStateContainer { SKKController* controller_; public: - DECLARE_StateContainer(SKKEnvironment, SKKEventParam, SKKEventResult, KanaInput); - SKKEnvironment(); ~SKKEnvironment(); - const Output& Result() const; + const Handler InitialState() const { return &SKKEnvironment::KanaInput; } // level 1 (initial state) State KanaInput(const Event& event); @@ -57,16 +54,17 @@ State Jisx0208Latin(const Event& event); // level 1 - State PreConversion(const Event& event); + State Compose(const Event& event); - // level 2 (sub of PreConversion) + // level 2 (sub of Compose) State EntryInput(const Event& event); // lelvel 3 (sub of EntryInput) State Japanese(const Event& event); + State Okuri(const Event& event); State Abbreviation(const Event& event); - // level 2 (sub of PreConversion) + // level 2 (sub of Compose) State EntryCompletion(const Event& event); // level 1 Index: AquaSKK/src/statemachine/SKKEventResult.cpp diff -u AquaSKK/src/statemachine/SKKEventResult.cpp:1.1.2.1 AquaSKK/src/statemachine/SKKEventResult.cpp:removed --- AquaSKK/src/statemachine/SKKEventResult.cpp:1.1.2.1 Sun Sep 2 12:36:25 2007 +++ AquaSKK/src/statemachine/SKKEventResult.cpp Sun Sep 23 23:48:09 2007 @@ -1,35 +0,0 @@ -/* -*- C++ -*- - MacOS X implementation of the SKK input method. - - Copyright (C) 2007 Tomotaka SUWA - - 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 "SKKEventResult.h" - -SKKEventResult::SKKEventResult() : impl_(new SKKEventResultImpl()) {} - -SKKEventResult::SKKEventResult(const SKKEventResult&) : impl_(new SKKEventResultImpl()) {} - -void SKKEventResult::Update() { - impl_->Update(); -} - -bool SKKEventResult::EventIsHandled() const { - // const ?¡ã????????§ã?????³ã?çµ???§å????è£???¶æ??????- return impl_->TestAndReset(); - // ???å®????????????????»£?¿æ????è¨???????-} Index: AquaSKK/src/statemachine/SKKEventResult.h diff -u AquaSKK/src/statemachine/SKKEventResult.h:1.1.2.1 AquaSKK/src/statemachine/SKKEventResult.h:removed --- AquaSKK/src/statemachine/SKKEventResult.h:1.1.2.1 Sun Sep 2 12:36:25 2007 +++ AquaSKK/src/statemachine/SKKEventResult.h Sun Sep 23 23:48:09 2007 @@ -1,64 +0,0 @@ -/* -*- C++ -*- - MacOS X implementation of the SKK input method. - - Copyright (C) 2007 Tomotaka SUWA - - 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__SKKEventResult__ -#define INC__SKKEventResult__ - -#include - -// ???å®?? -class SKKEventResultImpl { - bool handled_; - bool backup_; - -public: - SKKEventResultImpl() : handled_(false), backup_(false) {} - ~SKKEventResultImpl() {} - - void Update() { - handled_ = !backup_; - } - - // separate query from modifier ???????????- bool TestAndReset() { - bool ret = handled_ == backup_; - - backup_ = handled_; - - return ret; - } -}; - -// ???çµ?? -class SKKEventResult { - std::auto_ptr impl_; - -public: - SKKEventResult(); - SKKEventResult(const SKKEventResult& src); - - // ?¤ã??³ã??????????????¼ã??ºã? - void Update(); - - // ?¤ã??³ã????????????? - bool EventIsHandled() const; -}; - -#endif From t-suwa ¡÷ users.sourceforge.jp Sun Sep 23 23:56:54 2007 From: t-suwa ¡÷ users.sourceforge.jp (t-suwa ¡÷ users.sourceforge.jp) Date: Sun, 23 Sep 2007 23:56:54 +0900 Subject: [aquaskk-changes 384] CVS update: AquaSKK/src/controller Message-ID: <1190559414.235693.12267.nullmailer@users.sourceforge.jp> Index: AquaSKK/src/controller/SKKController.cpp diff -u AquaSKK/src/controller/SKKController.cpp:1.1.2.2 AquaSKK/src/controller/SKKController.cpp:1.1.2.3 --- AquaSKK/src/controller/SKKController.cpp:1.1.2.2 Sun Sep 16 09:21:45 2007 +++ AquaSKK/src/controller/SKKController.cpp Sun Sep 23 23:56:54 2007 @@ -34,11 +34,6 @@ stack_.push_back(SKKEditor()); } -// ???çµ?? -const Output& SKKController::Result() const { - return editor().Result(); -} - // ????¥å???? State SKKController::HandleInput(const SKKEventParam& param) { return invoke(&SKKEditor::HandleInput, param); Index: AquaSKK/src/controller/SKKController.h diff -u AquaSKK/src/controller/SKKController.h:1.1.2.1 AquaSKK/src/controller/SKKController.h:1.1.2.2 --- AquaSKK/src/controller/SKKController.h:1.1.2.1 Sun Sep 2 12:36:25 2007 +++ AquaSKK/src/controller/SKKController.h Sun Sep 23 23:56:54 2007 @@ -1,5 +1,5 @@ /* -*- C++ -*- - $Id: SKKController.h,v 1.1.2.1 2007/09/02 03:36:25 t-suwa Exp $ + $Id: SKKController.h,v 1.1.2.2 2007/09/23 14:56:54 t-suwa Exp $ MacOS X implementation of the SKK input method. @@ -27,19 +27,19 @@ #include #include "SKK.h" #include "SKKEventParam.h" -#include "SKKEnvironment.h" +#include "SKKEngine.h" #include "SKKEditor.h" -struct SKKController { - typedef SKKEnvironment::State State; - typedef SKKEnvironment::Event Event; - typedef SKKEnvironment::Handler Handler; - typedef SKKEnvironment::Output Output; +class SKKController : public StateContainerTraits { + std::vector stack_; - SKKController(); + SKKEditor& editor(); + const SKKEditor& editor() const; - // ???çµ?? - const Output& Result() const; + State invoke(SKKEditor::Handler handler, const SKKEventParam& param); + +public: + SKKController(); // ????¥å???? State HandleInput(const SKKEventParam& param); @@ -64,14 +64,6 @@ // ??¸°????¸ç??? void BeginRegistration(const std::string& prompt); void EndRegistration(bool commit); - -private: - std::vector stack_; - - SKKEditor& editor(); - const SKKEditor& editor() const; - - State invoke(SKKEditor::Handler handler, const SKKEventParam& param); }; #endif Index: AquaSKK/src/controller/SKKSubController.h diff -u AquaSKK/src/controller/SKKSubController.h:1.1.2.1 AquaSKK/src/controller/SKKSubController.h:1.1.2.2 --- AquaSKK/src/controller/SKKSubController.h:1.1.2.1 Sun Sep 2 12:36:25 2007 +++ AquaSKK/src/controller/SKKSubController.h Sun Sep 23 23:56:54 2007 @@ -25,12 +25,7 @@ #include "SKKController.h" // SKKController ???????¥ã??¼ã???-struct SKKSubController { - typedef SKKController::State State; - typedef SKKController::Event Event; - typedef SKKController::Handler Handler; - typedef SKKController::Output Output; - +struct SKKSubController : public StateContainerTraits { virtual State Apply(SKKController& controller) = 0; }; From t-suwa ¡÷ users.sourceforge.jp Mon Sep 24 07:44:34 2007 From: t-suwa ¡÷ users.sourceforge.jp (t-suwa ¡÷ users.sourceforge.jp) Date: Mon, 24 Sep 2007 07:44:34 +0900 Subject: [aquaskk-changes 385] CVS update: AquaSKK/src/component Message-ID: <1190587474.401646.6331.nullmailer@users.sourceforge.jp> Index: AquaSKK/src/component/SKKSession.cpp diff -u AquaSKK/src/component/SKKSession.cpp:1.1.2.3 AquaSKK/src/component/SKKSession.cpp:1.1.2.4 --- AquaSKK/src/component/SKKSession.cpp:1.1.2.3 Sun Sep 2 12:36:24 2007 +++ AquaSKK/src/component/SKKSession.cpp Mon Sep 24 07:44:34 2007 @@ -1,5 +1,5 @@ /* -*- C++ -*- - $Id: SKKSession.cpp,v 1.1.2.3 2007/09/02 03:36:24 t-suwa Exp $ + $Id: SKKSession.cpp,v 1.1.2.4 2007/09/23 22:44:34 t-suwa Exp $ MacOS X implementation of the SKK input method. @@ -37,7 +37,11 @@ SKKEventParam param = SKKPreProcessor::theInstance().Execute(event); std::cerr << param.dump() << std::endl; - engine_.Dispatch(Event(param.event, param)); + handled_ = false; + engine_.Dispatch(SKKEngine::Event(param.event, param)); + if(handled_) { + std::cerr << "handled" << std::endl; + } // ????·ã?????¸ã? SKKEvent legacy_event(event); @@ -110,7 +114,7 @@ } // ?°ã??³ã??³ã??¥å??¢ã??????- engine_.Dispatch(Event(param.event, param)); + engine_.Dispatch(SKKEngine::Event(param.event, param)); } Point SKKSession::GetInputPosition(long offset) const { @@ -189,6 +193,8 @@ void SKKSession::updateActiveInputArea(const CFStringRef str, int UniChar_fixlen, int UniChar_caretpos) { EventRef event = 0; + handled_ = true; + bufsize_.curr = CFStringGetLength(str); // ?¤ã??³ã??????Index: AquaSKK/src/component/SKKSession.h diff -u AquaSKK/src/component/SKKSession.h:1.1.2.2 AquaSKK/src/component/SKKSession.h:1.1.2.3 --- AquaSKK/src/component/SKKSession.h:1.1.2.2 Sun Sep 2 12:36:24 2007 +++ AquaSKK/src/component/SKKSession.h Mon Sep 24 07:44:34 2007 @@ -1,5 +1,5 @@ /* -*- C++ -*- - $Id: SKKSession.h,v 1.1.2.2 2007/09/02 03:36:24 t-suwa Exp $ + $Id: SKKSession.h,v 1.1.2.3 2007/09/23 22:44:34 t-suwa Exp $ MacOS X implementation of the SKK input method. @@ -30,10 +30,11 @@ #include "IMSessionInputMode.h" #include "SKKEngine.h" -class SKKSession : StateContainerTraits { +class SKKSession { ComponentInstance instance_; SKKEngine engine_; IMSessionInputMode legacy_; + bool handled_; struct buffer_size { long prev; From t-suwa ¡÷ users.sourceforge.jp Mon Sep 24 07:58:11 2007 From: t-suwa ¡÷ users.sourceforge.jp (t-suwa ¡÷ users.sourceforge.jp) Date: Mon, 24 Sep 2007 07:58:11 +0900 Subject: [aquaskk-changes 386] CVS update: AquaSKK/src/context Message-ID: <1190588291.186830.13416.nullmailer@users.sourceforge.jp> Index: AquaSKK/src/context/SKKContext.cpp diff -u AquaSKK/src/context/SKKContext.cpp:1.1.2.2 AquaSKK/src/context/SKKContext.cpp:1.1.2.3 --- AquaSKK/src/context/SKKContext.cpp:1.1.2.2 Sun Sep 16 09:15:12 2007 +++ AquaSKK/src/context/SKKContext.cpp Mon Sep 24 07:58:10 2007 @@ -1,5 +1,5 @@ /* -*- C++ -*- - $Id: SKKContext.cpp,v 1.1.2.2 2007/09/16 00:15:12 t-suwa Exp $ + $Id: SKKContext.cpp,v 1.1.2.3 2007/09/23 22:58:10 t-suwa Exp $ MacOS X implementation of the SKK input method. @@ -21,26 +21,27 @@ */ #include "SKKContext.h" +#include "SKKRegistrationOutputPort.h" SKKContext::SKKContext() { + initialize(); } -SKKContext::SKKContext(const std::string& prompt) : prompt_(prompt_) { +SKKContext::SKKContext(const std::string& prompt) : prompt_(prompt) { + initialize(); } -SKKContext::SKKContext(const SKKContext& src) : prompt_(src.prompt_), result_(src.result_) { +SKKContext::SKKContext(const SKKContext& src) + : prompt_(src.prompt_), input_(src.input_), entry_(src.entry_), word_(src.word_) { + initialize(); } -const std::string& SKKContext::Prompt() const { - return prompt_; -} - -SKKEventResult& SKKContext::Result() { - return result_; +SKKContext::~SKKContext() { + delete port_; } -const SKKEventResult& SKKContext::Result() const { - return result_; +const std::string& SKKContext::Prompt() const { + return prompt_; } SKKInputBuffer& SKKContext::InputBuffer() { @@ -50,3 +51,22 @@ SKKEditBuffer& SKKContext::EditBuffer() { return entry_; } + +SKKEditBuffer& SKKContext::WordBuffer() { + return word_; +} + +SKKOutputPort& SKKContext::OutputPort() { + return *port_; +} + +// ====================================================================== +// private method +// ====================================================================== +void SKKContext::initialize() { + if(prompt_.empty()) { + port_ = new SKKOutputPort(*this); + } else { + port_ = new SKKRegistrationOutputPort(*this); + } +} Index: AquaSKK/src/context/SKKContext.h diff -u AquaSKK/src/context/SKKContext.h:1.1.2.2 AquaSKK/src/context/SKKContext.h:1.1.2.3 --- AquaSKK/src/context/SKKContext.h:1.1.2.2 Sun Sep 16 09:15:12 2007 +++ AquaSKK/src/context/SKKContext.h Mon Sep 24 07:58:10 2007 @@ -22,28 +22,32 @@ #define INC__SKKContext__ #include -#include "SKKEventResult.h" #include "SKKInputBuffer.h" #include "SKKEditBuffer.h" +#include "SKKOutputPort.h" // ?¥å??³ã?????¹ã? class SKKContext { std::string prompt_; // ?»é?????ºã?èª?- SKKEventResult result_; // ???çµ?? SKKInputBuffer input_; // ?¥å??????? SKKEditBuffer entry_; // è¦??????????? + SKKEditBuffer word_; // ?»é??????? + SKKOutputPort* port_; // ?ºå??????+ + void initialize(); public: SKKContext(); SKKContext(const std::string& prompt); SKKContext(const SKKContext& src); + ~SKKContext(); const std::string& Prompt() const; - SKKEventResult& Result(); - const SKKEventResult& Result() const; SKKInputBuffer& InputBuffer(); SKKEditBuffer& EditBuffer(); + SKKEditBuffer& WordBuffer(); + SKKOutputPort& OutputPort(); }; #endif Index: AquaSKK/src/context/SKKEditBuffer.cpp diff -u AquaSKK/src/context/SKKEditBuffer.cpp:1.1.2.1 AquaSKK/src/context/SKKEditBuffer.cpp:1.1.2.2 --- AquaSKK/src/context/SKKEditBuffer.cpp:1.1.2.1 Sun Sep 16 09:15:12 2007 +++ AquaSKK/src/context/SKKEditBuffer.cpp Mon Sep 24 07:58:10 2007 @@ -22,7 +22,7 @@ #include "utf8util.h" /* - ??????½ã?ä½?½®?????? + << ????½ã?ä½?½®?????? >> ?¥å???????????????????å°¾ã???¿½???????§ã?????????????ä¿?? ???????½ã?ä½?½®?????????å°¾ã????????»ã????????????@@ -37,11 +37,7 @@ } void SKKEditBuffer::Insert(unsigned char ch) { - std::string tmp; - - tmp += ch; - - Insert(tmp); + Insert(std::string(1, ch)); } void SKKEditBuffer::Insert(const std::string& str) { Index: AquaSKK/src/context/SKKOutputPort.cpp diff -u /dev/null AquaSKK/src/context/SKKOutputPort.cpp:1.1.2.1 --- /dev/null Mon Sep 24 07:58:11 2007 +++ AquaSKK/src/context/SKKOutputPort.cpp Mon Sep 24 07:58:10 2007 @@ -0,0 +1,97 @@ +/* -*- C++ -*- + MacOS X implementation of the SKK input method. + + Copyright (C) 2007 Tomotaka SUWA + + 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 "SKKOutputPort.h" +#include "SKKComponent.h" +#include "SKKSession.h" +#include "utf8util.h" + +SKKOutputPort::SKKOutputPort(SKKContext& context) : context_(context) { +} + +SKKOutputPort::~SKKOutputPort() { +} + +void SKKOutputPort::DisplayString(const std::string& str) { + DisplayString(str, utf8::length(str)); +} + +void SKKOutputPort::DisplayString(const std::string& str, int cursorPosition) { +#if 1 + std::string tmp(str); + + utf8::push(tmp, "[I]", cursorPosition - utf8::length(str)); + + std::cerr << tmp << std::endl; +#else + SKKSession& active = SKKComponent::theInstance().Session(); + + CFStringRef cfstr = CFStringCreateWithCString(0, str.c_str(), kCFStringEncodingUTF8); + + active.DisplayString(cfstr, 0, cursorPosition); + + CFRelease(cfstr); +#endif +} + +void SKKOutputPort::FixString(const std::string& str) { +#if 1 + std::cerr << str; +#else + SKKSession& active = SKKComponent::theInstance().Session(); + + CFStringRef cfstr = CFStringCreateWithCString(0, str.c_str(), kCFStringEncodingUTF8); + + active.FixString(cfstr); + + CFRelease(cfstr); +#endif +} + +void SKKOutputPort::Terminate() { +#if 1 + std::cerr << "[terminate]" << std::endl; +#else + SKKSession& active = SKKComponent::theInstance().Session(); + + active.Terminate(); +#endif +} + +void SKKOutputPort::Ignore(char) { +} + +void SKKOutputPort::BackSpace() { +} + +void SKKOutputPort::Delete() { +} + +void SKKOutputPort::CursorLeft() { +} + +void SKKOutputPort::CursorRight() { +} + +void SKKOutputPort::CursorUp() { +} + +void SKKOutputPort::CursorDown() { +} Index: AquaSKK/src/context/SKKOutputPort.h diff -u /dev/null AquaSKK/src/context/SKKOutputPort.h:1.1.2.1 --- /dev/null Mon Sep 24 07:58:11 2007 +++ AquaSKK/src/context/SKKOutputPort.h Mon Sep 24 07:58:10 2007 @@ -0,0 +1,51 @@ +/* -*- C++ -*- + MacOS X implementation of the SKK input method. + + Copyright (C) 2007 Tomotaka SUWA + + 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__SKKOutputPort__ +#define INC__SKKOutputPort__ + +#include + +class SKKContext; + +// ?ºå???????åº????? +class SKKOutputPort { +protected: + SKKContext& context_; + +public: + SKKOutputPort(SKKContext& context); + virtual ~SKKOutputPort(); + + virtual void DisplayString(const std::string& str); + virtual void DisplayString(const std::string& str, int cursorPosition); + virtual void FixString(const std::string& str); + virtual void Terminate(); + + virtual void Ignore(char ch); + virtual void BackSpace(); + virtual void Delete(); + virtual void CursorLeft(); + virtual void CursorRight(); + virtual void CursorUp(); + virtual void CursorDown(); +}; + +#endif Index: AquaSKK/src/context/SKKRegistrationOutputPort.cpp diff -u /dev/null AquaSKK/src/context/SKKRegistrationOutputPort.cpp:1.1.2.1 --- /dev/null Mon Sep 24 07:58:11 2007 +++ AquaSKK/src/context/SKKRegistrationOutputPort.cpp Mon Sep 24 07:58:10 2007 @@ -0,0 +1,103 @@ +/* -*- C++ -*- + MacOS X implementation of the SKK input method. + + Copyright (C) 2007 Tomotaka SUWA + + 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 "SKKComponent.h" +#include "SKKSession.h" +#include "SKKContext.h" +#include "SKKRegistrationOutputPort.h" +#include "utf8util.h" + +SKKRegistrationOutputPort::SKKRegistrationOutputPort(SKKContext& context) + : SKKOutputPort(context), prompt_("[?»é?ï¼? + context.Prompt() + "] ") { +} + +void SKKRegistrationOutputPort::DisplayString(const std::string& str) { + DisplayString(str, utf8::length(str)); +} + +void SKKRegistrationOutputPort::DisplayString(const std::string& str, int cursorPosition) { + SKKEditBuffer word(context_.WordBuffer()); + int insertPosition = utf8::length(prompt_) + word.CursorPosition(); + + word.Insert(str); + + std::string result(prompt_ + word.EditString()); + + SKKOutputPort::DisplayString(result, insertPosition + cursorPosition); +} + +void SKKRegistrationOutputPort::FixString(const std::string& str) { + SKKEditBuffer& word = context_.WordBuffer(); + + word.Insert(str); + + std::string result(prompt_ + word.EditString()); + + SKKOutputPort::DisplayString(result, utf8::length(prompt_) + word.CursorPosition()); +} + +void SKKRegistrationOutputPort::Ignore(char ch) { + DisplayString(std::string(1, ch)); +} + +void SKKRegistrationOutputPort::BackSpace() { + context_.WordBuffer().BackSpace(); + + display(); +} + +void SKKRegistrationOutputPort::Delete() { + context_.WordBuffer().Delete(); + + display(); +} + +void SKKRegistrationOutputPort::CursorLeft() { + context_.WordBuffer().CursorLeft(); + + display(); +} + +void SKKRegistrationOutputPort::CursorRight() { + context_.WordBuffer().CursorRight(); + + display(); +} + +void SKKRegistrationOutputPort::CursorUp() { + context_.WordBuffer().CursorUp(); + + display(); +} + +void SKKRegistrationOutputPort::CursorDown() { + context_.WordBuffer().CursorDown(); + + display(); +} + +// ====================================================================== +// private method +// ====================================================================== +void SKKRegistrationOutputPort::display() { + SKKEditBuffer& word = context_.WordBuffer(); + + DisplayString(prompt_ + word.EditString(), word.CursorPosition()); +} Index: AquaSKK/src/context/SKKRegistrationOutputPort.h diff -u /dev/null AquaSKK/src/context/SKKRegistrationOutputPort.h:1.1.2.1 --- /dev/null Mon Sep 24 07:58:11 2007 +++ AquaSKK/src/context/SKKRegistrationOutputPort.h Mon Sep 24 07:58:10 2007 @@ -0,0 +1,48 @@ +/* -*- C++ -*- + MacOS X implementation of the SKK input method. + + Copyright (C) 2007 Tomotaka SUWA + + 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__SKKRegistrationOutputPort__ +#define INC__SKKRegistrationOutputPort__ + +#include "SKKOutputPort.h" + +// ?ºå??????+class SKKRegistrationOutputPort : public SKKOutputPort { + const std::string prompt_; + + void display(); + +public: + SKKRegistrationOutputPort(SKKContext& context); + + virtual void DisplayString(const std::string& str); + virtual void DisplayString(const std::string& str, int cursorPosition); + virtual void FixString(const std::string& str); + + virtual void Ignore(char ch); + virtual void BackSpace(); + virtual void Delete(); + virtual void CursorLeft(); + virtual void CursorRight(); + virtual void CursorUp(); + virtual void CursorDown(); +}; + +#endif From t-suwa ¡÷ users.sourceforge.jp Mon Sep 24 10:51:06 2007 From: t-suwa ¡÷ users.sourceforge.jp (t-suwa ¡÷ users.sourceforge.jp) Date: Mon, 24 Sep 2007 10:51:06 +0900 Subject: [aquaskk-changes 387] CVS update: AquaSKK/src/context Message-ID: <1190598666.143356.4256.nullmailer@users.sourceforge.jp> Index: AquaSKK/src/context/SKKContext.cpp diff -u AquaSKK/src/context/SKKContext.cpp:1.1.2.3 AquaSKK/src/context/SKKContext.cpp:1.1.2.4 --- AquaSKK/src/context/SKKContext.cpp:1.1.2.3 Mon Sep 24 07:58:10 2007 +++ AquaSKK/src/context/SKKContext.cpp Mon Sep 24 10:51:05 2007 @@ -1,5 +1,5 @@ /* -*- C++ -*- - $Id: SKKContext.cpp,v 1.1.2.3 2007/09/23 22:58:10 t-suwa Exp $ + $Id: SKKContext.cpp,v 1.1.2.4 2007/09/24 01:51:05 t-suwa Exp $ MacOS X implementation of the SKK input method. @@ -44,6 +44,10 @@ return prompt_; } +const std::string& SKKContext::Word() const { + return word_.EditString(); +} + SKKInputBuffer& SKKContext::InputBuffer() { return input_; } Index: AquaSKK/src/context/SKKContext.h diff -u AquaSKK/src/context/SKKContext.h:1.1.2.3 AquaSKK/src/context/SKKContext.h:1.1.2.4 --- AquaSKK/src/context/SKKContext.h:1.1.2.3 Mon Sep 24 07:58:10 2007 +++ AquaSKK/src/context/SKKContext.h Mon Sep 24 10:51:05 2007 @@ -43,6 +43,7 @@ ~SKKContext(); const std::string& Prompt() const; + const std::string& Word() const; SKKInputBuffer& InputBuffer(); SKKEditBuffer& EditBuffer(); From t-suwa ¡÷ users.sourceforge.jp Mon Sep 24 10:52:48 2007 From: t-suwa ¡÷ users.sourceforge.jp (t-suwa ¡÷ users.sourceforge.jp) Date: Mon, 24 Sep 2007 10:52:48 +0900 Subject: [aquaskk-changes 388] CVS update: AquaSKK/proj/AquaSKK.xcodeproj Message-ID: <1190598768.200703.5286.nullmailer@users.sourceforge.jp> Index: AquaSKK/proj/AquaSKK.xcodeproj/project.pbxproj diff -u AquaSKK/proj/AquaSKK.xcodeproj/project.pbxproj:1.1.2.5 AquaSKK/proj/AquaSKK.xcodeproj/project.pbxproj:1.1.2.6 --- AquaSKK/proj/AquaSKK.xcodeproj/project.pbxproj:1.1.2.5 Sun Sep 16 09:21:44 2007 +++ AquaSKK/proj/AquaSKK.xcodeproj/project.pbxproj Mon Sep 24 10:52:48 2007 @@ -9,7 +9,6 @@ /* Begin PBXBuildFile section */ D313A5270C808483006DA355 /* SKKKeymapEntry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D313A5240C808483006DA355 /* SKKKeymapEntry.cpp */; }; D324B2040C80FF1C00E86DDA /* SKKEnvironment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D324B1FF0C80FF1C00E86DDA /* SKKEnvironment.cpp */; }; - D324B2100C8A47C900E86DDA /* SKKEventResult.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D324B20E0C8A47C900E86DDA /* SKKEventResult.cpp */; }; D324B2170C8A487E00E86DDA /* SKKController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D324B2120C8A487E00E86DDA /* SKKController.cpp */; }; D324B2190C8A487E00E86DDA /* SKKEmptySubController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D324B2140C8A487E00E86DDA /* SKKEmptySubController.cpp */; }; D324B22C0C8A498C00E86DDA /* SKKDirectInputState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D324B2270C8A498C00E86DDA /* SKKDirectInputState.cpp */; }; @@ -107,6 +106,8 @@ D397D36B0C9BF755002497FE /* SKKEntryInputState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D397D3690C9BF755002497FE /* SKKEntryInputState.cpp */; }; D397D36F0C9BF779002497FE /* SKKEditBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D397D36D0C9BF779002497FE /* SKKEditBuffer.cpp */; }; D3A256AC0C7DD6B4007A6A1A /* keymap.conf in Resources */ = {isa = PBXBuildFile; fileRef = D3A256AB0C7DD6B4007A6A1A /* keymap.conf */; }; + D3B95ADC0CA4D86500A6A45B /* SKKOutputPort.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D3B95AD80CA4D86500A6A45B /* SKKOutputPort.cpp */; }; + D3B95ADE0CA4D86500A6A45B /* SKKRegistrationOutputPort.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D3B95ADA0CA4D86500A6A45B /* SKKRegistrationOutputPort.cpp */; }; D3C4FFC00C7EF88E007AE470 /* SKKKeymap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D3C4FFBE0C7EF88E007AE470 /* SKKKeymap.cpp */; }; D3CD14470C9826A000C10019 /* SKKInputBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D3CD14400C9826A000C10019 /* SKKInputBuffer.cpp */; }; D3CD14490C9826A000C10019 /* SKKRomanKanaConverter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D3CD14420C9826A000C10019 /* SKKRomanKanaConverter.cpp */; }; @@ -157,8 +158,6 @@ D324B1FE0C80FF1C00E86DDA /* SKKEngine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SKKEngine.h; path = ../src/statemachine/SKKEngine.h; sourceTree = SOURCE_ROOT; }; D324B1FF0C80FF1C00E86DDA /* SKKEnvironment.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SKKEnvironment.cpp; path = ../src/statemachine/SKKEnvironment.cpp; sourceTree = SOURCE_ROOT; }; D324B2000C80FF1C00E86DDA /* SKKEnvironment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SKKEnvironment.h; path = ../src/statemachine/SKKEnvironment.h; sourceTree = SOURCE_ROOT; }; - D324B20E0C8A47C900E86DDA /* SKKEventResult.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SKKEventResult.cpp; path = ../src/statemachine/SKKEventResult.cpp; sourceTree = SOURCE_ROOT; }; - D324B20F0C8A47C900E86DDA /* SKKEventResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SKKEventResult.h; path = ../src/statemachine/SKKEventResult.h; sourceTree = SOURCE_ROOT; }; D324B2120C8A487E00E86DDA /* SKKController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SKKController.cpp; path = ../src/controller/SKKController.cpp; sourceTree = SOURCE_ROOT; }; D324B2130C8A487E00E86DDA /* SKKController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SKKController.h; path = ../src/controller/SKKController.h; sourceTree = SOURCE_ROOT; }; D324B2140C8A487E00E86DDA /* SKKEmptySubController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SKKEmptySubController.cpp; path = ../src/controller/SKKEmptySubController.cpp; sourceTree = SOURCE_ROOT; }; @@ -312,6 +311,10 @@ D397D36D0C9BF779002497FE /* SKKEditBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SKKEditBuffer.cpp; path = ../src/context/SKKEditBuffer.cpp; sourceTree = SOURCE_ROOT; }; D397D36E0C9BF779002497FE /* SKKEditBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SKKEditBuffer.h; path = ../src/context/SKKEditBuffer.h; sourceTree = SOURCE_ROOT; }; D3A256AB0C7DD6B4007A6A1A /* keymap.conf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = keymap.conf; path = ../src/keybindings/keymap.conf; sourceTree = SOURCE_ROOT; }; + D3B95AD80CA4D86500A6A45B /* SKKOutputPort.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SKKOutputPort.cpp; path = ../src/context/SKKOutputPort.cpp; sourceTree = SOURCE_ROOT; }; + D3B95AD90CA4D86500A6A45B /* SKKOutputPort.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SKKOutputPort.h; path = ../src/context/SKKOutputPort.h; sourceTree = SOURCE_ROOT; }; + D3B95ADA0CA4D86500A6A45B /* SKKRegistrationOutputPort.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SKKRegistrationOutputPort.cpp; path = ../src/context/SKKRegistrationOutputPort.cpp; sourceTree = SOURCE_ROOT; }; + D3B95ADB0CA4D86500A6A45B /* SKKRegistrationOutputPort.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SKKRegistrationOutputPort.h; path = ../src/context/SKKRegistrationOutputPort.h; sourceTree = SOURCE_ROOT; }; D3C4FFBE0C7EF88E007AE470 /* SKKKeymap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SKKKeymap.cpp; path = ../src/keybindings/SKKKeymap.cpp; sourceTree = SOURCE_ROOT; }; D3C4FFBF0C7EF88E007AE470 /* SKKKeymap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SKKKeymap.h; path = ../src/keybindings/SKKKeymap.h; sourceTree = SOURCE_ROOT; }; D3CD14400C9826A000C10019 /* SKKInputBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SKKInputBuffer.cpp; path = ../src/context/SKKInputBuffer.cpp; sourceTree = SOURCE_ROOT; }; @@ -469,16 +472,11 @@ D37894290C74881E00BE9E85 /* context */ = { isa = PBXGroup; children = ( + D3B95AE20CA4D89100A6A45B /* roman kana converter */, + D3B95AE10CA4D87F00A6A45B /* buffer */, + D3B95AE00CA4D86B00A6A45B /* port */, D324B2320C8A49C500E86DDA /* SKKContext.h */, D324B2310C8A49C500E86DDA /* SKKContext.cpp */, - D3CD14410C9826A000C10019 /* SKKInputBuffer.h */, - D3CD14400C9826A000C10019 /* SKKInputBuffer.cpp */, - D397D36E0C9BF779002497FE /* SKKEditBuffer.h */, - D397D36D0C9BF779002497FE /* SKKEditBuffer.cpp */, - D3CD14430C9826A000C10019 /* SKKRomanKanaConverter.h */, - D3CD14420C9826A000C10019 /* SKKRomanKanaConverter.cpp */, - D3CD14450C9826A000C10019 /* SKKRuleTreeNode.h */, - D3CD14440C9826A000C10019 /* SKKRuleTreeNode.cpp */, ); name = context; sourceTree = ""; @@ -539,8 +537,6 @@ D324B1FE0C80FF1C00E86DDA /* SKKEngine.h */, D324B2000C80FF1C00E86DDA /* SKKEnvironment.h */, D324B1FF0C80FF1C00E86DDA /* SKKEnvironment.cpp */, - D324B20F0C8A47C900E86DDA /* SKKEventResult.h */, - D324B20E0C8A47C900E86DDA /* SKKEventResult.cpp */, ); name = statemachine; sourceTree = ""; @@ -814,6 +810,39 @@ name = icons; sourceTree = ""; }; + D3B95AE00CA4D86B00A6A45B /* port */ = { + isa = PBXGroup; + children = ( + D3B95AD90CA4D86500A6A45B /* SKKOutputPort.h */, + D3B95AD80CA4D86500A6A45B /* SKKOutputPort.cpp */, + D3B95ADB0CA4D86500A6A45B /* SKKRegistrationOutputPort.h */, + D3B95ADA0CA4D86500A6A45B /* SKKRegistrationOutputPort.cpp */, + ); + name = port; + sourceTree = ""; + }; + D3B95AE10CA4D87F00A6A45B /* buffer */ = { + isa = PBXGroup; + children = ( + D3CD14410C9826A000C10019 /* SKKInputBuffer.h */, + D3CD14400C9826A000C10019 /* SKKInputBuffer.cpp */, + D397D36E0C9BF779002497FE /* SKKEditBuffer.h */, + D397D36D0C9BF779002497FE /* SKKEditBuffer.cpp */, + ); + name = buffer; + sourceTree = ""; + }; + D3B95AE20CA4D89100A6A45B /* roman kana converter */ = { + isa = PBXGroup; + children = ( + D3CD14430C9826A000C10019 /* SKKRomanKanaConverter.h */, + D3CD14420C9826A000C10019 /* SKKRomanKanaConverter.cpp */, + D3CD14450C9826A000C10019 /* SKKRuleTreeNode.h */, + D3CD14440C9826A000C10019 /* SKKRuleTreeNode.cpp */, + ); + name = "roman kana converter"; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -998,7 +1027,6 @@ D3C4FFC00C7EF88E007AE470 /* SKKKeymap.cpp in Sources */, D313A5270C808483006DA355 /* SKKKeymapEntry.cpp in Sources */, D324B2040C80FF1C00E86DDA /* SKKEnvironment.cpp in Sources */, - D324B2100C8A47C900E86DDA /* SKKEventResult.cpp in Sources */, D324B2170C8A487E00E86DDA /* SKKController.cpp in Sources */, D324B2190C8A487E00E86DDA /* SKKEmptySubController.cpp in Sources */, D324B22C0C8A498C00E86DDA /* SKKDirectInputState.cpp in Sources */, @@ -1009,6 +1037,8 @@ D3CD144B0C9826A000C10019 /* SKKRuleTreeNode.cpp in Sources */, D397D36B0C9BF755002497FE /* SKKEntryInputState.cpp in Sources */, D397D36F0C9BF779002497FE /* SKKEditBuffer.cpp in Sources */, + D3B95ADC0CA4D86500A6A45B /* SKKOutputPort.cpp in Sources */, + D3B95ADE0CA4D86500A6A45B /* SKKRegistrationOutputPort.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; From t-suwa ¡÷ users.sourceforge.jp Mon Sep 24 10:55:19 2007 From: t-suwa ¡÷ users.sourceforge.jp (t-suwa ¡÷ users.sourceforge.jp) Date: Mon, 24 Sep 2007 10:55:19 +0900 Subject: [aquaskk-changes 389] CVS update: AquaSKK/src/controller Message-ID: <1190598919.700832.6650.nullmailer@users.sourceforge.jp> Index: AquaSKK/src/controller/SKKController.cpp diff -u AquaSKK/src/controller/SKKController.cpp:1.1.2.3 AquaSKK/src/controller/SKKController.cpp:1.1.2.4 --- AquaSKK/src/controller/SKKController.cpp:1.1.2.3 Sun Sep 23 23:56:54 2007 +++ AquaSKK/src/controller/SKKController.cpp Mon Sep 24 10:55:19 2007 @@ -94,21 +94,26 @@ } // ?»é???? -void SKKController::BeginRegistration(const std::string& prompt) { - stack_.push_back(SKKEditor(prompt)); +void SKKController::BeginRegistration(const std::string& prompt, State returnPoint) { + stack_.push_back(SKKRegistrationInfo(prompt, returnPoint)); } // ?»é?çµ?? -void SKKController::EndRegistration(bool commit) { - if(stack_.size() == 1) return; +State SKKController::EndRegistration(bool commit) { + if(stack_.size() == 1) return 0; - std::string result = editor().EditString(); + SKKRegistrationInfo info(editor().RegistrationInfo()); + std::string word(editor().EditString()); stack_.pop_back(); if(commit) { - editor().Commit(result); + editor().Commit(word); + } else { + editor().Commit(""); } + + return info.ReturnPoint(); } // ====================================================================== Index: AquaSKK/src/controller/SKKController.h diff -u AquaSKK/src/controller/SKKController.h:1.1.2.2 AquaSKK/src/controller/SKKController.h:1.1.2.3 --- AquaSKK/src/controller/SKKController.h:1.1.2.2 Sun Sep 23 23:56:54 2007 +++ AquaSKK/src/controller/SKKController.h Mon Sep 24 10:55:19 2007 @@ -1,5 +1,5 @@ /* -*- C++ -*- - $Id: SKKController.h,v 1.1.2.2 2007/09/23 14:56:54 t-suwa Exp $ + $Id: SKKController.h,v 1.1.2.3 2007/09/24 01:55:19 t-suwa Exp $ MacOS X implementation of the SKK input method. @@ -62,8 +62,8 @@ void ChangeState(SKK::EditState); // ??¸°????¸ç???- void BeginRegistration(const std::string& prompt); - void EndRegistration(bool commit); + void BeginRegistration(const std::string& prompt, State returnPoint); + State EndRegistration(bool commit); }; #endif From t-suwa ¡÷ users.sourceforge.jp Mon Sep 24 11:09:04 2007 From: t-suwa ¡÷ users.sourceforge.jp (t-suwa ¡÷ users.sourceforge.jp) Date: Mon, 24 Sep 2007 11:09:04 +0900 Subject: [aquaskk-changes 390] CVS update: AquaSKK/src/editor Message-ID: <1190599744.868780.14026.nullmailer@users.sourceforge.jp> Index: AquaSKK/src/editor/SKKDirectInputState.cpp diff -u AquaSKK/src/editor/SKKDirectInputState.cpp:1.1.2.2 AquaSKK/src/editor/SKKDirectInputState.cpp:1.1.2.3 --- AquaSKK/src/editor/SKKDirectInputState.cpp:1.1.2.2 Sun Sep 16 09:18:52 2007 +++ AquaSKK/src/editor/SKKDirectInputState.cpp Mon Sep 24 11:09:04 2007 @@ -37,9 +37,8 @@ } SKKInputBuffer& buffer = context.InputBuffer(); - if(buffer.Input(param.code)) { - std::cerr << buffer.FixedString(); - } else { + SKKOutputPort& port = context.OutputPort(); + if(!buffer.Input(param.code)) { State state = 0; // 確å??????????????????? do { @@ -71,14 +70,16 @@ if(state) { buffer.Clear(); + port.Terminate(); return new SKKEmptySubController(state); } + } - if(!buffer.FixedString().empty()) { - std::cerr << buffer.FixedString() << std::endl; - } + if(!buffer.FixedString().empty()) { + port.FixString(buffer.FixedString()); } - std::cerr << buffer.InputString() << std::endl; + + port.DisplayString(buffer.InputString()); return 0; } @@ -94,24 +95,28 @@ SKKSubController* SKKDirectInputState::HandleCancel(SKKContext& context, const SKKEventParam&) { SKKInputBuffer& buffer = context.InputBuffer(); + SKKOutputPort& port = context.OutputPort(); if(!buffer.IsEmpty()) { buffer.Clear(); } else { // port ?¼ã??ºã? } - std::cerr << buffer.InputString() << std::endl; + + port.DisplayString(buffer.InputString()); return 0; } SKKSubController* SKKDirectInputState::HandleBackSpace(SKKContext& context, const SKKEventParam&) { SKKInputBuffer& buffer = context.InputBuffer(); + SKKOutputPort& port = context.OutputPort(); if(!buffer.IsEmpty()) { buffer.BackSpace(); } - std::cerr << buffer.InputString() << std::endl; + + port.DisplayString(buffer.InputString()); return 0; } Index: AquaSKK/src/editor/SKKEditor.cpp diff -u AquaSKK/src/editor/SKKEditor.cpp:1.1.2.2 AquaSKK/src/editor/SKKEditor.cpp:1.1.2.3 --- AquaSKK/src/editor/SKKEditor.cpp:1.1.2.2 Sun Sep 16 09:18:52 2007 +++ AquaSKK/src/editor/SKKEditor.cpp Mon Sep 24 11:09:04 2007 @@ -22,20 +22,37 @@ #include "SKKDirectInputState.h" #include "SKKEntryInputState.h" -SKKEditor::SKKEditor() { - initialize(); +// ====================================================================== +// SKKRegistrationInfo ?¤ã??¿ã??§ã???+// ====================================================================== +SKKRegistrationInfo::SKKRegistrationInfo() { +} + +SKKRegistrationInfo::SKKRegistrationInfo(const std::string& prompt, SKKEngine::State returnPoint) + : prompt_(prompt), returnPoint_(returnPoint) { +} + +const std::string& SKKRegistrationInfo::Prompt() const { + return prompt_; } -SKKEditor::SKKEditor(const std::string& prompt) : context_(prompt) { +const SKKEngine::State SKKRegistrationInfo::ReturnPoint() const { + return returnPoint_; +} + +// ====================================================================== +// SKKEditor ?¤ã??¿ã??§ã???+// ====================================================================== +SKKEditor::SKKEditor() { initialize(); } -SKKEditor::SKKEditor(const SKKEditor& src) : context_(src.context_), state_(src.state_) { +SKKEditor::SKKEditor(const SKKRegistrationInfo& info) : context_(info.Prompt()), registrationInfo_(info) { + initialize(); } -// ???çµ?? -const SKKEventResult& SKKEditor::Result() const { - return context_.Result(); +SKKEditor::SKKEditor(const SKKEditor& src) + : context_(src.context_), registrationInfo_(src.registrationInfo_), state_(src.state_) { } // ====================================================================== @@ -115,11 +132,16 @@ } } -std::string SKKEditor::EditString() const { - return ""; +const SKKRegistrationInfo& SKKEditor::RegistrationInfo() const { + return registrationInfo_; +} + +const std::string& SKKEditor::EditString() const { + return context_.Word(); } -void SKKEditor::Commit(const std::string& word) { +void SKKEditor::Commit(const std::string& str) { + context_.OutputPort().FixString(str); } // ====================================================================== Index: AquaSKK/src/editor/SKKEditor.h diff -u AquaSKK/src/editor/SKKEditor.h:1.1.2.2 AquaSKK/src/editor/SKKEditor.h:1.1.2.3 --- AquaSKK/src/editor/SKKEditor.h:1.1.2.2 Sun Sep 2 12:52:18 2007 +++ AquaSKK/src/editor/SKKEditor.h Mon Sep 24 11:09:04 2007 @@ -22,17 +22,31 @@ #define INC__SKKEditor__ #include "SKK.h" +#include "SKKEngine.h" #include "SKKContext.h" class SKKState; class SKKSubController; class SKKEventParam; -class SKKEventResult; + +// ??¸°????¸ç??²ç??????+class SKKRegistrationInfo { + std::string prompt_; + SKKEngine::State returnPoint_; + +public: + SKKRegistrationInfo(); + SKKRegistrationInfo(const std::string& prompt, SKKEngine::State returnPoint); + + const std::string& Prompt() const; + const SKKEngine::State ReturnPoint() const; +}; // ç·???¤ã??¿ã??§ã??? class SKKEditor { SKKContext context_; SKKState* state_; + SKKRegistrationInfo registrationInfo_; void initialize(); @@ -41,12 +55,9 @@ typedef SKKSubController* (SKKEditor::*Handler)(const SKKEventParam&); SKKEditor(); - SKKEditor(const std::string& prompt); + SKKEditor(const SKKRegistrationInfo& info); SKKEditor(const SKKEditor& src); - // ???çµ?? - const SKKEventResult& Result() const; - // ????¥å???? SKKSubController* HandleInput(const SKKEventParam& param); SKKSubController* HandleEnter(const SKKEventParam& param); @@ -67,11 +78,14 @@ // ????¶æ?å¤?? void ChangeState(SKK::EditState state); + // ?»é???????? + const SKKRegistrationInfo& RegistrationInfo() const; + // ç·??????????? - std::string EditString() const; + const std::string& EditString() const; - // 確å????????????? - void Commit(const std::string& word); + // 確å? + void Commit(const std::string& str); }; #endif // INC__SKKEditor__ Index: AquaSKK/src/editor/SKKEntryInputState.cpp diff -u AquaSKK/src/editor/SKKEntryInputState.cpp:1.1.2.1 AquaSKK/src/editor/SKKEntryInputState.cpp:1.1.2.2 --- AquaSKK/src/editor/SKKEntryInputState.cpp:1.1.2.1 Sun Sep 16 09:18:52 2007 +++ AquaSKK/src/editor/SKKEntryInputState.cpp Mon Sep 24 11:09:04 2007 @@ -33,6 +33,7 @@ SKKSubController* SKKEntryInputState::HandleInput(SKKContext& context, const SKKEventParam& param) { SKKInputBuffer& buffer = context.InputBuffer(); SKKEditBuffer& edit = context.EditBuffer(); + SKKOutputPort& port = context.OutputPort(); if(!edit.IsEmpty()) { State state = 0; @@ -43,7 +44,7 @@ std::string result; toggleKana(buffer.InputMode(), edit.EditString(), result); edit.Clear(); - std::cerr << result << std::endl; + port.FixString(result); state = State::Transition(&SKKEnvironment::KanaInput); break; } @@ -53,7 +54,7 @@ std::string result; toggleJisx0201Kana(buffer.InputMode(), edit.EditString(), result); edit.Clear(); - std::cerr << result << std::endl; + port.FixString(result); state = State::Transition(&SKKEnvironment::KanaInput); break; } @@ -61,6 +62,7 @@ // ?????? if(param.IsUpperCases()) { std::cerr << "?????????" << std::endl; + state = State::Transition(&SKKEnvironment::Okuri); break; } @@ -72,6 +74,7 @@ } while(0); if(state) { + port.Terminate(); return new SKKEmptySubController(state); } } @@ -99,7 +102,7 @@ } while(0); if(state) { - std::cerr << edit.EditString() << std::endl; + port.FixString(edit.EditString()); edit.Clear(); buffer.Clear(); return new SKKEmptySubController(state); @@ -110,7 +113,7 @@ } } - std::cerr << edit.EditString() << buffer.InputString() << std::endl; + display(context); return 0; } @@ -126,9 +129,10 @@ SKKSubController* SKKEntryInputState::HandleJmode(SKKContext& context, const SKKEventParam&) { SKKInputBuffer& buffer = context.InputBuffer(); SKKEditBuffer& edit = context.EditBuffer(); + SKKOutputPort& port = context.OutputPort(); // ?¾å????è£??確å? - std::cerr << edit.EditString() << std::endl; + port.FixString(edit.EditString()); edit.Clear(); buffer.Clear(); @@ -139,12 +143,13 @@ SKKSubController* SKKEntryInputState::HandleCancel(SKKContext& context, const SKKEventParam&) { SKKInputBuffer& buffer = context.InputBuffer(); SKKEditBuffer& edit = context.EditBuffer(); + SKKOutputPort& port = context.OutputPort(); edit.Clear(); buffer.Clear(); // 空ã???? - std::cerr << edit.EditString() << std::endl; + port.Terminate(); return new SKKEmptySubController(State::Transition(&SKKEnvironment::KanaInput)); } @@ -152,6 +157,7 @@ SKKSubController* SKKEntryInputState::HandleBackSpace(SKKContext& context, const SKKEventParam&) { SKKInputBuffer& buffer = context.InputBuffer(); SKKEditBuffer& edit = context.EditBuffer(); + SKKOutputPort& port = context.OutputPort(); if(!buffer.IsEmpty()) { buffer.BackSpace(); @@ -159,11 +165,13 @@ if(!edit.IsEmpty()) { edit.BackSpace(); } else { + port.Terminate(); + return new SKKEmptySubController(State::Transition(&SKKEnvironment::KanaInput)); } } - std::cerr << edit.EditString() << buffer.InputString() << std::endl; + display(context); return 0; } @@ -174,14 +182,14 @@ if(buffer.IsEmpty() && !edit.IsEmpty()) { edit.Delete(); - - std::cerr << edit.EditString() << std::endl; } + display(context); + return 0; } -SKKSubController* SKKEntryInputState::HandleTab(SKKContext& context, const SKKEventParam&) { +SKKSubController* SKKEntryInputState::HandleTab(SKKContext&, const SKKEventParam&) { // æ¤?´¢?§ã???? if(0) { // è£???¢ã???@@ -200,56 +208,44 @@ buffer.Clear(); edit.Insert("paste string"); - std::cerr << edit.EditString() << std::endl; + display(context); } return 0; } SKKSubController* SKKEntryInputState::HandleCursorLeft(SKKContext& context, const SKKEventParam&) { - SKKInputBuffer& buffer = context.InputBuffer(); - SKKEditBuffer& edit = context.EditBuffer(); - - buffer.Clear(); - edit.CursorLeft(); + context.InputBuffer().Clear(); + context.EditBuffer().CursorLeft(); - std::cerr << edit.EditString() << std::endl; + display(context); return 0; } SKKSubController* SKKEntryInputState::HandleCursorRight(SKKContext& context, const SKKEventParam&) { - SKKInputBuffer& buffer = context.InputBuffer(); - SKKEditBuffer& edit = context.EditBuffer(); + context.InputBuffer().Clear(); + context.EditBuffer().CursorRight(); - buffer.Clear(); - edit.CursorRight(); - - std::cerr << edit.EditString() << std::endl; + display(context); return 0; } SKKSubController* SKKEntryInputState::HandleCursorUp(SKKContext& context, const SKKEventParam&) { - SKKInputBuffer& buffer = context.InputBuffer(); - SKKEditBuffer& edit = context.EditBuffer(); - - buffer.Clear(); - edit.CursorUp(); + context.InputBuffer().Clear(); + context.EditBuffer().CursorUp(); - std::cerr << edit.EditString() << std::endl; + display(context); return 0; } SKKSubController* SKKEntryInputState::HandleCursorDown(SKKContext& context, const SKKEventParam&) { - SKKInputBuffer& buffer = context.InputBuffer(); - SKKEditBuffer& edit = context.EditBuffer(); - - buffer.Clear(); - edit.CursorDown(); + context.InputBuffer().Clear(); + context.EditBuffer().CursorDown(); - std::cerr << edit.EditString() << std::endl; + display(context); return 0; } @@ -257,6 +253,18 @@ // ====================================================================== // private method // ====================================================================== +void SKKEntryInputState::display(SKKContext& context) { + SKKOutputPort& port = context.OutputPort(); + SKKInputBuffer& input = context.InputBuffer(); + SKKEditBuffer edit(context.EditBuffer()); + + if(!input.IsEmpty()) { + edit.Insert(input.InputString()); + } + + port.DisplayString("?? + edit.EditString(), 1 + edit.CursorPosition()); +} + void SKKEntryInputState::toggleKana(SKK::InputMode mode, const std::string& from, std::string& to) { to.clear(); Index: AquaSKK/src/editor/SKKEntryInputState.h diff -u AquaSKK/src/editor/SKKEntryInputState.h:1.1.2.1 AquaSKK/src/editor/SKKEntryInputState.h:1.1.2.2 --- AquaSKK/src/editor/SKKEntryInputState.h:1.1.2.1 Sun Sep 16 09:18:52 2007 +++ AquaSKK/src/editor/SKKEntryInputState.h Mon Sep 24 11:09:04 2007 @@ -26,7 +26,12 @@ #include "SKKState.h" // è¦??????¥å??¶æ? -struct SKKEntryInputState : public SKKState { +class SKKEntryInputState : public SKKState { + void display(SKKContext& context); + void toggleKana(SKK::InputMode mode, const std::string& from, std::string& to); + void toggleJisx0201Kana(SKK::InputMode mode, const std::string& from, std::string& to); + +public: static SKKEntryInputState& theInstance(); virtual SKKSubController* HandleInput(SKKContext& context, const SKKEventParam& param); @@ -41,10 +46,6 @@ virtual SKKSubController* HandleCursorRight(SKKContext& context, const SKKEventParam& param); virtual SKKSubController* HandleCursorUp(SKKContext& context, const SKKEventParam& param); virtual SKKSubController* HandleCursorDown(SKKContext& context, const SKKEventParam& param); - -private: - void toggleKana(SKK::InputMode mode, const std::string& from, std::string& to); - void toggleJisx0201Kana(SKK::InputMode mode, const std::string& from, std::string& to); }; #endif From t-suwa ¡÷ users.sourceforge.jp Mon Sep 24 18:23:33 2007 From: t-suwa ¡÷ users.sourceforge.jp (t-suwa ¡÷ users.sourceforge.jp) Date: Mon, 24 Sep 2007 18:23:33 +0900 Subject: [aquaskk-changes 391] CVS update: AquaSKK/src/statemachine Message-ID: <1190625813.583516.18259.nullmailer@users.sourceforge.jp> Index: AquaSKK/src/statemachine/SKKEnvironment.cpp diff -u AquaSKK/src/statemachine/SKKEnvironment.cpp:1.1.2.2 AquaSKK/src/statemachine/SKKEnvironment.cpp:1.1.2.3 --- AquaSKK/src/statemachine/SKKEnvironment.cpp:1.1.2.2 Sun Sep 23 23:48:08 2007 +++ AquaSKK/src/statemachine/SKKEnvironment.cpp Mon Sep 24 18:23:33 2007 @@ -257,7 +257,7 @@ return controller_->HandleCursorDown(); case SKK_CANCEL: - return State::Transition(&SKKEnvironment::KanaInput); + return controller_->HandleCancel(); } return &SKKEnvironment::TopState; From t-suwa ¡÷ users.sourceforge.jp Mon Sep 24 18:24:55 2007 From: t-suwa ¡÷ users.sourceforge.jp (t-suwa ¡÷ users.sourceforge.jp) Date: Mon, 24 Sep 2007 18:24:55 +0900 Subject: [aquaskk-changes 392] CVS update: AquaSKK Message-ID: <1190625895.549909.19135.nullmailer@users.sourceforge.jp> Index: AquaSKK/GenericStateMachine.h diff -u AquaSKK/GenericStateMachine.h:1.1.2.1 AquaSKK/GenericStateMachine.h:removed --- AquaSKK/GenericStateMachine.h:1.1.2.1 Sat Feb 3 16:53:29 2007 +++ AquaSKK/GenericStateMachine.h Mon Sep 24 18:24:55 2007 @@ -1,503 +0,0 @@ -/* -*- C++ -*- - - Generic State Machine Library for C++. - - Copyright (c) 2006, Tomotaka SUWA All rights - reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - Neither the name of the "Generic State Machine Library for C++" nor - the names of its contributors may be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - - $Id: GenericStateMachine.h,v 1.1.2.1 2007/02/03 07:53:29 t-suwa Exp $ -*/ - -#ifndef INC__GenericStateMachine__ -#define INC__GenericStateMachine__ - -#include -#include -#include -#include -#include - -namespace statemachinecxx_sourceforge_jp { - // ====================================================================== - // event types - // ====================================================================== - enum EventTypes { - EXIT_EVENT = -3, - INIT_EVENT = -2, - ENTRY_EVENT = -1, - PROBE = 0, - USER_EVENT = 1 - }; - - // ====================================================================== - // Event - // ====================================================================== - template - class GenericEvent { - int type_; - ParamType param_; - - public: - GenericEvent() {} - GenericEvent(int type) : type_(type) {} - GenericEvent(int type, const ParamType& arg) : type_(type), param_(arg) {} - - operator int() const { return type_; } - void SetType(int type) { type_ = type;} - - const ParamType& Param() const { return param_; } - void SetParam(const ParamType& arg) { param_ = arg; } - - static GenericEvent& Probe() { static GenericEvent evt(PROBE); return evt; } - static GenericEvent& Entry() { static GenericEvent evt(ENTRY_EVENT); return evt; } - static GenericEvent& Exit() { static GenericEvent evt(EXIT_EVENT); return evt; } - static GenericEvent& Init() { static GenericEvent evt(INIT_EVENT); return evt; } - }; - - // ====================================================================== - // State - // ====================================================================== - template - class GenericState { - enum StateType { - UNKNOWN, - SUPER, - INITIAL, - SHALLOW_HISTORY, - DEEP_HISTORY, - TRANSITION, - FORWARD, - DEEP_FORWARD, - SAVE_HISTORY, - DEFER_EVENT - }; - - typedef typename StateContainer::Handler Handler; - - int type_; - Handler handler_; - - GenericState(StateType type, Handler handler) : type_(type), handler_(handler) {} - - public: - GenericState() : type_(UNKNOWN), handler_(0) {} - GenericState(Handler handler) : type_(UNKNOWN), handler_(handler) {} - - operator Handler() const { return handler_; } - - bool IsSuper() const { return type_ == SUPER; } - bool IsInitial() const { return type_ == INITIAL; } - bool IsShallowHistory() const { return type_ == SHALLOW_HISTORY; } - bool IsDeepHistory() const { return type_ == DEEP_HISTORY; } - bool IsTransition() const { return type_ == TRANSITION; } - bool IsForward() const { return type_ == FORWARD; } - bool IsDeepForward() const { return type_ == DEEP_FORWARD; } - bool IsSaveHistory() const { return type_ == SAVE_HISTORY; } - bool IsDeferEvent() const { return type_ == DEFER_EVENT; } - - static GenericState Super(Handler handler) { return GenericState(SUPER, handler); } - static GenericState Initial(Handler handler) { return GenericState(INITIAL, handler); } - static GenericState ShallowHistory(Handler handler) { return GenericState(SHALLOW_HISTORY, handler); } - static GenericState DeepHistory(Handler handler) { return GenericState(DEEP_HISTORY, handler); } - static GenericState Transition(Handler handler) { return GenericState(TRANSITION, handler); } - static GenericState Forward(Handler handler) { return GenericState(FORWARD, handler); } - static GenericState DeepForward(Handler handler) { return GenericState(DEEP_FORWARD, handler); } - static GenericState SaveHistory() { return GenericState(SAVE_HISTORY, 0); } - static GenericState DeferEvent() { return GenericState(DEFER_EVENT, 0); } - }; - - // ====================================================================== - // State History - // ====================================================================== - template - class GenericStateHistory { - typedef std::pair Entry; - std::vector keys_; - std::vector values_; - - enum HistoryType { SHALLOW, DEEP }; - - int lookup(const Handler key) const { - typename std::vector::const_iterator iter = std::find(keys_.begin(), keys_.end(), key); - - if(iter == keys_.end()) return -1; - - return iter - keys_.begin(); - } - - const Handler get(Handler key, HistoryType type) const { - int pos = lookup(key); - - if(pos < 0) return 0; - - return (type == SHALLOW) ? values_[pos].first : values_[pos].second; - } - - public: - void Save(Handler key, Handler shallow, Handler deep) { - int pos = lookup(key); - Entry history(std::make_pair(shallow, deep)); - - if(pos < 0) { - keys_.push_back(key); - values_.push_back(history); - } else { - values_[pos] = history; - } - } - - const Handler Shallow(Handler key) const { - return get(key, SHALLOW); - } - - const Handler Deep(Handler key) const { - return get(key, DEEP); - } - }; - - // ====================================================================== - // Deferred Event - // ====================================================================== - template - class GenericDeferEvent { - typedef typename StateContainer::Event Event; - typedef typename StateContainer::Handler Handler; - typedef std::pair Entry; - std::list queue_; - - struct NotEqual : public std::unary_function { - const Handler key; - NotEqual(Handler arg) : key(arg) {} - bool operator()(const Entry& entry) const { - return key != entry.first; - } - }; - - public: - void Enqueue(const Handler key, const Event& event) { - queue_.push_back(std::make_pair(key, event)); - } - - bool Dequeue(const Handler key, Event& event) { - typename std::list::iterator iter = std::find_if(queue_.begin(), queue_.end(), NotEqual(key)); - - if(iter != queue_.end()) { - event = iter->second; - queue_.erase(iter); - return true; - } - - return false; - } - }; - - // ====================================================================== - // Standard Invoker - // ====================================================================== - template - class StandardInvoker { - typedef typename StateContainer::Handler Handler; - typedef typename StateContainer::Event Event; - typedef typename StateContainer::State State; - - StateContainer& instance_; - - public: - StandardInvoker(StateContainer& obj) : instance_(obj) {} - - State operator()(const Handler handler, const Event& event) { - assert(handler != 0 && "Invalid handler address."); - return (instance_.*handler)(event); - } - }; - - // ====================================================================== - // State Machine - // ====================================================================== - template class Invoker = StandardInvoker> - class GenericStateMachine { - typedef typename StateContainer::Handler Handler; - typedef typename StateContainer::Event Event; - typedef typename StateContainer::State State; - typedef typename StateContainer::Output Output; - - StateContainer container_; - - Handler top_; - Handler active_; - Handler prior_; - - Invoker invoke_; - GenericStateHistory history_; - GenericDeferEvent queue_; - - Event defer_; - - typedef typename std::vector Path; - typedef typename Path::iterator PathIterator; - - Path path_; - - // ------------------------------------------------------------ - // primitive functions - // ------------------------------------------------------------ - State getSuperState(const Handler handler) { return invoke_(handler, Event::Probe()); } - State entryAction(const Handler handler) { return invoke_(handler, Event::Entry()); } - State initialTransition(const Handler handler) { return invoke_(handler, Event::Init()); } - State exitAction(const Handler handler) { - State result = invoke_(handler, Event::Exit()); - - if(result.IsSaveHistory()) { - assert(prior_ != 0 && "Shallow history not found."); - history_.Save(handler, prior_, active_); - } - - prior_ = handler; - - return result; - } - - // ------------------------------------------------------------ - // trigger initial transition - // ------------------------------------------------------------ - void initialize(const State& target) { - State state; - - active_ = target; - - for(state = initialTransition(active_); state.IsInitial() || state.IsShallowHistory(); - state = initialTransition(active_)) { - assert(state != active_ && "Infinete loop detected. Check INIT_EVENT."); - assert((getSuperState(state) == active_ || getSuperState(state) == getSuperState(active_)) - && "Initial transition must go same level or one level deep."); - - if(state.IsShallowHistory()) { - Handler shallow = history_.Shallow(active_); - if(!shallow) { - history_.Save(active_, state, 0); // first time - active_ = state; - } else { - active_ = shallow; - } - } else { - active_ = state; - } - - entryAction(active_); - } - - assert(state.IsSuper() && "Initial transition must be ended by 'return State::Super(state);'."); - } - - // ------------------------------------------------------------ - // trigger transition - // ------------------------------------------------------------ - void transition(const Handler source, const Handler target) { - assert(target != top_ && "You can not transition to TopState."); - - Handler tmp; - - // exit to source - for(tmp = active_, prior_ = 0; tmp != source; tmp = getSuperState(tmp)) { - exitAction(tmp); - } - - // exit to LCA(Least Common Ancestor) and record path to target - do { - path_.push_back(target); - - // (a) self transition - if(source == target) { - exitAction(source); - break; - } - - // (b) go into substate(one level) - Handler targetSuper = getSuperState(target); - if(source == targetSuper) { - break; - } - - // (c) balanced transition - Handler sourceSuper = getSuperState(source); - if(sourceSuper == targetSuper) { - exitAction(source); - break; - } - - // (d) exit from substate(one level) - if(sourceSuper == target) { - exitAction(source); - path_.clear(); - break; - } - - // (e) go into substate(multiple level) - path_.push_back(targetSuper); - for(tmp = getSuperState(targetSuper); tmp != 0; tmp = getSuperState(tmp)) { - if(source == tmp) { - break; - } - path_.push_back(tmp); - } - if(tmp != 0) break; - - exitAction(source); - - struct check { - static bool exist(Path& path, const Handler handler) { - PathIterator iter = std::find(path.begin(), path.end(), handler); - if(iter != path.end()) { - path.erase(iter, path.end()); - return true; - } - return false; - } - }; - - // (f) unbalanced transition - if(check::exist(path_, sourceSuper)) { - break; - } - - // (g) exit from substate(multiple level) - for(tmp = sourceSuper; tmp != 0; tmp = getSuperState(tmp)) { - if(check::exist(path_, tmp)) { - break; - } - exitAction(tmp); - } - if(tmp != 0) break; - - assert(0 && "Invalid state transition form."); - } while(0); - - // go into target - while(!path_.empty()) { - entryAction(path_.back()); - path_.pop_back(); - } - } - - public: - GenericStateMachine() : top_(&StateContainer::TopState), active_(0), prior_(0), invoke_(container_) {} - - ~GenericStateMachine() { - for(Handler tmp = active_; tmp != 0; tmp = getSuperState(tmp)) { - exitAction(tmp); - } - } - - void Start() { - assert(active_ == 0 && "You can't call Start() twice."); - - initialize(State::Initial(top_)); - } - - void Dispatch(const Event& event) { - assert(active_ != 0 && "You must call Start() before call Dispatch()."); - - State next; - - for(Handler source = active_; source != 0; source = next) { - next = invoke_(source, event); - - if(next.IsDeferEvent()) { - queue_.Enqueue(next, event); - break; - } - - if(next.IsForward() || next.IsDeepForward()) { - if(next.IsDeepForward()) { - next = history_.Deep(next); - assert(next != 0 && "Deep history not found."); - } - - transition(source, next); - initialize(next); - continue; - } - - if(next.IsTransition() || next.IsDeepHistory()) { - if(next.IsDeepHistory()) { - next = history_.Deep(next); - assert(next != 0 && "Deep history not found."); - } - - transition(source, next); - initialize(next); - - while(queue_.Dequeue(next, defer_)) { - Dispatch(defer_); // recursion - } - break; - } - - assert(!next.IsShallowHistory() && !next.IsSaveHistory() && !next.IsInitial() && "Invalid state."); - } - } - - const Output& Result() const { - return container_.Result(); - } - }; - -} // statemachinecxx_sourceforge_jp - -// ====================================================================== -// helper macro -// ====================================================================== - -#define DECLARE_ImportantTypes(container, param, result) \ - typedef GenericState State; \ - typedef GenericEvent Event; \ - typedef State (container::*Handler)(const Event&); \ - typedef result Output; - -#define DECLARE_TopState(container, initial) \ - State TopState(const Event& event) { \ - switch(event) { \ - case INIT_EVENT: \ - return State::Initial(&container::initial); \ - } \ - return 0; \ - } - -#define DECLARE_StateContainer(container, param, result, initial) \ - DECLARE_ImportantTypes(container, param, result) \ - DECLARE_TopState(container, initial) - -#define IMPLEMENT_StateContainer(container) \ - typedef container::State State; \ - typedef container::Event Event; - -#endif From t-suwa ¡÷ users.sourceforge.jp Mon Sep 24 18:25:46 2007 From: t-suwa ¡÷ users.sourceforge.jp (t-suwa ¡÷ users.sourceforge.jp) Date: Mon, 24 Sep 2007 18:25:46 +0900 Subject: [aquaskk-changes 393] CVS update: AquaSKK Message-ID: <1190625946.982213.19300.nullmailer@users.sourceforge.jp> Index: AquaSKK/KotoeriDictionary.h diff -u AquaSKK/KotoeriDictionary.h:1.2.2.4 AquaSKK/KotoeriDictionary.h:1.2.2.5 --- AquaSKK/KotoeriDictionary.h:1.2.2.4 Sat Feb 3 17:52:48 2007 +++ AquaSKK/KotoeriDictionary.h Mon Sep 24 18:25:46 2007 @@ -1,5 +1,5 @@ /* - $Id: KotoeriDictionary.h,v 1.2.2.4 2007/02/03 08:52:48 t-suwa Exp $ + $Id: KotoeriDictionary.h,v 1.2.2.5 2007/09/24 09:25:46 t-suwa Exp $ MacOS X implementation of the SKK input method. @@ -27,6 +27,7 @@ #ifndef INC__KotoeriDictionary__ #define INC__KotoeriDictionary__ +#include #include "Dictionary.h" class KotoeriDictionary: public Dictionary { From t-suwa ¡÷ users.sourceforge.jp Mon Sep 24 18:55:36 2007 From: t-suwa ¡÷ users.sourceforge.jp (t-suwa ¡÷ users.sourceforge.jp) Date: Mon, 24 Sep 2007 18:55:36 +0900 Subject: [aquaskk-changes 394] CVS update: AquaSKK/src/test Message-ID: <1190627736.864061.2739.nullmailer@users.sourceforge.jp> Index: AquaSKK/src/test/.cvsignore diff -u /dev/null AquaSKK/src/test/.cvsignore:1.1.2.1 --- /dev/null Mon Sep 24 18:55:36 2007 +++ AquaSKK/src/test/.cvsignore Mon Sep 24 18:55:36 2007 @@ -0,0 +1,10 @@ +.depend +.gdb_history +KotoeriDictionary_TEST +SKKEditBuffer_TEST +SKKInputBuffer_TEST +SKKKeymapEntry_TEST +SKKKeymap_TEST +SKKRomanKanaConverter_TEST +SKKRuleTreeNode_TEST +SKKUserDictionary_TEST From t-suwa ¡÷ users.sourceforge.jp Mon Sep 24 19:04:34 2007 From: t-suwa ¡÷ users.sourceforge.jp (t-suwa ¡÷ users.sourceforge.jp) Date: Mon, 24 Sep 2007 19:04:34 +0900 Subject: [aquaskk-changes 395] CVS update: AquaSKK/src/test Message-ID: <1190628274.818407.8199.nullmailer@users.sourceforge.jp> Index: AquaSKK/src/test/.cvsignore diff -u AquaSKK/src/test/.cvsignore:1.1.2.1 AquaSKK/src/test/.cvsignore:1.1.2.2 --- AquaSKK/src/test/.cvsignore:1.1.2.1 Mon Sep 24 18:55:36 2007 +++ AquaSKK/src/test/.cvsignore Mon Sep 24 19:04:34 2007 @@ -8,3 +8,4 @@ SKKRomanKanaConverter_TEST SKKRuleTreeNode_TEST SKKUserDictionary_TEST +skk-user-dic.utf8 Index: AquaSKK/src/test/Makefile diff -u AquaSKK/src/test/Makefile:1.1.2.6 AquaSKK/src/test/Makefile:1.1.2.7 --- AquaSKK/src/test/Makefile:1.1.2.6 Sun Sep 16 09:15:42 2007 +++ AquaSKK/src/test/Makefile Mon Sep 24 19:04:34 2007 @@ -3,15 +3,17 @@ ### VPATH = $(filter-out %/CVS,$(wildcard ../*)) ../.. -CPPFLAGS= $(foreach dir,$(VPATH),-I$(dir)) +CPPFLAGS= $(foreach dir,$(VPATH),-I$(dir)) -g SRCS = $(wildcard *_TEST.cpp) OBJS = $(SRCS:.cpp=.o) PROGS = $(SRCS:.cpp=) +DEPDIR = .depend LIB = libtest.a -LDFLAGS = -L. -ltest +LDFLAGS = -L. -ltest -framework Carbon LIBOBJS = SKKKeymapEntry.o SKKKeymap.o SKKRuleTreeNode.o SKKRomanKanaConverter.o \ - SKKInputBuffer.o jconv.o SKKEditBuffer.o + SKKInputBuffer.o jconv.o SKKEditBuffer.o KotoeriDictionary.o CppCFString.o \ + SKKDictionary.o SKKConfig.o CppCFData.o all: $(LIB) $(PROGS) @@ -19,7 +21,7 @@ @for prog in $(PROGS); do ./$$prog; done clean: - $(RM) -rf $(PROGS) $(LIB) *.o .depend + $(RM) -rf $(PROGS) $(LIB) *.o $(DEPDIR) $(LIB): $(LIBOBJS) $(AR) -rsu $@ $(LIBOBJS) @@ -27,12 +29,12 @@ $(PROGS): %: %.o $(LIB) $(CXX) -o $@ $< $(LDFLAGS) -.depend/%.d: %.cpp .depend +$(DEPDIR)/%.d: %.cpp $(DEPDIR) $(CXX) -MM $(CPPFLAGS) $< | sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' > $@ -.depend: - @mkdir .depend +$(DEPDIR): + @mkdir $@ ifneq ($(MAKECMDGOALS), clean) --include $(addprefix .depend/,$(LIBOBJS:.o=.d) $(OBJS:.o=.d)) +-include $(addprefix $(DEPDIR)/,$(LIBOBJS:.o=.d) $(OBJS:.o=.d)) endif From t-suwa ¡÷ users.sourceforge.jp Mon Sep 24 20:10:05 2007 From: t-suwa ¡÷ users.sourceforge.jp (t-suwa ¡÷ users.sourceforge.jp) Date: Mon, 24 Sep 2007 20:10:05 +0900 Subject: [aquaskk-changes 396] CVS update: AquaSKK Message-ID: <1190632205.143255.11106.nullmailer@users.sourceforge.jp> Index: AquaSKK/skkserv.cpp diff -u AquaSKK/skkserv.cpp:1.3.2.7 AquaSKK/skkserv.cpp:1.3.2.8 --- AquaSKK/skkserv.cpp:1.3.2.7 Fri Aug 17 21:47:26 2007 +++ AquaSKK/skkserv.cpp Mon Sep 24 20:10:04 2007 @@ -1,5 +1,5 @@ /* - $Id: skkserv.cpp,v 1.3.2.7 2007/08/17 12:47:26 t-suwa Exp $ + $Id: skkserv.cpp,v 1.3.2.8 2007/09/24 11:10:04 t-suwa Exp $ MacOS X implementation of the SKK input method. @@ -94,6 +94,7 @@ switch(cmd) { case '0': // ??? break; + case '1': { // æ¤?´¢ std::string word; sock >> word; @@ -115,23 +116,32 @@ if(result != "//") { std::string candidates; jconv::convert_utf8_to_eucj(result, candidates); - sock << "1" << candidates << "\n"; + sock << '1' << candidates << std::endl; } else { - sock << "4" << word << "\n"; + sock << '4' << word << ' '; } sock.flush(); } break; + case '2': // ????¸ã???- sock << "AquaSKKServer (skkserv emulation)" << std::endl; + sock << "AquaSKKServer1.0 "; sock.flush(); break; + case '3': // ????????- sock << ip_address::getsockname(sock.socket()) << ":0.0.0.0:" << std::endl; + sock << ip_address::getsockname(sock.socket()) << ":0.0.0.0: "; sock.flush(); break; + + case '4': // ?µã????è£?? + // ä»????????対å? + sock.ignore(0xff, ' '); + default: // ?¡å????????? fprintf(stderr, "AquaSKK(skkserv): Unknown command[0x%02x]\n", cmd); + sock << '0'; + sock.flush(); break; } } while(sock.good() && cmd != '0'); Index: AquaSKK/SKKDictionary.cpp diff -u AquaSKK/SKKDictionary.cpp:1.12.2.5 AquaSKK/SKKDictionary.cpp:1.12.2.6 --- AquaSKK/SKKDictionary.cpp:1.12.2.5 Sat Feb 3 17:52:48 2007 +++ AquaSKK/SKKDictionary.cpp Mon Sep 24 20:10:04 2007 @@ -1,5 +1,5 @@ /* - $Id: SKKDictionary.cpp,v 1.12.2.5 2007/02/03 08:52:48 t-suwa Exp $ + $Id: SKKDictionary.cpp,v 1.12.2.6 2007/09/24 11:10:04 t-suwa Exp $ MacOS X implementation of the SKK input method. @@ -462,7 +462,7 @@ // è¦???????? if(i != okuriAri_.end()) { entry = SKKEntry::ParseOkuriAri(i->first, i->second); - okuriAri_.erase(std::remove(okuriAri_.begin(), okuriAri_.end(), *i), okuriAri_.end()); + okuriAri_.erase(i); } entry.Update(SKKCandidate(kanji), okuri); @@ -479,7 +479,7 @@ // è¦???????? if(i != okuriNasi_.end()) { entry = SKKEntry::ParseOkuriNasi(i->first, i->second); - okuriNasi_.erase(std::remove(okuriNasi_.begin(), okuriNasi_.end(), *i), okuriNasi_.end()); + okuriNasi_.erase(i); } entry.Update(SKKCandidate(kanji)); @@ -506,7 +506,7 @@ *i = SKKPair(entry.Key(), entry.Candidate()); } else { // ????????????????????- okuriAri_.erase(std::remove(okuriAri_.begin(), okuriAri_.end(), *i), okuriAri_.end()); + okuriAri_.erase(i); } // ä¿????? @@ -530,7 +530,7 @@ *i = SKKPair(entry.Key(), entry.Candidate()); } else { // ????????????????????- okuriNasi_.erase(std::remove(okuriNasi_.begin(), okuriNasi_.end(), *i), okuriNasi_.end()); + okuriNasi_.erase(i); } // ä¿????? Index: AquaSKK/KotoeriDictionary.cpp diff -u AquaSKK/KotoeriDictionary.cpp:1.3.2.4 AquaSKK/KotoeriDictionary.cpp:1.3.2.5 --- AquaSKK/KotoeriDictionary.cpp:1.3.2.4 Sat Feb 3 17:52:48 2007 +++ AquaSKK/KotoeriDictionary.cpp Mon Sep 24 20:10:04 2007 @@ -1,10 +1,10 @@ /* - $Id: KotoeriDictionary.cpp,v 1.3.2.4 2007/02/03 08:52:48 t-suwa Exp $ + $Id: KotoeriDictionary.cpp,v 1.3.2.5 2007/09/24 11:10:04 t-suwa Exp $ MacOS X implementation of the SKK input method. Copyright (C) 2002 phonohawk - Copyright (C) 2005-2006 Tomotaka SUWA + Copyright (C) 2005-2007 Tomotaka SUWA 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 @@ -24,10 +24,11 @@ Directory Maneger対å???002.09.25 Shin_ichi Abe. */ -#include #include #include #include "KotoeriDictionary.h" +#include "CppCFData.h" +#include "CppCFString.h" KotoeriDictionary::KotoeriDictionary() : path_(0), isRegistered_(false), id_(0) { // empty @@ -123,13 +124,13 @@ if(status != noErr) break; DescType actualType; - char dataBuffer[kMaxKanjiLengthInAppleJapaneseDictionary]; + UInt8 dataBuffer[kMaxKanjiLengthInAppleJapaneseDictionary]; Size actualSize; // Get one data from AERecord status = AEGetParamPtr(&dataList, kDCMJapaneseHyokiTag, - typeUTF8Text, + typeUnicodeText, &actualType, dataBuffer, kMaxKanjiLengthInAppleJapaneseDictionary, @@ -140,8 +141,12 @@ if(status != noErr) break; + CFStringRef entry = CFStringCreateWithBytes(0, dataBuffer, actualSize, kCFStringEncodingUnicode, 0); + CppCFString tmp(entry); + CFRelease(entry); + result += '/'; - result.append(dataBuffer, actualSize); + result += tmp.encode().toStdString(kCFStringEncodingUTF8); } DCMDisposeRecordIterator(iterator); @@ -162,12 +167,13 @@ // ????¼ã????ç´? OSStatus status; DCMFieldTag dataFieldTagList[] = { kDCMJapaneseHyokiTag }; - CFStringRef keydata = CFStringCreateWithCString(NULL, key.c_str(), kCFStringEncodingUTF8); + CFStringRef keydata = CppCFString(key.c_str(), kCFStringEncodingUTF8).toBigEndianCFString(); + status = DCMFindRecords(ref, // Dictionary reference - kDCMJapaneseYomiTag, // key field tag - CFStringGetLength(keydata) * sizeof(UInt16), // key data length + kDCMJapaneseYomiTag, // key field tag + CFStringGetLength(keydata) * sizeof(UniChar), // key data length CFStringGetCharactersPtr(keydata), // key data - kDCMFindMethodExactMatch, // find method + kDCMFindMethodExactMatch, // find method 1, // number of data field dataFieldTagList, // data field tag list 0, 0, // search all records Index: AquaSKK/KanjiConversionMode.cpp diff -u AquaSKK/KanjiConversionMode.cpp:1.8.2.6 AquaSKK/KanjiConversionMode.cpp:1.8.2.7 --- AquaSKK/KanjiConversionMode.cpp:1.8.2.6 Thu Aug 16 19:58:18 2007 +++ AquaSKK/KanjiConversionMode.cpp Mon Sep 24 20:10:04 2007 @@ -1,5 +1,5 @@ /* - $Id: KanjiConversionMode.cpp,v 1.8.2.6 2007/08/16 10:58:18 t-suwa Exp $ + $Id: KanjiConversionMode.cpp,v 1.8.2.7 2007/09/24 11:10:04 t-suwa Exp $ MacOS X implementation of the SKK input method. @@ -1028,7 +1028,7 @@ // ??? ä»?????????? ä»?? // èª???????????è§?»®??????ä»????¹³ä»??????? query.append('-').append(HiraganaInputMode::convert(root)).append(SKK_MSG_DELIMITER); - query.append(candidates[current_candidate_index]); + query.append(candidates[current_candidate_index].encode()); } // é¯??渡ã? Index: AquaSKK/ChangeLog diff -u AquaSKK/ChangeLog:1.33.2.9 AquaSKK/ChangeLog:1.33.2.10 --- AquaSKK/ChangeLog:1.33.2.9 Thu Aug 16 19:58:18 2007 +++ AquaSKK/ChangeLog Mon Sep 24 20:10:04 2007 @@ -1,3 +1,23 @@ +2007-09-22 Tomotaka SUWA + + * KotoeriDictionary.cpp: æ¤?´¢çµ???????ºã??¿ã???? + typeUnicodeText ??µ±ä¸??????³ã??¤ã??????????????¤åŽ»??+ +2007-09-19 Tomotaka SUWA + + * BIMInputEvents.cpp (BIMHandleOffsetToPos): ?»ã??·ã??³ã??³ã????è¦?+ æ±??????¼ã??¼ã??¼ã????æ­¢ã? + + * skkserv.cpp: ?µã????è£??è¦????????示ç????è¦????????ä¿????+ + * SKKDictionary.cpp: ?????????ä¸?????ç´¢ã??¤åŽ»??+ + * KotoeriDictionary.cpp: æ¤?´¢?§ã????ä¸?????ä¿????????æ¤?´¢çµ????+ ????³ã????å¿??????????¿½??? + + * KanjiConversionMode.cpp: ???対象???????³ã??¼ã????????????? + ????¤ã???????????·å???¿®æ­£ã? + 2007-06-15 Tomotaka SUWA * AquaSKK.pbproj/project.pbxproj: Panther ?§ã?????§ã???????ä¿?Index: AquaSKK/BIMInputEvents.cpp diff -u AquaSKK/BIMInputEvents.cpp:1.3 AquaSKK/BIMInputEvents.cpp:1.3.2.1 --- AquaSKK/BIMInputEvents.cpp:1.3 Wed Apr 26 22:36:12 2006 +++ AquaSKK/BIMInputEvents.cpp Mon Sep 24 20:10:04 2007 @@ -1,5 +1,5 @@ /* - $Id: BIMInputEvents.cpp,v 1.3 2006/04/26 13:36:12 t-suwa Exp $ + $Id: BIMInputEvents.cpp,v 1.3.2.1 2007/09/24 11:10:04 t-suwa Exp $ MacOS X implementation of the SKK input method. @@ -228,10 +228,7 @@ // ????????????????B void BIMHandleOffsetToPos(struct OffsetToPosParams *offsetToPosParams) { - BIMHandleOffsetToPos(BIMGetActiveSession(), offsetToPosParams); -} - -void BIMHandleOffsetToPos(BIMSessionHandle inSessionHandle, struct OffsetToPosParams *offsetToPosParams) { + BIMSessionHandle inSessionHandle = BIMGetActiveSession(); OSStatus status; ComponentInstance componentInstance; EventRef event; From t-suwa ¡÷ users.sourceforge.jp Mon Sep 24 21:31:34 2007 From: t-suwa ¡÷ users.sourceforge.jp (t-suwa ¡÷ users.sourceforge.jp) Date: Mon, 24 Sep 2007 21:31:34 +0900 Subject: [aquaskk-changes 397] CVS update: AquaSKK/proj Message-ID: <1190637094.739169.23391.nullmailer@users.sourceforge.jp> Index: AquaSKK/proj/AquaSKKInputMethod-Info.plist diff -u AquaSKK/proj/AquaSKKInputMethod-Info.plist:1.1.2.4 AquaSKK/proj/AquaSKKInputMethod-Info.plist:1.1.2.5 --- AquaSKK/proj/AquaSKKInputMethod-Info.plist:1.1.2.4 Sun Sep 2 12:36:24 2007 +++ AquaSKK/proj/AquaSKKInputMethod-Info.plist Mon Sep 24 21:31:34 2007 @@ -15,11 +15,11 @@ CFBundlePackageType thng CFBundleShortVersionString - brand-new-engine 0.3 + brand-new-engine 0.4 CFBundleSignature askk CFBundleVersion - 2007-09-02 + 2007-09-24 CSResourcesFileMapped yes tsInputMethodIconFileKey Index: AquaSKK/proj/AquaSKKServer-Info.plist diff -u AquaSKK/proj/AquaSKKServer-Info.plist:1.1.2.4 AquaSKK/proj/AquaSKKServer-Info.plist:1.1.2.5 --- AquaSKK/proj/AquaSKKServer-Info.plist:1.1.2.4 Sun Sep 2 12:36:24 2007 +++ AquaSKK/proj/AquaSKKServer-Info.plist Mon Sep 24 21:31:34 2007 @@ -15,11 +15,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - brand-new-engine 0.3 + brand-new-engine 0.4 CFBundleSignature askk CFBundleVersion - 2007-09-02 + 2007-09-24 NSMainNibFile Principal NSPrincipalClass