OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // This tool converts Hunspell .aff/.dic pairs to a combined binary dictionary | 5 // This tool converts Hunspell .aff/.dic pairs to a combined binary dictionary |
6 // format (.bdic). This format is more compact, and can be more efficiently | 6 // format (.bdic). This format is more compact, and can be more efficiently |
7 // read by the client application. | 7 // read by the client application. |
8 // | 8 // |
9 // We do this conversion manually before publishing dictionary files. It is not | 9 // We do this conversion manually before publishing dictionary files. It is not |
10 // part of any build process. | 10 // part of any build process. |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 int PrintHelp() { | 64 int PrintHelp() { |
65 printf("Usage: convert_dict <dicfile base name>\n\n"); | 65 printf("Usage: convert_dict <dicfile base name>\n\n"); |
66 printf("Example:\n convert_dict en-US\nwill read en-US.dic / en-US.aff and\n"
); | 66 printf("Example:\n convert_dict en-US\nwill read en-US.dic / en-US.aff and\n"
); |
67 printf("generate en-US.bdic\n\n"); | 67 printf("generate en-US.bdic\n\n"); |
68 return 1; | 68 return 1; |
69 } | 69 } |
70 | 70 |
71 } // namespace | 71 } // namespace |
72 | 72 |
73 int main(int argc, char* argv[]) { | 73 int main(int argc, char* argv[]) { |
74 process_util::EnableTerminationOnHeapCorruption(); | 74 base::EnableTerminationOnHeapCorruption(); |
75 if (argc != 2) | 75 if (argc != 2) |
76 return PrintHelp(); | 76 return PrintHelp(); |
77 | 77 |
78 icu_util::Initialize(); | 78 icu_util::Initialize(); |
79 | 79 |
80 std::string file_base = argv[1]; | 80 std::string file_base = argv[1]; |
81 | 81 |
82 std::string aff_name = file_base + ".aff"; | 82 std::string aff_name = file_base + ".aff"; |
83 printf("Reading %s ...\n", aff_name.c_str()); | 83 printf("Reading %s ...\n", aff_name.c_str()); |
84 convert_dict::AffReader aff_reader(aff_name.c_str()); | 84 convert_dict::AffReader aff_reader(aff_name.c_str()); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 if (!out_file) { | 118 if (!out_file) { |
119 printf("ERROR writing file\n"); | 119 printf("ERROR writing file\n"); |
120 return 1; | 120 return 1; |
121 } | 121 } |
122 fwrite(&serialized[0], 1, serialized.size(), out_file); | 122 fwrite(&serialized[0], 1, serialized.size(), out_file); |
123 file_util::CloseFile(out_file); | 123 file_util::CloseFile(out_file); |
124 | 124 |
125 return 0; | 125 return 0; |
126 } | 126 } |
127 | 127 |
OLD | NEW |