Added checker for missing documentation,
parent
13ee76effe
commit
2d78eade2f
|
@ -204,5 +204,21 @@ doc_paragraph(Arena *arena, Doc_Block *block){
|
||||||
par->kind = DocParagraphKind_Text;
|
par->kind = DocParagraphKind_Text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////
|
||||||
|
|
||||||
|
function Doc_Page*
|
||||||
|
doc_get_page(Doc_Cluster *cluster, String_Const_u8 name){
|
||||||
|
Doc_Page *result = 0;
|
||||||
|
for (Doc_Page *page = cluster->first_page;
|
||||||
|
page != 0;
|
||||||
|
page = page->next){
|
||||||
|
if (string_match(name, page->name)){
|
||||||
|
result = page;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
// BOTTOM
|
// BOTTOM
|
||||||
|
|
||||||
|
|
|
@ -384,6 +384,39 @@ doc_custom_api__buffer(Arena *arena, API_Definition *api_def, Doc_Cluster *clust
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
|
|
||||||
|
if (begin_doc_call(arena, cluster, api_def, "buffer_padded_box_of_pos", &func)){
|
||||||
|
doc_function_brief(arena, &func, "Compute the rectangle around a character at a particular byte position, relative to the top left corner of a given line");
|
||||||
|
|
||||||
|
// params
|
||||||
|
Doc_Block *params = doc_function_begin_params(arena, &func);
|
||||||
|
doc_custom_app_ptr(arena, &func);
|
||||||
|
|
||||||
|
doc_function_param(arena, &func, "buffer_id");
|
||||||
|
doc_text(arena, params, "the id of the buffer who's layout will be measured");
|
||||||
|
|
||||||
|
doc_function_param(arena, &func, "width");
|
||||||
|
doc_text(arena, params, "the width parameter of the layout, passed to layout rules as a recommended wrap point");
|
||||||
|
|
||||||
|
doc_function_param(arena, &func, "face_id");
|
||||||
|
doc_text(arena, params, "the face parameter of the layout, passed to layout rules as a recommended face");
|
||||||
|
|
||||||
|
doc_function_param(arena, &func, "base_line");
|
||||||
|
doc_text(arena, params, "the line number of the line that serves as the relative starting point of the measurement");
|
||||||
|
|
||||||
|
doc_function_param(arena, &func, "pos");
|
||||||
|
doc_text(arena, params, "the absolute byte index of the position to query");
|
||||||
|
|
||||||
|
// return
|
||||||
|
Doc_Block *ret = doc_function_return(arena, &func);
|
||||||
|
doc_text(arena, ret, "the rectangle around a character in the layout that is closest to including the given query position in it's span, with coordinates set relative to the top left corner of the base line, on success, when the buffer exists and contains the base line and query position, cleared to zero otherwise");
|
||||||
|
|
||||||
|
// details
|
||||||
|
Doc_Block *det = doc_function_details(arena, &func);
|
||||||
|
doc_text(arena, det, "Line numbers are 1 based.");
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////
|
||||||
|
|
||||||
if (begin_doc_call(arena, cluster, api_def, "buffer_relative_character_from_pos", &func)){
|
if (begin_doc_call(arena, cluster, api_def, "buffer_relative_character_from_pos", &func)){
|
||||||
doc_function_brief(arena, &func, "Compute a character index relative to a particular lines first character");
|
doc_function_brief(arena, &func, "Compute a character index relative to a particular lines first character");
|
||||||
|
|
||||||
|
@ -627,6 +660,39 @@ doc_custom_api__buffer(Arena *arena, API_Definition *api_def, Doc_Cluster *clust
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
|
|
||||||
|
if (begin_doc_call(arena, cluster, api_def, "buffer_set_layout", &func)){
|
||||||
|
doc_function_brief(arena, &func, "Set the layout function of a buffer");
|
||||||
|
|
||||||
|
// params
|
||||||
|
Doc_Block *params = doc_function_begin_params(arena, &func);
|
||||||
|
doc_custom_app_ptr(arena, &func);
|
||||||
|
|
||||||
|
doc_function_param(arena, &func, "buffer_id");
|
||||||
|
doc_text(arena, params, "the id of the buffer to be modified");
|
||||||
|
|
||||||
|
doc_function_param(arena, &func, "layout_func");
|
||||||
|
doc_text(arena, params, "the new layout function for the buffer's layout");
|
||||||
|
|
||||||
|
// return
|
||||||
|
Doc_Block *ret = doc_function_return(arena, &func);
|
||||||
|
doc_text(arena, ret, "non-zero on success, when the buffer exists, otherwise zero");
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////
|
||||||
|
|
||||||
|
if (begin_doc_call(arena, cluster, api_def, "buffer_clear_layout_cache", &func)){
|
||||||
|
doc_function_brief(arena, &func, "Clear all the layout information cached in the buffer");
|
||||||
|
|
||||||
|
// params
|
||||||
|
Doc_Block *params = doc_function_begin_params(arena, &func);
|
||||||
|
doc_custom_app_ptr(arena, &func);
|
||||||
|
|
||||||
|
doc_function_param(arena, &func, "buffer_id");
|
||||||
|
doc_text(arena, params, "the id of the buffer to be modified");
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////
|
||||||
|
|
||||||
if (begin_doc_call(arena, cluster, api_def, "buffer_get_layout", &func)){
|
if (begin_doc_call(arena, cluster, api_def, "buffer_get_layout", &func)){
|
||||||
doc_function_brief(arena, &func, "Retrieve the layout rule of a buffer");
|
doc_function_brief(arena, &func, "Retrieve the layout rule of a buffer");
|
||||||
|
|
||||||
|
|
|
@ -1174,6 +1174,16 @@ doc_custom_api__global(Arena *arena, API_Definition *api_def, Doc_Cluster *clust
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
|
|
||||||
|
if (begin_doc_call(arena, cluster, api_def, "hard_exit", &func)){
|
||||||
|
doc_function_brief(arena, &func, "Exits 4coder at the end of the frame, no matter what; for instance, call from the exit signal handler to actual exit 4coder.");
|
||||||
|
|
||||||
|
// params
|
||||||
|
doc_function_begin_params(arena, &func);
|
||||||
|
doc_custom_app_ptr(arena, &func);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////
|
||||||
|
|
||||||
if (begin_doc_call(arena, cluster, api_def, "set_window_title", &func)){
|
if (begin_doc_call(arena, cluster, api_def, "set_window_title", &func)){
|
||||||
doc_function_brief(arena, &func, "Set the title of the 4coder window");
|
doc_function_brief(arena, &func, "Set the title of the 4coder window");
|
||||||
|
|
||||||
|
|
|
@ -60,6 +60,8 @@ int main(void){
|
||||||
API_Definition *api_def = api_get_api(&def_list, string_u8_litexpr("custom"));
|
API_Definition *api_def = api_get_api(&def_list, string_u8_litexpr("custom"));
|
||||||
Doc_Cluster *cluster = doc_custom_api(&arena, api_def);
|
Doc_Cluster *cluster = doc_custom_api(&arena, api_def);
|
||||||
|
|
||||||
|
doc_api_check_full_coverage(&arena, cluster, api_def);
|
||||||
|
|
||||||
for (Doc_Log *node = cluster->first_log;
|
for (Doc_Log *node = cluster->first_log;
|
||||||
node != 0;
|
node != 0;
|
||||||
node = node->next){
|
node = node->next){
|
||||||
|
|
|
@ -133,6 +133,33 @@ doc_custom_api__view(Arena *arena, API_Definition *api_def, Doc_Cluster *cluster
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
|
|
||||||
|
if (begin_doc_call(arena, cluster, api_def, "view_padded_box_of_pos", &func)){
|
||||||
|
doc_function_brief(arena, &func, "Compute the rectangle around a character at a particular byte position, relative to the top left corner of a given line");
|
||||||
|
|
||||||
|
// params
|
||||||
|
Doc_Block *params = doc_function_begin_params(arena, &func);
|
||||||
|
doc_custom_app_ptr(arena, &func);
|
||||||
|
|
||||||
|
doc_function_param(arena, &func, "view_id");
|
||||||
|
doc_text(arena, params, "the id of the view who's layout will be measured");
|
||||||
|
|
||||||
|
doc_function_param(arena, &func, "base_line");
|
||||||
|
doc_text(arena, params, "the line number of the line that serves as the relative starting point of the measurement");
|
||||||
|
|
||||||
|
doc_function_param(arena, &func, "pos");
|
||||||
|
doc_text(arena, params, "the absolute byte index of the position to query");
|
||||||
|
|
||||||
|
// return
|
||||||
|
Doc_Block *ret = doc_function_return(arena, &func);
|
||||||
|
doc_text(arena, ret, "the rectangle around a character in the layout that is closest to including the given query position in it's span, with coordinates set relative to the top left corner of the base line, on success, when the view exists and contains the base line and query position, cleared to zero otherwise");
|
||||||
|
|
||||||
|
// details
|
||||||
|
Doc_Block *det = doc_function_details(arena, &func);
|
||||||
|
doc_text(arena, det, "Line numbers are 1 based.");
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////
|
||||||
|
|
||||||
if (begin_doc_call(arena, cluster, api_def, "view_relative_character_from_pos", &func)){
|
if (begin_doc_call(arena, cluster, api_def, "view_relative_character_from_pos", &func)){
|
||||||
doc_function_brief(arena, &func, "Compute a character index relative to a particular lines first character");
|
doc_function_brief(arena, &func, "Compute a character index relative to a particular lines first character");
|
||||||
|
|
||||||
|
|
|
@ -155,4 +155,19 @@ doc_function_add_related(Arena *arena, Doc_Block *rel, char *name){
|
||||||
content->page_link = SCu8(name);
|
content->page_link = SCu8(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////
|
||||||
|
|
||||||
|
function void
|
||||||
|
doc_api_check_full_coverage(Arena *arena, Doc_Cluster *cluster, API_Definition *api_def){
|
||||||
|
for (API_Call *call = api_def->first_call;
|
||||||
|
call != 0;
|
||||||
|
call = call->next){
|
||||||
|
String_Const_u8 name = call->name;
|
||||||
|
Doc_Page *page = doc_get_page(cluster, name);
|
||||||
|
if (page == 0){
|
||||||
|
doc_errorf(arena, cluster, "missing documentation for %.*s", string_expand(name));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// BOTTOM
|
// BOTTOM
|
||||||
|
|
Loading…
Reference in New Issue