Progress on type documentation

This commit is contained in:
Allen Webster 2019-12-15 22:56:13 -08:00
parent 0e9fcaee05
commit b6fc044538
20 changed files with 953 additions and 494 deletions

View File

@ -19,8 +19,8 @@ begin_api(Arena *arena, char *name){
function API_Call* function API_Call*
api_call_with_location(Arena *arena, API_Definition *api, String_Const_u8 name, String_Const_u8 type, String_Const_u8 location){ api_call_with_location(Arena *arena, API_Definition *api, String_Const_u8 name, String_Const_u8 type, String_Const_u8 location){
API_Call *call = push_array_zero(arena, API_Call, 1); API_Call *call = push_array_zero(arena, API_Call, 1);
sll_queue_push(api->first, api->last, call); sll_queue_push(api->first_call, api->last_call, call);
api->count += 1; api->call_count += 1;
call->name = name; call->name = name;
call->return_type = type; call->return_type = type;
call->location_string = location; call->location_string = location;
@ -32,6 +32,25 @@ api_call_with_location(Arena *arena, API_Definition *api, char *name, char *type
return(api_call_with_location(arena, api, SCu8(name), SCu8(type), SCu8(location))); return(api_call_with_location(arena, api, SCu8(name), SCu8(type), SCu8(location)));
} }
function API_Type*
api_type_structure_with_location(Arena *arena, API_Definition *api, API_Type_Structure_Kind kind, String_Const_u8 name, List_String_Const_u8 member_list, String_Const_u8 definition, String_Const_u8 location){
API_Type *type = push_array_zero(arena, API_Type, 1);
sll_queue_push(api->first_type, api->last_type, type);
api->type_count += 1;
type->kind = APITypeKind_Structure;
type->name = name;
type->location_string = location;
type->struct_type.kind = kind;
type->struct_type.member_names = member_list;
type->struct_type.definition_string = definition;
return(type);
}
function API_Type*
api_type_structure_with_location(Arena *arena, API_Definition *api, API_Type_Structure_Kind kind, char *name, List_String_Const_u8 member_list, char *definition, char *location){
return(api_type_structure_with_location(arena, api, kind, name, member_list, definition, location));
}
#define api_call(arena, api, name, type) \ #define api_call(arena, api, name, type) \
api_call_with_location((arena), (api), (name), (type), file_name_line_number) api_call_with_location((arena), (api), (name), (type), file_name_line_number)
@ -79,7 +98,7 @@ api_get_api(Arena *arena, API_Definition_List *list, String_Const_u8 name){
function API_Call* function API_Call*
api_get_call(API_Definition *api, String_Const_u8 name){ api_get_call(API_Definition *api, String_Const_u8 name){
API_Call *result = 0; API_Call *result = 0;
for (API_Call *call = api->first; for (API_Call *call = api->first_call;
call != 0; call != 0;
call = call->next){ call = call->next){
if (string_match(name, call->name)){ if (string_match(name, call->name)){
@ -109,6 +128,63 @@ api_call_match_sigs(API_Call *a, API_Call *b){
return(result); return(result);
} }
function API_Type*
api_get_type(API_Definition *api, String_Const_u8 name){
API_Type *result = 0;
for (API_Type *type = api->first_type;
type != 0;
type = type->next){
if (string_match(type->name, name)){
result = type;
break;
}
}
return(result);
}
function b32
api_type_match(API_Type *a, API_Type *b){
b32 result = false;
if (a->kind == b->kind && string_match(a->name, b->name)){
switch (a->kind){
case APITypeKind_Structure:
{
if (a->kind == b->kind &&
string_list_match(a->struct_type.member_names, b->struct_type.member_names) &&
string_match(a->struct_type.definition_string, b->struct_type.definition_string)){
result = true;
}
}break;
case APITypeKind_Enum:
{
if (a->enum_type.val_count == b->enum_type.val_count &&
string_match(a->enum_type.type_name, b->enum_type.type_name)){
result = true;
for (API_Enum_Value *a_node = a->enum_type.first_val, *b_node = b->enum_type.first_val;
a_node != 0 && b_node != 0;
a_node = a_node->next, b_node = b_node->next){
if (!string_match(a_node->name, b_node->name) ||
!string_match(a_node->val, b_node->val)){
result = false;
break;
}
}
}
}break;
case APITypeKind_Typedef:
{
if (string_match(a->typedef_type.name, b->typedef_type.name) &&
string_match(a->typedef_type.definition_text, b->typedef_type.definition_text)){
result = false;
}
}break;
}
}
return(result);
}
//////////////////////////////// ////////////////////////////////
#if !defined(SKIP_STDIO) #if !defined(SKIP_STDIO)
@ -133,7 +209,7 @@ api_get_callable_name(Arena *arena, String_Const_u8 api_name, String_Const_u8 na
function void function void
generate_api_master_list(Arena *scratch, API_Definition *api, API_Generation_Flag flags, FILE *out){ generate_api_master_list(Arena *scratch, API_Definition *api, API_Generation_Flag flags, FILE *out){
for (API_Call *call = api->first; for (API_Call *call = api->first_call;
call != 0; call != 0;
call = call->next){ call = call->next){
fprintf(out, "api(%.*s) function %.*s %.*s(", fprintf(out, "api(%.*s) function %.*s %.*s(",
@ -161,7 +237,7 @@ generate_api_master_list(Arena *scratch, API_Definition *api, API_Generation_Fla
function void function void
generate_header(Arena *scratch, API_Definition *api, API_Generation_Flag flags, FILE *out){ generate_header(Arena *scratch, API_Definition *api, API_Generation_Flag flags, FILE *out){
for (API_Call *call = api->first; for (API_Call *call = api->first_call;
call != 0; call != 0;
call = call->next){ call = call->next){
fprintf(out, "#define %.*s_%.*s_sig() %.*s %.*s_%.*s(", fprintf(out, "#define %.*s_%.*s_sig() %.*s %.*s_%.*s(",
@ -188,7 +264,7 @@ generate_header(Arena *scratch, API_Definition *api, API_Generation_Flag flags,
fprintf(out, ")\n"); fprintf(out, ")\n");
} }
for (API_Call *call = api->first; for (API_Call *call = api->first_call;
call != 0; call != 0;
call = call->next){ call = call->next){
fprintf(out, "typedef %.*s %.*s_%.*s_type(", fprintf(out, "typedef %.*s %.*s_%.*s_type(",
@ -214,7 +290,7 @@ generate_header(Arena *scratch, API_Definition *api, API_Generation_Flag flags,
} }
fprintf(out, "struct API_VTable_%.*s{\n", string_expand(api->name)); fprintf(out, "struct API_VTable_%.*s{\n", string_expand(api->name));
for (API_Call *call = api->first; for (API_Call *call = api->first_call;
call != 0; call != 0;
call = call->next){ call = call->next){
fprintf(out, "%.*s_%.*s_type *", fprintf(out, "%.*s_%.*s_type *",
@ -227,7 +303,7 @@ generate_header(Arena *scratch, API_Definition *api, API_Generation_Flag flags,
fprintf(out, "};\n"); fprintf(out, "};\n");
fprintf(out, "#if defined(STATIC_LINK_API)\n"); fprintf(out, "#if defined(STATIC_LINK_API)\n");
for (API_Call *call = api->first; for (API_Call *call = api->first_call;
call != 0; call != 0;
call = call->next){ call = call->next){
String_Const_u8 callable_name = api_get_callable_name(scratch, api->name, call->name, flags); String_Const_u8 callable_name = api_get_callable_name(scratch, api->name, call->name, flags);
@ -253,7 +329,7 @@ generate_header(Arena *scratch, API_Definition *api, API_Generation_Flag flags,
} }
fprintf(out, "#undef STATIC_LINK_API\n"); fprintf(out, "#undef STATIC_LINK_API\n");
fprintf(out, "#elif defined(DYNAMIC_LINK_API)\n"); fprintf(out, "#elif defined(DYNAMIC_LINK_API)\n");
for (API_Call *call = api->first; for (API_Call *call = api->first_call;
call != 0; call != 0;
call = call->next){ call = call->next){
String_Const_u8 callable_name = api_get_callable_name(scratch, api->name, call->name, flags); String_Const_u8 callable_name = api_get_callable_name(scratch, api->name, call->name, flags);
@ -272,7 +348,7 @@ generate_cpp(Arena *scratch, API_Definition *api, API_Generation_Flag flags, FIL
fprintf(out, "%.*s_api_fill_vtable(API_VTable_%.*s *vtable){\n", fprintf(out, "%.*s_api_fill_vtable(API_VTable_%.*s *vtable){\n",
string_expand(api->name), string_expand(api->name),
string_expand(api->name)); string_expand(api->name));
for (API_Call *call = api->first; for (API_Call *call = api->first_call;
call != 0; call != 0;
call = call->next){ call = call->next){
String_Const_u8 callable_name = api_get_callable_name(scratch, api->name, call->name, flags); String_Const_u8 callable_name = api_get_callable_name(scratch, api->name, call->name, flags);
@ -287,7 +363,7 @@ generate_cpp(Arena *scratch, API_Definition *api, API_Generation_Flag flags, FIL
fprintf(out, "%.*s_api_read_vtable(API_VTable_%.*s *vtable){\n", fprintf(out, "%.*s_api_read_vtable(API_VTable_%.*s *vtable){\n",
string_expand(api->name), string_expand(api->name),
string_expand(api->name)); string_expand(api->name));
for (API_Call *call = api->first; for (API_Call *call = api->first_call;
call != 0; call != 0;
call = call->next){ call = call->next){
String_Const_u8 callable_name = api_get_callable_name(scratch, api->name, call->name, flags); String_Const_u8 callable_name = api_get_callable_name(scratch, api->name, call->name, flags);
@ -308,7 +384,7 @@ generate_constructor(Arena *scratch, API_Definition *api, API_Generation_Flag fl
fprintf(out, "API_Definition *result = begin_api(arena, \"%.*s\");\n", fprintf(out, "API_Definition *result = begin_api(arena, \"%.*s\");\n",
string_expand(api->name)); string_expand(api->name));
for (API_Call *call = api->first; for (API_Call *call = api->first_call;
call != 0; call != 0;
call = call->next){ call = call->next){
fprintf(out, "{\n"); fprintf(out, "{\n");
@ -494,7 +570,7 @@ api_definition_check(Arena *arena, API_Definition *correct, API_Definition *remo
b32 iterate_correct = (report_missing || report_mismatch); b32 iterate_correct = (report_missing || report_mismatch);
if (iterate_correct){ if (iterate_correct){
for (API_Call *call = correct->first; for (API_Call *call = correct->first_call;
call != 0; call != 0;
call = call->next){ call = call->next){
API_Call *remote_call = api_get_call(remote, call->name); API_Call *remote_call = api_get_call(remote, call->name);
@ -512,7 +588,7 @@ api_definition_check(Arena *arena, API_Definition *correct, API_Definition *remo
b32 iterate_remote = (report_extra); b32 iterate_remote = (report_extra);
if (iterate_remote){ if (iterate_remote){
for (API_Call *call = remote->first; for (API_Call *call = remote->first_call;
call != 0; call != 0;
call = call->next){ call = call->next){
API_Call *correct_call = api_get_call(correct, call->name); API_Call *correct_call = api_get_call(correct, call->name);

View File

@ -32,12 +32,62 @@ struct API_Call{
API_Param_List params; API_Param_List params;
}; };
typedef i32 API_Type_Structure_Kind;
enum{
APITypeStructureKind_Struct,
APITypeStructureKind_Union,
};
struct API_Type_Structure{
API_Type_Structure_Kind kind;
List_String_Const_u8 member_names;
String_Const_u8 definition_string;
};
struct API_Enum_Value{
API_Enum_Value *next;
String_Const_u8 name;
String_Const_u8 val;
};
struct API_Type_Enum{
String_Const_u8 type_name;
API_Enum_Value *first_val;
API_Enum_Value *last_val;
i32 val_count;
};
struct API_Type_Typedef{
String_Const_u8 name;
String_Const_u8 definition_text;
};
typedef i32 API_Type_Kind;
enum{
APITypeKind_Structure,
APITypeKind_Enum,
APITypeKind_Typedef,
};
struct API_Type{
API_Type *next;
API_Type_Kind kind;
String_Const_u8 name;
String_Const_u8 location_string;
union{
API_Type_Structure struct_type;
API_Type_Enum enum_type;
API_Type_Typedef typedef_type;
};
};
struct API_Definition{ struct API_Definition{
API_Definition *next; API_Definition *next;
API_Call *first; API_Call *first_call;
API_Call *last; API_Call *last_call;
i32 count; i32 call_count;
API_Type *first_type;
API_Type *last_type;
i32 type_count;
String_Const_u8 name; String_Const_u8 name;
}; };

View File

@ -9,14 +9,14 @@
// TOP // TOP
internal void function void
output_file_append(Thread_Context *tctx, Models *models, Editing_File *file, String_Const_u8 value){ output_file_append(Thread_Context *tctx, Models *models, Editing_File *file, String_Const_u8 value){
i64 end = buffer_size(&file->state.buffer); i64 end = buffer_size(&file->state.buffer);
Edit_Behaviors behaviors = {}; Edit_Behaviors behaviors = {};
edit_single(tctx, models, file, Ii64(end), value, behaviors); edit_single(tctx, models, file, Ii64(end), value, behaviors);
} }
internal void function void
file_cursor_to_end(Thread_Context *tctx, Models *models, Editing_File *file){ file_cursor_to_end(Thread_Context *tctx, Models *models, Editing_File *file){
Assert(file != 0); Assert(file != 0);
i64 pos = buffer_size(&file->state.buffer); i64 pos = buffer_size(&file->state.buffer);
@ -2414,13 +2414,13 @@ buffer_history__fill_record_info(Record *record, Record_Info *out){
switch (out->kind){ switch (out->kind){
case RecordKind_Single: case RecordKind_Single:
{ {
out->single.string_forward = record->single.forward_text ; out->single_string_forward = record->single.forward_text ;
out->single.string_backward = record->single.backward_text; out->single_string_backward = record->single.backward_text;
out->single.first = record->single.first; out->single_first = record->single.first;
}break; }break;
case RecordKind_Group: case RecordKind_Group:
{ {
out->group.count = record->group.count; out->group_count = record->group.count;
}break; }break;
default: default:
{ {

View File

@ -24,11 +24,16 @@ api_source:
{function|anything_else} EOF {function|anything_else} EOF
*/ */
function Token*
api_parse__token_pos(Token_Iterator *it){
return(token_it_read(it));
}
function b32 function b32
api_parse__match(Token_Iterator *it, Token_Cpp_Kind sub_kind){ api_parse__match(Token_Iterator *it, Token_Cpp_Kind sub_kind){
b32 match = false; b32 match = false;
Token *token = token_it_read(it); Token *token = token_it_read(it);
if (token->sub_kind == sub_kind){ if (token != 0 && token->sub_kind == sub_kind){
if (token_it_inc(it)){ if (token_it_inc(it)){
match = true; match = true;
} }
@ -98,6 +103,15 @@ api_parse_add_function(Arena *arena, API_Definition_List *list,
api_set_param_list(call, param_list); api_set_param_list(call, param_list);
} }
function void
api_parse_add_structure(Arena *arena, API_Definition_List *list,
String_Const_u8 api_name, API_Type_Structure_Kind kind,
String_Const_u8 name, List_String_Const_u8 member_list,
String_Const_u8 definition, String_Const_u8 location){
API_Definition *api = api_get_api(arena, list, api_name);
api_type_structure_with_location(arena, api, kind, name, member_list, definition, location);
}
function String_Const_u8 function String_Const_u8
api_parse_location(Arena *arena, String_Const_u8 source_name, String_Const_u8 source, u8 *pos){ api_parse_location(Arena *arena, String_Const_u8 source_name, String_Const_u8 source, u8 *pos){
i32 line_number = 1; i32 line_number = 1;
@ -120,6 +134,143 @@ api_parse_location(Arena *arena, String_Const_u8 source_name, String_Const_u8 so
return(push_u8_stringf(arena, "%.*s:%d:%d:", string_expand(source_name), line_number, col_number)); return(push_u8_stringf(arena, "%.*s:%d:%d:", string_expand(source_name), line_number, col_number));
} }
function b32
api_parse_source__function(Arena *arena, String_Const_u8 source_name, String_Const_u8 source, Token_Iterator *token_it, String_Const_u8 api_name, API_Definition_List *list){
b32 result = false;
String_Const_u8 ret_type = {};
i32 ret_type_star_counter = 0;
String_Const_u8 func_name = {};
API_Param_List param_list = {};
if (api_parse__match_identifier(token_it, source, &ret_type)){
for (;api_parse__match(token_it, TokenCppKind_Star);){
ret_type_star_counter += 1;
}
if (api_parse__match_identifier(token_it, source, &func_name)){
if (api_parse__match(token_it, TokenCppKind_ParenOp)){
b32 param_list_success = false;
if (api_parse__match_identifier(token_it, source, "void")){
param_list_success = true;
}
else{
for (;;){
String_Const_u8 type = {};
i32 star_counter = 0;
String_Const_u8 name = {};
if (api_parse__match_identifier(token_it, source, &type)){
for (;api_parse__match(token_it, TokenCppKind_Star);){
star_counter += 1;
}
if (api_parse__match_identifier(token_it, source, &name)){
param_list_success = true;
}
else{
break;
}
}
else{
break;
}
if (param_list_success){
api_parse_add_param(arena, &param_list, type, star_counter, name);
}
if (api_parse__match(token_it, TokenCppKind_Comma)){
param_list_success = false;
}
else{
break;
}
}
}
if (param_list_success){
if (api_parse__match(token_it, TokenCppKind_ParenCl)){
result = true;
}
}
}
}
}
if (result){
String_Const_u8 location = api_parse_location(arena, source_name, source, func_name.str);
api_parse_add_function(arena, list, api_name, func_name, ret_type, ret_type_star_counter, param_list, location);
}
return(result);
}
function String_Const_u8
api_parse__restringize_token_range(Arena *arena, String_Const_u8 source, Token *token, Token *token_end){
List_String_Const_u8 list = {};
for (Token *t = token; t < token_end; t += 1){
if (t->kind == TokenBaseKind_Comment){
continue;
}
if (t->kind == TokenBaseKind_Whitespace){
// TODO(allen): if there is a newline, emit it, all other whitespace is managed automatically.
continue;
}
String_Const_u8 str = string_substring(source, Ii64(t));
string_list_push(arena, &list, str);
}
return(string_list_flatten(arena, list));
}
function b32
api_parse_source__structure(Arena *arena, String_Const_u8 source_name, String_Const_u8 source, API_Type_Structure_Kind kind, Token_Iterator *token_it, String_Const_u8 api_name, API_Definition_List *list){
b32 result = false;
String_Const_u8 name = {};
List_String_Const_u8 member_list = {};
Token *token = api_parse__token_pos(token_it);
if (api_parse__match_identifier(token_it, source, &name)){
if (api_parse__match(token_it, TokenCppKind_Semicolon)){
result = true;
}
else if (api_parse__match(token_it, TokenCppKind_BraceOp)){
b32 member_list_success = false;
for (;;){
String_Const_u8 member_name = {};
if (api_parse__match(token_it, TokenCppKind_BraceCl)){
member_list_success = true;
break;
}
else if (api_parse__match_identifier(token_it, source, &member_name)){
if (api_parse__match(token_it, TokenCppKind_Semicolon)){
string_list_push(arena, &member_list, member_name);
}
}
else{
if (!token_it_inc(token_it)){
break;
}
}
}
if (member_list_success){
if (api_parse__match(token_it, TokenCppKind_BraceCl)){
if (api_parse__match(token_it, TokenCppKind_Semicolon)){
result = true;
}
}
}
}
}
if (result){
Token *token_end = api_parse__token_pos(token_it);
String_Const_u8 definition = ;
String_Const_u8 location = api_parse_location(arena, source_name, source, name.str);
api_parse_add_structure(arena, list, api_name, kind, name, member_list, definition, location);
}
return(result);
}
function b32
api_parse_source__struct(Arena *arena, String_Const_u8 source_name, String_Const_u8 source, Token_Iterator *token_it, String_Const_u8 api_name, API_Definition_List *list){
return(api_parse_source__structure(arena, source_name, source, APITypeStructureKind_Struct, token_it, api_name, list));
}
function b32
api_parse_source__union(Arena *arena, String_Const_u8 source_name, String_Const_u8 source, Token_Iterator *token_it, String_Const_u8 api_name, API_Definition_List *list){
return(api_parse_source__structure(arena, source_name, source, APITypeStructureKind_Union, token_it, api_name, list));
}
function void function void
api_parse_source_add_to_list(Arena *arena, String_Const_u8 source_name, String_Const_u8 source, API_Definition_List *list){ api_parse_source_add_to_list(Arena *arena, String_Const_u8 source_name, String_Const_u8 source, API_Definition_List *list){
Token_List token_list = lex_full_input_cpp(arena, source); Token_List token_list = lex_full_input_cpp(arena, source);
@ -133,74 +284,20 @@ api_parse_source_add_to_list(Arena *arena, String_Const_u8 source_name, String_C
if (api_parse__match_identifier(&token_it, source, "api")){ if (api_parse__match_identifier(&token_it, source, "api")){
String_Const_u8 api_name = {}; String_Const_u8 api_name = {};
String_Const_u8 ret_type = {};
i32 ret_type_star_counter = 0;
String_Const_u8 func_name = {};
API_Param_List param_list = {};
b32 success = false;
if (api_parse__match(&token_it, TokenCppKind_ParenOp)){ if (api_parse__match(&token_it, TokenCppKind_ParenOp)){
if (api_parse__match_identifier(&token_it, source, &api_name)){ if (api_parse__match_identifier(&token_it, source, &api_name)){
if (api_parse__match(&token_it, TokenCppKind_ParenCl)){ if (api_parse__match(&token_it, TokenCppKind_ParenCl)){
if (api_parse__match_identifier(&token_it, source, "function")){ if (api_parse__match_identifier(&token_it, source, "function")){
if (api_parse__match_identifier(&token_it, source, &ret_type)){ api_parse_source__function(arena, source_name, source, &token_it, api_name, list);
for (;api_parse__match(&token_it, TokenCppKind_Star);){
ret_type_star_counter += 1;
} }
if (api_parse__match_identifier(&token_it, source, &func_name)){ else if (api_parse__match_identifier(&token_it, source, "struct")){
if (api_parse__match(&token_it, TokenCppKind_ParenOp)){ api_parse_source__struct(arena, source_name, source, &token_it, api_name, list);
b32 param_list_success = false;
if (api_parse__match_identifier(&token_it, source, "void")){
param_list_success = true;
} }
else{ else if (api_parse__match_identifier(&token_it, source, "union")){
for (;;){ api_parse_source__union(arena, source_name, source, &token_it, api_name, list);
String_Const_u8 type = {};
i32 star_counter = 0;
String_Const_u8 name = {};
if (api_parse__match_identifier(&token_it, source, &type)){
for (;api_parse__match(&token_it, TokenCppKind_Star);){
star_counter += 1;
}
if (api_parse__match_identifier(&token_it, source, &name)){
param_list_success = true;
}
else{
break;
}
}
else{
break;
}
if (param_list_success){
api_parse_add_param(arena, &param_list, type, star_counter, name);
}
if (api_parse__match(&token_it, TokenCppKind_Comma)){
param_list_success = false;
}
else{
break;
} }
} }
} }
if (param_list_success){
if (api_parse__match(&token_it, TokenCppKind_ParenCl)){
success = true;
}
}
}
}
}
}
}
}
}
if (success){
String_Const_u8 location = api_parse_location(arena, source_name, source, func_name.str);
api_parse_add_function(arena, list, api_name, func_name,
ret_type, ret_type_star_counter, param_list,
location);
} }
} }
else{ else{

View File

@ -96,7 +96,8 @@
#include "4ed_api_definition.cpp" #include "4ed_api_definition.cpp"
#include "generated/custom_api_constructor.cpp" #include "generated/custom_api_constructor.cpp"
#include "4ed_api_parser.cpp" #include "4ed_api_parser.cpp"
#include "docs/4ed_doc_content_types.cpp" #include "4coder_doc_content_types.cpp"
#include "docs/4ed_doc_helper.cpp"
#include "docs/4ed_doc_custom_api.cpp" #include "docs/4ed_doc_custom_api.cpp"
#include "4ed_log.cpp" #include "4ed_log.cpp"

View File

@ -23,8 +23,8 @@ write_text(Application_Links *app, String_Const_u8 insert){
if (insert.str[0] != '\n'){ if (insert.str[0] != '\n'){
Record_Info record = get_single_record(app, buffer, first_index); Record_Info record = get_single_record(app, buffer, first_index);
if (record.error == RecordError_NoError && record.kind == RecordKind_Single){ if (record.error == RecordError_NoError && record.kind == RecordKind_Single){
String_Const_u8 string = record.single.string_forward; String_Const_u8 string = record.single_string_forward;
i32 last_end = (i32)(record.single.first + string.size); i32 last_end = (i32)(record.single_first + string.size);
if (last_end == pos && string.size > 0){ if (last_end == pos && string.size > 0){
char c = string.str[string.size - 1]; char c = string.str[string.size - 1];
if (c != '\n'){ if (c != '\n'){
@ -1574,12 +1574,12 @@ record_get_new_cursor_position_undo(Application_Links *app, Buffer_ID buffer_id,
default: default:
case RecordKind_Single: case RecordKind_Single:
{ {
new_edit_position = (i32)(record.single.first + record.single.string_backward.size); new_edit_position = (i32)(record.single_first + record.single_string_backward.size);
}break; }break;
case RecordKind_Group: case RecordKind_Group:
{ {
Record_Info sub_record = buffer_history_get_group_sub_record(app, buffer_id, index, 0); Record_Info sub_record = buffer_history_get_group_sub_record(app, buffer_id, index, 0);
new_edit_position = (i32)(sub_record.single.first + sub_record.single.string_backward.size); new_edit_position = (i32)(sub_record.single_first + sub_record.single_string_backward.size);
}break; }break;
} }
return(new_edit_position); return(new_edit_position);
@ -1598,12 +1598,12 @@ record_get_new_cursor_position_redo(Application_Links *app, Buffer_ID buffer_id,
default: default:
case RecordKind_Single: case RecordKind_Single:
{ {
new_edit_position = record.single.first + record.single.string_forward.size; new_edit_position = record.single_first + record.single_string_forward.size;
}break; }break;
case RecordKind_Group: case RecordKind_Group:
{ {
Record_Info sub_record = buffer_history_get_group_sub_record(app, buffer_id, index, record.group.count - 1); Record_Info sub_record = buffer_history_get_group_sub_record(app, buffer_id, index, record.group_count - 1);
new_edit_position = sub_record.single.first + sub_record.single.string_forward.size; new_edit_position = sub_record.single_first + sub_record.single_string_forward.size;
}break; }break;
} }
return((i32)(new_edit_position)); return((i32)(new_edit_position));

View File

@ -6166,6 +6166,20 @@ string_list_reverse(List_String_Const_u32 *list){
list->last = last; list->last = last;
} }
function b32
string_list_match(List_String_Const_u8 a, List_String_Const_u8 b){
b32 result = true;
for (Node_String_Const_u8 *a_node = a.first, *b_node = b.first;
a_node != 0 && b_node != 0;
a_node = a_node->next, b_node = b_node->next){
if (!string_match(a_node->string, b_node->string)){
result = false;
break;
}
}
return(result);
}
//////////////////////////////// ////////////////////////////////
global_const u8 utf8_class[32] = { global_const u8 utf8_class[32] = {

View File

@ -266,7 +266,7 @@ struct: "struct" <identifier> $(";" | "{")
union: "union" <identifier> $(";" | "{") union: "union" <identifier> $(";" | "{")
enum: "enum" <identifier> $(";" | "{") enum: "enum" <identifier> $(";" | "{")
typedef: "typedef" [* - (<identifier> (";" | "("))] <identifier> $(";" | "(") typedef: "typedef" [* - (<identifier> (";" | "("))] <identifier> $(";" | "(")
function: <identifier> >"(" function: <identifier> >"(" [* - ("(" | ")" | "{" | "}" | ";")] ")" ("{" | ";")
#endif #endif
@ -350,10 +350,42 @@ cpp_parse_function(Code_Index_File *index, Generic_Parse_State *state, Code_Inde
generic_parse_inc(state); generic_parse_inc(state);
generic_parse_skip_soft_tokens(index, state); generic_parse_skip_soft_tokens(index, state);
Token *peek = token_it_read(&state->it); Token *peek = token_it_read(&state->it);
Token *reset_point = peek;
if (peek != 0 && peek->sub_kind == TokenCppKind_ParenOp){ if (peek != 0 && peek->sub_kind == TokenCppKind_ParenOp){
b32 at_paren_close = false;
for (; peek != 0;){
generic_parse_inc(state);
generic_parse_skip_soft_tokens(index, state);
peek = token_it_read(&state->it);
if (peek == 0){
break;
}
if (peek->kind == TokenBaseKind_ParentheticalOpen ||
peek->kind == TokenBaseKind_ScopeOpen ||
peek->kind == TokenBaseKind_ScopeClose ||
peek->kind == TokenBaseKind_StatementClose){
break;
}
if (peek->kind == TokenBaseKind_ParentheticalClose){
at_paren_close = true;
break;
}
}
if (at_paren_close){
generic_parse_inc(state);
generic_parse_skip_soft_tokens(index, state);
peek = token_it_read(&state->it);
if (peek != 0 &&
peek->kind == TokenBaseKind_ScopeOpen ||
peek->kind == TokenBaseKind_StatementClose){
index_new_note(index, state, Ii64(token), CodeIndexNote_Function, parent); index_new_note(index, state, Ii64(token), CodeIndexNote_Function, parent);
} }
} }
}
state->it = token_iterator(state->it.user_id, state->it.tokens, state->it.count, reset_point);
}
function Code_Index_Nest* function Code_Index_Nest*
generic_parse_statement(Code_Index_File *index, Generic_Parse_State *state); generic_parse_statement(Code_Index_File *index, Generic_Parse_State *state);

View File

@ -111,6 +111,8 @@
#include "4coder_miblo_numbers.cpp" #include "4coder_miblo_numbers.cpp"
#include "4coder_profile_inspect.cpp" #include "4coder_profile_inspect.cpp"
#include "4coder_tutorial.cpp" #include "4coder_tutorial.cpp"
#include "4coder_doc_content_types.cpp"
#include "4coder_doc_commands.cpp"
#include "4coder_docs.cpp" #include "4coder_docs.cpp"
#include "4coder_default_hooks.cpp" #include "4coder_default_hooks.cpp"

View File

@ -0,0 +1,27 @@
/*
* Mr. 4th Dimention - Allen Webster
*
* 14.12.2019
*
* Documentation of the custom layer's primary api.
*
*/
// TOP
function Doc_Cluster*
doc_commands(Arena *arena){
Doc_Cluster *cluster = new_doc_cluster(arena, "Commands", "commands");
for (i32 i = 0; i < ArrayCount(fcoder_metacmd_table); i += 1){
String_Const_u8 cmd_name = SCu8(fcoder_metacmd_table[i].name,
fcoder_metacmd_table[i].name_len);
String_Const_u8 title = push_u8_stringf(arena, "Command %.*s", string_expand(cmd_name));
Doc_Page *page = new_doc_page(arena, cluster, (char*)title.str, (char*)cmd_name.str);
Doc_Block *block = new_doc_block(arena, page, "brief");
doc_text(arena, block, fcoder_metacmd_table[i].description);
}
return(cluster);
}
// BOTTOM

View File

@ -192,153 +192,5 @@ doc_paragraph(Arena *arena, Doc_Block *block){
par->kind = DocParagraphKind_Text; par->kind = DocParagraphKind_Text;
} }
////////////////////////////////
function Doc_Function
make_doc_function(Arena *arena, Doc_Cluster *cluster, API_Call *call){
Doc_Function result = {};
result.call = call;
result.page = new_doc_page_function(arena, cluster, call->name);
result.brief = new_doc_block(arena, result.page, "brief");
result.sig = new_doc_block(arena, result.page, "Signature");
new_doc_block_jump(arena, result.page, result.sig);
String_Const_u8 opener = push_u8_stringf(arena, "%.*s\n%.*s(",
string_expand(call->return_type),
string_expand(call->name));
umem indent_size = call->name.size + 1;
u8 *buffer = push_array(arena, u8, indent_size);
for (umem i = 0; i < indent_size; i += 1){
buffer[i] = ' ';
}
String_Const_u8 indent = SCu8(buffer, indent_size);
List_String_Const_u8 list = {};
string_list_push(arena, &list, opener);
for (API_Param *node = call->params.first;
node != 0;
node = node->next){
string_list_pushf(arena, &list, "%.*s %.*s",
string_expand(node->type_name),
string_expand(node->name));
if (node->next != 0){
string_list_pushf(arena, &list, ",\n%.*s",
string_expand(indent));
}
}
string_list_push(arena, &list, string_u8_litexpr(");"));
String_Const_u8 contents = string_list_flatten(arena, list);
new_doc_par_single_code(arena, result.sig, contents, DocCodeLanguage_Cpp);
return(result);
}
function b32
begin_doc_call(Arena *arena, Doc_Cluster *cluster, API_Definition *api_def, char *name, Doc_Function *func){
API_Call *call = api_get_call(api_def, SCu8(name));
b32 result = (call != 0);
if (result){
*func = make_doc_function(arena, cluster, call);
}
else{
doc_warningf(arena, cluster, "dead call documentation %s", name);
}
return(result);
}
function Doc_Block*
doc_function_brief(Arena *arena, Doc_Function *func, char *text){
if (text != 0){
doc_text(arena, func->brief, text);
}
return(func->brief);
}
function Doc_Block*
doc_function_begin_params(Arena *arena, Doc_Function *func){
func->params = new_doc_block(arena, func->page, "Parameters");
new_doc_block_jump(arena, func->page, func->params);
return(func->params);
}
function void
doc_function_param(Arena *arena, Doc_Function *func, char *name){
String_Const_u8 name_str = SCu8(name);
API_Call *call = func->call;
API_Param *param = 0;
for (API_Param *node = call->params.first;
node != 0;
node = node->next){
if (string_match(name_str, node->name)){
param = node;
break;
}
}
if (param == 0){
doc_errorf(arena, func->page->owner, "documentation for non-existant parameter %s in call %.*s", name, string_expand(call->name));
return;
}
API_Param *iter = func->param_iter;
if (iter != 0){
for (iter = iter->next;
iter != 0 && iter != param;
iter = iter->next);
if (iter == 0){
doc_warningf(arena, func->page->owner, "parameters out of order in documentation for call %.*s", string_expand(call->name));
}
}
func->param_iter = param;
// parameter header
Doc_Paragraph *par = new_doc_par(arena, func->params);
par->kind = DocParagraphKind_Text;
doc_content_push(arena, &par->text, name_str, DocContentEmphasis_SmallHeader);
// empty paragraph to start filling after
par = new_doc_par(arena, func->params);
par->kind = DocParagraphKind_Text;
}
function Doc_Block*
doc_function_return(Arena *arena, Doc_Function *func){
func->ret = new_doc_block(arena, func->page, "Return");
new_doc_block_jump(arena, func->page, func->ret);
return(func->ret);
}
function Doc_Block*
doc_function_details(Arena *arena, Doc_Function *func){
func->det = new_doc_block(arena, func->page, "Details");
new_doc_block_jump(arena, func->page, func->det);
return(func->det);
}
function Doc_Block*
doc_function_examples(Arena *arena, Doc_Function *func){
func->examples = new_doc_block(arena, func->page, "Examples");
new_doc_block_jump(arena, func->page, func->examples);
return(func->examples);
}
function Doc_Block*
doc_function_begin_related(Arena *arena, Doc_Function *func){
func->rel = new_doc_block(arena, func->page, "Related");
new_doc_block_jump(arena, func->page, func->rel);
return(func->rel);
}
function void
doc_function_add_related(Arena *arena, Doc_Block *rel, char *name){
Doc_Paragraph *par = new_doc_par(arena, rel);
par->kind = DocParagraphKind_Text;
Doc_Content *content = doc_content_push(arena, &par->text, SCu8(name));
content->page_link = SCu8(name);
}
// BOTTOM // BOTTOM

View File

@ -172,16 +172,27 @@ render_doc_page(Application_Links *app, Doc_Page *page){
return(buffer); return(buffer);
} }
CUSTOM_UI_COMMAND_SIG(open_documentation) CUSTOM_UI_COMMAND_SIG(custom_api_documentation)
CUSTOM_DOC("Prompts the user to select an API item then loads a doc buffer for that item") CUSTOM_DOC("Prompts the user to select a Custom API item then loads a doc buffer for that item")
{ {
View_ID view = get_this_ctx_view(app, Access_ReadWrite); View_ID view = get_this_ctx_view(app, Access_ReadWrite);
if (view != 0){ if (view != 0){
Scratch_Block scratch(app); Scratch_Block scratch(app);
Doc_Cluster *docs = get_custom_layer_boundary_docs(app, scratch); Doc_Cluster *docs = get_custom_layer_boundary_docs(app, scratch);
Doc_Page *page = get_doc_page_from_user(app, docs, "Doc Page:"); Doc_Page *page = get_doc_page_from_user(app, docs, "Doc Page:");
String_Const_u8 string = push_u8_stringf(scratch, "selected page: %.*s\n", Buffer_ID buffer = render_doc_page(app, page);
string_expand(page->title)); view_set_buffer(app, view, buffer, 0);
}
}
CUSTOM_UI_COMMAND_SIG(command_documentation)
CUSTOM_DOC("Prompts the user to select a command then loads a doc buffer for that item")
{
View_ID view = get_this_ctx_view(app, Access_Always);
if (view != 0){
Scratch_Block scratch(app);
Doc_Cluster *docs = doc_commands(scratch);
Doc_Page *page = get_doc_page_from_user(app, docs, "Doc Page:");
Buffer_ID buffer = render_doc_page(app, page); Buffer_ID buffer = render_doc_page(app, page);
view_set_buffer(app, view, buffer, 0); view_set_buffer(app, view, buffer, 0);
} }

View File

@ -2239,7 +2239,7 @@ internal Record_Info
get_single_record(Application_Links *app, Buffer_ID buffer_id, History_Record_Index index){ get_single_record(Application_Links *app, Buffer_ID buffer_id, History_Record_Index index){
Record_Info record = buffer_history_get_record_info(app, buffer_id, index); Record_Info record = buffer_history_get_record_info(app, buffer_id, index);
if (record.error == RecordError_NoError && record.kind == RecordKind_Group){ if (record.error == RecordError_NoError && record.kind == RecordKind_Group){
record = buffer_history_get_group_sub_record(app, buffer_id, index, record.group.count - 1); record = buffer_history_get_group_sub_record(app, buffer_id, index, record.group_count - 1);
} }
return(record); return(record);
} }
@ -2380,14 +2380,24 @@ guess_line_ending_kind_from_buffer(Application_Links *app, Buffer_ID buffer){
//////////////////////////////// ////////////////////////////////
function i32
get_command_id(Custom_Command_Function *func){
i32 result = -1;
for (i32 i = 0; i < ArrayCount(fcoder_metacmd_table); i += 1){
if (func == fcoder_metacmd_table[i].proc){
result = i;
break;
}
}
return(result);
}
function Command_Metadata* function Command_Metadata*
get_command_metadata(Custom_Command_Function *func){ get_command_metadata(Custom_Command_Function *func){
Command_Metadata *result = 0; Command_Metadata *result = 0;
for (i32 i = 0; i < ArrayCount(fcoder_metacmd_table); i += 1){ i32 id = get_command_id(func);
if (func == fcoder_metacmd_table[i].proc){ if (id >= 0){
result = &fcoder_metacmd_table[i]; result = &fcoder_metacmd_table[id];
break;
}
} }
return(result); return(result);
} }

View File

@ -668,9 +668,9 @@ CUSTOM_DOC("Interactively opens a file.")
CUSTOM_UI_COMMAND_SIG(command_lister) CUSTOM_UI_COMMAND_SIG(command_lister)
CUSTOM_DOC("Opens an interactive list of all registered commands.") CUSTOM_DOC("Opens an interactive list of all registered commands.")
{ {
Command_Lister_Status_Rule rule = {};
View_ID view = get_this_ctx_view(app, Access_Always); View_ID view = get_this_ctx_view(app, Access_Always);
if (view != 0){
Command_Lister_Status_Rule rule = {};
Buffer_ID buffer = view_get_buffer(app, view, Access_Visible); Buffer_ID buffer = view_get_buffer(app, view, Access_Visible);
Managed_Scope buffer_scope = buffer_get_managed_scope(app, buffer); Managed_Scope buffer_scope = buffer_get_managed_scope(app, buffer);
Command_Map_ID *map_id_ptr = scope_attachment(app, buffer_scope, buffer_map_id, Command_Map_ID); Command_Map_ID *map_id_ptr = scope_attachment(app, buffer_scope, buffer_map_id, Command_Map_ID);
@ -685,6 +685,7 @@ CUSTOM_DOC("Opens an interactive list of all registered commands.")
view_enqueue_command_function(app, view, func); view_enqueue_command_function(app, view, func);
} }
} }
}
//////////////////////////////// ////////////////////////////////

View File

@ -1,24 +1,32 @@
#if !defined(FCODER_TYPES_H) #if !defined(FCODER_TYPES_H)
#define FCODER_TYPES_H #define FCODER_TYPES_H
api(custom)
struct Thread_Context_Extra_Info{ struct Thread_Context_Extra_Info{
void *coroutine; void *coroutine;
void *async_thread; void *async_thread;
}; };
api(custom)
struct Application_Links{ struct Application_Links{
Thread_Context *tctx; Thread_Context *tctx;
void *cmd_context; void *cmd_context;
}; };
api(custom)
typedef void Custom_Layer_Init_Type(Application_Links *app); typedef void Custom_Layer_Init_Type(Application_Links *app);
void custom_layer_init(Application_Links *app); void custom_layer_init(Application_Links *app);
api(custom)
typedef b32 _Get_Version_Type(i32 maj, i32 min, i32 patch); typedef b32 _Get_Version_Type(i32 maj, i32 min, i32 patch);
api(custom)
typedef Custom_Layer_Init_Type *_Init_APIs_Type(struct API_VTable_custom *custom_vtable, typedef Custom_Layer_Init_Type *_Init_APIs_Type(struct API_VTable_custom *custom_vtable,
struct API_VTable_system *system_vtable); struct API_VTable_system *system_vtable);
//////////////////////////////// ////////////////////////////////
api(custom)
typedef u16 ID_Color; typedef u16 ID_Color;
api(custom)
union FColor{ union FColor{
struct{ struct{
u8 padding__[3]; u8 padding__[3];
@ -32,21 +40,25 @@ union FColor{
}; };
}; };
api(custom)
struct Theme_Color{ struct Theme_Color{
ID_Color tag; ID_Color tag;
ARGB_Color color; ARGB_Color color;
}; };
api(custom)
struct Color_Array{ struct Color_Array{
ARGB_Color *vals; ARGB_Color *vals;
i32 count; i32 count;
}; };
api(custom)
struct Color_Table{ struct Color_Table{
Color_Array *arrays; Color_Array *arrays;
u32 count; u32 count;
}; };
api(custom)
struct Color_Picker{ struct Color_Picker{
String_Const_u8 title; String_Const_u8 title;
ARGB_Color *dest; ARGB_Color *dest;
@ -55,8 +67,10 @@ struct Color_Picker{
//////////////////////////////// ////////////////////////////////
api(custom)
typedef u32 Face_ID; typedef u32 Face_ID;
api(custom)
struct Fancy_String{ struct Fancy_String{
Fancy_String *next; Fancy_String *next;
String_Const_u8 value; String_Const_u8 value;
@ -66,6 +80,7 @@ struct Fancy_String{
f32 post_margin; f32 post_margin;
}; };
api(custom)
struct Fancy_Line{ struct Fancy_Line{
Fancy_Line *next; Fancy_Line *next;
Face_ID face; Face_ID face;
@ -74,6 +89,7 @@ struct Fancy_Line{
Fancy_String *last; Fancy_String *last;
}; };
api(custom)
struct Fancy_Block{ struct Fancy_Block{
Fancy_Line *first; Fancy_Line *first;
Fancy_Line *last; Fancy_Line *last;
@ -82,12 +98,22 @@ struct Fancy_Block{
//////////////////////////////// ////////////////////////////////
api(custom)
typedef i32 Buffer_ID; typedef i32 Buffer_ID;
api(custom)
typedef i32 View_ID; typedef i32 View_ID;
api(custom)
typedef i32 Panel_ID; typedef i32 Panel_ID;
api(custom)
typedef u32 Text_Layout_ID; typedef u32 Text_Layout_ID;
api(custom)
typedef u32 Child_Process_ID; typedef u32 Child_Process_ID;
api(custom)
typedef i32 UI_Highlight_Level; typedef i32 UI_Highlight_Level;
enum{ enum{
UIHighlight_None, UIHighlight_None,
@ -95,21 +121,25 @@ enum{
UIHighlight_Active, UIHighlight_Active,
}; };
api(custom)
struct Buffer_Point{ struct Buffer_Point{
i64 line_number; i64 line_number;
Vec2_f32 pixel_shift; Vec2_f32 pixel_shift;
}; };
api(custom)
struct Line_Shift_Vertical{ struct Line_Shift_Vertical{
i64 line; i64 line;
f32 y_delta; f32 y_delta;
}; };
api(custom)
struct Line_Shift_Character{ struct Line_Shift_Character{
i64 line; i64 line;
i64 character_delta; i64 character_delta;
}; };
api(custom)
typedef u32 Child_Process_Set_Target_Flags; typedef u32 Child_Process_Set_Target_Flags;
enum{ enum{
ChildProcessSet_FailIfBufferAlreadyAttachedToAProcess = 1, ChildProcessSet_FailIfBufferAlreadyAttachedToAProcess = 1,
@ -118,6 +148,7 @@ enum{
ChildProcessSet_CursorAtEnd = 4, ChildProcessSet_CursorAtEnd = 4,
}; };
api(custom)
typedef u32 Memory_Protect_Flags; typedef u32 Memory_Protect_Flags;
enum{ enum{
MemProtect_Read = 0x1, MemProtect_Read = 0x1,
@ -125,6 +156,7 @@ enum{
MemProtect_Execute = 0x4, MemProtect_Execute = 0x4,
}; };
api(custom)
typedef i32 Wrap_Indicator_Mode; typedef i32 Wrap_Indicator_Mode;
enum{ enum{
WrapIndicator_Hide, WrapIndicator_Hide,
@ -132,12 +164,14 @@ enum{
WrapIndicator_Show_At_Wrap_Edge, WrapIndicator_Show_At_Wrap_Edge,
}; };
api(custom)
typedef i32 Global_Setting_ID; typedef i32 Global_Setting_ID;
enum{ enum{
GlobalSetting_Null, GlobalSetting_Null,
GlobalSetting_LAltLCtrlIsAltGr, GlobalSetting_LAltLCtrlIsAltGr,
}; };
api(custom)
typedef i32 Buffer_Setting_ID; typedef i32 Buffer_Setting_ID;
enum{ enum{
BufferSetting_Null, BufferSetting_Null,
@ -146,16 +180,19 @@ enum{
BufferSetting_RecordsHistory, BufferSetting_RecordsHistory,
}; };
api(custom)
struct Character_Predicate{ struct Character_Predicate{
u8 b[32]; u8 b[32];
}; };
api(custom)
struct Frame_Info{ struct Frame_Info{
i32 index; i32 index;
f32 literal_dt; f32 literal_dt;
f32 animation_dt; f32 animation_dt;
}; };
api(custom)
typedef i32 View_Setting_ID; typedef i32 View_Setting_ID;
enum{ enum{
ViewSetting_Null, ViewSetting_Null,
@ -164,6 +201,7 @@ enum{
ViewSetting_ShowFileBar, ViewSetting_ShowFileBar,
}; };
api(custom)
typedef u32 Buffer_Create_Flag; typedef u32 Buffer_Create_Flag;
enum{ enum{
BufferCreate_Background = 0x1, BufferCreate_Background = 0x1,
@ -175,19 +213,23 @@ enum{
BufferCreate_SuppressNewFileHook = 0x40, BufferCreate_SuppressNewFileHook = 0x40,
}; };
api(custom)
typedef u32 Buffer_Save_Flag; typedef u32 Buffer_Save_Flag;
enum{ enum{
BufferSave_IgnoreDirtyFlag = 0x1, BufferSave_IgnoreDirtyFlag = 0x1,
}; };
api(custom)
typedef u32 Buffer_Kill_Flag; typedef u32 Buffer_Kill_Flag;
enum{ enum{
BufferKill_AlwaysKill = 0x2, BufferKill_AlwaysKill = 0x2,
}; };
api(custom)
typedef u32 Buffer_Reopen_Flag; typedef u32 Buffer_Reopen_Flag;
enum{}; enum{};
api(custom)
typedef u32 Buffer_Kill_Result; typedef u32 Buffer_Kill_Result;
enum{ enum{
BufferKillResult_Killed = 0, BufferKillResult_Killed = 0,
@ -196,12 +238,14 @@ enum{
BufferKillResult_DoesNotExist = 3, BufferKillResult_DoesNotExist = 3,
}; };
api(custom)
typedef u32 Buffer_Reopen_Result; typedef u32 Buffer_Reopen_Result;
enum{ enum{
BufferReopenResult_Reopened = 0, BufferReopenResult_Reopened = 0,
BufferReopenResult_Failed = 1, BufferReopenResult_Failed = 1,
}; };
api(custom)
typedef u32 Access_Flag; typedef u32 Access_Flag;
enum{ enum{
Access_Write = 0x1, Access_Write = 0x1,
@ -215,6 +259,7 @@ enum{
Access_ReadWriteVisible = Access_Write|Access_Read|Access_Visible, Access_ReadWriteVisible = Access_Write|Access_Read|Access_Visible,
}; };
api(custom)
typedef i32 Dirty_State; typedef i32 Dirty_State;
enum{ enum{
DirtyState_UpToDate = 0, DirtyState_UpToDate = 0,
@ -223,6 +268,7 @@ enum{
DirtyState_UnsavedChangesAndUnloadedChanges = 3, DirtyState_UnsavedChangesAndUnloadedChanges = 3,
}; };
api(custom)
typedef u32 Command_Line_Interface_Flag; typedef u32 Command_Line_Interface_Flag;
enum{ enum{
CLI_OverlapWithConflict = 0x1, CLI_OverlapWithConflict = 0x1,
@ -231,17 +277,20 @@ enum{
CLI_SendEndSignal = 0x8, CLI_SendEndSignal = 0x8,
}; };
api(custom)
typedef u32 Set_Buffer_Flag; typedef u32 Set_Buffer_Flag;
enum{ enum{
SetBuffer_KeepOriginalGUI = 0x1 SetBuffer_KeepOriginalGUI = 0x1
}; };
api(custom)
typedef i32 Mouse_Cursor_Show_Type; typedef i32 Mouse_Cursor_Show_Type;
enum{ enum{
MouseCursorShow_Never, MouseCursorShow_Never,
MouseCursorShow_Always, MouseCursorShow_Always,
}; };
api(custom)
typedef i32 View_Split_Position; typedef i32 View_Split_Position;
enum{ enum{
ViewSplit_Top, ViewSplit_Top,
@ -250,6 +299,7 @@ enum{
ViewSplit_Right, ViewSplit_Right,
}; };
api(custom)
typedef i32 Panel_Split_Kind; typedef i32 Panel_Split_Kind;
enum{ enum{
PanelSplitKind_Ratio_Min = 0, PanelSplitKind_Ratio_Min = 0,
@ -258,8 +308,10 @@ enum{
PanelSplitKind_FixedPixels_Max = 3, PanelSplitKind_FixedPixels_Max = 3,
}; };
api(custom)
typedef u8 Key_Modifier; typedef u8 Key_Modifier;
api(custom)
struct Mouse_State{ struct Mouse_State{
b8 l; b8 l;
b8 r; b8 r;
@ -278,62 +330,73 @@ struct Mouse_State{
}; };
}; };
api(custom)
struct Parser_String_And_Type{ struct Parser_String_And_Type{
char *str; char *str;
u32 length; u32 length;
u32 type; u32 type;
}; };
api(custom)
typedef u32 File_Attribute_Flag; typedef u32 File_Attribute_Flag;
enum{ enum{
FileAttribute_IsDirectory = 1, FileAttribute_IsDirectory = 1,
}; };
api(custom)
struct File_Attributes{ struct File_Attributes{
u64 size; u64 size;
u64 last_write_time; u64 last_write_time;
File_Attribute_Flag flags; File_Attribute_Flag flags;
}; };
api(custom)
struct File_Info{ struct File_Info{
File_Info *next; File_Info *next;
String_Const_u8 file_name; String_Const_u8 file_name;
File_Attributes attributes; File_Attributes attributes;
}; };
api(custom)
struct File_List{ struct File_List{
File_Info **infos; File_Info **infos;
u32 count; u32 count;
}; };
api(custom)
struct Buffer_Identifier{ struct Buffer_Identifier{
char *name; char *name;
i32 name_len; i32 name_len;
Buffer_ID id; Buffer_ID id;
}; };
api(custom)
typedef i32 Set_Buffer_Scroll_Rule; typedef i32 Set_Buffer_Scroll_Rule;
enum{ enum{
SetBufferScroll_NoCursorChange, SetBufferScroll_NoCursorChange,
SetBufferScroll_SnapCursorIntoView, SetBufferScroll_SnapCursorIntoView,
}; };
api(custom)
struct Buffer_Scroll{ struct Buffer_Scroll{
Buffer_Point position; Buffer_Point position;
Buffer_Point target; Buffer_Point target;
}; };
api(custom)
struct Basic_Scroll{ struct Basic_Scroll{
Vec2_f32 position; Vec2_f32 position;
Vec2_f32 target; Vec2_f32 target;
}; };
api(custom)
typedef i32 Buffer_Seek_Type; typedef i32 Buffer_Seek_Type;
enum{ enum{
buffer_seek_pos, buffer_seek_pos,
buffer_seek_line_col, buffer_seek_line_col,
}; };
api(custom)
struct Buffer_Seek{ struct Buffer_Seek{
Buffer_Seek_Type type; Buffer_Seek_Type type;
union{ union{
@ -347,12 +410,14 @@ struct Buffer_Seek{
}; };
}; };
api(custom)
struct Buffer_Cursor{ struct Buffer_Cursor{
i64 pos; i64 pos;
i64 line; i64 line;
i64 col; i64 col;
}; };
api(custom)
struct Range_Cursor{ struct Range_Cursor{
struct{ struct{
Buffer_Cursor min; Buffer_Cursor min;
@ -368,11 +433,13 @@ struct Range_Cursor{
}; };
}; };
api(custom)
struct Marker{ struct Marker{
i64 pos; i64 pos;
b32 lean_right; b32 lean_right;
}; };
api(custom)
typedef i32 Managed_Object_Type; typedef i32 Managed_Object_Type;
enum{ enum{
ManagedObjectType_Error = 0, ManagedObjectType_Error = 0,
@ -382,40 +449,42 @@ enum{
ManagedObjectType_COUNT = 4, ManagedObjectType_COUNT = 4,
}; };
api(custom)
typedef u64 Managed_ID; typedef u64 Managed_ID;
api(custom)
typedef u64 Managed_Scope; typedef u64 Managed_Scope;
api(custom)
typedef u64 Managed_Object; typedef u64 Managed_Object;
static Managed_Scope ManagedScope_NULL = 0; api(custom)
static Managed_Object ManagedObject_NULL = 0;
static Managed_ID ManagedIndex_ERROR = 0;
struct Marker_Visual{ struct Marker_Visual{
Managed_Scope scope; Managed_Scope scope;
u32 slot_id; u32 slot_id;
u32 gen_id; u32 gen_id;
}; };
api(custom)
typedef u32 Glyph_Flag; typedef u32 Glyph_Flag;
enum{ enum{
GlyphFlag_None = 0x0, GlyphFlag_None = 0x0,
GlyphFlag_Rotate90 = 0x1, GlyphFlag_Rotate90 = 0x1,
}; };
api(custom)
struct Query_Bar{ struct Query_Bar{
String_Const_u8 prompt; String_Const_u8 prompt;
String_Const_u8 string; String_Const_u8 string;
umem string_capacity; umem string_capacity;
}; };
api(custom)
struct Query_Bar_Ptr_Array{ struct Query_Bar_Ptr_Array{
Query_Bar **ptrs; Query_Bar **ptrs;
i32 count; i32 count;
}; };
api(custom)
struct Query_Bar_Group{ struct Query_Bar_Group{
Application_Links *app; Application_Links *app;
View_ID view; View_ID view;
@ -425,10 +494,12 @@ struct Query_Bar_Group{
~Query_Bar_Group(); ~Query_Bar_Group();
}; };
api(custom)
struct Font_Load_Location{ struct Font_Load_Location{
String_Const_u8 file_name; String_Const_u8 file_name;
}; };
api(custom)
struct Face_Load_Parameters{ struct Face_Load_Parameters{
u32 pt_size; u32 pt_size;
b32 bold; b32 bold;
@ -437,11 +508,13 @@ struct Face_Load_Parameters{
b32 hinting; b32 hinting;
}; };
api(custom)
struct Face_Description{ struct Face_Description{
Font_Load_Location font; Font_Load_Location font;
Face_Load_Parameters parameters; Face_Load_Parameters parameters;
}; };
api(custom)
struct Face_Metrics{ struct Face_Metrics{
f32 text_height; f32 text_height;
f32 line_height; f32 line_height;
@ -463,6 +536,7 @@ struct Face_Metrics{
f32 normal_advance; f32 normal_advance;
}; };
api(custom)
struct Codepoint_Index_Map{ struct Codepoint_Index_Map{
b32 has_zero_index; b32 has_zero_index;
u16 zero_index; u16 zero_index;
@ -470,28 +544,33 @@ struct Codepoint_Index_Map{
Table_u32_u16 table; Table_u32_u16 table;
}; };
api(custom)
struct Face_Advance_Map{ struct Face_Advance_Map{
Codepoint_Index_Map codepoint_to_index; Codepoint_Index_Map codepoint_to_index;
f32 *advance; f32 *advance;
u16 index_count; u16 index_count;
}; };
api(custom)
struct Edit{ struct Edit{
String_Const_u8 text; String_Const_u8 text;
Interval_i64 range; Interval_i64 range;
}; };
api(custom)
struct Batch_Edit{ struct Batch_Edit{
Batch_Edit *next; Batch_Edit *next;
Edit edit; Edit edit;
}; };
api(custom)
typedef i32 Record_Kind; typedef i32 Record_Kind;
enum{ enum{
RecordKind_Single, RecordKind_Single,
RecordKind_Group, RecordKind_Group,
}; };
api(custom)
typedef i32 Record_Error; typedef i32 Record_Error;
enum{ enum{
RecordError_NoError, RecordError_NoError,
@ -503,6 +582,7 @@ enum{
RecordError_WrongRecordTypeAtIndex, RecordError_WrongRecordTypeAtIndex,
}; };
api(custom)
typedef u32 Record_Merge_Flag; typedef u32 Record_Merge_Flag;
enum{ enum{
RecordMergeFlag_StateInRange_MoveStateForward = 0x0, RecordMergeFlag_StateInRange_MoveStateForward = 0x0,
@ -510,21 +590,23 @@ enum{
RecordMergeFlag_StateInRange_ErrorOut = 0x2, RecordMergeFlag_StateInRange_ErrorOut = 0x2,
}; };
api(custom)
typedef i32 History_Record_Index; typedef i32 History_Record_Index;
api(custom)
struct Record_Info{ struct Record_Info{
Record_Error error; Record_Error error;
Record_Kind kind; Record_Kind kind;
i32 edit_number; i32 edit_number;
union{ union{
struct{ struct{
String_Const_u8 string_forward; String_Const_u8 single_string_forward;
String_Const_u8 string_backward; String_Const_u8 single_string_backward;
i64 first; i64 single_first;
} single; };
struct{ struct{
i32 count; i32 group_count;
} group; };
}; };
}; };
@ -544,12 +626,13 @@ struct Record_Info{
#define CUSTOM_ID(group, name) CUSTOM_ID(group, name) #define CUSTOM_ID(group, name) CUSTOM_ID(group, name)
#endif #endif
// TODO(allen): rename api(custom)
struct User_Input{ struct User_Input{
Input_Event event; Input_Event event;
b32 abort; b32 abort;
}; };
api(custom)
typedef i32 Hook_ID; typedef i32 Hook_ID;
enum{ enum{
HookID_Tick, HookID_Tick,
@ -567,9 +650,11 @@ enum{
HookID_Layout, HookID_Layout,
}; };
api(custom)
typedef i32 Hook_Function(Application_Links *app); typedef i32 Hook_Function(Application_Links *app);
#define HOOK_SIG(name) i32 name(Application_Links *app) #define HOOK_SIG(name) i32 name(Application_Links *app)
api(custom)
struct Buffer_Name_Conflict_Entry{ struct Buffer_Name_Conflict_Entry{
Buffer_ID buffer_id; Buffer_ID buffer_id;
String_Const_u8 file_name; String_Const_u8 file_name;
@ -579,34 +664,44 @@ struct Buffer_Name_Conflict_Entry{
umem unique_name_capacity; umem unique_name_capacity;
}; };
api(custom)
typedef void Buffer_Name_Resolver_Function(Application_Links *app, Buffer_Name_Conflict_Entry *conflicts, i32 conflict_count); typedef void Buffer_Name_Resolver_Function(Application_Links *app, Buffer_Name_Conflict_Entry *conflicts, i32 conflict_count);
#define BUFFER_NAME_RESOLVER_SIG(n) void n(Application_Links *app, Buffer_Name_Conflict_Entry *conflicts, i32 conflict_count) #define BUFFER_NAME_RESOLVER_SIG(n) void n(Application_Links *app, Buffer_Name_Conflict_Entry *conflicts, i32 conflict_count)
api(custom)
typedef i32 Buffer_Hook_Function(Application_Links *app, Buffer_ID buffer_id); typedef i32 Buffer_Hook_Function(Application_Links *app, Buffer_ID buffer_id);
#define BUFFER_HOOK_SIG(name) i32 name(Application_Links *app, Buffer_ID buffer_id) #define BUFFER_HOOK_SIG(name) i32 name(Application_Links *app, Buffer_ID buffer_id)
api(custom)
typedef i32 Buffer_Edit_Range_Function(Application_Links *app, Buffer_ID buffer_id, typedef i32 Buffer_Edit_Range_Function(Application_Links *app, Buffer_ID buffer_id,
Range_i64 new_range, umem original_size); Range_i64 new_range, umem original_size);
#define BUFFER_EDIT_RANGE_SIG(name) i32 name(Application_Links *app, Buffer_ID buffer_id, Interval_i64 new_range, umem original_size) #define BUFFER_EDIT_RANGE_SIG(name) i32 name(Application_Links *app, Buffer_ID buffer_id, Interval_i64 new_range, umem original_size)
api(custom)
typedef Vec2_f32 Delta_Rule_Function(Vec2_f32 pending, b32 is_new_target, f32 dt, void *data); typedef Vec2_f32 Delta_Rule_Function(Vec2_f32 pending, b32 is_new_target, f32 dt, void *data);
#define DELTA_RULE_SIG(name) Vec2_f32 name(Vec2_f32 pending, b32 is_new_target, f32 dt, void *data) #define DELTA_RULE_SIG(name) Vec2_f32 name(Vec2_f32 pending, b32 is_new_target, f32 dt, void *data)
api(custom)
typedef Rect_f32 Buffer_Region_Function(Application_Links *app, View_ID view_id, Rect_f32 region); typedef Rect_f32 Buffer_Region_Function(Application_Links *app, View_ID view_id, Rect_f32 region);
api(custom)
typedef void New_Clipboard_Contents_Function(Application_Links *app, String_Const_u8 contents); typedef void New_Clipboard_Contents_Function(Application_Links *app, String_Const_u8 contents);
#define NEW_CLIPBOARD_CONTENTS_SIG(name) void name(Application_Links *app, String_Const_u8 contents) #define NEW_CLIPBOARD_CONTENTS_SIG(name) void name(Application_Links *app, String_Const_u8 contents)
api(custom)
typedef void Tick_Function(Application_Links *app, Frame_Info frame_info); typedef void Tick_Function(Application_Links *app, Frame_Info frame_info);
api(custom)
typedef void Render_Caller_Function(Application_Links *app, Frame_Info frame_info, View_ID view); typedef void Render_Caller_Function(Application_Links *app, Frame_Info frame_info, View_ID view);
api(custom)
typedef u32 Layout_Item_Flag; typedef u32 Layout_Item_Flag;
enum{ enum{
LayoutItemFlag_Special_Character = (1 << 0), LayoutItemFlag_Special_Character = (1 << 0),
LayoutItemFlag_Ghost_Character = (1 << 1) LayoutItemFlag_Ghost_Character = (1 << 1)
}; };
api(custom)
struct Layout_Item{ struct Layout_Item{
i64 index; i64 index;
u32 codepoint; u32 codepoint;
@ -614,6 +709,7 @@ struct Layout_Item{
Rect_f32 rect; Rect_f32 rect;
}; };
api(custom)
struct Layout_Item_Block{ struct Layout_Item_Block{
Layout_Item_Block *next; Layout_Item_Block *next;
Layout_Item *items; Layout_Item *items;
@ -621,6 +717,7 @@ struct Layout_Item_Block{
i64 character_count; i64 character_count;
}; };
api(custom)
struct Layout_Item_List{ struct Layout_Item_List{
Layout_Item_Block *first; Layout_Item_Block *first;
Layout_Item_Block *last; Layout_Item_Block *last;
@ -633,10 +730,13 @@ struct Layout_Item_List{
Range_i64 manifested_index_range; Range_i64 manifested_index_range;
}; };
api(custom)
typedef Layout_Item_List Layout_Function(Application_Links *app, Arena *arena, Buffer_ID buffer, Range_i64 range, Face_ID face, f32 width); typedef Layout_Item_List Layout_Function(Application_Links *app, Arena *arena, Buffer_ID buffer, Range_i64 range, Face_ID face, f32 width);
api(custom)
typedef i64 Command_Map_ID; typedef i64 Command_Map_ID;
api(custom)
struct Command_Trigger{ struct Command_Trigger{
Command_Trigger *next; Command_Trigger *next;
Input_Event_Kind kind; Input_Event_Kind kind;
@ -644,15 +744,18 @@ struct Command_Trigger{
Input_Modifier_Set mods; Input_Modifier_Set mods;
}; };
api(custom)
struct Command_Trigger_List{ struct Command_Trigger_List{
Command_Trigger *first; Command_Trigger *first;
Command_Trigger *last; Command_Trigger *last;
}; };
api(custom)
struct Command_Binding{ struct Command_Binding{
Custom_Command_Function *custom; Custom_Command_Function *custom;
}; };
api(custom)
struct Command_Modified_Binding{ struct Command_Modified_Binding{
Command_Modified_Binding *next; Command_Modified_Binding *next;
SNode order_node; SNode order_node;
@ -660,6 +763,7 @@ struct Command_Modified_Binding{
Command_Binding binding; Command_Binding binding;
}; };
api(custom)
struct Command_Binding_List{ struct Command_Binding_List{
Command_Binding_List *next; Command_Binding_List *next;
SNode *first; SNode *first;
@ -667,6 +771,7 @@ struct Command_Binding_List{
i32 count; i32 count;
}; };
api(custom)
struct Command_Map{ struct Command_Map{
Command_Map *next; Command_Map *next;
Command_Map_ID id; Command_Map_ID id;
@ -683,6 +788,7 @@ struct Command_Map{
struct Binding_Unit *real_beginning; struct Binding_Unit *real_beginning;
}; };
api(custom)
struct Mapping{ struct Mapping{
Arena *node_arena; Arena *node_arena;
Heap heap; Heap heap;
@ -694,6 +800,7 @@ struct Mapping{
Command_Binding_List *free_lists; Command_Binding_List *free_lists;
}; };
api(custom)
struct View_Context{ struct View_Context{
Render_Caller_Function *render_caller; Render_Caller_Function *render_caller;
Delta_Rule_Function *delta_rule; Delta_Rule_Function *delta_rule;
@ -703,6 +810,7 @@ struct View_Context{
Command_Map_ID map_id; Command_Map_ID map_id;
}; };
api(custom)
typedef u32 String_Match_Flag; typedef u32 String_Match_Flag;
enum{ enum{
StringMatch_CaseSensitive = 1, StringMatch_CaseSensitive = 1,
@ -711,6 +819,7 @@ enum{
StringMatch_Straddled = 8, StringMatch_Straddled = 8,
}; };
api(custom)
struct String_Match{ struct String_Match{
String_Match *next; String_Match *next;
Buffer_ID buffer; Buffer_ID buffer;
@ -719,12 +828,14 @@ struct String_Match{
Range_i64 range; Range_i64 range;
}; };
api(custom)
struct String_Match_List{ struct String_Match_List{
String_Match *first; String_Match *first;
String_Match *last; String_Match *last;
i32 count; i32 count;
}; };
api(custom)
struct Process_State{ struct Process_State{
b32 valid; b32 valid;
b32 is_updating; b32 is_updating;

View File

@ -2,7 +2,7 @@
#define command_id(c) (fcoder_metacmd_ID_##c) #define command_id(c) (fcoder_metacmd_ID_##c)
#define command_metadata(c) (&fcoder_metacmd_table[command_id(c)]) #define command_metadata(c) (&fcoder_metacmd_table[command_id(c)])
#define command_metadata_by_id(id) (&fcoder_metacmd_table[id]) #define command_metadata_by_id(id) (&fcoder_metacmd_table[id])
#define command_one_past_last_id 228 #define command_one_past_last_id 229
#if defined(CUSTOM_COMMAND_SIG) #if defined(CUSTOM_COMMAND_SIG)
#define PROC_LINKS(x,y) x #define PROC_LINKS(x,y) x
#else #else
@ -31,11 +31,13 @@ CUSTOM_COMMAND_SIG(click_set_mark);
CUSTOM_COMMAND_SIG(close_all_code); CUSTOM_COMMAND_SIG(close_all_code);
CUSTOM_COMMAND_SIG(close_build_panel); CUSTOM_COMMAND_SIG(close_build_panel);
CUSTOM_COMMAND_SIG(close_panel); CUSTOM_COMMAND_SIG(close_panel);
CUSTOM_COMMAND_SIG(command_documentation);
CUSTOM_COMMAND_SIG(command_lister); CUSTOM_COMMAND_SIG(command_lister);
CUSTOM_COMMAND_SIG(comment_line); CUSTOM_COMMAND_SIG(comment_line);
CUSTOM_COMMAND_SIG(comment_line_toggle); CUSTOM_COMMAND_SIG(comment_line_toggle);
CUSTOM_COMMAND_SIG(copy); CUSTOM_COMMAND_SIG(copy);
CUSTOM_COMMAND_SIG(cursor_mark_swap); CUSTOM_COMMAND_SIG(cursor_mark_swap);
CUSTOM_COMMAND_SIG(custom_api_documentation);
CUSTOM_COMMAND_SIG(cut); CUSTOM_COMMAND_SIG(cut);
CUSTOM_COMMAND_SIG(decrease_face_size); CUSTOM_COMMAND_SIG(decrease_face_size);
CUSTOM_COMMAND_SIG(default_file_externally_modified); CUSTOM_COMMAND_SIG(default_file_externally_modified);
@ -135,7 +137,6 @@ CUSTOM_COMMAND_SIG(move_up_to_blank_line_end);
CUSTOM_COMMAND_SIG(move_up_to_blank_line_skip_whitespace); CUSTOM_COMMAND_SIG(move_up_to_blank_line_skip_whitespace);
CUSTOM_COMMAND_SIG(open_all_code); CUSTOM_COMMAND_SIG(open_all_code);
CUSTOM_COMMAND_SIG(open_all_code_recursive); CUSTOM_COMMAND_SIG(open_all_code_recursive);
CUSTOM_COMMAND_SIG(open_documentation);
CUSTOM_COMMAND_SIG(open_file_in_quotes); CUSTOM_COMMAND_SIG(open_file_in_quotes);
CUSTOM_COMMAND_SIG(open_in_other); CUSTOM_COMMAND_SIG(open_in_other);
CUSTOM_COMMAND_SIG(open_long_braces); CUSTOM_COMMAND_SIG(open_long_braces);
@ -249,7 +250,7 @@ char *source_name;
i32 source_name_len; i32 source_name_len;
i32 line_number; i32 line_number;
}; };
static Command_Metadata fcoder_metacmd_table[228] = { static Command_Metadata fcoder_metacmd_table[229] = {
{ PROC_LINKS(allow_mouse, 0), false, "allow_mouse", 11, "Shows the mouse and causes all mouse input to be processed normally.", 68, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 409 }, { PROC_LINKS(allow_mouse, 0), false, "allow_mouse", 11, "Shows the mouse and causes all mouse input to be processed normally.", 68, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 409 },
{ PROC_LINKS(auto_indent_line_at_cursor, 0), false, "auto_indent_line_at_cursor", 26, "Auto-indents the line on which the cursor sits.", 47, "w:\\4ed\\code\\custom\\4coder_auto_indent.cpp", 41, 375 }, { PROC_LINKS(auto_indent_line_at_cursor, 0), false, "auto_indent_line_at_cursor", 26, "Auto-indents the line on which the cursor sits.", 47, "w:\\4ed\\code\\custom\\4coder_auto_indent.cpp", 41, 375 },
{ PROC_LINKS(auto_indent_range, 0), false, "auto_indent_range", 17, "Auto-indents the range between the cursor and the mark.", 55, "w:\\4ed\\code\\custom\\4coder_auto_indent.cpp", 41, 385 }, { PROC_LINKS(auto_indent_range, 0), false, "auto_indent_range", 17, "Auto-indents the range between the cursor and the mark.", 55, "w:\\4ed\\code\\custom\\4coder_auto_indent.cpp", 41, 385 },
@ -272,11 +273,13 @@ static Command_Metadata fcoder_metacmd_table[228] = {
{ PROC_LINKS(close_all_code, 0), false, "close_all_code", 14, "Closes any buffer with a filename ending with an extension configured to be recognized as a code file type.", 107, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 843 }, { PROC_LINKS(close_all_code, 0), false, "close_all_code", 14, "Closes any buffer with a filename ending with an extension configured to be recognized as a code file type.", 107, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 843 },
{ PROC_LINKS(close_build_panel, 0), false, "close_build_panel", 17, "If the special build panel is open, closes it.", 46, "w:\\4ed\\code\\custom\\4coder_build_commands.cpp", 44, 180 }, { PROC_LINKS(close_build_panel, 0), false, "close_build_panel", 17, "If the special build panel is open, closes it.", 46, "w:\\4ed\\code\\custom\\4coder_build_commands.cpp", 44, 180 },
{ PROC_LINKS(close_panel, 0), false, "close_panel", 11, "Closes the currently active panel if it is not the only panel open.", 67, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 621 }, { PROC_LINKS(close_panel, 0), false, "close_panel", 11, "Closes the currently active panel if it is not the only panel open.", 67, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 621 },
{ PROC_LINKS(command_documentation, 0), true, "command_documentation", 21, "Prompts the user to select a command then loads a doc buffer for that item", 74, "w:\\4ed\\code\\custom\\4coder_docs.cpp", 34, 188 },
{ PROC_LINKS(command_lister, 0), true, "command_lister", 14, "Opens an interactive list of all registered commands.", 53, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 668 }, { PROC_LINKS(command_lister, 0), true, "command_lister", 14, "Opens an interactive list of all registered commands.", 53, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 668 },
{ PROC_LINKS(comment_line, 0), false, "comment_line", 12, "Insert '//' at the beginning of the line after leading whitespace.", 66, "w:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 125 }, { PROC_LINKS(comment_line, 0), false, "comment_line", 12, "Insert '//' at the beginning of the line after leading whitespace.", 66, "w:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 125 },
{ PROC_LINKS(comment_line_toggle, 0), false, "comment_line_toggle", 19, "Turns uncommented lines into commented lines and vice versa for comments starting with '//'.", 92, "w:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 149 }, { PROC_LINKS(comment_line_toggle, 0), false, "comment_line_toggle", 19, "Turns uncommented lines into commented lines and vice versa for comments starting with '//'.", 92, "w:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 149 },
{ PROC_LINKS(copy, 0), false, "copy", 4, "Copy the text in the range from the cursor to the mark onto the clipboard.", 74, "w:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 19 }, { PROC_LINKS(copy, 0), false, "copy", 4, "Copy the text in the range from the cursor to the mark onto the clipboard.", 74, "w:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 19 },
{ PROC_LINKS(cursor_mark_swap, 0), false, "cursor_mark_swap", 16, "Swaps the position of the cursor and the mark.", 46, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 124 }, { PROC_LINKS(cursor_mark_swap, 0), false, "cursor_mark_swap", 16, "Swaps the position of the cursor and the mark.", 46, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 124 },
{ PROC_LINKS(custom_api_documentation, 0), true, "custom_api_documentation", 24, "Prompts the user to select a Custom API item then loads a doc buffer for that item", 82, "w:\\4ed\\code\\custom\\4coder_docs.cpp", 34, 175 },
{ PROC_LINKS(cut, 0), false, "cut", 3, "Cut the text in the range from the cursor to the mark onto the clipboard.", 73, "w:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 28 }, { PROC_LINKS(cut, 0), false, "cut", 3, "Cut the text in the range from the cursor to the mark onto the clipboard.", 73, "w:\\4ed\\code\\custom\\4coder_clipboard.cpp", 39, 28 },
{ PROC_LINKS(decrease_face_size, 0), false, "decrease_face_size", 18, "Decrease the size of the face used by the current buffer.", 57, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 684 }, { PROC_LINKS(decrease_face_size, 0), false, "decrease_face_size", 18, "Decrease the size of the face used by the current buffer.", 57, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 684 },
{ PROC_LINKS(default_file_externally_modified, 0), false, "default_file_externally_modified", 32, "Notes the external modification of attached files by printing a message.", 72, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1798 }, { PROC_LINKS(default_file_externally_modified, 0), false, "default_file_externally_modified", 32, "Notes the external modification of attached files by printing a message.", 72, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1798 },
@ -376,7 +379,6 @@ static Command_Metadata fcoder_metacmd_table[228] = {
{ PROC_LINKS(move_up_to_blank_line_skip_whitespace, 0), false, "move_up_to_blank_line_skip_whitespace", 37, "Seeks the cursor up to the next blank line and places it at the end of the line.", 80, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 415 }, { PROC_LINKS(move_up_to_blank_line_skip_whitespace, 0), false, "move_up_to_blank_line_skip_whitespace", 37, "Seeks the cursor up to the next blank line and places it at the end of the line.", 80, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 415 },
{ PROC_LINKS(open_all_code, 0), false, "open_all_code", 13, "Open all code in the current directory. File types are determined by extensions. An extension is considered code based on the extensions specified in 4coder.config.", 164, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 849 }, { PROC_LINKS(open_all_code, 0), false, "open_all_code", 13, "Open all code in the current directory. File types are determined by extensions. An extension is considered code based on the extensions specified in 4coder.config.", 164, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 849 },
{ PROC_LINKS(open_all_code_recursive, 0), false, "open_all_code_recursive", 23, "Works as open_all_code but also runs in all subdirectories.", 59, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 855 }, { PROC_LINKS(open_all_code_recursive, 0), false, "open_all_code_recursive", 23, "Works as open_all_code but also runs in all subdirectories.", 59, "w:\\4ed\\code\\custom\\4coder_project_commands.cpp", 46, 855 },
{ PROC_LINKS(open_documentation, 0), true, "open_documentation", 18, "Prompts the user to select an API item then loads a doc buffer for that item", 76, "w:\\4ed\\code\\custom\\4coder_docs.cpp", 34, 175 },
{ PROC_LINKS(open_file_in_quotes, 0), false, "open_file_in_quotes", 19, "Reads a filename from surrounding '\"' characters and attempts to open the corresponding file.", 94, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1461 }, { PROC_LINKS(open_file_in_quotes, 0), false, "open_file_in_quotes", 19, "Reads a filename from surrounding '\"' characters and attempts to open the corresponding file.", 94, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1461 },
{ PROC_LINKS(open_in_other, 0), false, "open_in_other", 13, "Interactively opens a file in the other panel.", 46, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1792 }, { PROC_LINKS(open_in_other, 0), false, "open_in_other", 13, "Interactively opens a file in the other panel.", 46, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1792 },
{ PROC_LINKS(open_long_braces, 0), false, "open_long_braces", 16, "At the cursor, insert a '{' and '}' separated by a blank line.", 62, "w:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 46 }, { PROC_LINKS(open_long_braces, 0), false, "open_long_braces", 16, "At the cursor, insert a '{' and '}' separated by a blank line.", 62, "w:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 46 },
@ -446,7 +448,7 @@ static Command_Metadata fcoder_metacmd_table[228] = {
{ PROC_LINKS(snippet_lister, 0), true, "snippet_lister", 14, "Opens a snippet lister for inserting whole pre-written snippets of text.", 72, "w:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 237 }, { PROC_LINKS(snippet_lister, 0), true, "snippet_lister", 14, "Opens a snippet lister for inserting whole pre-written snippets of text.", 72, "w:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 237 },
{ PROC_LINKS(suppress_mouse, 0), false, "suppress_mouse", 14, "Hides the mouse and causes all mosue input (clicks, position, wheel) to be ignored.", 83, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 403 }, { PROC_LINKS(suppress_mouse, 0), false, "suppress_mouse", 14, "Hides the mouse and causes all mosue input (clicks, position, wheel) to be ignored.", 83, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 403 },
{ PROC_LINKS(swap_panels, 0), false, "swap_panels", 11, "Swaps the active panel with it's sibling.", 41, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1518 }, { PROC_LINKS(swap_panels, 0), false, "swap_panels", 11, "Swaps the active panel with it's sibling.", 41, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 1518 },
{ PROC_LINKS(theme_lister, 0), true, "theme_lister", 12, "Opens an interactive list of all registered themes.", 51, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 691 }, { PROC_LINKS(theme_lister, 0), true, "theme_lister", 12, "Opens an interactive list of all registered themes.", 51, "w:\\4ed\\code\\custom\\4coder_lists.cpp", 35, 692 },
{ PROC_LINKS(to_lowercase, 0), false, "to_lowercase", 12, "Converts all ascii text in the range between the cursor and the mark to lowercase.", 82, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 565 }, { PROC_LINKS(to_lowercase, 0), false, "to_lowercase", 12, "Converts all ascii text in the range between the cursor and the mark to lowercase.", 82, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 565 },
{ PROC_LINKS(to_uppercase, 0), false, "to_uppercase", 12, "Converts all ascii text in the range between the cursor and the mark to uppercase.", 82, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 552 }, { PROC_LINKS(to_uppercase, 0), false, "to_uppercase", 12, "Converts all ascii text in the range between the cursor and the mark to uppercase.", 82, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 552 },
{ PROC_LINKS(toggle_filebar, 0), false, "toggle_filebar", 14, "Toggles the visibility status of the current view's filebar.", 60, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 658 }, { PROC_LINKS(toggle_filebar, 0), false, "toggle_filebar", 14, "Toggles the visibility status of the current view's filebar.", 60, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 658 },
@ -459,7 +461,7 @@ static Command_Metadata fcoder_metacmd_table[228] = {
{ PROC_LINKS(toggle_mouse, 0), false, "toggle_mouse", 12, "Toggles the mouse suppression mode, see suppress_mouse and allow_mouse.", 71, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 415 }, { PROC_LINKS(toggle_mouse, 0), false, "toggle_mouse", 12, "Toggles the mouse suppression mode, see suppress_mouse and allow_mouse.", 71, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 415 },
{ PROC_LINKS(toggle_paren_matching_helper, 0), false, "toggle_paren_matching_helper", 28, "In code files matching parentheses pairs are colored with distinguishing colors.", 80, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 445 }, { PROC_LINKS(toggle_paren_matching_helper, 0), false, "toggle_paren_matching_helper", 28, "In code files matching parentheses pairs are colored with distinguishing colors.", 80, "w:\\4ed\\code\\custom\\4coder_default_framework.cpp", 47, 445 },
{ PROC_LINKS(toggle_show_whitespace, 0), false, "toggle_show_whitespace", 22, "Toggles the current buffer's whitespace visibility status.", 58, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 712 }, { PROC_LINKS(toggle_show_whitespace, 0), false, "toggle_show_whitespace", 22, "Toggles the current buffer's whitespace visibility status.", 58, "w:\\4ed\\code\\custom\\4coder_base_commands.cpp", 43, 712 },
{ PROC_LINKS(toggle_virtual_whitespace, 0), false, "toggle_virtual_whitespace", 25, "Toggles the current buffer's virtual whitespace status.", 55, "w:\\4ed\\code\\custom\\4coder_code_index.cpp", 40, 1122 }, { PROC_LINKS(toggle_virtual_whitespace, 0), false, "toggle_virtual_whitespace", 25, "Toggles the current buffer's virtual whitespace status.", 55, "w:\\4ed\\code\\custom\\4coder_code_index.cpp", 40, 1154 },
{ PROC_LINKS(tutorial_maximize, 0), false, "tutorial_maximize", 17, "Expand the tutorial window", 26, "w:\\4ed\\code\\custom\\4coder_tutorial.cpp", 38, 20 }, { PROC_LINKS(tutorial_maximize, 0), false, "tutorial_maximize", 17, "Expand the tutorial window", 26, "w:\\4ed\\code\\custom\\4coder_tutorial.cpp", 38, 20 },
{ PROC_LINKS(tutorial_minimize, 0), false, "tutorial_minimize", 17, "Shrink the tutorial window", 26, "w:\\4ed\\code\\custom\\4coder_tutorial.cpp", 38, 34 }, { PROC_LINKS(tutorial_minimize, 0), false, "tutorial_minimize", 17, "Shrink the tutorial window", 26, "w:\\4ed\\code\\custom\\4coder_tutorial.cpp", 38, 34 },
{ PROC_LINKS(uncomment_line, 0), false, "uncomment_line", 14, "If present, delete '//' at the beginning of the line after leading whitespace.", 78, "w:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 137 }, { PROC_LINKS(uncomment_line, 0), false, "uncomment_line", 14, "If present, delete '//' at the beginning of the line after leading whitespace.", 78, "w:\\4ed\\code\\custom\\4coder_combined_write_commands.cpp", 53, 137 },
@ -501,210 +503,211 @@ static i32 fcoder_metacmd_ID_click_set_mark = 18;
static i32 fcoder_metacmd_ID_close_all_code = 19; static i32 fcoder_metacmd_ID_close_all_code = 19;
static i32 fcoder_metacmd_ID_close_build_panel = 20; static i32 fcoder_metacmd_ID_close_build_panel = 20;
static i32 fcoder_metacmd_ID_close_panel = 21; static i32 fcoder_metacmd_ID_close_panel = 21;
static i32 fcoder_metacmd_ID_command_lister = 22; static i32 fcoder_metacmd_ID_command_documentation = 22;
static i32 fcoder_metacmd_ID_comment_line = 23; static i32 fcoder_metacmd_ID_command_lister = 23;
static i32 fcoder_metacmd_ID_comment_line_toggle = 24; static i32 fcoder_metacmd_ID_comment_line = 24;
static i32 fcoder_metacmd_ID_copy = 25; static i32 fcoder_metacmd_ID_comment_line_toggle = 25;
static i32 fcoder_metacmd_ID_cursor_mark_swap = 26; static i32 fcoder_metacmd_ID_copy = 26;
static i32 fcoder_metacmd_ID_cut = 27; static i32 fcoder_metacmd_ID_cursor_mark_swap = 27;
static i32 fcoder_metacmd_ID_decrease_face_size = 28; static i32 fcoder_metacmd_ID_custom_api_documentation = 28;
static i32 fcoder_metacmd_ID_default_file_externally_modified = 29; static i32 fcoder_metacmd_ID_cut = 29;
static i32 fcoder_metacmd_ID_default_startup = 30; static i32 fcoder_metacmd_ID_decrease_face_size = 30;
static i32 fcoder_metacmd_ID_default_try_exit = 31; static i32 fcoder_metacmd_ID_default_file_externally_modified = 31;
static i32 fcoder_metacmd_ID_default_view_input_handler = 32; static i32 fcoder_metacmd_ID_default_startup = 32;
static i32 fcoder_metacmd_ID_delete_alpha_numeric_boundary = 33; static i32 fcoder_metacmd_ID_default_try_exit = 33;
static i32 fcoder_metacmd_ID_delete_char = 34; static i32 fcoder_metacmd_ID_default_view_input_handler = 34;
static i32 fcoder_metacmd_ID_delete_current_scope = 35; static i32 fcoder_metacmd_ID_delete_alpha_numeric_boundary = 35;
static i32 fcoder_metacmd_ID_delete_file_query = 36; static i32 fcoder_metacmd_ID_delete_char = 36;
static i32 fcoder_metacmd_ID_delete_line = 37; static i32 fcoder_metacmd_ID_delete_current_scope = 37;
static i32 fcoder_metacmd_ID_delete_range = 38; static i32 fcoder_metacmd_ID_delete_file_query = 38;
static i32 fcoder_metacmd_ID_duplicate_line = 39; static i32 fcoder_metacmd_ID_delete_line = 39;
static i32 fcoder_metacmd_ID_execute_any_cli = 40; static i32 fcoder_metacmd_ID_delete_range = 40;
static i32 fcoder_metacmd_ID_execute_previous_cli = 41; static i32 fcoder_metacmd_ID_duplicate_line = 41;
static i32 fcoder_metacmd_ID_exit_4coder = 42; static i32 fcoder_metacmd_ID_execute_any_cli = 42;
static i32 fcoder_metacmd_ID_goto_beginning_of_file = 43; static i32 fcoder_metacmd_ID_execute_previous_cli = 43;
static i32 fcoder_metacmd_ID_goto_end_of_file = 44; static i32 fcoder_metacmd_ID_exit_4coder = 44;
static i32 fcoder_metacmd_ID_goto_first_jump = 45; static i32 fcoder_metacmd_ID_goto_beginning_of_file = 45;
static i32 fcoder_metacmd_ID_goto_first_jump_same_panel_sticky = 46; static i32 fcoder_metacmd_ID_goto_end_of_file = 46;
static i32 fcoder_metacmd_ID_goto_jump_at_cursor = 47; static i32 fcoder_metacmd_ID_goto_first_jump = 47;
static i32 fcoder_metacmd_ID_goto_jump_at_cursor_same_panel = 48; static i32 fcoder_metacmd_ID_goto_first_jump_same_panel_sticky = 48;
static i32 fcoder_metacmd_ID_goto_line = 49; static i32 fcoder_metacmd_ID_goto_jump_at_cursor = 49;
static i32 fcoder_metacmd_ID_goto_next_jump = 50; static i32 fcoder_metacmd_ID_goto_jump_at_cursor_same_panel = 50;
static i32 fcoder_metacmd_ID_goto_next_jump_no_skips = 51; static i32 fcoder_metacmd_ID_goto_line = 51;
static i32 fcoder_metacmd_ID_goto_prev_jump = 52; static i32 fcoder_metacmd_ID_goto_next_jump = 52;
static i32 fcoder_metacmd_ID_goto_prev_jump_no_skips = 53; static i32 fcoder_metacmd_ID_goto_next_jump_no_skips = 53;
static i32 fcoder_metacmd_ID_hide_filebar = 54; static i32 fcoder_metacmd_ID_goto_prev_jump = 54;
static i32 fcoder_metacmd_ID_hide_scrollbar = 55; static i32 fcoder_metacmd_ID_goto_prev_jump_no_skips = 55;
static i32 fcoder_metacmd_ID_hms_demo_tutorial = 56; static i32 fcoder_metacmd_ID_hide_filebar = 56;
static i32 fcoder_metacmd_ID_if0_off = 57; static i32 fcoder_metacmd_ID_hide_scrollbar = 57;
static i32 fcoder_metacmd_ID_if_read_only_goto_position = 58; static i32 fcoder_metacmd_ID_hms_demo_tutorial = 58;
static i32 fcoder_metacmd_ID_if_read_only_goto_position_same_panel = 59; static i32 fcoder_metacmd_ID_if0_off = 59;
static i32 fcoder_metacmd_ID_increase_face_size = 60; static i32 fcoder_metacmd_ID_if_read_only_goto_position = 60;
static i32 fcoder_metacmd_ID_interactive_kill_buffer = 61; static i32 fcoder_metacmd_ID_if_read_only_goto_position_same_panel = 61;
static i32 fcoder_metacmd_ID_interactive_new = 62; static i32 fcoder_metacmd_ID_increase_face_size = 62;
static i32 fcoder_metacmd_ID_interactive_open = 63; static i32 fcoder_metacmd_ID_interactive_kill_buffer = 63;
static i32 fcoder_metacmd_ID_interactive_open_or_new = 64; static i32 fcoder_metacmd_ID_interactive_new = 64;
static i32 fcoder_metacmd_ID_interactive_switch_buffer = 65; static i32 fcoder_metacmd_ID_interactive_open = 65;
static i32 fcoder_metacmd_ID_jump_to_definition = 66; static i32 fcoder_metacmd_ID_interactive_open_or_new = 66;
static i32 fcoder_metacmd_ID_keyboard_macro_finish_recording = 67; static i32 fcoder_metacmd_ID_interactive_switch_buffer = 67;
static i32 fcoder_metacmd_ID_keyboard_macro_replay = 68; static i32 fcoder_metacmd_ID_jump_to_definition = 68;
static i32 fcoder_metacmd_ID_keyboard_macro_start_recording = 69; static i32 fcoder_metacmd_ID_keyboard_macro_finish_recording = 69;
static i32 fcoder_metacmd_ID_kill_buffer = 70; static i32 fcoder_metacmd_ID_keyboard_macro_replay = 70;
static i32 fcoder_metacmd_ID_kill_tutorial = 71; static i32 fcoder_metacmd_ID_keyboard_macro_start_recording = 71;
static i32 fcoder_metacmd_ID_left_adjust_view = 72; static i32 fcoder_metacmd_ID_kill_buffer = 72;
static i32 fcoder_metacmd_ID_list_all_functions_all_buffers = 73; static i32 fcoder_metacmd_ID_kill_tutorial = 73;
static i32 fcoder_metacmd_ID_list_all_functions_all_buffers_lister = 74; static i32 fcoder_metacmd_ID_left_adjust_view = 74;
static i32 fcoder_metacmd_ID_list_all_functions_current_buffer = 75; static i32 fcoder_metacmd_ID_list_all_functions_all_buffers = 75;
static i32 fcoder_metacmd_ID_list_all_functions_current_buffer_lister = 76; static i32 fcoder_metacmd_ID_list_all_functions_all_buffers_lister = 76;
static i32 fcoder_metacmd_ID_list_all_locations = 77; static i32 fcoder_metacmd_ID_list_all_functions_current_buffer = 77;
static i32 fcoder_metacmd_ID_list_all_locations_case_insensitive = 78; static i32 fcoder_metacmd_ID_list_all_functions_current_buffer_lister = 78;
static i32 fcoder_metacmd_ID_list_all_locations_of_identifier = 79; static i32 fcoder_metacmd_ID_list_all_locations = 79;
static i32 fcoder_metacmd_ID_list_all_locations_of_identifier_case_insensitive = 80; static i32 fcoder_metacmd_ID_list_all_locations_case_insensitive = 80;
static i32 fcoder_metacmd_ID_list_all_locations_of_selection = 81; static i32 fcoder_metacmd_ID_list_all_locations_of_identifier = 81;
static i32 fcoder_metacmd_ID_list_all_locations_of_selection_case_insensitive = 82; static i32 fcoder_metacmd_ID_list_all_locations_of_identifier_case_insensitive = 82;
static i32 fcoder_metacmd_ID_list_all_locations_of_type_definition = 83; static i32 fcoder_metacmd_ID_list_all_locations_of_selection = 83;
static i32 fcoder_metacmd_ID_list_all_locations_of_type_definition_of_identifier = 84; static i32 fcoder_metacmd_ID_list_all_locations_of_selection_case_insensitive = 84;
static i32 fcoder_metacmd_ID_list_all_substring_locations = 85; static i32 fcoder_metacmd_ID_list_all_locations_of_type_definition = 85;
static i32 fcoder_metacmd_ID_list_all_substring_locations_case_insensitive = 86; static i32 fcoder_metacmd_ID_list_all_locations_of_type_definition_of_identifier = 86;
static i32 fcoder_metacmd_ID_load_project = 87; static i32 fcoder_metacmd_ID_list_all_substring_locations = 87;
static i32 fcoder_metacmd_ID_load_themes_default_folder = 88; static i32 fcoder_metacmd_ID_list_all_substring_locations_case_insensitive = 88;
static i32 fcoder_metacmd_ID_load_themes_hot_directory = 89; static i32 fcoder_metacmd_ID_load_project = 89;
static i32 fcoder_metacmd_ID_make_directory_query = 90; static i32 fcoder_metacmd_ID_load_themes_default_folder = 90;
static i32 fcoder_metacmd_ID_miblo_decrement_basic = 91; static i32 fcoder_metacmd_ID_load_themes_hot_directory = 91;
static i32 fcoder_metacmd_ID_miblo_decrement_time_stamp = 92; static i32 fcoder_metacmd_ID_make_directory_query = 92;
static i32 fcoder_metacmd_ID_miblo_decrement_time_stamp_minute = 93; static i32 fcoder_metacmd_ID_miblo_decrement_basic = 93;
static i32 fcoder_metacmd_ID_miblo_increment_basic = 94; static i32 fcoder_metacmd_ID_miblo_decrement_time_stamp = 94;
static i32 fcoder_metacmd_ID_miblo_increment_time_stamp = 95; static i32 fcoder_metacmd_ID_miblo_decrement_time_stamp_minute = 95;
static i32 fcoder_metacmd_ID_miblo_increment_time_stamp_minute = 96; static i32 fcoder_metacmd_ID_miblo_increment_basic = 96;
static i32 fcoder_metacmd_ID_mouse_wheel_change_face_size = 97; static i32 fcoder_metacmd_ID_miblo_increment_time_stamp = 97;
static i32 fcoder_metacmd_ID_mouse_wheel_scroll = 98; static i32 fcoder_metacmd_ID_miblo_increment_time_stamp_minute = 98;
static i32 fcoder_metacmd_ID_move_down = 99; static i32 fcoder_metacmd_ID_mouse_wheel_change_face_size = 99;
static i32 fcoder_metacmd_ID_move_down_10 = 100; static i32 fcoder_metacmd_ID_mouse_wheel_scroll = 100;
static i32 fcoder_metacmd_ID_move_down_textual = 101; static i32 fcoder_metacmd_ID_move_down = 101;
static i32 fcoder_metacmd_ID_move_down_to_blank_line = 102; static i32 fcoder_metacmd_ID_move_down_10 = 102;
static i32 fcoder_metacmd_ID_move_down_to_blank_line_end = 103; static i32 fcoder_metacmd_ID_move_down_textual = 103;
static i32 fcoder_metacmd_ID_move_down_to_blank_line_skip_whitespace = 104; static i32 fcoder_metacmd_ID_move_down_to_blank_line = 104;
static i32 fcoder_metacmd_ID_move_left = 105; static i32 fcoder_metacmd_ID_move_down_to_blank_line_end = 105;
static i32 fcoder_metacmd_ID_move_left_alpha_numeric_boundary = 106; static i32 fcoder_metacmd_ID_move_down_to_blank_line_skip_whitespace = 106;
static i32 fcoder_metacmd_ID_move_left_alpha_numeric_or_camel_boundary = 107; static i32 fcoder_metacmd_ID_move_left = 107;
static i32 fcoder_metacmd_ID_move_left_token_boundary = 108; static i32 fcoder_metacmd_ID_move_left_alpha_numeric_boundary = 108;
static i32 fcoder_metacmd_ID_move_left_whitespace_boundary = 109; static i32 fcoder_metacmd_ID_move_left_alpha_numeric_or_camel_boundary = 109;
static i32 fcoder_metacmd_ID_move_left_whitespace_or_token_boundary = 110; static i32 fcoder_metacmd_ID_move_left_token_boundary = 110;
static i32 fcoder_metacmd_ID_move_line_down = 111; static i32 fcoder_metacmd_ID_move_left_whitespace_boundary = 111;
static i32 fcoder_metacmd_ID_move_line_up = 112; static i32 fcoder_metacmd_ID_move_left_whitespace_or_token_boundary = 112;
static i32 fcoder_metacmd_ID_move_right = 113; static i32 fcoder_metacmd_ID_move_line_down = 113;
static i32 fcoder_metacmd_ID_move_right_alpha_numeric_boundary = 114; static i32 fcoder_metacmd_ID_move_line_up = 114;
static i32 fcoder_metacmd_ID_move_right_alpha_numeric_or_camel_boundary = 115; static i32 fcoder_metacmd_ID_move_right = 115;
static i32 fcoder_metacmd_ID_move_right_token_boundary = 116; static i32 fcoder_metacmd_ID_move_right_alpha_numeric_boundary = 116;
static i32 fcoder_metacmd_ID_move_right_whitespace_boundary = 117; static i32 fcoder_metacmd_ID_move_right_alpha_numeric_or_camel_boundary = 117;
static i32 fcoder_metacmd_ID_move_right_whitespace_or_token_boundary = 118; static i32 fcoder_metacmd_ID_move_right_token_boundary = 118;
static i32 fcoder_metacmd_ID_move_up = 119; static i32 fcoder_metacmd_ID_move_right_whitespace_boundary = 119;
static i32 fcoder_metacmd_ID_move_up_10 = 120; static i32 fcoder_metacmd_ID_move_right_whitespace_or_token_boundary = 120;
static i32 fcoder_metacmd_ID_move_up_to_blank_line = 121; static i32 fcoder_metacmd_ID_move_up = 121;
static i32 fcoder_metacmd_ID_move_up_to_blank_line_end = 122; static i32 fcoder_metacmd_ID_move_up_10 = 122;
static i32 fcoder_metacmd_ID_move_up_to_blank_line_skip_whitespace = 123; static i32 fcoder_metacmd_ID_move_up_to_blank_line = 123;
static i32 fcoder_metacmd_ID_open_all_code = 124; static i32 fcoder_metacmd_ID_move_up_to_blank_line_end = 124;
static i32 fcoder_metacmd_ID_open_all_code_recursive = 125; static i32 fcoder_metacmd_ID_move_up_to_blank_line_skip_whitespace = 125;
static i32 fcoder_metacmd_ID_open_documentation = 126; static i32 fcoder_metacmd_ID_open_all_code = 126;
static i32 fcoder_metacmd_ID_open_file_in_quotes = 127; static i32 fcoder_metacmd_ID_open_all_code_recursive = 127;
static i32 fcoder_metacmd_ID_open_in_other = 128; static i32 fcoder_metacmd_ID_open_file_in_quotes = 128;
static i32 fcoder_metacmd_ID_open_long_braces = 129; static i32 fcoder_metacmd_ID_open_in_other = 129;
static i32 fcoder_metacmd_ID_open_long_braces_break = 130; static i32 fcoder_metacmd_ID_open_long_braces = 130;
static i32 fcoder_metacmd_ID_open_long_braces_semicolon = 131; static i32 fcoder_metacmd_ID_open_long_braces_break = 131;
static i32 fcoder_metacmd_ID_open_matching_file_cpp = 132; static i32 fcoder_metacmd_ID_open_long_braces_semicolon = 132;
static i32 fcoder_metacmd_ID_open_panel_hsplit = 133; static i32 fcoder_metacmd_ID_open_matching_file_cpp = 133;
static i32 fcoder_metacmd_ID_open_panel_vsplit = 134; static i32 fcoder_metacmd_ID_open_panel_hsplit = 134;
static i32 fcoder_metacmd_ID_page_down = 135; static i32 fcoder_metacmd_ID_open_panel_vsplit = 135;
static i32 fcoder_metacmd_ID_page_up = 136; static i32 fcoder_metacmd_ID_page_down = 136;
static i32 fcoder_metacmd_ID_paste = 137; static i32 fcoder_metacmd_ID_page_up = 137;
static i32 fcoder_metacmd_ID_paste_and_indent = 138; static i32 fcoder_metacmd_ID_paste = 138;
static i32 fcoder_metacmd_ID_paste_next = 139; static i32 fcoder_metacmd_ID_paste_and_indent = 139;
static i32 fcoder_metacmd_ID_paste_next_and_indent = 140; static i32 fcoder_metacmd_ID_paste_next = 140;
static i32 fcoder_metacmd_ID_place_in_scope = 141; static i32 fcoder_metacmd_ID_paste_next_and_indent = 141;
static i32 fcoder_metacmd_ID_profile_clear = 142; static i32 fcoder_metacmd_ID_place_in_scope = 142;
static i32 fcoder_metacmd_ID_profile_disable = 143; static i32 fcoder_metacmd_ID_profile_clear = 143;
static i32 fcoder_metacmd_ID_profile_enable = 144; static i32 fcoder_metacmd_ID_profile_disable = 144;
static i32 fcoder_metacmd_ID_profile_inspect = 145; static i32 fcoder_metacmd_ID_profile_enable = 145;
static i32 fcoder_metacmd_ID_project_command_lister = 146; static i32 fcoder_metacmd_ID_profile_inspect = 146;
static i32 fcoder_metacmd_ID_project_fkey_command = 147; static i32 fcoder_metacmd_ID_project_command_lister = 147;
static i32 fcoder_metacmd_ID_project_go_to_root_directory = 148; static i32 fcoder_metacmd_ID_project_fkey_command = 148;
static i32 fcoder_metacmd_ID_query_replace = 149; static i32 fcoder_metacmd_ID_project_go_to_root_directory = 149;
static i32 fcoder_metacmd_ID_query_replace_identifier = 150; static i32 fcoder_metacmd_ID_query_replace = 150;
static i32 fcoder_metacmd_ID_query_replace_selection = 151; static i32 fcoder_metacmd_ID_query_replace_identifier = 151;
static i32 fcoder_metacmd_ID_redo = 152; static i32 fcoder_metacmd_ID_query_replace_selection = 152;
static i32 fcoder_metacmd_ID_redo_all_buffers = 153; static i32 fcoder_metacmd_ID_redo = 153;
static i32 fcoder_metacmd_ID_rename_file_query = 154; static i32 fcoder_metacmd_ID_redo_all_buffers = 154;
static i32 fcoder_metacmd_ID_reopen = 155; static i32 fcoder_metacmd_ID_rename_file_query = 155;
static i32 fcoder_metacmd_ID_replace_in_all_buffers = 156; static i32 fcoder_metacmd_ID_reopen = 156;
static i32 fcoder_metacmd_ID_replace_in_buffer = 157; static i32 fcoder_metacmd_ID_replace_in_all_buffers = 157;
static i32 fcoder_metacmd_ID_replace_in_range = 158; static i32 fcoder_metacmd_ID_replace_in_buffer = 158;
static i32 fcoder_metacmd_ID_reverse_search = 159; static i32 fcoder_metacmd_ID_replace_in_range = 159;
static i32 fcoder_metacmd_ID_reverse_search_identifier = 160; static i32 fcoder_metacmd_ID_reverse_search = 160;
static i32 fcoder_metacmd_ID_save = 161; static i32 fcoder_metacmd_ID_reverse_search_identifier = 161;
static i32 fcoder_metacmd_ID_save_all_dirty_buffers = 162; static i32 fcoder_metacmd_ID_save = 162;
static i32 fcoder_metacmd_ID_save_to_query = 163; static i32 fcoder_metacmd_ID_save_all_dirty_buffers = 163;
static i32 fcoder_metacmd_ID_search = 164; static i32 fcoder_metacmd_ID_save_to_query = 164;
static i32 fcoder_metacmd_ID_search_identifier = 165; static i32 fcoder_metacmd_ID_search = 165;
static i32 fcoder_metacmd_ID_seek_beginning_of_line = 166; static i32 fcoder_metacmd_ID_search_identifier = 166;
static i32 fcoder_metacmd_ID_seek_beginning_of_textual_line = 167; static i32 fcoder_metacmd_ID_seek_beginning_of_line = 167;
static i32 fcoder_metacmd_ID_seek_end_of_line = 168; static i32 fcoder_metacmd_ID_seek_beginning_of_textual_line = 168;
static i32 fcoder_metacmd_ID_seek_end_of_textual_line = 169; static i32 fcoder_metacmd_ID_seek_end_of_line = 169;
static i32 fcoder_metacmd_ID_select_all = 170; static i32 fcoder_metacmd_ID_seek_end_of_textual_line = 170;
static i32 fcoder_metacmd_ID_select_next_scope_absolute = 171; static i32 fcoder_metacmd_ID_select_all = 171;
static i32 fcoder_metacmd_ID_select_next_scope_after_current = 172; static i32 fcoder_metacmd_ID_select_next_scope_absolute = 172;
static i32 fcoder_metacmd_ID_select_prev_scope_absolute = 173; static i32 fcoder_metacmd_ID_select_next_scope_after_current = 173;
static i32 fcoder_metacmd_ID_select_prev_top_most_scope = 174; static i32 fcoder_metacmd_ID_select_prev_scope_absolute = 174;
static i32 fcoder_metacmd_ID_select_surrounding_scope = 175; static i32 fcoder_metacmd_ID_select_prev_top_most_scope = 175;
static i32 fcoder_metacmd_ID_select_surrounding_scope_maximal = 176; static i32 fcoder_metacmd_ID_select_surrounding_scope = 176;
static i32 fcoder_metacmd_ID_set_eol_mode_from_contents = 177; static i32 fcoder_metacmd_ID_select_surrounding_scope_maximal = 177;
static i32 fcoder_metacmd_ID_set_eol_mode_to_binary = 178; static i32 fcoder_metacmd_ID_set_eol_mode_from_contents = 178;
static i32 fcoder_metacmd_ID_set_eol_mode_to_crlf = 179; static i32 fcoder_metacmd_ID_set_eol_mode_to_binary = 179;
static i32 fcoder_metacmd_ID_set_eol_mode_to_lf = 180; static i32 fcoder_metacmd_ID_set_eol_mode_to_crlf = 180;
static i32 fcoder_metacmd_ID_set_mark = 181; static i32 fcoder_metacmd_ID_set_eol_mode_to_lf = 181;
static i32 fcoder_metacmd_ID_set_mode_to_notepad_like = 182; static i32 fcoder_metacmd_ID_set_mark = 182;
static i32 fcoder_metacmd_ID_set_mode_to_original = 183; static i32 fcoder_metacmd_ID_set_mode_to_notepad_like = 183;
static i32 fcoder_metacmd_ID_setup_build_bat = 184; static i32 fcoder_metacmd_ID_set_mode_to_original = 184;
static i32 fcoder_metacmd_ID_setup_build_bat_and_sh = 185; static i32 fcoder_metacmd_ID_setup_build_bat = 185;
static i32 fcoder_metacmd_ID_setup_build_sh = 186; static i32 fcoder_metacmd_ID_setup_build_bat_and_sh = 186;
static i32 fcoder_metacmd_ID_setup_new_project = 187; static i32 fcoder_metacmd_ID_setup_build_sh = 187;
static i32 fcoder_metacmd_ID_show_filebar = 188; static i32 fcoder_metacmd_ID_setup_new_project = 188;
static i32 fcoder_metacmd_ID_show_scrollbar = 189; static i32 fcoder_metacmd_ID_show_filebar = 189;
static i32 fcoder_metacmd_ID_show_the_log_graph = 190; static i32 fcoder_metacmd_ID_show_scrollbar = 190;
static i32 fcoder_metacmd_ID_snipe_backward_whitespace_or_token_boundary = 191; static i32 fcoder_metacmd_ID_show_the_log_graph = 191;
static i32 fcoder_metacmd_ID_snipe_forward_whitespace_or_token_boundary = 192; static i32 fcoder_metacmd_ID_snipe_backward_whitespace_or_token_boundary = 192;
static i32 fcoder_metacmd_ID_snippet_lister = 193; static i32 fcoder_metacmd_ID_snipe_forward_whitespace_or_token_boundary = 193;
static i32 fcoder_metacmd_ID_suppress_mouse = 194; static i32 fcoder_metacmd_ID_snippet_lister = 194;
static i32 fcoder_metacmd_ID_swap_panels = 195; static i32 fcoder_metacmd_ID_suppress_mouse = 195;
static i32 fcoder_metacmd_ID_theme_lister = 196; static i32 fcoder_metacmd_ID_swap_panels = 196;
static i32 fcoder_metacmd_ID_to_lowercase = 197; static i32 fcoder_metacmd_ID_theme_lister = 197;
static i32 fcoder_metacmd_ID_to_uppercase = 198; static i32 fcoder_metacmd_ID_to_lowercase = 198;
static i32 fcoder_metacmd_ID_toggle_filebar = 199; static i32 fcoder_metacmd_ID_to_uppercase = 199;
static i32 fcoder_metacmd_ID_toggle_fps_meter = 200; static i32 fcoder_metacmd_ID_toggle_filebar = 200;
static i32 fcoder_metacmd_ID_toggle_fullscreen = 201; static i32 fcoder_metacmd_ID_toggle_fps_meter = 201;
static i32 fcoder_metacmd_ID_toggle_highlight_enclosing_scopes = 202; static i32 fcoder_metacmd_ID_toggle_fullscreen = 202;
static i32 fcoder_metacmd_ID_toggle_highlight_line_at_cursor = 203; static i32 fcoder_metacmd_ID_toggle_highlight_enclosing_scopes = 203;
static i32 fcoder_metacmd_ID_toggle_line_numbers = 204; static i32 fcoder_metacmd_ID_toggle_highlight_line_at_cursor = 204;
static i32 fcoder_metacmd_ID_toggle_line_wrap = 205; static i32 fcoder_metacmd_ID_toggle_line_numbers = 205;
static i32 fcoder_metacmd_ID_toggle_mouse = 206; static i32 fcoder_metacmd_ID_toggle_line_wrap = 206;
static i32 fcoder_metacmd_ID_toggle_paren_matching_helper = 207; static i32 fcoder_metacmd_ID_toggle_mouse = 207;
static i32 fcoder_metacmd_ID_toggle_show_whitespace = 208; static i32 fcoder_metacmd_ID_toggle_paren_matching_helper = 208;
static i32 fcoder_metacmd_ID_toggle_virtual_whitespace = 209; static i32 fcoder_metacmd_ID_toggle_show_whitespace = 209;
static i32 fcoder_metacmd_ID_tutorial_maximize = 210; static i32 fcoder_metacmd_ID_toggle_virtual_whitespace = 210;
static i32 fcoder_metacmd_ID_tutorial_minimize = 211; static i32 fcoder_metacmd_ID_tutorial_maximize = 211;
static i32 fcoder_metacmd_ID_uncomment_line = 212; static i32 fcoder_metacmd_ID_tutorial_minimize = 212;
static i32 fcoder_metacmd_ID_undo = 213; static i32 fcoder_metacmd_ID_uncomment_line = 213;
static i32 fcoder_metacmd_ID_undo_all_buffers = 214; static i32 fcoder_metacmd_ID_undo = 214;
static i32 fcoder_metacmd_ID_view_buffer_other_panel = 215; static i32 fcoder_metacmd_ID_undo_all_buffers = 215;
static i32 fcoder_metacmd_ID_view_jump_list_with_lister = 216; static i32 fcoder_metacmd_ID_view_buffer_other_panel = 216;
static i32 fcoder_metacmd_ID_word_complete = 217; static i32 fcoder_metacmd_ID_view_jump_list_with_lister = 217;
static i32 fcoder_metacmd_ID_word_complete_drop_down = 218; static i32 fcoder_metacmd_ID_word_complete = 218;
static i32 fcoder_metacmd_ID_write_block = 219; static i32 fcoder_metacmd_ID_word_complete_drop_down = 219;
static i32 fcoder_metacmd_ID_write_hack = 220; static i32 fcoder_metacmd_ID_write_block = 220;
static i32 fcoder_metacmd_ID_write_note = 221; static i32 fcoder_metacmd_ID_write_hack = 221;
static i32 fcoder_metacmd_ID_write_space = 222; static i32 fcoder_metacmd_ID_write_note = 222;
static i32 fcoder_metacmd_ID_write_text_and_auto_indent = 223; static i32 fcoder_metacmd_ID_write_space = 223;
static i32 fcoder_metacmd_ID_write_text_input = 224; static i32 fcoder_metacmd_ID_write_text_and_auto_indent = 224;
static i32 fcoder_metacmd_ID_write_todo = 225; static i32 fcoder_metacmd_ID_write_text_input = 225;
static i32 fcoder_metacmd_ID_write_underscore = 226; static i32 fcoder_metacmd_ID_write_todo = 226;
static i32 fcoder_metacmd_ID_write_zero_struct = 227; static i32 fcoder_metacmd_ID_write_underscore = 227;
static i32 fcoder_metacmd_ID_write_zero_struct = 228;
#endif #endif

View File

@ -23,7 +23,8 @@
#include "generated/lexer_cpp.cpp" #include "generated/lexer_cpp.cpp"
#include "../4ed_api_definition.cpp" #include "../4ed_api_definition.cpp"
#include "../4ed_api_parser.cpp" #include "../4ed_api_parser.cpp"
#include "4ed_doc_content_types.cpp" #include "4coder_doc_content_types.cpp"
#include "4ed_doc_helper.cpp"
#include "4coder_file.cpp" #include "4coder_file.cpp"
//////////////////////////////// ////////////////////////////////

158
docs/4ed_doc_helper.cpp Normal file
View File

@ -0,0 +1,158 @@
/*
* Mr. 4th Dimention - Allen Webster
*
* 14.12.2019
*
* Definition of information contained in 4coder documentation.
*
*/
// TOP
function Doc_Function
make_doc_function(Arena *arena, Doc_Cluster *cluster, API_Call *call){
Doc_Function result = {};
result.call = call;
result.page = new_doc_page_function(arena, cluster, call->name);
result.brief = new_doc_block(arena, result.page, "brief");
result.sig = new_doc_block(arena, result.page, "Signature");
new_doc_block_jump(arena, result.page, result.sig);
String_Const_u8 opener = push_u8_stringf(arena, "%.*s\n%.*s(",
string_expand(call->return_type),
string_expand(call->name));
umem indent_size = call->name.size + 1;
u8 *buffer = push_array(arena, u8, indent_size);
for (umem i = 0; i < indent_size; i += 1){
buffer[i] = ' ';
}
String_Const_u8 indent = SCu8(buffer, indent_size);
List_String_Const_u8 list = {};
string_list_push(arena, &list, opener);
for (API_Param *node = call->params.first;
node != 0;
node = node->next){
string_list_pushf(arena, &list, "%.*s %.*s",
string_expand(node->type_name),
string_expand(node->name));
if (node->next != 0){
string_list_pushf(arena, &list, ",\n%.*s",
string_expand(indent));
}
}
string_list_push(arena, &list, string_u8_litexpr(");"));
String_Const_u8 contents = string_list_flatten(arena, list);
new_doc_par_single_code(arena, result.sig, contents, DocCodeLanguage_Cpp);
return(result);
}
function b32
begin_doc_call(Arena *arena, Doc_Cluster *cluster, API_Definition *api_def, char *name, Doc_Function *func){
API_Call *call = api_get_call(api_def, SCu8(name));
b32 result = (call != 0);
if (result){
*func = make_doc_function(arena, cluster, call);
}
else{
doc_warningf(arena, cluster, "dead call documentation %s", name);
}
return(result);
}
function Doc_Block*
doc_function_brief(Arena *arena, Doc_Function *func, char *text){
if (text != 0){
doc_text(arena, func->brief, text);
}
return(func->brief);
}
function Doc_Block*
doc_function_begin_params(Arena *arena, Doc_Function *func){
func->params = new_doc_block(arena, func->page, "Parameters");
new_doc_block_jump(arena, func->page, func->params);
return(func->params);
}
function void
doc_function_param(Arena *arena, Doc_Function *func, char *name){
String_Const_u8 name_str = SCu8(name);
API_Call *call = func->call;
API_Param *param = 0;
for (API_Param *node = call->params.first;
node != 0;
node = node->next){
if (string_match(name_str, node->name)){
param = node;
break;
}
}
if (param == 0){
doc_errorf(arena, func->page->owner, "documentation for non-existant parameter %s in call %.*s", name, string_expand(call->name));
return;
}
API_Param *iter = func->param_iter;
if (iter != 0){
for (iter = iter->next;
iter != 0 && iter != param;
iter = iter->next);
if (iter == 0){
doc_warningf(arena, func->page->owner, "parameters out of order in documentation for call %.*s", string_expand(call->name));
}
}
func->param_iter = param;
// parameter header
Doc_Paragraph *par = new_doc_par(arena, func->params);
par->kind = DocParagraphKind_Text;
doc_content_push(arena, &par->text, name_str, DocContentEmphasis_SmallHeader);
// empty paragraph to start filling after
par = new_doc_par(arena, func->params);
par->kind = DocParagraphKind_Text;
}
function Doc_Block*
doc_function_return(Arena *arena, Doc_Function *func){
func->ret = new_doc_block(arena, func->page, "Return");
new_doc_block_jump(arena, func->page, func->ret);
return(func->ret);
}
function Doc_Block*
doc_function_details(Arena *arena, Doc_Function *func){
func->det = new_doc_block(arena, func->page, "Details");
new_doc_block_jump(arena, func->page, func->det);
return(func->det);
}
function Doc_Block*
doc_function_examples(Arena *arena, Doc_Function *func){
func->examples = new_doc_block(arena, func->page, "Examples");
new_doc_block_jump(arena, func->page, func->examples);
return(func->examples);
}
function Doc_Block*
doc_function_begin_related(Arena *arena, Doc_Function *func){
func->rel = new_doc_block(arena, func->page, "Related");
new_doc_block_jump(arena, func->page, func->rel);
return(func->rel);
}
function void
doc_function_add_related(Arena *arena, Doc_Block *rel, char *name){
Doc_Paragraph *par = new_doc_par(arena, rel);
par->kind = DocParagraphKind_Text;
Doc_Content *content = doc_content_push(arena, &par->text, SCu8(name));
content->page_link = SCu8(name);
}
// BOTTOM

View File

@ -112,7 +112,7 @@ out vec4 out_color;
float rectangle_sd(vec2 p, vec2 b){ float rectangle_sd(vec2 p, vec2 b){
vec2 d = abs(p) - b; vec2 d = abs(p) - b;
return(length(Max(d, vec2(0.0, 0.0))) + Min(max(d.x, d.y), 0.0)); return(length(max(d, vec2(0.0, 0.0))) + min(max(d.x, d.y), 0.0));
} }
void main(void) void main(void)

View File

@ -14,15 +14,19 @@
#include "4coder_doc_content_types.h" #include "4coder_doc_content_types.h"
#include "../docs/4ed_doc_helper.h" #include "../docs/4ed_doc_helper.h"
#include "generated/command_metadata.h"
#include "4coder_base_types.cpp" #include "4coder_base_types.cpp"
#include "4coder_stringf.cpp" #include "4coder_stringf.cpp"
#include "4coder_malloc_allocator.cpp" #include "4coder_malloc_allocator.cpp"
#include "../4ed_api_definition.cpp" #include "../4ed_api_definition.cpp"
#include "../docs/4ed_doc_content_types.cpp" #include "4coder_doc_content_types.cpp"
#include "../docs/4ed_doc_helper.cpp"
#include "4coder_file.cpp" #include "4coder_file.cpp"
#include "generated/custom_api_constructor.cpp" #include "generated/custom_api_constructor.cpp"
#include "../docs/4ed_doc_custom_api.cpp" #include "../docs/4ed_doc_custom_api.cpp"
#include "4coder_doc_commands.cpp"
#include <stdio.h> #include <stdio.h>
@ -408,7 +412,7 @@ render_doc_cluster_to_html(Arena *scratch, Doc_Cluster *cluster,
fprintf(file, "<div class=\"spacer\"></div>\n"); fprintf(file, "<div class=\"spacer\"></div>\n");
fprintf(file, "<h2><a href=\"docs/%.*s_index.html\">Index</a></h2>\n", fprintf(file, "<h2><a href=\"%.*s_index.html\">Index</a></h2>\n",
string_expand(cluster->name)); string_expand(cluster->name));
fprintf(file, html_footer); fprintf(file, html_footer);
@ -470,8 +474,9 @@ render_doc_cluster_to_html(Arena *scratch, Doc_Cluster *cluster, String_Const_u8
return; return;
} }
render_doc_cluster_to_html(scratch, cluster, render_doc_cluster_to_html(scratch, cluster, file, file_index);
file, file_index); printf("%s:1:1\n", indx_name.str);
fclose(file); fclose(file);
} }
@ -491,15 +496,23 @@ int main(){
String_Const_u8 docs_root = push_u8_stringf(&arena, "%.*sdocs/", String_Const_u8 docs_root = push_u8_stringf(&arena, "%.*sdocs/",
string_expand(site_root)); string_expand(site_root));
API_Definition *api_def = custom_api_construct(&arena); (void)root;
Doc_Cluster *cluster = doc_custom_api(&arena, api_def);
API_Definition *api_def = custom_api_construct(&arena);
Doc_Cluster *cluster_array[] = {
doc_custom_api(&arena, api_def),
doc_commands(&arena),
};
for (i32 i = 0; i < ArrayCount(cluster_array); i += 1){
Doc_Cluster *cluster = cluster_array[i];
for (Doc_Page *node = cluster->first_page; for (Doc_Page *node = cluster->first_page;
node != 0; node != 0;
node = node->next){ node = node->next){
render_doc_page_to_html(&arena, node, docs_root); render_doc_page_to_html(&arena, node, docs_root);
} }
render_doc_cluster_to_html(&arena, cluster, docs_root); render_doc_cluster_to_html(&arena, cluster, docs_root);
}
return(0); return(0);
} }