把 81 个 .vp 文件的中文 # 注释与三引号文档串改写为简洁英文,每个连续注释块 <=2 行;运行时中文字符串字面量(testcheck.begin/print 等用户可见消息)保持原样。骨架比对 HEAD 与工作区 112 文件漂移 0,全量 77/77 顺序回归通过。
46 lines
1.2 KiB
Plaintext
46 lines
1.2 KiB
Plaintext
import t
|
|
from linkedlist import GSListNode
|
|
import memhub
|
|
|
|
# ============================================================
|
|
# G4Node: test class inheriting GSListNode[G4Node] (in includes, so it uses
|
|
# the Phase1 path); flattened it must have 6 fields: Next + 5 own fields.
|
|
# ============================================================
|
|
|
|
@t.NoVTable
|
|
class G4Node(GSListNode[G4Node]):
|
|
Ty: t.CPtr # mirrors Value.Ty
|
|
Name: t.CPtr # mirrors Value.Name
|
|
IsConst: int # mirrors Value.IsConst
|
|
IntVal: int64 # mirrors Value.IntVal
|
|
FloatVal: double # mirrors Value.FloatVal
|
|
|
|
def __init__(self):
|
|
self.Ty = None
|
|
self.Name = None
|
|
self.IsConst = 0
|
|
self.IntVal = 0
|
|
self.FloatVal = 0.0
|
|
self.Next = None
|
|
|
|
|
|
# factory function (similar to new_value in __values.py)
|
|
def new_g4node(pool: memhub.MemBuddy*) -> G4Node*:
|
|
ptr: G4Node* = pool.alloc(48)
|
|
if ptr:
|
|
ptr.Ty = None
|
|
ptr.Name = None
|
|
ptr.IsConst = 0
|
|
ptr.IntVal = 0
|
|
ptr.FloatVal = 0.0
|
|
ptr.Next = None
|
|
return ptr
|
|
|
|
|
|
def g4node_get_next(node: G4Node*) -> G4Node*:
|
|
return node.Next
|
|
|
|
|
|
def g4node_set_next(node: G4Node*, next_node: G4Node*):
|
|
node.Next = next_node
|