24 #pragma warning( disable: 4251 )
25 #pragma warning( disable: 4996 )
47 #ifndef NO_SWORD_NAMESPACE
51 using sword::VerseKey;
53 using sword::SW_POSITION;
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'))
131 return (stage == 4) ? buf : 0;
160 std::cerr <<
"problem\n";
166 int main(
int argc,
char **argv) {
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";
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";
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)
virtual char setKey(const SWKey *ikey)
char readline(int fd, char **buf)
void setPersist(bool ipersist)
virtual void setIntros(bool val)
virtual int getChapter() const
virtual char getBook() const
virtual int getVerse() const
const char * getRawEntry() const
virtual void setAutoNormalize(bool iautonorm)
virtual char getTestament() const
char * parseVReg(char *buf)