[Scummvm-cvs-logs] CVS: residual debug.cpp,1.2,1.3 debug.h,1.2,1.3 smush.cpp,1.16,1.17

James Brown ender at users.sourceforge.net
Sun Feb 1 04:41:09 CET 2004


Update of /cvsroot/scummvm/residual
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27659

Modified Files:
	debug.cpp debug.h smush.cpp 
Log Message:
Relocate some debug functions


Index: debug.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/debug.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- debug.cpp	24 Aug 2003 17:56:03 -0000	1.2
+++ debug.cpp	1 Feb 2004 12:38:33 -0000	1.3
@@ -22,6 +22,65 @@
 #include <cstdlib>
 #include <SDL.h>
 
+const char *tag2str(uint32 tag) {
+  static char str[5];
+  str[0] = (char)(tag >> 24);
+  str[1] = (char)(tag >> 16);
+  str[2] = (char)(tag >> 8);
+  str[3] = (char)tag;
+  str[4] = '\0';
+  return str;
+}
+
+void hexdump(const byte * data, int len, int bytesPerLine) {
+        assert(1 <= bytesPerLine && bytesPerLine <= 32);
+        int i;
+        byte c;
+        int offset = 0;
+        while (len >= bytesPerLine) {
+                printf("%06x: ", offset);
+                for (i = 0; i < bytesPerLine; i++) {
+                        printf("%02x ", data[i]);
+                        if (i % 4 == 3)
+                                printf(" ");
+                }
+                printf(" |");
+                for (i = 0; i < bytesPerLine; i++) {
+                        c = data[i];
+                        if (c < 32 || c >= 127)
+                                c = '.';
+                        printf("%c", c);
+                }
+                printf("|\n");
+                data += bytesPerLine;
+                len -= bytesPerLine;
+                offset += bytesPerLine;
+        }
+
+        if (len <= 0)
+                return;
+
+        printf("%06x: ", offset);
+        for (i = 0; i < bytesPerLine; i++) {
+                if (i < len)
+                        printf("%02x ", data[i]);
+                else
+                        printf("   ");
+                if (i % 4 == 3)
+                        printf(" ");
+        }
+        printf(" |");
+        for (i = 0; i < len; i++) {
+                c = data[i];
+                if (c < 32 || c >= 127)
+                        c = '.';
+                printf("%c", c);
+        }
+        for (; i < bytesPerLine; i++)
+                printf(" ");
+        printf("|\n");
+}
+
 void warning(const char *fmt, ...) {
   std::fprintf(stderr, "WARNING: ");
 

Index: debug.h
===================================================================
RCS file: /cvsroot/scummvm/residual/debug.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- debug.h	21 Sep 2003 09:51:59 -0000	1.2
+++ debug.h	1 Feb 2004 12:38:33 -0000	1.3
@@ -15,6 +15,8 @@
 //  License along with this library; if not, write to the Free Software
 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
 
+#include "bits.h"
+
 #ifndef DEBUG_H
 #define DEBUG_H
 // Hacky toggles for experimental / debug code (defined/set in main.cpp)
@@ -23,4 +25,6 @@
 void warning(const char *fmt, ...);
 void error(const char *fmt, ...);
 
+const char *tag2str(uint32 tag);
+void hexdump(const byte * data, int len, int bytesPerLine);
 #endif

Index: smush.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/smush.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- smush.cpp	1 Feb 2004 12:32:53 -0000	1.16
+++ smush.cpp	1 Feb 2004 12:38:33 -0000	1.17
@@ -19,67 +19,16 @@
 #include "bits.h"
 #include "debug.h"
 #include <cstring>
+#include <zlib.h>
 #include "smush.h"
 #include "timer.h"
 #include "mixer/mixer.h"
 #include "driver_gl.h"
-
 #include "resource.h"
 
-#include <zlib.h>
 
 Smush *smush;
 
-void hexdump(const byte * data, int len, int bytesPerLine) {
-        assert(1 <= bytesPerLine && bytesPerLine <= 32);
-        int i;
-        byte c;
-        int offset = 0;
-        while (len >= bytesPerLine) {
-                printf("%06x: ", offset);
-                for (i = 0; i < bytesPerLine; i++) {
-                        printf("%02x ", data[i]);
-                        if (i % 4 == 3)
-                                printf(" ");
-                }
-                printf(" |");
-                for (i = 0; i < bytesPerLine; i++) {
-                        c = data[i];
-                        if (c < 32 || c >= 127)
-                                c = '.';
-                        printf("%c", c);
-                }
-                printf("|\n");
-                data += bytesPerLine;
-                len -= bytesPerLine;
-                offset += bytesPerLine;
-        }
-
-        if (len <= 0)
-                return;
-
-        printf("%06x: ", offset);
-        for (i = 0; i < bytesPerLine; i++) {
-                if (i < len)
-                        printf("%02x ", data[i]);
-                else
-                        printf("   ");
-                if (i % 4 == 3)
-                        printf(" ");
-        }
-        printf(" |");
-        for (i = 0; i < len; i++) {
-                c = data[i];
-                if (c < 32 || c >= 127)
-                        c = '.';
-                printf("%c", c);
-        }
-        for (; i < bytesPerLine; i++)
-                printf(" ");
-        printf("|\n");
-}
-
-
 void Smush::timerCallback(void *refCon) {
 	smush->handleFrame();
 }





More information about the Scummvm-git-logs mailing list