Files
TransPyC/TestProject/App/main.vp
T
TermiNexus e1cb560df0 test: 对象化前的最后稳定版本
- OopInheritTest 全部类补类体字段声明(x/y/r/w/h/health/battery 等), 保证父类字段展平与 GEP 偏移正确
- 多个测试适配 i8* 指针比较语义(== 指针地址比较改 string.strcmp)
- 删除 ZlibTest/__zlib 旧实现与 find.py 调试脚本
- 更新 TODO 与 TestProject
2026-08-09 22:19:29 +08:00

60 lines
1.1 KiB
Plaintext

import w32.win32console as w32cmd
from w32.win32console import SetConsoleOutputCP, SetConsoleCP
import stdlib, stdio
import memhub
import string
import this
import t, c
pagecode: t.CDefine = 65001
# @c.Attribute(t.attr.packed)
class A:
a: int = 1
def __init__(self):
self.a = 10
def workk():
print(1)
raise Exception("workk")
print(2)
@t.CExport
def main() -> int:
w32cmd.SetConsoleOutputCP(pagecode)
w32cmd.SetConsoleCP(pagecode)
SetConsoleOutputCP(pagecode)
SetConsoleCP(pagecode)
print("你好,世界")
p = stdlib.malloc(1024)
m = memhub.MemPool(p, 1024)
a: A | t.CPtr = m.alloc(A.__sizeof__())
string.memset(a, 0, A.__sizeof__())
c.DerefAs(a, 0x00000002) # *a = 2
print(a.a) # 2
a.__before_init__()
print(a.a) # 1
a.__init__()
print(a.a) # 10
print("你好")
try:
workk()
except Exception as e:
print(e)
this.this()
#for s in "nihao":
# stdio.printf("%c", s)
return 0