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
|
||||
|
|
53
build.cpp
53
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,12 +910,22 @@ 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.
|
@ -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
|
||||
|
@ -122,10 +124,10 @@ assert_files_are_equal(char *directory, char *filename1, char *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){
|
||||
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);
|
||||
|
@ -148,10 +150,10 @@ assert_files_are_equal(char *directory, char *filename1, char *filename2){
|
|||
}
|
||||
|
||||
end_tail_part(temp);
|
||||
}
|
||||
}
|
||||
|
||||
static Abstract_Item*
|
||||
generate_homepage(Document_System *doc_system, Partition *part, char *src_directory){
|
||||
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");
|
||||
|
||||
|
@ -160,11 +162,11 @@ assert_files_are_equal(char *directory, char *filename1, char *filename2){
|
|||
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){
|
||||
// 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 } ,
|
||||
|
@ -296,10 +298,10 @@ assert_files_are_equal(char *directory, char *filename1, char *filename2){
|
|||
end_document_description(doc);
|
||||
|
||||
return(doc);
|
||||
}
|
||||
}
|
||||
|
||||
static Abstract_Item*
|
||||
generate_feature_list(Document_System *doc_system, Partition *part, char *src_directory){
|
||||
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");
|
||||
|
||||
|
@ -308,10 +310,10 @@ assert_files_are_equal(char *directory, char *filename1, char *filename2){
|
|||
end_document_description(doc);
|
||||
|
||||
return(doc);
|
||||
}
|
||||
}
|
||||
|
||||
static Abstract_Item*
|
||||
generate_roadmap(Document_System *doc_system, Partition *part, char *src_directory){
|
||||
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");
|
||||
|
||||
|
@ -320,10 +322,10 @@ assert_files_are_equal(char *directory, char *filename1, char *filename2){
|
|||
end_document_description(doc);
|
||||
|
||||
return(doc);
|
||||
}
|
||||
}
|
||||
|
||||
static Abstract_Item*
|
||||
generate_tutorials(Document_System *doc_system, Partition *part, char *src_directory){
|
||||
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");
|
||||
|
||||
|
@ -332,21 +334,32 @@ assert_files_are_equal(char *directory, char *filename1, char *filename2){
|
|||
end_document_description(doc);
|
||||
|
||||
return(doc);
|
||||
}
|
||||
}
|
||||
|
||||
static String
|
||||
push_string(Partition *part, int32_t size){
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
free(image);
|
||||
free(resized_image);
|
||||
}
|
||||
|
||||
static void
|
||||
generate_site(char *code_directory, char *asset_directory, char *src_directory, char *dst_directory){
|
||||
|
@ -434,7 +447,15 @@ generate_site(char *code_directory, char *asset_directory, char *src_directory,
|
|||
|
||||
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