From: Jay Freeman (saurik) Date: Sun, 24 Feb 2008 01:43:54 +0000 (+0000) Subject: Adding Pamphlet for Brian. X-Git-Url: https://git.saurik.com/minimal.git/commitdiff_plain/a75f8a407c6b2ed309084cac03560d2e932cb9cd Adding Pamphlet for Brian. --- diff --git a/hexdump.h b/hexdump.h index 9b2cadf..5f36144 100644 --- a/hexdump.h +++ b/hexdump.h @@ -44,28 +44,30 @@ _disused static char hexchar(uint8_t value) { return value < 0x20 || value >= 0x80 ? '.' : value; } +#define HexWidth_ 12 + _disused static void hexdump(const char *mark, const uint8_t *data, size_t size) { int i = 0, j; while (i != size) { - if (i % 16 == 0) + if (i % HexWidth_ == 0) printf("[%s] 0x%.3x:", mark, i); printf(" %.2x", data[i]); - if (++i % 16 == 0) { + if (++i % HexWidth_ == 0) { printf(" "); - for (j = i - 16; j != i; ++j) + for (j = i - HexWidth_; j != i; ++j) printf("%c", hexchar(data[j])); printf("\n"); } } - if (i % 16 != 0) { - for (j = i % 16; j != 16; ++j) + if (i % HexWidth_ != 0) { + for (j = i % HexWidth_; j != HexWidth_; ++j) printf(" "); printf(" "); - for (j = i / 16 * 16; j != i; ++j) + for (j = i / HexWidth_ * HexWidth_; j != i; ++j) printf("%c", hexchar(data[j])); printf("\n"); } diff --git a/stdlib.h b/stdlib.h index 06709eb..0f24d7d 100644 --- a/stdlib.h +++ b/stdlib.h @@ -58,7 +58,7 @@ for (;;) #define _trace() \ - printf("_trace(%s:%u)\n", __FILE__, __LINE__) + printf("_trace(%s:%u): %s\n", __FILE__, __LINE__, __FUNCTION__) #define _not(type) \ ((type) ~ (type) 0)