got metagen working without Partition
This commit is contained in:
parent
643f656780
commit
bd090a2504
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#define FSTRING_IMPLEMENTATION
|
#define FSTRING_IMPLEMENTATION
|
||||||
#include "../4coder_lib/4coder_string.h"
|
#include "../4coder_lib/4coder_string.h"
|
||||||
#include "../4coder_lib/4coder_mem.h"
|
//#include "../4coder_lib/4coder_mem.h"
|
||||||
|
|
||||||
#include "../4cpp/4cpp_lexer.h"
|
#include "../4cpp/4cpp_lexer.h"
|
||||||
|
|
||||||
|
@ -28,7 +28,10 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#define FTECH_FILE_MOVING_IMPLEMENTATION
|
||||||
|
#include "4ed_file_moving.h"
|
||||||
#include "4ed_meta_parser.cpp"
|
#include "4ed_meta_parser.cpp"
|
||||||
|
#include "4ed_meta_keywords.h"
|
||||||
#include "4ed_out_context.cpp"
|
#include "4ed_out_context.cpp"
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -82,33 +85,33 @@ generate_keycode_enum(){
|
||||||
if (begin_file_out(&context, filename_keycodes, &out)){
|
if (begin_file_out(&context, filename_keycodes, &out)){
|
||||||
int32_t count = ArrayCount(keys_that_need_codes);
|
int32_t count = ArrayCount(keys_that_need_codes);
|
||||||
|
|
||||||
append_sc(&out, "enum{\n");
|
append(&out, "enum{\n");
|
||||||
for (int32_t i = 0; i < count;){
|
for (int32_t i = 0; i < count;){
|
||||||
append_sc(&out, "key_");
|
append(&out, "key_");
|
||||||
append_sc(&out, keys_that_need_codes[i++]);
|
append(&out, keys_that_need_codes[i++]);
|
||||||
append_sc(&out, " = ");
|
append(&out, " = ");
|
||||||
append_int_to_str(&out, code++);
|
append_int_to_str(&out, code++);
|
||||||
append_sc(&out, ",\n");
|
append(&out, ",\n");
|
||||||
}
|
}
|
||||||
append_sc(&out, "};\n");
|
append(&out, "};\n");
|
||||||
|
|
||||||
append_sc(&out,
|
append(&out,
|
||||||
"static char*\n"
|
"static char*\n"
|
||||||
"global_key_name(uint32_t key_code, int32_t *size){\n"
|
"global_key_name(uint32_t key_code, int32_t *size){\n"
|
||||||
"char *result = 0;\n"
|
"char *result = 0;\n"
|
||||||
"switch(key_code){\n");
|
"switch(key_code){\n");
|
||||||
|
|
||||||
for (int32_t i = 0; i < count; ++i){
|
for (int32_t i = 0; i < count; ++i){
|
||||||
append_sc(&out, "case key_");
|
append(&out, "case key_");
|
||||||
append_sc(&out, keys_that_need_codes[i]);
|
append(&out, keys_that_need_codes[i]);
|
||||||
append_sc(&out, ": result = \"");
|
append(&out, ": result = \"");
|
||||||
append_sc(&out, keys_that_need_codes[i]);
|
append(&out, keys_that_need_codes[i]);
|
||||||
append_sc(&out, "\"; *size = sizeof(\"");
|
append(&out, "\"; *size = sizeof(\"");
|
||||||
append_sc(&out, keys_that_need_codes[i]);
|
append(&out, keys_that_need_codes[i]);
|
||||||
append_sc(&out, "\")-1; break;\n");
|
append(&out, "\")-1; break;\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
append_sc(&out,
|
append(&out,
|
||||||
"}\n"
|
"}\n"
|
||||||
"return(result);\n"
|
"return(result);\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
|
@ -120,21 +123,21 @@ generate_keycode_enum(){
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
static void
|
static void
|
||||||
struct_begin(String *str, char *name){
|
struct_begin(String *str, char *name){
|
||||||
append_sc(str, "struct ");
|
append(str, "struct ");
|
||||||
append_sc(str, name);
|
append(str, name);
|
||||||
append_sc(str, "{\n"); //}
|
append(str, "{\n"); //}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
enum_begin(String *str, char *name){
|
enum_begin(String *str, char *name){
|
||||||
append_sc(str, "enum ");
|
append(str, "enum ");
|
||||||
append_sc(str, name);
|
append(str, name);
|
||||||
append_sc(str, "{\n"); //}
|
append(str, "{\n"); //}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
struct_end(String *str){ //{
|
struct_end(String *str){ //{
|
||||||
append_sc(str, "};\n\n");
|
append(str, "};\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static char* bar_style_fields[] = {
|
static char* bar_style_fields[] = {
|
||||||
|
@ -205,46 +208,46 @@ generate_style(){
|
||||||
int32_t count = ArrayCount(bar_style_fields);
|
int32_t count = ArrayCount(bar_style_fields);
|
||||||
for (int32_t i = 0; i < count; ++i){
|
for (int32_t i = 0; i < count; ++i){
|
||||||
char *tag = make_style_tag(bar_style_fields[i]);
|
char *tag = make_style_tag(bar_style_fields[i]);
|
||||||
append_sc(&out, "Stag_");
|
append(&out, "Stag_");
|
||||||
append_sc(&out, tag);
|
append(&out, tag);
|
||||||
append_sc(&out, ",\n");
|
append(&out, ",\n");
|
||||||
free(tag);
|
free(tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
count = ArrayCount(main_style_fields);
|
count = ArrayCount(main_style_fields);
|
||||||
for (int32_t i = 0; i < count; ++i){
|
for (int32_t i = 0; i < count; ++i){
|
||||||
char *tag = make_style_tag(main_style_fields[i]);
|
char *tag = make_style_tag(main_style_fields[i]);
|
||||||
append_sc(&out, "Stag_");
|
append(&out, "Stag_");
|
||||||
append_sc(&out, tag);
|
append(&out, tag);
|
||||||
append_sc(&out, ",\n");
|
append(&out, ",\n");
|
||||||
free(tag);
|
free(tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
append_sc(&out, "Stag_COUNT\n");
|
append(&out, "Stag_COUNT\n");
|
||||||
}
|
}
|
||||||
struct_end(&out);
|
struct_end(&out);
|
||||||
|
|
||||||
append_sc(&out, "static char *style_tag_names[] = {\n");
|
append(&out, "static char *style_tag_names[] = {\n");
|
||||||
{
|
{
|
||||||
int32_t count = ArrayCount(bar_style_fields);
|
int32_t count = ArrayCount(bar_style_fields);
|
||||||
for (int32_t i = 0; i < count; ++i){
|
for (int32_t i = 0; i < count; ++i){
|
||||||
char *tag = make_style_tag(bar_style_fields[i]);
|
char *tag = make_style_tag(bar_style_fields[i]);
|
||||||
append_sc(&out, "\"");
|
append(&out, "\"");
|
||||||
append_sc(&out, tag);
|
append(&out, tag);
|
||||||
append_sc(&out, "\",\n");
|
append(&out, "\",\n");
|
||||||
free(tag);
|
free(tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
count = ArrayCount(main_style_fields);
|
count = ArrayCount(main_style_fields);
|
||||||
for (int32_t i = 0; i < count; ++i){
|
for (int32_t i = 0; i < count; ++i){
|
||||||
char *tag = make_style_tag(main_style_fields[i]);
|
char *tag = make_style_tag(main_style_fields[i]);
|
||||||
append_sc(&out, "\"");
|
append(&out, "\"");
|
||||||
append_sc(&out, tag);
|
append(&out, tag);
|
||||||
append_sc(&out, "\",\n");
|
append(&out, "\",\n");
|
||||||
free(tag);
|
free(tag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
append_sc(&out, "};\n");
|
append(&out, "};\n");
|
||||||
|
|
||||||
end_file_out(context);
|
end_file_out(context);
|
||||||
}
|
}
|
||||||
|
@ -255,9 +258,9 @@ generate_style(){
|
||||||
{
|
{
|
||||||
int32_t count = ArrayCount(bar_style_fields);
|
int32_t count = ArrayCount(bar_style_fields);
|
||||||
for (int32_t i = 0; i < count; ++i){
|
for (int32_t i = 0; i < count; ++i){
|
||||||
append_sc(&out, "u32 ");
|
append(&out, "u32 ");
|
||||||
append_sc(&out, bar_style_fields[i]);
|
append(&out, bar_style_fields[i]);
|
||||||
append_sc(&out, "_color;\n");
|
append(&out, "_color;\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
struct_end(&out);
|
struct_end(&out);
|
||||||
|
@ -266,16 +269,16 @@ generate_style(){
|
||||||
{
|
{
|
||||||
int32_t count = ArrayCount(main_style_fields);
|
int32_t count = ArrayCount(main_style_fields);
|
||||||
for (int32_t i = 0; i < count; ++i){
|
for (int32_t i = 0; i < count; ++i){
|
||||||
append_sc(&out, "u32 ");
|
append(&out, "u32 ");
|
||||||
append_sc(&out, main_style_fields[i]);
|
append(&out, main_style_fields[i]);
|
||||||
append_sc(&out, "_color;\n");
|
append(&out, "_color;\n");
|
||||||
}
|
}
|
||||||
append_sc(&out, "Interactive_Style file_info_style;\n");
|
append(&out, "Interactive_Style file_info_style;\n");
|
||||||
}
|
}
|
||||||
struct_end(&out);
|
struct_end(&out);
|
||||||
|
|
||||||
{
|
{
|
||||||
append_sc(&out,
|
append(&out,
|
||||||
"inline u32*\n"
|
"inline u32*\n"
|
||||||
"style_index_by_tag(Style_Main_Data *s, u32 tag){\n"
|
"style_index_by_tag(Style_Main_Data *s, u32 tag){\n"
|
||||||
"u32 *result = 0;\n"
|
"u32 *result = 0;\n"
|
||||||
|
@ -284,26 +287,26 @@ generate_style(){
|
||||||
int32_t count = ArrayCount(bar_style_fields);
|
int32_t count = ArrayCount(bar_style_fields);
|
||||||
for (int32_t i = 0; i < count; ++i){
|
for (int32_t i = 0; i < count; ++i){
|
||||||
char *tag = make_style_tag(bar_style_fields[i]);
|
char *tag = make_style_tag(bar_style_fields[i]);
|
||||||
append_sc(&out, "case Stag_");
|
append(&out, "case Stag_");
|
||||||
append_sc(&out, tag);
|
append(&out, tag);
|
||||||
append_sc(&out, ": result = &s->file_info_style.");
|
append(&out, ": result = &s->file_info_style.");
|
||||||
append_sc(&out, bar_style_fields[i]);
|
append(&out, bar_style_fields[i]);
|
||||||
append_sc(&out, "_color; break;\n");
|
append(&out, "_color; break;\n");
|
||||||
free(tag);
|
free(tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
count = ArrayCount(main_style_fields);
|
count = ArrayCount(main_style_fields);
|
||||||
for (int32_t i = 0; i < count; ++i){
|
for (int32_t i = 0; i < count; ++i){
|
||||||
char *tag = make_style_tag(main_style_fields[i]);
|
char *tag = make_style_tag(main_style_fields[i]);
|
||||||
append_sc(&out, "case Stag_");
|
append(&out, "case Stag_");
|
||||||
append_sc(&out, tag);
|
append(&out, tag);
|
||||||
append_sc(&out, ": result = &s->");
|
append(&out, ": result = &s->");
|
||||||
append_sc(&out, main_style_fields[i]);
|
append(&out, main_style_fields[i]);
|
||||||
append_sc(&out, "_color; break;\n");
|
append(&out, "_color; break;\n");
|
||||||
free(tag);
|
free(tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
append_sc(&out,
|
append(&out,
|
||||||
"}\n"
|
"}\n"
|
||||||
"return(result);\n"
|
"return(result);\n"
|
||||||
"}\n\n");
|
"}\n\n");
|
||||||
|
@ -335,7 +338,7 @@ print_function_body_code(String *out, Parse_Context *context, int32_t start){
|
||||||
for (; (token = get_token(context)) != 0; get_next_token(context)){
|
for (; (token = get_token(context)) != 0; get_next_token(context)){
|
||||||
if (do_whitespace_print){
|
if (do_whitespace_print){
|
||||||
pstr = str_start_end(context->data, start, token->start);
|
pstr = str_start_end(context->data, start, token->start);
|
||||||
append_ss(out, pstr);
|
append(out, pstr);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
do_whitespace_print = true;
|
do_whitespace_print = true;
|
||||||
|
@ -364,7 +367,7 @@ print_function_body_code(String *out, Parse_Context *context, int32_t start){
|
||||||
|
|
||||||
if (do_print){
|
if (do_print){
|
||||||
pstr = get_lexeme(*token, context->data);
|
pstr = get_lexeme(*token, context->data);
|
||||||
append_ss(out, pstr);
|
append(out, pstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
start = token->start + token->size;
|
start = token->start + token->size;
|
||||||
|
@ -385,9 +388,9 @@ typedef struct App_API{
|
||||||
} App_API;
|
} App_API;
|
||||||
|
|
||||||
static App_API
|
static App_API
|
||||||
allocate_app_api(Partition *part, int32_t count){
|
allocate_app_api(int32_t count){
|
||||||
App_API app_api = {0};
|
App_API app_api = {0};
|
||||||
app_api.names = push_array(part, App_API_Name, count);
|
app_api.names = fm_push_array(App_API_Name, count);
|
||||||
memset(app_api.names, 0, sizeof(App_API_Name)*count);
|
memset(app_api.names, 0, sizeof(App_API_Name)*count);
|
||||||
return(app_api);
|
return(app_api);
|
||||||
}
|
}
|
||||||
|
@ -400,73 +403,57 @@ generate_custom_headers(){
|
||||||
void *mem = malloc(size);
|
void *mem = malloc(size);
|
||||||
memset(mem, 0, size);
|
memset(mem, 0, size);
|
||||||
|
|
||||||
Partition part_ = make_part(mem, size);
|
|
||||||
Partition *part = &part_;
|
|
||||||
|
|
||||||
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))
|
|
||||||
|
|
||||||
// NOTE(allen): Parse the customization API files
|
// NOTE(allen): Parse the customization API files
|
||||||
static char *functions_files[] = { "4ed_api_implementation.cpp", 0 };
|
static char *functions_files[] = { "4ed_api_implementation.cpp", 0 };
|
||||||
Meta_Unit unit_custom = compile_meta_unit(part, ".", functions_files, ExpandArray(meta_keywords));
|
Meta_Unit unit_custom = compile_meta_unit(".", functions_files, ExpandArray(meta_keywords));
|
||||||
if (unit_custom.parse == 0){
|
if (unit_custom.parse == 0){
|
||||||
Assert(!"Missing one or more input files!");
|
Assert(!"Missing one or more input files!");
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE(allen): Compute and store variations of the function names
|
// NOTE(allen): Compute and store variations of the function names
|
||||||
App_API func_4ed_names = allocate_app_api(part, unit_custom.set.count);
|
App_API func_4ed_names = allocate_app_api(unit_custom.set.count);
|
||||||
|
|
||||||
for (int32_t i = 0; i < unit_custom.set.count; ++i){
|
for (int32_t i = 0; i < unit_custom.set.count; ++i){
|
||||||
String name_string = unit_custom.set.items[i].name;
|
String name_string = unit_custom.set.items[i].name;
|
||||||
String *macro = &func_4ed_names.names[i].macro;
|
String *macro = &func_4ed_names.names[i].macro;
|
||||||
String *public_name = &func_4ed_names.names[i].public_name;
|
String *public_name = &func_4ed_names.names[i].public_name;
|
||||||
|
|
||||||
*macro = str_alloc(part, name_string.size+4);
|
*macro = str_alloc(name_string.size+4);
|
||||||
to_upper_ss(macro, name_string);
|
to_upper_ss(macro, name_string);
|
||||||
append_ss(macro, make_lit_string("_SIG"));
|
append(macro, make_lit_string("_SIG"));
|
||||||
|
|
||||||
*public_name = str_alloc(part, name_string.size);
|
*public_name = str_alloc(name_string.size);
|
||||||
to_lower_ss(public_name, name_string);
|
to_lower_ss(public_name, name_string);
|
||||||
|
|
||||||
partition_align(part, 4);
|
fm_align();
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE(allen): Output
|
// NOTE(allen): Output
|
||||||
String out = str_alloc(part, 10 << 20);
|
String out = str_alloc(10 << 20);
|
||||||
Out_Context context = {0};
|
Out_Context context = {0};
|
||||||
|
|
||||||
// NOTE(allen): Custom API headers
|
// NOTE(allen): Custom API headers
|
||||||
if (begin_file_out(&context, OS_API_H, &out)){
|
if (begin_file_out(&context, OS_API_H, &out)){
|
||||||
int32_t main_api_count = unit_custom.parse[0].item_count;
|
int32_t main_api_count = unit_custom.parse[0].item_count;
|
||||||
int32_t os_api_count = unit_custom.parse[1].item_count;
|
int32_t os_api_count = unit_custom.parse[1].item_count;
|
||||||
append_sc(&out, "struct Application_Links;\n");
|
append(&out, "struct Application_Links;\n");
|
||||||
|
|
||||||
for (int32_t i = main_api_count; i < os_api_count; ++i){
|
for (int32_t i = main_api_count; i < os_api_count; ++i){
|
||||||
append_sc(&out, "#define ");
|
append(&out, "#define ");
|
||||||
append_ss(&out, func_4ed_names.names[i].macro);
|
append(&out, func_4ed_names.names[i].macro);
|
||||||
append_sc(&out, "(n) ");
|
append(&out, "(n) ");
|
||||||
append_ss(&out, unit_custom.set.items[i].ret);
|
append(&out, unit_custom.set.items[i].ret);
|
||||||
append_sc(&out, " n");
|
append(&out, " n");
|
||||||
append_ss(&out, unit_custom.set.items[i].args);
|
append(&out, unit_custom.set.items[i].args);
|
||||||
append_s_char(&out, '\n');
|
append_s_char(&out, '\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int32_t i = main_api_count; i < os_api_count; ++i){
|
for (int32_t i = main_api_count; i < os_api_count; ++i){
|
||||||
append_sc(&out, "typedef ");
|
append(&out, "typedef ");
|
||||||
append_ss(&out, func_4ed_names.names[i].macro);
|
append(&out, func_4ed_names.names[i].macro);
|
||||||
append_s_char(&out, '(');
|
append_s_char(&out, '(');
|
||||||
append_ss(&out, unit_custom.set.items[i].name);
|
append(&out, unit_custom.set.items[i].name);
|
||||||
append_sc(&out, "_Function);\n");
|
append(&out, "_Function);\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
end_file_out(context);
|
end_file_out(context);
|
||||||
|
@ -476,48 +463,48 @@ generate_custom_headers(){
|
||||||
}
|
}
|
||||||
|
|
||||||
if (begin_file_out(&context, API_H, &out)){
|
if (begin_file_out(&context, API_H, &out)){
|
||||||
append_sc(&out, "struct Application_Links;\n");
|
append(&out, "struct Application_Links;\n");
|
||||||
|
|
||||||
for (int32_t i = 0; i < unit_custom.set.count; ++i){
|
for (int32_t i = 0; i < unit_custom.set.count; ++i){
|
||||||
append_sc(&out, "#define ");
|
append(&out, "#define ");
|
||||||
append_ss(&out, func_4ed_names.names[i].macro);
|
append(&out, func_4ed_names.names[i].macro);
|
||||||
append_sc(&out, "(n) ");
|
append(&out, "(n) ");
|
||||||
append_ss(&out, unit_custom.set.items[i].ret);
|
append(&out, unit_custom.set.items[i].ret);
|
||||||
append_sc(&out, " n");
|
append(&out, " n");
|
||||||
append_ss(&out, unit_custom.set.items[i].args);
|
append(&out, unit_custom.set.items[i].args);
|
||||||
append_s_char(&out, '\n');
|
append_s_char(&out, '\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int32_t i = 0; i < unit_custom.set.count; ++i){
|
for (int32_t i = 0; i < unit_custom.set.count; ++i){
|
||||||
append_sc(&out, "typedef ");
|
append(&out, "typedef ");
|
||||||
append_ss(&out, func_4ed_names.names[i].macro);
|
append(&out, func_4ed_names.names[i].macro);
|
||||||
append_s_char(&out, '(');
|
append_s_char(&out, '(');
|
||||||
append_ss(&out, unit_custom.set.items[i].name);
|
append(&out, unit_custom.set.items[i].name);
|
||||||
append_sc(&out, "_Function);\n");
|
append(&out, "_Function);\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
append_sc(&out, "struct Application_Links{\n");
|
append(&out, "struct Application_Links{\n");
|
||||||
|
|
||||||
|
|
||||||
append_sc(&out, "#if defined(ALLOW_DEP_4CODER)\n");
|
append(&out, "#if defined(ALLOW_DEP_4CODER)\n");
|
||||||
for (int32_t i = 0; i < unit_custom.set.count; ++i){
|
for (int32_t i = 0; i < unit_custom.set.count; ++i){
|
||||||
append_ss(&out, unit_custom.set.items[i].name);
|
append(&out, unit_custom.set.items[i].name);
|
||||||
append_sc(&out, "_Function *");
|
append(&out, "_Function *");
|
||||||
append_ss(&out, func_4ed_names.names[i].public_name);
|
append(&out, func_4ed_names.names[i].public_name);
|
||||||
append_sc(&out, ";\n");
|
append(&out, ";\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
append_sc(&out, "#else\n");
|
append(&out, "#else\n");
|
||||||
|
|
||||||
for (int32_t i = 0; i < unit_custom.set.count; ++i){
|
for (int32_t i = 0; i < unit_custom.set.count; ++i){
|
||||||
append_ss(&out, unit_custom.set.items[i].name);
|
append(&out, unit_custom.set.items[i].name);
|
||||||
append_sc(&out, "_Function *");
|
append(&out, "_Function *");
|
||||||
append_ss(&out, func_4ed_names.names[i].public_name);
|
append(&out, func_4ed_names.names[i].public_name);
|
||||||
append_sc(&out, "_;\n");
|
append(&out, "_;\n");
|
||||||
}
|
}
|
||||||
append_sc(&out, "#endif\n");
|
append(&out, "#endif\n");
|
||||||
|
|
||||||
append_sc(&out,
|
append(&out,
|
||||||
"void *memory;\n"
|
"void *memory;\n"
|
||||||
"int32_t memory_size;\n"
|
"int32_t memory_size;\n"
|
||||||
"void *cmd_context;\n"
|
"void *cmd_context;\n"
|
||||||
|
@ -526,66 +513,66 @@ generate_custom_headers(){
|
||||||
"int32_t type_coroutine;\n"
|
"int32_t type_coroutine;\n"
|
||||||
"};\n");
|
"};\n");
|
||||||
|
|
||||||
append_sc(&out, "#define FillAppLinksAPI(app_links) do{");
|
append(&out, "#define FillAppLinksAPI(app_links) do{");
|
||||||
for (int32_t i = 0; i < unit_custom.set.count; ++i){
|
for (int32_t i = 0; i < unit_custom.set.count; ++i){
|
||||||
append_sc(&out, "\\\napp_links->");
|
append(&out, "\\\napp_links->");
|
||||||
append_ss(&out, func_4ed_names.names[i].public_name);
|
append(&out, func_4ed_names.names[i].public_name);
|
||||||
append_sc(&out, "_ = ");
|
append(&out, "_ = ");
|
||||||
append_ss(&out, unit_custom.set.items[i].name);
|
append(&out, unit_custom.set.items[i].name);
|
||||||
append_s_char(&out, ';');
|
append_s_char(&out, ';');
|
||||||
}
|
}
|
||||||
append_sc(&out, "} while(false)\n");
|
append(&out, "} while(false)\n");
|
||||||
|
|
||||||
append_sc(&out, "#if defined(ALLOW_DEP_4CODER)\n");
|
append(&out, "#if defined(ALLOW_DEP_4CODER)\n");
|
||||||
for (int32_t use_dep = 1; use_dep >= 0; --use_dep){
|
for (int32_t use_dep = 1; use_dep >= 0; --use_dep){
|
||||||
for (int32_t i = 0; i < unit_custom.set.count; ++i){
|
for (int32_t i = 0; i < unit_custom.set.count; ++i){
|
||||||
Argument_Breakdown breakdown = unit_custom.set.items[i].breakdown;
|
Argument_Breakdown breakdown = unit_custom.set.items[i].breakdown;
|
||||||
String ret = unit_custom.set.items[i].ret;
|
String ret = unit_custom.set.items[i].ret;
|
||||||
String public_name = func_4ed_names.names[i].public_name;
|
String public_name = func_4ed_names.names[i].public_name;
|
||||||
|
|
||||||
append_sc(&out, "static inline ");
|
append(&out, "static inline ");
|
||||||
append_ss(&out, ret);
|
append(&out, ret);
|
||||||
append_sc(&out, " ");
|
append(&out, " ");
|
||||||
append_ss(&out, public_name);
|
append(&out, public_name);
|
||||||
|
|
||||||
append_sc(&out, "(");
|
append(&out, "(");
|
||||||
for (int32_t j = 0; j < breakdown.count; ++j){
|
for (int32_t j = 0; j < breakdown.count; ++j){
|
||||||
append_ss(&out, breakdown.args[j].param_string);
|
append(&out, breakdown.args[j].param_string);
|
||||||
if (j+1 != breakdown.count){
|
if (j+1 != breakdown.count){
|
||||||
append_sc(&out, ", ");
|
append(&out, ", ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
append_sc(&out, "){");
|
append(&out, "){");
|
||||||
|
|
||||||
if (match_ss(ret, make_lit_string("void"))){
|
if (match_ss(ret, make_lit_string("void"))){
|
||||||
append_sc(&out, "(");
|
append(&out, "(");
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
append_sc(&out, "return(");
|
append(&out, "return(");
|
||||||
}
|
}
|
||||||
|
|
||||||
append_sc(&out, "app->");
|
append(&out, "app->");
|
||||||
append_ss(&out, public_name);
|
append(&out, public_name);
|
||||||
if (!use_dep){
|
if (!use_dep){
|
||||||
append_sc(&out, "_");
|
append(&out, "_");
|
||||||
}
|
}
|
||||||
|
|
||||||
append_sc(&out, "(");
|
append(&out, "(");
|
||||||
for (int32_t j = 0; j < breakdown.count; ++j){
|
for (int32_t j = 0; j < breakdown.count; ++j){
|
||||||
append_ss(&out, breakdown.args[j].param_name);
|
append(&out, breakdown.args[j].param_name);
|
||||||
if (j+1 != breakdown.count){
|
if (j+1 != breakdown.count){
|
||||||
append_sc(&out, ", ");
|
append(&out, ", ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
append_sc(&out, ")");
|
append(&out, ")");
|
||||||
|
|
||||||
append_sc(&out, ");}\n");
|
append(&out, ");}\n");
|
||||||
}
|
}
|
||||||
if (use_dep == 1){
|
if (use_dep == 1){
|
||||||
append_sc(&out, "#else\n");
|
append(&out, "#else\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
append_sc(&out, "#endif\n");
|
append(&out, "#endif\n");
|
||||||
|
|
||||||
end_file_out(context);
|
end_file_out(context);
|
||||||
}
|
}
|
||||||
|
@ -597,6 +584,7 @@ generate_custom_headers(){
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv){
|
int main(int argc, char **argv){
|
||||||
|
fm_init_system();
|
||||||
generate_keycode_enum();
|
generate_keycode_enum();
|
||||||
generate_style();
|
generate_style();
|
||||||
generate_custom_headers();
|
generate_custom_headers();
|
||||||
|
|
Loading…
Reference in New Issue