From b98f0041a61740cb1572e30a294c19ca917a76ac Mon Sep 17 00:00:00 2001 From: XANTRONIX Development Date: Wed, 13 Sep 2023 17:10:53 -0400 Subject: Cats :3 --- include/zx/basic.h | 16 +++++++++------- src/basic.c | 18 +++++++++--------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/include/zx/basic.h b/include/zx/basic.h index 973923c..71c41fb 100644 --- a/include/zx/basic.h +++ b/include/zx/basic.h @@ -5,8 +5,8 @@ #include #include -#define ZX_BASIC_STATE_SIZE 116 -#define ZX_BASIC_LINE_LAST 0x7676 +#define ZX81_BASIC_STATE_SIZE 116 +#define ZX81_BASIC_LINE_LAST 0x7676 extern char *zx81_basic_tokens_low[3]; @@ -17,11 +17,13 @@ typedef struct _zx_basic_line { } zx_basic_line; enum zx_basic_token_type { - ZX_BASIC_TOKEN_UNKNOWN, - ZX_BASIC_TOKEN_ALNUM, - ZX_BASIC_TOKEN_QUOTE, - ZX_BASIC_TOKEN_SYMBOL, - ZX_BASIC_TOKEN_WORD, + ZX81_BASIC_TOKEN_UNKNOWN, + ZX81_BASIC_TOKEN_ALNUM, + ZX81_BASIC_TOKEN_PAREN_OPEN, + ZX81_BASIC_TOKEN_PAREN_CLOSE, + ZX81_BASIC_TOKEN_QUOTE, + ZX81_BASIC_TOKEN_SYMBOL, + ZX81_BASIC_TOKEN_WORD, }; ssize_t zx81_basic_dump(int fd, FILE *stream); diff --git a/src/basic.c b/src/basic.c index 043c66a..e6eb4bb 100644 --- a/src/basic.c +++ b/src/basic.c @@ -25,27 +25,27 @@ static inline enum zx_basic_token_type zx_basic_token_type_get(uint8_t b) { if ((codepoint >= 'A' && codepoint <= 'Z') || (codepoint >= '0' && codepoint <= '9')) { - return ZX_BASIC_TOKEN_ALNUM; + return ZX81_BASIC_TOKEN_ALNUM; } else if (codepoint == '"') { - return ZX_BASIC_TOKEN_QUOTE; + return ZX81_BASIC_TOKEN_QUOTE; } else { - return ZX_BASIC_TOKEN_SYMBOL; + return ZX81_BASIC_TOKEN_SYMBOL; } } else if (ZX81_CHAR_INVERSE(b)) { return zx_basic_token_type_get(b - ZX81_CHAR_INVERSE_START); } else if (ZX81_CHAR_TOKEN_LOW(b)) { - return ZX_BASIC_TOKEN_WORD; + return ZX81_BASIC_TOKEN_WORD; } else if (ZX81_CHAR_TOKEN_HIGH(b)) { char *token = zx81_basic_tokens[b-ZX81_CHAR_TOKEN_HIGH_START]; if (token[0] >= 'A' && token[0] <= 'Z') { - return ZX_BASIC_TOKEN_WORD; + return ZX81_BASIC_TOKEN_WORD; } else { - return ZX_BASIC_TOKEN_SYMBOL; + return ZX81_BASIC_TOKEN_SYMBOL; } } - return ZX_BASIC_TOKEN_UNKNOWN; + return ZX81_BASIC_TOKEN_UNKNOWN; } static inline int basic_print(uint8_t c, int tty, FILE *stream) { @@ -77,7 +77,7 @@ ssize_t zx81_basic_dump(int fd, FILE *stream) { goto error_malloc; } - if (lseek(fd, ZX_BASIC_STATE_SIZE, SEEK_CUR) < 0) { + if (lseek(fd, ZX81_BASIC_STATE_SIZE, SEEK_CUR) < 0) { goto error_io; } @@ -94,7 +94,7 @@ ssize_t zx81_basic_dump(int fd, FILE *stream) { len = le16toh(line.len); - if (be16toh(line.num) == len && len == ZX_BASIC_LINE_LAST) { + if (be16toh(line.num) == len && len == ZX81_BASIC_LINE_LAST) { break; } -- cgit v1.2.3