14 // "local" variables for use in macros
17 typedef struct SESEstruct SESE;
20 SESE* createSESE( SESE* parent, int id ) {
21 SESE* sese = (SESE*) malloc( sizeof( SESE ) );
23 sese->parent = (void*) parent;
24 sese->childQ = createQueue();
27 void freeSESE( SESE* sese ) {
28 freeQueue( sese->childQ );
33 // macros set this return value for inspection
36 // currently running SESE
41 void mlpLog( char* point ) {
42 printf( " time = %d, id = %d, point = %s\n", mlpTime, current->id, point );
47 #define mlpInit( id ) \
48 current = createSESE( NULL, id );
51 void mlpBlock( int id ) {
55 #define mlpEnqueue( childid ) \
56 current->child = (void*) createSESE( current, childid ); \
57 addNewItem( current->childQ, current->child ); \
58 if( setjmp( ((SESE*)current->child)->buf ) ) { \
65 #define mlpNotifyExit() \
66 while( !isEmpty( current->childQ ) ) { \
67 current->child = getItem( current->childQ ); \
68 current = (SESE*) current->child; \
69 if( setjmp( ((SESE*)current->parent)->buf ) ) { \
71 longjmp( current->buf, 1 ); \
74 if( current->parent != NULL ) { \
75 current = (SESE*) current->parent; \
76 longjmp( current->buf, 1 ); \
101 printf( "Beginning setjump/longjump test.\n" );
111 for( i = 0; i < 2; ++i ) {
113 mlpEnqueue( 10 + i );
116 sprintf( lname, "Ls%d", 10 + i );
121 sprintf( lname, "%d", i );
138 printf( "End test.\n" );