Check-in [420f721914]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Move structure definitions to other file.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 420f7219147f24a0fe9e4aaaab12d278bd9b9a4e
User & Date: stephanie.gawroriski 2019-10-06 14:31:57
Context
2019-10-06
16:05
Migrate sleep system call. check-in: d26777b957 user: stephanie.gawroriski tags: trunk
14:31
Move structure definitions to other file. check-in: 420f721914 user: stephanie.gawroriski tags: trunk
14:30
Move the static built-in font to another file. check-in: 5c1c5e72c6 user: stephanie.gawroriski tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ratufacoat/sjmerc.c.

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157

158
159
160
161
162
163
164
 *
 * @since 2019/06/02
 */

#include "sjmerc.h"
#include "sjmecon.h"
#include "sjmebsqf.h"

/**
 * Division result.
 *
 * @since 2019/06/20
 */
typedef struct sjme_jint_div
{
	/** Quotient. */
	sjme_jint quot;

	/** Remainder. */
	sjme_jint rem;
} sjme_jint_div;

/**
 * Virtual CPU state.
 *
 * @since 2019/06/27
 */
typedef struct sjme_cpustate sjme_cpustate;
struct sjme_cpustate
{
	/** PC. */
	sjme_vmemptr pc;
	
	/** Registers. */
	sjme_jint r[SJME_MAX_REGISTERS];
	
	/** Debug: Class name. */
	sjme_vmemptr debugclassname;
	
	/** Debug: Method name. */
	sjme_vmemptr debugmethodname;
	
	/** Debug: Method type. */
	sjme_vmemptr debugmethodtype;
	
	/** Debug: Source file. */
	sjme_vmemptr debugsourcefile;
	
	/** Debug: Current line. */
	sjme_jint debugline;
	
	/** Debug: Java Operation. */
	sjme_jint debugjop;
	
	/** Debug: Java Address. */
	sjme_jint debugjpc;
	
	/** Debug: The Task ID. */
	sjme_jint taskid;
	
	/** The parent CPU state. */
	sjme_cpustate* parent;
};

/** Virtual CPU. */
typedef struct sjme_cpu sjme_cpu;
struct sjme_cpu
{
	/** The state of this thread. */
	sjme_jint threadstate;
	
	/* System call arguments. */
	sjme_jint syscallargs[SJME_MAX_SYSCALLARGS];
	
	/* System call error numbers. */
	sjme_jint syscallerr[SJME_SYSCALL_NUM_SYSCALLS];
	
	/* Supervisor properties. */
	sjme_jint supervisorprops[SJME_SUPERPROP_NUM_PROPERTIES];
	
	/* Current CPU state. */
	sjme_cpustate state;
};

/** Virtual machine state. */
struct sjme_jvm
{
	/** Virtual memory information. */
	sjme_vmem* vmem;
	
	/** RAM. */
	sjme_vmemmap* ram;
	
	/** ROM. */
	sjme_vmemmap* rom;
	
	/** Configuration space. */
	sjme_vmemmap* config;
	
	/** Framebuffer. */
	sjme_vmemmap* framebuffer;
	
	/** OptionJAR. */
	sjme_vmemmap* optionjar;
	
	/** Preset ROM. */
	void* presetrom;
	
	/** Framebuffer info. */
	sjme_framebuffer* fbinfo;
	
	/** Native functions. */
	sjme_nativefuncs* nativefuncs;
	
	/** Linearly fair CPU execution engine. */
	sjme_jint fairthreadid;
	
	/** Threads. */
	sjme_cpu threads[SJME_THREAD_MAX];
	
	/** Total instruction count. */
	sjme_jint totalinstructions;
	
	/** Did the supervisor boot okay? */
	sjme_jint supervisorokay;
	
	/** Console X position. */
	sjme_jint conx;
	
	/** Console Y position. */
	sjme_jint cony;
	
	/** Console width. */
	sjme_jint conw;
	
	/** Console height. */
	sjme_jint conh;
	
	/** System call static field pointer. */
	sjme_vmemptr syscallsfp;
	
	/** System call code pointer. */
	sjme_vmemptr syscallcode;
	
	/** System call pool pointer. */
	sjme_vmemptr syscallpool;
};


