Added register_match().

git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@110 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
master
Marcel Telka 23 years ago
parent 9cbb00f5dd
commit 56f5f7750e

@ -32,11 +32,12 @@ typedef struct tap_register {
} tap_register;
tap_register *register_alloc( int len );
tap_register *register_duplicate( tap_register *tr );
tap_register *register_duplicate( const tap_register *tr );
void register_free( tap_register *tr );
tap_register *register_fill( tap_register *tr, int val );
const char *register_get_string( tap_register *tr );
tap_register *register_init( tap_register *tr, const char *value );
int register_compare( const tap_register *tr, const tap_register *tr2 );
int register_match( const tap_register *tr, const char *expr );
#endif /* JTAG_REGISTER_H */

@ -59,7 +59,7 @@ register_alloc( int len )
}
tap_register *
register_duplicate( tap_register *tr )
register_duplicate( const tap_register *tr )
{
if (!tr)
return NULL;
@ -144,3 +144,21 @@ register_compare( const tap_register *tr, const tap_register *tr2 )
return 0;
}
int
register_match( const tap_register *tr, const char *expr )
{
int i;
char *s;
if (!tr || !expr || (tr->len != strlen( expr )))
return 0;
s = register_get_string( tr );
for (i = 0; i < tr->len; i++)
if ((expr[i] != '?') && (expr[i] != s[i]))
return 0;
return 1;
}

Loading…
Cancel
Save