X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=dict.h;h=af21015650d906b7e7e9e0c2de6f86c6f4329d7c;hb=95950fcacd327b24eb22bad24d15f377c0640e2c;hp=ccc0c0b8af961570514fd232fe1e29efde80ab71;hpb=2d604d8b8a380f7f3028c234282bfdcf12f95dad;p=wordgame diff --git a/dict.h b/dict.h index ccc0c0b..af21015 100644 --- a/dict.h +++ b/dict.h @@ -19,9 +19,27 @@ #ifndef _DICT_H_ #define _DICT_H_ -#include "dict-impl.h" +/* Portably, schmortability. I want ease of programming. */ +#define _GNU_SOURCE +#include +#include +#include + +#ifndef FALSE +# define FALSE 0 +#endif + +#ifndef TRUE +# define TRUE 1 +#endif + +typedef int bool_t; + +typedef struct _trie { + uint32_t flags; + struct _trie *next[26]; +} trie_t; -/* Only looks opaque. Perfectly stack-allocatable */ typedef trie_t dict_t; typedef trie_t *dict_cursor_t; typedef uint32_t dict_entry_t; @@ -56,7 +74,9 @@ dict_count (dict_t *dict, /* Querying a dictionary entry. The dict interface uses 1 bit. * All of the remaining bits are available for application use. */ -#define DICT_ENTRY_IS_WORD(entry) ((entry) && ((*entry) & 0x01)) +#define DICT_ENTRY_FLAG_IS_WORD (1<<0) + +#define DICT_ENTRY_IS_WORD(entry) ((entry) && ((*entry) & DICT_ENTRY_FLAG_IS_WORD)) /* Printing the dictionary */ int