summaryrefslogtreecommitdiffstats
path: root/versification
diff options
context:
space:
mode:
Diffstat (limited to 'versification')
-rw-r--r--versification/v11nsys.pl47
1 files changed, 36 insertions, 11 deletions
diff --git a/versification/v11nsys.pl b/versification/v11nsys.pl
index cff2bc6..239aa35 100644
--- a/versification/v11nsys.pl
+++ b/versification/v11nsys.pl
@@ -13,6 +13,18 @@ sub cleanupLine {
return $ret;
}
+sub buildBooks {
+ if ($lastBook eq "Matt") {
+ $otnt = 1;
+ }
+ if ($otnt == 0) {
+ $otbooks .= "\t{\"$idmap{$lastBook}\", \"$lastBook\", \"$lastBook\", $lastChap},\n";
+ }
+ else {
+ $ntbooks .= "\t{\"$idmap{$lastBook}\", \"$lastBook\", \"$lastBook\", $lastChap},\n";
+ }
+}
+
# @canons will contain this list of files, these are in a basic XML format.
# Each file lists osisIDs along with the English names associated with the
# osisID. These aren't exhaustive, and may or may not overlap (but hopefully
@@ -69,42 +81,55 @@ foreach $infile (@srcfiles) {
$thisBook = "";
$thisChap = "";
$thisVers = "";
-
+
$vm = "/******************************************************************************\n * Maximum verses per chapter\n */\n\nint vm$v11n\[\] = {";
-
+ $otbooks = "/******************************************************************************\n * [on]tbooks$v11n - initialize static instance for all canonical text names\n * and chapmax\n */\nstruct sbook otbooks$v11n\[\] = {\n";
+ $ntbooks = "struct sbook ntbooks$v11n\[\] = {\n";
+ $booksCloser = "\t{\"\", \"\", \"\", 0}\n};\n";
+
+ $otnt = 0; # 0 = ot, 1 = nt
+
while (<INF>) {
$line = $_;
-
+
$line = cleanupLine($line);
-
+
if ($line =~ /<osisID.+?code=\"(.+?)\"\/>/) {
$osisID = $1;
$lastBook = $thisBook;
$lastChap = $thisChap;
$lastVers = $thisVers;
-
+
$osisID =~ /([^\.]+)\.(\d+)\.(\d+)/;
-
+
$thisBook = $1;
$thisChap = $2;
$thisVers = $3;
-
+
if ((($thisBook ne $lastBook) ||($thisChap ne $lastChap)) && $lastVers ne "") {
$vm .= "$lastVers, ";
}
if ($thisBook ne $lastBook) {
$vm .= "\n\t// $idmap{$thisBook}\n\t";
+ if ($lastBook ne "") {
+ buildBooks{};
+ }
}
}
}
$vm .= "$thisVers\n};\n";
-
- print OUTF "$vm";
-
+ buildBooks();
+ $otbooks .= $booksCloser;
+ $ntbooks .= $booksCloser;
+
+ print OUTF $otbooks;
+ print OUTF $ntbooks;
+ print OUTF $vm;
+
print OUTF "\nSWORD_NAMESPACE_END\n\n#endif\n";
-
+
close (INF);
close (OUTF);
}