From 5bc8a00f02156102e3ac613fb89931262b8b5b45 Mon Sep 17 00:00:00 2001 From: XANTRONIX Development Date: Wed, 13 Sep 2023 00:09:23 -0400 Subject: Slight reorganisation --- main.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/main.c b/main.c index 0e3da6d..42a12bc 100644 --- a/main.c +++ b/main.c @@ -9,15 +9,10 @@ #include #include -#define ZX_DUMP_STRIDE_LINE 16 -#define ZX_DUMP_STRIDE_GROUP 2 -#define ZX_DUMP_CHARSET_LEN 64 - -#define ZX_DUMP_FLAGS_NONE 0 -#define ZX_DUMP_FLAGS_BASIC (1 << 0) +#define ZX_CHARSET_LEN 64 #define ZX_CHAR_LOW(c) \ - (c <= ZX_DUMP_CHARSET_LEN) + (c <= ZX_CHARSET_LEN) #define ZX_CHAR_INVERSE_START 0x80 #define ZX_CHAR_INVERSE_END 0xbf @@ -56,7 +51,7 @@ typedef struct _zx_basic_line { #define ZX_BASIC_STATE_SIZE 116 #define ZX_BASIC_LINE_LAST 0x7676 -static uint32_t zx_charset[ZX_DUMP_CHARSET_LEN] = { +static uint32_t zx_charset[ZX_CHARSET_LEN] = { 0x0020, 0x2598, 0x259d, 0x2580, 0x2596, 0x258c, 0x259e, 0x259b, 0x2592, '.', '.', '"', 0x00a3, '$', ':', '?', '(', ')', '>', '<', '=', '+', '-', '*', @@ -134,6 +129,9 @@ error_io: return -1; } +#define ZX_HEXDUMP_STRIDE_LINE 16 +#define ZX_HEXDUMP_STRIDE_GROUP 2 + static ssize_t hexdump_line(off_t offset, void *buf, size_t len, int tty) { size_t i; @@ -142,7 +140,7 @@ static ssize_t hexdump_line(off_t offset, void *buf, size_t len, int tty) { } for (i=0; i 0 && (i % ZX_DUMP_STRIDE_GROUP) == 0) { + if (i > 0 && (i % ZX_HEXDUMP_STRIDE_GROUP) == 0) { if (putchar(' ') < 0) { goto error_io; } @@ -209,9 +207,9 @@ static ssize_t zx_dump_hex(int fd) { break; } - for (i=0; i