added links in the docs for CPP_NAME names

master
Allen Webster 2016-09-05 21:46:41 -04:00
parent bc7d558945
commit 161c3cc871
5 changed files with 245 additions and 231 deletions

File diff suppressed because one or more lines are too long

View File

@ -18,171 +18,130 @@
// TODO(allen): revisit this keyword data declaration system // TODO(allen): revisit this keyword data declaration system
struct String_And_Flag{ struct String_And_Flag{
char *str; String str;
uint32_t flags; uint32_t flags;
}; };
struct String_List{ static String_And_Flag preprops[] = {
String_And_Flag *data; {make_lit_string("include"), CPP_PP_INCLUDE } ,
int32_t count; {make_lit_string("INCLUDE"), CPP_PP_INCLUDE } ,
{make_lit_string("ifndef" ), CPP_PP_IFNDEF } ,
{make_lit_string("IFNDEF" ), CPP_PP_IFNDEF } ,
{make_lit_string("define" ), CPP_PP_DEFINE } ,
{make_lit_string("DEFINE" ), CPP_PP_DEFINE } ,
{make_lit_string("import" ), CPP_PP_IMPORT } ,
{make_lit_string("IMPORT" ), CPP_PP_IMPORT } ,
{make_lit_string("pragma" ), CPP_PP_PRAGMA } ,
{make_lit_string("PRAGMA" ), CPP_PP_PRAGMA } ,
{make_lit_string("undef" ), CPP_PP_UNDEF } ,
{make_lit_string("UNDEF" ), CPP_PP_UNDEF } ,
{make_lit_string("endif" ), CPP_PP_ENDIF } ,
{make_lit_string("ENDIF" ), CPP_PP_ENDIF } ,
{make_lit_string("error" ), CPP_PP_ERROR } ,
{make_lit_string("ERROR" ), CPP_PP_ERROR } ,
{make_lit_string("ifdef" ), CPP_PP_IFDEF } ,
{make_lit_string("IFDEF" ), CPP_PP_IFDEF } ,
{make_lit_string("using" ), CPP_PP_USING } ,
{make_lit_string("USING" ), CPP_PP_USING } ,
{make_lit_string("else" ), CPP_PP_ELSE } ,
{make_lit_string("ELSE" ), CPP_PP_ELSE } ,
{make_lit_string("elif" ), CPP_PP_ELIF } ,
{make_lit_string("ELIF" ), CPP_PP_ELIF } ,
{make_lit_string("line" ), CPP_PP_LINE } ,
{make_lit_string("LINE" ), CPP_PP_LINE } ,
{make_lit_string("if" ), CPP_PP_IF } ,
{make_lit_string("IF" ), CPP_PP_IF } ,
}; };
#define lexer_string_list(x) {x, (sizeof(x)/sizeof(*(x)))} static String_And_Flag keywords[] = {
{make_lit_string("true") , CPP_TOKEN_BOOLEAN_CONSTANT},
{make_lit_string("false") , CPP_TOKEN_BOOLEAN_CONSTANT},
static String_And_Flag preprop_strings[] = { {make_lit_string("and") , CPP_TOKEN_AND},
{"include", CPP_PP_INCLUDE}, {make_lit_string("and_eq") , CPP_TOKEN_ANDEQ},
{"INCLUDE", CPP_PP_INCLUDE}, {make_lit_string("bitand") , CPP_TOKEN_BIT_AND},
{"ifndef", CPP_PP_IFNDEF}, {make_lit_string("bitor") , CPP_TOKEN_BIT_OR},
{"IFNDEF", CPP_PP_IFNDEF}, {make_lit_string("or") , CPP_TOKEN_OR},
{"define", CPP_PP_DEFINE}, {make_lit_string("or_eq") , CPP_TOKEN_OREQ},
{"DEFINE", CPP_PP_DEFINE}, {make_lit_string("sizeof") , CPP_TOKEN_SIZEOF},
{"import", CPP_PP_IMPORT}, {make_lit_string("alignof") , CPP_TOKEN_ALIGNOF},
{"IMPORT", CPP_PP_IMPORT}, {make_lit_string("decltype") , CPP_TOKEN_DECLTYPE},
{"pragma", CPP_PP_PRAGMA}, {make_lit_string("throw") , CPP_TOKEN_THROW},
{"PRAGMA", CPP_PP_PRAGMA}, {make_lit_string("new") , CPP_TOKEN_NEW},
{"undef", CPP_PP_UNDEF}, {make_lit_string("delete") , CPP_TOKEN_DELETE},
{"UNDEF", CPP_PP_UNDEF}, {make_lit_string("xor") , CPP_TOKEN_BIT_XOR},
{"endif", CPP_PP_ENDIF}, {make_lit_string("xor_eq") , CPP_TOKEN_XOREQ},
{"ENDIF", CPP_PP_ENDIF}, {make_lit_string("not") , CPP_TOKEN_NOT},
{"error", CPP_PP_ERROR}, {make_lit_string("not_eq") , CPP_TOKEN_NOTEQ},
{"ERROR", CPP_PP_ERROR}, {make_lit_string("typeid") , CPP_TOKEN_TYPEID},
{"ifdef", CPP_PP_IFDEF}, {make_lit_string("compl") , CPP_TOKEN_BIT_NOT},
{"IFDEF", CPP_PP_IFDEF},
{"using", CPP_PP_USING}, {make_lit_string("void") , CPP_TOKEN_KEY_TYPE},
{"USING", CPP_PP_USING}, {make_lit_string("bool") , CPP_TOKEN_KEY_TYPE},
{"else", CPP_PP_ELSE}, {make_lit_string("char") , CPP_TOKEN_KEY_TYPE},
{"ELSE", CPP_PP_ELSE}, {make_lit_string("int") , CPP_TOKEN_KEY_TYPE},
{"elif", CPP_PP_ELIF}, {make_lit_string("float") , CPP_TOKEN_KEY_TYPE},
{"ELIF", CPP_PP_ELIF}, {make_lit_string("double") , CPP_TOKEN_KEY_TYPE},
{"line", CPP_PP_LINE},
{"LINE", CPP_PP_LINE}, {make_lit_string("long") , CPP_TOKEN_KEY_MODIFIER},
{"if", CPP_PP_IF}, {make_lit_string("short") , CPP_TOKEN_KEY_MODIFIER},
{"IF", CPP_PP_IF}, {make_lit_string("unsigned") , CPP_TOKEN_KEY_MODIFIER},
{make_lit_string("const") , CPP_TOKEN_KEY_QUALIFIER},
{make_lit_string("volatile") , CPP_TOKEN_KEY_QUALIFIER},
{make_lit_string("asm") , CPP_TOKEN_KEY_CONTROL_FLOW},
{make_lit_string("break") , CPP_TOKEN_KEY_CONTROL_FLOW},
{make_lit_string("case") , CPP_TOKEN_KEY_CONTROL_FLOW},
{make_lit_string("catch") , CPP_TOKEN_KEY_CONTROL_FLOW},
{make_lit_string("continue") , CPP_TOKEN_KEY_CONTROL_FLOW},
{make_lit_string("default") , CPP_TOKEN_KEY_CONTROL_FLOW},
{make_lit_string("do") , CPP_TOKEN_KEY_CONTROL_FLOW},
{make_lit_string("else") , CPP_TOKEN_KEY_CONTROL_FLOW},
{make_lit_string("for") , CPP_TOKEN_KEY_CONTROL_FLOW},
{make_lit_string("goto") , CPP_TOKEN_KEY_CONTROL_FLOW},
{make_lit_string("if") , CPP_TOKEN_KEY_CONTROL_FLOW},
{make_lit_string("return") , CPP_TOKEN_KEY_CONTROL_FLOW},
{make_lit_string("switch") , CPP_TOKEN_KEY_CONTROL_FLOW},
{make_lit_string("try") , CPP_TOKEN_KEY_CONTROL_FLOW},
{make_lit_string("while") , CPP_TOKEN_KEY_CONTROL_FLOW},
{make_lit_string("static_assert") , CPP_TOKEN_KEY_CONTROL_FLOW},
{make_lit_string("const_cast") , CPP_TOKEN_KEY_CAST},
{make_lit_string("dynamic_cast") , CPP_TOKEN_KEY_CAST},
{make_lit_string("reinterpret_cast") , CPP_TOKEN_KEY_CAST},
{make_lit_string("static_cast") , CPP_TOKEN_KEY_CAST},
{make_lit_string("class") , CPP_TOKEN_KEY_TYPE_DECLARATION},
{make_lit_string("enum") , CPP_TOKEN_KEY_TYPE_DECLARATION},
{make_lit_string("struct") , CPP_TOKEN_KEY_TYPE_DECLARATION},
{make_lit_string("typedef") , CPP_TOKEN_KEY_TYPE_DECLARATION},
{make_lit_string("union") , CPP_TOKEN_KEY_TYPE_DECLARATION},
{make_lit_string("template") , CPP_TOKEN_KEY_TYPE_DECLARATION},
{make_lit_string("typename") , CPP_TOKEN_KEY_TYPE_DECLARATION},
{make_lit_string("friend") , CPP_TOKEN_KEY_ACCESS},
{make_lit_string("namespace") , CPP_TOKEN_KEY_ACCESS},
{make_lit_string("private") , CPP_TOKEN_KEY_ACCESS},
{make_lit_string("protected") , CPP_TOKEN_KEY_ACCESS},
{make_lit_string("public") , CPP_TOKEN_KEY_ACCESS},
{make_lit_string("using") , CPP_TOKEN_KEY_ACCESS},
{make_lit_string("extern") , CPP_TOKEN_KEY_LINKAGE},
{make_lit_string("export") , CPP_TOKEN_KEY_LINKAGE},
{make_lit_string("inline") , CPP_TOKEN_KEY_LINKAGE},
{make_lit_string("static") , CPP_TOKEN_KEY_LINKAGE},
{make_lit_string("virtual") , CPP_TOKEN_KEY_LINKAGE},
{make_lit_string("alignas") , CPP_TOKEN_KEY_OTHER},
{make_lit_string("explicit") , CPP_TOKEN_KEY_OTHER},
{make_lit_string("noexcept") , CPP_TOKEN_KEY_OTHER},
{make_lit_string("nullptr") , CPP_TOKEN_KEY_OTHER},
{make_lit_string("operator") , CPP_TOKEN_KEY_OTHER},
{make_lit_string("register") , CPP_TOKEN_KEY_OTHER},
{make_lit_string("this") , CPP_TOKEN_KEY_OTHER},
{make_lit_string("thread_local") , CPP_TOKEN_KEY_OTHER},
}; };
static String_List preprops = lexer_string_list(preprop_strings);
static String_And_Flag keyword_strings[] = {
{"true", CPP_TOKEN_BOOLEAN_CONSTANT},
{"false", CPP_TOKEN_BOOLEAN_CONSTANT},
{"and", CPP_TOKEN_AND},
{"and_eq", CPP_TOKEN_ANDEQ},
{"bitand", CPP_TOKEN_BIT_AND},
{"bitor", CPP_TOKEN_BIT_OR},
{"or", CPP_TOKEN_OR},
{"or_eq", CPP_TOKEN_OREQ},
{"sizeof", CPP_TOKEN_SIZEOF},
{"alignof", CPP_TOKEN_ALIGNOF},
{"decltype", CPP_TOKEN_DECLTYPE},
{"throw", CPP_TOKEN_THROW},
{"new", CPP_TOKEN_NEW},
{"delete", CPP_TOKEN_DELETE},
{"xor", CPP_TOKEN_BIT_XOR},
{"xor_eq", CPP_TOKEN_XOREQ},
{"not", CPP_TOKEN_NOT},
{"not_eq", CPP_TOKEN_NOTEQ},
{"typeid", CPP_TOKEN_TYPEID},
{"compl", CPP_TOKEN_BIT_NOT},
{"void", CPP_TOKEN_KEY_TYPE},
{"bool", CPP_TOKEN_KEY_TYPE},
{"char", CPP_TOKEN_KEY_TYPE},
{"int", CPP_TOKEN_KEY_TYPE},
{"float", CPP_TOKEN_KEY_TYPE},
{"double", CPP_TOKEN_KEY_TYPE},
{"long", CPP_TOKEN_KEY_MODIFIER},
{"short", CPP_TOKEN_KEY_MODIFIER},
{"unsigned", CPP_TOKEN_KEY_MODIFIER},
{"const", CPP_TOKEN_KEY_QUALIFIER},
{"volatile", CPP_TOKEN_KEY_QUALIFIER},
{"asm", CPP_TOKEN_KEY_CONTROL_FLOW},
{"break", CPP_TOKEN_KEY_CONTROL_FLOW},
{"case", CPP_TOKEN_KEY_CONTROL_FLOW},
{"catch", CPP_TOKEN_KEY_CONTROL_FLOW},
{"continue", CPP_TOKEN_KEY_CONTROL_FLOW},
{"default", CPP_TOKEN_KEY_CONTROL_FLOW},
{"do", CPP_TOKEN_KEY_CONTROL_FLOW},
{"else", CPP_TOKEN_KEY_CONTROL_FLOW},
{"for", CPP_TOKEN_KEY_CONTROL_FLOW},
{"goto", CPP_TOKEN_KEY_CONTROL_FLOW},
{"if", CPP_TOKEN_KEY_CONTROL_FLOW},
{"return", CPP_TOKEN_KEY_CONTROL_FLOW},
{"switch", CPP_TOKEN_KEY_CONTROL_FLOW},
{"try", CPP_TOKEN_KEY_CONTROL_FLOW},
{"while", CPP_TOKEN_KEY_CONTROL_FLOW},
{"static_assert", CPP_TOKEN_KEY_CONTROL_FLOW},
{"const_cast", CPP_TOKEN_KEY_CAST},
{"dynamic_cast", CPP_TOKEN_KEY_CAST},
{"reinterpret_cast", CPP_TOKEN_KEY_CAST},
{"static_cast", CPP_TOKEN_KEY_CAST},
{"class", CPP_TOKEN_KEY_TYPE_DECLARATION},
{"enum", CPP_TOKEN_KEY_TYPE_DECLARATION},
{"struct", CPP_TOKEN_KEY_TYPE_DECLARATION},
{"typedef", CPP_TOKEN_KEY_TYPE_DECLARATION},
{"union", CPP_TOKEN_KEY_TYPE_DECLARATION},
{"template", CPP_TOKEN_KEY_TYPE_DECLARATION},
{"typename", CPP_TOKEN_KEY_TYPE_DECLARATION},
{"friend", CPP_TOKEN_KEY_ACCESS},
{"namespace", CPP_TOKEN_KEY_ACCESS},
{"private", CPP_TOKEN_KEY_ACCESS},
{"protected", CPP_TOKEN_KEY_ACCESS},
{"public", CPP_TOKEN_KEY_ACCESS},
{"using", CPP_TOKEN_KEY_ACCESS},
{"extern", CPP_TOKEN_KEY_LINKAGE},
{"export", CPP_TOKEN_KEY_LINKAGE},
{"inline", CPP_TOKEN_KEY_LINKAGE},
{"static", CPP_TOKEN_KEY_LINKAGE},
{"virtual", CPP_TOKEN_KEY_LINKAGE},
{"alignas", CPP_TOKEN_KEY_OTHER},
{"explicit", CPP_TOKEN_KEY_OTHER},
{"noexcept", CPP_TOKEN_KEY_OTHER},
{"nullptr", CPP_TOKEN_KEY_OTHER},
{"operator", CPP_TOKEN_KEY_OTHER},
{"register", CPP_TOKEN_KEY_OTHER},
{"this", CPP_TOKEN_KEY_OTHER},
{"thread_local", CPP_TOKEN_KEY_OTHER},
};
static String_List keywords = lexer_string_list(keyword_strings);
FCPP_LINK int32_t
sub_match_list(char *chunk, int32_t size, String_List list, int32_t sub_size){
int32_t result = 0;
String str_main = {0};
char *str_check = 0;
int32_t i = 0, l = 0;
result = -1;
str_main = make_string(chunk, size);
if (sub_size > 0){
str_main = substr(str_main, 0, sub_size);
for (i = 0; i < list.count; ++i){
str_check = list.data[i].str;
if (match_sc(str_main, str_check)){
result = i;
break;
}
}
}
else{
for (i = 0; i < list.count; ++i){
str_check = list.data[i].str;
if (match_part_scl(str_main, str_check, &l)){
result = i;
break;
}
}
}
return(result);
}
FCPP_LINK Cpp_Get_Token_Result FCPP_LINK Cpp_Get_Token_Result
@ -525,10 +484,12 @@ cpp_lex_nonalloc(Lex_Data *S_ptr,
} }
} }
int32_t sub_match = sub_match_list(S.tb, S.tb_pos, keywords, word_size); int32_t sub_match = -1;
string_set_match_table(keywords, sizeof(*keywords), ArrayCount(keywords),
make_string(S.tb, S.tb_pos), &sub_match);
if (sub_match != -1){ if (sub_match != -1){
String_And_Flag data = keywords.data[sub_match]; String_And_Flag data = keywords[sub_match];
S.token.type = (Cpp_Token_Type)data.flags; S.token.type = (Cpp_Token_Type)data.flags;
S.token.flags = CPP_TFLAG_IS_KEYWORD; S.token.flags = CPP_TFLAG_IS_KEYWORD;
} }
@ -560,7 +521,6 @@ cpp_lex_nonalloc(Lex_Data *S_ptr,
{ {
--S.pos; --S.pos;
int32_t word_size = S.pos - S.token_start;
int32_t pos = S.tb_pos-1; int32_t pos = S.tb_pos-1;
int32_t i = 1; int32_t i = 1;
for (;i < pos; ++i){ for (;i < pos; ++i){
@ -569,10 +529,12 @@ cpp_lex_nonalloc(Lex_Data *S_ptr,
} }
} }
int32_t sub_match = sub_match_list(S.tb+i, pos-i, preprops, word_size); int32_t sub_match = -1;
string_set_match_table(preprops, sizeof(*preprops), ArrayCount(preprops),
make_string(S.tb+i, pos-i), &sub_match);
if (sub_match != -1){ if (sub_match != -1){
String_And_Flag data = preprops.data[sub_match]; String_And_Flag data = preprops[sub_match];
S.token.type = (Cpp_Token_Type)data.flags; S.token.type = (Cpp_Token_Type)data.flags;
S.token.flags = CPP_TFLAG_PP_DIRECTIVE; S.token.flags = CPP_TFLAG_PP_DIRECTIVE;
S.pp_state = (unsigned char)cpp_pp_directive_to_state(S.token.type); S.pp_state = (unsigned char)cpp_pp_directive_to_state(S.token.type);
@ -1078,19 +1040,19 @@ cpp_token_get_pp_state(uint16_t bitfield){
// TODO(allen): Eliminate this once we actually store the EOF token // TODO(allen): Eliminate this once we actually store the EOF token
// in the token stack. // in the token stack.
FCPP_LINK Cpp_Token FCPP_LINK Cpp_Token
cpp__get_token(Cpp_Token_Stack *stack, Cpp_Token *tokens, int32_t size, int32_t index){ cpp_index_stack(Cpp_Token_Stack *stack, int32_t file_size, int32_t index){
Cpp_Token result; Cpp_Token result;
if (index < stack->count){ if (index < stack->count){
result = tokens[index]; result = stack->tokens[index];
} }
else{ else{
result.start = size; result.start = file_size;
result.size = 0; result.size = 0;
result.type = CPP_TOKEN_EOF; result.type = CPP_TOKEN_EOF;
result.flags = 0; result.flags = 0;
result.state_flags = 0; result.state_flags = 0;
} }
return result; return(result);
} }
FCPP_LINK int32_t FCPP_LINK int32_t
@ -1108,7 +1070,7 @@ cpp_relex_nonalloc_main(Cpp_Relex_State *state,
lex.pos = state->relex_start; lex.pos = state->relex_start;
int32_t relex_end_i = state->end_token_i; int32_t relex_end_i = state->end_token_i;
Cpp_Token match_token = cpp__get_token(stack, tokens, state->size, relex_end_i); Cpp_Token match_token = cpp_index_stack(stack, state->size, relex_end_i);
Cpp_Token end_token = match_token; Cpp_Token end_token = match_token;
int32_t went_too_far = false; int32_t went_too_far = false;
@ -1135,7 +1097,7 @@ cpp_relex_nonalloc_main(Cpp_Relex_State *state,
while (lex.pos > end_token.start && relex_end_i < stack->count){ while (lex.pos > end_token.start && relex_end_i < stack->count){
++relex_end_i; ++relex_end_i;
end_token = cpp__get_token(stack, tokens, state->size, relex_end_i); end_token = cpp_index_stack(stack, state->size, relex_end_i);
} }
} }
break; break;

View File

@ -426,6 +426,11 @@ typedef struct Meta_Keywords{
Item_Type type; Item_Type type;
} Meta_Keywords; } Meta_Keywords;
typedef struct Used_Links{
String *strs;
int32_t count, max;
} Used_Links;
static Item_Node null_item_node = {0}; static Item_Node null_item_node = {0};
static String static String
@ -1551,9 +1556,7 @@ compile_meta_unit(Partition *part, char **files, int32_t file_count,
++unit.set.count; ++unit.set.count;
} }
else{ else{
// TODO(allen): Convert this to a duff's routine and return // TODO(allen): Warning
// this result to the user so that they may do whatever it
// is they want to do.
} }
} }
} }
@ -1672,6 +1675,28 @@ compile_meta_unit(Partition *part, char **files, int32_t file_count,
return(unit); return(unit);
} }
static void
init_used_links(Partition *part, Used_Links *used, int32_t count){
used->strs = push_array(part, String, count);
used->count = 0;
used->max = count;
}
static int32_t
try_to_use(Used_Links *used, String str){
int32_t result = 1;
int32_t index = 0;
if (string_set_match(used->strs, used->count, str, &index)){
result = 0;
}
else{
used->strs[used->count++] = str;
}
return(result);
}
static void static void
print_struct_html(String *out, Item_Node *member){ print_struct_html(String *out, Item_Node *member){
String name = member->name; String name = member->name;
@ -1701,7 +1726,9 @@ print_struct_html(String *out, Item_Node *member){
} }
static void static void
print_function_html(String *out, String ret, char *function_call_head, String name, Argument_Breakdown breakdown){ print_function_html(String *out, Used_Links *used, String cpp_name,
String ret, char *function_call_head, String name, Argument_Breakdown breakdown){
append_ss (out, ret); append_ss (out, ret);
append_s_char (out, ' '); append_s_char (out, ' ');
append_sc (out, function_call_head); append_sc (out, function_call_head);
@ -1961,8 +1988,8 @@ print_item_in_list(String *out, String name, char *id_postfix){
} }
static void static void
print_item(String *out, Partition *part, Item_Node *item, print_item(String *out, Partition *part, Used_Links *used,
char *id_postfix, char *function_prefix, Item_Node *item, char *id_postfix, char *function_prefix,
char *section, int32_t I){ char *section, int32_t I){
Temp_Memory temp = begin_temp_memory(part); Temp_Memory temp = begin_temp_memory(part);
@ -1977,6 +2004,17 @@ print_item(String *out, Partition *part, Item_Node *item,
append_sc(out, id_postfix); append_sc(out, id_postfix);
append_sc(out, "' style='margin-bottom: 1cm;'>"); append_sc(out, "' style='margin-bottom: 1cm;'>");
int32_t has_cpp_name = 0;
if (item->cpp_name.str != 0){
if (try_to_use(used, item->cpp_name)){
append_sc(out, "<div id='");
append_ss(out, item->cpp_name);
append_sc(out, id_postfix);
append_sc(out, "'>");
has_cpp_name = 1;
}
}
append_sc (out, "<h4>&sect;"); append_sc (out, "<h4>&sect;");
append_sc (out, section); append_sc (out, section);
append_s_char (out, '.'); append_s_char (out, '.');
@ -1992,7 +2030,8 @@ print_item(String *out, Partition *part, Item_Node *item,
{ {
// NOTE(allen): Code box // NOTE(allen): Code box
Assert(function_prefix != 0); Assert(function_prefix != 0);
print_function_html(out, item->ret, function_prefix, item->name, item->breakdown); print_function_html(out, used, item->cpp_name,
item->ret, function_prefix, item->name, item->breakdown);
// NOTE(allen): Close the code box // NOTE(allen): Close the code box
append_sc(out, "</div>"); append_sc(out, "</div>");
@ -2139,6 +2178,10 @@ print_item(String *out, Partition *part, Item_Node *item,
}break; }break;
} }
if (has_cpp_name){
append_sc(out, "</div>");
}
// NOTE(allen): Close the item box // NOTE(allen): Close the item box
append_sc(out, "</div><hr>"); append_sc(out, "</div><hr>");
@ -2573,6 +2616,9 @@ generate_custom_headers(){
if (begin_file_out(&context, API_DOC, &out)){ if (begin_file_out(&context, API_DOC, &out)){
Used_Links used_links = {0};
init_used_links(part, &used_links, 4000);
append_sc(&out, append_sc(&out,
"<html lang=\"en-US\">" "<html lang=\"en-US\">"
"<head>" "<head>"
@ -2730,7 +2776,7 @@ generate_custom_headers(){
append_ss (&out, name); append_ss (&out, name);
append_sc (&out, "</h4><div style='"CODE_STYLE" "DESCRIPT_SECTION_STYLE"'>"); append_sc (&out, "</h4><div style='"CODE_STYLE" "DESCRIPT_SECTION_STYLE"'>");
print_function_html(&out, item->ret, "app->", name, item->breakdown); print_function_html(&out, &used_links, item->cpp_name, item->ret, "app->", name, item->breakdown);
append_sc(&out, "</div>"); append_sc(&out, "</div>");
print_function_docs(&out, part, name, item->doc_string); print_function_docs(&out, part, name, item->doc_string);
@ -2745,7 +2791,7 @@ generate_custom_headers(){
int32_t I = 1; int32_t I = 1;
for (int32_t i = 0; i < unit.set.count; ++i, ++I){ for (int32_t i = 0; i < unit.set.count; ++i, ++I){
print_item(&out, part, unit.set.items + i, "_doc", 0, SECTION, I); print_item(&out, part, &used_links, unit.set.items + i, "_doc", 0, SECTION, I);
} }
#undef MAJOR_SECTION #undef MAJOR_SECTION
@ -2781,7 +2827,7 @@ generate_custom_headers(){
append_sc(&out, "<h3>&sect;"SECTION" String Function Descriptions</h3>"); append_sc(&out, "<h3>&sect;"SECTION" String Function Descriptions</h3>");
for (int32_t i = 0; i < string_unit.set.count; ++i){ for (int32_t i = 0; i < string_unit.set.count; ++i){
print_item(&out, part, string_unit.set.items+i, "_doc", "", SECTION, i+1); print_item(&out, part, &used_links, string_unit.set.items+i, "_doc", "", SECTION, i+1);
} }
#undef MAJOR_SECTION #undef MAJOR_SECTION
@ -2827,7 +2873,7 @@ generate_custom_headers(){
append_sc(&out, "<h3>&sect;"SECTION" Lexer Function Descriptions</h3>"); append_sc(&out, "<h3>&sect;"SECTION" Lexer Function Descriptions</h3>");
for (int32_t i = 0; i < lexer_funcs_unit.set.count; ++i){ for (int32_t i = 0; i < lexer_funcs_unit.set.count; ++i){
print_item(&out, part, lexer_funcs_unit.set.items+i, "_doc", "", SECTION, i+1); print_item(&out, part, &used_links, lexer_funcs_unit.set.items+i, "_doc", "", SECTION, i+1);
} }
#undef SECTION #undef SECTION
@ -2835,7 +2881,7 @@ generate_custom_headers(){
append_sc(&out, "<h3>&sect;"SECTION" Lexer Type Descriptions</h3>"); append_sc(&out, "<h3>&sect;"SECTION" Lexer Type Descriptions</h3>");
for (int32_t i = 0; i < lexer_types_unit.set.count; ++i){ for (int32_t i = 0; i < lexer_types_unit.set.count; ++i){
print_item(&out, part, lexer_types_unit.set.items+i, "_doc", "", SECTION, i+1); print_item(&out, part, &used_links, lexer_types_unit.set.items+i, "_doc", "", SECTION, i+1);
} }

13
build.c
View File

@ -63,14 +63,15 @@
static char cmd[4096]; static char cmd[4096];
static int32_t error_state = 0; static int32_t error_state = 0;
static int32_t prev_error = 0;
#define systemf(...) do{ \ #define systemf(...) do{ \
int32_t n = snprintf(cmd, sizeof(cmd), __VA_ARGS__); \ int32_t n = snprintf(cmd, sizeof(cmd), __VA_ARGS__); \
assert(n < sizeof(cmd)); \ assert(n < sizeof(cmd)); \
if (system(cmd) != 0) error_state = 1; \ prev_error = system(cmd); \
if (prev_error != 0) error_state = 1; \
}while(0) }while(0)
static void init_time_system(); static void init_time_system();
static uint64_t get_time(); static uint64_t get_time();
static int32_t get_current_directory(char *buffer, int32_t max); static int32_t get_current_directory(char *buffer, int32_t max);
@ -653,7 +654,7 @@ fsm_generator(char *cdir){
END_TIME_SECTION("build fsm generator"); END_TIME_SECTION("build fsm generator");
} }
{ if (prev_error == 0){
BEGIN_TIME_SECTION(); BEGIN_TIME_SECTION();
execute(cdir, META_DIR"/fsmgen"); execute(cdir, META_DIR"/fsmgen");
END_TIME_SECTION("run fsm generator"); END_TIME_SECTION("run fsm generator");
@ -669,7 +670,7 @@ metagen(char *cdir){
END_TIME_SECTION("build metagen"); END_TIME_SECTION("build metagen");
} }
{ if (prev_error == 0){
BEGIN_TIME_SECTION(); BEGIN_TIME_SECTION();
execute(cdir, META_DIR"/metagen"); execute(cdir, META_DIR"/metagen");
END_TIME_SECTION("run metagen"); END_TIME_SECTION("run metagen");
@ -715,9 +716,9 @@ standard_build(char *cdir, uint32_t flags){
metagen(cdir); metagen(cdir);
do_buildsuper(cdir); //do_buildsuper(cdir);
build_main(cdir, flags); //build_main(cdir, flags);
} }
#define PACK_DIR "../distributions" #define PACK_DIR "../distributions"

View File

@ -1744,8 +1744,11 @@ This call returns non-zero on success.) */{
CPP_NAME(string_set_match) CPP_NAME(string_set_match)
FSTRING_LINK fstr_bool FSTRING_LINK fstr_bool
string_set_match_table(void *str_set, int32_t item_size, int32_t count, String str, int32_t *match_index)/* string_set_match_table(void *str_set, int32_t item_size, int32_t count, String str, int32_t *match_index)/*
DOC_PARAM(str_set, The str_set parameter is an array of String structs specifying matchable strings.) DOC_PARAM(str_set, The str_set parameter may be an array of any type.
DOC_PARAM(count, The count parameter specifies the number of String structs in the str_set array.) It should point at the String in the first element of the array.)
DOC_PARAM(count, The item_size parameter should describe the "stride" from one String to the next, in other
words it should be the size of one element of the array.)
DOC_PARAM(count, The count parameter specifies the number of elements in the str_set array.)
DOC_PARAM(str, The str parameter specifies the string to match against the str_set.) DOC_PARAM(str, The str parameter specifies the string to match against the str_set.)
DOC_PARAM(match_index, If this call succeeds match_index is filled with the index into str_set where the match occurred.) DOC_PARAM(match_index, If this call succeeds match_index is filled with the index into str_set where the match occurred.)
DOC(This call tries to see if str matches any of the strings in str_set. If there is a match the call DOC(This call tries to see if str matches any of the strings in str_set. If there is a match the call