snapshot before regression test

This commit is contained in:
t
2026-07-18 19:25:40 +08:00
commit 796222a300
2295 changed files with 206453 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
from stdint import *
import w32.win32console
import t, c
from t import CInt, CExport
import mbuddytest
def main() -> CInt | CExport:
w32.win32console.SetConsoleCP(65001)
w32.win32console.SetConsoleOutputCP(65001)
return mbuddytest.mbuddy_main()

View File

@@ -0,0 +1,535 @@
import t, c
from t import CInt, CPtr, CChar, CUInt8T, CUInt32T, CUInt64T, CSizeT
import viperlib
import viperio
import stdlib
import memhub
import string
import testcheck
import w32.win32process
import w32.win32sync
import w32.win32base
# 线程函数: 在共享 MBuddy 上执行 alloc/free (测试 spinlock 线程安全)
def _thread_alloc_free(param: t.CVoid | t.CPtr) -> t.CUInt32T:
bd: memhub.MemBuddy | t.CPtr = (memhub.MemBuddy | t.CPtr)(param)
i: CInt
for i in range(100):
p: bytes = bd.alloc(32)
if p != None:
p_c: CUInt8T | CPtr = CPtr(p)
p_c[0] = CUInt8T(i & 0xFF)
bd.free(p)
return 0
def mbuddy_main() -> CInt:
buf: bytes = stdlib.malloc(256)
testcheck.begin("BuddyTest: 伙伴系统内存分配器测试")
# === 基础 alloc/free 测试 ===
testcheck.section("基础 alloc/free")
arena: bytes = stdlib.malloc(65536)
bd: memhub.MemBuddy | CPtr = memhub.MemBuddy(arena, 65536)
viperlib.snprintf(buf, 256, "stats=%lu, free_count=%lu", bd.stats(), bd.free_count())
testcheck.info(buf)
p1: bytes = bd.alloc(16)
p2: bytes = bd.alloc(64)
p3: bytes = bd.alloc(256)
testcheck.check(p1 != None and p2 != None and p3 != None,
"3 allocs OK", "alloc FAILED")
# 写入数据验证指针可用
p_c: CUInt8T | CPtr = CPtr(p1)
p_c[0] = CUInt8T(0xAB)
p_c[1] = CUInt8T(0xCD)
viperlib.snprintf(buf, 256, "p1[0]=0x%x p1[1]=0x%x", p_c[0], p_c[1])
testcheck.info(buf)
testcheck.check(p_c[0] == CUInt8T(0xAB) and p_c[1] == CUInt8T(0xCD),
"write/read OK", "write/read FAILED")
bd.free(p1)
bd.free(p2)
bd.free(p3)
testcheck.ok("3 frees OK")
# 释放后验证合并: free_count 应回到 1 (单个大块)
testcheck.check(bd.free_count() == 1,
"coalesce: free_count=1 OK", "coalesce: free_count != 1")
# 合并后应能分配大块
big: bytes = bd.alloc(16000)
testcheck.check(big != None, "big alloc OK", "big alloc FAILED")
bd.free(big)
stdlib.free(arena)
# === calloc 测试 (验证清零) ===
testcheck.section("calloc 清零")
arena2: bytes = stdlib.malloc(4096)
bd2: memhub.MemBuddy | CPtr = memhub.MemBuddy(arena2, 4096)
dirty: bytes = bd2.alloc(64)
d_c: CUInt8T | CPtr = CPtr(dirty)
i: CInt
for i in range(64):
d_c[i] = CUInt8T(0xFF)
bd2.free(dirty)
cl: bytes = bd2.calloc(8, 8)
if cl != None:
cl_c: CUInt8T | CPtr = CPtr(cl)
all_zero: CInt = 1
j: CInt
for j in range(64):
if cl_c[j] != 0:
all_zero = 0
break
testcheck.check(all_zero == 1, "calloc zeroed OK", "calloc NOT zeroed")
bd2.free(cl)
else:
testcheck.fail("calloc FAILED")
stdlib.free(arena2)
# === realloc 扩展测试 ===
testcheck.section("realloc 扩展")
arena3: bytes = stdlib.malloc(4096)
bd3: memhub.MemBuddy | CPtr = memhub.MemBuddy(arena3, 4096)
rp: bytes = bd3.alloc(32)
rp_c: CUInt8T | CPtr = CPtr(rp)
k: CInt
for k in range(32):
rp_c[k] = CUInt8T(k + 1)
rp2: bytes = bd3.realloc(rp, 128)
if rp2 != None:
rp2_c: CUInt8T | CPtr = CPtr(rp2)
ok: CInt = 1
m: CInt
for m in range(32):
if rp2_c[m] != CUInt8T(m + 1):
ok = 0
break
testcheck.check(ok == 1, "realloc grow data preserved OK", "realloc grow data LOST")
bd3.free(rp2)
else:
testcheck.fail("realloc grow FAILED")
stdlib.free(arena3)
# === 原地收缩测试 (验证无泄漏) ===
testcheck.section("原地收缩 (realloc shrink)")
arena_shrink: bytes = stdlib.malloc(4096)
bds: memhub.MemBuddy | CPtr = memhub.MemBuddy(arena_shrink, 4096)
sp: bytes = bds.alloc(256)
testcheck.check(sp != None, "alloc 256 OK", "alloc 256 FAILED")
fc_before: CSizeT = bds.free_count()
# realloc 到更小尺寸: 256+8=264 -> order 4 (512); 32+8=40 -> order 1 (64)
# new_order(1) <= old_order(4), 应原地返回同一指针
sp2: bytes = bds.realloc(sp, 32)
fc_after: CSizeT = bds.free_count()
testcheck.check(sp2 == sp, "shrink same ptr OK", "shrink ptr changed")
testcheck.check(fc_after == fc_before, "shrink no leak OK", "shrink LEAKED blocks")
# 验证数据仍可读写
sp_c: CUInt8T | CPtr = CPtr(sp2)
sp_c[0] = CUInt8T(0x42)
testcheck.check(sp_c[0] == CUInt8T(0x42), "shrink data OK", "shrink data FAILED")
bds.free(sp2)
testcheck.check(bds.free_count() == 1, "shrink+free coalesce OK", "shrink+free coalesce FAILED")
stdlib.free(arena_shrink)
# === 边界情况测试 ===
testcheck.section("边界情况")
arena4: bytes = stdlib.malloc(4096)
bd4: memhub.MemBuddy | CPtr = memhub.MemBuddy(arena4, 4096)
# alloc(0) 应返回 None
z: bytes = bd4.alloc(0)
testcheck.check(z == None, "alloc(0)=None OK", "alloc(0) should be None")
# free(None) 应安全
bd4.free(None)
testcheck.ok("free(None) safe")
# realloc(None, size) 等价于 alloc
rn: bytes = bd4.realloc(None, 32)
testcheck.check(rn != None, "realloc(None)=alloc OK", "realloc(None) FAILED")
bd4.free(rn)
# realloc(ptr, 0) 等价于 free
rz: bytes = bd4.alloc(32)
rz2: bytes = bd4.realloc(rz, 0)
testcheck.check(rz2 == None, "realloc(ptr,0)=free OK", "realloc(ptr,0) should be None")
stdlib.free(arena4)
# === 非法指针防护测试 ===
testcheck.section("非法指针防护")
arena5: bytes = stdlib.malloc(4096)
bd5: memhub.MemBuddy | CPtr = memhub.MemBuddy(arena5, 4096)
valid: bytes = bd5.alloc(32)
testcheck.check(valid != None, "alloc for illegal test OK", "alloc FAILED")
# 1. free 随机地址 (地址 1)
bd5.free(t.CVoid(t.CUInt64T(1), t.CPtr))
testcheck.ok("free(addr=1) ignored")
# 2. free NULL
bd5.free(None)
testcheck.ok("free(NULL) ignored")
# 3. free 越界指针 (arena 之前)
bd5.free(t.CVoid(t.CUInt64T(arena5), t.CPtr))
testcheck.ok("free(before arena) ignored")
# 4. free 越界指针 (arena 之后)
bd5.free(t.CVoid(t.CUInt64T(arena5) + 99999, t.CPtr))
testcheck.ok("free(after arena) ignored")
# 5. free 未对齐指针 (arena + 1, 在 mem 区域内但不对齐)
bd5.free(t.CVoid(t.CUInt64T(bd5.mem) + 1, t.CPtr))
testcheck.ok("free(misaligned) ignored")
# 6. 验证合法 free 仍正常工作 (释放后应能再次分配)
bd5.free(valid)
retry5: bytes = bd5.alloc(32)
testcheck.check(retry5 != None, "valid free still works OK", "valid free BROKEN")
if retry5 != None:
bd5.free(retry5)
# 7. realloc 非法指针应返回 None
r_illegal: bytes = bd5.realloc(t.CVoid(t.CUInt64T(1), t.CPtr), 64)
testcheck.check(r_illegal == None, "realloc(illegal)=None OK", "realloc(illegal) should be None")
stdlib.free(arena5)
# === OOM 内存耗尽测试 ===
testcheck.section("OOM 内存耗尽")
arena6: bytes = stdlib.malloc(4096)
bd6: memhub.MemBuddy | CPtr = memhub.MemBuddy(arena6, 4096)
# 持续分配直到失败
alloc_count: CInt = 0
ptrs_arr: bytes = stdlib.malloc(8 * 256) # 存储指针的数组
ptrs: CUInt64T | CPtr = CPtr(ptrs_arr)
while alloc_count < 256:
p: bytes = bd6.alloc(32)
if p == None:
break
ptrs[alloc_count] = t.CUInt64T(p)
alloc_count += 1
viperlib.snprintf(buf, 256, "allocated %d blocks before OOM", alloc_count)
testcheck.info(buf)
testcheck.check(alloc_count > 0, "OOM: got some allocs OK", "OOM: no allocs at all")
# 尝试再分配应失败
oom_p: bytes = bd6.alloc(32)
testcheck.check(oom_p == None, "OOM: alloc fails OK", "OOM: alloc should fail")
# 释放一个块后应能再次分配
if alloc_count > 0:
first_ptr: bytes = t.CVoid(ptrs[0], t.CPtr)
bd6.free(first_ptr)
retry: bytes = bd6.alloc(32)
testcheck.check(retry != None, "OOM: free+alloc OK", "OOM: free+alloc FAILED")
if retry != None:
bd6.free(retry)
# 释放所有块
idx: CInt = 1
while idx < alloc_count:
cur_p: bytes = t.CVoid(ptrs[idx], t.CPtr)
bd6.free(cur_p)
idx += 1
# 全部释放后应能合并回单个大块
testcheck.check(bd6.free_count() == 1,
"OOM: full coalesce OK", "OOM: free_count != 1 after full free")
stdlib.free(ptrs_arr)
stdlib.free(arena6)
# === 空闲链表状态测试 ===
testcheck.section("空闲链表状态")
arena7: bytes = stdlib.malloc(4096)
bd7: memhub.MemBuddy | CPtr = memhub.MemBuddy(arena7, 4096)
# 初始: 1 个大块
testcheck.check(bd7.free_count() == 1, "init: 1 free block OK", "init: free_count != 1")
# 分配后: 空闲块数应增加 (分裂产生多个小块)
a1: bytes = bd7.alloc(32)
fc1: CSizeT = bd7.free_count()
viperlib.snprintf(buf, 256, "after alloc(32): free_count=%lu", fc1)
testcheck.info(buf)
testcheck.check(fc1 > 1, "after alloc: split OK", "after alloc: no split")
# 再分配
a2: bytes = bd7.alloc(32)
fc2: CSizeT = bd7.free_count()
testcheck.check(fc2 >= 1, "after 2nd alloc: free >= 1 OK", "after 2nd alloc: free < 1")
# 释放 a1: 空闲块数应增加
bd7.free(a1)
fc3: CSizeT = bd7.free_count()
testcheck.check(fc3 > fc2, "after free a1: free increased OK", "after free a1: free not increased")
# 释放 a2: 应合并, 空闲块数回到 1
bd7.free(a2)
testcheck.check(bd7.free_count() == 1,
"after free all: coalesced to 1 OK", "after free all: free_count != 1")
stdlib.free(arena7)
# === with 上下文管理器测试 ===
testcheck.section("with 上下文管理器")
arena8: bytes = stdlib.malloc(4096)
with memhub.MemBuddy(arena8, 4096) as wbd:
wp1: bytes = wbd.alloc(32)
wp2: bytes = wbd.alloc(64)
testcheck.check(wp1 != None and wp2 != None,
"with: allocs OK", "with: allocs FAILED")
# 退出 with 块时 __exit__ 自动 reset
# 退出后重新进入,验证 reset 生效
with memhub.MemBuddy(arena8, 4096) as wbd2:
wp3: bytes = wbd2.alloc(1024)
testcheck.check(wp3 != None, "with: reset+realloc OK", "with: reset+realloc FAILED")
stdlib.free(arena8)
# === 双重 free 检测测试 ===
testcheck.section("双重 free 检测")
arena_df: bytes = stdlib.malloc(4096)
bd_df: memhub.MemBuddy | CPtr = memhub.MemBuddy(arena_df, 4096)
df: bytes = bd_df.alloc(64)
testcheck.check(df != None, "df: alloc OK", "df: alloc FAILED")
# 第一次 free
bd_df.free(df)
fc_df1: CSizeT = bd_df.free_count()
testcheck.ok("first free OK")
# 第二次 free (双重 free) — 应被静默拒绝
bd_df.free(df)
fc_df2: CSizeT = bd_df.free_count()
testcheck.check(fc_df2 == fc_df1, "double free rejected OK", "double free CORRUPTED state")
# 验证分配器仍正常工作
df2: bytes = bd_df.alloc(64)
testcheck.check(df2 != None, "df: alloc after double-free OK", "df: alloc after double-free FAILED")
if df2 != None:
bd_df.free(df2)
stdlib.free(arena_df)
# === 自检功能测试 ===
testcheck.section("自检功能")
arena_sc: bytes = stdlib.malloc(4096)
bd_sc: memhub.MemBuddy | CPtr = memhub.MemBuddy(arena_sc, 4096)
# 初始状态自检
testcheck.check(bd_sc.self_check() == 0, "self_check init OK", "self_check init FAILED")
# 分配后自检
sc_p1: bytes = bd_sc.alloc(32)
sc_p2: bytes = bd_sc.alloc(128)
testcheck.check(bd_sc.self_check() == 0, "self_check after alloc OK", "self_check after alloc FAILED")
# 部分释放后自检
bd_sc.free(sc_p1)
testcheck.check(bd_sc.self_check() == 0, "self_check after partial free OK", "self_check after partial free FAILED")
# 全部释放后自检 (应合并回单个大块)
bd_sc.free(sc_p2)
testcheck.check(bd_sc.self_check() == 0, "self_check after full free OK", "self_check after full free FAILED")
# 双重 free 后自检 (验证状态未损坏)
sc_p3: bytes = bd_sc.alloc(64)
bd_sc.free(sc_p3)
bd_sc.free(sc_p3) # 双重 free应被拒绝
testcheck.check(bd_sc.self_check() == 0, "self_check after double-free OK", "self_check after double-free CORRUPTED")
stdlib.free(arena_sc)
# === 并发多线程测试 (spinlock) ===
testcheck.section("并发多线程 (spinlock)")
arena_mt: bytes = stdlib.malloc(65536)
bd_mt: memhub.MemBuddy | CPtr = memhub.MemBuddy(arena_mt, 65536)
NUM_THREADS: CInt = 4
handles_arr: bytes = stdlib.malloc(8 * 4)
handles: CUInt64T | CPtr = CPtr(handles_arr)
tid: CUInt32T = 0
# 创建 4 个线程并发 alloc/free
t_idx: CInt
for t_idx in range(NUM_THREADS):
h: bytes = w32.win32process.CreateThread(None, 0, _thread_alloc_free, t.CVoid(t.CUInt64T(bd_mt), t.CPtr), 0, c.Addr(tid))
handles[t_idx] = CUInt64T(h)
# 等待所有线程完成
for t_idx in range(NUM_THREADS):
h: bytes = t.CVoid(handles[t_idx], t.CPtr)
w32.win32sync.WaitForSingleObject(h, w32.win32base.INFINITE)
w32.win32base.CloseHandle(h)
# 验证分配器状态: 自检通过,所有块已合并
testcheck.check(bd_mt.self_check() == 0, "mt: self_check OK", "mt: self_check FAILED")
testcheck.check(bd_mt.free_count() == 1, "mt: free_count=1 OK", "mt: free_count != 1 (leaked)")
viperlib.snprintf(buf, 256, "mt: free_count=%lu", bd_mt.free_count())
testcheck.info(buf)
stdlib.free(handles_arr)
stdlib.free(arena_mt)
# === 极端边界测试 ===
testcheck.section("极端边界")
# 1. 分配尺寸恰巧是块边界
arena_ex: bytes = stdlib.malloc(4096)
bd_ex: memhub.MemBuddy | CPtr = memhub.MemBuddy(arena_ex, 4096)
# 24 + 8 = 32 = MIN_BLOCK, 恰好填满 order 0 块
exact_fit: bytes = bd_ex.alloc(24)
testcheck.check(exact_fit != None, "exact fit order 0 OK", "exact fit order 0 FAILED")
# 25 + 8 = 33 > 32, 需要 order 1 (64 字节)
over_fit: bytes = bd_ex.alloc(25)
testcheck.check(over_fit != None, "over by 1 byte OK", "over by 1 byte FAILED")
bd_ex.free(exact_fit)
bd_ex.free(over_fit)
testcheck.check(bd_ex.free_count() == 1, "boundary: coalesce OK", "boundary: coalesce FAILED")
# 2. 单次分配接近 arena 上限
max_usable: CSizeT = bd_ex.mem_size - 8
viperlib.snprintf(buf, 256, "mem_size=%lu, max_usable=%lu", bd_ex.mem_size, max_usable)
testcheck.info(buf)
# 恰好用完整个 arena
exact_max: bytes = bd_ex.alloc(max_usable)
testcheck.check(exact_max != None, "exact max alloc OK", "exact max alloc FAILED")
testcheck.check(bd_ex.free_count() == 0, "max alloc: arena full OK", "max alloc: arena not full")
bd_ex.free(exact_max)
testcheck.check(bd_ex.free_count() == 1, "max free: coalesce OK", "max free: coalesce FAILED")
# 再次分配同样大小 — 验证合并后可再次使用
exact_max2: bytes = bd_ex.alloc(max_usable)
testcheck.check(exact_max2 != None, "exact max re-alloc OK", "exact max re-alloc FAILED")
bd_ex.free(exact_max2)
# 3. 分配超过 arena 上限 — 应失败
over_max: bytes = bd_ex.alloc(bd_ex.mem_size)
testcheck.check(over_max == None, "over max: fails OK", "over max: should fail")
over_max2: bytes = bd_ex.alloc(max_usable + 1)
testcheck.check(over_max2 == None, "max+1: fails OK", "max+1: should fail")
stdlib.free(arena_ex)
# 4. Arena 太小 (仅够 free_lists 开销, 264 字节)
arena_tiny: bytes = stdlib.malloc(264)
bd_tiny: memhub.MemBuddy | CPtr = memhub.MemBuddy(arena_tiny, 264)
testcheck.check(bd_tiny.stats() == 0, "tiny arena: stats=0 OK", "tiny arena: stats != 0")
tiny_p: bytes = bd_tiny.alloc(32)
testcheck.check(tiny_p == None, "tiny arena: alloc fails OK", "tiny arena: should fail")
stdlib.free(arena_tiny)
# 5. Arena 刚好够一个最小块 (264 + 32 = 296)
arena_one: bytes = stdlib.malloc(296)
bd_one: memhub.MemBuddy | CPtr = memhub.MemBuddy(arena_one, 296)
testcheck.check(bd_one.stats() == 32, "one block: stats=32 OK", "one block: stats != 32")
one_p: bytes = bd_one.alloc(24)
testcheck.check(one_p != None, "one block: alloc OK", "one block: alloc FAILED")
one_p2: bytes = bd_one.alloc(24)
testcheck.check(one_p2 == None, "one block: OOM OK", "one block: should be OOM")
bd_one.free(one_p)
testcheck.check(bd_one.free_count() == 1, "one block: free OK", "one block: free FAILED")
stdlib.free(arena_one)
# 6. 2 的幂 arena vs 非 2 的幂 arena
arena_pow2: bytes = stdlib.malloc(512)
bd_pow2: memhub.MemBuddy | CPtr = memhub.MemBuddy(arena_pow2, 512)
# 512 - 264 = 248, largest_pow2(248) = 128
testcheck.check(bd_pow2.stats() == 128, "pow2 arena: stats=128 OK", "pow2 arena: stats != 128")
stdlib.free(arena_pow2)
arena_non2: bytes = stdlib.malloc(500)
bd_non2: memhub.MemBuddy | CPtr = memhub.MemBuddy(arena_non2, 500)
# 500 - 264 = 236, largest_pow2(236) = 128
testcheck.check(bd_non2.stats() == 128, "non-pow2 arena: stats=128 OK", "non-pow2 arena: stats != 128")
stdlib.free(arena_non2)
# 7. 压力测试: 反复 alloc/free 同一尺寸 1000 次
arena_stress: bytes = stdlib.malloc(4096)
bd_stress: memhub.MemBuddy | CPtr = memhub.MemBuddy(arena_stress, 4096)
s: CInt
for s in range(1000):
sp: bytes = bd_stress.alloc(64)
if sp != None:
sp_c: CUInt8T | CPtr = CPtr(sp)
sp_c[0] = CUInt8T(s & 0xFF)
bd_stress.free(sp)
testcheck.check(bd_stress.self_check() == 0, "stress: self_check OK", "stress: self_check FAILED")
testcheck.check(bd_stress.free_count() == 1, "stress: free_count=1 OK", "stress: leaked")
stdlib.free(arena_stress)
# 8. 分配全部最小块然后全部释放
arena_fill: bytes = stdlib.malloc(4096)
bd_fill: memhub.MemBuddy | CPtr = memhub.MemBuddy(arena_fill, 4096)
fill_count: CInt = 0
fill_ptrs_arr: bytes = stdlib.malloc(8 * 256)
fill_ptrs: CUInt64T | CPtr = CPtr(fill_ptrs_arr)
fc: CInt
for fc in range(256):
fp: bytes = bd_fill.alloc(24)
if fp == None:
break
fill_ptrs[fill_count] = t.CUInt64T(fp)
fill_count += 1
viperlib.snprintf(buf, 256, "fill: %d min blocks allocated", fill_count)
testcheck.info(buf)
testcheck.check(fill_count > 0, "fill: got blocks OK", "fill: no blocks")
testcheck.check(bd_fill.self_check() == 0, "fill: self_check OK", "fill: self_check FAILED")
# 全部释放
fi: CInt
for fi in range(fill_count):
fp2: bytes = t.CVoid(fill_ptrs[fi], t.CPtr)
bd_fill.free(fp2)
testcheck.check(bd_fill.free_count() == 1, "fill: all freed OK", "fill: leaked after free all")
testcheck.check(bd_fill.self_check() == 0, "fill: self_check after free OK", "fill: self_check FAILED")
stdlib.free(fill_ptrs_arr)
stdlib.free(arena_fill)
stdlib.free(buf)
return testcheck.end()

