doc update

This commit is contained in:
udo
2022-04-18 23:37:21 +00:00
parent defc628204
commit 364d83b199
17 changed files with 482 additions and 120 deletions
+20 -11
View File
@@ -159,20 +159,16 @@ String preprocess_shared_unit_char_wise(Request* context, SharedUnit* su, String
pc.append("#include \"" + sub_su->bin_path + "/" + sub_su->pre_file_name + "\"\n");
}
}
else if(false && current_line.substr(0, 6) == "EXPORT" && isspace(current_line[6]))
else if(current_line.substr(0, 6) == "EXPORT" && isspace(current_line[6]))
{
current_line = "";
auto end_declaration_pos = content.find("{", i);
if(end_declaration_pos != std::string::npos)
{
// remove string "API " from output
//pc.resize(pc.length() - 7);
pc.append(1, '\n');
String declaration = trim(content.substr(i, end_declaration_pos - i));
String return_type_and_name = nibble(declaration, "(");
StringList rtn_list = split_space(return_type_and_name);
String fn_name = rtn_list.back(); rtn_list.pop_back();
su->api_declarations.push_back(fn_name + ":" + join(rtn_list, " ") + ":(" + declaration + "\n");
printf("declaration found: %s\n", declaration.c_str());
su->api_declarations.push_back(declaration+";\n");
//printf("declaration found: %s\n", declaration.c_str());
}
}
}
@@ -430,7 +426,20 @@ void render_file(String file_name, DTree& call_param)
compiler_invoke(context, file_name, call_param);
}
DTree* call_file_function(String file_name, String function_name, DTree* call_param)
SharedUnit* load_file(String file_name)
{
auto su = compiler_load_shared_unit(context, file_name, "", false);
if(su && su->so_handle)
{
return(su);
}
else
{
return(0);
}
}
DTree* call_file(String file_name, String function_name, DTree* call_param)
{
DTree* result;
auto su = compiler_load_shared_unit(context, file_name, "", false);
@@ -445,7 +454,7 @@ DTree* call_file_function(String file_name, String function_name, DTree* call_pa
auto f = (dtree_call_handler)dlsym(su->so_handle, function_name.c_str());
if(!f)
{
print("Error: call_file_function() function '", function_name, "' not found");
print("Error: call_file() function '", function_name, "' not found");
}
else
{
@@ -459,7 +468,7 @@ DTree* call_file_function(String file_name, String function_name, DTree* call_pa
}
else
{
print("Error: call_file_function() could not load unit file '", file_name, "'");
print("Error: call_file() could not load unit file '", file_name, "'");
}
return(result);
}
+2 -1
View File
@@ -10,8 +10,9 @@ SharedUnit* get_shared_unit(Request* context, String file_name, bool opt_so_opti
void compiler_invoke(Request* context, String file_name, DTree& call_param);
SharedUnit* compiler_load_shared_unit(Request* context, String file_name, String current_path, bool opt_so_optional = false);
SharedUnit* load_file(String file_name);
void render_file(String file_name);
void render_file(String file_name, DTree& call_param);
DTree* call_file_function(String file_name, String function_name, DTree* call_param = 0);
DTree* call_file(String file_name, String function_name, DTree* call_param = 0);
StringList precompile_jobs;
+9 -1
View File
@@ -43,7 +43,7 @@ String operator+(String lhs, f32 rhs) {
}
#define DEBUG_MEMORY_OFF
#define GLOBAL_ARENA_ALLOCATOR
#define NO_GLOBAL_ARENA_ALLOCATOR
struct MemoryArena {
@@ -293,3 +293,11 @@ void print(Ts... args)
((*context->ob << args), ...);
}
template <typename... Ts>
String concat(Ts... args)
{
std::stringstream out;
((out << args), ...);
return(out.str());
}