1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598
|
/*
Copyright (C) 2002 Apuã Paquola - Instituto de Química -
Universidade de São Paulo - Brasil
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include <zerg.h>
static int
not_here(char *s)
{
croak("%s not implemented on this architecture", s);
return -1;
}
static double
constant_PE(char *name, int len, int arg)
{
if (2 + 6 >= len ) {
errno = EINVAL;
return 0;
}
switch (name[2 + 6]) {
case 'I':
if (strEQ(name + 2, "RCENT_IDENTITIES")) { /* PE removed */
#ifdef PERCENT_IDENTITIES
return PERCENT_IDENTITIES;
#else
goto not_there;
#endif
}
case 'P':
if (strEQ(name + 2, "RCENT_POSITIVES")) { /* PE removed */
#ifdef PERCENT_POSITIVES
return PERCENT_POSITIVES;
#else
goto not_there;
#endif
}
}
errno = EINVAL;
return 0;
not_there:
errno = ENOENT;
return 0;
}
static double
constant_P(char *name, int len, int arg)
{
switch (name[1 + 0]) {
case 'E':
return constant_PE(name, len, arg);
case 'O':
if (strEQ(name + 1, "OSITIVES")) { /* P removed */
#ifdef POSITIVES
return POSITIVES;
#else
goto not_there;
#endif
}
}
errno = EINVAL;
return 0;
not_there:
errno = ENOENT;
return 0;
}
static double
constant_Q(char *name, int len, int arg)
{
if (1 + 5 >= len ) {
errno = EINVAL;
return 0;
}
switch (name[1 + 5]) {
case 'A':
if (strEQ(name + 1, "UERY_ALI")) { /* Q removed */
#ifdef QUERY_ALI
return QUERY_ALI;
#else
goto not_there;
#endif
}
else if (strEQ(name + 1, "UERY_ANNOTATION")) { /* Q removed */
#ifdef QUERY_ANNOTATION
return QUERY_ANNOTATION;
#else
goto not_there;
#endif
}
case 'E':
if (strEQ(name + 1, "UERY_END")) { /* Q removed */
#ifdef QUERY_END
return QUERY_END;
#else
goto not_there;
#endif
}
case 'F':
if (strEQ(name + 1, "UERY_FRAME")) { /* Q removed */
#ifdef QUERY_FRAME
return QUERY_FRAME;
#else
goto not_there;
#endif
}
case 'L':
if (strEQ(name + 1, "UERY_LENGTH")) { /* Q removed */
#ifdef QUERY_LENGTH
return QUERY_LENGTH;
#else
goto not_there;
#endif
}
case 'N':
if (strEQ(name + 1, "UERY_NAME")) { /* Q removed */
#ifdef QUERY_NAME
return QUERY_NAME;
#else
goto not_there;
#endif
}
case 'O':
if (strEQ(name + 1, "UERY_ORIENTATION")) { /* Q removed */
#ifdef QUERY_ORIENTATION
return QUERY_ORIENTATION;
#else
goto not_there;
#endif
}
case 'S':
if (strEQ(name + 1, "UERY_START")) { /* Q removed */
#ifdef QUERY_START
return QUERY_START;
#else
goto not_there;
#endif
}
}
errno = EINVAL;
return 0;
not_there:
errno = ENOENT;
return 0;
}
static double
constant_R(char *name, int len, int arg)
{
if (strEQ(name + 1, "EFERENCE")) { /* R removed */
#ifdef REFERENCE
return REFERENCE;
#else
goto not_there;
#endif
}
else if (strEQ(name + 1, "OUND_NUMBER")) { /* R removed */
#ifdef ROUND_NUMBER
return ROUND_NUMBER;
#else
goto not_there;
#endif
}
else if (strEQ(name + 1, "OUND_SEQ_FOUND")) { /* R removed */
#ifdef ROUND_SEQ_FOUND
return ROUND_SEQ_FOUND;
#else
goto not_there;
#endif
}
else if (strEQ(name + 1, "OUND_SEQ_NEW")) { /* R removed */
#ifdef ROUND_SEQ_NEW
return ROUND_SEQ_NEW;
#else
goto not_there;
#endif
}
errno = EINVAL;
return 0;
not_there:
errno = ENOENT;
return 0;
}
static double
constant_SC(char *name, int len, int arg)
{
if (2 + 3 > len ) {
errno = EINVAL;
return 0;
}
switch (name[2 + 3]) {
case '\0':
if (strEQ(name + 2, "ORE")) { /* SC removed */
#ifdef SCORE
return SCORE;
#else
goto not_there;
#endif
}
case '_':
if (strEQ(name + 2, "ORE_BITS")) { /* SC removed */
#ifdef SCORE_BITS
return SCORE_BITS;
#else
goto not_there;
#endif
}
}
errno = EINVAL;
return 0;
not_there:
errno = ENOENT;
return 0;
}
static double
constant_SU(char *name, int len, int arg)
{
if (2 + 6 >= len ) {
errno = EINVAL;
return 0;
}
switch (name[2 + 6]) {
case 'A':
if (strEQ(name + 2, "BJECT_ALI")) { /* SU removed */
#ifdef SUBJECT_ALI
return SUBJECT_ALI;
#else
goto not_there;
#endif
}
else if (strEQ(name + 2, "BJECT_ANNOTATION")) { /* SU removed */
#ifdef SUBJECT_ANNOTATION
return SUBJECT_ANNOTATION;
#else
goto not_there;
#endif
}
case 'E':
if (strEQ(name + 2, "BJECT_END")) { /* SU removed */
#ifdef SUBJECT_END
return SUBJECT_END;
#else
goto not_there;
#endif
}
case 'F':
if (strEQ(name + 2, "BJECT_FRAME")) { /* SU removed */
#ifdef SUBJECT_FRAME
return SUBJECT_FRAME;
#else
goto not_there;
#endif
}
case 'L':
if (strEQ(name + 2, "BJECT_LENGTH")) { /* SU removed */
#ifdef SUBJECT_LENGTH
return SUBJECT_LENGTH;
#else
goto not_there;
#endif
}
case 'N':
if (strEQ(name + 2, "BJECT_NAME")) { /* SU removed */
#ifdef SUBJECT_NAME
return SUBJECT_NAME;
#else
goto not_there;
#endif
}
case 'O':
if (strEQ(name + 2, "BJECT_ORIENTATION")) { /* SU removed */
#ifdef SUBJECT_ORIENTATION
return SUBJECT_ORIENTATION;
#else
goto not_there;
#endif
}
case 'S':
if (strEQ(name + 2, "BJECT_START")) { /* SU removed */
#ifdef SUBJECT_START
return SUBJECT_START;
#else
goto not_there;
#endif
}
}
errno = EINVAL;
return 0;
not_there:
errno = ENOENT;
return 0;
}
static double
constant_S(char *name, int len, int arg)
{
switch (name[1 + 0]) {
case 'C':
return constant_SC(name, len, arg);
case 'E':
if (strEQ(name + 2, "ARCHING")) { /* SE removed */
#ifdef SEARCHING
return SEARCHING;
#else
goto not_there;
#endif
}
case 'U':
return constant_SU(name, len, arg);
}
errno = EINVAL;
return 0;
not_there:
errno = ENOENT;
return 0;
}
static double
constant_D(char *name, int len, int arg)
{
if (strEQ(name + 1, "ATABASE")) { /* D removed */
#ifdef DATABASE
return DATABASE;
#else
goto not_there;
#endif
}
if (1 + 11 >= len ) {
errno = EINVAL;
return 0;
}
switch (name[1 + 11]) {
case 'A':
if (strEQ(name + 1, "ESCRIPTION_ANNOTATION")) { /* D removed */
#ifdef DESCRIPTION_ANNOTATION
return DESCRIPTION_ANNOTATION;
#else
goto not_there;
#endif
}
case 'E':
if (strEQ(name + 1, "ESCRIPTION_EVALUE")) { /* D removed */
#ifdef DESCRIPTION_EVALUE
return DESCRIPTION_EVALUE;
#else
goto not_there;
#endif
}
case 'H':
if (strEQ(name + 1, "ESCRIPTION_HITNAME")) { /* D removed */
#ifdef DESCRIPTION_HITNAME
return DESCRIPTION_HITNAME;
#else
goto not_there;
#endif
}
case 'S':
if (strEQ(name + 1, "ESCRIPTION_SCORE")) { /* D removed */
#ifdef DESCRIPTION_SCORE
return DESCRIPTION_SCORE;
#else
goto not_there;
#endif
}
}
errno = EINVAL;
return 0;
not_there:
errno = ENOENT;
return 0;
}
static double
constant_E(char *name, int len, int arg)
{
switch (name[1 + 0]) {
case 'N':
if (strEQ(name + 1, "ND_OF_REPORT")) { /* E removed */
#ifdef END_OF_REPORT
return END_OF_REPORT;
#else
goto not_there;
#endif
}
case 'V':
if (strEQ(name + 1, "VALUE")) { /* E removed */
#ifdef EVALUE
return EVALUE;
#else
goto not_there;
#endif
}
}
errno = EINVAL;
return 0;
not_there:
errno = ENOENT;
return 0;
}
static double
constant(char *name, int len, int arg)
{
errno = 0;
switch (name[0 + 0]) {
case 'A':
if (strEQ(name + 0, "ALIGNMENT_LENGTH")) { /* removed */
#ifdef ALIGNMENT_LENGTH
return ALIGNMENT_LENGTH;
#else
goto not_there;
#endif
}
case 'B':
if (strEQ(name + 0, "BLAST_VERSION")) { /* removed */
#ifdef BLAST_VERSION
return BLAST_VERSION;
#else
goto not_there;
#endif
}
case 'C':
if (strEQ(name + 1, "ONVERGED")) { /* C removed */
#ifdef CONVERGED
return CONVERGED;
#else
goto not_there;
#endif
}
case 'D':
return constant_D(name, len, arg);
case 'E':
return constant_E(name, len, arg);
case 'G':
if (strEQ(name + 0, "GAPS")) { /* removed */
#ifdef GAPS
return GAPS;
#else
goto not_there;
#endif
}
case 'H':
if (strEQ(name + 1, "SP_METHOD")) { /* H removed */
#ifdef HSP_METHOD
return HSP_METHOD;
#else
goto not_there;
#endif
}
case 'I':
if (strEQ(name + 0, "IDENTITIES")) { /* removed */
#ifdef IDENTITIES
return IDENTITIES;
#else
goto not_there;
#endif
}
case 'N':
if (strEQ(name + 0, "NOHITS")) { /* removed */
#ifdef NOHITS
return NOHITS;
#else
goto not_there;
#endif
}
case 'P':
return constant_P(name, len, arg);
case 'Q':
return constant_Q(name, len, arg);
case 'R':
return constant_R(name, len, arg);
case 'S':
return constant_S(name, len, arg);
case 'T':
if (strEQ(name + 0, "TAIL_OF_REPORT")) { /* removed */
#ifdef TAIL_OF_REPORT
return TAIL_OF_REPORT;
#else
goto not_there;
#endif
}
case 'U':
if (strEQ(name + 0, "UNMATCHED")) { /* removed */
#ifdef UNMATCHED
return UNMATCHED;
#else
goto not_there;
#endif
}
}
errno = EINVAL;
return 0;
not_there:
errno = ENOENT;
return 0;
}
MODULE = Zerg PACKAGE = Zerg
double
constant(sv,arg)
PROTOTYPE: DISABLE
PREINIT:
STRLEN len;
INPUT:
SV * sv
char * s = SvPV(sv, len);
int arg
CODE:
RETVAL = constant(s,len,arg);
OUTPUT:
RETVAL
void
zerg_open_file(filename)
char* filename
CODE:
zerg_open_file(filename);
void
zerg_close_file()
CODE:
zerg_close_file();
void
zerg_ignore(code)
int code
CODE:
zerg_ignore(code);
void
zerg_ignore_all()
CODE:
zerg_ignore_all();
void
zerg_unignore(code)
int code
CODE:
zerg_unignore(code);
void
zerg_unignore_all()
CODE:
zerg_unignore_all();
void
zerg_get_token()
PPCODE:
int c;
char *v;
zerg_get_token(&c, &v);
XPUSHs(sv_2mortal(newSViv(c)));
XPUSHs(sv_2mortal(newSVpv(v,0)));
int
zerg_get_token_offset()
CODE:
RETVAL=zerg_get_token_offset();
OUTPUT:
RETVAL
|