~ubuntu-branches/ubuntu/trusty/hyperestraier/trusty

« back to all changes in this revision

Viewing changes to perlnative/src/Estraier.xs

  • Committer: Bazaar Package Importer
  • Author(s): Steve Langasek
  • Date: 2006-11-14 05:28:32 UTC
  • mfrom: (2.1.4 feisty)
  • Revision ID: james.westby@ubuntu.com-20061114052832-0lzqzcefn8mt4yqe
Tags: 1.4.9-1.1
* Non-maintainer upload.
* High-urgency upload for RC bugfix.
* Set HOME=$(CURDIR)/junkhome when building, otherwise the package build
  will incorrectly look for headers there -- and fail when the directory
  exists and is unreadable, as happens sometimes on sudo-using
  autobuilders!

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*************************************************************************************************
 
2
 * Perl binding of Hyper Estraier
 
3
 *                                                      Copyright (C) 2004-2005 Mikio Hirabayashi
 
4
 * This file is part of Hyper Estraier.
 
5
 * Hyper Estraier is free software; you can redistribute it and/or modify it under the terms of
 
6
 * the GNU Lesser General Public License as published by the Free Software Foundation; either
 
7
 * version 2.1 of the License or any later version.  Hyper Estraier is distributed in the hope
 
8
 * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
 
9
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
 
10
 * License for more details.
 
11
 * You should have received a copy of the GNU Lesser General Public License along with Hyper
 
12
 * Estraier; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
 
13
 * Boston, MA 02111-1307 USA.
 
14
 *************************************************************************************************/
 
15
 
 
16
 
 
17
#include "EXTERN.h"
 
18
#include "perl.h"
 
19
#include "XSUB.h"
 
20
#include <estraier.h>
 
21
#include <estmtdb.h>
 
22
#include <cabin.h>
 
23
#include <stdlib.h>
 
24
 
 
25
 
 
26
 
 
27
/*************************************************************************************************
 
28
 * private objects
 
29
 *************************************************************************************************/
 
30
 
 
31
 
 
32
static AV *cblisttoav(const CBLIST *names);
 
33
static CBLIST *avtocblist(AV *av);
 
34
static HV *cbmaptohv(CBMAP *kwords);
 
35
static CBMAP *hvtocbmap(HV *hv);
 
36
static void dbinform(const char *message, void *opaque);
 
37
 
 
38
 
 
39
static AV *cblisttoav(const CBLIST *names){
 
40
  AV *av;
 
41
  const char *buf;
 
42
  int i, size;
 
43
  av = newAV();
 
44
  for(i = 0; i < cblistnum(names); i++){
 
45
    buf = cblistval(names, i, &size);
 
46
    av_push(av, newSVpvn(buf, size));
 
47
  }
 
48
  return av;
 
49
}
 
50
 
 
51
 
 
52
static CBLIST *avtocblist(AV *av){
 
53
  CBLIST *list;
 
54
  SV *val;
 
55
  STRLEN size;
 
56
  char *buf;
 
57
  int i, num;
 
58
  list = cblistopen();
 
59
  if((num = av_len(av)) < 0) return list;
 
60
  for(i = 0; i <= num; i++){
 
61
    val = *av_fetch(av, i, 0);
 
62
    buf = SvPV(val, size);
 
63
    cblistpush(list, buf, (int)size);
 
64
  }
 
65
  return list;
 
66
}
 
67
 
 
68
 
 
69
static HV *cbmaptohv(CBMAP *kwords){
 
70
  HV *hv;
 
71
  const char *kbuf, *vbuf;
 
72
  int ksiz, vsiz;
 
73
  hv = newHV();
 
74
  cbmapiterinit(kwords);
 
75
  while((kbuf = cbmapiternext(kwords, &ksiz)) != NULL){
 
76
    vbuf = cbmapiterval(kbuf, &vsiz);
 
77
    hv_store(hv, kbuf, ksiz, newSVpvn(vbuf, vsiz), 0);
 
78
  }
 
79
  return hv;
 
80
}
 
