pub fn createparam(name: &str, flags: i32) -> Option<Param>Expand description
Port of createparam(char *name, int flags) from Src/params.c:1030. C body
(~130 lines, see comment header at c:1020-1027) creates a
parameter so that it can be assigned to. Returns NULL if the
parameter already exists or can’t be created, otherwise
returns the new node. If a parameter of the same name exists
in an outer scope, it is hidden by the new one. An already
existing node at the current level may be “created” and
returned provided it is unset and not special. If the
parameter can’t be created because it already exists,
PM_UNSET is cleared.
Faithful port covers:
- PM_HASHELEM / PM_EXPORTED tweak when paramtab != realparamtab (c:1034)
- PM_RO_BY_DESIGN read-only rejection (c:1043-1052)
- PM_NAMEREF chain follow via
resolve_nameref_rec(c:1062-1104) - hidden vs reuse-old branches (c:1108-1147)
pm->node.flags = flags & ~PM_LOCALfinalization (c:1155)assigngetset(pm)for non-special params (c:1157-1158)
Paramtab-backed branches (c:1034 paramtab compare, c:1038 gethashnode2, c:1144-1146 paramtab.removenode/addnode) cannot fully execute until the paramtab vtable lands; they are preserved as architectural intent. The faithful behaviour emerges as soon as paramtab is wired (no signature drift at this site).