A minimal Bible format designed for the C language.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

68 lines
1.2 KiB

  1. #ifndef BIBLEC_H
  2. #define BIBLEC_H
  3. #define MAX_BOOKS 66
  4. #define MAX_CHAPTERS 151
  5. #define INDEX_MAX_LENGTH 512
  6. #define VERSE_LENGTH 1024
  7. #define MAX_NAME 32
  8. #define MAX_LANG 16
  9. #define MAX_LOCATION 128
  10. #define MAX_BOOK_NAME 64
  11. enum Biblec_error {
  12. // Ensure compatibility for now
  13. FILE_NOT_FOUND = -1,
  14. BOOK_NOT_FOUND = -2,
  15. FILE_OVERFLOW = -3,
  16. FILE_ERROR = -4,
  17. BAD_CHAPTER = -5,
  18. VERSE_ERROR = -6,
  19. BIBLEC_BAD_FILE = -1,
  20. BIBLEC_BAD_BOOK = -2,
  21. BIBLEC_OVERFLOW = -3,
  22. BIBLEC_FILE_ERROR = -4,
  23. BIBLEC_BAD_CHAPTER = -5,
  24. BIBLEC_VERSE_ERROR = -6
  25. };
  26. struct Biblec_reader {
  27. char *book;
  28. int chapter;
  29. int verse;
  30. int to;
  31. char result[VERSE_LENGTH];
  32. int linesRead;
  33. FILE *file;
  34. };
  35. struct Biblec_translation {
  36. char name[MAX_NAME];
  37. char lang[MAX_LANG];
  38. char location[MAX_LOCATION];
  39. int length; // (in books)
  40. struct Book {
  41. char name[MAX_BOOK_NAME];
  42. int start;
  43. int length; // (in chapters)
  44. int chapters[MAX_CHAPTERS];
  45. }books[MAX_BOOKS];
  46. };
  47. int biblec_parse(struct Biblec_translation *translation, char *indexLocation);
  48. int biblec_next(struct Biblec_reader *reader);
  49. void biblec_close(struct Biblec_reader *reader);
  50. int biblec_new(
  51. struct Biblec_reader *reader,
  52. struct Biblec_translation *translation,
  53. char *book,
  54. int chapter,
  55. int verse,
  56. int to
  57. );
  58. #endif