81
 
 
82
 
 
83
static CBMAP *hvtocbmap(HV *hv){
 
84
  HE *entry;
 
85
  STRLEN vsiz;
 
86
  CBMAP *map;
 
87
  char *kbuf, *vbuf;
 
88
  SV *val;
 
89
  I32 ksiz;
 
90
  map = cbmapopenex(31);
 
91
  hv_iterinit(hv);
 
92
  while((entry = hv_iternext(hv)) != NULL){
 
93
    kbuf = hv_iterkey(entry, &ksiz);
 
94
    val = hv_iterval(hv, entry);
 
95
    vbuf = SvPV(val, vsiz);
 
96
    cbmapput(map, kbuf, (int)ksiz, vbuf, (int)vsiz, FALSE);
 
97
  }
 
98
  return map;
 
99
}
 
100
 
 
101
 
 
102
static void dbinform(const char *message, void *opaque){
 
103
  dSP;
 
104
  ENTER;
 
105
  SAVETMPS;
 
106
  PUSHMARK(SP);
 
107
  XPUSHs(sv_2mortal(newSVpv(message, 0)));
 
108
  PUTBACK;
 
109
  perl_call_pv(opaque, G_DISCARD | G_EVAL);
 
110
  FREETMPS;
 
111
  LEAVE;
 
112
}
 
113
 
 
114
 
 
115
 
 
116
/*************************************************************************************************
 
117
 * public objects
 
118
 *************************************************************************************************/
 
119
 
 
120
 
 
121
MODULE = Estraier               PACKAGE = Estraier
 
122
PROTOTYPES: DISABLE
 
123
 
 
124
 
 
125
void *
 
126
doc_new()
 
127
CODE:
 
128
        RETVAL = est_doc_new();
 
129
OUTPUT:
 
130
        RETVAL
 
131
 
 
132
 
 
133
void *
 
134
doc_new_from_draft(draft)
 
135
        char *  draft
 
136
CODE:
 
137
        RETVAL = est_doc_new_from_draft(draft);
 
138
OUTPUT:
 
139
        RETVAL
 
140
 
 
141
 
 
142
void
 
143
doc_delete(doc)
 
144
        void *  doc
 
145
CODE:
 
146
        est_doc_delete(doc);
 
147
 
 
148
 
 
149
void
 
150
doc_add_attr(doc, name, value)
 
151
        void *  doc
 
152
        char *  name
 
153
        char *  value
 
154
CODE:
 
155
        if(!strcmp(value, "\t(NULL)\t")) value = NULL;
 
156
        est_doc_add_attr(doc, name, value);
 
157
 
 
158
 
 
159
void
 
160
doc_add_text(doc, text)
 
161
        void *  doc
 
162
        char *  text
 
163
CODE:
 
164
        est_doc_add_text(doc, text);
 
165
 
 
166
 
 
167
void
 
168
doc_add_hidden_text(doc, text)
 
169
        void *  doc
 
170
        char *  text
 
171
CODE:
 
172
        est_doc_add_hidden_text(doc, text);
 
173
 
 
174
 
 
175
void
 
176
doc_set_keywords(doc, kwords)
 
177
        void *  doc
 
178
        HV *    kwords
 
179
PREINIT:
 
180
        CBMAP *tkwords;
 
181
CODE:
 
182
        tkwords = hvtocbmap(kwords);
 
183
        est_doc_set_keywords(doc, tkwords);
 
184
        cbmapclose(tkwords);
 
185
 
 
186
 
 
187
void
 
188
doc_set_score(doc, score)
 
189
        void *  doc
 
190
        int     score
 
191
CODE:
 
192
        est_doc_set_score(doc, score);
 
193
 
 
194
 
 
195
int
 
196
doc_id(doc)
 
197
        void *  doc
 
198
CODE:
 
