.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32 .\" .\" Standard preamble: .\" ======================================================================== .de Sh \" Subsection heading .br .if t .Sp .ne 5 .PP \fB\\$1\fR .PP .. .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. | will give a .\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to .\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' .\" expand to `' in nroff, nothing in troff, for use with C<>. .tr \(*W-|\(bv\*(Tr .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .\" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .hy 0 .if n .na .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "KinoSearch::Index::TermDocs 3" .TH KinoSearch::Index::TermDocs 3 "2008-01-14" "perl v5.8.8" "User Contributed Perl Documentation" sub seek { shift\->abstract_death } .PP sub close { shift\->abstract_death } .PP 1; .PP _\|_END_\|_ .PP _\|_XS_\|_ .PP \&\s-1MODULE\s0 = KinoSearch \s-1PACKAGE\s0 = KinoSearch::Index::TermDocs .PP void new(either_sv) \s-1SV\s0 *either_sv; \&\s-1PREINIT:\s0 char *class; TermDocs *term_docs; \&\s-1PPCODE:\s0 /* determine the class */ class = sv_isobject(either_sv) ? sv_reftype(either_sv, 0) : SvPV_nolen(either_sv); .PP .Vb 5 \& /* build object */ \& term_docs = Kino_TermDocs_new(); \& ST(0) = sv_newmortal(); \& sv_setref_pv(ST(0), class, (void*)term_docs); \& XSRETURN(1); .Ve .PP void seek_tinfo(term_docs, maybe_tinfo_sv) TermDocs *term_docs; \s-1SV\s0 *maybe_tinfo_sv; \&\s-1PREINIT:\s0 TermInfo *tinfo = \s-1NULL\s0; \&\s-1PPCODE:\s0 /* if maybe_tinfo_sv is undef, tinfo is \s-1NULL\s0 */ if (SvOK(maybe_tinfo_sv)) { Kino_extract_struct(maybe_tinfo_sv, tinfo, TermInfo*, \*(L"KinoSearch::Index::TermInfo\*(R"); } term_docs\->seek_tinfo(term_docs, tinfo); .PP bool next(term_docs) TermDocs *term_docs; \&\s-1CODE:\s0 \s-1RETVAL\s0 = term_docs\->next(term_docs); \&\s-1OUTPUT:\s0 \s-1RETVAL\s0 .PP U32 bulk_read(term_docs, doc_nums_sv, freqs_sv, num_wanted) TermDocs *term_docs \s-1SV\s0 *doc_nums_sv; \s-1SV\s0 *freqs_sv; U32 num_wanted; \&\s-1CODE:\s0 \s-1RETVAL\s0 = term_docs\->bulk_read(term_docs, doc_nums_sv, freqs_sv, num_wanted); \&\s-1OUTPUT:\s0 \s-1RETVAL\s0 .PP bool skip_to(term_docs, target) TermDocs *term_docs; U32 target; \&\s-1CODE:\s0 \s-1RETVAL\s0 = term_docs\->skip_to(term_docs, target); \&\s-1OUTPUT:\s0 \s-1RETVAL\s0 .PP SV* _parent_set_or_get(term_docs, ...) TermDocs *term_docs; \&\s-1ALIAS:\s0 set_doc = 1 get_doc = 2 set_freq = 3 get_freq = 4 set_positions = 5 get_positions = 6 set_doc_freq = 7 get_doc_freq = 8 \&\s-1PREINIT:\s0 U32 num; \&\s-1CODE:\s0 { \s-1KINO_START_SET_OR_GET_SWITCH\s0 .PP .Vb 7 \& case 1: Kino_confess("Can't set_doc"); \& /* fall through */ \& case 2: num = term_docs->get_doc(term_docs); \& RETVAL = num == KINO_TERM_DOCS_SENTINEL \& ? &PL_sv_undef \& : newSVuv(num); \& break; .Ve .PP .Vb 7 \& case 3: Kino_confess("Can't set_freq"); \& /* fall through */ \& case 4: num = term_docs->get_freq(term_docs); \& RETVAL = num == KINO_TERM_DOCS_SENTINEL \& ? &PL_sv_undef \& : newSVuv(num); \& break; .Ve .PP .Vb 4 \& case 5: Kino_confess("Can't set_positions"); \& /* fall through */ \& case 6: RETVAL = newSVsv(term_docs->get_positions(term_docs)); \& break; .Ve .PP .Vb 7 \& case 7: term_docs->set_doc_freq(term_docs, (U32)SvUV(ST(1)) ); \& /* fall through */ \& case 8: num = term_docs->get_doc_freq(term_docs); \& RETVAL = num == KINO_TERM_DOCS_SENTINEL \& ? &PL_sv_undef \& : newSVuv(num); \& break; .Ve .PP .Vb 3 \& KINO_END_SET_OR_GET_SWITCH \&} \&OUTPUT: RETVAL .Ve .PP void \&\s-1DESTROY\s0(term_docs) TermDocs *term_docs; \&\s-1PPCODE:\s0 term_docs\->destroy(term_docs); .PP _\|_H_\|_ .PP #ifndef H_KINO_TERM_DOCS #define H_KINO_TERM_DOCS 1 .PP #define \s-1KINO_TERM_DOCS_SENTINEL\s0 0xFFFFFFFF .PP #include \*(L"\s-1EXTERN\s0.h\*(R" #include \*(L"perl.h\*(R" #include \*(L"\s-1XSUB\s0.h\*(R" #include \*(L"KinoSearchUtilMemManager.h\*(R" #include \*(L"KinoSearchIndexTermInfo.h\*(R" .PP typedef struct termdocs { void *child; \s-1SV\s0 *positions; void (*set_doc_freq)(struct termdocs*, U32); U32 (*get_doc_freq)(struct termdocs*); U32 (*get_doc)(struct termdocs*); U32 (*get_freq)(struct termdocs*); SV* (*get_positions)(struct termdocs*); void (*seek_tinfo)(struct termdocs*, TermInfo*); bool (*next)(struct termdocs*); bool (*skip_to)(struct termdocs*, U32); U32 (*bulk_read)(struct termdocs*, SV*, SV*, U32); void (*destroy)(struct termdocs*); } TermDocs; .PP TermDocs* \fIKino_TermDocs_new()\fR; void Kino_TermDocs_set_doc_freq_death(TermDocs*, U32); U32 Kino_TermDocs_get_doc_freq_death(TermDocs*); U32 Kino_TermDocs_get_doc_death(TermDocs*); U32 Kino_TermDocs_get_freq_death(TermDocs*); SV* Kino_TermDocs_get_positions_death(TermDocs*); void Kino_TermDocs_seek_tinfo_death(TermDocs*, TermInfo*); bool Kino_TermDocs_next_death(TermDocs*); bool Kino_TermDocs_skip_to_death(TermDocs*, U32); U32 Kino_TermDocs_bulk_read_death(TermDocs*, SV*, SV*, U32); void Kino_TermDocs_destroy(TermDocs*); .PP #endif /* include guard */ .PP _\|_C_\|_ .PP #include \*(L"KinoSearchIndexTermDocs.h\*(R" .PP TermDocs* \&\fIKino_TermDocs_new()\fR { TermDocs* term_docs; .PP .Vb 2 \& Kino_New(0, term_docs, 1, TermDocs); \& term_docs->child = NULL; .Ve .PP .Vb 10 \& /* force the subclass to override functions */ \& term_docs->set_doc_freq = Kino_TermDocs_set_doc_freq_death; \& term_docs->get_doc_freq = Kino_TermDocs_get_doc_freq_death; \& term_docs->get_doc = Kino_TermDocs_get_doc_death; \& term_docs->get_freq = Kino_TermDocs_get_freq_death; \& term_docs->get_positions = Kino_TermDocs_get_positions_death; \& term_docs->seek_tinfo = Kino_TermDocs_seek_tinfo_death; \& term_docs->next = Kino_TermDocs_next_death; \& term_docs->skip_to = Kino_TermDocs_skip_to_death; \& term_docs->destroy = Kino_TermDocs_destroy; .Ve .PP .Vb 2 \& return term_docs; \&} .Ve .PP void Kino_TermDocs_set_doc_freq_death(TermDocs *term_docs, U32 doc_freq) { Kino_confess(\*(L"term_docs\->set_doc_freq must be defined in a subclass\*(R"); } .PP U32 Kino_TermDocs_get_doc_freq_death(TermDocs *term_docs) { Kino_confess(\*(L"term_docs\->get_doc_freq must be defined in a subclass\*(R"); return 1; } .PP U32 Kino_TermDocs_get_doc_death(TermDocs *term_docs) { Kino_confess(\*(L"term_docs\->get_doc must be defined in a subclass\*(R"); return 1; } .PP U32 Kino_TermDocs_get_freq_death(TermDocs *term_docs) { Kino_confess(\*(L"term_docs\->get_freq must be defined in a subclass\*(R"); return 1; } .PP SV* Kino_TermDocs_get_positions_death(TermDocs *term_docs) { Kino_confess(\*(L"term_docs\->get_positions must be defined in a subclass\*(R"); return &PL_sv_undef; } .PP void Kino_TermDocs_seek_tinfo_death(TermDocs *term_docs, TermInfo *tinfo) { Kino_confess(\*(L"term_docs\->seek_tinfo must be defined in a subclass\*(R"); } .PP bool Kino_TermDocs_next_death(TermDocs *term_docs) { Kino_confess(\*(L"term_docs\->next must be defined in a subclass\*(R"); return 1; } .PP U32 Kino_TermDocs_bulk_read_death(TermDocs* term_docs, SV* doc_nums_sv, SV* freqs_sv, U32 num_wanted) { Kino_confess(\*(L"term_docs\->bulk_read must be defined in a subclass\*(R"); return 1; } .PP bool Kino_TermDocs_skip_to_death(TermDocs *term_docs, U32 target) { Kino_confess(\*(L"term_docs\->skip_to must be defined in a subclass\*(R"); return 1; } .PP void Kino_TermDocs_destroy(TermDocs *term_docs) { Kino_Safefree(term_docs); } .PP _\|_POD_\|_