読者です 読者をやめる 読者になる 読者になる

mfks17's blog(Life is Good !!)

趣味や思った事を書いていくと思います

macのemacsにc/migemoをいれる

C/Migemoとは

Migemo(Ruby/Migemo)をC言語で実装したもので、ローマ字のまま日本語を(インクリメンタルに)検索する」ことができるものです。

READMEより一部抜粋

検証環境

  • macbookair Late 2010
  • macbookair Mid 2012
  • OSX 10.8.2

参考サイト様:[http://d.hatena.ne.jp/ground256/20111008/1318063872
http://d.hatena.ne.jp/ground256/20111008/1318063872:title=Mac OS X Lion の emacs-appでmigemoを使えるようにする]

インストール手順


ソースの入手


C/Migemo ― KaoriYaでcmigemoの最新版をチェック。
現在はgithubにリポジトリがあるようです。
cmigemo - github

$ git clone https://github.com/koron/cmigemo.git
Cloning into 'cmigemo'...
remote: Counting objects: 1138, done.
remote: Compressing objects: 100% (663/663), done.
remote: Total 1138 (delta 422), reused 1138 (delta 422)
Receiving objects: 100% (1138/1138), 461.01 KiB | 170 KiB/s, done.
Resolving deltas: 100% (422/422), done.
$ cd cmigemo
$ ll
drwxr-xr-x  17 typosterr  staff   578  1 27 11:30 ./
drwxr-xr-x   6 typosterr  staff   204  1 27 11:30 ../
drwxr-xr-x  12 typosterr  staff   408  1 27 11:30 .git/
-rw-r--r--   1 typosterr  staff   147  1 27 11:30 .hgignore
-rw-r--r--   1 typosterr  staff   145  1 27 11:30 .hgtags
-rw-r--r--   1 typosterr  staff  3306  1 27 11:30 Makefile
-rw-r--r--   1 typosterr  staff   179  1 27 11:30 README.txt
-rw-r--r--   1 typosterr  staff     5  1 27 11:30 VERSION
drwxr-xr-x  23 typosterr  staff   782  1 27 11:30 compile/
-rw-r--r--   1 typosterr  staff  1305  1 27 11:30 config.mk
-rwxr-xr-x   1 typosterr  staff  1770  1 27 11:30 configure*
drwxr-xr-x   9 typosterr  staff   306  1 27 11:30 dict/
drwxr-xr-x   9 typosterr  staff   306  1 27 11:30 doc/
-rw-r--r--   1 typosterr  staff  1260  1 27 11:30 mkpkg
drwxr-xr-x  25 typosterr  staff   850  1 27 11:30 src/
drwxr-xr-x   8 typosterr  staff   272  1 27 11:30 tools/
drwxr-xr-x  11 typosterr  staff   374  1 27 11:30 xpcom/

ライブラリとプログラムのビルド

$ ./configure 
$ make osx
make -f compile/Make_osx.mak
cc -O2 -Wall  -fPIC -o build/object/main.o -c src/main.c
src/main.c:34:13: warning: passing 'unsigned char [256]' to parameter of type
      'char *' converts between pointers to integer types with different sign
      [-Wpointer-sign]
        if (!fgets(buf, sizeof(buf), stdin))
                   ^~~
/usr/include/stdio.h:246:30: note: passing argument to parameter here
char    *fgets(char * __restrict, int, FILE *);
                                ^
src/main.c:41:20: warning: passing 'unsigned char [256]' to parameter of type
      'const char *' converts between pointers to integer types with different
      sign [-Wpointer-sign]
        if ((ans = strchr(buf, '\n')) != NULL)
                          ^~~
/usr/include/string.h:86:26: note: passing argument to parameter here
char    *strchr(const char *, int);
                            ^
src/main.c:41:11: warning: assigning to 'unsigned char *' from 'char *' converts
      between pointers to integer types with different sign [-Wpointer-sign]
        if ((ans = strchr(buf, '\n')) != NULL)
                 ^ ~~~~~~~~~~~~~~~~~
src/main.c:169:54: warning: passing 'char [3]' to parameter of type
      'const unsigned char *' converts between pointers to integer types with
      different sign [-Wpointer-sign]
            migemo_set_operator(pmigemo, MIGEMO_OPINDEX_OR, "\\|");
                                                            ^~~~~
src/migemo.h:56:23: note: passing argument to parameter 'op' here
        const unsigned char* op);
                             ^
