summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Little <chrislit@crosswire.org>2001-10-09 08:26:28 +0000
committerChris Little <chrislit@crosswire.org>2001-10-09 08:26:28 +0000
commitac4aed68671fb103dfb1a349ef040d9cec4616d3 (patch)
treed76e5b344c5d2beeb8389ce142c5a3102955575c
parent513a2d59537f1c66f8abcb0129bdbc0103a347ef (diff)
downloadsword-tools-ac4aed68671fb103dfb1a349ef040d9cec4616d3.tar.gz
Initial revision
git-svn-id: https://www.crosswire.org/svn/sword-tools/trunk@2 07627401-56e2-0310-80f4-f8cd0041bdcd
-rw-r--r--Diaspora/Diaspora.bpg25
-rw-r--r--Diaspora/Diaspora.bpr123
-rw-r--r--Diaspora/Diaspora.cpp24
-rw-r--r--Diaspora/Diaspora.resbin0 -> 1832 bytes
-rw-r--r--Diaspora/Main.cpp489
-rw-r--r--Diaspora/Main.dfm146
-rw-r--r--Diaspora/Main.h54
7 files changed, 861 insertions, 0 deletions
diff --git a/Diaspora/Diaspora.bpg b/Diaspora/Diaspora.bpg
new file mode 100644
index 0000000..db6a33a
--- /dev/null
+++ b/Diaspora/Diaspora.bpg
@@ -0,0 +1,25 @@
+#------------------------------------------------------------------------------
+VERSION = BWS.01
+#------------------------------------------------------------------------------
+!ifndef ROOT
+ROOT = $(MAKEDIR)\..
+!endif
+#------------------------------------------------------------------------------
+MAKE = $(ROOT)\bin\make.exe -$(MAKEFLAGS) -f$**
+DCC = $(ROOT)\bin\dcc32.exe $**
+BRCC = $(ROOT)\bin\brcc32.exe $**
+#------------------------------------------------------------------------------
+PROJECTS = Diaspora.exe swordlib.lib
+#------------------------------------------------------------------------------
+default: $(PROJECTS)
+#------------------------------------------------------------------------------
+
+Diaspora.exe: Diaspora.bpr
+ $(ROOT)\bin\bpr2mak $**
+ $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak
+
+swordlib.lib: ..\..\sword\apps\windoze\CBuilder5\BibleCS\swordlib.bpr
+ $(ROOT)\bin\bpr2mak -t$(ROOT)\bin\deflib.bmk $**
+ $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak
+
+
diff --git a/Diaspora/Diaspora.bpr b/Diaspora/Diaspora.bpr
new file mode 100644
index 0000000..2eede04
--- /dev/null
+++ b/Diaspora/Diaspora.bpr
@@ -0,0 +1,123 @@
+<?xml version='1.0' encoding='utf-8' ?>
+<!-- C++Builder XML Project -->
+<PROJECT>
+ <MACROS>
+ <VERSION value="BCB.05.03"/>
+ <PROJECT value="Diaspora.exe"/>
+ <OBJFILES value="Diaspora.obj Main.obj"/>
+ <RESFILES value="Diaspora.res"/>
+ <IDLFILES value=""/>
+ <IDLGENFILES value=""/>
+ <DEFFILE value=""/>
+ <RESDEPEN value="$(RESFILES) Main.dfm"/>
+ <LIBFILES value="swordlib.lib"/>
+ <LIBRARIES value="Vclx50.lib Vcl50.lib"/>
+ <SPARELIBS value="Vcl50.lib Vclx50.lib"/>
+ <PACKAGES value="Vcl50.bpi Vclx50.bpi bcbsmp50.bpi Vcldb50.bpi vclado50.bpi ibsmp50.bpi
+ VCLBDE50.bpi vcldbx50.bpi Qrpt50.bpi TeeUI50.bpi TeeDB50.bpi Tee50.bpi
+ Dss50.bpi TeeQR50.bpi VCLIB50.bpi Vclmid50.bpi vclie50.bpi Inetdb50.bpi
+ Inet50.bpi NMFast50.bpi webmid50.bpi bcbie50.bpi dclocx50.bpi
+ bcb2kaxserver50.bpi"/>
+ <PATHCPP value=".;"/>
+ <PATHPAS value=".;"/>
+ <PATHRC value=".;"/>
+ <PATHASM value=".;"/>
+ <DEBUGLIBPATH value="$(BCB)\lib\debug"/>
+ <RELEASELIBPATH value="$(BCB)\lib\release"/>
+ <LINKER value="tlink32"/>
+ <USERDEFINES value=""/>
+ <SYSDEFINES value="NO_STRICT"/>
+ <MAINSOURCE value="Diaspora.cpp"/>
+ <INCLUDEPATH value="$(BCB)\include;$(BCB)\include\vcl;..\..\sword\include"/>
+ <LIBPATH value="$(BCB)\lib\obj;$(BCB)\lib;..\..\sword\apps\windoze\cbuilder5\biblecs"/>
+ <WARNINGS value="-w-par"/>
+ </MACROS>
+ <OPTIONS>
+ <IDLCFLAGS value="-I$(BCB)\include -I$(BCB)\include\vcl -I..\..\sword\include -src_suffix
+ cpp -boa"/>
+ <CFLAG1 value="-O2 -H=$(BCB)\lib\vcl50.csm -Hc -Vx -Ve -X- -a8 -b- -k- -vi -c -tW -tWM"/>
+ <PFLAGS value="-$Y- -$L- -$D- -v -JPHNE -M"/>
+ <RFLAGS value=""/>
+ <AFLAGS value="/mx /w2 /zn"/>
+ <LFLAGS value="-D&quot;&quot; -aa -Tpe -x -Gn"/>
+ </OPTIONS>
+ <LINKER>
+ <ALLOBJ value="c0w32.obj sysinit.obj $(OBJFILES)"/>
+ <ALLRES value="$(RESFILES)"/>
+ <ALLLIB value="$(LIBFILES) $(LIBRARIES) import32.lib cp32mt.lib"/>
+ </LINKER>
+ <IDEOPTIONS>
+[Version Info]
+IncludeVerInfo=1
+AutoIncBuild=1
+MajorVer=1
+MinorVer=0
+Release=2
+Build=11
+Debug=0
+PreRelease=0
+Special=0
+Private=0
+DLL=0
+Locale=1033
+CodePage=1252
+
+[Version Info Keys]
+CompanyName=CrossWire Bible Society
+FileDescription=SWORD Module Exporter
+FileVersion=1.0.2.11
+InternalName=Diaspora
+LegalCopyright=Copyright 2001 by CrossWire Bible Society
+LegalTrademarks=
+OriginalFilename=diaspora.exe
+ProductName=Diaspora
+ProductVersion=1.0.1
+Comments=Freely have you been give; freely give.
+
+[HistoryLists\hlIncludePath]
+Count=3
+Item0=$(BCB)\include;$(BCB)\include\vcl;..\..\sword\include
+Item1=$(BCB)\include;$(BCB)\include\vcl;..\sword\include
+Item2=$(BCB)\include;$(BCB)\include\vcl
+
+[HistoryLists\hlLibraryPath]
+Count=4
+Item0=$(BCB)\lib\obj;$(BCB)\lib;..\..\sword\apps\windoze\cbuilder5\biblecs
+Item1=$(BCB)\lib\obj;$(BCB)\lib;..\sword\apps\windoze\cbuilder5\biblecs
+Item2=$(BCB)\lib\obj;$(BCB)\lib;..\sword\apps\windoze\cbuilder5
+Item3=$(BCB)\lib\obj;$(BCB)\lib
+
+[HistoryLists\hlDebugSourcePath]
+Count=1
+Item0=$(BCB)\source\vcl
+
+[HistoryLists\hlConditionals]
+Count=1
+Item0=_DEBUG
+
+[Debugging]
+DebugSourceDirs=$(BCB)\source\vcl
+
+[Parameters]
+RunParams=
+HostApplication=
+RemoteHost=
+RemotePath=
+RemoteDebug=0
+
+[Compiler]
+ShowInfoMsgs=0
+LinkDebugVcl=0
+LinkCGLIB=0
+
+[CORBA]
+AddServerUnit=1
+AddClientUnit=1
+PrecompiledHeaders=1
+
+[Language]
+ActiveLang=
+ProjectLang=
+RootDir=
+ </IDEOPTIONS>
+</PROJECT> \ No newline at end of file
diff --git a/Diaspora/Diaspora.cpp b/Diaspora/Diaspora.cpp
new file mode 100644
index 0000000..74e063b
--- /dev/null
+++ b/Diaspora/Diaspora.cpp
@@ -0,0 +1,24 @@
+//---------------------------------------------------------------------------
+
+#include <vcl.h>
+#pragma hdrstop
+USERES("Diaspora.res");
+USELIB("swordlib.lib");
+USEFORM("Main.cpp", MainForm);
+//---------------------------------------------------------------------------
+WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
+{
+ try
+ {
+ Application->Initialize();
+ Application->Title = "Diaspora";
+ Application->CreateForm(__classid(TMainForm), &MainForm);
+ Application->Run();
+ }
+ catch (Exception &exception)
+ {
+ Application->ShowException(&exception);
+ }
+ return 0;
+}
+//---------------------------------------------------------------------------
diff --git a/Diaspora/Diaspora.res b/Diaspora/Diaspora.res
new file mode 100644
index 0000000..ced6715
--- /dev/null
+++ b/Diaspora/Diaspora.res
Binary files differ
diff --git a/Diaspora/Main.cpp b/Diaspora/Main.cpp
new file mode 100644
index 0000000..ae02161
--- /dev/null
+++ b/Diaspora/Main.cpp
@@ -0,0 +1,489 @@
+//---------------------------------------------------------------------------
+#include <vcl\vcl.h>
+#pragma hdrstop
+
+#include "Main.h"
+#include <versekey.h>
+#include <gbfthml.h>
+#include <latin1utf8.h>
+#include <thmlgbf.h>
+#include <thmlolb.h>
+#include <thmlplain.h>
+#include <localemgr.h>
+//---------------------------------------------------------------------------
+#pragma resource "*.dfm"
+TMainForm *MainForm;
+//---------------------------------------------------------------------------
+__fastcall TMainForm::TMainForm(TComponent* Owner)
+ : TForm(Owner)
+{
+}
+//----------------------------------------------------------------------------
+void __fastcall TMainForm::FormCreate(TObject *Sender)
+{
+ ModMap::iterator it;
+ SWModule *target;
+ manager = new SWMgr();
+
+ for (it = manager->Modules.begin(); it != manager->Modules.end(); it++) {
+ target = it->second;
+ if (!strcmp(target->Type(), "Biblical Texts")) {
+ modlist->Items->Add(target->Name());
+// if (descriptions) *output << target->Description();
+ }
+ }
+ for (it = manager->Modules.begin(); it != manager->Modules.end(); it++) {
+ target = it->second;
+ if (!strcmp(target->Type(), "Commentaries")) {
+ modlist->Items->Add(target->Name());
+// if (descriptions) *output << target->Description();
+ }
+ }
+ for (it = manager->Modules.begin(); it != manager->Modules.end(); it++) {
+ target = it->second;
+ if (!strcmp(target->Type(), "Lexicons / Dictionaries")) {
+ modlist->Items->Add(target->Name());
+// if (descriptions) *output << target->Description();
+ }
+ }
+
+}
+
+short palmbooks[67] = {0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 190, 220, 230, 240, 250, 260, 290, 300, 310, 330, 340, 350, 360, 370, 380, 390, 400, 410, 420, 430, 440, 450, 460, 470, 480, 490, 500, 510, 520, 530, 540, 550, 560, 570, 580, 590, 600, 610, 620, 630, 640, 650, 660, 670, 680, 690, 700, 710, 720, 730};
+char* palmbooknames[67] = {"", "GEN", "EXO", "LEV", "NUM", "DEU", "JOS", "JUG", "RUT", "1SA", "2SA", "1KI", "2KI", "1CH", "2CH", "EZR", "NEH", "EST", "JOB", "PS", "PRO", "ECC", "SON", "ISA", "JER", "LAM", "EZE", "DAN", "HOS", "JOE", "AMO", "OBA", "JON", "MIC", "NAH", "HAB", "ZEP", "HAG", "ZEC", "MAL", "MAT", "MAK", "LUK", "JHN", "ACT", "ROM", "1CO", "2CO", "GAL", "EPH", "PHL", "COL", "1TS", "2TS", "1TI", "2TI", "TIT", "MON", "HEB", "JAS", "1PE", "2PE", "1JN", "2JN", "3JN", "JUD", "REV"};
+enum {ThML, OLB, GBF, PBR, Plain};
+
+void __fastcall TMainForm::outputClick(TObject *Sender)
+{
+ static GBFThML gbffilter;
+ static Latin1UTF8 latin1filter;
+ static ThMLOLB olboutputfilter;
+ static ThMLGBF gbfoutputfilter;
+ static ThMLPlain plainoutputfilter;
+
+ int format;
+ if (fmtOLB->Checked) format = OLB;
+ else if (fmtGBF->Checked) format = GBF;
+ else if (fmtPalm->Checked) format = PBR;
+ else if (fmtPlain->Checked) format = Plain;
+ else format = ThML;
+
+ unsigned long topicnr = 0;
+
+ //Turn EVERYTHING on
+ manager->setGlobalOption("Footnotes","On");
+ manager->setGlobalOption("Headings","On");
+ manager->setGlobalOption("Strong's Numbers","On");
+ manager->setGlobalOption("Morphological Tags","On");
+ manager->setGlobalOption("Hebrew Cantillation","On");
+ manager->setGlobalOption("Hebrew Vowel Points","On");
+ manager->setGlobalOption("Greek Accents","On");
+
+ if (format == OLB) {
+ manager->setGlobalOption("Headings","Off");
+ }
+
+ for (int i = 0; i < modlist->Items->Count; i++) {
+ if (modlist->Checked[i]) {
+ if (feedback->Lines->Count > 30000) {
+ feedback->Lines->Clear();
+ }
+ AnsiString path;
+ if (format == OLB)
+ path = outputpath->Text + "\\" + modlist->Items->Strings[i] + ".exp";
+ else if (format == GBF)
+ path = outputpath->Text + "\\" + modlist->Items->Strings[i] + ".gbf";
+ else if (format == ThML)
+ path = outputpath->Text + "\\" + modlist->Items->Strings[i] + ".thml";
+ else
+ path = outputpath->Text + "\\" + modlist->Items->Strings[i] + ".txt";
+
+ ModMap::iterator it = manager->Modules.find(modlist->Items->Strings[i].c_str());
+ SectionMap::iterator sit;
+ ConfigEntMap::iterator eit;
+ SWModule *mod = it->second;
+ FILE *ofile = fopen(path.c_str(), "w");
+ VerseKey* vkey;
+ SWKey* key;
+ char* version;
+ char* lang;
+ bool rtl;
+
+ static unsigned char testament, book, chapter, verse;
+ static bool t, b, c, v;
+
+ testament = book = chapter = verse = t = b = c = v = 0;
+
+ if ((sit = manager->config->Sections.find((*it).second->Name())) != manager->config->Sections.end()) {
+ if ((eit = (*sit).second.find("SourceType")) != (*sit).second.end()) {
+ if (!stricmp((char *)(*eit).second.c_str(), "GBF")) {
+ mod->AddRenderFilter(&gbffilter); // memory leak? never heard of one
+ }
+ else {
+ mod->RemoveRenderFilter(&gbffilter);
+ }
+ }
+ if ((eit = (*sit).second.find("Encoding")) == (*sit).second.end() || stricmp((char *)(*eit).second.c_str(), "UTF-8")) {
+ if (eit == (*sit).second.end()) {
+ mod->AddRenderFilter(&latin1filter); // memory leak? never heard of one
+ }
+ else {
+ mod->RemoveRenderFilter(&latin1filter); // memory leak? never heard of one
+ }
+ }
+ if ((eit = (*sit).second.find("Version")) != (*sit).second.end()) {
+ version = (char *)(*eit).second.c_str();
+ }
+ else {
+ version = "1.0";
+ }
+ if ((eit = (*sit).second.find("Lang")) != (*sit).second.end()) {
+ lang = (char *)(*eit).second.c_str();
+ }
+ else {
+ lang = "en";
+ }
+
+ if ((eit = (*sit).second.find("Direction")) != (*sit).second.end()) {
+ rtl = !stricmp((char *)(*eit).second.c_str(), "RtoL");
+ }
+ else {
+ rtl = false;
+ }
+ }
+
+
+
+
+ if (format == ThML) {
+ LocaleMgr::systemLocaleMgr.setDefaultLocaleName("en");
+ fprintf(ofile, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!DOCTYPE ThML PUBLIC \"-\/\/CCEL\/\/DTD Theological Markup Language\/\/EN\" \"dtd\/ThML.dtd\">\n<ThML>\n<ThML.head>\n");
+ fprintf(ofile, "<electronicEdInfo>\n<publisherID>crosswire</publisherID>\n<authorID></authorID>\n<bookID>%s</bookID>\n<version>%s</version>\n<series></series>\n", modlist->Items->Strings[i].LowerCase().c_str(), version);
+ fprintf(ofile, "<DC>\n<DC.Title>%s<\/DC.Title>\n<DC.Language>%s<\/DC.Language>\n<\/DC>\n<\/electronicEdInfo>\n<\/ThML.head>\n<ThML.body>\n", (char*)mod->Description(), lang);
+
+ if (!strcmp(mod->Type(), "Biblical Texts") || !strcmp(mod->Type(), "Commentaries")) {
+ fprintf (ofile, "<scripContext version=\"%s\" \/>\n", (char*)mod->Name());
+ key = (*mod);
+ vkey = (VerseKey*)key;
+ vkey->Headings(1);
+ vkey->Persist(1);
+ vkey->setLocale("en");
+ }
+ else if (!strcmp(mod->Type(), "Lexicons / Dictionaries")) {
+ fprintf (ofile, "<glossary>\n");
+ }
+
+ (*mod) = TOP;
+
+ bool div1, div2, div3;
+ div1 = div2 = div3 = 0;
+
+ while (!mod->Error()) {
+ if (!strcmp(mod->Type(), "Biblical Texts") || !strcmp(mod->Type(), "Commentaries")) {
+
+ t = vkey->Testament() > testament;
+ testament = vkey->Testament();
+ b = vkey->Book() > book;
+ book = vkey->Book();
+ c = vkey->Chapter() > chapter;
+ chapter = vkey->Chapter();
+ v = vkey->Verse() > verse;
+ verse = vkey->Verse();
+
+ if (testament) {
+ if (b && book) {
+ feedback->Lines->Add(modlist->Items->Strings[i] + " - " + vkey->books[testament - 1][book - 1].name);
+ }
+
+ if (t || !div1) {
+ if (div1) {
+ fprintf (ofile, "<\/div3>\n<\/div2>\n<\/div1>\n");
+ div3 = false;
+ div2 = false;
+ }
+ if (testament == 1) {
+ fprintf (ofile, "<div1 title=\"Old Testament\" class=\"testament\" n=\"1\">\n");
+ div1 = true;
+ }
+ else if (testament == 2) {
+ fprintf (ofile, "<div1 title=\"New Testament\" class=\"testament\" n=\"2\">\n");
+ div1 = true;
+ }
+ }
+ if ((b || !div2) && book) {
+ if (div2) {
+ fprintf (ofile, "<\/div3>\n<\/div2>\n");
+ div3 = false;
+ }
+ fprintf (ofile, "<div2 title=\"%s\" class=\"book\" n=\"%d\">\n<scripContext passage=\"%s\" \/>\n", vkey->books[testament - 1][book - 1].name, book, vkey->books[testament - 1][book - 1].name);
+ div2 = true;
+ }
+ if ((c || !div3) && chapter) {
+ if (div3) {
+ fprintf (ofile, "<\/div3>\n");
+ }
+ fprintf (ofile, "<div3 title=\"Chapter %d\" class=\"chapter\" n=\"%d\">\n<scripContext passage=\"%s %d\" \/>\n", chapter, chapter, vkey->books[testament - 1][book - 1].name, chapter);
+ div3 = true;
+ }
+ }
+ }
+
+ if (!strcmp(mod->Type(), "Biblical Texts")) {
+ fprintf (ofile, "<scripture passage=\"%s\">%s<\/scripture>\n", (char*)mod->KeyText(), (const char*)(*mod));
+ (*mod)++;
+ }
+ else if (!strcmp(mod->Type(), "Commentaries")) {
+ fprintf (ofile, "<scripCom passage=\"%s\">%s<\/scripCom>\n", (char*)mod->KeyText(), (const char*)(*mod));
+ (*mod)++;
+ }
+ else if (!strcmp(mod->Type(), "Lexicons / Dictionaries")) {
+ fprintf (ofile, "<term>%s<\/term><def>%s<\/def>\n", (char*)mod->KeyText(), (const char*)(*mod));
+ (*mod)++;
+ feedback->Lines->Add(modlist->Items->Strings[i] + " - " + (char*)mod->KeyText());
+ }
+ }
+
+ if (!strcmp(mod->Type(), "Biblical Texts") || !strcmp(mod->Type(), "Commentaries")) {
+ fprintf (ofile, "<\/div3>\n<\/div2>\n<\/div1>\n");
+ }
+ else if (!strcmp(mod->Type(), "Lexicons / Dictionaries")) {
+ fprintf (ofile, "<\/glossary>\n");
+ }
+ fprintf(ofile, "<\/ThML.body>\n<\/ThML>\n");
+ }
+ else if (format == Plain) {
+ mod->AddRenderFilter(&plainoutputfilter);
+ LocaleMgr::systemLocaleMgr.setDefaultLocaleName("en");
+
+ if (!strcmp(mod->Type(), "Biblical Texts") || !strcmp(mod->Type(), "Commentaries")) {
+ key = (*mod);
+ vkey = (VerseKey*)key;
+ vkey->Headings(1);
+ vkey->Persist(1);
+ vkey->setLocale("en");
+ }
+
+ (*mod) = TOP;
+
+ while (!mod->Error()) {
+ testament = vkey->Testament();
+ b = vkey->Book() > book;
+ book = vkey->Book();
+
+ if (b) {
+ feedback->Lines->Add(modlist->Items->Strings[i] + " - " + vkey->books[testament - 1][book - 1].name);
+ }
+
+ if (!strcmp(mod->Type(), "Biblical Texts")) {
+ fprintf (ofile, "%s %s\n", (char*)mod->KeyText(), (const char*)(*mod));
+ (*mod)++;
+ }
+ else if (!strcmp(mod->Type(), "Commentaries")) {
+ fprintf (ofile, "%s %s\n", (char*)mod->KeyText(), (const char*)(*mod));
+ (*mod)++;
+ }
+ else if (!strcmp(mod->Type(), "Lexicons / Dictionaries")) {
+ fprintf (ofile, "%s %s\n", (char*)mod->KeyText(), (const char*)(*mod));
+ (*mod)++;
+ feedback->Lines->Add(modlist->Items->Strings[i] + " - " + (char*)mod->KeyText());
+ }
+ }
+ mod->RemoveRenderFilter(&plainoutputfilter);
+ }
+ else if (format == OLB) {
+ mod->AddRenderFilter(&olboutputfilter);
+ LocaleMgr::systemLocaleMgr.setDefaultLocaleName("olb");
+
+ if (!strcmp(mod->Type(), "Biblical Texts") || !strcmp(mod->Type(), "Commentaries")) {
+ key = (*mod);
+ vkey = (VerseKey*)key;
+ vkey->Headings(0);
+ vkey->Persist(1);
+ vkey->setLocale("olb");
+ }
+
+ (*mod) = TOP;
+
+ while (!mod->Error()) {
+ testament = vkey->Testament();
+ b = vkey->Book() > book;
+ book = vkey->Book();
+
+ if (b) {
+ feedback->Lines->Add(modlist->Items->Strings[i] + " - " + vkey->books[testament - 1][book - 1].name);
+ }
+
+ if (!strcmp(mod->Type(), "Biblical Texts")) {
+ fprintf (ofile, "$$$ %s\n%s\n", (char*)mod->KeyText(), (const char*)(*mod));
+ (*mod)++;
+ }
+ else if (!strcmp(mod->Type(), "Commentaries")) {
+ fprintf (ofile, "$$$ %s\n%s\n", (char*)mod->KeyText(), (const char*)(*mod));
+ (*mod)++;
+ }
+ else if (!strcmp(mod->Type(), "Lexicons / Dictionaries")) {
+ fprintf (ofile, "$$$ T%d\n\\\\%s\\\\\n%s\n", topicnr++, (char*)mod->KeyText(), (const char*)(*mod));
+ (*mod)++;
+ feedback->Lines->Add(modlist->Items->Strings[i] + " - " + (char*)mod->KeyText());
+ }
+ }
+ mod->RemoveRenderFilter(&olboutputfilter);
+ }
+ else if (format == GBF) {
+ if (!strcmp(mod->Type(), "Biblical Texts") || !strcmp(mod->Type(), "Commentaries")) {
+ mod->AddRenderFilter(&gbfoutputfilter);
+ LocaleMgr::systemLocaleMgr.setDefaultLocaleName("en");
+ fprintf(ofile, "<H000>\n<H1>%s\n<H2>%s\n", (char*)mod->Description(), (char*)mod->Name());
+ key = (*mod);
+ vkey = (VerseKey*)key;
+ vkey->Headings(0);
+ vkey->Persist(1);
+ vkey->setLocale("en");
+
+ (*mod) = TOP;
+
+ while (!mod->Error()) {
+ if (!strcmp(mod->Type(), "Biblical Texts") || !strcmp(mod->Type(), "Commentaries")) {
+ testament = vkey->Testament();
+ b = vkey->Book() > book;
+ book = vkey->Book();
+
+ if (b) {
+ feedback->Lines->Add(modlist->Items->Strings[i] + " - " + vkey->books[testament - 1][book - 1].name);
+ }
+
+
+ if (book == 1 && chapter == 1 && verse == 1 && format != PBR) {
+ if (testament == 1) {
+ fprintf (ofile, "<BO><CM>\n");
+ }
+ else if (testament == 2) {
+ fprintf (ofile, "<BN><CM>\n");
+ }
+
+ fprintf (ofile, "<SB%d><TT>%s<CM><Tt>\n", book, vkey->books[testament - 1][book - 1].name);
+ fprintf (ofile, "<SC%d>\n", chapter);
+ if (rtl)
+ fprintf (ofile, "<DR>\n");
+ }
+ else if (chapter == 1 && verse == 1) {
+ fprintf (ofile, "<SB%d><TT>%s<CM><Tt>\n", book, vkey->books[testament - 1][book - 1].name);
+ fprintf (ofile, "<SC%d>\n", chapter);
+ if (rtl)
+ fprintf (ofile, "<DR>\n");
+ }
+ else if (verse == 1) {
+ fprintf (ofile, "<SC%d>\n", chapter);
+ if (rtl)
+ fprintf (ofile, "<DR>\n");
+ }
+ }
+
+
+ if (!strcmp(mod->Type(), "Biblical Texts")) {
+ fprintf (ofile, "<SV%d>%s\n", vkey->Verse(), (const char*)(*mod));
+ (*mod)++;
+ }
+ else if (!strcmp(mod->Type(), "Commentaries")) {
+ fprintf (ofile, "<SV%d>%s\n", vkey->Verse(), (const char*)(*mod));
+ (*mod)++;
+ }
+ }
+ fprintf(ofile, "<ZZ>\n");
+ mod->RemoveRenderFilter(&gbfoutputfilter);
+ }
+ }
+ else if (format == PBR) {
+ if (!strcmp(mod->Type(), "Biblical Texts") || !strcmp(mod->Type(), "Commentaries")) {
+ mod->AddRenderFilter(&plainoutputfilter);
+ LocaleMgr::systemLocaleMgr.setDefaultLocaleName(lang);
+ fprintf(ofile, "<PARSERINFO ENCODE=\"iso-8859-1\" WORDTYPE=\"SPCSEP\">\n\n");
+ fprintf(ofile, "<BIBLE NAME=\"%s\" INFO=\"%s\" ALIGN=\"%s\">\n", (char*)mod->Name(), (char*)mod->Description(), rtl ? "RIGHT" : "LEFT");
+ key = (*mod);
+ vkey = (VerseKey*)key;
+ vkey->Headings(0);
+ vkey->Persist(1);
+ vkey->setLocale(lang);
+
+ (*mod) = TOP;
+
+ bool div1, div2;
+ div1 = div2 = 0;
+
+ while (!mod->Error()) {
+ if (!strcmp(mod->Type(), "Biblical Texts") || !strcmp(mod->Type(), "Commentaries")) {
+ t = vkey->Testament() > testament;
+ testament = vkey->Testament();
+ b = vkey->Book() > book || t;
+ book = vkey->Book();
+ c = vkey->Chapter() > chapter || b;
+ chapter = vkey->Chapter();
+ v = vkey->Verse() > verse || v;
+ verse = vkey->Verse();
+
+ if (testament) {
+ if (b) {
+ feedback->Lines->Add(modlist->Items->Strings[i] + " - " + vkey->books[testament - 1][book - 1].name);
+ }
+
+ if (b || !div1) {
+ if (div1) {
+ fprintf(ofile, "<\/CHAPTER>\n<\/BOOK>\n");
+ div2 = false;
+ }
+
+ fprintf (ofile, "<BOOK NAME=\"%s\" NUMBER=\"%d\" SHORTCUT=\"%s\">\n", vkey->books[testament - 1][book - 1].name, palmbooks[book + (39 * (testament - 1))], palmbooknames[book + (39 * (testament - 1))]);
+ div1 = true;
+ b = true;
+ }
+ if (c || !div2) {
+ if (div2) {
+ fprintf(ofile, "<\/CHAPTER>\n");
+ }
+
+ fprintf (ofile, "<CHAPTER>\n");
+ div2 = true;
+ c = true;
+ }
+ }
+ }
+
+
+ if (!strcmp(mod->Type(), "Biblical Texts")) {
+ fprintf (ofile, "<VERSE>");
+ if (c) {
+ if (b) {
+ fprintf(ofile, "<BOOKTEXT>%s", vkey->books[testament - 1][book - 1].name);
+ }
+ fprintf (ofile, "<CHAPTEXT>Chapter %d<VERSTEXT>", vkey->Chapter());
+ }
+ fprintf (ofile, "%s<\/VERSE>\n", (const char*)(*mod));
+
+ (*mod)++;
+ }
+ else if (!strcmp(mod->Type(), "Commentaries")) {
+ fprintf (ofile, "<VERSE>");
+ if (c) {
+ if (b) {
+ fprintf(ofile, "<BOOKTEXT>%s", vkey->books[testament - 1][book - 1].name);
+ }
+ fprintf (ofile, "<CHAPTEXT>Chapter %d<VERSTEXT>", vkey->Chapter());
+ }
+ fprintf (ofile, "%s<\/VERSE>\n", (const char*)(*mod));
+
+ (*mod)++; }
+ }
+
+ fprintf(ofile, "<\/CHAPTER>\n<\/BOOK>\n<\/BIBLE>\n");
+ mod->RemoveRenderFilter(&plainoutputfilter);
+ }
+ }
+
+ fclose(ofile);
+ feedback->Lines->Add(modlist->Items->Strings[i] + " - Complete");
+ }
+ }
+ feedback->Lines->Add("All Modules Complete");
+}
+//---------------------------------------------------------------------------
+
diff --git a/Diaspora/Main.dfm b/Diaspora/Main.dfm
new file mode 100644
index 0000000..4b386d6
--- /dev/null
+++ b/Diaspora/Main.dfm
@@ -0,0 +1,146 @@
+object MainForm: TMainForm
+ Left = 472
+ Top = 128
+ Width = 544
+ Height = 399
+ Caption = 'Diaspora'
+ Color = clBtnFace
+ Font.Charset = DEFAULT_CHARSET
+ Font.Color = clWindowText
+ Font.Height = -11
+ Font.Name = 'MS Sans Serif'
+ Font.Style = []
+ OldCreateOrder = True
+ ShowHint = True
+ OnCreate = FormCreate
+ PixelsPerInch = 96
+ TextHeight = 13
+ object modlist: TCheckListBox
+ Left = 0
+ Top = 0
+ Width = 153
+ Height = 372
+ Align = alLeft
+ ItemHeight = 13
+ TabOrder = 0
+ end
+ object Panel1: TPanel
+ Left = 153
+ Top = 0
+ Width = 383
+ Height = 372
+ Align = alClient
+ BevelOuter = bvNone
+ TabOrder = 1
+ object Label1: TLabel
+ Left = 8
+ Top = 8
+ Width = 60
+ Height = 13
+ Caption = 'Output Path:'
+ end
+ object outputpath: TEdit
+ Left = 93
+ Top = 8
+ Width = 281
+ Height = 21
+ TabOrder = 0
+ Text = '.\'
+ end
+ object output: TButton
+ Left = 280
+ Top = 40
+ Width = 94
+ Height = 41
+ Caption = 'Output Files'
+ TabOrder = 1
+ OnClick = outputClick
+ end
+ object feedback: TMemo
+ Left = 0
+ Top = 88
+ Width = 383
+ Height = 284
+ Align = alBottom
+ Lines.Strings = (
+ 'Diaspora: The SWORD Project Module Exporter'
+ 'Copyright 2001 by the CrossWire Bible Society'
+ 'http://www.crosswire.org'
+ 'Released under the GNU General Public License version 2.0'
+
+ 'You can read this licese here: http://www.gnu.org/licenses/gpl.h' +
+ 'tml'
+ 'Send bug reports to sword-bugs@crosswire.org.'
+ ''
+
+ 'Select the modules you which to export from the list on the left' +
+ ', enter the '
+
+ 'path where you want the exported files to be written, and choose' +
+ ' the format '
+ 'you desire. Then click Output Files.'
+ ''
+ 'Note that OLB, GBF, and Palm Bible Reader export support are '
+ 'experimental.'
+ ''
+ 'For more information on formats:'
+ 'ThML: http://www.ccel.org/ThML'
+ 'GBF: http://www.ebible.org/bible/gbf.htm'
+ 'Palm Bible Reader: http://palmbible.sourceforge.net/convert.htm'
+ ''
+ 'Please remember to respect copyright holders'#39' rights & wishes.')
+ ScrollBars = ssVertical
+ TabOrder = 2
+ end
+ object RadioGroup1: TRadioGroup
+ Left = 8
+ Top = 40
+ Width = 265
+ Height = 41
+ Caption = 'Format'
+ TabOrder = 3
+ end
+ object fmtThML: TRadioButton
+ Left = 16
+ Top = 56
+ Width = 81
+ Height = 17
+ Caption = 'ThML'
+ Checked = True
+ TabOrder = 4
+ TabStop = True
+ end
+ object fmtOLB: TRadioButton
+ Left = 72
+ Top = 56
+ Width = 49
+ Height = 17
+ Caption = 'OLB'
+ TabOrder = 5
+ end
+ object fmtGBF: TRadioButton
+ Left = 120
+ Top = 56
+ Width = 49
+ Height = 17
+ Caption = 'GBF'
+ TabOrder = 6
+ end
+ object fmtPalm: TRadioButton
+ Left = 168
+ Top = 56
+ Width = 41
+ Height = 17
+ Caption = 'PBR'
+ TabOrder = 7
+ end
+ object fmtPlain: TRadioButton
+ Left = 216
+ Top = 56
+ Width = 41
+ Height = 17
+ Caption = 'Plain'
+ TabOrder = 8
+ end
+ end
+end
diff --git a/Diaspora/Main.h b/Diaspora/Main.h
new file mode 100644
index 0000000..a2e86f9
--- /dev/null
+++ b/Diaspora/Main.h
@@ -0,0 +1,54 @@
+//---------------------------------------------------------------------------
+#ifndef MainH
+#define MainH
+//---------------------------------------------------------------------------
+#include <vcl\sysutils.hpp>
+#include <vcl\windows.hpp>
+#include <vcl\messages.hpp>
+#include <vcl\sysutils.hpp>
+#include <vcl\classes.hpp>
+#include <vcl\graphics.hpp>
+#include <vcl\controls.hpp>
+#include <vcl\forms.hpp>
+#include <vcl\dialogs.hpp>
+#include <vcl\stdctrls.hpp>
+#include <vcl\buttons.hpp>
+#include <vcl\extctrls.hpp>
+#include <vcl\menus.hpp>
+#include <Buttons.hpp>
+#include <Classes.hpp>
+#include <ComCtrls.hpp>
+#include <Controls.hpp>
+#include <Dialogs.hpp>
+#include <ExtCtrls.hpp>
+#include <Menus.hpp>
+#include <swmgr.h>
+#include <CheckLst.hpp>
+#include <StdCtrls.hpp>
+//---------------------------------------------------------------------------
+class TMainForm : public TForm
+{
+__published:
+ TCheckListBox *modlist;
+ TPanel *Panel1;
+ TLabel *Label1;
+ TEdit *outputpath;
+ TButton *output;
+ TMemo *feedback;
+ TRadioGroup *RadioGroup1;
+ TRadioButton *fmtThML;
+ TRadioButton *fmtOLB;
+ TRadioButton *fmtGBF;
+ TRadioButton *fmtPalm;
+ TRadioButton *fmtPlain;
+ void __fastcall FormCreate(TObject *Sender);
+ void __fastcall outputClick(TObject *Sender);
+private: // private user declarations
+public: // public user declarations
+ virtual __fastcall TMainForm(TComponent* Owner);
+ SWMgr* manager;
+};
+//---------------------------------------------------------------------------
+extern TMainForm *MainForm;
+//---------------------------------------------------------------------------
+#endif