Search
lxdream.org :: lxdream :: r220:f72f8a7dff88
lxdream 0.9.1
released Jun 29
Download Now
changeset220:f72f8a7dff88
parent219:dfd3292143f2
child221:cf5c6d326162
authornkeynes
dateTue Sep 12 08:36:09 2006 +0000 (14 years ago)
Add fwrite_dump32v support method to util
src/dream.h
src/util.c
1.1 --- a/src/dream.h Tue Aug 29 08:12:13 2006 +0000
1.2 +++ b/src/dream.h Tue Sep 12 08:36:09 2006 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: dream.h,v 1.10 2006-07-02 04:59:00 nkeynes Exp $
1.6 + * $Id: dream.h,v 1.11 2006-09-12 08:36:09 nkeynes Exp $
1.7 *
1.8 * Miscellaneous application-wide declarations (mainly logging atm)
1.9 *
1.10 @@ -112,7 +112,9 @@
1.11
1.12 void fwrite_string( char *s, FILE *f );
1.13 int fread_string( char *s, int maxlen, FILE *f );
1.14 - void fwrite_dump( unsigned char *buf, unsigned int length, FILE *f );
1.15 +void fwrite_dump( unsigned char *buf, unsigned int length, FILE *f );
1.16 +void fwrite_dump32( unsigned int *buf, unsigned int length, FILE *f );
1.17 +void fwrite_dump32v( unsigned int *buf, unsigned int length, int wordsPerLine, FILE *f );
1.18
1.19 #ifndef max
1.20 #define max(a,b) ( (a) > (b) ? (a) : (b) )
2.1 --- a/src/util.c Tue Aug 29 08:12:13 2006 +0000
2.2 +++ b/src/util.c Tue Sep 12 08:36:09 2006 +0000
2.3 @@ -1,5 +1,5 @@
2.4 /**
2.5 - * $Id: util.c,v 1.5 2006-08-01 21:55:38 nkeynes Exp $
2.6 + * $Id: util.c,v 1.6 2006-09-12 08:36:09 nkeynes Exp $
2.7 *
2.8 * Miscellaneous utility functions.
2.9 *
2.10 @@ -61,13 +61,17 @@
2.11 }
2.12 }
2.13
2.14 -
2.15 void fwrite_dump32( unsigned int *data, unsigned int length, FILE *f )
2.16 {
2.17 + fwrite_dump32v( data, length, 8, f );
2.18 +}
2.19 +
2.20 +void fwrite_dump32v( unsigned int *data, unsigned int length, int wordsPerLine, FILE *f )
2.21 +{
2.22 unsigned int i, j;
2.23 - for( i =0; i<length>>2; i+=8 ) {
2.24 + for( i =0; i<length>>2; i+=wordsPerLine ) {
2.25 fprintf( f, "%08X:", i);
2.26 - for( j=i; j<i+8; j++ ) {
2.27 + for( j=i; j<i+wordsPerLine; j++ ) {
2.28 if( j < length )
2.29 fprintf( f, " %08X", (unsigned int)(data[j]) );
2.30 else
.