src/main.c:170:59: warning: passing 'char [4]' to parameter of type
      'const unsigned char *' converts between pointers to integer types with
      different sign [-Wpointer-sign]
            migemo_set_operator(pmigemo, MIGEMO_OPINDEX_NEST_IN, "\\%(");
                                                                 ^~~~~~
src/migemo.h:56:23: note: passing argument to parameter 'op' here
        const unsigned char* op);
                             ^
src/main.c:171:60: warning: passing 'char [3]' to parameter of type
      'const unsigned char *' converts between pointers to integer types with
      different sign [-Wpointer-sign]
            migemo_set_operator(pmigemo, MIGEMO_OPINDEX_NEST_OUT, "\\)");
                                                                  ^~~~~
src/migemo.h:56:23: note: passing argument to parameter 'op' here
        const unsigned char* op);
                             ^
src/main.c:173:56: warning: passing 'char [5]' to parameter of type
      'const unsigned char *' converts between pointers to integer types with
      different sign [-Wpointer-sign]
                migemo_set_operator(pmigemo, MIGEMO_OPINDEX_NEWLINE, "\\_s*");
                                                                     ^~~~~~~
src/migemo.h:56:23: note: passing argument to parameter 'op' here
        const unsigned char* op);
                             ^
src/main.c:177:54: warning: passing 'char [3]' to parameter of type
      'const unsigned char *' converts between pointers to integer types with
      different sign [-Wpointer-sign]
            migemo_set_operator(pmigemo, MIGEMO_OPINDEX_OR, "\\|");
                                                            ^~~~~
src/migemo.h:56:23: note: passing argument to parameter 'op' here
        const unsigned char* op);
                             ^
src/main.c:178:59: warning: passing 'char [3]' to parameter of type
      'const unsigned char *' converts between pointers to integer types with
      different sign [-Wpointer-sign]
            migemo_set_operator(pmigemo, MIGEMO_OPINDEX_NEST_IN, "\\(");
                                                                 ^~~~~
src/migemo.h:56:23: note: passing argument to parameter 'op' here
        const unsigned char* op);
                             ^
src/main.c:179:60: warning: passing 'char [3]' to parameter of type
      'const unsigned char *' converts between pointers to integer types with
      different sign [-Wpointer-sign]
            migemo_set_operator(pmigemo, MIGEMO_OPINDEX_NEST_OUT, "\\)");
                                                                  ^~~~~
src/migemo.h:56:23: note: passing argument to parameter 'op' here
        const unsigned char* op);
                             ^
src/main.c:181:56: warning: passing 'char [5]' to parameter of type
      'const unsigned char *' converts between pointers to integer types with
      different sign [-Wpointer-sign]
                migemo_set_operator(pmigemo, MIGEMO_OPINDEX_NEWLINE, "\\s-*");
                                                                     ^~~~~~~
src/migemo.h:56:23: note: passing argument to parameter 'op' here
        const unsigned char* op);
                             ^
src/main.c:188:34: warning: passing 'char *' to parameter of type
      'const unsigned char *' converts between pointers to integer types with
      different sign [-Wpointer-sign]
            ans = migemo_query(pmigemo, word);
                                        ^~~~
src/migemo.h:51:23: note: passing argument to parameter 'query' here
        const unsigned char* query);
                             ^
12 warnings generated.
cc -O2 -Wall  -fPIC -o build/object/charset.o -c src/charset.c
cc -O2 -Wall  -fPIC -o build/object/filename.o -c src/filename.c
cc -O2 -Wall  -fPIC -o build/object/migemo.o -c src/migemo.c
src/migemo.c:178:32: warning: passing 'const char *' to parameter of type
      'const unsigned char *' converts between pointers to integer types with
      different sign [-Wpointer-sign]
        if (dict && romaji_load(dict, dict_file) == 0)
                                      ^~~~~~~~~
src/romaji.h:24:54: note: passing argument to parameter 'filename' here
int romaji_load(romaji* object, const unsigned char* filename);
                                                     ^
src/migemo.c:255:34: warning: passing 'char [1024]' to parameter of type
      'const unsigned char *' converts between pointers to integer types with
      different sign [-Wpointer-sign]
            romaji_load(obj->roma2hira, roma_dict);
                                        ^~~~~~~~~
