2022-09-10 14:01:13 -04:00
|
|
|
#include <stdint.h>
|
2022-09-11 19:04:40 -04:00
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#if PRINT_INTERMEDIATES
|
|
|
|
uint32_t rawWC = 0;
|
|
|
|
#endif
|
2022-09-10 14:01:13 -04:00
|
|
|
|
|
|
|
#if TIME_SECTIONS
|
|
|
|
#include <time.h>
|
|
|
|
|
|
|
|
clock_t start, end;
|
|
|
|
double section_time;
|
|
|
|
char * curr_section;
|
|
|
|
|
|
|
|
#define START_TIME(section_name) do {\
|
|
|
|
curr_section = section_name;\
|
|
|
|
fprintf(stderr, "BEGIN %s\n", curr_section);\
|
|
|
|
start = clock();\
|
|
|
|
} while (0);
|
|
|
|
|
|
|
|
#define END_TIME do {\
|
|
|
|
end = clock();\
|
|
|
|
section_time = ((double) (end - start)) / CLOCKS_PER_SEC;\
|
|
|
|
fprintf(stderr, "END %s, %fs\n\n", curr_section, section_time);\
|
|
|
|
} while (0);
|
|
|
|
|
|
|
|
#else
|
|
|
|
// TIME_SECTIONS not specified, define to be nothing
|
|
|
|
#define START_TIME(section_name) 0;
|
|
|
|
#define END_TIME 0;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* <defines> */
|
2022-09-11 19:04:40 -04:00
|
|
|
#define WORDS 12971u
|
|
|
|
#define WORDLEN 5u
|
2022-09-10 14:01:13 -04:00
|
|
|
#define CHARMASK ~0b1100000u
|
2022-09-11 19:04:40 -04:00
|
|
|
#define A_BIT 0b10u
|
|
|
|
#define Z_BIT (A_BIT << 26)
|
2022-09-26 10:31:09 -04:00
|
|
|
#define MAX(a,b) ((a > b) ? a : b)
|
2022-09-10 14:01:13 -04:00
|
|
|
|
|
|
|
#if PRINT_INTERMEDIATES
|
2022-09-23 16:11:08 -04:00
|
|
|
#if FANCYPRINT
|
|
|
|
#define PRINT2 printsigs(sigs, 2, i1, i2);
|
|
|
|
#define PRINT3 printsigs(sigs, 3, i1, i2, i3);
|
|
|
|
#define PRINT4 printsigs(sigs, 4, i1, i2, i3, i4);
|
|
|
|
#else
|
|
|
|
#define PRINT2 printf("%s, %s\n", sigs[i1], sigs[i2]);
|
|
|
|
#define PRINT3 printf("%s, %s, %s\n", sigs[i1], sigs[i2], sigs[i3]);
|
|
|
|
#define PRINT4 printf("%s, %s, %s, %s\n", sigs[i1], sigs[i2], sigs[i3], sigs[i4]);
|
|
|
|
#endif
|
2022-09-10 14:01:13 -04:00
|
|
|
#else
|
|
|
|
#define PRINT2 0;
|
|
|
|
#define PRINT3 0;
|
|
|
|
#define PRINT4 0;
|
|
|
|
#endif
|
|
|
|
/* </defines> */
|
|
|
|
|
|
|
|
typedef struct signature {
|
2022-10-06 18:11:26 -04:00
|
|
|
char word[5];
|
2022-09-10 14:01:13 -04:00
|
|
|
uint32_t sign;
|
|
|
|
} signature;
|
|
|
|
|
|
|
|
/* <declarations> */
|
2022-09-11 19:04:40 -04:00
|
|
|
signature* makeArray(FILE *, uint32_t*);
|
2022-09-26 10:31:09 -04:00
|
|
|
uint32_t getsig(char* restrict);
|
2022-09-10 14:01:13 -04:00
|
|
|
|
2022-09-11 19:04:40 -04:00
|
|
|
int compare(const void*, const void*);
|
2022-09-26 10:31:09 -04:00
|
|
|
uint32_t rmdups(signature* restrict, const uint32_t);
|
2022-09-11 19:04:40 -04:00
|
|
|
|
2022-09-26 10:31:09 -04:00
|
|
|
void findWords(signature* restrict, const uint32_t);
|
|
|
|
void printsigs(signature* restrict, const uint32_t, ...);
|
|
|
|
void printDashed(const uint32_t);
|
2022-09-10 14:01:13 -04:00
|
|
|
/* </declarations> */
|