[sword-devel] SWIG Perl

Joachim Ansorg sword-devel@crosswire.org
Fri, 31 Jan 2003 01:04:18 +0100


--------------Boundary-00=_6JXJYHAJQKPYJRNIK3UV
Content-Type: text/plain;
  charset="iso-8859-15"
Content-Transfer-Encoding: quoted-printable

Chad,
it's done now.
Update your CVS to get the new functions.

I implemented bookCount, bookName, chapterCount, verseCount. All in Verse=
Key.=20
See versekey.i for documentation iof these functions.

See attached script as an example. This script prints out the Bible struc=
ture.=20
If you ask me, it's simpler and faster to code than in C++ ;-)

Let me know if it works and if you need more functionslity,
Joachim

> In SWIG Perl, is there a way to find out how many verses are in a
> chapter and how many chapters are in a book?
>
> Thanks
> Chad
>
> _______________________________________________
> sword-devel mailing list
> sword-devel@crosswire.org
> http://www.crosswire.org/mailman/listinfo/sword-devel

--=20
Joachim Ansorg
www.bibletime.info
www.ansorgs.de


--------------Boundary-00=_6JXJYHAJQKPYJRNIK3UV
Content-Type: text/x-perl;
  charset="iso-8859-15";
  name="versekey-test.pl"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="versekey-test.pl"

#!/usr/bin/perl -w
use Sword;
use strict;
my $key = Sword::VerseKey->new();

foreach my $testament (1, 2) {
	print "Testament $testament\n";

	for my $book (1 ... $key->bookCount($testament) ) {
		my $bookname = $key->bookName( $testament, $book );
		print "\t$bookname (book number $book in testament $testament)\n";

		for my $chapter ( 1 ... $key->chapterCount($testament, $book) ) {
			print "\t\t$bookname $chapter\n";

			for my $verse ( 1 ... $key->verseCount($testament, $book, $chapter) ) {
				print "\t\t\t$bookname $chapter:$verse\n";
			}

		}
	}
}

--------------Boundary-00=_6JXJYHAJQKPYJRNIK3UV--