src/romaji.h:24:54: note: passing argument to parameter 'filename' here
int romaji_load(romaji* object, const unsigned char* filename);
                                                     ^
src/migemo.c:256:34: warning: passing 'char [1024]' to parameter of type
      'const unsigned char *' converts between pointers to integer types with
      different sign [-Wpointer-sign]
            romaji_load(obj->hira2kata, kata_dict);
                                        ^~~~~~~~~
src/romaji.h:24:54: note: passing argument to parameter 'filename' here
int romaji_load(romaji* object, const unsigned char* filename);
                                                     ^
src/migemo.c:257:32: warning: passing 'char [1024]' to parameter of type
      'const unsigned char *' converts between pointers to integer types with
      different sign [-Wpointer-sign]
            romaji_load(obj->han2zen, h2z_dict);
                                      ^~~~~~~~
src/romaji.h:24:54: note: passing argument to parameter 'filename' here
int romaji_load(romaji* object, const unsigned char* filename);
                                                     ^
src/migemo.c:258:32: warning: passing 'char [1024]' to parameter of type
      'const unsigned char *' converts between pointers to integer types with
      different sign [-Wpointer-sign]
            romaji_load(obj->zen2han, z2h_dict);
                                      ^~~~~~~~
src/romaji.h:24:54: note: passing argument to parameter 'filename' here
int romaji_load(romaji* object, const unsigned char* filename);
                                                     ^
src/migemo.c:376:27: warning: passing 'unsigned char *' to parameter of type
      'const char *' converts between pointers to integer types with different
      sign [-Wpointer-sign]
    if (!(len = my_strlen(query)))
                          ^~~~~
src/migemo.c:56:23: note: passing argument to parameter 's' here
my_strlen(const char* s)
                      ^
src/migemo.c:389:17: warning: passing 'const unsigned char [6]' to parameter of
      type 'const char *' converts between pointers to integer types with
      different sign [-Wpointer-sign]
    if (!strchr(VOWEL_CHARS, buf[len - 1]))
                ^~~~~~~~~~~
/usr/include/string.h:86:26: note: passing argument to parameter here
char    *strchr(const char *, int);
                            ^
src/migemo.c:391:29: warning: passing 'char *' to parameter of type
      'unsigned char *' converts between pointers to integer types with
      different sign [-Wpointer-sign]
        add_dubious_vowels(object, buf, len);
                                   ^~~
src/migemo.c:355:51: note: passing argument to parameter 'buf' here
add_dubious_vowels(migemo* object, unsigned char* buf, int index)
                                                  ^
src/migemo.c:393:24: warning: passing 'const unsigned char [6]' to parameter of
      type 'const char *' converts between pointers to integer types with
      different sign [-Wpointer-sign]
        if (len < 2 || strchr(VOWEL_CHARS, buf[len - 2]))
                              ^~~~~~~~~~~
/usr/include/string.h:86:26: note: passing argument to parameter here
char    *strchr(const char *, int);
                            ^
src/migemo.c:399:20: warning: passing 'char *' to parameter of type
      'unsigned char *' converts between pointers to integer types with
      different sign [-Wpointer-sign]
                add_roma(object, buf);
                                 ^~~
src/migemo.c:322:41: note: passing argument to parameter 'query' here
add_roma(migemo* object, unsigned char* query)
                                        ^
src/migemo.c:406:30: warning: passing 'char *' to parameter of type
      'unsigned char *' converts between pointers to integer types with
      different sign [-Wpointer-sign]
                add_dubious_vowels(object, buf, len + 3);
                                           ^~~
src/migemo.c:355:51: note: passing argument to parameter 'buf' here
add_dubious_vowels(migemo* object, unsigned char* buf, int index)
                                                  ^
src/migemo.c:466:25: warning: passing 'unsigned char *' to parameter of type
      'const char *' converts between pointers to integer types with different
      sign [-Wpointer-sign]
    int len = my_strlen(query);
                        ^~~~~
src/migemo.c:56:23: note: passing argument to parameter 's' here
my_strlen(const char* s)
                      ^
