BOOST help again ...

Jim REMOVEjimdon at sympatico.caREMOVE
Fri Mar 21 13:23:27 EST 2003


Hi ...
I have a new boost question ... how do convert a tuple to a c struct ... 
my half brained attempt is below ... but it has some obvious compile 
problems ...

Thanks in advance,
Jim

void BOOSTED_cosim_define_board(boost::python::tuple t)
{
   double x60_clk, pwm_clk, utx_clk, urx_clk, local_ref_clk, 
pcr_ref_clk, mod_ref_clk, demod_ref_clk;
   long mod_utopia, demod_utopia, dac_type, adc_type;

   if (!PyArg_ParseTuple(t, "(ddddddddllll)",
     &x60_clk,
     &pwm_clk,
     &utx_clk,
     &urx_clk,

     &local_ref_clk,
     &pcr_ref_clk,
     &mod_ref_clk,
     &demod_ref_clk,

     &mod_utopia,
     &demod_utopia,

     &dac_type,
     &adc_type))
   {
     PyErr_SetString( PyCosim_Error, "invalid args" );
     return;
   }

   theboard.x60_clk=x60_clk*1e6;
   theboard.pwm_clk=pwm_clk*1e6;
   theboard.utx_clk=utx_clk*1e6;
   theboard.urx_clk=urx_clk*1e6;

   theboard.local_ref_clk=local_ref_clk*1e6;
   theboard.pcr_ref_clk=pcr_ref_clk*1e6;
   theboard.mod_ref_clk=mod_ref_clk*1e6;
   theboard.demod_ref_clk=demod_ref_clk*1e6;

   theboard.mod_utopia=static_cast<ATM_INFO>(mod_utopia);
   theboard.demod_utopia=static_cast<ATM_INFO>(demod_utopia);

   theboard.dac_type=static_cast<DACADC_TYPE>(dac_type);
   theboard.adc_type=static_cast<DACADC_TYPE>(adc_type);

   return;
}





More information about the Python-list mailing list