root/lang/perl/Senna/trunk/lib/Senna.xs @ 3767

Revision 3767, 2.6 kB (checked in by daisuke, 6 years ago)

Initial commit for incomplete Senna rewrite. It's incomplete.
Did I say it was incomplete?

Line 
1/* $Id$
2 *
3 * Copyright (c) 2005-2007 Daisuke Maki <daisuke@endeworks.jp>
4 * All rights reserved.
5 */
6#include "senna-perl.h"
7
8MODULE = Senna    PACKAGE = Senna  PREFIX = SennaPerl_Global_
9
10PROTOTYPES: DISABLE
11
12BOOT:
13    SennaPerl_Global_bootstrap();
14
15SV *
16SennaPerl_Global_XS_cleanup()
17    CODE:
18        sen_fin();
19
20HV *
21SennaPerl_Global_info()
22
23
24MODULE = Senna    PACKAGE = Senna::Index   PREFIX = SennaPerl_Index_
25
26PROTOTYPES: DISABLE
27
28SV *
29SennaPerl_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
37SV *
38SennaPerl_Index_XS_open(pkg, path)
39        char *pkg;
40        char *path;
41
42void
43SennaPerl_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
81SV *
82SennaPerl_Index_path(self)
83        SV *self;
84
85SV *
86SennaPerl_Index_remove(self)
87        SV *self;
88
89SV *
90SennaPerl_Index_close(self)
91        SV *self;
92
93SV *
94SennaPerl_Index_update(self, key, oldvalue, newvalue)
95        SV *self;
96        SV *key;
97        SV *oldvalue;
98        SV *newvalue;
99
100SV *
101SennaPerl_Index_insert(self, key, newvalue)
102        SV *self;
103        SV *key;
104        SV *newvalue;
105
106SV *
107SennaPerl_Index_DESTROY(self)
108        SV *self;
109
110MODULE = Senna     PACKAGE = Senna::Encoding    PREFIX = SennaPerl_Encoding_
111
112PROTOTYPES: DISABLE
113
114SV *
115SennaPerl_Encoding_enc2str(enc)
116        sen_encoding enc;
117    CODE:
118        RETVAL = SennaPerl_Encoding_XS_enc2str(enc);
119    OUTPUT:
120        RETVAL
121
Note: See TracBrowser for help on using the browser.