2023-07-18 20:33:00 -07:00
|
|
|
#pragma once
|
|
|
|
|
2023-07-19 20:42:28 -07:00
|
|
|
#include "gen.scanner.hpp"
|
2023-07-18 20:33:00 -07:00
|
|
|
|
|
|
|
namespace gen {
|
|
|
|
|
|
|
|
struct Policy
|
|
|
|
{
|
|
|
|
// Nothing for now.
|
|
|
|
};
|
|
|
|
|
|
|
|
enum class SymbolType : u32
|
|
|
|
{
|
|
|
|
Code,
|
|
|
|
Line,
|
|
|
|
Marker
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Editor
|
|
|
|
{
|
|
|
|
enum RequestType : u32
|
|
|
|
{
|
|
|
|
Add,
|
|
|
|
Replace,
|
|
|
|
Remove
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SymbolData
|
|
|
|
{
|
|
|
|
Policy Policy;
|
|
|
|
SymbolInfo Info;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct RequestEntry
|
|
|
|
{
|
|
|
|
union {
|
|
|
|
SymbolData Symbol;
|
|
|
|
String Specification;
|
|
|
|
};
|
|
|
|
RequestType Type;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Receipt
|
|
|
|
{
|
|
|
|
StringCached File;
|
|
|
|
Code Found;
|
|
|
|
Code Written;
|
|
|
|
bool Result;
|
|
|
|
};
|
|
|
|
|
|
|
|
static AllocatorInfo Allocator;
|
|
|
|
|
|
|
|
static void set_allocator( AllocatorInfo allocator );
|
|
|
|
|
2023-07-19 20:42:28 -07:00
|
|
|
Array<FileInfo> Files;
|
2023-07-18 20:33:00 -07:00
|
|
|
String Buffer;
|
2023-07-19 20:42:28 -07:00
|
|
|
Array<RequestEntry> Requests;
|
2023-07-18 20:33:00 -07:00
|
|
|
|
|
|
|
void add_files( s32 num, char const** files );
|
|
|
|
|
|
|
|
void add ( SymbolInfo definition, Policy policy, Code to_inject );
|
|
|
|
void remove ( SymbolInfo definition, Policy policy );
|
|
|
|
void replace( SymbolInfo definition, Policy policy, Code to_replace);
|
|
|
|
|
|
|
|
# ifdef GEN_FEATURE_EDITOR_REFACTOR
|
|
|
|
void refactor( char const* file_path, char const* specification_path );
|
|
|
|
# endif
|
|
|
|
|
2023-07-19 20:42:28 -07:00
|
|
|
bool process_requests( Array<Receipt> out_receipts );
|
2023-07-18 20:33:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
// namespace gen
|
2023-07-20 22:12:38 -07:00
|
|
|
};
|