Bible Searching Software
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.
 
 
 
 

54 lines
891 B

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <time.h>
  5. #include <biblec/biblec.h>
  6. #include "bsearch.h"
  7. struct BiblecTranslation translation;
  8. int main() {
  9. int tryFile = biblec_parse(
  10. &translation,
  11. "/home/daniel/.local/share/heb12/web.i"
  12. );
  13. if (tryFile) {
  14. return -1;
  15. }
  16. clock_t start = clock();
  17. char mySearch[][BSEARCH_MAX_WORD] = {
  18. "for",
  19. "god",
  20. "loved",
  21. "world",
  22. };
  23. int *hits = malloc(BSEARCH_MAX_HITS * sizeof(int));
  24. int c = bsearch_open(mySearch,
  25. sizeof(mySearch) / sizeof(mySearch[0]), hits, &translation);
  26. if (c == -1) {
  27. puts("Err");
  28. return 1;
  29. }
  30. char buffer[1024];
  31. for (int i = 0; i < c; i++) {
  32. bsearch_getVerse(buffer, hits[i], &translation);
  33. printf("%d\t%s\n", hits[i], buffer);
  34. }
  35. free(hits);
  36. double elapsed = (double)(clock() - start) / CLOCKS_PER_SEC;
  37. printf("Done in %f seconds.\n", elapsed);
  38. return 0;
  39. }