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