wavelength 1.0.0
Loading...
Searching...
No Matches
DataFile.h File Reference
#include <vector>
#include "utl/BinStream.h"
#include "utl/Data.h"
Include dependency graph for DataFile.h:

Go to the source code of this file.

Enumerations

enum  DataToken {
  kDataTokenEnd = 0 , kDataTokenFloat = 1 , kDataTokenInt = 2 , kDataTokenString = 3 ,
  kDataTokenSymbol = 4 , kDataTokenArrayOpen = 5 , kDataTokenArrayClose = 6 , kDataTokenMacroOpen = 7 ,
  kDataTokenMacroClose = 8 , kDataTokenInclude = 9 , kDataTokenMergeInclude = 10
}
 A token the script lexer returns. More...

Functions

int yylex ()
 Read the next token of the script being parsed.
BinStream & DataReadFilenames (BinStream &bs, std::vector< const char * > &filenames)
 Read the script names a compiled script begins with into the shared string table.
int DataLexInput (char *buf, int max)
 Fill the lexer's buffer from the stream being parsed.
void DataSetUseCompiled ()
 Read every script compiled, even from the host.
DataArray * DataReadFile (const char *file, BinStream *stream)
 Read a script, as text from the host or compiled from the disc or when DataSetUseCompiled() was called.
DataArray * DataReadTxtFile (const char *file, BinStream *stream)
 Parse a script source.
DataArray * DataParseArray ()
 Parse nodes up to the end of the current array into a new array.
bool DataParseNode ()
 Parse one token into the current array.
DataArray * DataReadEmbeddedFile (int delimiterLength)
 Parse the script yytext refers to, relative to the directory of the script being parsed.
void DataMakeCompiledPath (char *out, const char *file, bool compiled)
 Make the path a script is read from: the source itself, or dir/gen/base.ext.bin when reading compiled scripts.

Variables

char * yytext
 Text of the token yylex() returned last.
int yyleng
 Length of yytext.
int gDataLine
 Line of the script being parsed, counted by the lexer from one.

Enumeration Type Documentation

◆ DataToken

enum DataToken

A token the script lexer returns.

Enumerator
kDataTokenEnd 

The end of the input.

kDataTokenFloat 

A real number.

kDataTokenInt 

An integer.

kDataTokenString 

Text in double quotes.

kDataTokenSymbol 

A bare word.

kDataTokenArrayOpen 

(, which opens a nested array.

kDataTokenArrayClose 

), which closes an array.

kDataTokenMacroOpen 

{, which opens the value of the macro named before it.

kDataTokenMacroClose 

}, which closes a macro's value.

kDataTokenInclude 

<file>, whose nodes are inserted in place.

kDataTokenMergeInclude 

<<file>>, whose nested arrays are merged by tag.

Function Documentation

◆ yylex()

int yylex ( )

Read the next token of the script being parsed.

Returns
A DataToken. The text of the token is in yytext.
Ghidra address:
0x1001a210

◆ DataReadFilenames()

BinStream & DataReadFilenames ( BinStream & bs,
std::vector< const char * > & filenames )

Read the script names a compiled script begins with into the shared string table.

Parameters
bsThe stream.
filenamesReceives the names.
Returns
The stream.
Ghidra address:
0x10015340

◆ DataLexInput()

int DataLexInput ( char * buf,
int max )

Fill the lexer's buffer from the stream being parsed.

Parameters
bufThe buffer.
maxThe size of the buffer.
Returns
max, or zero when the stream has failed before or during the read.
Ghidra address:
0x10015410

◆ DataSetUseCompiled()

void DataSetUseCompiled ( )

Read every script compiled, even from the host.

Ghidra address:
0x10015450

◆ DataReadFile()

DataArray * DataReadFile ( const char * file,
BinStream * stream )

Read a script, as text from the host or compiled from the disc or when DataSetUseCompiled() was called.

A compiled script is read from the path DataMakeCompiledPath() makes. A compiled script of the wrong version is a failure.

Parameters
fileThe path of the script source.
streamThe stream to read from, or null to open the file.
Returns
The array, with one reference, or null when the file does not open.
Ghidra address:
0x10015460

◆ DataReadTxtFile()

DataArray * DataReadTxtFile ( const char * file,
BinStream * stream )

Parse a script source.

Parameters
fileThe path of the script, recorded as the file of each array.
streamThe stream to read from, or null to open the file.
Returns
The array, with one reference, or null when the file does not open.
Ghidra address:
0x100156e0

◆ DataParseArray()

DataArray * DataParseArray ( )

Parse nodes up to the end of the current array into a new array.

Returns
The array, with one reference.
Ghidra address:
0x10015800

◆ DataParseNode()

bool DataParseNode ( )

Parse one token into the current array.

Returns
Whether the array continues.
Ghidra address:
0x10015880

◆ DataReadEmbeddedFile()

DataArray * DataReadEmbeddedFile ( int delimiterLength)

Parse the script yytext refers to, relative to the directory of the script being parsed.

A file that does not open is a failure.

Parameters
delimiterLengthThe number of angle brackets on each side of the name in yytext.
Returns
The array, with one reference.
Ghidra address:
0x10015bd0

◆ DataMakeCompiledPath()

void DataMakeCompiledPath ( char * out,
const char * file,
bool compiled )

Make the path a script is read from: the source itself, or dir/gen/base.ext.bin when reading compiled scripts.

Parameters
outReceives the path.
fileThe path of the script source.
compiledWhether to make the compiled path even from the host.
Ghidra address:
0x10015cc0

Variable Documentation

◆ yytext

char* yytext
extern

Text of the token yylex() returned last.

Ghidra address:
0x100cbe58

◆ yyleng

int yyleng
extern

Length of yytext.

Ghidra address:
0x100cbe54

◆ gDataLine

int gDataLine
extern

Line of the script being parsed, counted by the lexer from one.

Ghidra address:
0x100c391c