27 lines
755 B
Plaintext
27 lines
755 B
Plaintext
from g4node import G4Node, new_g4node
|
|
|
|
|
|
# ============================================================
|
|
# caller3: a third module importing G4Node.
|
|
# Adds more cross-module references (many-module environment).
|
|
# ============================================================
|
|
|
|
|
|
def caller3_find_tail(head: G4Node*) -> G4Node*:
|
|
"""Find the chain tail, accessing Next directly."""
|
|
if head is None:
|
|
return None
|
|
cur: G4Node* = head
|
|
while cur.Next is not None:
|
|
cur = cur.Next
|
|
return cur
|
|
|
|
|
|
def caller3_append(head: G4Node*, new_node: G4Node*) -> G4Node*:
|
|
"""Append a node at the chain tail."""
|
|
if head is None:
|
|
return new_node
|
|
tail: G4Node* = caller3_find_tail(head)
|
|
tail.Next = new_node
|
|
return head
|