|
|
@@ -1,4 +1,4 @@
|
|
|
-from typing import overload, Self
|
|
|
+from typing import Self, ClassVar
|
|
|
|
|
|
intptr = int
|
|
|
|
|
|
@@ -9,15 +9,13 @@ def memcpy(dst: intptr, src: intptr, n: int) -> None: ...
|
|
|
def memset(s: intptr, c: int, n: int) -> None: ...
|
|
|
def memcmp(s1: intptr, s2: intptr, n: int) -> int: ...
|
|
|
|
|
|
-def addressof(obj: Memory) -> intptr: ...
|
|
|
-def sizeof(obj: type[Memory]) -> int: ...
|
|
|
-
|
|
|
def read_cstr(p: intptr) -> str: ...
|
|
|
def read_bytes(p: intptr, n: int) -> bytes: ...
|
|
|
def write_cstr(p: intptr, data: str) -> None: ...
|
|
|
def write_bytes(p: intptr, data: bytes) -> None: ...
|
|
|
|
|
|
-class Memory: ...
|
|
|
+class Memory:
|
|
|
+ size: ClassVar[int]
|
|
|
|
|
|
class _BuiltinMemory[T](Memory):
|
|
|
value: T
|
|
|
@@ -27,11 +25,8 @@ class _BuiltinMemory[T](Memory):
|
|
|
def read(p: intptr, offset: int) -> T: ...
|
|
|
@staticmethod
|
|
|
def write(p: intptr, offset: int, value: T) -> None: ...
|
|
|
- @staticmethod
|
|
|
- def array(length: int) -> Self: ...
|
|
|
-
|
|
|
- @property
|
|
|
- def size(self) -> int: ...
|
|
|
+ @classmethod
|
|
|
+ def array(cls, length: int) -> Self: ...
|
|
|
|
|
|
def __getitem__(self, index: int) -> T: ...
|
|
|
def __setitem__(self, index: int, value: T) -> None: ...
|
|
|
@@ -51,11 +46,15 @@ class Double(_BuiltinMemory[float]): ...
|
|
|
class Pointer(_BuiltinMemory[intptr]): ...
|
|
|
class Bool(_BuiltinMemory[bool]): ...
|
|
|
|
|
|
-INT8: _BuiltinMemory[int]
|
|
|
-UINT8: _BuiltinMemory[int]
|
|
|
-INT16: _BuiltinMemory[int]
|
|
|
-UINT16: _BuiltinMemory[int]
|
|
|
-INT32: _BuiltinMemory[int]
|
|
|
-UINT32: _BuiltinMemory[int]
|
|
|
-INT64: _BuiltinMemory[int]
|
|
|
-UINT64: _BuiltinMemory[int]
|
|
|
+INT8: _BuiltinMemory[int] = ...
|
|
|
+UINT8: _BuiltinMemory[int] = ...
|
|
|
+INT16: _BuiltinMemory[int] = ...
|
|
|
+UINT16: _BuiltinMemory[int] = ...
|
|
|
+INT32: _BuiltinMemory[int] = ...
|
|
|
+UINT32: _BuiltinMemory[int] = ...
|
|
|
+INT64: _BuiltinMemory[int] = ...
|
|
|
+UINT64: _BuiltinMemory[int] = ...
|
|
|
+
|
|
|
+def addressof(obj: Memory) -> intptr: ...
|
|
|
+def sizeof(obj: type[Memory]) -> int: ...
|
|
|
+
|