12 warnings generated.
cc -O2 -Wall  -fPIC -o build/object/mnode.o -c src/mnode.c
cc -O2 -Wall  -fPIC -o build/object/romaji.o -c src/romaji.c
src/romaji.c:208:33: warning: passing 'const unsigned char *' to parameter of
      type 'const char *' converts between pointers to integer types with
      different sign [-Wpointer-sign]
    unsigned char *out = STRDUP(string), *tmp;
                                ^~~~~~
/usr/include/string.h:127:26: note: passing argument to parameter here
char    *strdup(const char *);
                            ^
src/romaji.c:208:20: warning: initializing 'unsigned char *' with an expression
      of type 'char *' converts between pointers to integer types with different
      sign [-Wpointer-sign]
    unsigned char *out = STRDUP(string), *tmp;
                   ^     ~~~~~~~~~~~~~~
src/romaji.c:245:27: warning: passing 'const unsigned char *' to parameter of
      type 'const char *' converts between pointers to integer types with
      different sign [-Wpointer-sign]
    value_length = strlen(value);
                          ^~~~~
/usr/include/string.h:92:28: note: passing argument to parameter here
size_t   strlen(const char *);
                            ^
src/romaji.c:255:33: warning: passing 'const unsigned char *' to parameter of
      type 'const char *' converts between pointers to integer types with
      different sign [-Wpointer-sign]
    (*ref_node)->value = STRDUP(value);
                                ^~~~~
/usr/include/string.h:127:26: note: passing argument to parameter here
char    *strdup(const char *);
                            ^
src/romaji.c:255:24: warning: assigning to 'unsigned char *' from 'char *'
      converts between pointers to integer types with different sign
      [-Wpointer-sign]
    (*ref_node)->value = STRDUP(value);
                       ^ ~~~~~~~~~~~~~
src/romaji.c:259:17: warning: passing 'const unsigned char *' to parameter of
      type 'const char *' converts between pointers to integer types with
      different sign [-Wpointer-sign]
            && !strcmp(key, ROMAJI_FIXKEY_XN))
                       ^~~
/usr/include/string.h:87:25: note: passing argument to parameter here
int      strcmp(const char *, const char *);
                            ^
src/romaji.c:262:31: warning: passing 'const unsigned char *' to parameter of
      type 'const char *' converts between pointers to integer types with
      different sign [-Wpointer-sign]
        object->fixvalue_xn = STRDUP(value);
                                     ^~~~~
/usr/include/string.h:127:26: note: passing argument to parameter here
char    *strdup(const char *);
                            ^
src/romaji.c:262:22: warning: assigning to 'unsigned char *' from 'char *'
      converts between pointers to integer types with different sign
      [-Wpointer-sign]
        object->fixvalue_xn = STRDUP(value);
                            ^ ~~~~~~~~~~~~~
src/romaji.c:265:17: warning: passing 'const unsigned char *' to parameter of
      type 'const char *' converts between pointers to integer types with
      different sign [-Wpointer-sign]
            && !strcmp(key, ROMAJI_FIXKEY_XTU))
                       ^~~
/usr/include/string.h:87:25: note: passing argument to parameter here
int      strcmp(const char *, const char *);
                            ^
src/romaji.c:268:32: warning: passing 'const unsigned char *' to parameter of
      type 'const char *' converts between pointers to integer types with
      different sign [-Wpointer-sign]
        object->fixvalue_xtu = STRDUP(value);
                                      ^~~~~
/usr/include/string.h:127:26: note: passing argument to parameter here
char    *strdup(const char *);
                            ^
src/romaji.c:268:23: warning: assigning to 'unsigned char *' from 'char *'
      converts between pointers to integer types with different sign
      [-Wpointer-sign]
        object->fixvalue_xtu = STRDUP(value);
                             ^ ~~~~~~~~~~~~~
src/romaji.c:376:35: warning: passing 'const unsigned char *' to parameter of
      type 'const char *' converts between pointers to integer types with
      different sign [-Wpointer-sign]
    charset = charset_detect_file(filename);
                                  ^~~~~~~~
src/charset.h:35:37: note: passing argument to parameter 'path' here
int charset_detect_file(const char* path);
                                    ^
src/romaji.c:379:21: warning: passing 'const unsigned char *' to parameter of
      type 'const char *' converts between pointers to integer types with
      different sign [-Wpointer-sign]
    if ((fp = fopen(filename, "rt")) != NULL)
                    ^~~~~~~~
