new tutorial: projects 4.0.13
parent
987eeb06ec
commit
8d40cc1eca
|
@ -60,7 +60,7 @@
|
|||
#define MEMORY_FREE_SIG(n) void n(Application_Links *app, void *ptr, int32_t size)
|
||||
#define FILE_EXISTS_SIG(n) bool32 n(Application_Links *app, char *filename, int32_t len)
|
||||
#define DIRECTORY_CD_SIG(n) bool32 n(Application_Links *app, char *dir, int32_t *len, int32_t capacity, char *rel_path, int32_t rel_len)
|
||||
#define GET_4ED_PATH_SIG(n) bool32 n(Application_Links *app, char *out, int32_t capacity)
|
||||
#define GET_4ED_PATH_SIG(n) int32_t n(Application_Links *app, char *out, int32_t capacity)
|
||||
#define SHOW_MOUSE_CURSOR_SIG(n) void n(Application_Links *app, Mouse_Cursor_Show_Type show)
|
||||
#define TOGGLE_FULLSCREEN_SIG(n) void n(Application_Links *app)
|
||||
#define IS_FULLSCREEN_SIG(n) bool32 n(Application_Links *app)
|
||||
|
@ -408,7 +408,7 @@ static inline bool32 memory_set_protection(Application_Links *app, void *ptr, in
|
|||
static inline void memory_free(Application_Links *app, void *ptr, int32_t size){(app->memory_free(app, ptr, size));}
|
||||
static inline bool32 file_exists(Application_Links *app, char *filename, int32_t len){return(app->file_exists(app, filename, len));}
|
||||
static inline bool32 directory_cd(Application_Links *app, char *dir, int32_t *len, int32_t capacity, char *rel_path, int32_t rel_len){return(app->directory_cd(app, dir, len, capacity, rel_path, rel_len));}
|
||||
static inline bool32 get_4ed_path(Application_Links *app, char *out, int32_t capacity){return(app->get_4ed_path(app, out, capacity));}
|
||||
static inline int32_t get_4ed_path(Application_Links *app, char *out, int32_t capacity){return(app->get_4ed_path(app, out, capacity));}
|
||||
static inline void show_mouse_cursor(Application_Links *app, Mouse_Cursor_Show_Type show){(app->show_mouse_cursor(app, show));}
|
||||
static inline void toggle_fullscreen(Application_Links *app){(app->toggle_fullscreen(app));}
|
||||
static inline bool32 is_fullscreen(Application_Links *app){return(app->is_fullscreen(app));}
|
||||
|
@ -476,7 +476,7 @@ static inline bool32 memory_set_protection(Application_Links *app, void *ptr, in
|
|||
static inline void memory_free(Application_Links *app, void *ptr, int32_t size){(app->memory_free_(app, ptr, size));}
|
||||
static inline bool32 file_exists(Application_Links *app, char *filename, int32_t len){return(app->file_exists_(app, filename, len));}
|
||||
static inline bool32 directory_cd(Application_Links *app, char *dir, int32_t *len, int32_t capacity, char *rel_path, int32_t rel_len){return(app->directory_cd_(app, dir, len, capacity, rel_path, rel_len));}
|
||||
static inline bool32 get_4ed_path(Application_Links *app, char *out, int32_t capacity){return(app->get_4ed_path_(app, out, capacity));}
|
||||
static inline int32_t get_4ed_path(Application_Links *app, char *out, int32_t capacity){return(app->get_4ed_path_(app, out, capacity));}
|
||||
static inline void show_mouse_cursor(Application_Links *app, Mouse_Cursor_Show_Type show){(app->show_mouse_cursor_(app, show));}
|
||||
static inline void toggle_fullscreen(Application_Links *app){(app->toggle_fullscreen_(app));}
|
||||
static inline bool32 is_fullscreen(Application_Links *app){return(app->is_fullscreen_(app));}
|
||||
|
|
|
@ -3465,12 +3465,9 @@ SCROLL_RULE_SIG(smooth_scroll_rule){
|
|||
COMMAND_CALLER_HOOK(default_command_caller){
|
||||
View_Summary view = get_active_view(app, AccessAll);
|
||||
|
||||
view_paste_index[view.view_id].next_rewrite = false;
|
||||
|
||||
view_paste_index[view.view_id].next_rewrite = 0;
|
||||
exec_command(app, cmd);
|
||||
|
||||
view_paste_index[view.view_id].rewrite =
|
||||
view_paste_index[view.view_id].next_rewrite;
|
||||
view_paste_index[view.view_id].rewrite = view_paste_index[view.view_id].next_rewrite;
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
@ -3486,6 +3483,16 @@ static int32_t default_min_base_width = 550;
|
|||
static void
|
||||
process_config_file(Application_Links *app){
|
||||
FILE *file = fopen("config.4coder", "rb");
|
||||
|
||||
if (!file){
|
||||
char space[256];
|
||||
int32_t size = get_4ed_path(app, space, sizeof(space));
|
||||
String str = make_string_cap(space, size, sizeof(space));
|
||||
append_sc(&str, "/config.4coder");
|
||||
terminate_with_null(&str);
|
||||
file = fopen(str.str, "rb");
|
||||
}
|
||||
|
||||
if (file){
|
||||
Temp_Memory temp = begin_temp_memory(&global_part);
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#define MAJOR 4
|
||||
#define MINOR 0
|
||||
#define PATCH 13
|
||||
#define PATCH 14
|
||||
|
||||
#define VN__(a,b,c) #a"."#b"."#c
|
||||
#define VN_(a,b,c) VN__(a,b,c)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#define MEMORY_FREE_SIG(n) void n(Application_Links *app, void *ptr, int32_t size)
|
||||
#define FILE_EXISTS_SIG(n) bool32 n(Application_Links *app, char *filename, int32_t len)
|
||||
#define DIRECTORY_CD_SIG(n) bool32 n(Application_Links *app, char *dir, int32_t *len, int32_t capacity, char *rel_path, int32_t rel_len)
|
||||
#define GET_4ED_PATH_SIG(n) bool32 n(Application_Links *app, char *out, int32_t capacity)
|
||||
#define GET_4ED_PATH_SIG(n) int32_t n(Application_Links *app, char *out, int32_t capacity)
|
||||
#define SHOW_MOUSE_CURSOR_SIG(n) void n(Application_Links *app, Mouse_Cursor_Show_Type show)
|
||||
#define TOGGLE_FULLSCREEN_SIG(n) void n(Application_Links *app)
|
||||
#define IS_FULLSCREEN_SIG(n) bool32 n(Application_Links *app)
|
||||
|
|
2
TODO.txt
2
TODO.txt
|
@ -92,6 +92,8 @@
|
|||
; BEFORE I SHIP
|
||||
;
|
||||
; [] decent options for indentation rules for text & presentation
|
||||
; [] code file outlining
|
||||
; [] alternate code completion plan
|
||||
;
|
||||
|
||||
; TODOS
|
||||
|
|
55
build.cpp
55
build.cpp
|
@ -876,15 +876,31 @@ metagen(char *cdir){
|
|||
}
|
||||
}
|
||||
|
||||
enum{
|
||||
Custom_Default,
|
||||
Custom_Experiments,
|
||||
Custom_Casey,
|
||||
Custom_ChronalVim,
|
||||
CUSTOM_COUNT
|
||||
};
|
||||
|
||||
static void
|
||||
do_buildsuper(char *cdir){
|
||||
do_buildsuper(char *cdir, int32_t custom_option){
|
||||
char space[1024];
|
||||
String str = make_fixed_width_string(space);
|
||||
|
||||
BEGIN_TIME_SECTION();
|
||||
//copy_sc(&str, "../code/4coder_default_bindings.cpp");
|
||||
//terminate_with_null(&str);
|
||||
//buildsuper(cdir, BUILD_DIR, str.str);
|
||||
|
||||
switch (custom_option){
|
||||
case Custom_Default:
|
||||
{
|
||||
copy_sc(&str, "../code/4coder_default_bindings.cpp");
|
||||
terminate_with_null(&str);
|
||||
buildsuper(cdir, BUILD_DIR, str.str);
|
||||
}break;
|
||||
|
||||
case Custom_Experiments:
|
||||
{
|
||||
#if defined(IS_WINDOWS)
|
||||
copy_sc(&str, "../code/internal_4coder_tests.cpp");
|
||||
terminate_with_null(&str);
|
||||
|
@ -894,13 +910,23 @@ do_buildsuper(char *cdir){
|
|||
terminate_with_null(&str);
|
||||
buildsuper(cdir, BUILD_DIR, str.str);
|
||||
#endif
|
||||
//copy_sc(&str, "../code/power/4coder_casey.cpp");
|
||||
//terminate_with_null(&str);
|
||||
//buildsuper(cdir, BUILD_DIR, str.str);
|
||||
//copy_sc(&str, "../4vim/4coder_chronal.cpp");
|
||||
//terminate_with_null(&str);
|
||||
//buildsuper(cdir, BUILD_DIR, str.str);
|
||||
|
||||
}break;
|
||||
|
||||
case Custom_Casey:
|
||||
{
|
||||
copy_sc(&str, "../code/power/4coder_casey.cpp");
|
||||
terminate_with_null(&str);
|
||||
buildsuper(cdir, BUILD_DIR, str.str);
|
||||
}break;
|
||||
|
||||
case Custom_ChronalVim:
|
||||
{
|
||||
copy_sc(&str, "../4vim/4coder_chronal.cpp");
|
||||
terminate_with_null(&str);
|
||||
buildsuper(cdir, BUILD_DIR, str.str);
|
||||
}break;
|
||||
}
|
||||
|
||||
END_TIME_SECTION("build custom");
|
||||
}
|
||||
|
||||
|
@ -923,7 +949,8 @@ static void
|
|||
standard_build(char *cdir, uint32_t flags){
|
||||
fsm_generator(cdir);
|
||||
metagen(cdir);
|
||||
do_buildsuper(cdir);
|
||||
do_buildsuper(cdir, Custom_Experiments);
|
||||
//do_buildsuper(cdir, Custom_ChronalVim);
|
||||
build_main(cdir, flags);
|
||||
}
|
||||
|
||||
|
@ -1017,15 +1044,19 @@ package(char *cdir){
|
|||
|
||||
// NOTE(allen): super
|
||||
build_main(cdir, OPTIMIZATION | KEEP_ASSERT | DEBUG_INFO | SUPER);
|
||||
do_buildsuper(cdir, Custom_Default);
|
||||
|
||||
clear_folder(PACK_SUPER_PAR_DIR);
|
||||
make_folder_if_missing(PACK_SUPER_DIR, "3rdparty");
|
||||
make_folder_if_missing(PACK_DIR, "super");
|
||||
make_folder_if_missing(PACK_DIR, "super-docs");
|
||||
|
||||
copy_file(BUILD_DIR, "4ed"EXE, PACK_SUPER_DIR, 0, 0);
|
||||
ONLY_WINDOWS(copy_file(BUILD_DIR, "4ed"PDB, PACK_SUPER_DIR, 0, 0));
|
||||
copy_file(BUILD_DIR, "4ed_app"DLL, PACK_SUPER_DIR, 0, 0);
|
||||
ONLY_WINDOWS(copy_file(BUILD_DIR, "4ed_app"PDB, PACK_SUPER_DIR, 0, 0));
|
||||
copy_file(BUILD_DIR, "4coder_custom"DLL, PACK_SUPER_DIR, 0, 0);
|
||||
|
||||
copy_all (PACK_DATA_DIR, "*", PACK_SUPER_DIR);
|
||||
copy_file(0, "README.txt", PACK_SUPER_DIR, 0, 0);
|
||||
copy_file(0, "TODO.txt", PACK_SUPER_DIR, 0, 0);
|
||||
|
|
Binary file not shown.
453
site/sitegen.cpp
453
site/sitegen.cpp
|
@ -13,6 +13,8 @@
|
|||
#include "stb_image.h"
|
||||
#define STB_IMAGE_RESIZE_IMPLEMENTATION
|
||||
#include "stb_image_resize.h"
|
||||
#define STB_IMAGE_WRITE_IMPLEMENTATION
|
||||
#include "stb_image_write.h"
|
||||
|
||||
#include "4coder_version.h"
|
||||
#define FSTRING_IMPLEMENTATION
|
||||
|
@ -88,7 +90,7 @@ print_function_body_code(String *out, Parse_Context *context, int32_t start){
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static Alternate_Names_Array
|
||||
allocate_app_api(Partition *part, int32_t count){
|
||||
Alternate_Names_Array app_api = {0};
|
||||
|
@ -96,7 +98,7 @@ allocate_app_api(Partition *part, int32_t count){
|
|||
memset(app_api.names, 0, sizeof(Alternate_Name)*count);
|
||||
return(app_api);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
assert_files_are_equal(char *directory, char *filename1, char *filename2){
|
||||
char space[256];
|
||||
|
@ -105,249 +107,260 @@ assert_files_are_equal(char *directory, char *filename1, char *filename2){
|
|||
append_sc(&name, "/");
|
||||
append_sc(&name, filename1);
|
||||
terminate_with_null(&name);
|
||||
|
||||
|
||||
String file1 = file_dump(name.str);
|
||||
|
||||
|
||||
name.size = 0;
|
||||
append_sc(&name, directory);
|
||||
append_sc(&name, "/");
|
||||
append_sc(&name, filename2);
|
||||
terminate_with_null(&name);
|
||||
|
||||
|
||||
String file2 = file_dump(name.str);
|
||||
|
||||
|
||||
if (!match_ss(file1, file2)){
|
||||
fprintf(stderr, "Failed transitional test: %s != %s\n", filename1, filename2);
|
||||
}
|
||||
else{
|
||||
fprintf(stderr, "Passed transitional test: %s == %s\n", filename1, filename2);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
do_html_output(Document_System *doc_system, Partition *part, char *dst_directory, Abstract_Item *doc){
|
||||
// NOTE(allen): Output
|
||||
int32_t out_size = 10 << 20;
|
||||
Tail_Temp_Partition temp = begin_tail_part(part, out_size);
|
||||
|
||||
String out = str_alloc(&temp.part, out_size);
|
||||
assert(out.str);
|
||||
Out_Context context = {0};
|
||||
set_context_directory(&context, dst_directory);
|
||||
|
||||
// Output Docs
|
||||
char space[256];
|
||||
if (doc_get_link_string(doc, space, sizeof(space))){
|
||||
if (begin_file_out(&context, space, &out)){
|
||||
generate_document_html(&out, part, doc_system, doc);
|
||||
end_file_out(context);
|
||||
}
|
||||
else{
|
||||
fprintf(stderr, "Failed to open %s\n", space);
|
||||
}
|
||||
}
|
||||
|
||||
end_tail_part(temp);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
do_html_output(Document_System *doc_system, Partition *part, char *dst_directory, Abstract_Item *doc){
|
||||
// NOTE(allen): Output
|
||||
int32_t out_size = 10 << 20;
|
||||
Tail_Temp_Partition temp = begin_tail_part(part, out_size);
|
||||
|
||||
static Abstract_Item*
|
||||
generate_homepage(Document_System *doc_system, Partition *part, char *src_directory){
|
||||
Enriched_Text *home = push_struct(part, Enriched_Text);
|
||||
*home = load_enriched_text(part, src_directory, "home.txt");
|
||||
|
||||
Abstract_Item *doc = begin_document_description(doc_system, "4coder Home", "home", 0);
|
||||
add_enriched_text(doc, home);
|
||||
end_document_description(doc);
|
||||
|
||||
return(doc);
|
||||
}
|
||||
String out = str_alloc(&temp.part, out_size);
|
||||
assert(out.str);
|
||||
Out_Context context = {0};
|
||||
set_context_directory(&context, dst_directory);
|
||||
|
||||
// TODO(allen): replace the documentation declaration system with a straight up enriched text system
|
||||
static Abstract_Item*
|
||||
generate_4coder_docs(Document_System *doc_system, Partition *part, char *code_directory, char *src_directory){
|
||||
static Meta_Keywords meta_keywords[] = {
|
||||
{make_lit_string("API_EXPORT") , Item_Function } ,
|
||||
{make_lit_string("API_EXPORT_INLINE") , Item_Function } ,
|
||||
{make_lit_string("API_EXPORT_MACRO") , Item_Macro } ,
|
||||
{make_lit_string("CPP_NAME") , Item_CppName } ,
|
||||
{make_lit_string("TYPEDEF") , Item_Typedef } ,
|
||||
{make_lit_string("STRUCT") , Item_Struct } ,
|
||||
{make_lit_string("UNION") , Item_Union } ,
|
||||
{make_lit_string("ENUM") , Item_Enum } ,
|
||||
};
|
||||
|
||||
#define ExpandArray(a) (a), (ArrayCount(a))
|
||||
|
||||
Meta_Unit *custom_types_unit = push_struct(part, Meta_Unit);
|
||||
Meta_Unit *lexer_funcs_unit = push_struct(part, Meta_Unit);
|
||||
Meta_Unit *lexer_types_unit = push_struct(part, Meta_Unit);
|
||||
Meta_Unit *string_unit = push_struct(part, Meta_Unit);
|
||||
Meta_Unit *custom_funcs_unit = push_struct(part, Meta_Unit);
|
||||
|
||||
Alternate_Names_Array *custom_func_names = push_struct(part, Alternate_Names_Array);
|
||||
|
||||
Enriched_Text *introduction = push_struct(part, Enriched_Text);
|
||||
Enriched_Text *lexer_introduction = push_struct(part, Enriched_Text);
|
||||
|
||||
// NOTE(allen): Parse the important code.
|
||||
*custom_types_unit = compile_meta_unit(part, code_directory, "4coder_types.h", ExpandArray(meta_keywords));
|
||||
|
||||
*lexer_funcs_unit = compile_meta_unit(part, code_directory, "4cpp_lexer.h", ExpandArray(meta_keywords));
|
||||
|
||||
*lexer_types_unit = compile_meta_unit(part, code_directory, "4cpp_lexer_types.h", ExpandArray(meta_keywords));
|
||||
|
||||
*string_unit = compile_meta_unit(part, code_directory, "internal_4coder_string.cpp", ExpandArray(meta_keywords));
|
||||
|
||||
static char *functions_files[] = {
|
||||
"4ed_api_implementation.cpp",
|
||||
"win32_api_impl.cpp",
|
||||
0
|
||||
};
|
||||
|
||||
*custom_funcs_unit = compile_meta_unit(part, code_directory, functions_files, ExpandArray(meta_keywords));
|
||||
|
||||
|
||||
// NOTE(allen): Compute and store variations of the custom function names
|
||||
*custom_func_names = allocate_app_api(part, custom_funcs_unit->set.count);
|
||||
|
||||
for (int32_t i = 0; i < custom_funcs_unit->set.count; ++i){
|
||||
String name_string = custom_funcs_unit->set.items[i].name;
|
||||
String *macro = &custom_func_names->names[i].macro;
|
||||
String *public_name = &custom_func_names->names[i].public_name;
|
||||
|
||||
*macro = str_alloc(part, name_string.size+4);
|
||||
to_upper_ss(macro, name_string);
|
||||
append_ss(macro, make_lit_string("_SIG"));
|
||||
|
||||
*public_name = str_alloc(part, name_string.size);
|
||||
to_lower_ss(public_name, name_string);
|
||||
|
||||
partition_align(part, 4);
|
||||
// Output Docs
|
||||
char space[256];
|
||||
if (doc_get_link_string(doc, space, sizeof(space))){
|
||||
if (begin_file_out(&context, space, &out)){
|
||||
generate_document_html(&out, part, doc_system, doc);
|
||||
end_file_out(context);
|
||||
}
|
||||
else{
|
||||
fprintf(stderr, "Failed to open %s\n", space);
|
||||
}
|
||||
}
|
||||
|
||||
end_tail_part(temp);
|
||||
}
|
||||
|
||||
static Abstract_Item*
|
||||
generate_homepage(Document_System *doc_system, Partition *part, char *src_directory){
|
||||
Enriched_Text *home = push_struct(part, Enriched_Text);
|
||||
*home = load_enriched_text(part, src_directory, "home.txt");
|
||||
|
||||
Abstract_Item *doc = begin_document_description(doc_system, "4coder Home", "home", 0);
|
||||
add_enriched_text(doc, home);
|
||||
end_document_description(doc);
|
||||
|
||||
return(doc);
|
||||
}
|
||||
|
||||
// TODO(allen): replace the documentation declaration system with a straight up enriched text system
|
||||
static Abstract_Item*
|
||||
generate_4coder_docs(Document_System *doc_system, Partition *part, char *code_directory, char *src_directory){
|
||||
static Meta_Keywords meta_keywords[] = {
|
||||
{make_lit_string("API_EXPORT") , Item_Function } ,
|
||||
{make_lit_string("API_EXPORT_INLINE") , Item_Function } ,
|
||||
{make_lit_string("API_EXPORT_MACRO") , Item_Macro } ,
|
||||
{make_lit_string("CPP_NAME") , Item_CppName } ,
|
||||
{make_lit_string("TYPEDEF") , Item_Typedef } ,
|
||||
{make_lit_string("STRUCT") , Item_Struct } ,
|
||||
{make_lit_string("UNION") , Item_Union } ,
|
||||
{make_lit_string("ENUM") , Item_Enum } ,
|
||||
};
|
||||
|
||||
#define ExpandArray(a) (a), (ArrayCount(a))
|
||||
|
||||
Meta_Unit *custom_types_unit = push_struct(part, Meta_Unit);
|
||||
Meta_Unit *lexer_funcs_unit = push_struct(part, Meta_Unit);
|
||||
Meta_Unit *lexer_types_unit = push_struct(part, Meta_Unit);
|
||||
Meta_Unit *string_unit = push_struct(part, Meta_Unit);
|
||||
Meta_Unit *custom_funcs_unit = push_struct(part, Meta_Unit);
|
||||
|
||||
Alternate_Names_Array *custom_func_names = push_struct(part, Alternate_Names_Array);
|
||||
|
||||
Enriched_Text *introduction = push_struct(part, Enriched_Text);
|
||||
Enriched_Text *lexer_introduction = push_struct(part, Enriched_Text);
|
||||
|
||||
// NOTE(allen): Parse the important code.
|
||||
*custom_types_unit = compile_meta_unit(part, code_directory, "4coder_types.h", ExpandArray(meta_keywords));
|
||||
|
||||
*lexer_funcs_unit = compile_meta_unit(part, code_directory, "4cpp_lexer.h", ExpandArray(meta_keywords));
|
||||
|
||||
*lexer_types_unit = compile_meta_unit(part, code_directory, "4cpp_lexer_types.h", ExpandArray(meta_keywords));
|
||||
|
||||
*string_unit = compile_meta_unit(part, code_directory, "internal_4coder_string.cpp", ExpandArray(meta_keywords));
|
||||
|
||||
static char *functions_files[] = {
|
||||
"4ed_api_implementation.cpp",
|
||||
"win32_api_impl.cpp",
|
||||
0
|
||||
};
|
||||
|
||||
*custom_funcs_unit = compile_meta_unit(part, code_directory, functions_files, ExpandArray(meta_keywords));
|
||||
|
||||
|
||||
// NOTE(allen): Compute and store variations of the custom function names
|
||||
*custom_func_names = allocate_app_api(part, custom_funcs_unit->set.count);
|
||||
|
||||
for (int32_t i = 0; i < custom_funcs_unit->set.count; ++i){
|
||||
String name_string = custom_funcs_unit->set.items[i].name;
|
||||
String *macro = &custom_func_names->names[i].macro;
|
||||
String *public_name = &custom_func_names->names[i].public_name;
|
||||
|
||||
// NOTE(allen): Load enriched text materials
|
||||
*introduction = load_enriched_text(part, src_directory, "introduction.txt");
|
||||
*lexer_introduction = load_enriched_text(part, src_directory, "lexer_introduction.txt");
|
||||
*macro = str_alloc(part, name_string.size+4);
|
||||
to_upper_ss(macro, name_string);
|
||||
append_ss(macro, make_lit_string("_SIG"));
|
||||
|
||||
// NOTE(allen): Put together the abstract document
|
||||
Abstract_Item *doc = begin_document_description(doc_system, "4coder API Docs", "custom_docs", 1);
|
||||
*public_name = str_alloc(part, name_string.size);
|
||||
to_lower_ss(public_name, name_string);
|
||||
|
||||
add_table_of_contents(doc);
|
||||
|
||||
begin_section(doc, "Introduction", "introduction");
|
||||
add_enriched_text(doc, introduction);
|
||||
partition_align(part, 4);
|
||||
}
|
||||
|
||||
// NOTE(allen): Load enriched text materials
|
||||
*introduction = load_enriched_text(part, src_directory, "introduction.txt");
|
||||
*lexer_introduction = load_enriched_text(part, src_directory, "lexer_introduction.txt");
|
||||
|
||||
// NOTE(allen): Put together the abstract document
|
||||
Abstract_Item *doc = begin_document_description(doc_system, "4coder API Docs", "custom_docs", 1);
|
||||
|
||||
add_table_of_contents(doc);
|
||||
|
||||
begin_section(doc, "Introduction", "introduction");
|
||||
add_enriched_text(doc, introduction);
|
||||
end_section(doc);
|
||||
|
||||
begin_section(doc, "4coder Systems", "4coder_systems");
|
||||
add_todo(doc);
|
||||
end_section(doc);
|
||||
|
||||
begin_section(doc, "Types and Functions", "types_and_functions");
|
||||
{
|
||||
begin_section(doc, "Function List", 0);
|
||||
add_element_list(doc, custom_funcs_unit, custom_func_names, AltName_Public_Name);
|
||||
end_section(doc);
|
||||
|
||||
begin_section(doc, "4coder Systems", "4coder_systems");
|
||||
begin_section(doc, "Type List", 0);
|
||||
add_element_list(doc, custom_types_unit);
|
||||
end_section(doc);
|
||||
begin_section(doc, "Function Descriptions", 0);
|
||||
add_full_elements(doc, custom_funcs_unit, custom_func_names, AltName_Public_Name);
|
||||
end_section(doc);
|
||||
begin_section(doc, "Type Descriptions", 0);
|
||||
add_full_elements(doc, custom_types_unit);
|
||||
end_section(doc);
|
||||
}
|
||||
end_section(doc);
|
||||
|
||||
begin_section(doc, "String Library", "string_library");
|
||||
{
|
||||
begin_section(doc, "String Library Intro", 0);
|
||||
add_todo(doc);
|
||||
end_section(doc);
|
||||
|
||||
begin_section(doc, "Types and Functions", "types_and_functions");
|
||||
{
|
||||
begin_section(doc, "Function List", 0);
|
||||
add_element_list(doc, custom_funcs_unit, custom_func_names, AltName_Public_Name);
|
||||
end_section(doc);
|
||||
begin_section(doc, "Type List", 0);
|
||||
add_element_list(doc, custom_types_unit);
|
||||
end_section(doc);
|
||||
begin_section(doc, "Function Descriptions", 0);
|
||||
add_full_elements(doc, custom_funcs_unit, custom_func_names, AltName_Public_Name);
|
||||
end_section(doc);
|
||||
begin_section(doc, "Type Descriptions", 0);
|
||||
add_full_elements(doc, custom_types_unit);
|
||||
end_section(doc);
|
||||
}
|
||||
begin_section(doc, "String Function List", 0);
|
||||
add_element_list(doc, string_unit);
|
||||
end_section(doc);
|
||||
|
||||
begin_section(doc, "String Library", "string_library");
|
||||
{
|
||||
begin_section(doc, "String Library Intro", 0);
|
||||
add_todo(doc);
|
||||
end_section(doc);
|
||||
begin_section(doc, "String Function List", 0);
|
||||
add_element_list(doc, string_unit);
|
||||
end_section(doc);
|
||||
begin_section(doc, "String Function Descriptions", 0);
|
||||
add_full_elements(doc, string_unit);
|
||||
end_section(doc);
|
||||
}
|
||||
begin_section(doc, "String Function Descriptions", 0);
|
||||
add_full_elements(doc, string_unit);
|
||||
end_section(doc);
|
||||
|
||||
begin_section(doc, "Lexer Library", "lexer_library");
|
||||
{
|
||||
begin_section(doc, "Lexer Intro", 0);
|
||||
add_enriched_text(doc, lexer_introduction);
|
||||
end_section(doc);
|
||||
begin_section(doc, "Lexer Function List", 0);
|
||||
add_element_list(doc, lexer_funcs_unit);
|
||||
end_section(doc);
|
||||
begin_section(doc, "Lexer Type List", 0);
|
||||
add_element_list(doc, lexer_types_unit);
|
||||
end_section(doc);
|
||||
begin_section(doc, "Lexer Function Descriptions", 0);
|
||||
add_full_elements(doc, lexer_funcs_unit);
|
||||
end_section(doc);
|
||||
begin_section(doc, "Lexer Type Descriptions", 0);
|
||||
add_full_elements(doc, lexer_types_unit);
|
||||
end_section(doc);
|
||||
}
|
||||
end_section(doc);
|
||||
|
||||
end_document_description(doc);
|
||||
|
||||
return(doc);
|
||||
}
|
||||
end_section(doc);
|
||||
|
||||
static Abstract_Item*
|
||||
generate_feature_list(Document_System *doc_system, Partition *part, char *src_directory){
|
||||
Enriched_Text *feature_list = push_struct(part, Enriched_Text);
|
||||
*feature_list = load_enriched_text(part, src_directory, "feature_list.txt");
|
||||
|
||||
Abstract_Item *doc = begin_document_description(doc_system, "4coder Feature List", "features", 0);
|
||||
add_enriched_text(doc, feature_list);
|
||||
end_document_description(doc);
|
||||
|
||||
return(doc);
|
||||
begin_section(doc, "Lexer Library", "lexer_library");
|
||||
{
|
||||
begin_section(doc, "Lexer Intro", 0);
|
||||
add_enriched_text(doc, lexer_introduction);
|
||||
end_section(doc);
|
||||
begin_section(doc, "Lexer Function List", 0);
|
||||
add_element_list(doc, lexer_funcs_unit);
|
||||
end_section(doc);
|
||||
begin_section(doc, "Lexer Type List", 0);
|
||||
add_element_list(doc, lexer_types_unit);
|
||||
end_section(doc);
|
||||
begin_section(doc, "Lexer Function Descriptions", 0);
|
||||
add_full_elements(doc, lexer_funcs_unit);
|
||||
end_section(doc);
|
||||
begin_section(doc, "Lexer Type Descriptions", 0);
|
||||
add_full_elements(doc, lexer_types_unit);
|
||||
end_section(doc);
|
||||
}
|
||||
end_section(doc);
|
||||
|
||||
static Abstract_Item*
|
||||
generate_roadmap(Document_System *doc_system, Partition *part, char *src_directory){
|
||||
Enriched_Text *roadmap = push_struct(part, Enriched_Text);
|
||||
*roadmap = load_enriched_text(part, src_directory, "roadmap.txt");
|
||||
end_document_description(doc);
|
||||
|
||||
return(doc);
|
||||
}
|
||||
|
||||
Abstract_Item *doc = begin_document_description(doc_system, "4coder Roadmap", "roadmap", 0);
|
||||
add_enriched_text(doc, roadmap);
|
||||
end_document_description(doc);
|
||||
|
||||
return(doc);
|
||||
}
|
||||
|
||||
static Abstract_Item*
|
||||
generate_tutorials(Document_System *doc_system, Partition *part, char *src_directory){
|
||||
Enriched_Text *roadmap = push_struct(part, Enriched_Text);
|
||||
*roadmap = load_enriched_text(part, src_directory, "tutorials.txt");
|
||||
|
||||
Abstract_Item *doc = begin_document_description(doc_system, "4coder Tutorials", "tutorials", 0);
|
||||
add_enriched_text(doc, roadmap);
|
||||
end_document_description(doc);
|
||||
|
||||
return(doc);
|
||||
}
|
||||
|
||||
static String
|
||||
push_string(Partition *part, int32_t size){
|
||||
String str = {0};
|
||||
str.memory_size = size;
|
||||
str.str = push_array(part, char, size);
|
||||
partition_align(part, 4);
|
||||
return(str);
|
||||
}
|
||||
|
||||
static void
|
||||
do_image_resize(Partition *part, char *src_file, char *dst_dir, char *dst_file, int32_t w, int32_t h){
|
||||
do_file_copy(part, src_file, dst_dir, dst_file);
|
||||
static Abstract_Item*
|
||||
generate_feature_list(Document_System *doc_system, Partition *part, char *src_directory){
|
||||
Enriched_Text *feature_list = push_struct(part, Enriched_Text);
|
||||
*feature_list = load_enriched_text(part, src_directory, "feature_list.txt");
|
||||
|
||||
Abstract_Item *doc = begin_document_description(doc_system, "4coder Feature List", "features", 0);
|
||||
add_enriched_text(doc, feature_list);
|
||||
end_document_description(doc);
|
||||
|
||||
return(doc);
|
||||
}
|
||||
|
||||
static Abstract_Item*
|
||||
generate_roadmap(Document_System *doc_system, Partition *part, char *src_directory){
|
||||
Enriched_Text *roadmap = push_struct(part, Enriched_Text);
|
||||
*roadmap = load_enriched_text(part, src_directory, "roadmap.txt");
|
||||
|
||||
Abstract_Item *doc = begin_document_description(doc_system, "4coder Roadmap", "roadmap", 0);
|
||||
add_enriched_text(doc, roadmap);
|
||||
end_document_description(doc);
|
||||
|
||||
return(doc);
|
||||
}
|
||||
|
||||
static Abstract_Item*
|
||||
generate_tutorials(Document_System *doc_system, Partition *part, char *src_directory){
|
||||
Enriched_Text *roadmap = push_struct(part, Enriched_Text);
|
||||
*roadmap = load_enriched_text(part, src_directory, "tutorials.txt");
|
||||
|
||||
Abstract_Item *doc = begin_document_description(doc_system, "4coder Tutorials", "tutorials", 0);
|
||||
add_enriched_text(doc, roadmap);
|
||||
end_document_description(doc);
|
||||
|
||||
return(doc);
|
||||
}
|
||||
|
||||
static String
|
||||
push_string(Partition *part, int32_t size){
|
||||
String str = {0};
|
||||
str.memory_size = size;
|
||||
str.str = push_array(part, char, size);
|
||||
partition_align(part, 4);
|
||||
return(str);
|
||||
}
|
||||
|
||||
static void
|
||||
do_image_resize(Partition *part, char *src_file, char *dst_file, char *extension, int32_t w, int32_t h){
|
||||
int x, y, channels;
|
||||
stbi_uc *image = stbi_load(src_file, &x, &y, &channels, 0);
|
||||
|
||||
stbi_uc *resized_image = (stbi_uc*)malloc(w*h*channels);
|
||||
stbir_resize_uint8(image, x, y, x*channels, resized_image, w, h, w*channels, channels);
|
||||
|
||||
if (match_cc(extension, "png")){
|
||||
stbi_write_png(dst_file, w, h, channels, resized_image, w*channels);
|
||||
}
|
||||
|
||||
free(image);
|
||||
free(resized_image);
|
||||
}
|
||||
|
||||
static void
|
||||
generate_site(char *code_directory, char *asset_directory, char *src_directory, char *dst_directory){
|
||||
int32_t size = (512 << 20);
|
||||
|
@ -432,9 +445,17 @@ generate_site(char *code_directory, char *asset_directory, char *src_directory,
|
|||
node = node->next){
|
||||
Image_Instantiation *inst = NodeGetData(node, Image_Instantiation);
|
||||
|
||||
char space[256];
|
||||
char space[256];
|
||||
if (img_get_link_string(img, space, sizeof(space), inst->w, inst->h)){
|
||||
do_image_resize(part, img->source_file, dst_directory, space, inst->w, inst->h);
|
||||
char space2[256];
|
||||
String str = make_fixed_width_string(space2);
|
||||
|
||||
append_sc(&str, dst_directory);
|
||||
append_sc(&str, "/");
|
||||
append_sc(&str, space);
|
||||
terminate_with_null(&str);
|
||||
|
||||
do_image_resize(part, img->source_file, space2, img->extension, inst->w, inst->h);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,10 @@ Getting started with 4coder and navigating your files:
|
|||
|
||||
\VIDEO{youtube:https://www.youtube.com/embed/h5cbOcnSrcc}
|
||||
|
||||
Setting up and navigating your project with 4coder:
|
||||
|
||||
\VIDEO{youtube:https://www.youtube.com/embed/glPEpaT6GH0}
|
||||
|
||||
More tutorials coming soon.
|
||||
|
||||
|
||||
|
|
|
@ -159,7 +159,7 @@ folders.
|
|||
return(result);
|
||||
}
|
||||
|
||||
API_EXPORT bool32
|
||||
API_EXPORT int32_t
|
||||
Get_4ed_Path(Application_Links *app, char *out, int32_t capacity)
|
||||
/*
|
||||
DOC_PARAM(out, This parameter provides a character buffer that receives the path to the 4ed executable file.)
|
||||
|
@ -167,7 +167,8 @@ DOC_PARAM(capacity, This parameter specifies the maximum capacity of the out buf
|
|||
DOC_RETURN(This call returns non-zero on success.)
|
||||
*/{
|
||||
String str = make_string_cap(out, 0, capacity);
|
||||
return(system_get_binary_path(&str));
|
||||
int32_t size = system_get_binary_path(&str);
|
||||
return(size);
|
||||
}
|
||||
|
||||
// TODO(allen): add a "shown but auto-hides on timer" setting here.
|
||||
|
|
Loading…
Reference in New Issue