ScummVM API documentation
nl_parse.h
1
/* ScummVM - Graphic Adventure Engine
2
*
3
* ScummVM is the legal property of its developers, whose names
4
* are too numerous to list here. Please refer to the COPYRIGHT
5
* file distributed with this source distribution.
6
*
7
* This program is free software: you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation, either version 3 of the License, or
10
* (at your option) any later version.
11
*
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
16
*
17
* You should have received a copy of the GNU General Public License
18
* along with this program. If not, see <http://www.gnu.org/licenses/>.
19
*
20
*/
21
22
#ifndef WATCHMAKER_NL_PARSE_H
23
#define WATCHMAKER_NL_PARSE_H
24
25
#define J_MAXSTRLEN 512L
26
#include "common/stream.h"
27
28
namespace
Watchmaker
{
29
30
class
NLParser
{
31
unsigned
int
jStringLimit = J_MAXSTRLEN, jTillEOL = 0, jUsingComments = 0;
32
unsigned
long
nlLineCounter;
33
int
ReadArgument_(
char
*str,
int
teol);
34
Common::SharedPtr<Common::SeekableReadStream>
_stream =
nullptr
;
35
void (*ErrorFunc)() =
nullptr
;
36
public
:
37
// TODO: Need a static version that allows for failure, as we have fallbacks in the code to use.
38
static
Common::SharedPtr<NLParser>
open(
const
Common::String
&name);
39
NLParser
(
Common::SharedPtr<Common::SeekableReadStream>
stream);
40
int
ParseError(
const
char
*ln, ...);
41
void
IfParseErrorDo(
void
(*func)());
42
int
ReadArgumentEOL(
char
*str) {
43
return
ReadArgument_(str, 1);
44
}
45
int
ReadArgument(
char
*str) {
46
return
ReadArgument_(str, 0);
47
}
48
int
ReadNumber();
//max 80 cifre
49
int
SearchArgument(
char
*t, ...);
50
int
getCurLine() {
51
return
nlLineCounter;
52
}
53
54
int
JParse_ReadByte(
void
) {
55
int
a = _stream->
readByte
();
56
if
(a ==
'\n'
)
57
nlLineCounter++;
58
return
a;
59
}
60
61
int
JParse_PrevByte(
void
) {
62
63
if
(_stream->
seek
(-1, SEEK_SET))
64
return
0;
65
return
1;
66
}
67
68
int
MatchWord(
const
char
*token);
69
70
#define EOF_PARSED -2
71
};
72
73
74
}
// End of namespace Watchmaker
75
76
#endif // WATCHMAKER_NL_PARSE_H
Watchmaker
Definition:
2d_stuff.h:30
Common::String
Definition:
str.h:59
Common::SeekableReadStream::seek
virtual bool seek(int64 offset, int whence=SEEK_SET)=0
Common::ReadStream::readByte
byte readByte()
Definition:
stream.h:434
Watchmaker::NLParser
Definition:
nl_parse.h:30
Common::SharedPtr< Common::SeekableReadStream >
engines
watchmaker
init
nl_parse.h
Generated on Wed Sep 3 2025 09:17:09 for ScummVM API documentation by
1.8.13