gtop 562 global/global.c GTOP *gtop; gtop 572 global/global.c gtop = gtags_open(dbpath, root, db, GTAGS_READ); gtop 573 global/global.c for (gtp = gtags_first(gtop, prefix, flags); gtp; gtp = gtags_next(gtop)) { gtop 577 global/global.c gtags_close(gtop); gtop 1031 global/global.c GTOP *gtop; gtop 1045 global/global.c gtop = gtags_open(dbpath, root, db, GTAGS_READ); gtop 1066 global/global.c if (gtop->format & GTAGS_COMPACT) gtop 1068 global/global.c for (gtp = gtags_first(gtop, pattern, flags); gtp; gtp = gtags_next(gtop)) { gtop 1074 global/global.c } else if (gtop->format & GTAGS_COMPACT) { gtop 1125 global/global.c if (gtop->format & GTAGS_COMPLINE) { gtop 1152 global/global.c if (gtop->format & GTAGS_COMPNAME) gtop 1173 global/global.c if (gtop->format & GTAGS_COMPNAME) gtop 1196 global/global.c if (gtop->format & GTAGS_COMPNAME) { gtop 1206 global/global.c if (gtop->format & GTAGS_COMPRESS) gtop 1220 global/global.c gtags_close(gtop); gtop 358 gtags/gtags.c GTOP *gtop = gtags_open(dbpath, cwd, GTAGS, GTAGS_MODIFY); gtop 359 gtags/gtags.c gtags_close(gtop); gtop 640 gtags/gtags.c GTOP *gtop; gtop 655 gtags/gtags.c gtop = gtags_open(dbpath, root, db, GTAGS_MODIFY); gtop 672 gtags/gtags.c gtags_delete(gtop, deleteset); gtop 673 gtags/gtags.c gtop->flags = 0; gtop 675 gtags/gtags.c gtop->flags |= GTAGS_EXTRACTMETHOD; gtop 677 gtags/gtags.c gtop->flags |= GTAGS_DEBUG; gtop 711 gtags/gtags.c if (gtop->flags & GTAGS_EXTRACTMETHOD) { gtop 719 gtags/gtags.c gtags_put(gtop, p, ctags_x); gtop 723 gtags/gtags.c gtags_close(gtop); gtop 748 gtags/gtags.c GTOP *gtop; gtop 764 gtags/gtags.c gtop = gtags_open(dbpath, root, db, GTAGS_CREATE); gtop 768 gtags/gtags.c gtop->flags = 0; gtop 770 gtags/gtags.c gtop->flags |= GTAGS_EXTRACTMETHOD; gtop 772 gtags/gtags.c gtop->flags |= GTAGS_DEBUG; gtop 810 gtags/gtags.c if (gtop->flags & GTAGS_EXTRACTMETHOD) { gtop 818 gtags/gtags.c gtags_put(gtop, p, ctags_x); gtop 822 gtags/gtags.c gtags_close(gtop); gtop 1728 htags/htags.c GTOP *gtop; gtop 1744 htags/htags.c gtop = gtags_open(dbpath, cwdpath, GTAGS, GTAGS_READ); gtop 1745 htags/htags.c gtags_close(gtop); gtop 275 libutil/gtagsop.c GTOP *gtop; gtop 278 libutil/gtagsop.c gtop = (GTOP *)check_calloc(sizeof(GTOP), 1); gtop 279 libutil/gtagsop.c gtop->db = db; gtop 280 libutil/gtagsop.c gtop->mode = mode; gtop 281 libutil/gtagsop.c gtop->format_version = 4; gtop 285 libutil/gtagsop.c switch (gtop->mode) { gtop 298 libutil/gtagsop.c gtop->dbop = dbop_open(makepath(dbpath, dbname(db), NULL), dbmode, 0644, DBOP_DUP); gtop 299 libutil/gtagsop.c if (gtop->dbop == NULL) { gtop 304 libutil/gtagsop.c if (gtop->mode == GTAGS_CREATE) { gtop 308 libutil/gtagsop.c gtop->format = 0; gtop 309 libutil/gtagsop.c gtop->format_version = 5; gtop 310 libutil/gtagsop.c if (gtop->db == GTAGS) gtop 311 libutil/gtagsop.c gtop->format |= GTAGS_COMPRESS; gtop 312 libutil/gtagsop.c gtop->format |= GTAGS_COMPNAME; gtop 313 libutil/gtagsop.c if (gtop->db == GRTAGS || gtop->db == GSYMS) { gtop 314 libutil/gtagsop.c gtop->format |= GTAGS_COMPACT; gtop 315 libutil/gtagsop.c gtop->format |= GTAGS_COMPLINE; gtop 317 libutil/gtagsop.c if (gtop->format & GTAGS_COMPACT) gtop 318 libutil/gtagsop.c dbop_putoption(gtop->dbop, COMPACTKEY, NULL); gtop 319 libutil/gtagsop.c if (gtop->format & GTAGS_COMPRESS) { gtop 320 libutil/gtagsop.c dbop_putoption(gtop->dbop, COMPRESSKEY, DEFAULT_ABBREVIATION); gtop 323 libutil/gtagsop.c if (gtop->format & GTAGS_COMPLINE) gtop 324 libutil/gtagsop.c dbop_putoption(gtop->dbop, COMPLINEKEY, NULL); gtop 325 libutil/gtagsop.c if (gtop->format & GTAGS_COMPNAME) gtop 326 libutil/gtagsop.c dbop_putoption(gtop->dbop, COMPNAMEKEY, NULL); gtop 327 libutil/gtagsop.c dbop_putversion(gtop->dbop, gtop->format_version); gtop 339 libutil/gtagsop.c gtop->format_version = dbop_getversion(gtop->dbop); gtop 340 libutil/gtagsop.c if (gtop->format_version > upper_bound_version) gtop 341 libutil/gtagsop.c die("%s seems new format. Please install the latest GLOBAL.", dbname(gtop->db)); gtop 342 libutil/gtagsop.c else if (gtop->format_version < lower_bound_version) gtop 343 libutil/gtagsop.c die("%s seems older format. Please remake tag files.", dbname(gtop->db)); gtop 344 libutil/gtagsop.c gtop->format = 0; gtop 345 libutil/gtagsop.c if (dbop_getoption(gtop->dbop, COMPACTKEY) != NULL) gtop 346 libutil/gtagsop.c gtop->format |= GTAGS_COMPACT; gtop 347 libutil/gtagsop.c if ((p = dbop_getoption(gtop->dbop, COMPRESSKEY)) != NULL) { gtop 349 libutil/gtagsop.c gtop->format |= GTAGS_COMPRESS; gtop 351 libutil/gtagsop.c if (dbop_getoption(gtop->dbop, COMPLINEKEY) != NULL) gtop 352 libutil/gtagsop.c gtop->format |= GTAGS_COMPLINE; gtop 353 libutil/gtagsop.c if (dbop_getoption(gtop->dbop, COMPNAMEKEY) != NULL) gtop 354 libutil/gtagsop.c gtop->format |= GTAGS_COMPNAME; gtop 362 libutil/gtagsop.c if (gtop->mode != GTAGS_READ) gtop 363 libutil/gtagsop.c gtop->sb = strbuf_open(0); /* This buffer is used for working area. */ gtop 367 libutil/gtagsop.c if (gtop->format & GTAGS_COMPACT) { gtop 369 libutil/gtagsop.c strlimcpy(gtop->root, root, sizeof(gtop->root)); gtop 370 libutil/gtagsop.c if (gtop->mode != GTAGS_READ) gtop 371 libutil/gtagsop.c gtop->path_hash = strhash_open(HASHBUCKETS); gtop 373 libutil/gtagsop.c return gtop; gtop 383 libutil/gtagsop.c gtags_put(GTOP *gtop, const char *key, const char *ctags_x) /* virtually const */ gtop 391 libutil/gtagsop.c if (gtop->format & GTAGS_COMPACT) { gtop 403 libutil/gtagsop.c if (gtop->cur_path[0] && strcmp(gtop->cur_path, ptable.part[PART_PATH].start)) { gtop 404 libutil/gtagsop.c flush_pool(gtop); gtop 405 libutil/gtagsop.c strhash_reset(gtop->path_hash); gtop 407 libutil/gtagsop.c strlimcpy(gtop->cur_path, ptable.part[PART_PATH].start, sizeof(gtop->cur_path)); gtop 419 libutil/gtagsop.c entry = strhash_assign(gtop->path_hash, key, 1); gtop 429 libutil/gtagsop.c strbuf_reset(gtop->sb); gtop 430 libutil/gtagsop.c strbuf_puts(gtop->sb, s_fid); gtop 431 libutil/gtagsop.c strbuf_putc(gtop->sb, ' '); gtop 432 libutil/gtagsop.c if (gtop->format & GTAGS_COMPNAME) gtop 433 libutil/gtagsop.c strbuf_puts(gtop->sb, compress(ptable.part[PART_TAG].start, key)); gtop 435 libutil/gtagsop.c strbuf_puts(gtop->sb, ptable.part[PART_TAG].start); gtop 436 libutil/gtagsop.c strbuf_putc(gtop->sb, ' '); gtop 437 libutil/gtagsop.c strbuf_puts(gtop->sb, ptable.part[PART_LNO].start); gtop 438 libutil/gtagsop.c strbuf_putc(gtop->sb, ' '); gtop 439 libutil/gtagsop.c strbuf_puts(gtop->sb, gtop->format & GTAGS_COMPRESS ? gtop 442 libutil/gtagsop.c dbop_put(gtop->dbop, key, strbuf_value(gtop->sb)); gtop 453 libutil/gtagsop.c gtags_delete(GTOP *gtop, IDSET *deleteset) gtop 458 libutil/gtagsop.c for (tagline = dbop_first(gtop->dbop, NULL, NULL, 0); tagline; tagline = dbop_next(gtop->dbop)) { gtop 467 libutil/gtagsop.c dbop_delete(gtop->dbop, NULL); gtop 487 libutil/gtagsop.c gtags_first(GTOP *gtop, const char *pattern, int flags) gtop 498 libutil/gtagsop.c if (gtop->path_hash) { gtop 499 libutil/gtagsop.c strhash_close(gtop->path_hash); gtop 500 libutil/gtagsop.c gtop->path_hash = NULL; gtop 502 libutil/gtagsop.c if (gtop->path_array) { gtop 503 libutil/gtagsop.c free(gtop->path_array); gtop 504 libutil/gtagsop.c gtop->path_array = NULL; gtop 507 libutil/gtagsop.c gtop->flags = flags; gtop 517 libutil/gtagsop.c if (gtop->format & GTAGS_COMPACT) gtop 518 libutil/gtagsop.c gtop->fp = NULL; gtop 558 libutil/gtagsop.c if (gtop->flags & GTOP_PATH) { gtop 564 libutil/gtagsop.c gtop->path_hash = strhash_open(HASHBUCKETS); gtop 574 libutil/gtagsop.c for (tagline = dbop_first(gtop->dbop, key, preg, dbflags); gtop 576 libutil/gtagsop.c tagline = dbop_next(gtop->dbop)) gtop 583 libutil/gtagsop.c entry = strhash_assign(gtop->path_hash, tagline, 1); gtop 589 libutil/gtagsop.c entry->value = strhash_strdup(gtop->path_hash, cp, 0); gtop 601 libutil/gtagsop.c gtop->path_array = (char **)check_malloc(gtop->path_hash->entries * sizeof(char *)); gtop 603 libutil/gtagsop.c for (entry = strhash_first(gtop->path_hash); entry != NULL; entry = strhash_next(gtop->path_hash)) gtop 604 libutil/gtagsop.c gtop->path_array[i++] = entry->value; gtop 605 libutil/gtagsop.c if (i != gtop->path_hash->entries) gtop 606 libutil/gtagsop.c die("Something is wrong. 'i = %lu, entries = %lu'" , i, gtop->path_hash->entries); gtop 607 libutil/gtagsop.c if (!(gtop->flags & GTOP_NOSORT)) gtop 608 libutil/gtagsop.c qsort(gtop->path_array, gtop->path_hash->entries, sizeof(char *), compare_path); gtop 609 libutil/gtagsop.c gtop->path_count = gtop->path_hash->entries; gtop 610 libutil/gtagsop.c gtop->path_index = 0; gtop 612 libutil/gtagsop.c if (gtop->path_index >= gtop->path_count) gtop 614 libutil/gtagsop.c gtop->gtp.path = gtop->path_array[gtop->path_index++]; gtop 615 libutil/gtagsop.c return >op->gtp; gtop 616 libutil/gtagsop.c } else if (gtop->flags & GTOP_KEY) { gtop 617 libutil/gtagsop.c return ((gtop->gtp.tag = dbop_first(gtop->dbop, key, preg, dbflags)) == NULL) gtop 618 libutil/gtagsop.c ? NULL : >op->gtp; gtop 620 libutil/gtagsop.c if (gtop->vb == NULL) gtop 621 libutil/gtagsop.c gtop->vb = varray_open(sizeof(GTP), 200); gtop 623 libutil/gtagsop.c varray_reset(gtop->vb); gtop 624 libutil/gtagsop.c if (gtop->segment_pool == NULL) gtop 625 libutil/gtagsop.c gtop->segment_pool = pool_open(); gtop 627 libutil/gtagsop.c pool_reset(gtop->segment_pool); gtop 628 libutil/gtagsop.c if (gtop->path_hash == NULL) gtop 629 libutil/gtagsop.c gtop->path_hash = strhash_open(HASHBUCKETS); gtop 631 libutil/gtagsop.c strhash_reset(gtop->path_hash); gtop 632 libutil/gtagsop.c tagline = dbop_first(gtop->dbop, key, preg, dbflags); gtop 638 libutil/gtagsop.c dbop_unread(gtop->dbop); gtop 642 libutil/gtagsop.c segment_read(gtop); gtop 643 libutil/gtagsop.c return >op->gtp_array[gtop->gtp_index++]; gtop 654 libutil/gtagsop.c gtags_next(GTOP *gtop) gtop 656 libutil/gtagsop.c if (gtop->flags & GTOP_PATH) { gtop 657 libutil/gtagsop.c if (gtop->path_index >= gtop->path_count) gtop 659 libutil/gtagsop.c gtop->gtp.path = gtop->path_array[gtop->path_index++]; gtop 660 libutil/gtagsop.c return >op->gtp; gtop 661 libutil/gtagsop.c } else if (gtop->flags & GTOP_KEY) { gtop 662 libutil/gtagsop.c return ((gtop->gtp.tag = dbop_next(gtop->dbop)) == NULL) gtop 663 libutil/gtagsop.c ? NULL : >op->gtp; gtop 669 libutil/gtagsop.c if (gtop->gtp_index >= gtop->gtp_count) { gtop 670 libutil/gtagsop.c varray_reset(gtop->vb); gtop 671 libutil/gtagsop.c pool_reset(gtop->segment_pool); gtop 673 libutil/gtagsop.c segment_read(gtop); gtop 675 libutil/gtagsop.c if (gtop->gtp_index >= gtop->gtp_count) gtop 677 libutil/gtagsop.c return >op->gtp_array[gtop->gtp_index++]; gtop 686 libutil/gtagsop.c gtags_close(GTOP *gtop) gtop 688 libutil/gtagsop.c if (gtop->format & GTAGS_COMPACT && gtop->fp != NULL) gtop 689 libutil/gtagsop.c fclose(gtop->fp); gtop 690 libutil/gtagsop.c if (gtop->format & GTAGS_COMPRESS) gtop 692 libutil/gtagsop.c if (gtop->format & GTAGS_COMPACT && gtop->cur_path[0]) gtop 693 libutil/gtagsop.c flush_pool(gtop); gtop 694 libutil/gtagsop.c if (gtop->segment_pool) gtop 695 libutil/gtagsop.c pool_close(gtop->segment_pool); gtop 696 libutil/gtagsop.c if (gtop->path_array) gtop 697 libutil/gtagsop.c free(gtop->path_array); gtop 698 libutil/gtagsop.c if (gtop->sb) gtop 699 libutil/gtagsop.c strbuf_close(gtop->sb); gtop 700 libutil/gtagsop.c if (gtop->vb) gtop 701 libutil/gtagsop.c varray_close(gtop->vb); gtop 702 libutil/gtagsop.c if (gtop->path_hash) gtop 703 libutil/gtagsop.c strhash_close(gtop->path_hash); gtop 705 libutil/gtagsop.c dbop_close(gtop->dbop); gtop 706 libutil/gtagsop.c free(gtop); gtop 714 libutil/gtagsop.c flush_pool(GTOP *gtop) gtop 717 libutil/gtagsop.c const char *s_fid = gpath_path2fid(gtop->cur_path, NULL); gtop 722 libutil/gtagsop.c die("GPATH is corrupted.('%s' not found)", gtop->cur_path); gtop 727 libutil/gtagsop.c for (entry = strhash_first(gtop->path_hash); entry; entry = strhash_next(gtop->path_hash)) { gtop 740 libutil/gtagsop.c if (gtop->flags & GTAGS_EXTRACTMETHOD) { gtop 751 libutil/gtagsop.c strbuf_reset(gtop->sb); gtop 752 libutil/gtagsop.c strbuf_puts(gtop->sb, s_fid); gtop 753 libutil/gtagsop.c strbuf_putc(gtop->sb, ' '); gtop 754 libutil/gtagsop.c if (gtop->format & GTAGS_COMPNAME) { gtop 755 libutil/gtagsop.c strbuf_puts(gtop->sb, compress(entry->name, key)); gtop 757 libutil/gtagsop.c strbuf_puts(gtop->sb, entry->name); gtop 759 libutil/gtagsop.c strbuf_putc(gtop->sb, ' '); gtop 760 libutil/gtagsop.c header_offset = strbuf_getlen(gtop->sb); gtop 766 libutil/gtagsop.c if (gtop->format & GTAGS_COMPLINE) { gtop 780 libutil/gtagsop.c if (strbuf_getlen(gtop->sb) == header_offset) gtop 781 libutil/gtagsop.c strbuf_putn(gtop->sb, n); gtop 790 libutil/gtagsop.c strbuf_putc(gtop->sb, '-'); gtop 791 libutil/gtagsop.c strbuf_putn(gtop->sb, last - cont); gtop 794 libutil/gtagsop.c if (strbuf_getlen(gtop->sb) > header_offset) { gtop 795 libutil/gtagsop.c strbuf_putc(gtop->sb, ','); gtop 796 libutil/gtagsop.c strbuf_putn(gtop->sb, n - last); gtop 798 libutil/gtagsop.c strbuf_putn(gtop->sb, n); gtop 800 libutil/gtagsop.c if (strbuf_getlen(gtop->sb) > DBOP_PAGESIZE / 4) { gtop 801 libutil/gtagsop.c dbop_put(gtop->dbop, key, strbuf_value(gtop->sb)); gtop 802 libutil/gtagsop.c strbuf_setlen(gtop->sb, header_offset); gtop 808 libutil/gtagsop.c strbuf_putc(gtop->sb, '-'); gtop 809 libutil/gtagsop.c strbuf_putn(gtop->sb, last - cont); gtop 821 libutil/gtagsop.c if (strbuf_getlen(gtop->sb) > header_offset) gtop 822 libutil/gtagsop.c strbuf_putc(gtop->sb, ','); gtop 823 libutil/gtagsop.c strbuf_putn(gtop->sb, n); gtop 824 libutil/gtagsop.c if (strbuf_getlen(gtop->sb) > DBOP_PAGESIZE / 4) { gtop 825 libutil/gtagsop.c dbop_put(gtop->dbop, key, strbuf_value(gtop->sb)); gtop 826 libutil/gtagsop.c strbuf_setlen(gtop->sb, header_offset); gtop 831 libutil/gtagsop.c if (strbuf_getlen(gtop->sb) > header_offset) gtop 832 libutil/gtagsop.c dbop_put(gtop->dbop, key, strbuf_value(gtop->sb)); gtop 857 libutil/gtagsop.c segment_read(GTOP *gtop) gtop 866 libutil/gtagsop.c gtop->cur_tagname[0] = '\0'; gtop 867 libutil/gtagsop.c while ((tagline = dbop_next(gtop->dbop)) != NULL) { gtop 873 libutil/gtagsop.c if (gtop->cur_tagname[0] == '\0') { gtop 874 libutil/gtagsop.c strlimcpy(gtop->cur_tagname, gtop->dbop->lastkey, sizeof(gtop->cur_tagname)); gtop 875 libutil/gtagsop.c } else if (strcmp(gtop->cur_tagname, gtop->dbop->lastkey) != 0) { gtop 879 libutil/gtagsop.c dbop_unread(gtop->dbop); gtop 882 libutil/gtagsop.c gtp = varray_append(gtop->vb); gtop 883 libutil/gtagsop.c gtp->tagline = pool_strdup(gtop->segment_pool, tagline, 0); gtop 884 libutil/gtagsop.c gtp->tag = (const char *)gtop->cur_tagname; gtop 892 libutil/gtagsop.c sh = strhash_assign(gtop->path_hash, path, 1); gtop 902 libutil/gtagsop.c gtop->gtp_array = varray_assign(gtop->vb, 0, 0); gtop 903 libutil/gtagsop.c gtop->gtp_count = gtop->vb->length; gtop 904 libutil/gtagsop.c gtop->gtp_index = 0; gtop 905 libutil/gtagsop.c if (!(gtop->flags & GTOP_NOSORT)) gtop 906 libutil/gtagsop.c qsort(gtop->gtp_array, gtop->gtp_count, sizeof(GTP), compare_tags);