1 /* @include ajindex *********************************************************** 2 ** 3 ** B+ Tree Indexing plus Disc Cache. 4 ** 5 ** @author Copyright (c) 2003 Alan Bleasby 6 ** @version $Revision: 1.44 $ 7 ** @modified subsequently heavily modified by Peter Rice 8 ** @modified $Date: 2013/01/24 15:30:42 $ by $Author: rice $ 9 ** 10 ** This library is free software; you can redistribute it and/or 11 ** modify it under the terms of the GNU Lesser General Public 12 ** License as published by the Free Software Foundation; either 13 ** version 2.1 of the License, or (at your option) any later version. 14 ** 15 ** This library is distributed in the hope that it will be useful, 16 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 17 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 ** Lesser General Public License for more details. 19 ** 20 ** You should have received a copy of the GNU Lesser General Public 21 ** License along with this library; if not, write to the Free Software 22 ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 23 ** MA 02110-1301, USA. 24 ** 25 ******************************************************************************/ 26 27 #ifndef AJINDEX_H 28 #define AJINDEX_H 29 30 /* ========================================================================= */ 31 /* ============================= include files ============================= */ 32 /* ========================================================================= */ 33 34 #include "ajdefine.h" 35 #include "ajstr.h" 36 #include "ajtable.h" 37 #include "ajlist.h" 38 #include "ajfile.h" 39 40 AJ_BEGIN_DECLS 41 42 43 44 45 /* ========================================================================= */ 46 /* =============================== constants =============================== */ 47 /* ========================================================================= */ 48 49 50 51 52 #define BT_PAGESIZE BUFSIZ /* Default cache page size 53 ** use C default buffer size */ 54 #define BT_CACHESIZE 100 55 56 #define BT_MAXRETRIES 100 /* Maximum number of read/write attempts */ 57 #define BT_KWLIMIT 15 58 59 #define BT_LOCK 2 60 #define BT_DIRTY 1 61 #define BT_CLEAN 0 62 63 #define BT_READ ajTrue 64 #define BT_WRITE ajFalse 65 66 67 #define BT_ROOT 1 68 #define BT_INTERNAL 2 69 #define BT_LEAF 4 70 #define BT_IDBUCKET 8 71 #define BT_OVERFLOW 16 72 #define BT_PRIBUCKET 32 73 #define BT_SECBUCKET 64 74 #define BT_NUMBUCKET 128 75 #define BT_FREEPAGE 256 76 #define BT_SECFREEPAGE 512 77 #define BT_SECROOT 1024 78 #define BT_SECINTERNAL 2048 79 #define BT_SECLEAF 4096 80 #define BT_SECOVERFLOW 8192 81 #define BT_MAXTYPE 8192 82 83 #define BTNO_BALANCE 100L 84 #define BTNO_NODE 100L 85 86 87 #define ID_EXTENSION "xid" 88 #define AC_EXTENSION "xac" 89 #define SV_EXTENSION "xsv" 90 #define DE_EXTENSION "xde" 91 #define KW_EXTENSION "xkw" 92 #define TX_EXTENSION "xtx" 93 94 95 /* Useful page filling values */ 96 97 /* 98 * Length of integers after the ID string in a primary bucket 99 * i.e. dbno + dups + offset 100 * then later add refoffset 101 */ 102 #define BT_DDOFF (sizeof(ajuint) + sizeof(ajuint) + sizeof(ajulong)) 103 104 /* 105 * Preamble before key lengths in an internal node 106 * i.e. nodetype+blocknumber+nkeys+totlen+left+right+overflow+prev 107 */ 108 #define BT_NODEPREAMBLE (sizeof(ajuint) + sizeof(ajulong) + sizeof(ajuint) + \ 109 sizeof(ajuint) + sizeof(ajulong) + sizeof(ajulong) + \ 110 sizeof(ajulong) + sizeof(ajulong)) 111 112 /* 113 * This is the length of extra pointer required in primary index 114 * page space calculations i.e. the total space taken by 115 * key/pointer pairs in an internal page is: 116 * BT_PTRLEN + ((keylenmax + sizeof(long))*nkeys) 117 * This is because there is one more pointer than the 118 * value of 'order' in a B+ tree. 119 */ 120 #define BT_PTRLEN sizeof(ajulong) 121 122 123 /* 124 * Length of extra space, on top of a key string, taken up by a 125 * key in an internal node. This is an ajuint holding the length 126 * of a string plus the length of a block pointer (ajulong) 127 */ 128 #define BT_IDKEYEXTRA (sizeof(ajuint) + sizeof(ajulong)) 129 130 131 /* 132 * Preamble before key lengths in an id bucket 133 * i.e. nodetype+nentries+overflow 134 */ 135 #define BT_BUCKPREAMBLE (sizeof(ajuint) + sizeof(ajuint) + sizeof(ajulong)) 136 137 138 /* 139 * Size of a key in a key length table block in an internal node or bucket 140 */ 141 #define BT_KEYLENENTRY sizeof(ajuint) 142 143 /* 144 * Size of an offset key 145 */ 146 #define BT_OFFKEYLEN sizeof(ajulong) 147 148 /* 149 * Length of integers per entry in a num bucket 150 * i.e. dbno + offset 151 * then later add refoffsets 152 */ 153 #define BT_DOFF (sizeof(ajuint) + sizeof(ajulong)) 154 155 #define BT_EXTRA (sizeof(ajulong)) 156 157 158 /* ========================================================================= */ 159 /* ============================== public data ============================== */ 160 /* ========================================================================= */ 161 162 163 164 165 /* @data AjPBtNode ************************************************************ 166 ** 167 ** Btree node 168 ** 169 ** @attr BlockOffset [ajulong] Offset within main index 170 ** @attr Nkeys [ajuint] Number of keys filled 171 ** @attr TotLen [ajuint] Total length of keys 172 ** @attr Left [ajulong] Left Sibling 173 ** @attr Right [ajulong] Right Sibling 174 ** @attr Overflow [ajulong] Offset to overflow block 175 ** @attr PrevNode [ajulong] Previous node 176 ** @attr NodeType [ajuint] Root, Internal or Leaf 177 ** @attr Padding [char[4]] Padding to alignment boundary 178 ******************************************************************************/ 179 180 typedef struct AjSBtNode 181 { 182 ajulong BlockOffset; 183 ajuint Nkeys; 184 ajuint TotLen; 185 ajulong Left; 186 ajulong Right; 187 ajulong Overflow; 188 ajulong PrevNode; 189 ajuint NodeType; 190 char Padding[4]; 191 } AjOBtNode; 192 193 #define AjPBtNode AjOBtNode* 194 195 196 197 198 /* @data AjPBtMem ************************************************************* 199 ** 200 ** Dynamic list for btree memory arrays 201 ** 202 ** @attr next [struct AjSBtMem*] next node 203 ** @attr prev [struct AjSBtMem*] previous node 204 ** @attr karray [AjPStr*] key array (primary trees) 205 ** @attr parray [ajulong*] pointer arrays (primary and secondary trees) 206 ** @attr overflows [ajulong*] overflows (primary) and keys (secondary) 207 ** @attr used [AjBool] node in use 208 ** @attr Padding [char[4]] Padding to alignment boundary 209 ******************************************************************************/ 210 211 typedef struct AjSBtMem 212 { 213 struct AjSBtMem *next; 214 struct AjSBtMem *prev; 215 AjPStr *karray; 216 ajulong *parray; 217 ajulong *overflows; 218 AjBool used; 219 char Padding[4]; 220 } AjOBtMem; 221 222 #define AjPBtMem AjOBtMem* 223 224 225 226 227 /* @data AjPBtId ************************************************************** 228 ** 229 ** Btree ID 230 ** 231 ** @attr id [AjPStr] Unique ID 232 ** @attr offset [ajulong] Offset within database file (ftello) 233 ** @attr refoffsets [ajulong*] Offset within reference database file(s) (ftello) 234 ** @attr dbno [ajuint] Database file number 235 ** @attr dups [ajuint] Duplicates 236 ** @attr refcount [ajuint] Number of reference files 237 ** @attr Padding [char[4]] Padding to alignment boundary 238 ******************************************************************************/ 239 240 typedef struct AjSBtId 241 { 242 AjPStr id; 243 ajulong offset; 244 ajulong *refoffsets; 245 ajuint dbno; 246 ajuint dups; 247 ajuint refcount; 248 char Padding[4]; 249 } AjOBtId; 250 251 #define AjPBtId AjOBtId* 252 253 254 255 256 /* @data AjPBHit ************************************************************* 257 ** 258 ** Btree index hit minimal information for refcount zero 259 ** 260 ** @attr dbno [ajuint] Database file number 261 ** @attr refcount [ajuint] Number of reference files (zero, for padding) 262 ** @attr offset [ajulong] Offset within database file (ftello) 263 ******************************************************************************/ 264 265 typedef struct AjSBtHit 266 { 267 ajuint dbno; 268 ajuint refcount; 269 ajulong offset; 270 } AjOBtHit; 271 272 #define AjPBtHit AjOBtHit* 273 274 275 276 277 /* @data AjPBHitref ********************************************************** 278 ** 279 ** Btree index hit minimal information for refcount non-zero 280 ** 281 ** @attr dbno [ajuint] Database file number 282 ** @attr refcount [ajuint] Number of reference files (one, for padding) 283 ** @attr offset [ajulong] Offset within database file (ftello) 284 ** @attr refoffset [ajulong] Offset within reference file (ftello) 285 ******************************************************************************/ 286 287 typedef struct AjSBtHitref 288 { 289 ajuint dbno; 290 ajuint refcount; 291 ajulong offset; 292 ajulong refoffset; 293 } AjOBtHitref; 294 295 #define AjPBtHitref AjOBtHitref* 296 297 298 299 300 /* @data AjPBtIdwild ********************************************************** 301 ** 302 ** Btree identifier search wildcard 303 ** 304 ** @attr id [AjPStr] Wildcard ID 305 ** @attr pagepos [ajulong] Page number of leaf 306 ** @attr list [AjPList] list of AjPBtIds 307 ** @attr first [AjBool] true for first search 308 ** @attr Padding [char[4]] Padding to alignment boundary 309 ******************************************************************************/ 310 311 typedef struct AjSBIdild 312 { 313 AjPStr id; 314 ajulong pagepos; 315 AjPList list; 316 AjBool first; 317 char Padding[4]; 318 } AjOBtIdwild; 319 320 #define AjPBtIdwild AjOBtIdwild* 321 322 323 324 325 /* @data AjPIdbucket ********************************************************** 326 ** 327 ** Id bucket structure on disc 328 ** 329 ** Key, file number, ftell ID, subkey page (char*, ajuint, ajulong, ajulong) 330 ** 331 ** @attr NodeType [ajuint] Node type 332 ** @attr Maxentries [ajuint] Number of entries available 333 ** @attr Nentries [ajuint] Number of entries 334 ** @attr Padding [ajuint] Padding to alignment boundary 335 ** @attr Overflow [ajulong] Offset to overflow block 336 ** @attr keylen [ajuint*] Key lengths 337 ** @attr Ids [AjPBtId*] Ids 338 ******************************************************************************/ 339 340 typedef struct AjSIdbucket 341 { 342 ajuint NodeType; 343 ajuint Maxentries; 344 ajuint Nentries; 345 ajuint Padding; 346 ajulong Overflow; 347 ajuint *keylen; 348 AjPBtId *Ids; 349 } AjOIdbucket; 350 351 #define AjPIdbucket AjOIdbucket* 352 353 354 355 356 /* @data AjPBtNumId *********************************************************** 357 ** 358 ** Btree ID 359 ** 360 ** @attr offset [ajulong] Offset within database file (ftello) 361 ** @attr refoffsets [ajulong*] Offset within reference database file(s) (ftello) 362 ** @attr dbno [ajuint] Database file number 363 ** @attr refcount [ajuint] Number of reference files 364 ******************************************************************************/ 365 366 typedef struct AjSBtNumId 367 { 368 ajulong offset; 369 ajulong *refoffsets; 370 ajuint dbno; 371 ajuint refcount; 372 } AjOBtNumId; 373 374 #define AjPBtNumId AjOBtNumId* 375 376 377 378 379 /* @data AjPNumbucket ********************************************************* 380 ** 381 ** Offset bucket structure on disc 382 ** 383 ** Key, file number, ftell ID, subkey page (char*, ajuint, ajulong, ajulong) 384 ** 385 ** @attr NodeType [ajuint] Node type 386 ** @attr Maxentries [ajuint] Number of entries available 387 ** @attr Nentries [ajuint] Number of entries 388 ** @attr Padding [ajuint] Padding to alignment boundary 389 ** @attr Overflow [ajulong] Offset to overflow block 390 ** @attr NumId [AjPBtNumId*] secondary tree IDs 391 ******************************************************************************/ 392 393 typedef struct AjSNumbucket 394 { 395 ajuint NodeType; 396 ajuint Maxentries; 397 ajuint Nentries; 398 ajuint Padding; 399 ajulong Overflow; 400 AjPBtNumId *NumId; 401 } AjONumbucket; 402 403 #define AjPNumbucket AjONumbucket* 404 405 406 407 408 /* @data AjPBtpage ************************************************************ 409 ** 410 ** Btree page 411 ** 412 ** @attr pagepos [ajulong] Page number 413 ** @attr next [struct AjSBtpage*] Next page 414 ** @attr prev [struct AjSBtpage*] Previous page 415 ** @attr buf [unsigned char*] Buffer 416 ** @attr dirty [ajuint] BT_DIRTY if page needs to be written to disc 417 ** @attr lockfor [ajuint] Reason for last setting of dirty as BT_LOCK 418 ******************************************************************************/ 419 420 typedef struct AjSBtpage 421 { 422 ajulong pagepos; 423 struct AjSBtpage *next; 424 struct AjSBtpage *prev; 425 unsigned char *buf; 426 ajuint dirty; 427 ajuint lockfor; 428 } AjOBtpage; 429 430 #define AjPBtpage AjOBtpage* 431 432 433 434 435 /* @data AjPBtcache *********************************************************** 436 ** 437 ** B+ tree cache 438 ** 439 ** @attr fp [FILE*] Tree index file pointer 440 ** @attr filename [AjPStr] Filename 441 ** @attr basename [AjPStr] File base name 442 ** @attr plru [AjPBtpage] Least recently used primary cache page 443 ** @attr pmru [AjPBtpage] Most recently used primary cache page 444 ** @attr slru [AjPBtpage] Least recently used secondary cache page 445 ** @attr smru [AjPBtpage] Most recently used secondary cache page 446 ** @attr bmem [AjPBtMem] Primary array allocation MRU bottom 447 ** @attr tmem [AjPBtMem] Primary array allocation MRU top 448 ** @attr bsmem [AjPBtMem] Secondary array allocation MRU bottom 449 ** @attr tsmem [AjPBtMem] Secondary array allocation MRU top 450 ** @attr replace [AjPStr] Replacement ID 451 ** @attr pripagetable [AjPTable] Table of cached primary pages 452 ** @attr secpagetable [AjPTable] Table of cached secondary pages 453 ** @attr totsize [ajulong] Tree index total length used 454 ** @attr maxsize [ajulong] Tree index total length available 455 ** @attr filesize [ajulong] Tree index length after any compression 456 ** @attr pripagecount [ajulong] Tree index number of primary pages 457 ** @attr secpagecount [ajulong] Tree index number of secondary pages 458 ** @attr secrootblock [ajulong] Secondary tree root block 459 ** @attr numreplace [ajulong] Replacement numeric ID 460 ** @attr countunique [ajulong] Number of unique tokens indexed 461 ** @attr countall [ajulong] Number of total tokens indexed 462 ** @attr pricachehits [ajulong] Number of primnary cached page reads 463 ** @attr seccachehits [ajulong] Number of secondary cached page reads 464 ** @attr prireads [ajulong] Number of physical primary page reads from disk 465 ** @attr secreads [ajulong] Number of physical secondary page reads from disk 466 ** @attr priwrites [ajulong] Number of physical primary page writes to disk 467 ** @attr secwrites [ajulong] Number of physical secondary page writes to disk 468 ** @attr pripagesize [ajuint] Size of primary cache pages 469 ** @attr secpagesize [ajuint] Size of secondary cache pages 470 ** @attr prilistLength [ajuint] Number of pages in primary cache 471 ** @attr seclistLength [ajuint] Number of pages in secondary cache 472 ** @attr porder [ajuint] Order of primary tree 473 ** @attr plevel [ajuint] Depth of primary tree 474 ** @attr pnperbucket [ajuint] Number of entries in a primary bucket 475 ** @attr pricachesize [ajuint] Maximum number of pages to cache 476 ** @attr sorder [ajuint] Order of secondary tree 477 ** @attr slevel [ajuint] Depth of secondary tree 478 ** @attr snperbucket [ajuint] Number of entries in a secondary bucket 479 ** @attr seccachesize [ajuint] Maximum number of pages to cache 480 ** @attr keylimit [ajuint] Max length of primary key 481 ** @attr idlimit [ajuint] Max length of secondary key 482 ** @attr refcount [ajuint] Number of extra files for each entry 483 ** @attr secondary [AjBool] Secondary index 484 ** @attr readonly [AjBool] Read only flag 485 ** @attr dodelete [AjBool] Deletion flag 486 ** @attr compressed [AjBool] Index is compressed 487 ******************************************************************************/ 488 489 typedef struct AjSBtCache 490 { 491 FILE *fp; 492 AjPStr filename; 493 AjPStr basename; 494 AjPBtpage plru; 495 AjPBtpage pmru; 496 AjPBtpage slru; 497 AjPBtpage smru; 498 AjPBtMem bmem; 499 AjPBtMem tmem; 500 AjPBtMem bsmem; 501 AjPBtMem tsmem; 502 AjPStr replace; 503 AjPTable pripagetable; 504 AjPTable secpagetable; 505 ajulong totsize; 506 ajulong maxsize; 507 ajulong filesize; 508 ajulong pripagecount; 509 ajulong secpagecount; 510 ajulong secrootblock; 511 ajulong numreplace; 512 ajulong countunique; 513 ajulong countall; 514 ajulong pricachehits; 515 ajulong seccachehits; 516 ajulong prireads; 517 ajulong secreads; 518 ajulong priwrites; 519 ajulong secwrites; 520 ajuint pripagesize; 521 ajuint secpagesize; 522 ajuint prilistLength; 523 ajuint seclistLength; 524 ajuint porder; 525 ajuint plevel; 526 ajuint pnperbucket; 527 ajuint pricachesize; 528 ajuint sorder; 529 ajuint slevel; 530 ajuint snperbucket; 531 ajuint seccachesize; 532 ajuint keylimit; 533 ajuint idlimit; 534 ajuint refcount; 535 AjBool secondary; 536 AjBool readonly; 537 AjBool dodelete; 538 AjBool compressed; 539 } AjOBtcache; 540 541 #define AjPBtcache AjOBtcache* 542 543 544 545 546 /* @data AjPBtPri ************************************************************* 547 ** 548 ** Btree primary link from a primary bucket for secondary identifier tree 549 ** 550 ** @attr keyword [AjPStr] keyword 551 ** @attr treeblock [ajulong] root block of secondary tree 552 ** @attr id [AjPStr] Id string 553 ******************************************************************************/ 554 555 typedef struct AjSBtPri 556 { 557 AjPStr keyword; 558 ajulong treeblock; 559 AjPStr id; 560 } AjOBtPri; 561 562 #define AjPBtPri AjOBtPri* 563 564 565 566 567 /* @data AjPPribucket ********************************************************* 568 ** 569 ** Keyword primary bucket structure on disc 570 ** 571 ** @attr NodeType [ajuint] Node type 572 ** @attr Maxentries [ajuint] Number of entries available 573 ** @attr Nentries [ajuint] Number of entries 574 ** @attr Padding [ajuint] Padding to alignment boundary 575 ** @attr Overflow [ajulong] Offset to overflow block 576 ** @attr keylen [ajuint*] key lengths 577 ** @attr codes [AjPBtPri*] Primary keywords 578 ******************************************************************************/ 579 580 typedef struct AjSPribucket 581 { 582 ajuint NodeType; 583 ajuint Maxentries; 584 ajuint Nentries; 585 ajuint Padding; 586 ajulong Overflow; 587 ajuint *keylen; 588 AjPBtPri *codes; 589 } AjOPribucket; 590 591 #define AjPPribucket AjOPribucket* 592 593 594 595 596 /* @data AjPSecbucket ********************************************************* 597 ** 598 ** Keyword secondary bucket structure on disc 599 ** 600 ** @attr NodeType [ajuint] Node type 601 ** @attr Maxentries [ajuint] Number of entries available 602 ** @attr Nentries [ajuint] Number of entries 603 ** @attr Padding [ajuint] Padding to alignment boundary 604 ** @attr Overflow [ajulong] Offset to overflow block 605 ** @attr keylen [ajuint*] key lengths 606 ** @attr SecIds [AjPStr*] Ids 607 ******************************************************************************/ 608 609 typedef struct AjSSecbucket 610 { 611 ajuint NodeType; 612 ajuint Maxentries; 613 ajuint Nentries; 614 ajuint Padding; 615 ajulong Overflow; 616 ajuint *keylen; 617 AjPStr *SecIds; 618 } AjOSecbucket; 619 620 #define AjPSecbucket AjOSecbucket* 621 622 623 624 625 /* @data AjPBtKeywild ********************************************************* 626 ** 627 ** Btree keyword wildcard object 628 ** 629 ** @attr keyword [AjPStr] Wildcard keyword 630 ** @attr prefix [AjPStr] Wildcard keyword prefix 631 ** @attr pagepos [ajulong] Page number of primary tree leaf 632 ** @attr list [AjPList] list of AjPBtPris 633 ** @attr cache [AjPBtcache] cache for secondary tree 634 ** @attr idlist [AjPList] list of AjPStr IDs 635 ** @attr secpagepos [ajulong] Page number of secondary tree leaf 636 ** @attr first [AjBool] true for first search 637 ** @attr Padding [char[4]] Padding to alignment boundary 638 ******************************************************************************/ 639 640 typedef struct AjSBtKeywild 641 { 642 AjPStr keyword; 643 AjPStr prefix; 644 ajulong pagepos; 645 AjPList list; 646 AjPBtcache cache; 647 AjPList idlist; 648 ajulong secpagepos; 649 AjBool first; 650 char Padding[4]; 651 } AjOBtKeywild; 652 653 #define AjPBtKeywild AjOBtKeywild* 654 655 656 657 658 #if 0 659 /* #data AjPBtHybrid ********************************************************** 660 ** 661 ** Btree ID 662 ** 663 ** #attr key1 [AjPStr] Unique ID 664 ** #attr offset [ajulong] Offset within database file (ftello) 665 ** #attr refoffsets [ajulong*] Offset within reference database file(s) (ftello) 666 ** #attr treeblock [ajulong] Secondary tree root page 667 ** #attr dbno [ajuint] Database file number 668 ** #attr dups [ajuint] Duplicates 669 ** #attr refcount [ajuint] Number of reference files 670 ** #attr Padding [char[4]] Padding to alignment boundary 671 ******************************************************************************/ 672 /* 673 typedef struct AjSBtHybrid 674 { 675 AjPStr key1; 676 ajulong offset; 677 ajulong *refoffsets; 678 /# ajulong treeblock;#/ 679 ajuint dbno; 680 ajuint dups; 681 ajuint refcount; 682 char Padding[4]; 683 } AjOBtHybrid; 684 685 #define AjPBtHybrid AjOBtHybrid* 686 */ 687 #endif 688 689 690 /* ========================================================================= */ 691 /* =========================== public functions ============================ */ 692 /* ========================================================================= */ 693 694 695 696 697 /* Database file name structure 698 ** 699 ** ajuint order Order of B+tree 700 ** ajuint m Max entries per bucket 701 ** ajuint NFiles Number of Indexed files 702 ** ajuint TotalLen Total length if dir/name entries 703 ** Directory/FileName pairs 704 */ 705 706 #if !defined(WORDS_BIGENDIAN) 707 #define BT_GETAJINT(p,v) (memcpy((void*)v,(const void*)p,sizeof(ajint))) 708 #define BT_GETAJUINT(p,v) (memcpy((void*)v,(const void*)p,sizeof(ajuint))) 709 #define BT_GETAJLONG(p,v) (memcpy((void*)v,(const void*)p,sizeof(ajlong))) 710 #define BT_GETAJULONG(p,v) (memcpy((void*)v,(const void*)p,sizeof(ajulong))) 711 #define BT_SETAJINT(p,v) (memcpy((void*)p,(const void*)&v,sizeof(ajint))) 712 #define BT_SETAJUINT(p,v) (memcpy((void*)p,(const void*)&v,sizeof(ajuint))) 713 #define BT_SETAJLONG(p,v) (memcpy((void*)p,(const void*)&v,sizeof(ajlong))) 714 #define BT_SETAJULONG(p,v) (memcpy((void*)p,(const void*)&v,sizeof(ajulong))) 715 #else 716 #define BT_GETAJINT(p,v) memcpy((void*)v,(const void*)p,sizeof(ajint)); \ 717 ajByteRevInt(v) 718 #define BT_GETAJUINT(p,v) memcpy((void*)v,(const void*)p,sizeof(ajuint)); \ 719 ajByteRevUint(v) 720 #define BT_GETAJLONG(p,v) memcpy((void*)v,(const void*)p,sizeof(ajlong)); \ 721 ajByteRevLong(v) 722 #define BT_GETAJULONG(p,v) memcpy((void*)v,(const void*)p,sizeof(ajulong)); \ 723 ajByteRevUlong(v) 724 #define BT_SETAJINT(p,v) ajByteRevInt(&v); \ 725 memcpy((void*)p,(const void*)&v,sizeof(ajint)) 726 #define BT_SETAJUINT(p,v) ajByteRevUint(&v); \ 727 memcpy((void*)p,(const void*)&v,sizeof(ajuint)) 728 #define BT_SETAJLONG(p,v) ajByteRevLong(&v); \ 729 memcpy((void*)p,(const void*)&v,sizeof(ajlong)) 730 #define BT_SETAJULONG(p,v) ajByteRevUlong(&v); \ 731 memcpy((void*)p,(const void*)&v,sizeof(ajulong)) 732 #endif 733 734 735 #define BT_BUCKIDLEN(str) (MAJSTRGETLEN(str) + 1 + sizeof(ajuint) + \ 736 sizeof(ajuint) + sizeof(ajulong)) 737 738 739 /* 740 ** Macros to determine entry positions within a bucket 741 */ 742 743 #define PBT_BUCKNODETYPE(p) p 744 #define PBT_BUCKNENTRIES(p) (p + sizeof(ajuint)) 745 #define PBT_BUCKOVERFLOW(p) (p + sizeof(ajuint) + sizeof(ajuint)) 746 #define PBT_BUCKKEYLEN(p) (p + sizeof(ajuint) + sizeof(ajuint) + sizeof(ajulong)) 747 #define BT_BUCKPRILEN(str) (MAJSTRGETLEN(str) + 1 + sizeof(ajulong)) 748 #define BT_BUCKSECLEN(str) (MAJSTRGETLEN(str) +1) 749 750 /* 751 ** Macros to return a page entry value within a bucket 752 */ 753 754 #if !defined(WORDS_BIGENDIAN) 755 #define GBT_BUCKNODETYPE(p,v) (memcpy((void*)v, \ 756 (const void*)PBT_BUCKNODETYPE(p), \ 757 sizeof(ajuint))) 758 #define GBT_BUCKNENTRIES(p,v) (memcpy((void*)v, \ 759 (const void*)PBT_BUCKNENTRIES(p), \ 760 sizeof(ajuint))) 761 #define GBT_BUCKOVERFLOW(p,v) (memcpy((void*)v, \ 762 (const void*)PBT_BUCKOVERFLOW(p), \ 763 sizeof(ajulong))) 764 #else 765 #define GBT_BUCKNODETYPE(p,v) memcpy((void*)v, \ 766 (const void*)PBT_BUCKNODETYPE(p), \ 767 sizeof(ajuint)); \ 768 ajByteRevUint(v) 769 #define GBT_BUCKNENTRIES(p,v) memcpy((void*)v, \ 770 (const void*)PBT_BUCKNENTRIES(p), \ 771 sizeof(ajuint)); \ 772 ajByteRevUint(v) 773 #define GBT_BUCKOVERFLOW(p,v) memcpy((void*)v, \ 774 (const void*)PBT_BUCKOVERFLOW(p), \ 775 sizeof(ajulong)); \ 776 ajByteRevUlong(v) 777 #endif 778 779 780 /* 781 ** Macros to set a page entry value within an internal/leaf node 782 */ 783 784 #if !defined(WORDS_BIGENDIAN) 785 #define SBT_BUCKNODETYPE(p,v) (memcpy((void*)PBT_BUCKNODETYPE(p), \ 786 (const void*)&v,sizeof(ajuint))) 787 #define SBT_BUCKNENTRIES(p,v) (memcpy((void*)PBT_BUCKNENTRIES(p), \ 788 (const void*)&v,sizeof(ajuint))) 789 #define SBT_BUCKOVERFLOW(p,v) (memcpy((void*)PBT_BUCKOVERFLOW(p), \ 790 (const void*)&v,sizeof(ajulong))) 791 #else 792 #define SBT_BUCKNODETYPE(p,v) ajByteRevUint(&v); \ 793 memcpy((void*)PBT_BUCKNODETYPE(p), \ 794 (const void*)&v,sizeof(ajuint)) 795 #define SBT_BUCKNENTRIES(p,v) ajByteRevUint(&v); \ 796 memcpy((void*)PBT_BUCKNENTRIES(p), \ 797 (const void*)&v,sizeof(ajuint)) 798 #define SBT_BUCKOVERFLOW(p,v) ajByteRevUlong(&v); \ 799 memcpy((void*)PBT_BUCKOVERFLOW(p), \ 800 (const void*)&v,sizeof(ajulong)) 801 #endif 802 803 /* 804 ** Macros to determine entry positions within an internal/leaf node 805 */ 806 807 #define PBT_NODETYPE(p) p 808 #define PBT_BLOCKNUMBER(p) (p + sizeof(ajuint)) 809 #define PBT_NKEYS(p) (p + sizeof(ajuint) + sizeof(ajulong)) 810 #define PBT_TOTLEN(p) (p+sizeof(ajuint)+sizeof(ajulong)+sizeof(ajuint)) 811 #define PBT_LEFT(p) (p+sizeof(ajuint)+sizeof(ajulong)+sizeof(ajuint) \ 812 +sizeof(ajuint)) 813 #define PBT_RIGHT(p) (p+sizeof(ajuint)+sizeof(ajulong)+sizeof(ajuint) \ 814 +sizeof(ajuint)+sizeof(ajulong)) 815 #define PBT_OVERFLOW(p) (p+sizeof(ajuint)+sizeof(ajulong)+sizeof(ajuint) \ 816 +sizeof(ajuint)+sizeof(ajulong)+sizeof(ajulong)) 817 #define PBT_PREV(p) (p+sizeof(ajuint)+sizeof(ajulong)+sizeof(ajuint) \ 818 +sizeof(ajuint)+sizeof(ajulong)+sizeof(ajulong) \ 819 +sizeof(ajulong)) 820 #define PBT_KEYLEN(p) (p+sizeof(ajuint)+sizeof(ajulong)+sizeof(ajuint) \ 821 +sizeof(ajuint)+sizeof(ajulong)+sizeof(ajulong) \ 822 +sizeof(ajulong)+sizeof(ajulong)) 823 824 /* 825 ** Macros to return a page entry value within an internal/leaf node 826 */ 827 828 #if !defined(WORDS_BIGENDIAN) 829 #define GBT_NODETYPE(p,v) (memcpy((void*)v,(const void*)PBT_NODETYPE(p), \ 830 sizeof(ajuint))) 831 #define GBT_BLOCKNUMBER(p,v) (memcpy((void*)v,(const void*)PBT_BLOCKNUMBER(p), \ 832 sizeof(ajulong))) 833 #define GBT_NKEYS(p,v) (memcpy((void*)v,(const void*)PBT_NKEYS(p), \ 834 sizeof(ajuint))) 835 #define GBT_TOTLEN(p,v) (memcpy((void*)v,(const void*)PBT_TOTLEN(p), \ 836 sizeof(ajuint))) 837 #define GBT_LEFT(p,v) (memcpy((void*)v,(const void*)PBT_LEFT(p), \ 838 sizeof(ajulong))) 839 #define GBT_RIGHT(p,v) (memcpy((void*)v,(const void*)PBT_RIGHT(p), \ 840 sizeof(ajulong))) 841 #define GBT_PREV(p,v) (memcpy((void*)v,(const void*)PBT_PREV(p), \ 842 sizeof(ajulong))) 843 #define GBT_OVERFLOW(p,v) (memcpy((void*)v,(const void*)PBT_OVERFLOW(p), \ 844 sizeof(ajulong))) 845 #else 846 #define GBT_NODETYPE(p,v) memcpy((void*)v,(const void*)PBT_NODETYPE(p), \ 847 sizeof(ajuint)); \ 848 ajByteRevUint(v) 849 #define GBT_BLOCKNUMBER(p,v) memcpy((void*)v,(const void*)PBT_BLOCKNUMBER(p), \ 850 sizeof(ajulong)); \ 851 ajByteRevUlong(v) 852 #define GBT_NKEYS(p,v) memcpy((void*)v,(const void*)PBT_NKEYS(p), \ 853 sizeof(ajuint)); \ 854 ajByteRevUint(v) 855 #define GBT_TOTLEN(p,v) memcpy((void*)v,(const void*)PBT_TOTLEN(p), \ 856 sizeof(ajuint)); \ 857 ajByteRevUint(v) 858 #define GBT_LEFT(p,v) memcpy((void*)v,(const void*)PBT_LEFT(p), \ 859 sizeof(ajulong)); \ 860 ajByteRevUlong(v) 861 862 #define GBT_RIGHT(p,v) memcpy((void*)v,(const void*)PBT_RIGHT(p), \ 863 sizeof(ajulong)); \ 864 ajByteRevUlong(v) 865 #define GBT_PREV(p,v) memcpy((void*)v,(const void*)PBT_PREV(p), \ 866 sizeof(ajulong)); \ 867 ajByteRevUlong(v) 868 #define GBT_OVERFLOW(p,v) memcpy((void*)v,(const void*)PBT_OVERFLOW(p), \ 869 sizeof(ajulong)); \ 870 ajByteRevUlong(v) 871 #endif 872 873 874 /* 875 ** Macros to set a page entry value within an internal/leaf node 876 */ 877 878 #if !defined(WORDS_BIGENDIAN) 879 #define SBT_NODETYPE(p,v) (memcpy((void*)PBT_NODETYPE(p),(const void*)&v, \ 880 sizeof(ajuint))) 881 #define SBT_BLOCKNUMBER(p,v) (memcpy((void*)PBT_BLOCKNUMBER(p), \ 882 (const void*)&v,sizeof(ajulong))) 883 #define SBT_NKEYS(p,v) (memcpy((void*)PBT_NKEYS(p),(const void*)&v, \ 884 sizeof(ajuint))) 885 #define SBT_TOTLEN(p,v) (memcpy((void*)PBT_TOTLEN(p),(const void*)&v, \ 886 sizeof(ajuint))) 887 #define SBT_LEFT(p,v) (memcpy((void*)PBT_LEFT(p), \ 888 (const void*)&v,sizeof(ajulong))) 889 #define SBT_RIGHT(p,v) (memcpy((void*)PBT_RIGHT(p), \ 890 (const void*)&v,sizeof(ajulong))) 891 #define SBT_PREV(p,v) (memcpy((void*)PBT_PREV(p), \ 892 (const void*)&v,sizeof(ajulong))) 893 #define SBT_OVERFLOW(p,v) (memcpy((void*)PBT_OVERFLOW(p), \ 894 (const void*)&v,sizeof(ajulong))) 895 #else 896 #define SBT_NODETYPE(p,v) ajByteRevUint(&v); \ 897 memcpy((void*)PBT_NODETYPE(p),(const void*)&v, \ 898 sizeof(ajuint)) 899 #define SBT_BLOCKNUMBER(p,v) ajByteRevUlong(&v); \ 900 memcpy((void*)PBT_BLOCKNUMBER(p), \ 901 (const void*)&v,sizeof(ajulong)) 902 #define SBT_NKEYS(p,v) ajByteRevUint(&v); \ 903 memcpy((void*)PBT_NKEYS(p),(const void*)&v, \ 904 sizeof(ajuint)) 905 #define SBT_TOTLEN(p,v) ajByteRevUint(&v); \ 906 memcpy((void*)PBT_TOTLEN(p),(const void*)&v, \ 907 sizeof(ajuint)) 908 #define SBT_LEFT(p,v) ajByteRevUlong(&v); \ 909 memcpy((void*)PBT_LEFT(p), \ 910 (const void*)&v,sizeof(ajulong)) 911 #define SBT_RIGHT(p,v) ajByteRevUlong(&v); \ 912 memcpy((void*)PBT_RIGHT(p), \ 913 (const void*)&v,sizeof(ajulong)) 914 #define SBT_PREV(p,v) ajByteRevUlong(&v); \ 915 memcpy((void*)PBT_PREV(p), \ 916 (const void*)&v,sizeof(ajulong)) 917 #define SBT_OVERFLOW(p,v) ajByteRevUlong(&v); \ 918 memcpy((void*)PBT_OVERFLOW(p), \ 919 (const void*)&v,sizeof(ajulong)) 920 #endif 921 922 923 924 925 /* 926 ** Prototype definitions 927 */ 928 929 AjBool ajBtreeKeyFindLen(AjPBtcache cache, const AjPStr key, 930 ajulong* treeblock); 931 932 ajuint ajBtreeFieldGetLenC(const char* nametxt); 933 ajuint ajBtreeFieldGetLenS(const AjPStr name); 934 const AjPStr ajBtreeFieldGetExtensionC(const char *nametxt); 935 const AjPStr ajBtreeFieldGetExtensionS(const AjPStr name); 936 AjBool ajBtreeFieldGetSecondaryC(const char *nametxt); 937 AjBool ajBtreeFieldGetSecondaryS(const AjPStr name); 938 939 ajulong ajBtreeCacheGetPagecount(const AjPBtcache cache); 940 ajuint ajBtreeCacheGetPripagesize(const AjPBtcache cache); 941 ajuint ajBtreeCacheGetSecpagesize(const AjPBtcache cache); 942 ajulong ajBtreeCacheGetTotsize(const AjPBtcache cache); 943 944 AjBool ajBtreeCacheIsCompressed(const AjPBtcache cache); 945 AjBool ajBtreeCacheIsSecondary(const AjPBtcache thys); 946 947 ajuint ajBtreePageGetSize(const AjPBtpage page, ajuint refcount); 948 const char* ajBtreePageGetTypename(const AjPBtpage page); 949 AjBool ajBtreePageIsPrimary(const AjPBtpage page); 950 951 AjPBtcache ajBtreeIdcacheNewC(const char *file, const char *ext, 952 const char *idir, const char *mode, 953 AjBool compressed, 954 ajuint kwlimit, ajuint refcount, 955 ajuint pripagesize, ajuint secpagesize, 956 ajuint pricachesize, ajuint seccachesize, 957 ajulong pripagecount, ajulong secpagecount, 958 ajuint order, ajuint fill, ajuint level, 959 ajuint sorder, ajuint sfill, 960 ajulong count, ajulong countall); 961 AjPBtcache ajBtreeIdcacheNewS(const AjPStr file, const AjPStr ext, 962 const AjPStr idir, const char *mode, 963 AjBool compressed, 964 ajuint kwlimit, ajuint refcount, 965 ajuint pripagesize, ajuint secpagesize, 966 ajuint pricachesize, ajuint seccachesize, 967 ajulong pripagecount, ajulong secpagecount, 968 ajuint order, ajuint fill, ajuint level, 969 ajuint sorder, ajuint sfill, 970 ajulong count, ajulong countall); 971 972 AjPBtcache ajBtreeSeccacheNewC(const char *file, const char *ext, 973 const char *idir, const char *mode, 974 AjBool compressed, 975 ajuint kwlimit, ajuint idlimit, 976 ajuint pagesize, ajuint secpagesize, 977 ajuint cachesize, ajuint seccachesize, 978 ajulong pagecount, ajulong secpagecount, 979 ajuint order, ajuint fill, ajuint level, 980 ajuint sorder, ajuint sfill, 981 ajulong count, ajulong countall); 982 AjPBtcache ajBtreeSeccacheNewS(const AjPStr file, const AjPStr ext, 983 const AjPStr idir, const char *mode, 984 AjBool compressed, 985 ajuint kwlimit, ajuint idlimit, 986 ajuint pagesize, ajuint secpagesize, 987 ajuint cachesize, ajuint seccachesize, 988 ajulong pagecount, ajulong secpagecount, 989 ajuint order, ajuint fill, ajuint level, 990 ajuint sorder, ajuint sfill, 991 ajulong count, ajulong countall); 992 993 AjPBtcache ajBtreeCacheNewReadC(const char *filetxt, const char *exttxt, 994 const char *idirtxt); 995 AjPBtcache ajBtreeCacheNewReadS(const AjPStr file, const AjPStr ext, 996 const AjPStr idir); 997 AjPBtcache ajBtreeCacheNewUpdateC(const char *filetxt, const char *exttxt, 998 const char *idirtxt); 999 AjPBtcache ajBtreeCacheNewUpdateS(const AjPStr file, const AjPStr ext, 1000 const AjPStr idir); 1001 AjPBtpage ajBtreeCacheRead(AjPBtcache cache, ajulong pagepos); 1002 1003 ajulong ajBtreeCacheDel(AjPBtcache *thys); 1004 1005 void ajBtreeIdDel(AjPBtId *thys); 1006 void ajBtreeIdDelVoid(void **voidarg); 1007 AjPBtId ajBtreeIdNew(ajuint refcount); 1008 AjBool ajBtreeIdIsMulti(const AjPBtId thys); 1009 1010 void ajBtreeHitDel(AjPBtHit *thys); 1011 void ajBtreeHitDelVoid(void **voidarg); 1012 AjPBtHit ajBtreeHitNew(void); 1013 AjPBtHit ajBtreeHitNewId(const AjPBtId btid); 1014 1015 void ajBtreeHitrefDel(AjPBtHitref *thys); 1016 void ajBtreeHitrefDelVoid(void **voidarg); 1017 AjPBtHitref ajBtreeHitrefNew(void); 1018 AjPBtHitref ajBtreeHitrefNewId(const AjPBtId btid); 1019 1020 AjBool ajBtreeReadParamsC(const char *fn, const char *ext, 1021 const char *idir, 1022 AjBool *secondary, AjBool *compressed, 1023 ajuint *kwlimit, ajuint *idlimit, 1024 ajuint *refcount, 1025 ajuint *pripagesize, ajuint *secpagesize, 1026 ajuint *pricachesize, ajuint *seccachesize, 1027 ajulong *pripagecount, ajulong *secpagecount, 1028 ajuint *order, ajuint *nperbucket, 1029 ajuint *level, 1030 ajuint *sorder, ajuint *snperbucket, 1031 ajulong *count, ajulong *countall); 1032 AjBool ajBtreeReadParamsS(const AjPStr fn, const AjPStr ext, 1033 const AjPStr idir, 1034 AjBool *secondary, AjBool *compressed, 1035 ajuint *kwlimit, ajuint *idlimit, 1036 ajuint *refcount, 1037 ajuint *pripagesize, ajuint *secpagesize, 1038 ajuint *pricachesize, ajuint *seccachesize, 1039 ajulong *pripagecount, ajulong *secpagecount, 1040 ajuint *order, ajuint *nperbucket, 1041 ajuint *level, 1042 ajuint *sorder, ajuint *snperbucket, 1043 ajulong *count, ajulong *countall); 1044 1045 void ajBtreeWriteParamsC(const AjPBtcache cache, const char *fntxt, 1046 const char *exttxt, const char *idirtxt); 1047 void ajBtreeWriteParamsS(const AjPBtcache cache, const AjPStr fn, 1048 const AjPStr ext, const AjPStr idir); 1049 1050 ajuint ajBtreeReadEntriesC(const char *filename, const char *indexdir, 1051 const char *directory, 1052 AjPStr **seqfiles, AjPStr ***reffiles, 1053 ajuint *refcount); 1054 ajuint ajBtreeReadEntriesS(const AjPStr filename, const AjPStr indexdir, 1055 const AjPStr directory, 1056 AjPStr **seqfiles, AjPStr ***reffiles, 1057 ajuint *refcount); 1058 1059 void ajBtreeIdentFetchId(AjPBtcache cache, const AjPStr key, 1060 AjPList idlist); 1061 void ajBtreeIdentFetchwildId(AjPBtcache cache, 1062 const AjPStr key, AjPList idlist); 1063 void ajBtreeIdentFetchHit(AjPBtcache cache, const AjPStr key, 1064 AjPList idlist); 1065 void ajBtreeIdentFetchwildHit(AjPBtcache cache, 1066 const AjPStr key, AjPList idlist); 1067 void ajBtreeIdentFetchHitref(AjPBtcache cache, const AjPStr key, 1068 AjPList idlist); 1069 void ajBtreeIdentFetchwildHitref(AjPBtcache cache, 1070 const AjPStr key, AjPList idlist); 1071 1072 void ajBtreeKeyFetchId(AjPBtcache cache, AjPBtcache idcache, 1073 const AjPStr key, AjPList btidlist); 1074 void ajBtreeKeyFetchwildId(AjPBtcache cache, AjPBtcache idcache, 1075 const AjPStr key, AjPList btidlist); 1076 void ajBtreeKeyFetchHit(AjPBtcache cache, AjPBtcache idcache, 1077 const AjPStr key, AjPList btidlist); 1078 void ajBtreeKeyFetchwildHit(AjPBtcache cache, AjPBtcache idcache, 1079 const AjPStr key, AjPList btidlist); 1080 void ajBtreeKeyFetchHitref(AjPBtcache cache, AjPBtcache idcache, 1081 const AjPStr key, AjPList btidlist); 1082 void ajBtreeKeyFetchwildHitref(AjPBtcache cache, AjPBtcache idcache, 1083 const AjPStr key, AjPList btidlist); 1084 1085 AjPBtIdwild ajBtreeIdwildNew(AjPBtcache cache, const AjPStr wild); 1086 void ajBtreeIdwildDel(AjPBtIdwild *thys); 1087 1088 AjPBtId ajBtreeIdwildQuery(AjPBtcache cache, AjPBtIdwild wild); 1089 1090 AjPBtKeywild ajBtreeKeywildNew(AjPBtcache cache, const AjPStr wild); 1091 void ajBtreeKeywildDel(AjPBtKeywild *thys); 1092 1093 AjPBtId ajBtreeKeywildQuery(AjPBtcache cache, AjPBtKeywild wild, 1094 AjPBtcache idcache); 1095 1096 AjPBtPri ajBtreePriNew(void); 1097 void ajBtreePriDel(AjPBtPri *thys); 1098 1099 void ajBtreeIdentIndex(AjPBtcache cache, AjPBtId id); 1100 1101 AjBool ajBtreeKeyIndex(AjPBtcache cache, const AjPStr keyword, 1102 const AjPStr id); 1103 1104 void ajBtreeDumpIdentifiers(AjPBtcache cache, ajuint dmin, ajuint dmax, 1105 AjPFile outf); 1106 1107 void ajBtreeDumpKeywords(AjPBtcache cache, 1108 ajuint dmin, ajuint dmax, AjPFile outf); 1109 1110 ajint ajBtreeIdCmp(const void *x, const void *y); 1111 ajulong ajBtreeIdHash(const void *x, ajulong hashsize); 1112 1113 ajint ajBtreeHitCmp(const void *x, const void *y); 1114 ajulong ajBtreeHitHash(const void *x, ajulong hashsize); 1115 1116 ajint ajBtreeHitrefCmp(const void *x, const void *y); 1117 ajulong ajBtreeHitrefHash(const void *x, ajulong hashsize); 1118 1119 void ajBtreeCacheStatsOut(AjPFile outf, const AjPBtcache cache, 1120 ajulong *Ppricache, ajulong *Pseccache, 1121 ajulong* Pprireads, ajulong* Psecreads, 1122 ajulong* Ppriwrites, ajulong* Psecwrites, 1123 ajulong *Pprisize, ajulong *Psecsize); 1124 void ajBtreeStatsOut(AjPFile outf, 1125 ajulong* Psplitrootid, ajulong* Psplitrootnum, 1126 ajulong* Psplitrootkey, ajulong* Psplitrootsec, 1127 ajulong* Psplitleafid, ajulong* Psplitleafnum, 1128 ajulong* Psplitleafkey, ajulong* Psplitleafsec, 1129 ajulong* Preorderid, ajulong* Preordernum, 1130 ajulong* Preorderkey, ajulong* Preordersec); 1131 1132 AjBool ajBtreeStatIdbucket(AjPBtcache cache, 1133 const AjPBtpage page, AjBool full, 1134 ajuint* nkeys, ajuint* ndups, ajuint* nextra, 1135 ajuint* overflows, ajuint* freespace, 1136 ajulong *refs, const AjPTable newpostable); 1137 AjBool ajBtreeStatNumbucket(AjPBtcache cache, 1138 const AjPBtpage page, AjBool full, 1139 ajuint* nkeys, ajuint* overflows, 1140 ajuint* freespace); 1141 AjBool ajBtreeStatPribucket(AjPBtcache cache, 1142 const AjPBtpage page, AjBool full, 1143 ajuint* nkeys, ajuint* overflows, 1144 ajuint* freespace, ajulong *refs, 1145 const AjPTable newpostable); 1146 AjBool ajBtreeStatSecbucket(AjPBtcache cache, 1147 const AjPBtpage page, AjBool full, 1148 ajuint* nkeys, ajuint* overflows, 1149 ajuint* freespace); 1150 AjBool ajBtreeStatNode(AjPBtcache cache, 1151 const AjPBtpage page, AjBool full, 1152 ajuint* nkeys, ajuint* overflows, 1153 ajuint* freespace, ajulong* refs, 1154 const AjPTable newpostable); 1155 AjBool ajBtreeStatNumnode(AjPBtcache cache, 1156 const AjPBtpage page, AjBool full, 1157 ajuint* nkeys, ajuint* overflows, 1158 ajuint* freespace, ajulong* refs, 1159 const AjPTable newpostable); 1160 void ajBtreeExit(void); 1161 1162 /* 1163 ** future functions for index updating 1164 */ 1165 1166 AjBool ajBtreeReplaceId(AjPBtcache cache, const AjPBtId rid); 1167 AjBool ajBtreeDeleteIdent(AjPBtcache cache, const AjPBtId btid); 1168 AjBool ajBtreeDeletePriId(AjPBtcache cache, const AjPBtPri pri); 1169 1170 1171 1172 1173 /* 1174 ** End of prototype definitions 1175 */ 1176 1177 1178 #if 0 1179 AjPBtHybrid ajBtreeHybNew(ajuint refcount); 1180 void ajBtreeHybDel(AjPBtHybrid *thys); 1181 #endif 1182 1183 1184 1185 #ifdef AJ_COMPILE_DEPRECATED_BOOK 1186 #endif /* AJ_COMPILE_DEPRECATED_BOOK */ 1187 1188 #ifdef AJ_COMPILE_DEPRECATED 1189 1190 __deprecated void ajBtreeWriteParams(const AjPBtcache cache, const char *fn, 1191 const char *ext, const char *idir); 1192 1193 #endif /* AJ_COMPILE_DEPRECATED */ 1194 1195 1196 1197 1198 AJ_END_DECLS 1199 1200 #endif /* !AJINDEX_H */ 1201