[sword-svn] r163 - trunk/versification

chrislit at crosswire.org chrislit at crosswire.org
Thu Mar 12 03:25:44 MST 2009


Author: chrislit
Date: 2009-03-12 03:25:44 -0700 (Thu, 12 Mar 2009)
New Revision: 163

Modified:
   trunk/versification/v11nsys.pl
Log:
changed metric for verse/chapter limits to counting rather than the numeric value of the final verse/chapter

Modified: trunk/versification/v11nsys.pl
===================================================================
--- trunk/versification/v11nsys.pl	2009-03-12 10:05:04 UTC (rev 162)
+++ trunk/versification/v11nsys.pl	2009-03-12 10:25:44 UTC (rev 163)
@@ -14,10 +14,10 @@
 	$otnt = 1;
     }
     if ($otnt == 0) {
-	$otbooks .= "\t{\"$idmap{$lastBook}\", \"$lastBook\", \"$lastBook\", $lastChap},\n";
+	$otbooks .= "\t{\"$idmap{$lastBook}\", \"$lastBook\", \"$lastBook\", $cCount},\n";
     }
     else {
-	$ntbooks .= "\t{\"$idmap{$lastBook}\", \"$lastBook\", \"$lastBook\", $lastChap},\n";
+	$ntbooks .= "\t{\"$idmap{$lastBook}\", \"$lastBook\", \"$lastBook\", $cCount},\n";
     }
 }
 
@@ -71,12 +71,16 @@
     open INF, $infile;
     open OUTF, ">$outfile";
 
-    print OUTF "/******************************************************************************\n * $outfile.h - Versification data for the $v11n system\n *\n * Copyright 1998-2005 CrossWire Bible Society (http://www.crosswire.org)\n *	CrossWire Bible Society\n *	P. O. Box 2528\n *	Tempe, AZ  85280-2528\n *\n * This program is free software; you can redistribute it and/or modify it\n * under the terms of the GNU General Public License as published by the\n * Free Software Foundation version 2.\n *\n * This program is distributed in the hope that it will be useful, but\n * WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n * General Public License for more details.\n *\n */\n";
+    print OUTF "/******************************************************************************\n * $outfile.h - Versification data for the $v11n system\n *\n * Copyright 1998-2005 CrossWire Bible Society (http://www.crosswire.org)\n *	CrossWire Bible Society\n *	P. O. Box 2528\n *	Tempe, AZ  85280-2528\n *\n * This program is free software; you can redistribute it and/or modify it\n * under the terms of the GNU General Public License as published by the\n * Free Software Foundation version 2.\n *\n * This program is distributed in the hope that it will be useful, but\n * WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n * General Public License for more details.\n *\n * \n * This file is based on data from SIL, further processed by CCEL.\n */\n";
     print OUTF "\n#ifndef V11N" . uc($v11n) . "_H\n#define V11N" . uc($v11n) . "_H\n\nSWORD_NAMESPACE_START\n\n";
 
     $thisBook = "";
     $thisChap = "";
     $thisVers = "";
+
+    $bCount = 0;
+    $cCount = 0;
+    $vCount = 0;
     
     $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";
@@ -97,25 +101,35 @@
 	    $lastChap = $thisChap;
 	    $lastVers = $thisVers;
 	    
-	    $osisID =~ /([^\.]+)\.(\d+)\.(\d+)/;
+	    $osisID =~ /([^\.]+)\.([a-zA-Z\d]+)\.([a-zA-Z\d]+)/;
 	    
 	    $thisBook = $1;
 	    $thisChap = $2;
 	    $thisVers = $3;
 	    
 	    if ((($thisBook ne $lastBook) ||($thisChap ne $lastChap)) && $lastVers ne "") {
-		$vm .= "$lastVers, ";
+		$vm .= "$vCount, ";
 	    }
 
 	    if ($thisBook ne $lastBook) {
+		$bCount++;
 		$vm .= "\n\t// $idmap{$thisBook}\n\t";
 		if ($lastBook ne "") {
 		    buildBooks{};
 		}
+		$cCount = 1;
+		$vCount = 1;
 	    }
+	    elsif ($thisChap ne $lastChap) {
+		$cCount++;
+		$vCount = 1;
+	    }
+	    elsif ($thisVers ne $lastVers) {
+		$vCount++;
+	    }
 	}
     }
-    $vm .= "$thisVers\n};\n";
+    $vm .= "$vCount\n};\n";
     buildBooks();
     $otbooks .= $booksCloser;
     $ntbooks .= $booksCloser;




More information about the sword-cvs mailing list