2023-08-28 21:03:08 -07:00
|
|
|
#ifdef GEN_INTELLISENSE_DIRECTIVES
|
|
|
|
# pragma once
|
2024-12-10 13:13:14 -08:00
|
|
|
# include "helpers/push_ignores.inline.hpp"
|
|
|
|
# include "components/header_start.hpp"
|
|
|
|
# include "components/types.hpp"
|
|
|
|
# include "components/gen/ecode.hpp"
|
|
|
|
# include "components/gen/eoperator.hpp"
|
|
|
|
# include "components/gen/especifier.hpp"
|
|
|
|
# include "components/ast.hpp"
|
|
|
|
# include "components/code_types.hpp"
|
|
|
|
# include "components/ast_types.hpp"
|
|
|
|
# include "components/interface.hpp"
|
|
|
|
# include "components/inlines.hpp"
|
|
|
|
# include "components/gen/ast_inlines.hpp"
|
|
|
|
# include "components/header_end.hpp"
|
2024-12-10 17:45:00 -08:00
|
|
|
using namespace gen;
|
2023-08-28 21:03:08 -07:00
|
|
|
#endif
|
2023-08-21 18:40:23 -07:00
|
|
|
|
2024-12-10 13:13:14 -08:00
|
|
|
#pragma region Builder
|
|
|
|
|
2024-12-10 04:24:32 -08:00
|
|
|
struct Builder;
|
|
|
|
typedef struct Builder Builder;
|
|
|
|
|
|
|
|
Builder builder_open ( char const* path );
|
|
|
|
void builder_pad_lines ( Builder* builder, s32 num );
|
|
|
|
void builder_print ( Builder* builder, Code code );
|
|
|
|
void builder_print_fmt_va( Builder* builder, char const* fmt, va_list va );
|
2024-12-15 14:52:31 -08:00
|
|
|
void builder_write ( Builder* builder );
|
|
|
|
|
|
|
|
forceinline void builder_print_fmt ( Builder* builder, char const* fmt, ... ) {
|
2024-12-10 04:24:32 -08:00
|
|
|
va_list va;
|
|
|
|
va_start( va, fmt );
|
|
|
|
builder_print_fmt_va( builder, fmt, va );
|
|
|
|
va_end( va );
|
|
|
|
}
|
|
|
|
|
2023-07-24 14:45:27 -07:00
|
|
|
struct Builder
|
|
|
|
{
|
|
|
|
FileInfo File;
|
2024-12-12 09:55:15 -08:00
|
|
|
StrBuilder Buffer;
|
2023-07-24 14:45:27 -07:00
|
|
|
|
2024-12-10 04:24:32 -08:00
|
|
|
#if GEN_COMPILER_CPP && ! GEN_C_LIKE_CPP
|
|
|
|
forceinline static Builder open( char const* path ) { return builder_open(path); }
|
|
|
|
|
|
|
|
forceinline void pad_lines( s32 num ) { return builder_pad_lines(this, num); }
|
2023-08-03 08:01:43 -07:00
|
|
|
|
2024-12-10 04:24:32 -08:00
|
|
|
forceinline void print( Code code ) { return builder_print(this, code); }
|
|
|
|
forceinline void print_fmt( char const* fmt, ... ) {
|
2024-12-10 10:56:56 -08:00
|
|
|
va_list va;
|
|
|
|
va_start( va, fmt );
|
|
|
|
builder_print_fmt_va( this, fmt, va );
|
|
|
|
va_end( va );
|
2024-12-10 04:24:32 -08:00
|
|
|
}
|
2023-07-24 14:45:27 -07:00
|
|
|
|
2024-12-10 04:24:32 -08:00
|
|
|
forceinline void write() { return builder_write(this); }
|
|
|
|
#endif
|
2023-07-24 14:45:27 -07:00
|
|
|
};
|
2023-08-03 20:18:33 -07:00
|
|
|
|
2024-12-10 04:24:32 -08:00
|
|
|
#if GEN_COMPILER_CPP && ! GEN_C_LIKE_CPP
|
2024-12-15 14:52:31 -08:00
|
|
|
forceinline void builder_pad_lines( Builder& builder, s32 num ) { return builder_pad_lines(& builder, num); }
|
|
|
|
forceinline void builder_print ( Builder& builder, Code code ) { return builder_print(& builder, code); }
|
|
|
|
forceinline void builder_write ( Builder& builder ) { return builder_write(& builder ); }
|
|
|
|
forceinline void builder_print_fmt( Builder& builder, char const* fmt, ...) {
|
2024-12-10 04:24:32 -08:00
|
|
|
va_list va;
|
|
|
|
va_start( va, fmt );
|
|
|
|
builder_print_fmt_va( & builder, fmt, va );
|
|
|
|
va_end( va );
|
|
|
|
}
|
|
|
|
#endif
|
2024-12-10 13:13:14 -08:00
|
|
|
|
|
|
|
#pragma endregion Builder
|