Main Page   Packages   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

C:/temp/src/j2k/QNX4/MsgTest.cpp

Go to the documentation of this file.
00001 #include <j2k/Fred/QNX/MsgData.hpp>
00002 
00003 void sub( void* m ) {
00004   serial_t i = *((serial_t*)m);
00005 
00006   printf("[%u]\n", i );
00007 
00008   if ( i & _IS_MSG_DATA ) {
00009     MsgData* msg = (MsgData*)m;
00010     printf("I'm a MsgData* kind of message !!!\n ");
00011 
00012     if ( msg->task == MSG_FUNCTION_CALL ) {
00013       printf("\nI wanna execute the function[%u] ", msg->index );
00014       printf("from the array of pointer to function\n\n\n");
00015     } else {
00016       printf("\nThere is no Task !?\n\n");
00017     }
00018   } else {
00019     printf("I have no clue what I am ! [%u]\n\n", i );
00020   }
00021 }
00022 
00023 int main() {
00024   MsgData* m = new MsgData();
00025   m->index = 2;
00026   m->task  = MSG_FUNCTION_CALL;
00027   sub( (void*)m );
00028 
00029   unsigned long i = MSG_DATA_SERIAL;
00030 
00031   // This will be interpreted as MsgData* 
00032   sub( &i );  // This will phreak out !
00033 
00034   i = 24;
00035 
00036   sub( &i );  // This won't be interpreted as MsgData*
00037 
00038   return 0;
00039 }

Generated on Sun Oct 14 18:46:42 2001 for Standard J2K Library by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001