View File

@@ -0,0 +1 @@
{"w32.win32process": "067c78e9f121dce3", "win32process": "067c78e9f121dce3", "w32.win32sync": "06f53cc594b4ac6c", "win32sync": "06f53cc594b4ac6c", "atom": "271ea3decb810db2", "stdio": "6f62fe05c5ea1ceb", "stdarg": "71e0a3ffcb3ebfad", "w32.win32base": "7e529fe7a078cfef", "win32base": "7e529fe7a078cfef", "stdlib": "90c53dd6db8d41cf", "string": "ab6e54ba9a669f76", "mbuddytest": "b69cdee68f223fef", "w32.win32console": "bbdf3bbd4c3bc28c", "win32console": "bbdf3bbd4c3bc28c", "viperlib": "c3b259b4059f8668", "viperio": "c9f4be41ca1cc2b4", "testcheck": "dd3002730623424b", "memhub": "ee084e9fc6ee413a", "stdint": "f5522571bcce7bcb"}

View File

@@ -0,0 +1,29 @@
{
"$schema": "https://raw.githubusercontent.com/TermiNexus/TransPyC/main/schemas/project-schema.json",
"name": "BuddyTest",
"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": "BuddyTest.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
}
}

View 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

View 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

View 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

View 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

View File

@@ -0,0 +1 @@
{}

