diff --git a/4coder_default_include.cpp b/4coder_default_include.cpp index 6f7376c7..54632ec4 100644 --- a/4coder_default_include.cpp +++ b/4coder_default_include.cpp @@ -404,7 +404,7 @@ buffer_seek_delimiter_forward(Application_Links *app, Buffer_Summary *buffer, static void buffer_seek_delimiter_backward(Application_Links *app, Buffer_Summary *buffer, - int32_t pos, char delim, int32_t *result){ + int32_t pos, char delim, int32_t *result){ if (buffer->exists){ char chunk[1024]; int32_t size = sizeof(chunk); @@ -1404,7 +1404,7 @@ buffer_seek_whitespace_up(Application_Links *app, Buffer_Summary *buffer, int32_ ++pos; } } - + return(pos); } @@ -1479,8 +1479,8 @@ CUSTOM_COMMAND_SIG(seek_whitespace_up){ int32_t new_pos = buffer_seek_whitespace_up(app, &buffer, view.cursor.pos); view_set_cursor(app, &view, - seek_pos(new_pos), - true); + seek_pos(new_pos), + true); } CUSTOM_COMMAND_SIG(seek_whitespace_down){ @@ -1490,8 +1490,8 @@ CUSTOM_COMMAND_SIG(seek_whitespace_down){ int32_t new_pos = buffer_seek_whitespace_down(app, &buffer, view.cursor.pos); view_set_cursor(app, &view, - seek_pos(new_pos), - true); + seek_pos(new_pos), + true); } CUSTOM_COMMAND_SIG(seek_end_of_textual_line){ @@ -2053,18 +2053,18 @@ CUSTOM_COMMAND_SIG(if0_off){ edits[1].end = range.max; buffer_batch_edit(app,&buffer, - base, global_part.pos, - edits, ArrayCount(edits), BatchEdit_Normal); + base, global_part.pos, + edits, ArrayCount(edits), BatchEdit_Normal); view = get_view(app, view.view_id, AccessAll); if (view.cursor.pos > view.mark.pos){ view_set_cursor(app, &view, - seek_line_char(view.cursor.line+1, view.cursor.character), - true); + seek_line_char(view.cursor.line+1, view.cursor.character), + true); } else{ view_set_mark(app, &view, - seek_line_char(view.mark.line+1, view.mark.character)); + seek_line_char(view.mark.line+1, view.mark.character)); } range = get_range(&view); @@ -2623,10 +2623,10 @@ CUSTOM_COMMAND_SIG(execute_any_cli){ View_Summary view = get_active_view(app, access); exec_system_command(app, &view, - buffer_identifier(bar_out.string.str, bar_out.string.size), - hot_directory.str, hot_directory.size, - bar_cmd.string.str, bar_cmd.string.size, - CLI_OverlapWithConflict | CLI_CursorAtEnd); + buffer_identifier(bar_out.string.str, bar_out.string.size), + hot_directory.str, hot_directory.size, + bar_cmd.string.str, bar_cmd.string.size, + CLI_OverlapWithConflict | CLI_CursorAtEnd); } CUSTOM_COMMAND_SIG(execute_previous_cli){ @@ -2639,10 +2639,10 @@ CUSTOM_COMMAND_SIG(execute_previous_cli){ View_Summary view = get_active_view(app, access); exec_system_command(app, &view, - buffer_identifier(out_buffer.str, out_buffer.size), - hot_directory.str, hot_directory.size, - cmd.str, cmd.size, - CLI_OverlapWithConflict | CLI_CursorAtEnd); + buffer_identifier(out_buffer.str, out_buffer.size), + hot_directory.str, hot_directory.size, + cmd.str, cmd.size, + CLI_OverlapWithConflict | CLI_CursorAtEnd); } } @@ -2665,7 +2665,7 @@ CUSTOM_COMMAND_SIG(increase_line_wrap){ Buffer_Summary buffer = get_buffer(app, view.buffer_id, AccessProtected); int32_t wrap = 0; - buffer_get_setting(app, &buffer, BufferSetting_WrapPosition, &wrap); + buffer_get_setting(app, &buffer, BufferSetting_WrapPosition, &wrap); buffer_set_setting(app, &buffer, BufferSetting_WrapPosition, wrap + 10); } @@ -2984,7 +2984,7 @@ CUSTOM_COMMAND_SIG(word_complete){ complete_state.initialized = true; search_iter_init(&global_general, &complete_state.iter, size); buffer_read_range(app, &buffer, word_start, word_end, - complete_state.iter.word.str); + complete_state.iter.word.str); complete_state.iter.word.size = size; // NOTE(allen): Initialize the set of ranges to be searched. @@ -3045,15 +3045,15 @@ CUSTOM_COMMAND_SIG(word_complete){ char *spare = push_array(&global_part, char, match_size); buffer_read_range(app, &match.buffer, - match.start, match.end, spare); + match.start, match.end, spare); if (search_hit_add(&global_general, &complete_state.hits, &complete_state.str, spare, match_size)){ buffer_replace_range(app, &buffer, word_start, word_end, - spare, match_size); + spare, match_size); view_set_cursor(app, &view, - seek_pos(word_start + match_size), - true); + seek_pos(word_start + match_size), + true); complete_state.word_end = word_start + match_size; complete_state.set.ranges[0].mid_size = match_size; @@ -3075,10 +3075,10 @@ CUSTOM_COMMAND_SIG(word_complete){ match_size = complete_state.iter.word.size; char *str = complete_state.iter.word.str; buffer_replace_range(app, &buffer, word_start, word_end, - str, match_size); + str, match_size); view_set_cursor(app, &view, - seek_pos(word_start + match_size), - true); + seek_pos(word_start + match_size), + true); complete_state.word_end = word_start + match_size; complete_state.set.ranges[0].mid_size = match_size; @@ -3124,7 +3124,7 @@ get_build_directory(Application_Links *app, Buffer_Summary *buffer, String *dir_ if (!result){ int32_t len = directory_get_hot(app, dir_out->str, - dir_out->memory_size - dir_out->size); + dir_out->memory_size - dir_out->size); if (len + dir_out->size < dir_out->memory_size){ dir_out->size += len; result = BuildDir_AtHot; @@ -3165,10 +3165,10 @@ standard_build_search(Application_Links *app, View_Summary *view, Buffer_Summary exec_system_command(app, view, - buffer_identifier(literal("*compilation*")), - dir->str, dir->size, - command->str, command->size, - CLI_OverlapWithConflict); + buffer_identifier(literal("*compilation*")), + dir->str, dir->size, + command->str, command->size, + CLI_OverlapWithConflict); result = true; break; } @@ -3182,10 +3182,10 @@ standard_build_search(Application_Links *app, View_Summary *view, Buffer_Summary append_ss(&backup_command, make_lit_string("echo could not find ")); append_ss(&backup_command, filename); exec_system_command(app, view, - buffer_identifier(literal("*compilation*")), - dir->str, dir->size, - backup_command.str, backup_command.size, - CLI_OverlapWithConflict); + buffer_identifier(literal("*compilation*")), + dir->str, dir->size, + backup_command.str, backup_command.size, + CLI_OverlapWithConflict); } break; } @@ -3445,14 +3445,14 @@ SCROLL_RULE_SIG(smooth_scroll_rule){ velocity->x = 1.f; velocity->y = 1.f; } - + if (smooth_camera_step(target_y, scroll_y, &velocity->y, 80.f, 1.f/2.f)){ result = 1; } if (smooth_camera_step(target_x, scroll_x, &velocity->x, 80.f, 1.f/2.f)){ result = 1; } - + return(result); } @@ -3495,88 +3495,88 @@ process_config_file(Application_Links *app){ fseek(file, 0, SEEK_SET); int32_t check_size = (int32_t)fread(mem, 1, size, file); if (check_size == size){ - mem[size] = 0; - fclose(file); - - Cpp_Token_Array array; - array.count = 0; - array.max_count = (1 << 20)/sizeof(Cpp_Token); - array.tokens = push_array(&global_part, Cpp_Token, array.max_count); - - Cpp_Lex_Data S = cpp_lex_data_init(); - Cpp_Lex_Result result = cpp_lex_step(&S, mem, size+1, HAS_NULL_TERM, &array, NO_OUT_LIMIT); - - if (result == LexResult_Finished){ + mem[size] = 0; + fclose(file); - for (int32_t i = 0; i < array.count; ++i){ - int32_t read_setting_failed = 1; - Cpp_Token id_token = array.tokens[i]; - if (id_token.type == CPP_TOKEN_IDENTIFIER){ - ++i; - if (i < array.count){ - Cpp_Token eq_token = array.tokens[i]; - if (eq_token.type == CPP_TOKEN_EQ){ - ++i; - if (i < array.count){ - Cpp_Token val_token = array.tokens[i]; - { - ++i; - if (i < array.count){ - Cpp_Token semicolon_token = array.tokens[i]; - if (semicolon_token.type == CPP_TOKEN_SEMICOLON){ - read_setting_failed = 0; - - String id = make_string(mem + id_token.start, id_token.size); - - if (match(id, "enable_code_wrapping")){ - if (val_token.type == CPP_TOKEN_BOOLEAN_CONSTANT){ - String val = make_string(mem + val_token.start, val_token.size); - if (val.str[0] == 't'){ - enable_code_wrapping = 1; - } - else{ - enable_code_wrapping = 0; + Cpp_Token_Array array; + array.count = 0; + array.max_count = (1 << 20)/sizeof(Cpp_Token); + array.tokens = push_array(&global_part, Cpp_Token, array.max_count); + + Cpp_Lex_Data S = cpp_lex_data_init(); + Cpp_Lex_Result result = cpp_lex_step(&S, mem, size+1, HAS_NULL_TERM, &array, NO_OUT_LIMIT); + + if (result == LexResult_Finished){ + + for (int32_t i = 0; i < array.count; ++i){ + int32_t read_setting_failed = 1; + Cpp_Token id_token = array.tokens[i]; + if (id_token.type == CPP_TOKEN_IDENTIFIER){ + ++i; + if (i < array.count){ + Cpp_Token eq_token = array.tokens[i]; + if (eq_token.type == CPP_TOKEN_EQ){ + ++i; + if (i < array.count){ + Cpp_Token val_token = array.tokens[i]; + { + ++i; + if (i < array.count){ + Cpp_Token semicolon_token = array.tokens[i]; + if (semicolon_token.type == CPP_TOKEN_SEMICOLON){ + read_setting_failed = 0; + + String id = make_string(mem + id_token.start, id_token.size); + + if (match(id, "enable_code_wrapping")){ + if (val_token.type == CPP_TOKEN_BOOLEAN_CONSTANT){ + String val = make_string(mem + val_token.start, val_token.size); + if (val.str[0] == 't'){ + enable_code_wrapping = 1; + } + else{ + enable_code_wrapping = 0; + } } } - } - else if (match(id, "default_wrap_width")){ - if (val_token.type == CPP_TOKEN_INTEGER_CONSTANT){ - String val = make_string(mem + val_token.start, val_token.size); - default_wrap_width = str_to_int(val); + else if (match(id, "default_wrap_width")){ + if (val_token.type == CPP_TOKEN_INTEGER_CONSTANT){ + String val = make_string(mem + val_token.start, val_token.size); + 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); + 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); + } } + } - } } } } } } - } - - if (read_setting_failed){ - for (; i < array.count; ++i){ - Cpp_Token token = array.tokens[i]; - if (token.type == CPP_TOKEN_SEMICOLON){ - break; + + if (read_setting_failed){ + for (; i < array.count; ++i){ + Cpp_Token token = array.tokens[i]; + if (token.type == CPP_TOKEN_SEMICOLON){ + break; + } } } } } + + end_temp_memory(temp); + } + else{ + print_message(app, literal("Did not find config.4coder, using default settings")); } - - end_temp_memory(temp); } - else{ - print_message(app, literal("Did not find config.4coder, using default settings")); - } -} } #endif diff --git a/4coder_mem.h b/4coder_mem.h index e960893c..95e000c5 100644 --- a/4coder_mem.h +++ b/4coder_mem.h @@ -8,7 +8,8 @@ struct Partition{ char *base; - int32_t pos, max; + int32_t pos; + int32_t max; }; struct Temp_Memory{ @@ -16,6 +17,12 @@ struct Temp_Memory{ int32_t pos; }; +struct Tail_Temp_Partition{ + Partition part; + void *handle; + int32_t old_max; +}; + inline Partition make_part(void *memory, int32_t size){ Partition partition; @@ -43,12 +50,12 @@ partition_align(Partition *data, uint32_t boundary){ inline void* partition_current(Partition *data){ - return data->base + data->pos; + return(data->base + data->pos); } inline int32_t partition_remaining(Partition *data){ - return data->max - data->pos; + return(data->max - data->pos); } inline Partition @@ -58,7 +65,7 @@ partition_sub_part(Partition *data, int32_t size){ if (d){ result = make_part(d, size); } - return result; + return(result); } #define push_struct(part, T) (T*)partition_allocate(part, sizeof(T)) @@ -70,7 +77,7 @@ begin_temp_memory(Partition *data){ Temp_Memory result; result.handle = data; result.pos = data->pos; - return result; + return(result); } inline void @@ -78,6 +85,26 @@ end_temp_memory(Temp_Memory temp){ ((Partition*)temp.handle)->pos = temp.pos; } +inline Tail_Temp_Partition +begin_tail_part(Partition *data, int32_t size){ + Tail_Temp_Partition result = {0}; + if (data->pos + size <= data->max){ + result.handle = data; + result.old_max = data->max; + data->max -= size; + result.part = make_part(data->base + data->max, size); + } + return(result); +} + +inline void +end_tail_part(Tail_Temp_Partition temp){ + if (temp.handle){ + Partition *part = (Partition*)temp.handle; + part->max = temp.old_max; + } +} + /* NOTE(allen): This is a very week general purpose allocator system. diff --git a/TODO.txt b/TODO.txt index 661dece7..cce8a508 100644 --- a/TODO.txt +++ b/TODO.txt @@ -91,10 +91,6 @@ ; BEFORE I SHIP ; -; [X] query buffer font info -; [X] issues with drive letters -; [X] ad hoc call for setting up/down keys for interactive screens -; [X] miblo's various number editors ; [] decent options for indentation rules for text & presentation ; @@ -145,6 +141,14 @@ ; [X] use strange theme ; [X] cuber's return to previous buffer idea ; [X] find matches for current identifier +; [X] query buffer font info +; [X] issues with drive letters +; [X] ad hoc call for setting up/down keys for interactive screens +; [X] miblo's various number editors +; [X] eliminate the need for the lexer state's spare array. +; [X] fix buffer render item capacity issue +; [X] tab to complete folder names in the new file dialogue +; [X] API docs have duplicate ids? ; Token related upgrades ; [X] tokens in the custom API @@ -154,10 +158,6 @@ ; [X] inserting lines at end of block comment ; [] switch to line classification system ; [] more built in options for auto indenting -; -; [X] eliminate the need for the lexer state's spare array. -; [X] fix buffer render item capacity issue -; [X] tab to complete folder names in the new file dialogue ; Arbitrary wrap positions ; [X] allow for arbitrary wrap positions independent of view width @@ -196,7 +196,6 @@ ; [] user file bar string ; [] option to not open *messages* every startup -; [] API docs have duplicate ids? ; [] API docs as text file ; [] read only files ; [] option to hide hidden files diff --git a/build.cpp b/build.cpp index 1ea16a21..8ab8bc66 100644 --- a/build.cpp +++ b/build.cpp @@ -116,7 +116,8 @@ typedef union _LARGE_INTEGER { #endif extern "C"{ -DWORD WINAPI GetCurrentDirectoryA(_In_ DWORD nBufferLength, _Out_ LPTSTR lpBuffer); + DWORD WINAPI GetCurrentDirectoryA(_In_ DWORD nBufferLength, _Out_ LPTSTR lpBuffer); + BOOL WINAPI SetCurrentDirectoryA(_In_ LPCTSTR lpPathName); BOOL WINAPI QueryPerformanceCounter(_Out_ LARGE_INTEGER *lpPerformanceCount); @@ -130,10 +131,17 @@ DWORD WINAPI GetCurrentDirectoryA(_In_ DWORD nBufferLength, _Out_ LPTSTR lpBuf static uint64_t perf_frequency; static Temp_Dir -pushdir(char *dir){} +pushdir(char *dir){ + Temp_Dir temp = {0}; + GetCurrentDirectoryA(sizeof(temp.dir), temp.dir); + SetCurrentDirectoryA(dir); + return(temp); +} static void -popdir(Temp_Dir temp){} +popdir(Temp_Dir temp){ + SetCurrentDirectoryA(temp.dir); +} static void init_time_system(){ @@ -922,9 +930,14 @@ standard_build(char *cdir, uint32_t flags){ static void site_build(char *cdir, uint32_t flags){ { - BEGIN_TIME_SECTION(); - build(OPTS | SITE_INCLUDES | flags, cdir, "site/sitegen.cpp", BUILD_SITE_DIR, "sitegen", 0); - END_TIME_SECTION("build sitegen"); + BEGIN_TIME_SECTION(); + // TODO(allen): Figure out how to do these strings the right way... fuck. +#if defined(IS_WINDOWS) + build(OPTS | SITE_INCLUDES | flags, cdir, "site\\sitegen.cpp", BUILD_SITE_DIR, "sitegen", 0); +#else + build(OPTS | SITE_INCLUDES | flags, cdir, "site/sitegen.cpp", BUILD_SITE_DIR, "sitegen", 0); +#endif + END_TIME_SECTION("build sitegen"); } { @@ -932,7 +945,7 @@ site_build(char *cdir, uint32_t flags){ #if defined(IS_WINDOWS) systemf("..\\build\\site\\sitegen . ..\\foreign\\site-resources site\\source_material ..\\site"); - #else +#else systemf("../build/site/sitegen . ../foreign/site-resources site/source_material ../site"); #endif diff --git a/buildsuper.bat b/buildsuper.bat index e8f4d306..b9945780 100644 --- a/buildsuper.bat +++ b/buildsuper.bat @@ -1,8 +1,6 @@ @echo off -REM this is not really working... it's slowing down the build time -REM IF NOT DEFINED clset (call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x64) -REM SET clset=64 +IF NOT DEFINED LIB (call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x64) SET SRC=%1 if "%SRC%" == "" SET SRC=4coder_default_bindings.cpp diff --git a/power/4coder_experiments.cpp b/power/4coder_experiments.cpp index c429e47b..2a586d9d 100644 --- a/power/4coder_experiments.cpp +++ b/power/4coder_experiments.cpp @@ -305,7 +305,7 @@ CUSTOM_COMMAND_SIG(cursor_to_surrounding_scope){ finished:; if (found_result){ - view_set_cursor(app, &view, seek_pos(result), 0); + view_set_cursor(app, &view, seek_pos(result), 1); } } diff --git a/site/4ed_site.ctm b/site/4ed_site.ctm index 6993139f..cb30c616 100644 Binary files a/site/4ed_site.ctm and b/site/4ed_site.ctm differ diff --git a/site/abstract_document.cpp b/site/abstract_document.cpp index 738b5827..d6ee1883 100644 --- a/site/abstract_document.cpp +++ b/site/abstract_document.cpp @@ -91,10 +91,22 @@ static Document_Item null_document_item = {0}; enum{ ItemType_Document, ItemType_Image, + ItemType_GenericFile, // never below this ItemType_COUNT, }; +struct Basic_Node{ + Basic_Node *next; +}; + +#define NodeGetData(node, T) ((T*) ((node)+1)) + +struct Basic_List{ + Basic_Node *head; + Basic_Node *tail; +}; + struct Abstract_Item{ int32_t item_type; char *name; @@ -110,26 +122,21 @@ struct Abstract_Item{ // Image value members char *source_file; - char *out_file; + char *extension; float w_h_ratio; float h_w_ratio; + Basic_List img_instantiations; }; static Abstract_Item null_abstract_item = {0}; -struct Basic_Node{ - Basic_Node *next; -}; - -#define NodeGetData(node, T) ((T*) ((node)+1)) - -struct Basic_List{ - Basic_Node *head; - Basic_Node *tail; +struct Image_Instantiation{ + int32_t w, h; }; struct Document_System{ Basic_List doc_list; Basic_List img_list; + Basic_List file_list; Partition *part; }; @@ -195,20 +202,42 @@ get_item_by_name(Basic_List list, char *name){ return(result); } +static Image_Instantiation* +get_image_instantiation(Basic_List list, int32_t w, int32_t h){ + Image_Instantiation *result = 0; + + for (Basic_Node *node = list.head; + node != 0; + node = node->next){ + Image_Instantiation *instantiation = NodeGetData(node, Image_Instantiation); + if (instantiation->w == w && instantiation->h == h){ + result = instantiation; + break; + } + } + + return(result); +} + static Abstract_Item* create_item(Partition *part, Basic_List *list, char *name){ - int32_t is_new_name = 1; - Abstract_Item *lookup = get_item_by_name(*list, name); Abstract_Item *result = 0; - if (is_new_name){ + if (lookup == 0){ result = (Abstract_Item*)push_item_on_list(part, list, sizeof(Abstract_Item)); } return(result); } +static void +add_image_instantiation(Partition *part, Basic_List *list, int32_t w, int32_t h){ + Image_Instantiation *instantiation = (Image_Instantiation*)push_item_on_list(part, list, sizeof(Image_Instantiation)); + instantiation->w = w; + instantiation->h = h; +} + static void set_section_name(Partition *part, Document_Item *item, char *name, int32_t show_title){ int32_t name_len = str_size(name); @@ -241,26 +270,37 @@ begin_document_description(Abstract_Item *doc, Partition *part, char *title, int } static Abstract_Item* -add_image_description(Document_System *system, char *asset_directory, char *source_file, char *out_file, char *name){ +add_generic_file(Document_System *system, char *source_file, char *extension, char *name){ + Abstract_Item *item = create_item(system->part, &system->file_list, name); + if (item){ + item->item_type = ItemType_GenericFile; + item->extension = extension; + item->source_file = source_file; + item->name = name; + } + return(item); +} + +static Abstract_Item* +add_image_description(Document_System *system, char *source_file, char *extension, char *name){ Abstract_Item *item = create_item(system->part, &system->img_list, name); if (item){ item->item_type = ItemType_Image; + item->extension = extension; item->source_file = source_file; - item->out_file = out_file; item->name = name; - char str[256]; - String s = make_fixed_width_string(str); - append_sc(&s, asset_directory); - append_sc(&s, "/"); - append_sc(&s, source_file); - terminate_with_null(&s); - int32_t w = 0, h = 0, comp = 0; - int32_t stbi_r = stbi_info(str, &w, &h, &comp); - assert(stbi_r); + int32_t stbi_r = stbi_info(source_file, &w, &h, &comp); + if (!stbi_r){ + fprintf(stderr, "Did not find file %s\n", source_file); + item->w_h_ratio = 1.f; + item->h_w_ratio = 1.f; + } + else{ item->w_h_ratio = ((float)w/(float)h); item->h_w_ratio = ((float)h/(float)w); + } } return(item); } @@ -453,9 +493,17 @@ doc_get_link_string(Abstract_Item *doc, char *space, int32_t capacity){ } static int32_t -img_get_link_string(Abstract_Item *img, char *space, int32_t capacity){ +img_get_link_string(Abstract_Item *img, char *space, int32_t capacity, int32_t w, int32_t h){ String str = make_string_cap(space, 0, capacity); - append_sc(&str, img->out_file); + append_sc(&str, img->name); + + append_sc(&str, "_"); + append_int_to_str(&str, w); + append_sc(&str, "_"); + append_int_to_str(&str, h); + + append_sc(&str, "."); + append_sc(&str, img->extension); int32_t result = terminate_with_null(&str); return(result); } @@ -477,7 +525,7 @@ append_section_number(String *out, Section_Counter *section_counter){ } static int32_t -extract_command_body(String *out, String l, int32_t *i_in_out, int32_t *body_start_out, int32_t *body_end_out, String command_name){ +extract_command_body(String *out, String l, int32_t *i_in_out, int32_t *body_start_out, int32_t *body_end_out, String command_name, int32_t require_body){ int32_t result = 0; int32_t i = *i_in_out; @@ -507,6 +555,7 @@ extract_command_body(String *out, String l, int32_t *i_in_out, int32_t *body_sta result = 1; } else{ + if (require_body){ #define STR_START "! Doc generator error: missing body for " #define STR_SLOW " !" append_sc(out, STR_START); @@ -515,6 +564,7 @@ extract_command_body(String *out, String l, int32_t *i_in_out, int32_t *body_sta #undef STR fprintf(stderr, "error: missing body for %.*s\n", command_name.size, command_name.str); + } } *i_in_out = i; @@ -559,7 +609,7 @@ html_render_section_header(String *out, String section_name, String section_id, #define HTML_WIDTH 800 static void -write_enriched_text_html(String *out, Enriched_Text *text, Document_System *doc_system, Section_Counter *section_counter){ +write_enriched_text_html(String *out, Partition *part, Enriched_Text *text, Document_System *doc_system, Section_Counter *section_counter){ String source = text->source; append_sc(out, "