199
        RETVAL = est_doc_id(doc);
 
200
OUTPUT:
 
201
        RETVAL
 
202
 
 
203
 
 
204
void
 
205
doc_attr_names(doc)
 
206
        void *  doc
 
207
PREINIT:
 
208
        CBLIST *names;
 
209
PPCODE:
 
210
        names = est_doc_attr_names(doc);
 
211
        XPUSHs(sv_2mortal(newRV_noinc((SV *)cblisttoav(names))));
 
212
        cblistclose(names);
 
213
        XSRETURN(1);
 
214
 
 
215
 
 
216
const char *
 
217
doc_attr(doc, name)
 
218
        void *  doc
 
219
        char *  name
 
220
CODE:
 
221
        RETVAL = est_doc_attr(doc, name);
 
222
OUTPUT:
 
223
        RETVAL
 
224
 
 
225
 
 
226
void
 
227
doc_texts(doc)
 
228
        void *  doc
 
229
PREINIT:
 
230
        const CBLIST *texts;
 
231
PPCODE:
 
232
        texts = est_doc_texts(doc);
 
233
        XPUSHs(sv_2mortal(newRV_noinc((SV *)cblisttoav(texts))));
 
234
        XSRETURN(1);
 
235
 
 
236
 
 
237
void
 
238
doc_cat_texts(doc)
 
239
        void *  doc
 
240
PREINIT:
 
241
        char *texts;
 
242
PPCODE:
 
243
        texts = est_doc_cat_texts(doc);
 
244
        XPUSHs(sv_2mortal(newSVpv(texts, 0)));
 
245
        free(texts);
 
246
        XSRETURN(1);
 
247
 
 
248
 
 
249
void
 
250
doc_keywords(doc)
 
251
        void *  doc
 
252
PREINIT:
 
253
        CBMAP *kwords;
 
254
PPCODE:
 
255
        if((kwords = est_doc_keywords(doc)) != NULL){
 
256
          XPUSHs(sv_2mortal(newRV_noinc((SV *)cbmaptohv(kwords))));
 
257
        } else {
 
258
          XPUSHs((SV *)&PL_sv_undef);
 
259
        }
 
260
        XSRETURN(1);
 
261
 
 
262
 
 
263
int
 
264
doc_score(doc)
 
265
        void *  doc
 
266
CODE:
 
267
        RETVAL = est_doc_score(doc);
 
268
OUTPUT:
 
269
        RETVAL
 
270
 
 
271
 
 
272
void
 
273
doc_make_snippet(doc, words, wwidth, hwidth, awidth)
 
274
        void *  doc
 
275
        AV *    words
 
276
        int     wwidth
 
277
        int     hwidth
 
278
        int     awidth
 
279
PREINIT:
 
280
        CBLIST *twords;
 
281
        char *snippet;
 
282
PPCODE:
 
283
        twords = avtocblist(words);
 
284
        snippet = est_doc_make_snippet(doc, twords, wwidth, hwidth, awidth);
 
285
        XPUSHs(sv_2mortal(newSVpv(snippet, 0)));
 
286
        free(snippet);
 
287
        cblistclose(twords);
 
288
        XSRETURN(1);
 
289
 
 
290
 
 
291
void
 
292
doc_dump_draft(doc)
 
293
        void *  doc
 
294
PREINIT:
 
295
        char *draft;
 
296
PPCODE:
 
297
        draft = est_doc_dump_draft(doc);
 
298
        XPUSHs(sv_2mortal(newSVpv(draft, 0)));
 
299
        free(draft);
 
300
        XSRETURN(1);
 
301
 
 
302
 
 
303
void *
 
304
cond_new()
 
305
PREINIT:
 
306
        void *cond;
 
307
CODE:
 
308
        cond = est_cond_new();
 
309
        est_cond_set_options(cond, ESTCONDSCFB);
 
310
        RETVAL = cond;
 
311
OUTPUT:
 
312
        RETVAL
 
