Newer
Older
* COMMENT -*- mode: org -*-
#+Date: 2019-04-05
#+STARTUP: content
* notes :entry:
** 2019-08-31 ibus-pinyin userdb inference notice.
zero-pinyin-service reuse ibus-pinyin's userdb at
~/.cache/ibus/pinyin/user-1.0.db
This is generally not a problem. But if ibus-pinyin changed their table schema
in the future, zero-pinyin-service may require update.
zero-pinyin-service also store user phrase in this db. So user phrases are
shared between zero-pinyin and ibus-pinyin.
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
** 2019-04-05 zero-pinyin-service file structure :doc:
- zero-pinyin-service
- main.c
a console application based on glib and gio.
provides dbus service. see the zero-pinyin-service spec at
~/c/gtk-im-module/operational :id001:
- zero-pinyin-service.h
zero-pinyin-service.c
zero-pinyin-service-test.c
contains the zero-pinyin-service dbus method C based implementation.
- parse-pinyin.h
parse-pinyin.cpp
parse-pinyin-test.cpp
contains utility functions based on code from libpyzyz. This should be
replaced eventually. I don't want to depend on libpyzy source code.
- utilities
- test-sql.sh
a shell script to experiment SQL commands
- data files
- meson.build
build script. used to create executable.
- com.emacsos.zero.ZeroPinyinService.service
dbus service definition file.
Should be copied to dbus service file dir /usr/share/dbus-1/services/
When dbus client try to talk to service, dbus session bus will start the
service app automatically.
* later :entry:
* current :entry:
**
** 2019-08-31 how to format C code? do it before git commit.
see ~/c/gtk-im-module/, it uses myastyle-pre-commit-check in git pre-commit
~/bin/myastyle-pre-commit-check
** 2019-08-31 honor XDG cache dir.
~/.cache/ibus
** 2019-04-17 make flags configurable at runtime.
- add dbus method to set flags.
- make the method work. use gobject property maybe.
- set default flags to my flags. reflect this in UI/config file.
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
** 2019-08-31 choose maindb like my patched libpyzy.
- here is patched libpyzy maindb logic:
files.push_back (m_user_data_dir + "/main.db");
files.push_back (PKGDATADIR"/db/local.db");
files.push_back (PKGDATADIR"/db/open-phrase.db");
files.push_back (PKGDATADIR"/db/android.db");
return first_existing_file (files);
m_user_data_dir default is ~/.cache/ibus/pinyin/
PKGDATADIR default is /usr/share/pyzy/
in zero-pinyin-service, just use the first existing file:
~/.cache/ibus/pinyin/main.db
/usr/share/pyzy/db/open-phrase.db
/usr/share/pyzy/db/android.db
- should I reuse the ibus-pinyin userdb file?
~/.cache/ibus/pinyin/user-1.0.db
yes. ibus-pinyin is not going away.
DONE document this behavior in zero-el and zero-pinyin-service.
- init_userdb()
sqlite3_mprintf()
https://www.sqlite.org/c3ref/mprintf.html
additional non-standard formats (%q, %Q, %w, and %z).
| | in | out | used for |
|----+------+---------+----------------------------------------------------------|
| %q | ab'c | ab''c | SQL string literal |
| %Q | ab'c | 'ab''c' | SQL string literal |
| %w | ab"c | ab""c | SQL identifier name |
| %z | abc | abc | like %s, but sqlite3_free() is called on param after use |