The namespace block of `line` in file f and its imports. */
| 545 | |
| 546 | /* The namespace block of `line` in file f and its imports. */ |
| 547 | static void pr_block_at(pr_ctx_t *c, const pr_file_t *f, uint32_t line) { |
| 548 | int blk = f->nnss ? CBM_NOT_FOUND : 0; |
| 549 | c->ns = ""; |
| 550 | c->ns_len = 0; |
| 551 | for (int i = 0; i < f->nnss; i++) { |
| 552 | if (line >= f->nss[i].first && line <= f->nss[i].last) { |
| 553 | blk = f->nss[i].blk; |
| 554 | c->ns = f->nss[i].name; |
| 555 | c->ns_len = strlen(c->ns); |
| 556 | break; |
| 557 | } |
| 558 | } |
| 559 | c->uses = NULL; |
| 560 | c->nuses = 0; |
| 561 | for (int i = 0; i < f->nuses; i++) { |
| 562 | if (f->use_blk[i] != blk) { |
| 563 | continue; |
| 564 | } |
| 565 | if (!c->uses) { |
| 566 | c->uses = &f->uses[i]; |
| 567 | } |
| 568 | c->nuses++; |
| 569 | } |
| 570 | } |
| 571 | |
| 572 | /* The type of file f whose lines hold `line`, or -1. */ |
| 573 | static int pr_type_at(const pr_index_t *ix, const pr_file_t *f, uint32_t line) { |