doc generator prototype

master
Allen Webster 2016-06-24 15:33:37 -04:00
parent 73d3826a6a
commit 239985696f
10 changed files with 541 additions and 118 deletions

145
4coder_API.html Normal file
View File

@ -0,0 +1,145 @@
<html lang="en-US">
<head>
<title>4coder API Docs</title>
</head>
<body style='font-family:Arial;'>
<h1>4coder API</h1><h2>
&sect;1 Introduction</h2>
<div style='margin-bottom: 5mm;'><i>Coming Soon</i></div><h2>
&sect;2 Functions</h2>
<div>
exec_command
</div>
<div>
exec_system_command
</div>
<div>
directory_get_hot
</div>
<div>
get_4ed_path
</div>
<div>
file_exists
</div>
<div>
directory_cd
</div>
<div>
get_file_list
</div>
<div>
free_file_list
</div>
<div>
clipboard_post
</div>
<div>
clipboard_count
</div>
<div>
clipboard_index
</div>
<div>
get_buffer_first
</div>
<div>
get_buffer_next
</div>
<div>
get_buffer
</div>
<div>
get_buffer_by_name
</div>
<div>
buffer_seek
</div>
<div>
buffer_read_range
</div>
<div>
buffer_replace_range
</div>
<div>
buffer_set_setting
</div>
<div>
buffer_auto_indent
</div>
<div>
create_buffer
</div>
<div>
save_buffer
</div>
<div>
kill_buffer
</div>
<div>
get_view_first
</div>
<div>
get_view_next
</div>
<div>
get_view
</div>
<div>
get_active_view
</div>
<div>
view_compute_cursor
</div>
<div>
view_set_cursor
</div>
<div>
view_set_mark
</div>
<div>
view_set_highlight
</div>
<div>
view_set_buffer
</div>
<div>
view_post_fade
</div>
<div>
view_set_paste_rewrite_
</div>
<div>
view_get_paste_rewrite_
</div>
<div>
get_user_input
</div>
<div>
get_command_input
</div>
<div>
get_mouse_state
</div>
<div>
start_query_bar
</div>
<div>
end_query_bar
</div>
<div>
print_message
</div>
<div>
change_theme
</div>
<div>
change_font
</div>
<div>
set_theme_colors
</div>
<div>
get_theme_colors
</div>
</body></html>

View File

