Skip to content

Commit

Permalink
rebase rime#700
Browse files Browse the repository at this point in the history
  • Loading branch information
nopdan committed Sep 4, 2023
1 parent 9ed9c8a commit a8b7ecf
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 27 deletions.
1 change: 1 addition & 0 deletions boost/core
Submodule core added at c71349
1 change: 1 addition & 0 deletions boost/optional
Submodule optional added at 2f8d01
11 changes: 9 additions & 2 deletions tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,18 @@ target_link_libraries(rime_deployer
${rime_dict_library}
${rime_levers_library})

set(rime_table_decompiler_src "rime_table_decompiler.cc")
set(rime_table_decompiler_src
"rime_table_decompiler.cc"
${CMAKE_SOURCE_DIR}/src/rime/dict/table.cc
${CMAKE_SOURCE_DIR}/src/rime/dict/mapped_file.cc
${CMAKE_SOURCE_DIR}/src/rime/dict/string_table.cc
${CMAKE_SOURCE_DIR}/src/rime/dict/vocabulary.cc
)
add_executable(rime_table_decompiler ${rime_table_decompiler_src})
target_link_libraries(rime_table_decompiler
${rime_library}
${rime_dict_library})

install(TARGETS rime_deployer DESTINATION ${BIN_INSTALL_DIR})
install(TARGETS rime_dict_manager DESTINATION ${BIN_INSTALL_DIR})
install(TARGETS rime_table_decompiler DESTINATION ${BIN_INSTALL_DIR})
Expand Down
27 changes: 2 additions & 25 deletions tools/rime_table_decompiler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@
#include <ios>
#include <iostream>
#include <rime/dict/table.h>
#if _MSC_VER >= 1600
#pragma execution_character_set("utf-8")
#endif
#ifdef _WIN32
#include <windows.h>
#endif

using namespace std;
ofstream fout;
Expand Down Expand Up @@ -77,10 +71,7 @@ void traversal(rime::Table* table, ofstream& fout) {
int main(int argc, char* argv[]) {
string fileName(argv[1]);

#ifdef _WIN32
SetConsoleOutputCP(65001);
#endif
cout << "读取文件: " << fileName << endl;
cout << "Read File: " << fileName << endl;
rime::Table table(fileName);
table.Load();

Expand All @@ -104,24 +95,10 @@ int main(int argc, char* argv[]) {
fout << "---\n"
"name: " << fileName << "\n"
"version: \"1.0\"\n"
"sort: original\n"
"columns:\n"
" - text\n"
" - code\n"
" - weight\n"
" - stem\n"
"encoder:\n"
" rules:\n"
" - length_equal: 2\n"
" formula: \"AaAbBaBb\"\n"
" - length_equal: 3\n"
" formula: \"AaBaCaCb\"\n"
" - length_in_range: [4, 10]\n"
" formula: \"AaBaCaZa\"\n"
"...\n\n";
// clang-format on
traversal(&table, fout);
cout << "已保存到: " << outputName << endl
cout << "Save To: " << outputName << endl
<< endl;
system("pause");
return 0;
Expand Down

0 comments on commit a8b7ecf

Please sign in to comment.