diff --git a/.gitignore b/.gitignore index 62d72749..f796cba3 100644 --- a/.gitignore +++ b/.gitignore @@ -226,4 +226,5 @@ _ReSharper*/ _TeamCity* _UpgradeReport_Files/ __pycache__/ -~$* \ No newline at end of file +~$* +DataCompiler/dataCompiler.exe diff --git a/DataCompiler/dataCompiler.swift b/DataCompiler/dataCompiler.swift index d79dbd12..f929e557 100644 --- a/DataCompiler/dataCompiler.swift +++ b/DataCompiler/dataCompiler.swift @@ -117,12 +117,12 @@ func cnvPhonabetToASCII(_ incoming: String) -> String { private let urlCurrentFolder = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) private let urlCHSforCustom: String = "./components/chs/phrases-custom-chs.txt" -private let urlCHSforMCBP: String = "./components/chs/phrases-mcbp-chs.txt" +private let urlCHSforTABE: String = "./components/chs/phrases-tabe-chs.txt" private let urlCHSforMOE: String = "./components/chs/phrases-moe-chs.txt" private let urlCHSforVCHEW: String = "./components/chs/phrases-vchewing-chs.txt" private let urlCHTforCustom: String = "./components/cht/phrases-custom-cht.txt" -private let urlCHTforMCBP: String = "./components/cht/phrases-mcbp-cht.txt" +private let urlCHTforTABE: String = "./components/cht/phrases-tabe-cht.txt" private let urlCHTforMOE: String = "./components/cht/phrases-moe-cht.txt" private let urlCHTforVCHEW: String = "./components/cht/phrases-vchewing-cht.txt" @@ -150,7 +150,7 @@ func rawDictForPhrases(isCHS: Bool) -> [Entry] { var arrEntryRAW: [Entry] = [] var strRAW = "" let urlCustom: String = isCHS ? urlCHSforCustom : urlCHTforCustom - let urlMCBP: String = isCHS ? urlCHSforMCBP : urlCHTforMCBP + let urlTABE: String = isCHS ? urlCHSforTABE : urlCHTforTABE let urlMOE: String = isCHS ? urlCHSforMOE : urlCHTforMOE let urlVCHEW: String = isCHS ? urlCHSforVCHEW : urlCHTforVCHEW let i18n: String = isCHS ? "簡體中文" : "繁體中文" @@ -158,7 +158,7 @@ func rawDictForPhrases(isCHS: Bool) -> [Entry] { do { strRAW += try String(contentsOfFile: urlCustom, encoding: .utf8) strRAW += "\n" - strRAW += try String(contentsOfFile: urlMCBP, encoding: .utf8) + strRAW += try String(contentsOfFile: urlTABE, encoding: .utf8) strRAW += "\n" strRAW += try String(contentsOfFile: urlMOE, encoding: .utf8) strRAW += "\n" diff --git a/Packages/SwiftyOpenCC/OpenCC/src/DartsDict.cpp b/Packages/SwiftyOpenCC/OpenCC/src/DartsDict.cpp index 888bcc01..70bc63d3 100644 --- a/Packages/SwiftyOpenCC/OpenCC/src/DartsDict.cpp +++ b/Packages/SwiftyOpenCC/OpenCC/src/DartsDict.cpp @@ -18,6 +18,7 @@ #include #include +#include #include "BinaryDict.hpp" #include "DartsDict.hpp" diff --git a/Packages/SwiftyOpenCC/OpenCC/src/DictConverter.cpp b/Packages/SwiftyOpenCC/OpenCC/src/DictConverter.cpp index 0271c74e..76a7d1ae 100644 --- a/Packages/SwiftyOpenCC/OpenCC/src/DictConverter.cpp +++ b/Packages/SwiftyOpenCC/OpenCC/src/DictConverter.cpp @@ -16,6 +16,7 @@ * limitations under the License. */ +#include #include "DictConverter.hpp" #include "MarisaDict.hpp" #include "TextDict.hpp" diff --git a/README-CHT.md b/README-CHT.md index efb29760..72f03733 100644 --- a/README-CHT.md +++ b/README-CHT.md @@ -28,36 +28,36 @@ >- 可以自動整理使用者語彙檔案格式、自訂聯想詞。 >- …… -威注音分支專案及威注音詞庫由孫志貴(Shiki Suen)維護。小麥注音官方原始倉庫內的詞庫的內容均與孫志貴無關。 +威注音分支專案及威注音詞庫由孫志貴(Shiki Suen)維護,其內容屬於可在 Gitee 公開展示的合法內容。小麥注音官方原始倉庫內的詞庫的內容均與孫志貴無關。 ## 系統需求 -建置用系統需求:至少 macOS 10.15 Catalina & Xcode 12。// 原因:Swift 封包管理支援所需。 +建置用系統需求: + +- 至少 macOS 11 Big Sur & Xcode 13。 + - 原因:Swift 封包管理支援與 Swift 5.5 所需。 + - 我們已經沒有條件測試 macOS 10.15 Catalina & Xcode 12 環境了。硬要在這個環境下編譯的話,可能需要額外安裝[新版 Swift](https://www.swift.org/download/) 才可以。 +- 請使用正式發行版 Xcode,且最小子版本號越高越好(因為 Bug 相對而言最少)。 + - 如果是某個大版本的 Xcode 的 Release Candidate 版本的話,我們可能會對此做相容性測試。 編譯出的成品對應系統需求: - 至少 macOS El Capitan 10.11.5,否則無法處理 Unicode 8.0 的漢字。即便如此,仍需手動升級蘋方至至少 macOS 10.12 開始隨贈的版本、以支援 Unicode 8.0 的通用規範漢字表用字(全字庫沒有「𫫇」字)。 - - - 保留該系統支援的原因:非 Unibody 體型的 MacBook Pro 支援的最後一版 macOS 就是 El Capitan。 + - 保留該系統支援的原因:非 Unibody 機種的 MacBook Pro 支援的最後一版 macOS 就是 El Capitan。 - **推薦最低系統版本**:macOS 10.12 Sierra,對 Unicode 8.0 開始的《通用規範漢字表》漢字有原生的蘋方支援。 - - 同時建議**系統記憶體應至少 4GB**。威注音輸入法佔用記憶體約 115MB 左右(簡繁雙模式)、75MB左右(單模式),供參考。 - - - 請務必使用 SSD 硬碟,否則可能會影響每次開機之後輸入法首次載入的速度。從 10.10 Yosemite 開始,macOS 就已經是針對機械硬碟負優化的作業系統了。 - + - 同時建議**系統記憶體應至少 4GB**。威注音輸入法佔用記憶體約 115MB 左右(簡繁雙模式)、75MB左右(單模式),供參考。 + - 請務必使用 SSD 硬碟,否則可能會影響每次開機之後輸入法首次載入的速度。從 10.10 Yosemite 開始,macOS 就已經是針對機械硬碟負優化的作業系統了。 - 注:能裝 macOS 10.13 High Sierra 就不要去碰 macOS 10.12 Sierra 這個半成品。 - 關於全字庫支援,因下述事實而在理論上很難做到最完美: - - 很可惜 GB18030-2005 並沒有官方提供的逐字讀音對照表,所以目前才用了全字庫。然而全字庫並不等於完美。 - - - 有條件者可以安裝全字庫字型與花園明朝,否則全字庫等高萬國碼碼位漢字恐無法在輸入法的選字窗內完整顯示。 - + - 很可惜 GB18030-2005 並沒有官方提供的逐字讀音對照表,所以目前才用了全字庫。然而全字庫並不等於完美。 + - 有條件者可以安裝全字庫字型與花園明朝,否則全字庫等高萬國碼碼位漢字恐無法在輸入法的選字窗內完整顯示。 - 全字庫漢字顯示支援會受到具體系統版本對萬國碼版本的支援的限制。 - - 有些全字庫漢字一開始會依賴萬國碼的私人造字區,且在之後被新版本萬國碼所支援。 - + ## 建置流程 安裝 Xcode 之後,請先配置 Xcode 允許其直接構建在專案所在的資料夾下的 build 資料夾內。步驟: @@ -83,30 +83,37 @@ 威注音專案僅用到小麥注音的下述程式組件(MIT License): - 狀態管理引擎 & NSStringUtils & FSEventStreamHelper (by Zonble Yang)。 - - 半衰記憶模組,因故障暫時無法啟用 (by Mengjuei Hsieh)。 - - 僅供研發人員調試方便而使用的 App 版安裝程式 (by Zonble Yang)。 - - Voltaire MK2 選字窗、飄雲通知視窗、工具提示 (by Zonble Yang),有大幅度修改。 威注音輸入法 macOS 版以 MIT-NTL License 授權釋出 (與 MIT 相容):© 2021-2022 vChewing 專案。 - 威注音輸入法 macOS 版程式維護:Shiki Suen。特別感謝 Isaac Xen 與 Hiraku Wong 等人的技術協力。 - - 鐵恨注音並擊處理引擎:Shiki Suen (MIT-NTL License)。 - - 天權星語彙處理引擎:Shiki Suen (MIT-NTL License)。 - - 威注音詞庫由 Shiki Suen 維護,以 3-Clause BSD License 授權釋出。其中的詞頻數據[由 NAER 授權用於非商業用途](https://twitter.com/ShikiSuen/status/1479329302713831424)。 使用者可自由使用、散播本軟體,惟散播時必須完整保留版權聲明及軟體授權、且一旦經過修改便不可以再繼續使用威注音的產品名稱。 -## 格式規範等與參與研發時需要注意的事項: +## 資料來源 -該專案對源碼格式有規範,且 Swift 與其他 (Obj)C(++) 系語言持不同規範: +原廠詞庫主要詞語資料來源: -請洽該倉庫內的「[CONTRIBUTING.md](./CONTRIBUTING.md)」檔案。 +- 《重編國語辭典修訂本 2015》的六字以內的詞語資料 (CC BY-ND 3.0)。 +- 《CNS11643中文標準交換碼全字庫(簡稱全字庫)》 (OGDv1 License)。 +- LibTaBE (by Pai-Hsiang Hsiao under 3-Clause BSD License)。 +- [《新加坡華語資料庫》](https://www.languagecouncils.sg/mandarin/ch/learning-resources/singaporean-mandarin-database)。 +- 原始詞頻資料取自 NAER,有經過換算處理與按需調整。 + - 威注音並未使用由 LibTaBE 內建的來自 Sinica 語料庫的詞頻資料。 +- 威注音語彙庫作者自行維護新增的詞語資料,包括: + - 盡可能所有字詞的陸規審音與齊鐵恨廣播讀音。 + - 中國大陸常用資訊電子術語等常用語,以確保簡體中文母語者在使用輸入法時不會受到審音差異的困擾。 +- 其他使用者建議收錄的資料。 + +## 格式規範等與參與研發時需要注意的事項 + +該專案對源碼格式有規範,且 Swift 與其他 (Obj)C(++) 系語言持不同規範。請洽該倉庫內的「[CONTRIBUTING.md](./CONTRIBUTING.md)」檔案。 ## 其他 diff --git a/README.md b/README.md index 04f8d364..9b689ee2 100644 --- a/README.md +++ b/README.md @@ -5,11 +5,11 @@ 因不可控原因,该仓库只能保证在 Gitee 有最新的内容可用: - 下载:https://gitee.com/vchewing/vChewing-macOS/releases -- 代码仓库:https://gitee.com/vchewing/vChewing-macOS +- 源码仓库:https://gitee.com/vchewing/vChewing-macOS # vChewing 威注音输入法 -威注音输入法基于小麦注音二次开发,是**原生简体中文/繁体中文注音输入法**: +威注音输入法基于小麦注音二次开发,是**原生简体中文、原生繁体中文注音输入法**: - 威注音是业界现阶段支持注音排列种类数量与输入用拼音种类数量最多的注音输入法。 - 受威注音自家的铁恨注音并击引擎加持。 @@ -17,96 +17,103 @@ - 相比中州韵(鼠须管)而言,威注音能够做到真正的大千声韵并击。 - 拥有拼音并击模式,不懂注音的人群也可以受益于该输入法所带来的稳定的平均输入速度。 - 相比小鹤双拼等双拼方案而言,威注音双手声韵分工明确、且重码率只有双拼的五分之一。 -- 威注音对陆规审音完全兼容:不熟悉台澎金马审音的大陆用户不会遇到与汉字读音有关的不便。 +- 威注音对陆规审音完全相容:不熟悉台澎金马审音的大陆用户不会遇到与汉字读音有关的不便。 - 反之亦然。 ->威注音有很多特色功能。在此仅枚举部分: ->- 支持 macOS 屏幕仿真键盘(仅传统大千与传统倚天布局)。 ->- 可以将自己打的繁体中文自动转成日本 JIS 新字体来输出(包括基础的字词转换),也可以转成康熙繁体来输出。 +>威注音有很多特色功能。在此仅列举部分: +>- 支持 macOS 屏幕模拟键盘(仅传统大千与传统倚天布局)。 +>- 可以将自己打的繁体中文自动转成日本 JIS 新字体来输出(包括基础的字词转换)、也可以转成康熙繁体来输出。 >- 简繁体中文语料库彼此分离,彻底杜绝任何繁简转换过程可能造成的失误。 >- 支持近年的全字库汉字输入。 ->- 可以自动整理用户语汇文档格式、自订联想词。 +>- 可以自动整理使用者语汇档案格式、自订联想词。 >- …… -威注音分支专案及威注音词库由孙志贵(Shiki Suen)维护。小麦注音官方原始仓库内的词库的内容均与孙志贵无关。 +威注音分支专案及威注音词库由孙志贵(Shiki Suen)维护,其内容属于可在 Gitee 公开展示的合法内容。小麦注音官方原始仓库内的词库的内容均与孙志贵无关。 ## 系统需求 -建置用系统需求:至少 macOS 10.15 Catalina & Xcode 12。// 原因:Swift 包管理器支持所需。 +编译用系统需求: + +- 至少 macOS 11 Big Sur & Xcode 13。 + - 原因:Swift 封包管理支持与 Swift 5.5 所需。 + - 我们已经没有条件测试 macOS 10.15 Catalina & Xcode 12 环境了。硬要在这个环境下编译的话,可能需要额外安装[新版 Swift](https://www.swift.org/download/) 才可以。 +- 请使用正式发行版 Xcode,且最小子版本号越高越好(因为 Bug 相对而言最少)。 + - 如果是某个大版本的 Xcode 的 Release Candidate 版本的话,我们可能会对此做相容性测试。 编译出的成品对应系统需求: -- 至少 macOS El Capitan 10.11.5,否则无法处理 Unicode 8.0 的汉字。即便如此,仍需手动升级苹方至至少 macOS 10.12 开始随附的版本、以支持 Unicode 8.0 的通用规范汉字表用字(全字库没有「𫫇」字)。 - - - 保留该系统支持的原因:非 Unibody 体型的 MacBook Pro 支持的最后一版 macOS 就是 El Capitan。 +- 至少 macOS El Capitan 10.11.5,否则无法处理 Unicode 8.0 的汉字。即便如此,仍需手动升级苹方至至少 macOS 10.12 开始随赠的版本、以支持 Unicode 8.0 的通用规范汉字表用字(全字库没有「𫫇」字)。 + - 保留该系统支持的原因:非 Unibody 机种的 MacBook Pro 支持的最后一版 macOS 就是 El Capitan。 - **推荐最低系统版本**:macOS 10.12 Sierra,对 Unicode 8.0 开始的《通用规范汉字表》汉字有原生的苹方支持。 - - 同时建议**系统运存应至少 4GB**。威注音输入法占用运存约 115MB 左右(简繁双模式)、75MB左右(单模式),供参考。 - - - 请务必使用 SSD 硬盘,否则可能会影响每次开机之后输入法首次加载的速度。从 10.10 Yosemite 开始,macOS 就已经是针对机械硬盘负优化的操作系统了。 - + - 同时建议**系统运存应至少 4GB**。威注音输入法占用运存约 115MB 左右(简繁双模式)、75MB左右(单模式),供参考。 + - 请务必使用 SSD 硬盘,否则可能会影响每次开机之后输入法首次载入的速度。从 10.10 Yosemite 开始,macOS 就已经是针对机械硬盘负优化的操作系统了。 - 注:能装 macOS 10.13 High Sierra 就不要去碰 macOS 10.12 Sierra 这个半成品。 - 关于全字库支持,因下述事实而在理论上很难做到最完美: - - 很可惜 GB18030-2005 并没有官方提供的逐字读音对照表,所以目前才用了全字库。然而全字库并不等于完美。 - - - 有条件者可以安装全字库字体与花园明朝,否则全字库等高万国码码位汉字可能无法在输入法的选字窗内完整显示。 - + - 很可惜 GB18030-2005 并没有官方提供的逐字读音对照表,所以目前才用了全字库。然而全字库并不等于完美。 + - 有条件者可以安装全字库字型与花园明朝,否则全字库等高万国码码位汉字恐无法在输入法的选字窗内完整显示。 - 全字库汉字显示支持会受到具体系统版本对万国码版本的支持的限制。 - - 有些全字库汉字一开始会依赖万国码的私人造字区,且在之后被新版本万国码所支持。 - -## 建置流程 -安装 Xcode 之后,请先配置 Xcode 允许其直接构建在专案所在的文档夹下的 build 文档夹内。步骤: +## 编译流程 + +安装 Xcode 之后,请先配置 Xcode 允许其直接构建在专案所在的资料夹下的 build 资料夹内。步骤: ``` 「Xcode」->「Preferences...」->「Locations」; 「File」->「Project/WorkspaceSettings...」->「Advanced」; -选「Custom」->「Relative to Workspace」即可。否则,make 的过程会出错。 +选「Custom」->「Relative to Workspace」即可。不选的话,make 的过程会出错。 ``` -在终端机内定位到威注音的克隆本地专案的本地仓库的目录之后,运行 `make update` 以获取最新词库。 +在终端机内定位到威注音的克隆本地专案的本地仓库的目录之后,执行 `make update` 以获取最新词库。 接下来就是直接开 Xcode 专案,Product -> Scheme 选「vChewingInstaller」,编译即可。 -> 之前说「在成功之后运行 `make` 即可组建、再运行 `make install` 可以触发威注音的安装程序」,这对新版威注音而言**当且仅当**使用纯 Swift 编译脚本工序时方可使用。目前的 libvchewing-data 模块已经针对 macOS 版威注音实装了纯 Swift 词库编译脚本。 +> 之前说「在成功之后执行 `make` 即可编译、再执行 `make install` 可以触发威注音的安装程式」,这对新版威注音而言**当且仅当**使用纯 Swift 编译脚本工序时方可使用。目前的 libvchewing-data 模组已经针对 macOS 版威注音实装了纯 Swift 词库编译脚本。 -第一次安装完,日后代码或词库有任何修改,只要重复上述流程,再次安装威注音即可。 +第一次安装完,日后源码或词库有任何修改,只要重覆上述流程,再次安装威注音即可。 -要注意的是 macOS 可能会限制同一次 login session 能终结同一个输入法的进程的次数(安装程序通过 kill input method process 来让新版的输入法生效)。如果安装若干次后,发现程序修改的结果并没有出现、或甚至输入法已无法再选用,只需要登出目前的 macOS 系统帐号、再重新登入即可。 +要注意的是 macOS 可能会限制同一次 login session 能终结同一个输入法的执行进程的次数(安装程式透过 kill input method process 来让新版的输入法生效)。如果安装若干次后,发现程式修改的结果并没有出现、或甚至输入法已无法再选用,只需要登出目前的 macOS 系统帐号、再重新登入即可。 -补记: 该输入法是在 2021 年 11 月初「28ae7deb4092f067539cff600397292e66a5dd56」这一版小麦注音建置的基础上完成的。因为在清洗词库的时候清洗了全部的 git commit 历史,所以无法自动从小麦注音官方仓库上游继承任何改动,只能手动同步任何在此之后的程序修正。最近一次同步参照是上游主仓库的 2.2.2 版、以及 zonble 的分支「5cb6819e132a02bbcba77dbf083ada418750dab7」。 +补记: 该输入法是在 2021 年 11 月初「28ae7deb4092f067539cff600397292e66a5dd56」这一版小麦注音编译的基础上完成的。因为在清洗词库的时候清洗了全部的 git commit 历史,所以无法自动从小麦注音官方仓库上游继承任何改动,只能手动同步任何在此之后的程式修正。最近一次同步参照是上游主仓库的 2.2.2 版、以及 zonble 的分支「5cb6819e132a02bbcba77dbf083ada418750dab7」。 ## 应用授权 -威注音专案仅用到小麦注音的下述程序组件(MIT License): +威注音专案仅用到小麦注音的下述程式组件(MIT License): - 状态管理引擎 & NSStringUtils & FSEventStreamHelper (by Zonble Yang)。 +- 半衰记忆模组,因故障暂时无法启用 (by Mengjuei Hsieh)。 +- 仅供研发人员调试方便而使用的 App 版安装程式 (by Zonble Yang)。 +- Voltaire MK2 选字窗、飘云通知视窗、工具提示 (by Zonble Yang),有大幅度修改。 -- 半衰记忆模块,因故障暂时无法激活 (by Mengjuei Hsieh)。 - -- 仅供研发人员调试方便而使用的 App 版安装程序 (by Zonble Yang)。 - -- Voltaire MK2 选字窗、飘云通知窗口、工具提示 (by Zonble Yang),有大幅度修改。 - -威注音输入法 macOS 版以 MIT-NTL License 授权发布 (与 MIT 兼容):© 2021-2022 vChewing 专案。 - -- 威注音输入法 macOS 版程序维护:Shiki Suen。特别感谢 Isaac Xen 与 Hiraku Wong 等人的技术协力。 +威注音输入法 macOS 版以 MIT-NTL License 授权释出 (与 MIT 相容):© 2021-2022 vChewing 专案。 +- 威注音输入法 macOS 版程式维护:Shiki Suen。特别感谢 Isaac Xen 与 Hiraku Wong 等人的技术协力。 - 铁恨注音并击处理引擎:Shiki Suen (MIT-NTL License)。 - - 天权星语汇处理引擎:Shiki Suen (MIT-NTL License)。 +- 威注音词库由 Shiki Suen 维护,以 3-Clause BSD License 授权释出。其中的词频数据[由 NAER 授权用于非商业用途](https://twitter.com/ShikiSuen/status/1479329302713831424)。 -- 威注音词库由 Shiki Suen 维护,以 3-Clause BSD License 授权发布。其中的词频数据[由 NAER 授权用于非商业用途](https://twitter.com/ShikiSuen/status/1479329302713831424)。 +使用者可自由使用、散播本软件,惟散播时必须完整保留版权声明及软件授权、且一旦经过修改便不可以再继续使用威注音的产品名称。 -用户可自由使用、散播本软件,惟散播时必须完整保留版权声明及软件授权、且一旦经过修改便不可以再继续使用威注音的产品名称。 +## 资料来源 + +原厂词库主要词语资料来源: + +- 《重编国语辞典修订本 2015》的六字以内的词语资料 (CC BY-ND 3.0)。 +- 《CNS11643中文标准交换码全字库(简称全字库)》 (OGDv1 License)。 +- LibTaBE (by Pai-Hsiang Hsiao under 3-Clause BSD License)。 +- [《新加坡华语资料库》](https://www.languagecouncils.sg/mandarin/ch/learning-resources/singaporean-mandarin-database)。 +- 原始词频资料取自 NAER,有经过换算处理与按需调整。 + - 威注音并未使用由 LibTaBE 内建的来自 Sinica 语料库的词频资料。 +- 威注音语汇库作者自行维护新增的词语资料,包括: + - 尽可能所有字词的陆规审音与齐铁恨广播读音。 + - 中国大陆常用资讯电子术语等常用语,以确保简体中文母语者在使用输入法时不会受到审音差异的困扰。 +- 其他使用者建议收录的资料。 ## 格式规范等与参与研发时需要注意的事项 -该专案对源码格式有规范,且 Swift 与其他 (Obj)C(++) 系语言持不同规范: - -请查看该仓库内的「[CONTRIBUTING.md](./CONTRIBUTING.md)」文档。 +该专案对源码格式有规范,且 Swift 与其他 (Obj)C(++) 系语言持不同规范。请洽该仓库内的「[CONTRIBUTING.md](./CONTRIBUTING.md)」档案。 ## 其他 diff --git a/Source/Data b/Source/Data index 01adac46..3fa3e5f4 160000 --- a/Source/Data +++ b/Source/Data @@ -1 +1 @@ -Subproject commit 01adac46a15ab0bf907ca1bd362bdd1082e79c4e +Subproject commit 3fa3e5f4e06de2710ed7ba641a4bf4a8843f1cf8 diff --git a/Source/Modules/ControllerModules/KeyHandler_HandleCandidate.swift b/Source/Modules/ControllerModules/KeyHandler_HandleCandidate.swift index a770892c..a57d3bc3 100644 --- a/Source/Modules/ControllerModules/KeyHandler_HandleCandidate.swift +++ b/Source/Modules/ControllerModules/KeyHandler_HandleCandidate.swift @@ -37,341 +37,345 @@ extension KeyHandler { ) -> Bool { let inputText = input.inputText let charCode: UniChar = input.charCode - if let ctlCandidateCurrent = delegate?.ctlCandidate() { - // MARK: Cancel Candidate + guard let ctlCandidateCurrent = delegate?.ctlCandidate() else { + IME.prtDebugIntel("06661F6E") + errorCallback() + return true + } - let cancelCandidateKey = - input.isBackSpace || input.isESC || input.isDelete - || ((input.isCursorBackward || input.isCursorForward) && input.isShiftHold) + // MARK: Cancel Candidate - if cancelCandidateKey { - if (state is InputState.AssociatedPhrases) - || mgrPrefs.useSCPCTypingMode - || isBuilderEmpty - { - // 如果此時發現當前組字緩衝區為真空的情況的話, - // 就將當前的組字緩衝區析構處理、強制重設輸入狀態。 - // 否則,一個本不該出現的真空組字緩衝區會使前後方向鍵與 BackSpace 鍵失靈。 - // 所以這裡需要對 isBuilderEmpty 做判定。 - clear() - stateCallback(InputState.EmptyIgnoringPreviousState()) - } else { - stateCallback(buildInputtingState) - } + let cancelCandidateKey = + input.isBackSpace || input.isESC || input.isDelete + || ((input.isCursorBackward || input.isCursorForward) && input.isShiftHold) + + if cancelCandidateKey { + if (state is InputState.AssociatedPhrases) + || mgrPrefs.useSCPCTypingMode + || isBuilderEmpty + { + // 如果此時發現當前組字緩衝區為真空的情況的話, + // 就將當前的組字緩衝區析構處理、強制重設輸入狀態。 + // 否則,一個本不該出現的真空組字緩衝區會使前後方向鍵與 BackSpace 鍵失靈。 + // 所以這裡需要對 isBuilderEmpty 做判定。 + clear() + stateCallback(InputState.EmptyIgnoringPreviousState()) + } else { + stateCallback(buildInputtingState) + } + return true + } + + // MARK: Enter + + if input.isEnter { + if state is InputState.AssociatedPhrases { + clear() + stateCallback(InputState.EmptyIgnoringPreviousState()) return true } + delegate!.keyHandler( + self, + didSelectCandidateAt: ctlCandidateCurrent.selectedCandidateIndex, + ctlCandidate: ctlCandidateCurrent + ) + return true + } - // MARK: Enter + // MARK: Tab - if input.isEnter { - if state is InputState.AssociatedPhrases { - clear() - stateCallback(InputState.EmptyIgnoringPreviousState()) - return true + if input.isTab { + let updated: Bool = + mgrPrefs.specifyShiftTabKeyBehavior + ? (input.isShiftHold + ? ctlCandidateCurrent.showPreviousPage() + : ctlCandidateCurrent.showNextPage()) + : (input.isShiftHold + ? ctlCandidateCurrent.highlightPreviousCandidate() + : ctlCandidateCurrent.highlightNextCandidate()) + if !updated { + IME.prtDebugIntel("9B691919") + errorCallback() + } + return true + } + + // MARK: Space + + if input.isSpace { + let updated: Bool = + mgrPrefs.specifyShiftSpaceKeyBehavior + ? (input.isShiftHold + ? ctlCandidateCurrent.highlightNextCandidate() + : ctlCandidateCurrent.showNextPage()) + : (input.isShiftHold + ? ctlCandidateCurrent.showNextPage() + : ctlCandidateCurrent.highlightNextCandidate()) + if !updated { + IME.prtDebugIntel("A11C781F") + errorCallback() + } + return true + } + + // MARK: PgDn + + if input.isPageDown || input.emacsKey == vChewingEmacsKey.nextPage { + let updated: Bool = ctlCandidateCurrent.showNextPage() + if !updated { + IME.prtDebugIntel("9B691919") + errorCallback() + } + return true + } + + // MARK: PgUp + + if input.isPageUp { + let updated: Bool = ctlCandidateCurrent.showPreviousPage() + if !updated { + IME.prtDebugIntel("9569955D") + errorCallback() + } + return true + } + + // MARK: Left Arrow + + if input.isLeft { + switch ctlCandidateCurrent.currentLayout { + case .horizontal: + do { + if !ctlCandidateCurrent.highlightPreviousCandidate() { + IME.prtDebugIntel("1145148D") + errorCallback() + } + } + case .vertical: + do { + if !ctlCandidateCurrent.showPreviousPage() { + IME.prtDebugIntel("1919810D") + errorCallback() + } + } + } + return true + } + + // MARK: EmacsKey Backward + + if input.emacsKey == vChewingEmacsKey.backward { + let updated: Bool = ctlCandidateCurrent.highlightPreviousCandidate() + if !updated { + IME.prtDebugIntel("9B89308D") + errorCallback() + } + return true + } + + // MARK: Right Arrow + + if input.isRight { + switch ctlCandidateCurrent.currentLayout { + case .horizontal: + do { + if !ctlCandidateCurrent.highlightNextCandidate() { + IME.prtDebugIntel("9B65138D") + errorCallback() + } + } + case .vertical: + do { + if !ctlCandidateCurrent.showNextPage() { + IME.prtDebugIntel("9244908D") + errorCallback() + } + } + } + return true + } + + // MARK: EmacsKey Forward + + if input.emacsKey == vChewingEmacsKey.forward { + let updated: Bool = ctlCandidateCurrent.highlightNextCandidate() + if !updated { + IME.prtDebugIntel("9B2428D") + errorCallback() + } + return true + } + + // MARK: Up Arrow + + if input.isUp { + switch ctlCandidateCurrent.currentLayout { + case .horizontal: + do { + if !ctlCandidateCurrent.showPreviousPage() { + IME.prtDebugIntel("9B614524") + errorCallback() + } + } + case .vertical: + do { + if !ctlCandidateCurrent.highlightPreviousCandidate() { + IME.prtDebugIntel("ASD9908D") + errorCallback() + } + } + } + return true + } + + // MARK: Down Arrow + + if input.isDown { + switch ctlCandidateCurrent.currentLayout { + case .horizontal: + do { + if !ctlCandidateCurrent.showNextPage() { + IME.prtDebugIntel("92B990DD") + errorCallback() + } + } + case .vertical: + do { + if !ctlCandidateCurrent.highlightNextCandidate() { + IME.prtDebugIntel("6B99908D") + errorCallback() + } + } + } + return true + } + + // MARK: Home Key + + if input.isHome || input.emacsKey == vChewingEmacsKey.home { + if ctlCandidateCurrent.selectedCandidateIndex == 0 { + IME.prtDebugIntel("9B6EDE8D") + errorCallback() + } else { + ctlCandidateCurrent.selectedCandidateIndex = 0 + } + + return true + } + + // MARK: End Key + + var candidates: [String]! + + if let state = state as? InputState.ChoosingCandidate { + candidates = state.candidates + } else if let state = state as? InputState.AssociatedPhrases { + candidates = state.candidates + } + + if candidates.isEmpty { + return false + } else { // 這裡不用「count > 0」,因為該整數變數只要「!isEmpty」那就必定滿足這個條件。 + if input.isEnd || input.emacsKey == vChewingEmacsKey.end { + if ctlCandidateCurrent.selectedCandidateIndex == candidates.count - 1 { + IME.prtDebugIntel("9B69AAAD") + errorCallback() + } else { + ctlCandidateCurrent.selectedCandidateIndex = candidates.count - 1 } + } + } + + // MARK: - Associated Phrases + + if state is InputState.AssociatedPhrases { + if !input.isShiftHold { return false } + } + + var index: Int = NSNotFound + var match: String! + if state is InputState.AssociatedPhrases { + match = input.inputTextIgnoringModifiers + } else { + match = inputText + } + + var j = 0 + while j < ctlCandidateCurrent.keyLabels.count { + let label: CandidateKeyLabel = ctlCandidateCurrent.keyLabels[j] + if match.compare(label.key, options: .caseInsensitive, range: nil, locale: .current) == .orderedSame { + index = j + break + } + j += 1 + } + + if index != NSNotFound { + let candidateIndex = ctlCandidateCurrent.candidateIndexAtKeyLabelIndex(index) + if candidateIndex != Int.max { delegate!.keyHandler( - self, - didSelectCandidateAt: ctlCandidateCurrent.selectedCandidateIndex, - ctlCandidate: ctlCandidateCurrent + self, didSelectCandidateAt: candidateIndex, ctlCandidate: ctlCandidateCurrent ) return true } + } - // MARK: Tab + if state is InputState.AssociatedPhrases { return false } - if input.isTab { - let updated: Bool = - mgrPrefs.specifyShiftTabKeyBehavior - ? (input.isShiftHold - ? ctlCandidateCurrent.showPreviousPage() - : ctlCandidateCurrent.showNextPage()) - : (input.isShiftHold - ? ctlCandidateCurrent.highlightPreviousCandidate() - : ctlCandidateCurrent.highlightNextCandidate()) - if !updated { - IME.prtDebugIntel("9B691919") - errorCallback() - } - return true - } + // MARK: SCPC Mode Processing - // MARK: Space + if mgrPrefs.useSCPCTypingMode { + var punctuationNamePrefix = "" - if input.isSpace { - let updated: Bool = - mgrPrefs.specifyShiftSpaceKeyBehavior - ? (input.isShiftHold - ? ctlCandidateCurrent.highlightNextCandidate() - : ctlCandidateCurrent.showNextPage()) - : (input.isShiftHold - ? ctlCandidateCurrent.showNextPage() - : ctlCandidateCurrent.highlightNextCandidate()) - if !updated { - IME.prtDebugIntel("A11C781F") - errorCallback() - } - return true - } - - // MARK: PgDn - - if input.isPageDown || input.emacsKey == vChewingEmacsKey.nextPage { - let updated: Bool = ctlCandidateCurrent.showNextPage() - if !updated { - IME.prtDebugIntel("9B691919") - errorCallback() - } - return true - } - - // MARK: PgUp - - if input.isPageUp { - let updated: Bool = ctlCandidateCurrent.showPreviousPage() - if !updated { - IME.prtDebugIntel("9569955D") - errorCallback() - } - return true - } - - // MARK: Left Arrow - - if input.isLeft { - switch ctlCandidateCurrent.currentLayout { - case .horizontal: - do { - if !ctlCandidateCurrent.highlightPreviousCandidate() { - IME.prtDebugIntel("1145148D") - errorCallback() - } - } - case .vertical: - do { - if !ctlCandidateCurrent.showPreviousPage() { - IME.prtDebugIntel("1919810D") - errorCallback() - } - } - } - return true - } - - // MARK: EmacsKey Backward - - if input.emacsKey == vChewingEmacsKey.backward { - let updated: Bool = ctlCandidateCurrent.highlightPreviousCandidate() - if !updated { - IME.prtDebugIntel("9B89308D") - errorCallback() - } - return true - } - - // MARK: Right Arrow - - if input.isRight { - switch ctlCandidateCurrent.currentLayout { - case .horizontal: - do { - if !ctlCandidateCurrent.highlightNextCandidate() { - IME.prtDebugIntel("9B65138D") - errorCallback() - } - } - case .vertical: - do { - if !ctlCandidateCurrent.showNextPage() { - IME.prtDebugIntel("9244908D") - errorCallback() - } - } - } - return true - } - - // MARK: EmacsKey Forward - - if input.emacsKey == vChewingEmacsKey.forward { - let updated: Bool = ctlCandidateCurrent.highlightNextCandidate() - if !updated { - IME.prtDebugIntel("9B2428D") - errorCallback() - } - return true - } - - // MARK: Up Arrow - - if input.isUp { - switch ctlCandidateCurrent.currentLayout { - case .horizontal: - do { - if !ctlCandidateCurrent.showPreviousPage() { - IME.prtDebugIntel("9B614524") - errorCallback() - } - } - case .vertical: - do { - if !ctlCandidateCurrent.highlightPreviousCandidate() { - IME.prtDebugIntel("ASD9908D") - errorCallback() - } - } - } - return true - } - - // MARK: Down Arrow - - if input.isDown { - switch ctlCandidateCurrent.currentLayout { - case .horizontal: - do { - if !ctlCandidateCurrent.showNextPage() { - IME.prtDebugIntel("92B990DD") - errorCallback() - } - } - case .vertical: - do { - if !ctlCandidateCurrent.highlightNextCandidate() { - IME.prtDebugIntel("6B99908D") - errorCallback() - } - } - } - return true - } - - // MARK: Home Key - - if input.isHome || input.emacsKey == vChewingEmacsKey.home { - if ctlCandidateCurrent.selectedCandidateIndex == 0 { - IME.prtDebugIntel("9B6EDE8D") - errorCallback() - } else { - ctlCandidateCurrent.selectedCandidateIndex = 0 - } - - return true - } - - // MARK: End Key - - var candidates: [String]! - - if let state = state as? InputState.ChoosingCandidate { - candidates = state.candidates - } else if let state = state as? InputState.AssociatedPhrases { - candidates = state.candidates - } - - if candidates.isEmpty { - return false - } else { // 這裡不用「count > 0」,因為該整數變數只要「!isEmpty」那就必定滿足這個條件。 - if input.isEnd || input.emacsKey == vChewingEmacsKey.end { - if ctlCandidateCurrent.selectedCandidateIndex == candidates.count - 1 { - IME.prtDebugIntel("9B69AAAD") - errorCallback() - } else { - ctlCandidateCurrent.selectedCandidateIndex = candidates.count - 1 - } - } - } - - // MARK: - Associated Phrases - - if state is InputState.AssociatedPhrases { - if !input.isShiftHold { return false } - } - - var index: Int = NSNotFound - var match: String! - if state is InputState.AssociatedPhrases { - match = input.inputTextIgnoringModifiers + if input.isOptionHold && !input.isControlHold { + punctuationNamePrefix = "_alt_punctuation_" + } else if input.isControlHold && !input.isOptionHold { + punctuationNamePrefix = "_ctrl_punctuation_" + } else if input.isControlHold && input.isOptionHold { + punctuationNamePrefix = "_alt_ctrl_punctuation_" + } else if mgrPrefs.halfWidthPunctuationEnabled { + punctuationNamePrefix = "_half_punctuation_" } else { - match = inputText + punctuationNamePrefix = "_punctuation_" } - var j = 0 - while j < ctlCandidateCurrent.keyLabels.count { - let label: CandidateKeyLabel = ctlCandidateCurrent.keyLabels[j] - if match.compare(label.key, options: .caseInsensitive, range: nil, locale: .current) == .orderedSame { - index = j - break - } - j += 1 + let parser = currentMandarinParser + + let arrCustomPunctuations: [String] = [ + punctuationNamePrefix, parser, String(format: "%c", CChar(charCode)), + ] + let customPunctuation: String = arrCustomPunctuations.joined(separator: "") + + let arrPunctuations: [String] = [punctuationNamePrefix, String(format: "%c", CChar(charCode))] + let punctuation: String = arrPunctuations.joined(separator: "") + + var shouldAutoSelectCandidate: Bool = + _composer.inputValidityCheck(key: charCode) || ifLangModelHasUnigrams(forKey: customPunctuation) + || ifLangModelHasUnigrams(forKey: punctuation) + + if !shouldAutoSelectCandidate, input.isUpperCaseASCIILetterKey { + let letter: String! = String(format: "%@%c", "_letter_", CChar(charCode)) + if ifLangModelHasUnigrams(forKey: letter) { shouldAutoSelectCandidate = true } } - if index != NSNotFound { - let candidateIndex = ctlCandidateCurrent.candidateIndexAtKeyLabelIndex(index) + if shouldAutoSelectCandidate { + let candidateIndex = ctlCandidateCurrent.candidateIndexAtKeyLabelIndex(0) if candidateIndex != Int.max { delegate!.keyHandler( - self, didSelectCandidateAt: candidateIndex, ctlCandidate: ctlCandidateCurrent + self, + didSelectCandidateAt: candidateIndex, + ctlCandidate: ctlCandidateCurrent + ) + clear() + let empty = InputState.EmptyIgnoringPreviousState() + stateCallback(empty) + return handle( + input: input, state: empty, stateCallback: stateCallback, errorCallback: errorCallback ) - return true } + return true } - - if state is InputState.AssociatedPhrases { return false } - - // MARK: SCPC Mode Processing - - if mgrPrefs.useSCPCTypingMode { - var punctuationNamePrefix = "" - - if input.isOptionHold && !input.isControlHold { - punctuationNamePrefix = "_alt_punctuation_" - } else if input.isControlHold && !input.isOptionHold { - punctuationNamePrefix = "_ctrl_punctuation_" - } else if input.isControlHold && input.isOptionHold { - punctuationNamePrefix = "_alt_ctrl_punctuation_" - } else if mgrPrefs.halfWidthPunctuationEnabled { - punctuationNamePrefix = "_half_punctuation_" - } else { - punctuationNamePrefix = "_punctuation_" - } - - let parser = currentMandarinParser - - let arrCustomPunctuations: [String] = [ - punctuationNamePrefix, parser, String(format: "%c", CChar(charCode)), - ] - let customPunctuation: String = arrCustomPunctuations.joined(separator: "") - - let arrPunctuations: [String] = [punctuationNamePrefix, String(format: "%c", CChar(charCode))] - let punctuation: String = arrPunctuations.joined(separator: "") - - var shouldAutoSelectCandidate: Bool = - _composer.inputValidityCheck(key: charCode) || ifLangModelHasUnigrams(forKey: customPunctuation) - || ifLangModelHasUnigrams(forKey: punctuation) - - if !shouldAutoSelectCandidate, input.isUpperCaseASCIILetterKey { - let letter: String! = String(format: "%@%c", "_letter_", CChar(charCode)) - if ifLangModelHasUnigrams(forKey: letter) { shouldAutoSelectCandidate = true } - } - - if shouldAutoSelectCandidate { - let candidateIndex = ctlCandidateCurrent.candidateIndexAtKeyLabelIndex(0) - if candidateIndex != Int.max { - delegate!.keyHandler( - self, - didSelectCandidateAt: candidateIndex, - ctlCandidate: ctlCandidateCurrent - ) - clear() - let empty = InputState.EmptyIgnoringPreviousState() - stateCallback(empty) - return handle( - input: input, state: empty, stateCallback: stateCallback, errorCallback: errorCallback - ) - } - return true - } - } - } // END: "if let ctlCandidateCurrent" + } IME.prtDebugIntel("172A0F81") errorCallback() diff --git a/vChewing.xcodeproj/project.pbxproj b/vChewing.xcodeproj/project.pbxproj index 8d97beb1..07127204 100644 --- a/vChewing.xcodeproj/project.pbxproj +++ b/vChewing.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 52; + objectVersion = 54; objects = { /* Begin PBXBuildFile section */ @@ -128,13 +128,6 @@ remoteGlobalIDString = 5BD05BB727B2A429004C4F1D; remoteInfo = vChewingPhraseEditor; }; - 6A38BC2515FC131100A8A51F /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 6A0D4E9415FC0CFA00ABF4B3 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 6A38BC2115FC12FD00A8A51F; - remoteInfo = Data; - }; 6ACA420015FC1DCC00935EF6 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 6A0D4E9415FC0CFA00ABF4B3 /* Project object */; @@ -145,14 +138,14 @@ /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ - 5BDC5CBE27C28E8B00E1CCE2 /* Embed App Extensions */ = { + 5BDC5CBE27C28E8B00E1CCE2 /* Embed Foundation Extensions */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; dstPath = ""; dstSubfolderSpec = 13; files = ( ); - name = "Embed App Extensions"; + name = "Embed Foundation Extensions"; runOnlyForDeploymentPostprocessing = 0; }; /* End PBXCopyFilesBuildPhase section */ @@ -808,23 +801,6 @@ }; /* End PBXGroup section */ -/* Begin PBXLegacyTarget section */ - 6A38BC2115FC12FD00A8A51F /* Data */ = { - isa = PBXLegacyTarget; - buildArgumentsString = "$(ACTION) ../../DataCompiler/dataCompiler.swift"; - buildConfigurationList = 6A38BC2215FC12FD00A8A51F /* Build configuration list for PBXLegacyTarget "Data" */; - buildPhases = ( - ); - buildToolPath = /usr/bin/swift; - buildWorkingDirectory = "$(SRCROOT)/Source/Data"; - dependencies = ( - ); - name = Data; - passBuildSettingsInEnvironment = 1; - productName = Data; - }; -/* End PBXLegacyTarget section */ - /* Begin PBXNativeTarget section */ 5BD05BB727B2A429004C4F1D /* vChewingPhraseEditor */ = { isa = PBXNativeTarget; @@ -847,17 +823,17 @@ isa = PBXNativeTarget; buildConfigurationList = 6A0D4EC015FC0D2E00ABF4B3 /* Build configuration list for PBXNativeTarget "vChewing" */; buildPhases = ( + 5B9A5A00285184BB001FFCAF /* ShellScript */, 6A0D4E9E15FC0D2D00ABF4B3 /* Sources */, 6A0D4E9F15FC0D2D00ABF4B3 /* Frameworks */, 6A0D4EA015FC0D2D00ABF4B3 /* Resources */, - 5BDC5CBE27C28E8B00E1CCE2 /* Embed App Extensions */, + 5BDC5CBE27C28E8B00E1CCE2 /* Embed Foundation Extensions */, ); buildRules = ( ); dependencies = ( 5B707CEA27D9F47A0099EF99 /* PBXTargetDependency */, 5B0AF8B327B2C4E20096FE54 /* PBXTargetDependency */, - 6A38BC2615FC131100A8A51F /* PBXTargetDependency */, ); name = vChewing; packageProductDependencies = ( @@ -895,7 +871,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 1320; - LastUpgradeCheck = 1340; + LastUpgradeCheck = 1400; TargetAttributes = { 5BD05BB727B2A429004C4F1D = { CreatedOnToolsVersion = 13.2; @@ -933,7 +909,6 @@ 6A0D4EA115FC0D2D00ABF4B3 /* vChewing */, 6ACA41CA15FC1D7500935EF6 /* vChewingInstaller */, 5BD05BB727B2A429004C4F1D /* vChewingPhraseEditor */, - 6A38BC2115FC12FD00A8A51F /* Data */, ); }; /* End PBXProject section */ @@ -994,13 +969,53 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 6A225A2023679F5F00F685C6 /* ShellScript */ = { + 5B9A5A00285184BB001FFCAF /* ShellScript */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputFileListPaths = ( ); + inputPaths = ( + "$(SRCROOT)/Source/Data/components/chs/phrases-custom-chs.txt", + "$(SRCROOT)/Source/Data/components/chs/phrases-moe-chs.txt", + "$(SRCROOT)/Source/Data/components/chs/phrases-tabe-chs.txt", + "$(SRCROOT)/Source/Data/components/chs/phrases-vchewing-chs.txt", + "$(SRCROOT)/Source/Data/components/cht/phrases-custom-cht.txt", + "$(SRCROOT)/Source/Data/components/cht/phrases-moe-cht.txt", + "$(SRCROOT)/Source/Data/components/cht/phrases-tabe-cht.txt", + "$(SRCROOT)/Source/Data/components/cht/phrases-vchewing-cht.txt", + "$(SRCROOT)/Source/Data/components/common/char-kanji-cns.txt", + "$(SRCROOT)/Source/Data/components/common/char-kanji-core.txt", + "$(SRCROOT)/Source/Data/components/common/char-kanji-phrasesonly.txt", + "$(SRCROOT)/Source/Data/components/common/char-misc-bpmf.txt", + "$(SRCROOT)/Source/Data/components/common/char-misc-nonkanji.txt", + "$(SRCROOT)/Source/Data/components/common/data-punctuations.txt", + "$(SRCROOT)/Source/Data/components/common/data-symbols.txt", + "$(SRCROOT)/Source/Data/components/common/data-zhuyinwen.txt", + "$(SRCROOT)/Source/Data/components/common/phone-header.txt", + ); + outputFileListPaths = ( + ); + outputPaths = ( + "$(SRCROOT)/Source/Data/data-chs.plist", + "$(SRCROOT)/Source/Data/data-cht.plist", + "$(SRCROOT)/Source/Data/data-cns.plist", + "$(SRCROOT)/Source/Data/data-zhuyinwen.plist", + "$(SRCROOT)/Source/Data/data-symbols.plist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "# Type a script or drag a script file from your workspace to insert its path.\ncd ${SRCROOT}\nswiftc ${SRCROOT}/DataCompiler/dataCompiler.swift -o ${SRCROOT}/DataCompiler/cook_mac.exe\nmv ${SRCROOT}/DataCompiler/cook_mac.exe ${SRCROOT}/Source/Data/bin/cook_mac.exe\ncd ${SRCROOT}/Source/Data/\n./bin/cook_mac.exe\n"; + }; + 6A225A2023679F5F00F685C6 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 12; + files = ( + ); + inputFileListPaths = ( + ); inputPaths = ( ); outputFileListPaths = ( @@ -1126,11 +1141,6 @@ isa = PBXTargetDependency; productRef = 5B707CE927D9F47A0099EF99 /* OpenCC */; }; - 6A38BC2615FC131100A8A51F /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 6A38BC2115FC12FD00A8A51F /* Data */; - targetProxy = 6A38BC2515FC131100A8A51F /* PBXContainerItemProxy */; - }; 6ACA420115FC1DCC00935EF6 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 6A0D4EA115FC0D2D00ABF4B3 /* vChewing */; @@ -1295,6 +1305,7 @@ COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 1970; + DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = dwarf; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_DYNAMIC_NO_PIC = NO; @@ -1351,6 +1362,7 @@ COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 1970; + DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; GCC_C_LANGUAGE_STANDARD = gnu11; @@ -1405,6 +1417,7 @@ CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; + DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; @@ -1448,6 +1461,7 @@ CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; + DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_NO_COMMON_BLOCKS = YES; @@ -1462,7 +1476,6 @@ "$(OTHER_CFLAGS)", "-fcxx-modules", ); - SWIFT_COMPILATION_MODE = wholemodule; }; name = Release; }; @@ -1487,6 +1500,7 @@ COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 1970; + DEAD_CODE_STRIPPING = YES; DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_TEAM = ""; GCC_C_LANGUAGE_STANDARD = gnu99; @@ -1554,6 +1568,7 @@ COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 1970; + DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_TEAM = ""; @@ -1588,70 +1603,13 @@ PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; SDKROOT = macosx; - SWIFT_COMPILATION_MODE = singlefile; + SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OBJC_BRIDGING_HEADER = "Source/Headers/vChewing-Bridging-Header.h"; SWIFT_VERSION = 5.0; WRAPPER_EXTENSION = app; }; name = Release; }; - 6A38BC2315FC12FD00A8A51F /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COMBINE_HIDPI_IMAGES = YES; - COPY_PHASE_STRIP = NO; - DEBUGGING_SYMBOLS = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_OBJC_EXCEPTIONS = YES; - GCC_GENERATE_DEBUGGING_SYMBOLS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.10; - ONLY_ACTIVE_ARCH = YES; - OTHER_CFLAGS = ""; - OTHER_LDFLAGS = ""; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = macosx; - }; - name = Debug; - }; - 6A38BC2415FC12FD00A8A51F /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COMBINE_HIDPI_IMAGES = YES; - COPY_PHASE_STRIP = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_ENABLE_OBJC_EXCEPTIONS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.10; - OTHER_CFLAGS = ""; - OTHER_LDFLAGS = ""; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = macosx; - }; - name = Release; - }; 6ACA41E515FC1D7600935EF6 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -1668,6 +1626,7 @@ COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 1970; + DEAD_CODE_STRIPPING = YES; DEVELOPMENT_TEAM = ""; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; @@ -1720,6 +1679,7 @@ COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 1970; + DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = ""; GCC_C_LANGUAGE_STANDARD = gnu99; @@ -1780,15 +1740,6 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 6A38BC2215FC12FD00A8A51F /* Build configuration list for PBXLegacyTarget "Data" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 6A38BC2315FC12FD00A8A51F /* Debug */, - 6A38BC2415FC12FD00A8A51F /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; 6ACA41E415FC1D7600935EF6 /* Build configuration list for PBXNativeTarget "vChewingInstaller" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/vChewing.xcodeproj/xcshareddata/xcschemes/Data.xcscheme b/vChewing.xcodeproj/xcshareddata/xcschemes/Data.xcscheme index 24486708..e3eda545 100644 --- a/vChewing.xcodeproj/xcshareddata/xcschemes/Data.xcscheme +++ b/vChewing.xcodeproj/xcshareddata/xcschemes/Data.xcscheme @@ -1,6 +1,6 @@