new bug fixed version ready to go (4.0.13)

master
Allen Webster 2016-11-12 16:33:54 -05:00
parent 1b38d319dc
commit 3b4876022d
9 changed files with 338 additions and 634 deletions

View File

@ -237,6 +237,7 @@ OPEN_FILE_HOOK_SIG(my_file_settings){
} }
buffer_set_setting(app, &buffer, BufferSetting_WrapPosition, default_wrap_width); buffer_set_setting(app, &buffer, BufferSetting_WrapPosition, default_wrap_width);
buffer_set_setting(app, &buffer, BufferSetting_MinimumBaseWrapPosition, default_min_base_width);
buffer_set_setting(app, &buffer, BufferSetting_MapID, (treat_as_code)?((int32_t)my_code_map):((int32_t)mapid_file)); buffer_set_setting(app, &buffer, BufferSetting_MapID, (treat_as_code)?((int32_t)my_code_map):((int32_t)mapid_file));
if (treat_as_code && enable_code_wrapping && buffer.size < (1 << 18)){ if (treat_as_code && enable_code_wrapping && buffer.size < (1 << 18)){

View File

@ -810,8 +810,11 @@ CUSTOM_COMMAND_SIG(left_adjust_view){
GUI_Scroll_Vars scroll = view.scroll_vars; GUI_Scroll_Vars scroll = view.scroll_vars;
float x = get_view_x(view); float x = get_view_x(view) - 30.f;
x = x - 30.f; if (x < 0){
x = 0.f;
}
scroll.target_x = (int32_t)(x + .5f); scroll.target_x = (int32_t)(x + .5f);
view_set_scroll(app, &view, scroll); view_set_scroll(app, &view, scroll);
} }
@ -3133,14 +3136,7 @@ get_build_directory(Application_Links *app, Buffer_Summary *buffer, String *dir_
// TODO(allen): Better names for the "standard build search" family. // TODO(allen): Better names for the "standard build search" family.
static int32_t static int32_t
standard_build_search(Application_Links *app, standard_build_search(Application_Links *app, View_Summary *view, Buffer_Summary *active_buffer, String *dir, String *command, int32_t perform_backup, int32_t use_path_in_command, String filename, String commandname){
View_Summary *view,
Buffer_Summary *active_buffer,
String *dir, String *command,
int32_t perform_backup,
int32_t use_path_in_command,
String filename,
String commandname){
int32_t result = false; int32_t result = false;
for(;;){ for(;;){
@ -3489,10 +3485,11 @@ COMMAND_CALLER_HOOK(default_command_caller){
return(0); return(0);
} }
// NOTE(allen|a4.0.12): A primordial config system (actually really hate this but it seems best) // NOTE(allen|a4.0.12): A primordial config system (actually really hate this but it seems best at least right now... arg)
static bool32 enable_code_wrapping = 1; static bool32 enable_code_wrapping = 1;
static int32_t default_wrap_width = 672; static int32_t default_wrap_width = 672;
static int32_t default_min_base_width = 550;
#include <stdio.h> #include <stdio.h>
@ -3558,6 +3555,13 @@ process_config_file(Application_Links *app){
default_wrap_width = str_to_int(val); default_wrap_width = str_to_int(val);
} }
} }
else if (match(id, "default_min_base_width")){
if (val_token.type == CPP_TOKEN_INTEGER_CONSTANT){
String val = make_string(mem + val_token.start, val_token.size);
default_min_base_width = str_to_int(val);
}
}
} }
} }
} }

View File

@ -1,6 +1,6 @@
#define MAJOR 4 #define MAJOR 4
#define MINOR 0 #define MINOR 0
#define PATCH 12 #define PATCH 13
#define VN__(a,b,c) #a"."#b"."#c #define VN__(a,b,c) #a"."#b"."#c
#define VN_(a,b,c) VN__(a,b,c) #define VN_(a,b,c) VN__(a,b,c)

View File

