built out the entire site
parent
43c2df99d4
commit
87003907a7
|
@ -525,7 +525,7 @@ init_build_line(Build_Line *line){
|
|||
|
||||
#define CL_INCLUDES "/I..\\foreign /I..\\foreign\\freetype2"
|
||||
|
||||
#define CL_SITE_INCLUDES "/I..\\..\\code"
|
||||
#define CL_SITE_INCLUDES "/I..\\..\\foreign /I..\\..\\code"
|
||||
|
||||
#define CL_LIBS \
|
||||
"user32.lib winmm.lib gdi32.lib opengl32.lib " \
|
||||
|
@ -609,7 +609,7 @@ build_cl(uint32_t flags, char *code_path, char *code_file, char *out_path, char
|
|||
|
||||
#define GCC_INCLUDES "-I../foreign -I../code"
|
||||
|
||||
#define GCC_SITE_INCLUDES "-I../../code"
|
||||
#define GCC_SITE_INCLUDES "-I../../foreign -I../../code"
|
||||
|
||||
#define GCC_LIBS \
|
||||
"-L/usr/local/lib -lX11 -lpthread -lm -lrt " \
|
||||
|
@ -931,9 +931,9 @@ site_build(char *cdir, uint32_t flags){
|
|||
BEGIN_TIME_SECTION();
|
||||
|
||||
#if defined(IS_WINDOWS)
|
||||
systemf("..\\build\\site\\sitegen . site\\source_material ..\\site");
|
||||
systemf("..\\build\\site\\sitegen . ..\\foreign\\site-resources site\\source_material ..\\site");
|
||||
#else
|
||||
systemf("../build/site/sitegen . site/source_material ../site");
|
||||
systemf("../build/site/sitegen . ../foreign/site-resources site/source_material ../site");
|
||||
#endif
|
||||
|
||||
END_TIME_SECTION("run sitegen");
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -68,6 +68,52 @@ make_out_string(int32_t x){
|
|||
return(str);
|
||||
}
|
||||
|
||||
static void
|
||||
do_file_copy(Partition *part, char *src_dir, char *src_file, char *dst_dir, char *dst_file){
|
||||
char src[256];
|
||||
char dst[256];
|
||||
String str = {0};
|
||||
int32_t success = 0;
|
||||
|
||||
str = make_fixed_width_string(src);
|
||||
append_sc(&str, src_dir);
|
||||
append_sc(&str, "/");
|
||||
append_sc(&str, src_file);
|
||||
terminate_with_null(&str);
|
||||
|
||||
str = make_fixed_width_string(dst);
|
||||
append_sc(&str, dst_dir);
|
||||
append_sc(&str, "/");
|
||||
append_sc(&str, dst_file);
|
||||
terminate_with_null(&str);
|
||||
|
||||
Temp_Memory temp = begin_temp_memory(part);
|
||||
int32_t mem_size = partition_remaining(part);
|
||||
void *mem = push_block(part, mem_size);
|
||||
FILE *in = fopen(src, "rb");
|
||||
if (in){
|
||||
fseek(in, 0, SEEK_END);
|
||||
int32_t file_size = ftell(in);
|
||||
|
||||
if (mem_size >= file_size){
|
||||
fseek(in, 0, SEEK_SET);
|
||||
fread(mem, 1, file_size, in);
|
||||
|
||||
FILE *out = fopen(dst, "wb");
|
||||
if (out){
|
||||
fwrite(mem, 1, file_size, out);
|
||||
fclose(out);
|
||||
success = 1;
|
||||
}
|
||||
}
|
||||
|
||||
fclose(in);
|
||||
}
|
||||
end_temp_memory(temp);
|
||||
|
||||
assert(success);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// BOTTOM
|
||||
|
|
104
site/sitegen.cpp
104
site/sitegen.cpp
|
@ -9,8 +9,12 @@
|
|||
|
||||
// TOP
|
||||
|
||||
#define STB_IMAGE_IMPLEMENTATION
|
||||
#include "stb_image.h"
|
||||
|
||||
#include "4coder_version.h"
|
||||
#include "internal_4coder_string.cpp"
|
||||
#define FSTRING_IMPLEMENTATION
|
||||
#include "4coder_string.h"
|
||||
#include "4cpp_lexer.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
@ -19,6 +23,10 @@
|
|||
#include <assert.h>
|
||||
|
||||
#include "4coder_mem.h"
|
||||
|
||||
#define CEIL32(x) ((int32_t) ( (x>0)?(x+1.f):(x) ))
|
||||
#define FLOOR32(x) ((int32_t) ( (x>0)?(x):(x-1.f) ))
|
||||
|
||||
#include "meta_parser.cpp"
|
||||
#include "out_context.cpp"
|
||||
#include "abstract_document.cpp"
|
||||
|
@ -31,43 +39,6 @@
|
|||
// Meta Parse Rules
|
||||
//
|
||||
|
||||
#define BACK_COLOR "#FAFAFA"
|
||||
#define TEXT_COLOR "#0D0D0D"
|
||||
#define CODE_BACK "#DFDFDF"
|
||||
#define EXAMPLE_BACK "#EFEFDF"
|
||||
|
||||
#define POP_COLOR_1 "#309030"
|
||||
#define POP_BACK_1 "#E0FFD0"
|
||||
#define VISITED_LINK "#A0C050"
|
||||
|
||||
#define POP_COLOR_2 "#005000"
|
||||
|
||||
#define CODE_STYLE "font-family: \"Courier New\", Courier, monospace; text-align: left;"
|
||||
|
||||
#define CODE_BLOCK_STYLE(back) \
|
||||
"margin-top: 3mm; margin-bottom: 3mm; font-size: .95em; " \
|
||||
"background: "back"; padding: 0.25em;"
|
||||
|
||||
#define DESCRIPT_SECTION_STYLE CODE_BLOCK_STYLE(CODE_BACK)
|
||||
#define EXAMPLE_CODE_STYLE CODE_BLOCK_STYLE(EXAMPLE_BACK)
|
||||
|
||||
#define DOC_HEAD_OPEN "<div style='margin-top: 3mm; margin-bottom: 3mm; color: "POP_COLOR_1";'><b><i>"
|
||||
#define DOC_HEAD_CLOSE "</i></b></div>"
|
||||
|
||||
#define DOC_ITEM_HEAD_STYLE "font-weight: 600;"
|
||||
|
||||
#define DOC_ITEM_HEAD_INL_OPEN "<span style='"DOC_ITEM_HEAD_STYLE"'>"
|
||||
#define DOC_ITEM_HEAD_INL_CLOSE "</span>"
|
||||
|
||||
#define DOC_ITEM_HEAD_OPEN "<div style='"DOC_ITEM_HEAD_STYLE"'>"
|
||||
#define DOC_ITEM_HEAD_CLOSE "</div>"
|
||||
|
||||
#define DOC_ITEM_OPEN "<div style='margin-left: 5mm; margin-right: 5mm;'>"
|
||||
#define DOC_ITEM_CLOSE "</div>"
|
||||
|
||||
#define EXAMPLE_CODE_OPEN "<div style='"CODE_STYLE EXAMPLE_CODE_STYLE"'>"
|
||||
#define EXAMPLE_CODE_CLOSE "</div>"
|
||||
|
||||
static void
|
||||
print_function_body_code(String *out, Parse_Context *context, int32_t start){
|
||||
String pstr = {0}, lexeme = {0};
|
||||
|
@ -152,40 +123,44 @@ assert_files_are_equal(char *directory, char *filename1, char *filename2){
|
|||
}
|
||||
|
||||
static void
|
||||
do_html_output(Document_System *doc_system, Partition *part, char *dst_directory, Abstract_Document *doc){
|
||||
do_html_output(Document_System *doc_system, Partition *part, char *dst_directory, Abstract_Item *doc){
|
||||
// NOTE(allen): Output
|
||||
Temp_Memory temp = begin_temp_memory(part);
|
||||
|
||||
String out = str_alloc(part, 10 << 20);
|
||||
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);
|
||||
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);
|
||||
}
|
||||
}
|
||||
else{
|
||||
fprintf(stderr, "Failed to open %s", space);
|
||||
}
|
||||
}
|
||||
|
||||
end_temp_memory(temp);
|
||||
}
|
||||
|
||||
static Abstract_Document*
|
||||
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_Document *doc = begin_document_description(doc_system, "4coder Home", "home");
|
||||
Abstract_Item *doc = begin_document_description(doc_system, "4coder Home", "home", 0);
|
||||
add_enriched_text(doc, home);
|
||||
end_document_description(doc);
|
||||
|
||||
return(doc);
|
||||
}
|
||||
|
||||
static Abstract_Document*
|
||||
// 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 } ,
|
||||
|
@ -252,7 +227,7 @@ assert_files_are_equal(char *directory, char *filename1, char *filename2){
|
|||
*lexer_introduction = load_enriched_text(part, src_directory, "lexer_introduction.txt");
|
||||
|
||||
// NOTE(allen): Put together the abstract document
|
||||
Abstract_Document *doc = begin_document_description(doc_system, "4coder API Docs", "custom_docs");
|
||||
Abstract_Item *doc = begin_document_description(doc_system, "4coder API Docs", "custom_docs", 1);
|
||||
|
||||
add_table_of_contents(doc);
|
||||
|
||||
|
@ -320,24 +295,24 @@ assert_files_are_equal(char *directory, char *filename1, char *filename2){
|
|||
return(doc);
|
||||
}
|
||||
|
||||
static Abstract_Document*
|
||||
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_Document *doc = begin_document_description(doc_system, "4coder Feature List", "features");
|
||||
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_Document*
|
||||
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_Document *doc = begin_document_description(doc_system, "4coder Roadmap", "roadmap");
|
||||
Abstract_Item *doc = begin_document_description(doc_system, "4coder Roadmap", "roadmap", 0);
|
||||
add_enriched_text(doc, roadmap);
|
||||
end_document_description(doc);
|
||||
|
||||
|
@ -345,7 +320,7 @@ assert_files_are_equal(char *directory, char *filename1, char *filename2){
|
|||
}
|
||||
|
||||
static void
|
||||
generate_site(char *code_directory, char *src_directory, char *dst_directory){
|
||||
generate_site(char *code_directory, char *asset_directory, char *src_directory, char *dst_directory){
|
||||
int32_t size = (512 << 20);
|
||||
void *mem = malloc(size);
|
||||
memset(mem, 0, size);
|
||||
|
@ -354,22 +329,33 @@ generate_site(char *code_directory, char *src_directory, char *dst_directory){
|
|||
Partition *part = &part_;
|
||||
|
||||
Document_System doc_system = create_document_system(part);
|
||||
add_image_description(&doc_system, asset_directory, "4coder_green.png", "4coder_logo.png", "4coder_logo");
|
||||
|
||||
generate_homepage(&doc_system, part, src_directory);
|
||||
generate_4coder_docs(&doc_system, part, code_directory, src_directory);
|
||||
generate_feature_list(&doc_system, part, src_directory);
|
||||
generate_roadmap(&doc_system, part, src_directory);
|
||||
|
||||
for (Document_Node *node = doc_system.head;
|
||||
for (Basic_Node *node = doc_system.img_list.head;
|
||||
node != 0;
|
||||
node = node->next){
|
||||
do_html_output(&doc_system, part, dst_directory, &node->doc);
|
||||
Abstract_Item *img = NodeGetData(node, Abstract_Item);
|
||||
assert(img->item_type == ItemType_Image);
|
||||
do_file_copy(part, asset_directory, img->source_file, dst_directory, img->out_file);
|
||||
}
|
||||
|
||||
for (Basic_Node *node = doc_system.doc_list.head;
|
||||
node != 0;
|
||||
node = node->next){
|
||||
Abstract_Item *doc = NodeGetData(node, Abstract_Item);
|
||||
assert(doc->item_type == ItemType_Document);
|
||||
do_html_output(&doc_system, part, dst_directory, doc);
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char **argv){
|
||||
if (argc == 4){
|
||||
generate_site(argv[1], argv[2], argv[3]);
|
||||
if (argc == 5){
|
||||
generate_site(argv[1], argv[2], argv[3], argv[4]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
|
||||
This page provides a list of 4coder features for anyone trying to determine whether 4coder is the right editor for them. If a feature is missing here you should check out the \BEGIN_LINK{document:roadmap} roadmap \END_LINK page to see what is coming in the future. If the feature you want is on neither, you should contact \CODE_STYLE{editor@4coder.net}. Some features that are already in 4coder might be missing from this list, if you want to be sure you should contact \CODE_STYLE{editor@4coder.net}.
|
||||
\IMAGE{image:4coder_logo}
|
||||
|
||||
This page provides a list of 4coder features for anyone trying to determine whether 4coder is the right editor for them. If a feature is missing here you should check out the \BEGIN_LINK{document:roadmap} roadmap \END_LINK page to see what is coming in the future. If the feature you want is on neither, you should contact \BEGIN_STYLE{code} editor@4coder.net \END_STYLE. Some features that are already in 4coder might be missing from this list, if you want to be sure you should contact \BEGIN_STYLE{code} editor@4coder.net \END_STYLE.
|
||||
|
||||
\SECTION{Text Editing}
|
||||
\BEGIN_LIST
|
||||
|
@ -46,7 +48,7 @@ This page provides a list of 4coder features for anyone trying to determine whet
|
|||
4coder's current setup and editing paradigm is modeled after emacs, so it is very natural to transition to 4coder from emacs for many users. 4coder customization is quite different from emacs though, so anyone who wants to keep their current keybinds will have to take the time to rewrite the keybinding code. Once the initial transition is done, any user who prefers C++ to Lisp will have a much better time in their 4coder configuration code.
|
||||
|
||||
\SECTION{Transition From Vim}
|
||||
For vim users the built-in editing paradigm will not line up with editing habits. Thanks to the open customization model, a vim paradigm and default vim key bindings can be used in 4coder. The vim customization \BEGIN_LINK{https://github.com/Chronister/4vim} here \END_LINK is an early example of this with many basic vim systems up and running.
|
||||
For vim users the built-in editing paradigm will not line up with editing habits. Thanks to the open customization model, a vim paradigm and default vim key bindings can be used in 4coder. The vim customization \BEGIN_LINK{!https://github.com/Chronister/4vim} here \END_LINK is an early example of this with many basic vim systems up and running.
|
||||
|
||||
Right now 4coder is admittedly not great for vim users, but the transition path exists so keep your eyes on 4coder as better vim emulation is still on the way.
|
||||
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
|
||||
\IMAGE{image:4coder_logo}
|
||||
|
||||
4coder is a code editor that first and foremost targets the needs C/C++ developers so that developers in that space can be as efficient as possible. Here you can learn about the features of 4coder, how to get started with 4coder, and how to get the absolute most out of 4cocer.
|
||||
|
||||
If you cannot find what you are looking for please contact \CODE_STYLE{editor@4coder.net} with questions.
|
||||
If you cannot find what you are looking for please contact \BEGIN_STYLE{code} editor@4coder.net \END_STYLE with questions.
|
||||
|
||||
\BEGIN_LINK{document:features} The official 4coder feature list \END_LINK
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
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.
|
||||
|
||||
If you have questions or discover errors please contact \CODE_STYLE{editor@4coder.net} or to get help from members of the 4coder and handmade network community you can post on the 4coder forums hosted at \CODE_STYLE{4coder.handmade.network}.
|
||||
If you have questions or discover errors please contact \BEGIN_STYLE{code} editor@4coder.net \END_STYLE or to get help from members of the 4coder and handmade network community you can post on the 4coder forums hosted at \BEGIN_STYLE{code} 4coder.handmade.network \END_STYLE.
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
|
||||
This page provides an outline of planned 4coder features roughly sorted by priority. If a feature is missing here it may be on the \BEGIN_LINK{document:features} features \END_LINK page which means it is already in 4coder. If a feature is missing from both lists and you would like to recommend it for consideration, send your recommendation to \CODE_STYLE{editor@4coder.net}. If you believe the priority sorting of the items should be tweaked because certain items are more important than others, that recommendation can also be sent to the same 4coder email as any other recommendation.
|
||||
\IMAGE{image:4coder_logo}
|
||||
|
||||
This page provides an outline of planned 4coder features roughly sorted by priority. If a feature is missing here it may be on the \BEGIN_LINK{document:features} features \END_LINK page which means it is already in 4coder. If a feature is missing from both lists and you would like to recommend it for consideration, send your recommendation to \BEGIN_STYLE{code} editor@4coder.net \END_STYLE. If you believe the priority sorting of the items should be tweaked because certain items are more important than others, that recommendation can also be sent to the same 4coder email as any other recommendation.
|
||||
|
||||
Each section represents one major type of todo item, within each section the items are roughly sorted by priority with respect to other items in that section. The sections are also sorted by a rough priority, but more than one section might receive attention at a time.
|
||||
|
||||
|
|
Loading…
Reference in New Issue