diff options
Diffstat (limited to 'src/alf.c')
| -rw-r--r-- | src/alf.c | 16 |
1 files changed, 11 insertions, 5 deletions
@@ -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; |