@ -4,6 +4,8 @@ The implementation for the custom API
// TOP // TOP
#define API_EXPORT
inline b32 inline b32
access_test(u32 lock_flags, u32 access_flags){ access_test(u32 lock_flags, u32 access_flags){
b32 result = 0; b32 result = 0;
@ -153,15 +155,12 @@ imp_get_view(Command_Data *cmd, View_Summary *view){
return(vptr); return(vptr);
} }
#define API_EXPORT
API_EXPORT bool32 API_EXPORT bool32
Exec_Command(Application_Links *app, Command_ID command_id) Exec_Command(Application_Links *app, Command_ID command_id)
/* /*
DOC_PARAM(command_id, The command_id parameter specifies which internal command to execute.) DOC_PARAM(command_id, The command_id parameter specifies which internal command to execute.)
DOC_RETURN(This call returns non-zero if command_id named a valid internal command.) DOC_RETURN(This call returns non-zero if command_id named a valid internal command.)
DOC(A call to exec_command executes an internal command. DOC(A call to exec_command executes an internal command. If command_id is invalid a warning is posted to *messages*.)
If command_id is invalid a warning is posted to *messages*.)
DOC_SEE(Command_ID) DOC_SEE(Command_ID)
*/{ */{
bool32 result = false; bool32 result = false;
@ -721,15 +720,18 @@ DOC_RETURN(returns non-zero on success)
int32_t result = 0; int32_t result = 0;
if (file){ if (file){
result = 1;
switch (setting){ switch (setting){
case BufferSetting_Lex: result = file->settings.tokens_exist; break; case BufferSetting_Lex: *value_out = file->settings.tokens_exist; break;
case BufferSetting_WrapLine: result = !file->settings.unwrapped_lines; break; case BufferSetting_WrapLine: *value_out = !file->settings.unwrapped_lines; break;
case BufferSetting_WrapPosition: result = file->settings.display_width; break; case BufferSetting_WrapPosition: *value_out = file->settings.display_width; break;
case BufferSetting_MapID: result = file->settings.base_map_id; break; case BufferSetting_MinimumBaseWrapPosition: *value_out = file->settings.minimum_base_display_width; break;
case BufferSetting_Eol: result = file->settings.dos_write_mode; break; case BufferSetting_MapID: *value_out = file->settings.base_map_id; break;
case BufferSetting_Unimportant: result = file->settings.unimportant; break; case BufferSetting_Eol: *value_out = file->settings.dos_write_mode; break;
case BufferSetting_ReadOnly: result = file->settings.read_only; break; case BufferSetting_Unimportant: *value_out = file->settings.unimportant; break;
case BufferSetting_VirtualWhitespace: result = file->settings.virtual_white; break; case BufferSetting_ReadOnly: *value_out = file->settings.read_only; break;
case BufferSetting_VirtualWhitespace: *value_out = file->settings.virtual_white; break;
default: result = 0; break;
} }
} }
@ -1542,12 +1544,14 @@ DOC_RETURN(returns non-zero on success)
*/{ */{
Command_Data *cmd = (Command_Data*)app->cmd_context; Command_Data *cmd = (Command_Data*)app->cmd_context;
View *vptr = imp_get_view(cmd, view); View *vptr = imp_get_view(cmd, view);
int32_t result = -1; int32_t result = 0;
if (vptr){ if (vptr){
result = 1;
switch (setting){ switch (setting){
case ViewSetting_ShowWhitespace: result = vptr->file_data.show_whitespace; break; case ViewSetting_ShowWhitespace: *value_out = vptr->file_data.show_whitespace; break;
case ViewSetting_ShowScrollbar: result = !vptr->hide_scrollbar; break; case ViewSetting_ShowScrollbar: *value_out = !vptr->hide_scrollbar; break;
default: result = 0; break;
} }
} }

View File

@ -1549,7 +1549,10 @@ file_measure_wraps(System_Functions *system, Models *models, Editing_File *file,
if (use_tokens){ if (use_tokens){
Code_Wrap_State original_wrap_state = wrap_state; Code_Wrap_State original_wrap_state = wrap_state;
i32 next_line_start = params.buffer->line_starts[stop.line_index+1]; i32 next_line_start = buffer_size(params.buffer);
if (stop.line_index+1 < params.buffer->line_count){
next_line_start = params.buffer->line_starts[stop.line_index+1];
}
f32 base_adjusted_width = wrap_state.wrap_x.base_x + minimum_base_width; f32 base_adjusted_width = wrap_state.wrap_x.base_x + minimum_base_width;
@ -1580,7 +1583,8 @@ file_measure_wraps(System_Functions *system, Models *models, Editing_File *file,
b32 emit_comment_position = 0; b32 emit_comment_position = 0;
b32 first_word = 1; b32 first_word = 1;
if (wrap_state.token_ptr->type == CPP_TOKEN_COMMENT){ if (wrap_state.token_ptr->type == CPP_TOKEN_COMMENT ||
wrap_state.token_ptr->type == CPP_TOKEN_STRING_CONSTANT){
i32 i = wrap_state.token_ptr->start; i32 i = wrap_state.token_ptr->start;
i32 end_i = i + wrap_state.token_ptr->size; i32 end_i = i + wrap_state.token_ptr->size;
@ -1610,6 +1614,18 @@ file_measure_wraps(System_Functions *system, Models *models, Editing_File *file,
if (buffer_stringify_loop(&stream, params.buffer, i, end_i)){ if (buffer_stringify_loop(&stream, params.buffer, i, end_i)){
b32 still_looping = 1; b32 still_looping = 1;
while(still_looping){
for (; i < stream.end; ++i){
u8 ch = stream.data[i];
if (!char_is_whitespace(ch)){
goto doublebreak_stage_vspace;
}
}
still_looping = buffer_stringify_next(&stream);
}
doublebreak_stage_vspace:;
do{ do{
while (still_looping){ while (still_looping){
for (; i < stream.end; ++i){ for (; i < stream.end; ++i){

View File

@ -822,17 +822,17 @@ do_buildsuper(char *cdir){
//terminate_with_null(&str); //terminate_with_null(&str);
//buildsuper(cdir, BUILD_DIR, str.str); //buildsuper(cdir, BUILD_DIR, str.str);
#if defined(IS_WINDOWS) #if defined(IS_WINDOWS)
//copy_sc(&str, "../code/internal_4coder_tests.cpp"); copy_sc(&str, "../code/internal_4coder_tests.cpp");
//terminate_with_null(&str); terminate_with_null(&str);
//buildsuper(cdir, BUILD_DIR, str.str); buildsuper(cdir, BUILD_DIR, str.str);
#else #else
copy_sc(&str, "../code/power/4coder_experiments.cpp"); copy_sc(&str, "../code/power/4coder_experiments.cpp");
terminate_with_null(&str); terminate_with_null(&str);
buildsuper(cdir, BUILD_DIR, str.str); buildsuper(cdir, BUILD_DIR, str.str);
#endif #endif
copy_sc(&str, "../code/power/4coder_casey.cpp"); //copy_sc(&str, "../code/power/4coder_casey.cpp");
terminate_with_null(&str); //terminate_with_null(&str);
buildsuper(cdir, BUILD_DIR, str.str); //buildsuper(cdir, BUILD_DIR, str.str);
//copy_sc(&str, "../4vim/4coder_chronal.cpp"); //copy_sc(&str, "../4vim/4coder_chronal.cpp");
//terminate_with_null(&str); //terminate_with_null(&str);
//buildsuper(cdir, BUILD_DIR, str.str); //buildsuper(cdir, BUILD_DIR, str.str);

View File

@ -1763,15 +1763,12 @@ This call returns non-zero on success.) */{
CPP_NAME(string_set_match) CPP_NAME(string_set_match)
API_EXPORT FSTRING_LINK fstr_bool API_EXPORT 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 may be an array of any type. DOC_PARAM(str_set, The str_set parameter may be an array of any type. It should point at the String in the first element of the 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 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(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 succeeds and returns non-zero. The matching rule is equivalent to the matching rule for match.)
succeeds and returns non-zero. The matching rule is equivalent to the matching rule for match.)
DOC_SEE(match) */{ DOC_SEE(match) */{
fstr_bool result = 0; fstr_bool result = 0;
int32_t i = 0; int32_t i = 0;
@ -1792,15 +1789,19 @@ DOC_PARAM(str_set, The str_set parameter is an array of String structs specifyin
DOC_PARAM(count, The count parameter specifies the number of String structs in the str_set array.) DOC_PARAM(count, The count parameter specifies the number of String structs 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 succeeds and returns non-zero. The matching rule is equivalent to the matching rule for match.)
succeeds and returns non-zero. The matching rule is equivalent to the matching rule for match.)
DOC_SEE(match) */{ DOC_SEE(match) */{
fstr_bool result = string_set_match_table(str_set, sizeof(String), count, str, match_index); fstr_bool result = string_set_match_table(str_set, sizeof(String), count, str, match_index);
return(result); return(result);
} }
API_EXPORT FSTRING_LINK String API_EXPORT FSTRING_LINK String
get_first_double_line(String source){ get_first_double_line(String source)/*
DOC_PARAM(source, the source string accross which a 'double line' iteration will occur)
DOC_RETURN(The returned value is the first 'double line' in the source string.)
DOC(A 'double line' is a string of characters delimited by two new line characters. This call begins an iteration over all the double lines in the given source string.)
DOC_SEE(get_next_double_line)
*/{
String line = {0}; String line = {0};
int32_t pos0 = find_substr_s(source, 0, make_lit_string("\n\n")); int32_t pos0 = find_substr_s(source, 0, make_lit_string("\n\n"));
int32_t pos1 = find_substr_s(source, 0, make_lit_string("\r\n\r\n")); int32_t pos1 = find_substr_s(source, 0, make_lit_string("\r\n\r\n"));
@ -1812,7 +1813,12 @@ get_first_double_line(String source){
} }
API_EXPORT FSTRING_LINK String API_EXPORT FSTRING_LINK String
get_next_double_line(String source, String line){ get_next_double_line(String source, String line)/*
DOC_PARAM(source, the source string accross which the 'double line' iteration is occurring)
DOC_PARAM(line, the value returned from the previous call of get_first_double_line or get_next_double_line)
DOC_RETURN(The returned value is the first 'double line' in the source string.)
DOC_SEE(get_first_double_line)
*/{
String next = {0}; String next = {0};
int32_t pos = (int32_t)(line.str - source.str) + line.size; int32_t pos = (int32_t)(line.str - source.str) + line.size;
int32_t start = 0, pos0 = 0, pos1 = 0; int32_t start = 0, pos0 = 0, pos1 = 0;
@ -1835,7 +1841,12 @@ get_next_double_line(String source, String line){
} }
API_EXPORT FSTRING_LINK String API_EXPORT FSTRING_LINK String
get_next_word(String source, String prev_word){ get_next_word(String source, String prev_word)/*
DOC_PARAM(source, the source string accross which the 'word' iteration is occurring)
DOC_PARAM(line, the value returned from the previous call of get_first_word or get_next_word)
DOC_RETURN(The returned value is the first 'word' in the source string.)
DOC_SEE(get_first_word)
*/{
String word = {0}; String word = {0};
int32_t pos0 = (int32_t)(prev_word.str - source.str) + prev_word.size; int32_t pos0 = (int32_t)(prev_word.str - source.str) + prev_word.size;
@ -1864,7 +1875,12 @@ get_next_word(String source, String prev_word){
} }
API_EXPORT FSTRING_LINK String API_EXPORT FSTRING_LINK String
get_first_word(String source){ get_first_word(String source)/*
DOC_PARAM(source, the source string accross which a 'word' iteration will occur)
DOC_RETURN(The returned value is the first 'word' in the source string.)
DOC(A 'word' is a string of characters delimited by whitespace or parentheses. This call begins an iteration over all the double lines in the given source string.)
DOC_SEE(get_next_word)
*/{
String start_str = make_string(source.str, 0); String start_str = make_string(source.str, 0);
String word = get_next_word(source, start_str); String word = get_next_word(source, start_str);
return(word); return(word);

Binary file not shown.

View File

@ -289,342 +289,8 @@ generate_site(char *code_directory, char *src_directory, char *dst_directory){
Out_Context context = {0}; Out_Context context = {0};
set_context_directory(&context, dst_directory); set_context_directory(&context, dst_directory);
// Output Docs - General Document Generator // Output Docs
if (begin_file_out(&context, "gen-test.html", &out)){
generate_document_html(&out, part, &doc);
end_file_out(context);
}
else{
// TODO(allen): warning
}
// Output Docs - Direct Method
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,
"<html lang=\"en-US\">"
"<head>"
"<title>4coder API Docs</title>"
"<style>"
"body { "
"background: " BACK_COLOR "; "
"color: " TEXT_COLOR "; "
"}"
// H things
"h1,h2,h3,h4 { "
"color: " POP_COLOR_1 "; "
"margin: 0; "
"}"
"h2 { "
"margin-top: 6mm; "
"}"
"h3 { "
"margin-top: 5mm; margin-bottom: 5mm; "
"}"
"h4 { "
"font-size: 1.1em; "
"}"
// ANCHORS
"a { "
"color: " POP_COLOR_1 "; "
"text-decoration: none; "
"}"
"a:visited { "
"color: " VISITED_LINK "; "
"}"
"a:hover { "
"background: " POP_BACK_1 "; "
"}"
// LIST
"ul { "
"list-style: none; "
"padding: 0; "
"margin: 0; "
"}"
"</style>"
"</head>\n"
"<body>"
"<div style='font-family:Arial; margin: 0 auto; "
"width: 800px; text-align: justify; line-height: 1.25;'>"
//"<h1 style='margin-top: 5mm; margin-bottom: 5mm;'>4cpp Lexing Library</h1>");
"<h1 style='margin-top: 5mm; margin-bottom: 5mm;'>4coder API Docs</h1>");
struct Section{
char *id_string;
char *display_string;
};
static int32_t msection = -1;
static Section sections[] = {
{"introduction", "Introduction"},
{"4coder_systems", "4coder Systems"},
{"types_and_functions", "Types and Functions"},
{"string_library", "String Library"},
{"lexer_library", "Lexer Library"}
};
append_sc(&out, "<h3 style='margin:0;'>Table of Contents</h3><ul>");
int32_t section_count = ArrayCount(sections);
for (int32_t i = 0; i < section_count; ++i){
append_sc (&out, "<li><a href='#section_");
append_sc (&out, sections[i].id_string);
append_sc (&out, "'>&sect;");
append_int_to_str (&out, i+1);
append_s_char (&out, ' ');
append_sc (&out, sections[i].display_string);
append_sc (&out, "</a></li>");
}
append_sc(&out, "</ul>");
#define MAJOR_SECTION "1"
msection = 0;
append_sc(&out, "\n<h2 id='section_");
append_sc(&out, sections[msection].id_string);
append_sc(&out, "'>&sect;"MAJOR_SECTION" ");
append_sc(&out, sections[msection].display_string);
append_sc(&out, "</h2>");
#if 0
// NOTE(allen): doc intro for lexer standalone
append_sc(&out,
"<div>"
"<p>This is the documentation for the 4cpp lexer version 1.1. "
"The documentation is the newest piece of this lexer project "
"so it may still have problems. What is here should be correct "
"and mostly complete.</p>"
"<p>If you have questions or discover errors please contact "
"<span style='"CODE_STYLE"'>editor@4coder.net</span> or "
"to get help from community members you can post on the "
"4coder forums hosted on handmade.network at "
"<span style='"CODE_STYLE"'>4coder.handmade.network</span>.</p>"
"</div>");
#endif
append_sc(&out,
"<div>"
"<p>This is the documentation for " VERSION ". The documentation is still "
"under construction so some of the links are linking to sections that "
"have not been written yet. What is here should be correct and I suspect "
"useful even without some of the other sections.</p>"
"<p>If you have questions or discover errors please contact "
"<span style='"CODE_STYLE"'>editor@4coder.net</span> or "
"to get help from members of the 4coder and handmade network community you "
"can post on the 4coder forums hosted at "
"<span style='"CODE_STYLE"'>4coder.handmade.network</span>.</p>"
"</div>");
#undef MAJOR_SECTION
#define MAJOR_SECTION "2"
msection = 1;
// TODO(allen): Write the 4coder system descriptions.
append_sc(&out, "\n<h2 id='section_");
append_sc(&out, sections[msection].id_string);
append_sc(&out, "'>&sect;"MAJOR_SECTION" ");
append_sc(&out, sections[msection].display_string);
append_sc(&out, "</h2>");
append_sc(&out, "<div><i>Coming Soon</i><div>");
#undef MAJOR_SECTION
#define MAJOR_SECTION "3"
msection = 2;
append_sc(&out, "\n<h2 id='section_");
append_sc(&out, sections[msection].id_string);
append_sc(&out, "'>&sect;"MAJOR_SECTION" ");
append_sc(&out, sections[msection].display_string);
append_sc(&out, "</h2>");
#undef SECTION
#define SECTION MAJOR_SECTION".1"
append_sc(&out, "<h3>&sect;"SECTION" Function List</h3><ul>");
for (int32_t i = 0; i < custom_funcs_unit.set.count; ++i){
print_item_in_list(&out, custom_func_names.names[i].public_name, "_doc");
}
append_sc(&out, "</ul>");
#undef SECTION
#define SECTION MAJOR_SECTION".2"
append_sc(&out, "<h3>&sect;"SECTION" Type List</h3><ul>");
for (int32_t i = 0; i < custom_types_unit.set.count; ++i){
print_item_in_list(&out, custom_types_unit.set.items[i].name, "_doc");
}
append_sc(&out, "</ul>");
#undef SECTION
#define SECTION MAJOR_SECTION".3"
append_sc(&out, "<h3>&sect;"SECTION" Function Descriptions</h3>");
for (int32_t i = 0; i < custom_funcs_unit.set.count; ++i){
Item_Node *item = &custom_funcs_unit.set.items[i];
String name = custom_func_names.names[i].public_name;
append_sc (&out, "<div id='");
append_ss (&out, name);
append_sc (&out, "_doc' style='margin-bottom: 1cm;'>");
append_sc (&out, "<h4>&sect;"SECTION".");
append_int_to_str(&out, i+1);
append_sc (&out, ": ");
append_ss (&out, name);
append_sc (&out, "</h4><div style='"CODE_STYLE" "DESCRIPT_SECTION_STYLE"'>");
print_function_html(&out, &used_links, item->cpp_name, item->ret, "", name, item->breakdown);
append_sc(&out, "</div>");
print_function_docs(&out, part, name, item->doc_string);
append_sc(&out, "</div><hr>");
}
#undef SECTION
#define SECTION MAJOR_SECTION".4"
append_sc(&out, "<h3>&sect;"SECTION" Type Descriptions</h3>");
int32_t I = 1;
for (int32_t i = 0; i < custom_types_unit.set.count; ++i, ++I){
print_item_html(&out, part, &used_links, custom_types_unit.set.items + i, "_doc", SECTION, I, 0, 0);
}
#undef MAJOR_SECTION
#define MAJOR_SECTION "4"
msection = 3;
append_sc(&out, "\n<h2 id='section_");
append_sc(&out, sections[msection].id_string);
append_sc(&out, "'>&sect;"MAJOR_SECTION" ");
append_sc(&out, sections[msection].display_string);
append_sc(&out, "</h2>");
#undef SECTION
#define SECTION MAJOR_SECTION".1"
append_sc(&out, "<h3>&sect;"SECTION" String Library Intro</h3>");
append_sc(&out, "<div><i>Coming Soon</i><div>");
#undef SECTION
#define SECTION MAJOR_SECTION".2"
append_sc(&out, "<h3>&sect;"SECTION" String Function List</h3>");
append_sc(&out, "<ul>");
for (int32_t i = 0; i < string_unit.set.count; ++i){
print_item_in_list(&out, string_unit.set.items[i].name, "_doc");
}
append_sc(&out, "</ul>");
#undef SECTION
#define SECTION MAJOR_SECTION".3"
append_sc(&out, "<h3>&sect;"SECTION" String Function Descriptions</h3>");
for (int32_t i = 0; i < string_unit.set.count; ++i){
print_item_html(&out, part, &used_links, string_unit.set.items+i, "_doc", SECTION, i+1, 0, 0);
}
#undef MAJOR_SECTION
#define MAJOR_SECTION "5"
msection = 4;
append_sc(&out, "\n<h2 id='section_");
append_sc(&out, sections[msection].id_string);
append_sc(&out, "'>&sect;"MAJOR_SECTION" ");
append_sc(&out, sections[msection].display_string);
append_sc(&out, "</h2>");
#undef SECTION
#define SECTION MAJOR_SECTION".1"
append_sc(&out, "<h3>&sect;"SECTION" Lexer Intro</h3>");
append_sc(&out,
"<div>"
"<p>The 4cpp lexer system provides a polished, fast, flexible system that "
"takes in C/C++ and outputs a tokenization of the text data. There are "
"two API levels. One level is setup to let you easily get a tokenization "
"of the file. This level manages memory for you with malloc to make it "
"as fast as possible to start getting your tokens. The second level "
"enables deep integration by allowing control over allocation, data "
"chunking, and output rate control.</p>"
"<p>To use the quick setup API you simply include 4cpp_lexer.h and read the "
"documentation at <a href='#cpp_lex_file_doc'>cpp_lex_file</a>.</p>"
"<p>To use the the fancier API include 4cpp_lexer.h and read the "
"documentation at <a href='#cpp_lex_step_doc'>cpp_lex_step</a>. "
"If you want to be absolutely sure you are not including malloc into "
"your program you can define FCPP_FORBID_MALLOC before the include and "
"the \"step\" API will continue to work.</p>"
"<p>There are a few more features in 4cpp that are not documented yet. "
"You are free to try to use these, but I am not totally sure they are "
"ready yet, and when they are they will be documented.</p>"
"</div>");
#undef SECTION
#define SECTION MAJOR_SECTION".2"
append_sc(&out, "<h3>&sect;"SECTION" Lexer Function List</h3>");
append_sc(&out, "<ul>");
for (int32_t i = 0; i < lexer_funcs_unit.set.count; ++i){
print_item_in_list(&out, lexer_funcs_unit.set.items[i].name, "_doc");
}
append_sc(&out, "</ul>");
#undef SECTION
#define SECTION MAJOR_SECTION".3"
append_sc(&out, "<h3>&sect;"SECTION" Lexer Type List</h3>");
append_sc(&out, "<ul>");
for (int32_t i = 0; i < lexer_types_unit.set.count; ++i){
print_item_in_list(&out, lexer_types_unit.set.items[i].name, "_doc");
}
append_sc(&out, "</ul>");
#undef SECTION
#define SECTION MAJOR_SECTION".4"
append_sc(&out, "<h3>&sect;"SECTION" Lexer Function Descriptions</h3>");
for (int32_t i = 0; i < lexer_funcs_unit.set.count; ++i){
print_item_html(&out, part, &used_links, lexer_funcs_unit.set.items+i, "_doc", SECTION, i+1, 0, 0);
}
#undef SECTION
#define SECTION MAJOR_SECTION".5"
append_sc(&out, "<h3>&sect;"SECTION" Lexer Type Descriptions</h3>");
for (int32_t i = 0; i < lexer_types_unit.set.count; ++i){
print_item_html(&out, part, &used_links, lexer_types_unit.set.items+i, "_doc", SECTION, i+1, 0, 0);
}
append_sc(&out, "</div></body></html>");
end_file_out(context);
}
else{
// TODO(allen): warning
}
// Here to test the file equality tester
// Output Docs - General Document Generator
if (begin_file_out(&context, "gen-test2.html", &out)){
generate_document_html(&out, part, &doc); generate_document_html(&out, part, &doc);
end_file_out(context); end_file_out(context);
} }
@ -632,9 +298,6 @@ generate_site(char *code_directory, char *src_directory, char *dst_directory){
// TODO(allen): warning // TODO(allen): warning
} }
assert_files_are_equal(dst_directory, API_DOC, API_DOC);
assert_files_are_equal(dst_directory, "gen-test.html", "gen-test2.html");
assert_files_are_equal(dst_directory, API_DOC, "gen-test.html");
} }
int main(int argc, char **argv){ int main(int argc, char **argv){