mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 03:20:18 +00:00
add py_resetallvm
This commit is contained in:
parent
8f48c7d081
commit
f9debd804e
@ -108,6 +108,8 @@ PK_API int py_currentvm();
|
|||||||
PK_API void py_switchvm(int index);
|
PK_API void py_switchvm(int index);
|
||||||
/// Reset the current VM.
|
/// Reset the current VM.
|
||||||
PK_API void py_resetvm();
|
PK_API void py_resetvm();
|
||||||
|
/// Reset All VMs.
|
||||||
|
PK_API void py_resetallvm();
|
||||||
/// Get the current VM context. This is used for user-defined data.
|
/// Get the current VM context. This is used for user-defined data.
|
||||||
PK_API void* py_getvmctx();
|
PK_API void* py_getvmctx();
|
||||||
/// Set the current VM context. This is used for user-defined data.
|
/// Set the current VM context. This is used for user-defined data.
|
||||||
|
@ -94,6 +94,14 @@ void py_resetvm() {
|
|||||||
VM__ctor(vm);
|
VM__ctor(vm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void py_resetallvm() {
|
||||||
|
for(int i = 0; i < 16; i++) {
|
||||||
|
py_switchvm(i);
|
||||||
|
py_resetvm();
|
||||||
|
}
|
||||||
|
py_switchvm(0);
|
||||||
|
}
|
||||||
|
|
||||||
int py_currentvm() {
|
int py_currentvm() {
|
||||||
for(int i = 0; i < 16; i++) {
|
for(int i = 0; i < 16; i++) {
|
||||||
if(pk_all_vm[i] == pk_current_vm) return i;
|
if(pk_all_vm[i] == pk_current_vm) return i;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user