remove superfluous libChf #define

This commit is contained in:
Gwenhael Le Moine 2024-10-08 13:00:13 +02:00
parent a31bfcec42
commit 687f48b3e7
No known key found for this signature in database
GPG key ID: FDFE3669426707A7
36 changed files with 369 additions and 403 deletions

View file

@ -257,7 +257,7 @@ static void ExecSHUTDN( void )
cpu_status.shutdn = 1;
/* the CPU module implements SHUTDN signalling the condition CPU_I_SHUTDN */
ChfCondition( CPU_CHF_MODULE_ID ) CPU_I_SHUTDN, CHF_INFO ChfEnd;
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_I_SHUTDN, CHF_INFO ChfEnd;
ChfSignal( CPU_CHF_MODULE_ID );
}
@ -1109,7 +1109,7 @@ static void ExecTest_9( void )
break;
default:
ChfCondition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Test_Code" ChfEnd;
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Test_Code" ChfEnd;
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -1146,7 +1146,7 @@ static void ExecTest_8A( void )
break;
default:
ChfCondition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Test_Code" ChfEnd;
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Test_Code" ChfEnd;
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -1183,7 +1183,7 @@ static void ExecTest_8B( void )
break;
default:
ChfCondition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Test_Code" ChfEnd;
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Test_Code" ChfEnd;
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -1238,7 +1238,7 @@ static void ExecRegOp_A( void )
break;
default:
ChfCondition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" ChfEnd;
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" ChfEnd;
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -1290,7 +1290,7 @@ static void ExecRegOp_B( void )
break;
default:
ChfCondition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" ChfEnd;
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" ChfEnd;
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -1324,7 +1324,7 @@ static void ExecRegOp_C( void )
break;
default:
ChfCondition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" ChfEnd;
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" ChfEnd;
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -1358,7 +1358,7 @@ static void ExecRegOp_D( void )
break;
default:
ChfCondition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" ChfEnd;
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" ChfEnd;
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -1392,7 +1392,7 @@ static void ExecRegOp_E( void )
break;
default:
ChfCondition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" ChfEnd;
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" ChfEnd;
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -1426,7 +1426,7 @@ static void ExecRegOp_F( void )
break;
default:
ChfCondition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" ChfEnd;
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" ChfEnd;
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -1461,7 +1461,7 @@ static void ExecAND_OR( void )
break;
default:
ChfCondition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" ChfEnd;
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" ChfEnd;
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -1573,7 +1573,7 @@ static void ExecGroup_0( void )
break;
default: /* Unknown opcode */
ChfCondition( CPU_CHF_MODULE_ID ) CPU_E_BAD_OPCODE, CHF_ERROR, cpu_status.PC, n ChfEnd;
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_E_BAD_OPCODE, CHF_ERROR, cpu_status.PC, n ChfEnd;
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -1834,7 +1834,7 @@ static void ExecGroup_1( void )
break;
default:
ChfCondition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" ChfEnd;
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" ChfEnd;
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -1904,7 +1904,7 @@ static void ExecGroup_1( void )
default:
/* Unknown opcode */
ChfCondition( CPU_CHF_MODULE_ID ) CPU_E_BAD_OPCODE, CHF_ERROR, cpu_status.PC, n ChfEnd;
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_E_BAD_OPCODE, CHF_ERROR, cpu_status.PC, n ChfEnd;
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -1939,7 +1939,7 @@ static void ExecGroup_808( void )
case 3: /* BUSCB */
debug1( DEBUG_C_TRACE, CPU_I_CALLED, "ExecBUSCB" );
ChfCondition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_WARNING, "BUSCB" ChfEnd;
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_WARNING, "BUSCB" ChfEnd;
ChfSignal( CPU_CHF_MODULE_ID );
break;
@ -1986,7 +1986,7 @@ static void ExecGroup_808( void )
case 0xD:
/* BUSCD */
debug1( DEBUG_C_TRACE, CPU_I_CALLED, "ExecBUSCD" );
ChfCondition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_WARNING, "BUSCD" ChfEnd;
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_WARNING, "BUSCD" ChfEnd;
ChfSignal( CPU_CHF_MODULE_ID );
break;
@ -2004,7 +2004,7 @@ static void ExecGroup_808( void )
default:
/* Unknown opcode */
ChfCondition( CPU_CHF_MODULE_ID ) CPU_E_BAD_OPCODE, CHF_ERROR, cpu_status.PC, n ChfEnd;
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_E_BAD_OPCODE, CHF_ERROR, cpu_status.PC, n ChfEnd;
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -2070,13 +2070,13 @@ static void ExecGroup_80( void )
case 0xB: /* BUSCC */
debug1( DEBUG_C_TRACE, CPU_I_CALLED, "ExecBUSCC" );
// FIXME: 49g bugs here on display change
ChfCondition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_WARNING, "BUSCC" ChfEnd;
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_WARNING, "BUSCC" ChfEnd;
ChfSignal( CPU_CHF_MODULE_ID );
break;
case 0xE: /* SREQ? */
debug1( DEBUG_C_TRACE, CPU_I_CALLED, "ExecSREQ" );
ChfCondition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_WARNING, "SREQ" ChfEnd;
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_WARNING, "SREQ" ChfEnd;
ChfSignal( CPU_CHF_MODULE_ID );
break;
@ -2096,7 +2096,7 @@ static void ExecGroup_80( void )
break;
default:
ChfCondition( CPU_CHF_MODULE_ID ) CPU_E_BAD_OPCODE, CHF_ERROR, cpu_status.PC, n ChfEnd;
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_E_BAD_OPCODE, CHF_ERROR, cpu_status.PC, n ChfEnd;
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -2150,7 +2150,7 @@ static void ExecSpecialGroup_81( int rp )
break;
default:
ChfCondition( CPU_CHF_MODULE_ID ) CPU_E_BAD_OPCODE, CHF_ERROR, cpu_status.PC, n ChfEnd;
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_E_BAD_OPCODE, CHF_ERROR, cpu_status.PC, n ChfEnd;
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -2193,14 +2193,14 @@ static void ExecSpecialGroup_81( int rp )
}
default:
ChfCondition( CPU_CHF_MODULE_ID ) CPU_E_BAD_OPCODE, CHF_ERROR, cpu_status.PC, n ChfEnd;
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_E_BAD_OPCODE, CHF_ERROR, cpu_status.PC, n ChfEnd;
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
break;
default:
ChfCondition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Register_Pair" ChfEnd;
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Register_Pair" ChfEnd;
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -2242,7 +2242,7 @@ static void ExecGroup_8( void )
break;
default:
ChfCondition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" ChfEnd;
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" ChfEnd;
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -2319,7 +2319,7 @@ static void ExecGroup_8( void )
break;
default:
ChfCondition( CPU_CHF_MODULE_ID ) CPU_E_BAD_OPCODE, CHF_ERROR, cpu_status.PC, n ChfEnd;
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_E_BAD_OPCODE, CHF_ERROR, cpu_status.PC, n ChfEnd;
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -2476,7 +2476,7 @@ void CpuInit( void )
debug1( DEBUG_C_REVISION, CPU_I_REVISION, CPU_RCS_INFO );
if ( ReadStructFromFile( config.cpu_file_name, sizeof( cpu_status ), &cpu_status ) ) {
ChfCondition( CPU_CHF_MODULE_ID ) CPU_W_RESETTING, CHF_WARNING ChfEnd;
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_W_RESETTING, CHF_WARNING ChfEnd;
ChfSignal( CPU_CHF_MODULE_ID );
CpuReset();
@ -2512,7 +2512,7 @@ void CpuSave( void )
debug1( DEBUG_C_TRACE, CPU_I_CALLED, "CpuSave" );
if ( WriteStructToFile( &cpu_status, sizeof( cpu_status ), config.cpu_file_name ) ) {
ChfCondition( CPU_CHF_MODULE_ID ) CPU_E_SAVE, CHF_ERROR ChfEnd;
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_E_SAVE, CHF_ERROR ChfEnd;
ChfSignal( CPU_CHF_MODULE_ID );
}
}
@ -2942,7 +2942,7 @@ void OneStep( void )
break;
default:
ChfCondition( CPU_CHF_MODULE_ID ) CPU_E_BAD_OPCODE, CHF_ERROR, cpu_status.PC, n ChfEnd;
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_E_BAD_OPCODE, CHF_ERROR, cpu_status.PC, n ChfEnd;
ChfSignal( CPU_CHF_MODULE_ID );
break;
}

View file

@ -105,7 +105,7 @@ void SetDebugLevel( int new_level )
#ifdef DEBUG
debug_level |= new_level;
#else
ChfCondition( DEBUG_CHF_MODULE_ID ) DEBUG_W_NOT_SUPPORTED, CHF_WARNING ChfEnd;
CHF_Condition( DEBUG_CHF_MODULE_ID ) DEBUG_W_NOT_SUPPORTED, CHF_WARNING ChfEnd;
ChfSignal( DEBUG_CHF_MODULE_ID );
#endif
}

View file

@ -108,7 +108,7 @@ extern int debug_level;
# define debug_preamble( debug_class, condition_code ) \
{ \
if ( debug_level & ( debug_class ) ) { \
ChfCondition( CHF_MODULE_ID ) condition_code, CHF_INFO
CHF_Condition( CHF_MODULE_ID ) condition_code, CHF_INFO
# define debug_postamble \
ChfEnd; \

View file

@ -407,7 +407,7 @@ static Address DisTest_9( Address pc, char* ob )
break;
default:
ChfCondition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Test_Code" ChfEnd;
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Test_Code" ChfEnd;
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -540,7 +540,7 @@ static Address DisRegOp_A( Address pc, char* ob )
break;
default:
ChfCondition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" ChfEnd;
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" ChfEnd;
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -672,7 +672,7 @@ static Address DisRegOp_B( Address pc, char* ob )
break;
default:
ChfCondition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" ChfEnd;
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" ChfEnd;
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -751,7 +751,7 @@ static Address DisRegOp_C( Address pc, char* ob )
break;
default:
ChfCondition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" ChfEnd;
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" ChfEnd;
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -830,7 +830,7 @@ static Address DisRegOp_D( Address pc, char* ob )
break;
default:
ChfCondition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" ChfEnd;
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" ChfEnd;
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -910,7 +910,7 @@ static Address DisRegOp_E( Address pc, char* ob )
break;
default:
ChfCondition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" ChfEnd;
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" ChfEnd;
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -990,7 +990,7 @@ static Address DisRegOp_F( Address pc, char* ob )
break;
default:
ChfCondition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" ChfEnd;
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" ChfEnd;
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -1082,7 +1082,7 @@ static Address DisAND_OR( Address pc, char* ob )
break;
default:
ChfCondition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" ChfEnd;
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" ChfEnd;
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -1143,7 +1143,7 @@ static Address DisGroup_0( Address pc, char* ob )
/* Unknown opcode */
strcpy( ob, "?" );
ChfCondition( CPU_CHF_MODULE_ID ) CPU_E_BAD_OPCODE, CHF_ERROR, pc, n ChfEnd;
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_E_BAD_OPCODE, CHF_ERROR, pc, n ChfEnd;
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -1414,7 +1414,7 @@ static Address DisGroup_1( Address pc, char* ob )
/* Unknown opcode */
strcpy( ob, "?" );
ChfCondition( CPU_CHF_MODULE_ID ) CPU_E_BAD_OPCODE, CHF_ERROR, pc, n ChfEnd;
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_E_BAD_OPCODE, CHF_ERROR, pc, n ChfEnd;
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -1529,7 +1529,7 @@ static Address DisGroup_808( Address pc, char* ob )
/* Unknown opcode */
strcpy( ob, "?" );
ChfCondition( CPU_CHF_MODULE_ID ) CPU_E_BAD_OPCODE, CHF_ERROR, pc, n ChfEnd;
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_E_BAD_OPCODE, CHF_ERROR, pc, n ChfEnd;
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -1598,7 +1598,7 @@ static Address DisGroup_80( Address pc, char* ob )
/* Unknown opcode */
strcpy( ob, "?" );
ChfCondition( CPU_CHF_MODULE_ID ) CPU_E_BAD_OPCODE, CHF_ERROR, pc, n ChfEnd;
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_E_BAD_OPCODE, CHF_ERROR, pc, n ChfEnd;
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -1741,7 +1741,7 @@ static Address DisSpecialGroup_81( Address pc, char* ob, int rp )
break;
default:
ChfCondition( CPU_CHF_MODULE_ID ) CPU_E_BAD_OPCODE, CHF_ERROR, pc, n ChfEnd;
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_E_BAD_OPCODE, CHF_ERROR, pc, n ChfEnd;
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -1755,7 +1755,7 @@ static Address DisSpecialGroup_81( Address pc, char* ob, int rp )
break;
default:
ChfCondition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Register_Pair" ChfEnd;
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Register_Pair" ChfEnd;
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -1832,7 +1832,7 @@ static Address DisTest_8A( Address pc, char* ob )
break;
default:
ChfCondition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Test_Code" ChfEnd;
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Test_Code" ChfEnd;
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -1913,7 +1913,7 @@ static Address DisTest_8B( Address pc, char* ob )
break;
default:
ChfCondition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Test_Code" ChfEnd;
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Test_Code" ChfEnd;
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -2011,7 +2011,7 @@ static Address DisGroup_8( Address pc, char* ob )
break;
default:
ChfCondition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" ChfEnd;
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_F_INTERR, CHF_FATAL, "Bad_Operation_Code" ChfEnd;
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -2180,7 +2180,7 @@ static Address DisGroup_8( Address pc, char* ob )
/* Unknown opcode */
strcpy( ob, "?" );
ChfCondition( CPU_CHF_MODULE_ID ) CPU_E_BAD_OPCODE, CHF_ERROR, pc, n ChfEnd;
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_E_BAD_OPCODE, CHF_ERROR, pc, n ChfEnd;
ChfSignal( CPU_CHF_MODULE_ID );
break;
}
@ -2311,7 +2311,7 @@ Address Disassemble( Address pc, char ob[ DISASSEMBLE_OB_SIZE ] )
/* Unknown opcode */
strcpy( ob, "?" );
ChfCondition( CPU_CHF_MODULE_ID ) CPU_E_BAD_OPCODE, CHF_ERROR, pc, n ChfEnd;
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_E_BAD_OPCODE, CHF_ERROR, pc, n ChfEnd;
ChfSignal( CPU_CHF_MODULE_ID );
break;
}

View file

