snapshot before regression test
This commit is contained in:
422
Test/TestProject3/App/definetest.py
Normal file
422
Test/TestProject3/App/definetest.py
Normal file
@@ -0,0 +1,422 @@
|
||||
import t, c
|
||||
from t import CInt, CInt32T, CUInt32T, CUInt64T, CFloat64T, CPtr, CChar, CDefine, CUInt16T
|
||||
import viperlib
|
||||
import stdlib
|
||||
import platmacro
|
||||
|
||||
|
||||
MAX_SIZE: t.CDefine = 1024
|
||||
MIN_VAL: t.CDefine = 0
|
||||
MAX_VAL: t.CDefine = 100
|
||||
MASK_BYTE: t.CDefine = 0xFF
|
||||
SHIFT_BITS: t.CDefine = 8
|
||||
PI_INT: t.CDefine = 3
|
||||
ENABLED: t.CDefine = 1
|
||||
DISABLED: t.CDefine = 0
|
||||
PAGE_SIZE: t.CDefine = 4096
|
||||
BUFFER_LEN: t.CDefine = 256
|
||||
|
||||
CODE_SEG: t.CDefine | t.CUInt16T = 0x08
|
||||
DATA_SEG: t.CDefine | t.CUInt16T = 0x10
|
||||
STACK_SEG: t.CDefine | t.CUInt16T = 0x20
|
||||
|
||||
|
||||
def MAKE_FLAG(bit: CInt32T) -> t.CDefine:
|
||||
return 1 << bit
|
||||
|
||||
def CLAMP(x: CInt32T, lo: CInt32T, hi: CInt32T) -> t.CDefine:
|
||||
if x < lo:
|
||||
return lo
|
||||
if x > hi:
|
||||
return hi
|
||||
return x
|
||||
|
||||
|
||||
def test_basic_define() -> CInt:
|
||||
print(MAX_SIZE)
|
||||
print(MIN_VAL)
|
||||
print(MAX_VAL)
|
||||
print(MASK_BYTE)
|
||||
print(SHIFT_BITS)
|
||||
return 0
|
||||
|
||||
def test_define_arithmetic() -> CInt:
|
||||
a: CInt32T = 10
|
||||
b: CInt32T = a + MAX_SIZE
|
||||
print(b)
|
||||
c_val: CInt32T = (a << SHIFT_BITS) & MASK_BYTE
|
||||
print(c_val)
|
||||
d: CInt32T = MAX_VAL - MIN_VAL
|
||||
print(d)
|
||||
e: CInt32T = PAGE_SIZE / 4
|
||||
print(e)
|
||||
return 0
|
||||
|
||||
def test_define_conditional() -> CInt:
|
||||
mode: CInt32T = ENABLED
|
||||
if mode == ENABLED:
|
||||
print(1)
|
||||
else:
|
||||
print(0)
|
||||
if mode == DISABLED:
|
||||
print(0)
|
||||
else:
|
||||
print(1)
|
||||
val: CInt32T = 50
|
||||
if val > MAX_VAL:
|
||||
print(1)
|
||||
else:
|
||||
print(0)
|
||||
if val < MAX_VAL:
|
||||
print(1)
|
||||
else:
|
||||
print(0)
|
||||
return 0
|
||||
|
||||
def test_define_loop() -> CInt:
|
||||
i: CInt32T = 0
|
||||
while i < MAX_VAL:
|
||||
i = i + 1
|
||||
if i > 10:
|
||||
break
|
||||
print(i)
|
||||
i = 0
|
||||
while i < MAX_SIZE:
|
||||
i = i + PAGE_SIZE
|
||||
if i >= PAGE_SIZE * 4:
|
||||
break
|
||||
print(i)
|
||||
return 0
|
||||
|
||||
def test_typed_define() -> CInt:
|
||||
seg: CUInt16T = CODE_SEG | DATA_SEG | STACK_SEG
|
||||
print(seg)
|
||||
cs: CUInt16T = CODE_SEG
|
||||
print(cs)
|
||||
ds: CUInt16T = DATA_SEG
|
||||
print(ds)
|
||||
return 0
|
||||
|
||||
def test_define_function() -> CInt:
|
||||
flag0 = MAKE_FLAG(0)
|
||||
print(flag0)
|
||||
flag3 = MAKE_FLAG(3)
|
||||
print(flag3)
|
||||
flag7 = MAKE_FLAG(7)
|
||||
print(flag7)
|
||||
return 0
|
||||
|
||||
def test_define_clamp() -> CInt:
|
||||
v1 = CLAMP(50, 0, 100)
|
||||
print(v1)
|
||||
v2 = CLAMP(-10, 0, 100)
|
||||
print(v2)
|
||||
v3 = CLAMP(150, 0, 100)
|
||||
print(v3)
|
||||
return 0
|
||||
|
||||
def test_define_string() -> CInt:
|
||||
buf: CChar | CPtr = CPtr(stdlib.malloc(BUFFER_LEN))
|
||||
viperlib.snprintf(buf, BUFFER_LEN, "MAX_SIZE=%d PAGE=%d MASK=0x%x", MAX_SIZE, PAGE_SIZE, MASK_BYTE)
|
||||
print(buf)
|
||||
stdlib.free(buf)
|
||||
return 0
|
||||
|
||||
def test_define_combined() -> CInt:
|
||||
flags: CUInt32T = MAKE_FLAG(0) | MAKE_FLAG(1) | MAKE_FLAG(2)
|
||||
print(flags)
|
||||
shifted: CUInt32T = MASK_BYTE << SHIFT_BITS
|
||||
print(shifted)
|
||||
total: CUInt32T = PAGE_SIZE + BUFFER_LEN
|
||||
print(total)
|
||||
return 0
|
||||
|
||||
|
||||
def test_cif_basic() -> CInt:
|
||||
if c.CIf(ENABLED):
|
||||
print(1)
|
||||
else:
|
||||
print(0)
|
||||
if c.CIf(DISABLED):
|
||||
print(0)
|
||||
else:
|
||||
print(1)
|
||||
if c.CIf(MAX_SIZE > 512):
|
||||
print(1)
|
||||
else:
|
||||
print(0)
|
||||
if c.CIf(MIN_VAL > 0):
|
||||
print(0)
|
||||
else:
|
||||
print(1)
|
||||
return 0
|
||||
|
||||
def test_cif_elif_else() -> CInt:
|
||||
val: CInt32T = 2
|
||||
if c.CIf(val == 1):
|
||||
print(1)
|
||||
elif c.CIf(val == 2):
|
||||
print(2)
|
||||
elif c.CIf(val == 3):
|
||||
print(3)
|
||||
else:
|
||||
print(0)
|
||||
if c.CIf(val > 10):
|
||||
print(10)
|
||||
elif c.CIf(val > 5):
|
||||
print(5)
|
||||
else:
|
||||
print(val)
|
||||
return 0
|
||||
|
||||
def test_cifdef_cifndef() -> CInt:
|
||||
if c.CIfdef(MAX_SIZE):
|
||||
print(MAX_SIZE)
|
||||
else:
|
||||
print(0)
|
||||
if c.CIfdef(UNDEFINED_MACRO_XYZ):
|
||||
print(0)
|
||||
else:
|
||||
print(1)
|
||||
if c.CIfndef(UNDEFINED_MACRO_XYZ):
|
||||
print(1)
|
||||
else:
|
||||
print(0)
|
||||
if c.CIfndef(MAX_SIZE):
|
||||
print(0)
|
||||
else:
|
||||
print(1)
|
||||
return 0
|
||||
|
||||
def test_cif_platform() -> CInt:
|
||||
if c.CIfdef(_WIN32):
|
||||
print(1)
|
||||
else:
|
||||
print(0)
|
||||
if c.CIfdef(__x86_64__):
|
||||
print(1)
|
||||
else:
|
||||
print(0)
|
||||
if c.CIf(SIZEOF_VOID_P == 8):
|
||||
print(8)
|
||||
elif c.CIf(SIZEOF_VOID_P == 4):
|
||||
print(4)
|
||||
else:
|
||||
print(0)
|
||||
return 0
|
||||
|
||||
def test_cif_nested() -> CInt:
|
||||
if c.CIf(ENABLED):
|
||||
if c.CIf(MAX_SIZE > 512):
|
||||
print(1)
|
||||
else:
|
||||
print(0)
|
||||
if c.CIfdef(PAGE_SIZE):
|
||||
print(PAGE_SIZE)
|
||||
else:
|
||||
print(0)
|
||||
else:
|
||||
print(0)
|
||||
return 0
|
||||
|
||||
def test_cif_expr() -> CInt:
|
||||
if c.CIf(MASK_BYTE & 0x0F):
|
||||
print(1)
|
||||
else:
|
||||
print(0)
|
||||
if c.CIf((MAX_SIZE >> SHIFT_BITS) > 0):
|
||||
print(1)
|
||||
else:
|
||||
print(0)
|
||||
if c.CIf(ENABLED and MAX_SIZE > 0):
|
||||
print(1)
|
||||
else:
|
||||
print(0)
|
||||
if c.CIf(DISABLED or MAX_SIZE > 0):
|
||||
print(1)
|
||||
else:
|
||||
print(0)
|
||||
return 0
|
||||
|
||||
def test_platmacro_platform() -> CInt:
|
||||
if c.CIfdef(platmacro.IS_WINDOWS):
|
||||
print(1)
|
||||
else:
|
||||
print(0)
|
||||
if c.CIf(platmacro.IS_WINDOWS == 1):
|
||||
print(1)
|
||||
else:
|
||||
print(0)
|
||||
if c.CIf(platmacro.IS_LINUX == 0):
|
||||
print(1)
|
||||
else:
|
||||
print(0)
|
||||
if c.CIf(platmacro.IS_X86_64 == 1):
|
||||
print(1)
|
||||
else:
|
||||
print(0)
|
||||
return 0
|
||||
|
||||
def test_platmacro_sizes() -> CInt:
|
||||
print(platmacro.PTR_SIZE)
|
||||
print(platmacro.SIZEOF_INT)
|
||||
print(platmacro.SIZEOF_LONG)
|
||||
print(platmacro.SIZEOF_DOUBLE)
|
||||
print(platmacro.PAGE_SIZE)
|
||||
print(platmacro.CACHE_LINE_SIZE)
|
||||
return 0
|
||||
|
||||
def test_platmacro_endian() -> CInt:
|
||||
if c.CIf(platmacro.IS_LITTLE_ENDIAN == 1):
|
||||
print(1)
|
||||
else:
|
||||
print(0)
|
||||
if c.CIf(platmacro.IS_BIG_ENDIAN == 0):
|
||||
print(1)
|
||||
else:
|
||||
print(0)
|
||||
if c.CIf(platmacro.BYTE_ORDER_LE == 1):
|
||||
print(1)
|
||||
else:
|
||||
print(0)
|
||||
return 0
|
||||
|
||||
def test_platmacro_features() -> CInt:
|
||||
if c.CIf(platmacro.HAS_SSE2 == 1):
|
||||
print(1)
|
||||
else:
|
||||
print(0)
|
||||
if c.CIf(platmacro.HAS_AVX == 1):
|
||||
print(1)
|
||||
else:
|
||||
print(0)
|
||||
if c.CIf(platmacro.HAS_NEON == 0):
|
||||
print(1)
|
||||
else:
|
||||
print(0)
|
||||
return 0
|
||||
|
||||
def test_platmacro_align() -> CInt:
|
||||
print(platmacro.ALIGNOF_INT)
|
||||
print(platmacro.ALIGNOF_PTR)
|
||||
print(platmacro.ALIGNOF_DOUBLE)
|
||||
if c.CIf(platmacro.ALIGNOF_PTR == 8):
|
||||
print(1)
|
||||
else:
|
||||
print(0)
|
||||
return 0
|
||||
|
||||
def test_cifdef_cross_module() -> CInt:
|
||||
if c.CIfdef(platmacro.IS_WINDOWS):
|
||||
if c.CIf(platmacro.PTR_SIZE == 8):
|
||||
print(64)
|
||||
else:
|
||||
print(32)
|
||||
else:
|
||||
print(0)
|
||||
if c.CIfndef(platmacro.IS_ARM64):
|
||||
print(1)
|
||||
else:
|
||||
print(0)
|
||||
if c.CIfdef(platmacro.HAS_AVX2):
|
||||
print(1)
|
||||
else:
|
||||
print(0)
|
||||
return 0
|
||||
|
||||
def test_cifdef_guard() -> CInt:
|
||||
MY_HEADER_GUARD: t.CDefine = 1
|
||||
if c.CIfndef(MY_HEADER_GUARD):
|
||||
print(0)
|
||||
else:
|
||||
print(1)
|
||||
if c.CIfdef(MY_HEADER_GUARD):
|
||||
print(1)
|
||||
else:
|
||||
print(0)
|
||||
return 0
|
||||
|
||||
def test_cifdef_undefined() -> CInt:
|
||||
if c.CIfndef(NONEXISTENT_MACRO_ABC):
|
||||
print(1)
|
||||
else:
|
||||
print(0)
|
||||
if c.CIfndef(THIS_IS_ALSO_NOT_DEFINED):
|
||||
print(1)
|
||||
else:
|
||||
print(0)
|
||||
if c.CIfdef(NONEXISTENT_MACRO_ABC):
|
||||
print(0)
|
||||
else:
|
||||
print(1)
|
||||
return 0
|
||||
|
||||
def test_cifdef_complex() -> CInt:
|
||||
if c.CIfdef(platmacro.IS_WINDOWS) and c.CIf(platmacro.PTR_SIZE == 8):
|
||||
print(1)
|
||||
else:
|
||||
print(0)
|
||||
if c.CIfndef(platmacro.IS_ARM64) and c.CIf(platmacro.IS_X86_64 == 1):
|
||||
print(1)
|
||||
else:
|
||||
print(0)
|
||||
if c.CIfdef(platmacro.HAS_SSE2):
|
||||
if c.CIfdef(platmacro.HAS_AVX):
|
||||
print(2)
|
||||
else:
|
||||
print(1)
|
||||
else:
|
||||
print(0)
|
||||
return 0
|
||||
|
||||
|
||||
def define_main() -> CInt:
|
||||
print("=== Basic Define Test ===")
|
||||
test_basic_define()
|
||||
print("=== Define Arithmetic Test ===")
|
||||
test_define_arithmetic()
|
||||
print("=== Define Conditional Test ===")
|
||||
test_define_conditional()
|
||||
print("=== Define Loop Test ===")
|
||||
test_define_loop()
|
||||
print("=== Typed Define Test ===")
|
||||
test_typed_define()
|
||||
print("=== Define Function (Macro) Test ===")
|
||||
test_define_function()
|
||||
print("=== Define Clamp (Macro) Test ===")
|
||||
test_define_clamp()
|
||||
print("=== Define String Test ===")
|
||||
test_define_string()
|
||||
print("=== Define Combined Test ===")
|
||||
test_define_combined()
|
||||
print("=== CIf Basic Test ===")
|
||||
test_cif_basic()
|
||||
print("=== CIf Elif Else Test ===")
|
||||
test_cif_elif_else()
|
||||
print("=== CIfdef/CIfndef Test ===")
|
||||
test_cifdef_cifndef()
|
||||
print("=== CIf Platform Test ===")
|
||||
test_cif_platform()
|
||||
print("=== CIf Nested Test ===")
|
||||
test_cif_nested()
|
||||
print("=== CIf Expression Test ===")
|
||||
test_cif_expr()
|
||||
print("=== Platmacro Platform Test ===")
|
||||
test_platmacro_platform()
|
||||
print("=== Platmacro Sizes Test ===")
|
||||
test_platmacro_sizes()
|
||||
print("=== Platmacro Endian Test ===")
|
||||
test_platmacro_endian()
|
||||
print("=== Platmacro Features Test ===")
|
||||
test_platmacro_features()
|
||||
print("=== Platmacro Align Test ===")
|
||||
test_platmacro_align()
|
||||
print("=== CIfdef Cross-Module Test ===")
|
||||
test_cifdef_cross_module()
|
||||
print("=== CIfdef Guard Test ===")
|
||||
test_cifdef_guard()
|
||||
print("=== CIfdef Undefined Test ===")
|
||||
test_cifdef_undefined()
|
||||
print("=== CIfdef Complex Test ===")
|
||||
test_cifdef_complex()
|
||||
return 0
|
||||
95
Test/TestProject3/App/enumtest.py
Normal file
95
Test/TestProject3/App/enumtest.py
Normal file
@@ -0,0 +1,95 @@
|
||||
import t, c
|
||||
from t import CInt, CPtr, CChar, CInt32T, CExport
|
||||
import viperlib
|
||||
import stdlib
|
||||
|
||||
|
||||
class Color(t.CEnum):
|
||||
Red = 0
|
||||
Green = 1
|
||||
Blue = 2
|
||||
|
||||
|
||||
class Option(t.REnum):
|
||||
class Some:
|
||||
value: CInt
|
||||
Empty = 1
|
||||
|
||||
|
||||
class Result(t.REnum):
|
||||
class Ok:
|
||||
value: CInt
|
||||
class Err:
|
||||
msg: t.CChar | CPtr
|
||||
|
||||
|
||||
class GeoShape(t.REnum):
|
||||
class GCircle:
|
||||
radius: CInt
|
||||
class GRect:
|
||||
w: CInt
|
||||
h: CInt
|
||||
class GPoint:
|
||||
x: CInt
|
||||
y: CInt
|
||||
|
||||
|
||||
def enum_main() -> CInt:
|
||||
buf: CChar | CPtr = CPtr(stdlib.malloc(256))
|
||||
|
||||
c1: CInt = Color.Red
|
||||
c2: CInt = Color.Green
|
||||
c3: CInt = Color.Blue
|
||||
viperlib.snprintf(buf, 256, "CEnum: Red=%d Green=%d Blue=%d", c1, c2, c3)
|
||||
print(buf)
|
||||
|
||||
opt: Option = Option.Some(42)
|
||||
match opt:
|
||||
case Option.Some(v):
|
||||
viperlib.snprintf(buf, 256, "Option.Some: value=%d", v)
|
||||
print(buf)
|
||||
case Option.Empty():
|
||||
pass
|
||||
|
||||
res1: Result = Result.Ok(100)
|
||||
match res1:
|
||||
case Result.Ok(v):
|
||||
viperlib.snprintf(buf, 256, "Result.Ok: value=%d", v)
|
||||
print(buf)
|
||||
case Result.Err(e):
|
||||
pass
|
||||
|
||||
res2: Result = Result.Err("not found")
|
||||
match res2:
|
||||
case Result.Ok(v):
|
||||
pass
|
||||
case Result.Err(e):
|
||||
viperlib.snprintf(buf, 256, "Result.Err: msg=%s", e)
|
||||
print(buf)
|
||||
|
||||
s1: GeoShape = GeoShape.GCircle(5)
|
||||
match s1:
|
||||
case GeoShape.GCircle(r):
|
||||
viperlib.snprintf(buf, 256, "GeoShape.GCircle: radius=%d", r)
|
||||
print(buf)
|
||||
case _:
|
||||
pass
|
||||
|
||||
s2: GeoShape = GeoShape.GRect(10, 20)
|
||||
match s2:
|
||||
case GeoShape.GRect(w, h):
|
||||
viperlib.snprintf(buf, 256, "GeoShape.GRect: w=%d h=%d", w, h)
|
||||
print(buf)
|
||||
case _:
|
||||
pass
|
||||
|
||||
s3: GeoShape = GeoShape.GPoint(3, 4)
|
||||
match s3:
|
||||
case GeoShape.GPoint(x, y):
|
||||
viperlib.snprintf(buf, 256, "GeoShape.GPoint: x=%d y=%d", x, y)
|
||||
print(buf)
|
||||
case _:
|
||||
pass
|
||||
|
||||
stdlib.free(buf)
|
||||
return 0
|
||||
395
Test/TestProject3/App/fileiotest.py
Normal file
395
Test/TestProject3/App/fileiotest.py
Normal file
@@ -0,0 +1,395 @@
|
||||
import t, c
|
||||
from t import CInt, CInt32T, CUInt32T, CPtr, CChar, CExport
|
||||
from stdint import *
|
||||
import stdlib
|
||||
import viperlib
|
||||
import w32.win32base
|
||||
import w32.win32file
|
||||
import w32.win32console
|
||||
import w32.fileio
|
||||
from w32.fileio import File, FileW, MODE, FRESULT, SEEK_SET, SEEK_CUR, SEEK_END
|
||||
|
||||
|
||||
BUF_SIZE: t.CDefine = 4096
|
||||
|
||||
|
||||
def fileio_main():
|
||||
buf: bytes = stdlib.malloc(256)
|
||||
write_buf: bytes = stdlib.malloc(BUF_SIZE)
|
||||
read_buf: bytes = stdlib.malloc(BUF_SIZE)
|
||||
bytes_written: ULONG = 0
|
||||
bytes_read: ULONG = 0
|
||||
|
||||
w32.win32console.SetConsoleCP(65001)
|
||||
w32.win32console.SetConsoleOutputCP(65001)
|
||||
|
||||
hFile: w32.win32base.HANDLE = w32.win32file.CreateFileA(
|
||||
"testfile.txt",
|
||||
w32.win32file.GENERIC_WRITE,
|
||||
w32.win32file.FILE_SHARE_READ,
|
||||
None,
|
||||
w32.win32file.CREATE_ALWAYS,
|
||||
w32.win32file.FILE_ATTRIBUTE_NORMAL,
|
||||
None
|
||||
)
|
||||
|
||||
if hFile == w32.win32base.INVALID_HANDLE_VALUE:
|
||||
print("Failed to create file")
|
||||
return
|
||||
|
||||
viperlib.snprintf(write_buf, BUF_SIZE, "Hello from TransPyC Win32 FileIO!\nLine 2: %d + %d = %d\n", 10, 20, 30)
|
||||
write_len: ULONG = 0
|
||||
i: CInt = 0
|
||||
ch: bytes = write_buf
|
||||
while i < BUF_SIZE:
|
||||
if CInt(c.Deref(ch)) == 0:
|
||||
break
|
||||
write_len = write_len + 1
|
||||
i = i + 1
|
||||
ch = ch + 1
|
||||
|
||||
result: BOOL = w32.win32file.WriteFile(hFile, write_buf, write_len, c.Addr(bytes_written), None)
|
||||
if result == 0:
|
||||
print("WriteFile failed")
|
||||
else:
|
||||
viperlib.snprintf(buf, 256, "Written %d bytes to testfile.txt", bytes_written)
|
||||
print(buf)
|
||||
|
||||
w32.win32file.FlushFileBuffers(hFile)
|
||||
w32.win32base.CloseHandle(hFile)
|
||||
|
||||
hFile = w32.win32file.CreateFileA(
|
||||
"testfile.txt",
|
||||
w32.win32file.GENERIC_READ,
|
||||
w32.win32file.FILE_SHARE_READ,
|
||||
None,
|
||||
w32.win32file.OPEN_EXISTING,
|
||||
w32.win32file.FILE_ATTRIBUTE_NORMAL,
|
||||
None
|
||||
)
|
||||
|
||||
if hFile == w32.win32base.INVALID_HANDLE_VALUE:
|
||||
print("Failed to open file for reading")
|
||||
return
|
||||
|
||||
read_len: ULONG = 0
|
||||
result = w32.win32file.ReadFile(hFile, read_buf, BUF_SIZE - 1, c.Addr(read_len), None)
|
||||
if result == 0:
|
||||
print("ReadFile failed")
|
||||
else:
|
||||
viperlib.snprintf(buf, 256, "Read %d bytes from testfile.txt", read_len)
|
||||
print(buf)
|
||||
|
||||
read_ptr: bytes = read_buf
|
||||
read_ptr = read_ptr + read_len
|
||||
c.DerefAs(read_ptr, 0)
|
||||
print("--- File content ---")
|
||||
print(read_buf)
|
||||
print("--- End ---")
|
||||
|
||||
fileSize: ULONG = w32.win32file.GetFileSize(hFile, None)
|
||||
viperlib.snprintf(buf, 256, "File size: %d bytes", fileSize)
|
||||
print(buf)
|
||||
|
||||
w32.win32base.CloseHandle(hFile)
|
||||
|
||||
attrs: ULONG = w32.win32file.GetFileAttributesA("testfile.txt")
|
||||
if attrs == w32.win32base.INVALID_HANDLE_VALUE:
|
||||
print("GetFileAttributes failed")
|
||||
else:
|
||||
viperlib.snprintf(buf, 256, "File attributes: 0x%X", attrs)
|
||||
print(buf)
|
||||
|
||||
w32.win32file.DeleteFileA("testfile.txt")
|
||||
print("File deleted")
|
||||
|
||||
stdlib.free(write_buf)
|
||||
stdlib.free(read_buf)
|
||||
|
||||
print("=== OOP FileIO: with context manager ===")
|
||||
fileio_with_test()
|
||||
|
||||
print("=== OOP FileIO: f handle style ===")
|
||||
fileio_handle_test()
|
||||
|
||||
print("=== OOP FileIO: RP/WP/AP modes ===")
|
||||
fileio_rw_test()
|
||||
|
||||
|
||||
def fileio_with_test():
|
||||
buf: bytes = stdlib.malloc(256)
|
||||
write_buf: bytes = stdlib.malloc(BUF_SIZE)
|
||||
read_buf: bytes = stdlib.malloc(BUF_SIZE)
|
||||
|
||||
with File("oop_with.txt", MODE.W) as f:
|
||||
viperlib.snprintf(write_buf, BUF_SIZE, "with context manager test!\nLine 2: %d\n", 42)
|
||||
n: LONG = f.write_str(write_buf)
|
||||
if n < 0:
|
||||
print("[with] write failed")
|
||||
else:
|
||||
viperlib.snprintf(buf, 256, "[with] wrote %d bytes", n)
|
||||
print(buf)
|
||||
|
||||
with File("oop_with.txt", MODE.R) as f:
|
||||
n = f.read_all(read_buf, BUF_SIZE)
|
||||
if n < 0:
|
||||
print("[with] read failed")
|
||||
else:
|
||||
viperlib.snprintf(buf, 256, "[with] read %d bytes", n)
|
||||
print(buf)
|
||||
print("[with] content:")
|
||||
print(read_buf)
|
||||
|
||||
with File("oop_with.txt", MODE.R) as f:
|
||||
line1_len: LONG = f.readline(buf, 256)
|
||||
viperlib.snprintf(read_buf, BUF_SIZE, "[with] Line1(%d): ", line1_len)
|
||||
print(read_buf)
|
||||
print(buf)
|
||||
line2_len: LONG = f.readline(buf, 256)
|
||||
viperlib.snprintf(read_buf, BUF_SIZE, "[with] Line2(%d): ", line2_len)
|
||||
print(read_buf)
|
||||
print(buf)
|
||||
|
||||
with File("oop_with.txt", MODE.A) as f:
|
||||
f.write_str("Appended line!\n")
|
||||
|
||||
with File("oop_with.txt", MODE.R) as f:
|
||||
n = f.read_all(read_buf, BUF_SIZE)
|
||||
print("[with] after append:")
|
||||
print(read_buf)
|
||||
|
||||
with File("oop_with.txt", MODE.R) as f:
|
||||
sz: LONGLONG = f.size()
|
||||
pos: LONG = f.tell()
|
||||
viperlib.snprintf(buf, 256, "[with] Size=%lld Pos=%d", sz, pos)
|
||||
print(buf)
|
||||
f.seek(5, SEEK_SET)
|
||||
pos = f.tell()
|
||||
viperlib.snprintf(buf, 256, "[with] After seek: Pos=%d", pos)
|
||||
print(buf)
|
||||
|
||||
w32.win32file.DeleteFileA("oop_with.txt")
|
||||
print("[with] test file deleted")
|
||||
|
||||
stdlib.free(buf)
|
||||
stdlib.free(write_buf)
|
||||
stdlib.free(read_buf)
|
||||
|
||||
|
||||
def fileio_handle_test():
|
||||
buf: bytes = stdlib.malloc(256)
|
||||
write_buf: bytes = stdlib.malloc(BUF_SIZE)
|
||||
read_buf: bytes = stdlib.malloc(BUF_SIZE)
|
||||
|
||||
fw: File = File("oop_handle.txt", MODE.W)
|
||||
viperlib.snprintf(write_buf, BUF_SIZE, "f handle style test!\nLine 2: %d\n", 99)
|
||||
n: LONG = fw.write_str(write_buf)
|
||||
viperlib.snprintf(buf, 256, "[handle] wrote %d bytes", n)
|
||||
print(buf)
|
||||
fw.flush()
|
||||
fw.close()
|
||||
|
||||
fr: File = File("oop_handle.txt", MODE.R)
|
||||
n = fr.read_all(read_buf, BUF_SIZE)
|
||||
viperlib.snprintf(buf, 256, "[handle] read %d bytes", n)
|
||||
print(buf)
|
||||
print("[handle] content:")
|
||||
print(read_buf)
|
||||
fr.close()
|
||||
|
||||
fr2: File = File("oop_handle.txt", MODE.R)
|
||||
line1_len: LONG = fr2.readline(buf, 256)
|
||||
viperlib.snprintf(read_buf, BUF_SIZE, "[handle] Line1(%d): ", line1_len)
|
||||
print(read_buf)
|
||||
print(buf)
|
||||
line2_len: LONG = fr2.readline(buf, 256)
|
||||
viperlib.snprintf(read_buf, BUF_SIZE, "[handle] Line2(%d): ", line2_len)
|
||||
print(read_buf)
|
||||
print(buf)
|
||||
fr2.close()
|
||||
|
||||
fa: File = File("oop_handle.txt", MODE.A)
|
||||
fa.write_str("Appended by handle!\n")
|
||||
fa.close()
|
||||
|
||||
fr3: File = File("oop_handle.txt", MODE.R)
|
||||
n = fr3.read_all(read_buf, BUF_SIZE)
|
||||
print("[handle] after append:")
|
||||
print(read_buf)
|
||||
fr3.close()
|
||||
|
||||
fr4: File = File("oop_handle.txt", MODE.R)
|
||||
sz: LONGLONG = fr4.size()
|
||||
pos: LONG = fr4.tell()
|
||||
viperlib.snprintf(buf, 256, "[handle] Size=%lld Pos=%d", sz, pos)
|
||||
print(buf)
|
||||
fr4.seek(5, SEEK_SET)
|
||||
pos = fr4.tell()
|
||||
viperlib.snprintf(buf, 256, "[handle] After seek: Pos=%d", pos)
|
||||
print(buf)
|
||||
fr4.close()
|
||||
|
||||
w32.win32file.DeleteFileA("oop_handle.txt")
|
||||
print("[handle] test file deleted")
|
||||
|
||||
stdlib.free(buf)
|
||||
stdlib.free(write_buf)
|
||||
stdlib.free(read_buf)
|
||||
|
||||
|
||||
def fileio_rw_test():
|
||||
buf: bytes = stdlib.malloc(256)
|
||||
|
||||
fw: File = File("rw_test.txt", MODE.W)
|
||||
fw.write_str("original content\n")
|
||||
fw.close()
|
||||
|
||||
frp: File = File("rw_test.txt", MODE.RP)
|
||||
n: LONG = frp.read_all(buf, 256)
|
||||
viperlib.snprintf(buf, 256, "[rp] read %d bytes", n)
|
||||
print(buf)
|
||||
|
||||
frp.seek(0, SEEK_END)
|
||||
frp.write_str("appended via RP\n")
|
||||
frp.seek(0, SEEK_SET)
|
||||
n = frp.read_all(buf, 256)
|
||||
print("[rp] after RP append:")
|
||||
print(buf)
|
||||
frp.close()
|
||||
|
||||
fwp: File = File("rw_test.txt", MODE.WP)
|
||||
fwp.write_str("truncated + new\n")
|
||||
fwp.seek(0, SEEK_SET)
|
||||
n = fwp.read_all(buf, 256)
|
||||
print("[wp] WP (truncate+read):")
|
||||
print(buf)
|
||||
fwp.close()
|
||||
|
||||
fap: File = File("rw_test.txt", MODE.AP)
|
||||
fap.write_str("a+ appended\n")
|
||||
fap.seek(0, SEEK_SET)
|
||||
n = fap.read_all(buf, 256)
|
||||
print("[ap] AP (append+read):")
|
||||
print(buf)
|
||||
fap.close()
|
||||
|
||||
w32.win32file.DeleteFileA("rw_test.txt")
|
||||
print("[rw] test file deleted")
|
||||
|
||||
print("=== OOP FileIO: wide char (u\"...\") ===")
|
||||
fileio_wide_test()
|
||||
|
||||
stdlib.free(buf)
|
||||
|
||||
|
||||
def fileio_wide_test():
|
||||
buf: bytes = stdlib.malloc(256)
|
||||
|
||||
fw: File = File("wide_test.txt", MODE.W)
|
||||
fw.write_str("wide char test\n")
|
||||
fw.close()
|
||||
|
||||
fw2: FileW = FileW(u"wide_test.txt", MODE.R)
|
||||
n: LONG = fw2.read_all(buf, 256)
|
||||
viperlib.snprintf(buf, 256, "[wide] read %d bytes", n)
|
||||
print(buf)
|
||||
fw2.close()
|
||||
|
||||
w32.win32file.DeleteFileA("wide_test.txt")
|
||||
print("[wide] test file deleted")
|
||||
|
||||
stdlib.free(buf)
|
||||
|
||||
print("=== OOP FileIO: Chinese filename & content (u\"...\" = WCHAR_T) ===")
|
||||
fileio_chinese_test()
|
||||
|
||||
|
||||
def fileio_chinese_test():
|
||||
buf: bytes = stdlib.malloc(512)
|
||||
bytes_written: ULONG = 0
|
||||
|
||||
# === T1: Chinese filename (WCHAR_T) + ANSI content ===
|
||||
print("[chinese] T1: Chinese filename + ANSI content")
|
||||
fw: FileW = FileW(u"中文文件.txt", MODE.W)
|
||||
if fw.closed:
|
||||
print("[chinese] T1: create failed")
|
||||
else:
|
||||
fw.write_str("Hello from Chinese filename!\n")
|
||||
fw.close()
|
||||
|
||||
fr: FileW = FileW(u"中文文件.txt", MODE.R)
|
||||
n: LONG = fr.read_all(buf, 512)
|
||||
viperlib.snprintf(buf, 256, "[chinese] T1: read %d bytes", n)
|
||||
print(buf)
|
||||
print("[chinese] T1 content:")
|
||||
print(buf)
|
||||
fr.close()
|
||||
|
||||
w32.win32file.DeleteFileW(u"中文文件.txt")
|
||||
print("[chinese] T1: deleted")
|
||||
|
||||
# === T2: Chinese filename + Chinese wide content (WCHAR_T) ===
|
||||
print("[chinese] T2: Chinese filename + Chinese wide content")
|
||||
fw2: FileW = FileW(u"中文内容.txt", MODE.W)
|
||||
if fw2.closed:
|
||||
print("[chinese] T2: create failed")
|
||||
else:
|
||||
# u"你好世界\n" = 5 WCHARs = 10 bytes (UTF-16LE)
|
||||
w32.win32file.WriteFile(fw2.handle, u"你好世界\n", 10, c.Addr(bytes_written), None)
|
||||
viperlib.snprintf(buf, 256, "[chinese] T2: wrote %d WCHAR bytes", bytes_written)
|
||||
print(buf)
|
||||
fw2.close()
|
||||
|
||||
fr2: FileW = FileW(u"中文内容.txt", MODE.R)
|
||||
n = fr2.read_all(buf, 512)
|
||||
viperlib.snprintf(buf, 256, "[chinese] T2: read %d bytes (UTF-16LE)", n)
|
||||
print(buf)
|
||||
fr2.close()
|
||||
|
||||
w32.win32file.DeleteFileW(u"中文内容.txt")
|
||||
print("[chinese] T2: deleted")
|
||||
|
||||
# === T3: Chinese filename + mixed ANSI + wide content ===
|
||||
print("[chinese] T3: Chinese filename + mixed content")
|
||||
fw3: FileW = FileW(u"混合测试.txt", MODE.WP)
|
||||
if fw3.closed:
|
||||
print("[chinese] T3: create failed")
|
||||
else:
|
||||
fw3.write_str("ASCII line\n")
|
||||
# u"中文行\n" = 4 WCHARs = 8 bytes (UTF-16LE)
|
||||
w32.win32file.WriteFile(fw3.handle, u"中文行\n", 8, c.Addr(bytes_written), None)
|
||||
fw3.seek(0, SEEK_SET)
|
||||
n: LONG = fw3.read_all(buf, 512)
|
||||
viperlib.snprintf(buf, 256, "[chinese] T3: total %d bytes", n)
|
||||
print(buf)
|
||||
fw3.close()
|
||||
|
||||
w32.win32file.DeleteFileW(u"混合测试.txt")
|
||||
print("[chinese] T3: deleted")
|
||||
|
||||
# === T4: Chinese filename + Chinese content via WriteConsoleW ===
|
||||
print("[chinese] T4: Write wide content and print via WriteConsoleW")
|
||||
fw4: FileW = FileW(u"控制台测试.txt", MODE.W)
|
||||
if fw4.closed:
|
||||
print("[chinese] T4: create failed")
|
||||
else:
|
||||
# u"你好,世界!\n" = 7 WCHARs = 14 bytes (UTF-16LE)
|
||||
w32.win32file.WriteFile(fw4.handle, u"你好,世界!\n", 14, c.Addr(bytes_written), None)
|
||||
viperlib.snprintf(buf, 256, "[chinese] T4: wrote %d WCHAR bytes", bytes_written)
|
||||
print(buf)
|
||||
fw4.close()
|
||||
|
||||
fr4: FileW = FileW(u"控制台测试.txt", MODE.R)
|
||||
n = fr4.read_all(buf, 512)
|
||||
viperlib.snprintf(buf, 256, "[chinese] T4: read %d bytes", n)
|
||||
print(buf)
|
||||
# Print wide content to console using WriteConsoleW
|
||||
chars_written: ULONG = 0
|
||||
hOut: w32.win32base.HANDLE = w32.win32file.GetStdHandle(w32.win32file.STD_OUTPUT_HANDLE)
|
||||
w32.win32console.WriteConsoleW(hOut, u"你好,世界!\n", 7, c.Addr(chars_written), None)
|
||||
fr4.close()
|
||||
|
||||
w32.win32file.DeleteFileW(u"控制台测试.txt")
|
||||
print("[chinese] T4: deleted")
|
||||
|
||||
stdlib.free(buf)
|
||||
519
Test/TestProject3/App/main.py
Normal file
519
Test/TestProject3/App/main.py
Normal file
@@ -0,0 +1,519 @@
|
||||
from stdint import *
|
||||
import w32.win32console
|
||||
import t, c
|
||||
from t import CInt, CPtr, CChar, CInt32T, CUInt64T, CFloat64T, CExport, State
|
||||
import viperlib
|
||||
import stdlib
|
||||
import definetest
|
||||
import enumtest
|
||||
import mpooltest
|
||||
import vectortest
|
||||
import fileiotest
|
||||
import testcheck
|
||||
|
||||
|
||||
# === 函数泛型 ===
|
||||
|
||||
def add[T](a: T, b: T) -> T:
|
||||
return a + b
|
||||
|
||||
def add_u64[T](a: T, b: T, c: CUInt64T) -> T:
|
||||
return a + b + T(c)
|
||||
|
||||
def fxi[T1, T2](a: T1, b: T2) -> T1:
|
||||
return a + fxi2(a, b, CUInt64T(178900))
|
||||
|
||||
def fxi2[T1, T2, T3](a: T1, b: T2, c: T3) -> T1:
|
||||
return a + T1(b) + T1(c)
|
||||
|
||||
def wrap_add[T](a: T, b: T) -> T:
|
||||
return add(a, b)
|
||||
|
||||
def double_add[T](a: T, b: T) -> T:
|
||||
return add(a, b) + add(a, b)
|
||||
|
||||
|
||||
# === 结构体泛型 ===
|
||||
|
||||
class A[T]():
|
||||
def __init__(self, a: T):
|
||||
self.a = T(a)
|
||||
def get_a(self) -> T:
|
||||
return self.a
|
||||
|
||||
class Pair[T1, T2]():
|
||||
def __init__(self, first: T1, second: T2):
|
||||
self.first = T1(first)
|
||||
self.second = T2(second)
|
||||
def get_first(self) -> T1:
|
||||
return self.first
|
||||
def get_second(self) -> T2:
|
||||
return self.second
|
||||
|
||||
class Calculator[T]():
|
||||
def __init__(self, init_val: T):
|
||||
self.val = T(init_val)
|
||||
def compute(self, other: T) -> T:
|
||||
return add(self.val, other)
|
||||
def double_compute(self, other: T) -> T:
|
||||
return double_add(self.val, other)
|
||||
|
||||
class Container[T]():
|
||||
def __init__(self, v: T):
|
||||
self.value = T(v)
|
||||
self.flag = CInt32T(1)
|
||||
def get_value(self) -> T:
|
||||
return self.value
|
||||
def get_flag(self) -> CInt32T:
|
||||
return self.flag
|
||||
|
||||
|
||||
# === OOP 继承 + 虚方法(Gargantua 风格) ===
|
||||
|
||||
@t.CVTable
|
||||
class Shape:
|
||||
def __init__(self, x: CFloat64T, y: CFloat64T):
|
||||
self.x = x
|
||||
self.y = y
|
||||
def area(self) -> CFloat64T:
|
||||
return 0.0
|
||||
def perimeter(self) -> CFloat64T:
|
||||
return 0.0
|
||||
def describe(self) -> CFloat64T:
|
||||
return self.area() + self.perimeter()
|
||||
|
||||
@t.CVTable
|
||||
class Circle(Shape):
|
||||
def __init__(self, x: CFloat64T, y: CFloat64T, r: CFloat64T):
|
||||
self.x = x
|
||||
self.y = y
|
||||
self.r = r
|
||||
def area(self) -> CFloat64T:
|
||||
return 3.14159265 * self.r * self.r
|
||||
def perimeter(self) -> CFloat64T:
|
||||
return 2.0 * 3.14159265 * self.r
|
||||
def scale(self, factor: CFloat64T) -> 'Circle' | CPtr:
|
||||
self.r = self.r * factor
|
||||
return t.CVoid(c.Addr(self), CPtr)
|
||||
def move(self, dx: CFloat64T, dy: CFloat64T) -> 'Circle' | CPtr:
|
||||
self.x = self.x + dx
|
||||
self.y = self.y + dy
|
||||
return t.CVoid(c.Addr(self), CPtr)
|
||||
|
||||
@t.CVTable
|
||||
class Rect(Shape):
|
||||
def __init__(self, x: CFloat64T, y: CFloat64T, w: CFloat64T, h: CFloat64T):
|
||||
self.x = x
|
||||
self.y = y
|
||||
self.w = w
|
||||
self.h = h
|
||||
def area(self) -> CFloat64T:
|
||||
return self.w * self.h
|
||||
def perimeter(self) -> CFloat64T:
|
||||
return 2.0 * (self.w + self.h)
|
||||
def scale(self, factor: CFloat64T) -> 'Rect' | CPtr:
|
||||
self.w = self.w * factor
|
||||
self.h = self.h * factor
|
||||
return t.CVoid(c.Addr(self), CPtr)
|
||||
|
||||
|
||||
# === 运算符重载 + 链式调用(Gargantua V3 风格,堆分配) ===
|
||||
|
||||
class Vec2:
|
||||
x: CFloat64T
|
||||
y: CFloat64T
|
||||
|
||||
def __new__() -> 'Vec2' | CPtr:
|
||||
return t.CVoid(t.CUInt64T(stdlib.malloc(16)), CPtr)
|
||||
|
||||
def __init__(self, x: CFloat64T, y: CFloat64T):
|
||||
self.x = x
|
||||
self.y = y
|
||||
|
||||
def __add__(self, b: 'Vec2' | CPtr) -> 'Vec2' | CPtr:
|
||||
return Vec2(self.x + b.x, self.y + b.y)
|
||||
|
||||
def __sub__(self, b: 'Vec2' | CPtr) -> 'Vec2' | CPtr:
|
||||
return Vec2(self.x - b.x, self.y - b.y)
|
||||
|
||||
def __mul__(self, s: CFloat64T) -> 'Vec2' | CPtr:
|
||||
return Vec2(self.x * s, self.y * s)
|
||||
|
||||
def __neg__(self) -> 'Vec2' | CPtr:
|
||||
return Vec2(-self.x, -self.y)
|
||||
|
||||
def dot(self, b: 'Vec2' | CPtr) -> CFloat64T:
|
||||
return self.x * b.x + self.y * b.y
|
||||
|
||||
def len_sq(self) -> CFloat64T:
|
||||
return self.x * self.x + self.y * self.y
|
||||
|
||||
|
||||
class Vec3:
|
||||
x: CFloat64T
|
||||
y: CFloat64T
|
||||
z: CFloat64T
|
||||
|
||||
def __new__() -> 'Vec3' | CPtr:
|
||||
return t.CVoid(t.CUInt64T(stdlib.malloc(24)), CPtr)
|
||||
|
||||
def __init__(self, x: CFloat64T, y: CFloat64T, z: CFloat64T):
|
||||
self.x = x
|
||||
self.y = y
|
||||
self.z = z
|
||||
|
||||
def __add__(self, b: 'Vec3' | CPtr) -> 'Vec3' | CPtr:
|
||||
return Vec3(self.x + b.x, self.y + b.y, self.z + b.z)
|
||||
|
||||
def __sub__(self, b: 'Vec3' | CPtr) -> 'Vec3' | CPtr:
|
||||
return Vec3(self.x - b.x, self.y - b.y, self.z - b.z)
|
||||
|
||||
def __mul__(self, s: CFloat64T) -> 'Vec3' | CPtr:
|
||||
return Vec3(self.x * s, self.y * s, self.z * s)
|
||||
|
||||
def __neg__(self) -> 'Vec3' | CPtr:
|
||||
return Vec3(-self.x, -self.y, -self.z)
|
||||
|
||||
def dot(self, b: 'Vec3' | CPtr) -> CFloat64T:
|
||||
return self.x * b.x + self.y * b.y + self.z * b.z
|
||||
|
||||
def cross(self, b: 'Vec3' | CPtr) -> 'Vec3' | CPtr:
|
||||
return Vec3(self.y * b.z - self.z * b.y,
|
||||
self.z * b.x - self.x * b.z,
|
||||
self.x * b.y - self.y * b.x)
|
||||
|
||||
def len_sq(self) -> CFloat64T:
|
||||
return self.dot(self)
|
||||
|
||||
|
||||
# === 独立类(非继承,避免链接问题) ===
|
||||
|
||||
@t.CVTable
|
||||
class Dog:
|
||||
def __init__(self, name_val: CInt, bark_power: CInt32T):
|
||||
self.name_val = name_val
|
||||
self.health = CInt32T(100)
|
||||
self.bark_power = bark_power
|
||||
def speak(self) -> CInt:
|
||||
return 1
|
||||
def bite(self) -> CInt32T:
|
||||
return self.bark_power
|
||||
def take_damage(self, dmg: CInt32T) -> 'Dog' | CPtr:
|
||||
self.health = self.health - dmg
|
||||
return t.CVoid(c.Addr(self), CPtr)
|
||||
def is_alive(self) -> CInt:
|
||||
if self.health > 0:
|
||||
return 1
|
||||
return 0
|
||||
|
||||
@t.CVTable
|
||||
class Cat:
|
||||
def __init__(self, name_val: CInt, lives: CInt32T):
|
||||
self.name_val = name_val
|
||||
self.health = CInt32T(80)
|
||||
self.lives = lives
|
||||
def speak(self) -> CInt:
|
||||
return 2
|
||||
def scratch(self) -> CInt32T:
|
||||
return CInt32T(15)
|
||||
def take_damage(self, dmg: CInt32T) -> 'Cat' | CPtr:
|
||||
self.health = self.health - dmg
|
||||
return t.CVoid(c.Addr(self), CPtr)
|
||||
def is_alive(self) -> CInt:
|
||||
if self.health > 0:
|
||||
return 1
|
||||
return 0
|
||||
|
||||
|
||||
# === 嵌套对象组合(堆分配) ===
|
||||
|
||||
class Transform:
|
||||
px: CFloat64T
|
||||
py: CFloat64T
|
||||
pz: CFloat64T
|
||||
scale_x: CFloat64T
|
||||
scale_y: CFloat64T
|
||||
scale_z: CFloat64T
|
||||
|
||||
def __new__() -> 'Transform' | CPtr:
|
||||
return t.CVoid(t.CUInt64T(stdlib.malloc(48)), CPtr)
|
||||
|
||||
def __init__(self, px: CFloat64T, py: CFloat64T, pz: CFloat64T):
|
||||
self.px = px
|
||||
self.py = py
|
||||
self.pz = pz
|
||||
self.scale_x = 1.0
|
||||
self.scale_y = 1.0
|
||||
self.scale_z = 1.0
|
||||
|
||||
def apply_scale(self, sx: CFloat64T, sy: CFloat64T, sz: CFloat64T) -> 'Transform' | CPtr:
|
||||
self.scale_x = self.scale_x * sx
|
||||
self.scale_y = self.scale_y * sy
|
||||
self.scale_z = self.scale_z * sz
|
||||
return t.CVoid(c.Addr(self), CPtr)
|
||||
|
||||
def world_position(self) -> 'Vec3' | CPtr:
|
||||
return Vec3(self.px * self.scale_x, self.py * self.scale_y, self.pz * self.scale_z)
|
||||
|
||||
|
||||
# === 多层继承(子类只重写需要的方法) ===
|
||||
|
||||
@t.CVTable
|
||||
class Vehicle:
|
||||
def __init__(self, speed: CInt32T):
|
||||
self.speed = speed
|
||||
self.fuel = CInt32T(100)
|
||||
def move(self) -> CInt:
|
||||
self.fuel = self.fuel - CInt32T(10)
|
||||
return self.speed
|
||||
def is_running(self) -> CInt:
|
||||
if self.fuel > 0:
|
||||
return 1
|
||||
return 0
|
||||
|
||||
@t.CVTable
|
||||
class Car(Vehicle):
|
||||
def __init__(self, speed: CInt32T, doors: CInt32T):
|
||||
self.speed = speed
|
||||
self.fuel = CInt32T(100)
|
||||
self.doors = doors
|
||||
def honk(self) -> CInt:
|
||||
return 1
|
||||
|
||||
@t.CVTable
|
||||
class ElectricCar(Car):
|
||||
def __init__(self, speed: CInt32T, doors: CInt32T, battery: CInt32T):
|
||||
self.speed = speed
|
||||
self.fuel = CInt32T(100)
|
||||
self.doors = doors
|
||||
self.battery = battery
|
||||
def charge(self):
|
||||
self.battery = self.battery + CInt32T(20)
|
||||
def move(self) -> CInt:
|
||||
self.battery = self.battery - CInt32T(5)
|
||||
return self.speed
|
||||
|
||||
|
||||
def main() -> CInt | CExport:
|
||||
w32.win32console.SetConsoleCP(65001)
|
||||
w32.win32console.SetConsoleOutputCP(65001)
|
||||
|
||||
testcheck.begin("TestProject3: 泛型与OOP综合测试")
|
||||
|
||||
buf: CChar | CPtr = CPtr(stdlib.malloc(256))
|
||||
|
||||
# === 基础函数泛型 ===
|
||||
testcheck.section("基础函数泛型")
|
||||
print(add(3, 5))
|
||||
print(add(1.5, 2.5))
|
||||
print(add_u64(1, 2, CUInt64T(3000000000000000)))
|
||||
print(fxi(0.2, 6))
|
||||
print(wrap_add(10, 20))
|
||||
print(double_add(5, 7))
|
||||
testcheck.ok("基础函数泛型测试完成")
|
||||
|
||||
# === 基础结构体泛型 ===
|
||||
testcheck.section("基础结构体泛型")
|
||||
a = A(100)
|
||||
print(a.get_a())
|
||||
p1 = Pair(10, 20)
|
||||
print(p1.get_first())
|
||||
print(p1.get_second())
|
||||
testcheck.ok("基础结构体泛型测试完成")
|
||||
|
||||
# === OOP 继承测试 ===
|
||||
testcheck.section("OOP 继承测试")
|
||||
c1 = Circle(0.0, 0.0, 5.0)
|
||||
viperlib.snprintf(buf, 256, "Circle area=%.2f perim=%.2f", c1.area(), c1.perimeter())
|
||||
print(buf)
|
||||
|
||||
r1 = Rect(0.0, 0.0, 4.0, 3.0)
|
||||
viperlib.snprintf(buf, 256, "Rect area=%.2f perim=%.2f", r1.area(), r1.perimeter())
|
||||
print(buf)
|
||||
|
||||
# 链式调用: scale -> move
|
||||
c2 = Circle(1.0, 2.0, 3.0)
|
||||
c2.scale(2.0).move(10.0, 20.0)
|
||||
viperlib.snprintf(buf, 256, "Circle after scale+move: x=%.1f y=%.1f r=%.1f area=%.2f",
|
||||
c2.x, c2.y, c2.r, c2.area())
|
||||
print(buf)
|
||||
|
||||
r2 = Rect(0.0, 0.0, 10.0, 5.0)
|
||||
r2.scale(2.0).scale(0.5)
|
||||
viperlib.snprintf(buf, 256, "Rect after double scale: w=%.1f h=%.1f area=%.2f",
|
||||
r2.w, r2.h, r2.area())
|
||||
print(buf)
|
||||
testcheck.ok("OOP 继承测试完成")
|
||||
|
||||
# === Vec2 运算符重载 + 链式调用(堆分配) ===
|
||||
testcheck.section("Vec2 运算符重载 + 链式调用")
|
||||
v1 = Vec2(3.0, 4.0)
|
||||
v2 = Vec2(1.0, 2.0)
|
||||
v3 = v1 + v2
|
||||
viperlib.snprintf(buf, 256, "Vec2 add: (%.1f, %.1f)", v3.x, v3.y)
|
||||
print(buf)
|
||||
|
||||
v4 = v1 - v2
|
||||
viperlib.snprintf(buf, 256, "Vec2 sub: (%.1f, %.1f)", v4.x, v4.y)
|
||||
print(buf)
|
||||
|
||||
v5 = v1 * 2.0
|
||||
viperlib.snprintf(buf, 256, "Vec2 mul: (%.1f, %.1f)", v5.x, v5.y)
|
||||
print(buf)
|
||||
|
||||
v6 = -v1
|
||||
viperlib.snprintf(buf, 256, "Vec2 neg: (%.1f, %.1f)", v6.x, v6.y)
|
||||
print(buf)
|
||||
|
||||
d = v1.dot(v2)
|
||||
viperlib.snprintf(buf, 256, "Vec2 dot: %.1f", d)
|
||||
print(buf)
|
||||
|
||||
# 链式运算: (v1 + v2) * 3.0
|
||||
v_chain = (v1 + v2) * 3.0
|
||||
viperlib.snprintf(buf, 256, "Vec2 chain (v1+v2)*3: (%.1f, %.1f)", v_chain.x, v_chain.y)
|
||||
print(buf)
|
||||
testcheck.ok("Vec2 运算符重载测试完成")
|
||||
|
||||
# === Vec3 运算符重载 + 链式调用(堆分配) ===
|
||||
testcheck.section("Vec3 运算符重载 + 链式调用")
|
||||
a1 = Vec3(1.0, 0.0, 0.0)
|
||||
a2 = Vec3(0.0, 1.0, 0.0)
|
||||
cross_v = a1.cross(a2)
|
||||
viperlib.snprintf(buf, 256, "Vec3 cross: (%.1f, %.1f, %.1f)", cross_v.x, cross_v.y, cross_v.z)
|
||||
print(buf)
|
||||
|
||||
dot_v = a1.dot(a2)
|
||||
viperlib.snprintf(buf, 256, "Vec3 dot: %.1f", dot_v)
|
||||
print(buf)
|
||||
|
||||
# 链式: (a + b).dot(c)
|
||||
a3 = Vec3(1.0, 2.0, 3.0)
|
||||
a4 = Vec3(4.0, 5.0, 6.0)
|
||||
a5 = Vec3(7.0, 8.0, 9.0)
|
||||
chain_dot = (a3 + a4).dot(a5)
|
||||
viperlib.snprintf(buf, 256, "Vec3 chain dot: %.1f", chain_dot)
|
||||
print(buf)
|
||||
|
||||
# 链式: (a * 2.0 - b).cross(c)
|
||||
chain_cross = (a3 * 2.0 - a4).cross(a5)
|
||||
viperlib.snprintf(buf, 256, "Vec3 chain cross: (%.1f, %.1f, %.1f)", chain_cross.x, chain_cross.y, chain_cross.z)
|
||||
print(buf)
|
||||
|
||||
# len_sq 链式
|
||||
lsq = a3.len_sq()
|
||||
viperlib.snprintf(buf, 256, "Vec3 len_sq: %.1f", lsq)
|
||||
print(buf)
|
||||
testcheck.ok("Vec3 运算符重载测试完成")
|
||||
|
||||
# === Dog/Cat 虚方法 ===
|
||||
testcheck.section("Dog/Cat 虚方法")
|
||||
dog = Dog(1, CInt32T(30))
|
||||
cat = Cat(2, CInt32T(9))
|
||||
|
||||
viperlib.snprintf(buf, 256, "Dog speak=%d bite=%d alive=%d", dog.speak(), dog.bite(), dog.is_alive())
|
||||
print(buf)
|
||||
viperlib.snprintf(buf, 256, "Cat speak=%d scratch=%d alive=%d", cat.speak(), cat.scratch(), cat.is_alive())
|
||||
print(buf)
|
||||
|
||||
dog.take_damage(CInt32T(40)).take_damage(CInt32T(30))
|
||||
viperlib.snprintf(buf, 256, "Dog after 70dmg: health=%d alive=%d", dog.health, dog.is_alive())
|
||||
print(buf)
|
||||
|
||||
cat.take_damage(CInt32T(50))
|
||||
viperlib.snprintf(buf, 256, "Cat after 50dmg: health=%d alive=%d", cat.health, cat.is_alive())
|
||||
print(buf)
|
||||
testcheck.ok("Dog/Cat 虚方法测试完成")
|
||||
|
||||
# === Transform 嵌套组合(堆分配,链式调用) ===
|
||||
testcheck.section("Transform 嵌套组合")
|
||||
tr = Transform(10.0, 20.0, 30.0)
|
||||
tr.apply_scale(2.0, 3.0, 4.0)
|
||||
pos = tr.world_position()
|
||||
viperlib.snprintf(buf, 256, "Transform pos: (%.1f, %.1f, %.1f)", pos.x, pos.y, pos.z)
|
||||
print(buf)
|
||||
|
||||
tr2 = Transform(5.0, 10.0, 15.0)
|
||||
tr2.apply_scale(2.0, 2.0, 2.0)
|
||||
pos2 = tr2.world_position()
|
||||
viperlib.snprintf(buf, 256, "Transform2 pos: (%.1f, %.1f, %.1f)", pos2.x, pos2.y, pos2.z)
|
||||
print(buf)
|
||||
testcheck.ok("Transform 嵌套组合测试完成")
|
||||
|
||||
# === 多层继承 ===
|
||||
testcheck.section("多层继承")
|
||||
ec = ElectricCar(CInt32T(120), CInt32T(4), CInt32T(80))
|
||||
viperlib.snprintf(buf, 256, "ECar speed=%d doors=%d battery=%d", ec.speed, ec.doors, ec.battery)
|
||||
print(buf)
|
||||
ec.charge()
|
||||
viperlib.snprintf(buf, 256, "ECar after charge: battery=%d", ec.battery)
|
||||
print(buf)
|
||||
spd = ec.move()
|
||||
viperlib.snprintf(buf, 256, "ECar move: speed=%d battery=%d", spd, ec.battery)
|
||||
print(buf)
|
||||
viperlib.snprintf(buf, 256, "ECar honk=%d running=%d", ec.honk(), ec.is_running())
|
||||
print(buf)
|
||||
testcheck.ok("多层继承测试完成")
|
||||
|
||||
# === 泛型 + OOP 组合 ===
|
||||
testcheck.section("泛型 + OOP 组合")
|
||||
calc1 = Calculator(10)
|
||||
print(calc1.compute(5))
|
||||
calc2 = Calculator(1.5)
|
||||
print(calc2.compute(2.5))
|
||||
|
||||
c1_gen = Container(42)
|
||||
print(c1_gen.get_value())
|
||||
print(c1_gen.get_flag())
|
||||
testcheck.ok("泛型 + OOP 组合测试完成")
|
||||
|
||||
# === snprintf 格式化 ===
|
||||
testcheck.section("snprintf 格式化")
|
||||
viperlib.snprintf(buf, 256, "int=%d, float=%.2f", 42, 3.14)
|
||||
print(buf)
|
||||
viperlib.snprintf(buf, 256, "result=%d", add(100, 200))
|
||||
print(buf)
|
||||
testcheck.ok("snprintf 格式化测试完成")
|
||||
|
||||
# === 新语法类型强转 (t1|t2)(x) ===
|
||||
testcheck.section("新语法类型强转 (t1|t2)(x)")
|
||||
val_i64: CUInt64T = CUInt64T(42)
|
||||
val_i32 = (t.CInt)(val_i64)
|
||||
print(val_i32)
|
||||
|
||||
ptr_raw = stdlib.malloc(8)
|
||||
ptr_typed = (t.CInt | t.CPtr)(ptr_raw)
|
||||
viperlib.snprintf(buf, 256, "cast ptr=%p", ptr_typed)
|
||||
print(buf)
|
||||
|
||||
val_f = (t.CDouble)(42)
|
||||
viperlib.snprintf(buf, 256, "cast float=%.1f", val_f)
|
||||
print(buf)
|
||||
testcheck.ok("新语法类型强转测试完成")
|
||||
|
||||
# === CDefine 宏测试 ===
|
||||
testcheck.section("CDefine 宏测试")
|
||||
definetest.define_main()
|
||||
testcheck.ok("CDefine 宏测试完成")
|
||||
|
||||
# === Enum 测试 ===
|
||||
testcheck.section("Enum 测试")
|
||||
enumtest.enum_main()
|
||||
testcheck.ok("Enum 测试完成")
|
||||
|
||||
# === MPool OOP 测试 ===
|
||||
testcheck.section("MPool OOP 测试")
|
||||
mpooltest.mpool_main()
|
||||
testcheck.ok("MPool OOP 测试完成")
|
||||
|
||||
# === Vector 泛型测试 ===
|
||||
testcheck.section("Vector 泛型测试")
|
||||
vectortest.vector_main()
|
||||
testcheck.ok("Vector 泛型测试完成")
|
||||
|
||||
# === Win32 FileIO 测试 ===
|
||||
testcheck.section("Win32 FileIO 测试")
|
||||
fileiotest.fileio_main()
|
||||
testcheck.ok("Win32 FileIO 测试完成")
|
||||
|
||||
return testcheck.end()
|
||||
91
Test/TestProject3/App/mpooltest.py
Normal file
91
Test/TestProject3/App/mpooltest.py
Normal file
@@ -0,0 +1,91 @@
|
||||
import t, c
|
||||
from t import CInt, CPtr, CChar
|
||||
import viperlib
|
||||
import viperio
|
||||
import stdlib
|
||||
import memhub
|
||||
|
||||
|
||||
def mpool_main() -> CInt:
|
||||
buf: bytes = stdlib.malloc(256)
|
||||
|
||||
arena: bytes = stdlib.malloc(4096)
|
||||
with memhub.MemPool(arena, 4096) as pool:
|
||||
p1: bytes = pool.alloc(32)
|
||||
p2: bytes = pool.alloc(64)
|
||||
p3: bytes = pool.alloc(128)
|
||||
if p1 != None and p2 != None and p3 != None:
|
||||
viperlib.snprintf(buf, 256, "MPool bump: 3 allocs OK")
|
||||
print(buf)
|
||||
else:
|
||||
viperlib.snprintf(buf, 256, "MPool bump: alloc FAILED")
|
||||
print(buf)
|
||||
|
||||
pool.reset()
|
||||
p4: bytes = pool.alloc(256)
|
||||
if p4 != None:
|
||||
viperlib.snprintf(buf, 256, "MPool bump: reset+alloc OK")
|
||||
print(buf)
|
||||
else:
|
||||
viperlib.snprintf(buf, 256, "MPool bump: reset+alloc FAILED")
|
||||
print(buf)
|
||||
|
||||
stdlib.free(arena)
|
||||
|
||||
arena2: bytes = stdlib.malloc(4096)
|
||||
with memhub.MemSlab(arena2, 4096, 64) as spool:
|
||||
b1: bytes = spool.alloc(64)
|
||||
b2: bytes = spool.alloc(64)
|
||||
b3: bytes = spool.alloc(64)
|
||||
if b1 != None and b2 != None and b3 != None:
|
||||
viperlib.snprintf(buf, 256, "MPool slab: 3 allocs OK")
|
||||
print(buf)
|
||||
else:
|
||||
viperlib.snprintf(buf, 256, "MPool slab: alloc FAILED")
|
||||
print(buf)
|
||||
|
||||
spool.free(b2)
|
||||
b4: bytes = spool.alloc(64)
|
||||
if b4 != None:
|
||||
viperlib.snprintf(buf, 256, "MPool slab: free+realloc OK")
|
||||
print(buf)
|
||||
else:
|
||||
viperlib.snprintf(buf, 256, "MPool slab: free+realloc FAILED")
|
||||
print(buf)
|
||||
|
||||
stdlib.free(arena2)
|
||||
|
||||
arena3: bytes = stdlib.malloc(4096)
|
||||
hpool: memhub.MemPool | CPtr = memhub.MemPool(arena3, 4096)
|
||||
h1: bytes = hpool.alloc(32)
|
||||
h2: bytes = hpool.alloc(64)
|
||||
if h1 != None and h2 != None:
|
||||
viperlib.snprintf(buf, 256, "MPool manual: 2 allocs OK")
|
||||
print(buf)
|
||||
else:
|
||||
viperlib.snprintf(buf, 256, "MPool manual: alloc FAILED")
|
||||
print(buf)
|
||||
hpool.reset()
|
||||
h3: bytes = hpool.alloc(128)
|
||||
if h3 != None:
|
||||
viperlib.snprintf(buf, 256, "MPool manual: reset+alloc OK")
|
||||
print(buf)
|
||||
else:
|
||||
viperlib.snprintf(buf, 256, "MPool manual: reset+alloc FAILED")
|
||||
print(buf)
|
||||
|
||||
stdlib.free(arena3)
|
||||
|
||||
arena4: bytes = stdlib.malloc(4096)
|
||||
with memhub.MemPool(arena4, 4096) as bpool:
|
||||
wb: viperio.Buf | CPtr = bpool.alloc_buf(128)
|
||||
if wb.data != None:
|
||||
viperlib.snprintf(wb.cstr(), 128, "MPool alloc_buf: hello from Buf!")
|
||||
print(wb.cstr())
|
||||
else:
|
||||
viperlib.snprintf(buf, 256, "MPool alloc_buf: FAILED")
|
||||
print(buf)
|
||||
|
||||
stdlib.free(arena4)
|
||||
stdlib.free(buf)
|
||||
return 0
|
||||
43
Test/TestProject3/App/vectortest.py
Normal file
43
Test/TestProject3/App/vectortest.py
Normal file
@@ -0,0 +1,43 @@
|
||||
import t, c
|
||||
from t import CInt, CPtr, CChar, CFloat64T
|
||||
import viperlib
|
||||
import stdlib
|
||||
import vector
|
||||
import memhub
|
||||
|
||||
POOL_SIZE: t.CDefine = 4096
|
||||
|
||||
def vector_main() -> CInt:
|
||||
buf: str = stdlib.malloc(256)
|
||||
pool_mem: t.CVoid | t.CPtr = stdlib.malloc(POOL_SIZE)
|
||||
pool: memhub.MemPool | CPtr = memhub.MemPool(pool_mem, POOL_SIZE)
|
||||
|
||||
vi: vector.Vector | CPtr = vector.Vector(pool, 10, CInt(0))
|
||||
vi.push(CInt(10))
|
||||
vi.push(CInt(20))
|
||||
vi.push(CInt(30))
|
||||
viperlib.snprintf(buf, 256, "Vector[int]: len=%d, [0]=%d, [1]=%d, [2]=%d", vi.len(), vi.get(0), vi.get(1), vi.get(2))
|
||||
print(buf)
|
||||
|
||||
vi.set(1, CInt(99))
|
||||
viperlib.snprintf(buf, 256, "Vector[int]: set[1]=99, [1]=%d", vi.get(1))
|
||||
print(buf)
|
||||
|
||||
vi.clear()
|
||||
viperlib.snprintf(buf, 256, "Vector[int]: cleared, len=%d", vi.len())
|
||||
print(buf)
|
||||
|
||||
vi.free()
|
||||
|
||||
vd: vector.Vector | CPtr = vector.Vector(pool, 8, CFloat64T(0.0))
|
||||
vd.push(CFloat64T(1.5))
|
||||
vd.push(CFloat64T(2.7))
|
||||
vd.push(CFloat64T(3.14))
|
||||
viperlib.snprintf(buf, 256, "Vector[double]: len=%d, [0]=%.1f, [1]=%.1f, [2]=%.2f", vd.len(), vd.get(0), vd.get(1), vd.get(2))
|
||||
print(buf)
|
||||
|
||||
vd.free()
|
||||
|
||||
stdlib.free(pool_mem)
|
||||
stdlib.free(buf)
|
||||
return 0
|
||||
1
Test/TestProject3/output/1b58766d38d05de3.deps.json
Normal file
1
Test/TestProject3/output/1b58766d38d05de3.deps.json
Normal file
@@ -0,0 +1 @@
|
||||
{"mpooltest": "0019c939aae7f9f1", "w32.fileio": "0035c95a18d4f8e8", "fileio": "0035c95a18d4f8e8", "atom": "271ea3decb810db2", "definetest": "64ac83614c9bdbc6", "stdio": "6f62fe05c5ea1ceb", "stdarg": "71e0a3ffcb3ebfad", "w32.win32base": "7e529fe7a078cfef", "win32base": "7e529fe7a078cfef", "stdlib": "90c53dd6db8d41cf", "platmacro": "93c1d18e35d188d6", "string": "ab6e54ba9a669f76", "main": "b235d6477436c524", "vectortest": "b777c587cc21465a", "w32.win32console": "bbdf3bbd4c3bc28c", "win32console": "bbdf3bbd4c3bc28c", "vector": "bf9813f6e3c9d351", "fileiotest": "c01b27dbcd683245", "viperlib": "c3b259b4059f8668", "viperio": "c9f4be41ca1cc2b4", "testcheck": "dd3002730623424b", "memhub": "ee084e9fc6ee413a", "stdint": "f5522571bcce7bcb", "w32.win32file": "f6b51804a0ba8ff0", "win32file": "f6b51804a0ba8ff0"}
|
||||
1
Test/TestProject3/output/64ac83614c9bdbc6.deps.json
Normal file
1
Test/TestProject3/output/64ac83614c9bdbc6.deps.json
Normal file
@@ -0,0 +1 @@
|
||||
{"mpooltest": "0019c939aae7f9f1", "w32.fileio": "0035c95a18d4f8e8", "fileio": "0035c95a18d4f8e8", "enumtest": "1b58766d38d05de3", "atom": "271ea3decb810db2", "stdio": "6f62fe05c5ea1ceb", "stdarg": "71e0a3ffcb3ebfad", "w32.win32base": "7e529fe7a078cfef", "win32base": "7e529fe7a078cfef", "stdlib": "90c53dd6db8d41cf", "platmacro": "93c1d18e35d188d6", "string": "ab6e54ba9a669f76", "main": "b235d6477436c524", "vectortest": "b777c587cc21465a", "w32.win32console": "bbdf3bbd4c3bc28c", "win32console": "bbdf3bbd4c3bc28c", "vector": "bf9813f6e3c9d351", "fileiotest": "c01b27dbcd683245", "viperlib": "c3b259b4059f8668", "viperio": "c9f4be41ca1cc2b4", "testcheck": "dd3002730623424b", "memhub": "ee084e9fc6ee413a", "stdint": "f5522571bcce7bcb", "w32.win32file": "f6b51804a0ba8ff0", "win32file": "f6b51804a0ba8ff0"}
|
||||
1
Test/TestProject3/output/b235d6477436c524.deps.json
Normal file
1
Test/TestProject3/output/b235d6477436c524.deps.json
Normal file
@@ -0,0 +1 @@
|
||||
{"mpooltest": "0019c939aae7f9f1", "w32.fileio": "0035c95a18d4f8e8", "fileio": "0035c95a18d4f8e8", "enumtest": "1b58766d38d05de3", "atom": "271ea3decb810db2", "definetest": "64ac83614c9bdbc6", "stdio": "6f62fe05c5ea1ceb", "stdarg": "71e0a3ffcb3ebfad", "w32.win32base": "7e529fe7a078cfef", "win32base": "7e529fe7a078cfef", "stdlib": "90c53dd6db8d41cf", "platmacro": "93c1d18e35d188d6", "string": "ab6e54ba9a669f76", "vectortest": "b777c587cc21465a", "w32.win32console": "bbdf3bbd4c3bc28c", "win32console": "bbdf3bbd4c3bc28c", "vector": "bf9813f6e3c9d351", "fileiotest": "c01b27dbcd683245", "viperlib": "c3b259b4059f8668", "viperio": "c9f4be41ca1cc2b4", "testcheck": "dd3002730623424b", "memhub": "ee084e9fc6ee413a", "stdint": "f5522571bcce7bcb", "w32.win32file": "f6b51804a0ba8ff0", "win32file": "f6b51804a0ba8ff0"}
|
||||
1
Test/TestProject3/output/b777c587cc21465a.deps.json
Normal file
1
Test/TestProject3/output/b777c587cc21465a.deps.json
Normal file
@@ -0,0 +1 @@
|
||||
{"mpooltest": "0019c939aae7f9f1", "w32.fileio": "0035c95a18d4f8e8", "fileio": "0035c95a18d4f8e8", "enumtest": "1b58766d38d05de3", "atom": "271ea3decb810db2", "definetest": "64ac83614c9bdbc6", "stdio": "6f62fe05c5ea1ceb", "stdarg": "71e0a3ffcb3ebfad", "w32.win32base": "7e529fe7a078cfef", "win32base": "7e529fe7a078cfef", "stdlib": "90c53dd6db8d41cf", "platmacro": "93c1d18e35d188d6", "string": "ab6e54ba9a669f76", "main": "b235d6477436c524", "w32.win32console": "bbdf3bbd4c3bc28c", "win32console": "bbdf3bbd4c3bc28c", "vector": "bf9813f6e3c9d351", "fileiotest": "c01b27dbcd683245", "viperlib": "c3b259b4059f8668", "viperio": "c9f4be41ca1cc2b4", "testcheck": "dd3002730623424b", "memhub": "ee084e9fc6ee413a", "stdint": "f5522571bcce7bcb", "w32.win32file": "f6b51804a0ba8ff0", "win32file": "f6b51804a0ba8ff0"}
|
||||
1
Test/TestProject3/output/c01b27dbcd683245.deps.json
Normal file
1
Test/TestProject3/output/c01b27dbcd683245.deps.json
Normal file
@@ -0,0 +1 @@
|
||||
{"mpooltest": "0019c939aae7f9f1", "w32.fileio": "0035c95a18d4f8e8", "fileio": "0035c95a18d4f8e8", "enumtest": "1b58766d38d05de3", "atom": "271ea3decb810db2", "definetest": "64ac83614c9bdbc6", "stdio": "6f62fe05c5ea1ceb", "stdarg": "71e0a3ffcb3ebfad", "w32.win32base": "7e529fe7a078cfef", "win32base": "7e529fe7a078cfef", "stdlib": "90c53dd6db8d41cf", "platmacro": "93c1d18e35d188d6", "string": "ab6e54ba9a669f76", "main": "b235d6477436c524", "vectortest": "b777c587cc21465a", "w32.win32console": "bbdf3bbd4c3bc28c", "win32console": "bbdf3bbd4c3bc28c", "vector": "bf9813f6e3c9d351", "viperlib": "c3b259b4059f8668", "viperio": "c9f4be41ca1cc2b4", "testcheck": "dd3002730623424b", "memhub": "ee084e9fc6ee413a", "stdint": "f5522571bcce7bcb", "w32.win32file": "f6b51804a0ba8ff0", "win32file": "f6b51804a0ba8ff0"}
|
||||
29
Test/TestProject3/project.json
Normal file
29
Test/TestProject3/project.json
Normal file
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"$schema": "https://raw.githubusercontent.com/TermiNexus/TransPyC/main/schemas/project-schema.json",
|
||||
"name": "TestProject",
|
||||
"version": "1.0.0",
|
||||
"source_dir": "./App",
|
||||
"temp_dir": "./temp",
|
||||
"output_dir": "./output",
|
||||
"compiler": {
|
||||
"cmd": "llc",
|
||||
"flags": ["-filetype=obj", "-relocation-model=pic"]
|
||||
},
|
||||
"linker": {
|
||||
"cmd": "clang++",
|
||||
"flags": ["-lmsvcrt", "-lucrt", "-lpthread", "-lmingwex", "-lkernel32", "-Wl,--allow-multiple-definition"],
|
||||
"output": "TestProject.exe"
|
||||
},
|
||||
"includes": [
|
||||
"./includes"
|
||||
],
|
||||
"target": {
|
||||
"triple": "x86_64-pc-windows-gnu",
|
||||
"datalayout": "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
|
||||
},
|
||||
"options": {
|
||||
"slice_level": 3,
|
||||
"target": "llvm",
|
||||
"strict_mode": true
|
||||
}
|
||||
}
|
||||
1
Test/TestProject3/temp/0019c939aae7f9f1.doc.json
Normal file
1
Test/TestProject3/temp/0019c939aae7f9f1.doc.json
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
14
Test/TestProject3/temp/0019c939aae7f9f1.pyi
Normal file
14
Test/TestProject3/temp/0019c939aae7f9f1.pyi
Normal file
@@ -0,0 +1,14 @@
|
||||
"""
|
||||
Auto-generated Python stub file from mpooltest.py
|
||||
Module: mpooltest
|
||||
"""
|
||||
|
||||
|
||||
import t, c
|
||||
from t import CInt, CPtr, CChar
|
||||
import viperlib
|
||||
import viperio
|
||||
import stdlib
|
||||
import memhub
|
||||
|
||||
def mpool_main() -> CInt: pass
|
||||
81
Test/TestProject3/temp/0035c95a18d4f8e8.pyi
Normal file
81
Test/TestProject3/temp/0035c95a18d4f8e8.pyi
Normal file
@@ -0,0 +1,81 @@
|
||||
"""
|
||||
Auto-generated Python stub file from w32.fileio.py
|
||||
Module: w32.fileio
|
||||
"""
|
||||
|
||||
|
||||
import t, c
|
||||
from stdint import *
|
||||
import stdio
|
||||
import w32.win32base
|
||||
import w32.win32file
|
||||
|
||||
class MODE(t.CEnum):
|
||||
R = 0
|
||||
W = 1
|
||||
A = 2
|
||||
RP = 3
|
||||
WP = 4
|
||||
AP = 5
|
||||
X = 6
|
||||
XP = 7
|
||||
class FRESULT(t.CEnum):
|
||||
OK = 0
|
||||
ERR = -1
|
||||
ERR_CLOSED = -2
|
||||
ERR_PERM = -3
|
||||
ERR_IO = -4
|
||||
ERR_NOTFOUND = -5
|
||||
|
||||
SEEK_SET: t.CDefine = 0
|
||||
SEEK_CUR: t.CDefine = 1
|
||||
SEEK_END: t.CDefine = 2
|
||||
INVALID_SET_FILE_POINTER: t.CDefine = -1
|
||||
SHARE_READ: t.CDefine = 0x00000001
|
||||
SHARE_WRITE: t.CDefine = 0x00000002
|
||||
SHARE_DELETE: t.CDefine = 0x00000004
|
||||
|
||||
class File:
|
||||
handle: w32.win32base.HANDLE
|
||||
closed: bool
|
||||
can_read: bool
|
||||
can_write: bool
|
||||
is_append: bool
|
||||
_share_mode: ULONG
|
||||
def __init__(self: File, filename: str, mode: ULONG, share: ULONG) -> t.CInt: pass
|
||||
def __enter__(self: File) -> 'File' | t.CPtr: pass
|
||||
def __exit__(self: File) -> t.CInt: pass
|
||||
def read(self: File, buf: bytes, count: ULONG) -> LONG: pass
|
||||
def write(self: File, buf: bytes, count: ULONG) -> LONG: pass
|
||||
def write_str(self: File, s: str) -> LONG: pass
|
||||
def seek(self: File, offset: LONG, origin: ULONG) -> LONG: pass
|
||||
def tell(self: File) -> LONG: pass
|
||||
def close(self: File) -> LONG: pass
|
||||
def flush(self: File) -> LONG: pass
|
||||
def size(self: File) -> LONGLONG: pass
|
||||
def readline(self: File, buf: bytes, max_count: ULONG) -> LONG: pass
|
||||
def read_all(self: File, buf: bytes, max_count: ULONG) -> LONG: pass
|
||||
class FileW:
|
||||
handle: w32.win32base.HANDLE
|
||||
closed: bool
|
||||
can_read: bool
|
||||
can_write: bool
|
||||
is_append: bool
|
||||
_share_mode: ULONG
|
||||
def __init__(self: FileW, filename: w32.win32base.LPCWSTR, mode: ULONG, share: ULONG) -> t.CInt: pass
|
||||
def __enter__(self: FileW) -> 'FileW' | t.CPtr: pass
|
||||
def __exit__(self: FileW) -> t.CInt: pass
|
||||
def read(self: FileW, buf: bytes, count: ULONG) -> LONG: pass
|
||||
def write(self: FileW, buf: bytes, count: ULONG) -> LONG: pass
|
||||
def write_str(self: FileW, s: str) -> LONG: pass
|
||||
def seek(self: FileW, offset: LONG, origin: ULONG) -> LONG: pass
|
||||
def tell(self: FileW) -> LONG: pass
|
||||
def close(self: FileW) -> LONG: pass
|
||||
def flush(self: FileW) -> LONG: pass
|
||||
def size(self: FileW) -> LONGLONG: pass
|
||||
def readline(self: FileW, buf: bytes, max_count: ULONG) -> LONG: pass
|
||||
def read_all(self: FileW, buf: bytes, max_count: ULONG) -> LONG: pass
|
||||
|
||||
def open(filename: str, mode: ULONG, share: ULONG) -> File | t.CPtr: pass
|
||||
|
||||
def openw(filename: LPCWSTR, mode: ULONG, share: ULONG) -> FileW | t.CPtr: pass
|
||||
136
Test/TestProject3/temp/067c78e9f121dce3.pyi
Normal file
136
Test/TestProject3/temp/067c78e9f121dce3.pyi
Normal file
@@ -0,0 +1,136 @@
|
||||
"""
|
||||
Auto-generated Python stub file from w32.win32process.py
|
||||
Module: w32.win32process
|
||||
"""
|
||||
|
||||
import c
|
||||
|
||||
|
||||
import t
|
||||
from stdint import *
|
||||
from w32.win32base import *
|
||||
|
||||
PROCESS_TERMINATE: t.CDefine = 0x0001
|
||||
PROCESS_CREATE_THREAD: t.CDefine = 0x0002
|
||||
PROCESS_VM_OPERATION: t.CDefine = 0x0008
|
||||
PROCESS_VM_READ: t.CDefine = 0x0010
|
||||
PROCESS_VM_WRITE: t.CDefine = 0x0020
|
||||
PROCESS_QUERY_INFORMATION: t.CDefine = 0x0400
|
||||
PROCESS_ALL_ACCESS: t.CDefine = 0x001FFFFF
|
||||
THREAD_TERMINATE: t.CDefine = 0x0001
|
||||
THREAD_SUSPEND_RESUME: t.CDefine = 0x0002
|
||||
THREAD_GET_CONTEXT: t.CDefine = 0x0008
|
||||
THREAD_SET_CONTEXT: t.CDefine = 0x0010
|
||||
THREAD_QUERY_INFORMATION: t.CDefine = 0x0040
|
||||
THREAD_ALL_ACCESS: t.CDefine = 0x001FFFFF
|
||||
CREATE_SUSPENDED: t.CDefine = 0x00000004
|
||||
CREATE_NEW_CONSOLE: t.CDefine = 0x00000010
|
||||
CREATE_NEW_PROCESS_GROUP: t.CDefine = 0x00000200
|
||||
CREATE_NO_WINDOW: t.CDefine = 0x08000000
|
||||
DETACHED_PROCESS: t.CDefine = 0x00000008
|
||||
STARTF_USESHOWWINDOW: t.CDefine = 0x00000001
|
||||
STARTF_USESTDHANDLES: t.CDefine = 0x00000100
|
||||
SW_HIDE: t.CDefine = 0
|
||||
SW_SHOW: t.CDefine = 5
|
||||
SW_MINIMIZE: t.CDefine = 6
|
||||
NORMAL_PRIORITY_CLASS: t.CDefine = 0x00000020
|
||||
IDLE_PRIORITY_CLASS: t.CDefine = 0x00000040
|
||||
HIGH_PRIORITY_CLASS: t.CDefine = 0x00000080
|
||||
REALTIME_PRIORITY_CLASS: t.CDefine = 0x00000100
|
||||
BELOW_NORMAL_PRIORITY_CLASS: t.CDefine = 0x00004000
|
||||
ABOVE_NORMAL_PRIORITY_CLASS: t.CDefine = 0x00008000
|
||||
STILL_ACTIVE: t.CDefine = 259
|
||||
|
||||
class STARTUPINFOA:
|
||||
cb: ULONG
|
||||
lpReserved: CHARPTR
|
||||
lpDesktop: CHARPTR
|
||||
lpTitle: CHARPTR
|
||||
dwX: ULONG
|
||||
dwY: ULONG
|
||||
dwXSize: ULONG
|
||||
dwYSize: ULONG
|
||||
dwXCountChars: ULONG
|
||||
dwYCountChars: ULONG
|
||||
dwFillAttribute: ULONG
|
||||
dwFlags: ULONG
|
||||
wShowWindow: WORD
|
||||
cbReserved2: WORD
|
||||
lpReserved2: VOIDPTR
|
||||
hStdInput: HANDLE
|
||||
hStdOutput: HANDLE
|
||||
hStdError: HANDLE
|
||||
class STARTUPINFOW:
|
||||
cb: ULONG
|
||||
lpReserved: WCHARPTR
|
||||
lpDesktop: WCHARPTR
|
||||
lpTitle: WCHARPTR
|
||||
dwX: ULONG
|
||||
dwY: ULONG
|
||||
dwXSize: ULONG
|
||||
dwYSize: ULONG
|
||||
dwXCountChars: ULONG
|
||||
dwYCountChars: ULONG
|
||||
dwFillAttribute: ULONG
|
||||
dwFlags: ULONG
|
||||
wShowWindow: WORD
|
||||
cbReserved2: WORD
|
||||
lpReserved2: VOIDPTR
|
||||
hStdInput: HANDLE
|
||||
hStdOutput: HANDLE
|
||||
hStdError: HANDLE
|
||||
class PROCESS_INFORMATION:
|
||||
hProcess: HANDLE
|
||||
hThread: HANDLE
|
||||
dwProcessId: ULONG
|
||||
dwThreadId: ULONG
|
||||
|
||||
def CreateProcessA(lpApplicationName: LPCSTR, lpCommandLine: CHARPTR, lpProcessAttributes: SECURITY_ATTRIBUTES | t.CPtr, lpThreadAttributes: SECURITY_ATTRIBUTES | t.CPtr, bInheritHandles: BOOL, dwCreationFlags: ULONG, lpEnvironment: VOIDPTR, lpCurrentDirectory: LPCSTR, lpStartupInfo: STARTUPINFOA | t.CPtr, lpProcessInformation: PROCESS_INFORMATION | t.CPtr) -> BOOL | t.State: pass
|
||||
|
||||
def CreateProcessW(lpApplicationName: LPCWSTR, lpCommandLine: WCHARPTR, lpProcessAttributes: SECURITY_ATTRIBUTES | t.CPtr, lpThreadAttributes: SECURITY_ATTRIBUTES | t.CPtr, bInheritHandles: BOOL, dwCreationFlags: ULONG, lpEnvironment: VOIDPTR, lpCurrentDirectory: LPCWSTR, lpStartupInfo: STARTUPINFOW | t.CPtr, lpProcessInformation: PROCESS_INFORMATION | t.CPtr) -> BOOL | t.State: pass
|
||||
|
||||
def TerminateProcess(hProcess: HANDLE, uExitCode: UINT) -> BOOL | t.State: pass
|
||||
|
||||
def GetExitCodeProcess(hProcess: HANDLE, lpExitCode: ULONG | t.CPtr) -> BOOL | t.State: pass
|
||||
|
||||
def GetExitCodeThread(hThread: HANDLE, lpExitCode: ULONG | t.CPtr) -> BOOL | t.State: pass
|
||||
|
||||
def OpenProcess(dwDesiredAccess: ULONG, bInheritHandle: BOOL, dwProcessId: ULONG) -> HANDLE | t.State: pass
|
||||
|
||||
def GetCurrentProcess() -> HANDLE | t.State: pass
|
||||
|
||||
def GetCurrentProcessId() -> ULONG | t.State: pass
|
||||
|
||||
def CreateThread(lpThreadAttributes: SECURITY_ATTRIBUTES | t.CPtr, dwStackSize: t.CSizeT, lpStartAddress: VOIDPTR, lpParameter: VOIDPTR, dwCreationFlags: ULONG, lpThreadId: ULONG | t.CPtr) -> HANDLE | t.State: pass
|
||||
|
||||
def OpenThread(dwDesiredAccess: ULONG, bInheritHandle: BOOL, dwThreadId: ULONG) -> HANDLE | t.State: pass
|
||||
|
||||
def SuspendThread(hThread: HANDLE) -> ULONG | t.State: pass
|
||||
|
||||
def ResumeThread(hThread: HANDLE) -> ULONG | t.State: pass
|
||||
|
||||
def TerminateThread(hThread: HANDLE, dwExitCode: ULONG) -> BOOL | t.State: pass
|
||||
|
||||
def GetCurrentThread() -> HANDLE | t.State: pass
|
||||
|
||||
def GetCurrentThreadId() -> ULONG | t.State: pass
|
||||
|
||||
def GetThreadId(hThread: HANDLE) -> ULONG | t.State: pass
|
||||
|
||||
def GetProcessId(hProcess: HANDLE) -> ULONG | t.State: pass
|
||||
|
||||
def SetThreadPriority(hThread: HANDLE, nPriority: INT) -> BOOL | t.State: pass
|
||||
|
||||
def GetThreadPriority(hThread: HANDLE) -> INT | t.State: pass
|
||||
|
||||
def ExitProcess(uExitCode: UINT) -> VOID | t.State: pass
|
||||
|
||||
def ExitThread(dwExitCode: ULONG) -> VOID | t.State: pass
|
||||
|
||||
def TlsAlloc() -> ULONG | t.State: pass
|
||||
|
||||
def TlsFree(dwTlsIndex: ULONG) -> BOOL | t.State: pass
|
||||
|
||||
def TlsGetValue(dwTlsIndex: ULONG) -> VOIDPTR | t.State: pass
|
||||
|
||||
def TlsSetValue(dwTlsIndex: ULONG, lpTlsValue: VOIDPTR) -> BOOL | t.State: pass
|
||||
109
Test/TestProject3/temp/06f53cc594b4ac6c.pyi
Normal file
109
Test/TestProject3/temp/06f53cc594b4ac6c.pyi
Normal file
@@ -0,0 +1,109 @@
|
||||
"""
|
||||
Auto-generated Python stub file from w32.win32sync.py
|
||||
Module: w32.win32sync
|
||||
"""
|
||||
|
||||
import c
|
||||
|
||||
|
||||
import t
|
||||
from stdint import *
|
||||
from w32.win32base import *
|
||||
|
||||
class CRITICAL_SECTION:
|
||||
DebugInfo: VOIDPTR
|
||||
LockCount: LONG
|
||||
RecursionCount: LONG
|
||||
OwningThread: HANDLE
|
||||
LockSemaphore: HANDLE
|
||||
SpinCount: QWORD
|
||||
|
||||
def InitializeCriticalSection(lpCriticalSection: CRITICAL_SECTION | t.CPtr) -> VOID | t.State: pass
|
||||
|
||||
def EnterCriticalSection(lpCriticalSection: CRITICAL_SECTION | t.CPtr) -> VOID | t.State: pass
|
||||
|
||||
def LeaveCriticalSection(lpCriticalSection: CRITICAL_SECTION | t.CPtr) -> VOID | t.State: pass
|
||||
|
||||
def DeleteCriticalSection(lpCriticalSection: CRITICAL_SECTION | t.CPtr) -> VOID | t.State: pass
|
||||
|
||||
def TryEnterCriticalSection(lpCriticalSection: CRITICAL_SECTION | t.CPtr) -> BOOL | t.State: pass
|
||||
|
||||
def SetCriticalSectionSpinCount(lpCriticalSection: CRITICAL_SECTION | t.CPtr, dwSpinCount: ULONG) -> ULONG | t.State: pass
|
||||
|
||||
def InitializeCriticalSectionAndSpinCount(lpCriticalSection: CRITICAL_SECTION | t.CPtr, dwSpinCount: ULONG) -> BOOL | t.State: pass
|
||||
|
||||
def CreateMutexA(lpMutexAttributes: SECURITY_ATTRIBUTES | t.CPtr, bInitialOwner: BOOL, lpName: LPCSTR) -> HANDLE | t.State: pass
|
||||
|
||||
def CreateMutexW(lpMutexAttributes: SECURITY_ATTRIBUTES | t.CPtr, bInitialOwner: BOOL, lpName: LPCWSTR) -> HANDLE | t.State: pass
|
||||
|
||||
def OpenMutexA(dwDesiredAccess: ULONG, bInheritHandle: BOOL, lpName: LPCSTR) -> HANDLE | t.State: pass
|
||||
|
||||
def OpenMutexW(dwDesiredAccess: ULONG, bInheritHandle: BOOL, lpName: LPCWSTR) -> HANDLE | t.State: pass
|
||||
|
||||
def ReleaseMutex(hMutex: HANDLE) -> BOOL | t.State: pass
|
||||
|
||||
def CreateEventA(lpEventAttributes: SECURITY_ATTRIBUTES | t.CPtr, bManualReset: BOOL, bInitialState: BOOL, lpName: LPCSTR) -> HANDLE | t.State: pass
|
||||
|
||||
def CreateEventW(lpEventAttributes: SECURITY_ATTRIBUTES | t.CPtr, bManualReset: BOOL, bInitialState: BOOL, lpName: LPCWSTR) -> HANDLE | t.State: pass
|
||||
|
||||
def OpenEventA(dwDesiredAccess: ULONG, bInheritHandle: BOOL, lpName: LPCSTR) -> HANDLE | t.State: pass
|
||||
|
||||
def OpenEventW(dwDesiredAccess: ULONG, bInheritHandle: BOOL, lpName: LPCWSTR) -> HANDLE | t.State: pass
|
||||
|
||||
def SetEvent(hEvent: HANDLE) -> BOOL | t.State: pass
|
||||
|
||||
def ResetEvent(hEvent: HANDLE) -> BOOL | t.State: pass
|
||||
|
||||
def PulseEvent(hEvent: HANDLE) -> BOOL | t.State: pass
|
||||
|
||||
def CreateSemaphoreA(lpSemaphoreAttributes: SECURITY_ATTRIBUTES | t.CPtr, lInitialCount: LONG, lMaximumCount: LONG, lpName: LPCSTR) -> HANDLE | t.State: pass
|
||||
|
||||
def CreateSemaphoreW(lpSemaphoreAttributes: SECURITY_ATTRIBUTES | t.CPtr, lInitialCount: LONG, lMaximumCount: LONG, lpName: LPCWSTR) -> HANDLE | t.State: pass
|
||||
|
||||
def OpenSemaphoreA(dwDesiredAccess: ULONG, bInheritHandle: BOOL, lpName: LPCSTR) -> HANDLE | t.State: pass
|
||||
|
||||
def OpenSemaphoreW(dwDesiredAccess: ULONG, bInheritHandle: BOOL, lpName: LPCWSTR) -> HANDLE | t.State: pass
|
||||
|
||||
def ReleaseSemaphore(hSemaphore: HANDLE, lReleaseCount: LONG, lpPreviousCount: LONG | t.CPtr) -> BOOL | t.State: pass
|
||||
|
||||
def WaitForSingleObject(hHandle: HANDLE, dwMilliseconds: ULONG) -> ULONG | t.State: pass
|
||||
|
||||
def WaitForSingleObjectEx(hHandle: HANDLE, dwMilliseconds: ULONG, bAlertable: BOOL) -> ULONG | t.State: pass
|
||||
|
||||
def WaitForMultipleObjects(nCount: ULONG, lpHandles: VOIDPTR, bWaitAll: BOOL, dwMilliseconds: ULONG) -> ULONG | t.State: pass
|
||||
|
||||
def WaitForMultipleObjectsEx(nCount: ULONG, lpHandles: VOIDPTR, bWaitAll: BOOL, dwMilliseconds: ULONG, bAlertable: BOOL) -> ULONG | t.State: pass
|
||||
|
||||
def InitializeSRWLock(SRWLock: VOIDPTR) -> VOID | t.State: pass
|
||||
|
||||
def AcquireSRWLockExclusive(SRWLock: VOIDPTR) -> VOID | t.State: pass
|
||||
|
||||
def AcquireSRWLockShared(SRWLock: VOIDPTR) -> VOID | t.State: pass
|
||||
|
||||
def ReleaseSRWLockExclusive(SRWLock: VOIDPTR) -> VOID | t.State: pass
|
||||
|
||||
def ReleaseSRWLockShared(SRWLock: VOIDPTR) -> VOID | t.State: pass
|
||||
|
||||
|
||||
CONDITION_VARIABLE_LOCKMODE_SHARED: t.CDefine = 0x1
|
||||
|
||||
def InitializeConditionVariable(ConditionVariable: VOIDPTR) -> VOID | t.State: pass
|
||||
|
||||
def SleepConditionVariableCS(ConditionVariable: VOIDPTR, CriticalSection: CRITICAL_SECTION | t.CPtr, dwMilliseconds: ULONG) -> BOOL | t.State: pass
|
||||
|
||||
def SleepConditionVariableSRW(ConditionVariable: VOIDPTR, SRWLock: VOIDPTR, dwMilliseconds: ULONG, Flags: ULONG) -> BOOL | t.State: pass
|
||||
|
||||
def WakeConditionVariable(ConditionVariable: VOIDPTR) -> VOID | t.State: pass
|
||||
|
||||
def WakeAllConditionVariable(ConditionVariable: VOIDPTR) -> VOID | t.State: pass
|
||||
|
||||
|
||||
INIT_ONCE_STATIC_INIT: t.CDefine = 0x00000001
|
||||
INIT_ONCE_CHECK_ONLY: t.CDefine = 0x00000002
|
||||
INIT_ONCE_ASYNC: t.CDefine = 0x00000004
|
||||
INIT_ONCE_INIT_FAILED: t.CDefine = 0x00000008
|
||||
|
||||
class INIT_ONCE:
|
||||
Ptr: t.CPtr
|
||||
|
||||
def InitOnceExecuteOnce(InitOnce: INIT_ONCE | t.CPtr, InitFn: VOIDPTR, Parameter: VOIDPTR, Context: VOIDPTR | t.CPtr) -> BOOL | t.State: pass
|
||||
1
Test/TestProject3/temp/1b58766d38d05de3.doc.json
Normal file
1
Test/TestProject3/temp/1b58766d38d05de3.doc.json
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
35
Test/TestProject3/temp/1b58766d38d05de3.pyi
Normal file
35
Test/TestProject3/temp/1b58766d38d05de3.pyi
Normal file
@@ -0,0 +1,35 @@
|
||||
"""
|
||||
Auto-generated Python stub file from enumtest.py
|
||||
Module: enumtest
|
||||
"""
|
||||
|
||||
|
||||
import t, c
|
||||
from t import CInt, CPtr, CChar, CInt32T, CExport
|
||||
import viperlib
|
||||
import stdlib
|
||||
|
||||
class Color(t.CEnum):
|
||||
Red = 0
|
||||
Green = 1
|
||||
Blue = 2
|
||||
class Option(t.REnum):
|
||||
class Some:
|
||||
value: CInt
|
||||
Empty = 1
|
||||
class Result(t.REnum):
|
||||
class Ok:
|
||||
value: CInt
|
||||
class Err:
|
||||
msg: t.CChar | CPtr
|
||||
class GeoShape(t.REnum):
|
||||
class GCircle:
|
||||
radius: CInt
|
||||
class GRect:
|
||||
w: CInt
|
||||
h: CInt
|
||||
class GPoint:
|
||||
x: CInt
|
||||
y: CInt
|
||||
|
||||
def enum_main() -> CInt: pass
|
||||
26
Test/TestProject3/temp/271ea3decb810db2.pyi
Normal file
26
Test/TestProject3/temp/271ea3decb810db2.pyi
Normal file
@@ -0,0 +1,26 @@
|
||||
"""
|
||||
Auto-generated Python stub file from atom.py
|
||||
Module: atom
|
||||
"""
|
||||
|
||||
|
||||
import t, c
|
||||
|
||||
ATOMIC_RELAXED: t.CDefine = 0
|
||||
ATOMIC_CONSUME: t.CDefine = 1
|
||||
ATOMIC_ACQUIRE: t.CDefine = 2
|
||||
ATOMIC_RELEASE: t.CDefine = 3
|
||||
ATOMIC_ACQ_REL: t.CDefine = 4
|
||||
ATOMIC_SEQ_CST: t.CDefine = 5
|
||||
|
||||
def __atomic_test_and_set(ptr: t.CUInt64T | t.CPtr, order: t.CInt) -> t.CBool: pass
|
||||
|
||||
def __atomic_clear(ptr: t.CUInt64T | t.CPtr, order: t.CInt) -> t.CVoid: pass
|
||||
|
||||
def __atomic_thread_fence(order: t.CInt) -> t.CVoid: pass
|
||||
|
||||
def __atomic_signal_fence(order: t.CInt) -> t.CVoid: pass
|
||||
|
||||
def __atomic_always_lock_free(size: t.CSizeT, ptr: t.CVoid | t.CPtr) -> t.CBool: pass
|
||||
|
||||
def __atomic_is_lock_free(size: t.CSizeT, ptr: t.CVoid | t.CPtr) -> t.CBool: pass
|
||||
86
Test/TestProject3/temp/6446627d4f07a1b5.pyi
Normal file
86
Test/TestProject3/temp/6446627d4f07a1b5.pyi
Normal file
@@ -0,0 +1,86 @@
|
||||
"""
|
||||
Auto-generated Python stub file from w32.winsock2.py
|
||||
Module: w32.winsock2
|
||||
"""
|
||||
|
||||
|
||||
import t, c
|
||||
from stdint import *
|
||||
from w32.win32base import *
|
||||
|
||||
WINSOCK_VERSION: t.CDefine = 0x0202 # 2.2
|
||||
AF_INET: t.CDefine = 2
|
||||
AF_INET6: t.CDefine = 23
|
||||
SOCK_STREAM: t.CDefine = 1 # TCP
|
||||
SOCK_DGRAM: t.CDefine = 2 # UDP
|
||||
SOCK_RAW: t.CDefine = 3 # 原始套接字
|
||||
IPPROTO_TCP: t.CDefine = 6
|
||||
IPPROTO_UDP: t.CDefine = 17
|
||||
SOL_SOCKET: t.CDefine = 0xFFFF # WinSock2 值
|
||||
SO_RCVTIMEO: t.CDefine = 0x1006 # WinSock2 值
|
||||
SO_SNDTIMEO: t.CDefine = 0x1005 # WinSock2 值
|
||||
SO_REUSEADDR: t.CDefine = 0x0004 # WinSock2 值
|
||||
INADDR_ANY: t.CDefine = 0
|
||||
SOCKET_ERROR: t.CDefine = -1
|
||||
INVALID_SOCKET: t.CDefine = 0xFFFFFFFF # WinSock2: ~0
|
||||
MSG_NOSIGNAL: t.CDefine = 0 # Windows 不支持,设为 0
|
||||
SD_SEND: t.CDefine = 1
|
||||
SD_RECV: t.CDefine = 0
|
||||
SD_BOTH: t.CDefine = 2
|
||||
|
||||
class WSASocketAddr:
|
||||
family: u16
|
||||
port: u16
|
||||
addr: u32
|
||||
zero: u64
|
||||
class WSAData:
|
||||
wVersion: WORD
|
||||
wHighVersion: WORD
|
||||
szDescription: BYTE
|
||||
szSystemStatus: BYTE
|
||||
iMaxSockets: u16
|
||||
iMaxUdpDg: u16
|
||||
lpVendorInfo: CHARPTR
|
||||
class WSAHostEnt:
|
||||
h_name: CHARPTR
|
||||
h_aliases: CHARPTR
|
||||
h_addrtype: SHORT
|
||||
h_length: SHORT
|
||||
h_addr_list: CHARPTR
|
||||
class WinTimeVal:
|
||||
tv_sec: LONG
|
||||
tv_usec: LONG
|
||||
|
||||
def WSAStartup(wVersionRequested: WORD, lpWSAData: WSAData | t.CPtr) -> INT | t.State: pass
|
||||
|
||||
def WSACleanup() -> INT | t.State: pass
|
||||
|
||||
def WSAGetLastError() -> INT | t.State: pass
|
||||
|
||||
def socket(family: INT, type: INT, protocol: INT) -> u64 | t.State: pass
|
||||
|
||||
def closesocket(s: u64) -> INT | t.State: pass
|
||||
|
||||
def connect(s: u64, name: WSASocketAddr | t.CPtr, namelen: INT) -> INT | t.State: pass
|
||||
|
||||
def send(s: u64, buf: t.CVoid | t.CPtr, len: INT, flags: INT) -> INT | t.State: pass
|
||||
|
||||
def recv(s: u64, buf: t.CVoid | t.CPtr, len: INT, flags: INT) -> INT | t.State: pass
|
||||
|
||||
def bind(s: u64, name: WSASocketAddr | t.CPtr, namelen: INT) -> INT | t.State: pass
|
||||
|
||||
def listen(s: u64, backlog: INT) -> INT | t.State: pass
|
||||
|
||||
def accept(s: u64, addr: WSASocketAddr | t.CPtr, addrlen: INT | t.CPtr) -> u64 | t.State: pass
|
||||
|
||||
def setsockopt(s: u64, level: INT, optname: INT, optval: t.CVoid | t.CPtr, optlen: INT) -> INT | t.State: pass
|
||||
|
||||
def shutdown(s: u64, how: INT) -> INT | t.State: pass
|
||||
|
||||
def gethostbyname(name: t.CChar | t.CConst | t.CPtr) -> WSAHostEnt | t.CPtr | t.State: pass
|
||||
|
||||
def ntohs(netshort: u16) -> u16 | t.State: pass
|
||||
|
||||
def htons(hostshort: u16) -> u16 | t.State: pass
|
||||
|
||||
def inet_addr(cp: t.CChar | t.CConst | t.CPtr) -> u32 | t.State: pass
|
||||
1
Test/TestProject3/temp/64ac83614c9bdbc6.doc.json
Normal file
1
Test/TestProject3/temp/64ac83614c9bdbc6.doc.json
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
85
Test/TestProject3/temp/64ac83614c9bdbc6.pyi
Normal file
85
Test/TestProject3/temp/64ac83614c9bdbc6.pyi
Normal file
@@ -0,0 +1,85 @@
|
||||
"""
|
||||
Auto-generated Python stub file from definetest.py
|
||||
Module: definetest
|
||||
"""
|
||||
|
||||
|
||||
import t, c
|
||||
from t import CInt, CInt32T, CUInt32T, CUInt64T, CFloat64T, CPtr, CChar, CDefine, CUInt16T
|
||||
import viperlib
|
||||
import stdlib
|
||||
import platmacro
|
||||
|
||||
MAX_SIZE: t.CDefine = 1024
|
||||
MIN_VAL: t.CDefine = 0
|
||||
MAX_VAL: t.CDefine = 100
|
||||
MASK_BYTE: t.CDefine = 0xFF
|
||||
SHIFT_BITS: t.CDefine = 8
|
||||
PI_INT: t.CDefine = 3
|
||||
ENABLED: t.CDefine = 1
|
||||
DISABLED: t.CDefine = 0
|
||||
PAGE_SIZE: t.CDefine = 4096
|
||||
BUFFER_LEN: t.CDefine = 256
|
||||
CODE_SEG: t.CDefine | t.CUInt16T = 0x08
|
||||
DATA_SEG: t.CDefine | t.CUInt16T = 0x10
|
||||
STACK_SEG: t.CDefine | t.CUInt16T = 0x20
|
||||
|
||||
def MAKE_FLAG(bit: CInt32T) -> t.CDefine:
|
||||
return 1 << bit
|
||||
|
||||
def CLAMP(x: CInt32T, lo: CInt32T, hi: CInt32T) -> t.CDefine:
|
||||
if x < lo:
|
||||
return lo
|
||||
if x > hi:
|
||||
return hi
|
||||
return x
|
||||
|
||||
def test_basic_define() -> CInt: pass
|
||||
|
||||
def test_define_arithmetic() -> CInt: pass
|
||||
|
||||
def test_define_conditional() -> CInt: pass
|
||||
|
||||
def test_define_loop() -> CInt: pass
|
||||
|
||||
def test_typed_define() -> CInt: pass
|
||||
|
||||
def test_define_function() -> CInt: pass
|
||||
|
||||
def test_define_clamp() -> CInt: pass
|
||||
|
||||
def test_define_string() -> CInt: pass
|
||||
|
||||
def test_define_combined() -> CInt: pass
|
||||
|
||||
def test_cif_basic() -> CInt: pass
|
||||
|
||||
def test_cif_elif_else() -> CInt: pass
|
||||
|
||||
def test_cifdef_cifndef() -> CInt: pass
|
||||
|
||||
def test_cif_platform() -> CInt: pass
|
||||
|
||||
def test_cif_nested() -> CInt: pass
|
||||
|
||||
def test_cif_expr() -> CInt: pass
|
||||
|
||||
def test_platmacro_platform() -> CInt: pass
|
||||
|
||||
def test_platmacro_sizes() -> CInt: pass
|
||||
|
||||
def test_platmacro_endian() -> CInt: pass
|
||||
|
||||
def test_platmacro_features() -> CInt: pass
|
||||
|
||||
def test_platmacro_align() -> CInt: pass
|
||||
|
||||
def test_cifdef_cross_module() -> CInt: pass
|
||||
|
||||
def test_cifdef_guard() -> CInt: pass
|
||||
|
||||
def test_cifdef_undefined() -> CInt: pass
|
||||
|
||||
def test_cifdef_complex() -> CInt: pass
|
||||
|
||||
def define_main() -> CInt: pass
|
||||
28
Test/TestProject3/temp/6f62fe05c5ea1ceb.pyi
Normal file
28
Test/TestProject3/temp/6f62fe05c5ea1ceb.pyi
Normal file
@@ -0,0 +1,28 @@
|
||||
"""
|
||||
Auto-generated Python stub file from stdio.py
|
||||
Module: stdio
|
||||
"""
|
||||
|
||||
|
||||
import t, c
|
||||
|
||||
def printf(fmt: t.CConst | str, *args) -> t.CInt | t.State: pass
|
||||
|
||||
def fprintf(stream: bytes, fmt: t.CConst | str, *args) -> t.CInt | t.State: pass
|
||||
|
||||
def sprintf(buf: bytes, fmt: t.CConst | str, *args) -> t.CInt | t.State: pass
|
||||
|
||||
def snprintf(buf: bytes, size: t.CSizeT, fmt: t.CConst | str, *args) -> t.CInt | t.State: pass
|
||||
|
||||
def puts(s: t.CConst | str) -> t.CInt | t.State: pass
|
||||
|
||||
def fputs(s: t.CConst | str, stream: bytes) -> t.CInt | t.State: pass
|
||||
|
||||
def fgets(buf: bytes, size: t.CInt, stream: bytes) -> bytes | t.State: pass
|
||||
|
||||
def fflush(stream: bytes) -> t.CInt | t.State: pass
|
||||
|
||||
|
||||
stdin: t.CExtern | bytes
|
||||
stdout: t.CExtern | bytes
|
||||
stderr: t.CExtern | bytes
|
||||
20
Test/TestProject3/temp/71e0a3ffcb3ebfad.pyi
Normal file
20
Test/TestProject3/temp/71e0a3ffcb3ebfad.pyi
Normal file
@@ -0,0 +1,20 @@
|
||||
"""
|
||||
Auto-generated Python stub file from stdarg.py
|
||||
Module: stdarg
|
||||
"""
|
||||
|
||||
import c
|
||||
|
||||
|
||||
import t
|
||||
|
||||
def va_start(args: t.CPtr, last_arg: t.CPtr) -> t.State: pass
|
||||
|
||||
def va_arg(args: t.CPtr, type: t.CPtr) -> t.CPtr | t.State: pass
|
||||
|
||||
def va_end(args: t.CPtr) -> t.State | t.State: pass
|
||||
|
||||
|
||||
va_list: t.CTypedef = t.CUnsignedChar | t.CPtr
|
||||
|
||||
def arg(type: t.CType) -> t.State: pass
|
||||
91
Test/TestProject3/temp/72e2d5ccb7cedcf1.pyi
Normal file
91
Test/TestProject3/temp/72e2d5ccb7cedcf1.pyi
Normal file
@@ -0,0 +1,91 @@
|
||||
"""
|
||||
Auto-generated Python stub file from w32.win32memory.py
|
||||
Module: w32.win32memory
|
||||
"""
|
||||
|
||||
import c
|
||||
|
||||
|
||||
import t
|
||||
from stdint import *
|
||||
from w32.win32base import *
|
||||
|
||||
MEM_COMMIT: t.CDefine = 0x00001000
|
||||
MEM_RESERVE: t.CDefine = 0x00002000
|
||||
MEM_DECOMMIT: t.CDefine = 0x00004000
|
||||
MEM_RELEASE: t.CDefine = 0x00008000
|
||||
MEM_FREE: t.CDefine = 0x00010000
|
||||
MEM_RESET: t.CDefine = 0x00080000
|
||||
MEM_TOP_DOWN: t.CDefine = 0x00100000
|
||||
MEM_WRITE_WATCH: t.CDefine = 0x00200000
|
||||
MEM_PHYSICAL: t.CDefine = 0x00400000
|
||||
MEM_LARGE_PAGES: t.CDefine = 0x20000000
|
||||
PAGE_NOACCESS: t.CDefine = 0x01
|
||||
PAGE_READONLY: t.CDefine = 0x02
|
||||
PAGE_READWRITE: t.CDefine = 0x04
|
||||
PAGE_WRITECOPY: t.CDefine = 0x08
|
||||
PAGE_EXECUTE: t.CDefine = 0x10
|
||||
PAGE_EXECUTE_READ: t.CDefine = 0x20
|
||||
PAGE_EXECUTE_READWRITE: t.CDefine = 0x40
|
||||
PAGE_EXECUTE_WRITECOPY: t.CDefine = 0x80
|
||||
PAGE_GUARD: t.CDefine = 0x100
|
||||
PAGE_NOCACHE: t.CDefine = 0x200
|
||||
PAGE_WRITECOMBINE: t.CDefine = 0x400
|
||||
HEAP_NO_SERIALIZE: t.CDefine = 0x00000001
|
||||
HEAP_GROWABLE: t.CDefine = 0x00000002
|
||||
HEAP_GENERATE_EXCEPTIONS: t.CDefine = 0x00000004
|
||||
HEAP_ZERO_MEMORY: t.CDefine = 0x00000008
|
||||
HEAP_REALLOC_IN_PLACE_ONLY: t.CDefine = 0x00000010
|
||||
|
||||
class MEMORY_BASIC_INFORMATION:
|
||||
BaseAddress: VOIDPTR
|
||||
AllocationBase: VOIDPTR
|
||||
AllocationProtect: ULONG
|
||||
RegionSize: t.CSizeT
|
||||
State: ULONG
|
||||
Protect: ULONG
|
||||
Type: ULONG
|
||||
|
||||
def VirtualAlloc(lpAddress: VOIDPTR, dwSize: t.CSizeT, flAllocationType: ULONG, flProtect: ULONG) -> VOIDPTR | t.State: pass
|
||||
|
||||
def VirtualFree(lpAddress: VOIDPTR, dwSize: t.CSizeT, dwFreeType: ULONG) -> BOOL | t.State: pass
|
||||
|
||||
def VirtualProtect(lpAddress: VOIDPTR, dwSize: t.CSizeT, flNewProtect: ULONG, lpflOldProtect: ULONG | t.CPtr) -> BOOL | t.State: pass
|
||||
|
||||
def VirtualQuery(lpAddress: t.CConst | VOIDPTR, lpBuffer: MEMORY_BASIC_INFORMATION | t.CPtr, dwLength: t.CSizeT) -> t.CSizeT | t.State: pass
|
||||
|
||||
def VirtualLock(lpAddress: VOIDPTR, dwSize: t.CSizeT) -> BOOL | t.State: pass
|
||||
|
||||
def VirtualUnlock(lpAddress: VOIDPTR, dwSize: t.CSizeT) -> BOOL | t.State: pass
|
||||
|
||||
def GetProcessHeap() -> HANDLE | t.State: pass
|
||||
|
||||
def HeapCreate(flOptions: ULONG, dwInitialSize: t.CSizeT, dwMaximumSize: t.CSizeT) -> HANDLE | t.State: pass
|
||||
|
||||
def HeapDestroy(hHeap: HANDLE) -> BOOL | t.State: pass
|
||||
|
||||
def HeapAlloc(hHeap: HANDLE, dwFlags: ULONG, dwBytes: t.CSizeT) -> VOIDPTR | t.State: pass
|
||||
|
||||
def HeapReAlloc(hHeap: HANDLE, dwFlags: ULONG, lpMem: VOIDPTR, dwBytes: t.CSizeT) -> VOIDPTR | t.State: pass
|
||||
|
||||
def HeapFree(hHeap: HANDLE, dwFlags: ULONG, lpMem: VOIDPTR) -> BOOL | t.State: pass
|
||||
|
||||
def HeapSize(hHeap: HANDLE, dwFlags: ULONG, lpMem: t.CConst | VOIDPTR) -> t.CSizeT | t.State: pass
|
||||
|
||||
def HeapValidate(hHeap: HANDLE, dwFlags: ULONG, lpMem: t.CConst | VOIDPTR) -> BOOL | t.State: pass
|
||||
|
||||
def HeapCompact(hHeap: HANDLE, dwFlags: ULONG) -> t.CSizeT | t.State: pass
|
||||
|
||||
def GlobalAlloc(uFlags: UINT, dwBytes: t.CSizeT) -> VOIDPTR | t.State: pass
|
||||
|
||||
def GlobalFree(hMem: VOIDPTR) -> VOIDPTR | t.State: pass
|
||||
|
||||
def GlobalLock(hMem: VOIDPTR) -> VOIDPTR | t.State: pass
|
||||
|
||||
def GlobalUnlock(hMem: VOIDPTR) -> BOOL | t.State: pass
|
||||
|
||||
def GlobalSize(hMem: VOIDPTR) -> t.CSizeT | t.State: pass
|
||||
|
||||
def LocalAlloc(uFlags: UINT, dwBytes: t.CSizeT) -> VOIDPTR | t.State: pass
|
||||
|
||||
def LocalFree(hMem: VOIDPTR) -> VOIDPTR | t.State: pass
|
||||
100
Test/TestProject3/temp/7e529fe7a078cfef.pyi
Normal file
100
Test/TestProject3/temp/7e529fe7a078cfef.pyi
Normal file
@@ -0,0 +1,100 @@
|
||||
"""
|
||||
Auto-generated Python stub file from w32.win32base.py
|
||||
Module: w32.win32base
|
||||
"""
|
||||
|
||||
import c
|
||||
|
||||
|
||||
import t
|
||||
from stdint import *
|
||||
|
||||
HANDLE: t.CTypedef = VOIDPTR
|
||||
LPCSTR: t.CTypedef = t.CConst | t.CChar | t.CPtr
|
||||
LPCWSTR: t.CTypedef = t.CConst | t.CUnsignedShort | t.CPtr
|
||||
INVALID_HANDLE_VALUE: t.CDefine = t.CVoid(-1)
|
||||
NULL: t.CDefine = 0
|
||||
TRUE: t.CDefine = 1
|
||||
FALSE: t.CDefine = 0
|
||||
INFINITE: t.CDefine = 0xFFFFFFFF
|
||||
WAIT_FAILED: t.CDefine = 0xFFFFFFFF
|
||||
WAIT_OBJECT_0: t.CDefine = 0
|
||||
WAIT_TIMEOUT: t.CDefine = 258
|
||||
WAIT_ABANDONED: t.CDefine = 0x80
|
||||
MAX_PATH: t.CDefine = 260
|
||||
ERROR_SUCCESS: t.CDefine = 0
|
||||
ERROR_FILE_NOT_FOUND: t.CDefine = 2
|
||||
ERROR_ACCESS_DENIED: t.CDefine = 5
|
||||
ERROR_INSUFFICIENT_BUFFER: t.CDefine = 122
|
||||
|
||||
class SECURITY_ATTRIBUTES:
|
||||
nLength: ULONG
|
||||
lpSecurityDescriptor: VOIDPTR
|
||||
bInheritHandle: BOOL
|
||||
class OVERLAPPED:
|
||||
Internal: ULONGLONG
|
||||
InternalHigh: ULONGLONG
|
||||
Offset: ULONG
|
||||
OffsetHigh: ULONG
|
||||
hEvent: HANDLE
|
||||
class FILETIME:
|
||||
dwLowDateTime: DWORD
|
||||
dwHighDateTime: DWORD
|
||||
class SYSTEMTIME:
|
||||
wYear: WORD
|
||||
wMonth: WORD
|
||||
wDayOfWeek: WORD
|
||||
wDay: WORD
|
||||
wHour: WORD
|
||||
wMinute: WORD
|
||||
wSecond: WORD
|
||||
wMilliseconds: WORD
|
||||
class GUID:
|
||||
Data1: DWORD
|
||||
Data2: WORD
|
||||
Data3: WORD
|
||||
Data4: BYTEPTR
|
||||
class LARGE_INTEGER:
|
||||
QuadPart: LONGLONG
|
||||
class ULARGE_INTEGER:
|
||||
QuadPart: ULONGLONG
|
||||
|
||||
def GetLastError() -> ULONG | t.State: pass
|
||||
|
||||
def SetLastError(dwErrCode: ULONG) -> t.State: pass
|
||||
|
||||
def CloseHandle(hObject: HANDLE) -> BOOL | t.State: pass
|
||||
|
||||
def GetProcAddress(hModule: HANDLE, lpProcName: LPCSTR) -> VOIDPTR | t.State: pass
|
||||
|
||||
def GetModuleHandleA(lpModuleName: LPCSTR) -> HANDLE | t.State: pass
|
||||
|
||||
def GetModuleHandleW(lpModuleName: LPCWSTR) -> HANDLE | t.State: pass
|
||||
|
||||
def LoadLibraryA(lpLibFileName: LPCSTR) -> HANDLE | t.State: pass
|
||||
|
||||
def LoadLibraryW(lpLibFileName: LPCWSTR) -> HANDLE | t.State: pass
|
||||
|
||||
def FreeLibrary(hLibModule: HANDLE) -> BOOL | t.State: pass
|
||||
|
||||
def GetSystemTime(lpSystemTime: SYSTEMTIME | t.CPtr) -> t.State: pass
|
||||
|
||||
def GetLocalTime(lpSystemTime: SYSTEMTIME | t.CPtr) -> t.State: pass
|
||||
|
||||
def FileTimeToSystemTime(lpFileTime: FILETIME | t.CPtr, lpSystemTime: SYSTEMTIME | t.CPtr) -> BOOL | t.State: pass
|
||||
|
||||
def SystemTimeToFileTime(lpSystemTime: SYSTEMTIME | t.CPtr, lpFileTime: FILETIME | t.CPtr) -> BOOL | t.State: pass
|
||||
|
||||
def QueryPerformanceCounter(lpPerformanceCount: LARGE_INTEGER | t.CPtr) -> BOOL | t.State: pass
|
||||
|
||||
def QueryPerformanceFrequency(lpFrequency: LARGE_INTEGER | t.CPtr) -> BOOL | t.State: pass
|
||||
|
||||
def Sleep(dwMilliseconds: ULONG) -> t.State: pass
|
||||
|
||||
def SleepEx(dwMilliseconds: ULONG, bAlertable: BOOL) -> ULONG | t.State: pass
|
||||
|
||||
def GetTickCount() -> ULONG | t.State: pass
|
||||
|
||||
def GetTickCount64() -> ULONGLONG | t.State: pass
|
||||
|
||||
def GetCommandLineA() -> CHARPTR | t.State: pass
|
||||
20
Test/TestProject3/temp/90c53dd6db8d41cf.pyi
Normal file
20
Test/TestProject3/temp/90c53dd6db8d41cf.pyi
Normal file
@@ -0,0 +1,20 @@
|
||||
"""
|
||||
Auto-generated Python stub file from stdlib.py
|
||||
Module: stdlib
|
||||
"""
|
||||
|
||||
import c
|
||||
|
||||
|
||||
from stdint import *
|
||||
import t
|
||||
|
||||
def malloc(size: t.CSizeT) -> t.CVoid | t.CPtr | t.State: pass
|
||||
|
||||
def calloc(nmemb: t.CSizeT, size: t.CSizeT) -> t.CVoid | t.CPtr | t.State: pass
|
||||
|
||||
def realloc(p: t.CVoid | t.CPtr, size: t.CSizeT) -> t.CVoid | t.CPtr | t.State: pass
|
||||
|
||||
def free(p: t.CVoid | t.CPtr) -> t.State: pass
|
||||
|
||||
def system(cmd: t.CConst | t.CChar | t.CPtr) -> INT | t.State: pass
|
||||
53
Test/TestProject3/temp/93c1d18e35d188d6.pyi
Normal file
53
Test/TestProject3/temp/93c1d18e35d188d6.pyi
Normal file
@@ -0,0 +1,53 @@
|
||||
"""
|
||||
Auto-generated Python stub file from platmacro.py
|
||||
Module: platmacro
|
||||
"""
|
||||
|
||||
|
||||
import t, c
|
||||
|
||||
IS_WINDOWS: t.CDefine = 1
|
||||
IS_WIN64: t.CDefine = 1
|
||||
IS_X86_64: t.CDefine = 1
|
||||
IS_LP64: t.CDefine = 1
|
||||
IS_LITTLE_ENDIAN: t.CDefine = 1
|
||||
IS_LINUX: t.CDefine = 0
|
||||
IS_MACOS: t.CDefine = 0
|
||||
IS_ARM64: t.CDefine = 0
|
||||
IS_BIG_ENDIAN: t.CDefine = 0
|
||||
IS_ILP32: t.CDefine = 0
|
||||
PTR_SIZE: t.CDefine = t.CSizeT().Size
|
||||
INT_SIZE: t.CDefine = 4
|
||||
LONG_SIZE: t.CDefine = t.CLong().Size
|
||||
WORD_SIZE: t.CDefine = t.CSizeT().Size
|
||||
CACHE_LINE_SIZE: t.CDefine = 64
|
||||
PAGE_SIZE: t.CDefine = 4096
|
||||
STACK_ALIGN: t.CDefine = 16
|
||||
MAX_PATH_LEN: t.CDefine = 260
|
||||
PLATFORM_NAME: t.CDefine = 1
|
||||
ARCH_NAME: t.CDefine = 1
|
||||
WINVER: t.CDefine = 0x0A00
|
||||
_WIN32_WINNT: t.CDefine = 0x0A00
|
||||
NTDDI_VERSION: t.CDefine = 0x0A000006
|
||||
HAS_SSE2: t.CDefine = 1
|
||||
HAS_AVX: t.CDefine = 1
|
||||
HAS_AVX2: t.CDefine = 1
|
||||
HAS_FMA: t.CDefine = 1
|
||||
HAS_NEON: t.CDefine = 0
|
||||
ALIGNOF_INT: t.CDefine = 4
|
||||
ALIGNOF_LONG: t.CDefine = t.CLong().Size // 8
|
||||
ALIGNOF_PTR: t.CDefine = t.CSizeT().Size // 8
|
||||
ALIGNOF_DOUBLE: t.CDefine = 8
|
||||
ALIGNOF_LONG_DOUBLE: t.CDefine = 16
|
||||
SIZEOF_SHORT: t.CDefine = 2
|
||||
SIZEOF_INT: t.CDefine = 4
|
||||
SIZEOF_LONG: t.CDefine = t.CLong().Size // 8
|
||||
SIZEOF_LONG_LONG: t.CDefine = 8
|
||||
SIZEOF_FLOAT: t.CDefine = 4
|
||||
SIZEOF_DOUBLE: t.CDefine = 8
|
||||
SIZEOF_LONG_DOUBLE: t.CDefine = 16
|
||||
SIZEOF_POINTER: t.CDefine = t.CSizeT().Size // 8
|
||||
SIZEOF_SIZE_T: t.CDefine = t.CSizeT().Size // 8
|
||||
SIZEOF_PTRDIFF_T: t.CDefine = t.CPtrDiffT().Size // 8
|
||||
BYTE_ORDER_LE: t.CDefine = 1
|
||||
BYTE_ORDER_BE: t.CDefine = 0
|
||||
1
Test/TestProject3/temp/_phase1_manifest.json
Normal file
1
Test/TestProject3/temp/_phase1_manifest.json
Normal file
@@ -0,0 +1 @@
|
||||
{"D:\\Users\\TermiNexus\\Desktop\\TransPyC\\Test\\TestProject3\\App\\definetest.py": {"sha1": "64ac83614c9bdbc6", "mtime": 1781005527.138675, "size": 9399}, "D:\\Users\\TermiNexus\\Desktop\\TransPyC\\Test\\TestProject3\\App\\enumtest.py": {"sha1": "1b58766d38d05de3", "mtime": 1781025043.7585423, "size": 2094}, "D:\\Users\\TermiNexus\\Desktop\\TransPyC\\Test\\TestProject3\\App\\fileiotest.py": {"sha1": "c01b27dbcd683245", "mtime": 1781261000.2857711, "size": 12600}, "D:\\Users\\TermiNexus\\Desktop\\TransPyC\\Test\\TestProject3\\App\\main.py": {"sha1": "b235d6477436c524", "mtime": 1782110387.1454024, "size": 15478}, "D:\\Users\\TermiNexus\\Desktop\\TransPyC\\Test\\TestProject3\\App\\mpooltest.py": {"sha1": "0019c939aae7f9f1", "mtime": 1782828388.8033123, "size": 2789}, "D:\\Users\\TermiNexus\\Desktop\\TransPyC\\Test\\TestProject3\\App\\vectortest.py": {"sha1": "b777c587cc21465a", "mtime": 1782828416.8050296, "size": 1215}, "D:\\Users\\TermiNexus\\Desktop\\TransPyC\\includes\\atom.py": {"sha1": "271ea3decb810db2", "mtime": 1782226548.693161, "size": 1290}, "D:\\Users\\TermiNexus\\Desktop\\TransPyC\\includes\\memhub.py": {"sha1": "ee084e9fc6ee413a", "mtime": 1784214242.4485993, "size": 17765}, "D:\\Users\\TermiNexus\\Desktop\\TransPyC\\includes\\platmacro.py": {"sha1": "93c1d18e35d188d6", "mtime": 1781237231.03366, "size": 1422}, "D:\\Users\\TermiNexus\\Desktop\\TransPyC\\includes\\stdarg.py": {"sha1": "71e0a3ffcb3ebfad", "mtime": 1781258888.113146, "size": 277}, "D:\\Users\\TermiNexus\\Desktop\\TransPyC\\includes\\stdint.py": {"sha1": "f5522571bcce7bcb", "mtime": 1782383975.8824987, "size": 4356}, "D:\\Users\\TermiNexus\\Desktop\\TransPyC\\includes\\stdio.py": {"sha1": "6f62fe05c5ea1ceb", "mtime": 1783239556.0959673, "size": 714}, "D:\\Users\\TermiNexus\\Desktop\\TransPyC\\includes\\stdlib.py": {"sha1": "90c53dd6db8d41cf", "mtime": 1783874975.3597875, "size": 375}, "D:\\Users\\TermiNexus\\Desktop\\TransPyC\\includes\\string.py": {"sha1": "ab6e54ba9a669f76", "mtime": 1783933178.7264287, "size": 9922}, "D:\\Users\\TermiNexus\\Desktop\\TransPyC\\includes\\testcheck.py": {"sha1": "dd3002730623424b", "mtime": 1783927513.1159866, "size": 1818}, "D:\\Users\\TermiNexus\\Desktop\\TransPyC\\includes\\vector.py": {"sha1": "bf9813f6e3c9d351", "mtime": 1782826619.9232223, "size": 2141}, "D:\\Users\\TermiNexus\\Desktop\\TransPyC\\includes\\viperio.py": {"sha1": "c9f4be41ca1cc2b4", "mtime": 1782812279.506002, "size": 1556}, "D:\\Users\\TermiNexus\\Desktop\\TransPyC\\includes\\viperlib.py": {"sha1": "c3b259b4059f8668", "mtime": 1782821991.979496, "size": 56772}, "D:\\Users\\TermiNexus\\Desktop\\TransPyC\\includes\\w32\\fileio.py": {"sha1": "0035c95a18d4f8e8", "mtime": 1783747022.686592, "size": 14147}, "D:\\Users\\TermiNexus\\Desktop\\TransPyC\\includes\\w32\\win32base.py": {"sha1": "7e529fe7a078cfef", "mtime": 1782488356.7736557, "size": 2662}, "D:\\Users\\TermiNexus\\Desktop\\TransPyC\\includes\\w32\\win32console.py": {"sha1": "bbdf3bbd4c3bc28c", "mtime": 1781200703.5338137, "size": 5604}, "D:\\Users\\TermiNexus\\Desktop\\TransPyC\\includes\\w32\\win32file.py": {"sha1": "f6b51804a0ba8ff0", "mtime": 1782531158.744144, "size": 8424}}
|
||||
22
Test/TestProject3/temp/_sha1_map.txt
Normal file
22
Test/TestProject3/temp/_sha1_map.txt
Normal file
@@ -0,0 +1,22 @@
|
||||
0019c939aae7f9f1:mpooltest.py
|
||||
0035c95a18d4f8e8:includes/w32\fileio.py
|
||||
1b58766d38d05de3:enumtest.py
|
||||
271ea3decb810db2:includes/atom.py
|
||||
64ac83614c9bdbc6:definetest.py
|
||||
6f62fe05c5ea1ceb:includes/stdio.py
|
||||
71e0a3ffcb3ebfad:includes/stdarg.py
|
||||
7e529fe7a078cfef:includes/w32\win32base.py
|
||||
90c53dd6db8d41cf:includes/stdlib.py
|
||||
93c1d18e35d188d6:includes/platmacro.py
|
||||
ab6e54ba9a669f76:includes/string.py
|
||||
b235d6477436c524:main.py
|
||||
b777c587cc21465a:vectortest.py
|
||||
bbdf3bbd4c3bc28c:includes/w32\win32console.py
|
||||
bf9813f6e3c9d351:includes/vector.py
|
||||
c01b27dbcd683245:fileiotest.py
|
||||
c3b259b4059f8668:includes/viperlib.py
|
||||
c9f4be41ca1cc2b4:includes/viperio.py
|
||||
dd3002730623424b:includes/testcheck.py
|
||||
ee084e9fc6ee413a:includes/memhub.py
|
||||
f5522571bcce7bcb:includes/stdint.py
|
||||
f6b51804a0ba8ff0:includes/w32\win32file.py
|
||||
BIN
Test/TestProject3/temp/_shared_sym.json
Normal file
BIN
Test/TestProject3/temp/_shared_sym.json
Normal file
Binary file not shown.
48
Test/TestProject3/temp/ab6e54ba9a669f76.pyi
Normal file
48
Test/TestProject3/temp/ab6e54ba9a669f76.pyi
Normal file
@@ -0,0 +1,48 @@
|
||||
"""
|
||||
Auto-generated Python stub file from string.py
|
||||
Module: string
|
||||
"""
|
||||
|
||||
|
||||
from stdint import *
|
||||
import t, c
|
||||
|
||||
def strcpy(dest: str, src: str) -> str: pass
|
||||
|
||||
def strcat(dest: str, src: str) -> str: pass
|
||||
|
||||
def strncpy(dest: str, src: str, n: t.CSizeT) -> str: pass
|
||||
|
||||
def strlen(src: str) -> t.CSizeT | t.CExport: pass
|
||||
|
||||
def strcmp(str1: str, str2: str) -> t.CInt: pass
|
||||
|
||||
def samestr(str1: str, str2: str) -> bool: pass
|
||||
|
||||
def strncmp(str1: str, str2: str, n: t.CSizeT) -> t.CInt: pass
|
||||
|
||||
def memcmp(ptr1: t.CVoid | t.CPtr, ptr2: t.CVoid | t.CPtr, n: t.CSizeT) -> t.CInt: pass
|
||||
|
||||
def strchr(s: str, cr: t.CInt) -> str: pass
|
||||
|
||||
def strrchr(s: str, cr: t.CInt) -> str: pass
|
||||
|
||||
def strstr(s: str, needle: str) -> str: pass
|
||||
|
||||
def strspn(s: str, skip: str) -> int: pass
|
||||
|
||||
def memset(ptr: t.CVoid | t.CPtr, value: t.CInt, num: t.CSizeT) -> t.CVoid | t.CPtr | t.CExport: pass
|
||||
|
||||
def memset32(ptr: t.CVoid | t.CPtr, value: t.CUInt32T, count: t.CSizeT) -> t.CVoid | t.CPtr: pass
|
||||
|
||||
def memcpy(dest: t.CVoid | t.CPtr, src: t.CVoid | t.CPtr, num: t.CSizeT) -> t.CVoid | t.CPtr | t.CExport: pass
|
||||
|
||||
def memmove(dest: t.CVoid | t.CPtr, src: t.CVoid | t.CPtr, num: t.CSizeT) -> t.CVoid | t.CPtr: pass
|
||||
|
||||
def atoi(src: str) -> t.CInt: pass
|
||||
|
||||
def atoll(src: str) -> t.CInt64T: pass
|
||||
|
||||
def atof(src: str) -> t.CDouble: pass
|
||||
|
||||
def split(s: str, delim: str, result: t.CArray[str]) -> int: pass
|
||||
1
Test/TestProject3/temp/b235d6477436c524.doc.json
Normal file
1
Test/TestProject3/temp/b235d6477436c524.doc.json
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
131
Test/TestProject3/temp/b235d6477436c524.pyi
Normal file
131
Test/TestProject3/temp/b235d6477436c524.pyi
Normal file
@@ -0,0 +1,131 @@
|
||||
"""
|
||||
Auto-generated Python stub file from main.py
|
||||
Module: main
|
||||
"""
|
||||
|
||||
|
||||
from stdint import *
|
||||
import w32.win32console
|
||||
import t, c
|
||||
from t import CInt, CPtr, CChar, CInt32T, CUInt64T, CFloat64T, CExport, State
|
||||
import viperlib
|
||||
import stdlib
|
||||
import definetest
|
||||
import enumtest
|
||||
import mpooltest
|
||||
import vectortest
|
||||
import fileiotest
|
||||
import testcheck
|
||||
|
||||
def add[T](a: T, b: T) -> T: pass
|
||||
|
||||
def add_u64[T](a: T, b: T, c: CUInt64T) -> T: pass
|
||||
|
||||
def fxi[T1, T2](a: T1, b: T2) -> T1: pass
|
||||
|
||||
def fxi2[T1, T2, T3](a: T1, b: T2, c: T3) -> T1: pass
|
||||
|
||||
def wrap_add[T](a: T, b: T) -> T: pass
|
||||
|
||||
def double_add[T](a: T, b: T) -> T: pass
|
||||
|
||||
|
||||
class A[T]:
|
||||
def __init__(self: A, a: T) -> t.CInt: pass
|
||||
def get_a(self: A) -> T: pass
|
||||
class Pair[T1, T2]:
|
||||
def __init__(self: Pair, first: T1, second: T2) -> t.CInt: pass
|
||||
def get_first(self: Pair) -> T1: pass
|
||||
def get_second(self: Pair) -> T2: pass
|
||||
class Calculator[T]:
|
||||
def __init__(self: Calculator, init_val: T) -> t.CInt: pass
|
||||
def compute(self: Calculator, other: T) -> T: pass
|
||||
def double_compute(self: Calculator, other: T) -> T: pass
|
||||
class Container[T]:
|
||||
def __init__(self: Container, v: T) -> t.CInt: pass
|
||||
def get_value(self: Container) -> T: pass
|
||||
def get_flag(self: Container) -> CInt32T: pass
|
||||
@t.CVTable
|
||||
class Shape:
|
||||
def __init__(self: Shape, x: CFloat64T, y: CFloat64T) -> t.CInt: pass
|
||||
def area(self: Shape) -> CFloat64T: pass
|
||||
def perimeter(self: Shape) -> CFloat64T: pass
|
||||
def describe(self: Shape) -> CFloat64T: pass
|
||||
@t.CVTable
|
||||
class Circle(Shape):
|
||||
def __init__(self: Circle, x: CFloat64T, y: CFloat64T, r: CFloat64T) -> t.CInt: pass
|
||||
def area(self: Circle) -> CFloat64T: pass
|
||||
def perimeter(self: Circle) -> CFloat64T: pass
|
||||
def scale(self: Circle, factor: CFloat64T) -> 'Circle' | CPtr: pass
|
||||
def move(self: Circle, dx: CFloat64T, dy: CFloat64T) -> 'Circle' | CPtr: pass
|
||||
@t.CVTable
|
||||
class Rect(Shape):
|
||||
def __init__(self: Rect, x: CFloat64T, y: CFloat64T, w: CFloat64T, h: CFloat64T) -> t.CInt: pass
|
||||
def area(self: Rect) -> CFloat64T: pass
|
||||
def perimeter(self: Rect) -> CFloat64T: pass
|
||||
def scale(self: Rect, factor: CFloat64T) -> 'Rect' | CPtr: pass
|
||||
class Vec2:
|
||||
x: CFloat64T
|
||||
y: CFloat64T
|
||||
def __new__() -> 'Vec2' | CPtr: pass
|
||||
def __init__(self: Vec2, x: CFloat64T, y: CFloat64T) -> t.CInt: pass
|
||||
def __add__(self: Vec2, b: 'Vec2' | CPtr) -> 'Vec2' | CPtr: pass
|
||||
def __sub__(self: Vec2, b: 'Vec2' | CPtr) -> 'Vec2' | CPtr: pass
|
||||
def __mul__(self: Vec2, s: CFloat64T) -> 'Vec2' | CPtr: pass
|
||||
def __neg__(self: Vec2) -> 'Vec2' | CPtr: pass
|
||||
def dot(self: Vec2, b: 'Vec2' | CPtr) -> CFloat64T: pass
|
||||
def len_sq(self: Vec2) -> CFloat64T: pass
|
||||
class Vec3:
|
||||
x: CFloat64T
|
||||
y: CFloat64T
|
||||
z: CFloat64T
|
||||
def __new__() -> 'Vec3' | CPtr: pass
|
||||
def __init__(self: Vec3, x: CFloat64T, y: CFloat64T, z: CFloat64T) -> t.CInt: pass
|
||||
def __add__(self: Vec3, b: 'Vec3' | CPtr) -> 'Vec3' | CPtr: pass
|
||||
def __sub__(self: Vec3, b: 'Vec3' | CPtr) -> 'Vec3' | CPtr: pass
|
||||
def __mul__(self: Vec3, s: CFloat64T) -> 'Vec3' | CPtr: pass
|
||||
def __neg__(self: Vec3) -> 'Vec3' | CPtr: pass
|
||||
def dot(self: Vec3, b: 'Vec3' | CPtr) -> CFloat64T: pass
|
||||
def cross(self: Vec3, b: 'Vec3' | CPtr) -> 'Vec3' | CPtr: pass
|
||||
def len_sq(self: Vec3) -> CFloat64T: pass
|
||||
@t.CVTable
|
||||
class Dog:
|
||||
def __init__(self: Dog, name_val: CInt, bark_power: CInt32T) -> t.CInt: pass
|
||||
def speak(self: Dog) -> CInt: pass
|
||||
def bite(self: Dog) -> CInt32T: pass
|
||||
def take_damage(self: Dog, dmg: CInt32T) -> 'Dog' | CPtr: pass
|
||||
def is_alive(self: Dog) -> CInt: pass
|
||||
@t.CVTable
|
||||
class Cat:
|
||||
def __init__(self: Cat, name_val: CInt, lives: CInt32T) -> t.CInt: pass
|
||||
def speak(self: Cat) -> CInt: pass
|
||||
def scratch(self: Cat) -> CInt32T: pass
|
||||
def take_damage(self: Cat, dmg: CInt32T) -> 'Cat' | CPtr: pass
|
||||
def is_alive(self: Cat) -> CInt: pass
|
||||
class Transform:
|
||||
px: CFloat64T
|
||||
py: CFloat64T
|
||||
pz: CFloat64T
|
||||
scale_x: CFloat64T
|
||||
scale_y: CFloat64T
|
||||
scale_z: CFloat64T
|
||||
def __new__() -> 'Transform' | CPtr: pass
|
||||
def __init__(self: Transform, px: CFloat64T, py: CFloat64T, pz: CFloat64T) -> t.CInt: pass
|
||||
def apply_scale(self: Transform, sx: CFloat64T, sy: CFloat64T, sz: CFloat64T) -> 'Transform' | CPtr: pass
|
||||
def world_position(self: Transform) -> 'Vec3' | CPtr: pass
|
||||
@t.CVTable
|
||||
class Vehicle:
|
||||
def __init__(self: Vehicle, speed: CInt32T) -> t.CInt: pass
|
||||
def move(self: Vehicle) -> CInt: pass
|
||||
def is_running(self: Vehicle) -> CInt: pass
|
||||
@t.CVTable
|
||||
class Car(Vehicle):
|
||||
def __init__(self: Car, speed: CInt32T, doors: CInt32T) -> t.CInt: pass
|
||||
def honk(self: Car) -> CInt: pass
|
||||
@t.CVTable
|
||||
class ElectricCar(Car):
|
||||
def __init__(self: ElectricCar, speed: CInt32T, doors: CInt32T, battery: CInt32T) -> t.CInt: pass
|
||||
def charge(self: ElectricCar) -> t.CInt: pass
|
||||
def move(self: ElectricCar) -> CInt: pass
|
||||
|
||||
def main() -> CInt | CExport: pass
|
||||
1
Test/TestProject3/temp/b777c587cc21465a.doc.json
Normal file
1
Test/TestProject3/temp/b777c587cc21465a.doc.json
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
16
Test/TestProject3/temp/b777c587cc21465a.pyi
Normal file
16
Test/TestProject3/temp/b777c587cc21465a.pyi
Normal file
@@ -0,0 +1,16 @@
|
||||
"""
|
||||
Auto-generated Python stub file from vectortest.py
|
||||
Module: vectortest
|
||||
"""
|
||||
|
||||
|
||||
import t, c
|
||||
from t import CInt, CPtr, CChar, CFloat64T
|
||||
import viperlib
|
||||
import stdlib
|
||||
import vector
|
||||
import memhub
|
||||
|
||||
POOL_SIZE: t.CDefine = 4096
|
||||
|
||||
def vector_main() -> CInt: pass
|
||||
138
Test/TestProject3/temp/bbdf3bbd4c3bc28c.pyi
Normal file
138
Test/TestProject3/temp/bbdf3bbd4c3bc28c.pyi
Normal file
@@ -0,0 +1,138 @@
|
||||
"""
|
||||
Auto-generated Python stub file from w32.win32console.py
|
||||
Module: w32.win32console
|
||||
"""
|
||||
|
||||
import c
|
||||
|
||||
|
||||
import t
|
||||
from stdint import *
|
||||
from w32.win32base import *
|
||||
|
||||
ENABLE_PROCESSED_INPUT: t.CDefine = 0x0001
|
||||
ENABLE_LINE_INPUT: t.CDefine = 0x0002
|
||||
ENABLE_ECHO_INPUT: t.CDefine = 0x0004
|
||||
ENABLE_WINDOW_INPUT: t.CDefine = 0x0008
|
||||
ENABLE_MOUSE_INPUT: t.CDefine = 0x0010
|
||||
ENABLE_INSERT_MODE: t.CDefine = 0x0020
|
||||
ENABLE_QUICK_EDIT_MODE: t.CDefine = 0x0040
|
||||
ENABLE_EXTENDED_FLAGS: t.CDefine = 0x0080
|
||||
ENABLE_PROCESSED_OUTPUT: t.CDefine = 0x0001
|
||||
ENABLE_WRAP_AT_EOL_OUTPUT: t.CDefine = 0x0002
|
||||
ENABLE_VIRTUAL_TERMINAL_PROCESSING: t.CDefine = 0x0004
|
||||
DISABLE_NEWLINE_AUTO_RETURN: t.CDefine = 0x0008
|
||||
ENABLE_LVB_GRID_WORLDWIDE: t.CDefine = 0x0010
|
||||
FOREGROUND_BLUE: t.CDefine = 0x0001
|
||||
FOREGROUND_GREEN: t.CDefine = 0x0002
|
||||
FOREGROUND_RED: t.CDefine = 0x0004
|
||||
FOREGROUND_INTENSITY: t.CDefine = 0x0008
|
||||
BACKGROUND_BLUE: t.CDefine = 0x0010
|
||||
BACKGROUND_GREEN: t.CDefine = 0x0020
|
||||
BACKGROUND_RED: t.CDefine = 0x0040
|
||||
BACKGROUND_INTENSITY: t.CDefine = 0x0080
|
||||
KEY_EVENT: t.CDefine = 0x0001
|
||||
MOUSE_EVENT: t.CDefine = 0x0002
|
||||
WINDOW_BUFFER_SIZE_EVENT: t.CDefine = 0x0004
|
||||
MENU_EVENT: t.CDefine = 0x0008
|
||||
FOCUS_EVENT: t.CDefine = 0x0010
|
||||
|
||||
class COORD:
|
||||
X: SHORT
|
||||
Y: SHORT
|
||||
class SMALL_RECT:
|
||||
Left: SHORT
|
||||
Top: SHORT
|
||||
Right: SHORT
|
||||
Bottom: SHORT
|
||||
class CONSOLE_SCREEN_BUFFER_INFO:
|
||||
dwSize: COORD
|
||||
dwCursorPosition: COORD
|
||||
wAttributes: WORD
|
||||
srWindow: SMALL_RECT
|
||||
dwMaximumWindowSize: COORD
|
||||
class CONSOLE_CURSOR_INFO:
|
||||
dwSize: ULONG
|
||||
bVisible: BOOL
|
||||
class CHAR_INFO:
|
||||
UnicodeChar: WCHAR
|
||||
Attributes: WORD
|
||||
class KEY_EVENT_RECORD:
|
||||
bKeyDown: BOOL
|
||||
wRepeatCount: WORD
|
||||
wVirtualKeyCode: WORD
|
||||
wVirtualScanCode: WORD
|
||||
uChar: WCHAR
|
||||
dwControlKeyState: ULONG
|
||||
class MOUSE_EVENT_RECORD:
|
||||
dwMousePosition: COORD
|
||||
dwButtonState: ULONG
|
||||
dwControlKeyState: ULONG
|
||||
dwEventFlags: ULONG
|
||||
class WINDOW_BUFFER_SIZE_RECORD:
|
||||
dwSize: COORD
|
||||
class INPUT_RECORD:
|
||||
EventType: WORD
|
||||
Event: KEY_EVENT_RECORD
|
||||
|
||||
def SetConsoleOutputCP(codepage: UINT) -> BOOL | t.State: pass
|
||||
|
||||
def SetConsoleCP(codepage: UINT) -> BOOL | t.State: pass
|
||||
|
||||
def GetConsoleCP() -> UINT | t.State: pass
|
||||
|
||||
def GetConsoleOutputCP() -> UINT | t.State: pass
|
||||
|
||||
def GetConsoleScreenBufferInfo(hConsoleOutput: HANDLE, lpConsoleScreenBufferInfo: CONSOLE_SCREEN_BUFFER_INFO | t.CPtr) -> BOOL | t.State: pass
|
||||
|
||||
def SetConsoleScreenBufferSize(hConsoleOutput: HANDLE, dwSize: COORD) -> BOOL | t.State: pass
|
||||
|
||||
def SetConsoleCursorPosition(hConsoleOutput: HANDLE, dwCursorPosition: COORD) -> BOOL | t.State: pass
|
||||
|
||||
def GetConsoleCursorInfo(hConsoleOutput: HANDLE, lpConsoleCursorInfo: CONSOLE_CURSOR_INFO | t.CPtr) -> BOOL | t.State: pass
|
||||
|
||||
def SetConsoleCursorInfo(hConsoleOutput: HANDLE, lpConsoleCursorInfo: CONSOLE_CURSOR_INFO | t.CPtr) -> BOOL | t.State: pass
|
||||
|
||||
def SetConsoleTextAttribute(hConsoleOutput: HANDLE, wAttributes: WORD) -> BOOL | t.State: pass
|
||||
|
||||
def FillConsoleOutputCharacterA(hConsoleOutput: HANDLE, cCharacter: t.CChar, nLength: ULONG, dwWriteCoord: COORD, lpNumberOfCharsWritten: ULONG | t.CPtr) -> BOOL | t.State: pass
|
||||
|
||||
def FillConsoleOutputCharacterW(hConsoleOutput: HANDLE, cCharacter: WCHAR, nLength: ULONG, dwWriteCoord: COORD, lpNumberOfCharsWritten: ULONG | t.CPtr) -> BOOL | t.State: pass
|
||||
|
||||
def FillConsoleOutputAttribute(hConsoleOutput: HANDLE, wAttribute: WORD, nLength: ULONG, dwWriteCoord: COORD, lpNumberOfAttrsWritten: ULONG | t.CPtr) -> BOOL | t.State: pass
|
||||
|
||||
def WriteConsoleA(hConsoleOutput: HANDLE, lpBuffer: t.CConst | VOIDPTR, nNumberOfCharsToWrite: ULONG, lpNumberOfCharsWritten: ULONG | t.CPtr, lpReserved: VOIDPTR) -> BOOL | t.State: pass
|
||||
|
||||
def WriteConsoleW(hConsoleOutput: HANDLE, lpBuffer: t.CConst | VOIDPTR, nNumberOfCharsToWrite: ULONG, lpNumberOfCharsWritten: ULONG | t.CPtr, lpReserved: VOIDPTR) -> BOOL | t.State: pass
|
||||
|
||||
def ReadConsoleA(hConsoleInput: HANDLE, lpBuffer: VOIDPTR, nNumberOfCharsToRead: ULONG, lpNumberOfCharsRead: ULONG | t.CPtr, pInputControl: VOIDPTR) -> BOOL | t.State: pass
|
||||
|
||||
def ReadConsoleW(hConsoleInput: HANDLE, lpBuffer: VOIDPTR, nNumberOfCharsToRead: ULONG, lpNumberOfCharsRead: ULONG | t.CPtr, pInputControl: VOIDPTR) -> BOOL | t.State: pass
|
||||
|
||||
def GetConsoleMode(hConsoleHandle: HANDLE, lpMode: ULONG | t.CPtr) -> BOOL | t.State: pass
|
||||
|
||||
def SetConsoleMode(hConsoleHandle: HANDLE, dwMode: ULONG) -> BOOL | t.State: pass
|
||||
|
||||
def ReadConsoleInputA(hConsoleInput: HANDLE, lpBuffer: INPUT_RECORD | t.CPtr, nLength: ULONG, lpNumberOfEventsRead: ULONG | t.CPtr) -> BOOL | t.State: pass
|
||||
|
||||
def ReadConsoleInputW(hConsoleInput: HANDLE, lpBuffer: INPUT_RECORD | t.CPtr, nLength: ULONG, lpNumberOfEventsRead: ULONG | t.CPtr) -> BOOL | t.State: pass
|
||||
|
||||
def GetNumberOfConsoleInputEvents(hConsoleInput: HANDLE, lpNumberOfEvents: ULONG | t.CPtr) -> BOOL | t.State: pass
|
||||
|
||||
def FlushConsoleInputBuffer(hConsoleInput: HANDLE) -> BOOL | t.State: pass
|
||||
|
||||
def SetConsoleTitleA(lpConsoleTitle: LPCSTR) -> BOOL | t.State: pass
|
||||
|
||||
def SetConsoleTitleW(lpConsoleTitle: LPCWSTR) -> BOOL | t.State: pass
|
||||
|
||||
def GetConsoleTitleA(lpConsoleTitle: CHARPTR, nSize: ULONG) -> ULONG | t.State: pass
|
||||
|
||||
def GetConsoleTitleW(lpConsoleTitle: WCHARPTR, nSize: ULONG) -> ULONG | t.State: pass
|
||||
|
||||
def AllocConsole() -> BOOL | t.State: pass
|
||||
|
||||
def FreeConsole() -> BOOL | t.State: pass
|
||||
|
||||
def SetConsoleWindowInfo(hConsoleOutput: HANDLE, bAbsolute: BOOL, lpConsoleWindow: SMALL_RECT | t.CPtr) -> BOOL | t.State: pass
|
||||
|
||||
def ScrollConsoleScreenBufferA(hConsoleOutput: HANDLE, lpScrollRectangle: SMALL_RECT | t.CPtr, lpClipRectangle: SMALL_RECT | t.CPtr, dwDestinationOrigin: COORD, lpFill: CHAR_INFO | t.CPtr) -> BOOL | t.State: pass
|
||||
24
Test/TestProject3/temp/bf9813f6e3c9d351.pyi
Normal file
24
Test/TestProject3/temp/bf9813f6e3c9d351.pyi
Normal file
@@ -0,0 +1,24 @@
|
||||
"""
|
||||
Auto-generated Python stub file from vector.py
|
||||
Module: vector
|
||||
"""
|
||||
|
||||
|
||||
import t, c
|
||||
from stdint import *
|
||||
import memhub
|
||||
|
||||
class Vector[T]:
|
||||
data: t.CVoid | t.CPtr
|
||||
length: t.CSizeT
|
||||
capacity: t.CSizeT
|
||||
elem_size: t.CSizeT
|
||||
pool: memhub.MemManager | t.CPtr
|
||||
def __init__(self: Vector, pool: memhub.MemManager | t.CPtr, capacity: t.CSizeT, _hint: T) -> t.CInt: pass
|
||||
def push(self: Vector, value: T) -> t.CInt: pass
|
||||
def _grow(self: Vector) -> t.CInt: pass
|
||||
def get(self: Vector, index: t.CSizeT) -> T: pass
|
||||
def set(self: Vector, index: t.CSizeT, value: T) -> t.CInt: pass
|
||||
def len(self: Vector) -> t.CSizeT: pass
|
||||
def clear(self: Vector) -> t.CInt: pass
|
||||
def free(self: Vector) -> t.CInt: pass
|
||||
1
Test/TestProject3/temp/c01b27dbcd683245.doc.json
Normal file
1
Test/TestProject3/temp/c01b27dbcd683245.doc.json
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
30
Test/TestProject3/temp/c01b27dbcd683245.pyi
Normal file
30
Test/TestProject3/temp/c01b27dbcd683245.pyi
Normal file
@@ -0,0 +1,30 @@
|
||||
"""
|
||||
Auto-generated Python stub file from fileiotest.py
|
||||
Module: fileiotest
|
||||
"""
|
||||
|
||||
|
||||
import t, c
|
||||
from t import CInt, CInt32T, CUInt32T, CPtr, CChar, CExport
|
||||
from stdint import *
|
||||
import stdlib
|
||||
import viperlib
|
||||
import w32.win32base
|
||||
import w32.win32file
|
||||
import w32.win32console
|
||||
import w32.fileio
|
||||
from w32.fileio import File, FileW, MODE, FRESULT, SEEK_SET, SEEK_CUR, SEEK_END
|
||||
|
||||
BUF_SIZE: t.CDefine = 4096
|
||||
|
||||
def fileio_main() -> t.CInt: pass
|
||||
|
||||
def fileio_with_test() -> t.CInt: pass
|
||||
|
||||
def fileio_handle_test() -> t.CInt: pass
|
||||
|
||||
def fileio_rw_test() -> t.CInt: pass
|
||||
|
||||
def fileio_wide_test() -> t.CInt: pass
|
||||
|
||||
def fileio_chinese_test() -> t.CInt: pass
|
||||
23
Test/TestProject3/temp/c3b259b4059f8668.pyi
Normal file
23
Test/TestProject3/temp/c3b259b4059f8668.pyi
Normal file
@@ -0,0 +1,23 @@
|
||||
"""
|
||||
Auto-generated Python stub file from viperlib.py
|
||||
Module: viperlib
|
||||
"""
|
||||
|
||||
|
||||
import t, c
|
||||
import viperio
|
||||
from stdarg import arg, va_arg
|
||||
|
||||
TEMP_BUF_SIZE: t.CDefine = 68
|
||||
|
||||
def get_digit_count(num: t.CUnsignedInt, base: t.CInt) -> t.CStatic | t.CInt: pass
|
||||
|
||||
def sprintf(buf: t.CChar | t.CPtr, rule: str, *args) -> t.CVoid | t.CExport: pass
|
||||
|
||||
def vsprintf(buf: t.CChar | t.CPtr, rule: str, *args) -> t.CInt: pass
|
||||
|
||||
def snprintf(buf: t.CChar | t.CPtr, size: t.CSizeT, fmt: str, *args) -> t.CInt | t.CExport: pass
|
||||
|
||||
def _check_special_float(fv: t.CDouble) -> t.CInt: pass
|
||||
|
||||
def vsnprintf(buf: t.CChar | t.CPtr, size: t.CSizeT, fmt: str, ap: t.CChar | t.CPtr) -> t.CInt | t.CExport: pass
|
||||
22
Test/TestProject3/temp/c9f4be41ca1cc2b4.pyi
Normal file
22
Test/TestProject3/temp/c9f4be41ca1cc2b4.pyi
Normal file
@@ -0,0 +1,22 @@
|
||||
"""
|
||||
Auto-generated Python stub file from viperio.py
|
||||
Module: viperio
|
||||
"""
|
||||
|
||||
|
||||
import t, c
|
||||
from stdint import *
|
||||
|
||||
class Buf:
|
||||
data: t.CChar | t.CPtr
|
||||
length: t.CSizeT
|
||||
capacity: t.CSizeT
|
||||
owned: bool
|
||||
def __init__(self: Buf, data: t.CChar | t.CPtr, capacity: t.CSizeT, length: t.CSizeT, owned: bool) -> t.CInt: pass
|
||||
def clear(self: Buf) -> t.CInt: pass
|
||||
def write(self: Buf, src: t.CChar | t.CPtr, count: t.CSizeT) -> t.CSizeT: pass
|
||||
def cstr(self: Buf) -> t.CChar | t.CPtr: pass
|
||||
def reset(self: Buf) -> t.CInt: pass
|
||||
def __enter__(self: Buf) -> 'Buf' | t.CPtr: pass
|
||||
def __exit__(self: Buf) -> t.CInt: pass
|
||||
def free(self: Buf) -> t.CInt: pass
|
||||
31
Test/TestProject3/temp/dd3002730623424b.pyi
Normal file
31
Test/TestProject3/temp/dd3002730623424b.pyi
Normal file
@@ -0,0 +1,31 @@
|
||||
"""
|
||||
Auto-generated Python stub file from testcheck.py
|
||||
Module: testcheck
|
||||
"""
|
||||
|
||||
|
||||
import t, c
|
||||
import stdio
|
||||
from w32.win32console import SetConsoleOutputCP, SetConsoleCP
|
||||
|
||||
CP_UTF8: t.CDefine = 65001
|
||||
_pass_count: t.CExtern | t.CInt
|
||||
_fail_count: t.CExtern | t.CInt
|
||||
_total_pass: t.CExtern | t.CInt
|
||||
_total_fail: t.CExtern | t.CInt
|
||||
|
||||
def begin(name: str) -> t.CInt: pass
|
||||
|
||||
def section(name: str) -> t.CInt: pass
|
||||
|
||||
def ok(msg: str) -> t.CInt: pass
|
||||
|
||||
def fail(msg: str) -> t.CInt: pass
|
||||
|
||||
def check(cond: t.CInt, ok_msg: str, fail_msg: str) -> t.CInt: pass
|
||||
|
||||
def info(msg: str) -> t.CInt: pass
|
||||
|
||||
def end() -> t.CInt: pass
|
||||
|
||||
def summary() -> t.CInt: pass
|
||||
81
Test/TestProject3/temp/ee084e9fc6ee413a.pyi
Normal file
81
Test/TestProject3/temp/ee084e9fc6ee413a.pyi
Normal file
@@ -0,0 +1,81 @@
|
||||
"""
|
||||
Auto-generated Python stub file from memhub.py
|
||||
Module: memhub
|
||||
"""
|
||||
|
||||
|
||||
import t, c
|
||||
from stdint import *
|
||||
import string
|
||||
import atom
|
||||
import viperio
|
||||
|
||||
MEMHUB_ALIGN: t.CDefine = 8
|
||||
MEMSLAB_MIN_BLOCK: t.CDefine = 16
|
||||
MEMSLAB_BITMAP_BYTES: t.CDefine = 256
|
||||
MEMBUDDY_MIN_BLOCK: t.CDefine = 32
|
||||
MEMBUDDY_MAX_ORDERS: t.CDefine = 32
|
||||
MEMBUDDY_HEADER_SIZE: t.CDefine = 8
|
||||
|
||||
def _align_up(val: t.CSizeT, align: t.CSizeT) -> t.CSizeT: pass
|
||||
|
||||
def _largest_pow2_le(val: t.CSizeT) -> t.CSizeT: pass
|
||||
|
||||
def _block_size_at_order(order: t.CInt) -> t.CSizeT: pass
|
||||
|
||||
|
||||
@t.CVTable
|
||||
class MemManager:
|
||||
__provides__: list[str] = ['__memmgr__']
|
||||
base: t.CVoid | t.CPtr
|
||||
size: t.CSizeT
|
||||
def __init__(self: MemManager, base: t.CVoid | t.CPtr, size: t.CSizeT) -> t.CInt: pass
|
||||
def alloc(self: MemManager, size: t.CSizeT) -> t.CVoid | t.CPtr: pass
|
||||
def free(self: MemManager, ptr: t.CVoid | t.CPtr) -> t.CInt: pass
|
||||
def reset(self: MemManager) -> t.CInt: pass
|
||||
def calloc(self: MemManager, count: t.CSizeT, size: t.CSizeT) -> t.CVoid | t.CPtr: pass
|
||||
def realloc(self: MemManager, ptr: t.CVoid | t.CPtr, old_size: t.CSizeT, new_size: t.CSizeT) -> t.CVoid | t.CPtr: pass
|
||||
def __enter__(self: MemManager) -> 'MemManager' | t.CPtr: pass
|
||||
def __exit__(self: MemManager) -> t.CInt: pass
|
||||
def alloc_buf(self: MemManager, capacity: t.CSizeT) -> viperio.Buf | t.CPtr: pass
|
||||
class MemPool(MemManager):
|
||||
offset: t.CSizeT
|
||||
high_water: t.CSizeT
|
||||
def __init__(self: MemPool, base: t.CVoid | t.CPtr, size: t.CSizeT) -> t.CInt: pass
|
||||
def alloc(self: MemPool, size: t.CSizeT) -> t.CVoid | t.CPtr: pass
|
||||
def free(self: MemPool, ptr: t.CVoid | t.CPtr) -> t.CInt: pass
|
||||
def reset(self: MemPool) -> t.CInt: pass
|
||||
class MemSlab(MemManager):
|
||||
block_size: t.CSizeT
|
||||
block_count: t.CSizeT
|
||||
used_count: t.CSizeT
|
||||
free_list: t.CVoid | t.CPtr
|
||||
alloc_map: t.CUInt8T | t.CPtr
|
||||
alloc_map_size: t.CSizeT
|
||||
usable: t.CVoid | t.CPtr
|
||||
usable_size: t.CSizeT
|
||||
def __init__(self: MemSlab, base: t.CVoid | t.CPtr, size: t.CSizeT, block_size: t.CSizeT) -> t.CInt: pass
|
||||
def alloc(self: MemSlab, size: t.CSizeT) -> t.CVoid | t.CPtr: pass
|
||||
def free(self: MemSlab, ptr: t.CVoid | t.CPtr) -> t.CInt: pass
|
||||
def reset(self: MemSlab) -> t.CInt: pass
|
||||
class MemBuddy(MemManager):
|
||||
max_order: t.CInt
|
||||
free_lists: t.CUInt64T | t.CPtr
|
||||
lock_val: t.CVolatile | t.CInt
|
||||
usable: t.CVoid | t.CPtr
|
||||
usable_size: t.CSizeT
|
||||
def __init__(self: MemBuddy, base: t.CVoid | t.CPtr, size: t.CSizeT) -> t.CInt: pass
|
||||
def _fl_push(self: MemBuddy, order: t.CInt, block: t.CVoid | t.CPtr) -> t.CInt: pass
|
||||
def _fl_pop(self: MemBuddy, order: t.CInt) -> t.CVoid | t.CPtr: pass
|
||||
def _fl_find_and_remove(self: MemBuddy, order: t.CInt, target: t.CVoid | t.CPtr) -> t.CInt: pass
|
||||
def _buddy_of(self: MemBuddy, block: t.CVoid | t.CPtr, order: t.CInt) -> t.CVoid | t.CPtr: pass
|
||||
def _order_for_size(self: MemBuddy, size: t.CSizeT) -> t.CInt: pass
|
||||
def _split_to_order(self: MemBuddy, to_order: t.CInt) -> t.CVoid | t.CPtr: pass
|
||||
def _coalesce(self: MemBuddy, block: t.CVoid | t.CPtr, order: t.CInt) -> t.CInt: pass
|
||||
def _is_valid_ptr(self: MemBuddy, ptr: t.CVoid | t.CPtr) -> t.CInt: pass
|
||||
def _lock(self: MemBuddy) -> t.CInt: pass
|
||||
def _unlock(self: MemBuddy) -> t.CInt: pass
|
||||
def alloc(self: MemBuddy, size: t.CSizeT) -> t.CVoid | t.CPtr: pass
|
||||
def free(self: MemBuddy, ptr: t.CVoid | t.CPtr) -> t.CInt: pass
|
||||
def reset(self: MemBuddy) -> t.CInt: pass
|
||||
def realloc(self: MemBuddy, ptr: t.CVoid | t.CPtr, old_size: t.CSizeT, new_size: t.CSizeT) -> t.CVoid | t.CPtr: pass
|
||||
100
Test/TestProject3/temp/f5522571bcce7bcb.pyi
Normal file
100
Test/TestProject3/temp/f5522571bcce7bcb.pyi
Normal file
@@ -0,0 +1,100 @@
|
||||
"""
|
||||
Auto-generated Python stub file from stdint.py
|
||||
Module: stdint
|
||||
"""
|
||||
|
||||
import c
|
||||
|
||||
|
||||
import t
|
||||
|
||||
INT: t.CTypedef = t.CInt
|
||||
INTPTR: t.CTypedef = t.CInt | t.CPtr
|
||||
BOOL: t.CTypedef = t.CInt
|
||||
UINT: t.CTypedef = t.CUnsignedInt
|
||||
UINTPTR: t.CTypedef = UINT | t.CPtr
|
||||
BYTE: t.CTypedef = t.CUnsignedChar
|
||||
BYTEPTR: t.CTypedef = BYTE | t.CPtr
|
||||
WORD: t.CTypedef = t.CUInt16T
|
||||
DWORD: t.CTypedef = t.CUInt32T
|
||||
QWORD: t.CTypedef = t.CUInt64T
|
||||
TCHAR: t.CTypedef = t.CChar
|
||||
CHARLIST: t.CTypedef = str | t.CPtr
|
||||
VOID: t.CTypedef = t.CVoid
|
||||
SHORT: t.CTypedef = t.CShort
|
||||
SHORTPTR: t.CTypedef = t.CShort | t.CPtr
|
||||
USHORT: t.CTypedef = t.CUnsignedShort
|
||||
USHORTPTR: t.CTypedef = t.CUnsignedShort | t.CPtr
|
||||
LONGLONG: t.CTypedef = t.CLongLong
|
||||
ULONGLONG: t.CTypedef = t.CUnsignedLongLong
|
||||
LONG: t.CTypedef = t.CLong
|
||||
ULONG: t.CTypedef = t.CUnsignedLong
|
||||
WCHAR: t.CTypedef = WORD
|
||||
WCHARPTR: t.CTypedef = WORD | t.CPtr
|
||||
CHARPTR: t.CTypedef = t.CChar | t.CPtr
|
||||
FSIZE_t: t.CTypedef = DWORD
|
||||
LBA_t: t.CTypedef = DWORD
|
||||
VOIDPTR: t.CTypedef = t.CVoid | t.CPtr
|
||||
FLOAT: t.CTypedef = t.CFloat
|
||||
DOUBLE: t.CTypedef = t.CDouble
|
||||
FLOAT8: t.CTypedef = t.CFloat8T
|
||||
FLOAT16: t.CTypedef = t.CFloat16T
|
||||
FLOAT32: t.CTypedef = t.CFloat32T
|
||||
FLOAT64: t.CTypedef = t.CFloat64T
|
||||
FLOAT128: t.CTypedef = t.CFloat128T
|
||||
INT8: t.CTypedef = t.CInt8T
|
||||
INT16: t.CTypedef = t.CInt16T
|
||||
INT32: t.CTypedef = t.CInt32T
|
||||
INT64: t.CTypedef = t.CInt64T
|
||||
UINT8: t.CTypedef = t.CUInt8T
|
||||
UINT16: t.CTypedef = t.CUInt16T
|
||||
UINT32: t.CTypedef = t.CUInt32T
|
||||
UINT64: t.CTypedef = t.CUInt64T
|
||||
INT8PTR: t.CTypedef = t.CInt8T | t.CPtr
|
||||
INT16PTR: t.CTypedef = t.CInt16T | t.CPtr
|
||||
INT32PTR: t.CTypedef = t.CInt32T | t.CPtr
|
||||
INT64PTR: t.CTypedef = t.CInt64T | t.CPtr
|
||||
UINT8PTR: t.CTypedef = t.CUInt8T | t.CPtr
|
||||
UINT16PTR: t.CTypedef = t.CUInt16T | t.CPtr
|
||||
UINT32PTR: t.CTypedef = t.CUInt32T | t.CPtr
|
||||
UINT64PTR: t.CTypedef = t.CUInt64T | t.CPtr
|
||||
CHAR8: t.CTypedef = t.CChar8T
|
||||
CHAR16: t.CTypedef = t.CChar16T
|
||||
CHAR32: t.CTypedef = t.CChar32T
|
||||
CHAR8PTR: t.CTypedef = t.CChar8T | t.CPtr
|
||||
CHAR16PTR: t.CTypedef = t.CChar16T | t.CPtr
|
||||
CHAR32PTR: t.CTypedef = t.CChar32T | t.CPtr
|
||||
i8: t.CTypedef = t.CInt8T
|
||||
i16: t.CTypedef = t.CInt16T
|
||||
i32: t.CTypedef = t.CInt32T
|
||||
i64: t.CTypedef = t.CInt64T
|
||||
u8: t.CTypedef = t.CUInt8T
|
||||
u16: t.CTypedef = t.CUInt16T
|
||||
u32: t.CTypedef = t.CUInt32T
|
||||
u64: t.CTypedef = t.CUInt64T
|
||||
SIZE_T: t.CTypedef = t.CSizeT
|
||||
SSIZE_T: t.CTypedef = t.CPtrDiffT
|
||||
PTRDIFF_T: t.CTypedef = t.CPtrDiffT
|
||||
int8_t: t.CTypedef = t.CInt8T
|
||||
int16_t: t.CTypedef = t.CInt16T
|
||||
int32_t: t.CTypedef = t.CInt32T
|
||||
int64_t: t.CTypedef = t.CInt64T
|
||||
uint8_t: t.CTypedef = t.CUInt8T
|
||||
uint16_t: t.CTypedef = t.CUInt16T
|
||||
uint32_t: t.CTypedef = t.CUInt32T
|
||||
uint64_t: t.CTypedef = t.CUInt64T
|
||||
size_t: t.CTypedef = t.CSizeT
|
||||
ssize_t: t.CTypedef = t.CPtrDiffT
|
||||
ptrdiff_t: t.CTypedef = t.CPtrDiffT
|
||||
intptr_t: t.CTypedef = t.CIntPtrT
|
||||
uintptr_t: t.CTypedef = t.CUIntPtrT
|
||||
wchar_t: t.CTypedef = t.CWCharT
|
||||
char8_t: t.CTypedef = t.CChar8T
|
||||
char16_t: t.CTypedef = t.CChar16T
|
||||
char32_t: t.CTypedef = t.CChar32T
|
||||
float8_t: t.CTypedef = t.CFloat8T
|
||||
float16_t: t.CTypedef = t.CFloat16T
|
||||
float32_t: t.CTypedef = t.CFloat32T
|
||||
float64_t: t.CTypedef = t.CFloat64T
|
||||
float128_t: t.CTypedef = t.CFloat128T
|
||||
_Bool: t.CTypedef = t.CBool
|
||||
192
Test/TestProject3/temp/f6b51804a0ba8ff0.pyi
Normal file
192
Test/TestProject3/temp/f6b51804a0ba8ff0.pyi
Normal file
@@ -0,0 +1,192 @@
|
||||
"""
|
||||
Auto-generated Python stub file from w32.win32file.py
|
||||
Module: w32.win32file
|
||||
"""
|
||||
|
||||
import c
|
||||
|
||||
|
||||
import t
|
||||
from stdint import *
|
||||
from w32.win32base import *
|
||||
|
||||
GENERIC_READ: t.CDefine = 0x80000000
|
||||
GENERIC_WRITE: t.CDefine = 0x40000000
|
||||
GENERIC_EXECUTE: t.CDefine = 0x20000000
|
||||
GENERIC_ALL: t.CDefine = 0x10000000
|
||||
FILE_SHARE_READ: t.CDefine = 0x00000001
|
||||
FILE_SHARE_WRITE: t.CDefine = 0x00000002
|
||||
FILE_SHARE_DELETE: t.CDefine = 0x00000004
|
||||
CREATE_NEW: t.CDefine = 1
|
||||
CREATE_ALWAYS: t.CDefine = 2
|
||||
OPEN_EXISTING: t.CDefine = 3
|
||||
OPEN_ALWAYS: t.CDefine = 4
|
||||
TRUNCATE_EXISTING: t.CDefine = 5
|
||||
FILE_ATTRIBUTE_READONLY: t.CDefine = 0x00000001
|
||||
FILE_ATTRIBUTE_HIDDEN: t.CDefine = 0x00000002
|
||||
FILE_ATTRIBUTE_SYSTEM: t.CDefine = 0x00000004
|
||||
FILE_ATTRIBUTE_DIRECTORY: t.CDefine = 0x00000010
|
||||
FILE_ATTRIBUTE_ARCHIVE: t.CDefine = 0x00000020
|
||||
FILE_ATTRIBUTE_NORMAL: t.CDefine = 0x00000080
|
||||
FILE_ATTRIBUTE_TEMPORARY: t.CDefine = 0x00000100
|
||||
FILE_ATTRIBUTE_COMPRESSED: t.CDefine = 0x00000800
|
||||
FILE_ATTRIBUTE_OFFLINE: t.CDefine = 0x00001000
|
||||
FILE_ATTRIBUTE_ENCRYPTED: t.CDefine = 0x00004000
|
||||
FILE_FLAG_WRITE_THROUGH: t.CDefine = 0x80000000
|
||||
FILE_FLAG_OVERLAPPED: t.CDefine = 0x40000000
|
||||
FILE_FLAG_NO_BUFFERING: t.CDefine = 0x20000000
|
||||
FILE_FLAG_RANDOM_ACCESS: t.CDefine = 0x10000000
|
||||
FILE_FLAG_SEQUENTIAL_SCAN: t.CDefine = 0x08000000
|
||||
FILE_FLAG_DELETE_ON_CLOSE: t.CDefine = 0x04000000
|
||||
FILE_FLAG_BACKUP_SEMANTICS: t.CDefine = 0x02000000
|
||||
FILE_FLAG_POSIX_SEMANTICS: t.CDefine = 0x01000000
|
||||
FILE_BEGIN: t.CDefine = 0
|
||||
FILE_CURRENT: t.CDefine = 1
|
||||
FILE_END: t.CDefine = 2
|
||||
STD_INPUT_HANDLE: t.CDefine = t.CUnsignedLong(-10)
|
||||
STD_OUTPUT_HANDLE: t.CDefine = t.CUnsignedLong(-11)
|
||||
STD_ERROR_HANDLE: t.CDefine = t.CUnsignedLong(-12)
|
||||
MOVEFILE_REPLACE_EXISTING: t.CDefine = 0x00000001
|
||||
MOVEFILE_COPY_ALLOWED: t.CDefine = 0x00000002
|
||||
MOVEFILE_WRITE_THROUGH: t.CDefine = 0x00000008
|
||||
|
||||
class BY_HANDLE_FILE_INFORMATION:
|
||||
dwFileAttributes: ULONG
|
||||
ftCreationTime: FILETIME
|
||||
ftLastAccessTime: FILETIME
|
||||
ftLastWriteTime: FILETIME
|
||||
dwVolumeSerialNumber: ULONG
|
||||
nFileSizeHigh: ULONG
|
||||
nFileSizeLow: ULONG
|
||||
nNumberOfLinks: ULONG
|
||||
nFileIndexHigh: ULONG
|
||||
nFileIndexLow: ULONG
|
||||
class WIN32_FIND_DATAA:
|
||||
dwFileAttributes: ULONG
|
||||
ftCreationTime: FILETIME
|
||||
ftLastAccessTime: FILETIME
|
||||
ftLastWriteTime: FILETIME
|
||||
nFileSizeHigh: ULONG
|
||||
nFileSizeLow: ULONG
|
||||
dwReserved0: ULONG
|
||||
dwReserved1: ULONG
|
||||
cFileName: t.CArray[t.CChar, 260]
|
||||
cAlternateFileName: t.CArray[t.CChar, 14]
|
||||
class WIN32_FIND_DATAW:
|
||||
dwFileAttributes: ULONG
|
||||
ftCreationTime: FILETIME
|
||||
ftLastAccessTime: FILETIME
|
||||
ftLastWriteTime: FILETIME
|
||||
nFileSizeHigh: ULONG
|
||||
nFileSizeLow: ULONG
|
||||
dwReserved0: ULONG
|
||||
dwReserved1: ULONG
|
||||
cFileName: t.CArray[t.CUInt16T, 260]
|
||||
cAlternateFileName: t.CArray[t.CUInt16T, 14]
|
||||
|
||||
def CreateFileA(lpFileName: LPCSTR, dwDesiredAccess: ULONG, dwShareMode: ULONG, lpSecurityAttributes: SECURITY_ATTRIBUTES | t.CPtr, dwCreationDisposition: ULONG, dwFlagsAndAttributes: ULONG, hTemplateFile: HANDLE) -> HANDLE | t.State: pass
|
||||
|
||||
def CreateFileW(lpFileName: LPCWSTR, dwDesiredAccess: ULONG, dwShareMode: ULONG, lpSecurityAttributes: SECURITY_ATTRIBUTES | t.CPtr, dwCreationDisposition: ULONG, dwFlagsAndAttributes: ULONG, hTemplateFile: HANDLE) -> HANDLE | t.State: pass
|
||||
|
||||
def ReadFile(hFile: HANDLE, lpBuffer: VOIDPTR, nNumberOfBytesToRead: ULONG, lpNumberOfBytesRead: ULONG | t.CPtr, lpOverlapped: OVERLAPPED | t.CPtr) -> BOOL | t.State: pass
|
||||
|
||||
def WriteFile(hFile: HANDLE, lpBuffer: t.CConst | VOIDPTR, nNumberOfBytesToWrite: ULONG, lpNumberOfBytesWritten: ULONG | t.CPtr, lpOverlapped: OVERLAPPED | t.CPtr) -> BOOL | t.State: pass
|
||||
|
||||
def SetFilePointer(hFile: HANDLE, lDistanceToMove: LONG, lpDistanceToMoveHigh: LONG | t.CPtr, dwMoveMethod: ULONG) -> LONG | t.State: pass
|
||||
|
||||
def SetFilePointerEx(hFile: HANDLE, liDistanceToMove: LARGE_INTEGER | t.CPtr, lpNewFilePointer: LARGE_INTEGER | t.CPtr, dwMoveMethod: ULONG) -> BOOL | t.State: pass
|
||||
|
||||
def GetFileSize(hFile: HANDLE, lpFileSizeHigh: ULONG | t.CPtr) -> ULONG | t.State: pass
|
||||
|
||||
def GetFileSizeEx(hFile: HANDLE, lpFileSize: LARGE_INTEGER | t.CPtr) -> BOOL | t.State: pass
|
||||
|
||||
def SetEndOfFile(hFile: HANDLE) -> BOOL | t.State: pass
|
||||
|
||||
def FlushFileBuffers(hFile: HANDLE) -> BOOL | t.State: pass
|
||||
|
||||
def GetFileType(hFile: HANDLE) -> ULONG | t.State: pass
|
||||
|
||||
def GetFileAttributesA(lpFileName: LPCSTR) -> ULONG | t.State: pass
|
||||
|
||||
def GetFileAttributesW(lpFileName: LPCWSTR) -> ULONG | t.State: pass
|
||||
|
||||
def SetFileAttributesA(lpFileName: LPCSTR, dwFileAttributes: ULONG) -> BOOL | t.State: pass
|
||||
|
||||
def SetFileAttributesW(lpFileName: LPCWSTR, dwFileAttributes: ULONG) -> BOOL | t.State: pass
|
||||
|
||||
def DeleteFileA(lpFileName: LPCSTR) -> BOOL | t.State: pass
|
||||
|
||||
def DeleteFileW(lpFileName: LPCWSTR) -> BOOL | t.State: pass
|
||||
|
||||
def MoveFileA(lpExistingFileName: LPCSTR, lpNewFileName: LPCSTR) -> BOOL | t.State: pass
|
||||
|
||||
def MoveFileW(lpExistingFileName: LPCWSTR, lpNewFileName: LPCWSTR) -> BOOL | t.State: pass
|
||||
|
||||
def MoveFileExA(lpExistingFileName: LPCSTR, lpNewFileName: LPCSTR, dwFlags: ULONG) -> BOOL | t.State: pass
|
||||
|
||||
def MoveFileExW(lpExistingFileName: LPCWSTR, lpNewFileName: LPCWSTR, dwFlags: ULONG) -> BOOL | t.State: pass
|
||||
|
||||
def CopyFileA(lpExistingFileName: LPCSTR, lpNewFileName: LPCSTR, bFailIfExists: BOOL) -> BOOL | t.State: pass
|
||||
|
||||
def CopyFileW(lpExistingFileName: LPCWSTR, lpNewFileName: LPCWSTR, bFailIfExists: BOOL) -> BOOL | t.State: pass
|
||||
|
||||
def CreateDirectoryA(lpPathName: LPCSTR, lpSecurityAttributes: SECURITY_ATTRIBUTES | t.CPtr) -> BOOL | t.State: pass
|
||||
|
||||
def CreateDirectoryW(lpPathName: LPCWSTR, lpSecurityAttributes: SECURITY_ATTRIBUTES | t.CPtr) -> BOOL | t.State: pass
|
||||
|
||||
def RemoveDirectoryA(lpPathName: LPCSTR) -> BOOL | t.State: pass
|
||||
|
||||
def RemoveDirectoryW(lpPathName: LPCWSTR) -> BOOL | t.State: pass
|
||||
|
||||
def FindFirstFileA(lpFileName: LPCSTR, lpFindFileData: WIN32_FIND_DATAA | t.CPtr) -> HANDLE | t.State: pass
|
||||
|
||||
def FindFirstFileW(lpFileName: LPCWSTR, lpFindFileData: WIN32_FIND_DATAW | t.CPtr) -> HANDLE | t.State: pass
|
||||
|
||||
def FindNextFileA(hFindFile: HANDLE, lpFindFileData: WIN32_FIND_DATAA | t.CPtr) -> BOOL | t.State: pass
|
||||
|
||||
def FindNextFileW(hFindFile: HANDLE, lpFindFileData: WIN32_FIND_DATAW | t.CPtr) -> BOOL | t.State: pass
|
||||
|
||||
def FindClose(hFindFile: HANDLE) -> BOOL | t.State: pass
|
||||
|
||||
def GetStdHandle(nStdHandle: ULONG) -> HANDLE | t.State: pass
|
||||
|
||||
def SetStdHandle(nStdHandle: ULONG, hHandle: HANDLE) -> BOOL | t.State: pass
|
||||
|
||||
def GetFileInformationByHandle(hFile: HANDLE, lpFileInformation: BY_HANDLE_FILE_INFORMATION | t.CPtr) -> BOOL | t.State: pass
|
||||
|
||||
def LockFile(hFile: HANDLE, dwFileOffsetLow: ULONG, dwFileOffsetHigh: ULONG, nNumberOfBytesToLockLow: ULONG, nNumberOfBytesToLockHigh: ULONG) -> BOOL | t.State: pass
|
||||
|
||||
def UnlockFile(hFile: HANDLE, dwFileOffsetLow: ULONG, dwFileOffsetHigh: ULONG, nNumberOfBytesToUnlockLow: ULONG, nNumberOfBytesToUnlockHigh: ULONG) -> BOOL | t.State: pass
|
||||
|
||||
def GetTempPathA(nBufferLength: ULONG, lpBuffer: CHARPTR) -> ULONG | t.State: pass
|
||||
|
||||
def GetTempPathW(nBufferLength: ULONG, lpBuffer: WCHARPTR) -> ULONG | t.State: pass
|
||||
|
||||
def GetTempFileNameA(lpPathName: LPCSTR, lpPrefixString: LPCSTR, uUnique: UINT, lpTempFileName: CHARPTR) -> UINT | t.State: pass
|
||||
|
||||
def GetTempFileNameW(lpPathName: LPCWSTR, lpPrefixString: LPCWSTR, uUnique: UINT, lpTempFileName: WCHARPTR) -> UINT | t.State: pass
|
||||
|
||||
def GetCurrentDirectoryA(nBufferLength: ULONG, lpBuffer: CHARPTR) -> ULONG | t.State: pass
|
||||
|
||||
def GetCurrentDirectoryW(nBufferLength: ULONG, lpBuffer: WCHARPTR) -> ULONG | t.State: pass
|
||||
|
||||
def SetCurrentDirectoryA(lpPathName: LPCSTR) -> BOOL | t.State: pass
|
||||
|
||||
def SetCurrentDirectoryW(lpPathName: LPCWSTR) -> BOOL | t.State: pass
|
||||
|
||||
def GetModuleFileNameA(hModule: HANDLE, lpFilename: CHARPTR, nSize: ULONG) -> ULONG | t.State: pass
|
||||
|
||||
def GetModuleFileNameW(hModule: HANDLE, lpFilename: WCHARPTR, nSize: ULONG) -> ULONG | t.State: pass
|
||||
|
||||
|
||||
HANDLE_FLAG_INHERIT: t.CDefine = 0x00000001
|
||||
HANDLE_FLAG_PROTECT_FROM_CLOSE: t.CDefine = 0x00000002
|
||||
|
||||
def CreatePipe(hReadPipe: HANDLE | t.CPtr, hWritePipe: HANDLE | t.CPtr, lpPipeAttributes: SECURITY_ATTRIBUTES | t.CPtr, nSize: ULONG) -> BOOL | t.State: pass
|
||||
|
||||
def SetHandleInformation(hObject: HANDLE, dwMask: ULONG, dwFlags: ULONG) -> BOOL | t.State: pass
|
||||
|
||||
def DuplicateHandle(hSourceProcessHandle: HANDLE, hSourceHandle: HANDLE, hTargetProcessHandle: HANDLE, lpTargetHandle: HANDLE | t.CPtr, dwDesiredAccess: ULONG, bInheritHandle: BOOL, dwOptions: ULONG) -> BOOL | t.State: pass
|
||||
|
||||
|
||||
DUPLICATE_SAME_ACCESS: t.CDefine = 0x00000002
|
||||
Reference in New Issue
Block a user