| 1 | /* $Id$ |
|---|
| 2 | * |
|---|
| 3 | * Copyright (c) 2005-2007 Daisuke Maki <daisuke@endeworks.jp> |
|---|
| 4 | * All rights reserved. |
|---|
| 5 | */ |
|---|
| 6 | #include "senna-perl.h" |
|---|
| 7 | |
|---|
| 8 | MODULE = Senna PACKAGE = Senna PREFIX = SennaPerl_Global_ |
|---|
| 9 | |
|---|
| 10 | PROTOTYPES: DISABLE |
|---|
| 11 | |
|---|
| 12 | BOOT: |
|---|
| 13 | SennaPerl_Global_bootstrap(); |
|---|
| 14 | |
|---|
| 15 | SV * |
|---|
| 16 | SennaPerl_Global_XS_cleanup() |
|---|
| 17 | CODE: |
|---|
| 18 | sen_fin(); |
|---|
| 19 | |
|---|
| 20 | HV * |
|---|
| 21 | SennaPerl_Global_info() |
|---|
| 22 | |
|---|
| 23 | |
|---|
| 24 | MODULE = Senna PACKAGE = Senna::Index PREFIX = SennaPerl_Index_ |
|---|
| 25 | |
|---|
| 26 | PROTOTYPES: DISABLE |
|---|
| 27 | |
|---|
| 28 | SV * |
|---|
| 29 | SennaPerl_Index_XS_create(pkg, path, key_size = SEN_VARCHAR_KEY, flags = 0, initial_n_segments = 0, encoding = sen_enc_default) |
|---|
| 30 | char *pkg; |
|---|
| 31 | char *path; |
|---|
| 32 | int key_size; |
|---|
| 33 | int flags; |
|---|
| 34 | int initial_n_segments; |
|---|
| 35 | sen_encoding encoding; |
|---|
| 36 | |
|---|
| 37 | SV * |
|---|
| 38 | SennaPerl_Index_XS_open(pkg, path) |
|---|
| 39 | char *pkg; |
|---|
| 40 | char *path; |
|---|
| 41 | |
|---|
| 42 | void |
|---|
| 43 | SennaPerl_Index_XS_info(self) |
|---|
| 44 | SV *self; |
|---|
| 45 | PREINIT: |
|---|
| 46 | sen_index *index; |
|---|
| 47 | int key_size; |
|---|
| 48 | int flags; |
|---|
| 49 | int initial_n_segments; |
|---|
| 50 | sen_encoding encoding; |
|---|
| 51 | unsigned int nrecords_keys; |
|---|
| 52 | unsigned int file_size_keys; |
|---|
| 53 | unsigned int nrecords_lexicon; |
|---|
| 54 | unsigned int file_size_lexicon; |
|---|
| 55 | unsigned int inv_seg_size; |
|---|
| 56 | unsigned int inv_chunk_size; |
|---|
| 57 | sen_rc rc; |
|---|
| 58 | PPCODE: |
|---|
| 59 | index = XS_STATE(sen_index *, self); |
|---|
| 60 | rc = sen_index_info(index, |
|---|
| 61 | &key_size, &flags, &initial_n_segments, &encoding, |
|---|
| 62 | &nrecords_keys, &file_size_keys, &nrecords_lexicon, |
|---|
| 63 | &file_size_lexicon, &inv_seg_size, &inv_chunk_size |
|---|
| 64 | ); |
|---|
| 65 | |
|---|
| 66 | if (rc != sen_success) |
|---|
| 67 | croak("Failed to call sen_index_info: %d", rc); |
|---|
| 68 | |
|---|
| 69 | EXTEND(SP, 10); |
|---|
| 70 | mPUSHi(key_size); |
|---|
| 71 | mPUSHi(flags); |
|---|
| 72 | mPUSHi(initial_n_segments); |
|---|
| 73 | mPUSHi(encoding); |
|---|
| 74 | mPUSHi(nrecords_keys); |
|---|
| 75 | mPUSHi(file_size_keys); |
|---|
| 76 | mPUSHi(nrecords_lexicon); |
|---|
| 77 | mPUSHi(file_size_lexicon); |
|---|
| 78 | mPUSHi(inv_seg_size); |
|---|
| 79 | mPUSHi(inv_chunk_size); |
|---|
| 80 | |
|---|
| 81 | SV * |
|---|
| 82 | SennaPerl_Index_path(self) |
|---|
| 83 | SV *self; |
|---|
| 84 | |
|---|
| 85 | SV * |
|---|
| 86 | SennaPerl_Index_remove(self) |
|---|
| 87 | SV *self; |
|---|
| 88 | |
|---|
| 89 | SV * |
|---|
| 90 | SennaPerl_Index_close(self) |
|---|
| 91 | SV *self; |
|---|
| 92 | |
|---|
| 93 | SV * |
|---|
| 94 | SennaPerl_Index_update(self, key, oldvalue, newvalue) |
|---|
| 95 | SV *self; |
|---|
| 96 | SV *key; |
|---|
| 97 | SV *oldvalue; |
|---|
| 98 | SV *newvalue; |
|---|
| 99 | |
|---|
| 100 | SV * |
|---|
| 101 | SennaPerl_Index_insert(self, key, newvalue) |
|---|
| 102 | SV *self; |
|---|
| 103 | SV *key; |
|---|
| 104 | SV *newvalue; |
|---|
| 105 | |
|---|
| 106 | SV * |
|---|
| 107 | SennaPerl_Index_DESTROY(self) |
|---|
| 108 | SV *self; |
|---|
| 109 | |
|---|
| 110 | MODULE = Senna PACKAGE = Senna::Encoding PREFIX = SennaPerl_Encoding_ |
|---|
| 111 | |
|---|
| 112 | PROTOTYPES: DISABLE |
|---|
| 113 | |
|---|
| 114 | SV * |
|---|
| 115 | SennaPerl_Encoding_enc2str(enc) |
|---|
| 116 | sen_encoding enc; |
|---|
| 117 | CODE: |
|---|
| 118 | RETVAL = SennaPerl_Encoding_XS_enc2str(enc); |
|---|
| 119 | OUTPUT: |
|---|
| 120 | RETVAL |
|---|
| 121 | |
|---|