/usr/include/stdio.h:250:36: note: passing argument to parameter here
FILE    *fopen(const char * __restrict, const char * __restrict) ...
                                      ^
src/romaji.c:454:18: warning: passing 'unsigned char *' to parameter of type
      'const char *' converts between pointers to integer types with different
      sign [-Wpointer-sign]
        answer = STRDUP(WORDBUF_GET(buf));
                        ^~~~~~~~~~~~~~~~
src/wordbuf.h:23:24: note: expanded from macro 'WORDBUF_GET'
#define WORDBUF_GET(w) ((w)->buf)
                       ^~~~~~~~~~
/usr/include/string.h:127:26: note: passing argument to parameter here
char    *strdup(const char *);
                            ^
src/romaji.c:454:9: warning: assigning to 'unsigned char *' from 'char *'
      converts between pointers to integer types with different sign
      [-Wpointer-sign]
        answer = STRDUP(WORDBUF_GET(buf));
               ^ ~~~~~~~~~~~~~~~~~~~~~~~~
15 warnings generated.
cc -O2 -Wall  -fPIC -o build/object/rxgen.o -c src/rxgen.c
src/rxgen.c:156:9: warning: passing 'unsigned char [8]' to parameter of type
      'char *' converts between pointers to integer types with different sign
      [-Wpointer-sign]
        strcpy(object->op_or,           RXGEN_OP_OR);
        ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/secure/_string.h:88:30: note: expanded from macro 'strcpy'
   ? __builtin___strcpy_chk (dest, src, __darwin_obsz (dest))           \
                             ^
src/rxgen.c:156:9: warning: passing 'unsigned char [8]' to parameter of type
      'char *' converts between pointers to integer types with different sign
      [-Wpointer-sign]
        strcpy(object->op_or,           RXGEN_OP_OR);
        ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/secure/_string.h:89:27: note: expanded from macro 'strcpy'
   : __inline_strcpy_chk (dest, src))
                          ^
/usr/include/secure/_string.h:92:39: note: passing argument to parameter
      '__dest' here
__inline_strcpy_chk (char *__restrict __dest, const char *__restrict __src)
                                      ^
src/rxgen.c:157:9: warning: passing 'unsigned char [8]' to parameter of type
      'char *' converts between pointers to integer types with different sign
      [-Wpointer-sign]
        strcpy(object->op_nest_in,      RXGEN_OP_NEST_IN);
        ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/secure/_string.h:88:30: note: expanded from macro 'strcpy'
   ? __builtin___strcpy_chk (dest, src, __darwin_obsz (dest))           \
                             ^
src/rxgen.c:157:9: warning: passing 'unsigned char [8]' to parameter of type
      'char *' converts between pointers to integer types with different sign
      [-Wpointer-sign]
        strcpy(object->op_nest_in,      RXGEN_OP_NEST_IN);
        ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/secure/_string.h:89:27: note: expanded from macro 'strcpy'
   : __inline_strcpy_chk (dest, src))
                          ^
/usr/include/secure/_string.h:92:39: note: passing argument to parameter
      '__dest' here
__inline_strcpy_chk (char *__restrict __dest, const char *__restrict __src)
                                      ^
src/rxgen.c:158:9: warning: passing 'unsigned char [8]' to parameter of type
      'char *' converts between pointers to integer types with different sign
      [-Wpointer-sign]
        strcpy(object->op_nest_out,     RXGEN_OP_NEST_OUT);
        ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/secure/_string.h:88:30: note: expanded from macro 'strcpy'
   ? __builtin___strcpy_chk (dest, src, __darwin_obsz (dest))           \
                             ^
src/rxgen.c:158:9: warning: passing 'unsigned char [8]' to parameter of type
      'char *' converts between pointers to integer types with different sign
      [-Wpointer-sign]
        strcpy(object->op_nest_out,     RXGEN_OP_NEST_OUT);
        ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/secure/_string.h:89:27: note: expanded from macro 'strcpy'
   : __inline_strcpy_chk (dest, src))
                          ^
/usr/include/secure/_string.h:92:39: note: passing argument to parameter
      '__dest' here
__inline_strcpy_chk (char *__restrict __dest, const char *__restrict __src)
                                      ^
