C言語用正規表現ライブラリ oniguruma を Visual C++
2005ExpressEditionでビルド&インスコする方法を説明します。
ちなみにオレは V3.9.1 をダウンロードしました。
oniguruma のソースを取得
上記サイトより、Latest releaseversionをダウンロードして展開する。ちなみにオレは V3.9.1 をダウンロードしました。
oniguruma をスレッドセーフになるように設定する
やる気向上作戦:OnigPPを参考にしつつ以下のように設定する。regint.h
$ diff -c regint.h regint.h.orig *** regint.h Thu Jan 12 23:59:32 2006 --- regint.h.orig Thu Jan 12 23:47:07 2006 *************** *** 84,99 **** #define USE_VARIABLE_META_CHARS #define USE_WORD_BEGIN_END /* "\<": word-begin, "\>": word-end */ #define USE_POSIX_REGION_OPTION /* needed for POSIX API support */ ! // オレ様変更 ! // マルチスレッド対応化 ! // 詳しくは doc/FAQ.ja をご覧あれ ! #include ! #define USE_MULTI_THREAD_SYSTEM ! extern CRITICAL_SECTION gOnigMutex; ! #define THREAD_ATOMIC_START EnterCriticalSection(&gOnigMutex) ! #define THREAD_ATOMIC_END LeaveCriticalSection(&gOnigMutex) ! #define THREAD_PASS Sleep(0) ! // /オレ様変更 #define CHECK_INTERRUPT /* depend on application */ #define xmalloc malloc #define xrealloc realloc --- 84,93 ---- #define USE_VARIABLE_META_CHARS #define USE_WORD_BEGIN_END /* "\<": word-begin, "\>": word-end */ #define USE_POSIX_REGION_OPTION /* needed for POSIX API support */ ! /* #define USE_MULTI_THREAD_SYSTEM */ ! #define THREAD_ATOMIC_START /* depend on thread system */ ! #define THREAD_ATOMIC_END /* depend on thread system */ ! #define THREAD_PASS /* depend on thread system */ #define CHECK_INTERRUPT /* depend on application */ #define xmalloc malloc #define xrealloc realloc
regcomp.c
$ diff -c regcomp.c regcomp.c.orig *** regcomp.c Thu Jan 12 23:50:48 2006 --- regcomp.c.orig Mon Nov 21 21:16:36 2005 *************** *** 29,36 **** #include "regparse.h" - CRITICAL_SECTION gOnigMutex; //これ追