@ -109,15 +109,15 @@ int ReadNibblesFromFile( const char* name, int size, Nibble* dest )
debug1( DEBUG_C_TRACE, DISK_IO_I_CALLED, "ReadNibblesFromFile" );
if ( ( f = fopen( name, "rb" ) ) == ( FILE* )NULL ) {
ChfErrnoCondition;
ChfCondition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_OPEN, CHF_ERROR, name ChfEnd;
CHF_ErrnoCondition;
CHF_Condition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_OPEN, CHF_ERROR, name ChfEnd;
} else {
for ( i = 0; i < size; ) {
by = getc( f );
if ( by == -1 ) {
ChfErrnoCondition;
ChfCondition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_GETC, CHF_ERROR, name ChfEnd;
CHF_ErrnoCondition;
CHF_Condition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_GETC, CHF_ERROR, name ChfEnd;
break;
}
@ -167,23 +167,23 @@ int WriteNibblesToFile( const Nibble* src, int size, const char* name )
debug1( DEBUG_C_TRACE, DISK_IO_I_CALLED, "WriteNibblesToFile" );
if ( ( f = fopen( name, "wb" ) ) == ( FILE* )NULL ) {
ChfErrnoCondition;
ChfCondition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_OPEN, CHF_ERROR, name ChfEnd;
CHF_ErrnoCondition;
CHF_Condition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_OPEN, CHF_ERROR, name ChfEnd;
} else {
for ( i = 0; i < size; ) {
by = ( int )src[ i++ ];
by |= ( int )src[ i++ ] << 4;
if ( putc( by, f ) == EOF ) {
ChfErrnoCondition;
ChfCondition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_PUTC, CHF_ERROR, name ChfEnd;
CHF_ErrnoCondition;
CHF_Condition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_PUTC, CHF_ERROR, name ChfEnd;
break;
}
}
if ( fclose( f ) == EOF ) {
ChfErrnoCondition;
ChfCondition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_CLOSE, CHF_ERROR, name ChfEnd;
CHF_ErrnoCondition;
CHF_Condition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_CLOSE, CHF_ERROR, name ChfEnd;
}
}
@ -222,12 +222,12 @@ int ReadStructFromFile( const char* name, size_t s_size, void* s )
debug1( DEBUG_C_TRACE, DISK_IO_I_CALLED, "ReadStructFromFile" );
if ( ( f = fopen( name, "rb" ) ) == ( FILE* )NULL ) {
ChfErrnoCondition;
ChfCondition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_OPEN, CHF_ERROR, name ChfEnd;
CHF_ErrnoCondition;
CHF_Condition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_OPEN, CHF_ERROR, name ChfEnd;
} else {
if ( fread( s, s_size, ( size_t )1, f ) != 1 ) {
ChfErrnoCondition;
ChfCondition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_READ, CHF_ERROR, name ChfEnd;
CHF_ErrnoCondition;
CHF_Condition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_READ, CHF_ERROR, name ChfEnd;
}
( void )fclose( f );
@ -270,17 +270,17 @@ int WriteStructToFile( const void* s, size_t s_size, const char* name )
debug1( DEBUG_C_TRACE, DISK_IO_I_CALLED, "WriteStructToFile" );
if ( ( f = fopen( name, "wb" ) ) == ( FILE* )NULL ) {
ChfErrnoCondition;
ChfCondition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_OPEN, CHF_ERROR, name ChfEnd;
CHF_ErrnoCondition;
CHF_Condition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_OPEN, CHF_ERROR, name ChfEnd;
} else {
if ( fwrite( s, s_size, ( size_t )1, f ) != 1 ) {
ChfErrnoCondition;
ChfCondition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_WRITE, CHF_ERROR, name ChfEnd;
CHF_ErrnoCondition;
CHF_Condition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_WRITE, CHF_ERROR, name ChfEnd;
}
if ( fclose( f ) == EOF ) {
ChfErrnoCondition;
ChfCondition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_CLOSE, CHF_ERROR, name ChfEnd;
CHF_ErrnoCondition;
CHF_Condition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_CLOSE, CHF_ERROR, name ChfEnd;
}
}

View file

@ -136,19 +136,19 @@ int ReadObjectFromFile( const char* name, const char* hdr, Address start, Addres
save_area[ i ] = ReadNibble( cur );
if ( ( f = fopen( name, "rb" ) ) == ( FILE* )NULL ) {
ChfErrnoCondition;
ChfCondition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_OPEN, CHF_ERROR, name ChfEnd;
CHF_ErrnoCondition;
CHF_Condition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_OPEN, CHF_ERROR, name ChfEnd;
} else {
/* Check and skip header */
for ( i = 0; i < ( int )hdr_len; i++ ) {
by = getc( f );
if ( by == EOF ) {
ChfErrnoCondition;
ChfCondition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_GETC, CHF_ERROR, name ChfEnd;
CHF_ErrnoCondition;
CHF_Condition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_GETC, CHF_ERROR, name ChfEnd;
break;
} else if ( hdr[ i ] != '?' && by != hdr[ i ] ) {
ChfCondition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_BAD_HDR, CHF_ERROR, name ChfEnd;
CHF_Condition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_BAD_HDR, CHF_ERROR, name ChfEnd;
break;
}
}
@ -160,7 +160,7 @@ int ReadObjectFromFile( const char* name, const char* hdr, Address start, Addres
while ( ( by = getc( f ) ) != EOF ) {
/* Next byte available in by; check available space */
if ( cur >= end - 1 ) {
ChfCondition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_SIZE, CHF_ERROR, name ChfEnd;
CHF_Condition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_SIZE, CHF_ERROR, name ChfEnd;
break;
}
@ -171,8 +171,8 @@ int ReadObjectFromFile( const char* name, const char* hdr, Address start, Addres
/* Check why getc() failed */
if ( ferror( f ) && !feof( f ) ) {
ChfErrnoCondition;
ChfCondition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_GETC, CHF_ERROR, name ChfEnd;
CHF_ErrnoCondition;
CHF_Condition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_GETC, CHF_ERROR, name ChfEnd;
}
/* Recover from save_area if transfer failed */
@ -233,14 +233,14 @@ int WriteObjectToFile( Address start, Address end, const char* hdr, const char*
debug1( DEBUG_C_TRACE, DISK_IO_I_CALLED, "WriteObjectFromFile" );
if ( ( f = fopen( name, "wb" ) ) == ( FILE* )NULL ) {
ChfErrnoCondition;
ChfCondition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_OPEN, CHF_ERROR, name ChfEnd;
CHF_ErrnoCondition;
CHF_Condition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_OPEN, CHF_ERROR, name ChfEnd;
} else {
/* Write header; replace wildcard character '?' with 'S' */
for ( i = 0; i < ( int )hdr_len; i++ ) {
if ( putc( hdr[ i ] == '?' ? 'S' : hdr[ i ], f ) == EOF ) {
ChfErrnoCondition;
ChfCondition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_PUTC, CHF_ERROR, name ChfEnd;
CHF_ErrnoCondition;
CHF_Condition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_PUTC, CHF_ERROR, name ChfEnd;
break;
}
}
@ -254,8 +254,8 @@ int WriteObjectToFile( Address start, Address end, const char* hdr, const char*
by |= ( int )ReadNibble( cur++ ) << 4;
if ( putc( by, f ) == EOF ) {
ChfErrnoCondition;
ChfCondition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_PUTC, CHF_ERROR, name ChfEnd;
CHF_ErrnoCondition;
CHF_Condition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_PUTC, CHF_ERROR, name ChfEnd;
break;
}
}
@ -265,16 +265,16 @@ int WriteObjectToFile( Address start, Address end, const char* hdr, const char*
by = ( int )ReadNibble( cur++ );
if ( putc( by, f ) == EOF ) {
ChfErrnoCondition;
ChfCondition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_PUTC, CHF_ERROR, name ChfEnd;
CHF_ErrnoCondition;
CHF_Condition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_PUTC, CHF_ERROR, name ChfEnd;
}
}
}
/* Close the output file anyway */
if ( fclose( f ) == EOF ) {
ChfErrnoCondition;
ChfCondition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_CLOSE, CHF_ERROR, name ChfEnd;
CHF_ErrnoCondition;
CHF_Condition( DISK_IO_CHF_MODULE_ID ) st = DISK_IO_E_CLOSE, CHF_ERROR, name ChfEnd;
}
}

View file

@ -219,7 +219,7 @@ static void EmulatorLoop( void )
/* Emulator Interrupt Request */
if ( ( t1_count++ & INT_T1_MASK ) == 0 && emulator_int_req ) {
ChfCondition( CPU_CHF_MODULE_ID ) CPU_I_EMULATOR_INT, CHF_INFO ChfEnd;
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_I_EMULATOR_INT, CHF_INFO ChfEnd;
ChfSignal( CPU_CHF_MODULE_ID );
}

View file

@ -132,7 +132,7 @@ static int wb[ WB_SIZE ]; /* Write buffer */
static int BadCommand( enum FlashState* state, enum FlashCycle cycle, XAddress address, int data )
{
/* Unknown command: signal and reset state to FLASH_ST_READ_ARRAY */
ChfCondition( FLASH_CHF_MODULE_ID ) FLASH_W_BAD_CMD, CHF_WARNING, *state, cycle, address, data ChfEnd;
CHF_Condition( FLASH_CHF_MODULE_ID ) FLASH_W_BAD_CMD, CHF_WARNING, *state, cycle, address, data ChfEnd;
ChfSignal( FLASH_CHF_MODULE_ID );
*state = FLASH_ST_READ_ARRAY;
@ -191,7 +191,7 @@ static int ParseCommand( enum FlashState* state, enum FlashCycle cycle, XAddress
default:
/* Unknown command; signal, ignore, keep current state. */
ChfCondition( FLASH_CHF_MODULE_ID ) FLASH_W_BAD_CMD, CHF_WARNING, *state, cycle, address, data ChfEnd;
CHF_Condition( FLASH_CHF_MODULE_ID ) FLASH_W_BAD_CMD, CHF_WARNING, *state, cycle, address, data ChfEnd;
ChfSignal( FLASH_CHF_MODULE_ID );
break;
}
@ -259,7 +259,7 @@ static int StoreData( enum FlashState* state, enum FlashCycle cycle, XAddress ad
case FLASH_ST_WRITE_DATA_N:
index = address - wb_start;
if ( index < 0 || index >= WB_SIZE ) {
ChfCondition( FLASH_CHF_MODULE_ID ) FLASH_W_BAD_ADDRESS, CHF_WARNING, *state, cycle, address, data ChfEnd;
CHF_Condition( FLASH_CHF_MODULE_ID ) FLASH_W_BAD_ADDRESS, CHF_WARNING, *state, cycle, address, data ChfEnd;
ChfSignal( FLASH_CHF_MODULE_ID );
} else
wb[ index ] = data;

View file

@ -146,7 +146,7 @@ void HdwInit( void )
debug1( DEBUG_C_TRACE, MOD_I_CALLED, "HdwInit" );
if ( ReadStructFromFile( config.hdw_file_name, sizeof( mod_status.hdw ), &mod_status.hdw ) ) {
ChfCondition( MOD_CHF_MODULE_ID ) MOD_W_HDW_INIT, CHF_WARNING ChfEnd;
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_W_HDW_INIT, CHF_WARNING ChfEnd;
ChfSignal( MOD_CHF_MODULE_ID );
( void )memset( &mod_status.hdw, 0, sizeof( mod_status.hdw ) );
@ -180,7 +180,7 @@ void HdwSave( void )
debug1( DEBUG_C_TRACE, MOD_I_CALLED, "HdwSave" );
if ( WriteStructToFile( &mod_status.hdw, sizeof( mod_status.hdw ), config.hdw_file_name ) ) {
ChfCondition( MOD_CHF_MODULE_ID ) MOD_E_HDW_SAVE, CHF_ERROR ChfEnd;
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_E_HDW_SAVE, CHF_ERROR ChfEnd;
ChfSignal( MOD_CHF_MODULE_ID );
}
}
@ -324,7 +324,7 @@ Nibble HdwRead( Address rel_address )
return ( Nibble )( ( mod_status.hdw.t2_val >> ( ( rel_address - 0x38 ) * 4 ) ) & 0x0F );
default:
ChfCondition( MOD_CHF_MODULE_ID ) MOD_W_HDW_READ, CHF_WARNING, rel_address ChfEnd;
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_W_HDW_READ, CHF_WARNING, rel_address ChfEnd;
ChfSignal( MOD_CHF_MODULE_ID );
return ( Nibble )0xF;
}
@ -531,7 +531,7 @@ void HdwWrite( Address rel_address, Nibble data )
break;
default:
ChfCondition( MOD_CHF_MODULE_ID ) MOD_W_HDW_WRITE, CHF_WARNING, rel_address, ( int )data ChfEnd;
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_W_HDW_WRITE, CHF_WARNING, rel_address, ( int )data ChfEnd;
ChfSignal( MOD_CHF_MODULE_ID );
}

View file

@ -201,7 +201,7 @@ void ModSelectDescription( int model )
ModRegisterDescription( hw49_description );
break;
default:
/* ChfCondition( MOD_CHF_MODULE_ID ) MOD_E_NO_MATCH, CHF_ERROR, config.hw ChfEnd; */
/* CHF_Condition( MOD_CHF_MODULE_ID ) MOD_E_NO_MATCH, CHF_ERROR, config.hw ChfEnd; */
/* ChfSignal( MOD_CHF_MODULE_ID ); */
fprintf( stderr, "Error: Unknown model %i\n", model );
exit( EXIT_FAILURE );

View file

@ -213,10 +213,10 @@ void KeybPress( const char* key )
unsigned int in_val, out_bit;
if ( sscanf( key, "%x/%x", &out_bit, &in_val ) != 2 ) {
ChfCondition( MOD_CHF_MODULE_ID ) MOD_W_BAD_KEY, CHF_WARNING, key ChfEnd;
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_W_BAD_KEY, CHF_WARNING, key ChfEnd;
ChfSignal( MOD_CHF_MODULE_ID );
/* } else if ( out_bit < 0 || out_bit >= OUT_BITS ) { */
/* ChfCondition( MOD_CHF_MODULE_ID ) MOD_W_BAD_OUT_BIT, CHF_WARNING, out_bit ChfEnd; */
/* CHF_Condition( MOD_CHF_MODULE_ID ) MOD_W_BAD_OUT_BIT, CHF_WARNING, out_bit ChfEnd; */
/* ChfSignal( MOD_CHF_MODULE_ID ); */
} else {
/* Update the cur_in array */
@ -263,10 +263,10 @@ void KeybRelease( const char* key )
unsigned int in_val, out_bit;
if ( sscanf( key, "%x/%x", &out_bit, &in_val ) != 2 ) {
ChfCondition( MOD_CHF_MODULE_ID ) MOD_W_BAD_KEY, CHF_WARNING, key ChfEnd;
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_W_BAD_KEY, CHF_WARNING, key ChfEnd;
ChfSignal( MOD_CHF_MODULE_ID );
/* } else if ( out_bit < 0 || out_bit >= OUT_BITS ) { */
/* ChfCondition( MOD_CHF_MODULE_ID ) MOD_W_BAD_OUT_BIT, CHF_WARNING, out_bit ChfEnd; */
/* CHF_Condition( MOD_CHF_MODULE_ID ) MOD_W_BAD_OUT_BIT, CHF_WARNING, out_bit ChfEnd; */
/* ChfSignal( MOD_CHF_MODULE_ID ); */
} else {
/* Update the cur_in array */

View file

@ -68,10 +68,10 @@ Condition generation and signal
Generating a condition
* ChfCondition::
* CHF_Condition::
* ChfEnd::
* ChfSeverity::
* ChfErrnoCondition::
* CHF_ErrnoCondition::
Signaling a condition
@ -98,9 +98,9 @@ Structured condition handling
Chf behavior during structured condition handling
* ChfTry::
* ChfCatch::
* ChfEndTry::
* CHF_Try::
* CHF_Catch::
* CHF_EndTry::
Message retrieval
@ -178,7 +178,7 @@ The reentrant flavor of the Chf library is not yet supported. Multithreaded
application must serialize Chf accesses themselves.
@item
The @code{ChfErrnoCondition} macro is not supported, and has no effect.
The @code{CHF_ErrnoCondition} macro is not supported, and has no effect.
@item
The default condition handler does not display the condition message
@ -321,8 +321,8 @@ Size of the handler stack. This value determines the maximum number of
active condition handlers the application can have. A condition handler is
activated when a @code{ChfPushHandler()} is executed for it, and it is
deactivated when the corresponding @code{ChfPopHandler()} completes.
In addition, each execution of the @code{ChfTry} macro also pushes
a condition handler; the handler is removed when @code{ChfEndTry}
In addition, each execution of the @code{CHF_Try} macro also pushes
a condition handler; the handler is removed when @code{CHF_EndTry}
is executed.
@item exit_code
@ -697,15 +697,15 @@ When an unusual or noteworthy condition occurs, the application may generate
a condition that describes it.
@menu
* ChfCondition::
* CHF_Condition::
* ChfEnd::
* ChfSeverity::
* ChfErrnoCondition::
* CHF_ErrnoCondition::
@end menu
@node ChfCondition, ChfEnd, Generating a condition, Generating a condition
@subsection ChfCondition
@deftypefn Macro {} ChfCondition {...}
@node CHF_Condition, ChfEnd, Generating a condition, Generating a condition
@subsection CHF_Condition
@deftypefn Macro {} CHF_Condition {...}
This macro starts the definition of a condition using the current
application's module specifier @code{CHF_MODULE_ID}; it must be followed by
@ -759,15 +759,15 @@ there was an attempt to generate a condition while the Chf condition
@end deftypefn
@node ChfEnd, ChfSeverity, ChfCondition, Generating a condition
@node ChfEnd, ChfSeverity, CHF_Condition, Generating a condition
@subsection ChfEnd
@deftypefn Macro {} ChfEnd
This macro terminates the generation of the condition, started
with @code{ChfCondition}; it must be followed by @code{;}. For example:
with @code{CHF_Condition}; it must be followed by @code{;}. For example:
@example
ChfCondition
CHF_Condition
<condition_code>, <severity>, <additional_info>
ChfEnd;
@end example
@ -776,7 +776,7 @@ ChfEnd;
@c 2.1, cibrario, 26-May-2000
@c Expanded description of severity codes
@node ChfSeverity, ChfErrnoCondition, ChfEnd, Generating a condition
@node ChfSeverity, CHF_ErrnoCondition, ChfEnd, Generating a condition
@subsection ChfSeverity
@deftp {Data type} ChfSeverity
The severity code of a condition is an enumerated type, and can assume one
@ -822,9 +822,9 @@ call. It is usually signaled immediately after generation.
@end table
@end deftp
@node ChfErrnoCondition, , ChfSeverity, Generating a condition
@subsection ChfErrnoCondition
@deftypefn Macro {} ChfErrnoCondition
@node CHF_ErrnoCondition, , ChfSeverity, Generating a condition
@subsection CHF_ErrnoCondition
@deftypefn Macro {} CHF_ErrnoCondition
This macro generates a condition from the current value of the @code{errno}
variable. The module identifier of the condition is set to the special
@ -1342,19 +1342,19 @@ the structured condition handling is layered above the general one.
The syntax establishing a structured condition handler is as follows:
@example
ChfTry
CHF_Try
@{
... body ...
@}
ChfCatch
CHF_Catch
@{
const ChfDescriptor *exc = ChfGetTopCondition();
... condition handler ...
@}
ChfEndTry;
CHF_EndTry;
@end example
The macros @code{ChfTry}, @code{ChfCatch} and @code{ChfEndTry}
The macros @code{CHF_Try}, @code{CHF_Catch} and @code{CHF_EndTry}
expand as follows:
@example
@ -1392,7 +1392,7 @@ The @code{body} is either a statement or a block of statements (a block
is shown in the example) to be protected. If an exception with severity
equal to @code{CHF_FATAL} is signaled during the execution of
@code{body}, control is transferred to the @code{condition handler}
following @code{ChfCatch}.
following @code{CHF_Catch}.
The handler can then retrieve the condition group associated with the
exception using @code{ChfGetTopCondition()}, as shown in the example,
@ -1403,12 +1403,12 @@ and must perform one of the following actions:
Handle the exception; when the condition handler completes, that is, its
last statement has been executed, the current condition group is
automatically discarded and control is transferred to the code that
follows @code{ChfEndTry}.
follows @code{CHF_EndTry}.
@item
Resignal the exception, possibly after adding one or more conditions to
it; in this case, the handler explicitly calls @code{ChfSignal()}.
In response, Chf continues to search for a handler that actually
handles the exception, in the @code{ChfTry}/@code{ChfCatch} blocks
handles the exception, in the @code{CHF_Try}/@code{CHF_Catch} blocks
enclosing the current one, in inner to outer order. The control
will never be returned to the resignaling handler.
@end itemize
@ -1430,7 +1430,7 @@ automatically signaled immediately after generation and are not reported
to the caller; they are informational conditions only, and they must not
disrupt the normal control flow of the application. Accordingly, the
structured condition handler is @strong{not} invoked when a
success/informational condition is signaled in its @code{ChfTry} body.
success/informational condition is signaled in its @code{CHF_Try} body.
@item
@code{CHF_WARNING} conditions generated by a module are usually not
signaled immediately after generation, but are reported to the
@ -1440,7 +1440,7 @@ has been at least partially successful; this usually means that
the disruption of the control flow of the application can be kept to
a minimum and handled locally. Accordingly, the structured condition
handler is @strong{not} invoked when a warning condition
is signaled in its @code{ChfTry} body.
is signaled in its @code{CHF_Try} body.
@item
@code{CHF_ERROR} conditions generated by a module indicate that the
module execution has been unsuccessful; they are usually reported to the
@ -1449,7 +1449,7 @@ indicates that a significant disruption of the control flow of the
application is required to recover, and that local handling is still
possible but could not suffice. Accordingly, the structured condition
handler is @strong{not} invoked when an error condition is signaled in
its @code{ChfTry} body. Notice also that if the @code{ChfTry} body is
its @code{CHF_Try} body. Notice also that if the @code{CHF_Try} body is
not able to locally recover the condition, it can add a @code{CHF_FATAL}
condition to the condition group and signal the modified group, thus
triggering the invocation of the structured condition handler.
@ -1457,7 +1457,7 @@ triggering the invocation of the structured condition handler.
@code{CHF_FATAL} conditions are usually signaled immediately after
generation and always require a global recovery action.
Accordingly, the structured condition handler is
invoked when a warning condition is signaled in its @code{ChfTry} body.
invoked when a warning condition is signaled in its @code{CHF_Try} body.
@end itemize
Notice also that control is transferred to the structured exception
@ -1471,7 +1471,7 @@ detailed description of its operation.
If no exceptions are raised during the execution of @code{body},
the @code{condition handler} is skipped and execution continues
immediately after @code{ChfEndTry}.
immediately after @code{CHF_EndTry}.
@node Chf behavior during structured condition handling, , Syntax of structured condition handlers, Structured condition handling
@section Chf behavior during structured condition handling
@ -1502,11 +1502,11 @@ immediately returns without doing anything, since Chf is now in state
@item
Chf transitions to the @code{CHF_IDLE} state and performs a non-local
control transfer to the structured condition handler's unwind context;
this corresponds to the code that follows @code{ChfCatch}.
this corresponds to the code that follows @code{CHF_Catch}.
The current condition group is not removed from the condition stack.
@item
Since the current condition group has not been removed from the
condition stack, the code that follows @code{ChfCatch} can freely
condition stack, the code that follows @code{CHF_Catch} can freely
access the condition group using @code{ChfGetTopCondition()}
and @code{ChfGetNextDescriptor()}.
@item
@ -1514,7 +1514,7 @@ If any new condition is generated in this phase, it is merged with the
current condition group; the condition group can be re-signaled at will
by invoking @code{ChfSignal()}.
@item
Immediately after the code that follows @code{ChfCatch} completes,
Immediately after the code that follows @code{CHF_Catch} completes,
@code{ChfDiscard()} is automatically invoked to remove the topmost
condition group from the stack.
@end itemize
@ -1531,38 +1531,38 @@ In summary, the following structured condition handling macros
are currently available:
@menu
* ChfTry::
* ChfCatch::
* ChfEndTry::
* CHF_Try::
* CHF_Catch::
* CHF_EndTry::
@end menu
@node ChfTry, ChfCatch, Chf behavior during structured condition handling, Chf behavior during structured condition handling
@subsection ChfTry
@deftypefn Macro {} ChfTry {...}
@node CHF_Try, CHF_Catch, Chf behavior during structured condition handling, Chf behavior during structured condition handling
@subsection CHF_Try
@deftypefn Macro {} CHF_Try {...}
This macro introduces a new structured condition handling body.
The body is either a statement or a block of statements to be
protected: if a @code{CHF_FATAL} exception is signaled during its
execution, control is transferred to the condition handling code
following @code{ChfCatch}.
following @code{CHF_Catch}.
@end deftypefn
@node ChfCatch, ChfEndTry, ChfTry, Chf behavior during structured condition handling
@subsection ChfCatch
@deftypefn Macro {} ChfCatch {...}
@node CHF_Catch, CHF_EndTry, CHF_Try, Chf behavior during structured condition handling
@subsection CHF_Catch
@deftypefn Macro {} CHF_Catch {...}
This macro must follow @code{ChfTry} and introduces a new structured
This macro must follow @code{CHF_Try} and introduces a new structured
condition handler following it; the handler can be either a statement or
a block of statements. If a @code{CHF_FATAL} exception is signaled
during the execution of the body protected by @code{ChfTry}, control is
transferred to the condition handling code following @code{ChfCatch}.
during the execution of the body protected by @code{CHF_Try}, control is
transferred to the condition handling code following @code{CHF_Catch}.
@end deftypefn
@node ChfEndTry, , ChfCatch, Chf behavior during structured condition handling
@subsection ChfEndTry
@deftypefn Macro {} ChfEndTry
@node CHF_EndTry, , CHF_Catch, Chf behavior during structured condition handling
@subsection CHF_EndTry
@deftypefn Macro {} CHF_EndTry
This macro marks the end of a body/condition handler pair.
@ -1910,36 +1910,6 @@ Contains the integer identifier of the message set containing the condition
messages for @code{errno} codes. It has the value 3.
@end deftypefn
@deftypefn Macro {} ChfChar
This macro is used to make portable declarations of character variables,
and is mapped into either @code{char} or @code{TCHAR} depending on the
platform.
@end deftypefn
@deftypefn Macro {} ChfText (x)
This macro is used to make portable declarations of character strings,
and is mapped into either @code{x} or @code{_T(x)} depending on the
platform.
@end deftypefn
@deftypefn Macro {} ChfSigjmp_buf
This macro is mapped into either @code{sigjmp_buf} or @code{jmp_buf},
depending on whether the platform supports @code{sigjmp_buf}
contexts or not.
@end deftypefn
@deftypefn Macro {} ChfSigsetjmp (x,y)
This macro is mapped into either @code{sigsetjmp()} or @code{setjmp()},
depending on whether the platform supports @code{sigjmp_buf}
contexts or not. In the latter case argument @code{x} is ignored.
@end deftypefn
@deftypefn Macro {} ChfSiglongjmp (x,y)
This macro is mapped into either @code{siglongjmp()} or @code{longjmp()},
depending on whether the platform supports @code{sigjmp_buf}
contexts or not.
@end deftypefn
@node Other useful functions, Changes since release 1, Other useful macro definitions, Top
@chapter Other useful functions
@cindex Other useful functions

View file

@ -27,7 +27,7 @@
CHF_MINOR_RELEASE_NUMBER
- New ChfAction value: CHF_UNWIND_KEEP; fixed spelling of ChfAction value:
CHF_SIGNALLING -> CHF_SIGNALING
- Added structured condition handling macros: ChfTry, ChfCatch, ChfEndTry
- Added structured condition handling macros: CHF_Try, CHF_Catch, CHF_EndTry
Revision 1.6 1997/01/15 13:41:20 cibrario
Defined the new data type ChfPointer, a generic (void *) pointer. Each
@ -61,11 +61,7 @@
Win32 & UNICODE support
------------------------------------------------------------------------- */
#define ChfChar char
#define ChfText( x ) x
#define ChfSigjmp_buf sigjmp_buf
#define ChfSigsetjmp( x, y ) sigsetjmp( x, y )
#define ChfSiglongjmp( x, y ) siglongjmp( x, y )
/* -------------------------------------------------------------------------
CHF implementation limits and other symbolic constants
@ -73,7 +69,7 @@
#define CHF_MAX_MESSAGE_LENGTH 256
#define CHF_UNKNOWN_LINE_NUMBER ( -1 )
#define CHF_UNKNOWN_FILE_NAME ( ChfChar* )NULL
#define CHF_UNKNOWN_FILE_NAME ( char* )NULL
#define CHF_NULL_DESCRIPTOR ( ChfDescriptor* )NULL
#define CHF_NULL_CONTEXT ( void* )NULL
#define CHF_NULL_POINTER ( ChfPointer* )NULL
@ -135,20 +131,20 @@ typedef enum /* Current CHF state */
typedef struct ChfDescriptor_S /* Condition descriptor */
{
int module_id; /* Module identifier */
int condition_code; /* Condition code */
ChfSeverity severity; /* Severity */
int line_number; /* Line # or CHF_UNK_LINE_NUMBER */
const ChfChar* file_name; /* File name or CHF_UNK_FILE_NAME */
ChfChar message[ CHF_MAX_MESSAGE_LENGTH ]; /* Partial message */
struct ChfDescriptor_S* next; /* Link to next descriptor */
int module_id; /* Module identifier */
int condition_code; /* Condition code */
ChfSeverity severity; /* Severity */
int line_number; /* Line # or CHF_UNK_LINE_NUMBER */
const char* file_name; /* File name or CHF_UNK_FILE_NAME */
char message[ CHF_MAX_MESSAGE_LENGTH ]; /* Partial message */
struct ChfDescriptor_S* next; /* Link to next descriptor */
} ChfDescriptor;
typedef struct ChfTable_S /* Standalone message table */
{
int module; /* Module identifier */
int code; /* Condition code */
ChfChar* msg_template; /* Message template */
int module; /* Module identifier */
int code; /* Condition code */
char* msg_template; /* Message template */
} ChfTable;
typedef /* Generic pointer */
@ -158,7 +154,7 @@ typedef /* Condition handler */
ChfAction ( *ChfHandler )( const ChfDescriptor*, const ChfState, ChfPointer );
typedef /* Message retrieval 'get_message' function */
const ChfChar* ( *ChfMrsGet )( void*, const int, const int, const ChfChar* default_message );
const char* ( *ChfMrsGet )( void*, const int, const int, const char* default_message );
typedef /* Message retrieval 'exit' function */
void ( *ChfMrsExit )( void* );
@ -168,20 +164,20 @@ typedef /* Message retrieval 'exit' function */
------------------------------------------------------------------------- */
#if defined( CHF_EXTENDED_INFO )
# define ChfCondition( module_id ) \
# define CHF_Condition( module_id ) \
ChfGenerate( \
module_id, \
ChfText(__FILE__), __LINE__,
# define ChfErrnoCondition ChfGenerate( CHF_ERRNO_SET, ChfText( __FILE__ ), __LINE__, errno, CHF_ERROR )
# define CHF_ErrnoCondition ChfGenerate( CHF_ERRNO_SET, ChfText( __FILE__ ), __LINE__, errno, CHF_ERROR )
#else
# define ChfCondition( module_id ) \
# define CHF_Condition( module_id ) \
ChfGenerate( \
module_id, \
CHF_UNKNOWN_FILE_NAME, CHF_UNKNOWN_LINE_NUMBER,
# define ChfErrnoCondition ChfGenerate( CHF_ERRNO_SET, CHF_UNKNOWN_FILE_NAME, CHF_UNKNOWN_LINE_NUMBER, errno, CHF_ERROR )
# define CHF_ErrnoCondition ChfGenerate( CHF_ERRNO_SET, CHF_UNKNOWN_FILE_NAME, CHF_UNKNOWN_LINE_NUMBER, errno, CHF_ERROR )
#endif
@ -192,19 +188,19 @@ typedef /* Message retrieval 'exit' function */
Structured condition handling
------------------------------------------------------------------------- */
#define ChfTry \
#define CHF_Try \
{ \
ChfSigjmp_buf _chf_sigjmp_buf; \
if ( ChfSigsetjmp( _chf_sigjmp_buf, 1 ) == 0 ) { \
sigjmp_buf _chf_sigjmp_buf; \
if ( sigsetjmp( _chf_sigjmp_buf, 1 ) == 0 ) { \
ChfPushHandler( CHF_NULL_HANDLER, _chf_sigjmp_buf, CHF_NULL_POINTER );
#define ChfCatch \
#define CHF_Catch \
ChfPopHandler( CHF_MODULE_ID ); \
} \
else \
{
#define ChfEndTry \
#define CHF_EndTry \
ChfDiscard(); \
} \
}
@ -225,7 +221,7 @@ typedef /* Message retrieval 'exit' function */
Function prototypes
------------------------------------------------------------------------- */
/* Generic initialization */
int ChfInit( const ChfChar* app_name, /* Application's name */
int ChfInit( const char* app_name, /* Application's name */
const ChfOptions options, /* Options */
void* mrs_data, /* Message retrieval private data */
ChfMrsGet mrs_get, /* 'GetMessage' function */
@ -235,15 +231,15 @@ int ChfInit( const ChfChar* app_name, /* Application's name */
const int exit_code /* Abnormal exit code */
);
/* Initialization with msgcat subsystem */
int ChfMsgcatInit( const ChfChar* app_name, /* Application's name */
int ChfMsgcatInit( const char* app_name, /* Application's name */
const ChfOptions options, /* Options */
const ChfChar* msgcat_name, /* Name of the message catalog */
const char* msgcat_name, /* Name of the message catalog */
const int condition_stack_size, /* Size of the condition stack */
const int handler_stack_size, /* Size of the handler stack */
const int exit_code /* Abnormal exit code */
);
/* Initialization with static message tables */
int ChfStaticInit( const ChfChar* app_name, /* Application's name */
int ChfStaticInit( const char* app_name, /* Application's name */
const ChfOptions options, /* Options */
const ChfTable* table, /* Static message table */
const size_t table_size, /* Size of the message table */
@ -263,16 +259,16 @@ void ChfPushHandler( const int module_id, ChfHandler new_handler, /* Handler to
/* Pop a handler */
void ChfPopHandler( const int module_id );
/* Build a condition message */
ChfChar* ChfBuildMessage( const ChfDescriptor* descriptor );
char* ChfBuildMessage( const ChfDescriptor* descriptor );
/* Signal the current conditions */
void ChfSignal( const int module_id );
/* Discard the current conditions */
void ChfDiscard( void );
/* Generate a condition into the stack */
void ChfGenerate( const int module_id, const ChfChar* file_name, const int line_number, const int condition_code,
const ChfSeverity severity, ... );
void ChfGenerate( const int module_id, const char* file_name, const int line_number, const int condition_code, const ChfSeverity severity,
... );
/* Retrieve a condition message */
const ChfChar* ChfGetMessage( const int module_id, const int condition_code, const ChfChar* default_message );
const char* ChfGetMessage( const int module_id, const int condition_code, const char* default_message );
/* Retrieve top condition */
const ChfDescriptor* ChfGetTopCondition( const int module_id );

View file

@ -89,7 +89,7 @@ typedef struct ChfHandlerDescriptor_S {
typedef struct ChfContext_S /* CHF Context */
{
ChfState state; /* Current CHF state */
const ChfChar* app_name; /* Application's name */
const char* app_name; /* Application's name */
ChfOptions options; /* Options */
void* mrs_data; /* Message retrieval private data */
ChfMrsGet mrs_get; /* 'GetMessage' function */
@ -102,7 +102,7 @@ typedef struct ChfContext_S /* CHF Context */
ChfDescriptor* condition_sp; /* Current condition stack pointer */
ChfHandlerDescriptor* handler_stack; /* Handler stack */
ChfHandlerDescriptor* handler_sp; /* Current handler stack pointer */
ChfChar* message_buffer; /* Message buffer */
char* message_buffer; /* Message buffer */
} ChfContext;
/* -------------------------------------------------------------------------

View file

@ -45,19 +45,19 @@
/* Abort codes message table; the relative position of the messages must
match the numeric codes CHF_ABORT_xxxx defined in ChfPriv.h
*/
static const ChfChar* message_table[] = { ( const ChfChar* )NULL,
ChfText( "Not initialized" ),
ChfText( "Temporary message buffer overflow" ),
ChfText( "Invalid action from last chance handler" ),
ChfText( "Already initialized" ),
ChfText( "Unwind request while unwinding" ),
ChfText( "Improperly handled condition" ),
ChfText( "Fatal condition while unwinding" ),
ChfText( "Condition stack overflow" ),
ChfText( "Can't prime a new Chf context" ),
ChfText( "Pthread interaction failed" ) };
static const char* message_table[] = { ( const char* )NULL,
ChfText( "Not initialized" ),
ChfText( "Temporary message buffer overflow" ),
ChfText( "Invalid action from last chance handler" ),
ChfText( "Already initialized" ),
ChfText( "Unwind request while unwinding" ),
ChfText( "Improperly handled condition" ),
ChfText( "Fatal condition while unwinding" ),
ChfText( "Condition stack overflow" ),
ChfText( "Can't prime a new Chf context" ),
ChfText( "Pthread interaction failed" ) };
#define MESSAGE_TABLE_SIZE ( sizeof( message_table ) / sizeof( const ChfChar* ) )
#define MESSAGE_TABLE_SIZE ( sizeof( message_table ) / sizeof( const char* ) )
/* .+

View file

@ -80,8 +80,8 @@
.- */
void ChfGenerate( /* Generate a condition into the stack */
const int module_id, const ChfChar* file_name, const int line_number, const int condition_code,
const ChfSeverity severity, ... )
const int module_id, const char* file_name, const int line_number, const int condition_code, const ChfSeverity severity,
... )
{
ChfDescriptor* new_descriptor;
va_list aux_arg;
@ -121,8 +121,8 @@ void ChfGenerate( /* Generate a condition into the stack */
}
else {
ChfChar def_message[ CHF_DEF_MESSAGE_LENGTH ];
ChfChar tmp_message[ CHF_TMP_MESSAGE_LENGTH ];
char def_message[ CHF_DEF_MESSAGE_LENGTH ];
char tmp_message[ CHF_TMP_MESSAGE_LENGTH ];
new_descriptor->module_id = module_id;
new_descriptor->condition_code = condition_code;

View file

@ -152,14 +152,14 @@ void ChfPushHandler( /* Push a new handler into the stack */
ChfAbort( CHF_ABORT_INIT );
if ( chf_context.state != CHF_IDLE ) {
ChfCondition( module_id ) CHF_F_BAD_STATE, CHF_FATAL ChfEnd;
CHF_Condition( module_id ) CHF_F_BAD_STATE, CHF_FATAL ChfEnd;
ChfSignal( module_id );
}
/* Check if the handler stack is full */
else if ( chf_context.handler_sp - chf_context.handler_stack >= chf_context.handler_stack_size ) {
ChfCondition( module_id ) CHF_F_HDLR_STACK_FULL, CHF_FATAL ChfEnd;
CHF_Condition( module_id ) CHF_F_HDLR_STACK_FULL, CHF_FATAL ChfEnd;
ChfSignal( module_id );
}
@ -214,14 +214,14 @@ void ChfPopHandler( /* Pop a handler */
ChfAbort( CHF_ABORT_INIT );
if ( chf_context.state != CHF_IDLE ) {
ChfCondition( module_id ) CHF_F_BAD_STATE, CHF_FATAL ChfEnd;
CHF_Condition( module_id ) CHF_F_BAD_STATE, CHF_FATAL ChfEnd;
ChfSignal( module_id );
}
/* Check if the handler stack is empty */
else if ( chf_context.handler_sp == chf_context.handler_stack ) {
ChfCondition( module_id ) CHF_F_HDLR_STACK_EMPTY, CHF_FATAL ChfEnd;
CHF_Condition( module_id ) CHF_F_HDLR_STACK_EMPTY, CHF_FATAL ChfEnd;
ChfSignal( module_id );
}

View file

@ -62,15 +62,15 @@
/* Chf Library Id */
#ifndef lint
static ChfChar rcs_lib_id[] = CHF_LIBRARY_ID;
static char rcs_lib_id[] = CHF_LIBRARY_ID;
#endif
/* CHF context */
ChfContext _chf_context;
/* Message separator and severity names for ChfBuildMessage() */
static const ChfChar separator[] = CHF_MESSAGE_SEPARATOR;
static const ChfChar* severity_name[] = CHF_SEVERITY_NAMES;
static const char separator[] = CHF_MESSAGE_SEPARATOR;
static const char* severity_name[] = CHF_SEVERITY_NAMES;
/* -------------------------------------------------------------------------
Multithreading support
@ -233,7 +233,7 @@ static ChfAction DefaultHandler( const ChfDescriptor* desc, const ChfState state
1.1, 16-May-1996, creation
.- */
static ChfChar* scopy( ChfChar* p, const ChfChar* q, ChfChar* p_end )
static char* scopy( char* p, const char* q, char* p_end )
{
size_t q_len = ChfStrlen( q );
size_t p_avail = p_end - p;
@ -296,10 +296,10 @@ static ChfChar* scopy( ChfChar* p, const ChfChar* q, ChfChar* p_end )
- added Win32 support
.- */
const ChfChar* ChfGetMessage( /* Retrieve a condition message */
const int module_id, const int condition_code, const ChfChar* default_message )
const char* ChfGetMessage( /* Retrieve a condition message */
const int module_id, const int condition_code, const char* default_message )
{
const ChfChar* message;
const char* message;
/* Check that CHF has been correctly initialized */
if ( chf_context.state == CHF_UNKNOWN )
@ -346,12 +346,12 @@ const ChfChar* ChfGetMessage( /* Retrieve a condition message */
- added Win32 support
.- */
ChfChar* ChfBuildMessage( /* Build a condition message */
const ChfDescriptor* descriptor )
char* ChfBuildMessage( /* Build a condition message */
const ChfDescriptor* descriptor )
{
ChfChar* tmp_p;
ChfChar* tmp_end;
ChfChar def_message[ CHF_DEF_MESSAGE_LENGTH ];
char* tmp_p;
char* tmp_end;
char def_message[ CHF_DEF_MESSAGE_LENGTH ];
ChfSeverity severity;
/* Check that CHF has been correctly initialized */
@ -452,7 +452,7 @@ ChfChar* ChfBuildMessage( /* Build a condition message */
.- */
int ChfInit( /* Generic initialization */
const ChfChar* app_name, /* Application's name */
const char* app_name, /* Application's name */
const ChfOptions options, /* Options */
void* mrs_data, /* Message retrieval private data */
ChfMrsGet mrs_get, /* 'GetMessage' function */
@ -490,8 +490,8 @@ int ChfInit( /* Generic initialization */
cc = CHF_F_MALLOC;
}
else if ( ( _chf_context.message_buffer = ( ChfChar* )malloc( ( size_t )( CHF_MAX_MESSAGE_LENGTH ) * sizeof( ChfChar ) ) ) ==
( ChfChar* )NULL ) {
else if ( ( _chf_context.message_buffer = ( char* )malloc( ( size_t )( CHF_MAX_MESSAGE_LENGTH ) * sizeof( char ) ) ) ==
( char* )NULL ) {
free( _chf_context.condition_stack );
free( _chf_context.handler_stack );
cc = CHF_F_MALLOC;

View file

@ -113,9 +113,9 @@ static void ExitMessage( void* private_context )
.- */
int ChfMsgcatInit( /* Initialization with msgcat subsystem */
const ChfChar* app_name, /* Application's name */
const char* app_name, /* Application's name */
const ChfOptions options, /* Options */
const ChfChar* msgcat_name, /* Name of the message catalog */
const char* msgcat_name, /* Name of the message catalog */
const int condition_stack_size, /* Size of the condition stack */
const int handler_stack_size, /* Size of the handler stack */
const int exit_code /* Abnormal exit code */

View file

@ -290,7 +290,7 @@ void ChfSignal( const int module_id )
if ( unwind_handler->unwind_context == CHF_NULL_CONTEXT )
ChfAbort( CHF_ABORT_SILENT );
else
ChfSiglongjmp( unwind_handler->unwind_context, 1 );
siglongjmp( unwind_handler->unwind_context, 1 );
}
break;
@ -310,7 +310,7 @@ void ChfSignal( const int module_id )
otherwise call ChfAbort()
*/
if ( chf_context.handler_sp > chf_context.handler_stack ) {
ChfCondition( module_id ) CHF_F_INVALID_ACTION, CHF_FATAL, handler_result ChfEnd;
CHF_Condition( module_id ) CHF_F_INVALID_ACTION, CHF_FATAL, handler_result ChfEnd;
ChfSignal( module_id );
}

View file

@ -67,7 +67,7 @@ static int Search( const void* l, const void* r )
return ( EQ );
}
static const ChfChar* StGetMessage( void* private_context, const int module_id, const int condition_code, const ChfChar* default_message )
static const char* StGetMessage( void* private_context, const int module_id, const int condition_code, const char* default_message )
{
ChfTable key;
ChfTable* res;
@ -126,7 +126,7 @@ static void ExitMessage( void* private_context ) {}
.- */
int ChfStaticInit( /* Initialization with static message tables */
const ChfChar* app_name, /* Application's name */
const char* app_name, /* Application's name */
const ChfOptions options, /* Options */
const ChfTable* table, /* Static message table */
const size_t table_size, /* Size of the message table */

View file

@ -91,7 +91,7 @@ const ChfDescriptor* ChfGetTopCondition( /* Retrieve top condition */
ChfAbort( CHF_ABORT_INIT );
if ( ( d = chf_context.condition_sp ) == chf_context.condition_base ) {
ChfCondition( module_id ) CHF_F_BAD_STATE, CHF_FATAL ChfEnd;
CHF_Condition( module_id ) CHF_F_BAD_STATE, CHF_FATAL ChfEnd;
ChfSignal( module_id );
}

View file

@ -44,7 +44,7 @@ int main( int argc, char* argv[] )
exit( EXIT_FAILURE );
/* Generate a condition and check descriptor; this is line 46 */
ChfCondition 3, CHF_WARNING, 456 ChfEnd;
CHF_Condition 3, CHF_WARNING, 456 ChfEnd;
if ( ( d = ChfGetTopCondition() ) == NULL )
exit( EXIT_FAILURE );
@ -53,7 +53,7 @@ int main( int argc, char* argv[] )
exit( EXIT_FAILURE );
/* Generate another condition and check; this is line 60 */
ChfCondition 4, CHF_INFO, "arg" ChfEnd;
CHF_Condition 4, CHF_INFO, "arg" ChfEnd;
if ( ( e = ChfGetTopCondition() ) == NULL )
exit( EXIT_FAILURE );
@ -65,7 +65,7 @@ int main( int argc, char* argv[] )
ChfDiscard();
/* This is line 77 */
ChfCondition 5, CHF_ERROR, 456, 789 ChfEnd;
CHF_Condition 5, CHF_ERROR, 456, 789 ChfEnd;
if ( ( d = ChfGetTopCondition() ) == NULL )
exit( EXIT_FAILURE );

View file

@ -34,7 +34,7 @@ void* task( void* arg )
exit( EXIT_FAILURE );
/* Generate a condition and check descriptor; this is line 36 */
ChfCondition 3, CHF_WARNING, 456 ChfEnd;
CHF_Condition 3, CHF_WARNING, 456 ChfEnd;
if ( ( d = ChfGetTopCondition() ) == NULL )
exit( EXIT_FAILURE );
@ -43,7 +43,7 @@ void* task( void* arg )
exit( EXIT_FAILURE );
/* Generate another condition and check; this is line 50 */
ChfCondition 4, CHF_INFO, "arg" ChfEnd;
CHF_Condition 4, CHF_INFO, "arg" ChfEnd;
if ( ( e = ChfGetTopCondition() ) == NULL )
exit( EXIT_FAILURE );
@ -55,7 +55,7 @@ void* task( void* arg )
ChfDiscard();
/* This is line 67 */
ChfCondition 5, CHF_ERROR, 456, 789 ChfEnd;
CHF_Condition 5, CHF_ERROR, 456, 789 ChfEnd;
if ( ( d = ChfGetTopCondition() ) == NULL )
exit( EXIT_FAILURE );

View file

@ -32,11 +32,11 @@ void* task( void* arg )
printf( "\tThread %d\n", ( int )arg );
/* Generate a condition group and signal it */
ChfCondition 6, CHF_INFO, ( int )arg ChfEnd;
ChfCondition 6, CHF_INFO, ( int )arg ChfEnd;
ChfCondition 6, CHF_INFO, ( int )arg ChfEnd;
ChfCondition 6, CHF_INFO, ( int )arg ChfEnd;
ChfCondition 7, CHF_INFO, ( int )arg ChfEnd;
CHF_Condition 6, CHF_INFO, ( int )arg ChfEnd;
CHF_Condition 6, CHF_INFO, ( int )arg ChfEnd;
CHF_Condition 6, CHF_INFO, ( int )arg ChfEnd;
CHF_Condition 6, CHF_INFO, ( int )arg ChfEnd;
CHF_Condition 7, CHF_INFO, ( int )arg ChfEnd;
/* The sleep() is here to increase contention between threads */
sleep( 1 );

View file

@ -32,7 +32,7 @@ ChfAction h1( const ChfDescriptor* c, const ChfState s, ChfPointer p )
ChfAction action;
if ( c != tdata_p->e || ChfGetNextDescriptor( c ) != tdata_p->d ) {
ChfCondition 10, CHF_FATAL ChfEnd;
CHF_Condition 10, CHF_FATAL ChfEnd;
action = CHF_RESIGNAL;
}
@ -51,7 +51,7 @@ ChfAction h2( const ChfDescriptor* c, const ChfState s, ChfPointer p )
case CHF_SIGNALING:
{
if ( c != tdata_p->e || ChfGetNextDescriptor( c ) != tdata_p->d || ( tdata_p->phase != 2 && tdata_p->phase != 4 ) ) {
ChfCondition 10, CHF_FATAL ChfEnd;
CHF_Condition 10, CHF_FATAL ChfEnd;
action = CHF_RESIGNAL;
}
@ -119,14 +119,14 @@ ChfAction h4( const ChfDescriptor* c, const ChfState s, ChfPointer p )
case CHF_SIGNALING:
{
if ( c != tdata_p->e || ChfGetNextDescriptor( c ) != tdata_p->d ) {
ChfCondition 10, CHF_FATAL ChfEnd;
CHF_Condition 10, CHF_FATAL ChfEnd;
action = CHF_RESIGNAL;
}
else {
/* This generates a new group and signals it */
tdata_p->phase = 3;
ChfCondition 9, CHF_INFO ChfEnd;
CHF_Condition 9, CHF_INFO ChfEnd;
ChfSignal();
if ( tdata_p->phase != 4 )
@ -134,7 +134,7 @@ ChfAction h4( const ChfDescriptor* c, const ChfState s, ChfPointer p )
tdata_p->phase = 5;
if ( c != tdata_p->e || ChfGetNextDescriptor( c ) != tdata_p->d ) {
ChfCondition 10, CHF_FATAL ChfEnd;
CHF_Condition 10, CHF_FATAL ChfEnd;
action = CHF_RESIGNAL;
} else
action = CHF_CONTINUE;
@ -162,9 +162,9 @@ void* task( void* arg )
ChfPushHandler( h1, NULL, ( ChfPointer )( &tdata ) );
/* Generate a condition group and signal it */
ChfCondition 6, CHF_INFO, ( int )arg ChfEnd;
CHF_Condition 6, CHF_INFO, ( int )arg ChfEnd;
tdata.d = ChfGetTopCondition();
ChfCondition 7, CHF_INFO, ( int )arg ChfEnd;
CHF_Condition 7, CHF_INFO, ( int )arg ChfEnd;
tdata.e = ChfGetTopCondition();
/* The sleep() is here to increase contention between threads */
@ -178,9 +178,9 @@ void* task( void* arg )
and signal it; this checks that the handler has actually been
removed.
*/
ChfCondition 6, CHF_INFO, ( int )arg ChfEnd;
CHF_Condition 6, CHF_INFO, ( int )arg ChfEnd;
tdata.d = NULL;
ChfCondition 7, CHF_INFO, ( int )arg ChfEnd;
CHF_Condition 7, CHF_INFO, ( int )arg ChfEnd;
tdata.e = NULL;
ChfSignal();
@ -194,9 +194,9 @@ void* task( void* arg )
/* Generate a condition group and signal it */
tdata.phase = 1;
ChfCondition 6, CHF_INFO, ( int )arg ChfEnd;
CHF_Condition 6, CHF_INFO, ( int )arg ChfEnd;
tdata.d = ChfGetTopCondition();
ChfCondition 7, CHF_INFO, ( int )arg ChfEnd;
CHF_Condition 7, CHF_INFO, ( int )arg ChfEnd;
tdata.e = ChfGetTopCondition();
/* This does not trigger an unwind */
@ -204,9 +204,9 @@ void* task( void* arg )
ChfSignal();
tdata.phase = 3;
ChfCondition 6, CHF_INFO, ( int )arg ChfEnd;
CHF_Condition 6, CHF_INFO, ( int )arg ChfEnd;
tdata.d = ChfGetTopCondition();
ChfCondition 8, CHF_INFO, ( int )arg ChfEnd;
CHF_Condition 8, CHF_INFO, ( int )arg ChfEnd;
tdata.e = ChfGetTopCondition();
/* This MUST trigger an unwind */
@ -234,9 +234,9 @@ void* task( void* arg )
ChfPushHandler( h4, NULL, ( ChfPointer )&tdata );
tdata.phase = 1;
ChfCondition 6, CHF_INFO, ( int )arg ChfEnd;
CHF_Condition 6, CHF_INFO, ( int )arg ChfEnd;
tdata.d = ChfGetTopCondition();
ChfCondition 7, CHF_INFO, ( int )arg ChfEnd;
CHF_Condition 7, CHF_INFO, ( int )arg ChfEnd;
tdata.e = ChfGetTopCondition();
tdata.phase = 2;

View file

@ -45,7 +45,7 @@ ChfAction h2( const ChfDescriptor* c, const ChfState s, ChfPointer p )
if ( push_count == H_STACK_SIZE - 2 && ChfGetNextDescriptor( c ) == NULL && ChfGetSeverity( c ) == CHF_FATAL )
action = CHF_UNWIND;
else {
ChfCondition 11, CHF_FATAL, push_count, H_STACK_SIZE - 2 ChfEnd;
CHF_Condition 11, CHF_FATAL, push_count, H_STACK_SIZE - 2 ChfEnd;
action = CHF_RESIGNAL;
}
}
@ -59,7 +59,7 @@ ChfAction h2( const ChfDescriptor* c, const ChfState s, ChfPointer p )
/* Overflow check handler; it unwinds if the CHF_F_COND_STACK_FULL
condition is signalled exactly after C_STACK_SIZE invocations
of ChfCondition, it resignals a modified condition if the
of CHF_Condition, it resignals a modified condition if the
condition is signalled too early
*/
ChfAction h3( const ChfDescriptor* c, const ChfState s, ChfPointer p )
@ -73,7 +73,7 @@ ChfAction h3( const ChfDescriptor* c, const ChfState s, ChfPointer p )
if ( push_count == C_STACK_SIZE && ChfGetNextDescriptor( c ) == NULL && ChfGetSeverity( c ) == CHF_FATAL )
action = CHF_UNWIND;
else {
ChfCondition 12, CHF_FATAL, push_count, C_STACK_SIZE ChfEnd;
CHF_Condition 12, CHF_FATAL, push_count, C_STACK_SIZE ChfEnd;
action = CHF_RESIGNAL;
}
}
@ -129,7 +129,7 @@ void* task( void* arg )
/* Push dummy conditions until an error should occur */
for ( ; push_count <= C_STACK_SIZE; push_count++ )
ChfCondition 1, CHF_INFO ChfEnd;
CHF_Condition 1, CHF_INFO ChfEnd;
/* No error? Bad! */
return ( void* )EXIT_FAILURE;
@ -152,7 +152,7 @@ void* task( void* arg )
/* Push dummy conditions until an error should occur */
for ( ; push_count <= C_STACK_SIZE; push_count++ )
ChfCondition 1, CHF_INFO ChfEnd;
CHF_Condition 1, CHF_INFO ChfEnd;
/* No error? Bad! */
return ( void* )EXIT_FAILURE;

View file

@ -28,50 +28,50 @@ void* task( void* arg )
{
volatile int phase = 0;
ChfTry
CHF_Try
{
phase = 1;
ChfCondition 20, CHF_SUCCESS ChfEnd;
CHF_Condition 20, CHF_SUCCESS ChfEnd;
ChfSignal();
phase = 2;
ChfCondition 20, CHF_INFO ChfEnd;
CHF_Condition 20, CHF_INFO ChfEnd;
ChfSignal();
phase = 3;
ChfCondition 20, CHF_WARNING ChfEnd;
CHF_Condition 20, CHF_WARNING ChfEnd;
ChfSignal();
phase = 4;
ChfCondition 20, CHF_ERROR ChfEnd;
CHF_Condition 20, CHF_ERROR ChfEnd;
ChfSignal();
phase = 5;
ChfCondition 20, CHF_FATAL ChfEnd;
CHF_Condition 20, CHF_FATAL ChfEnd;
ChfSignal();
/* Should not be reached */
return ( void* )EXIT_FAILURE;
}
ChfCatch
CHF_Catch
{
/* Catched an exception; check descriptor */
const ChfDescriptor* d = ChfGetTopCondition();
if ( d == NULL || ChfGetNextDescriptor( d ) != NULL || ChfGetModuleId( d ) != CHF_MODULE_ID || ChfGetConditionCode( d ) != 20 )
return ( void* )EXIT_FAILURE;
}
ChfEndTry;
CHF_EndTry;
/* Check that the condition stack actually is empty after catch */
ChfTry { const volatile ChfDescriptor* e = ChfGetTopCondition(); }
ChfCatch
CHF_Try { const volatile ChfDescriptor* e = ChfGetTopCondition(); }
CHF_Catch
{
const ChfDescriptor* d = ChfGetTopCondition();
if ( d == NULL || ChfGetNextDescriptor( d ) != NULL || ChfGetModuleId( d ) != CHF_SET ||
ChfGetConditionCode( d ) != CHF_F_BAD_STATE )
return ( void* )EXIT_FAILURE;
}
ChfEndTry;
CHF_EndTry;
return ( void* )EXIT_SUCCESS;
}

View file

@ -44,7 +44,7 @@ int main( int argc, char* argv[] )
exit( EXIT_FAILURE );
/* Generate a condition and check descriptor; this is line 46 */
ChfCondition 3, CHF_WARNING, 456 ChfEnd;
CHF_Condition 3, CHF_WARNING, 456 ChfEnd;
if ( ( d = ChfGetTopCondition() ) == NULL )
exit( EXIT_FAILURE );
@ -53,7 +53,7 @@ int main( int argc, char* argv[] )
exit( EXIT_FAILURE );
/* Generate another condition and check; this is line 60 */
ChfCondition 4, CHF_INFO, "arg" ChfEnd;
CHF_Condition 4, CHF_INFO, "arg" ChfEnd;
if ( ( e = ChfGetTopCondition() ) == NULL )
exit( EXIT_FAILURE );
@ -65,7 +65,7 @@ int main( int argc, char* argv[] )
ChfDiscard();
/* This is line 77 */
ChfCondition 5, CHF_ERROR, 456, 789 ChfEnd;
CHF_Condition 5, CHF_ERROR, 456, 789 ChfEnd;
if ( ( d = ChfGetTopCondition() ) == NULL )
exit( EXIT_FAILURE );

View file

@ -219,7 +219,7 @@ static int repl_c = 0; /* Entry replacement counter */
.- */
static Nibble BadRead( Address addr )
{
ChfCondition( MOD_CHF_MODULE_ID ) MOD_E_BAD_READ, CHF_ERROR, addr ChfEnd;
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_E_BAD_READ, CHF_ERROR, addr ChfEnd;
ChfSignal( MOD_CHF_MODULE_ID );
return ( Nibble )0x0;
@ -251,7 +251,7 @@ static Nibble BadRead( Address addr )
.- */
static void BadWrite( Address addr, Nibble datum )
{
ChfCondition( MOD_CHF_MODULE_ID ) MOD_E_BAD_WRITE, CHF_ERROR, addr, datum ChfEnd;
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_E_BAD_WRITE, CHF_ERROR, addr, datum ChfEnd;
ChfSignal( MOD_CHF_MODULE_ID );
}
@ -423,8 +423,8 @@ static struct ModMap* NewModMap( void )
debug1( DEBUG_C_TRACE, MOD_I_CALLED, "NewModMap" );
if ( ( new = ( struct ModMap* )malloc( sizeof( struct ModMap ) ) ) == ( struct ModMap* )NULL ) {
ChfErrnoCondition;
ChfCondition( MOD_CHF_MODULE_ID ) MOD_F_MAP_ALLOC, CHF_FATAL ChfEnd;
CHF_ErrnoCondition;
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_F_MAP_ALLOC, CHF_FATAL ChfEnd;
ChfSignal( MOD_CHF_MODULE_ID );
}
@ -577,7 +577,7 @@ static void FlushCache( struct ModMap* save )
#ifdef DEBUG
/* The alloc_c performance counter must be exactly 1 now */
if ( alloc_c != 1 ) {
ChfCondition( MOD_CHF_MODULE_ID ) MOD_F_BAD_ALLOC_C, CHF_ERROR, alloc_c ChfEnd;
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_F_BAD_ALLOC_C, CHF_ERROR, alloc_c ChfEnd;
ChfSignal( MOD_CHF_MODULE_ID );
}
#endif
@ -716,7 +716,7 @@ struct ModCacheTableEntry* SelectConfigVictim( int retry )
if ( victim == ( struct ModCacheTableEntry* )NULL ) {
if ( retry ) {
/* Unable to find a victim; flush the cache and retry */
ChfCondition( MOD_CHF_MODULE_ID ) MOD_W_NO_VICTIM, CHF_WARNING ChfEnd;
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_W_NO_VICTIM, CHF_WARNING ChfEnd;
ChfSignal( MOD_CHF_MODULE_ID );
FlushCache( mod_map_ptr );
@ -724,7 +724,7 @@ struct ModCacheTableEntry* SelectConfigVictim( int retry )
victim = SelectConfigVictim( 0 );
} else {
/* Unable to find a victim; retry is not an option; give up */
ChfCondition( MOD_CHF_MODULE_ID ) MOD_F_NO_VICTIM, CHF_FATAL ChfEnd;
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_F_NO_VICTIM, CHF_FATAL ChfEnd;
ChfSignal( MOD_CHF_MODULE_ID );
}
} else
@ -848,7 +848,7 @@ static void FreeModMap( struct ModMap* p )
/* Should never happen */
if ( n == ( struct ModMap* )NULL ) {
ChfCondition( MOD_CHF_MODULE_ID ) MOD_F_CHAIN_CORRUPTED, CHF_FATAL ChfEnd;
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_F_CHAIN_CORRUPTED, CHF_FATAL ChfEnd;
ChfSignal( MOD_CHF_MODULE_ID );
}
@ -950,7 +950,7 @@ void ModInit( void )
non-NULL argument.
*/
if ( mod_description == NULL ) {
ChfCondition( MOD_CHF_MODULE_ID ) MOD_F_NO_DESCRIPTION, CHF_FATAL ChfEnd;
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_F_NO_DESCRIPTION, CHF_FATAL ChfEnd;
ChfSignal( MOD_CHF_MODULE_ID );
}
@ -969,7 +969,7 @@ void ModInit( void )
fails.
*/
if ( ReadStructFromFile( config.mod_file_name, sizeof( mod_map.map_info ), &mod_map.map_info ) ) {
ChfCondition( MOD_CHF_MODULE_ID ) MOD_W_RESETTING_ALL, CHF_WARNING ChfEnd;
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_W_RESETTING_ALL, CHF_WARNING ChfEnd;
ChfSignal( MOD_CHF_MODULE_ID );
/* Reset all modules */
@ -1024,7 +1024,7 @@ void ModSave( void )
/* Attempt to save the mod_map from file */
if ( WriteStructToFile( &mod_map.map_info, sizeof( mod_map.map_info ), config.mod_file_name ) ) {
ChfCondition( MOD_CHF_MODULE_ID ) MOD_F_MAP_SAVE, CHF_FATAL ChfEnd;
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_F_MAP_SAVE, CHF_FATAL ChfEnd;
ChfSignal( MOD_CHF_MODULE_ID );
}
}
@ -1253,7 +1253,7 @@ void ModConfig( Address config_info )
if ( mod == N_MOD ) {
/* All modules are configured - Signal a warning */
// FIXME: 48gx bugs here when running VERSION
ChfCondition( MOD_CHF_MODULE_ID ) MOD_W_BAD_CONFIG, CHF_WARNING, config_info ChfEnd;
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_W_BAD_CONFIG, CHF_WARNING, config_info ChfEnd;
ChfSignal( MOD_CHF_MODULE_ID );
} else {
if ( mod_map.map_info[ mod ].config == MOD_UNCONFIGURED ) {
@ -1332,7 +1332,7 @@ void ModUnconfig( Address unconfig_info )
/* There isn't any module configured at the given address -
Signal a warning
*/
ChfCondition( MOD_CHF_MODULE_ID ) MOD_W_BAD_UNCONFIG, CHF_WARNING, unconfig_info ChfEnd;
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_W_BAD_UNCONFIG, CHF_WARNING, unconfig_info ChfEnd;
ChfSignal( MOD_CHF_MODULE_ID );
} else if ( mod_description[ mod ].r_config == MOD_CONFIGURED ) {
/* The module is automatically configured after reset; it can never

View file

@ -344,7 +344,7 @@ void Monitor( void )
/* New command empty; try old command */
if ( ( tk = strtok( old_cmd, TOK_DELIMITERS ) ) != ( char* )NULL )
if ( InvokeCommand( tk ) )
ChfCondition( CPU_CHF_MODULE_ID ) CPU_W_BAD_MONITOR_CMD, CHF_WARNING, tk ChfEnd;
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_W_BAD_MONITOR_CMD, CHF_WARNING, tk ChfEnd;
ChfSignal( CPU_CHF_MODULE_ID );
} else {
/* Save command */
@ -352,7 +352,7 @@ void Monitor( void )
/* New command */
if ( InvokeCommand( tk ) ) {
ChfCondition( CPU_CHF_MODULE_ID ) CPU_W_BAD_MONITOR_CMD, CHF_WARNING, tk ChfEnd;
CHF_Condition( CPU_CHF_MODULE_ID ) CPU_W_BAD_MONITOR_CMD, CHF_WARNING, tk ChfEnd;
ChfSignal( CPU_CHF_MODULE_ID );
}
}

View file

@ -165,29 +165,29 @@ int main( int argc, char* argv[] )
/* Now, do some useful work; pack argv[1] into argv[2] */
if ( argc != 3 ) {
ChfCondition( UTIL_CHF_MODULE_ID ) UTIL_I_PACK_USAGE, CHF_INFO ChfEnd;
ChfCondition( UTIL_CHF_MODULE_ID ) UTIL_F_PACK_CMD_LINE, CHF_FATAL ChfEnd;
CHF_Condition( UTIL_CHF_MODULE_ID ) UTIL_I_PACK_USAGE, CHF_INFO ChfEnd;
CHF_Condition( UTIL_CHF_MODULE_ID ) UTIL_F_PACK_CMD_LINE, CHF_FATAL ChfEnd;
ChfSignal( UTIL_CHF_MODULE_ID );
}
/* Get the size of the source file */
if ( stat( argv[ 1 ], &statb ) ) {
ChfErrnoCondition;
ChfCondition( UTIL_CHF_MODULE_ID ) UTIL_F_PACK_STAT, CHF_FATAL, argv[ 1 ] ChfEnd;
CHF_ErrnoCondition;
CHF_Condition( UTIL_CHF_MODULE_ID ) UTIL_F_PACK_STAT, CHF_FATAL, argv[ 1 ] ChfEnd;
ChfSignal( UTIL_CHF_MODULE_ID );
}
/* Check that actual size is reasonable */
if ( statb.st_size > MAX_SRC_SIZE ) {
ChfCondition( UTIL_CHF_MODULE_ID ) UTIL_F_PACK_SRC_SIZE, CHF_FATAL, statb.st_size ChfEnd;
CHF_Condition( UTIL_CHF_MODULE_ID ) UTIL_F_PACK_SRC_SIZE, CHF_FATAL, statb.st_size ChfEnd;
ChfSignal( UTIL_CHF_MODULE_ID );
}
/* Allocate source buffer */
if ( ( b = ( char* )malloc( statb.st_size ) ) == ( char* )NULL ||
( nb = ( Nibble* )malloc( sizeof( Nibble ) * statb.st_size ) ) == ( Nibble* )NULL ) {
ChfErrnoCondition;
ChfCondition( UTIL_CHF_MODULE_ID ) UTIL_F_PACK_MALLOC, CHF_FATAL, statb.st_size ChfEnd;
CHF_ErrnoCondition;
CHF_Condition( UTIL_CHF_MODULE_ID ) UTIL_F_PACK_MALLOC, CHF_FATAL, statb.st_size ChfEnd;
ChfSignal( UTIL_CHF_MODULE_ID );
return EXIT_FAILURE;
@ -195,17 +195,17 @@ int main( int argc, char* argv[] )
/* open/read/close */
if ( ( d = open( argv[ 1 ], O_RDONLY ) ) == -1 ) {
ChfErrnoCondition;
ChfCondition( UTIL_CHF_MODULE_ID ) UTIL_F_PACK_OPEN, CHF_FATAL, argv[ 1 ] ChfEnd;
CHF_ErrnoCondition;
CHF_Condition( UTIL_CHF_MODULE_ID ) UTIL_F_PACK_OPEN, CHF_FATAL, argv[ 1 ] ChfEnd;
ChfSignal( UTIL_CHF_MODULE_ID );
}
if ( read( d, b, statb.st_size ) != statb.st_size ) {
ChfErrnoCondition;
CHF_ErrnoCondition;
( void )close( d );
ChfCondition( UTIL_CHF_MODULE_ID ) UTIL_F_PACK_READ, CHF_FATAL, argv[ 1 ] ChfEnd;
CHF_Condition( UTIL_CHF_MODULE_ID ) UTIL_F_PACK_READ, CHF_FATAL, argv[ 1 ] ChfEnd;
ChfSignal( UTIL_CHF_MODULE_ID );
}
@ -220,7 +220,7 @@ int main( int argc, char* argv[] )
/* Write */
if ( WriteNibblesToFile( nb, statb.st_size, argv[ 2 ] ) ) {
ChfCondition( UTIL_CHF_MODULE_ID ) UTIL_F_PACK_WRITE_NIBBLES, CHF_FATAL ChfEnd;
CHF_Condition( UTIL_CHF_MODULE_ID ) UTIL_F_PACK_WRITE_NIBBLES, CHF_FATAL ChfEnd;
ChfSignal( UTIL_CHF_MODULE_ID );
}

View file

@ -138,17 +138,17 @@ void RomInit( void )
debug1( DEBUG_C_TRACE, MOD_I_CALLED, "RomInit" );
if ( ( mod_status_48 = ( struct ModStatus_48* )malloc( sizeof( struct ModStatus_48 ) ) ) == ( struct ModStatus_48* )NULL ) {
ChfErrnoCondition;
ChfCondition( MOD_CHF_MODULE_ID ) MOD_F_MOD_STATUS_ALLOC, CHF_FATAL, sizeof( struct ModStatus_48 ) ChfEnd;
CHF_ErrnoCondition;
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_F_MOD_STATUS_ALLOC, CHF_FATAL, sizeof( struct ModStatus_48 ) ChfEnd;
ChfSignal( MOD_CHF_MODULE_ID );
}
if ( ReadNibblesFromFile( config.rom_file_name, N_ROM_SIZE, mod_status_rom ) ) {
/* ChfCondition( MOD_CHF_MODULE_ID ) MOD_F_ROM_INIT, CHF_FATAL ChfEnd; */
/* CHF_Condition( MOD_CHF_MODULE_ID ) MOD_F_ROM_INIT, CHF_FATAL ChfEnd; */
/* ChfSignal( MOD_CHF_MODULE_ID ); */
// HACK: To load 48SX ROM, try again with half the size this time.
if ( ReadNibblesFromFile( config.rom_file_name, N_ROM_SIZE / 2, mod_status_rom ) ) {
ChfCondition( MOD_CHF_MODULE_ID ) MOD_F_ROM_INIT, CHF_FATAL ChfEnd;
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_F_ROM_INIT, CHF_FATAL ChfEnd;
ChfSignal( MOD_CHF_MODULE_ID );
}
}
@ -233,7 +233,7 @@ void RomWrite( Address rel_address, Nibble datum )
debug1( DEBUG_C_TRACE, MOD_I_CALLED, "RomWrite" );
// FIXME: 48gx: saturn48gx-Mid <12>d (src/romram.c,235)-E-Write into ROM A[1B632] D[9]
ChfCondition( MOD_CHF_MODULE_ID ) MOD_E_ROM_WRITE, CHF_ERROR, rel_address, datum ChfEnd;
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_E_ROM_WRITE, CHF_ERROR, rel_address, datum ChfEnd;
ChfSignal( MOD_CHF_MODULE_ID );
}
@ -267,7 +267,7 @@ void RamInit( void )
debug1( DEBUG_C_TRACE, MOD_I_CALLED, "RamInit" );
if ( ReadNibblesFromFile( config.ram_file_name, N_RAM_SIZE, mod_status_ram ) ) {
ChfCondition( MOD_CHF_MODULE_ID ) MOD_W_RAM_INIT, CHF_WARNING ChfEnd;
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_W_RAM_INIT, CHF_WARNING ChfEnd;
ChfSignal( MOD_CHF_MODULE_ID );
( void )memset( mod_status_ram, 0, sizeof( mod_status_ram ) );
@ -294,7 +294,7 @@ void RamInit( void )
.notes :
1.1, 11-Feb-1998, creation
2.4, 12-Sep-2000, update
- upon failure, added push of ChfErrnoCondition to condition stack.
- upon failure, added push of CHF_ErrnoCondition to condition stack.
.- */
void RamSave( void )
@ -302,8 +302,8 @@ void RamSave( void )
debug1( DEBUG_C_TRACE, MOD_I_CALLED, "RamSave" );
if ( WriteNibblesToFile( mod_status_ram, N_RAM_SIZE, config.ram_file_name ) ) {
ChfErrnoCondition;
ChfCondition( MOD_CHF_MODULE_ID ) MOD_E_RAM_SAVE, CHF_ERROR ChfEnd;
CHF_ErrnoCondition;
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_E_RAM_SAVE, CHF_ERROR ChfEnd;
ChfSignal( MOD_CHF_MODULE_ID );
}
}
@ -504,7 +504,7 @@ void Ce1Write( Address rel_address, Nibble datum )
{
debug1( DEBUG_C_TRACE, MOD_I_CALLED, "Ce1Write" );
ChfCondition( MOD_CHF_MODULE_ID ) MOD_E_CE1_WRITE, CHF_ERROR, rel_address, datum ChfEnd;
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_E_CE1_WRITE, CHF_ERROR, rel_address, datum ChfEnd;
ChfSignal( MOD_CHF_MODULE_ID );
}
@ -542,7 +542,7 @@ void Ce2Init( void )
debug1( DEBUG_C_TRACE, MOD_I_CALLED, "Ce2Init" );
if ( ReadNibblesFromFile( config.port_1_file_name, N_PORT_1_SIZE, mod_status_port_1 ) ) {
ChfCondition( MOD_CHF_MODULE_ID ) MOD_W_PORT_1_INIT, CHF_WARNING ChfEnd;
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_W_PORT_1_INIT, CHF_WARNING ChfEnd;
ChfSignal( MOD_CHF_MODULE_ID );
( void )memset( mod_status_port_1, 0, sizeof( mod_status_port_1 ) );
@ -557,8 +557,8 @@ void Ce2Init( void )
else {
new_status &= ~CE2_CARD_WE;
ChfErrnoCondition;
ChfCondition( MOD_CHF_MODULE_ID ) MOD_I_PORT_1_WP, CHF_INFO ChfEnd;
CHF_ErrnoCondition;
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_I_PORT_1_WP, CHF_INFO ChfEnd;
ChfSignal( MOD_CHF_MODULE_ID );
}
}
@ -602,8 +602,8 @@ void Ce2Save( void )
/* Attempt to save only if port is write-enabled */
if ( ( mod_status_hdw.card_status & CE2_CARD_WE ) && WriteNibblesToFile( mod_status_port_1, N_PORT_1_SIZE, config.port_1_file_name ) ) {
ChfErrnoCondition;
ChfCondition( MOD_CHF_MODULE_ID ) MOD_E_PORT_1_SAVE, CHF_ERROR ChfEnd;
CHF_ErrnoCondition;
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_E_PORT_1_SAVE, CHF_ERROR ChfEnd;
ChfSignal( MOD_CHF_MODULE_ID );
}
}
@ -701,7 +701,7 @@ void NCe3Init( void )
#ifdef N_PORT_2_BANK
if ( ReadNibblesFromFile( config.port_2_file_name, N_PORT_2_SIZE, mod_status_port_2 ) ) {
ChfCondition( MOD_CHF_MODULE_ID ) MOD_W_PORT_2_INIT, CHF_WARNING ChfEnd;
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_W_PORT_2_INIT, CHF_WARNING ChfEnd;
ChfSignal( MOD_CHF_MODULE_ID );
( void )memset( mod_status_port_2, 0, sizeof( mod_status_port_2 ) );
@ -716,8 +716,8 @@ void NCe3Init( void )
else {
new_status &= ~NCE3_CARD_WE;
ChfErrnoCondition;
ChfCondition( MOD_CHF_MODULE_ID ) MOD_I_PORT_2_WP, CHF_INFO ChfEnd;
CHF_ErrnoCondition;
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_I_PORT_2_WP, CHF_INFO ChfEnd;
ChfSignal( MOD_CHF_MODULE_ID );
}
}
@ -768,8 +768,8 @@ void NCe3Save( void )
/* Attempt to save only if port is write-enabled */
if ( ( mod_status_hdw.card_status & NCE3_CARD_WE ) &&
WriteNibblesToFile( mod_status_port_2, N_PORT_2_SIZE, config.port_2_file_name ) ) {
ChfErrnoCondition;
ChfCondition( MOD_CHF_MODULE_ID ) MOD_E_PORT_2_SAVE, CHF_ERROR ChfEnd;
CHF_ErrnoCondition;
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_E_PORT_2_SAVE, CHF_ERROR ChfEnd;
ChfSignal( MOD_CHF_MODULE_ID );
}
#endif
@ -806,7 +806,7 @@ Nibble NCe3Read( Address rel_address )
return mod_status_port_2[ rel_address | mod_status_hdw.accel.a48.bs_address ];
#else
ChfCondition( MOD_CHF_MODULE_ID ) MOD_E_NCE3_READ, CHF_ERROR, rel_address ChfEnd;
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_E_NCE3_READ, CHF_ERROR, rel_address ChfEnd;
ChfSignal( MOD_CHF_MODULE_ID );
return ( Nibble )0;
@ -846,7 +846,7 @@ void NCe3Write( Address rel_address, Nibble datum )
mod_status_port_2[ rel_address | mod_status_hdw.accel.a48.bs_address ] = datum;
#else
ChfCondition( MOD_CHF_MODULE_ID ) MOD_E_NCE3_WRITE, CHF_ERROR, rel_address, datum ChfEnd;
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_E_NCE3_WRITE, CHF_ERROR, rel_address, datum ChfEnd;
ChfSignal( MOD_CHF_MODULE_ID );
#endif

View file

@ -153,13 +153,13 @@ void RomInit49( void )
debug1( DEBUG_C_TRACE, MOD_I_CALLED, "RomInit49" );
if ( ( mod_status_49 = ( struct ModStatus_49* )malloc( sizeof( struct ModStatus_49 ) ) ) == ( struct ModStatus_49* )NULL ) {
ChfErrnoCondition;
ChfCondition( MOD_CHF_MODULE_ID ) MOD_F_MOD_STATUS_ALLOC, CHF_FATAL, sizeof( struct ModStatus_49 ) ChfEnd;
CHF_ErrnoCondition;
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_F_MOD_STATUS_ALLOC, CHF_FATAL, sizeof( struct ModStatus_49 ) ChfEnd;
ChfSignal( MOD_CHF_MODULE_ID );
}
if ( ReadNibblesFromFile( config.rom_file_name, N_FLASH_SIZE_49, mod_status_49->flash ) ) {
ChfCondition( MOD_CHF_MODULE_ID ) MOD_F_ROM_INIT, CHF_FATAL ChfEnd;
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_F_ROM_INIT, CHF_FATAL ChfEnd;
ChfSignal( MOD_CHF_MODULE_ID );
}
}
@ -191,8 +191,8 @@ void RomSave49( void )
debug1( DEBUG_C_TRACE, MOD_I_CALLED, "RomSave49" );
if ( WriteNibblesToFile( mod_status_49->flash, N_FLASH_SIZE_49, config.rom_file_name ) ) {
ChfErrnoCondition;
ChfCondition( MOD_CHF_MODULE_ID ) MOD_E_ROM_SAVE, CHF_ERROR ChfEnd;
CHF_ErrnoCondition;
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_E_ROM_SAVE, CHF_ERROR ChfEnd;
ChfSignal( MOD_CHF_MODULE_ID );
}
}
@ -296,7 +296,7 @@ void RamInit49( void )
debug1( DEBUG_C_TRACE, MOD_I_CALLED, "RamInit49" );
if ( ReadNibblesFromFile( config.ram_file_name, N_RAM_SIZE_49, mod_status_49->ram ) ) {
ChfCondition( MOD_CHF_MODULE_ID ) MOD_W_RAM_INIT, CHF_WARNING ChfEnd;
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_W_RAM_INIT, CHF_WARNING ChfEnd;
ChfSignal( MOD_CHF_MODULE_ID );
( void )memset( mod_status_49->ram, 0, sizeof( mod_status_49->ram ) );
@ -329,8 +329,8 @@ void RamSave49( void )
debug1( DEBUG_C_TRACE, MOD_I_CALLED, "RamSave49" );
if ( WriteNibblesToFile( mod_status_49->ram, N_RAM_SIZE_49, config.ram_file_name ) ) {
ChfErrnoCondition;
ChfCondition( MOD_CHF_MODULE_ID ) MOD_E_RAM_SAVE, CHF_ERROR ChfEnd;
CHF_ErrnoCondition;
CHF_Condition( MOD_CHF_MODULE_ID ) MOD_E_RAM_SAVE, CHF_ERROR ChfEnd;
ChfSignal( MOD_CHF_MODULE_ID );
}
}

View file

@ -532,8 +532,8 @@ const char* SerialInit( void )
if ( openpty( &master_pty, &slave_pty, NULL, NULL, NULL ) ) {
pty_name = ( char* )NULL;
ChfErrnoCondition;
ChfCondition( SERIAL_CHF_MODULE_ID ) SERIAL_F_OPENPTY, CHF_FATAL ChfEnd;
CHF_ErrnoCondition;
CHF_Condition( SERIAL_CHF_MODULE_ID ) SERIAL_F_OPENPTY, CHF_FATAL ChfEnd;
ChfSignal( SERIAL_CHF_MODULE_ID );
} else {
int cur_flags;
@ -545,8 +545,8 @@ const char* SerialInit( void )
/* Set O_NONBLOCK on master_pty */
if ( ( cur_flags = fcntl( master_pty, F_GETFL, 0 ) ) < 0 || fcntl( master_pty, F_SETFL, cur_flags | O_NONBLOCK ) < 0 ) {
ChfErrnoCondition;
ChfCondition( SERIAL_CHF_MODULE_ID ) SERIAL_F_FCNTL, CHF_FATAL ChfEnd;
CHF_ErrnoCondition;
CHF_Condition( SERIAL_CHF_MODULE_ID ) SERIAL_F_FCNTL, CHF_FATAL ChfEnd;
ChfSignal( SERIAL_CHF_MODULE_ID );
}
}
@ -557,29 +557,29 @@ const char* SerialInit( void )
if ( ( master_pty = open( PTY_MASTER, O_RDWR | O_NONBLOCK ) ) < 0 ) {
pty_name = ( char* )NULL;
ChfErrnoCondition;
ChfCondition( SERIAL_CHF_MODULE_ID ) SERIAL_F_OPEN_MASTER, CHF_FATAL, PTY_MASTER ChfEnd;
CHF_ErrnoCondition;
CHF_Condition( SERIAL_CHF_MODULE_ID ) SERIAL_F_OPEN_MASTER, CHF_FATAL, PTY_MASTER ChfEnd;
ChfSignal( SERIAL_CHF_MODULE_ID );
} else {
/* Master side opened ok; change permissions and unlock slave side */
if ( grantpt( master_pty ) < 0 ) {
/* close() may modify errno; save it first */
ChfErrnoCondition;
CHF_ErrnoCondition;
( void )close( master_pty );
ChfCondition( SERIAL_CHF_MODULE_ID ) SERIAL_F_GRANTPT, CHF_FATAL ChfEnd;
CHF_Condition( SERIAL_CHF_MODULE_ID ) SERIAL_F_GRANTPT, CHF_FATAL ChfEnd;
ChfSignal( SERIAL_CHF_MODULE_ID );
}
if ( unlockpt( master_pty ) < 0 ) {
/* close() may modify errno; save it first */
ChfErrnoCondition;
CHF_ErrnoCondition;
( void )close( master_pty );
ChfCondition( SERIAL_CHF_MODULE_ID ) SERIAL_F_UNLOCKPT, CHF_FATAL ChfEnd;
CHF_Condition( SERIAL_CHF_MODULE_ID ) SERIAL_F_UNLOCKPT, CHF_FATAL ChfEnd;
ChfSignal( SERIAL_CHF_MODULE_ID );
}
@ -589,11 +589,11 @@ const char* SerialInit( void )
/* Open slave in nonblocking mode */
if ( ( slave_pty = open( pty_name, O_RDWR | O_NONBLOCK ) ) < 0 ) {
/* close() may modify errno; save it first */
ChfErrnoCondition;
CHF_ErrnoCondition;
( void )close( master_pty );
ChfCondition( SERIAL_CHF_MODULE_ID ) SERIAL_F_OPEN_SLAVE, CHF_FATAL, pty_name ChfEnd;
CHF_Condition( SERIAL_CHF_MODULE_ID ) SERIAL_F_OPEN_SLAVE, CHF_FATAL, pty_name ChfEnd;
ChfSignal( SERIAL_CHF_MODULE_ID );
}
@ -605,14 +605,14 @@ const char* SerialInit( void )
indistinguishable from a real terminal.
*/
if ( ioctl( slave_pty, I_PUSH, "ptem" ) == -1 ) {
ChfErrnoCondition;
ChfCondition( SERIAL_CHF_MODULE_ID ) SERIAL_F_PUSH, CHF_FATAL, "ptem" ChfEnd;
CHF_ErrnoCondition;
CHF_Condition( SERIAL_CHF_MODULE_ID ) SERIAL_F_PUSH, CHF_FATAL, "ptem" ChfEnd;
ChfSignal( SERIAL_CHF_MODULE_ID );
}
if ( ioctl( slave_pty, I_PUSH, "ldterm" ) == -1 ) {
ChfErrnoCondition;
ChfCondition( SERIAL_CHF_MODULE_ID ) SERIAL_F_PUSH, CHF_FATAL, "ldterm" ChfEnd;
CHF_ErrnoCondition;
CHF_Condition( SERIAL_CHF_MODULE_ID ) SERIAL_F_PUSH, CHF_FATAL, "ldterm" ChfEnd;
ChfSignal( SERIAL_CHF_MODULE_ID );
}
}
@ -627,8 +627,8 @@ const char* SerialInit( void )
struct termios tios;
if ( tcgetattr( slave_pty, &tios ) ) {
ChfErrnoCondition;
ChfCondition( SERIAL_CHF_MODULE_ID ) SERIAL_F_TCGETATTR, CHF_FATAL ChfEnd;
CHF_ErrnoCondition;
CHF_Condition( SERIAL_CHF_MODULE_ID ) SERIAL_F_TCGETATTR, CHF_FATAL ChfEnd;
ChfSignal( SERIAL_CHF_MODULE_ID );
}
@ -652,8 +652,8 @@ const char* SerialInit( void )
tios.c_cc[ VTIME ] = 0;
if ( tcsetattr( slave_pty, TCSANOW, &tios ) ) {
ChfErrnoCondition;
ChfCondition( SERIAL_CHF_MODULE_ID ) SERIAL_F_TCSETATTR, CHF_FATAL ChfEnd;
CHF_ErrnoCondition;
CHF_Condition( SERIAL_CHF_MODULE_ID ) SERIAL_F_TCSETATTR, CHF_FATAL ChfEnd;
ChfSignal( SERIAL_CHF_MODULE_ID );
}
}
@ -661,7 +661,7 @@ const char* SerialInit( void )
/* Publish pty name */
if ( config.verbose ) {
ChfCondition( SERIAL_CHF_MODULE_ID ) SERIAL_I_PTY_NAME, CHF_INFO, pty_name ChfEnd;
CHF_Condition( SERIAL_CHF_MODULE_ID ) SERIAL_I_PTY_NAME, CHF_INFO, pty_name ChfEnd;
ChfSignal( SERIAL_CHF_MODULE_ID );
}
@ -669,7 +669,7 @@ const char* SerialInit( void )
/* Dummy implementation; do nothing */
pty_name = "";
ChfCondition( SERIAL_CHF_MODULE_ID ) SERIAL_W_NOPTY, CHF_WARNING ChfEnd;
CHF_Condition( SERIAL_CHF_MODULE_ID ) SERIAL_W_NOPTY, CHF_WARNING ChfEnd;
ChfSignal( SERIAL_CHF_MODULE_ID );
#endif
@ -709,8 +709,8 @@ void SerialClose( void )
debug1( DEBUG_C_TRACE, SERIAL_I_CALLED, "SerialClose" );
if ( close( slave_pty ) || close( master_pty ) ) {
ChfErrnoCondition;
ChfCondition( SERIAL_CHF_MODULE_ID ) SERIAL_E_PTY_CLOSE, CHF_ERROR ChfEnd;
CHF_ErrnoCondition;
CHF_Condition( SERIAL_CHF_MODULE_ID ) SERIAL_E_PTY_CLOSE, CHF_ERROR ChfEnd;
ChfSignal( SERIAL_CHF_MODULE_ID );
}
}
@ -893,7 +893,7 @@ int8 Serial_RBR_Read( void )
/* 3.2: The HP49 firmware (1.19-4) can read from an empty RRB;
this is not harmful, and this warning can be removed.
*/
ChfCondition( SERIAL_CHF_MODULE_ID ) SERIAL_W_EMPTY_RRB, CHF_WARNING, rcs ChfEnd;
CHF_Condition( SERIAL_CHF_MODULE_ID ) SERIAL_W_EMPTY_RRB, CHF_WARNING, rcs ChfEnd;
ChfSignal( SERIAL_CHF_MODULE_ID );
#endif
@ -1082,7 +1082,7 @@ void Serial_TBR_Write( int8 d )
Push( trb, d );
} else {
/* trb is full; discard character */
ChfCondition( SERIAL_CHF_MODULE_ID ) SERIAL_W_FULL_TRB, CHF_WARNING, tcs ChfEnd;
CHF_Condition( SERIAL_CHF_MODULE_ID ) SERIAL_W_FULL_TRB, CHF_WARNING, tcs ChfEnd;
ChfSignal( SERIAL_CHF_MODULE_ID );
}
@ -1143,8 +1143,8 @@ void HandleSerial( void )
/* Signal a condition upon failure */
if ( result < 0 ) {
ChfErrnoCondition;
ChfCondition( SERIAL_CHF_MODULE_ID ) SERIAL_E_TRB_DRAIN, CHF_ERROR ChfEnd;
CHF_ErrnoCondition;
CHF_Condition( SERIAL_CHF_MODULE_ID ) SERIAL_E_TRB_DRAIN, CHF_ERROR ChfEnd;
ChfSignal( SERIAL_CHF_MODULE_ID );
}
@ -1157,8 +1157,8 @@ void HandleSerial( void )
/* Signal a condition upon failure */
if ( result < 0 ) {
ChfErrnoCondition;
ChfCondition( SERIAL_CHF_MODULE_ID ) SERIAL_E_RRB_CHARGE, CHF_ERROR ChfEnd;
CHF_ErrnoCondition;
CHF_Condition( SERIAL_CHF_MODULE_ID ) SERIAL_E_RRB_CHARGE, CHF_ERROR ChfEnd;
ChfSignal( SERIAL_CHF_MODULE_ID );
}

View file

@ -150,7 +150,7 @@ static void SetSpeed( Nibble function_code )
debug1( DEBUG_C_TRACE, X_FUNC_I_CALLED, "SetSpeed" );
#ifndef REAL_CPU_SPEED
ChfCondition( X_FUNC_CHF_MODULE_ID ) X_FUNC_E_NO_SPEED, CHF_ERROR ChfEnd;
CHF_Condition( X_FUNC_CHF_MODULE_ID ) X_FUNC_E_NO_SPEED, CHF_ERROR ChfEnd;
ChfSignal( X_FUNC_CHF_MODULE_ID );
#else
@ -169,9 +169,9 @@ static void SetSpeed( Nibble function_code )
/* Notify the user about the speed change */
if ( cpu_status.inner_loop_max )
ChfCondition( X_FUNC_CHF_MODULE_ID ) X_FUNC_I_SET_SPEED, CHF_INFO, new_speed ChfEnd;
CHF_Condition( X_FUNC_CHF_MODULE_ID ) X_FUNC_I_SET_SPEED, CHF_INFO, new_speed ChfEnd;
else
ChfCondition( X_FUNC_CHF_MODULE_ID ) X_FUNC_I_MAX_SPEED, CHF_INFO ChfEnd;
CHF_Condition( X_FUNC_CHF_MODULE_ID ) X_FUNC_I_MAX_SPEED, CHF_INFO ChfEnd;
ChfSignal( X_FUNC_CHF_MODULE_ID );
}
@ -201,7 +201,7 @@ static const char* BinaryHeader( void )
return "HPHP49-?";
break;
default:
ChfCondition( X_FUNC_CHF_MODULE_ID ) X_FUNC_E_NO_BIN_HDR, CHF_ERROR, "hw unknown" ChfEnd;
CHF_Condition( X_FUNC_CHF_MODULE_ID ) X_FUNC_E_NO_BIN_HDR, CHF_ERROR, "hw unknown" ChfEnd;
fprintf( stderr, "Error: Unknown model %i\n", config.model );
return ( char* )NULL;
}
@ -214,7 +214,7 @@ static void KgetContinuation( int proceed, char* file_name )
{
/* Check whether continuation should proceed */
if ( !proceed ) {
ChfCondition( X_FUNC_CHF_MODULE_ID ) X_FUNC_W_ABORTED, CHF_WARNING ChfEnd;
CHF_Condition( X_FUNC_CHF_MODULE_ID ) X_FUNC_W_ABORTED, CHF_WARNING ChfEnd;
ChfSignal( X_FUNC_CHF_MODULE_ID );
} else {
/* Ok to proceed; read:
@ -230,7 +230,7 @@ static void KgetContinuation( int proceed, char* file_name )
debug3( DEBUG_C_X_FUNC, X_FUNC_I_KGET, start_addr, end_addr, bin_hdr );
if ( bin_hdr == ( const char* )NULL || ReadObjectFromFile( file_name, bin_hdr, ( Address )start_addr, ( Address )end_addr ) ) {
ChfCondition( X_FUNC_CHF_MODULE_ID ) X_FUNC_W_FAILED, CHF_WARNING ChfEnd;
CHF_Condition( X_FUNC_CHF_MODULE_ID ) X_FUNC_W_FAILED, CHF_WARNING ChfEnd;
ChfSignal( X_FUNC_CHF_MODULE_ID );
}
}
@ -244,7 +244,7 @@ static void KgetContinuation( int proceed, char* file_name )
static void SendContinuation( int proceed, char* file_name )
{
if ( !proceed ) {
ChfCondition( X_FUNC_CHF_MODULE_ID ) X_FUNC_W_ABORTED, CHF_WARNING ChfEnd;
CHF_Condition( X_FUNC_CHF_MODULE_ID ) X_FUNC_W_ABORTED, CHF_WARNING ChfEnd;
ChfSignal( X_FUNC_CHF_MODULE_ID );
} else {
/* Ok to proceed; read:
@ -260,7 +260,7 @@ static void SendContinuation( int proceed, char* file_name )
debug3( DEBUG_C_X_FUNC, X_FUNC_I_SEND, start_addr, end_addr, bin_hdr );
if ( bin_hdr == ( const char* )NULL || WriteObjectToFile( ( Address )start_addr, ( Address )end_addr, bin_hdr, file_name ) ) {
ChfCondition( X_FUNC_CHF_MODULE_ID ) X_FUNC_W_FAILED, CHF_WARNING ChfEnd;
CHF_Condition( X_FUNC_CHF_MODULE_ID ) X_FUNC_W_FAILED, CHF_WARNING ChfEnd;
ChfSignal( X_FUNC_CHF_MODULE_ID );
}
}
@ -298,7 +298,7 @@ static void SetupXfer( int msg, const char* def_msg, FsbContinuation cont )
/* ( void )CpuHaltRequest(); */
} else {
ChfCondition( X_FUNC_CHF_MODULE_ID ) X_FUNC_E_NO_HALT, CHF_ERROR ChfEnd;
CHF_Condition( X_FUNC_CHF_MODULE_ID ) X_FUNC_E_NO_HALT, CHF_ERROR ChfEnd;
ChfSignal( X_FUNC_CHF_MODULE_ID );
}
}
@ -329,7 +329,7 @@ static void Kget( Nibble function_code )
debug3( DEBUG_C_X_FUNC, X_FUNC_I_KGET, start_addr, end_addr, bin_hdr );
if ( bin_hdr == ( const char* )NULL || ReadObjectFromFile( file_name, bin_hdr, ( Address )start_addr, ( Address )end_addr ) ) {
ChfCondition( X_FUNC_CHF_MODULE_ID ) X_FUNC_W_FAILED, CHF_WARNING ChfEnd;
CHF_Condition( X_FUNC_CHF_MODULE_ID ) X_FUNC_W_FAILED, CHF_WARNING ChfEnd;
ChfSignal( X_FUNC_CHF_MODULE_ID );
}
}
@ -361,7 +361,7 @@ static void Send( Nibble function_code )
debug3( DEBUG_C_X_FUNC, X_FUNC_I_SEND, start_addr, end_addr, bin_hdr );
if ( bin_hdr == ( const char* )NULL || WriteObjectToFile( ( Address )start_addr, ( Address )end_addr, bin_hdr, file_name ) ) {
ChfCondition( X_FUNC_CHF_MODULE_ID ) X_FUNC_W_FAILED, CHF_WARNING ChfEnd;
CHF_Condition( X_FUNC_CHF_MODULE_ID ) X_FUNC_W_FAILED, CHF_WARNING ChfEnd;
ChfSignal( X_FUNC_CHF_MODULE_ID );
}
}
@ -420,7 +420,7 @@ void ExtendedFunction( Nibble function_code )
/* Some sanity checks, first */
if ( function_code < 0 || function_code >= N_X_FUNC || function[ ( int )function_code ] == ( XFunc )NULL ) {
ChfCondition( X_FUNC_CHF_MODULE_ID ) X_FUNC_W_BAD_CODE, CHF_WARNING, function_code ChfEnd;
CHF_Condition( X_FUNC_CHF_MODULE_ID ) X_FUNC_W_BAD_CODE, CHF_WARNING, function_code ChfEnd;
ChfSignal( X_FUNC_CHF_MODULE_ID );
}
/* Dispatch */