@ -35,11 +35,10 @@
#define VIEW_GET_PASTE_REWRITE__SIG(n) int n(Application_Links *app, View_Summary *view)
#define GET_USER_INPUT_SIG(n) User_Input n(Application_Links *app, unsigned int get_type, unsigned int abort_type)
#define GET_COMMAND_INPUT_SIG(n) User_Input n(Application_Links *app)
#define GET_EVENT_MESSAGE_SIG(n) Event_Message n(Application_Links *app)
#define GET_MOUSE_STATE_SIG(n) Mouse_State n(Application_Links *app)
#define START_QUERY_BAR_SIG(n) int n(Application_Links *app, Query_Bar *bar, unsigned int flags)
#define END_QUERY_BAR_SIG(n) void n(Application_Links *app, Query_Bar *bar, unsigned int flags)
#define PRINT_MESSAGE_SIG(n) void n(Application_Links *app, char *string, int len)
#define PRINT_MESSAGE_SIG(n) void n(Application_Links *app, char *str, int len)
#define CHANGE_THEME_SIG(n) void n(Application_Links *app, char *name, int len)
#define CHANGE_FONT_SIG(n) void n(Application_Links *app, char *name, int len)
#define SET_THEME_COLORS_SIG(n) void n(Application_Links *app, Theme_Color *colors, int count)
@ -82,7 +81,6 @@ extern "C"{
typedef VIEW_GET_PASTE_REWRITE__SIG(View_Get_Paste_Rewrite__Function);
typedef GET_USER_INPUT_SIG(Get_User_Input_Function);
typedef GET_COMMAND_INPUT_SIG(Get_Command_Input_Function);
typedef GET_EVENT_MESSAGE_SIG(Get_Event_Message_Function);
typedef GET_MOUSE_STATE_SIG(Get_Mouse_State_Function);
typedef START_QUERY_BAR_SIG(Start_Query_Bar_Function);
typedef END_QUERY_BAR_SIG(End_Query_Bar_Function);
@ -132,7 +130,6 @@ struct Application_Links{
View_Get_Paste_Rewrite__Function *view_get_paste_rewrite_;
Get_User_Input_Function *get_user_input;
Get_Command_Input_Function *get_command_input;
Get_Event_Message_Function *get_event_message;
Get_Mouse_State_Function *get_mouse_state;
Start_Query_Bar_Function *start_query_bar;
End_Query_Bar_Function *end_query_bar;
@ -184,7 +181,6 @@ app_links->view_set_paste_rewrite_ = external_view_set_paste_rewrite_;\
app_links->view_get_paste_rewrite_ = external_view_get_paste_rewrite_;\
app_links->get_user_input = external_get_user_input;\
app_links->get_command_input = external_get_command_input;\
app_links->get_event_message = external_get_event_message;\
app_links->get_mouse_state = external_get_mouse_state;\
app_links->start_query_bar = external_start_query_bar;\
app_links->end_query_bar = external_end_query_bar;\

View File

@ -31,16 +31,16 @@ NOTES ON USE:
#ifndef FRED_STRING_STRUCT
#define FRED_STRING_STRUCT
struct String{
typedef struct String{
char *str;
int32_t size;
int32_t memory_size;
};
} String;
struct Offset_String{
typedef struct Offset_String{
int32_t offset;
int32_t size;
};
} Offset_String;
#endif
#ifndef fstr_bool
@ -187,25 +187,29 @@ FSTRING_INLINE fstr_bool terminate_with_null(String *str){
FSTRING_LINK fstr_bool append_padding(String *dest, char c, int32_t target_size);
FSTRING_LINK int32_t compare(char *a, char *b);
FSTRING_LINK int32_t compare(String a, char *b);
FSTRING_INLINE int32_t compare(char *a, String b) { return -compare(b,a); }
FSTRING_LINK int32_t compare(String a, String b);
FSTRING_LINK int32_t compare(char *a, char *b);
FSTRING_LINK int32_t compare(String a, char *b);
FSTRING_INLINE int32_t compare(char *a, String b) { return -compare(b,a); }
FSTRING_LINK int32_t compare(String a, String b);
FSTRING_LINK int32_t reverse_seek_slash(String str);
FSTRING_LINK int32_t reverse_seek_slash(String str, int32_t start_pos);
FSTRING_INLINE String front_of_directory(String dir) { return substr(dir, reverse_seek_slash(dir) + 1); }
FSTRING_INLINE String path_of_directory(String dir) { return substr(dir, 0, reverse_seek_slash(dir) + 1); }
FSTRING_INLINE fstr_bool get_front_of_directory(String *dest, String dir) { return append_checked(dest, front_of_directory(dir)); }
FSTRING_INLINE fstr_bool get_path_of_directory(String *dest, String dir) { return append_checked(dest, path_of_directory(dir)); }
FSTRING_LINK fstr_bool set_last_folder(String *dir, char *folder_name, char slash);
FSTRING_LINK fstr_bool set_last_folder(String *dir, String folder_name, char slash);
FSTRING_LINK String file_extension(String str);
FSTRING_LINK String file_extension_slowly(char *str);
FSTRING_LINK char * file_extension_c(String str);
FSTRING_LINK fstr_bool remove_last_folder(String *str);
FSTRING_LINK void replace_char(String str, char replace, char with);
FSTRING_LINK void replace_char(char *str, char replace, char with);
// TODO(allen): Add hash-table extension to string sets.
FSTRING_LINK fstr_bool string_set_match(String *str_set, int32_t count, String str, int32_t *match_index);
FSTRING_LINK int32_t reverse_seek_slash(String str);
FSTRING_LINK int32_t reverse_seek_slash(String str, int32_t start_pos);
FSTRING_INLINE String front_of_directory(String dir) { return substr(dir, reverse_seek_slash(dir) + 1); }
FSTRING_INLINE String path_of_directory(String dir) { return substr(dir, 0, reverse_seek_slash(dir) + 1); }
FSTRING_INLINE fstr_bool get_front_of_directory(String *dest, String dir) { return append_checked(dest, front_of_directory(dir)); }
FSTRING_INLINE fstr_bool get_path_of_directory(String *dest, String dir) { return append_checked(dest, path_of_directory(dir)); }
FSTRING_LINK fstr_bool set_last_folder(String *dir, char *folder_name, char slash);
FSTRING_LINK fstr_bool set_last_folder(String *dir, String folder_name, char slash);
FSTRING_LINK String file_extension(String str);
FSTRING_LINK String file_extension_slowly(char *str);
FSTRING_LINK char * file_extension_c(String str);
FSTRING_LINK fstr_bool remove_last_folder(String *str);
FSTRING_LINK void replace_char(String str, char replace, char with);
FSTRING_LINK void replace_char(char *str, char replace, char with);
FSTRING_INLINE String string_zero(){
String str={0};
@ -1251,6 +1255,20 @@ replace_char(char *str, char replace, char with){
}
}
FSTRING_LINK fstr_bool
string_set_match(String *str_set, int32_t count, String str, int32_t *match_index){
fstr_bool result = false;
int32_t i = 0;
for (; i < count; ++i, ++str_set){
if (match(*str_set, str)){
*match_index = i;
result = true;
break;
}
}
return(result);
}
// NOTE(allen): experimental section, things below here are
// not promoted to public API level yet.

View File

@ -1310,7 +1310,21 @@ VIEW_GET_PASTE_REWRITE__SIG(external_view_get_paste_rewrite_){
return(result);
}
GET_USER_INPUT_SIG(external_get_user_input){
GET_USER_INPUT_SIG(external_get_user_input)/*
DOC_PARAM(get_type, input type flag that specifies the types of inputs that should be returned)
DOC_PARAM(abort_type, input type flag that specifies the types of inputs that should cause an abort signal)
DOC_RETURN(returns a User_Input that describes an event passed to the command)
DOC
(
This call preempts the command. The command is resumed if either a get or abort condition
is met, or if another command is executed. If either the abort condition is met or another
command is executed an abort signal is returned. If an abort signal is ever returned the
command should finish execution without any more calls that preempt the command.
If a get condition is met the user input is returned
)
DOC_SEE(Input_Type_Flag)
DOC_SEE(User_Input)
*/{
Command_Data *cmd = (Command_Data*)app->cmd_context;
System_Functions *system = cmd->system;
Coroutine *coroutine = (Coroutine*)app->current_coroutine;
@ -1327,7 +1341,10 @@ GET_USER_INPUT_SIG(external_get_user_input){
return(result);
}
GET_COMMAND_INPUT_SIG(external_get_command_input){
GET_COMMAND_INPUT_SIG(external_get_command_input)/*
DOC_RETURN(returns the input that triggered the command in execution.)
DOC_SEE(User_Input)
*/{
Command_Data *cmd = (Command_Data*)app->cmd_context;
User_Input result;
@ -1339,13 +1356,17 @@ GET_COMMAND_INPUT_SIG(external_get_command_input){
return(result);
}
GET_MOUSE_STATE_SIG(external_get_mouse_state){
GET_MOUSE_STATE_SIG(external_get_mouse_state)/*
DOC_RETURN(returns the current mouse state)
DOC_SEE(Mouse_State)
*/{
Command_Data *cmd = (Command_Data*)app->cmd_context;
App_Vars *vars = cmd->vars;
Mouse_State mouse = direct_get_mouse_state(&vars->available_input);
return(mouse);
}
#if 0
GET_EVENT_MESSAGE_SIG(external_get_event_message){
Event_Message message = {0};
System_Functions *system = (System_Functions*)app->system_links;
@ -1359,8 +1380,18 @@ GET_EVENT_MESSAGE_SIG(external_get_event_message){
return(message);
}
#endif
START_QUERY_BAR_SIG(external_start_query_bar){
START_QUERY_BAR_SIG(external_start_query_bar)/*
DOC_PARAM(bar, a pointer to the Query_Bar struct that defines the bar's contents)
DOC_PARAM(flags, not currently used)
DOC_RETURN(returns non-zero on success)
DOC
(
The memory pointed to by bar must remain valid until a call to end_query_bar or
until the command returns.
)
*/{
Command_Data *cmd = (Command_Data*)app->cmd_context;
Query_Slot *slot = 0;
View *vptr;
@ -1373,20 +1404,33 @@ START_QUERY_BAR_SIG(external_start_query_bar){
return(slot != 0);
}
END_QUERY_BAR_SIG(external_end_query_bar){
END_QUERY_BAR_SIG(external_end_query_bar)/*
DOC_PARAM(bar, a pointer to the Query_Bar struct to end)
DOC_PARAM(flags, not currently used)
DOC
(
bar must be a pointer previously passed to start_query_bar previously in the same command.
)
*/{
Command_Data *cmd = (Command_Data*)app->cmd_context;
View *vptr;
vptr = cmd->view;
free_query_slot(&vptr->query_set, bar);
}
PRINT_MESSAGE_SIG(external_print_message){
PRINT_MESSAGE_SIG(external_print_message)/*
DOC_PARAM(str, the string to post to *messages*)
DOC_PARAM(len, the length of str string)
*/{
Command_Data *cmd = (Command_Data*)app->cmd_context;
Models *models = cmd->models;
do_feedback_message(cmd->system, models, make_string(string, len));
do_feedback_message(cmd->system, models, make_string(str, len));
}
CHANGE_THEME_SIG(external_change_theme){
CHANGE_THEME_SIG(external_change_theme)/*
DOC_PARAM(name, the name of the built in theme to change to)
DOC_PARAM(len, the length of the name string)
*/{
Command_Data *cmd = (Command_Data*)app->cmd_context;
Style_Library *styles = &cmd->models->styles;
String theme_name = make_string(name, len);
@ -1403,7 +1447,10 @@ CHANGE_THEME_SIG(external_change_theme){
}
}
CHANGE_FONT_SIG(external_change_font){
CHANGE_FONT_SIG(external_change_font)/*
DOC_PARAM(name, the name of the built in font to change to)
DOC_PARAM(len, the length of the name string)
*/{
Command_Data *cmd = (Command_Data*)app->cmd_context;
Font_Set *set = cmd->models->font_set;
Style_Font *global_font = &cmd->models->global_font;
@ -1416,7 +1463,15 @@ CHANGE_FONT_SIG(external_change_font){
}
}
SET_THEME_COLORS_SIG(external_set_theme_colors){
SET_THEME_COLORS_SIG(external_set_theme_colors)/*
DOC_PARAM(colors, an array of color structs pairing differet style tags to color codes)
DOC_PARAM(count, the number of color structs in the colors array)
DOC
(
For each color struct in the array, the color in the style pallet is set to the color
code paired with the tag.
)
*/{
Command_Data *cmd = (Command_Data*)app->cmd_context;
Style *style = main_style(cmd->models);
@ -1430,7 +1485,15 @@ SET_THEME_COLORS_SIG(external_set_theme_colors){
}
}
GET_THEME_COLORS_SIG(external_get_theme_colors){
GET_THEME_COLORS_SIG(external_get_theme_colors)/*
DOC_PARAM(colors, an array of color structs listing style tags to get color values for)
DOC_PARAM(count, the number of color structs in the colors array)
DOC
(
For each color struct in the array, the color field of the struct is filled with the
color from the specified color in the pallet.
)
*/{
Command_Data *cmd = (Command_Data*)app->cmd_context;
Style *style = main_style(cmd->models);

View File

@ -1,17 +1,24 @@
/*
* Mr. 4th Dimention - Allen Webster
*
* 25.02.2016
*
* File editing view for 4coder
*
*/
* Mr. 4th Dimention - Allen Webster
*
* 25.02.2016
*
* File editing view for 4coder
*
*/
// TOP
#include "4ed_meta.h"
#define FCPP_STRING_IMPLEMENTATION
#include "4coder_string.h"
#include "4cpp_types.h"
#include "4cpp_lexer_types.h"
#define FCPP_LEXER_IMPLEMENTATION
#include "4cpp_lexer.h"
struct Struct_Field{
char *type;
char *name;
@ -26,6 +33,15 @@ void to_lower(char *src, char *dst){
*dst = 0;
}
void to_lower(String *str){
char *c;
int i = 0;
int size = str->size;
for (c = str->str; i < size; ++c, ++i){
*c = char_to_lower(*c);
}
}
void to_upper(char *src, char *dst){
char *c, ch;
for (c = src; *c != 0; ++c){
@ -35,6 +51,15 @@ void to_upper(char *src, char *dst){
*dst = 0;
}
void to_upper(String *str){
char *c;
int i = 0;
int size = str->size;
for (c = str->str; i < size; ++c, ++i){
*c = char_to_upper(*c);
}
}
void to_camel(char *src, char *dst){
char *c, ch;
int is_first = 1;
@ -303,13 +328,25 @@ char* generate_style(){
}
//////////////////////////////////////////////////////////////////////////////////////////////////
struct Function_Signature{
String name;
String ret;
String args;
int valid;
struct Function_Set{
String *name;
String *ret;
String *args;
String *macros;
String *public_name;
int *valid;
};
void
zero_index(Function_Set fnc_set, int sig_count){
fnc_set.name [sig_count] = string_zero();
fnc_set.ret [sig_count] = string_zero();
fnc_set.args [sig_count] = string_zero();
fnc_set.valid[sig_count] = 0;
}
String
file_dump(char *filename){
String result = {0};
@ -391,9 +428,71 @@ is_comment(String str){
return(result);
}
struct Doc_Parse{
Cpp_Token_Stack tokens;
String doc_string;
};
int
check_and_fix_docs(String *lexeme){
int result = false;
if (lexeme->size > 4){
if (lexeme->str[0] == '/'){
if (lexeme->str[1] == '*'){
if (lexeme->str[lexeme->size - 2] == '*'){
if (lexeme->str[lexeme->size - 1] == '/'){
result = true;
lexeme->str += 2;
lexeme->size -= 4;
}
}
}
}
}
return(result);
}
static String
doc_note_string[] = {
make_lit_string("DOC_PARAM"),
make_lit_string("DOC_RETURN"),
make_lit_string("DOC"),
make_lit_string("DOC_SEE"),
};
void
perform_doc_parse(Doc_Parse *parse, String lexeme){
#if 0
int keep_parsing = true;
int pos = 0;
do{
String doc_note = doc_parse_identifier(lexeme, &pos);
if (doc_note.size == 0){
keep_parsing = false;
}
else{
if (string_set_match(doc_note_string, ArrayCount(doc_note_string), doc_note, &match)){
}
else{
// TODO(allen): do warning
}
}
}while(keep_parsing);
#endif
}
char*
generate_custom_headers(){
char *filename = "4coder_custom_api.h";
#define API_H "4coder_custom_api.h"
#define API_DOC "4coder_API.html"
char *filename = API_H " & " API_DOC;
// NOTE(allen): Header
String data = file_dump("custom_api_spec.cpp");
int line_count = 0;
@ -404,8 +503,14 @@ generate_custom_headers(){
++line_count;
}
Function_Signature *sigs =
(Function_Signature*)malloc(sizeof(Function_Signature)*line_count);
Function_Set function_set = {0};
function_set.name = (String*)malloc((sizeof(String)*5 + sizeof(int))*line_count);
function_set.ret = function_set.name + line_count;
function_set.args = function_set.ret + line_count;
function_set.macros = function_set.args + line_count;
function_set.public_name = function_set.macros + line_count;
function_set.valid = (int*)(function_set.public_name + line_count);
int max_name_size = 0;
int sig_count = 0;
@ -421,85 +526,101 @@ generate_custom_headers(){
parse = chop_whitespace(parse);
if (parse.size > 0){
if (!is_comment(parse)){
Function_Signature *sig = sigs + sig_count;
memset(sig, 0, sizeof(*sig));
++sig_count;
zero_index(function_set, sig_count);
int valid = false;
int pos = find(parse, 0, ' ');
sig->ret = substr(parse, 0, pos);
function_set.ret[sig_count] = substr(parse, 0, pos);
parse = substr(parse, pos);
parse = skip_whitespace(parse);
if (parse.size > 0){
pos = find(parse, 0, '(');
sig->name = substr(parse, 0, pos);
sig->name = chop_whitespace(sig->name);
String name_string = substr(parse, 0, pos);
function_set.name[sig_count] = chop_whitespace(name_string);
parse = substr(parse, pos);
if (parse.size > 0){
char end = parse.str[parse.size - 1];
int valid = true;
valid = true;
switch (end){
case ')':
sig->args = parse;
function_set.args[sig_count] = parse;
break;
case ';':
--parse.size;
sig->args = parse;
function_set.args[sig_count] = parse;
break;
default:
valid = false;
break;
}
sig->valid = valid;
function_set.valid[sig_count] = valid;
if (max_name_size < sig->name.size){
max_name_size = sig->name.size;
if (max_name_size < name_string.size){
max_name_size = name_string.size;
}
}
}
if (!sig->valid){
if (!valid){
printf("custom_api_spec.cpp(%d) : generator warning : invalid function signature\n",
line_count);
}
++sig_count;
}
}
}
FILE *file = fopen("4coder_custom_api.h", "wb");
int buffer_size = max_name_size + 1;
char *name_buffer = (char*)malloc(buffer_size);
FILE *file = fopen(API_H, "wb");
for (int i = 0; i < sig_count; ++i){
Function_Signature *sig = sigs + i;
String name_string = function_set.name[i];
String *macro = function_set.macros + i;
String *public_name = function_set.public_name + i;
copy_fast_unsafe(name_buffer, sig->name);
name_buffer[sig->name.size] = 0;
to_upper(name_buffer, name_buffer);
macro->size = 0;
macro->memory_size = name_string.size+4;
fprintf(file, "#define %s_SIG(n) %.*s n%.*s\n",
name_buffer,
sig->ret.size, sig->ret.str,
sig->args.size, sig->args.str
macro->str = (char*)malloc(macro->memory_size);
copy(macro, name_string);
to_upper(macro);
append(macro, make_lit_string("_SIG"));
public_name->size = 0;
public_name->memory_size = name_string.size;
public_name->str = (char*)malloc(public_name->memory_size);
copy(public_name, name_string);
to_lower(public_name);
}
for (int i = 0; i < sig_count; ++i){
String ret_string = function_set.ret[i];
String args_string = function_set.args[i];
String macro_string = function_set.macros[i];
fprintf(file, "#define %.*s(n) %.*s n%.*s\n",
macro_string.size, macro_string.str,
ret_string.size, ret_string.str,
args_string.size, args_string.str
);
}
fprintf(file, "extern \"C\"{\n");
for (int i = 0; i < sig_count; ++i){
Function_Signature *sig = sigs + i;
String name_string = function_set.name[i];
String macro_string = function_set.macros[i];
copy_fast_unsafe(name_buffer, sig->name);
name_buffer[sig->name.size] = 0;
to_upper(name_buffer, name_buffer);
fprintf(file, " typedef %s_SIG(%.*s_Function);\n",
name_buffer,
sig->name.size, sig->name.str);
fprintf(file, " typedef %.*s(%.*s_Function);\n",
macro_string.size, macro_string.str,
name_string.size, name_string.str);
}
fprintf(file, "}\n");
@ -509,15 +630,12 @@ generate_custom_headers(){
" int memory_size;\n"
);
for (int i = 0; i < sig_count; ++i){
Function_Signature *sig = sigs + i;
String name_string = function_set.name[i];
String public_string = function_set.public_name[i];
copy_fast_unsafe(name_buffer, sig->name);
name_buffer[sig->name.size] = 0;
to_lower(name_buffer, name_buffer);
fprintf(file, " %.*s_Function *%s;\n",
sig->name.size, sig->name.str,
name_buffer);
fprintf(file, " %.*s_Function *%.*s;\n",
name_string.size, name_string.str,
public_string.size, public_string.str);
}
fprintf(file,
" void *cmd_context;\n"
@ -529,34 +647,106 @@ generate_custom_headers(){
fprintf(file, "#define FillAppLinksAPI(app_links) do{");
for (int i = 0; i < sig_count; ++i){
Function_Signature *sig = sigs + i;
copy_fast_unsafe(name_buffer, sig->name);
name_buffer[sig->name.size] = 0;
to_lower(name_buffer, name_buffer);
String public_string = function_set.public_name[i];
fprintf(file,
"\\\n"
"app_links->%s = external_%s;",
name_buffer, name_buffer
"app_links->%.*s = external_%.*s;",
public_string.size, public_string.str,
public_string.size, public_string.str
);
}
fprintf(file, " } while(false)\n");
fclose(file);
// NOTE(allen): Documentation
String code_data[2];
Doc_Parse parses[2];
code_data[0] = file_dump("4ed_api_implementation.cpp");
code_data[1] = file_dump("win32_4ed.cpp");
for (int J = 0; J < 2; ++J){
String *code = &code_data[J];
Doc_Parse *parse = &parses[J];
// TODO(allen): KILL THIS FUCKIN' Cpp_File FUCKIN NONSENSE BULLSHIT!!!!!
Cpp_File file;
file.data = code->str;
file.size = code->size;
parse->tokens = cpp_make_token_stack(512);
cpp_lex_file(file, &parse->tokens);
int count = parse->tokens.count;
Cpp_Token *tokens = parse->tokens.tokens;
Cpp_Token *token = tokens;
for (int i = 0; i < count; ++i, ++token){
if (token->type == CPP_TOKEN_IDENTIFIER){
String lexeme = make_string(file.data + token->start, token->size);
int match = 0;
if (string_set_match(function_set.macros, sig_count, lexeme, &match)){
for (; i < count; ++i, ++token){
if (token->type == CPP_TOKEN_COMMENT){
lexeme = make_string(file.data + token->start, token->size);
if (check_and_fix_docs(&lexeme)){
perform_doc_parse(parse, lexeme);
break;
}
}
}
}
}
}
}
file = fopen(API_DOC, "wb");
fprintf(file,
"<html lang=\"en-US\">\n"
"<head>\n"
"<title>4coder API Docs</title>\n"
"</head>\n"
"<body style='font-family:Arial;'>\n"
"<h1>4coder API</h1>"
);
fprintf(file,
"<h2>\n&sect;1 Introduction</h2>\n"
"<div style='margin-bottom: 5mm;'><i>Coming Soon</i></div>");
fprintf(file, "<h2>\n&sect;2 Functions</h2>\n");
for (int i = 0; i < sig_count; ++i){
String name = function_set.public_name[i];
fprintf(file,
"<div>\n"
"%.*s\n"
"</div>\n",
name.size, name.str
);
}
fprintf(file,
"</body>"
"</html>\n"
);
fclose(file);
return(filename);
}
int main(){
char *filename;
char *filename = 0;
filename = generate_keycode_enum();
printf("gen success: %s\n", filename);
filename = generate_style();
printf("gen success: %s\n", filename);
filename = generate_custom_headers();
printf("gen success: %s\n", filename);
}

View File

@ -1,4 +1,4 @@
Distribution Date: 23.6.2016 (dd.mm.yyyy)
Distribution Date: 24.6.2016 (dd.mm.yyyy)
Thank you for contributing to the 4coder project!

View File

@ -1,4 +1,4 @@
Distribution Date: 23.6.2016 (dd.mm.yyyy)
Distribution Date: 24.6.2016 (dd.mm.yyyy)
Thank you for contributing to the 4coder project!

View File

@ -1,5 +1,14 @@
@echo off
pushd ..\meta
REM cl %OPTS% ..\code\4ed_metagen.cpp /Zi /Femetagen
popd
pushd ..\code
REM "..\meta\metagen"
popd
REM "build_exp.bat" /Zi
"build_all.bat" /DFRED_SUPER /DFRED_INTERNAL /Zi
REM "build_all.bat" /O2 /Zi

View File

@ -56,21 +56,21 @@ void View_Set_Paste_Rewrite_(Application_Links *app, View_Summary *view);
int View_Get_Paste_Rewrite_(Application_Links *app, View_Summary *view);
// Directly get user input
User_Input Get_User_Input(Application_Links *app, unsigned int get_type, unsigned int abort_type);
User_Input Get_Command_Input(Application_Links *app);
Event_Message Get_Event_Message(Application_Links *app);
Mouse_State Get_Mouse_State(Application_Links *app);
User_Input Get_User_Input (Application_Links *app, unsigned int get_type, unsigned int abort_type);
User_Input Get_Command_Input (Application_Links *app);
Mouse_State Get_Mouse_State (Application_Links *app);
//Event_Message Get_Event_Message (Application_Links *app);
// Queries and information display
int Start_Query_Bar(Application_Links *app, Query_Bar *bar, unsigned int flags);
void End_Query_Bar(Application_Links *app, Query_Bar *bar, unsigned int flags);
void Print_Message(Application_Links *app, char *string, int len);
int Start_Query_Bar (Application_Links *app, Query_Bar *bar, unsigned int flags);
void End_Query_Bar (Application_Links *app, Query_Bar *bar, unsigned int flags);
void Print_Message (Application_Links *app, char *str, int len);
//GUI_Functions* Get_GUI_Functions(Application_Links *app);
//GUI* Get_GUI(Application_Links *app, int view_id);
// Color settings
void Change_Theme(Application_Links *app, char *name, int len);
void Change_Font(Application_Links *app, char *name, int len);
void Set_Theme_Colors(Application_Links *app, Theme_Color *colors, int count);
void Get_Theme_Colors(Application_Links *app, Theme_Color *colors, int count);
void Change_Theme (Application_Links *app, char *name, int len);
void Change_Font (Application_Links *app, char *name, int len);
void Set_Theme_Colors (Application_Links *app, Theme_Color *colors, int count);
void Get_Theme_Colors (Application_Links *app, Theme_Color *colors, int count);

View File

@ -16,6 +16,7 @@ copy ..\build\4ed_app.pdb ..\current_dist\4coder\*
copy ..\data\* ..\current_dist\4coder\*
copy README.txt ..\current_dist\4coder\*
copy TODO.txt ..\current_dist\4coder\*
copy 4coder_API.html ..\current_dist\4coder\*
del ..\current_dist\SUPERREADME.txt
del ..\current_dist\4coder\basic.cpp
del ..\current_dist\4coder\.4coder_settings
@ -33,6 +34,7 @@ copy 4coder_*.cpp ..\current_dist_super\4coder\*
copy README.txt ..\current_dist_super\4coder\*
copy TODO.txt ..\current_dist_super\4coder\*
copy SUPERREADME.txt ..\current_dist_super\4coder\*
copy 4coder_API.html ..\current_dist_super\4coder\*
copy ..\current_dist\4coder\3rdparty\* ..\current_dist_super\4coder\3rdparty\*
REM del ..\current_dist_super\4coder\*.pdb
del ..\current_dist_super\4coder\*.lib