//// 由 erlgen 发射——词表: protocol/dop.toml——勿手改
//// 再生: moon run /home/thy/bitbang/erlgen/cmd --  

///|
/// DOP 控制消息词表常量(dist.h DOP 枚举——数据面;真源=词表 TOML)
/// {2, '', To}——from 位普通 SEND 恒空 atom(dist.c:2508);payload 分离
pub const DOP_SEND : Int32 = 2

///|
/// {6, FromPid, Cookie='', ToName}——4 元(dist.c REG_SEND 臂 arity 必 4,R9B+ cookie 恒空 atom;payload 逻辑分离——msg 段同包自帶 131)
pub const DOP_REG_SEND : Int32 = 6

///|
/// {8, FromPid, ToPid, Reason}
pub const DOP_EXIT2 : Int32 = 8

///|
/// {19, WatcherPid, Watched(pid|atom), Ref}——远端要监视本地
pub const DOP_MONITOR_P : Int32 = 19

///|
/// {20, SourcePid, Target, Ref}
pub const DOP_DEMONITOR_P : Int32 = 20

///|
/// {22, FromPid, ToPid}+msg=message——SEND 带发送方形(SEND_SENDER 位声明形;rex reply 投递实形,probe dump 铁证 2026-11-07)
pub const DOP_SEND_SENDER : Int32 = 22

///|
/// {21, SourcePid, Target, Ref, Reason}——元组形(无 EXIT_PAYLOAD 位)
pub const DOP_MONITOR_P_EXIT : Int32 = 21

///|
/// {28, Target, Watcher, Ref}+msg=Reason 同流第 5 项(DFLAG_EXIT_PAYLOAD;'Z' ref 新形)
pub const DOP_PAYLOAD_MONITOR_P_EXIT : Int32 = 28

///|
/// {35, FromPid, ToPid, Id}(DFLAG_UNLINK_ID 新代)
pub const DOP_UNLINK_ID : Int32 = 35

///|
/// {36, FromPid, ToPid, Id}
pub const DOP_UNLINK_ID_ACK : Int32 = 36

///|
/// {29, Ref, FromPid, GroupLeader, {M,F,Arity}, Opts}+ArgList 帧流第 7 项(真帧勘定 2026-11-07 本机双节点 strace 铁证:t2_node 侧 recvfrom——MFA 第三位=Arity 非 ArgList[单变量对拍:pong/0=0/pong2/1=1];ArgList 独立段[hello]/[];spawn_link=Opts[link] vs spawn=nil;idlen 变长 ref)
pub const DOP_SPAWN_REQUEST : Int32 = 29

///|
/// {31, Ref, ToPid, Arity0, [NewPid]} 5 元——spawn_reply 真形(真帧勘定 2026-11-07 spawn 真网实验:spawn 帧 175B 发→95B 回执——Ref 对拍 id=20/ToPid=caller4/第三位 int 0/新进程 pid list;38 役 'Z' ref 新形收侧)
pub const DOP_SPAWN_REPLY : Int32 = 31

///|
/// 封闭查表:tag → 语义名(未知 None——负例诚实拒)
pub fn dop_name_of(tag : Int32) -> String? {
  match tag {
    2 => Some("send")
    6 => Some("reg_send")
    8 => Some("exit2")
    19 => Some("monitor_p")
    20 => Some("demonitor_p")
    22 => Some("send_sender")
    21 => Some("monitor_p_exit")
    28 => Some("payload_monitor_p_exit")
    35 => Some("unlink_id")
    36 => Some("unlink_id_ack")
    29 => Some("spawn_request")
    31 => Some("spawn_reply")
    _ => None
  }
}

///|
/// 封闭查表:tag → 语义动词(send/account/stop——L3 分派面)
pub fn dop_semantics_of(tag : Int32) -> String? {
  match tag {
    2 => Some("send")
    6 => Some("send")
    8 => Some("account")
    19 => Some("account")
    20 => Some("account")
    22 => Some("send")
    21 => Some("account")
    28 => Some("account")
    35 => Some("account")
    36 => Some("account")
    29 => Some("account")
    31 => Some("account")
    _ => None
  }
}

///|
/// 词表全表 [(tag, 语义名, 语义动词, 参数形)](封闭性罐/分派面用;词表行序)
pub fn all_dops() -> Array[(Int32, String, String, String)] {
  [
    (2, "send", "send", "atom_empty,pid"),
    (6, "reg_send", "send", "pid,atom_empty,atom"),
    (8, "exit2", "account", "pid,pid,term"),
    (19, "monitor_p", "account", "pid,pid_or_atom,ref"),
    (20, "demonitor_p", "account", "pid,pid_or_atom,ref"),
    (22, "send_sender", "send", "pid,pid"),
    (21, "monitor_p_exit", "account", "pid,pid_or_atom,ref,term"),
    (28, "payload_monitor_p_exit", "account", "pid,pid_or_atom,ref"),
    (35, "unlink_id", "account", "pid,pid,int"),
    (36, "unlink_id_ack", "account", "pid,pid,int"),
    (29, "spawn_request", "account", "ref,pid,pid,term,term,term"),
    (31, "spawn_reply", "account", "ref,pid,int,term"),
  ]
}