/** Sets the error code. */
void sjme_seterror(sjme_error* error, sjme_jint code, sjme_jint value)
{
	if (error != NULL)
	{
		error->code = code;







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
>







11
12
13
14
15
16
17












































































































































18
19
20
21
22
23
24
25
 *
 * @since 2019/06/02
 */

#include "sjmerc.h"
#include "sjmecon.h"
#include "sjmebsqf.h"












































































































































#include "sjmevdef.h"

/** Sets the error code. */
void sjme_seterror(sjme_error* error, sjme_jint code, sjme_jint value)
{
	if (error != NULL)
	{
		error->code = code;

Added ratufacoat/sjmevdef.h.

















































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
/* ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// --------------------------------------------------------------------------*/

/**
 * SquirrelJME Virtual Machine Definitions.
 *
 * @since 2019/10/06
 */

/** Header guard. */
#ifndef SJME_hGRATUFACOATSJMFHSJMEVDEFH
#define SJME_hGRATUFACOATSJMFHSJMEVDEFH

/** Anti-C++. */
#ifdef _cplusplus
#ifndef SJME_CXX_IS_EXTERNED
#define SJME_CXX_IS_EXTERNED
#define SJME_cXRATUFACOATSJMFHSJMEVDEFH
extern "C"
{
#endif /** #ifdef SJME_CXX_IS_EXTERNED */
#endif /** #ifdef __cplusplus */

/****************************************************************************/

/**
 * Division result.
 *
 * @since 2019/06/20
 */
typedef struct sjme_jint_div
{
	/** Quotient. */
	sjme_jint quot;

	/** Remainder. */
	sjme_jint rem;
} sjme_jint_div;

/**
 * Virtual CPU state.
 *
 * @since 2019/06/27
 */
typedef struct sjme_cpustate sjme_cpustate;
struct sjme_cpustate
{
	/** PC. */
	sjme_vmemptr pc;
	
	/** Registers. */
	sjme_jint r[SJME_MAX_REGISTERS];
	
	/** Debug: Class name. */
	sjme_vmemptr debugclassname;
	
	/** Debug: Method name. */
	sjme_vmemptr debugmethodname;
	
	/** Debug: Method type. */
	sjme_vmemptr debugmethodtype;
	
	/** Debug: Source file. */
	sjme_vmemptr debugsourcefile;
	
	/** Debug: Current line. */
	sjme_jint debugline;
	
	/** Debug: Java Operation. */
	sjme_jint debugjop;
	
	/** Debug: Java Address. */
	sjme_jint debugjpc;
	
	/** Debug: The Task ID. */
	sjme_jint taskid;
	
	/** The parent CPU state. */
	sjme_cpustate* parent;
};

/** Virtual CPU. */
typedef struct sjme_cpu sjme_cpu;
struct sjme_cpu
{
	/** The state of this thread. */
	sjme_jint threadstate;
	
	/* System call arguments. */
	sjme_jint syscallargs[SJME_MAX_SYSCALLARGS];
	
	/* System call error numbers. */
	sjme_jint syscallerr[SJME_SYSCALL_NUM_SYSCALLS];
	
	/* Supervisor properties. */
	sjme_jint supervisorprops[SJME_SUPERPROP_NUM_PROPERTIES];
	
	/* Current CPU state. */
	sjme_cpustate state;
};

/** Virtual machine state. */
struct sjme_jvm
{
	/** Virtual memory information. */
	sjme_vmem* vmem;
	
	/** RAM. */
	sjme_vmemmap* ram;
	
	/** ROM. */
	sjme_vmemmap* rom;
	
	/** Configuration space. */
	sjme_vmemmap* config;
	
	/** Framebuffer. */
	sjme_vmemmap* framebuffer;
	
	/** OptionJAR. */
	sjme_vmemmap* optionjar;
	
	/** Preset ROM. */
	void* presetrom;
	
	/** Framebuffer info. */
	sjme_framebuffer* fbinfo;
	
	/** Native functions. */
	sjme_nativefuncs* nativefuncs;
	
	/** Linearly fair CPU execution engine. */
	sjme_jint fairthreadid;
	
	/** Threads. */
	sjme_cpu threads[SJME_THREAD_MAX];
	
	/** Total instruction count. */
	sjme_jint totalinstructions;
	
	/** Did the supervisor boot okay? */
	sjme_jint supervisorokay;
	
	/** Console X position. */
	sjme_jint conx;
	
	/** Console Y position. */
	sjme_jint cony;
	
	/** Console width. */
	sjme_jint conw;
	
	/** Console height. */
	sjme_jint conh;
	
	/** System call static field pointer. */
	sjme_vmemptr syscallsfp;
	
	/** System call code pointer. */
	sjme_vmemptr syscallcode;
	
	/** System call pool pointer. */
	sjme_vmemptr syscallpool;
};

/****************************************************************************/

/** Anti-C++. */
#ifdef __cplusplus
#ifdef SJME_cXRATUFACOATSJMFHSJMEVDEFH
}
#undef SJME_cXRATUFACOATSJMFHSJMEVDEFH
#undef SJME_CXX_IS_EXTERNED
#endif /** #ifdef SJME_cXRATUFACOATSJMFHSJMEVDEFH */
#endif /** #ifdef __cplusplus */

/** Header guard. */
#endif /* #ifndef SJME_hGRATUFACOATSJMFHSJMEVDEFH */