Senna バインディングを拡張してみた

php_senna-0.0.4devel.tgz
アドバンスト API もできましたー。作っただけでほとんどテストできてないです。危険かも。
sen_sym を使う関数は low level API が絡むので、コールバック関数を指定する関数/オプションは面倒くさいので実装してません。
あとちょっとアレンジ入ってます。sen_query_exec() が OO-API では SenIndex::exec() になってたり、一部の引数や返り値が変わってたり。

% php -dextension=senna.so --re senna
Extension [ <persistent> extension #50 senna version 0.0.4 (devel) ] {
  - Constants [35] {
    Constant [ integer SEN_INDEX_NORMALIZE ] { 1 }
    Constant [ integer SEN_INDEX_SPLIT_ALPHA ] { 2 }
    Constant [ integer SEN_INDEX_SPLIT_DIGIT ] { 4 }
    Constant [ integer SEN_INDEX_SPLIT_SYMBOL ] { 8 }
    Constant [ integer SEN_INDEX_MORPH_ANALYSE ] { 0 }
    Constant [ integer SEN_INDEX_NGRAM ] { 16 }
    Constant [ integer SEN_INDEX_DELIMITED ] { 32 }
    Constant [ integer SEN_INDEX_ENABLE_SUFFIX_SEARCH ] { 256 }
    Constant [ integer SEN_INDEX_DISABLE_SUFFIX_SEARCH ] { 512 }
    Constant [ integer SEN_INDEX_WITH_VGRAM ] { 4096 }
    Constant [ integer SEN_INDEX_WITH_VACUUM ] { 32768 }
    Constant [ integer SEN_ENC_DEFAULT ] { 0 }
    Constant [ integer SEN_ENC_NONE ] { 1 }
    Constant [ integer SEN_ENC_EUCJP ] { 2 }
    Constant [ integer SEN_ENC_UTF8 ] { 3 }
    Constant [ integer SEN_ENC_SJIS ] { 4 }
    Constant [ integer SEN_ENC_LATIN1 ] { 5 }
    Constant [ integer SEN_ENC_KOI8R ] { 6 }
    Constant [ integer SEN_REC_DOCUMENT ] { 0 }
    Constant [ integer SEN_REC_SECTION ] { 1 }
    Constant [ integer SEN_REC_POSITION ] { 2 }
    Constant [ integer SEN_REC_USERDEF ] { 3 }
    Constant [ integer SEN_REC_NONE ] { 4 }
    Constant [ integer SEN_SEL_OP_OR ] { 0 }
    Constant [ integer SEN_SEL_OP_AND ] { 1 }
    Constant [ integer SEN_SEL_OP_BUT ] { 2 }
    Constant [ integer SEN_SEL_OP_ADJUST ] { 3 }
    Constant [ integer SEN_SEL_MODE_EXACT ] { 0 }
    Constant [ integer SEN_SEL_MODE_PARTIAL ] { 1 }
    Constant [ integer SEN_SEL_MODE_UNSPLIT ] { 2 }
    Constant [ integer SEN_SEL_MODE_NEAR ] { 3 }
    Constant [ integer SEN_SEL_MODE_SIMILAR ] { 4 }
    Constant [ integer SEN_SEL_MODE_TERM_EXTRACT ] { 5 }
    Constant [ integer SEN_SORT_DESCENDING ] { 0 }
    Constant [ integer SEN_SORT_ASCENDING ] { 1 }
  }
  - Functions {
    Function [ <internal> public function sen_info ] {}
    Function [ <internal> public function sen_index_create ] {}
    Function [ <internal> public function sen_index_open ] {}
    Function [ <internal> public function sen_index_close ] {}
    Function [ <internal> public function sen_index_remove ] {}
    Function [ <internal> public function sen_index_rename ] {}
    Function [ <internal> public function sen_index_upd ] {}
    Function [ <internal> public function sen_index_sel ] {}
    Function [ <internal> public function sen_index_update ] {}
    Function [ <internal> public function sen_index_select ] {}
    Function [ <internal> public function sen_index_info ] {}
    Function [ <internal> public function sen_index_path ] {}
    Function [ <internal> public function sen_index_del ] {}
    Function [ <internal> public function sen_records_next ] {}
    Function [ <internal> public function sen_records_rewind ] {}
    Function [ <internal> public function sen_records_curr_score ] {}
    Function [ <internal> public function sen_records_curr_key ] {}
    Function [ <internal> public function sen_records_nhits ] {}
    Function [ <internal> public function sen_records_find ] {}
    Function [ <internal> public function sen_records_close ] {}
    Function [ <internal> public function sen_records_open ] {}
    Function [ <internal> public function sen_records_union ] {}
    Function [ <internal> public function sen_records_subtract ] {}
    Function [ <internal> public function sen_records_intersect ] {}
    Function [ <internal> public function sen_records_difference ] {}
    Function [ <internal> public function sen_records_sort ] {}
    Function [ <internal> public function sen_records_group ] {}
    Function [ <internal> public function sen_record_info ] {}
    Function [ <internal> public function sen_record_subrec_info ] {}
    Function [ <internal> public function sen_values_open ] {}
    Function [ <internal> public function sen_values_close ] {}
    Function [ <internal> public function sen_values_add ] {}
    Function [ <internal> public function sen_query_open ] {}
    Function [ <internal> public function sen_query_close ] {}
    Function [ <internal> public function sen_query_exec ] {}
  }
  - Classes [6] {
    Class [ <internal:senna> class SenIndex ] {
      - Constants [0] {}
      - Static properties [0] {}
      - Static methods [3] {
        Method [ <internal> static public method create ] {}
        Method [ <internal> static public method remove ] {}
        Method [ <internal> static public method rename ] {}
      }
      - Properties [0] {}
      - Methods [9] {
        Method [ <internal, ctor> public method __construct ] {}
        Method [ <internal> public method upd ] {}
        Method [ <internal> public method sel ] {}
        Method [ <internal> public method update ] {}
        Method [ <internal> public method select ] {}
        Method [ <internal> public method info ] {}
        Method [ <internal> public method path ] {}
        Method [ <internal> public method del ] {}
        Method [ <internal> public method exec ] {}
      }
    }
    Class [ <internal:senna> <iterateable> class SenRecords implements IteratorAggregate, Traversable, Countable ] {
      - Constants [0] {}
      - Static properties [0] {}
      - Static methods [4] {
        Method [ <internal> static public method union ] {}
        Method [ <internal> static public method subtract ] {}
        Method [ <internal> static public method intersect ] {}
        Method [ <internal> static public method difference ] {}
      }
      - Properties [0] {}
      - Methods [13] {
        Method [ <internal, prototype IteratorAggregate> public method getIterator ] {}
        Method [ <internal, prototype Countable> public method count ] {}
        Method [ <internal> public method next ] {}
        Method [ <internal> public method rewind ] {}
        Method [ <internal> public method score ] {}
        Method [ <internal> public method key ] {}
        Method [ <internal> public method nhits ] {}
        Method [ <internal> public method find ] {}
        Method [ <internal, ctor> public method __construct ] {}
        Method [ <internal> public method sort ] {}
        Method [ <internal> public method group ] {}
        Method [ <internal> public method info ] {}
        Method [ <internal> public method subrecInfo ] {}
      }
    }
    Class [ <internal:senna> <iterateable> class SenRecordsIterator implements Iterator, Traversable ] {
      - Constants [0] {}
      - Static properties [0] {}
      - Static methods [0] {}
      - Properties [0] {}
      - Methods [6] {
        Method [ <internal, ctor> private method __construct ] {}
        Method [ <internal, prototype Iterator> public method current ] {}
        Method [ <internal, prototype Iterator> public method key ] {}
        Method [ <internal, prototype Iterator> public method next ] {}
        Method [ <internal, prototype Iterator> public method rewind ] {}
        Method [ <internal, prototype Iterator> public method valid ] {}
      }
    }
    Class [ <internal:senna> class SenValues ] {
      - Constants [0] {}
      - Static properties [0] {}
      - Static methods [0] {}
      - Properties [0] {}
      - Methods [2] {
        Method [ <internal, ctor> public method __construct ] {}
        Method [ <internal> public method add ] {}
      }
    }
    Class [ <internal:senna> class SenQuery ] {
      - Constants [0] {}
      - Static properties [0] {}
      - Static methods [0] {}
      - Properties [0] {}
      - Methods [1] {
        Method [ <internal, ctor> public method __construct ] {}
      }
    }
    Class [ <internal:senna> class SenException extends Exception ] {
      - Constants [0] {}
      - Static properties [0] {}
      - Static methods [0] {}
      - Properties [4] {
        Property [ <default> protected $message ]
        Property [ <default> protected $code ]
        Property [ <default> protected $file ]
        Property [ <default> protected $line ]
      }
      - Methods [9] {
        Method [ <internal, inherits Exception> final private method __clone ] {}
        Method [ <internal, inherits Exception, ctor> public method __construct ] {
          - Parameters [2] {
            Parameter #0 [ <optional> $message ]
            Parameter #1 [ <optional> $code ]
          }
        }
        Method [ <internal, inherits Exception> final public method getMessage ] {}
        Method [ <internal, inherits Exception> final public method getCode ] {}
        Method [ <internal, inherits Exception> final public method getFile ] {}
        Method [ <internal, inherits Exception> final public method getLine ] {}
        Method [ <internal, inherits Exception> final public method getTrace ] {}
        Method [ <internal, inherits Exception> final public method getTraceAsString ] {}
        Method [ <internal, inherits Exception> public method __toString ] {}
      }
    }
  }
}