313
 
 
314
 
 
315
void
 
316
cond_delete(cond)
 
317
        void *  cond
 
318
CODE:
 
319
        est_cond_delete(cond);
 
320
 
 
321
 
 
322
void
 
323
cond_set_phrase(cond, phrase)
 
324
        void *  cond
 
325
        char *  phrase
 
326
CODE:
 
327
        est_cond_set_phrase(cond, phrase);
 
328
 
 
329
 
 
330
void
 
331
cond_add_attr(cond, expr)
 
332
        void *  cond
 
333
        char *  expr
 
334
CODE:
 
335
        est_cond_add_attr(cond, expr);
 
336
 
 
337
 
 
338
void
 
339
cond_set_order(cond, expr)
 
340
        void *  cond
 
341
        char *  expr
 
342
CODE:
 
343
        est_cond_set_order(cond, expr);
 
344
 
 
345
 
 
346
void
 
347
cond_set_max(cond, max)
 
348
        void *  cond
 
349
        int     max
 
350
CODE:
 
351
        est_cond_set_max(cond, max);
 
352
 
 
353
 
 
354
void
 
355
cond_set_skip(cond, skip)
 
356
        void *  cond
 
357
        int     skip
 
358
CODE:
 
359
        est_cond_set_skip(cond, skip);
 
360
 
 
361
 
 
362
void
 
363
cond_set_options(cond, options)
 
364
        void *  cond
 
365
        int     options
 
366
CODE:
 
367
        est_cond_set_options(cond, options);
 
368
 
 
369
 
 
370
void
 
371
cond_set_auxiliary(cond, min)
 
372
        void *  cond
 
373
        int     min
 
374
CODE:
 
375
        est_cond_set_auxiliary(cond, min);
 
376
 
 
377
 
 
378
void
 
379
cond_set_eclipse(cond, limit)
 
380
        void *  cond
 
381
        double  limit
 
382
CODE:
 
383
        est_cond_set_eclipse(cond, limit);
 
384
 
 
385
 
 
386
void
 
387
cond_set_distinct(cond, name)
 
388
        void *  cond
 
389
        char *  name
 
390
CODE:
 
391
        est_cond_set_distinct(cond, name);
 
392
 
 
393
 
 
394
void
 
395
res_delete(resptr, idxsptr, hints, cond)
 
396
        void *  resptr
 
397
        void *  idxsptr
 
398
        void *  hints
 
399
        void *  cond
 
400
CODE:
 
401
        est_cond_delete(cond);
 
402
        cbmapclose(hints);
 
403
        free(idxsptr);
 
404
        free(resptr);
 
405
 
 
406
 
 
407
int
 
408
res_get_doc_id(resptr, index)
 
409
        void *  resptr
 
410
        int     index
 
411
CODE:
 
412
        RETVAL = ((int *)resptr)[index];
 
413
OUTPUT:
 
414
        RETVAL
 
415
 
 
416
 
 
417
int
 
418
res_get_dbidx(idxsptr, index)
 
419
        void *  idxsptr
 
420
        int     index
 
421
CODE:
 
422
        RETVAL = ((int *)idxsptr)[index];
 
423
OUTPUT:
 
424
        RETVAL
 
425
 
 
426
 
 
427
void
 
428
res_hint_words(hints)
 
429
        void *  hints
 
430
PREINIT:
 
431
        CBLIST *words;
 
432
        const char *vbuf;
 
433
        int i;
 
434
PPCODE:
 
435
        words = cbmapkeys(hints);
 
436
        for(i = 0; i < cblistnum(words); i++){
 
437
          vbuf = cblistval(words, i, NULL);
 
438
          if(vbuf[0] == '\0'){
 
439
            free(cblistremove(words, i, NULL));
 
440
            break;
 
441
          }
 
442
        }
 
443
        XPUSHs(sv_2mortal(newRV_noinc((SV *)cblisttoav(words))));
 
444
        cblistclose(words);
 
