Commit e97b37e6 authored by Hiroshi Sumita's avatar Hiroshi Sumita
Browse files

Replace variable types from g* to standard types.

replacing
- gchar - char
- gint - int, unsigned int, or size_t
- guint -> unsigned int or size_t
- guint8 -> unsigned char
- gboolean -> bool
- gsize -> size_t
- gpointer -> void *
- gconstpointer -> const void *
- gunichar -> unichar (typedef of int on PyZyUtil.h)

BUG=None
TEST=Run a test

Review URL: http://codereview.appspot.com/5367046
parent d4a3a174
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-

'''
const static gunichar bopomofo_char[] = {
const static unichar bopomofo_char[] = {
    L'\0',L'',L'',L'',L'',L'',L'',L'',L'',L'',L'',
    L'',L'',L'',L'',L'',L'',L'',L'',L'',L'',L'',

+4 −4
Original line number Diff line number Diff line
import pydict

for name, (sheng, yun) in pydict.SHUANGPIN_SCHEMAS:
    print "static const gint8 double_pinyin_%s_sheng[] = {" % name.lower()
    print "static const char double_pinyin_%s_sheng[] = {" % name.lower()
    for c in "abcdefghijklmnopqrstuvwxyz;":
        s = sheng.get(c, "VOID")
        if s == "'":
@@ -13,7 +13,7 @@ for name, (sheng, yun) in pydict.SHUANGPIN_SCHEMAS:
        print "    PINYIN_ID_%s // %s" % ((s + ",").ljust(5), c.upper())
    print "};"
    
    print "static const gint8 double_pinyin_%s_yun[][2] = {" % name.lower()
    print "static const char double_pinyin_%s_yun[][2] = {" % name.lower()
    for c in "abcdefghijklmnopqrstuvwxyz;":
        s = yun.get(c, ("VOID", "VOID"))
        if len(s) == 1:
@@ -32,8 +32,8 @@ for name, (sheng, yun) in pydict.SHUANGPIN_SCHEMAS:

print '''
static const struct {
    const gint8  (&sheng)[27];
    const gint8  (&yun)[27][2];
    const char  (&sheng)[27];
    const char  (&yun)[27][2];
} double_pinyin_map [] = {'''
for name, (sheng, yun) in pydict.SHUANGPIN_SCHEMAS:
    print "    { double_pinyin_%s_sheng, double_pinyin_%s_yun}," %  (name.lower(), name.lower())
+1 −1
Original line number Diff line number Diff line
@@ -80,7 +80,7 @@ def tochar(ch):

def gen_table():
    i = 0
    print 'static const guint8'
    print 'static const unsigned char'
    print 'bopomofo_keyboard[][41][2] = {'
    for keyboard in bopomofo_keyboard:
        print '    {'
+2 −2
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@ def tocstr(s):
def gen_table():
    array = []
    i = 0
    print 'static const gchar * const'
    print 'static const char * const'
    print 'puncts[] = {'
    for k, vs in punct_map:
        k = tocstr(k)
@@ -22,7 +22,7 @@ def gen_table():
        i += len(vs) + 2
    print '};'
    print
    print 'static const gchar * const * const'
    print 'static const char * const * const'
    print 'punct_table[] = {'
    for i, k in array:
        print '    &puncts[%d],    // %s' % (i, k)
+2 −2
Original line number Diff line number Diff line
@@ -268,8 +268,8 @@ def gen_macros():
    print

def gen_option_check(name, fuzzy):
    print '''static gboolean
%s (guint option, gint id, gint fid)
    print '''static bool
%s (unsigned int option, int id, int fid)
{
    switch ((id << 16) | fid) {''' % name
    for y1, y2 in fuzzy:
Loading