ScummVM API documentation
uc_process.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#ifndef ULTIMA8_USECODE_UCPROCESS_H
22#define ULTIMA8_USECODE_UCPROCESS_H
23
24#include "ultima/ultima8/kernel/process.h"
25#include "ultima/ultima8/usecode/uc_stack.h"
26
27namespace Ultima {
28namespace Ultima8 {
29
30class Usecode;
31
32// probably won't inherit from Process directly in the future
33class UCProcess : public Process {
34 friend class UCMachine;
35 friend class Kernel;
36public:
37 UCProcess();
38 UCProcess(uint16 classid, uint16 offset, uint32 this_ptr = 0,
39 int thissize = 0, const uint8 *args = 0, int argsize = 0);
40 ~UCProcess() override;
41
42 ENABLE_RUNTIME_CLASSTYPE()
43
44 void run() override;
45
46 void terminate() override;
47
48 void freeOnTerminate(uint16 index, int type);
49
50 void setReturnValue(uint32 retval) {
51 _temp32 = retval;
52 }
53
54 uint16 getClassId() const {
55 return _classId;
56 }
57
58 Common::String dumpInfo() const override;
59
60 bool loadData(Common::ReadStream *rs, uint32 version);
61 void saveData(Common::WriteStream *ws) override;
62
63protected:
64 void load(uint16 classid, uint16 offset, uint32 this_ptr = 0,
65 int thissize = 0, const uint8 *args = 0, int argsize = 0);
66 void call(uint16 classid, uint16 offset);
67 bool ret();
68
69 // stack base pointer
70 uint16 _bp;
71
72 Usecode *_usecode;
73
74 uint16 _classId;
75 uint16 _ip;
76
77 uint32 _temp32;
78
79 // data stack
80 UCStack _stack;
81
82 // "Free Me" list
84};
85
86} // End of namespace Ultima8
87} // End of namespace Ultima
88
89#endif
Definition: list.h:44
Definition: stream.h:385
Definition: str.h:59
Definition: stream.h:77
Definition: kernel.h:45
Definition: process.h:38
Definition: uc_machine.h:42
Definition: uc_process.h:33
Common::String dumpInfo() const override
dump some info about this process to a string
void saveData(Common::WriteStream *ws) override
save Process data
void terminate() override
terminate the process. This wakes up all processes waiting for it.
Definition: uc_stack.h:182
Definition: usecode.h:34