| 247 | | |
|---|
| 248 | | void |
|---|
| 249 | | _make_subclasses (self) |
|---|
| 250 | | SV * self |
|---|
| 251 | | |
|---|
| 252 | | PREINIT: |
|---|
| 253 | | char* class; |
|---|
| 254 | | |
|---|
| 255 | | CODE: |
|---|
| 256 | | class = sv_reftype(SvRV(self), 1); |
|---|
| 257 | | //printf("parent class is %s\n", class); |
|---|
| 258 | | _make_subclasses(class); |
|---|
| 259 | | |
|---|
| 260 | | |
|---|
| 261 | | void |
|---|
| 262 | | _cleanup(self) |
|---|
| 263 | | SV* self; |
|---|
| 264 | | |
|---|
| 265 | | CODE: |
|---|
| 266 | | /* TODO */ |
|---|
| 267 | | |
|---|
| 268 | | |
|---|
| 269 | | |
|---|
| 270 | | SV* |
|---|
| 271 | | slurp_file(self, filename) |
|---|
| 272 | | SV* self; |
|---|
| 273 | | char* filename; |
|---|
| 274 | | |
|---|
| 275 | | CODE: |
|---|
| 276 | | RETVAL = newSVpv( (const char*)swish_slurp_file((xmlChar*)filename), 0 ); |
|---|
| 277 | | |
|---|
| 278 | | OUTPUT: |
|---|
| 279 | | RETVAL |
|---|
| 280 | | |
|---|
| 281 | | |
|---|
| 282 | | void |
|---|
| 283 | | _init_parser(self) |
|---|
| 284 | | SV* self; |
|---|
| 285 | | |
|---|
| 286 | | CODE: |
|---|
| 287 | | swish_init_parser(); |
|---|
| 288 | | _remember_handler(_get_object_key(self,callback_method)); |
|---|
| 289 | | |
|---|
| 290 | | |
|---|
| 291 | | void |
|---|
| 292 | | _free(self) |
|---|
| 293 | | SV* self; |
|---|
| 294 | | |
|---|
| 295 | | CODE: |
|---|
| 296 | | swish_free_parser(); |
|---|
| 297 | | |
|---|
| 298 | | # |
|---|
| 299 | | # TODO: pass our own _word_tokenizer() callback so we can use Perl regexp |
|---|
| 300 | | # TODO: passing void*self is NOT right. reference counting gets messed up. |
|---|
| 301 | | # maybe clone? or pass SvIV and then re-make SV in data->parser? |
|---|
| 302 | | |
|---|
| 303 | | int |
|---|
| 304 | | parse_file (self, filename) |
|---|
| 305 | | SV* self; |
|---|
| 306 | | SV* filename; |
|---|
| 307 | | |
|---|
| 308 | | PREINIT: |
|---|
| 309 | | char * file; |
|---|
| 310 | | SV * config; |
|---|
| 311 | | |
|---|
| 312 | | CODE: |
|---|
| 313 | | file = SvPV(filename, PL_na); |
|---|
| 314 | | config = _get_object_key(self,"config"); |
|---|
| 315 | | |
|---|
| 316 | | # need to swap return values to make it Perlish |
|---|
| 317 | | RETVAL = swish_parse_file((xmlChar*)file, |
|---|
| 318 | | (swish_Config*)SvIV((SV*)SvRV( config )), |
|---|
| 319 | | &swish_perl_handler, |
|---|
| 320 | | NULL, |
|---|
| 321 | | (void*)self |
|---|
| 322 | | ) |
|---|
| 323 | | ? 0 |
|---|
| 324 | | : 1; |
|---|
| 325 | | |
|---|
| 326 | | OUTPUT: |
|---|
| 327 | | RETVAL |
|---|
| 328 | | |
|---|
| 329 | | |
|---|
| 330 | | int |
|---|
| 331 | | parse_buf (self, buffer) |
|---|
| 332 | | SV* self; |
|---|
| 333 | | SV* buffer; |
|---|
| 334 | | |
|---|
| 335 | | PREINIT: |
|---|
| 336 | | SV* config; |
|---|
| 337 | | char* buf; |
|---|
| 338 | | |
|---|
| 339 | | CODE: |
|---|
| 340 | | config = _get_object_key(self,"config"); |
|---|
| 341 | | buf = SvPV(buffer, PL_na); |
|---|
| 342 | | |
|---|
| 343 | | RETVAL = swish_parse_buffer((xmlChar*)buf, |
|---|
| 344 | | (swish_Config*)SvIV((SV*)SvRV( config )), |
|---|
| 345 | | &swish_perl_handler, |
|---|
| 346 | | NULL, |
|---|
| 347 | | (void*)self |
|---|
| 348 | | ) |
|---|
| 349 | | ? 0 |
|---|
| 350 | | : 1; |
|---|
| 351 | | |
|---|
| 352 | | |
|---|
| 353 | | OUTPUT: |
|---|
| 354 | | RETVAL |
|---|
| 355 | | |
|---|
| 356 | | |
|---|
| 357 | | |
|---|
| 358 | | |
|---|
| 359 | | # ******************************************************************************* |
|---|
| 360 | | |
|---|
| 361 | | MODULE = SWISH::3 PACKAGE = SWISH::3::Parser::Word |
|---|
| 362 | | |
|---|
| 363 | | PROTOTYPES: disable |
|---|
| 364 | | |
|---|
| 365 | | SV * |
|---|
| 366 | | word (self) |
|---|
| 367 | | swish_Word * self; |
|---|
| 368 | | CODE: |
|---|
| 369 | | RETVAL = newSVpvn( (char*)self->word, strlen((char*)self->word) ); |
|---|
| 370 | | |
|---|
| 371 | | OUTPUT: |
|---|
| 372 | | RETVAL |
|---|
| 373 | | |
|---|
| 374 | | |
|---|
| 375 | | SV * |
|---|
| 376 | | metaname (self) |
|---|
| 377 | | swish_Word * self; |
|---|
| 378 | | CODE: |
|---|
| 379 | | RETVAL = newSVpvn( (char*)self->metaname, strlen((char*)self->metaname) ); |
|---|
| 380 | | |
|---|
| 381 | | OUTPUT: |
|---|
| 382 | | RETVAL |
|---|
| 383 | | |
|---|
| 384 | | SV * |
|---|
| 385 | | position (self) |
|---|
| 386 | | swish_Word * self; |
|---|
| 387 | | CODE: |
|---|
| 388 | | RETVAL = newSViv( self->position ); |
|---|
| 389 | | |
|---|
| 390 | | OUTPUT: |
|---|
| 391 | | RETVAL |
|---|
| 392 | | |
|---|
| 393 | | SV * |
|---|
| 394 | | start_offset(self) |
|---|
| 395 | | swish_Word * self; |
|---|
| 396 | | CODE: |
|---|
| 397 | | RETVAL = newSViv( self->start_offset ); |
|---|
| 398 | | |
|---|
| 399 | | OUTPUT: |
|---|
| 400 | | RETVAL |
|---|
| 401 | | |
|---|
| 402 | | SV * |
|---|
| 403 | | end_offset(self) |
|---|
| 404 | | swish_Word * self; |
|---|
| 405 | | CODE: |
|---|
| 406 | | RETVAL = newSViv( self->end_offset ); |
|---|
| 407 | | |
|---|
| 408 | | OUTPUT: |
|---|
| 409 | | RETVAL |
|---|
| 410 | | |
|---|
| 411 | | |
|---|
| 412 | | |
|---|
| 413 | | # ******************************************************************************* |
|---|
| 414 | | |
|---|
| 415 | | MODULE = SWISH::3 PACKAGE = SWISH::3::Parser::Doc |
|---|
| 416 | | |
|---|
| 417 | | PROTOTYPES: disable |
|---|
| 418 | | |
|---|
| 419 | | SV* |
|---|
| 420 | | mtime(self) |
|---|
| 421 | | swish_DocInfo * self; |
|---|
| 422 | | |
|---|
| 423 | | CODE: |
|---|
| 424 | | RETVAL = newSViv( self->mtime ); |
|---|
| 425 | | |
|---|
| 426 | | OUTPUT: |
|---|
| 427 | | RETVAL |
|---|
| 428 | | |
|---|
| 429 | | SV* |
|---|
| 430 | | size(self) |
|---|
| 431 | | swish_DocInfo * self; |
|---|
| 432 | | |
|---|
| 433 | | CODE: |
|---|
| 434 | | RETVAL = newSViv( self->size ); |
|---|
| 435 | | |
|---|
| 436 | | OUTPUT: |
|---|
| 437 | | RETVAL |
|---|
| 438 | | |
|---|
| 439 | | SV* |
|---|
| 440 | | nwords(self) |
|---|
| 441 | | swish_DocInfo * self; |
|---|
| 442 | | |
|---|
| 443 | | CODE: |
|---|
| 444 | | RETVAL = newSViv( self->nwords ); |
|---|
| 445 | | |
|---|
| 446 | | OUTPUT: |
|---|
| 447 | | RETVAL |
|---|
| 448 | | |
|---|
| 449 | | |
|---|
| 450 | | SV * |
|---|
| 451 | | encoding(self) |
|---|
| 452 | | swish_DocInfo * self; |
|---|
| 453 | | CODE: |
|---|
| 454 | | RETVAL = newSVpvn( (char*)self->encoding, strlen((char*)self->encoding) ); |
|---|
| 455 | | |
|---|
| 456 | | OUTPUT: |
|---|
| 457 | | RETVAL |
|---|
| 458 | | |
|---|
| 459 | | SV * |
|---|
| 460 | | uri(self) |
|---|
| 461 | | swish_DocInfo * self; |
|---|
| 462 | | CODE: |
|---|
| 463 | | RETVAL = newSVpvn( (char*)self->uri, strlen((char*)self->uri) ); |
|---|
| 464 | | |
|---|
| 465 | | OUTPUT: |
|---|
| 466 | | RETVAL |
|---|
| 467 | | |
|---|
| 468 | | SV * |
|---|
| 469 | | ext(self) |
|---|
| 470 | | swish_DocInfo * self; |
|---|
| 471 | | CODE: |
|---|
| 472 | | RETVAL = newSVpvn( (char*)self->ext, strlen((char*)self->ext) ); |
|---|
| 473 | | |
|---|
| 474 | | OUTPUT: |
|---|
| 475 | | RETVAL |
|---|
| 476 | | |
|---|
| 477 | | SV * |
|---|
| 478 | | mime(self) |
|---|
| 479 | | swish_DocInfo * self; |
|---|
| 480 | | CODE: |
|---|
| 481 | | RETVAL = newSVpvn( (char*)self->mime, strlen((char*)self->mime) ); |
|---|
| 482 | | |
|---|
| 483 | | OUTPUT: |
|---|
| 484 | | RETVAL |
|---|
| 485 | | |
|---|
| 486 | | |
|---|
| 487 | | SV * |
|---|
| 488 | | parser(self) |
|---|
| 489 | | swish_DocInfo * self; |
|---|
| 490 | | CODE: |
|---|
| 491 | | RETVAL = newSVpvn( (char*)self->parser, strlen((char*)self->parser) ); |
|---|
| 492 | | |
|---|
| 493 | | OUTPUT: |
|---|
| 494 | | RETVAL |
|---|
| 495 | | |
|---|
| 496 | | |
|---|
| 497 | | |
|---|
| 498 | | # ******************************************************************************* |
|---|
| 499 | | |
|---|
| 500 | | MODULE = SWISH::3 PACKAGE = SWISH::3::Parser::Property |
|---|
| 501 | | |
|---|
| 502 | | PROTOTYPES: disable |
|---|
| 503 | | |
|---|
| 504 | | |
|---|
| 505 | | |
|---|
| 506 | | # ******************************************************************************* |
|---|
| 507 | | |
|---|
| 508 | | MODULE = SWISH::3 PACKAGE = SWISH::3::Parser::WordList |
|---|
| 509 | | |
|---|
| 510 | | PROTOTYPES: disable |
|---|
| 511 | | |
|---|
| 512 | | swish_Word * |
|---|
| 513 | | next(self) |
|---|
| 514 | | swish_WordList * self |
|---|
| 515 | | |
|---|
| 516 | | PREINIT: |
|---|
| 517 | | char * CLASS; |
|---|
| 518 | | |
|---|
| 519 | | CODE: |
|---|
| 520 | | CLASS = _which_class("Word"); |
|---|
| 521 | | if (self->current == NULL) |
|---|
| 522 | | { |
|---|
| 523 | | self->current = self->head; |
|---|
| 524 | | } |
|---|
| 525 | | else |
|---|
| 526 | | { |
|---|
| 527 | | self->current = self->current->next; |
|---|
| 528 | | } |
|---|
| 529 | | RETVAL = self->current; |
|---|
| 530 | | |
|---|
| 531 | | OUTPUT: |
|---|
| 532 | | RETVAL |
|---|
| 533 | | |
|---|
| 534 | | |
|---|
| 535 | | |
|---|
| 536 | | |
|---|
| 537 | | # ******************************************************************************* |
|---|
| 538 | | |
|---|
| 539 | | MODULE = SWISH::3 PACKAGE = SWISH::3::Parser::Data |
|---|
| 540 | | |
|---|
| 541 | | PROTOTYPES: disable |
|---|
| 542 | | |
|---|
| 543 | | SV* |
|---|
| 544 | | parser(self) |
|---|
| 545 | | swish_ParseData * self |
|---|
| 546 | | |
|---|
| 547 | | PREINIT: |
|---|
| 548 | | SV* parser; |
|---|
| 549 | | |
|---|
| 550 | | CODE: |
|---|
| 551 | | RETVAL = self->user_data; |
|---|
| 552 | | |
|---|
| 553 | | OUTPUT: |
|---|
| 554 | | RETVAL |
|---|
| 555 | | |
|---|
| 556 | | |
|---|
| 557 | | swish_Config * |
|---|
| 558 | | config(self) |
|---|
| 559 | | swish_ParseData * self |
|---|
| 560 | | |
|---|
| 561 | | PREINIT: |
|---|
| 562 | | char* CLASS; |
|---|
| 563 | | |
|---|
| 564 | | CODE: |
|---|
| 565 | | CLASS = "SWISH::3::Config"; |
|---|
| 566 | | RETVAL = self->config; |
|---|
| 567 | | RETVAL->ref_cnt++; |
|---|
| 568 | | |
|---|
| 569 | | OUTPUT: |
|---|
| 570 | | RETVAL |
|---|
| 571 | | |
|---|
| 572 | | |
|---|
| 573 | | SV* |
|---|
| 574 | | property(self,p) |
|---|
| 575 | | swish_ParseData * self; |
|---|
| 576 | | xmlChar * p; |
|---|
| 577 | | |
|---|
| 578 | | PREINIT: |
|---|
| 579 | | xmlBufferPtr buf; |
|---|
| 580 | | |
|---|
| 581 | | CODE: |
|---|
| 582 | | buf = xmlHashLookup(self->propHash,p); |
|---|
| 583 | | RETVAL = newSVpvn((char*)xmlBufferContent(buf), xmlBufferLength(buf)); |
|---|
| 584 | | |
|---|
| 585 | | OUTPUT: |
|---|
| 586 | | RETVAL |
|---|
| 587 | | |
|---|
| 588 | | |
|---|
| 589 | | swish_DocInfo * |
|---|
| 590 | | doc(self) |
|---|
| 591 | | swish_ParseData * self |
|---|
| 592 | | |
|---|
| 593 | | PREINIT: |
|---|
| 594 | | char* CLASS; |
|---|
| 595 | | |
|---|
| 596 | | CODE: |
|---|
| 597 | | CLASS = _which_class("Doc"); |
|---|
| 598 | | RETVAL = self->docinfo; |
|---|
| 599 | | |
|---|
| 600 | | OUTPUT: |
|---|
| 601 | | RETVAL |
|---|
| 602 | | |
|---|
| 603 | | swish_WordList * |
|---|
| 604 | | wordlist(self) |
|---|
| 605 | | swish_ParseData * self |
|---|
| 606 | | |
|---|
| 607 | | PREINIT: |
|---|
| 608 | | char* CLASS; |
|---|
| 609 | | |
|---|
| 610 | | CODE: |
|---|
| 611 | | CLASS = _which_class("WordList"); |
|---|
| 612 | | RETVAL = self->wordlist; |
|---|
| 613 | | |
|---|
| 614 | | OUTPUT: |
|---|
| 615 | | RETVAL |
|---|
| 616 | | |
|---|
| 617 | | |
|---|
| 618 | | |
|---|
| 619 | | # *************************************************************************************/ |
|---|
| 620 | | |
|---|
| 621 | | MODULE = SWISH::3 PACKAGE = SWISH::3::Config |
|---|
| 622 | | |
|---|
| 623 | | PROTOTYPES: enable |
|---|
| 624 | | |
|---|
| | 247 | |
|---|
| | 248 | # TODO more from libswish3.h |
|---|
| 654 | | |
|---|
| 655 | | |
|---|
| | 278 | |
|---|
| | 279 | # ********************************************************************************* |
|---|
| | 280 | |
|---|
| | 281 | MODULE = SWISH::3 PACKAGE = SWISH::3::Parser |
|---|
| | 282 | |
|---|
| | 283 | PROTOTYPES: enable |
|---|
| | 284 | |
|---|
| | 285 | void |
|---|
| | 286 | _make_subclasses (self) |
|---|
| | 287 | SV * self |
|---|
| | 288 | |
|---|
| | 289 | PREINIT: |
|---|
| | 290 | char* class; |
|---|
| | 291 | |
|---|
| | 292 | CODE: |
|---|
| | 293 | class = sv_reftype(SvRV(self), 1); |
|---|
| | 294 | //printf("parent class is %s\n", class); |
|---|
| | 295 | _make_subclasses(class); |
|---|
| | 296 | |
|---|
| | 297 | |
|---|
| | 298 | void |
|---|
| | 299 | _cleanup(self) |
|---|
| | 300 | SV* self; |
|---|
| | 301 | |
|---|
| | 302 | CODE: |
|---|
| | 303 | /* TODO */ |
|---|
| | 304 | |
|---|
| | 305 | |
|---|
| | 306 | |
|---|
| | 307 | SV* |
|---|
| | 308 | slurp_file(self, filename) |
|---|
| | 309 | SV* self; |
|---|
| | 310 | char* filename; |
|---|
| | 311 | |
|---|
| | 312 | CODE: |
|---|
| | 313 | RETVAL = newSVpv( (const char*)swish_slurp_file((xmlChar*)filename), 0 ); |
|---|
| | 314 | |
|---|
| | 315 | OUTPUT: |
|---|
| | 316 | RETVAL |
|---|
| | 317 | |
|---|
| | 318 | |
|---|
| | 319 | void |
|---|
| | 320 | _init_parser(self) |
|---|
| | 321 | SV* self; |
|---|
| | 322 | |
|---|
| | 323 | CODE: |
|---|
| | 324 | swish_init_parser(); |
|---|
| | 325 | _remember_handler(_get_object_key(self,callback_method)); |
|---|
| | 326 | |
|---|
| | 327 | |
|---|
| | 328 | void |
|---|
| | 329 | _free(self) |
|---|
| | 330 | SV* self; |
|---|
| | 331 | |
|---|
| | 332 | CODE: |
|---|
| | 333 | swish_free_parser(); |
|---|
| | 334 | |
|---|
| | 335 | # |
|---|
| | 336 | # TODO: pass our own _word_tokenizer() callback so we can use Perl regexp |
|---|
| | 337 | # |
|---|
| | 338 | |
|---|
| | 339 | |
|---|
| | 340 | int |
|---|
| | 341 | parse_file (self, filename) |
|---|
| | 342 | SV* self; |
|---|
| | 343 | SV* filename; |
|---|
| | 344 | |
|---|
| | 345 | PREINIT: |
|---|
| | 346 | char * file; |
|---|
| | 347 | SV * config; |
|---|
| | 348 | |
|---|
| | 349 | CODE: |
|---|
| | 350 | file = SvPV(filename, PL_na); |
|---|
| | 351 | config = _get_object_key(self,"config"); |
|---|
| | 352 | |
|---|
| | 353 | # need to swap return values to make it Perlish |
|---|
| | 354 | RETVAL = swish_parse_file((xmlChar*)file, |
|---|
| | 355 | (swish_Config*)SvIV((SV*)SvRV( config )), |
|---|
| | 356 | &swish_perl_handler, |
|---|
| | 357 | NULL, |
|---|
| | 358 | (void*)SvREFCNT_inc( self ) |
|---|
| | 359 | ) |
|---|
| | 360 | ? 0 |
|---|
| | 361 | : 1; |
|---|
| | 362 | |
|---|
| | 363 | OUTPUT: |
|---|
| | 364 | RETVAL |
|---|
| | 365 | |
|---|
| | 366 | |
|---|
| | 367 | int |
|---|
| | 368 | parse_buf (self, buffer) |
|---|
| | 369 | SV* self; |
|---|
| | 370 | SV* buffer; |
|---|
| | 371 | |
|---|
| | 372 | PREINIT: |
|---|
| | 373 | SV* config; |
|---|
| | 374 | char* buf; |
|---|
| | 375 | |
|---|
| | 376 | CODE: |
|---|
| | 377 | config = _get_object_key(self,"config"); |
|---|
| | 378 | buf = SvPV(buffer, PL_na); |
|---|
| | 379 | |
|---|
| | 380 | RETVAL = swish_parse_buffer((xmlChar*)buf, |
|---|
| | 381 | (swish_Config*)SvIV((SV*)SvRV( config )), |
|---|
| | 382 | &swish_perl_handler, |
|---|
| | 383 | NULL, |
|---|
| | 384 | (void*)SvREFCNT_inc( self ) |
|---|
| | 385 | ) |
|---|
| | 386 | ? 0 |
|---|
| | 387 | : 1; |
|---|
| | 388 | |
|---|
| | 389 | |
|---|
| | 390 | OUTPUT: |
|---|
| | 391 | RETVAL |
|---|
| | 392 | |
|---|
| | 393 | |
|---|
| | 394 | |
|---|
| | 395 | |
|---|
| | 396 | # ******************************************************************************* |
|---|
| | 397 | |
|---|
| | 398 | MODULE = SWISH::3 PACKAGE = SWISH::3::Parser::Word |
|---|
| | 399 | |
|---|
| | 400 | PROTOTYPES: disable |
|---|
| | 401 | |
|---|
| | 402 | SV * |
|---|
| | 403 | word (self) |
|---|
| | 404 | swish_Word * self; |
|---|
| | 405 | CODE: |
|---|
| | 406 | RETVAL = newSVpvn( (char*)self->word, strlen((char*)self->word) ); |
|---|
| | 407 | |
|---|
| | 408 | OUTPUT: |
|---|
| | 409 | RETVAL |
|---|
| | 410 | |
|---|
| | 411 | |
|---|
| | 412 | SV * |
|---|
| | 413 | metaname (self) |
|---|
| | 414 | swish_Word * self; |
|---|
| | 415 | CODE: |
|---|
| | 416 | RETVAL = newSVpvn( (char*)self->metaname, strlen((char*)self->metaname) ); |
|---|
| | 417 | |
|---|
| | 418 | OUTPUT: |
|---|
| | 419 | RETVAL |
|---|
| | 420 | |
|---|
| | 421 | SV * |
|---|
| | 422 | context (self) |
|---|
| | 423 | swish_Word * self; |
|---|
| | 424 | CODE: |
|---|
| | 425 | RETVAL = newSVpvn( (char*)self->context, strlen((char*)self->context) ); |
|---|
| | 426 | |
|---|
| | 427 | OUTPUT: |
|---|
| | 428 | RETVAL |
|---|
| | 429 | |
|---|
| | 430 | |
|---|
| | 431 | SV * |
|---|
| | 432 | position (self) |
|---|
| | 433 | swish_Word * self; |
|---|
| | 434 | CODE: |
|---|
| | 435 | RETVAL = newSViv( self->position ); |
|---|
| | 436 | |
|---|
| | 437 | OUTPUT: |
|---|
| | 438 | RETVAL |
|---|
| | 439 | |
|---|
| | 440 | SV * |
|---|
| | 441 | start_offset(self) |
|---|
| | 442 | swish_Word * self; |
|---|
| | 443 | CODE: |
|---|
| | 444 | RETVAL = newSViv( self->start_offset ); |
|---|
| | 445 | |
|---|
| | 446 | OUTPUT: |
|---|
| | 447 | RETVAL |
|---|
| | 448 | |
|---|
| | 449 | SV * |
|---|
| | 450 | end_offset(self) |
|---|
| | 451 | swish_Word * self; |
|---|
| | 452 | CODE: |
|---|
| | 453 | RETVAL = newSViv( self->end_offset ); |
|---|
| | 454 | |
|---|
| | 455 | OUTPUT: |
|---|
| | 456 | RETVAL |
|---|
| | 457 | |
|---|
| | 458 | |
|---|
| | 459 | |
|---|
| | 460 | # ******************************************************************************* |
|---|
| | 461 | |
|---|
| | 462 | MODULE = SWISH::3 PACKAGE = SWISH::3::Parser::Doc |
|---|
| | 463 | |
|---|
| | 464 | PROTOTYPES: disable |
|---|
| | 465 | |
|---|
| | 466 | SV* |
|---|
| | 467 | mtime(self) |
|---|
| | 468 | swish_DocInfo * self; |
|---|
| | 469 | |
|---|
| | 470 | CODE: |
|---|
| | 471 | RETVAL = newSViv( self->mtime ); |
|---|
| | 472 | |
|---|
| | 473 | OUTPUT: |
|---|
| | 474 | RETVAL |
|---|
| | 475 | |
|---|
| | 476 | SV* |
|---|
| | 477 | size(self) |
|---|
| | 478 | swish_DocInfo * self; |
|---|
| | 479 | |
|---|
| | 480 | CODE: |
|---|
| | 481 | RETVAL = newSViv( self->size ); |
|---|
| | 482 | |
|---|
| | 483 | OUTPUT: |
|---|
| | 484 | RETVAL |
|---|
| | 485 | |
|---|
| | 486 | SV* |
|---|
| | 487 | nwords(self) |
|---|
| | 488 | swish_DocInfo * self; |
|---|
| | 489 | |
|---|
| | 490 | CODE: |
|---|
| | 491 | RETVAL = newSViv( self->nwords ); |
|---|
| | 492 | |
|---|
| | 493 | OUTPUT: |
|---|
| | 494 | RETVAL |
|---|
| | 495 | |
|---|
| | 496 | |
|---|
| | 497 | SV * |
|---|
| | 498 | encoding(self) |
|---|
| | 499 | swish_DocInfo * self; |
|---|
| | 500 | CODE: |
|---|
| | 501 | RETVAL = newSVpvn( (char*)self->encoding, strlen((char*)self->encoding) ); |
|---|
| | 502 | |
|---|
| | 503 | OUTPUT: |
|---|
| | 504 | RETVAL |
|---|
| | 505 | |
|---|
| | 506 | SV * |
|---|
| | 507 | uri(self) |
|---|
| | 508 | swish_DocInfo * self; |
|---|
| | 509 | CODE: |
|---|
| | 510 | RETVAL = newSVpvn( (char*)self->uri, strlen((char*)self->uri) ); |
|---|
| | 511 | |
|---|
| | 512 | OUTPUT: |
|---|
| | 513 | RETVAL |
|---|
| | 514 | |
|---|
| | 515 | SV * |
|---|
| | 516 | ext(self) |
|---|
| | 517 | swish_DocInfo * self; |
|---|
| | 518 | CODE: |
|---|
| | 519 | RETVAL = newSVpvn( (char*)self->ext, strlen((char*)self->ext) ); |
|---|
| | 520 | |
|---|
| | 521 | OUTPUT: |
|---|
| | 522 | RETVAL |
|---|
| | 523 | |
|---|
| | 524 | SV * |
|---|
| | 525 | mime(self) |
|---|
| | 526 | swish_DocInfo * self; |
|---|
| | 527 | CODE: |
|---|
| | 528 | RETVAL = newSVpvn( (char*)self->mime, strlen((char*)self->mime) ); |
|---|
| | 529 | |
|---|
| | 530 | OUTPUT: |
|---|
| | 531 | RETVAL |
|---|
| | 532 | |
|---|
| | 533 | |
|---|
| | 534 | SV * |
|---|
| | 535 | parser(self) |
|---|
| | 536 | swish_DocInfo * self; |
|---|
| | 537 | CODE: |
|---|
| | 538 | RETVAL = newSVpvn( (char*)self->parser, strlen((char*)self->parser) ); |
|---|
| | 539 | |
|---|
| | 540 | OUTPUT: |
|---|
| | 541 | RETVAL |
|---|
| | 542 | |
|---|
| | 543 | |
|---|
| | 544 | |
|---|
| | 545 | # ******************************************************************************* |
|---|
| | 546 | |
|---|
| | 547 | MODULE = SWISH::3 PACKAGE = SWISH::3::Parser::Property |
|---|
| | 548 | |
|---|
| | 549 | PROTOTYPES: disable |
|---|
| | 550 | |
|---|
| | 551 | |
|---|
| | 552 | |
|---|
| | 553 | # ******************************************************************************* |
|---|
| | 554 | |
|---|
| | 555 | MODULE = SWISH::3 PACKAGE = SWISH::3::Parser::WordList |
|---|
| | 556 | |
|---|
| | 557 | PROTOTYPES: disable |
|---|
| | 558 | |
|---|
| | 559 | swish_Word * |
|---|
| | 560 | next(self) |
|---|
| | 561 | swish_WordList * self |
|---|
| | 562 | |
|---|
| | 563 | PREINIT: |
|---|
| | 564 | char * CLASS; |
|---|
| | 565 | |
|---|
| | 566 | CODE: |
|---|
| | 567 | CLASS = _which_class("Word"); |
|---|
| | 568 | if (self->current == NULL) |
|---|
| | 569 | { |
|---|
| | 570 | self->current = self->head; |
|---|
| | 571 | } |
|---|
| | 572 | else |
|---|
| | 573 | { |
|---|
| | 574 | self->current = self->current->next; |
|---|
| | 575 | } |
|---|
| | 576 | RETVAL = self->current; |
|---|
| | 577 | |
|---|
| | 578 | OUTPUT: |
|---|
| | 579 | RETVAL |
|---|
| | 580 | |
|---|
| | 581 | |
|---|
| | 582 | |
|---|
| | 583 | |
|---|
| | 584 | # ******************************************************************************* |
|---|
| | 585 | |
|---|
| | 586 | MODULE = SWISH::3 PACKAGE = SWISH::3::Parser::Data |
|---|
| | 587 | |
|---|
| | 588 | PROTOTYPES: disable |
|---|
| | 589 | |
|---|
| | 590 | SV* |
|---|
| | 591 | parser(self) |
|---|
| | 592 | swish_ParseData * self |
|---|
| | 593 | |
|---|
| | 594 | PREINIT: |
|---|
| | 595 | SV* parser; |
|---|
| | 596 | |
|---|
| | 597 | CODE: |
|---|
| | 598 | RETVAL = self->user_data; |
|---|
| | 599 | |
|---|
| | 600 | OUTPUT: |
|---|
| | 601 | RETVAL |
|---|
| | 602 | |
|---|
| | 603 | |
|---|
| | 604 | swish_Config * |
|---|
| | 605 | config(self) |
|---|
| | 606 | swish_ParseData * self |
|---|
| | 607 | |
|---|
| | 608 | PREINIT: |
|---|
| | 609 | char* CLASS; |
|---|
| | 610 | |
|---|
| | 611 | CODE: |
|---|
| | 612 | CLASS = "SWISH::3::Config"; |
|---|
| | 613 | RETVAL = self->config; |
|---|
| | 614 | RETVAL->ref_cnt++; |
|---|
| | 615 | |
|---|
| | 616 | OUTPUT: |
|---|
| | 617 | RETVAL |
|---|
| | 618 | |
|---|
| | 619 | |
|---|
| | 620 | SV* |
|---|
| | 621 | property(self,p) |
|---|
| | 622 | swish_ParseData * self; |
|---|
| | 623 | xmlChar * p; |
|---|
| | 624 | |
|---|
| | 625 | PREINIT: |
|---|
| | 626 | xmlBufferPtr buf; |
|---|
| | 627 | |
|---|
| | 628 | CODE: |
|---|
| | 629 | buf = xmlHashLookup(self->propHash,p); |
|---|
| | 630 | RETVAL = newSVpvn((char*)xmlBufferContent(buf), xmlBufferLength(buf)); |
|---|
| | 631 | |
|---|
| | 632 | OUTPUT: |
|---|
| | 633 | RETVAL |
|---|
| | 634 | |
|---|
| | 635 | |
|---|
| | 636 | swish_DocInfo * |
|---|
| | 637 | doc(self) |
|---|
| | 638 | swish_ParseData * self |
|---|
| | 639 | |
|---|
| | 640 | PREINIT: |
|---|
| | 641 | char* CLASS; |
|---|
| | 642 | |
|---|
| | 643 | CODE: |
|---|
| | 644 | CLASS = _which_class("Doc"); |
|---|
| | 645 | RETVAL = self->docinfo; |
|---|
| | 646 | |
|---|
| | 647 | OUTPUT: |
|---|
| | 648 | RETVAL |
|---|
| | 649 | |
|---|
| | 650 | swish_WordList * |
|---|
| | 651 | wordlist(self) |
|---|
| | 652 | swish_ParseData * self |
|---|
| | 653 | |
|---|
| | 654 | PREINIT: |
|---|
| | 655 | char* CLASS; |
|---|
| | 656 | |
|---|
| | 657 | CODE: |
|---|
| | 658 | CLASS = _which_class("WordList"); |
|---|
| | 659 | RETVAL = self->wordlist; |
|---|
| | 660 | |
|---|
| | 661 | OUTPUT: |
|---|
| | 662 | RETVAL |
|---|
| | 663 | |
|---|
| | 664 | |
|---|
| | 665 | # must decrement refcount for stashed SWISH::3::Parser object |
|---|
| | 666 | # since we increment it in parse_buf() and parse_file() |
|---|
| | 667 | # TODO: this way of doing it doesn't work. |
|---|
| | 668 | # but isn't it a potential mem leak to just _inc in parse_*() without |
|---|
| | 669 | # _dec somewhere else? just means that the SWISH::3::Parser object |
|---|
| | 670 | # may never get garbage collected. |
|---|
| | 671 | #void |
|---|
| | 672 | #DESTROY(self) |
|---|
| | 673 | # swish_ParseData * self; |
|---|
| | 674 | # |
|---|
| | 675 | # CODE: |
|---|
| | 676 | # SvREFCNT_dec( self->user_data ); |
|---|
| | 677 | |
|---|
| | 678 | |
|---|
| | 679 | |
|---|
| | 680 | # *************************************************************************************/ |
|---|
| | 681 | |
|---|
| | 682 | MODULE = SWISH::3 PACKAGE = SWISH::3::Config |
|---|
| | 683 | |
|---|
| | 684 | PROTOTYPES: disable |
|---|