[sword-svn] r155 - trunk/versification

chrislit at crosswire.org chrislit at crosswire.org
Tue Mar 10 00:28:55 MST 2009


Author: chrislit
Date: 2009-03-10 00:28:55 -0700 (Tue, 10 Mar 2009)
New Revision: 155

Added:
   trunk/versification/v11nsys.pl
Log:
basic framework for the CCEL refsys to Sword canon.h-style refsys converter--doesn't do much yet, just creates the correct files, writes some basic header/footer stuff, and spits out a full list of osisIDs, so this still needs to process the osisIDs into our data format

Added: trunk/versification/v11nsys.pl
===================================================================
--- trunk/versification/v11nsys.pl	                        (rev 0)
+++ trunk/versification/v11nsys.pl	2009-03-10 07:28:55 UTC (rev 155)
@@ -0,0 +1,33 @@
+#!/usr/bin/perl
+
+opendir (DIR, ".");
+ at srcfiles = grep /Bible\.[^\.]+\.xml$/, readdir DIR;
+closedir(DIR);
+
+foreach $infile (@srcfiles) {
+    
+    $infile =~ /Bible\.([^\.]+)\.xml/;
+    $v11n = $1;
+    $outfile = lc("v11n$1.h");
+
+    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#ifndef V11N" . uc($v11n) . "_H\n#define V11N" . uc($v11n) . "_H\n\nSWORD_NAMESPACE_START\n\n";
+
+    while (<INF>) {
+	$line = $_;
+
+	if ($line =~ /<osisID.+?code=\"(.+?)\"\/>/) {
+	    print OUTF "$1\n";
+	}
+    }
+
+    print OUTF "\nSWORD_NAMESPACE_END\n\n#endif\n";
+
+    close (INF);
+    close (OUTF);
+}
+
+




More information about the sword-cvs mailing list