Hi Eric,

 

I guess I too am struggling with explaining the scenario I have here.
Lemme give it one last try. Please don't get me wrong, I truly
appreciate the time and patience on your side. Now I understand that
what I was trying to implement is not possible. So I am implementing a
workaround.

 

Lets say for reasons beyond my control I have multiple data structs for
different applications. Each of these structs has a header and some
data. All of the struct header members except for one member are unique
for each struct . Now I am trying  to do some common operations on this
common member variable. Now I could move the common data to a struct and
then include it in the parent struct, but that would imply me having a
quite a few sub structs for each such operation.

 

 

 

 

 

The reason I initially thought this was possible was after checking the
generated app.c for another generic module  I had tested  a while ago. 

 

For eg

/***********NesC module ******************/

typedef struct

{

  message_t* ptrMsgUpperLayer;

  message_t  m_msgTx;

  uint8_t    m_cTickCntStart;

  uint8_t iCRC;

  

}StructTxData;

 

typedef struct

{

 

  addr_t     addrRxSource;  

  uint8_t    m_acRxPayLoad[TOSH_DATA_LENGTH];  

  uint8_t    m_cNumPayloadBytes ;

  uint8_t iCRC;

  

}StructRxData;

 

 

generic module AMTxMsgQueueM(typedef type)

{ 

     //interfaces removed to reduce clutter 

}

 

Implementation

{

 

void TestType(type* t)

{

     //t->iCRC =0; does not compile

}

//implementation removed to reduce clutter

 

}

/***********************************/

 

 

 

 

 

After compiling app.c  becomes

/**************app.c**************************/

 

typedef struct __nesc_unnamed4351 {

 

 

  addr_t addrRxSource;

  uint8_t m_acRxPayLoad[100];

  uint8_t m_cNumPayloadBytes;

  uint8_t iCRC;

 

} 

StructRxData;

 

 

typedef StructRxData /*DymoServiceC.RxMsgQueueC*/AMTxMsgQueueC__1__type;

 

typedef /*DymoServiceC.RxMsgQueueC*/AMTxMsgQueueC__1__type
/*DymoServiceC.RxMsgQueueC.AMTxMsgQueueM*/AMTxMsgQueueM__1__type;

 

 

 

static inline void
/*DymoServiceC.RxMsgQueueC.AMTxMsgQueueM*/AMTxMsgQueueM__1__TestType(/*D
ymoServiceC.RxMsgQueueC.AMTxMsgQueueM*/AMTxMsgQueueM__1__type *t)

{

}

 

 

/***********************************/

 

This implies that  'AMTxMsgQueueM__1__type',  which is an argument
passed to TestType(),  is actually replaced by StructRxData. If I look
at app.c just as regular C file , I would assume that I could access any
member of StructRxData inside TestType()

 

 

Thanks once again for your time and patience.

Lewis

 

 

 

 

_______________________________________________
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to