Browse Source

more small changes

pull/2/head
Daniel 3 months ago
parent
commit
d51c45c05b
2 changed files with 13 additions and 9 deletions
  1. +10
    -6
      fbrp.c
  2. +3
    -3
      test.c

+ 10
- 6
fbrp.c View File

@@ -64,9 +64,9 @@ int strspt(char *string, char *result) {
return integer;
}

// A simple function to set an int to chapter or verse and
// add 1 to it's counter. A complicated use of pointers could
//have been used, but this is overall simpler.
// A simple function to increment a the next verse or chapter.
// A complicated use of pointers could have been used,
// but this is overall simpler.
void setInt(struct Reference *ref, int on, int currentlyOn, int value, int append) {
if (currentlyOn == 1) {
ref->chapter[ref->chapterLength].r[on] = value;
@@ -115,9 +115,13 @@ void parseReference(struct Reference *ref, char *string) {

partType = type;

// Append char
read[readY].text[readX] = string[c];
readX++;
// Append the character, make sure it
// doesn't go out of bounds
if (readX <= MAX_WORD - 2) {
read[readY].text[readX] = string[c];
readX++;
}
read[readY].length++;




+ 3
- 3
test.c View File

@@ -8,11 +8,11 @@ struct Reference ref;
void debugPrint(struct Reference *ref) {
printf("Book: %s\n", ref->book);

for (int c = 0; c < ref->chapterLength; c++) {
for (size_t c = 0; c < ref->chapterLength; c++) {
printf("Chapter: %d-%d\n", ref->chapter[c].r[0], ref->chapter[c].r[1]);
}

for (int c = 0; c < ref->verseLength; c++) {
for (size_t c = 0; c < ref->verseLength; c++) {
printf("Verse: %d-%d\n", ref->verse[c].r[0], ref->verse[c].r[1]);
}
}
@@ -26,7 +26,7 @@ void parse(char *text) {
}

int main() {
char ref1[] = "John 3 16";
char ref1[] = "ABCDEFGHIJKLMNOPQSRTYCUVZ 3 16";
char ref2[] = "John 3 16-20, 17, 18-19";
parse(ref1);
parse(ref2);


Loading…
Cancel
Save