ScummVM API documentation
cc_script.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 AGS_SHARED_SCRIPT_CC_SCRIPT_H
23
#define AGS_SHARED_SCRIPT_CC_SCRIPT_H
24
25
#include "common/std/memory.h"
26
#include "ags/shared/core/types.h"
27
28
namespace
AGS3
{
29
30
namespace
AGS
{
31
namespace
Shared {
32
class
Stream;
33
}
34
}
35
using namespace
AGS
;
// FIXME later
36
37
struct
ccScript
{
38
public
:
39
char
*globaldata;
40
int32_t globaldatasize;
41
int32_t *code;
// executable byte-code, 32-bit per op or arg
42
int32_t codesize;
// TODO: find out if we can make it size_t
43
char
*strings;
44
int32_t stringssize;
45
char
*fixuptypes;
// global data/string area/ etc
46
int32_t *fixups;
// code array index to fixup (in ints)
47
int
numfixups;
48
int
importsCapacity;
49
char
**imports;
50
int
numimports;
51
int
exportsCapacity;
52
char
**exports;
// names of exports
53
int32_t *export_addr;
// high byte is type; low 24-bits are offset
54
int
numexports;
55
int
instances;
56
// 'sections' allow the interpreter to find out which bit
57
// of the code came from header files, and which from the main file
58
char
**sectionNames;
59
int32_t *sectionOffsets;
60
int
numSections;
61
int
capacitySections;
62
63
static
ccScript
*CreateFromStream(
Shared::Stream
*in);
64
65
ccScript
();
66
ccScript
(
const
ccScript
&src);
67
virtual
~
ccScript
();
// there are few derived classes, so dtor should be virtual
68
69
// write the script to disk (after compiling)
70
void
Write(
Shared::Stream
*out);
71
// read back a script written with Write
72
bool
Read(
Shared::Stream
*in);
73
const
char
*GetSectionName(int32_t offset)
const
;
74
75
protected
:
76
// free the memory occupied by the script - do NOT attempt to run the
77
// script after calling this function
78
void
Free();
79
};
80
81
typedef
std::shared_ptr<ccScript>
PScript
;
82
83
}
// namespace AGS3
84
85
#endif
AGS
Definition:
achievements_tables.h:27
AGS3::ccScript
Definition:
cc_script.h:37
Common::SharedPtr
Definition:
ptr.h:159
AGS3::AGS::Shared::Stream
Definition:
stream.h:52
AGS3
Definition:
ags.h:40
engines
ags
shared
script
cc_script.h
Generated on Sat Nov 23 2024 09:09:40 for ScummVM API documentation by
1.8.13