OpenBarnyard
 
Loading...
Searching...
No Matches
TFileLexerUTF8 Class Reference

#include <TFileLexerUTF8.h>

Inheritance diagram for TFileLexerUTF8:
TObject

Classes

struct  LookaheadTokens
 
struct  Token
 

Public Member Functions

 TDECLARE_CLASS (TFileLexerUTF8, TObject)
 
 TFileLexerUTF8 ()
 
 TFileLexerUTF8 (TFile *a_pInputStream, TINT a_iTokenLookaheadSize)
 
 ~TFileLexerUTF8 ()
 
TBOOL ComputePreprocessorAllow ()
 
void SetCharacterLookaheadSize (TINT a_iLookaheadSize)
 
void SetInputStream (TFile *a_pInputStream)
 
void Define (const TCHAR *a_szDefinition)
 
- Public Member Functions inherited from TObject
virtual Toshi::TClass * GetClass ()
 
virtual void Delete ()
 
virtual ~TObject ()
 
TBOOL IsExactly (TClass *a_pClass)
 
TBOOL IsA (TClass *a_pClass)
 

Additional Inherited Members

- Public Types inherited from TObject
enum  { IsTObject = TTRUE }
 
- Static Public Member Functions inherited from TObject
static Toshi::TObject * CreateTObject ()
 
static Toshi::TObject * CreateTObjectInPlace (void *a_pPtr)
 
static void InitialiseClass ()
 
static void DeinitialiseClass ()
 
static TFORCEINLINE TClassGetClassStatic ()
 
- Static Public Attributes inherited from TObject
static constexpr Toshi::TClass * PARENTCLASS = TNULL
 
static constinit Toshi::TClass ms_oClass = Toshi::TClass( "TObject", TObject::CreateTObject, TObject::CreateTObjectInPlace, TObject::InitialiseClass, TObject::DeinitialiseClass, 0, 2, sizeof( TObject ), alignof( TObject ) )
 

Detailed Description

Definition at line 8 of file TFileLexerUTF8.h.

Constructor & Destructor Documentation

◆ TFileLexerUTF8() [1/2]

TFileLexerUTF8::TFileLexerUTF8 ( )

Definition at line 14 of file TFileLexerUTF8.cpp.

15 : m_oEmitter( this )
16{
17 m_pFile = 0;
18 m_bUnk1 = TFALSE;
19 m_iCharLookaheadSize = 0;
20 m_iUnk3 = 0;
21 m_piCharLookahead = TNULL;
22 m_iUnk4 = 0;
23 m_iUnk5 = 0;
24 m_iUnk6 = 0;
25 m_iTokenLookaheadSize = 1;
26 m_iTokenLookaheadMask = 1;
27 m_LookaheadTokens = LookaheadTokens::Allocate()->GetTokens();
28 m_iTokenLookaheadBuffered = 0;
29 m_iTokenLookaheadFront = 0;
30 m_iTokenLookaheadBack = 0;
31 m_iSomeNum = 0;
32 m_bAllowPreprocessor = TTRUE;
33 m_bUnk7 = TFALSE;
34
35#if defined( TOSHI_SKU_WINDOWS )
36 Define( "TOSHI_SKU_WINDOWS" );
37#elif defined( TOSHI_SKU_PS2 )
38 Define( "TOSHI_SKU_PS2" );
39#elif defined( TOSHI_SKU_GC )
40 Define( "TOSHI_SKU_GC" );
41#elif defined( TOSHI_SKU_WII )
42 Define( "TOSHI_SKU_WII" );
43#else
44# error Wrong define?
45#endif
46}
#define TNULL
Definition Typedefs.h:23
#define TFALSE
Definition Typedefs.h:24
#define TTRUE
Definition Typedefs.h:25
void Define(const TCHAR *a_szDefinition)
static LookaheadTokens * Allocate(TINT a_iCount=1)

◆ TFileLexerUTF8() [2/2]

TFileLexerUTF8::TFileLexerUTF8 ( TFile * a_pInputStream,
TINT a_iTokenLookaheadSize )

Definition at line 48 of file TFileLexerUTF8.cpp.

