[sword-devel] SWIG Perl

Chad Snow sword-devel@crosswire.org
30 Jan 2003 21:09:59 -0500


Joachim,

How do you get the CVS version?  I am not using CVS and I don't know
much about it?  But I would like to learn so if you could help me get
started I would appreciate it.

Thanks
Chad

On Thu, 2003-01-30 at 19:04, Joachim Ansorg wrote:
> Chad,
> it's done now.
> Update your CVS to get the new functions.
> 
> I implemented bookCount, bookName, chapterCount, verseCount. All in VerseKey. 
> See versekey.i for documentation iof these functions.
> 
> See attached script as an example. This script prints out the Bible structure. 
> 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
> 
> -- 
> Joachim Ansorg
> www.bibletime.info
> www.ansorgs.de
> 
> ----
> 

> #!/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";
> 			}
> 
> 		}
> 	}
> }