Moving over lib gen features to a different repo, changing this repo to just be minimal metadesk lib from raddbg

This commit is contained in:
ed
2025-02-12 13:52:09 -05:00
parent 1fad37ad90
commit ea67e889e0
20 changed files with 6 additions and 31530 deletions
-44
View File
@@ -1,44 +0,0 @@
BSD 3-Clause License
Copyright (c) 2023, Edward R. Gonzalez
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Source URL: https://github.com/Ed94/gencpp
Acknowledgements
* The dependencies for gencpp source are derived from the zpl library: https://github.com/zpl-c/zpl
Special thanks to:
* The Handmade Community.
* Casey Muratori, Ginger Bill (Bill Hall), Mr. 4th (Allen Webster), Ryan Fluery: Influnced conceptually how to handle staged metaprograming.
* Jonathan Blow: Jai's metaprogramming influenced the design of this library.
* My friends for putting up with discord spam on this library.
-4
View File
@@ -1,4 +0,0 @@
# gencpp_c11
See: [gencpp](https://github.com/Ed94/gencpp)
-28705
View File
File diff suppressed because it is too large Load Diff
-69
View File
@@ -1,69 +0,0 @@
#pragma once
// #define
#define GEN_EXPOSE_BACKEND
#include "gencpp_c11.h"
// Will format a file with the given style at the provided path.
// Assumes clang-format is defined in an user-exposed or system enviornment PATH.
void clang_format_file( char const* path, char const* style_path )
{
GEN_ASSERT_NOT_NULL(path);
gen_StrBuilder resolved_path = gen_strbuilder_make_str(gen_get_context()->Allocator_Temp, gen_to_str_from_c_str(path));
gen_StrBuilder style_arg;
if (style_path) {
style_arg = gen_strbuilder_make_str(gen_get_context()->Allocator_Temp, gen_txt("-style=file:"));
gen_strbuilder_append_fmt( & style_arg, "%s ", style_path );
}
gen_Str clang_format = gen_txt("clang-format ");
gen_Str cf_format_inplace = gen_txt("-i ");
gen_Str cf_verbose = gen_txt("-verbose ");
gen_StrBuilder command = gen_strbuilder_make_str( gen_get_context()->Allocator_Temp, clang_format );
gen_strbuilder_append_str ( & command, cf_format_inplace );
gen_strbuilder_append_str ( & command, cf_verbose );
gen_strbuilder_append_string( & command, style_arg );
gen_strbuilder_append_string( & command, resolved_path );
system( command );
}
// Will refactor a file with the given script at the provided path.
// Assumes refactor is defined in an user-exposed or system enviornment PATH.
// (See: ./gencpp/scripts/build.ci.ps1 for how)
void refactor_file( char const* path, char const* refactor_script )
{
GEN_ASSERT_NOT_NULL(path);
GEN_ASSERT_NOT_NULL(refactor_script);
gen_StrBuilder command = gen_strbuilder_make_str(gen_get_context()->Allocator_Temp, gen_txt("refactor "));
// strbuilder_append_str( & command, gen_txt("-debug ") );
gen_strbuilder_append_str( & command, gen_txt("-num=1 ") );
gen_strbuilder_append_fmt( & command, "-src=%s ", path );
gen_strbuilder_append_fmt( & command,"-spec=%s ", refactor_script );
system(command);
gen_log_fmt("\n");
}
// Does either of the above or both to the provided code.
// Code returned will be untyped content (its be serialized)
gen_Code code_refactor_and_format( gen_Code code, char const* scratch_path, char const* refactor_script, char const* clang_format_sytle_path )
{
GEN_ASSERT(code);
GEN_ASSERT_NOT_NULL(scratch_path);
gen_Builder scratch_file = gen_builder_open( scratch_path );
gen_builder_print( & scratch_file, code);
gen_builder_write(& scratch_file);
if (refactor_script) {
refactor_file(scratch_path, refactor_script);
}
if ( clang_format_sytle_path ) {
clang_format_file(scratch_path, clang_format_sytle_path);
}
gen_Code result = gen_scan_file( scratch_path );
remove(scratch_path);
return result;
}
-7
View File
@@ -1,7 +0,0 @@
#ifdef __clang__
# pragma clang diagnostic pop
#endif
#ifdef __GNUC__
# pragma GCC diagnostic pop
#endif
-21
View File
@@ -1,21 +0,0 @@
#ifdef __clang__
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wunused-const-variable"
# pragma clang diagnostic ignored "-Wunused-but-set-variable"
# pragma clang diagnostic ignored "-Wswitch"
# pragma clang diagnostic ignored "-Wunused-variable"
# pragma clang diagnostic ignored "-Wunknown-pragmas"
# pragma clang diagnostic ignored "-Wvarargs"
# pragma clang diagnostic ignored "-Wunused-function"
# pragma clang diagnostic ignored "-Wbraced-scalar-init"
# pragma clang diagnostic ignored "-W#pragma-messages"
# pragma clang diagnostic ignored "-Wstatic-in-inline"
#endif
#ifdef __GNUC__
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wunknown-pragmas"
# pragma GCC diagnostic ignored "-Wcomment"
# pragma GCC diagnostic ignored "-Wswitch"
# pragma GCC diagnostic ignored "-Wunused-variable"
#endif