Skip to main content

export_param

Function export_param 

Source
pub fn export_param(pm: &mut param)
Expand description

Port of export_param(Param pm) from Src/params.c:2653.

C body converts pm’s value to its scalar form per PM_TYPE: PM_INTEGER: convbase(buf, getfn, pm->base) PM_EFLOAT/FFLOAT: convfloat(getfn, pm->base, pm->node.flags, NULL) PM_SCALAR/etc.: gsu.s->getfn(pm) Then calls addenv(pm, val). PM_ARRAY/PM_HASHED early-return.

The previous Rust port used format!("{}", intgetfn(pm)) for integers and format!("{}", floatgetfn(pm)) for floats — Rust’s DEFAULT formatting. C uses convbase/convfloat which respect pm.base and pm.flags:

  • typeset -i16 x=255; export x should put “16#FF” in the env (per pm.base==16). The previous Rust port wrote “255”.
  • typeset -F3 y=3.14; export y should put “3.140” (per pm.base==3 precision + PM_FFLOAT flag). Rust wrote “3.14”.

Both formatter ports exist (params::convbase, utils::convfloat). Wire them so the env-side representation matches C.