work on gettings things compiling again after restructuring

This commit is contained in:
2024-12-10 20:45:00 -05:00
parent 8891657eb1
commit ef78772278
26 changed files with 230 additions and 210 deletions

View File

@ -1,11 +1,11 @@
#pragma once
#include "gen.hpp"
#if GEN_INTELLISENSE_DIRECTIVES
# include "../gen.hpp"
# include "misc.hpp"
using namespace gen;
#include "dependencies/parsing.hpp"
#include "misc.hpp"
#endif
CodeBody gen_ecode( char const* path, bool use_c_definition = false )
{
@ -182,8 +182,8 @@ CodeBody gen_especifier( char const* path, bool use_c_definition = false )
for (usize idx = 0; idx < array_num(csv_enum.Col_1); idx++)
{
char const* enum_str = enum_strs[idx].string;
char const* entry_to_str = str_strs [idx].string;
char const* enum_str = csv_enum.Col_1[idx].string;
char const* entry_to_str = csv_enum.Col_2[idx].string;
string_append_fmt( & enum_entries, "Spec_%s,\n", enum_str );
string_append_fmt( & to_str_entries, "{ sizeof(\"%s\"), \"%s\" },\n", entry_to_str, entry_to_str);

View File

@ -1,23 +1,19 @@
#pragma once
#ifdef GEN_INTELLISENSE_DIRECTIVES
#pragma once
#define GEN_DEFINE_LIBRARY_CODE_CONSTANTS
#define GEN_ENFORCE_STRONG_CODE_TYPES
#define GEN_EXPOSE_BACKEND
#include "../gen.cpp"
# define GEN_DEFINE_LIBRARY_CODE_CONSTANTS
# define GEN_ENFORCE_STRONG_CODE_TYPES
# define GEN_EXPOSE_BACKEND
# include "gen.hpp"
# include "helpers/push_ignores.inline.hpp"
# include "helpers/helper.hpp"
# include "auxillary/builder.hpp"
# include "auxillary/builder.cpp"
# include "auxillary/scanner.hpp"
#include "helpers/push_ignores.inline.hpp"
#include "helpers/helper.hpp"
#include <stdlib.h>
GEN_NS_BEGIN
#include "helpers/push_container_defines.inline.hpp"
#include "dependencies/parsing.cpp"
#include "helpers/pop_container_defines.inline.hpp"
GEN_NS_END
#include "auxillary/builder.hpp"
#include "auxillary/builder.cpp"
#include "auxillary/scanner.hpp"
using namespace gen;
#endif
// Will format a file with the given style at the provided path.
@ -29,13 +25,13 @@ void clang_format_file( char const* path, char const* style_path )
String style_arg;
if (style_path) {
stle_arg = string_make_strc(GlobalAllocator, txt("-style=file:"));
style_arg = string_make_strc(GlobalAllocator, txt("-style=file:"));
string_append_fmt( & style_arg, "%s ", style_path );
}
StrC clang_format = txt("clang-format ")
StrC cf_format_inplace = txt("-i ")
StrC cf_verbose = txt("-verbose ")
StrC clang_format = txt("clang-format ");
StrC cf_format_inplace = txt("-i ");
StrC cf_verbose = txt("-verbose ");
String command = string_make_strc( GlobalAllocator, clang_format );
string_append_strc( & command, cf_format_inplace );
@ -53,31 +49,34 @@ void clang_format_file( char const* path, char const* style_path )
// (See: ./gencpp/scripts/build.ci.ps1 for how)
void refactor_file( char const* path, char const* refactor_script )
{
GEN_ASSERT_NOT_NULL(path, refactor_script);
GEN_ASSERT_NOT_NULL(path);
GEN_ASSERT_NOT_NULL(refactor_script);
#define refactor
String command = string_make_strc(GlobalAllocator, txt("refactor")));
String command = string_make_strc(GlobalAllocator, txt("refactor "));
string_append_strc( & command, txt("-debug ") );
string_append_strc( & command, txt("-num=1 ") );
string_append_fmt( & command, "-src=%s ", path );
string_append_fmt( & command,"-spec=%s ", refactor_script );
log_fmt("\tBeginning refactor:\n");
system(command);
log_fmt("\nRefactoring complete.\n");
log_fmt("\nRefactoring complete.\n");
#undef refactor
}
// Does either of the above or both to the provided code.
// Code returned will be untyped content (its be serialized)
Code code_refactor_and_format( Code code, char const* scratch_path, char const* refactor_script, char_const* clang_format_sytle_path )
Code code_refactor_and_format( Code code, char const* scratch_path, char const* refactor_script, char const* clang_format_sytle_path )
{
GEN_ASSERT_NOT_NULL(code);
GEN_ASSERT(code);
GEN_ASSERT_NOT_NULL(scratch_path);
Builder scratch_file = builder_open("gen/scratch.hpp");
builder_print( & scratch_file, code);
builder_write(& scratch_file);
if (refactor_script) {
refactor_file(scratch_path, refactor_script)
refactor_file(scratch_path, refactor_script);
}
if ( clang_format_sytle_path ) {
clang_format_file(scratch_path, clang_format_sytle_path);