mirror of
https://github.com/Ed94/refactor.git
synced 2024-11-10 04:14:53 -08:00
renamed test files to make a clearer distinction between the regular files.
Removed c8 typedef.
This commit is contained in:
parent
d01625d464
commit
9129b5a9fc
@ -21,3 +21,6 @@ Syntax :
|
|||||||
TODO:
|
TODO:
|
||||||
* Possibly come up with a better name.
|
* Possibly come up with a better name.
|
||||||
* Cleanup memory usage (it hogs quite a bit or what it does..)
|
* Cleanup memory usage (it hogs quite a bit or what it does..)
|
||||||
|
* Split lines of file and refactor it that way instead (better debug, problably negligable performance loss, worst case can have both depending on build type)
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,5 +9,5 @@ if get_option('buildtype').startswith('debug')
|
|||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
executable( 'refactor', 'refactor.cpp' )
|
executable( 'refactor', 'refactor.refactored.cpp' )
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#define ZPL_IMPLEMENTATION
|
#define ZPL_IMPLEMENTATION
|
||||||
#include "bloat.hpp"
|
#include "bloat.refactored.hpp"
|
||||||
|
|
||||||
|
|
||||||
namespace File
|
namespace File
|
||||||
@ -7,7 +7,8 @@ namespace File
|
|||||||
string Source = nullptr;
|
string Source = nullptr;
|
||||||
string Destination = nullptr;
|
string Destination = nullptr;
|
||||||
file_contents Content {};
|
file_contents Content {};
|
||||||
zpl_arena Buffer;
|
|
||||||
|
zpl_arena Buffer;
|
||||||
|
|
||||||
void cleanup()
|
void cleanup()
|
||||||
{
|
{
|
||||||
@ -28,7 +29,7 @@ namespace File
|
|||||||
|
|
||||||
if ( fsize > 0 )
|
if ( fsize > 0 )
|
||||||
{
|
{
|
||||||
arena_init_from_allocator( & Buffer, heap(), (fsize % 64) * 2 );
|
arena_init_from_allocator( & Buffer, heap(), (fsize + fsize % 64) * 4 );
|
||||||
|
|
||||||
Content.data = alloc( arena_allocator( & Buffer), fsize);
|
Content.data = alloc( arena_allocator( & Buffer), fsize);
|
||||||
Content.size = fsize;
|
Content.size = fsize;
|
||||||
@ -459,9 +460,11 @@ void refactor()
|
|||||||
|
|
||||||
if ( string_are_equal( ignore->Sig, current ) )
|
if ( string_are_equal( ignore->Sig, current ) )
|
||||||
{
|
{
|
||||||
char after = content[sig_length];
|
char before = content[-1];
|
||||||
|
char after = content[sig_length];
|
||||||
|
|
||||||
if ( char_is_alphanumeric( after ) || after == '_' )
|
if ( char_is_alphanumeric( before ) || before == '_'
|
||||||
|
|| char_is_alphanumeric( after ) || after == '_' )
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -537,9 +540,11 @@ void refactor()
|
|||||||
|
|
||||||
if ( string_are_equal( word->Sig, current ) )
|
if ( string_are_equal( word->Sig, current ) )
|
||||||
{
|
{
|
||||||
char after = content[sig_length];
|
char before = content[-1];
|
||||||
|
char after = content[sig_length];
|
||||||
|
|
||||||
if ( char_is_alphanumeric( after ) || after == '_' )
|
if ( char_is_alphanumeric( before ) || before == '_'
|
||||||
|
|| char_is_alphanumeric( after ) || after == '_' )
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -626,6 +631,7 @@ void refactor()
|
|||||||
|
|
||||||
content++;
|
content++;
|
||||||
left--;
|
left--;
|
||||||
|
|
||||||
Skip:
|
Skip:
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
@ -72,7 +72,6 @@ do \
|
|||||||
while(0) \
|
while(0) \
|
||||||
|
|
||||||
|
|
||||||
using c8 = char;
|
|
||||||
using s8 = zpl_i8;
|
using s8 = zpl_i8;
|
||||||
using s32 = zpl_i32;
|
using s32 = zpl_i32;
|
||||||
using s64 = zpl_i64;
|
using s64 = zpl_i64;
|
||||||
@ -84,7 +83,7 @@ using uw = zpl_usize;
|
|||||||
using sw = zpl_isize;
|
using sw = zpl_isize;
|
||||||
|
|
||||||
|
|
||||||
ct c8 const* Msg_Invalid_Value = "INVALID VALUE PROVIDED";
|
ct char const* Msg_Invalid_Value = "INVALID VALUE PROVIDED";
|
||||||
|
|
||||||
|
|
||||||
namespace Memory
|
namespace Memory
|
||||||
|
@ -6,7 +6,6 @@ namespace File
|
|||||||
{
|
{
|
||||||
zpl_string Source = nullptr;
|
zpl_string Source = nullptr;
|
||||||
zpl_string Destination = nullptr;
|
zpl_string Destination = nullptr;
|
||||||
|
|
||||||
zpl_file_contents Content {};
|
zpl_file_contents Content {};
|
||||||
|
|
||||||
zpl_arena Buffer;
|
zpl_arena Buffer;
|
||||||
@ -92,7 +91,7 @@ namespace Spec
|
|||||||
}
|
}
|
||||||
|
|
||||||
ct
|
ct
|
||||||
c8 strlen_tok( Tok tok )
|
char strlen_tok( Tok tok )
|
||||||
{
|
{
|
||||||
ct
|
ct
|
||||||
const u8 tok_to_len[ Tok::Num_Tok ] =
|
const u8 tok_to_len[ Tok::Num_Tok ] =
|
||||||
@ -632,6 +631,7 @@ void refactor()
|
|||||||
|
|
||||||
content++;
|
content++;
|
||||||
left--;
|
left--;
|
||||||
|
|
||||||
Skip:
|
Skip:
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user