445
        XSRETURN(1);
 
446
 
 
447
 
 
448
int
 
449
res_hint(hints, word)
 
450
        void *  hints
 
451
        char *  word
 
452
PREINIT:
 
453
        const char *value;
 
454
CODE:
 
455
        value = cbmapget(hints, word, -1, NULL);
 
456
        RETVAL = value ? atoi(value) : 0;
 
457
OUTPUT:
 
458
        RETVAL
 
459
 
 
460
 
 
461
int
 
462
res_get_score(cond, index)
 
463
        void *  cond
 
464
        int     index
 
465
CODE:
 
466
        RETVAL = est_cond_score(cond, index);
 
467
OUTPUT:
 
468
        RETVAL
 
469
 
 
470
 
 
471
void
 
472
res_get_shadows(cond, id)
 
473
        void *  cond
 
474
        int     id
 
475
PREINIT:
 
476
        const int *ary;
 
477
        int i, anum;
 
478
        AV *av;
 
479
PPCODE:
 
480
        ary = est_cond_shadows(cond, id, &anum);
 
481
        av = newAV();
 
482
        for(i = 0; i < anum; i++){
 
483
          av_push(av, newSViv(ary[i]));
 
484
        }
 
485
        XPUSHs(sv_2mortal(newRV_noinc((SV *)av)));
 
486
        XSRETURN(1);
 
487
 
 
488
 
 
489
const char *
 
490
db_version()
 
491
CODE:
 
492
        RETVAL = est_version;
 
493
OUTPUT:
 
494
        RETVAL
 
495
 
 
496
 
 
497
void
 
498
db_search_meta(dbav, cond)
 
499
        AV *    dbav
 
500
        void *  cond
 
501
PREINIT:
 
502
        ESTMTDB **dbs;
 
503
        CBMAP *hints;
 
504
        int i, dbnum, *res, rnum, *idxs;
 
505
PPCODE:
 
506
        dbnum = av_len(dbav) + 1;
 
507
        dbs = cbmalloc(dbnum * sizeof(ESTMTDB *) + 1);
 
508
        for(i = 0; i < dbnum; i++){
 
509
          dbs[i] = (ESTMTDB *)SvIV(*av_fetch(dbav, i, 0));
 
510
        }
 
511
        hints = cbmapopenex(31);
 
512
        res = est_mtdb_search_meta(dbs, dbnum, cond, &rnum, hints);
 
513
        idxs = cbmalloc(rnum / 2 * sizeof(int) + 1);
 
514
        for(i = 0; i < rnum; i += 2){
 
515
          idxs[i/2] = res[i];
 
516
          res[i/2] = res[i+1];
 
517
        }
 
518
        free(dbs);
 
519
        XPUSHs(sv_2mortal(newSViv((IV)res)));
 
520
        XPUSHs(sv_2mortal(newSViv((IV)idxs)));
 
521
        XPUSHs(sv_2mortal(newSViv((IV)(rnum / 2))));
 
522
        XPUSHs(sv_2mortal(newSViv((IV)hints)));
 
523
        XPUSHs(sv_2mortal(newSViv((IV)est_cond_dup(cond))));
 
524
        XSRETURN(5);
 
525
 
 
526
 
 
527
const char *
 
528
db_err_msg(ecode)
 
529
        int     ecode
 
530
CODE:
 
531
        RETVAL = est_err_msg(ecode);
 
532
OUTPUT:
 
533
        RETVAL
 
534
 
 
535
 
 
536
void
 
537
db_open(name, omode)
 
538
        char *  name
 
539
        int     omode
 
540
PREINIT:
 
541
        void *  db;
 
542
        int     ecode;
 
543
PPCODE:
 
544
        db = est_mtdb_open(name, omode, &ecode);
 
545
        XPUSHs(sv_2mortal(newSViv((IV)db)));
 
546
        XPUSHs(sv_2mortal(newSViv((IV)ecode)));
 
