(linenum→info "unix/slp.c:2238")

anthy/9100e/anthy/xstr.h

    1: /*
    2:  * Anthy内部で使う文字列
    3:  * 特に実装を隠蔽しようとしているわけでは無いので、
    4:  * ここにある関数の使用は強制しない。
    5:  */
    6: #ifndef _xstr_h_included_
    7: #define _xstr_h_included_
    8: 
    9: /** 文字型
   10:  * UCS4が入っている */
   11: typedef int xchar;
   12: 
   13: /** 文字列
   14:  * xstrにtypedefされている
   15:  */
   16: typedef struct xstr_ {
   17:   /** 文字列へのポインタ */
   18:   xchar *str;
   19:   /** xcharの数 */
   20:   int len;
   21: } xstr;
   22: 
   23: /* デバッグ用の出力関数 */
   24: void anthy_putxchar(xchar );
   25: void anthy_putxstr(xstr *);
   26: void anthy_putxstrln(xstr *);
   27: 
   28: /* Cの文字列への書き出し */
   29: int anthy_sputxchar(char *, xchar , int encoding);
   30: int anthy_sputxstr(char *, xstr *, int encoding);
   31: int anthy_snputxstr(char *, int , xstr *, int encoding);
   32: 
   33: /* xstrとstr共にmallocされる、freeで両方解放するかanthy_free_xstrで解放する */
   34: xstr *anthy_cstr_to_xstr(const char *, int );
   35: /* 結果はmallocで確保される */
   36: char *anthy_xstr_to_cstr(xstr *, int);
   37: 
   38: /* xstrとstr共にmallocされる */
   39: xstr *anthy_xstr_dup(xstr *);
   40: void anthy_free_xstr(xstr *);
   41: 
   42: /* 結果はmallocで確保される */
   43: xchar *anthy_xstr_dup_str(xstr *);
   44: void anthy_free_xstr_str(xstr *);
   45: 
   46: /* 文字列をコピーする */
   47: xstr* anthy_xstrcpy(xstr *, xstr *);
   48: /* 文字列を比較する。strcmpと同等の動作(返り値の符号に意味がある) */
   49: int anthy_xstrcmp(xstr *, xstr *);
   50: /* n文字目まで文字列を比較する。strncmpと同等の動作(返り値の符号に意味がある) */
   51: int anthy_xstrncmp(xstr *, xstr *, int);
   52: /* s->strをreallocする */
   53: xstr *anthy_xstrcat(xstr *s, xstr *d);
   54: /* xs->strをreallocする */
   55: xstr *anthy_xstrappend(xstr *xs, xchar c);
   56: 
   57: /* strtollのxstr版 */
   58: long long anthy_xstrtoll(xstr *);
   59: /* 全角数字から半角数字への変換 */
   60: xstr *anthy_xstr_wide_num_to_num(xstr *);
   61: /* ひらがなからカタカナへの変換 */
   62: xstr *anthy_xstr_hira_to_kata(xstr *);
   63: /**/
   64: xstr *anthy_xstr_hira_to_half_kata(xstr *);
   65: xstr *anthy_conv_half_wide(xstr *xs);
   66: 
   67: /*  xcharの型 */
   68: #define XCT_ALL 0xffffffff
   69: #define XCT_NONE 0
   70: #define XCT_HIRA 1
   71: #define XCT_KATA 2
   72: #define XCT_ASCII 4
   73: #define XCT_NUM 8
   74: #define XCT_WIDENUM 16
   75: #define XCT_OPEN 32
   76: #define XCT_CLOSE 64
   77: /* 直前の文字の一部 */
   78: #define XCT_PART 128
   79: /* 助詞 */
   80: #define XCT_DEP 256
   81: /* 記号 */
   82: #define XCT_SYMBOL 1024
   83: /* 漢字 */
   84: #define XCT_KANJI 2048
   85: /* 句読点 */
   86: #define XCT_PUNCTUATION 4096
   87: 
   88: /** XCT_*が返ってくる */
   89: int anthy_get_xchar_type(const xchar );
   90: /** 全ての文字に対してXCT_*の論理積をとったもの */
   91: int anthy_get_xstr_type(const xstr *);
   92: 
   93: /* hash */
   94: int anthy_xstr_hash(xstr *);
   95: 
   96: /* xstr.c */
   97: int anthy_init_xstr(void);
   98: void anthy_quit_xstr(void);
   99: void anthy_xstr_set_print_encoding(int );
  100: 
  101: int anthy_euc_to_ucs(int ec);
  102: int anthy_ucs_to_euc(int uc);
  103: 
  104: const char *anthy_utf8_to_ucs4_xchar(const char *s, xchar *res);
  105: /**/
  106: char *anthy_conv_euc_to_utf8(const char *s);
  107: char *anthy_conv_utf8_to_euc(const char *s);
  108: 
  109: #endif
Syntax (Markdown)