From 0443d34ddc62566211fcca90f827950a0629772c Mon Sep 17 00:00:00 2001 From: Chris Little Date: Thu, 12 Mar 2009 10:25:44 +0000 Subject: changed metric for verse/chapter limits to counting rather than the numeric value of the final verse/chapter git-svn-id: https://www.crosswire.org/svn/sword-tools/trunk@163 07627401-56e2-0310-80f4-f8cd0041bdcd --- versification/v11nsys.pl | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'versification') diff --git a/versification/v11nsys.pl b/versification/v11nsys.pl index 0e9fbb8..44b8349 100644 --- a/versification/v11nsys.pl +++ b/versification/v11nsys.pl @@ -14,10 +14,10 @@ sub buildBooks { $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 @@ foreach $infile (@srcfiles) { 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 @@ foreach $infile (@srcfiles) { $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; -- cgit