View File

@@ -0,0 +1,13 @@
"""
Auto-generated Python stub file from main.py
Module: main
"""
from stdint import *
import w32.win32console
import t, c
from t import CInt, CExport
import mbuddytest
def main() -> CInt | CExport: pass

View 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

View 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

View 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

View 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

View 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

View 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

View File

@@ -0,0 +1 @@
{"D:\\Users\\TermiNexus\\Desktop\\TransPyC\\Test\\BuddyTest\\App\\main.py": {"sha1": "5e430ae5bf7af3a2", "mtime": 1782224154.785576, "size": 260}, "D:\\Users\\TermiNexus\\Desktop\\TransPyC\\Test\\BuddyTest\\App\\mbuddytest.py": {"sha1": "b69cdee68f223fef", "mtime": 1782827825.044477, "size": 19246}, "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\\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\\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\\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\\win32process.py": {"sha1": "067c78e9f121dce3", "mtime": 1781200703.5409546, "size": 4802}, "D:\\Users\\TermiNexus\\Desktop\\TransPyC\\includes\\w32\\win32sync.py": {"sha1": "06f53cc594b4ac6c", "mtime": 1782297500.2581685, "size": 4726}}

View File

@@ -0,0 +1,16 @@
067c78e9f121dce3:includes/w32\win32process.py
06f53cc594b4ac6c:includes/w32\win32sync.py
271ea3decb810db2:includes/atom.py
5e430ae5bf7af3a2:main.py
6f62fe05c5ea1ceb:includes/stdio.py
71e0a3ffcb3ebfad:includes/stdarg.py
7e529fe7a078cfef:includes/w32\win32base.py
90c53dd6db8d41cf:includes/stdlib.py
ab6e54ba9a669f76:includes/string.py
b69cdee68f223fef:mbuddytest.py
bbdf3bbd4c3bc28c:includes/w32\win32console.py
c3b259b4059f8668:includes/viperlib.py
c9f4be41ca1cc2b4:includes/viperio.py
dd3002730623424b:includes/testcheck.py
ee084e9fc6ee413a:includes/memhub.py
f5522571bcce7bcb:includes/stdint.py

Binary file not shown.

View 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

View File

@@ -0,0 +1 @@
{}

View File

@@ -0,0 +1,21 @@
"""
Auto-generated Python stub file from mbuddytest.py
Module: mbuddytest
"""
import t, c
from t import CInt, CPtr, CChar, CUInt8T, CUInt32T, CUInt64T, CSizeT
import viperlib
import viperio
import stdlib
import memhub
import string
import testcheck
import w32.win32process
import w32.win32sync
import w32.win32base
def _thread_alloc_free(param: t.CVoid | t.CPtr) -> t.CUInt32T: pass
def mbuddy_main() -> CInt: pass

View 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

View 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

View 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

View 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

View 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

View 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

View 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