把 81 个 .vp 文件的中文 # 注释与三引号文档串改写为简洁英文,每个连续注释块 <=2 行;运行时中文字符串字面量(testcheck.begin/print 等用户可见消息)保持原样。骨架比对 HEAD 与工作区 112 文件漂移 0,全量 77/77 顺序回归通过。
32 lines
867 B
Plaintext
32 lines
867 B
Plaintext
import t, c
|
|
from stdint import *
|
|
import stdio
|
|
|
|
|
|
def bump(v: char) -> char:
|
|
return char(v + 1)
|
|
|
|
|
|
def main() -> int | t.CExport:
|
|
# 1) char annotation: char = t.CChar = i8 (scalar builtin, not a pointer)
|
|
ch: char = 65
|
|
stdio.printf("1 char annot: %d (expect 65)\n", int(ch))
|
|
|
|
# 2) char() cast int to char: 300 truncates to i8, giving 44
|
|
big: char = char(300)
|
|
stdio.printf("2 char cast trunc: %d (expect 44)\n", int(big))
|
|
|
|
# 3) Function returns char (stored as i8)
|
|
nx: char = bump(ch)
|
|
stdio.printf("3 char return: %d (expect 66)\n", int(nx))
|
|
|
|
# 4) Single-char literal 'Z' assigned to char (90)
|
|
lit: char = 'Z'
|
|
stdio.printf("4 char literal: %d (expect 90)\n", int(lit))
|
|
|
|
# 5) char in arithmetic (i8 promoted when mixed with int)
|
|
s: int = ch + 1
|
|
stdio.printf("5 char arith: %d (expect 66)\n", s)
|
|
|
|
return 0
|