Compare commits

..

No commits in common. "d5bf86c1f580d5fcb313458ee116c7411f860f75" and "ed3fa2ead99e99665b3af224c86cb972743204ca" have entirely different histories.

12 changed files with 112 additions and 58 deletions

View file

@ -1,18 +1,6 @@
#include "libChf/src/Chf.h"
#include "chf_messages.h" #include "chf_messages.h"
ChfTable message_table[] = { ChfTable message_table[] = {
{CHF_SET, CHF_S_OK, "" },
{CHF_SET, CHF_F_COND_STACK_FULL, "Condition stack is full" },
{CHF_SET, CHF_F_HDLR_STACK_FULL, "Handler stack is full" },
{CHF_SET, CHF_F_HDLR_STACK_EMPTY, "Handler stack is empty" },
{CHF_SET, CHF_F_BAD_STATE, "Wrong Chf state for requested operation" },
{CHF_SET, CHF_F_INVALID_ACTION, "Invalid action code from handler (code=<%d>d)" },
{CHF_SET, CHF_F_MALLOC, "Dynamic memory allocation failed" },
{CHF_SET, CHF_F_NOT_AVAILABLE, "Function not implemented" },
{CHF_SET, CHF_F_SETLOCALE, "setlocale() failed" },
{CHF_SET, CHF_F_CATOPEN, "catopen() failed" },
{CPU_CHF_MODULE_ID, CPU_I_CALLED, "Function [%s] called" }, {CPU_CHF_MODULE_ID, CPU_I_CALLED, "Function [%s] called" },
{CPU_CHF_MODULE_ID, CPU_I_EXECUTING, "Executing @ PC[%05X]" }, {CPU_CHF_MODULE_ID, CPU_I_EXECUTING, "Executing @ PC[%05X]" },
{CPU_CHF_MODULE_ID, CPU_I_SHUTDN, "CPU shutdown executed" }, {CPU_CHF_MODULE_ID, CPU_I_SHUTDN, "CPU shutdown executed" },

View file

@ -259,7 +259,7 @@ static void EmulatorLoop( void )
} }
/* Condition handler for the EmulatorLoop */ /* Condition handler for the EmulatorLoop */
static ChfAction EmulatorLoopHandler( const ChfDescriptor* d, const ChfState s, void* _ctx ) static ChfAction EmulatorLoopHandler( const ChfDescriptor* d, const ChfState s, ChfPointer _ctx )
{ {
ChfAction act; ChfAction act;
@ -515,7 +515,7 @@ void Emulator( void )
/* Setup unwind_context */ /* Setup unwind_context */
if ( setjmp( unwind_context ) == 0 ) { if ( setjmp( unwind_context ) == 0 ) {
/* Push condition handler, with NULL context */ /* Push condition handler, with NULL context */
ChfPushHandler( CPU_CHF_MODULE_ID, EmulatorLoopHandler, &unwind_context, ( void* )NULL ); ChfPushHandler( CPU_CHF_MODULE_ID, EmulatorLoopHandler, &unwind_context, ( ChfPointer )NULL );
/* Activate emulator loop */ /* Activate emulator loop */
EmulatorLoop(); EmulatorLoop();

View file

@ -976,7 +976,7 @@ typedef /* Condition handler */
ChfAction (*ChfHandler)( ChfAction (*ChfHandler)(
const ChfDescriptor *, const ChfDescriptor *,
const ChfState, const ChfState,
void* ChfPointer
); );
@end example @end example
@ -990,7 +990,7 @@ is a pointer to the condition group that is being signaled.
@item const ChfState @item const ChfState
represents the current state of the condition handling facility. represents the current state of the condition handling facility.
@item void* @item ChfPointer
is a copy of the @code{handler_context} pointer passed to the is a copy of the @code{handler_context} pointer passed to the
@code{ChfPushHandler()} invocation that established the condition @code{ChfPushHandler()} invocation that established the condition
handler. handler.
@ -1024,7 +1024,7 @@ of the new condition group allows it to do so.
@subsection ChfPushHandler() @subsection ChfPushHandler()
@cindex Condition handlers @cindex Condition handlers
@cindex Adding condition handlers @cindex Adding condition handlers
@deftypefn Function void ChfPushHandler (ChfHandler new_handler, void *unwind_context, void* handler_context) @deftypefn Function void ChfPushHandler (ChfHandler new_handler, void *unwind_context, ChfPointer handler_context)
This function pushes the new condition handler @code{new_handler} with This function pushes the new condition handler @code{new_handler} with
its associated @code{siglongjmp()} context, pointed by its associated @code{siglongjmp()} context, pointed by

View file

@ -30,9 +30,9 @@
- Added structured condition handling macros: CHF_Try, CHF_Catch, CHF_EndTry - Added structured condition handling macros: CHF_Try, CHF_Catch, CHF_EndTry
Revision 1.6 1997/01/15 13:41:20 cibrario Revision 1.6 1997/01/15 13:41:20 cibrario
Defined the new data type void*, a generic (void *) pointer. Each Defined the new data type ChfPointer, a generic (void *) pointer. Each
condition handler can have a private handler context pointer, of type condition handler can have a private handler context pointer, of type
void*, that the function ChfPushHandler() stores and that is passed ChfPointer, that the function ChfPushHandler() stores and that is passed
to the handler when it's activated. to the handler when it's activated.
Fixed a wrong adjustment of the condition handlers stack pointer after Fixed a wrong adjustment of the condition handlers stack pointer after
an unwind operation. an unwind operation.
@ -66,7 +66,7 @@
#define CHF_UNKNOWN_FILE_NAME ( char* )NULL #define CHF_UNKNOWN_FILE_NAME ( char* )NULL
#define CHF_NULL_DESCRIPTOR ( ChfDescriptor* )NULL #define CHF_NULL_DESCRIPTOR ( ChfDescriptor* )NULL
#define CHF_NULL_CONTEXT ( void* )NULL #define CHF_NULL_CONTEXT ( void* )NULL
#define CHF_NULL_POINTER ( void** )NULL #define CHF_NULL_POINTER ( ChfPointer* )NULL
#define CHF_NULL_HANDLER ( ChfHandler ) NULL #define CHF_NULL_HANDLER ( ChfHandler ) NULL
#define CHF_LIBRARY_ID "$Id: Chf.h,v 2.2 2001/01/25 11:56:44 cibrario Exp $" #define CHF_LIBRARY_ID "$Id: Chf.h,v 2.2 2001/01/25 11:56:44 cibrario Exp $"
@ -141,8 +141,11 @@ typedef struct ChfTable_S /* Standalone message table */
char* msg_template; /* Message template */ char* msg_template; /* Message template */
} ChfTable; } ChfTable;
typedef /* Generic pointer */
void* ChfPointer;
typedef /* Condition handler */ typedef /* Condition handler */
ChfAction ( *ChfHandler )( const ChfDescriptor*, const ChfState, void* ); ChfAction ( *ChfHandler )( const ChfDescriptor*, const ChfState, ChfPointer );
typedef /* Message retrieval 'get_message' function */ typedef /* Message retrieval 'get_message' function */
const char* ( *ChfMrsGet )( void*, const int, const int, const char* default_message ); const char* ( *ChfMrsGet )( void*, const int, const int, const char* default_message );
@ -233,7 +236,7 @@ void ChfAbort( const int abort_code );
/* Push a new handler into the stack */ /* Push a new handler into the stack */
void ChfPushHandler( const int module_id, ChfHandler new_handler, /* Handler to be added */ void ChfPushHandler( const int module_id, ChfHandler new_handler, /* Handler to be added */
void* unwind_context, /* Unwind context */ void* unwind_context, /* Unwind context */
void* handler_context /* Private handler context */ ChfPointer handler_context /* Private handler context */
); );
/* Pop a handler */ /* Pop a handler */
void ChfPopHandler( const int module_id ); void ChfPopHandler( const int module_id );

View file

@ -49,6 +49,16 @@
#define CHF_MODULE_ID CHF_SET #define CHF_MODULE_ID CHF_SET
#define CHF_TMP_MESSAGE_LENGTH ( 2 * CHF_MAX_MESSAGE_LENGTH ) #define CHF_TMP_MESSAGE_LENGTH ( 2 * CHF_MAX_MESSAGE_LENGTH )
#define CHF_DEF_MESSAGE_LENGTH 40 #define CHF_DEF_MESSAGE_LENGTH 40
#define CHF_DEF_PARTIAL_MSG_FMT "Code <%d>d"
#define CHF_DEF_MID_MSG_FMT "Mid <%d>d"
#define CHF_EXTENDED_INFO_FMT "(%s,%)"
#define CHF_SEVERITY_NAMES { "S", "I", "W", "E", "F" }
#define CHF_UNKNOWN_SEVERITY "?"
#define CHF_MESSAGE_SEPARATOR "-"
#define CHF_MESSAGE_TERMINATOR "\n"
#define CHF_ABORT_HEADER "ChfAbort-F-"
#define CHF_ABORT_BAD_CODE_FMT "Bad abort code <%d>d\n"
#define CHF_ABORT_GOOD_CODE_FMT "%s\n"
/* ------------------------------------------------------------------------- /* -------------------------------------------------------------------------
Abort codes used with ChfAbort() Abort codes used with ChfAbort()
@ -73,7 +83,7 @@
typedef struct ChfHandlerDescriptor_S { typedef struct ChfHandlerDescriptor_S {
ChfHandler handler; ChfHandler handler;
void* unwind_context; void* unwind_context;
void* handler_context; ChfPointer handler_context;
} ChfHandlerDescriptor; } ChfHandlerDescriptor;
typedef struct ChfContext_S /* CHF Context */ typedef struct ChfContext_S /* CHF Context */
@ -117,4 +127,15 @@ extern ChfContext _chf_context; /* CHF Context */
ChfContext* _ChfGetContext( void ); ChfContext* _ChfGetContext( void );
#endif #endif
/* -------------------------------------------------------------------------
Private redirection of stdlib functions needed by Win32
------------------------------------------------------------------------- */
#define ChfStrlen strlen
#define ChfStrcpy strcpy
#define ChfStrcat strcat
#define ChfStrncpy strncpy
#define ChfSprintf sprintf
#define ChfVsprintf vsprintf
#endif /*!_CHF_PRIV_H*/ #endif /*!_CHF_PRIV_H*/

40
src/libChf/src/chf.msf Normal file
View file

@ -0,0 +1,40 @@
$ .+
$ .
$ .identifier : $Id: chf.msf,v 2.2 2001/01/25 12:00:19 cibrario Exp $
$ .context :
$ .title : $RCSfile: chf.msf,v $
$ .kind : Makefile
$ .author : Ivan Cibrario B.
$ .site : CSTV-CNR
$ .creation : 27-May-1996
$ .keywords : *
$ .description :
$ . Message source file for the CHF conditions
$ .notes :
$ . $Log: chf.msf,v $
$ . Revision 2.2 2001/01/25 12:00:19 cibrario
$ . Added partial Win32 support (Windows CE only).
$ .
$ . Revision 2.1 2000/05/26 14:17:21 cibrario
$ . Updated documentation block and RCS log message header to prevent
$ . gencat warnings on Linux boxes
$ .
$ . Revision 1.1 1996/05/28 12:57:06 cibrario
$ . Initial revision
$ .
$ .-
$set 1
2 Chf
3 Errno
$set 2
1 Condition stack is full
2 Handler stack is full
3 Handler stack is empty
4 Wrong Chf state for requested operation
5 Invalid action code from handler (code=<%d>d)
6 Dynamic memory allocation failed
7 Function not implemented
10 setlocale() failed
11 catopen() failed

View file

@ -109,13 +109,13 @@ void ChfAbort( /* Abort application */
"Pthread interaction failed" }; "Pthread interaction failed" };
if ( abort_code != CHF_ABORT_SILENT ) { if ( abort_code != CHF_ABORT_SILENT ) {
fputs( "ChfAbort-F-", stderr ); fputs( CHF_ABORT_HEADER, stderr );
if ( abort_code < 0 || abort_code >= ( int )( sizeof( message_table ) / sizeof( const char* ) ) ) if ( abort_code < 0 || abort_code >= ( int )( sizeof( message_table ) / sizeof( const char* ) ) )
fprintf( stderr, "Bad abort code <%d>d\n", abort_code ); fprintf( stderr, CHF_ABORT_BAD_CODE_FMT, abort_code );
else else
fprintf( stderr, "%s\n", message_table[ abort_code ] ); fprintf( stderr, CHF_ABORT_GOOD_CODE_FMT, message_table[ abort_code ] );
} }
if ( chf_context.state == CHF_UNKNOWN || chf_context.options & CHF_ABORT ) if ( chf_context.state == CHF_UNKNOWN || chf_context.options & CHF_ABORT )

View file

@ -106,8 +106,8 @@ void ChfGenerate( /* Generate a condition into the stack */
new_descriptor->line_number = CHF_UNKNOWN_LINE_NUMBER; new_descriptor->line_number = CHF_UNKNOWN_LINE_NUMBER;
new_descriptor->file_name = CHF_UNKNOWN_FILE_NAME; new_descriptor->file_name = CHF_UNKNOWN_FILE_NAME;
strncpy( new_descriptor->message, ChfGetMessage( module_id, CHF_F_COND_STACK_FULL, "Condition stack is full" ), ChfStrncpy( new_descriptor->message, ChfGetMessage( module_id, CHF_F_COND_STACK_FULL, "Condition stack is full" ),
CHF_MAX_MESSAGE_LENGTH - 1 ); CHF_MAX_MESSAGE_LENGTH - 1 );
new_descriptor->message[ CHF_MAX_MESSAGE_LENGTH - 1 ] = '\0'; new_descriptor->message[ CHF_MAX_MESSAGE_LENGTH - 1 ] = '\0';
new_descriptor->next = CHF_NULL_DESCRIPTOR; new_descriptor->next = CHF_NULL_DESCRIPTOR;
@ -131,16 +131,16 @@ void ChfGenerate( /* Generate a condition into the stack */
new_descriptor->file_name = file_name; new_descriptor->file_name = file_name;
/* Generate the default message */ /* Generate the default message */
sprintf( def_message, "Code <%d>d", condition_code ); ChfSprintf( def_message, CHF_DEF_PARTIAL_MSG_FMT, condition_code );
/* Generate the partial message associated with the condition using a /* Generate the partial message associated with the condition using a
temporary area temporary area
*/ */
if ( vsprintf( tmp_message, ChfGetMessage( module_id, condition_code, def_message ), aux_arg ) >= CHF_TMP_MESSAGE_LENGTH ) if ( ChfVsprintf( tmp_message, ChfGetMessage( module_id, condition_code, def_message ), aux_arg ) >= CHF_TMP_MESSAGE_LENGTH )
ChfAbort( CHF_ABORT_MSG_OVF ); ChfAbort( CHF_ABORT_MSG_OVF );
/* Copy the message into the condition descriptor */ /* Copy the message into the condition descriptor */
strncpy( new_descriptor->message, tmp_message, CHF_MAX_MESSAGE_LENGTH - 1 ); ChfStrncpy( new_descriptor->message, tmp_message, CHF_MAX_MESSAGE_LENGTH - 1 );
new_descriptor->message[ CHF_MAX_MESSAGE_LENGTH - 1 ] = '\0'; new_descriptor->message[ CHF_MAX_MESSAGE_LENGTH - 1 ] = '\0';
/* Link the new descriptor with the current descriptor list, if it /* Link the new descriptor with the current descriptor list, if it

View file

@ -78,7 +78,7 @@
2.1, 19-May-2000, creation 2.1, 19-May-2000, creation
.- */ .- */
static ChfAction StructuredHelper( const ChfDescriptor* desc, const ChfState state, void* handler_context ) static ChfAction StructuredHelper( const ChfDescriptor* desc, const ChfState state, ChfPointer handler_context )
{ {
ChfAction action; ChfAction action;
const ChfDescriptor* d; const ChfDescriptor* d;
@ -128,7 +128,7 @@ static ChfAction StructuredHelper( const ChfDescriptor* desc, const ChfState sta
.input : .input :
ChfHandler new_handler, new condition handler ChfHandler new_handler, new condition handler
void *unwind_context, handler unwind context pointer void *unwind_context, handler unwind context pointer
void* handler_context, private handler context pointer ChfPointer handler_context, private handler context pointer
.output : .output :
void void
.status_codes : .status_codes :
@ -145,7 +145,7 @@ static ChfAction StructuredHelper( const ChfDescriptor* desc, const ChfState sta
.- */ .- */
void ChfPushHandler( /* Push a new handler into the stack */ void ChfPushHandler( /* Push a new handler into the stack */
const int module_id, ChfHandler new_handler, void* unwind_context, void* handler_context ) const int module_id, ChfHandler new_handler, void* unwind_context, ChfPointer handler_context )
{ {
/* Make sure that CHF has been correctly initialized and is idle */ /* Make sure that CHF has been correctly initialized and is idle */
if ( chf_context.state == CHF_UNKNOWN ) if ( chf_context.state == CHF_UNKNOWN )

View file

@ -69,8 +69,8 @@ static char rcs_lib_id[] = CHF_LIBRARY_ID;
ChfContext _chf_context; ChfContext _chf_context;
/* Message separator and severity names for ChfBuildMessage() */ /* Message separator and severity names for ChfBuildMessage() */
static const char separator[] = "-"; static const char separator[] = CHF_MESSAGE_SEPARATOR;
static const char* severity_name[] = { "S", "I", "W", "E", "F" }; static const char* severity_name[] = CHF_SEVERITY_NAMES;
/* ------------------------------------------------------------------------- /* -------------------------------------------------------------------------
Multithreading support Multithreading support
@ -155,7 +155,7 @@ static void DestroyContext( void* context )
- added Win32 support - added Win32 support
.- */ .- */
static ChfAction DefaultHandler( const ChfDescriptor* desc, const ChfState state, void* handler_context ) static ChfAction DefaultHandler( const ChfDescriptor* desc, const ChfState state, ChfPointer handler_context )
{ {
ChfAction action; ChfAction action;
const ChfDescriptor* d; const ChfDescriptor* d;
@ -235,16 +235,16 @@ static ChfAction DefaultHandler( const ChfDescriptor* desc, const ChfState state
.- */ .- */
static char* scopy( char* p, const char* q, char* p_end ) static char* scopy( char* p, const char* q, char* p_end )
{ {
size_t q_len = strlen( q ); size_t q_len = ChfStrlen( q );
size_t p_avail = p_end - p; size_t p_avail = p_end - p;
if ( q_len < p_avail ) { if ( q_len < p_avail ) {
strcpy( p, q ); ChfStrcpy( p, q );
p += q_len; p += q_len;
} }
else if ( p_avail > 1 ) { else if ( p_avail > 1 ) {
strncpy( p, q, p_avail - 2 ); ChfStrncpy( p, q, p_avail - 2 );
p[ p_avail - 1 ] = '\0'; p[ p_avail - 1 ] = '\0';
p = p_end; p = p_end;
} }
@ -374,7 +374,7 @@ char* ChfBuildMessage( /* Build a condition message */
tmp_p = scopy( tmp_p, "\t", tmp_end ); tmp_p = scopy( tmp_p, "\t", tmp_end );
/* The message continues with the module name */ /* The message continues with the module name */
sprintf( def_message, "Mid <%d>d", descriptor->module_id ); ChfSprintf( def_message, CHF_DEF_MID_MSG_FMT, descriptor->module_id );
tmp_p = scopy( tmp_p, ChfGetMessage( CHF_MODULE_NAMES_SET, descriptor->module_id, def_message ), tmp_end ); tmp_p = scopy( tmp_p, ChfGetMessage( CHF_MODULE_NAMES_SET, descriptor->module_id, def_message ), tmp_end );
@ -382,7 +382,7 @@ char* ChfBuildMessage( /* Build a condition message */
if ( descriptor->line_number != CHF_UNKNOWN_LINE_NUMBER ) { if ( descriptor->line_number != CHF_UNKNOWN_LINE_NUMBER ) {
tmp_p = scopy( tmp_p, " ", tmp_end ); tmp_p = scopy( tmp_p, " ", tmp_end );
sprintf( def_message, "(%s,%)", descriptor->file_name, descriptor->line_number ); ChfSprintf( def_message, CHF_EXTENDED_INFO_FMT, descriptor->file_name, descriptor->line_number );
tmp_p = scopy( tmp_p, def_message, tmp_end ); tmp_p = scopy( tmp_p, def_message, tmp_end );
} }
@ -390,14 +390,16 @@ char* ChfBuildMessage( /* Build a condition message */
tmp_p = scopy( tmp_p, separator, tmp_end ); tmp_p = scopy( tmp_p, separator, tmp_end );
/* Add the severity code of the message */ /* Add the severity code of the message */
tmp_p = scopy( tmp_p, ( ( severity = descriptor->severity ) < CHF_SUCCESS || severity > CHF_FATAL ) ? "?" : severity_name[ severity ], tmp_p = scopy( tmp_p,
( ( severity = descriptor->severity ) < CHF_SUCCESS || severity > CHF_FATAL ) ? CHF_UNKNOWN_SEVERITY
: severity_name[ severity ],
tmp_end ); tmp_end );
tmp_p = scopy( tmp_p, separator, tmp_end ); tmp_p = scopy( tmp_p, separator, tmp_end );
/* The message ends with the partial message from the descriptor */ /* The message ends with the partial message from the descriptor */
tmp_p = scopy( tmp_p, descriptor->message, tmp_end ); tmp_p = scopy( tmp_p, descriptor->message, tmp_end );
( void )scopy( tmp_p, "\n", tmp_end ); ( void )scopy( tmp_p, CHF_MESSAGE_TERMINATOR, tmp_end );
return chf_context.message_buffer; return chf_context.message_buffer;
} }

View file

@ -26,7 +26,7 @@ struct tdata_s {
int phase; int phase;
}; };
ChfAction h1( const ChfDescriptor* c, const ChfState s, void* p ) ChfAction h1( const ChfDescriptor* c, const ChfState s, ChfPointer p )
{ {
struct tdata_s* tdata_p = ( struct tdata_s* )p; struct tdata_s* tdata_p = ( struct tdata_s* )p;
ChfAction action; ChfAction action;
@ -42,7 +42,7 @@ ChfAction h1( const ChfDescriptor* c, const ChfState s, void* p )
return action; return action;
} }
ChfAction h2( const ChfDescriptor* c, const ChfState s, void* p ) ChfAction h2( const ChfDescriptor* c, const ChfState s, ChfPointer p )
{ {
struct tdata_s* tdata_p = ( struct tdata_s* )p; struct tdata_s* tdata_p = ( struct tdata_s* )p;
ChfAction action; ChfAction action;
@ -76,7 +76,7 @@ ChfAction h2( const ChfDescriptor* c, const ChfState s, void* p )
return action; return action;
} }
ChfAction h3( const ChfDescriptor* c, const ChfState s, void* p ) ChfAction h3( const ChfDescriptor* c, const ChfState s, ChfPointer p )
{ {
struct tdata_s* tdata_p = ( struct tdata_s* )p; struct tdata_s* tdata_p = ( struct tdata_s* )p;
ChfAction action; ChfAction action;
@ -106,7 +106,7 @@ ChfAction h3( const ChfDescriptor* c, const ChfState s, void* p )
return action; return action;
} }
ChfAction h4( const ChfDescriptor* c, const ChfState s, void* p ) ChfAction h4( const ChfDescriptor* c, const ChfState s, ChfPointer p )
{ {
struct tdata_s* tdata_p = ( struct tdata_s* )p; struct tdata_s* tdata_p = ( struct tdata_s* )p;
ChfAction action; ChfAction action;
@ -159,7 +159,7 @@ void* task( void* arg )
printf( "\tThread %d\n", ( int )arg ); printf( "\tThread %d\n", ( int )arg );
/* Push the handler */ /* Push the handler */
ChfPushHandler( h1, NULL, ( void* )( &tdata ) ); ChfPushHandler( h1, NULL, ( ChfPointer )( &tdata ) );
/* Generate a condition group and signal it */ /* Generate a condition group and signal it */
CHF_Condition 6, CHF_INFO, ( int )arg ChfEnd; CHF_Condition 6, CHF_INFO, ( int )arg ChfEnd;
@ -190,7 +190,7 @@ void* task( void* arg )
tdata.phase = 0; tdata.phase = 0;
if ( setjmp( jb ) == 0 ) { if ( setjmp( jb ) == 0 ) {
ChfPushHandler( h2, jb, ( void* )( &tdata ) ); ChfPushHandler( h2, jb, ( ChfPointer )( &tdata ) );
/* Generate a condition group and signal it */ /* Generate a condition group and signal it */
tdata.phase = 1; tdata.phase = 1;
@ -230,8 +230,8 @@ void* task( void* arg )
{ {
tdata.phase = 0; tdata.phase = 0;
ChfPushHandler( h3, NULL, ( void* )&tdata ); ChfPushHandler( h3, NULL, ( ChfPointer )&tdata );
ChfPushHandler( h4, NULL, ( void* )&tdata ); ChfPushHandler( h4, NULL, ( ChfPointer )&tdata );
tdata.phase = 1; tdata.phase = 1;
CHF_Condition 6, CHF_INFO, ( int )arg ChfEnd; CHF_Condition 6, CHF_INFO, ( int )arg ChfEnd;

View file

@ -27,14 +27,14 @@
/* Dummy handler; pushed only to verify that the handler stack overflow /* Dummy handler; pushed only to verify that the handler stack overflow
checks are correct. checks are correct.
*/ */
ChfAction h1( const ChfDescriptor* c, const ChfState s, void* p ) { return CHF_RESIGNAL; } ChfAction h1( const ChfDescriptor* c, const ChfState s, ChfPointer p ) { return CHF_RESIGNAL; }
/* Overflow check handler; it unwinds if the CHF_F_HDLR_STACK_FULL /* Overflow check handler; it unwinds if the CHF_F_HDLR_STACK_FULL
condition is signalled exactly after H_STACK_SIZE-2 invocations condition is signalled exactly after H_STACK_SIZE-2 invocations
of ChfPushHandler(), it resignals a modified condition if the of ChfPushHandler(), it resignals a modified condition if the
condition is signalled too early condition is signalled too early
*/ */
ChfAction h2( const ChfDescriptor* c, const ChfState s, void* p ) ChfAction h2( const ChfDescriptor* c, const ChfState s, ChfPointer p )
{ {
int push_count = *( ( int* )p ); int push_count = *( ( int* )p );
ChfAction action; ChfAction action;
@ -62,7 +62,7 @@ ChfAction h2( const ChfDescriptor* c, const ChfState s, void* p )
of CHF_Condition, it resignals a modified condition if the of CHF_Condition, it resignals a modified condition if the
condition is signalled too early condition is signalled too early
*/ */
ChfAction h3( const ChfDescriptor* c, const ChfState s, void* p ) ChfAction h3( const ChfDescriptor* c, const ChfState s, ChfPointer p )
{ {
int push_count = *( ( int* )p ); int push_count = *( ( int* )p );
ChfAction action; ChfAction action;
@ -100,7 +100,7 @@ void* task( void* arg )
int i; int i;
/* Push the handler */ /* Push the handler */
ChfPushHandler( h2, jb, ( void* )( &push_count ) ); ChfPushHandler( h2, jb, ( ChfPointer )( &push_count ) );
/* The sleep() is here to increase contention between threads */ /* The sleep() is here to increase contention between threads */
sleep( 1 ); sleep( 1 );
@ -122,7 +122,7 @@ void* task( void* arg )
int i; int i;
/* Push the handler */ /* Push the handler */
ChfPushHandler( h3, jb, ( void* )( &push_count ) ); ChfPushHandler( h3, jb, ( ChfPointer )( &push_count ) );
/* The sleep() is here to increase contention between threads */ /* The sleep() is here to increase contention between threads */
sleep( 1 ); sleep( 1 );
@ -145,7 +145,7 @@ void* task( void* arg )
int i; int i;
/* Push the handler */ /* Push the handler */
ChfPushHandler( h3, jb, ( void* )( &push_count ) ); ChfPushHandler( h3, jb, ( ChfPointer )( &push_count ) );
/* The sleep() is here to increase contention between threads */ /* The sleep() is here to increase contention between threads */
sleep( 1 ); sleep( 1 );