1# This file was automatically generated by SWIG (http://www.swig.org).
2# Version 1.3.40
3#
4# Do not make changes to this file unless you know what you are doing--modify
5# the SWIG interface file instead.
6
7package marisa;
8use base qw(Exporter);
9use base qw(DynaLoader);
10package marisac;
11bootstrap marisa;
12package marisa;
13@EXPORT = qw();
14
15# ---------- BASE METHODS -------------
16
17package marisa;
18
19sub TIEHASH {
20    my ($classname,$obj) = @_;
21    return bless $obj, $classname;
22}
23
24sub CLEAR { }
25
26sub FIRSTKEY { }
27
28sub NEXTKEY { }
29
30sub FETCH {
31    my ($self,$field) = @_;
32    my $member_func = "swig_${field}_get";
33    $self->$member_func();
34}
35
36sub STORE {
37    my ($self,$field,$newval) = @_;
38    my $member_func = "swig_${field}_set";
39    $self->$member_func($newval);
40}
41
42sub this {
43    my $ptr = shift;
44    return tied(%$ptr);
45}
46
47
48# ------- FUNCTION WRAPPERS --------
49
50package marisa;
51
52
53############# Class : marisa::Key ##############
54
55package marisa::Key;
56use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
57@ISA = qw( marisa );
58%OWNER = ();
59%ITERATORS = ();
60*str = *marisac::Key_str;
61*id = *marisac::Key_id;
62*weight = *marisac::Key_weight;
63sub DESTROY {
64    return unless $_[0]->isa('HASH');
65    my $self = tied(%{$_[0]});
66    return unless defined $self;
67    delete $ITERATORS{$self};
68    if (exists $OWNER{$self}) {
69        marisac::delete_Key($self);
70        delete $OWNER{$self};
71    }
72}
73
74sub DISOWN {
75    my $self = shift;
76    my $ptr = tied(%$self);
77    delete $OWNER{$ptr};
78}
79
80sub ACQUIRE {
81    my $self = shift;
82    my $ptr = tied(%$self);
83    $OWNER{$ptr} = 1;
84}
85
86
87############# Class : marisa::Query ##############
88
89package marisa::Query;
90use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
91@ISA = qw( marisa );
92%OWNER = ();
93%ITERATORS = ();
94*str = *marisac::Query_str;
95*id = *marisac::Query_id;
96sub DESTROY {
97    return unless $_[0]->isa('HASH');
98    my $self = tied(%{$_[0]});
99    return unless defined $self;
100    delete $ITERATORS{$self};
101    if (exists $OWNER{$self}) {
102        marisac::delete_Query($self);
103        delete $OWNER{$self};
104    }
105}
106
107sub DISOWN {
108    my $self = shift;
109    my $ptr = tied(%$self);
110    delete $OWNER{$ptr};
111}
112
113sub ACQUIRE {
114    my $self = shift;
115    my $ptr = tied(%$self);
116    $OWNER{$ptr} = 1;
117}
118
119
120############# Class : marisa::Keyset ##############
121
122package marisa::Keyset;
123use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
124@ISA = qw( marisa );
125%OWNER = ();
126%ITERATORS = ();
127sub new {
128    my $pkg = shift;
129    my $self = marisac::new_Keyset(@_);
130    bless $self, $pkg if defined($self);
131}
132
133sub DESTROY {
134    return unless $_[0]->isa('HASH');
135    my $self = tied(%{$_[0]});
136    return unless defined $self;
137    delete $ITERATORS{$self};
138    if (exists $OWNER{$self}) {
139        marisac::delete_Keyset($self);
140        delete $OWNER{$self};
141    }
142}
143
144*push_back = *marisac::Keyset_push_back;
145*key = *marisac::Keyset_key;
146*key_str = *marisac::Keyset_key_str;
147*key_id = *marisac::Keyset_key_id;
148*num_keys = *marisac::Keyset_num_keys;
149*empty = *marisac::Keyset_empty;
150*size = *marisac::Keyset_size;
151*total_length = *marisac::Keyset_total_length;
152*reset = *marisac::Keyset_reset;
153*clear = *marisac::Keyset_clear;
154sub DISOWN {
155    my $self = shift;
156    my $ptr = tied(%$self);
157    delete $OWNER{$ptr};
158}
159
160sub ACQUIRE {
161    my $self = shift;
162    my $ptr = tied(%$self);
163    $OWNER{$ptr} = 1;
164}
165
166
167############# Class : marisa::Agent ##############
168
169package marisa::Agent;
170use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
171@ISA = qw( marisa );
172%OWNER = ();
173%ITERATORS = ();
174sub new {
175    my $pkg = shift;
176    my $self = marisac::new_Agent(@_);
177    bless $self, $pkg if defined($self);
178}
179
180sub DESTROY {
181    return unless $_[0]->isa('HASH');
182    my $self = tied(%{$_[0]});
183    return unless defined $self;
184    delete $ITERATORS{$self};
185    if (exists $OWNER{$self}) {
186        marisac::delete_Agent($self);
187        delete $OWNER{$self};
188    }
189}
190
191*set_query = *marisac::Agent_set_query;
192*key = *marisac::Agent_key;
193*query = *marisac::Agent_query;
194*key_str = *marisac::Agent_key_str;
195*key_id = *marisac::Agent_key_id;
196*query_str = *marisac::Agent_query_str;
197*query_id = *marisac::Agent_query_id;
198sub DISOWN {
199    my $self = shift;
200    my $ptr = tied(%$self);
201    delete $OWNER{$ptr};
202}
203
204sub ACQUIRE {
205    my $self = shift;
206    my $ptr = tied(%$self);
207    $OWNER{$ptr} = 1;
208}
209
210
211############# Class : marisa::Trie ##############
212
213package marisa::Trie;
214use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
215@ISA = qw( marisa );
216%OWNER = ();
217%ITERATORS = ();
218sub new {
219    my $pkg = shift;
220    my $self = marisac::new_Trie(@_);
221    bless $self, $pkg if defined($self);
222}
223
224sub DESTROY {
225    return unless $_[0]->isa('HASH');
226    my $self = tied(%{$_[0]});
227    return unless defined $self;
228    delete $ITERATORS{$self};
229    if (exists $OWNER{$self}) {
230        marisac::delete_Trie($self);
231        delete $OWNER{$self};
232    }
233}
234
235*build = *marisac::Trie_build;
236*mmap = *marisac::Trie_mmap;
237*load = *marisac::Trie_load;
238*save = *marisac::Trie_save;
239*common_prefix_search = *marisac::Trie_common_prefix_search;
240*predictive_search = *marisac::Trie_predictive_search;
241*lookup = *marisac::Trie_lookup;
242*reverse_lookup = *marisac::Trie_reverse_lookup;
243*num_tries = *marisac::Trie_num_tries;
244*num_keys = *marisac::Trie_num_keys;
245*num_nodes = *marisac::Trie_num_nodes;
246*tail_mode = *marisac::Trie_tail_mode;
247*node_order = *marisac::Trie_node_order;
248*empty = *marisac::Trie_empty;
249*size = *marisac::Trie_size;
250*total_size = *marisac::Trie_total_size;
251*io_size = *marisac::Trie_io_size;
252*clear = *marisac::Trie_clear;
253sub DISOWN {
254    my $self = shift;
255    my $ptr = tied(%$self);
256    delete $OWNER{$ptr};
257}
258
259sub ACQUIRE {
260    my $self = shift;
261    my $ptr = tied(%$self);
262    $OWNER{$ptr} = 1;
263}
264
265
266# ------- VARIABLE STUBS --------
267
268package marisa;
269
270*OK = *marisac::OK;
271*STATE_ERROR = *marisac::STATE_ERROR;
272*NULL_ERROR = *marisac::NULL_ERROR;
273*BOUND_ERROR = *marisac::BOUND_ERROR;
274*RANGE_ERROR = *marisac::RANGE_ERROR;
275*CODE_ERROR = *marisac::CODE_ERROR;
276*RESET_ERROR = *marisac::RESET_ERROR;
277*SIZE_ERROR = *marisac::SIZE_ERROR;
278*MEMORY_ERROR = *marisac::MEMORY_ERROR;
279*IO_ERROR = *marisac::IO_ERROR;
280*FORMAT_ERROR = *marisac::FORMAT_ERROR;
281*MIN_NUM_TRIES = *marisac::MIN_NUM_TRIES;
282*MAX_NUM_TRIES = *marisac::MAX_NUM_TRIES;
283*DEFAULT_NUM_TRIES = *marisac::DEFAULT_NUM_TRIES;
284*HUGE_CACHE = *marisac::HUGE_CACHE;
285*LARGE_CACHE = *marisac::LARGE_CACHE;
286*NORMAL_CACHE = *marisac::NORMAL_CACHE;
287*SMALL_CACHE = *marisac::SMALL_CACHE;
288*TINY_CACHE = *marisac::TINY_CACHE;
289*DEFAULT_CACHE = *marisac::DEFAULT_CACHE;
290*TEXT_TAIL = *marisac::TEXT_TAIL;
291*BINARY_TAIL = *marisac::BINARY_TAIL;
292*DEFAULT_TAIL = *marisac::DEFAULT_TAIL;
293*LABEL_ORDER = *marisac::LABEL_ORDER;
294*WEIGHT_ORDER = *marisac::WEIGHT_ORDER;
295*DEFAULT_ORDER = *marisac::DEFAULT_ORDER;
296*INVALID_KEY_ID = *marisac::INVALID_KEY_ID;
2971;
298