HPutPPar (see figure 5.35) is an alternative to HPutCPar and writes control data to the output control parameter with the index par. However, instead of copying the num values like HPutCPar does, HPutPPar directly stores the pointer to the array of Hcpar structures (val). Thus, it causes less overhead. As HPutPPar directly uses the passed Hcpar array without copying, this array has to be allocated “permanently”, i.e. it must be allocated by using HAlloc (see section “Permanent Data”). Furthermore, the array must not be freed after passing it to HPutPPar. Figure 5.37 shows how to write output control data with HPutPPar.
Note that HPutPPar automatically checks the result state of the underlying procedure similarly to the macro HCkP (see section “HCkP”). Thus, you must not use HCkP on HPutPPar yourself.
As already mentioned, every data element may use a different type, because the types of the parameter values (LONG_PAR, DOUBLE_PAR, STRING_PAR) are stored with each Hcpar structure.
Hcpar *par; HCkP(HAlloc(proc_handle,(size_t)(sizeof(Hcpar)*2),(void**)&par)); par[0].par.l = 6; par[0].type = LONG_PAR; par[1].par.d = 4.4; par[1].type = DOUBLE_PAR; HPutPPar(proc_handle,1,par,2);
Figure 5.37: Write the control parameter values [6,4.4] using HPutPPar.