[sword-svn] r1956 - in trunk: . src/mgr tests
scribe at www.crosswire.org
scribe at www.crosswire.org
Wed Aug 16 05:04:53 MST 2006
Author: scribe
Date: 2006-08-16 05:04:50 -0700 (Wed, 16 Aug 2006)
New Revision: 1956
Modified:
trunk/ChangeLog
trunk/src/mgr/localemgr.cpp
trunk/src/mgr/swmgr.cpp
trunk/tests/mgrtest.cpp
Log:
Added new ./sword.conf module lookup option
Cleaned up code formatting and debug output
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2006-08-10 03:54:18 UTC (rev 1955)
+++ trunk/ChangeLog 2006-08-16 12:04:50 UTC (rev 1956)
@@ -1,6 +1,21 @@
API ChangeLog (see the ChangeLog in each 'apps' directory for
app specific changes)
+16-Aug-2006 Troy A. Griffitts <scribe at crosswire.org>
+ Added new module lookup options:
+ ./sword.conf
+ ../library/mods.d
+ Added fix to preserve markup in headings (charcoal)
+ Fixed non-UTF8 builds (thanks berkana)
+
+1-Aug-2006 DM Smith <dmsmith at crosswire.org>
+ Fixed divineName bug
+ Updated q handling to use quote stack
+ Update to fix RLT
+ Fixed a bug in osis2mod that duplicated a chapter title in the verse
+ Normalize whitespace in xml tags
+ Updated support for more OSIS markup, including q marker
+
21-May-2006 Troy A. Griffitts <scribe at crosswire.org>
Added SWBuf::startsWith, endsWith
Added entry attribute exposure of multipart words
Modified: trunk/src/mgr/localemgr.cpp
===================================================================
--- trunk/src/mgr/localemgr.cpp 2006-08-10 03:54:18 UTC (rev 1955)
+++ trunk/src/mgr/localemgr.cpp 2006-08-16 12:04:50 UTC (rev 1956)
@@ -36,9 +36,16 @@
#include <swlocale.h>
#include <swlog.h>
+
+#ifdef _MSC_VER
+#define DEBUGSTR(x)
+#else
+#include<iostream>
+#define DEBUGSTR(x) if (SWMgr::debug) std::cerr << x;
+#endif
+
SWORD_NAMESPACE_START
-
LocaleMgr *LocaleMgr::systemLocaleMgr = 0;
class __staticsystemLocaleMgr {
@@ -73,8 +80,11 @@
defaultLocaleName = 0;
- if (!iConfigPath)
+ if (!iConfigPath) {
+ DEBUGSTR("LOOKING UP LOCALE DIRECTORY...\n");
SWMgr::findConfig(&configType, &prefixPath, &configPath, &augPaths);
+ DEBUGSTR("LOOKING UP LOCALE DIRECTORY COMPLETE.\n\n");
+ }
else configPath = (char *)iConfigPath;
if (prefixPath) {
Modified: trunk/src/mgr/swmgr.cpp
===================================================================
--- trunk/src/mgr/swmgr.cpp 2006-08-10 03:54:18 UTC (rev 1955)
+++ trunk/src/mgr/swmgr.cpp 2006-08-16 12:04:50 UTC (rev 1956)
@@ -350,104 +350,112 @@
void SWMgr::findConfig(char *configType, char **prefixPath, char **configPath, std::list<SWBuf> *augPaths) {
SWBuf path;
+ SWBuf sysConfPath;
ConfigEntMap::iterator entry;
ConfigEntMap::iterator lastEntry;
- char *envsworddir = getenv ("SWORD_PATH");
- char *envhomedir = getenv ("HOME");
+ char *envsworddir = getenv("SWORD_PATH");
+ char *envhomedir = getenv("HOME");
*configType = 0;
//debug=1;
// check working directory
- DEBUGSTR("Checking working directory for mods.conf...");
- if (FileMgr::existsFile(".", "mods.conf")) {
- DEBUGSTR("found\n");
- stdstr(prefixPath, "./");
- stdstr(configPath, "./mods.conf");
- return;
+ DEBUGSTR("Checking working directory for sword.conf...");
+ if (FileMgr::existsFile(".", "sword.conf")) {
+ DEBUGSTR("\nOverriding any systemwide or ~/.sword/ sword.conf with one found in current directory.\n");
+ sysConfPath = "./sword.conf";
}
+ else {
+ DEBUGSTR("\nChecking working directory for mods.conf...");
+ if (FileMgr::existsFile(".", "mods.conf")) {
+ DEBUGSTR("found\n");
+ stdstr(prefixPath, "./");
+ stdstr(configPath, "./mods.conf");
+ return;
+ }
- DEBUGSTR("\nChecking working directory for mods.d...");
- if (FileMgr::existsDir(".", "mods.d")) {
- DEBUGSTR("found\n");
- stdstr(prefixPath, "./");
- stdstr(configPath, "./mods.d");
- *configType = 1;
- return;
- }
-
- // check working directory ../library/
- DEBUGSTR("\nChecking working directory ../library/ for mods.d...");
- if (FileMgr::existsDir("../library", "mods.d")) {
- DEBUGSTR("found\n");
- stdstr(prefixPath, "../library/");
- stdstr(configPath, "../library/mods.d");
- *configType = 1;
- return;
- }
-
- // check environment variable SWORD_PATH
- DEBUGSTR("\nChecking SWORD_PATH...");
-
- if (envsworddir != NULL) {
-
- DEBUGSTR("found (" << envsworddir << ")\n");
- path = envsworddir;
- if ((envsworddir[strlen(envsworddir)-1] != '\\') && (envsworddir[strlen(envsworddir)-1] != '/'))
- path += "/";
-
- DEBUGSTR("\nChecking $SWORD_PATH for mods.conf...");
- if (FileMgr::existsFile(path.c_str(), "mods.conf")) {
+ DEBUGSTR("\nChecking working directory for mods.d...");
+ if (FileMgr::existsDir(".", "mods.d")) {
DEBUGSTR("found\n");
- stdstr(prefixPath, path.c_str());
- path += "mods.conf";
- stdstr(configPath, path.c_str());
+ stdstr(prefixPath, "./");
+ stdstr(configPath, "./mods.d");
+ *configType = 1;
return;
}
- DEBUGSTR("\nChecking $SWORD_PATH for mods.d...");
- if (FileMgr::existsDir(path.c_str(), "mods.d")) {
+ // check working directory ../library/
+ DEBUGSTR("\nChecking working directory ../library/ for mods.d...");
+ if (FileMgr::existsDir("../library", "mods.d")) {
DEBUGSTR("found\n");
- stdstr(prefixPath, path.c_str());
- path += "mods.d";
- stdstr(configPath, path.c_str());
+ stdstr(prefixPath, "../library/");
+ stdstr(configPath, "../library/mods.d");
*configType = 1;
return;
}
- }
+ // check environment variable SWORD_PATH
+ DEBUGSTR("\nChecking SWORD_PATH...");
- // check for systemwide globalConfPath
+ if (envsworddir != NULL) {
+
+ DEBUGSTR("found (" << envsworddir << ")\n");
+ path = envsworddir;
+ if ((envsworddir[strlen(envsworddir)-1] != '\\') && (envsworddir[strlen(envsworddir)-1] != '/'))
+ path += "/";
- DEBUGSTR("\nParsing " << globalConfPath << "...");
- char *globPaths = 0;
- char *gfp;
- stdstr(&globPaths, globalConfPath);
- for (gfp = strtok(globPaths, ":"); gfp; gfp = strtok(0, ":")) {
+ DEBUGSTR("\nChecking $SWORD_PATH for mods.conf...");
+ if (FileMgr::existsFile(path.c_str(), "mods.conf")) {
+ DEBUGSTR("found\n");
+ stdstr(prefixPath, path.c_str());
+ path += "mods.conf";
+ stdstr(configPath, path.c_str());
+ return;
+ }
- DEBUGSTR("\nChecking for " << gfp << "...");
- if (FileMgr::existsFile(gfp))
- break;
- }
- SWBuf sysConfPath;
- if (gfp)
- sysConfPath = gfp;
+ DEBUGSTR("\nChecking $SWORD_PATH for mods.d...");
+ if (FileMgr::existsDir(path.c_str(), "mods.d")) {
+ DEBUGSTR("found\n");
+ stdstr(prefixPath, path.c_str());
+ path += "mods.d";
+ stdstr(configPath, path.c_str());
+ *configType = 1;
+ return;
+ }
+ }
- SWBuf homeDir = getenv ("HOME");
- if (homeDir.size() > 0) {
- if ((homeDir[homeDir.size()-1] != '\\') && (homeDir[homeDir.size()-1] != '/'))
- homeDir += "/";
- homeDir += ".sword/sword.conf";
- if (FileMgr::existsFile(homeDir)) {
- DEBUGSTR("\nOverriding any systemwide sword.conf with one found in users home directory." << gfp << "...");
- sysConfPath = homeDir;
+
+ // check for systemwide globalConfPath
+
+ DEBUGSTR("\nParsing " << globalConfPath << "...");
+ char *globPaths = 0;
+ char *gfp;
+ stdstr(&globPaths, globalConfPath);
+ for (gfp = strtok(globPaths, ":"); gfp; gfp = strtok(0, ":")) {
+ DEBUGSTR("\nChecking for " << gfp << "...");
+ if (FileMgr::existsFile(gfp)) {
+ DEBUGSTR("found\n");
+ break;
+ }
}
+ if (gfp)
+ sysConfPath = gfp;
+ delete [] globPaths;
+
+ SWBuf homeDir = envhomedir;
+ if (homeDir.size() > 0) {
+ if ((homeDir[homeDir.size()-1] != '\\') && (homeDir[homeDir.size()-1] != '/'))
+ homeDir += "/";
+ homeDir += ".sword/sword.conf";
+ if (FileMgr::existsFile(homeDir)) {
+ DEBUGSTR("\nOverriding any systemwide sword.conf with one found in users home directory.\n");
+ sysConfPath = homeDir;
+ }
+ }
}
if (sysConfPath.size()) {
- DEBUGSTR("found\n");
SWConfig etcconf(sysConfPath);
if ((entry = etcconf.Sections["Install"].find("DataPath")) != etcconf.Sections["Install"].end()) {
path = (*entry).second;
@@ -455,7 +463,7 @@
path += "/";
DEBUGSTR("DataPath in " << sysConfPath << " is set to: " << path);
- DEBUGSTR("\nChecking for mods.conf in DataPath ");
+ DEBUGSTR("\nChecking for mods.conf in DataPath...");
if (FileMgr::existsFile(path.c_str(), "mods.conf")) {
DEBUGSTR("found\n");
@@ -465,7 +473,7 @@
*configType = 1;
}
- DEBUGSTR("\nChecking for mods.d in DataPath ");
+ DEBUGSTR("\nChecking for mods.d in DataPath...");
if (FileMgr::existsDir(path.c_str(), "mods.d")) {
DEBUGSTR("found\n");
@@ -488,19 +496,19 @@
}
}
- delete [] globPaths;
if (*configType)
return;
// check ~/.sword/
- DEBUGSTR("\nChecking home directory for ~/.sword/mods.conf" << path);
+ DEBUGSTR("\nChecking home directory for ~/.sword...");
if (envhomedir != NULL) {
path = envhomedir;
if ((envhomedir[strlen(envhomedir)-1] != '\\') && (envhomedir[strlen(envhomedir)-1] != '/'))
path += "/";
path += ".sword/";
+ DEBUGSTR("\n Checking for " << path << "mods.conf...");
if (FileMgr::existsFile(path.c_str(), "mods.conf")) {
DEBUGSTR("found\n");
stdstr(prefixPath, path.c_str());
@@ -509,8 +517,7 @@
return;
}
- DEBUGSTR("\nChecking home directory for ~/.sword/mods.d" << path);
-
+ DEBUGSTR("\n Checking for " << path << "mods.d...");
if (FileMgr::existsDir(path.c_str(), "mods.d")) {
DEBUGSTR("found\n");
stdstr(prefixPath, path.c_str());
@@ -626,8 +633,11 @@
signed char ret = 0;
if (!config) { // If we weren't passed a config object at construction, find a config file
- if (!configPath) // If we weren't passed a config path at construction...
+ if (!configPath) { // If we weren't passed a config path at construction...
+ DEBUGSTR("LOOKING UP MODULE CONFIGURATION...\n");
findConfig(&configType, &prefixPath, &configPath, &augPaths);
+ DEBUGSTR("LOOKING UP MODULE CONFIGURATION COMPLETE.\n\n");
+ }
if (configPath) {
if (configType)
loadConfigDir(configPath);
@@ -659,7 +669,7 @@
}
if (augmentHome) {
// augment config with ~/.sword/mods.d if it exists ---------------------
- char *envhomedir = getenv ("HOME");
+ char *envhomedir = getenv("HOME");
if (envhomedir != NULL && configType != 2) { // 2 = user only
SWBuf path = envhomedir;
if ((envhomedir[strlen(envhomedir)-1] != '\\') && (envhomedir[strlen(envhomedir)-1] != '/'))
Modified: trunk/tests/mgrtest.cpp
===================================================================
--- trunk/tests/mgrtest.cpp 2006-08-10 03:54:18 UTC (rev 1955)
+++ trunk/tests/mgrtest.cpp 2006-08-16 12:04:50 UTC (rev 1956)
@@ -7,6 +7,7 @@
#endif
int main(int argc, char **argv) {
+ std::cerr << "\n";
SWMgr::debug = true;
SWMgr mymgr;
char keypress[2];
More information about the sword-cvs
mailing list