| 693 | } |
| 694 | |
| 695 | char *cbm_render_graph_profile(cbm_graph_profile_dialect_t dialect, cbm_graph_tier_t tier, |
| 696 | cbm_graph_access_t access, const char *binary_path) { |
| 697 | if (!dialect_valid(dialect) || !tier_valid(tier) || !access_valid(access) || |
| 698 | (access == CBM_GRAPH_ACCESS_DIRECT && !cbm_graph_dialect_direct_capable(dialect))) { |
| 699 | return NULL; |
| 700 | } |
| 701 | char *prompt = cbm_render_graph_prompt(tier, access); |
| 702 | if (!prompt) { |
| 703 | return NULL; |
| 704 | } |
| 705 | if (dialect == CBM_GRAPH_DIALECT_KIRO) { |
| 706 | char *result = render_kiro_profile(tier, access, binary_path, prompt); |
| 707 | free(prompt); |
| 708 | return result; |
| 709 | } |
| 710 | profile_buffer_t buffer; |
| 711 | profile_buffer_init(&buffer); |
| 712 | bool ok = render_profile_text(&buffer, dialect, tier, access, binary_path, prompt); |
| 713 | free(prompt); |
| 714 | if (!ok) { |
| 715 | profile_buffer_discard(&buffer); |
| 716 | return NULL; |
| 717 | } |
| 718 | return profile_buffer_finish(&buffer); |
| 719 | } |
| 720 | |
| 721 | /* A released-but-superseded rendering, kept only so install/uninstall can |
| 722 | * recognise and migrate files an older release wrote. */ |