#include <ctype.h>
#include <stdio.h>
#include <fcntl.h>
#include <errno.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <io.h>
#include <filemgr.h>
#include <swmgr.h>
#include <rawtext.h>
#include <swbuf.h>
#include <versekey.h>
Go to the source code of this file.
void fixText |
( |
char * |
text | ) |
|
Definition at line 152 of file vpl2mod.cpp.
160 std::cerr <<
"problem\n";
bool isKJVRef |
( |
const char * |
buf | ) |
|
Definition at line 135 of file vpl2mod.cpp.
void setPersist(bool ipersist)
virtual void setIntros(bool val)
virtual int getChapter() const
virtual char getBook() const
virtual int getVerse() const
virtual void setAutoNormalize(bool iautonorm)
virtual char getTestament() const
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 166 of file vpl2mod.cpp.
171 fprintf(stderr,
"usage: %s <source_vpl_file> </path/to/output/mod/> [0|1 - prepended verse refs] [0|1 - NT only]\n\n", argv[0]);
172 fprintf(stderr,
"\tWARNING: THIS IS CURRENTLY A KJV-VERSIFICATION-ONLY UTILITY\n");
173 fprintf(stderr,
"\tWith no verse refs, source file must contain exactly 31102 lines.\n");
174 fprintf(stderr,
"\tThis is KJV verse count plus headings for MODULE,\n");
175 fprintf(stderr,
"\tTESTAMENT, BOOK, CHAPTER. An example snippet follows:\n\n");
176 fprintf(stderr,
"\t\tMODULE HEADER\n");
177 fprintf(stderr,
"\t\tOLD TESTAMENT HEADER\n");
178 fprintf(stderr,
"\t\tGENESIS HEADER\n");
179 fprintf(stderr,
"\t\tCHAPTER 1 HEADER\n");
180 fprintf(stderr,
"\t\tIn the beginning...\n\n");
181 fprintf(stderr,
"\t... implying there must also be a CHAPTER2 HEADER,\n");
182 fprintf(stderr,
"\tEXODUS HEADER, NEW TESTAMENT HEADER, etc. If there is no text for\n");
183 fprintf(stderr,
"\tthe header, a blank line must, at least, hold place.\n\n");
184 fprintf(stderr,
"\tWith verse refs, source file must simply contain any number of lines,\n");
185 fprintf(stderr,
"\tthat begin with the verse reference for which it is an entry. e.g.:\n\n");
186 fprintf(stderr,
"\t\tgen 1:0 CHAPTER 1 HEADER\n");
187 fprintf(stderr,
"\t\tgen 1:1 In the beginning...\n\n");
194 fprintf(stderr,
"error: %s: couldn't open input file: %s \n", argv[0], argv[1]);
201 fprintf(stderr,
"error: %s: couldn't create module at path: %s \n", argv[0], argv[2]);
209 vref = (argv[3][0] ==
'0') ?
false :
true;
214 ntonly = (argv[4][0] ==
'0') ?
false :
true;
229 if (ntonly) vk =
"Matthew 1:1";
232 while ((!mod.popError()) && (!
readline(fd, &buffer))) {
236 const char *verseText =
parseVReg(buffer);
238 std::cerr <<
"No valid verse ref found on line: " << buffer <<
"\n";
244 std::cerr <<
"Error parsing key: " << buffer <<
"\n";
247 SWBuf orig = mod.getRawEntry();
259 orig = mod.getRawEntry();
261 std::cerr <<
"Not a valid KJV ref: " << origVK <<
"\n";
262 std::cerr <<
"appending to ref: " << vk <<
"\n";
275 std::cerr <<
"Warning, overwriting verse: " << vk << std::endl;
unsigned long length() const
static char createModule(const char *path, const char *v11n="KJV")
static int openFileReadOnly(const char *fName)
bool isKJVRef(const char *buf)
char readline(int fd, char **buf)
void setPersist(bool ipersist)
virtual void setIntros(bool val)
virtual void setAutoNormalize(bool iautonorm)
char * parseVReg(char *buf)
char* parseVReg |
( |
char * |
buf | ) |
|
Definition at line 101 of file vpl2mod.cpp.
131 return (stage == 4) ? buf : 0;
char readline |
( |
int |
fd, |
|
|
char ** |
buf |
|
) |
| |
Definition at line 57 of file vpl2mod.cpp.
67 while ((len = read(fd, &ch, 1)) == 1) {
68 if ((ch != 13) && (ch !=
' ') && (ch !=
'\t'))
75 if ((len = read(fd, &ch, 1)) != 1)
81 *buf =
new char [ size + 1 ];
90 for (
char *it = *buf+(strlen(*buf)-1); it > *buf; it--) {
91 if ((*it != 10) && (*it != 13) && (*it !=
' ') && (*it !=
'\t'))