49 : m_oEmitter( this )
50{
51 m_pFile = 0;
52 m_bUnk1 = TFALSE;
53 m_iCharLookaheadSize = 0;
54 m_iUnk3 = 0;
55 m_piCharLookahead = TNULL;
56 m_iUnk4 = 0;
57 m_iUnk5 = 0;
58 m_iUnk6 = 0;
59 m_iTokenLookaheadSize = 1;
60 m_iTokenLookaheadMask = 1;
61 m_LookaheadTokens = LookaheadTokens::Allocate( a_iTokenLookaheadSize )->GetTokens();
62 m_iTokenLookaheadBuffered = 0;
63 m_iTokenLookaheadFront = 0;
64 m_iTokenLookaheadBack = 0;
65 m_iSomeNum = 0;
66 m_bAllowPreprocessor = TTRUE;
67 m_bUnk7 = TFALSE;
68
69 m_iTokenLookaheadSize = 1 << ( ( ( a_iTokenLookaheadSize * 2 + -1 ) >> 0x17 ) + 0x81U & 0x1f );
70 m_iTokenLookaheadMask = ( m_iTokenLookaheadSize - 1 < 2 ) ? 1 : m_iTokenLookaheadSize - 1;
71
72 TASSERT( a_pInputStream != TNULL );
73 SetInputStream( a_pInputStream );
74
75#if defined( TOSHI_SKU_WINDOWS )
76 Define( "TOSHI_SKU_WINDOWS" );
77#elif defined( TOSHI_SKU_PS2 )
78 Define( "TOSHI_SKU_PS2" );
79#elif defined( TOSHI_SKU_GC )
80 Define( "TOSHI_SKU_GC" );
81#elif defined( TOSHI_SKU_WII )
82 Define( "TOSHI_SKU_WII" );
83#else
84# error Wrong define?
85#endif
86}
#define TASSERT(X,...)
Definition Defines.h:138
void SetInputStream(TFile *a_pInputStream)

◆ ~TFileLexerUTF8()

TFileLexerUTF8::~TFileLexerUTF8 ( )

Definition at line 88 of file TFileLexerUTF8.cpp.

89{
90 TIMPLEMENT();
91
92 LookaheadTokens::Free( m_LookaheadTokens );
93}
#define TIMPLEMENT()
Definition Defines.h:136
static void Free(Token *a_pHeadToken)

Member Function Documentation

◆ ComputePreprocessorAllow()

TBOOL TFileLexerUTF8::ComputePreprocessorAllow ( )

Definition at line 95 of file TFileLexerUTF8.cpp.

96{
97 for ( TINT i = 0; i < m_iSomeNum; i++ )
98 {
99 bool bFlag;
100
101 if ( m_iSomeNum - i < 0 )
102 bFlag = m_bFlags[ 0 ];
103 else
104 bFlag = m_bFlags[ m_iSomeNum - i ];
105
106 if ( !bFlag )
107 return TFALSE;
108 }
109
110 return TTRUE;
111}
int TINT
Definition Typedefs.h:7

◆ Define()

void TFileLexerUTF8::Define ( const TCHAR * a_szDefinition)

Definition at line 139 of file TFileLexerUTF8.cpp.

140{
141 bool bAlreadyDefined = TFALSE;
142
143 for ( TINT i = 0; i < m_Defines.Size(); i++ )
144 {
145 if ( m_Defines[ i ] == a_szDefinition )
146 {
147 bAlreadyDefined = TTRUE;
148 break;
149 }
150 }
151
152 if ( !bAlreadyDefined )
153 {
154 m_Defines.Push( a_szDefinition );
155 }
156}

◆ SetCharacterLookaheadSize()

void TFileLexerUTF8::SetCharacterLookaheadSize ( TINT a_iLookaheadSize)

Definition at line 113 of file TFileLexerUTF8.cpp.

114{
115 TASSERT( m_pFile != TNULL );
116 TASSERT( m_piCharLookahead == TNULL );
117
118 TINT iIntCount = 1 << ( ( a_iLookaheadSize * 2 - 1 ) >> 0x17 ) + 0x81 & 0x1f;
119 m_iCharLookaheadSize = iIntCount;
120 m_iUnk3 = iIntCount;
121 m_iUnk4 = 0;
122 m_iUnk5 = 0;
123 m_piCharLookahead = new TINT[ iIntCount ];
124
125 for ( TINT i = 0; i < iIntCount; i++ )
126 m_piCharLookahead[ i ] = m_pFile->GetCChar();
127}

◆ SetInputStream()

void TFileLexerUTF8::SetInputStream ( TFile * a_pInputStream)

Definition at line 129 of file TFileLexerUTF8.cpp.

130{
131 m_pFile = a_pInputStream;
132 m_iUnk6 = 1;
133 m_iSomeNum = 0;
134 m_bFlags[ 0 ] = TTRUE;
135 m_bAllowPreprocessor = ComputePreprocessorAllow();
137}
void SetCharacterLookaheadSize(TINT a_iLookaheadSize)
TBOOL ComputePreprocessorAllow()

◆ TDECLARE_CLASS()

TFileLexerUTF8::TDECLARE_CLASS ( TFileLexerUTF8 ,
TObject  )

The documentation for this class was generated from the following files: