-
Notifications
You must be signed in to change notification settings - Fork 5
/
fdecls.h
190 lines (190 loc) · 6.99 KB
/
fdecls.h
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
rope rope_new(size_t);
int rope_isnull(rope); // 1 if initialized, 0 otherwise
void rope_release(rope*);
span rope_alloc_atleast(rope*,size_t);
Partial partial_sp_sp(span, void(*)(span,span));
Partial partial_0_sp(void(*)(span));
void apply_partial(Partial,span);
void start_search();
void perform_search();
void finalize_search();
void search_forward();
void search_backward();
int find_block(span); // find first block containing text
int block_by_id(span); // find a block by id (without hash char)
void start_ex();
void handle_ex_command();
void bootstrap();
void addfile(span);
void addlib(span);
void ex_help();
void set_highlight();
void reset_highlight();
void select_model();
int select_menu(spans opts, int sel); // allows selecting from a short list of options
void print_menu(spans, int);
void page_down();
void page_up();
void print_current_blocks();
void render_block_range(int,int);
void print_physical_lines(span, int);
int print_matching_physical_lines(span, span);
span count_physical_lines(span, int*);
void print_multiple_partial_blocks(int,int);
void print_single_block_with_skipping(int,int);
void cmpr_init(); // handles --init
void print_block(int);
void print_comment(int);
void print_code(int);
int count_blocks();
void clear_display();
void get_code(); // read and index current code
void get_revs(); // read and index revs
spans find_blocks(span); // find the blocks in a file
spans find_blocks_language(span file, span language); // find_blocks helper function dispatching on language
void find_all_lines(); // like find_all_blocks, but for lines; applies to the whole project
void index_block_ids();
void ingest(); // updates everything that needs to be updated after code has changed
int main(int, char**);
void init();
void read_(int argc, char** argv);
void call_llm(span model, json messages, llm_message_handler cb);
void read_openai_key();
void read_anthropic_key();
span filename_template(span);
span assoc_spans_lookup(spans, span);
spans filename_variables();
network_ret call_gpt(json messages, span model);
network_ret call_gpt_curl(span req, span resp, span err);
network_ret call_ollama(json messages, span model);
network_ret call_ollama_curl(span req, span resp, span err);
network_ret call_anthropic(json messages, span model);
network_ret call_anthropic_curl(span req, span resp, span err);
void handle_args(int argc, char **argv);
void inp_sanity_checks();
checksum selected_checksum(span);
void ingest();
void index_block_ids();
spans ids_for_block(span);
int block_for_span(span);
span id_for_block(span);
checksum current_block_checksum();
void set_current_block(int);
void block_id_jump();
span get_revdir();
span read_file_into(span filename, rope*);
void get_revs_2();
int get_revs_cache_get(span bname, span rev_contents);
checksum scan_checksum(span);
int scan_int(span*);
int parse_int(span); // parse int without mutating
int scan_hex(span*);
int parse_hex(span);
int parse_revfile_cache(span bname, span rev_cache, span rev_contents);
void parse_section_header_line(int *failure, int *section_type, int *block_number, span *rev_cache);
void parse_blocks_lines(int *failure, time_t timestamp, int n_blocks, span rev_contents, span* rev_cache);
void parse_scs_lines(int *failure, int rev_block_idx, span* rev_cache);
void parse_ids_lines(int *failure, int rev_block_idx, span* rev_cache);
void get_revs_cache_put(checksums* working_set, span bname, span content);
void pr_revinfo(span language, spans blocks, int prev_n_revblocks, span contents);
void pr_checksum(checksum);
void pr_relative_span(span,span);
span prs_checksum(checksum);
int getkey();
void sbv_display(sbv_state* sbvs);
void sbv_populate(sbv_state* sbvs);
int block_id_match(spans curr_ids, spans rev_ids);
int rev_block_match(sbv_state* sbvs, rev_block* current_revblock);
void select_block_version();
checksums sorted_line_checksums(span);
int cksums_intersection(checksums,checksums);
time_t parse_rev_fname(span);
char getch();
void main_loop();
void render_empty_project_state();
void render_empty_file_state();
void handle_keystroke(char);
void keyboard_help();
void handle_j();
void handle_k();
void handle_g();
void handle_G();
int first_block_in_file(int);
int last_block_in_file(int);
void print_menu(spans,int);
int select_menu(spans,int);
void print_ruler();
span get_debug_info();
void parse_config();
void save_conf();
void check_dirs();
void check_conf_vars();
void ensure_conf_var(span* var, span message, span default_value);
void edit_current_block();
span tmp_filename();
int launch_editor(char* filename);
int file_for_block(span);
span current_block_language();
span guess_language_from_filename(span);
span language_for_block(span block);
void handle_edited_file(char *filename);
void new_rev(span tmp_filename, int file_index);
void update_projfile(int file_index, span tmp_filename, span rev_path);
void send_to_llm(span, llm_message_handler cb);
void handle_openai_response(span response, llm_message_handler cb);
void handle_ollama_response(span response, llm_message_handler cb);
void handle_anthropic_response(span response, llm_message_handler cb);
int find_comment_end_c(span);
int find_comment_end_python(span);
span block_comment_part(span);
span block_code_part(span);
void prompt_palette();
spans get_palette();
void apply_prompt(span prompt_name);
span get_prompt_template(span);
int main(int argc, char** argv);
span get_prompt_template(span name);
void agreement();
void agreement_to_nl_diff();
void output_template_var(spans* ctx, span human_name);
span lookup_output(span output_of);
span expand_template(span template, spans vars);
void print_template_literal(span);
spans current_block_template_vars();
void eval_template_variable(span, spans);
spans parse_template(span);
int block_by_id(span id_no_hash);
void ex_expand();
span blockref_id(span ref);
span blockref_fname(span ref);
span language_comment_starter(span language);
span language_comment_ender(span language);
span expand_refs_2(span,span);
void expand_refs_2_rec(span,span,int,int);
void expand_refs_2_rec_context(span block, span transform, spans* already, int comment_context, int depth);
void expand_refs_2_rec_body (span block, span transform, spans* already, int comment_context, int depth);
void expand_refs_2_rec_both (span block, span transform, spans* already, int comment_context, int depth);
span chase_ref_2(span);
span strip_markdown_codeblock(span);
void send_to_clipboard(span);
void compile();
void replace_code_clipboard();
span pipe_cmd_cmp(span);
void replace_block_code_part(span);
void agreement_SAV(span);
void output_save(span operation, span message);
llm_message_handler make_output_saver(span operation);
void generic_output_save(span operation, span message);
void agreement_SAV(span);
void proposed_diff_SAV(span);
int span_cmp_wrapper(const void*, const void*);
void get_outputs();
spans dir_listing(span dirname);
spans read_output_headers(span bname);
span read_output_body(span bname);
void replace_block(span new_block);
llm_message_handler simple_message_handler(void(*f)(span));
void agreement_to_pl_diff();
void nl2pl_rewrite();
void pl2nl_rewrite();
void pl2nl_rewrite_cb(span message);