修复了大量存在的问题,增加了假鸭子类型等等机制

This commit is contained in:
2026-06-25 14:49:46 +08:00
parent 19f2787db0
commit d88d11b646
827 changed files with 32617 additions and 18316 deletions

View File

@@ -11,7 +11,7 @@ import string
MPOOL_ALIGN: t.CDefine = 8
MPOOL_TYPE_SLAB: t.CDefine = 0
MPOOL_TYPE_BUMP: t.CDefine = 2
MPOOL_TYPE_BUMP: t.CDefine = 1
def _align_up(val: t.CSizeT, align: t.CSizeT) -> t.CSizeT: pass

View File

@@ -64,4 +64,12 @@ 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
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

View File

@@ -25,10 +25,14 @@ DATA_SEG: t.CDefine | t.CUInt16T = 0x10
STACK_SEG: t.CDefine | t.CUInt16T = 0x20
def MAKE_FLAG(bit: CInt32T) -> t.CDefine:
pass
return 1 << bit
def CLAMP(x: CInt32T, lo: CInt32T, hi: CInt32T) -> t.CDefine:
pass
if x < lo:
return lo
if x > hi:
return hi
return x
def test_basic_define() -> CInt: pass

View File

@@ -0,0 +1,28 @@
"""
Auto-generated Python stub file from stdio.py
Module: stdio
"""
import t, c
def printf(fmt: t.CChar | t.CConst | t.CPtr, *args) -> t.CInt | t.CExtern | t.CExport: pass
def fprintf(stream: t.CVoid | t.CPtr, fmt: t.CChar | t.CConst | t.CPtr, *args) -> t.CInt | t.CExtern | t.CExport: pass
def sprintf(buf: t.CChar | t.CPtr, fmt: t.CChar | t.CConst | t.CPtr, *args) -> t.CInt | t.CExtern | t.CExport: pass
def snprintf(buf: t.CChar | t.CPtr, size: t.CSizeT, fmt: t.CChar | t.CConst | t.CPtr, *args) -> t.CInt | t.CExtern | t.CExport: pass
def puts(s: t.CChar | t.CConst | t.CPtr) -> t.CInt | t.CExtern | t.CExport: pass
def fputs(s: t.CChar | t.CConst | t.CPtr, stream: t.CVoid | t.CPtr) -> t.CInt | t.CExtern | t.CExport: pass
def fgets(buf: t.CChar | t.CPtr, size: t.CInt, stream: t.CVoid | t.CPtr) -> t.CChar | t.CPtr | t.CExtern | t.CExport: pass
def fflush(stream: t.CVoid | t.CPtr) -> t.CInt | t.CExtern | t.CExport: pass
stdin: t.CExtern | t.CVoid | t.CPtr
stdout: t.CExtern | t.CVoid | t.CPtr
stderr: t.CExtern | t.CVoid | t.CPtr

View File

@@ -0,0 +1,25 @@
"""
Auto-generated Python stub file from testcheck.py
Module: testcheck
"""
import t, c
import stdio
_pass_count: t.CExtern | t.CInt
_fail_count: 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

View File

@@ -1,19 +1,21 @@
0f4d14c17bf75b10:main.py
0991af0d22263577:includes/mpool.py
1b58766d38d05de3:enumtest.py
2953a7db4185005b:includes/viperlib.py
3fdd11bdd589aa8c:includes/vector.py
5325ec533a59d71b:mpooltest.py
56cdd754a8a09347:includes/stdint.py
49bd8cba55979f76:includes/stdint.py
5a6a2137958c28c5:includes/w32\win32base.py
64ac83614c9bdbc6:definetest.py
68c4fe4b12c908e3:includes/mpool.py
6aee24fdefa3cbc0:includes/string.py
6c2029b306556c00:includes/stdlib.py
70b580331b822117:includes/viperlib.py
71e0a3ffcb3ebfad:includes/stdarg.py
73edbcf76e32d00b:includes/stdio.py
93c1d18e35d188d6:includes/platmacro.py
9dbecd0942a39782:includes/testcheck.py
abf9ce3160c9279e:includes/w32\win32file.py
b235d6477436c524:main.py
b5f1dc665c52a1bd:includes/string.py
bbdf3bbd4c3bc28c:includes/w32\win32console.py
c01b27dbcd683245:fileiotest.py
c9f4be41ca1cc2b4:includes/viperio.py
f8a7f964e23490fb:mpooltest.py
fa3691e66b426950:includes/w32\fileio.py
fc49f6314bad25e9:vectortest.py

View File

View File

@@ -15,6 +15,7 @@ import enumtest
import mpooltest
import vectortest
import fileiotest
import testcheck
def add[T](a: T, b: T) -> T: pass

View File

@@ -41,4 +41,4 @@ def atoll(src: str) -> t.CInt64T: pass
def atof(src: str) -> t.CDouble: pass
def split(s: str, delim: str, result: list[str]) -> int: pass
def split(s: str, delim: str, result: t.CArray[str]) -> int: pass