547
        XSRETURN(2);
 
548
 
 
549
 
 
550
void
 
551
db_close(db)
 
552
        void *  db
 
553
PREINIT:
 
554
        int ecode, rv;
 
555
PPCODE:
 
556
        rv = est_mtdb_close(db, &ecode);
 
557
        XPUSHs(sv_2mortal(newSViv((IV)rv)));
 
558
        XPUSHs(sv_2mortal(newSViv((IV)ecode)));
 
559
        XSRETURN(2);
 
560
 
 
561
 
 
562
int
 
563
db_error(db)
 
564
        void *  db
 
565
CODE:
 
566
        RETVAL = est_mtdb_error(db);
 
567
OUTPUT:
 
568
        RETVAL
 
569
 
 
570
 
 
571
int
 
572
db_fatal(db)
 
573
        void *  db
 
574
CODE:
 
575
        RETVAL = est_mtdb_fatal(db);
 
576
OUTPUT:
 
577
        RETVAL
 
578
 
 
579
 
 
580
int
 
581
db_add_attr_index(db, name, type)
 
582
        void *  db
 
583
        char *  name
 
584
        int     type
 
585
CODE:
 
586
        RETVAL = est_mtdb_add_attr_index(db, name, type);
 
587
OUTPUT:
 
588
        RETVAL
 
589
 
 
590
 
 
591
int
 
592
db_flush(db, max)
 
593
        void *  db
 
594
        int     max
 
595
CODE:
 
596
        RETVAL = est_mtdb_flush(db, max);
 
597
OUTPUT:
 
598
        RETVAL
 
599
 
 
600
 
 
601
int
 
602
db_sync(db)
 
603
        void *  db
 
604
CODE:
 
605
        RETVAL = est_mtdb_sync(db);
 
606
OUTPUT:
 
607
        RETVAL
 
608
 
 
609
 
 
610
int
 
611
db_optimize(db, options)
 
612
        void *  db
 
613
        int     options
 
614
CODE:
 
615
        RETVAL = est_mtdb_optimize(db, options);
 
616
OUTPUT:
 
617
        RETVAL
 
618
 
 
619
 
 
620
int
 
621
db_merge(db, name, options)
 
622
        void *  db
 
623
        char *  name
 
624
        int     options
 
625
CODE:
 
626
        RETVAL = est_mtdb_merge(db, name, options);
 
627
OUTPUT:
 
628
        RETVAL
 
629
 
 
630
 
 
631
int
 
632
db_put_doc(db, doc, options)
 
633
        void *  db
 
634
        void *  doc
 
635
        int     options
 
636
CODE:
 
637
        RETVAL = est_mtdb_put_doc(db, doc, options);
 
638
OUTPUT:
 
639
        RETVAL
 
640
 
 
641
 
 
642
int
 
643
db_out_doc(db, id, options)
 
644
        void *  db
 
645
        int     id
 
646
        int     options
 
647
CODE:
 
648
        RETVAL = est_mtdb_out_doc(db, id, options);
 
649
OUTPUT:
 
650
        RETVAL
 
651
 
 
652
 
 
653
int
 
654
db_edit_doc(db, doc)
 
655
        void *  db
 
656
        void *  doc
 
657
CODE:
 
658
        RETVAL = est_mtdb_edit_doc(db, doc);
 
659
OUTPUT:
 
660
        RETVAL
 
661
 
 
662
 
 
663
void *
 
664
db_get_doc(db, id, options)
 
665
        void *  db
 
666
        int     id
 
667
        int     options
 
668
CODE:
 
669
        RETVAL = est_mtdb_get_doc(db, id, options);
 
670
OUTPUT:
 
671
        RETVAL
 
672
 
 
673
 
 
674
void
 
675
db_get_doc_attr(db, id, name)
 
676
        void *  db
 
677
        int     id
 
678
        char *  name
 
679
PREINIT:
 
680
        char *value;
 