src/rxgen.c:159:9: warning: passing 'unsigned char [8]' to parameter of type
      'char *' converts between pointers to integer types with different sign
      [-Wpointer-sign]
        strcpy(object->op_select_in,    RXGEN_OP_SELECT_IN);
        ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/secure/_string.h:88:30: note: expanded from macro 'strcpy'
   ? __builtin___strcpy_chk (dest, src, __darwin_obsz (dest))           \
                             ^
src/rxgen.c:159:9: warning: passing 'unsigned char [8]' to parameter of type
      'char *' converts between pointers to integer types with different sign
      [-Wpointer-sign]
        strcpy(object->op_select_in,    RXGEN_OP_SELECT_IN);
        ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/secure/_string.h:89:27: note: expanded from macro 'strcpy'
   : __inline_strcpy_chk (dest, src))
                          ^
/usr/include/secure/_string.h:92:39: note: passing argument to parameter
      '__dest' here
__inline_strcpy_chk (char *__restrict __dest, const char *__restrict __src)
                                      ^
src/rxgen.c:160:9: warning: passing 'unsigned char [8]' to parameter of type
      'char *' converts between pointers to integer types with different sign
      [-Wpointer-sign]
        strcpy(object->op_select_out,   RXGEN_OP_SELECT_OUT);
        ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/secure/_string.h:88:30: note: expanded from macro 'strcpy'
   ? __builtin___strcpy_chk (dest, src, __darwin_obsz (dest))           \
                             ^
src/rxgen.c:160:9: warning: passing 'unsigned char [8]' to parameter of type
      'char *' converts between pointers to integer types with different sign
      [-Wpointer-sign]
        strcpy(object->op_select_out,   RXGEN_OP_SELECT_OUT);
        ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/secure/_string.h:89:27: note: expanded from macro 'strcpy'
   : __inline_strcpy_chk (dest, src))
                          ^
/usr/include/secure/_string.h:92:39: note: passing argument to parameter
      '__dest' here
__inline_strcpy_chk (char *__restrict __dest, const char *__restrict __src)
                                      ^
src/rxgen.c:161:9: warning: passing 'unsigned char [8]' to parameter of type
      'char *' converts between pointers to integer types with different sign
      [-Wpointer-sign]
        strcpy(object->op_newline,      RXGEN_OP_NEWLINE);
        ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/secure/_string.h:88:30: note: expanded from macro 'strcpy'
   ? __builtin___strcpy_chk (dest, src, __darwin_obsz (dest))           \
                             ^
src/rxgen.c:161:9: warning: passing 'unsigned char [8]' to parameter of type
      'char *' converts between pointers to integer types with different sign
      [-Wpointer-sign]
        strcpy(object->op_newline,      RXGEN_OP_NEWLINE);
        ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/secure/_string.h:89:27: note: expanded from macro 'strcpy'
   : __inline_strcpy_chk (dest, src))
                          ^
/usr/include/secure/_string.h:92:39: note: passing argument to parameter
      '__dest' here
__inline_strcpy_chk (char *__restrict __dest, const char *__restrict __src)
                                      ^
src/rxgen.c:322:18: warning: passing 'unsigned char *' to parameter of type
      'const char *' converts between pointers to integer types with different
      sign [-Wpointer-sign]
        answer = STRDUP(WORDBUF_GET(buf));
                        ^~~~~~~~~~~~~~~~
src/wordbuf.h:23:24: note: expanded from macro 'WORDBUF_GET'
#define WORDBUF_GET(w) ((w)->buf)
                       ^~~~~~~~~~
/usr/include/string.h:127:26: note: passing argument to parameter here
char    *strdup(const char *);
                            ^
src/rxgen.c:322:9: warning: assigning to 'unsigned char *' from 'char *'
      converts between pointers to integer types with different sign
      [-Wpointer-sign]
        answer = STRDUP(WORDBUF_GET(buf));
               ^ ~~~~~~~~~~~~~~~~~~~~~~~~
src/rxgen.c:383:16: warning: passing 'const unsigned char *' to parameter of
      type 'const char *' converts between pointers to integer types with
      different sign [-Wpointer-sign]
    if (strlen(op) >= RXGEN_OP_MAXLEN)
               ^~
/usr/include/string.h:92:28: note: passing argument to parameter here
size_t   strlen(const char *);
                            ^
src/rxgen.c:387:12: warning: passing 'unsigned char *' to parameter of type
      'char *' converts between pointers to integer types with different sign
      [-Wpointer-sign]
    strcpy(dest, op);
    ~~~~~~~^~~~~~~~~
