summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorDmitrijs Ledkovs <xnox@debian.org>2012-04-14 18:11:50 +0100
committerRoberto C. Sanchez <roberto@connexer.com>2014-10-21 22:48:45 -0400
commit1da8254d16a30cc96f545d198975e9f3a4d847be (patch)
tree6d94b7a0d34cb80e14287ae50994f1c46d39a154 /cmake
parentbc6baa3433b5781439754ff2a2a4d475986ec393 (diff)
parent00bc0a3de99e088902379dcb2905fb1546c7eca2 (diff)
Imported Debian patch 2.9.1-1
Diffstat (limited to 'cmake')
-rw-r--r--cmake/BTSourceFileList.cmake7
-rw-r--r--cmake/FindCLucene.cmake26
-rw-r--r--cmake/docs/handbook_po4a.conf2
-rw-r--r--cmake/platforms/windows/README.txt8
-rw-r--r--cmake/platforms/windows/filemgr.cpp570
-rw-r--r--cmake/platforms/windows/rawfiles.cpp230
-rw-r--r--cmake/platforms/windows/rawfiles.h86
7 files changed, 347 insertions, 582 deletions
diff --git a/cmake/BTSourceFileList.cmake b/cmake/BTSourceFileList.cmake
index 6fac014..f5c4ab5 100644
--- a/cmake/BTSourceFileList.cmake
+++ b/cmake/BTSourceFileList.cmake
@@ -108,6 +108,7 @@ SET(bibletime_SRC_UTIL
src/util/cresmgr.cpp
src/util/dialogutil.cpp
src/util/directory.cpp
+ src/util/btmodules.cpp
src/util/tool.cpp
)
@@ -125,7 +126,6 @@ SET(bibletime_SRC_FRONTEND
src/frontend/btmodulechooserdialog.cpp
src/frontend/btmoduleindexdialog.cpp
src/frontend/btopenworkaction.cpp
- src/frontend/cdragdrop.cpp
src/frontend/cexportmanager.cpp
src/frontend/cinfodisplay.cpp
src/frontend/cmdiarea.cpp
@@ -179,7 +179,6 @@ SET(bibletime_SRC_FRONTEND_BOOKMARKS
# Bookshelf/Bookmarks widget in main window:
src/frontend/bookmarks/btbookmarkfolder.cpp
src/frontend/bookmarks/btbookmarkitem.cpp
- src/frontend/bookmarks/btbookmarkitembase.cpp
src/frontend/bookmarks/btbookmarkloader.cpp
src/frontend/bookmarks/bteditbookmarkdialog.cpp
src/frontend/bookmarks/cbookmarkindex.cpp
@@ -220,7 +219,7 @@ SET(bibletime_SRC_FRONTEND_SETTINGSDIALOG
src/frontend/settingsdialogs/cacceleratorsettings.cpp
src/frontend/settingsdialogs/cconfigurationdialog.cpp
src/frontend/settingsdialogs/cdisplaysettings.cpp
- src/frontend/settingsdialogs/cfontchooser.cpp
+ src/frontend/settingsdialogs/btfontchooserwidget.cpp
src/frontend/settingsdialogs/btfontsettings.cpp
src/frontend/settingsdialogs/btlanguagesettings.cpp
src/frontend/settingsdialogs/clistwidget.cpp
@@ -405,7 +404,7 @@ SET(bibletime_MOCABLE_HEADERS
src/frontend/settingsdialogs/cacceleratorsettings.h
src/frontend/settingsdialogs/cconfigurationdialog.h
src/frontend/settingsdialogs/cdisplaysettings.h
- src/frontend/settingsdialogs/cfontchooser.h
+ src/frontend/settingsdialogs/btfontchooserwidget.h
src/frontend/settingsdialogs/btfontsettings.h
src/frontend/settingsdialogs/btlanguagesettings.h
src/frontend/settingsdialogs/clistwidget.h
diff --git a/cmake/FindCLucene.cmake b/cmake/FindCLucene.cmake
index a784975..9c9df7d 100644
--- a/cmake/FindCLucene.cmake
+++ b/cmake/FindCLucene.cmake
@@ -87,14 +87,28 @@ IF (CLUCENE_LIBRARY_DIR)
STRING(REGEX MATCH "_CL_VERSION +\".*\"" CLMATCH ${CLCONTENT})
IF (CLMATCH)
STRING(REGEX REPLACE "_CL_VERSION +\"(.*)\"" "\\1" CLUCENE_VERSION ${CLMATCH})
- IF (CLUCENE_VERSION STRLESS "${CLUCENE_MIN_VERSION}")
- MESSAGE(ERROR " CLucene version ${CLUCENE_VERSION} is less than the required minimum ${CLUCENE_MIN_VERSION}")
+ IF (CLUCENE_VERSION VERSION_LESS "${CLUCENE_MIN_VERSION}")
+ MESSAGE(ERROR " CLucene version ${CLUCENE_VERSION} is less than the required minimum ${CLUCENE_MIN_VERSION}")
SET(CLUCENE_GOOD_VERSION FALSE)
- ENDIF (CLUCENE_VERSION STRLESS "${CLUCENE_MIN_VERSION}")
- IF (CLUCENE_VERSION STREQUAL "0.9.17")
- MESSAGE(ERROR "CLucene version 0.9.17 is not supported.")
+ ENDIF (CLUCENE_VERSION VERSION_LESS "${CLUCENE_MIN_VERSION}")
+ IF (CLUCENE_VERSION STREQUAL "0.9.17")
+ MESSAGE(ERROR "CLucene version 0.9.17 is not supported.")
SET(CLUCENE_GOOD_VERSION FALSE)
- ENDIF (CLUCENE_VERSION STREQUAL "0.9.17")
+ ENDIF (CLUCENE_VERSION STREQUAL "0.9.17")
+ IF (CLUCENE_VERSION VERSION_GREATER "2.0.0")
+ ADD_DEFINITIONS(-DCLUCENE2)
+ FIND_LIBRARY_WITH_DEBUG(CLUCENE_SHARED_LIB
+ NAMES clucene-shared
+ PATHS ${TRIAL_LIBRARY_PATHS})
+
+ IF (CLUCENE_SHARED_LIB)
+ MESSAGE(STATUS "Found CLucene shared library: ${CLUCENE_SHARED_LIB}")
+ SET(CLUCENE_LIBRARY ${CLUCENE_LIBRARY} ${CLUCENE_SHARED_LIB})
+ ELSE (CLUCENE_SHARED_LIB)
+ MESSAGE(FATAL_ERROR "Unable to find CLucene shared library.")
+ SET(CLUCENE_GOOD_VERSION FALSE)
+ ENDIF(CLUCENE_SHARED_LIB)
+ ENDIF (CLUCENE_VERSION VERSION_GREATER "2.0.0")
ENDIF (CLMATCH)
ELSE (CLUCENE_LIBRARY_DIR)
MESSAGE(STATUS "CLucene library dir not found.")
diff --git a/cmake/docs/handbook_po4a.conf b/cmake/docs/handbook_po4a.conf
index ed8fe28..fc74c7f 100644
--- a/cmake/docs/handbook_po4a.conf
+++ b/cmake/docs/handbook_po4a.conf
@@ -4,7 +4,7 @@
# If you modify the language list here, make sure you also modify CMakeLists.txt
#
-[po4a_langs] cs de es fi fr hu it nl pt_BR
+[po4a_langs] ar cs de es fi fr hu it nl pt_BR
[po4a_paths] i18n/handbook/handbook.pot $lang:i18n/handbook/handbook-$lang.po
[type: docbook] docs/handbook/en/docbook/hdbk-config.docbook $lang:docs/handbook/$lang/docbook/hdbk-config.docbook
[type: docbook] docs/handbook/en/docbook/hdbk-intro.docbook $lang:docs/handbook/$lang/docbook/hdbk-intro.docbook
diff --git a/cmake/platforms/windows/README.txt b/cmake/platforms/windows/README.txt
index 6af16e7..254c599 100644
--- a/cmake/platforms/windows/README.txt
+++ b/cmake/platforms/windows/README.txt
@@ -1 +1,7 @@
-The filemgr.cpp in this directory should be copied into the sword/src/mgr directory and overwrite the filemgr.cpp in that directory. \ No newline at end of file
+Patch for sword 1.6.2 on Windows
+
+This fixes a crash that occurs when saving an entry using the Personal Commentary.
+
+The rawfiles.cpp file should be copied to sword\src\modules\comments\rawfiles
+
+The rawfiles.h file should be copied to sword\include
diff --git a/cmake/platforms/windows/filemgr.cpp b/cmake/platforms/windows/filemgr.cpp
deleted file mode 100644
index 2205825..0000000
--- a/cmake/platforms/windows/filemgr.cpp
+++ /dev/null
@@ -1,570 +0,0 @@
-/******************************************************************************
- * filemgr.cpp - implementation of class FileMgr used for pooling file
- * handles
- *
- * $Id: filemgr.cpp 2245 2009-02-10 23:22:28Z scribe $
- *
- * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
- * CrossWire Bible Society
- * P. O. Box 2528
- * Tempe, AZ 85280-2528
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation version 2.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- */
-
-#include <filemgr.h>
-#include <utilstr.h>
-
-#include <dirent.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <stdio.h>
-#include <string.h>
-#include <swbuf.h>
-#if !defined(__GNUC__) && !defined(_WIN32_WCE)
-#include <io.h>
-#include <direct.h>
-#else
-#include <unistd.h>
-#endif
-
-
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
-
-#ifndef S_IRGRP
-#define S_IRGRP 0
-#endif
-
-#ifndef S_IROTH
-#define S_IROTH 0
-#endif
-
-// Fix for VC6
-#ifndef S_IREAD
-#ifdef _S_IREAD
-#define S_IREAD _S_IREAD
-#define S_IWRITE _S_IWRITE
-#endif
-#endif
-// -----------
-
-
-SWORD_NAMESPACE_START
-
-
-int FileMgr::CREAT = O_CREAT;
-int FileMgr::APPEND = O_APPEND;
-int FileMgr::TRUNC = O_TRUNC;
-int FileMgr::RDONLY = O_RDONLY;
-int FileMgr::RDWR = O_RDWR;
-int FileMgr::WRONLY = O_WRONLY;
-int FileMgr::IREAD = S_IREAD;
-int FileMgr::IWRITE = S_IWRITE;
-
-
-// ---------------- statics -----------------
-FileMgr *FileMgr::systemFileMgr = 0;
-
-class __staticsystemFileMgr {
-public:
- __staticsystemFileMgr() { }
- ~__staticsystemFileMgr() { delete FileMgr::systemFileMgr; }
-} _staticsystemFileMgr;
-
-
-FileMgr *FileMgr::getSystemFileMgr() {
- if (!systemFileMgr)
- systemFileMgr = new FileMgr();
-
- return systemFileMgr;
-}
-
-
-void FileMgr::setSystemFileMgr(FileMgr *newFileMgr) {
- if (systemFileMgr)
- delete systemFileMgr;
- systemFileMgr = newFileMgr;
-}
-
-// --------------- end statics --------------
-
-
-FileDesc::FileDesc(FileMgr *parent, const char *path, int mode, int perms, bool tryDowngrade) {
- this->parent = parent;
- this->path = 0;
- stdstr(&this->path, path);
- this->mode = mode;
- this->perms = perms;
- this->tryDowngrade = tryDowngrade;
- offset = 0;
- fd = -77;
-}
-
-
-FileDesc::~FileDesc() {
- if (fd > 0)
- close(fd);
-
- if (path)
- delete [] path;
-}
-
-
-int FileDesc::getFd() {
- if (fd == -77)
- fd = parent->sysOpen(this);
-// if ((fd < -1) && (fd != -77)) // kludge to hand ce
-// return 777;
- return fd;
-}
-
-
-long FileDesc::seek(long offset, int whence) {
- return lseek(getFd(), offset, whence);
-}
-
-
-long FileDesc::read(void *buf, long count) {
- int fd = getFd();
- if (fd < 0) {
- return 0;
- }
- return ::read(fd, buf, count);
-}
-
-
-long FileDesc::write(const void *buf, long count) {
- return ::write(getFd(), buf, count);
-}
-
-
-FileMgr::FileMgr(int maxFiles) {
- this->maxFiles = maxFiles; // must be at least 2
- files = 0;
-}
-
-
-FileMgr::~FileMgr() {
- FileDesc *tmp;
-
- while(files) {
- tmp = files->next;
- delete files;
- files = tmp;
- }
-}
-
-
-FileDesc *FileMgr::open(const char *path, int mode, bool tryDowngrade) {
- return open(path, mode, S_IREAD|S_IWRITE|S_IRGRP|S_IROTH, tryDowngrade);
-}
-
-
-FileDesc *FileMgr::open(const char *path, int mode, int perms, bool tryDowngrade) {
- FileDesc **tmp, *tmp2;
-
- for (tmp = &files; *tmp; tmp = &((*tmp)->next)) {
- if ((*tmp)->fd < 0) // insert as first non-system_open file
- break;
- }
-
- tmp2 = new FileDesc(this, path, mode, perms, tryDowngrade);
- tmp2->next = *tmp;
- *tmp = tmp2;
-
- return tmp2;
-}
-
-
-void FileMgr::close(FileDesc *file) {
- FileDesc **loop;
-
- for (loop = &files; *loop; loop = &((*loop)->next)) {
- if (*loop == file) {
- *loop = (*loop)->next;
- delete file;
- break;
- }
- }
-}
-
-
-int FileMgr::sysOpen(FileDesc *file) {
- FileDesc **loop;
- int openCount = 1; // because we are presently opening 1 file, and we need to be sure to close files to accomodate, if necessary
-
- for (loop = &files; *loop; loop = &((*loop)->next)) {
-
- if ((*loop)->fd > 0) {
- if (++openCount > maxFiles) {
- (*loop)->offset = lseek((*loop)->fd, 0, SEEK_CUR);
- ::close((*loop)->fd);
- (*loop)->fd = -77;
- }
- }
-
- if (*loop == file) {
- if (*loop != files) {
- *loop = (*loop)->next;
- file->next = files;
- files = file;
- }
- if ((!access(file->path, 04)) || ((file->mode & O_CREAT) == O_CREAT)) { // check for at least file exists / read access before we try to open
- char tries = (((file->mode & O_RDWR) == O_RDWR) && (file->tryDowngrade)) ? 2 : 1; // try read/write if possible
- for (int i = 0; i < tries; i++) {
- if (i > 0) {
- file->mode = (file->mode & ~O_RDWR); // remove write access
- file->mode = (file->mode | O_RDONLY);// add read access
- }
- file->fd = ::open(file->path, file->mode|O_BINARY, file->perms);
-
- if (file->fd >= 0)
- break;
- }
-
- if (file->fd >= 0)
- lseek(file->fd, file->offset, SEEK_SET);
- }
- else file->fd = -1;
- if (!*loop)
- break;
- }
- }
- return file->fd;
-}
-
-
-// to truncate a file at its current position
-// leaving byte at current possition intact
-// deleting everything afterward.
-signed char FileMgr::trunc(FileDesc *file) {
-
- static const char *writeTest = "x";
- long size = file->seek(1, SEEK_CUR);
- if (size == 1) // was empty
- size = 0;
- char nibble [ 32767 ];
- bool writable = file->write(writeTest, 1);
- int bytes = 0;
-
- if (writable) {
- // get tmpfilename
- char *buf = new char [ strlen(file->path) + 10 ];
- int i;
- for (i = 0; i < 9999; i++) {
- sprintf(buf, "%stmp%.4d", file->path, i);
- if (!existsFile(buf))
- break;
- }
- if (i == 9999)
- return -2;
-
- int fd = ::open(buf, O_CREAT|O_RDWR, S_IREAD|S_IWRITE|S_IRGRP|S_IROTH);
- if (fd < 0)
- return -3;
-
- file->seek(0, SEEK_SET);
- while (size > 0) {
- bytes = file->read(nibble, 32767);
- write(fd, nibble, (bytes < size)?bytes:size);
- size -= bytes;
- }
- // zero out the file
- ::close(file->fd);
- file->fd = ::open(file->path, O_TRUNC, S_IREAD|S_IWRITE|S_IRGRP|S_IROTH);
- ::close(file->fd);
- file->fd = -77; // force file open by filemgr
- // copy tmp file back (dumb, but must preserve file permissions)
- lseek(fd, 0, SEEK_SET);
- do {
- bytes = read(fd, nibble, 32767);
- file->write(nibble, bytes);
- } while (bytes == 32767);
-
- ::close(fd);
- ::close(file->fd);
- removeFile(buf); // remove our tmp file
- file->fd = -77; // causes file to be swapped out forcing open on next call to getFd()
- }
- else { // put offset back and return failure
- file->seek(-1, SEEK_CUR);
- return -1;
- }
- return 0;
-}
-
-
-signed char FileMgr::existsFile(const char *ipath, const char *ifileName)
-{
- int len = strlen(ipath) + ((ifileName)?strlen(ifileName):0) + 3;
- char *ch;
- char *path = new char [ len ];
- strcpy(path, ipath);
-
- if ((path[strlen(path)-1] == '\\') || (path[strlen(path)-1] == '/'))
- path[strlen(path)-1] = 0;
-
- if (ifileName) {
- ch = path + strlen(path);
- sprintf(ch, "/%s", ifileName);
- }
- signed char retVal = !access(path, 04);
- delete [] path;
- return retVal;
-}
-
-
-signed char FileMgr::existsDir(const char *ipath, const char *idirName)
-{
- char *ch;
- int len = strlen(ipath) + ((idirName)?strlen(idirName):0) + 1;
- if (idirName)
- len += strlen(idirName);
- char *path = new char [ len ];
- strcpy(path, ipath);
-
- if ((path[strlen(path)-1] == '\\') || (path[strlen(path)-1] == '/'))
- path[strlen(path)-1] = 0;
-
- if (idirName) {
- ch = path + strlen(path);
- sprintf(ch, "/%s", idirName);
- }
- signed char retVal = !access(path, 04);
- delete [] path;
- return retVal;
-}
-
-
-int FileMgr::createParent(const char *pName) {
- char *buf = new char [ strlen(pName) + 1 ];
- int retCode = 0;
-
- strcpy(buf, pName);
- int end = strlen(buf) - 1;
- while (end) {
- if ((buf[end] == '/') || (buf[end] == '\\'))
- break;
- end--;
- }
- buf[end] = 0;
- if (strlen(buf)>0) {
- if (access(buf, 02)) { // not exists with write access?
- if ((retCode = mkdir(buf
-#ifndef WIN32
- , 0755
-#endif
- ))) {
- createParent(buf);
- retCode = mkdir(buf
-#ifndef WIN32
- , 0755
-#endif
- );
- }
- }
- }
- else retCode = -1;
- delete [] buf;
- return retCode;
-}
-
-
-int FileMgr::openFileReadOnly(const char *fName) {
- int fd = ::open(fName, O_RDONLY|O_BINARY, S_IREAD|S_IWRITE|S_IRGRP|S_IROTH);
- return fd;
-}
-
-
-int FileMgr::createPathAndFile(const char *fName) {
- int fd;
-
- fd = ::open(fName, O_CREAT|O_WRONLY|O_BINARY, S_IREAD|S_IWRITE|S_IRGRP|S_IROTH);
- if (fd < 1) {
- createParent(fName);
- fd = ::open(fName, O_CREAT|O_WRONLY|O_BINARY, S_IREAD|S_IWRITE|S_IRGRP|S_IROTH);
- }
- return fd;
-}
-
-
-int FileMgr::copyFile(const char *sourceFile, const char *targetFile) {
- int sfd, dfd, len;
- char buf[4096];
-
- if ((sfd = ::open(sourceFile, O_RDONLY|O_BINARY, S_IREAD|S_IWRITE|S_IRGRP|S_IROTH)) < 1)
- return -1;
- if ((dfd = createPathAndFile(targetFile)) < 1)
- return -1;
-
- do {
- len = read(sfd, buf, 4096);
- write(dfd, buf, len);
- }
- while(len == 4096);
- ::close(dfd);
- ::close(sfd);
-
- return 0;
-}
-
-
-int FileMgr::removeFile(const char *fName) {
- return ::remove(fName);
-}
-
-char FileMgr::getLine(FileDesc *fDesc, SWBuf &line) {
- int len;
- bool more = true;
- char chunk[255];
-
- line = "";
-
- // assert we have a valid file handle
- if (fDesc->getFd() < 1)
- return 0;
-
- while (more) {
- more = false;
- long index = fDesc->seek(0, SEEK_CUR);
- len = fDesc->read(chunk, 254);
-
- // assert we have a readable file (not a directory)
- if (len < 1)
- break;
-
- int start = 0;
- // clean up any preceding white space if we're at the beginning of line
- if (!line.length()) {
- for (;start < len; start++) {
- if ((chunk[start] != 13) && (chunk[start] != ' ') && (chunk[start] != '\t'))
- break;
- }
- }
-
- // find the end
- int end;
- for (end = start; ((end < (len-1)) && (chunk[end] != 10)); end++);
-
- if ((chunk[end] != 10) && (len == 254)) {
- more = true;
- }
- index += (end + 1);
-
- // reposition to next valid place to read
- fDesc->seek(index, SEEK_SET);
-
- // clean up any trailing junk on line if we're at the end
- if (!more) {
- for (; end > start; end--) {
- if ((chunk[end] != 10) && (chunk[end] != 13) && (chunk[end] != ' ') && (chunk[end] != '\t')) {
- if (chunk[end] == '\\') {
- more = true;
- end--;
- }
- break;
- }
- }
- }
-
- int size = (end - start) + 1;
-
- if (size > 0) {
- // line.appendFormatted("%.*s", size, chunk+start);
- line.append(chunk+start, size);
- }
- }
- return ((len > 0) || line.length());
-}
-
-
-char FileMgr::isDirectory(const char *path) {
- struct stat stats;
- if (stat(path, &stats))
- return 0;
- return ((stats.st_mode & S_IFDIR) == S_IFDIR);
-}
-
-
-int FileMgr::copyDir(const char *srcDir, const char *destDir) {
- DIR *dir;
- struct dirent *ent;
- if ((dir = opendir(srcDir))) {
- rewinddir(dir);
- while ((ent = readdir(dir))) {
- if ((strcmp(ent->d_name, ".")) && (strcmp(ent->d_name, ".."))) {
- SWBuf srcPath = (SWBuf)srcDir + (SWBuf)"/" + ent->d_name;
- SWBuf destPath = (SWBuf)destDir + (SWBuf)"/" + ent->d_name;
- if (!isDirectory(srcPath.c_str())) {
- copyFile(srcPath.c_str(), destPath.c_str());
- }
- else {
- copyDir(srcPath.c_str(), destPath.c_str());
- }
- }
- }
- closedir(dir);
- }
- return 0;
-}
-
-
-int FileMgr::removeDir(const char *targetDir) {
- DIR *dir = opendir(targetDir);
- struct dirent *ent;
- if (dir) {
- rewinddir(dir);
- while ((ent = readdir(dir))) {
- if ((strcmp(ent->d_name, ".")) && (strcmp(ent->d_name, ".."))) {
- SWBuf targetPath = (SWBuf)targetDir + (SWBuf)"/" + ent->d_name;
- if (!isDirectory(targetPath.c_str())) {
- FileMgr::removeFile(targetPath.c_str());
- }
- else {
- removeDir(targetPath.c_str());
- }
- }
- }
- closedir(dir);
- removeFile(targetDir);
- }
- return 0;
-}
-
-
-void FileMgr::flush() {
- FileDesc **loop;
-
- for (loop = &files; *loop; loop = &((*loop)->next)) {
- if ((*loop)->fd > 0) {
- (*loop)->offset = lseek((*loop)->fd, 0, SEEK_CUR);
- ::close((*loop)->fd);
- (*loop)->fd = -77;
- }
- }
-}
-
-long FileMgr::resourceConsumption() {
- long count = 0;
- FileDesc **loop;
- for (loop = &files; *loop; loop = &((*loop)->next)) {
- if ((*loop)->fd > 0) {
- count++;
- }
- }
- return count;
-}
-
-
-SWORD_NAMESPACE_END
diff --git a/cmake/platforms/windows/rawfiles.cpp b/cmake/platforms/windows/rawfiles.cpp
new file mode 100644
index 0000000..3901c22
--- /dev/null
+++ b/cmake/platforms/windows/rawfiles.cpp
@@ -0,0 +1,230 @@
+/******************************************************************************
+ * rawfiles.cpp - code for class 'RawFiles'- a module that produces HTML HREFs
+ * pointing to actual text desired. Uses standard
+ * files: ot and nt using indexs ??.bks ??.cps ??.vss
+ *
+ *
+ * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#include <ctype.h>
+#include <stdio.h>
+#include <fcntl.h>
+
+#include <rawverse.h>
+#include <rawfiles.h>
+#include <filemgr.h>
+#include <versekey.h>
+#include <sysdata.h>
+
+SWORD_NAMESPACE_START
+
+ /******************************************************************************
+ * RawFiles Constructor - Initializes data for instance of RawFiles
+ *
+ * ENT: iname - Internal name for module
+ * idesc - Name to display to user for module
+ * idisp - Display object to use for displaying
+ */
+
+RawFiles::RawFiles(const char *ipath, const char *iname, const char *idesc, SWDisplay *idisp, SWTextEncoding enc, SWTextDirection dir, SWTextMarkup mark, const char* ilang) : RawVerse(ipath, FileMgr::RDWR), SWCom(iname, idesc, idisp, enc, dir, mark, ilang)
+{
+}
+
+
+/******************************************************************************
+ * RawFiles Destructor - Cleans up instance of RawFiles
+ */
+
+RawFiles::~RawFiles()
+{
+}
+
+
+/** Is the module writable? :)
+* @return yes or no
+*/
+bool RawFiles::isWritable() {
+ return ((idxfp[0]->getFd() > 0) && ((idxfp[0]->mode & FileMgr::RDWR) == FileMgr::RDWR));
+}
+
+
+/******************************************************************************
+ * RawFiles::getRawEntry - Retrieve the unprocessed entry contents at
+ * the current key position of this module
+ *
+ * RET: entry contents
+ */
+
+SWBuf &RawFiles::getRawEntryBuf() {
+ FileDesc *datafile;
+ long start = 0;
+ unsigned short size = 0;
+ VerseKey *key = &getVerseKey();
+
+ findOffset(key->Testament(), key->TestamentIndex(), &start, &size);
+
+ entryBuf = "";
+ if (size) {
+ SWBuf tmpbuf = path;
+ tmpbuf += '/';
+ readText(key->Testament(), start, size, entryBuf);
+ tmpbuf += entryBuf;
+ entryBuf = "";
+ datafile = FileMgr::getSystemFileMgr()->open(tmpbuf.c_str(), FileMgr::RDONLY);
+ if (datafile->getFd() > 0) {
+ size = datafile->seek(0, SEEK_END);
+ char *tmpBuf = new char [ size + 1 ];
+ memset(tmpBuf, 0, size + 1);
+ datafile->seek(0, SEEK_SET);
+ datafile->read(tmpBuf, size);
+ entryBuf = tmpBuf;
+ delete [] tmpBuf;
+// preptext(entrybuf);
+ }
+ FileMgr::getSystemFileMgr()->close(datafile);
+ }
+ return entryBuf;
+}
+
+
+/******************************************************************************
+ * RawFiles::setEntry(char *)- Update the module's current key entry with
+ * provided text
+ */
+
+void RawFiles::setEntry(const char *inbuf, long len) {
+ FileDesc *datafile;
+ long start;
+ unsigned short size;
+ VerseKey *key = &getVerseKey();
+
+ len = (len<0)?strlen(inbuf):len;
+
+ findOffset(key->Testament(), key->TestamentIndex(), &start, &size);
+
+ if (size) {
+ SWBuf tmpbuf;
+ entryBuf = path;
+ entryBuf += '/';
+ readText(key->Testament(), start, size, tmpbuf);
+ entryBuf += tmpbuf;
+ }
+ else {
+ SWBuf tmpbuf;
+ entryBuf = path;
+ entryBuf += '/';
+ tmpbuf = getNextFilename();
+ doSetText(key->Testament(), key->TestamentIndex(), tmpbuf);
+ entryBuf += tmpbuf;
+ }
+ datafile = FileMgr::getSystemFileMgr()->open(entryBuf, FileMgr::CREAT|FileMgr::WRONLY|FileMgr::TRUNC);
+ if (datafile->getFd() > 0) {
+ datafile->write(inbuf, len);
+ }
+ FileMgr::getSystemFileMgr()->close(datafile);
+}
+
+
+/******************************************************************************
+ * RawFiles::linkEntry(SWKey *)- Link the modules current key entry with
+ * another module entry
+ *
+ * RET: *this
+ */
+
+void RawFiles::linkEntry(const SWKey *inkey) {
+
+ long start;
+ unsigned short size;
+ const VerseKey *key = &getVerseKey();
+
+ findOffset(key->Testament(), key->TestamentIndex(), &start, &size);
+
+ if (size) {
+ SWBuf tmpbuf;
+ readText(key->Testament(), start, size + 2, tmpbuf);
+
+ key = &getVerseKey(inkey);
+ doSetText(key->Testament(), key->TestamentIndex(), tmpbuf.c_str());
+ }
+}
+
+
+/******************************************************************************
+ * RawFiles::deleteEntry - deletes this entry
+ *
+ * RET: *this
+ */
+
+void RawFiles::deleteEntry() {
+ VerseKey *key = &getVerseKey();
+ doSetText(key->Testament(), key->TestamentIndex(), "");
+}
+
+
+/******************************************************************************
+ * RawFiles::getNextfilename - generates a valid filename in which to store
+ * an entry
+ *
+ * RET: filename
+ */
+
+const char *RawFiles::getNextFilename() {
+ static SWBuf incfile;
+ __u32 number = 0;
+ FileDesc *datafile;
+
+ incfile.setFormatted("%s/incfile", path);
+ datafile = FileMgr::getSystemFileMgr()->open(incfile, FileMgr::RDONLY);
+ if (datafile->getFd() != -1) {
+ if (datafile->read(&number, 4) != 4) number = 0;
+ number = swordtoarch32(number);
+ }
+ number++;
+ FileMgr::getSystemFileMgr()->close(datafile);
+
+ datafile = FileMgr::getSystemFileMgr()->open(incfile, FileMgr::CREAT|FileMgr::WRONLY|FileMgr::TRUNC);
+ incfile.setFormatted("%.7d", number-1);
+
+ number = archtosword32(number);
+ datafile->write(&number, 4);
+
+ FileMgr::getSystemFileMgr()->close(datafile);
+ return incfile;
+}
+
+
+char RawFiles::createModule(const char *path) {
+ char *incfile = new char [ strlen (path) + 16 ];
+
+ __u32 zero = 0;
+ zero = archtosword32(zero);
+
+ FileDesc *datafile;
+
+ sprintf(incfile, "%s/incfile", path);
+ datafile = FileMgr::getSystemFileMgr()->open(incfile, FileMgr::CREAT|FileMgr::WRONLY|FileMgr::TRUNC);
+ delete [] incfile;
+ datafile->write(&zero, 4);
+ FileMgr::getSystemFileMgr()->close(datafile);
+
+ return RawVerse::createModule (path);
+}
+
+
+
+SWORD_NAMESPACE_END
diff --git a/cmake/platforms/windows/rawfiles.h b/cmake/platforms/windows/rawfiles.h
new file mode 100644
index 0000000..014f40d
--- /dev/null
+++ b/cmake/platforms/windows/rawfiles.h
@@ -0,0 +1,86 @@
+/******************************************************************************
+ * rawfiles.h - code for class 'RawFiles'- a module that produces HTML HREFs
+ * pointing to actual text desired. Uses standard
+ * files: ot and nt using indexs ??.bks ??.cps ??.vss
+ *
+ * $Id: rawfiles.h 2599 2011-02-12 05:11:09Z scribe $
+ *
+ * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
+ * CrossWire Bible Society
+ * P. O. Box 2528
+ * Tempe, AZ 85280-2528
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ */
+
+#ifndef RAWFILES_H
+#define RAWFILES_H
+
+#include <rawverse.h>
+#include <swcom.h>
+
+#include <defs.h>
+
+SWORD_NAMESPACE_START
+
+class SWDLLEXPORT RawFiles : public RawVerse, public SWCom {
+
+ const char *getNextFilename();
+
+public:
+
+
+ RawFiles(const char *ipath, const char *iname = 0, const char *idesc = 0,
+ SWDisplay *idisp = 0, SWTextEncoding encoding = ENC_UNKNOWN,
+ SWTextDirection dir = DIRECTION_LTR, SWTextMarkup markup = FMT_UNKNOWN,
+ const char *ilang = 0);
+ virtual ~RawFiles();
+ virtual SWBuf &getRawEntryBuf();
+
+ // write interface ----------------------------
+ /** Is the module writable? :)
+ * @return yes or no
+ */
+ virtual bool isWritable();
+
+ /** Creates a new module
+ * @param path The first parameter is path of the new module
+ * @return error
+ */
+ static char createModule(const char *);
+
+ /** Modify the current module entry text
+ * - only if module @ref isWritable
+ * @return *this
+ */
+ virtual void setEntry(const char *inbuf, long len = -1); // Modify current module entry
+
+ /** Link the current module entry to another module entry
+ * - only if module @ref isWritable
+ * @return *this
+ */
+ virtual void linkEntry(const SWKey *linkKey); // Link current module entry to other module entry
+
+ /** Delete current module entry - only if module @ref isWritable
+ *
+ */
+ virtual void deleteEntry();
+ // end write interface ------------------------
+
+
+ // OPERATORS -----------------------------------------------------------------
+
+ SWMODULE_OPERATORS
+
+};
+
+SWORD_NAMESPACE_END
+#endif