diff --git a/format.sh b/format.sh index 036a4e3..bcc1b38 100755 --- a/format.sh +++ b/format.sh @@ -1,2 +1,5 @@ #!/bin/sh +while [ ! -d .git ]; do + cd .. +done clang-format --verbose -i `find src lib include -name "*.c" -or -name "*.h"` diff --git a/include/sj3core/sj_struct.h b/include/sj3core/sj_struct.h index 4bf270c..c551b66 100644 --- a/include/sj3core/sj_struct.h +++ b/include/sj3core/sj_struct.h @@ -140,12 +140,12 @@ typedef struct dict { TypeDicSeg segunit; TypeDicSeg maxunit; - IFunc getofs; - IFunc getidx; - IFunc getdic; - IFunc putidx; - IFunc putdic; - IFunc rszdic; + IFuncDict getofs; + IFuncDict getidx; + IFunc getdic; + IFunc putidx; + IFunc putdic; + IFunc rszdic; } DICT; typedef struct dictl { diff --git a/include/sj3core/sj_typedef.h b/include/sj3core/sj_typedef.h index ad02c19..68d80f7 100644 --- a/include/sj3core/sj_typedef.h +++ b/include/sj3core/sj_typedef.h @@ -46,9 +46,11 @@ typedef unsigned char u_char; typedef unsigned short u_short; typedef unsigned int u_int; -typedef void (*VFunc)(); -typedef u_char* (*UCPFunc)(); -typedef int (*IFunc)(); +typedef void (*VFunc)(void*, void*, void*); +typedef u_char* (*UCPFunc)(u_char*, u_char*, int); +typedef int (*IFunc)(void*, int); + +typedef int (*IFuncDict)(void*); typedef u_char TypeGroup; typedef u_char TypeGram; diff --git a/lib/sj3core/clstudy.c b/lib/sj3core/clstudy.c index 7893191..d3e4bf0 100644 --- a/lib/sj3core/clstudy.c +++ b/lib/sj3core/clstudy.c @@ -37,7 +37,7 @@ #include "sj_kanakan.h" -static u_char *delcldata(), *srchclpos(); +static u_char *delcldata(u_char*), *srchclpos(u_char*); static int delclold(); int clstudy(u_char* yomi1, u_char* yomi2, STDYOUT* stdy) { diff --git a/lib/sj3core/functbl.c b/lib/sj3core/functbl.c index 4877541..1f04fd3 100644 --- a/lib/sj3core/functbl.c +++ b/lib/sj3core/functbl.c @@ -39,33 +39,31 @@ #include "sj_kanakan.h" VFunc cvtnum_func[] = { - num_type00, num_type01, num_type02, num_type03, - num_type04, num_type05, num_type06, num_type07, - num_type08, num_type09, num_type10, num_type11, - num_type12, num_type13, num_type14}; + (VFunc)num_type00, (VFunc)num_type01, (VFunc)num_type02, (VFunc)num_type03, + (VFunc)num_type04, (VFunc)num_type05, (VFunc)num_type06, (VFunc)num_type07, + (VFunc)num_type08, (VFunc)num_type09, (VFunc)num_type10, (VFunc)num_type11, + (VFunc)num_type12, (VFunc)num_type13, (VFunc)num_type14}; UCPFunc getkan_func[] = { - getkan_norm, getkan_norm, getkan_hira, getkan_kata, - getkan_knj, getkan_ofs, getkan_norm, getkan_none, - getkan_norm, getkan_norm, getkan_hira, getkan_kata, - getkan_knj, getkan_ofs, getkan_norm, getkan_none}; + (UCPFunc)getkan_norm, (UCPFunc)getkan_norm, (UCPFunc)getkan_hira, (UCPFunc)getkan_kata, + (UCPFunc)getkan_knj, (UCPFunc)getkan_ofs, (UCPFunc)getkan_norm, (UCPFunc)getkan_none, + (UCPFunc)getkan_norm, (UCPFunc)getkan_norm, (UCPFunc)getkan_hira, (UCPFunc)getkan_kata, + (UCPFunc)getkan_knj, (UCPFunc)getkan_ofs, (UCPFunc)getkan_norm, (UCPFunc)getkan_none}; IFunc setjrec_func[] = { - setj_norm2, setj_norm2, setj_norm1, setj_norm1, - setj_knj, setj_ofs, setj_norm2, setj_atrb, - setj_norm2, setj_norm2, setj_norm1, setj_norm1, - setj_knj, setj_ofs, setj_norm2, setj_atrb}; + (IFunc)setj_norm2, (IFunc)setj_norm2, (IFunc)setj_norm1, (IFunc)setj_norm1, + (IFunc)setj_knj, (IFunc)setj_ofs, (IFunc)setj_norm2, (IFunc)setj_atrb, + (IFunc)setj_norm2, (IFunc)setj_norm2, (IFunc)setj_norm1, (IFunc)setj_norm1, + (IFunc)setj_knj, (IFunc)setj_ofs, (IFunc)setj_norm2, (IFunc)setj_atrb}; IFunc hiraknj_func[] = { - hiraknj_hira, hiraknj_norm, hiraknj_hask, hiraknj_kask, - hiraknj_knj, hiraknj_ofs, hiraknj_norm, hiraknj_atrb, - hiraknj_hira, hiraknj_norm, hiraknj_hask, hiraknj_kask, - hiraknj_knj, hiraknj_ofs, hiraknj_norm, hiraknj_atrb}; + (IFunc)hiraknj_hira, (IFunc)hiraknj_norm, (IFunc)hiraknj_hask, (IFunc)hiraknj_kask, + (IFunc)hiraknj_knj, (IFunc)hiraknj_ofs, (IFunc)hiraknj_norm, (IFunc)hiraknj_atrb, + (IFunc)hiraknj_hira, (IFunc)hiraknj_norm, (IFunc)hiraknj_hask, (IFunc)hiraknj_kask, + (IFunc)hiraknj_knj, (IFunc)hiraknj_ofs, (IFunc)hiraknj_norm, (IFunc)hiraknj_atrb}; -u_char *makekan_1byte(), *makekan_knj(), *makekan_ofs(); -u_char *makekan_norm(), *makekan_none(); UCPFunc makekan_func[] = { - makekan_norm, makekan_norm, makekan_1byte, makekan_1byte, - makekan_knj, makekan_ofs, makekan_norm, makekan_none, - makekan_norm, makekan_norm, makekan_1byte, makekan_1byte, - makekan_knj, makekan_ofs, makekan_norm, makekan_none}; + (UCPFunc)makekan_norm, (UCPFunc)makekan_norm, (UCPFunc)makekan_1byte, (UCPFunc)makekan_1byte, + (UCPFunc)makekan_knj, (UCPFunc)makekan_ofs, (UCPFunc)makekan_norm, (UCPFunc)makekan_none, + (UCPFunc)makekan_norm, (UCPFunc)makekan_norm, (UCPFunc)makekan_1byte, (UCPFunc)makekan_1byte, + (UCPFunc)makekan_knj, (UCPFunc)makekan_ofs, (UCPFunc)makekan_norm, (UCPFunc)makekan_none}; diff --git a/lib/sj3core/getkanji.c b/lib/sj3core/getkanji.c index a1cce5c..be8d93c 100644 --- a/lib/sj3core/getkanji.c +++ b/lib/sj3core/getkanji.c @@ -38,7 +38,7 @@ #include "sj_kanakan.h" -static u_char* code2kanji(); +static u_char* code2kanji(u_char* s, u_char* d, u_char* ym, int yl, int flg); u_char* getkan_none(u_char* s, u_char* d, u_char* ym, int yl, int flg) { diff --git a/lib/sj3core/getrank.c b/lib/sj3core/getrank.c index 3e4a509..c171faf 100644 --- a/lib/sj3core/getrank.c +++ b/lib/sj3core/getrank.c @@ -37,7 +37,7 @@ #include "sj_kanakan.h" -static void setstynum(), setnspr(), regetrank(); +static void setstynum(), setnspr(KHREC*, STDYIN*), regetrank(); void getrank() { diff --git a/lib/sj3core/mkjiritu.c b/lib/sj3core/mkjiritu.c index af738f4..b381bc8 100644 --- a/lib/sj3core/mkjiritu.c +++ b/lib/sj3core/mkjiritu.c @@ -38,7 +38,7 @@ #include "sj_kanakan.h" -static void dic_mu(), dic_cl(); +static void dic_mu(int), dic_cl(); void mkjiritu(int mode) { u_char chkind1; diff --git a/lib/sj3core/mkkouho.c b/lib/sj3core/mkkouho.c index d119bd7..b240582 100644 --- a/lib/sj3core/mkkouho.c +++ b/lib/sj3core/mkkouho.c @@ -41,10 +41,10 @@ #include "sj_kanakan.h" -static void getkhtbl(), cl_kanji(); -static int diffknj(); -static void cl_numcmn(); -static u_char* makekan(); +static void getkhtbl(CLREC*), cl_kanji(JREC*, CLREC*); +static int diffknj(JREC*, u_char*, int); +static void cl_numcmn(JREC*, CLREC*); +static u_char* makekan(u_char*, u_char*, int); void mkkouho() { CLREC* clrec; diff --git a/lib/sj3core/peepdic.c b/lib/sj3core/peepdic.c index 636379e..5af2362 100644 --- a/lib/sj3core/peepdic.c +++ b/lib/sj3core/peepdic.c @@ -40,7 +40,7 @@ static int prev_kanji(), prev_hinsi(), prev_douon(); static int next_kanji(), next_hinsi(), next_douon(); -static void set_kanji(), set_buf(), add_yomi(); +static void set_kanji(), set_buf(u_char*), add_yomi(); static void set_idxyomi(); static void cd2sjh_chr(u_char ch, u_char* dst); diff --git a/lib/sj3core/sdepend.c b/lib/sj3core/sdepend.c index f5e4dd0..dd1aade 100644 --- a/lib/sj3core/sdepend.c +++ b/lib/sj3core/sdepend.c @@ -294,10 +294,10 @@ opendict(char* name, char* passwd) { dfp->dict.seglen = get4byte(dp + DICTSEGLEN); dfp->dict.segunit = get4byte(dp + DICTSEGNUM); dfp->dict.maxunit = i ? get4byte(dp + DICTSEGMAX) : 0; - dfp->dict.getofs = getofs; - dfp->dict.getidx = getidx; + dfp->dict.getofs = (IFuncDict)getofs; + dfp->dict.getidx = (IFuncDict)getidx; dfp->dict.getdic = (IFunc)getdic; - dfp->dict.putidx = putidx; + dfp->dict.putidx = (IFunc)putidx; dfp->dict.putdic = (IFunc)putdic; dfp->dict.rszdic = (IFunc)rszdic; dfp->refcnt = 1; diff --git a/lib/sj3core/setkouho.c b/lib/sj3core/setkouho.c index 500ac5e..cda2489 100644 --- a/lib/sj3core/setkouho.c +++ b/lib/sj3core/setkouho.c @@ -39,7 +39,7 @@ #include "sj_kanakan.h" -static int hiraknj(); +static int hiraknj(u_char*); void setkouho(CLREC* clrec, TypeDicOfs offs, int mode) { JREC* jrec; diff --git a/lib/sj3core/srchnum.c b/lib/sj3core/srchnum.c index 65028b6..ccaf6ea 100644 --- a/lib/sj3core/srchnum.c +++ b/lib/sj3core/srchnum.c @@ -41,7 +41,7 @@ #include "sj_kanakan.h" -static void srch_kurai1(), srch_kurai2(); +static void srch_kurai1(u_char*, u_char*), srch_kurai2(u_char*, u_char*); static void srch_josuu_sub(JREC* jrec, TypeGram gram) {