mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-23 21:10:19 +00:00
Fix Typos in the Codebase (#210)
* Fix Typos * Revert some changes * Revert ldtk file
This commit is contained in:
parent
e7f278188f
commit
842c415a9f
@ -13,7 +13,7 @@ For methods, `call_method` can be used.
|
|||||||
+ `PyObject* call(PyObject* obj, ...)`
|
+ `PyObject* call(PyObject* obj, ...)`
|
||||||
+ `PyObject* call_method(PyObject* obj, StrName name, ...)`
|
+ `PyObject* call_method(PyObject* obj, StrName name, ...)`
|
||||||
|
|
||||||
### Exmaple
|
### Example
|
||||||
|
|
||||||
Let's create a `dict` object and set a key-value pair,
|
Let's create a `dict` object and set a key-value pair,
|
||||||
which equals to the following python snippet.
|
which equals to the following python snippet.
|
||||||
|
@ -143,7 +143,7 @@ The constructor can take 1 extra parameters.
|
|||||||
|
|
||||||
#### `VM(bool enable_os=true)`
|
#### `VM(bool enable_os=true)`
|
||||||
|
|
||||||
+ `enable_os`, whether to enable OS-related features or not. This setting controls the availability of priviledged modules such os `io` and `os` as well as builtin function `open`. **It is designed for sandboxing.**
|
+ `enable_os`, whether to enable OS-related features or not. This setting controls the availability of privileged modules such os `io` and `os` as well as builtin function `open`. **It is designed for sandboxing.**
|
||||||
|
|
||||||
When you are done with the `VM` instance, use `delete` operator to dispose it.
|
When you are done with the `VM` instance, use `delete` operator to dispose it.
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ PocketPython provides a sandboxed Python environment.
|
|||||||
All python code is executed in a C# virtual machine.
|
All python code is executed in a C# virtual machine.
|
||||||
The user cannot access the file system, network, or any other resources of the host machine.
|
The user cannot access the file system, network, or any other resources of the host machine.
|
||||||
|
|
||||||
### Seemless Interop with C#
|
### Seamless Interop with C#
|
||||||
|
|
||||||
PocketPython uses `object` in C# to represent dynamic typed Python objects.
|
PocketPython uses `object` in C# to represent dynamic typed Python objects.
|
||||||
Most of the basic Python types correspond to a C# type,
|
Most of the basic Python types correspond to a C# type,
|
||||||
|
@ -9,18 +9,18 @@
|
|||||||
/*************** feature settings ***************/
|
/*************** feature settings ***************/
|
||||||
|
|
||||||
// Whether to compile os-related modules or not
|
// Whether to compile os-related modules or not
|
||||||
#ifndef PK_ENABLE_OS // can be overrided by cmake
|
#ifndef PK_ENABLE_OS // can be overridden by cmake
|
||||||
#define PK_ENABLE_OS 0
|
#define PK_ENABLE_OS 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Enable this if you are working with multi-threading (experimental)
|
// Enable this if you are working with multi-threading (experimental)
|
||||||
// This triggers necessary locks to make the VM thread-safe
|
// This triggers necessary locks to make the VM thread-safe
|
||||||
#ifndef PK_ENABLE_THREAD // can be overrided by cmake
|
#ifndef PK_ENABLE_THREAD // can be overridden by cmake
|
||||||
#define PK_ENABLE_THREAD 0
|
#define PK_ENABLE_THREAD 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// GC min threshold
|
// GC min threshold
|
||||||
#ifndef PK_GC_MIN_THRESHOLD // can be overrided by cmake
|
#ifndef PK_GC_MIN_THRESHOLD // can be overridden by cmake
|
||||||
#define PK_GC_MIN_THRESHOLD 32768
|
#define PK_GC_MIN_THRESHOLD 32768
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -220,7 +220,7 @@ namespace pkpy
|
|||||||
newDeque.insertObj(false, true, -1, *it);
|
newDeque.insertObj(false, true, -1, *it);
|
||||||
return newDequeObj;
|
return newDequeObj;
|
||||||
});
|
});
|
||||||
// NEW: counts the number of occurences of the given object in the deque
|
// NEW: counts the number of occurrences of the given object in the deque
|
||||||
vm->bind(type, "count(self, obj) -> int",
|
vm->bind(type, "count(self, obj) -> int",
|
||||||
[](VM *vm, ArgsView args)
|
[](VM *vm, ArgsView args)
|
||||||
{
|
{
|
||||||
@ -290,7 +290,7 @@ namespace pkpy
|
|||||||
self.insertObj(false, false, index, obj); // this index shouldn't be fixed using vm->normalized_index, pass as is
|
self.insertObj(false, false, index, obj); // this index shouldn't be fixed using vm->normalized_index, pass as is
|
||||||
return vm->None;
|
return vm->None;
|
||||||
});
|
});
|
||||||
// NEW: removes the first occurence of the given object from the deque
|
// NEW: removes the first occurrence of the given object from the deque
|
||||||
vm->bind(type, "remove(self, obj) -> None",
|
vm->bind(type, "remove(self, obj) -> None",
|
||||||
[](VM *vm, ArgsView args)
|
[](VM *vm, ArgsView args)
|
||||||
{
|
{
|
||||||
@ -450,7 +450,7 @@ namespace pkpy
|
|||||||
/// @brief pops or removes an item from the deque
|
/// @brief pops or removes an item from the deque
|
||||||
/// @param front if true, pop from the front of the deque
|
/// @param front if true, pop from the front of the deque
|
||||||
/// @param back if true, pop from the back of the deque
|
/// @param back if true, pop from the back of the deque
|
||||||
/// @param item if front and back is not set, remove the first occurence of item from the deque
|
/// @param item if front and back is not set, remove the first occurrence of item from the deque
|
||||||
/// @param vm is needed for the py_eq
|
/// @param vm is needed for the py_eq
|
||||||
/// @return PyObject* if front or back is set, this is a pop operation and we return a PyObject*, if front and back are not set, this is a remove operation and we return the removed item or nullptr
|
/// @return PyObject* if front or back is set, this is a pop operation and we return a PyObject*, if front and back are not set, this is a remove operation and we return the removed item or nullptr
|
||||||
PyObject *PyDeque::popObj(bool front, bool back, PyObject *item, VM *vm)
|
PyObject *PyDeque::popObj(bool front, bool back, PyObject *item, VM *vm)
|
||||||
|
@ -591,7 +591,7 @@ namespace pkpy{
|
|||||||
ctx->emit_(OP_CALL_TP, 0, line);
|
ctx->emit_(OP_CALL_TP, 0, line);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
// vectorcall protocal
|
// vectorcall protocol
|
||||||
for(auto& item: args) item->emit_(ctx);
|
for(auto& item: args) item->emit_(ctx);
|
||||||
for(auto& item: kwargs){
|
for(auto& item: kwargs){
|
||||||
uint16_t index = StrName(item.first.sv()).index;
|
uint16_t index = StrName(item.first.sv()).index;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user