681
PPCODE:
 
682
        value = est_mtdb_get_doc_attr(db, id, name);
 
683
        if(!value) XSRETURN_UNDEF;
 
684
        XPUSHs(sv_2mortal(newSVpv(value, 0)));
 
685
        free(value);
 
686
        XSRETURN(1);
 
687
 
 
688
 
 
689
int
 
690
db_uri_to_id(db, uri)
 
691
        void *  db
 
692
        char *  uri
 
693
CODE:
 
694
        RETVAL = est_mtdb_uri_to_id(db, uri);
 
695
OUTPUT:
 
696
        RETVAL
 
697
 
 
698
 
 
699
const char *
 
700
db_name(db)
 
701
        void *  db
 
702
CODE:
 
703
        RETVAL = est_mtdb_name(db);
 
704
OUTPUT:
 
705
        RETVAL
 
706
 
 
707
 
 
708
int
 
709
db_doc_num(db)
 
710
        void *  db
 
711
CODE:
 
712
        RETVAL = est_mtdb_doc_num(db);
 
713
OUTPUT:
 
714
        RETVAL
 
715
 
 
716
 
 
717
int
 
718
db_word_num(db)
 
719
        void *  db
 
720
CODE:
 
721
        RETVAL = est_mtdb_word_num(db);
 
722
OUTPUT:
 
723
        RETVAL
 
724
 
 
725
 
 
726
double
 
727
db_size(db)
 
728
        void *  db
 
729
CODE:
 
730
        RETVAL = est_mtdb_size(db);
 
731
OUTPUT:
 
732
        RETVAL
 
733
 
 
734
 
 
735
void
 
736
db_search(db, cond)
 
737
        void *  db
 
738
        void *  cond
 
739
PREINIT:
 
740
        CBMAP *hints;
 
741
        int *res;
 
742
        int rnum;
 
743
PPCODE:
 
744
        hints = cbmapopenex(31);
 
745
        res = est_mtdb_search(db, cond, &rnum, hints);
 
746
        XPUSHs(sv_2mortal(newSViv((IV)res)));
 
747
        XPUSHs(sv_2mortal(newSViv((IV)rnum)));
 
748
        XPUSHs(sv_2mortal(newSViv((IV)hints)));
 
749
        XPUSHs(sv_2mortal(newSViv((IV)est_cond_dup(cond))));
 
750
        XSRETURN(4);
 
751
 
 
752
 
 
753
int
 
754
db_scan_doc(db, doc, cond)
 
755
        void *  db
 
756
        void *  doc
 
757
        void *  cond
 
758
CODE:
 
759
        RETVAL = est_mtdb_scan_doc(db, doc, cond);
 
760
OUTPUT:
 
761
        RETVAL
 
762
 
 
763
 
 
764
void
 
765
db_set_cache_size(db, size, anum, tnum, rnum)
 
766
        void *  db
 
767
        double  size
 
768
        int     anum
 
769
        int     tnum
 
770
        int     rnum
 
771
CODE:
 
772
        est_mtdb_set_cache_size(db, (size_t)size, anum, tnum, rnum);
 
773
 
 
774
 
 
775
int
 
776
db_add_pseudo_index(db, path)
 
777
        void *  db
 
778
        char *  path
 
779
CODE:
 
780
        RETVAL = est_mtdb_add_pseudo_index(db, path);
 
781
OUTPUT:
 
782
        RETVAL
 
783
 
 
784
 
 
785
void
 
786
db_set_wildmax(db, num)
 
787
        void *  db
 
788
        int     num
 
789
CODE:
 
790
        est_mtdb_set_wildmax(db, num);
 
791
 
 
792
 
 
793
void
 
794
db_set_informer(db, informer)
 
795
        void *  db
 
796
        char *  informer
 
797
CODE:
 
798
        est_mtdb_set_informer(db, dbinform, informer);
 
799
 
 
800
 
 
801
 
 
802
## END OF FILE