メインページ | モジュール | データ構造 | Directories | ファイル一覧 | データフィールド | グローバル | 関連ページ

charconv_libjcode.c

説明を見る。
00001 
00024 /*
00025  * Copyright (c) 1991-2006 Kawahara Lab., Kyoto University
00026  * Copyright (c) 2000-2005 Shikano Lab., Nara Institute of Science and Technology
00027  * Copyright (c) 2005-2006 Julius project team, Nagoya Institute of Technology, Nagoya Institute of Technology
00028  * All rights reserved
00029  */
00030 
00031 #include <sent/stddefs.h>
00032 
00033 #ifdef CHARACTER_CONVERSION
00034 #ifdef USE_LIBJCODE
00035 
00036 #include <jlib.h>
00037 static int convert_to = SJIS; 
00038 
00048 boolean
00049 charconv_libjcode_setup(char *fromcode, char *tocode, boolean *enable_conv)
00050 {
00051   if (tocode == NULL) {
00052     /* disable conversion */
00053     *enable_conv = FALSE;
00054   } else {
00055     if (strmatch(tocode, "sjis")
00056         || strmatch(tocode, "sjis-win")
00057         || strmatch(tocode, "shift-jis")
00058         || strmatch(tocode, "shift_jis")) {
00059       convert_to = SJIS;
00060     } else if (strmatch(tocode, "euc-jp")
00061                || strmatch(tocode, "euc")
00062                || strmatch(tocode, "eucjp")) {
00063       convert_to = EUC;
00064     } else if (strmatch(tocode, "jis")) {
00065       convert_to = JIS;
00066     } else {
00067       j_printerr("Error: character set \"%s\" not supported\n", tocode);
00068       j_printerr("Error: only \"sjis\", \"euc-jp\" and \"jis\" can be used with libjcode.\n");
00069       *enable_conv = FALSE;
00070       return FALSE;
00071     }
00072     *enable_conv = TRUE;
00073   }
00074   return TRUE;
00075 }
00076 
00087 char *
00088 charconv_libjcode(char *instr, char *outstr, int maxoutlen)
00089 {
00090   switch(convert_to) {
00091   case SJIS:
00092     toStringSJIS(instr, outstr, maxoutlen);
00093     break;
00094   case EUC:
00095     toStringEUC(instr, outstr, maxoutlen);
00096     break;
00097   case JIS:
00098     toStringJIS(instr, outstr, maxoutlen);
00099     break;
00100   }
00101   return(outstr);
00102 }
00103 
00104 #endif /* USE_LIBJCODE */
00105 #endif /* CHARACTER_CONVERSION */

Juliusに対してTue Mar 28 16:20:50 2006に生成されました。  doxygen 1.4.2