/[Search-TokyoDystopia]/TokyoDystopia.xs
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /TokyoDystopia.xs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 9 by dpavlin, Sun Aug 17 22:58:23 2008 UTC revision 27 by dpavlin, Mon Aug 18 19:07:04 2008 UTC
# Line 11  MODULE = Search::TokyoDystopia         PACKAGE Line 11  MODULE = Search::TokyoDystopia         PACKAGE
11  PROTOTYPES: DISABLE  PROTOTYPES: DISABLE
12    
13  const char *  const char *
14  errmsg(ecode)  tcidberrmsg(ecode)
15          int     ecode          int     ecode
16  CODE:  CODE:
17          RETVAL = tcidberrmsg(ecode);          RETVAL = tcidberrmsg(ecode);
# Line 20  OUTPUT: Line 20  OUTPUT:
20    
21    
22  void *  void *
23  new()  tcidbnew()
24  PREINIT:  PREINIT:
25          TCIDB *db;          TCIDB *idb;
26  CODE:  CODE:
27          db = tcidbnew();          idb = tcidbnew();
28          RETVAL = db;          RETVAL = idb;
29  OUTPUT:  OUTPUT:
30          RETVAL          RETVAL
31    
32    
33  void  void
34  del(db)  tcidbdel(idb)
35          void *  db          void *  idb
36  CODE:  CODE:
37          tcidbdel(db);          tcidbdel(idb);
38    
39    
40  int  int
41  ecode(db)  tcidbecode(idb)
42          void *  db          void *  idb
43  CODE:  CODE:
44          RETVAL = tcidbecode(db);          RETVAL = tcidbecode(idb);
45  OUTPUT:  OUTPUT:
46          RETVAL          RETVAL
47    
48    
49  int  int
50  tune(db, ernum, etnum, iusiz, opts)  tcidbtune(idb, ernum, etnum, iusiz, opts)
51          void *  db          void *  idb
52          int     ernum          int     ernum
53          int     etnum          int     etnum
54          int     iusiz          int     iusiz
55          int     opts          int     opts
56  CODE:  CODE:
57          RETVAL = tcidbtune(db, ernum, etnum, iusiz, opts);          RETVAL = tcidbtune(idb, ernum, etnum, iusiz, opts);
58  OUTPUT:  OUTPUT:
59          RETVAL          RETVAL
60    
61    
62  int  int
63  setcache(db, icsiz, lcnum)  tcidbsetcache(idb, icsiz, lcnum)
64          void *  db          void *  idb
65          int     icsiz          int     icsiz
66          int     lcnum          int     lcnum
67  CODE:  CODE:
68          RETVAL = tcidbsetcache(db, icsiz, lcnum);          RETVAL = tcidbsetcache(idb, icsiz, lcnum);
69  OUTPUT:  OUTPUT:
70          RETVAL          RETVAL
71    
72    
73  int  int
74  setfwmmax(db, fwmax)  tcidbsetfwmmax(idb, fwmax)
75          void *  db          void *  idb
76          int     fwmax          int     fwmax
77  CODE:  CODE:
78          RETVAL = tcidbsetfwmmax(db, fwmax);          RETVAL = tcidbsetfwmmax(idb, fwmax);
79  OUTPUT:  OUTPUT:
80          RETVAL          RETVAL
81    
82    
83    int
84    tcidbopen(idb, path, omode)
85            void *  idb
86            char *  path
87            int     omode
88    CODE:
89            RETVAL = tcidbopen(idb, path, omode);
90    OUTPUT:
91            RETVAL
92    
93    
94    int
95    tcidbclose(idb)
96            void *  idb
97    CODE:
98            RETVAL = tcidbclose(idb);
99    OUTPUT:
100            RETVAL
101    
102    
103    int
104    tcidbput(idb, id, val)
105            void *  idb
106            int     id
107            SV *    val
108    PREINIT:
109            STRLEN vsiz;
110            const char *vbuf;
111    CODE:
112            vbuf = SvPV(val, vsiz);
113            RETVAL = tcidbput(idb, id, vbuf);
114    OUTPUT:
115            RETVAL
116    
117    
118    int
119    tcidbout(idb, id)
120            void *  idb
121            int     id
122    CODE:
123            RETVAL = tcidbout(idb, id);
124    OUTPUT:
125            RETVAL
126    
127    
128    void
129    tcidbget(idb, id)
130            void *  idb
131            int     id
132    PREINIT:
133            char *vbuf;
134    PPCODE:
135            vbuf = tcidbget(idb, id);
136            if(vbuf){
137              XPUSHs(sv_2mortal(newSVpvn(vbuf, strlen(vbuf))));
138              tcfree(vbuf);
139            } else {
140              XPUSHs((SV *)&PL_sv_undef);
141            }
142            XSRETURN(1);
143    
144    
145    void
146    tcidbsearch(idb, word, smode)
147            void *  idb
148            SV *    word
149            int     smode
150    PREINIT:
151            AV *av;
152            STRLEN wsize;
153            uint64_t *results;
154            const char *wbuf;
155            int i, rnum;
156    PPCODE:
157            wbuf = SvPV(word, wsize);
158            results = tcidbsearch(idb, wbuf, smode, &rnum);
159            if ( rnum > 0 ) {
160              av = newAV();
161              for(i = 0; i < rnum; i++){
162                av_push(av, newSViv( (int)results[i] ));
163              }
164              XPUSHs(sv_2mortal(newRV_noinc((SV *)av)));
165            } else {
166              XPUSHs((SV *)&PL_sv_undef);
167            }
168            XSRETURN(1);
169    
170    
171    void
172    tcidbsearch2(idb, expr)
173            void *  idb
174            SV *    expr
175    PREINIT:
176            AV *av;
177            STRLEN wsize;
178            uint64_t *results;
179            const char *wbuf;
180            int i, rnum;
181    PPCODE:
182            wbuf = SvPV(expr, wsize);
183            results = tcidbsearch2(idb, wbuf, &rnum);
184            if ( rnum > 0 ) {
185              av = newAV();
186              for(i = 0; i < rnum; i++){
187                av_push(av, newSViv( (int)results[i] ));
188              }
189              XPUSHs(sv_2mortal(newRV_noinc((SV *)av)));
190            } else {
191              XPUSHs((SV *)&PL_sv_undef);
192            }
193            XSRETURN(1);
194    
195    
196    int
197    tcidbiterinit(idb)
198            void *  idb
199    CODE:
200            RETVAL = tcidbiterinit(idb);
201    OUTPUT:
202            RETVAL
203    
204    
205    int
206    tcidbiternext(idb)
207            void *  idb
208    CODE:
209            RETVAL = tcidbiternext(idb);
210    OUTPUT:
211            RETVAL
212    
213    
214    int
215    tcidbsync(idb)
216            void *  idb
217    CODE:
218            RETVAL = tcidbsync(idb);
219    OUTPUT:
220            RETVAL
221    
222    
223    int
224    tcidboptimize(idb)
225            void *  idb
226    CODE:
227            RETVAL = tcidboptimize(idb);
228    OUTPUT:
229            RETVAL
230    
231    
232    int
233    tcidbvanish(idb)
234            void *  idb
235    CODE:
236            RETVAL = tcidbvanish(idb);
237    OUTPUT:
238            RETVAL
239    
240    
241    int
242    tcidbcopy(idb, path)
243            void *  idb
244            char *  path
245    CODE:
246            RETVAL = tcidbcopy(idb, path);
247    OUTPUT:
248            RETVAL
249    
250    
251    void
252    tcidbpath(idb)
253            void *  idb
254    PREINIT:
255            const char *path;
256    PPCODE:
257            path = tcidbpath(idb);
258            if(path){
259              XPUSHs(sv_2mortal(newSVpv(path, 0)));
260            } else {
261              XPUSHs((SV *)&PL_sv_undef);
262            }
263            XSRETURN(1);
264    
265    
266    double
267    tcidbrnum(idb)
268            void *  idb
269    CODE:
270            RETVAL = tcidbrnum(idb);
271    OUTPUT:
272            RETVAL
273    

Legend:
Removed from v.9  
changed lines
  Added in v.27

  ViewVC Help
Powered by ViewVC 1.1.26