mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 11:30:18 +00:00
...
This commit is contained in:
parent
f27548c6df
commit
c9e688207a
@ -242,11 +242,11 @@ py_GlobalRef py_getreg(int i);
|
|||||||
void py_setreg(int i, py_Ref val);
|
void py_setreg(int i, py_Ref val);
|
||||||
|
|
||||||
/// Get variable in the `__main__` module.
|
/// Get variable in the `__main__` module.
|
||||||
py_GlobalRef py_getglobal(const char* name);
|
py_GlobalRef py_getglobal(py_Name name);
|
||||||
/// Set variable in the `__main__` module.
|
/// Set variable in the `__main__` module.
|
||||||
void py_setglobal(const char* name, py_Ref val);
|
void py_setglobal(py_Name name, py_Ref val);
|
||||||
/// Get variable in the `builtins` module.
|
/// Get variable in the `builtins` module.
|
||||||
py_GlobalRef py_getbuiltin(const char* name);
|
py_GlobalRef py_getbuiltin(py_Name name);
|
||||||
|
|
||||||
/// Equivalent to `*dst = *src`.
|
/// Equivalent to `*dst = *src`.
|
||||||
void py_assign(py_Ref dst, py_Ref src);
|
void py_assign(py_Ref dst, py_Ref src);
|
||||||
|
@ -13,17 +13,11 @@ py_Ref py_getmodule(const char* path) {
|
|||||||
return NameDict__try_get(&vm->modules, py_name(path));
|
return NameDict__try_get(&vm->modules, py_name(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
py_Ref py_getbuiltin(const char* name){
|
py_Ref py_getbuiltin(py_Name name) { return py_getdict(&pk_current_vm->builtins, name); }
|
||||||
return py_getdict(&pk_current_vm->builtins, py_name(name));
|
|
||||||
}
|
|
||||||
|
|
||||||
py_Ref py_getglobal(const char* name){
|
py_Ref py_getglobal(py_Name name) { return py_getdict(&pk_current_vm->main, name); }
|
||||||
return py_getdict(&pk_current_vm->main, py_name(name));
|
|
||||||
}
|
|
||||||
|
|
||||||
void py_setglobal(const char* name, py_Ref val){
|
void py_setglobal(py_Name name, py_Ref val) { py_setdict(&pk_current_vm->main, name, val); }
|
||||||
py_setdict(&pk_current_vm->main, py_name(name), val);
|
|
||||||
}
|
|
||||||
|
|
||||||
py_Ref py_newmodule(const char* path) {
|
py_Ref py_newmodule(const char* path) {
|
||||||
ManagedHeap* heap = &pk_current_vm->heap;
|
ManagedHeap* heap = &pk_current_vm->heap;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user