/usr/include/secure/_string.h:88:30: note: expanded from macro 'strcpy'
   ? __builtin___strcpy_chk (dest, src, __darwin_obsz (dest))           \
                             ^
src/rxgen.c:387:18: warning: passing 'const unsigned char *' to parameter of
      type 'const char *' converts between pointers to integer types with
      different sign [-Wpointer-sign]
    strcpy(dest, op);
    ~~~~~~~~~~~~~^~~
/usr/include/secure/_string.h:88:36: note: expanded from macro 'strcpy'
   ? __builtin___strcpy_chk (dest, src, __darwin_obsz (dest))           \
                                   ^
src/rxgen.c:387:12: warning: passing 'unsigned char *' to parameter of type
      'char *' converts between pointers to integer types with different sign
      [-Wpointer-sign]
    strcpy(dest, op);
    ~~~~~~~^~~~~~~~~
/usr/include/secure/_string.h:89:27: note: expanded from macro 'strcpy'
   : __inline_strcpy_chk (dest, src))
                          ^
/usr/include/secure/_string.h:92:39: note: passing argument to parameter
      '__dest' here
__inline_strcpy_chk (char *__restrict __dest, const char *__restrict __src)
                                      ^
src/rxgen.c:387:18: warning: passing 'const unsigned char *' to parameter of
      type 'const char *' converts between pointers to integer types with
      different sign [-Wpointer-sign]
    strcpy(dest, op);
    ~~~~~~~~~~~~~^~~
/usr/include/secure/_string.h:89:33: note: expanded from macro 'strcpy'
   : __inline_strcpy_chk (dest, src))
                                ^
/usr/include/secure/_string.h:92:70: note: passing argument to parameter '__src'
      here
__inline_strcpy_chk (char *__restrict __dest, const char *__restrict __src)
                                                                     ^
19 warnings generated.
cc -O2 -Wall  -fPIC -o build/object/wordbuf.o -c src/wordbuf.c
src/wordbuf.c:118:27: warning: passing 'const unsigned char *' to parameter of
      type 'const char *' converts between pointers to integer types with
      different sign [-Wpointer-sign]
        size_t l = strlen(sz);
                          ^~
/usr/include/string.h:92:28: note: passing argument to parameter here
size_t   strlen(const char *);
                            ^
1 warning generated.
cc -O2 -Wall  -fPIC -o build/object/wordlist.o -c src/wordlist.c
src/wordlist.c:27:14: warning: assigning to 'unsigned char *' from 'char *'
      converts between pointers to integer types with different sign
      [-Wpointer-sign]
            p->ptr  = (char*)(p + 1);
                    ^ ~~~~~~~~~~~~~~
src/wordlist.c:51:22: warning: passing 'const unsigned char *' to parameter of
      type 'const char *' converts between pointers to integer types with
      different sign [-Wpointer-sign]
        len = strlen(ptr);
                     ^~~
/usr/include/string.h:92:28: note: passing argument to parameter here
size_t   strlen(const char *);
                            ^
2 warnings generated.
cc -dynamiclib -install_name libmigemo.1.dylib -o libmigemo.1.1.0.dylib ./build/object/charset.o ./build/object/filename.o ./build/object/migemo.o ./build/object/mnode.o ./build/object/romaji.o ./build/object/rxgen.o ./build/object/wordbuf.o ./build/object/wordlist.o
rm -f libmigemo.1.dylib libmigemo.dylib
ln -s libmigemo.1.1.0.dylib libmigemo.1.dylib
ln -s libmigemo.1.1.0.dylib libmigemo.dylib
cc -o build/cmigemo ./build/object/main.o -L. -L./build/ -lmigemo 

warningがでましたが、動作は問題ありませんでした。(たぶん)

辞書ファイルのビルド


「辞書ファイルのビルド」には別途以下の4種が必要になります。

  1. . Perl
  2. . インターネットアクセスプログラム(cURL, wget, fetchの内どれか1つ)
  3. . 解凍伸長プログラムgzip
  4. . エンコード変換プログラム(nkf, qkc)

macならperlはデフォルトでバンドルされているので他のライブラリが無い場合はインストールして下さい。
自分の環境だとすべて入っていました。ちなみにHomebrewを使ってます。

