aboutsummaryrefslogtreecommitdiff
path: root/src/alf.c
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2025-11-29 14:46:55 -0500
committerB. Watson <urchlay@slackware.uk>2025-11-29 14:46:55 -0500
commiteef18664f9a161816a954ce032f44cae4e90ed81 (patch)
treece1d4bd8c00c7e946b111bc96c3509961b11278e /src/alf.c
parent671fd9c6e7806229e06424f12b27fa2ad28afa05 (diff)
downloadalftools-eef18664f9a161816a954ce032f44cae4e90ed81.tar.gz
Stop defining u8 and u16 all over the place.
Diffstat (limited to 'src/alf.c')
-rw-r--r--src/alf.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/alf.c b/src/alf.c
index a366a5c..1d634ab 100644
--- a/src/alf.c
+++ b/src/alf.c
@@ -7,14 +7,10 @@
#include <sys/stat.h>
#include <time.h>
+#include "u816.h"
#include "sanity.h"
#include "self.h"
-#ifndef u8
-#define u8 unsigned char
-#define u16 unsigned short
-#endif
-
#define INITIAL_BITS 9
#define MAX_BITS 12
#define MAX_TOKENS (1 << MAX_BITS)
@@ -35,6 +31,7 @@ int opt_zerotime = 0;
int opt_alftime = 0;
int opt_gmtime = 0;
int opt_txtconv = 0;
+int opt_verbose = 0;
struct stat in_file_stat;
@@ -260,6 +257,7 @@ int match_token(int pos) {
}
void make_token(int start, int end) {
+ int i;
/* if the token table is full, reset it. basically start over like
we would with a new file. */
if(curr_token == max_token) {
@@ -276,6 +274,13 @@ void make_token(int start, int end) {
tokentab[curr_token].start = &input_buf[start];
tokentab[curr_token].length = end - start + 1;
curr_token++;
+
+ if(opt_verbose) {
+ printf("%d -> %d (%d) = ", start, end, end - start + 1);
+ for(i = start; i < end; i++)
+ putchar(input_buf[i]);
+ putchar('\n');
+ }
}
void crunch(void) {
@@ -290,6 +295,7 @@ void crunch(void) {
store_token(TOK_RESET);
while(in_pos < input_len) {
+ if(opt_verbose) printf("in_pos==%d\n", in_pos);
token = match_token(in_pos);
store_token(token);
new_pos = in_pos + tokentab[token].length;