interpret/src/kjv.h

121 lines
2.3 KiB
C

#ifndef OMIT_BASE /* <!-- base */
#define BOOKS \
X(Genesis),\
X(Exodus),\
X(Leviticus),\
X(Numbers),\
X(Deuteronomy),\
X(Joshua),\
X(Judges),\
X(Ruth),\
X(ISamuel),\
X(IISamuel),\
X(IKings),\
X(IIKings),\
X(IChronicles),\
X(IIChronicles),\
X(Ezra),\
X(Nehemiah),\
X(Esther),\
X(Job),\
X(Psalms),\
X(Proverbs),\
X(Ecclesiastes),\
X(Song_of_Solomon),\
X(Isaiah),\
X(Jeremiah),\
X(Lamentations),\
X(Ezekiel),\
X(Daniel),\
X(Hosea),\
X(Joel),\
X(Amos),\
X(Obadiah),\
X(Jonah),\
X(Micah),\
X(Nahum),\
X(Habakkuk),\
X(Zephaniah),\
X(Haggai),\
X(Zechariah),\
X(Malachi),\
\
X(Matthew),\
X(Mark),\
X(Luke),\
X(John),\
X(Acts),\
X(Romans),\
X(ICorinthians),\
X(IICorinthians),\
X(Galatians),\
X(Ephesians),\
X(Philippians),\
X(Colossians),\
X(IThessalonians),\
X(IIThessalonians),\
X(ITimothy),\
X(IITimothy),\
X(Titus),\
X(Philemon),\
X(Hebrews),\
X(James),\
X(IPeter),\
X(IIPeter),\
X(IJohn),\
X(IIJohn),\
X(IIIJohn),\
X(Jude),\
X(Revelation),\
X(KJV_BOOK_SIZE)
#define X(book) book
enum kjv_book { BOOKS };
#undef X
#define X(book) #book
static const char *kjv_book_string[] = { BOOKS };
#undef X
#undef BOOKS
#include <stdint.h> /* C99 */
union kjvcite {
struct { uint32_t verse : 12, chapter : 13, book : 7; }; /* C11, reverse */
uint32_t u32;
};
void kjvcite_to_string(const union kjvcite, char (*)[12]);
#else /* base --><!-- !base */
#undef OMIT_BASE
#endif /* !base --> */
#ifndef OMIT_VERSES /* <!-- verses: For external inclusion. */
struct table_kjvset_bucket;
struct kjvset_table {
struct table_kjvset_bucket *buckets;
uint32_t log_capacity, size, top;
};
struct table_verse_bucket;
struct verse_table {
struct table_verse_bucket *buckets;
uint32_t log_capacity, size, top;
};
#else /* verses --><!-- !verses */
#undef OMIT_VERSES
#endif /* !verses --> */
#ifndef OMIT_PROTO /* <!-- proto */
#include <stddef.h>
struct kjv {
struct kjvset_table set;
struct verse_table verses;
struct { size_t total, set, verse; } words;
};
struct kjv kjv(void);
void kjv_(struct kjv *);
int kjv_is_valid(const struct kjv *const kjv);
int kjv_add(struct kjv *const kjv, const union kjvcite cite);
const char *kjv_to_string(const struct kjv *const kjv);
const char *kjv_set_to_string(const struct kjv *const kjv);
#else /* proto --><!-- !proto */
#undef OMIT_PROTO
#endif /* !proto --> */