$ make osx-dict
make -f compile/Make_osx.mak dictionary
cd dict && make osx
curl -O http://openlab.ring.gr.jp/skk/dic/SKK-JISYO.L.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1733k  100 1733k    0     0   447k      0  0:00:03  0:00:03 --:--:--  473k
gzip -d SKK-JISYO.L.gz
perl ../tools/skk2migemo.pl < SKK-JISYO.L > dict.tmp
perl ../tools/optimize-dict.pl < dict.tmp > base-dict
rm -f dict.tmp
nkf -x -s < base-dict > migemo-dict
mkdir -p euc-jp.d
nkf -x -e < migemo-dict > euc-jp.d/migemo-dict
nkf -x -e < zen2han.dat > euc-jp.d/zen2han.dat
nkf -x -e < han2zen.dat > euc-jp.d/han2zen.dat
nkf -x -e < hira2kata.dat > euc-jp.d/hira2kata.dat
nkf -x -e < roma2hira.dat > euc-jp.d/roma2hira.dat
mkdir -p utf-8.d
iconv -t utf-8 -f cp932 < migemo-dict > utf-8.d/migemo-dict
iconv -t utf-8 -f cp932 < zen2han.dat > utf-8.d/zen2han.dat
iconv -t utf-8 -f cp932 < han2zen.dat > utf-8.d/han2zen.dat
iconv -t utf-8 -f cp932 < hira2kata.dat > utf-8.d/hira2kata.dat
iconv -t utf-8 -f cp932 < roma2hira.dat > utf-8.d/roma2hira.dat

ここで、ドキュメントをみると

必要な外部プログラム、ネットワーク接続を揃えて以下を実行することでテストプログラムcmigemoと辞書ファイルがビルドされます

と、あります。

ドキュメントには
  cp932(Shift-JIS)で利用するならば:
    $ ./build/cmigemo -d dict/migemo-dict
  euc-jpで利用するならば:
    $ ./build/cmigemo -d dict/euc-jp.d/migemo-dict
  を実行します。
  euc-jpで利用するならば:
    $ ./build/cmigemo -d dict/utf-8.d/migemo-dict
  を実行します。

とあります。(utf-8の部分は僕が追記しました。ドキュメントにはありません。)
これを実行してみると

$ ./build/cmigemo -d dict/utf-8.d/migemo-dict 
migemo_open("dict/utf-8.d/migemo-dict")=0x7ff1f0403bd0
clock()=0.271006
QUERY: i-makkusu #ここで入力待ちになる
PATTERN: (イーマックス|イーマックス|いーまっくす|i−makkusu|i-makkusu)

上記のようになり入力待ち状態になるので実際検索するものを英字で入力すると実際に結果が返ってきます。
ご自分の文字コードの環境で意図するどうさを確認されてはいかがでしょうか?

インストール


root権限でインストール

$ sudo make osx-install

アンインストールは

$ sudo make osx-uninstall

です。
これで、cmigemoのビルド+インストールは完了。続いて、Emacsインクリメンタルサーチができるように設定。
migemo.elを https://gist.github.com/457761 からダウンロード。

$ cd ~/.emacs.d/
$ mkdir migemo
$ cd migemo
$ curl -L -o migemo.el https://raw.github.com/gist/457761/539882a79ec11bc9b6e1ac417cdafe0e198e245f/migemo.el

~/.emacs.d/init.elに設定を書く。

(setq load-path (cons "~/.emacs.d/migemo/" load-path))
(require 'migemo)
(setq migemo-command "/usr/local/bin/cmigemo")
(setq migemo-options '("-q" "--emacs"))
(setq migemo-dictionary "/usr/local/share/migemo/utf-8/migemo-dict")
(setq migemo-user-dictionary nil)
(setq migemo-coding-system 'utf-8-unix)
(setq migemo-regex-dictionary nil)
(load-library "migemo")
(migemo-init)

これでcmigemoが使えるようになりました。

使ってみる


emacsでC-sをするとcmigemoが使えるようになります。


すばらしいXD

まとめ


emacsでのローマ字によるインクリメンタルサーチが使えるようになりました。
以前ubuntuでインストールしたときは、たしかgooglecodeから落としてきましたが今回はgithubから行いました。
githubかわいいよgithub

最後まで、お読みいただきありがとうございました。