1
/***************************************************************************
2
* Copyright (C) 2002~2005 by Yuking *
3
* yuking_net@sohu.com *
5
* This program is free software; you can redistribute it and/or modify *
6
* it under the terms of the GNU General Public License as published by *
7
* the Free Software Foundation; either version 2 of the License, or *
8
* (at your option) any later version. *
10
* This program is distributed in the hope that it will be useful, *
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13
* GNU General Public License for more details. *
15
* You should have received a copy of the GNU General Public License *
16
* along with this program; if not, write to the *
17
* Free Software Foundation, Inc., *
18
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
19
***************************************************************************/
25
#include "im/pinyin/py.h"
27
#include "fcitx-config/xdg.h"
31
int main(int argc, char **argv)
35
char *pybase_mb = NULL;
40
while ((c = getopt(argc, argv, "b:h")) != -1) {
44
pybase_mb = strdup(optarg);
55
fi = fopen(pybase_mb , "r");
57
fi = FcitxXDGGetFileWithPrefix("pinyin", PY_BASE_FILE, "r", &pybase_mb);
61
fprintf(stderr, "Can't open file `%s' for reading\n", pybase_mb);
67
PYFACount = LoadPYBase(fi, &HZMap);
72
for (i = 0; i < PYFACount; ++i) {
73
printf("%s: ", HZMap[i].Map);
74
fwrite(HZMap[i].HZ, 2, HZMap[i].BaseCount, stdout);
79
for (i = 0; i < PYFACount; ++i) {
81
printf("%s: HZ Index\n", HZMap[i].Map);
83
for (j = 0; j < HZMap[i].BaseCount; ++j) {
84
printf("\t%s %5d", HZMap[i].HZ[j], HZMap[i].Index[j]);
98
char* pkgdatadir = fcitx_utils_get_fcitx_path("pkgdatadir");
100
"readPYBase - read pybase.mb file and display its contents\n"
102
" usage: readPYBase [OPTION]\n"
104
" -b <pybase.mb> full path to the file, usually\n"
105
" %s/pinyin/" PY_BASE_FILE "\n"
106
" if not specified, defaults to\n"
107
" %s/pinyin/" PY_BASE_FILE "\n"
108
" -h display this help\n"
110
pkgdatadir, pkgdatadir
118
// kate: indent-mode cstyle; space-indent on; indent-width 4;