summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Application.cpp35
-rw-r--r--Application.h1
-rw-r--r--COMPILE.cmd3
-rw-r--r--Changelog.txt15
-rw-r--r--FreeFileSync.cbp7
-rw-r--r--FreeFileSync.cpp540
-rw-r--r--FreeFileSync.h49
-rw-r--r--License.txt674
-rw-r--r--Readme.txt4
-rw-r--r--Resources.datbin84369 -> 107386 bytes
-rw-r--r--language.dat52
-rw-r--r--library/CustomGrid.cpp2
-rw-r--r--library/GMP/include/gmp.h2187
-rw-r--r--library/GMP/include/gmpxx.h3389
-rw-r--r--library/GMP/lib/libgmp.abin393164 -> 0 bytes
-rw-r--r--library/GMP/lib/libgmp.la35
-rw-r--r--library/GMP/lib/libgmpxx.abin24784 -> 0 bytes
-rw-r--r--library/GMP/lib/libgmpxx.la35
-rw-r--r--library/globalFunctions.cpp33
-rw-r--r--library/globalFunctions.h9
-rw-r--r--library/md5.c650
-rw-r--r--library/md5.h218
-rw-r--r--library/multithreading.cpp4
-rw-r--r--library/multithreading.h14
-rw-r--r--mingwm10.dllbin15964 -> 23464 bytes
-rw-r--r--ui/MainDialog.cpp491
-rw-r--r--ui/MainDialog.h27
-rw-r--r--ui/Resources.cpp23
-rw-r--r--ui/Resources.h10
-rw-r--r--ui/SmallDialogs.cpp229
-rw-r--r--ui/SmallDialogs.h69
-rw-r--r--ui/SyncDialog.cpp2
-rw-r--r--ui/guiGenerated.cpp153
-rw-r--r--ui/guiGenerated.h32
34 files changed, 1808 insertions, 7184 deletions
diff --git a/Application.cpp b/Application.cpp
index 3c6465f1..c53953ff 100644
--- a/Application.cpp
+++ b/Application.cpp
@@ -11,9 +11,6 @@
#include "ui/mainDialog.h"
#include <wx/stdpaths.h>
#include <wx/filename.h>
-#include <stdexcept> //for std::runtime_error
-#include <wx/wfstream.h>
-#include <wx/zipstrm.h>
#include "library/globalFunctions.h"
IMPLEMENT_APP(Application);
@@ -337,14 +334,14 @@ void Application::parseCommandline()
//until here all options and parameters are consistent
//--------------------------------------------------------------------
- CompareVariant cmpVar = compareByMD5; //dummy value to suppress compiler warning
+ CompareVariant cmpVar = compareByContent; //dummy value to suppress compiler warning
SyncConfiguration syncConfiguration;
FileCompareResult currentGridData;
if (cmp == "SIZEDATE")
cmpVar = compareByTimeAndSize;
else if (cmp == "CONTENT")
- cmpVar = compareByMD5;
+ cmpVar = compareByContent;
else
assert (false);
@@ -439,11 +436,6 @@ CommandLineStatusUpdater::~CommandLineStatusUpdater()
{
if (!silentMode)
{
- if (abortionRequested)
- syncStatusFrame->processHasFinished(_("Aborted!")); //enable okay and close events
- else
- syncStatusFrame->processHasFinished(_("Completed"));
-
//print the results list
unsigned int failedItems = unhandledErrors.GetCount();
wxString errorMessages;
@@ -455,7 +447,14 @@ CommandLineStatusUpdater::~CommandLineStatusUpdater()
syncStatusFrame->setStatusText_NoUpdate(errorMessages);
}
- syncStatusFrame->updateStatusDialogNow();
+
+ //notify to syncStatusFrame that current process has ended
+ if (abortionRequested)
+ syncStatusFrame->processHasFinished(statusAborted); //enable okay and close events
+ else if (failedItems)
+ syncStatusFrame->processHasFinished(statusCompletedWithErrors);
+ else
+ syncStatusFrame->processHasFinished(statusCompletedWithSuccess);
}
}
@@ -474,18 +473,18 @@ void CommandLineStatusUpdater::initNewProcess(int objectsTotal, double dataTotal
if (!silentMode)
{
if (currentProcess == FreeFileSync::scanningFilesProcess)
- syncStatusFrame->m_staticTextStatus->SetLabel(_("Scanning..."));
+ syncStatusFrame->setCurrentStatus(statusScanning);
- else if (currentProcess == FreeFileSync::calcMD5Process)
+ else if (currentProcess == FreeFileSync::compareFileContentProcess)
{
syncStatusFrame->resetGauge(objectsTotal, dataTotal);
- syncStatusFrame->m_staticTextStatus->SetLabel(_("Comparing..."));
+ syncStatusFrame->setCurrentStatus(statusComparing);
}
else if (currentProcess == FreeFileSync::synchronizeFilesProcess)
{
syncStatusFrame->resetGauge(objectsTotal, dataTotal);
- syncStatusFrame->m_staticTextStatus->SetLabel(_("Synchronizing..."));
+ syncStatusFrame->setCurrentStatus(statusSynchronizing);
}
else assert(false);
}
@@ -499,7 +498,7 @@ void CommandLineStatusUpdater::updateProcessedData(int objectsProcessed, double
{
if (currentProcess == FreeFileSync::scanningFilesProcess)
syncStatusFrame->m_gauge1->Pulse();
- else if (currentProcess == FreeFileSync::calcMD5Process)
+ else if (currentProcess == FreeFileSync::compareFileContentProcess)
syncStatusFrame->incProgressIndicator_NoUpdate(objectsProcessed, dataProcessed);
else if (currentProcess == FreeFileSync::synchronizeFilesProcess)
syncStatusFrame->incProgressIndicator_NoUpdate(objectsProcessed, dataProcessed);
@@ -531,6 +530,8 @@ int CommandLineStatusUpdater::reportError(const wxString& text)
return StatusUpdater::continueNext;
}
+ syncStatusFrame->updateStatusDialogNow();
+
wxString errorMessage = text + _("\n\nContinue with next object, retry or abort synchronization?");
ErrorDlg* errorDlg = new ErrorDlg(errorMessage, skipErrors);
@@ -624,7 +625,7 @@ CustomLocale::CustomLocale(int language, int flags)
currentLine.translation = exchangeEscapeChars(temp);
translationDB.insert(currentLine);
}
- rowNumber++;
+ ++rowNumber;
}
langFile.close();
}
diff --git a/Application.h b/Application.h
index 8c9283ed..f13dbe90 100644
--- a/Application.h
+++ b/Application.h
@@ -35,7 +35,6 @@ struct TranslationLine
return (original == b.original);
}
};
-
typedef set<TranslationLine> Translation;
diff --git a/COMPILE.cmd b/COMPILE.cmd
index e34c2dce..39a43c30 100644
--- a/COMPILE.cmd
+++ b/COMPILE.cmd
@@ -16,7 +16,6 @@ mingw32-g++.exe -Wall -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DFFS_WIN -O2 -
mingw32-g++.exe -Wall -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DFFS_WIN -O2 -DNDEBUG -I%widgets%\include -I%widgets%\contrib\include -I%widgets%\lib\gcc_lib\msw -c %sources%\library\customGrid.cpp -o obj\Release\library\CustomGrid.o
mingw32-g++.exe -Wall -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DFFS_WIN -O2 -DNDEBUG -I%widgets%\include -I%widgets%\contrib\include -I%widgets%\lib\gcc_lib\msw -c %sources%\ui\resources.cpp -o obj\Release\ui\Resources.o
mingw32-g++.exe -Wall -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DFFS_WIN -O2 -DNDEBUG -I%widgets%\include -I%widgets%\contrib\include -I%widgets%\lib\gcc_lib\msw -c %sources%\ui\smallDialogs.cpp -o obj\Release\ui\SmallDialogs.o
-mingw32-gcc.exe -Wall -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DFFS_WIN -O2 -DNDEBUG -I%widgets%\wxWidgets\include -I%widgets%\contrib\include -I%widgets%\lib\gcc_lib\msw -c %sources%\library\md5.c -o obj\Release\library\md5.o
windres.exe -i %sources%\resource.rc -J rc -o obj\Release\resource.res -O coff -I%widgets%\include -I%widgets%\lib\gcc_lib\msw
-mingw32-g++.exe -L%widgets%\lib\gcc_lib -o FreeFileSync.exe obj\Release\Application.o obj\Release\FreeFileSync.o obj\Release\library\globalFunctions.o obj\Release\library\multithreading.cpp.o obj\Release\library\md5.o obj\Release\ui\GUI_Generated.o obj\Release\ui\MainDialog.o obj\Release\ui\SyncDialog.o obj\Release\library\CustomGrid.o obj\Release\ui\Resources.o obj\Release\ui\SmallDialogs.o obj\Release\resource.res -s -mthreads -lwxmsw28_adv -lwxmsw28_core -lwxbase28 -lwxpng -lwxzlib -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lcomctl32 -lwsock32 -lodbc32 library\gmp\lib\libgmpxx.a library\gmp\lib\libgmp.a -mwindows
+mingw32-g++.exe -L%widgets%\lib\gcc_lib -o FreeFileSync.exe obj\Release\Application.o obj\Release\FreeFileSync.o obj\Release\library\globalFunctions.o obj\Release\library\multithreading.cpp.o obj\Release\ui\GUI_Generated.o obj\Release\ui\MainDialog.o obj\Release\ui\SyncDialog.o obj\Release\library\CustomGrid.o obj\Release\ui\Resources.o obj\Release\ui\SmallDialogs.o obj\Release\resource.res -s -mthreads -lwxmsw28_adv -lwxmsw28_core -lwxbase28 -lwxpng -lwxzlib -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lcomctl32 -lwsock32 -lodbc32 -mwindows
pause \ No newline at end of file
diff --git a/Changelog.txt b/Changelog.txt
index ff9821aa..1d714890 100644
--- a/Changelog.txt
+++ b/Changelog.txt
@@ -1,6 +1,17 @@
FreeFileSync
------------
+Changelog v1.5
+--------------
+Improved speed of comparison by file content
+Simplified and optimized calculation of accumulated filesizes
+Added right-click context menu to main dialog
+New installer for Windows
+Improved usability of filtering and selecting rows
+Solved possible issue with different file time precisions in multi-OS environments
+Updated German translation
+
+
Changelog v1.4
--------------
Implemented generic multithreading class to keep "compare by content" and "file synchronisation" responsive
@@ -12,6 +23,7 @@ The result grid after synchronization now always consists of items that have not
Added "remaining files" as sync-progress information
Updated German translation
+
Changelog v1.3
--------------
Maintain and load different configurations by drag&drop, load-button or commandline
@@ -26,6 +38,7 @@ Main window will remember restored position even if maximized
Updated sources to become more Linux and Unicode friendly
Updated German translation
+
Changelog v1.2
--------------
New progress indicator and status information when synchronizing:
@@ -45,6 +58,7 @@ New synchronization sequence: first delete files, then copy files to avoid disc
Added different return values when used in commandline mode to report success or failure
Updated German translation
+
Changelog v1.1
--------------
Some further speed optimizations (sorting)
@@ -58,6 +72,7 @@ Added indicator for sort direction
Simplified code concerning loading of UI resources
Prepared code to support unicode in some future version
+
Changelog v1.0
--------------
Initial release \ No newline at end of file
diff --git a/FreeFileSync.cbp b/FreeFileSync.cbp
index c8d9be57..0d45c186 100644
--- a/FreeFileSync.cbp
+++ b/FreeFileSync.cbp
@@ -83,8 +83,6 @@
<Add library="libcomctl32.a" />
<Add library="libwsock32.a" />
<Add library="libodbc32.a" />
- <Add library="library\gmp\lib\libgmpxx.a" />
- <Add library="library\gmp\lib\libgmp.a" />
</Linker>
<Unit filename="FreeFileSync.cpp" />
<Unit filename="FreeFileSync.h" />
@@ -95,11 +93,6 @@
<Unit filename="library\customGrid.h" />
<Unit filename="library\globalFunctions.cpp" />
<Unit filename="library\globalFunctions.h" />
- <Unit filename="library\gmp\include\gmp.h" />
- <Unit filename="library\md5.c">
- <Option compilerVar="CC" />
- </Unit>
- <Unit filename="library\md5.h" />
<Unit filename="library\multithreading.cpp" />
<Unit filename="library\multithreading.h" />
<Unit filename="library\wxWidgets.h" />
diff --git a/FreeFileSync.cpp b/FreeFileSync.cpp
index 09e8efb8..af0da109 100644
--- a/FreeFileSync.cpp
+++ b/FreeFileSync.cpp
@@ -2,13 +2,15 @@
#include <wx/dir.h>
#include <wx/msgdlg.h>
#include "FreeFileSync.h"
-#include "library\md5.h"
-#include <stdexcept> //for std::runtime_error
#include "library/globalFunctions.h"
-#include "library/gmp/include\gmp.h"
#include <wx/filename.h>
#include <fstream>
-#include "ui\resources.h"
+#include "ui/resources.h"
+#include <sys/stat.h>
+
+#ifdef FFS_WIN
+#include <windows.h>
+#endif // FFS_WIN
using namespace globalFunctions;
@@ -40,38 +42,9 @@ wxString formatTime(unsigned int number)
}
-bool filetimeCmpEqual(const FILETIME a,const FILETIME b)
-{
- if (a.dwHighDateTime == b.dwHighDateTime && a.dwLowDateTime == b.dwLowDateTime)
- return (true);
- else
- return (false);
-}
-
void FreeFileSync::getFileInformation(FileInfo& output, const wxString& filename)
{
-//
-// wxFileName file(filename);
-//
-// wxDateTime lastWriteTime;
-// wxULongLong filesize;
-//
-//
-//
-// if (file.FileExists())
-// {
-// if (!file.GetTimes(NULL, &lastWriteTime, NULL) || ((filesize = file.GetSize()) == wxInvalidSize))
-// throw FileError(wxString(_("Could not retrieve file info for: ")) + "\"" + filename + "\"");
-// output.lastWriteTime = lastWriteTime.FormatISODate();
-//
-// output.lastWriteTimeUTC.dwHighDateTime = 0;
-// output.lastWriteTimeUTC.dwLowDateTime = 0;
-// }
-//
-// output.fileSize = filesize.ToString();
-//
-
-
+#ifdef FFS_WIN
WIN32_FIND_DATA winFileInfo;
FILETIME localFileTime;
SYSTEMTIME time;
@@ -83,15 +56,15 @@ void FreeFileSync::getFileInformation(FileInfo& output, const wxString& filename
FindClose(fileHandle);
if (FileTimeToLocalFileTime(
- &winFileInfo.ftLastWriteTime, // pointer to UTC file time to convert
- &localFileTime // pointer to converted file time
+ &winFileInfo.ftLastWriteTime, // pointer to UTC file time to convert
+ &localFileTime // pointer to converted file time
) == 0)
throw std::runtime_error(_("Error converting FILETIME to local FILETIME"));
if (FileTimeToSystemTime(
&localFileTime, // pointer to file time to convert
- &time // pointer to structure to receive system time
+ &time // pointer to structure to receive system time
) == 0)
throw std::runtime_error(_("Error converting FILETIME to SYSTEMTIME"));
@@ -102,40 +75,93 @@ void FreeFileSync::getFileInformation(FileInfo& output, const wxString& filename
formatTime(time.wMinute) + ":" +
formatTime(time.wSecond);
- //UTC times
- output.lastWriteTimeUTC = wxULongLong(winFileInfo.ftLastWriteTime.dwHighDateTime, winFileInfo.ftLastWriteTime.dwLowDateTime);
+ //UTC time
+ output.lastWriteTimeRaw = wxULongLong(winFileInfo.ftLastWriteTime.dwHighDateTime, winFileInfo.ftLastWriteTime.dwLowDateTime);
+
+ //reduce precision to 1 second (FILETIME has unit 10^-7 s)
+ output.lastWriteTimeRaw/= 10000000; // <- time is used for comparison only: unit switched to seconds
output.fileSize = wxULongLong(winFileInfo.nFileSizeHigh, winFileInfo.nFileSizeLow);
+
+#else
+ struct stat fileInfo;
+ if (stat (filename.c_str(), &fileInfo) != 0)
+ throw FileError(wxString(_("Could not retrieve file info for: ")) + "\"" + filename + "\"");
+
+ struct tm * timeinfo;
+ timeinfo = localtime(&fileInfo.st_mtime);
+ char buffer [50];
+ strftime (buffer,50,"%Y-%m-%d %H:%M:%S",timeinfo);
+
+ //local time
+ output.lastWriteTime = buffer;
+ //unit: 1 second
+ output.lastWriteTimeRaw = fileInfo.st_mtime;
+
+ output.fileSize = fileInfo.st_size;
+#endif
}
-string FreeFileSync::calculateMD5Hash(const wxString& filename)
+struct MemoryAllocator
{
- const unsigned int bufferSize = 8192;
+ MemoryAllocator()
+ {
+ buffer1 = new unsigned char[bufferSize];
+ buffer2 = new unsigned char[bufferSize];
+ }
- char md5_output[33];
- unsigned char signature[16];
- unsigned char buffer[bufferSize];
- md5_t state;
+ ~MemoryAllocator()
+ {
+ delete [] buffer1;
+ delete [] buffer2;
+ }
- md5_init(&state);
- FILE* inputFile = fopen( filename.c_str(), "rb");
- if (!inputFile)
- throw FileError(wxString(_("Could not open file: ")) + "\"" + filename + "\"");
- do
+ static const unsigned int bufferSize = 1024*256; //256 kb seems to be the perfect buffer size
+ unsigned char* buffer1;
+ unsigned char* buffer2;
+};
+
+
+bool filesHaveSameContent(const wxString& filename1, const wxString& filename2)
+{
+ static MemoryAllocator memory;
+
+ FILE* file1 = fopen(filename1.c_str(), "rb");
+ if (!file1)
+ throw FileError(wxString(_("Could not open file: ")) + "\"" + filename1 + "\"");
+
+ FILE* file2 = fopen(filename2.c_str(), "rb");
+ if (!file2)
{
- unsigned int length = fread(buffer, 1, bufferSize, inputFile);
- if (!ferror(inputFile)) md5_process(&state, buffer, length);
+ fclose(file1); //NEVER forget clean-up
+ throw FileError(wxString(_("Could not open file: ")) + "\"" + filename2 + "\"");
}
- while (!feof(inputFile));
- fclose(inputFile);
+ bool returnValue = true;
+ do
+ {
+ unsigned int length1 = fread(memory.buffer1, 1, memory.bufferSize, file1);
+ if (ferror(file1)) throw FileError(wxString(_("Error reading file: ")) + "\"" + filename1 + "\"");
+
+ unsigned int length2 = fread(memory.buffer2, 1, memory.bufferSize, file2);
+ if (ferror(file2)) throw FileError(wxString(_("Error reading file: ")) + "\"" + filename2 + "\"");
+
+ if (length1 != length2 || memcmp(memory.buffer1, memory.buffer2, length1) != 0)
+ {
+ returnValue = false;
+ break;
+ }
+ }
+ while (!feof(file1));
- md5_finish(&state, signature);
+ if (!feof(file2))
+ returnValue = false;
- for (int i=0;i<16;i++) sprintf(md5_output + i*2, "%02x", signature[i]);
+ fclose(file1);
+ fclose(file2);
- return md5_output;
+ return returnValue;
}
@@ -153,23 +179,24 @@ void FreeFileSync::generateFileAndFolderDescriptions(DirectoryDescrType& output,
//handle execution of a method while updating the UI
-class UpdateWhileCalculatingMD5 : public UpdateWhileExecuting
+class UpdateWhileComparing : public UpdateWhileExecuting
{
public:
- UpdateWhileCalculatingMD5() {}
- ~UpdateWhileCalculatingMD5() {}
+ UpdateWhileComparing() {}
+ ~UpdateWhileComparing() {}
- wxString file;
+ wxString file1;
+ wxString file2;
bool success;
wxString errorMessage;
- string result;
+ bool result;
private:
void longRunner() //virtual method implementation
{
try
{
- result = FreeFileSync::calculateMD5Hash(file);
+ result = filesHaveSameContent(file1, file2);
success = true;
}
catch (FileError& error)
@@ -181,30 +208,31 @@ private:
};
-string FreeFileSync::calculateMD5HashMultithreaded(const wxString& filename, StatusUpdater* updateClass)
+bool filesHaveSameContentMultithreaded(const wxString& filename1, const wxString& filename2, StatusUpdater* updateClass)
{
- static UpdateWhileCalculatingMD5 calcAndUpdate; //single instantiation: after each execution thread enters wait phase
+ static UpdateWhileComparing cmpAndUpdate; //single instantiation: thread enters wait phase after each execution
- calcAndUpdate.waitUntilReady();
+ cmpAndUpdate.waitUntilReady();
//longRunner is called from thread, but no mutex needed here, since thread is in waiting state!
- calcAndUpdate.file = filename;
+ cmpAndUpdate.file1 = filename1;
+ cmpAndUpdate.file2 = filename2;
- calcAndUpdate.execAndUpdate(updateClass);
+ cmpAndUpdate.execute(updateClass);
//no mutex needed here since longRunner is finished
- if (!calcAndUpdate.success)
- throw FileError(calcAndUpdate.errorMessage);
+ if (!cmpAndUpdate.success)
+ throw FileError(cmpAndUpdate.errorMessage);
- return calcAndUpdate.result;
+ return cmpAndUpdate.result;
}
-void calcTotalDataForMD5(int& objectsTotal, double& dataTotal, const FileCompareResult& grid, const set<int>& rowsForMD5)
+void calcTotalDataForCompare(int& objectsTotal, double& dataTotal, const FileCompareResult& grid, const set<int>& rowsToCompare)
{
dataTotal = 0;
- for (set<int>::iterator i = rowsForMD5.begin(); i != rowsForMD5.end(); ++i)
+ for (set<int>::iterator i = rowsToCompare.begin(); i != rowsToCompare.end(); ++i)
{
const FileCompareLine& gridline = grid[*i];
@@ -212,7 +240,7 @@ void calcTotalDataForMD5(int& objectsTotal, double& dataTotal, const FileCompare
dataTotal+= gridline.fileDescrRight.fileSize.ToDouble();
}
- objectsTotal = rowsForMD5.size() * 2;
+ objectsTotal = rowsToCompare.size() * 2;
}
@@ -232,15 +260,19 @@ void FreeFileSync::startCompareProcess(FileCompareResult& output, const wxString
//retrieve sets of files (with description data)
DirectoryDescrType directoryLeft;
DirectoryDescrType directoryRight;
+
+ //unsigned int startTime = GetTickCount();
generateFileAndFolderDescriptions(directoryLeft, dirLeft, statusUpdater);
generateFileAndFolderDescriptions(directoryRight, dirRight, statusUpdater);
+ //wxMessageBox(numberToWxString(unsigned(GetTickCount()) - startTime));
FileCompareLine newline;
- set<int> delayedMD5calculation; //md5 calculation happens AFTER compare in order to separate into two processe (needed by progress indicators)
+ set<int> delayedContentCompare; //compare of file content happens AFTER finding corresponding files
+ //in order to separate into two processe (needed by progress indicators)
//find files/folders that exist in left file model but not in right model
- for (DirectoryDescrType::iterator i = directoryLeft.begin(); i != directoryLeft.end(); i++)
+ for (DirectoryDescrType::iterator i = directoryLeft.begin(); i != directoryLeft.end(); ++i)
if (directoryRight.find(*i) == directoryRight.end())
{
newline.fileDescrLeft = *i;
@@ -250,7 +282,7 @@ void FreeFileSync::startCompareProcess(FileCompareResult& output, const wxString
output_tmp.push_back(newline);
}
- for (DirectoryDescrType::iterator j = directoryRight.begin(); j != directoryRight.end(); j++)
+ for (DirectoryDescrType::iterator j = directoryRight.begin(); j != directoryRight.end(); ++j)
{
DirectoryDescrType::iterator i;
@@ -290,15 +322,15 @@ void FreeFileSync::startCompareProcess(FileCompareResult& output, const wxString
}
else if (cmpVar == compareByTimeAndSize)
{ //check files that exist in left and right model but have different properties
- if (i->lastWriteTimeUTC != j->lastWriteTimeUTC ||
+ if (i->lastWriteTimeRaw != j->lastWriteTimeRaw ||
i->fileSize != j->fileSize)
{
newline.fileDescrLeft = *i;
newline.fileDescrRight = *j;
- if (i->lastWriteTimeUTC == j->lastWriteTimeUTC)
+ if (i->lastWriteTimeRaw == j->lastWriteTimeRaw)
newline.cmpResult = filesDifferent;
- else if (i->lastWriteTimeUTC < j->lastWriteTimeUTC)
+ else if (i->lastWriteTimeRaw < j->lastWriteTimeRaw)
newline.cmpResult = rightFileNewer;
else
newline.cmpResult = leftFileNewer;
@@ -312,7 +344,7 @@ void FreeFileSync::startCompareProcess(FileCompareResult& output, const wxString
output_tmp.push_back(newline);
}
}
- else if (cmpVar == compareByMD5)
+ else if (cmpVar == compareByContent)
{ //check files that exist in left and right model but have different content
//check filesize first!
@@ -323,8 +355,8 @@ void FreeFileSync::startCompareProcess(FileCompareResult& output, const wxString
//newline.cmpResult = ...; //not yet determined
output_tmp.push_back(newline);
- //md5 needed only if filesizes are the same
- delayedMD5calculation.insert(output_tmp.size() - 1); //save index of row, to calculate cmpResult later
+ //compare by content is only needed if filesizes are the same
+ delayedContentCompare.insert(output_tmp.size() - 1); //save index of row, to calculate cmpResult later
}
else
{
@@ -339,25 +371,27 @@ void FreeFileSync::startCompareProcess(FileCompareResult& output, const wxString
}
//################################################################################################################################################
- //calculate MD5 checksums and set value "cmpResult"
- if (cmpVar == compareByMD5)
+
+ //compare file contents and set value "cmpResult"
+
+ //unsigned int startTime3 = GetTickCount();
+ if (cmpVar == compareByContent)
{
int objectsTotal = 0;
double dataTotal = 0;
- calcTotalDataForMD5(objectsTotal, dataTotal, output_tmp, delayedMD5calculation);
+ calcTotalDataForCompare(objectsTotal, dataTotal, output_tmp, delayedContentCompare);
- statusUpdater->initNewProcess(objectsTotal, dataTotal, FreeFileSync::calcMD5Process);
+ statusUpdater->initNewProcess(objectsTotal, dataTotal, FreeFileSync::compareFileContentProcess);
set<int> rowsToDelete; //if errors occur during file access and user skips, these rows need to be deleted from result
- for (set<int>::iterator i = delayedMD5calculation.begin(); i != delayedMD5calculation.end(); ++i)
+ for (set<int>::iterator i = delayedContentCompare.begin(); i != delayedContentCompare.end(); ++i)
{
FileCompareLine& gridline = output_tmp[*i];
- //check files that exist in left and right model but have different checksums
- string leftFileHash;
- string rightFileHash;
+ statusUpdater->updateStatusText(wxString(_("Comparing content of files ")) + "\"" + gridline.fileDescrLeft.relFilename + "\"");
+ //check files that exist in left and right model but have different content
while (true)
{
//trigger display refresh
@@ -365,25 +399,12 @@ void FreeFileSync::startCompareProcess(FileCompareResult& output, const wxString
try
{
- if (leftFileHash.empty())
- {
- statusUpdater->updateStatusText(wxString(_("Reading content of ") + gridline.fileDescrLeft.filename));
- leftFileHash = calculateMD5HashMultithreaded(gridline.fileDescrLeft.filename, statusUpdater);
- statusUpdater->updateProcessedData(1, gridline.fileDescrLeft.fileSize.ToDouble());
- }
-
- if (rightFileHash.empty())
- {
- statusUpdater->updateStatusText(wxString(_("Reading content of ") + gridline.fileDescrRight.filename));
- rightFileHash = calculateMD5HashMultithreaded(gridline.fileDescrRight.filename, statusUpdater);
- statusUpdater->updateProcessedData(1, gridline.fileDescrRight.fileSize.ToDouble());
- }
-
- if (leftFileHash == rightFileHash)
+ if (filesHaveSameContentMultithreaded(gridline.fileDescrLeft.filename, gridline.fileDescrRight.filename, statusUpdater))
gridline.cmpResult = filesEqual;
else
gridline.cmpResult = filesDifferent;
+ statusUpdater->updateProcessedData(2, (gridline.fileDescrLeft.fileSize + gridline.fileDescrRight.fileSize).ToDouble());
break;
}
catch (FileError& error)
@@ -407,6 +428,7 @@ void FreeFileSync::startCompareProcess(FileCompareResult& output, const wxString
if (rowsToDelete.size() > 0)
removeRowsFromVector(output_tmp, rowsToDelete);
}
+ //wxMessageBox(numberToWxString(unsigned(GetTickCount()) - startTime3));
statusUpdater->triggerUI_Refresh();
}
@@ -479,13 +501,13 @@ wxDirTraverseResult GetAllFilesFull::OnFile(const wxString& filename)
}
fileDescr.lastWriteTime = currentFileInfo.lastWriteTime;
- fileDescr.lastWriteTimeUTC = currentFileInfo.lastWriteTimeUTC;
+ fileDescr.lastWriteTimeRaw = currentFileInfo.lastWriteTimeRaw;
fileDescr.fileSize = currentFileInfo.fileSize;
fileDescr.objType = isFile;
m_output.insert(fileDescr);
//update UI/commandline status information
- statusUpdater->updateStatusText(wxString(_("Scanning ")) + filename); // NO performance issue at all
+ statusUpdater->updateStatusText(wxString(_("Scanning ")) + "\"" + filename + "\""); // NO performance issue at all
//add 1 element to the progress indicator
statusUpdater->updateProcessedData(1, 0); // NO performance issue at all
//trigger display refresh
@@ -497,9 +519,8 @@ wxDirTraverseResult GetAllFilesFull::OnFile(const wxString& filename)
wxDirTraverseResult GetAllFilesFull::OnDir(const wxString& dirname)
{
- if (dirname.EndsWith("\\RECYCLER"))
- return wxDIR_IGNORE;
- if (dirname.EndsWith("\\System Volume Information"))
+ if (dirname.EndsWith("\\RECYCLER") ||
+ dirname.EndsWith("\\System Volume Information"))
return wxDIR_IGNORE;
fileDescr.filename = dirname;
@@ -525,13 +546,13 @@ wxDirTraverseResult GetAllFilesFull::OnDir(const wxString& dirname)
}
}
fileDescr.lastWriteTime = currentFileInfo.lastWriteTime;
- fileDescr.lastWriteTimeUTC = currentFileInfo.lastWriteTimeUTC;
+ fileDescr.lastWriteTimeRaw = currentFileInfo.lastWriteTimeRaw;
fileDescr.fileSize = wxULongLong(0); //currentFileInfo.fileSize should be "0" as well, but just to be sure... currently used by getBytesToTransfer
fileDescr.objType = isDirectory;
m_output.insert(fileDescr);
//update UI/commandline status information
- statusUpdater->updateStatusText(wxString(_("Scanning ")) + dirname); // NO performance issue at all
+ statusUpdater->updateStatusText(wxString(_("Scanning ")) + "\"" + dirname + "\""); // NO performance issue at all
//add 1 element to the progress indicator
statusUpdater->updateProcessedData(1, 0); // NO performance issue at all
//trigger display refresh
@@ -583,25 +604,82 @@ private:
};
-void FreeFileSync::moveToRecycleBin(const wxString& filename)
+#ifdef FFS_WIN
+typedef WINSHELLAPI int (*DllFileOP)(LPSHFILEOPSTRUCT lpFileOp);
+#endif // FFS_WIN
+
+
+class RecycleBin
{
- bool aborted = false;
- SHFILEOPSTRUCT fileOp;
-
- wxString filenameDoubleNull = filename + char(0);
-
- fileOp.hwnd = NULL;
- fileOp.wFunc = FO_DELETE;
- fileOp.pFrom = filenameDoubleNull.c_str();
- fileOp.pTo = NULL;
- fileOp.fFlags = FOF_ALLOWUNDO | FOF_NOCONFIRMATION | FOF_SILENT;
- fileOp.fAnyOperationsAborted = aborted;
- fileOp.hNameMappings = NULL;
- fileOp.lpszProgressTitle = NULL;
-
- if (fileOperation(&fileOp //Pointer to an SHFILEOPSTRUCT structure that contains information the function needs to carry out.
- ) != 0 || aborted) throw FileError(wxString(_("Error moving file ")) + "\"" + filename + "\"" + _(" to recycle bin!"));
-}
+public:
+ RecycleBin() :
+ recycleBinAvailable(false)
+ {
+#ifdef FFS_WIN
+ // Get a handle to the DLL module containing Recycle Bin functionality
+ hinstShell = LoadLibrary("shell32.dll");
+ if (hinstShell != NULL)
+ {
+ fileOperation = (DllFileOP)GetProcAddress(hinstShell, "SHFileOperation");
+ if (fileOperation == NULL )
+ {
+ FreeLibrary(hinstShell);
+ recycleBinAvailable = false;
+ }
+ else
+ recycleBinAvailable = true;
+ }
+#endif // FFS_WIN
+ }
+
+ ~RecycleBin()
+ {
+#ifdef FFS_WIN
+ if (recycleBinAvailable)
+ FreeLibrary(hinstShell);
+#endif // FFS_WIN
+ }
+
+ bool recycleBinExists()
+ {
+ return recycleBinAvailable;
+ }
+
+ void moveToRecycleBin(const wxString& filename)
+ {
+ if (!recycleBinAvailable) //this method should ONLY be called if recycle bin is available
+ throw std::runtime_error("Initialization of Recycle Bin failed! It cannot be used!");
+
+#ifdef FFS_WIN
+ SHFILEOPSTRUCT fileOp;
+
+ wxString filenameDoubleNull = filename + char(0);
+
+ fileOp.hwnd = NULL;
+ fileOp.wFunc = FO_DELETE;
+ fileOp.pFrom = filenameDoubleNull.c_str();
+ fileOp.pTo = NULL;
+ fileOp.fFlags = FOF_ALLOWUNDO | FOF_NOCONFIRMATION | FOF_SILENT;
+ fileOp.fAnyOperationsAborted = false;
+ fileOp.hNameMappings = NULL;
+ fileOp.lpszProgressTitle = NULL;
+
+ if (fileOperation(&fileOp //Pointer to an SHFILEOPSTRUCT structure that contains information the function needs to carry out.
+ ) != 0 || fileOp.fAnyOperationsAborted) throw FileError(wxString(_("Error moving file ")) + "\"" + filename + "\"" + _(" to recycle bin!"));
+#endif // FFS_WIN
+ }
+
+private:
+ bool recycleBinAvailable;
+
+#ifdef FFS_WIN
+ HINSTANCE hinstShell;
+ DllFileOP fileOperation;
+#endif // FFS_WIN
+};
+
+
+RecycleBin FreeFileSync::recycler;
inline
@@ -609,9 +687,9 @@ void FreeFileSync::removeFile(const wxString& filename)
{
if (!wxFileExists(filename)) return; //this is NOT an error situation: the manual deletion relies on it!
- if (recycleBinAvailable)
+ if (recycleBinShouldBeUsed)
{
- moveToRecycleBin(filename);
+ recycler.moveToRecycleBin(filename);
return;
}
@@ -631,9 +709,9 @@ void FreeFileSync::removeDirectory(const wxString& directory)
{
if (!wxDirExists(directory)) return; //this is NOT an error situation: the manual deletion relies on it!
- if (recycleBinAvailable)
+ if (recycleBinShouldBeUsed)
{
- moveToRecycleBin(directory);
+ recycler.moveToRecycleBin(directory);
return;
}
@@ -660,27 +738,6 @@ void FreeFileSync::removeDirectory(const wxString& directory)
}
-inline
-void FreeFileSync::copyfile(const wxString& source, const wxString& target)
-{
- if (!wxCopyFile(source, target, false)) //return false if file exists
- throw FileError(wxString(_("Error copying file ")) + "\"" + source + "\"" + _(" to ") + "\"" + target + "\"");
-}
-
-
-inline
-void FreeFileSync::copyOverwriting(const wxString& source, const wxString& target)
-{
- if (!SetFileAttributes(
- target.c_str(), // address of filename
- FILE_ATTRIBUTE_NORMAL // address of attributes to set
- )) throw FileError(wxString(_("Error overwriting file ")) + "\"" + target + "\"");
-
- if (!wxCopyFile(source, target, true)) //if file exists it will be overwritten
- throw FileError(wxString(_("Error copying file ")) + "\"" + source + "\"" + _(" to ") + "\"" + target + "\"");
-}
-
-
void FreeFileSync::createDirectory(const wxString& directory, int level)
{
if (wxDirExists(directory))
@@ -708,7 +765,7 @@ void FreeFileSync::createDirectory(const wxString& directory, int level)
}
}
-
+/*
void FreeFileSync::copyCreatingDirs(const wxString& source, const wxString& target)
{
wxString targetPath = wxFileName(target).GetPath();
@@ -717,7 +774,7 @@ void FreeFileSync::copyCreatingDirs(const wxString& source, const wxString& targ
if (!wxCopyFile(source, target, false)) //error if file exists
throw FileError(wxString(_("Error copying file ")) + "\"" + source + "\"" + _(" to ") + "\"" + target + "\"");
}
-
+*/
//###########################################################################################
@@ -749,7 +806,7 @@ private:
void FreeFileSync::copyfileMultithreaded(const wxString& source, const wxString& target, StatusUpdater* updateClass)
{
- static UpdateWhileCopying copyAndUpdate; //single instantiation: after each execution thread enters wait phase
+ static UpdateWhileCopying copyAndUpdate; //single instantiation: after each execution thread enters wait phase
copyAndUpdate.waitUntilReady();
@@ -757,7 +814,7 @@ void FreeFileSync::copyfileMultithreaded(const wxString& source, const wxString&
copyAndUpdate.source = source;
copyAndUpdate.target = target;
- copyAndUpdate.execAndUpdate(updateClass);
+ copyAndUpdate.execute(updateClass);
//no mutex needed here since longRunner is finished
if (!copyAndUpdate.success)
@@ -765,25 +822,9 @@ void FreeFileSync::copyfileMultithreaded(const wxString& source, const wxString&
}
-FreeFileSync::FreeFileSync()
- : recycleBinAvailable(false)
+FreeFileSync::FreeFileSync(bool useRecycleBin) :
+ recycleBinShouldBeUsed(useRecycleBin)
{
- // Get a handle to the DLL module containing Recycle Bin functionality
- hinstShell = LoadLibrary("shell32.dll");
- if (hinstShell == NULL)
- recycleBinAvailable = false;
- else
- {
- fileOperation = (DLLFUNC)GetProcAddress(hinstShell, "SHFileOperation");
- if (fileOperation == NULL )
- {
- FreeLibrary(hinstShell);
- recycleBinAvailable = false;
- }
- else
- recycleBinAvailable = true;
- }
-
//prevent wxWidgets logging
noWxLogs = new wxLogNull;
}
@@ -791,27 +832,13 @@ FreeFileSync::FreeFileSync()
FreeFileSync::~FreeFileSync()
{
- if (recycleBinAvailable)
- FreeLibrary(hinstShell);
-
delete noWxLogs;
}
bool FreeFileSync::recycleBinExists()
{
- FreeFileSync dummyObject;
- return dummyObject.recycleBinAvailable;
-}
-
-
-bool FreeFileSync::setRecycleBinUsage(bool activate)
-{ //If recycleBin is not available it mustn't be activated: This should NEVER happen!
- if (!recycleBinAvailable && activate)
- throw std::runtime_error("Initialization of Recycle Bin failed! It cannot be used!");
- else
- recycleBinAvailable = activate;
- return true;
+ return recycler.recycleBinExists();
}
@@ -847,15 +874,6 @@ SyncDirection getSyncDirection(const CompareFilesResult cmpResult, const SyncCon
}
-void FreeFileSync::wxULongLongToMpz(mpz_t& output, const wxULongLong& input)
-{
- mpz_set_ui(output, input.GetHi());
- mpz_mul_ui(output, output, 65536);
- mpz_mul_ui(output, output, 65536);
- mpz_add_ui(output, output, input.GetLo());
-}
-
-
bool getBytesToTransfer(double& result, const FileCompareLine& fileCmpLine, const SyncConfiguration& config)
{ //false if nothing has to be done
@@ -905,7 +923,7 @@ void FreeFileSync::calcTotalBytesToSync(int& objectsTotal, double& dataTotal, co
if (getBytesToTransfer(tmp, *i, config))
{
dataTotal+= tmp;
- objectsTotal++;
+ ++objectsTotal;
}
}
}
@@ -926,13 +944,13 @@ bool FreeFileSync::synchronizeFile(const FileCompareLine& filename, const SyncCo
switch (config.exLeftSideOnly)
{
case syncDirLeft: //delete files on left
- statusUpdater->updateStatusText(wxString(_("Deleting file ") + filename.fileDescrLeft.filename));
+ statusUpdater->updateStatusText(wxString(_("Deleting file ")) + "\"" + filename.fileDescrLeft.filename + "\"");
removeFile(filename.fileDescrLeft.filename);
break;
case syncDirRight: //copy files to right
- target = filename.fileDescrRight.directory + filename.fileDescrLeft.relFilename.c_str();
- statusUpdater->updateStatusText(wxString(_("Copying file ")) + filename.fileDescrLeft.filename +
- _(" to ") + target);
+ target = filename.fileDescrRight.directory + filename.fileDescrLeft.relFilename;
+ statusUpdater->updateStatusText(wxString(_("Copying file ")) + "\"" + filename.fileDescrLeft.filename + "\"" +
+ _(" to ") + "\"" + target + "\"");
copyfileMultithreaded(filename.fileDescrLeft.filename, target, statusUpdater);
break;
@@ -948,13 +966,13 @@ bool FreeFileSync::synchronizeFile(const FileCompareLine& filename, const SyncCo
{
case syncDirLeft: //copy files to left
target = filename.fileDescrLeft.directory + filename.fileDescrRight.relFilename;
- statusUpdater->updateStatusText(wxString(_("Copying file ")) + filename.fileDescrRight.filename +
- _(" to ") + target);
+ statusUpdater->updateStatusText(wxString(_("Copying file ")) + "\"" + filename.fileDescrRight.filename + "\"" +
+ _(" to ") + "\"" + target + "\"");
copyfileMultithreaded(filename.fileDescrRight.filename, target, statusUpdater);
break;
case syncDirRight: //delete files on right
- statusUpdater->updateStatusText(wxString(_("Deleting file ") + filename.fileDescrRight.filename));
+ statusUpdater->updateStatusText(wxString(_("Deleting file ")) + "\"" + filename.fileDescrRight.filename + "\"");
removeFile(filename.fileDescrRight.filename);
break;
case syncDirNone:
@@ -970,15 +988,15 @@ bool FreeFileSync::synchronizeFile(const FileCompareLine& filename, const SyncCo
switch (getSyncDirection(filename.cmpResult, config))
{
case syncDirLeft: //copy from right to left
- statusUpdater->updateStatusText(wxString(_("Copying file ")) + filename.fileDescrRight.filename +
- _(" overwriting ") + filename.fileDescrLeft.filename);
+ statusUpdater->updateStatusText(wxString(_("Copying file ")) + "\"" + filename.fileDescrRight.filename + "\"" +
+ _(" overwriting ") + "\"" + filename.fileDescrLeft.filename + "\"");
removeFile(filename.fileDescrLeft.filename); //only used if switch activated by user, else file is simply deleted
copyfileMultithreaded(filename.fileDescrRight.filename, filename.fileDescrLeft.filename, statusUpdater);
break;
case syncDirRight: //copy from left to right
- statusUpdater->updateStatusText(wxString(_("Copying file ")) + filename.fileDescrLeft.filename +
- _(" overwriting ") + filename.fileDescrRight.filename);
+ statusUpdater->updateStatusText(wxString(_("Copying file ")) + "\"" + filename.fileDescrLeft.filename + "\"" +
+ _(" overwriting ") + "\"" + filename.fileDescrRight.filename + "\"");
removeFile(filename.fileDescrRight.filename); //only used if switch activated by user, else file is simply deleted
copyfileMultithreaded(filename.fileDescrLeft.filename, filename.fileDescrRight.filename, statusUpdater);
@@ -1015,12 +1033,12 @@ bool FreeFileSync::synchronizeFolder(const FileCompareLine& filename, const Sync
switch (config.exLeftSideOnly)
{
case syncDirLeft: //delete folders on left
- statusUpdater->updateStatusText(wxString(_("Deleting folder ") + filename.fileDescrLeft.filename));
+ statusUpdater->updateStatusText(wxString(_("Deleting folder ")) + "\"" + filename.fileDescrLeft.filename + "\"");
removeDirectory(filename.fileDescrLeft.filename);
break;
case syncDirRight: //create folders on right
target = filename.fileDescrRight.directory + filename.fileDescrLeft.relFilename;
- statusUpdater->updateStatusText(wxString(_("Creating folder ") + target));
+ statusUpdater->updateStatusText(wxString(_("Creating folder ")) + "\"" + target + "\"");
//some check to catch the error that directory on source has been deleted externally after the "compare"...
if (!wxDirExists(filename.fileDescrLeft.filename))
@@ -1039,15 +1057,15 @@ bool FreeFileSync::synchronizeFolder(const FileCompareLine& filename, const Sync
{
case syncDirLeft: //create folders on left
target = filename.fileDescrLeft.directory + filename.fileDescrRight.relFilename;
- statusUpdater->updateStatusText(wxString(_("Creating folder ") + target));
+ statusUpdater->updateStatusText(wxString(_("Creating folder ")) + "\"" + target + "\"");
//some check to catch the error that directory on source has been deleted externally after the "compare"...
if (!wxDirExists(filename.fileDescrRight.filename))
- throw FileError(wxString(_("Error: Source directory does not exist anymore: ")) + filename.fileDescrRight.filename);
+ throw FileError(wxString(_("Error: Source directory does not exist anymore: ")) + "\"" + filename.fileDescrRight.filename + "\"");
createDirectory(target);
break;
case syncDirRight: //delete folders on right
- statusUpdater->updateStatusText(wxString(_("Deleting folder ") + filename.fileDescrRight.filename));
+ statusUpdater->updateStatusText(wxString(_("Deleting folder ")) + "\"" + filename.fileDescrRight.filename + "\"");
removeDirectory(filename.fileDescrRight.filename);
break;
case syncDirNone:
@@ -1069,9 +1087,15 @@ bool FreeFileSync::synchronizeFolder(const FileCompareLine& filename, const Sync
}
-wxString FreeFileSync::formatFilesizeToShortString(const mpz_class& filesize)
+wxString FreeFileSync::formatFilesizeToShortString(const wxULongLong& filesize)
+{
+ return formatFilesizeToShortString(filesize.ToDouble());
+}
+
+
+wxString FreeFileSync::formatFilesizeToShortString(const double filesize)
{
- mpf_class nrOfBytes = filesize;
+ double nrOfBytes = filesize;
wxString unit = " Byte";
if (nrOfBytes > 999)
@@ -1100,37 +1124,51 @@ wxString FreeFileSync::formatFilesizeToShortString(const mpz_class& filesize)
}
}
- mp_exp_t exponent = 0;
-
wxString temp;
- if (unit == " Byte") //no decimal places in case of bytes
+ if (unit == " Byte") //no decimal places in case of bytes
{
- temp = nrOfBytes.get_str(exponent, 10, 3);
- if (!temp.Len()) //if nrOfBytes is zero GMP returns an empty string
- temp = "0";
+ double integer = 0;
+ modf(nrOfBytes, &integer); //get integer part of nrOfBytes
+ temp = numberToWxString(int(integer));
+ // if (!temp.Len()) //if nrOfBytes is zero GMP returns an empty string
+ // temp = "0";
}
else
{
- temp = wxString(nrOfBytes.get_str(exponent, 10, 3) + "000").substr(0, 3); //returns mantisse of length 3 in all cases
+ nrOfBytes*= 100; //we want up to two decimal places
+ double integer = 0;
+ modf(nrOfBytes, &integer); //get integer part of nrOfBytes
- if (exponent < 0 || exponent > 3)
- temp = _("Error");
- else
- switch (exponent)
- {
- case 0:
- temp = wxString("0") + GlobalResources::floatingPointSeparator + temp.substr(0, 2); //shorten mantisse as a 0 will be inserted
- break;
- case 1:
- case 2:
- temp.insert(exponent, GlobalResources::floatingPointSeparator);
- break;
- case 3:
- break;
- }
+ temp = numberToWxString(int(integer));
+
+ int length = temp.Len();
+
+ switch (length)
+ {
+ case 0:
+ temp = "Error";
+ break;
+ case 1:
+ temp = wxString("0") + GlobalResources::floatingPointSeparator + "0" + temp;
+ break; //0,01
+ case 2:
+ temp = wxString("0") + GlobalResources::floatingPointSeparator + temp;
+ break; //0,11
+ case 3:
+ temp.insert(1, GlobalResources::floatingPointSeparator);
+ break; //1,11
+ case 4:
+ temp = temp.substr(0, 3);
+ temp.insert(2, GlobalResources::floatingPointSeparator);
+ break; //11,1
+ case 5:
+ temp = temp.substr(0, 3);
+ break; //111
+ default:
+ return "Error";
+ }
}
- temp+= unit;
- return temp;
+ return (temp + unit);
}
@@ -1170,7 +1208,7 @@ void FreeFileSync::filterCurrentGridData(FileCompareResult& currentGridData, con
//###########################
//filter currentGridData
- for (FileCompareResult::iterator i = currentGridData.begin(); i != currentGridData.end(); i++)
+ for (FileCompareResult::iterator i = currentGridData.begin(); i != currentGridData.end(); ++i)
{
//process include filters
if (i->fileDescrLeft.objType != isNothing)
@@ -1230,7 +1268,7 @@ void FreeFileSync::filterCurrentGridData(FileCompareResult& currentGridData, con
void FreeFileSync::removeFilterOnCurrentGridData(FileCompareResult& currentGridData)
{
//remove all filters on currentGridData
- for (FileCompareResult::iterator i = currentGridData.begin(); i != currentGridData.end(); i++)
+ for (FileCompareResult::iterator i = currentGridData.begin(); i != currentGridData.end(); ++i)
i->selectedForSynchronization = true;
}
@@ -1296,10 +1334,9 @@ void FreeFileSync::startSynchronizationProcess(FileCompareResult& grid, const Sy
try
{
- FreeFileSync fileSyncObject; //currently only needed for recycle bin
- fileSyncObject.setRecycleBinUsage(useRecycleBin);
+ FreeFileSync fileSyncObject(useRecycleBin); //currently only needed for recycle bin and wxLog suppression => do NOT declare static!
- // it should never happen, that a directory on left side has same name as file on right side. GetModelDiff should take care of this
+ // it should never happen, that a directory on left side has same name as file on right side. startCompareProcess() should take care of this
// and split into two "exists on one side only" cases
// Note: this case is not handled by this tool as this is considered to be a bug and must be solved by the user
@@ -1432,8 +1469,7 @@ void FreeFileSync::addSubElements(set<int>& subElements, const FileCompareResult
void FreeFileSync::deleteOnGridAndHD(FileCompareResult& grid, const set<int>& rowsToDelete, StatusUpdater* statusUpdater, bool useRecycleBin)
{
- FreeFileSync fileSyncObject; //currently only needed for recycle bin
- fileSyncObject.setRecycleBinUsage(useRecycleBin);
+ FreeFileSync fileSyncObject(useRecycleBin); //currently only needed for recycle bin and wxLog suppression => do NOT declare static!
set<int> rowsToDeleteInGrid;
diff --git a/FreeFileSync.h b/FreeFileSync.h
index c0e4c367..3132a214 100644
--- a/FreeFileSync.h
+++ b/FreeFileSync.h
@@ -5,8 +5,6 @@
#include <set>
#include <vector>
#include <wx/dir.h>
-#include <windows.h>
-#include "library/gmp/include/gmpxx.h"
#include <wx/log.h>
#include "library/multithreading.h"
@@ -33,7 +31,7 @@ struct FileInfo
{
wxULongLong fileSize;
wxString lastWriteTime;
- wxULongLong lastWriteTimeUTC;
+ wxULongLong lastWriteTimeRaw;
};
enum ObjectType
@@ -51,7 +49,7 @@ struct FileDescrLine
wxString directory; //directory to be synced
wxString relFilename; //filename without directory that is being synchronized
wxString lastWriteTime;
- wxULongLong lastWriteTimeUTC;
+ wxULongLong lastWriteTimeRaw;
wxULongLong fileSize;
ObjectType objType; //is it a file or directory or initial?
@@ -118,7 +116,7 @@ typedef vector<FileCompareLine> FileCompareResult;
enum CompareVariant
{
- compareByMD5,
+ compareByContent,
compareByTimeAndSize
};
@@ -163,7 +161,7 @@ void removeRowsFromVector(vector<T>& grid, const set<int>& rowsToRemove)
temp.push_back(grid[i]);
else
{
- rowToSkipIndex++;
+ ++rowToSkipIndex;
if (rowToSkipIndex != rowsToRemove.end())
rowToSkip = *rowToSkipIndex;
}
@@ -171,13 +169,13 @@ void removeRowsFromVector(vector<T>& grid, const set<int>& rowsToRemove)
grid.swap(temp);
}
+class RecycleBin;
-typedef WINSHELLAPI int (*DLLFUNC)(LPSHFILEOPSTRUCT lpFileOp);
class FreeFileSync
{
public:
- FreeFileSync();
+ FreeFileSync(bool useRecycleBin);
~FreeFileSync();
friend class MainDialog;
@@ -185,9 +183,9 @@ public:
friend class CopyThread;
//identifiers of different processed
- static const int scanningFilesProcess = 1;
- static const int calcMD5Process = 2;
- static const int synchronizeFilesProcess = 3;
+ static const int scanningFilesProcess = 1;
+ static const int compareFileContentProcess = 2;
+ static const int synchronizeFilesProcess = 3;
//main function for compare
static void startCompareProcess(FileCompareResult& output, const wxString& dirLeft, const wxString& dirRight, CompareVariant cmpVar, StatusUpdater* statusUpdater);
@@ -195,8 +193,7 @@ public:
//main function for synchronization
static void startSynchronizationProcess(FileCompareResult& grid, const SyncConfiguration& config, StatusUpdater* statusUpdater, bool useRecycleBin);
- static bool recycleBinExists(); //test existence of Recycle Bin API
- bool setRecycleBinUsage(bool activate); //enables/disables Recycle Bin usage (but only if usage is possible at all): RV: Setting was successful or not
+ static bool recycleBinExists(); //test existence of Recycle Bin API on current system
static void deleteOnGridAndHD(FileCompareResult& grid, const set<int>& rowsToDelete, StatusUpdater* statusUpdater, bool useRecycleBin);
static void addSubElements(set<int>& subElements, const FileCompareResult& grid, const FileCompareLine& relevantRow);
@@ -204,46 +201,36 @@ public:
static void filterCurrentGridData(FileCompareResult& currentGridData, const wxString& includeFilter, const wxString& excludeFilter);
static void removeFilterOnCurrentGridData(FileCompareResult& currentGridData);
- static wxString formatFilesizeToShortString(const mpz_class& filesize);
+ static wxString formatFilesizeToShortString(const wxULongLong& filesize);
+ static wxString formatFilesizeToShortString(const double filesize);
static wxString getFormattedDirectoryName(const wxString& dirname);
static void calcTotalBytesToSync(int& objectsTotal, double& dataTotal, const FileCompareResult& fileCmpResult, const SyncConfiguration& config);
static void swapGrids(FileCompareResult& grid);
- static void wxULongLongToMpz(mpz_t& output, const wxULongLong& input);
-
- static string calculateMD5Hash(const wxString& filename);
- static string calculateMD5HashMultithreaded(const wxString& filename, StatusUpdater* updateClass);
-
static bool isFFS_ConfigFile(const wxString& filename);
static const wxString FFS_ConfigFileID;
static const wxString FFS_LastConfigFile;
private:
- bool synchronizeFile(const FileCompareLine& filename, const SyncConfiguration& config, StatusUpdater* statusUpdater); // false if nothing was to be done
- bool synchronizeFolder(const FileCompareLine& filename, const SyncConfiguration& config, StatusUpdater* statusUpdater); // false if nothing was to be done
+ bool synchronizeFile(const FileCompareLine& filename, const SyncConfiguration& config, StatusUpdater* statusUpdater); // false if nothing had to be done
+ bool synchronizeFolder(const FileCompareLine& filename, const SyncConfiguration& config, StatusUpdater* statusUpdater); // false if nothing had to be done
//file copy functionality -> keep instance-bound to to be able to prevent wxWidgets-logging
void removeDirectory(const wxString& directory);
void removeFile(const wxString& filename);
- void copyOverwriting(const wxString& source, const wxString& target);
- void copyfile(const wxString& source, const wxString& target);
- void copyCreatingDirs(const wxString& source, const wxString& target);
+ void copyfileMultithreaded(const wxString& source, const wxString& target, StatusUpdater* updateClass);
void createDirectory(const wxString& directory, int level = 0); //level is used internally only
- //some special file functions
- void moveToRecycleBin(const wxString& filename);
- static void copyfileMultithreaded(const wxString& source, const wxString& target, StatusUpdater* updateClass);
+ //some special file functions
static void generateFileAndFolderDescriptions(DirectoryDescrType& output, const wxString& directory, StatusUpdater* updateClass = 0);
-
static void getFileInformation(FileInfo& output, const wxString& filename);
- bool recycleBinAvailable;
+ bool recycleBinShouldBeUsed;
+ static RecycleBin recycler;
wxLogNull* noWxLogs;
- HINSTANCE hinstShell;
- DLLFUNC fileOperation;
};
diff --git a/License.txt b/License.txt
new file mode 100644
index 00000000..94a9ed02
--- /dev/null
+++ b/License.txt
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ 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, either version 3 of the License, or
+ (at your option) any later version.
+
+ 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.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
diff --git a/Readme.txt b/Readme.txt
index 2241555a..339a6555 100644
--- a/Readme.txt
+++ b/Readme.txt
@@ -1,4 +1,4 @@
-FreeFileSync v1.4
+FreeFileSync v1.5
-----------------
Usage
@@ -22,6 +22,8 @@ Features
- Maintain and load different configurations by drag&drop, load-button or commandline
- Double-click to show file in explorer.
- copy & paste support to export file-lists.
+ - right-click context menu
+ - delete superfluous/temporary files directly on main grid
- Progress indicators, status information and error reporting
- Sort file-lists by name, size or date.
- Display statistical data: total filesizes, amount of bytes that will be transfered with the current settings.
diff --git a/Resources.dat b/Resources.dat
index ecdd870b..170a8b90 100644
--- a/Resources.dat
+++ b/Resources.dat
Binary files differ
diff --git a/language.dat b/language.dat
index 55000014..1d478efb 100644
--- a/language.dat
+++ b/language.dat
@@ -34,12 +34,24 @@
&Abbruch
&Back
&Zurück
+&Cancel
+&Abbruch
+&Compare
+&Vergleichen
&Continue
&Fortfahren
&Default
&Standard
+&Filter
+&Filter
+&OK
+&OK
&Retry
&Wiederholen
+&Start
+&Start
+&Synchronize
+&Synchronisieren
(-) filtered out from sync-process\n
(-) nicht synchronisieren\n
(Build:
@@ -52,6 +64,8 @@
-----------------------------------------------------
---------\n
-----------\n
+--.--
+--.--
-Open-Source file synchronization-
-Open-Source Datei-Synchronisation-
.
@@ -80,6 +94,8 @@
>> rechte Datei ist neuer\n
Abort
Abbruch
+Aborted
+Abgebrochen
Aborted!
Abbruch!
About
@@ -110,6 +126,8 @@ Compare by
Vergleichen nach
Compare by \"File size and date\"\n----------------------------------------\nThis compare variant evaluates two equally named files as being equal when they have the same file size AND the same last write date and time. For the latter the system's UTC time (coordinated word time) is used internally, although the local file time is displayed on the result list. So there are no problems concerning different time zones or daylight saving time.\n\nWhen \"Compare\" is triggered with this option set the following decision tree is processed:\n\n -----------------\n |Decision tree|\n -----------------\n ________|___________\n | |\n file exists on both sides on one side only\n _____|______ __|___\n | | | |\nequal different left right\n _________|_____________\n | | |\n left newer right newer different (but same date)\n\nAs a result 6 different status can be returned to categorize all files:\n\n- exists left only\n- exists right only\n- left newer\n- right newer\n- different (but same date)\n- equal\n\n\nCompare by \"File content\"\n----------------------------------------\nAs the name suggests, two files which share the same name are marked as equal if and only if they have the same content. This option is useful for consistency checks rather than backup operations. Therefore the file times are not taken into account at all.\n\nWith this option enabled the decision tree is smaller:\n\n -----------------\n |Decision tree|\n -----------------\n ________|___________\n | |\n file exists on both sides on one side only\n _____|______ __|___\n | | | |\nequal different left right\n\nAs a result the files are separated into the following categories:\n\n- exists left only\n- exists right only\n- different\n- equal
Vergleichen nach \"Dateigröße und -datum\"\n---------------------------------------------------\nDiese Variante identifiziert zwei gleichnamige Dateien als gleich, wenn sie die gleiche Dateigröße haben UND der Zeitpunkt der letzten Änderung derselbe ist. Für Letzteres wird intern die UTC-Zeit (koordinierte Weltzeit) verwendet, auch wenn die lokale Zeit in der Ergebnisliste angezeigt wird. Dadurch werden Probleme vermieden, die durch verschiedene Zeitzonen oder Sommer-/Winterzeit entstehen.\n\nNachdem \"Compare\" mit dieser Einstellung gestartet wurde, wird der folgende Entscheidungsbaum abgearbeitet:\n\n -------------------------\n |Entscheidungsbaum|\n -------------------------\n __________|___________\n | |\n Datei ex. auf beiden Seiten nur auf einer Seite\n ________|____ __|___\n | | | |\n gleich verschieden links rechts\n __________|___________\n | | |\n links neuer rechts neuer verschieden (bei gleichem Datum)\n\nAls Ergebnis werden 6 verschiedene Status zurückgegeben, um Dateien zu kategorisieren:\n\n- existiert nur links\n- existiert nur rechts\n- links neuer\n- rechts neuer\n- verschieden (bei gleichem Datum)\n- gleich\n\n\nVergleichen nach \"Dateiinhalt\"\n------------------------------------\nWie der Name bereits sagt, werden zwei Dateien mit gleichem Namen genau dann als gleich angesehen, wenn sie den gleichen Dateiinhalt haben. Diese Einstellung ist eher für Konsistenzprüfungen geeignet als für Backup-Operationen. Aus diesem Grund wird der Zeitpunkt der letzten Änderung der Dateien nicht berücksichtigt.\n\nDer Entscheidungsbaum ist in diesem Fall kleiner:\n\n -------------------------\n |Entscheidungsbaum|\n -------------------------\n __________|___________\n | |\n Datei ex. auf beiden Seiten nur auf einer Seite\n ________|____ __|___\n | | | |\n gleich verschieden links rechts\n\nDas Ergebnis ist eine Aufteilung in folgende Kategorien:\n\n- existiert nur links\n- existiert nur rechts\n- verschieden\n- gleich
+Comparing content of files
+Vergleiche Inhalt der Dateien
Comparing...
Vergleiche...
Completed
@@ -138,6 +156,8 @@ Copy from right to left
Von rechts nach links kopieren
Copy from right to left overwriting
Von rechts nach links kopieren und überschreiben
+Copy to clipboard\tCTRL+C
+Kopiere in Zwischenablage\tCTRL+C
Copying file
Kopiere Datei
Could not change attributes of
@@ -180,6 +200,8 @@ Delete files existing on left side only
Lösche Dateien, die nur links existieren
Delete files existing on right side only
Lösche Dateien, die nur rechts existieren
+Delete files\tDEL
+Lösche Dateien\tDEL
Deleting file
Lösche Datei
Deleting folder
@@ -228,6 +250,8 @@ Error opening file
Fehler beim Öffnen der Datei
Error overwriting file
Fehler beim Überschreiben der Datei
+Error reading file:
+Fehler beim Lesen der Datei:
Error when modifying GUI grid
Fehler beim Modifizieren des UI Grids
Error: Source directory does not exist anymore:
@@ -276,6 +300,8 @@ Filter active: Press again to deactivate
Filter aktiv: Zum Deaktivieren erneut auswählen
Filter files
Dateien filtern
+Filter manually
+Manuell filtern
Filter view
Ansicht filtern
Folders/files that exist on left side only
@@ -284,10 +310,12 @@ Folders/files that exist on right side only
Ordner/Dateien, die nur rechts existieren
FreeFileSync (Date:
FreeFileSync (Datum:
-FreeFileSync - Folder Synchronization
-FreeFileSync - Dateisynchronisation
+FreeFileSync - Folder Comparison and Synchronization
+FreeFileSync - Dateivergleich und -synchronisation
FreeFileSync at Sourceforge
FreeFileSync bei Sourceforge
+FreeFileSync configuration
+FreeFileSync Konfiguration
Help
Hilfe
Hide error messages
@@ -311,7 +339,7 @@ Einschließen
Information
Information
It was not possible to gain access to Recycle Bin!\n\nIt's likely that you are not using Windows XP. (Probably Vista)\nIf you want this feature included, please contact the author. :)
-Die Papierkorbfunktion steht nicht zur Verfügung!\n\nWahrscheinlich ist das aktuelle Betriebssystem nicht Windows XP. (Möglicherweise Vista)\nWenn Sie diese Funktion benötigen kontaktieren Sie bitte den Autor. :)
+Die Papierkorbfunktion steht nicht zur Verfügung!\n\nWahrscheinlich ist das aktuelle Betriebssystem nicht Windows XP. (Möglicherweise Vista)\nWenn Sie diese Funktion wirklich benötigen kontaktieren Sie bitte den Autor. :)
Items completed:
Elemente komplett:
Legend\n
@@ -330,6 +358,8 @@ Not all items were synchronized! Have a look at the list.
Nicht alle Objekte wurden synchronisiert! Siehe die verbliebenen Elemente im Hauptfenster.
Nothing to synchronize. Both directories seem to contain the same data!
Nichts zu synchronisieren. Beide Verzeichnisse scheinen dieselben Daten zu enthalten!
+Number of files and directories that will be copied or deleted
+Anzahl der Dateien und Verzeichnisse, die kopiert oder gelöscht werden
OK
OK
Objects to process:
@@ -337,23 +367,31 @@ Zu übertragende Elemente:
One way ->
Nach rechts ->
Only files/directories that pass filtering will be relevant for synchronization.\n\n1. Enter full file or directory names separated by ';'.\n2. Wildcard characters '*' and '?' are supported.\n3. Case sensitive expressions!\n\nExample: *.tmp;C:\\data\\dummy.log;*filename*;*directory*
-Nur Dateien/Ordner, die zu den Filtereinstellungen passen, werden bei der\nSynchronisation berücksichtigt.\n\n1. Komplette Datei- oder Verzeichnisnamen getrennt durch ';' eingeben.\n2. Die Platzhalter '*' und '?' werden unterstützt.\n3. Groß-/Kleinschreibung wird unterschieden!\n\nBeispiel: *.tmp;C:\\data\\dummy.log;*filename*;*directory*
+Bei der Synchronisation werden nur die Dateien/Ordner berücksichtigt, die zu den\nFiltereinstellungen passen.\n\n1. Komplette Datei- oder Verzeichnisnamen getrennt durch ';' eingeben.\n2. Die Platzhalter '*' und '?' werden unterstützt.\n3. Groß-/Kleinschreibung wird unterschieden!\n\nBeispiel: *.tmp;C:\\data\\dummy.log;*filename*;*directory*
Open synchronization dialog
Zeige Synchronisationseinstellungen
+Open with Explorer\tD-Click
+Im Explorer öffnen\tD-Click
Operation aborted!
Aktion abgebrochen!
Operation:
Vorgang:
+Pause
+Pause
Please select directories for both sides!
Bitte für beide Seiten ein Verzeichnis wählen!
Press button to activate filter
Auswählen, um Filter zu aktivieren
+Published under the GNU General Public License:
+Veröffentlicht unter der GNU General Public License:
Quit
Beenden
Reading content of
Lese Inhalt von
Relative path
Relativer Pfad
+Remaining time:
+Verbliebene Zeit:
Result
Ergebnis
Retry
@@ -380,8 +418,8 @@ Set filter for synchronization
Filter einstellen
Size
Größe
-Source code written completely in C++ utilizing:\n\nMinGW \t\t- Windows port of GNU Compiler Collection\nwxWidgets \t- Open-Source GUI framework\nwxFormBuilder\t- wxWidgets GUI-builder\nGMP \t\t- arithmetic calculations\nCodeBlocks \t- Open-Source IDE\n\n by ZenJu
-Sourcecode komplett in C++ geschrieben unter Verwendung von:\n\nMinGW \t\t- Windows-Port der GNU Compiler Collection\nwxWidgets \t- Open-Source GUI-Framework\nwxFormBuilder\t- wxWidgets GUI-Builder\nGMP \t\t- Arithmetische Berechnungen\nCodeBlocks \t- Open-Source IDE\n\n ZenJu
+Source code written completely in C++ utilizing:\n\n MinGW \t\t- Windows port of GNU Compiler Collection\n wxWidgets \t- Open-Source GUI framework\n wxFormBuilder\t- wxWidgets GUI-builder\n CodeBlocks \t- Open-Source IDE\n\n by ZenJu
+Sourcecode komplett in C++ geschrieben unter Verwendung von:\n\n MinGW \t\t- Windows-Port der GNU Compiler Collection\n wxWidgets \t- Open-Source GUI-Framework\n wxFormBuilder\t- wxWidgets GUI-Builder\n CodeBlocks \t- Open-Source IDE\n\n ZenJu
Specify algorithm to test if files are equal:\n\n\t\tSIZEDATE: check filesize and date\n\t\tCONTENT: check file content\n
Methode angeben, um gleiche Dateien zu erkennen:\n\n\t\tSIZEDATE: Prüfung auf Dateigröße und -datum\n\t\tCONTENT: Prüfung auf Dateiinhalt\n
Specify names to be excluded separated by ';'. Wildcards '*' and '?' are supported. Default: \"\"\n
@@ -412,6 +450,8 @@ The selected file does not contain a valid configuration!
Die ausgewählte Datei enthält keine gültige Konfiguration!
The selected file does not exist anymore!
Die gewählte Datei existiert nicht mehr!
+Total amount of data that will be copied
+Menge der Daten, die kopiert werden
Two way <->
Beidseitig <->
Unable to create logfile!
diff --git a/library/CustomGrid.cpp b/library/CustomGrid.cpp
index eea2a0d4..4f8c84ad 100644
--- a/library/CustomGrid.cpp
+++ b/library/CustomGrid.cpp
@@ -164,7 +164,7 @@ public:
{
if (currentUI_ViewPtr)
{
- if (currentUI_ViewPtr->size() > unsigned(row))
+ if (unsigned(row) < currentUI_ViewPtr->size())
{
if ((*currentUI_ViewPtr)[row].cmpResult == constFilteredOut)
return true;
diff --git a/library/GMP/include/gmp.h b/library/GMP/include/gmp.h
deleted file mode 100644
index fa86f2dc..00000000
--- a/library/GMP/include/gmp.h
+++ /dev/null
@@ -1,2187 +0,0 @@
-/* Definitions for GNU multiple precision functions. -*- mode: c -*-
-
-Copyright 1991, 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002, 2003,
-2004, 2005, 2006, 2007 Free Software Foundation, Inc.
-
-This file is part of the GNU MP Library.
-
-The GNU MP Library is free software; you can redistribute it and/or modify
-it under the terms of the GNU Lesser General Public License as published by
-the Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-The GNU MP Library 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 Lesser General Public
-License for more details.
-
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
-
-#ifndef __GMP_H__
-
-#if defined (__cplusplus)
-#include <iosfwd> /* for std::istream, std::ostream, std::string */
-#endif
-
-
-/* Instantiated by configure. */
-#if ! defined (__GMP_WITHIN_CONFIGURE)
-#define __GMP_BITS_PER_MP_LIMB 32
-#define __GMP_HAVE_HOST_CPU_FAMILY_power 0
-#define __GMP_HAVE_HOST_CPU_FAMILY_powerpc 0
-#define GMP_LIMB_BITS 32
-#define GMP_NAIL_BITS 0
-#endif
-#define GMP_NUMB_BITS (GMP_LIMB_BITS - GMP_NAIL_BITS)
-#define GMP_NUMB_MASK ((~ __GMP_CAST (mp_limb_t, 0)) >> GMP_NAIL_BITS)
-#define GMP_NUMB_MAX GMP_NUMB_MASK
-#define GMP_NAIL_MASK (~ GMP_NUMB_MASK)
-
-
-/* The following (everything under ifndef __GNU_MP__) must be identical in
- gmp.h and mp.h to allow both to be included in an application or during
- the library build. */
-#ifndef __GNU_MP__
-#define __GNU_MP__ 4
-
-#define __need_size_t /* tell gcc stddef.h we only want size_t */
-#if defined (__cplusplus)
-#include <cstddef> /* for size_t */
-#else
-#include <stddef.h> /* for size_t */
-#endif
-#undef __need_size_t
-
-/* Instantiated by configure. */
-#if ! defined (__GMP_WITHIN_CONFIGURE)
-/* #undef _LONG_LONG_LIMB */
-#define __GMP_LIBGMP_DLL 0
-#endif
-
-
-/* __STDC__ - some ANSI compilers define this only to 0, hence the use of
- "defined" and not "__STDC__-0". In particular Sun workshop C 5.0
- sets __STDC__ to 0, but requires "##" for token pasting.
-
- _AIX - gnu ansidecl.h asserts that all known AIX compilers are ANSI but
- don't always define __STDC__.
-
- __DECC - current versions of DEC C (5.9 for instance) for alpha are ANSI,
- but don't define __STDC__ in their default mode. Don't know if old
- versions might have been K&R, but let's not worry about that unless
- someone is still using one.
-
- _mips - gnu ansidecl.h says the RISC/OS MIPS compiler is ANSI in SVR4
- mode, but doesn't define __STDC__.
-
- _MSC_VER - Microsoft C is ANSI, but __STDC__ is undefined unless the /Za
- option is given (in which case it's 1).
-
- _WIN32 - tested for by gnu ansidecl.h, no doubt on the assumption that
- all w32 compilers are ansi.
-
- Note: This same set of tests is used by gen-psqr.c and
- demos/expr/expr-impl.h, so if anything needs adding, then be sure to
- update those too. */
-
-#if defined (__STDC__) \
- || defined (__cplusplus) \
- || defined (_AIX) \
- || defined (__DECC) \
- || (defined (__mips) && defined (_SYSTYPE_SVR4)) \
- || defined (_MSC_VER) \
- || defined (_WIN32)
-#define __GMP_HAVE_CONST 1
-#define __GMP_HAVE_PROTOTYPES 1
-#define __GMP_HAVE_TOKEN_PASTE 1
-#else
-#define __GMP_HAVE_CONST 0
-#define __GMP_HAVE_PROTOTYPES 0
-#define __GMP_HAVE_TOKEN_PASTE 0
-#endif
-
-
-#if __GMP_HAVE_CONST
-#define __gmp_const const
-#define __gmp_signed signed
-#else
-#define __gmp_const
-#define __gmp_signed
-#endif
-
-
-/* __GMP_DECLSPEC supports Windows DLL versions of libgmp, and is empty in
- all other circumstances.
-
- When compiling objects for libgmp, __GMP_DECLSPEC is an export directive,
- or when compiling for an application it's an import directive. The two
- cases are differentiated by __GMP_WITHIN_GMP defined by the GMP Makefiles
- (and not defined from an application).
-
- __GMP_DECLSPEC_XX is similarly used for libgmpxx. __GMP_WITHIN_GMPXX
- indicates when building libgmpxx, and in that case libgmpxx functions are
- exports, but libgmp functions which might get called are imports.
-
- libmp.la uses __GMP_DECLSPEC, just as if it were libgmp.la. libgmp and
- libmp don't call each other, so there's no conflict or confusion.
-
- Libtool DLL_EXPORT define is not used.
-
- There's no attempt to support GMP built both static and DLL. Doing so
- would mean applications would have to tell us which of the two is going
- to be used when linking, and that seems very tedious and error prone if
- using GMP by hand, and equally tedious from a package since autoconf and
- automake don't give much help.
-
- __GMP_DECLSPEC is required on all documented global functions and
- variables, the various internals in gmp-impl.h etc can be left unadorned.
- But internals used by the test programs or speed measuring programs
- should have __GMP_DECLSPEC, and certainly constants or variables must
- have it or the wrong address will be resolved.
-
- In gcc __declspec can go at either the start or end of a prototype.
-
- In Microsoft C __declspec must go at the start, or after the type like
- void __declspec(...) *foo()". There's no __dllexport or anything to
- guard against someone foolish #defining dllexport. _export used to be
- available, but no longer.
-
- In Borland C _export still exists, but needs to go after the type, like
- "void _export foo();". Would have to change the __GMP_DECLSPEC syntax to
- make use of that. Probably more trouble than it's worth. */
-
-#if defined (__GNUC__)
-#define __GMP_DECLSPEC_EXPORT __declspec(__dllexport__)
-#define __GMP_DECLSPEC_IMPORT __declspec(__dllimport__)
-#endif
-#if defined (_MSC_VER) || defined (__BORLANDC__)
-#define __GMP_DECLSPEC_EXPORT __declspec(dllexport)
-#define __GMP_DECLSPEC_IMPORT __declspec(dllimport)
-#endif
-#ifdef __WATCOMC__
-#define __GMP_DECLSPEC_EXPORT __export
-#define __GMP_DECLSPEC_IMPORT __import
-#endif
-#ifdef __IBMC__
-#define __GMP_DECLSPEC_EXPORT _Export
-#define __GMP_DECLSPEC_IMPORT _Import
-#endif
-
-#if __GMP_LIBGMP_DLL
-#if __GMP_WITHIN_GMP
-/* compiling to go into a DLL libgmp */
-#define __GMP_DECLSPEC __GMP_DECLSPEC_EXPORT
-#else
-/* compiling to go into an application which will link to a DLL libgmp */
-#define __GMP_DECLSPEC __GMP_DECLSPEC_IMPORT
-#endif
-#else
-/* all other cases */
-#define __GMP_DECLSPEC
-#endif
-
-
-#ifdef __GMP_SHORT_LIMB
-typedef unsigned int mp_limb_t;
-typedef int mp_limb_signed_t;
-#else
-#ifdef _LONG_LONG_LIMB
-typedef unsigned long long int mp_limb_t;
-typedef long long int mp_limb_signed_t;
-#else
-typedef unsigned long int mp_limb_t;
-typedef long int mp_limb_signed_t;
-#endif
-#endif
-
-/* For reference, note that the name __mpz_struct gets into C++ mangled
- function names, which means although the "__" suggests an internal, we
- must leave this name for binary compatibility. */
-typedef struct
-{
- int _mp_alloc; /* Number of *limbs* allocated and pointed
- to by the _mp_d field. */
- int _mp_size; /* abs(_mp_size) is the number of limbs the
- last field points to. If _mp_size is
- negative this is a negative number. */
- mp_limb_t *_mp_d; /* Pointer to the limbs. */
-} __mpz_struct;
-
-#endif /* __GNU_MP__ */
-
-
-typedef __mpz_struct MP_INT; /* gmp 1 source compatibility */
-typedef __mpz_struct mpz_t[1];
-
-typedef mp_limb_t * mp_ptr;
-typedef __gmp_const mp_limb_t * mp_srcptr;
-#if defined (_CRAY) && ! defined (_CRAYMPP)
-/* plain `int' is much faster (48 bits) */
-#define __GMP_MP_SIZE_T_INT 1
-typedef int mp_size_t;
-typedef int mp_exp_t;
-#else
-#define __GMP_MP_SIZE_T_INT 0
-typedef long int mp_size_t;
-typedef long int mp_exp_t;
-#endif
-
-typedef struct
-{
- __mpz_struct _mp_num;
- __mpz_struct _mp_den;
-} __mpq_struct;
-
-typedef __mpq_struct MP_RAT; /* gmp 1 source compatibility */
-typedef __mpq_struct mpq_t[1];
-
-typedef struct
-{
- int _mp_prec; /* Max precision, in number of `mp_limb_t's.
- Set by mpf_init and modified by
- mpf_set_prec. The area pointed to by the
- _mp_d field contains `prec' + 1 limbs. */
- int _mp_size; /* abs(_mp_size) is the number of limbs the
- last field points to. If _mp_size is
- negative this is a negative number. */
- mp_exp_t _mp_exp; /* Exponent, in the base of `mp_limb_t'. */
- mp_limb_t *_mp_d; /* Pointer to the limbs. */
-} __mpf_struct;
-
-/* typedef __mpf_struct MP_FLOAT; */
-typedef __mpf_struct mpf_t[1];
-
-/* Available random number generation algorithms. */
-typedef enum
-{
- GMP_RAND_ALG_DEFAULT = 0,
- GMP_RAND_ALG_LC = GMP_RAND_ALG_DEFAULT /* Linear congruential. */
-} gmp_randalg_t;
-
-/* Random state struct. */
-typedef struct
-{
- mpz_t _mp_seed; /* _mp_d member points to state of the generator. */
- gmp_randalg_t _mp_alg; /* Currently unused. */
- union
- {
- void *_mp_lc; /* Pointer to function pointers structure. */
- } _mp_algdata;
-} __gmp_randstate_struct;
-typedef __gmp_randstate_struct gmp_randstate_t[1];
-
-/* Types for function declarations in gmp files. */
-/* ??? Should not pollute user name space with these ??? */
-typedef __gmp_const __mpz_struct *mpz_srcptr;
-typedef __mpz_struct *mpz_ptr;
-typedef __gmp_const __mpf_struct *mpf_srcptr;
-typedef __mpf_struct *mpf_ptr;
-typedef __gmp_const __mpq_struct *mpq_srcptr;
-typedef __mpq_struct *mpq_ptr;
-
-
-/* This is not wanted in mp.h, so put it outside the __GNU_MP__ common
- section. */
-#if __GMP_LIBGMP_DLL
-#if __GMP_WITHIN_GMPXX
-/* compiling to go into a DLL libgmpxx */
-#define __GMP_DECLSPEC_XX __GMP_DECLSPEC_EXPORT
-#else
-/* compiling to go into a application which will link to a DLL libgmpxx */
-#define __GMP_DECLSPEC_XX __GMP_DECLSPEC_IMPORT
-#endif
-#else
-/* all other cases */
-#define __GMP_DECLSPEC_XX
-#endif
-
-
-#if __GMP_HAVE_PROTOTYPES
-#define __GMP_PROTO(x) x
-#else
-#define __GMP_PROTO(x) ()
-#endif
-
-#ifndef __MPN
-#if __GMP_HAVE_TOKEN_PASTE
-#define __MPN(x) __gmpn_##x
-#else
-#define __MPN(x) __gmpn_/**/x
-#endif
-#endif
-
-/* For reference, "defined(EOF)" cannot be used here. In g++ 2.95.4,
- <iostream> defines EOF but not FILE. */
-#if defined (FILE) \
- || defined (H_STDIO) \
- || defined (_H_STDIO) /* AIX */ \
- || defined (_STDIO_H) /* glibc, Sun, SCO */ \
- || defined (_STDIO_H_) /* BSD, OSF */ \
- || defined (__STDIO_H) /* Borland */ \
- || defined (__STDIO_H__) /* IRIX */ \
- || defined (_STDIO_INCLUDED) /* HPUX */ \
- || defined (__dj_include_stdio_h_) /* DJGPP */ \
- || defined (_FILE_DEFINED) /* Microsoft */ \
- || defined (__STDIO__) /* Apple MPW MrC */ \
- || defined (_MSL_STDIO_H) /* Metrowerks */ \
- || defined (_STDIO_H_INCLUDED) /* QNX4 */ \
- || defined (_ISO_STDIO_ISO_H) /* Sun C++ */
-#define _GMP_H_HAVE_FILE 1
-#endif
-
-/* In ISO C, if a prototype involving "struct obstack *" is given without
- that structure defined, then the struct is scoped down to just the
- prototype, causing a conflict if it's subsequently defined for real. So
- only give prototypes if we've got obstack.h. */
-#if defined (_OBSTACK_H) /* glibc <obstack.h> */
-#define _GMP_H_HAVE_OBSTACK 1
-#endif
-
-/* The prototypes for gmp_vprintf etc are provided only if va_list is
- available, via an application having included <stdarg.h> or <varargs.h>.
- Usually va_list is a typedef so can't be tested directly, but C99
- specifies that va_start is a macro (and it was normally a macro on past
- systems too), so look for that.
-
- <stdio.h> will define some sort of va_list for vprintf and vfprintf, but
- let's not bother trying to use that since it's not standard and since
- application uses for gmp_vprintf etc will almost certainly require the
- whole <stdarg.h> or <varargs.h> anyway. */
-
-#ifdef va_start
-#define _GMP_H_HAVE_VA_LIST 1
-#endif
-
-/* Test for gcc >= maj.min, as per __GNUC_PREREQ in glibc */
-#if defined (__GNUC__) && defined (__GNUC_MINOR__)
-#define __GMP_GNUC_PREREQ(maj, min) \
- ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
-#else
-#define __GMP_GNUC_PREREQ(maj, min) 0
-#endif
-
-/* "pure" is in gcc 2.96 and up, see "(gcc)Function Attributes". Basically
- it means a function does nothing but examine its arguments and memory
- (global or via arguments) to generate a return value, but changes nothing
- and has no side-effects. __GMP_NO_ATTRIBUTE_CONST_PURE lets
- tune/common.c etc turn this off when trying to write timing loops. */
-#if __GMP_GNUC_PREREQ (2,96) && ! defined (__GMP_NO_ATTRIBUTE_CONST_PURE)
-#define __GMP_ATTRIBUTE_PURE __attribute__ ((__pure__))
-#else
-#define __GMP_ATTRIBUTE_PURE
-#endif
-
-
-/* __GMP_CAST allows us to use static_cast in C++, so our macros are clean
- to "g++ -Wold-style-cast".
-
- Casts in "extern inline" code within an extern "C" block don't induce
- these warnings, so __GMP_CAST only needs to be used on documented
- macros. */
-
-#ifdef __cplusplus
-#define __GMP_CAST(type, expr) (static_cast<type> (expr))
-#else
-#define __GMP_CAST(type, expr) ((type) (expr))
-#endif
-
-
-/* An empty "throw ()" means the function doesn't throw any C++ exceptions,
- this can save some stack frame info in applications.
-
- Currently it's given only on functions which never divide-by-zero etc,
- don't allocate memory, and are expected to never need to allocate memory.
- This leaves open the possibility of a C++ throw from a future GMP
- exceptions scheme.
-
- mpz_set_ui etc are omitted to leave open the lazy allocation scheme
- described in doc/tasks.html. mpz_get_d etc are omitted to leave open
- exceptions for float overflows.
-
- Note that __GMP_NOTHROW must be given on any inlines the same as on their
- prototypes (for g++ at least, where they're used together). Note also
- that g++ 3.0 demands that __GMP_NOTHROW is before other attributes like
- __GMP_ATTRIBUTE_PURE. */
-
-#if defined (__cplusplus)
-#define __GMP_NOTHROW throw ()
-#else
-#define __GMP_NOTHROW
-#endif
-
-
-/* PORTME: What other compilers have a useful "extern inline"? "static
- inline" would be an acceptable substitute if the compiler (or linker)
- discards unused statics. */
-
-/* gcc has __inline__ in all modes, including strict ansi. Give a prototype
- for an inline too, so as to correctly specify "dllimport" on windows, in
- case the function is called rather than inlined.
- GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99
- inline semantics, unless -fgnu89-inline is used. */
-#ifdef __GNUC__
-#if (defined __GNUC_STDC_INLINE__) || (__GNUC__ == 4 && __GNUC_MINOR__ == 2)
-#define __GMP_EXTERN_INLINE extern __inline__ __attribute__ ((__gnu_inline__))
-#else
-#define __GMP_EXTERN_INLINE extern __inline__
-#endif
-#define __GMP_INLINE_PROTOTYPES 1
-#endif
-
-/* DEC C (eg. version 5.9) supports "static __inline foo()", even in -std1
- strict ANSI mode. Inlining is done even when not optimizing (ie. -O0
- mode, which is the default), but an unnecessary local copy of foo is
- emitted unless -O is used. "extern __inline" is accepted, but the
- "extern" appears to be ignored, ie. it becomes a plain global function
- but which is inlined within its file. Don't know if all old versions of
- DEC C supported __inline, but as a start let's do the right thing for
- current versions. */
-#ifdef __DECC
-#define __GMP_EXTERN_INLINE static __inline
-#endif
-
-/* SCO OpenUNIX 8 cc supports "static inline foo()" but not in -Xc strict
- ANSI mode (__STDC__ is 1 in that mode). Inlining only actually takes
- place under -O. Without -O "foo" seems to be emitted whether it's used
- or not, which is wasteful. "extern inline foo()" isn't useful, the
- "extern" is apparently ignored, so foo is inlined if possible but also
- emitted as a global, which causes multiple definition errors when
- building a shared libgmp. */
-#ifdef __SCO_VERSION__
-#if __SCO_VERSION__ > 400000000 && __STDC__ != 1 \
- && ! defined (__GMP_EXTERN_INLINE)
-#define __GMP_EXTERN_INLINE static inline
-#endif
-#endif
-
-/* C++ always has "inline" and since it's a normal feature the linker should
- discard duplicate non-inlined copies, or if it doesn't then that's a
- problem for everyone, not just GMP. */
-#if defined (__cplusplus) && ! defined (__GMP_EXTERN_INLINE)
-#define __GMP_EXTERN_INLINE inline
-#endif
-
-/* Don't do any inlining within a configure run, since if the compiler ends
- up emitting copies of the code into the object file it can end up
- demanding the various support routines (like mpn_popcount) for linking,
- making the "alloca" test and perhaps others fail. And on hppa ia64 a
- pre-release gcc 3.2 was seen not respecting the "extern" in "extern
- __inline__", triggering this problem too. */
-#if defined (__GMP_WITHIN_CONFIGURE) && ! __GMP_WITHIN_CONFIGURE_INLINE
-#undef __GMP_EXTERN_INLINE
-#endif
-
-/* By default, don't give a prototype when there's going to be an inline
- version. Note in particular that Cray C++ objects to the combination of
- prototype and inline. */
-#ifdef __GMP_EXTERN_INLINE
-#ifndef __GMP_INLINE_PROTOTYPES
-#define __GMP_INLINE_PROTOTYPES 0
-#endif
-#else
-#define __GMP_INLINE_PROTOTYPES 1
-#endif
-
-
-#define __GMP_ABS(x) ((x) >= 0 ? (x) : -(x))
-#define __GMP_MAX(h,i) ((h) > (i) ? (h) : (i))
-
-/* __GMP_USHRT_MAX is not "~ (unsigned short) 0" because short is promoted
- to int by "~". */
-#define __GMP_UINT_MAX (~ (unsigned) 0)
-#define __GMP_ULONG_MAX (~ (unsigned long) 0)
-#define __GMP_USHRT_MAX ((unsigned short) ~0)
-
-
-/* __builtin_expect is in gcc 3.0, and not in 2.95. */
-#if __GMP_GNUC_PREREQ (3,0)
-#define __GMP_LIKELY(cond) __builtin_expect ((cond) != 0, 1)
-#define __GMP_UNLIKELY(cond) __builtin_expect ((cond) != 0, 0)
-#else
-#define __GMP_LIKELY(cond) (cond)
-#define __GMP_UNLIKELY(cond) (cond)
-#endif
-
-#ifdef _CRAY
-#define __GMP_CRAY_Pragma(str) _Pragma (str)
-#else
-#define __GMP_CRAY_Pragma(str)
-#endif
-
-
-/* Allow direct user access to numerator and denominator of a mpq_t object. */
-#define mpq_numref(Q) (&((Q)->_mp_num))
-#define mpq_denref(Q) (&((Q)->_mp_den))
-
-
-#if defined (__cplusplus)
-extern "C"
-{
-#include <cstdio>
-#ifdef _GMP_H_HAVE_FILE
- using std::FILE;
-#endif
-#endif
-
-#define mp_set_memory_functions __gmp_set_memory_functions
- __GMP_DECLSPEC void mp_set_memory_functions __GMP_PROTO ((void *(*) (size_t),
- void *(*) (void *, size_t, size_t),
- void (*) (void *, size_t))) __GMP_NOTHROW;
-
-#define mp_get_memory_functions __gmp_get_memory_functions
- __GMP_DECLSPEC void mp_get_memory_functions __GMP_PROTO ((void *(**) (size_t),
- void *(**) (void *, size_t, size_t),
- void (**) (void *, size_t))) __GMP_NOTHROW;
-
-#define mp_bits_per_limb __gmp_bits_per_limb
- __GMP_DECLSPEC extern __gmp_const int mp_bits_per_limb;
-
-#define gmp_errno __gmp_errno
- __GMP_DECLSPEC extern int gmp_errno;
-
-#define gmp_version __gmp_version
- __GMP_DECLSPEC extern __gmp_const char * __gmp_const gmp_version;
-
-
- /**************** Random number routines. ****************/
-
- /* obsolete */
-#define gmp_randinit __gmp_randinit
- __GMP_DECLSPEC void gmp_randinit __GMP_PROTO ((gmp_randstate_t, gmp_randalg_t, ...));
-
-#define gmp_randinit_default __gmp_randinit_default
- __GMP_DECLSPEC void gmp_randinit_default __GMP_PROTO ((gmp_randstate_t));
-
-#define gmp_randinit_lc_2exp __gmp_randinit_lc_2exp
- __GMP_DECLSPEC void gmp_randinit_lc_2exp __GMP_PROTO ((gmp_randstate_t,
- mpz_srcptr, unsigned long int,
- unsigned long int));
-
-#define gmp_randinit_lc_2exp_size __gmp_randinit_lc_2exp_size
- __GMP_DECLSPEC int gmp_randinit_lc_2exp_size __GMP_PROTO ((gmp_randstate_t, unsigned long));
-
-#define gmp_randinit_mt __gmp_randinit_mt
- __GMP_DECLSPEC void gmp_randinit_mt __GMP_PROTO ((gmp_randstate_t));
-
-#define gmp_randinit_set __gmp_randinit_set
- void gmp_randinit_set __GMP_PROTO ((gmp_randstate_t, __gmp_const __gmp_randstate_struct *));
-
-#define gmp_randseed __gmp_randseed
- __GMP_DECLSPEC void gmp_randseed __GMP_PROTO ((gmp_randstate_t, mpz_srcptr));
-
-#define gmp_randseed_ui __gmp_randseed_ui
- __GMP_DECLSPEC void gmp_randseed_ui __GMP_PROTO ((gmp_randstate_t, unsigned long int));
-
-#define gmp_randclear __gmp_randclear
- __GMP_DECLSPEC void gmp_randclear __GMP_PROTO ((gmp_randstate_t));
-
-#define gmp_urandomb_ui __gmp_urandomb_ui
- unsigned long gmp_urandomb_ui __GMP_PROTO ((gmp_randstate_t, unsigned long));
-
-#define gmp_urandomm_ui __gmp_urandomm_ui
- unsigned long gmp_urandomm_ui __GMP_PROTO ((gmp_randstate_t, unsigned long));
-
-
- /**************** Formatted output routines. ****************/
-
-#define gmp_asprintf __gmp_asprintf
- __GMP_DECLSPEC int gmp_asprintf __GMP_PROTO ((char **, __gmp_const char *, ...));
-
-#define gmp_fprintf __gmp_fprintf
-#ifdef _GMP_H_HAVE_FILE
- __GMP_DECLSPEC int gmp_fprintf __GMP_PROTO ((FILE *, __gmp_const char *, ...));
-#endif
-
-#define gmp_obstack_printf __gmp_obstack_printf
-#if defined (_GMP_H_HAVE_OBSTACK)
- __GMP_DECLSPEC int gmp_obstack_printf __GMP_PROTO ((struct obstack *, __gmp_const char *, ...));
-#endif
-
-#define gmp_obstack_vprintf __gmp_obstack_vprintf
-#if defined (_GMP_H_HAVE_OBSTACK) && defined (_GMP_H_HAVE_VA_LIST)
- __GMP_DECLSPEC int gmp_obstack_vprintf __GMP_PROTO ((struct obstack *, __gmp_const char *, va_list));
-#endif
-
-#define gmp_printf __gmp_printf
- __GMP_DECLSPEC int gmp_printf __GMP_PROTO ((__gmp_const char *, ...));
-
-#define gmp_snprintf __gmp_snprintf
- __GMP_DECLSPEC int gmp_snprintf __GMP_PROTO ((char *, size_t, __gmp_const char *, ...));
-
-#define gmp_sprintf __gmp_sprintf
- __GMP_DECLSPEC int gmp_sprintf __GMP_PROTO ((char *, __gmp_const char *, ...));
-
-#define gmp_vasprintf __gmp_vasprintf
-#if defined (_GMP_H_HAVE_VA_LIST)
- __GMP_DECLSPEC int gmp_vasprintf __GMP_PROTO ((char **, __gmp_const char *, va_list));
-#endif
-
-#define gmp_vfprintf __gmp_vfprintf
-#if defined (_GMP_H_HAVE_FILE) && defined (_GMP_H_HAVE_VA_LIST)
- __GMP_DECLSPEC int gmp_vfprintf __GMP_PROTO ((FILE *, __gmp_const char *, va_list));
-#endif
-
-#define gmp_vprintf __gmp_vprintf
-#if defined (_GMP_H_HAVE_VA_LIST)
- __GMP_DECLSPEC int gmp_vprintf __GMP_PROTO ((__gmp_const char *, va_list));
-#endif
-
-#define gmp_vsnprintf __gmp_vsnprintf
-#if defined (_GMP_H_HAVE_VA_LIST)
- __GMP_DECLSPEC int gmp_vsnprintf __GMP_PROTO ((char *, size_t, __gmp_const char *, va_list));
-#endif
-
-#define gmp_vsprintf __gmp_vsprintf
-#if defined (_GMP_H_HAVE_VA_LIST)
- __GMP_DECLSPEC int gmp_vsprintf __GMP_PROTO ((char *, __gmp_const char *, va_list));
-#endif
-
-
- /**************** Formatted input routines. ****************/
-
-#define gmp_fscanf __gmp_fscanf
-#ifdef _GMP_H_HAVE_FILE
- __GMP_DECLSPEC int gmp_fscanf __GMP_PROTO ((FILE *, __gmp_const char *, ...));
-#endif
-
-#define gmp_scanf __gmp_scanf
- __GMP_DECLSPEC int gmp_scanf __GMP_PROTO ((__gmp_const char *, ...));
-
-#define gmp_sscanf __gmp_sscanf
- __GMP_DECLSPEC int gmp_sscanf __GMP_PROTO ((__gmp_const char *, __gmp_const char *, ...));
-
-#define gmp_vfscanf __gmp_vfscanf
-#if defined (_GMP_H_HAVE_FILE) && defined (_GMP_H_HAVE_VA_LIST)
- __GMP_DECLSPEC int gmp_vfscanf __GMP_PROTO ((FILE *, __gmp_const char *, va_list));
-#endif
-
-#define gmp_vscanf __gmp_vscanf
-#if defined (_GMP_H_HAVE_VA_LIST)
- __GMP_DECLSPEC int gmp_vscanf __GMP_PROTO ((__gmp_const char *, va_list));
-#endif
-
-#define gmp_vsscanf __gmp_vsscanf
-#if defined (_GMP_H_HAVE_VA_LIST)
- __GMP_DECLSPEC int gmp_vsscanf __GMP_PROTO ((__gmp_const char *, __gmp_const char *, va_list));
-#endif
-
-
- /**************** Integer (i.e. Z) routines. ****************/
-
-#define _mpz_realloc __gmpz_realloc
-#define mpz_realloc __gmpz_realloc
- __GMP_DECLSPEC void *_mpz_realloc __GMP_PROTO ((mpz_ptr, mp_size_t));
-
-#define mpz_abs __gmpz_abs
-#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_abs)
- __GMP_DECLSPEC void mpz_abs __GMP_PROTO ((mpz_ptr, mpz_srcptr));
-#endif
-
-#define mpz_add __gmpz_add
- __GMP_DECLSPEC void mpz_add __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
-
-#define mpz_add_ui __gmpz_add_ui
- __GMP_DECLSPEC void mpz_add_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
-
-#define mpz_addmul __gmpz_addmul
- __GMP_DECLSPEC void mpz_addmul __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
-
-#define mpz_addmul_ui __gmpz_addmul_ui
- __GMP_DECLSPEC void mpz_addmul_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
-
-#define mpz_and __gmpz_and
- __GMP_DECLSPEC void mpz_and __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
-
-#define mpz_array_init __gmpz_array_init
- __GMP_DECLSPEC void mpz_array_init __GMP_PROTO ((mpz_ptr, mp_size_t, mp_size_t));
-
-#define mpz_bin_ui __gmpz_bin_ui
- __GMP_DECLSPEC void mpz_bin_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
-
-#define mpz_bin_uiui __gmpz_bin_uiui
- __GMP_DECLSPEC void mpz_bin_uiui __GMP_PROTO ((mpz_ptr, unsigned long int, unsigned long int));
-
-#define mpz_cdiv_q __gmpz_cdiv_q
- __GMP_DECLSPEC void mpz_cdiv_q __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
-
-#define mpz_cdiv_q_2exp __gmpz_cdiv_q_2exp
- __GMP_DECLSPEC void mpz_cdiv_q_2exp __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long));
-
-#define mpz_cdiv_q_ui __gmpz_cdiv_q_ui
- __GMP_DECLSPEC unsigned long int mpz_cdiv_q_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
-
-#define mpz_cdiv_qr __gmpz_cdiv_qr
- __GMP_DECLSPEC void mpz_cdiv_qr __GMP_PROTO ((mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr));
-
-#define mpz_cdiv_qr_ui __gmpz_cdiv_qr_ui
- __GMP_DECLSPEC unsigned long int mpz_cdiv_qr_ui __GMP_PROTO ((mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long int));
-
-#define mpz_cdiv_r __gmpz_cdiv_r
- __GMP_DECLSPEC void mpz_cdiv_r __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
-
-#define mpz_cdiv_r_2exp __gmpz_cdiv_r_2exp
- __GMP_DECLSPEC void mpz_cdiv_r_2exp __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long));
-
-#define mpz_cdiv_r_ui __gmpz_cdiv_r_ui
- __GMP_DECLSPEC unsigned long int mpz_cdiv_r_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
-
-#define mpz_cdiv_ui __gmpz_cdiv_ui
- __GMP_DECLSPEC unsigned long int mpz_cdiv_ui __GMP_PROTO ((mpz_srcptr, unsigned long int)) __GMP_ATTRIBUTE_PURE;
-
-#define mpz_clear __gmpz_clear
- __GMP_DECLSPEC void mpz_clear __GMP_PROTO ((mpz_ptr));
-
-#define mpz_clrbit __gmpz_clrbit
- __GMP_DECLSPEC void mpz_clrbit __GMP_PROTO ((mpz_ptr, unsigned long int));
-
-#define mpz_cmp __gmpz_cmp
- __GMP_DECLSPEC int mpz_cmp __GMP_PROTO ((mpz_srcptr, mpz_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpz_cmp_d __gmpz_cmp_d
- __GMP_DECLSPEC int mpz_cmp_d __GMP_PROTO ((mpz_srcptr, double)) __GMP_ATTRIBUTE_PURE;
-
-#define _mpz_cmp_si __gmpz_cmp_si
- __GMP_DECLSPEC int _mpz_cmp_si __GMP_PROTO ((mpz_srcptr, signed long int)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define _mpz_cmp_ui __gmpz_cmp_ui
- __GMP_DECLSPEC int _mpz_cmp_ui __GMP_PROTO ((mpz_srcptr, unsigned long int)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpz_cmpabs __gmpz_cmpabs
- __GMP_DECLSPEC int mpz_cmpabs __GMP_PROTO ((mpz_srcptr, mpz_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpz_cmpabs_d __gmpz_cmpabs_d
- __GMP_DECLSPEC int mpz_cmpabs_d __GMP_PROTO ((mpz_srcptr, double)) __GMP_ATTRIBUTE_PURE;
-
-#define mpz_cmpabs_ui __gmpz_cmpabs_ui
- __GMP_DECLSPEC int mpz_cmpabs_ui __GMP_PROTO ((mpz_srcptr, unsigned long int)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpz_com __gmpz_com
- __GMP_DECLSPEC void mpz_com __GMP_PROTO ((mpz_ptr, mpz_srcptr));
-
-#define mpz_combit __gmpz_combit
- __GMP_DECLSPEC void mpz_combit __GMP_PROTO ((mpz_ptr, unsigned long int));
-
-#define mpz_congruent_p __gmpz_congruent_p
- __GMP_DECLSPEC int mpz_congruent_p __GMP_PROTO ((mpz_srcptr, mpz_srcptr, mpz_srcptr)) __GMP_ATTRIBUTE_PURE;
-
-#define mpz_congruent_2exp_p __gmpz_congruent_2exp_p
- __GMP_DECLSPEC int mpz_congruent_2exp_p __GMP_PROTO ((mpz_srcptr, mpz_srcptr, unsigned long)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpz_congruent_ui_p __gmpz_congruent_ui_p
- __GMP_DECLSPEC int mpz_congruent_ui_p __GMP_PROTO ((mpz_srcptr, unsigned long, unsigned long)) __GMP_ATTRIBUTE_PURE;
-
-#define mpz_divexact __gmpz_divexact
- __GMP_DECLSPEC void mpz_divexact __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
-
-#define mpz_divexact_ui __gmpz_divexact_ui
- __GMP_DECLSPEC void mpz_divexact_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long));
-
-#define mpz_divisible_p __gmpz_divisible_p
- __GMP_DECLSPEC int mpz_divisible_p __GMP_PROTO ((mpz_srcptr, mpz_srcptr)) __GMP_ATTRIBUTE_PURE;
-
-#define mpz_divisible_ui_p __gmpz_divisible_ui_p
- __GMP_DECLSPEC int mpz_divisible_ui_p __GMP_PROTO ((mpz_srcptr, unsigned long)) __GMP_ATTRIBUTE_PURE;
-
-#define mpz_divisible_2exp_p __gmpz_divisible_2exp_p
- __GMP_DECLSPEC int mpz_divisible_2exp_p __GMP_PROTO ((mpz_srcptr, unsigned long)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpz_dump __gmpz_dump
- __GMP_DECLSPEC void mpz_dump __GMP_PROTO ((mpz_srcptr));
-
-#define mpz_export __gmpz_export
- __GMP_DECLSPEC void *mpz_export __GMP_PROTO ((void *, size_t *, int, size_t, int, size_t, mpz_srcptr));
-
-#define mpz_fac_ui __gmpz_fac_ui
- __GMP_DECLSPEC void mpz_fac_ui __GMP_PROTO ((mpz_ptr, unsigned long int));
-
-#define mpz_fdiv_q __gmpz_fdiv_q
- __GMP_DECLSPEC void mpz_fdiv_q __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
-
-#define mpz_fdiv_q_2exp __gmpz_fdiv_q_2exp
- __GMP_DECLSPEC void mpz_fdiv_q_2exp __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
-
-#define mpz_fdiv_q_ui __gmpz_fdiv_q_ui
- __GMP_DECLSPEC unsigned long int mpz_fdiv_q_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
-
-#define mpz_fdiv_qr __gmpz_fdiv_qr
- __GMP_DECLSPEC void mpz_fdiv_qr __GMP_PROTO ((mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr));
-
-#define mpz_fdiv_qr_ui __gmpz_fdiv_qr_ui
- __GMP_DECLSPEC unsigned long int mpz_fdiv_qr_ui __GMP_PROTO ((mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long int));
-
-#define mpz_fdiv_r __gmpz_fdiv_r
- __GMP_DECLSPEC void mpz_fdiv_r __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
-
-#define mpz_fdiv_r_2exp __gmpz_fdiv_r_2exp
- __GMP_DECLSPEC void mpz_fdiv_r_2exp __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
-
-#define mpz_fdiv_r_ui __gmpz_fdiv_r_ui
- __GMP_DECLSPEC unsigned long int mpz_fdiv_r_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
-
-#define mpz_fdiv_ui __gmpz_fdiv_ui
- __GMP_DECLSPEC unsigned long int mpz_fdiv_ui __GMP_PROTO ((mpz_srcptr, unsigned long int)) __GMP_ATTRIBUTE_PURE;
-
-#define mpz_fib_ui __gmpz_fib_ui
- __GMP_DECLSPEC void mpz_fib_ui __GMP_PROTO ((mpz_ptr, unsigned long int));
-
-#define mpz_fib2_ui __gmpz_fib2_ui
- __GMP_DECLSPEC void mpz_fib2_ui __GMP_PROTO ((mpz_ptr, mpz_ptr, unsigned long int));
-
-#define mpz_fits_sint_p __gmpz_fits_sint_p
- __GMP_DECLSPEC int mpz_fits_sint_p __GMP_PROTO ((mpz_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpz_fits_slong_p __gmpz_fits_slong_p
- __GMP_DECLSPEC int mpz_fits_slong_p __GMP_PROTO ((mpz_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpz_fits_sshort_p __gmpz_fits_sshort_p
- __GMP_DECLSPEC int mpz_fits_sshort_p __GMP_PROTO ((mpz_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpz_fits_uint_p __gmpz_fits_uint_p
-#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_fits_uint_p)
- __GMP_DECLSPEC int mpz_fits_uint_p __GMP_PROTO ((mpz_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-#endif
-
-#define mpz_fits_ulong_p __gmpz_fits_ulong_p
-#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_fits_ulong_p)
- __GMP_DECLSPEC int mpz_fits_ulong_p __GMP_PROTO ((mpz_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-#endif
-
-#define mpz_fits_ushort_p __gmpz_fits_ushort_p
-#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_fits_ushort_p)
- __GMP_DECLSPEC int mpz_fits_ushort_p __GMP_PROTO ((mpz_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-#endif
-
-#define mpz_gcd __gmpz_gcd
- __GMP_DECLSPEC void mpz_gcd __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
-
-#define mpz_gcd_ui __gmpz_gcd_ui
- __GMP_DECLSPEC unsigned long int mpz_gcd_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
-
-#define mpz_gcdext __gmpz_gcdext
- __GMP_DECLSPEC void mpz_gcdext __GMP_PROTO ((mpz_ptr, mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr));
-
-#define mpz_get_d __gmpz_get_d
- __GMP_DECLSPEC double mpz_get_d __GMP_PROTO ((mpz_srcptr)) __GMP_ATTRIBUTE_PURE;
-
-#define mpz_get_d_2exp __gmpz_get_d_2exp
- __GMP_DECLSPEC double mpz_get_d_2exp __GMP_PROTO ((signed long int *, mpz_srcptr));
-
-#define mpz_get_si __gmpz_get_si
- __GMP_DECLSPEC /* signed */ long int mpz_get_si __GMP_PROTO ((mpz_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpz_get_str __gmpz_get_str
- __GMP_DECLSPEC char *mpz_get_str __GMP_PROTO ((char *, int, mpz_srcptr));
-
-#define mpz_get_ui __gmpz_get_ui
-#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_get_ui)
- __GMP_DECLSPEC unsigned long int mpz_get_ui __GMP_PROTO ((mpz_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-#endif
-
-#define mpz_getlimbn __gmpz_getlimbn
-#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_getlimbn)
- __GMP_DECLSPEC mp_limb_t mpz_getlimbn __GMP_PROTO ((mpz_srcptr, mp_size_t)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-#endif
-
-#define mpz_hamdist __gmpz_hamdist
- __GMP_DECLSPEC unsigned long int mpz_hamdist __GMP_PROTO ((mpz_srcptr, mpz_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpz_import __gmpz_import
- __GMP_DECLSPEC void mpz_import __GMP_PROTO ((mpz_ptr, size_t, int, size_t, int, size_t, __gmp_const void *));
-
-#define mpz_init __gmpz_init
- __GMP_DECLSPEC void mpz_init __GMP_PROTO ((mpz_ptr));
-
-#define mpz_init2 __gmpz_init2
- __GMP_DECLSPEC void mpz_init2 __GMP_PROTO ((mpz_ptr, unsigned long));
-
-#define mpz_init_set __gmpz_init_set
- __GMP_DECLSPEC void mpz_init_set __GMP_PROTO ((mpz_ptr, mpz_srcptr));
-
-#define mpz_init_set_d __gmpz_init_set_d
- __GMP_DECLSPEC void mpz_init_set_d __GMP_PROTO ((mpz_ptr, double));
-
-#define mpz_init_set_si __gmpz_init_set_si
- __GMP_DECLSPEC void mpz_init_set_si __GMP_PROTO ((mpz_ptr, signed long int));
-
-#define mpz_init_set_str __gmpz_init_set_str
- __GMP_DECLSPEC int mpz_init_set_str __GMP_PROTO ((mpz_ptr, __gmp_const char *, int));
-
-#define mpz_init_set_ui __gmpz_init_set_ui
- __GMP_DECLSPEC void mpz_init_set_ui __GMP_PROTO ((mpz_ptr, unsigned long int));
-
-#define mpz_inp_raw __gmpz_inp_raw
-#ifdef _GMP_H_HAVE_FILE
- __GMP_DECLSPEC size_t mpz_inp_raw __GMP_PROTO ((mpz_ptr, FILE *));
-#endif
-
-#define mpz_inp_str __gmpz_inp_str
-#ifdef _GMP_H_HAVE_FILE
- __GMP_DECLSPEC size_t mpz_inp_str __GMP_PROTO ((mpz_ptr, FILE *, int));
-#endif
-
-#define mpz_invert __gmpz_invert
- __GMP_DECLSPEC int mpz_invert __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
-
-#define mpz_ior __gmpz_ior
- __GMP_DECLSPEC void mpz_ior __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
-
-#define mpz_jacobi __gmpz_jacobi
- __GMP_DECLSPEC int mpz_jacobi __GMP_PROTO ((mpz_srcptr, mpz_srcptr)) __GMP_ATTRIBUTE_PURE;
-
-#define mpz_kronecker mpz_jacobi /* alias */
-
-#define mpz_kronecker_si __gmpz_kronecker_si
- __GMP_DECLSPEC int mpz_kronecker_si __GMP_PROTO ((mpz_srcptr, long)) __GMP_ATTRIBUTE_PURE;
-
-#define mpz_kronecker_ui __gmpz_kronecker_ui
- __GMP_DECLSPEC int mpz_kronecker_ui __GMP_PROTO ((mpz_srcptr, unsigned long)) __GMP_ATTRIBUTE_PURE;
-
-#define mpz_si_kronecker __gmpz_si_kronecker
- __GMP_DECLSPEC int mpz_si_kronecker __GMP_PROTO ((long, mpz_srcptr)) __GMP_ATTRIBUTE_PURE;
-
-#define mpz_ui_kronecker __gmpz_ui_kronecker
- __GMP_DECLSPEC int mpz_ui_kronecker __GMP_PROTO ((unsigned long, mpz_srcptr)) __GMP_ATTRIBUTE_PURE;
-
-#define mpz_lcm __gmpz_lcm
- __GMP_DECLSPEC void mpz_lcm __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
-
-#define mpz_lcm_ui __gmpz_lcm_ui
- __GMP_DECLSPEC void mpz_lcm_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long));
-
-#define mpz_legendre mpz_jacobi /* alias */
-
-#define mpz_lucnum_ui __gmpz_lucnum_ui
- __GMP_DECLSPEC void mpz_lucnum_ui __GMP_PROTO ((mpz_ptr, unsigned long int));
-
-#define mpz_lucnum2_ui __gmpz_lucnum2_ui
- __GMP_DECLSPEC void mpz_lucnum2_ui __GMP_PROTO ((mpz_ptr, mpz_ptr, unsigned long int));
-
-#define mpz_millerrabin __gmpz_millerrabin
- __GMP_DECLSPEC int mpz_millerrabin __GMP_PROTO ((mpz_srcptr, int)) __GMP_ATTRIBUTE_PURE;
-
-#define mpz_mod __gmpz_mod
- __GMP_DECLSPEC void mpz_mod __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
-
-#define mpz_mod_ui mpz_fdiv_r_ui /* same as fdiv_r because divisor unsigned */
-
-#define mpz_mul __gmpz_mul
- __GMP_DECLSPEC void mpz_mul __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
-
-#define mpz_mul_2exp __gmpz_mul_2exp
- __GMP_DECLSPEC void mpz_mul_2exp __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
-
-#define mpz_mul_si __gmpz_mul_si
- __GMP_DECLSPEC void mpz_mul_si __GMP_PROTO ((mpz_ptr, mpz_srcptr, long int));
-
-#define mpz_mul_ui __gmpz_mul_ui
- __GMP_DECLSPEC void mpz_mul_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
-
-#define mpz_neg __gmpz_neg
-#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_neg)
- __GMP_DECLSPEC void mpz_neg __GMP_PROTO ((mpz_ptr, mpz_srcptr));
-#endif
-
-#define mpz_nextprime __gmpz_nextprime
- __GMP_DECLSPEC void mpz_nextprime __GMP_PROTO ((mpz_ptr, mpz_srcptr));
-
-#define mpz_out_raw __gmpz_out_raw
-#ifdef _GMP_H_HAVE_FILE
- __GMP_DECLSPEC size_t mpz_out_raw __GMP_PROTO ((FILE *, mpz_srcptr));
-#endif
-
-#define mpz_out_str __gmpz_out_str
-#ifdef _GMP_H_HAVE_FILE
- __GMP_DECLSPEC size_t mpz_out_str __GMP_PROTO ((FILE *, int, mpz_srcptr));
-#endif
-
-#define mpz_perfect_power_p __gmpz_perfect_power_p
- __GMP_DECLSPEC int mpz_perfect_power_p __GMP_PROTO ((mpz_srcptr)) __GMP_ATTRIBUTE_PURE;
-
-#define mpz_perfect_square_p __gmpz_perfect_square_p
-#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_perfect_square_p)
- __GMP_DECLSPEC int mpz_perfect_square_p __GMP_PROTO ((mpz_srcptr)) __GMP_ATTRIBUTE_PURE;
-#endif
-
-#define mpz_popcount __gmpz_popcount
-#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_popcount)
- __GMP_DECLSPEC unsigned long int mpz_popcount __GMP_PROTO ((mpz_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-#endif
-
-#define mpz_pow_ui __gmpz_pow_ui
- __GMP_DECLSPEC void mpz_pow_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
-
-#define mpz_powm __gmpz_powm
- __GMP_DECLSPEC void mpz_powm __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr, mpz_srcptr));
-
-#define mpz_powm_ui __gmpz_powm_ui
- __GMP_DECLSPEC void mpz_powm_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int, mpz_srcptr));
-
-#define mpz_probab_prime_p __gmpz_probab_prime_p
- __GMP_DECLSPEC int mpz_probab_prime_p __GMP_PROTO ((mpz_srcptr, int)) __GMP_ATTRIBUTE_PURE;
-
-#define mpz_random __gmpz_random
- __GMP_DECLSPEC void mpz_random __GMP_PROTO ((mpz_ptr, mp_size_t));
-
-#define mpz_random2 __gmpz_random2
- __GMP_DECLSPEC void mpz_random2 __GMP_PROTO ((mpz_ptr, mp_size_t));
-
-#define mpz_realloc2 __gmpz_realloc2
- __GMP_DECLSPEC void mpz_realloc2 __GMP_PROTO ((mpz_ptr, unsigned long));
-
-#define mpz_remove __gmpz_remove
- __GMP_DECLSPEC unsigned long int mpz_remove __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
-
-#define mpz_root __gmpz_root
- __GMP_DECLSPEC int mpz_root __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
-
-#define mpz_rootrem __gmpz_rootrem
- __GMP_DECLSPEC void mpz_rootrem __GMP_PROTO ((mpz_ptr,mpz_ptr, mpz_srcptr, unsigned long int));
-
-#define mpz_rrandomb __gmpz_rrandomb
- __GMP_DECLSPEC void mpz_rrandomb __GMP_PROTO ((mpz_ptr, gmp_randstate_t, unsigned long int));
-
-#define mpz_scan0 __gmpz_scan0
- __GMP_DECLSPEC unsigned long int mpz_scan0 __GMP_PROTO ((mpz_srcptr, unsigned long int)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpz_scan1 __gmpz_scan1
- __GMP_DECLSPEC unsigned long int mpz_scan1 __GMP_PROTO ((mpz_srcptr, unsigned long int)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpz_set __gmpz_set
- __GMP_DECLSPEC void mpz_set __GMP_PROTO ((mpz_ptr, mpz_srcptr));
-
-#define mpz_set_d __gmpz_set_d
- __GMP_DECLSPEC void mpz_set_d __GMP_PROTO ((mpz_ptr, double));
-
-#define mpz_set_f __gmpz_set_f
- __GMP_DECLSPEC void mpz_set_f __GMP_PROTO ((mpz_ptr, mpf_srcptr));
-
-#define mpz_set_q __gmpz_set_q
-#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_set_q)
- __GMP_DECLSPEC void mpz_set_q __GMP_PROTO ((mpz_ptr, mpq_srcptr));
-#endif
-
-#define mpz_set_si __gmpz_set_si
- __GMP_DECLSPEC void mpz_set_si __GMP_PROTO ((mpz_ptr, signed long int));
-
-#define mpz_set_str __gmpz_set_str
- __GMP_DECLSPEC int mpz_set_str __GMP_PROTO ((mpz_ptr, __gmp_const char *, int));
-
-#define mpz_set_ui __gmpz_set_ui
- __GMP_DECLSPEC void mpz_set_ui __GMP_PROTO ((mpz_ptr, unsigned long int));
-
-#define mpz_setbit __gmpz_setbit
- __GMP_DECLSPEC void mpz_setbit __GMP_PROTO ((mpz_ptr, unsigned long int));
-
-#define mpz_size __gmpz_size
-#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_size)
- __GMP_DECLSPEC size_t mpz_size __GMP_PROTO ((mpz_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-#endif
-
-#define mpz_sizeinbase __gmpz_sizeinbase
- __GMP_DECLSPEC size_t mpz_sizeinbase __GMP_PROTO ((mpz_srcptr, int)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpz_sqrt __gmpz_sqrt
- __GMP_DECLSPEC void mpz_sqrt __GMP_PROTO ((mpz_ptr, mpz_srcptr));
-
-#define mpz_sqrtrem __gmpz_sqrtrem
- __GMP_DECLSPEC void mpz_sqrtrem __GMP_PROTO ((mpz_ptr, mpz_ptr, mpz_srcptr));
-
-#define mpz_sub __gmpz_sub
- __GMP_DECLSPEC void mpz_sub __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
-
-#define mpz_sub_ui __gmpz_sub_ui
- __GMP_DECLSPEC void mpz_sub_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
-
-#define mpz_ui_sub __gmpz_ui_sub
- __GMP_DECLSPEC void mpz_ui_sub __GMP_PROTO ((mpz_ptr, unsigned long int, mpz_srcptr));
-
-#define mpz_submul __gmpz_submul
- __GMP_DECLSPEC void mpz_submul __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
-
-#define mpz_submul_ui __gmpz_submul_ui
- __GMP_DECLSPEC void mpz_submul_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
-
-#define mpz_swap __gmpz_swap
- __GMP_DECLSPEC void mpz_swap __GMP_PROTO ((mpz_ptr, mpz_ptr)) __GMP_NOTHROW;
-
-#define mpz_tdiv_ui __gmpz_tdiv_ui
- __GMP_DECLSPEC unsigned long int mpz_tdiv_ui __GMP_PROTO ((mpz_srcptr, unsigned long int)) __GMP_ATTRIBUTE_PURE;
-
-#define mpz_tdiv_q __gmpz_tdiv_q
- __GMP_DECLSPEC void mpz_tdiv_q __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
-
-#define mpz_tdiv_q_2exp __gmpz_tdiv_q_2exp
- __GMP_DECLSPEC void mpz_tdiv_q_2exp __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
-
-#define mpz_tdiv_q_ui __gmpz_tdiv_q_ui
- __GMP_DECLSPEC unsigned long int mpz_tdiv_q_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
-
-#define mpz_tdiv_qr __gmpz_tdiv_qr
- __GMP_DECLSPEC void mpz_tdiv_qr __GMP_PROTO ((mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr));
-
-#define mpz_tdiv_qr_ui __gmpz_tdiv_qr_ui
- __GMP_DECLSPEC unsigned long int mpz_tdiv_qr_ui __GMP_PROTO ((mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long int));
-
-#define mpz_tdiv_r __gmpz_tdiv_r
- __GMP_DECLSPEC void mpz_tdiv_r __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
-
-#define mpz_tdiv_r_2exp __gmpz_tdiv_r_2exp
- __GMP_DECLSPEC void mpz_tdiv_r_2exp __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
-
-#define mpz_tdiv_r_ui __gmpz_tdiv_r_ui
- __GMP_DECLSPEC unsigned long int mpz_tdiv_r_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
-
-#define mpz_tstbit __gmpz_tstbit
- __GMP_DECLSPEC int mpz_tstbit __GMP_PROTO ((mpz_srcptr, unsigned long int)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpz_ui_pow_ui __gmpz_ui_pow_ui
- __GMP_DECLSPEC void mpz_ui_pow_ui __GMP_PROTO ((mpz_ptr, unsigned long int, unsigned long int));
-
-#define mpz_urandomb __gmpz_urandomb
- __GMP_DECLSPEC void mpz_urandomb __GMP_PROTO ((mpz_ptr, gmp_randstate_t, unsigned long int));
-
-#define mpz_urandomm __gmpz_urandomm
- __GMP_DECLSPEC void mpz_urandomm __GMP_PROTO ((mpz_ptr, gmp_randstate_t, mpz_srcptr));
-
-#define mpz_xor __gmpz_xor
-#define mpz_eor __gmpz_xor
- __GMP_DECLSPEC void mpz_xor __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
-
-
- /**************** Rational (i.e. Q) routines. ****************/
-
-#define mpq_abs __gmpq_abs
-#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpq_abs)
- __GMP_DECLSPEC void mpq_abs __GMP_PROTO ((mpq_ptr, mpq_srcptr));
-#endif
-
-#define mpq_add __gmpq_add
- __GMP_DECLSPEC void mpq_add __GMP_PROTO ((mpq_ptr, mpq_srcptr, mpq_srcptr));
-
-#define mpq_canonicalize __gmpq_canonicalize
- __GMP_DECLSPEC void mpq_canonicalize __GMP_PROTO ((mpq_ptr));
-
-#define mpq_clear __gmpq_clear
- __GMP_DECLSPEC void mpq_clear __GMP_PROTO ((mpq_ptr));
-
-#define mpq_cmp __gmpq_cmp
- __GMP_DECLSPEC int mpq_cmp __GMP_PROTO ((mpq_srcptr, mpq_srcptr)) __GMP_ATTRIBUTE_PURE;
-
-#define _mpq_cmp_si __gmpq_cmp_si
- __GMP_DECLSPEC int _mpq_cmp_si __GMP_PROTO ((mpq_srcptr, long, unsigned long)) __GMP_ATTRIBUTE_PURE;
-
-#define _mpq_cmp_ui __gmpq_cmp_ui
- __GMP_DECLSPEC int _mpq_cmp_ui __GMP_PROTO ((mpq_srcptr, unsigned long int, unsigned long int)) __GMP_ATTRIBUTE_PURE;
-
-#define mpq_div __gmpq_div
- __GMP_DECLSPEC void mpq_div __GMP_PROTO ((mpq_ptr, mpq_srcptr, mpq_srcptr));
-
-#define mpq_div_2exp __gmpq_div_2exp
- __GMP_DECLSPEC void mpq_div_2exp __GMP_PROTO ((mpq_ptr, mpq_srcptr, unsigned long));
-
-#define mpq_equal __gmpq_equal
- __GMP_DECLSPEC int mpq_equal __GMP_PROTO ((mpq_srcptr, mpq_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpq_get_num __gmpq_get_num
- __GMP_DECLSPEC void mpq_get_num __GMP_PROTO ((mpz_ptr, mpq_srcptr));
-
-#define mpq_get_den __gmpq_get_den
- __GMP_DECLSPEC void mpq_get_den __GMP_PROTO ((mpz_ptr, mpq_srcptr));
-
-#define mpq_get_d __gmpq_get_d
- __GMP_DECLSPEC double mpq_get_d __GMP_PROTO ((mpq_srcptr)) __GMP_ATTRIBUTE_PURE;
-
-#define mpq_get_str __gmpq_get_str
- __GMP_DECLSPEC char *mpq_get_str __GMP_PROTO ((char *, int, mpq_srcptr));
-
-#define mpq_init __gmpq_init
- __GMP_DECLSPEC void mpq_init __GMP_PROTO ((mpq_ptr));
-
-#define mpq_inp_str __gmpq_inp_str
-#ifdef _GMP_H_HAVE_FILE
- __GMP_DECLSPEC size_t mpq_inp_str __GMP_PROTO ((mpq_ptr, FILE *, int));
-#endif
-
-#define mpq_inv __gmpq_inv
- __GMP_DECLSPEC void mpq_inv __GMP_PROTO ((mpq_ptr, mpq_srcptr));
-
-#define mpq_mul __gmpq_mul
- __GMP_DECLSPEC void mpq_mul __GMP_PROTO ((mpq_ptr, mpq_srcptr, mpq_srcptr));
-
-#define mpq_mul_2exp __gmpq_mul_2exp
- __GMP_DECLSPEC void mpq_mul_2exp __GMP_PROTO ((mpq_ptr, mpq_srcptr, unsigned long));
-
-#define mpq_neg __gmpq_neg
-#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpq_neg)
- __GMP_DECLSPEC void mpq_neg __GMP_PROTO ((mpq_ptr, mpq_srcptr));
-#endif
-
-#define mpq_out_str __gmpq_out_str
-#ifdef _GMP_H_HAVE_FILE
- __GMP_DECLSPEC size_t mpq_out_str __GMP_PROTO ((FILE *, int, mpq_srcptr));
-#endif
-
-#define mpq_set __gmpq_set
- __GMP_DECLSPEC void mpq_set __GMP_PROTO ((mpq_ptr, mpq_srcptr));
-
-#define mpq_set_d __gmpq_set_d
- __GMP_DECLSPEC void mpq_set_d __GMP_PROTO ((mpq_ptr, double));
-
-#define mpq_set_den __gmpq_set_den
- __GMP_DECLSPEC void mpq_set_den __GMP_PROTO ((mpq_ptr, mpz_srcptr));
-
-#define mpq_set_f __gmpq_set_f
- __GMP_DECLSPEC void mpq_set_f __GMP_PROTO ((mpq_ptr, mpf_srcptr));
-
-#define mpq_set_num __gmpq_set_num
- __GMP_DECLSPEC void mpq_set_num __GMP_PROTO ((mpq_ptr, mpz_srcptr));
-
-#define mpq_set_si __gmpq_set_si
- __GMP_DECLSPEC void mpq_set_si __GMP_PROTO ((mpq_ptr, signed long int, unsigned long int));
-
-#define mpq_set_str __gmpq_set_str
- __GMP_DECLSPEC int mpq_set_str __GMP_PROTO ((mpq_ptr, __gmp_const char *, int));
-
-#define mpq_set_ui __gmpq_set_ui
- __GMP_DECLSPEC void mpq_set_ui __GMP_PROTO ((mpq_ptr, unsigned long int, unsigned long int));
-
-#define mpq_set_z __gmpq_set_z
- __GMP_DECLSPEC void mpq_set_z __GMP_PROTO ((mpq_ptr, mpz_srcptr));
-
-#define mpq_sub __gmpq_sub
- __GMP_DECLSPEC void mpq_sub __GMP_PROTO ((mpq_ptr, mpq_srcptr, mpq_srcptr));
-
-#define mpq_swap __gmpq_swap
- __GMP_DECLSPEC void mpq_swap __GMP_PROTO ((mpq_ptr, mpq_ptr)) __GMP_NOTHROW;
-
-
- /**************** Float (i.e. F) routines. ****************/
-
-#define mpf_abs __gmpf_abs
- __GMP_DECLSPEC void mpf_abs __GMP_PROTO ((mpf_ptr, mpf_srcptr));
-
-#define mpf_add __gmpf_add
- __GMP_DECLSPEC void mpf_add __GMP_PROTO ((mpf_ptr, mpf_srcptr, mpf_srcptr));
-
-#define mpf_add_ui __gmpf_add_ui
- __GMP_DECLSPEC void mpf_add_ui __GMP_PROTO ((mpf_ptr, mpf_srcptr, unsigned long int));
-#define mpf_ceil __gmpf_ceil
- __GMP_DECLSPEC void mpf_ceil __GMP_PROTO ((mpf_ptr, mpf_srcptr));
-
-#define mpf_clear __gmpf_clear
- __GMP_DECLSPEC void mpf_clear __GMP_PROTO ((mpf_ptr));
-
-#define mpf_cmp __gmpf_cmp
- __GMP_DECLSPEC int mpf_cmp __GMP_PROTO ((mpf_srcptr, mpf_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpf_cmp_d __gmpf_cmp_d
- __GMP_DECLSPEC int mpf_cmp_d __GMP_PROTO ((mpf_srcptr, double)) __GMP_ATTRIBUTE_PURE;
-
-#define mpf_cmp_si __gmpf_cmp_si
- __GMP_DECLSPEC int mpf_cmp_si __GMP_PROTO ((mpf_srcptr, signed long int)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpf_cmp_ui __gmpf_cmp_ui
- __GMP_DECLSPEC int mpf_cmp_ui __GMP_PROTO ((mpf_srcptr, unsigned long int)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpf_div __gmpf_div
- __GMP_DECLSPEC void mpf_div __GMP_PROTO ((mpf_ptr, mpf_srcptr, mpf_srcptr));
-
-#define mpf_div_2exp __gmpf_div_2exp
- __GMP_DECLSPEC void mpf_div_2exp __GMP_PROTO ((mpf_ptr, mpf_srcptr, unsigned long int));
-
-#define mpf_div_ui __gmpf_div_ui
- __GMP_DECLSPEC void mpf_div_ui __GMP_PROTO ((mpf_ptr, mpf_srcptr, unsigned long int));
-
-#define mpf_dump __gmpf_dump
- __GMP_DECLSPEC void mpf_dump __GMP_PROTO ((mpf_srcptr));
-
-#define mpf_eq __gmpf_eq
- __GMP_DECLSPEC int mpf_eq __GMP_PROTO ((mpf_srcptr, mpf_srcptr, unsigned long int)) __GMP_ATTRIBUTE_PURE;
-
-#define mpf_fits_sint_p __gmpf_fits_sint_p
- __GMP_DECLSPEC int mpf_fits_sint_p __GMP_PROTO ((mpf_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpf_fits_slong_p __gmpf_fits_slong_p
- __GMP_DECLSPEC int mpf_fits_slong_p __GMP_PROTO ((mpf_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpf_fits_sshort_p __gmpf_fits_sshort_p
- __GMP_DECLSPEC int mpf_fits_sshort_p __GMP_PROTO ((mpf_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpf_fits_uint_p __gmpf_fits_uint_p
- __GMP_DECLSPEC int mpf_fits_uint_p __GMP_PROTO ((mpf_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpf_fits_ulong_p __gmpf_fits_ulong_p
- __GMP_DECLSPEC int mpf_fits_ulong_p __GMP_PROTO ((mpf_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpf_fits_ushort_p __gmpf_fits_ushort_p
- __GMP_DECLSPEC int mpf_fits_ushort_p __GMP_PROTO ((mpf_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpf_floor __gmpf_floor
- __GMP_DECLSPEC void mpf_floor __GMP_PROTO ((mpf_ptr, mpf_srcptr));
-
-#define mpf_get_d __gmpf_get_d
- __GMP_DECLSPEC double mpf_get_d __GMP_PROTO ((mpf_srcptr)) __GMP_ATTRIBUTE_PURE;
-
-#define mpf_get_d_2exp __gmpf_get_d_2exp
- __GMP_DECLSPEC double mpf_get_d_2exp __GMP_PROTO ((signed long int *, mpf_srcptr));
-
-#define mpf_get_default_prec __gmpf_get_default_prec
- __GMP_DECLSPEC unsigned long int mpf_get_default_prec __GMP_PROTO ((void)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpf_get_prec __gmpf_get_prec
- __GMP_DECLSPEC unsigned long int mpf_get_prec __GMP_PROTO ((mpf_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpf_get_si __gmpf_get_si
- __GMP_DECLSPEC long mpf_get_si __GMP_PROTO ((mpf_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpf_get_str __gmpf_get_str
- __GMP_DECLSPEC char *mpf_get_str __GMP_PROTO ((char *, mp_exp_t *, int, size_t, mpf_srcptr));
-
-#define mpf_get_ui __gmpf_get_ui
- __GMP_DECLSPEC unsigned long mpf_get_ui __GMP_PROTO ((mpf_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpf_init __gmpf_init
- __GMP_DECLSPEC void mpf_init __GMP_PROTO ((mpf_ptr));
-
-#define mpf_init2 __gmpf_init2
- __GMP_DECLSPEC void mpf_init2 __GMP_PROTO ((mpf_ptr, unsigned long int));
-
-#define mpf_init_set __gmpf_init_set
- __GMP_DECLSPEC void mpf_init_set __GMP_PROTO ((mpf_ptr, mpf_srcptr));
-
-#define mpf_init_set_d __gmpf_init_set_d
- __GMP_DECLSPEC void mpf_init_set_d __GMP_PROTO ((mpf_ptr, double));
-
-#define mpf_init_set_si __gmpf_init_set_si
- __GMP_DECLSPEC void mpf_init_set_si __GMP_PROTO ((mpf_ptr, signed long int));
-
-#define mpf_init_set_str __gmpf_init_set_str
- __GMP_DECLSPEC int mpf_init_set_str __GMP_PROTO ((mpf_ptr, __gmp_const char *, int));
-
-#define mpf_init_set_ui __gmpf_init_set_ui
- __GMP_DECLSPEC void mpf_init_set_ui __GMP_PROTO ((mpf_ptr, unsigned long int));
-
-#define mpf_inp_str __gmpf_inp_str
-#ifdef _GMP_H_HAVE_FILE
- __GMP_DECLSPEC size_t mpf_inp_str __GMP_PROTO ((mpf_ptr, FILE *, int));
-#endif
-
-#define mpf_integer_p __gmpf_integer_p
- __GMP_DECLSPEC int mpf_integer_p __GMP_PROTO ((mpf_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpf_mul __gmpf_mul
- __GMP_DECLSPEC void mpf_mul __GMP_PROTO ((mpf_ptr, mpf_srcptr, mpf_srcptr));
-
-#define mpf_mul_2exp __gmpf_mul_2exp
- __GMP_DECLSPEC void mpf_mul_2exp __GMP_PROTO ((mpf_ptr, mpf_srcptr, unsigned long int));
-
-#define mpf_mul_ui __gmpf_mul_ui
- __GMP_DECLSPEC void mpf_mul_ui __GMP_PROTO ((mpf_ptr, mpf_srcptr, unsigned long int));
-
-#define mpf_neg __gmpf_neg
- __GMP_DECLSPEC void mpf_neg __GMP_PROTO ((mpf_ptr, mpf_srcptr));
-
-#define mpf_out_str __gmpf_out_str
-#ifdef _GMP_H_HAVE_FILE
- __GMP_DECLSPEC size_t mpf_out_str __GMP_PROTO ((FILE *, int, size_t, mpf_srcptr));
-#endif
-
-#define mpf_pow_ui __gmpf_pow_ui
- __GMP_DECLSPEC void mpf_pow_ui __GMP_PROTO ((mpf_ptr, mpf_srcptr, unsigned long int));
-
-#define mpf_random2 __gmpf_random2
- __GMP_DECLSPEC void mpf_random2 __GMP_PROTO ((mpf_ptr, mp_size_t, mp_exp_t));
-
-#define mpf_reldiff __gmpf_reldiff
- __GMP_DECLSPEC void mpf_reldiff __GMP_PROTO ((mpf_ptr, mpf_srcptr, mpf_srcptr));
-
-#define mpf_set __gmpf_set
- __GMP_DECLSPEC void mpf_set __GMP_PROTO ((mpf_ptr, mpf_srcptr));
-
-#define mpf_set_d __gmpf_set_d
- __GMP_DECLSPEC void mpf_set_d __GMP_PROTO ((mpf_ptr, double));
-
-#define mpf_set_default_prec __gmpf_set_default_prec
- __GMP_DECLSPEC void mpf_set_default_prec __GMP_PROTO ((unsigned long int)) __GMP_NOTHROW;
-
-#define mpf_set_prec __gmpf_set_prec
- __GMP_DECLSPEC void mpf_set_prec __GMP_PROTO ((mpf_ptr, unsigned long int));
-
-#define mpf_set_prec_raw __gmpf_set_prec_raw
- __GMP_DECLSPEC void mpf_set_prec_raw __GMP_PROTO ((mpf_ptr, unsigned long int)) __GMP_NOTHROW;
-
-#define mpf_set_q __gmpf_set_q
- __GMP_DECLSPEC void mpf_set_q __GMP_PROTO ((mpf_ptr, mpq_srcptr));
-
-#define mpf_set_si __gmpf_set_si
- __GMP_DECLSPEC void mpf_set_si __GMP_PROTO ((mpf_ptr, signed long int));
-
-#define mpf_set_str __gmpf_set_str
- __GMP_DECLSPEC int mpf_set_str __GMP_PROTO ((mpf_ptr, __gmp_const char *, int));
-
-#define mpf_set_ui __gmpf_set_ui
- __GMP_DECLSPEC void mpf_set_ui __GMP_PROTO ((mpf_ptr, unsigned long int));
-
-#define mpf_set_z __gmpf_set_z
- __GMP_DECLSPEC void mpf_set_z __GMP_PROTO ((mpf_ptr, mpz_srcptr));
-
-#define mpf_size __gmpf_size
- __GMP_DECLSPEC size_t mpf_size __GMP_PROTO ((mpf_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpf_sqrt __gmpf_sqrt
- __GMP_DECLSPEC void mpf_sqrt __GMP_PROTO ((mpf_ptr, mpf_srcptr));
-
-#define mpf_sqrt_ui __gmpf_sqrt_ui
- __GMP_DECLSPEC void mpf_sqrt_ui __GMP_PROTO ((mpf_ptr, unsigned long int));
-
-#define mpf_sub __gmpf_sub
- __GMP_DECLSPEC void mpf_sub __GMP_PROTO ((mpf_ptr, mpf_srcptr, mpf_srcptr));
-
-#define mpf_sub_ui __gmpf_sub_ui
- __GMP_DECLSPEC void mpf_sub_ui __GMP_PROTO ((mpf_ptr, mpf_srcptr, unsigned long int));
-
-#define mpf_swap __gmpf_swap
- __GMP_DECLSPEC void mpf_swap __GMP_PROTO ((mpf_ptr, mpf_ptr)) __GMP_NOTHROW;
-
-#define mpf_trunc __gmpf_trunc
- __GMP_DECLSPEC void mpf_trunc __GMP_PROTO ((mpf_ptr, mpf_srcptr));
-
-#define mpf_ui_div __gmpf_ui_div
- __GMP_DECLSPEC void mpf_ui_div __GMP_PROTO ((mpf_ptr, unsigned long int, mpf_srcptr));
-
-#define mpf_ui_sub __gmpf_ui_sub
- __GMP_DECLSPEC void mpf_ui_sub __GMP_PROTO ((mpf_ptr, unsigned long int, mpf_srcptr));
-
-#define mpf_urandomb __gmpf_urandomb
- __GMP_DECLSPEC void mpf_urandomb __GMP_PROTO ((mpf_t, gmp_randstate_t, unsigned long int));
-
-
- /************ Low level positive-integer (i.e. N) routines. ************/
-
- /* This is ugly, but we need to make user calls reach the prefixed function. */
-
-#define mpn_add __MPN(add)
-#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_add)
- __GMP_DECLSPEC mp_limb_t mpn_add __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr,mp_size_t));
-#endif
-
-#define mpn_add_1 __MPN(add_1)
-#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_add_1)
- __GMP_DECLSPEC mp_limb_t mpn_add_1 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t)) __GMP_NOTHROW;
-#endif
-
-#define mpn_add_n __MPN(add_n)
- __GMP_DECLSPEC mp_limb_t mpn_add_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
-
-#define mpn_addmul_1 __MPN(addmul_1)
- __GMP_DECLSPEC mp_limb_t mpn_addmul_1 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t));
-
-#define mpn_bdivmod __MPN(bdivmod)
- __GMP_DECLSPEC mp_limb_t mpn_bdivmod __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, unsigned long int));
-
-#define mpn_cmp __MPN(cmp)
-#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_cmp)
- __GMP_DECLSPEC int mpn_cmp __GMP_PROTO ((mp_srcptr, mp_srcptr, mp_size_t)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-#endif
-
-#define mpn_divexact_by3(dst,src,size) \
- mpn_divexact_by3c (dst, src, size, __GMP_CAST (mp_limb_t, 0))
-
-#define mpn_divexact_by3c __MPN(divexact_by3c)
- __GMP_DECLSPEC mp_limb_t mpn_divexact_by3c __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t));
-
-#define mpn_divmod_1(qp,np,nsize,dlimb) \
- mpn_divrem_1 (qp, __GMP_CAST (mp_size_t, 0), np, nsize, dlimb)
-
-#define mpn_divrem __MPN(divrem)
- __GMP_DECLSPEC mp_limb_t mpn_divrem __GMP_PROTO ((mp_ptr, mp_size_t, mp_ptr, mp_size_t, mp_srcptr, mp_size_t));
-
-#define mpn_divrem_1 __MPN(divrem_1)
- __GMP_DECLSPEC mp_limb_t mpn_divrem_1 __GMP_PROTO ((mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t));
-
-#define mpn_divrem_2 __MPN(divrem_2)
- __GMP_DECLSPEC mp_limb_t mpn_divrem_2 __GMP_PROTO ((mp_ptr, mp_size_t, mp_ptr, mp_size_t, mp_srcptr));
-
-#define mpn_gcd __MPN(gcd)
- __GMP_DECLSPEC mp_size_t mpn_gcd __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_ptr, mp_size_t));
-
-#define mpn_gcd_1 __MPN(gcd_1)
- __GMP_DECLSPEC mp_limb_t mpn_gcd_1 __GMP_PROTO ((mp_srcptr, mp_size_t, mp_limb_t)) __GMP_ATTRIBUTE_PURE;
-
-#define mpn_gcdext __MPN(gcdext)
- __GMP_DECLSPEC mp_size_t mpn_gcdext __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t *, mp_ptr, mp_size_t, mp_ptr, mp_size_t));
-
-#define mpn_get_str __MPN(get_str)
- __GMP_DECLSPEC size_t mpn_get_str __GMP_PROTO ((unsigned char *, int, mp_ptr, mp_size_t));
-
-#define mpn_hamdist __MPN(hamdist)
- __GMP_DECLSPEC unsigned long int mpn_hamdist __GMP_PROTO ((mp_srcptr, mp_srcptr, mp_size_t)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpn_lshift __MPN(lshift)
- __GMP_DECLSPEC mp_limb_t mpn_lshift __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, unsigned int));
-
-#define mpn_mod_1 __MPN(mod_1)
- __GMP_DECLSPEC mp_limb_t mpn_mod_1 __GMP_PROTO ((mp_srcptr, mp_size_t, mp_limb_t)) __GMP_ATTRIBUTE_PURE;
-
-#define mpn_mul __MPN(mul)
- __GMP_DECLSPEC mp_limb_t mpn_mul __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t));
-
-#define mpn_mul_1 __MPN(mul_1)
- __GMP_DECLSPEC mp_limb_t mpn_mul_1 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t));
-
-#define mpn_mul_n __MPN(mul_n)
- __GMP_DECLSPEC void mpn_mul_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
-
-#define mpn_perfect_square_p __MPN(perfect_square_p)
- __GMP_DECLSPEC int mpn_perfect_square_p __GMP_PROTO ((mp_srcptr, mp_size_t)) __GMP_ATTRIBUTE_PURE;
-
-#define mpn_popcount __MPN(popcount)
- __GMP_DECLSPEC unsigned long int mpn_popcount __GMP_PROTO ((mp_srcptr, mp_size_t)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
-
-#define mpn_pow_1 __MPN(pow_1)
- __GMP_DECLSPEC mp_size_t mpn_pow_1 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_ptr));
-
- /* undocumented now, but retained here for upward compatibility */
-#define mpn_preinv_mod_1 __MPN(preinv_mod_1)
- __GMP_DECLSPEC mp_limb_t mpn_preinv_mod_1 __GMP_PROTO ((mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t)) __GMP_ATTRIBUTE_PURE;
-
-#define mpn_random __MPN(random)
- __GMP_DECLSPEC void mpn_random __GMP_PROTO ((mp_ptr, mp_size_t));
-
-#define mpn_random2 __MPN(random2)
- __GMP_DECLSPEC void mpn_random2 __GMP_PROTO ((mp_ptr, mp_size_t));
-
-#define mpn_rshift __MPN(rshift)
- __GMP_DECLSPEC mp_limb_t mpn_rshift __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, unsigned int));
-
-#define mpn_scan0 __MPN(scan0)
- __GMP_DECLSPEC unsigned long int mpn_scan0 __GMP_PROTO ((mp_srcptr, unsigned long int)) __GMP_ATTRIBUTE_PURE;
-
-#define mpn_scan1 __MPN(scan1)
- __GMP_DECLSPEC unsigned long int mpn_scan1 __GMP_PROTO ((mp_srcptr, unsigned long int)) __GMP_ATTRIBUTE_PURE;
-
-#define mpn_set_str __MPN(set_str)
- __GMP_DECLSPEC mp_size_t mpn_set_str __GMP_PROTO ((mp_ptr, __gmp_const unsigned char *, size_t, int));
-
-#define mpn_sqrtrem __MPN(sqrtrem)
- __GMP_DECLSPEC mp_size_t mpn_sqrtrem __GMP_PROTO ((mp_ptr, mp_ptr, mp_srcptr, mp_size_t));
-
-#define mpn_sub __MPN(sub)
-#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_sub)
- __GMP_DECLSPEC mp_limb_t mpn_sub __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr,mp_size_t));
-#endif
-
-#define mpn_sub_1 __MPN(sub_1)
-#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_sub_1)
- __GMP_DECLSPEC mp_limb_t mpn_sub_1 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t)) __GMP_NOTHROW;
-#endif
-
-#define mpn_sub_n __MPN(sub_n)
- __GMP_DECLSPEC mp_limb_t mpn_sub_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
-
-#define mpn_submul_1 __MPN(submul_1)
- __GMP_DECLSPEC mp_limb_t mpn_submul_1 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t));
-
-#define mpn_tdiv_qr __MPN(tdiv_qr)
- __GMP_DECLSPEC void mpn_tdiv_qr __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t));
-
-
- /**************** mpz inlines ****************/
-
- /* The following are provided as inlines where possible, but always exist as
- library functions too, for binary compatibility.
-
- Within gmp itself this inlining generally isn't relied on, since it
- doesn't get done for all compilers, whereas if something is worth
- inlining then it's worth arranging always.
-
- There are two styles of inlining here. When the same bit of code is
- wanted for the inline as for the library version, then __GMP_FORCE_foo
- arranges for that code to be emitted and the __GMP_EXTERN_INLINE
- directive suppressed, eg. mpz_fits_uint_p. When a different bit of code
- is wanted for the inline than for the library version, then
- __GMP_FORCE_foo arranges the inline to be suppressed, eg. mpz_abs. */
-
-#if defined (__GMP_EXTERN_INLINE) && ! defined (__GMP_FORCE_mpz_abs)
- __GMP_EXTERN_INLINE void
- mpz_abs (mpz_ptr __gmp_w, mpz_srcptr __gmp_u)
- {
- if (__gmp_w != __gmp_u)
- mpz_set (__gmp_w, __gmp_u);
- __gmp_w->_mp_size = __GMP_ABS (__gmp_w->_mp_size);
- }
-#endif
-
-#if GMP_NAIL_BITS == 0
-#define __GMPZ_FITS_UTYPE_P(z,maxval) \
- mp_size_t __gmp_n = z->_mp_size; \
- mp_ptr __gmp_p = z->_mp_d; \
- return (__gmp_n == 0 || (__gmp_n == 1 && __gmp_p[0] <= maxval));
-#else
-#define __GMPZ_FITS_UTYPE_P(z,maxval) \
- mp_size_t __gmp_n = z->_mp_size; \
- mp_ptr __gmp_p = z->_mp_d; \
- return (__gmp_n == 0 || (__gmp_n == 1 && __gmp_p[0] <= maxval) \
- || (__gmp_n == 2 && __gmp_p[1] <= ((mp_limb_t) maxval >> GMP_NUMB_BITS)));
-#endif
-
-#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_fits_uint_p)
-#if ! defined (__GMP_FORCE_mpz_fits_uint_p)
- __GMP_EXTERN_INLINE
-#endif
- int
- mpz_fits_uint_p (mpz_srcptr __gmp_z) __GMP_NOTHROW
- {
- __GMPZ_FITS_UTYPE_P (__gmp_z, __GMP_UINT_MAX);
- }
-#endif
-
-#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_fits_ulong_p)
-#if ! defined (__GMP_FORCE_mpz_fits_ulong_p)
- __GMP_EXTERN_INLINE
-#endif
- int
- mpz_fits_ulong_p (mpz_srcptr __gmp_z) __GMP_NOTHROW
- {
- __GMPZ_FITS_UTYPE_P (__gmp_z, __GMP_ULONG_MAX);
- }
-#endif
-
-#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_fits_ushort_p)
-#if ! defined (__GMP_FORCE_mpz_fits_ushort_p)
- __GMP_EXTERN_INLINE
-#endif
- int
- mpz_fits_ushort_p (mpz_srcptr __gmp_z) __GMP_NOTHROW
- {
- __GMPZ_FITS_UTYPE_P (__gmp_z, __GMP_USHRT_MAX);
- }
-#endif
-
-#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_get_ui)
-#if ! defined (__GMP_FORCE_mpz_get_ui)
- __GMP_EXTERN_INLINE
-#endif
- unsigned long
- mpz_get_ui (mpz_srcptr __gmp_z) __GMP_NOTHROW
- {
- mp_ptr __gmp_p = __gmp_z->_mp_d;
- mp_size_t __gmp_n = __gmp_z->_mp_size;
- mp_limb_t __gmp_l = __gmp_p[0];
- /* This is a "#if" rather than a plain "if" so as to avoid gcc warnings
- about "<< GMP_NUMB_BITS" exceeding the type size, and to avoid Borland
- C++ 6.0 warnings about condition always true for something like
- "__GMP_ULONG_MAX < GMP_NUMB_MASK". */
-#if GMP_NAIL_BITS == 0 || defined (_LONG_LONG_LIMB)
- /* limb==long and no nails, or limb==longlong, one limb is enough */
- return (__gmp_n != 0 ? __gmp_l : 0);
-#else
- /* limb==long and nails, need two limbs when available */
- __gmp_n = __GMP_ABS (__gmp_n);
- if (__gmp_n <= 1)
- return (__gmp_n != 0 ? __gmp_l : 0);
- else
- return __gmp_l + (__gmp_p[1] << GMP_NUMB_BITS);
-#endif
- }
-#endif
-
-#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_getlimbn)
-#if ! defined (__GMP_FORCE_mpz_getlimbn)
- __GMP_EXTERN_INLINE
-#endif
- mp_limb_t
- mpz_getlimbn (mpz_srcptr __gmp_z, mp_size_t __gmp_n) __GMP_NOTHROW
- {
- mp_limb_t __gmp_result = 0;
- if (__GMP_LIKELY (__gmp_n >= 0 && __gmp_n < __GMP_ABS (__gmp_z->_mp_size)))
- __gmp_result = __gmp_z->_mp_d[__gmp_n];
- return __gmp_result;
- }
-#endif
-
-#if defined (__GMP_EXTERN_INLINE) && ! defined (__GMP_FORCE_mpz_neg)
- __GMP_EXTERN_INLINE void
- mpz_neg (mpz_ptr __gmp_w, mpz_srcptr __gmp_u)
- {
- if (__gmp_w != __gmp_u)
- mpz_set (__gmp_w, __gmp_u);
- __gmp_w->_mp_size = - __gmp_w->_mp_size;
- }
-#endif
-
-#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_perfect_square_p)
-#if ! defined (__GMP_FORCE_mpz_perfect_square_p)
- __GMP_EXTERN_INLINE
-#endif
- int
- mpz_perfect_square_p (mpz_srcptr __gmp_a)
- {
- mp_size_t __gmp_asize;
- int __gmp_result;
-
- __gmp_asize = __gmp_a->_mp_size;
- __gmp_result = (__gmp_asize >= 0); /* zero is a square, negatives are not */
- if (__GMP_LIKELY (__gmp_asize > 0))
- __gmp_result = mpn_perfect_square_p (__gmp_a->_mp_d, __gmp_asize);
- return __gmp_result;
- }
-#endif
-
-#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_popcount)
-#if ! defined (__GMP_FORCE_mpz_popcount)
- __GMP_EXTERN_INLINE
-#endif
- unsigned long
- mpz_popcount (mpz_srcptr __gmp_u) __GMP_NOTHROW
- {
- mp_size_t __gmp_usize;
- unsigned long __gmp_result;
-
- __gmp_usize = __gmp_u->_mp_size;
- __gmp_result = (__gmp_usize < 0 ? __GMP_ULONG_MAX : 0);
- if (__GMP_LIKELY (__gmp_usize > 0))
- __gmp_result = mpn_popcount (__gmp_u->_mp_d, __gmp_usize);
- return __gmp_result;
- }
-#endif
-
-#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_set_q)
-#if ! defined (__GMP_FORCE_mpz_set_q)
- __GMP_EXTERN_INLINE
-#endif
- void
- mpz_set_q (mpz_ptr __gmp_w, mpq_srcptr __gmp_u)
- {
- mpz_tdiv_q (__gmp_w, mpq_numref (__gmp_u), mpq_denref (__gmp_u));
- }
-#endif
-
-#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpz_size)
-#if ! defined (__GMP_FORCE_mpz_size)
- __GMP_EXTERN_INLINE
-#endif
- size_t
- mpz_size (mpz_srcptr __gmp_z) __GMP_NOTHROW
- {
- return __GMP_ABS (__gmp_z->_mp_size);
- }
-#endif
-
-
- /**************** mpq inlines ****************/
-
-#if defined (__GMP_EXTERN_INLINE) && ! defined (__GMP_FORCE_mpq_abs)
- __GMP_EXTERN_INLINE void
- mpq_abs (mpq_ptr __gmp_w, mpq_srcptr __gmp_u)
- {
- if (__gmp_w != __gmp_u)
- mpq_set (__gmp_w, __gmp_u);
- __gmp_w->_mp_num._mp_size = __GMP_ABS (__gmp_w->_mp_num._mp_size);
- }
-#endif
-
-#if defined (__GMP_EXTERN_INLINE) && ! defined (__GMP_FORCE_mpq_neg)
- __GMP_EXTERN_INLINE void
- mpq_neg (mpq_ptr __gmp_w, mpq_srcptr __gmp_u)
- {
- if (__gmp_w != __gmp_u)
- mpq_set (__gmp_w, __gmp_u);
- __gmp_w->_mp_num._mp_size = - __gmp_w->_mp_num._mp_size;
- }
-#endif
-
-
- /**************** mpn inlines ****************/
-
- /* The comments with __GMPN_ADD_1 below apply here too.
-
- The test for FUNCTION returning 0 should predict well. If it's assumed
- {yp,ysize} will usually have a random number of bits then the high limb
- won't be full and a carry out will occur a good deal less than 50% of the
- time.
-
- ysize==0 isn't a documented feature, but is used internally in a few
- places.
-
- Producing cout last stops it using up a register during the main part of
- the calculation, though gcc (as of 3.0) on an "if (mpn_add (...))"
- doesn't seem able to move the true and false legs of the conditional up
- to the two places cout is generated. */
-
-#define __GMPN_AORS(cout, wp, xp, xsize, yp, ysize, FUNCTION, TEST) \
- do { \
- mp_size_t __gmp_i; \
- mp_limb_t __gmp_x; \
- \
- /* ASSERT ((ysize) >= 0); */ \
- /* ASSERT ((xsize) >= (ysize)); */ \
- /* ASSERT (MPN_SAME_OR_SEPARATE2_P (wp, xsize, xp, xsize)); */ \
- /* ASSERT (MPN_SAME_OR_SEPARATE2_P (wp, xsize, yp, ysize)); */ \
- \
- __gmp_i = (ysize); \
- if (__gmp_i != 0) \
- { \
- if (FUNCTION (wp, xp, yp, __gmp_i)) \
- { \
- do \
- { \
- if (__gmp_i >= (xsize)) \
- { \
- (cout) = 1; \
- goto __gmp_done; \
- } \
- __gmp_x = (xp)[__gmp_i]; \
- } \
- while (TEST); \
- } \
- } \
- if ((wp) != (xp)) \
- __GMPN_COPY_REST (wp, xp, xsize, __gmp_i); \
- (cout) = 0; \
- __gmp_done: \
- ; \
- } while (0)
-
-#define __GMPN_ADD(cout, wp, xp, xsize, yp, ysize) \
- __GMPN_AORS (cout, wp, xp, xsize, yp, ysize, mpn_add_n, \
- (((wp)[__gmp_i++] = (__gmp_x + 1) & GMP_NUMB_MASK) == 0))
-#define __GMPN_SUB(cout, wp, xp, xsize, yp, ysize) \
- __GMPN_AORS (cout, wp, xp, xsize, yp, ysize, mpn_sub_n, \
- (((wp)[__gmp_i++] = (__gmp_x - 1) & GMP_NUMB_MASK), __gmp_x == 0))
-
-
- /* The use of __gmp_i indexing is designed to ensure a compile time src==dst
- remains nice and clear to the compiler, so that __GMPN_COPY_REST can
- disappear, and the load/add/store gets a chance to become a
- read-modify-write on CISC CPUs.
-
- Alternatives:
-
- Using a pair of pointers instead of indexing would be possible, but gcc
- isn't able to recognise compile-time src==dst in that case, even when the
- pointers are incremented more or less together. Other compilers would
- very likely have similar difficulty.
-
- gcc could use "if (__builtin_constant_p(src==dst) && src==dst)" or
- similar to detect a compile-time src==dst. This works nicely on gcc
- 2.95.x, it's not good on gcc 3.0 where __builtin_constant_p(p==p) seems
- to be always false, for a pointer p. But the current code form seems
- good enough for src==dst anyway.
-
- gcc on x86 as usual doesn't give particularly good flags handling for the
- carry/borrow detection. It's tempting to want some multi instruction asm
- blocks to help it, and this was tried, but in truth there's only a few
- instructions to save and any gain is all too easily lost by register
- juggling setting up for the asm. */
-
-#if GMP_NAIL_BITS == 0
-#define __GMPN_AORS_1(cout, dst, src, n, v, OP, CB) \
- do { \
- mp_size_t __gmp_i; \
- mp_limb_t __gmp_x, __gmp_r; \
- \
- /* ASSERT ((n) >= 1); */ \
- /* ASSERT (MPN_SAME_OR_SEPARATE_P (dst, src, n)); */ \
- \
- __gmp_x = (src)[0]; \
- __gmp_r = __gmp_x OP (v); \
- (dst)[0] = __gmp_r; \
- if (CB (__gmp_r, __gmp_x, (v))) \
- { \
- (cout) = 1; \
- for (__gmp_i = 1; __gmp_i < (n);) \
- { \
- __gmp_x = (src)[__gmp_i]; \
- __gmp_r = __gmp_x OP 1; \
- (dst)[__gmp_i] = __gmp_r; \
- ++__gmp_i; \
- if (!CB (__gmp_r, __gmp_x, 1)) \
- { \
- if ((src) != (dst)) \
- __GMPN_COPY_REST (dst, src, n, __gmp_i); \
- (cout) = 0; \
- break; \
- } \
- } \
- } \
- else \
- { \
- if ((src) != (dst)) \
- __GMPN_COPY_REST (dst, src, n, 1); \
- (cout) = 0; \
- } \
- } while (0)
-#endif
-
-#if GMP_NAIL_BITS >= 1
-#define __GMPN_AORS_1(cout, dst, src, n, v, OP, CB) \
- do { \
- mp_size_t __gmp_i; \
- mp_limb_t __gmp_x, __gmp_r; \
- \
- /* ASSERT ((n) >= 1); */ \
- /* ASSERT (MPN_SAME_OR_SEPARATE_P (dst, src, n)); */ \
- \
- __gmp_x = (src)[0]; \
- __gmp_r = __gmp_x OP (v); \
- (dst)[0] = __gmp_r & GMP_NUMB_MASK; \
- if (__gmp_r >> GMP_NUMB_BITS != 0) \
- { \
- (cout) = 1; \
- for (__gmp_i = 1; __gmp_i < (n);) \
- { \
- __gmp_x = (src)[__gmp_i]; \
- __gmp_r = __gmp_x OP 1; \
- (dst)[__gmp_i] = __gmp_r & GMP_NUMB_MASK; \
- ++__gmp_i; \
- if (__gmp_r >> GMP_NUMB_BITS == 0) \
- { \
- if ((src) != (dst)) \
- __GMPN_COPY_REST (dst, src, n, __gmp_i); \
- (cout) = 0; \
- break; \
- } \
- } \
- } \
- else \
- { \
- if ((src) != (dst)) \
- __GMPN_COPY_REST (dst, src, n, 1); \
- (cout) = 0; \
- } \
- } while (0)
-#endif
-
-#define __GMPN_ADDCB(r,x,y) ((r) < (y))
-#define __GMPN_SUBCB(r,x,y) ((x) < (y))
-
-#define __GMPN_ADD_1(cout, dst, src, n, v) \
- __GMPN_AORS_1(cout, dst, src, n, v, +, __GMPN_ADDCB)
-#define __GMPN_SUB_1(cout, dst, src, n, v) \
- __GMPN_AORS_1(cout, dst, src, n, v, -, __GMPN_SUBCB)
-
-
- /* Compare {xp,size} and {yp,size}, setting "result" to positive, zero or
- negative. size==0 is allowed. On random data usually only one limb will
- need to be examined to get a result, so it's worth having it inline. */
-#define __GMPN_CMP(result, xp, yp, size) \
- do { \
- mp_size_t __gmp_i; \
- mp_limb_t __gmp_x, __gmp_y; \
- \
- /* ASSERT ((size) >= 0); */ \
- \
- (result) = 0; \
- __gmp_i = (size); \
- while (--__gmp_i >= 0) \
- { \
- __gmp_x = (xp)[__gmp_i]; \
- __gmp_y = (yp)[__gmp_i]; \
- if (__gmp_x != __gmp_y) \
- { \
- /* Cannot use __gmp_x - __gmp_y, may overflow an "int" */ \
- (result) = (__gmp_x > __gmp_y ? 1 : -1); \
- break; \
- } \
- } \
- } while (0)
-
-
-#if defined (__GMPN_COPY) && ! defined (__GMPN_COPY_REST)
-#define __GMPN_COPY_REST(dst, src, size, start) \
- do { \
- /* ASSERT ((start) >= 0); */ \
- /* ASSERT ((start) <= (size)); */ \
- __GMPN_COPY ((dst)+(start), (src)+(start), (size)-(start)); \
- } while (0)
-#endif
-
- /* Copy {src,size} to {dst,size}, starting at "start". This is designed to
- keep the indexing dst[j] and src[j] nice and simple for __GMPN_ADD_1,
- __GMPN_ADD, etc. */
-#if ! defined (__GMPN_COPY_REST)
-#define __GMPN_COPY_REST(dst, src, size, start) \
- do { \
- mp_size_t __gmp_j; \
- /* ASSERT ((size) >= 0); */ \
- /* ASSERT ((start) >= 0); */ \
- /* ASSERT ((start) <= (size)); */ \
- /* ASSERT (MPN_SAME_OR_SEPARATE_P (dst, src, size)); */ \
- __GMP_CRAY_Pragma ("_CRI ivdep"); \
- for (__gmp_j = (start); __gmp_j < (size); __gmp_j++) \
- (dst)[__gmp_j] = (src)[__gmp_j]; \
- } while (0)
-#endif
-
- /* Enhancement: Use some of the smarter code from gmp-impl.h. Maybe use
- mpn_copyi if there's a native version, and if we don't mind demanding
- binary compatibility for it (on targets which use it). */
-
-#if ! defined (__GMPN_COPY)
-#define __GMPN_COPY(dst, src, size) __GMPN_COPY_REST (dst, src, size, 0)
-#endif
-
-
-#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpn_add)
-#if ! defined (__GMP_FORCE_mpn_add)
- __GMP_EXTERN_INLINE
-#endif
- mp_limb_t
- mpn_add (mp_ptr __gmp_wp, mp_srcptr __gmp_xp, mp_size_t __gmp_xsize, mp_srcptr __gmp_yp, mp_size_t __gmp_ysize)
- {
- mp_limb_t __gmp_c;
- __GMPN_ADD (__gmp_c, __gmp_wp, __gmp_xp, __gmp_xsize, __gmp_yp, __gmp_ysize);
- return __gmp_c;
- }
-#endif
-
-#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpn_add_1)
-#if ! defined (__GMP_FORCE_mpn_add_1)
- __GMP_EXTERN_INLINE
-#endif
- mp_limb_t
- mpn_add_1 (mp_ptr __gmp_dst, mp_srcptr __gmp_src, mp_size_t __gmp_size, mp_limb_t __gmp_n) __GMP_NOTHROW
- {
- mp_limb_t __gmp_c;
- __GMPN_ADD_1 (__gmp_c, __gmp_dst, __gmp_src, __gmp_size, __gmp_n);
- return __gmp_c;
- }
-#endif
-
-#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpn_cmp)
-#if ! defined (__GMP_FORCE_mpn_cmp)
- __GMP_EXTERN_INLINE
-#endif
- int
- mpn_cmp (mp_srcptr __gmp_xp, mp_srcptr __gmp_yp, mp_size_t __gmp_size) __GMP_NOTHROW
- {
- int __gmp_result;
- __GMPN_CMP (__gmp_result, __gmp_xp, __gmp_yp, __gmp_size);
- return __gmp_result;
- }
-#endif
-
-#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpn_sub)
-#if ! defined (__GMP_FORCE_mpn_sub)
- __GMP_EXTERN_INLINE
-#endif
- mp_limb_t
- mpn_sub (mp_ptr __gmp_wp, mp_srcptr __gmp_xp, mp_size_t __gmp_xsize, mp_srcptr __gmp_yp, mp_size_t __gmp_ysize)
- {
- mp_limb_t __gmp_c;
- __GMPN_SUB (__gmp_c, __gmp_wp, __gmp_xp, __gmp_xsize, __gmp_yp, __gmp_ysize);
- return __gmp_c;
- }
-#endif
-
-#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpn_sub_1)
-#if ! defined (__GMP_FORCE_mpn_sub_1)
- __GMP_EXTERN_INLINE
-#endif
- mp_limb_t
- mpn_sub_1 (mp_ptr __gmp_dst, mp_srcptr __gmp_src, mp_size_t __gmp_size, mp_limb_t __gmp_n) __GMP_NOTHROW
- {
- mp_limb_t __gmp_c;
- __GMPN_SUB_1 (__gmp_c, __gmp_dst, __gmp_src, __gmp_size, __gmp_n);
- return __gmp_c;
- }
-#endif
-
-#if defined (__cplusplus)
-}
-#endif
-
-
-/* Allow faster testing for negative, zero, and positive. */
-#define mpz_sgn(Z) ((Z)->_mp_size < 0 ? -1 : (Z)->_mp_size > 0)
-#define mpf_sgn(F) ((F)->_mp_size < 0 ? -1 : (F)->_mp_size > 0)
-#define mpq_sgn(Q) ((Q)->_mp_num._mp_size < 0 ? -1 : (Q)->_mp_num._mp_size > 0)
-
-/* When using GCC, optimize certain common comparisons. */
-#if defined (__GNUC__)
-#define mpz_cmp_ui(Z,UI) \
- (__builtin_constant_p (UI) && (UI) == 0 \
- ? mpz_sgn (Z) : _mpz_cmp_ui (Z,UI))
-#define mpz_cmp_si(Z,SI) \
- (__builtin_constant_p (SI) && (SI) == 0 ? mpz_sgn (Z) \
- : __builtin_constant_p (SI) && (SI) > 0 \
- ? _mpz_cmp_ui (Z, __GMP_CAST (unsigned long int, SI)) \
- : _mpz_cmp_si (Z,SI))
-#define mpq_cmp_ui(Q,NUI,DUI) \
- (__builtin_constant_p (NUI) && (NUI) == 0 \
- ? mpq_sgn (Q) : _mpq_cmp_ui (Q,NUI,DUI))
-#define mpq_cmp_si(q,n,d) \
- (__builtin_constant_p ((n) >= 0) && (n) >= 0 \
- ? mpq_cmp_ui (q, __GMP_CAST (unsigned long, n), d) \
- : _mpq_cmp_si (q, n, d))
-#else
-#define mpz_cmp_ui(Z,UI) _mpz_cmp_ui (Z,UI)
-#define mpz_cmp_si(Z,UI) _mpz_cmp_si (Z,UI)
-#define mpq_cmp_ui(Q,NUI,DUI) _mpq_cmp_ui (Q,NUI,DUI)
-#define mpq_cmp_si(q,n,d) _mpq_cmp_si(q,n,d)
-#endif
-
-
-/* Using "&" rather than "&&" means these can come out branch-free. Every
- mpz_t has at least one limb allocated, so fetching the low limb is always
- allowed. */
-#define mpz_odd_p(z) (((z)->_mp_size != 0) & __GMP_CAST (int, (z)->_mp_d[0]))
-#define mpz_even_p(z) (! mpz_odd_p (z))
-
-
-/**************** C++ routines ****************/
-
-#ifdef __cplusplus
-__GMP_DECLSPEC_XX std::ostream& operator<< (std::ostream &, mpz_srcptr);
-__GMP_DECLSPEC_XX std::ostream& operator<< (std::ostream &, mpq_srcptr);
-__GMP_DECLSPEC_XX std::ostream& operator<< (std::ostream &, mpf_srcptr);
-__GMP_DECLSPEC_XX std::istream& operator>> (std::istream &, mpz_ptr);
-__GMP_DECLSPEC_XX std::istream& operator>> (std::istream &, mpq_ptr);
-__GMP_DECLSPEC_XX std::istream& operator>> (std::istream &, mpf_ptr);
-#endif
-
-
-/* Source-level compatibility with GMP 2 and earlier. */
-#define mpn_divmod(qp,np,nsize,dp,dsize) \
- mpn_divrem (qp, __GMP_CAST (mp_size_t, 0), np, nsize, dp, dsize)
-
-/* Source-level compatibility with GMP 1. */
-#define mpz_mdiv mpz_fdiv_q
-#define mpz_mdivmod mpz_fdiv_qr
-#define mpz_mmod mpz_fdiv_r
-#define mpz_mdiv_ui mpz_fdiv_q_ui
-#define mpz_mdivmod_ui(q,r,n,d) \
- (((r) == 0) ? mpz_fdiv_q_ui (q,n,d) : mpz_fdiv_qr_ui (q,r,n,d))
-#define mpz_mmod_ui(r,n,d) \
- (((r) == 0) ? mpz_fdiv_ui (n,d) : mpz_fdiv_r_ui (r,n,d))
-
-/* Useful synonyms, but not quite compatible with GMP 1. */
-#define mpz_div mpz_fdiv_q
-#define mpz_divmod mpz_fdiv_qr
-#define mpz_div_ui mpz_fdiv_q_ui
-#define mpz_divmod_ui mpz_fdiv_qr_ui
-#define mpz_div_2exp mpz_fdiv_q_2exp
-#define mpz_mod_2exp mpz_fdiv_r_2exp
-
-enum
-{
- GMP_ERROR_NONE = 0,
- GMP_ERROR_UNSUPPORTED_ARGUMENT = 1,
- GMP_ERROR_DIVISION_BY_ZERO = 2,
- GMP_ERROR_SQRT_OF_NEGATIVE = 4,
- GMP_ERROR_INVALID_ARGUMENT = 8
-};
-
-/* Define CC and CFLAGS which were used to build this version of GMP */
-#define __GMP_CC "gcc"
-#define __GMP_CFLAGS "-m32 -O2 -fomit-frame-pointer -mtune=k8 -march=k8 -mno-cygwin"
-
-/* Major version number is the value of __GNU_MP__ too, above and in mp.h. */
-#define __GNU_MP_VERSION 4
-#define __GNU_MP_VERSION_MINOR 2
-#define __GNU_MP_VERSION_PATCHLEVEL 3
-
-#define __GMP_H__
-#endif /* __GMP_H__ */
diff --git a/library/GMP/include/gmpxx.h b/library/GMP/include/gmpxx.h
deleted file mode 100644
index 6472707a..00000000
--- a/library/GMP/include/gmpxx.h
+++ /dev/null
@@ -1,3389 +0,0 @@
-/* gmpxx.h -- C++ class wrapper for GMP types. -*- C++ -*-
-
-Copyright 2001, 2002, 2003, 2006, 2008 Free Software Foundation, Inc.
-
-This file is part of the GNU MP Library.
-
-The GNU MP Library is free software; you can redistribute it and/or modify
-it under the terms of the GNU Lesser General Public License as published by
-the Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
-
-The GNU MP Library 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 Lesser General Public
-License for more details.
-
-You should have received a copy of the GNU Lesser General Public License
-along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
-
-/* the C++ compiler must implement the following features:
- - member templates
- - partial specialization of templates
- - namespace support
- for g++, this means version 2.91 or higher
- for other compilers, I don't know */
-#ifdef __GNUC__
-#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 91)
-#error gmpxx.h requires g++ version 2.91 (egcs 1.1.2) or higher
-#endif
-#endif
-
-#ifndef __GMP_PLUSPLUS__
-#define __GMP_PLUSPLUS__
-
-#include <iosfwd>
-
-#include <cstring> /* for strlen */
-#include <string>
-#include <stdexcept>
-#include <cfloat>
-#include <gmp.h>
-
-
-/**************** Function objects ****************/
-/* Any evaluation of a __gmp_expr ends up calling one of these functions
- all intermediate functions being inline, the evaluation should optimize
- to a direct call to the relevant function, thus yielding no overhead
- over the C interface. */
-
-struct __gmp_unary_plus
-{
- static void eval(mpz_ptr z, mpz_srcptr w) { mpz_set(z, w); }
- static void eval(mpq_ptr q, mpq_srcptr r) { mpq_set(q, r); }
- static void eval(mpf_ptr f, mpf_srcptr g) { mpf_set(f, g); }
-};
-
-struct __gmp_unary_minus
-{
- static void eval(mpz_ptr z, mpz_srcptr w) { mpz_neg(z, w); }
- static void eval(mpq_ptr q, mpq_srcptr r) { mpq_neg(q, r); }
- static void eval(mpf_ptr f, mpf_srcptr g) { mpf_neg(f, g); }
-};
-
-struct __gmp_unary_com
-{
- static void eval(mpz_ptr z, mpz_srcptr w) { mpz_com(z, w); }
-};
-
-struct __gmp_binary_plus
-{
- static void eval(mpz_ptr z, mpz_srcptr w, mpz_srcptr v)
- { mpz_add(z, w, v); }
-
- static void eval(mpz_ptr z, mpz_srcptr w, unsigned long int l)
- { mpz_add_ui(z, w, l); }
- static void eval(mpz_ptr z, unsigned long int l, mpz_srcptr w)
- { mpz_add_ui(z, w, l); }
- static void eval(mpz_ptr z, mpz_srcptr w, signed long int l)
- {
- if (l >= 0)
- mpz_add_ui(z, w, l);
- else
- mpz_sub_ui(z, w, -l);
- }
- static void eval(mpz_ptr z, signed long int l, mpz_srcptr w)
- {
- if (l >= 0)
- mpz_add_ui(z, w, l);
- else
- mpz_sub_ui(z, w, -l);
- }
- static void eval(mpz_ptr z, mpz_srcptr w, double d)
- {
- mpz_t temp;
- mpz_init_set_d(temp, d);
- mpz_add(z, w, temp);
- mpz_clear(temp);
- }
- static void eval(mpz_ptr z, double d, mpz_srcptr w)
- {
- mpz_t temp;
- mpz_init_set_d(temp, d);
- mpz_add(z, temp, w);
- mpz_clear(temp);
- }
-
- static void eval(mpq_ptr q, mpq_srcptr r, mpq_srcptr s)
- { mpq_add(q, r, s); }
-
- static void eval(mpq_ptr q, mpq_srcptr r, unsigned long int l)
- { mpq_set(q, r); mpz_addmul_ui(mpq_numref(q), mpq_denref(q), l); }
- static void eval(mpq_ptr q, unsigned long int l, mpq_srcptr r)
- { mpq_set(q, r); mpz_addmul_ui(mpq_numref(q), mpq_denref(q), l); }
- static void eval(mpq_ptr q, mpq_srcptr r, signed long int l)
- {
- mpq_set(q, r);
- if (l >= 0)
- mpz_addmul_ui(mpq_numref(q), mpq_denref(q), l);
- else
- mpz_submul_ui(mpq_numref(q), mpq_denref(q), -l);
- }
- static void eval(mpq_ptr q, signed long int l, mpq_srcptr r)
- {
- mpq_set(q, r);
- if (l >= 0)
- mpz_addmul_ui(mpq_numref(q), mpq_denref(q), l);
- else
- mpz_submul_ui(mpq_numref(q), mpq_denref(q), -l);
- }
- static void eval(mpq_ptr q, mpq_srcptr r, double d)
- {
- mpq_t temp;
- mpq_init(temp);
- mpq_set_d(temp, d);
- mpq_add(q, r, temp);
- mpq_clear(temp);
- }
- static void eval(mpq_ptr q, double d, mpq_srcptr r)
- {
- mpq_t temp;
- mpq_init(temp);
- mpq_set_d(temp, d);
- mpq_add(q, temp, r);
- mpq_clear(temp);
- }
-
- static void eval(mpq_ptr q, mpq_srcptr r, mpz_srcptr z)
- { mpq_set(q, r); mpz_addmul(mpq_numref(q), mpq_denref(q), z); }
- static void eval(mpq_ptr q, mpz_srcptr z, mpq_srcptr r)
- { mpq_set(q, r); mpz_addmul(mpq_numref(q), mpq_denref(q), z); }
-
- static void eval(mpf_ptr f, mpf_srcptr g, mpf_srcptr h)
- { mpf_add(f, g, h); }
-
- static void eval(mpf_ptr f, mpf_srcptr g, unsigned long int l)
- { mpf_add_ui(f, g, l); }
- static void eval(mpf_ptr f, unsigned long int l, mpf_srcptr g)
- { mpf_add_ui(f, g, l); }
- static void eval(mpf_ptr f, mpf_srcptr g, signed long int l)
- {
- if (l >= 0)
- mpf_add_ui(f, g, l);
- else
- mpf_sub_ui(f, g, -l);
- }
- static void eval(mpf_ptr f, signed long int l, mpf_srcptr g)
- {
- if (l >= 0)
- mpf_add_ui(f, g, l);
- else
- mpf_sub_ui(f, g, -l);
- }
- static void eval(mpf_ptr f, mpf_srcptr g, double d)
- {
- mpf_t temp;
- mpf_init2(temp, 8*sizeof(double));
- mpf_set_d(temp, d);
- mpf_add(f, g, temp);
- mpf_clear(temp);
- }
- static void eval(mpf_ptr f, double d, mpf_srcptr g)
- {
- mpf_t temp;
- mpf_init2(temp, 8*sizeof(double));
- mpf_set_d(temp, d);
- mpf_add(f, temp, g);
- mpf_clear(temp);
- }
-};
-
-struct __gmp_binary_minus
-{
- static void eval(mpz_ptr z, mpz_srcptr w, mpz_srcptr v)
- { mpz_sub(z, w, v); }
-
- static void eval(mpz_ptr z, mpz_srcptr w, unsigned long int l)
- { mpz_sub_ui(z, w, l); }
- static void eval(mpz_ptr z, unsigned long int l, mpz_srcptr w)
- { mpz_ui_sub(z, l, w); }
- static void eval(mpz_ptr z, mpz_srcptr w, signed long int l)
- {
- if (l >= 0)
- mpz_sub_ui(z, w, l);
- else
- mpz_add_ui(z, w, -l);
- }
- static void eval(mpz_ptr z, signed long int l, mpz_srcptr w)
- {
- if (l >= 0)
- mpz_ui_sub(z, l, w);
- else
- {
- mpz_add_ui(z, w, -l);
- mpz_neg(z, z);
- }
- }
- static void eval(mpz_ptr z, mpz_srcptr w, double d)
- {
- mpz_t temp;
- mpz_init_set_d(temp, d);
- mpz_sub(z, w, temp);
- mpz_clear(temp);
- }
- static void eval(mpz_ptr z, double d, mpz_srcptr w)
- {
- mpz_t temp;
- mpz_init_set_d(temp, d);
- mpz_sub(z, temp, w);
- mpz_clear(temp);
- }
-
- static void eval(mpq_ptr q, mpq_srcptr r, mpq_srcptr s)
- { mpq_sub(q, r, s); }
-
- static void eval(mpq_ptr q, mpq_srcptr r, unsigned long int l)
- { mpq_set(q, r); mpz_submul_ui(mpq_numref(q), mpq_denref(q), l); }
- static void eval(mpq_ptr q, unsigned long int l, mpq_srcptr r)
- { mpq_neg(q, r); mpz_addmul_ui(mpq_numref(q), mpq_denref(q), l); }
- static void eval(mpq_ptr q, mpq_srcptr r, signed long int l)
- {
- mpq_set(q, r);
- if (l >= 0)
- mpz_submul_ui(mpq_numref(q), mpq_denref(q), l);
- else
- mpz_addmul_ui(mpq_numref(q), mpq_denref(q), -l);
- }
- static void eval(mpq_ptr q, signed long int l, mpq_srcptr r)
- {
- mpq_neg(q, r);
- if (l >= 0)
- mpz_addmul_ui(mpq_numref(q), mpq_denref(q), l);
- else
- mpz_submul_ui(mpq_numref(q), mpq_denref(q), -l);
- }
- static void eval(mpq_ptr q, mpq_srcptr r, double d)
- {
- mpq_t temp;
- mpq_init(temp);
- mpq_set_d(temp, d);
- mpq_sub(q, r, temp);
- mpq_clear(temp);
- }
- static void eval(mpq_ptr q, double d, mpq_srcptr r)
- {
- mpq_t temp;
- mpq_init(temp);
- mpq_set_d(temp, d);
- mpq_sub(q, temp, r);
- mpq_clear(temp);
- }
-
- static void eval(mpq_ptr q, mpq_srcptr r, mpz_srcptr z)
- { mpq_set(q, r); mpz_submul(mpq_numref(q), mpq_denref(q), z); }
- static void eval(mpq_ptr q, mpz_srcptr z, mpq_srcptr r)
- { mpq_neg(q, r); mpz_addmul(mpq_numref(q), mpq_denref(q), z); }
-
- static void eval(mpf_ptr f, mpf_srcptr g, mpf_srcptr h)
- { mpf_sub(f, g, h); }
-
- static void eval(mpf_ptr f, mpf_srcptr g, unsigned long int l)
- { mpf_sub_ui(f, g, l); }
- static void eval(mpf_ptr f, unsigned long int l, mpf_srcptr g)
- { mpf_ui_sub(f, l, g); }
- static void eval(mpf_ptr f, mpf_srcptr g, signed long int l)
- {
- if (l >= 0)
- mpf_sub_ui(f, g, l);
- else
- mpf_add_ui(f, g, -l);
- }
- static void eval(mpf_ptr f, signed long int l, mpf_srcptr g)
- {
- if (l >= 0)
- mpf_sub_ui(f, g, l);
- else
- mpf_add_ui(f, g, -l);
- mpf_neg(f, f);
- }
- static void eval(mpf_ptr f, mpf_srcptr g, double d)
- {
- mpf_t temp;
- mpf_init2(temp, 8*sizeof(double));
- mpf_set_d(temp, d);
- mpf_sub(f, g, temp);
- mpf_clear(temp);
- }
- static void eval(mpf_ptr f, double d, mpf_srcptr g)
- {
- mpf_t temp;
- mpf_init2(temp, 8*sizeof(double));
- mpf_set_d(temp, d);
- mpf_sub(f, temp, g);
- mpf_clear(temp);
- }
-};
-
-struct __gmp_binary_multiplies
-{
- static void eval(mpz_ptr z, mpz_srcptr w, mpz_srcptr v)
- { mpz_mul(z, w, v); }
-
- static void eval(mpz_ptr z, mpz_srcptr w, unsigned long int l)
- { mpz_mul_ui(z, w, l); }
- static void eval(mpz_ptr z, unsigned long int l, mpz_srcptr w)
- { mpz_mul_ui(z, w, l); }
- static void eval(mpz_ptr z, mpz_srcptr w, signed long int l)
- { mpz_mul_si (z, w, l); }
- static void eval(mpz_ptr z, signed long int l, mpz_srcptr w)
- { mpz_mul_si (z, w, l); }
- static void eval(mpz_ptr z, mpz_srcptr w, double d)
- {
- mpz_t temp;
- mpz_init_set_d(temp, d);
- mpz_mul(z, w, temp);
- mpz_clear(temp);
- }
- static void eval(mpz_ptr z, double d, mpz_srcptr w)
- {
- mpz_t temp;
- mpz_init_set_d(temp, d);
- mpz_mul(z, temp, w);
- mpz_clear(temp);
- }
-
- static void eval(mpq_ptr q, mpq_srcptr r, mpq_srcptr s)
- { mpq_mul(q, r, s); }
-
- static void eval(mpq_ptr q, mpq_srcptr r, unsigned long int l)
- {
- mpq_t temp;
- mpq_init(temp);
- mpq_set_ui(temp, l, 1);
- mpq_mul(q, r, temp);
- mpq_clear(temp);
- }
- static void eval(mpq_ptr q, unsigned long int l, mpq_srcptr r)
- {
- mpq_t temp;
- mpq_init(temp);
- mpq_set_ui(temp, l, 1);
- mpq_mul(q, temp, r);
- mpq_clear(temp);
- }
- static void eval(mpq_ptr q, mpq_srcptr r, signed long int l)
- {
- mpq_t temp;
- mpq_init(temp);
- mpq_set_si(temp, l, 1);
- mpq_mul(q, r, temp);
- mpq_clear(temp);
- }
- static void eval(mpq_ptr q, signed long int l, mpq_srcptr r)
- {
- mpq_t temp;
- mpq_init(temp);
- mpq_set_si(temp, l, 1);
- mpq_mul(q, temp, r);
- mpq_clear(temp);
- }
- static void eval(mpq_ptr q, mpq_srcptr r, double d)
- {
- mpq_t temp;
- mpq_init(temp);
- mpq_set_d(temp, d);
- mpq_mul(q, r, temp);
- mpq_clear(temp);
- }
- static void eval(mpq_ptr q, double d, mpq_srcptr r)
- {
- mpq_t temp;
- mpq_init(temp);
- mpq_set_d(temp, d);
- mpq_mul(q, temp, r);
- mpq_clear(temp);
- }
-
- static void eval(mpf_ptr f, mpf_srcptr g, mpf_srcptr h)
- { mpf_mul(f, g, h); }
-
- static void eval(mpf_ptr f, mpf_srcptr g, unsigned long int l)
- { mpf_mul_ui(f, g, l); }
- static void eval(mpf_ptr f, unsigned long int l, mpf_srcptr g)
- { mpf_mul_ui(f, g, l); }
- static void eval(mpf_ptr f, mpf_srcptr g, signed long int l)
- {
- if (l >= 0)
- mpf_mul_ui(f, g, l);
- else
- {
- mpf_mul_ui(f, g, -l);
- mpf_neg(f, f);
- }
- }
- static void eval(mpf_ptr f, signed long int l, mpf_srcptr g)
- {
- if (l >= 0)
- mpf_mul_ui(f, g, l);
- else
- {
- mpf_mul_ui(f, g, -l);
- mpf_neg(f, f);
- }
- }
- static void eval(mpf_ptr f, mpf_srcptr g, double d)
- {
- mpf_t temp;
- mpf_init2(temp, 8*sizeof(double));
- mpf_set_d(temp, d);
- mpf_mul(f, g, temp);
- mpf_clear(temp);
- }
- static void eval(mpf_ptr f, double d, mpf_srcptr g)
- {
- mpf_t temp;
- mpf_init2(temp, 8*sizeof(double));
- mpf_set_d(temp, d);
- mpf_mul(f, temp, g);
- mpf_clear(temp);
- }
-};
-
-struct __gmp_binary_divides
-{
- static void eval(mpz_ptr z, mpz_srcptr w, mpz_srcptr v)
- { mpz_tdiv_q(z, w, v); }
-
- static void eval(mpz_ptr z, mpz_srcptr w, unsigned long int l)
- { mpz_tdiv_q_ui(z, w, l); }
- static void eval(mpz_ptr z, unsigned long int l, mpz_srcptr w)
- {
- if (mpz_sgn(w) >= 0)
- {
- if (mpz_fits_ulong_p(w))
- mpz_set_ui(z, l / mpz_get_ui(w));
- else
- mpz_set_ui(z, 0);
- }
- else
- {
- mpz_neg(z, w);
- if (mpz_fits_ulong_p(z))
- {
- mpz_set_ui(z, l / mpz_get_ui(z));
- mpz_neg(z, z);
- }
- else
- mpz_set_ui(z, 0);
- }
- }
- static void eval(mpz_ptr z, mpz_srcptr w, signed long int l)
- {
- if (l >= 0)
- mpz_tdiv_q_ui(z, w, l);
- else
- {
- mpz_tdiv_q_ui(z, w, -l);
- mpz_neg(z, z);
- }
- }
- static void eval(mpz_ptr z, signed long int l, mpz_srcptr w)
- {
- if (mpz_fits_slong_p(w))
- mpz_set_si(z, l / mpz_get_si(w));
- else
- {
- /* if w is bigger than a long then the quotient must be zero, unless
- l==LONG_MIN and w==-LONG_MIN in which case the quotient is -1 */
- mpz_set_si (z, (mpz_cmpabs_ui (w, (l >= 0 ? l : -l)) == 0 ? -1 : 0));
- }
- }
- static void eval(mpz_ptr z, mpz_srcptr w, double d)
- {
- mpz_t temp;
- mpz_init_set_d(temp, d);
- mpz_tdiv_q(z, w, temp);
- mpz_clear(temp);
- }
- static void eval(mpz_ptr z, double d, mpz_srcptr w)
- {
- mpz_t temp;
- mpz_init_set_d(temp, d);
- mpz_tdiv_q(z, temp, w);
- mpz_clear(temp);
- }
-
- static void eval(mpq_ptr q, mpq_srcptr r, mpq_srcptr s)
- { mpq_div(q, r, s); }
-
- static void eval(mpq_ptr q, mpq_srcptr r, unsigned long int l)
- {
- mpq_t temp;
- mpq_init(temp);
- mpq_set_ui(temp, l, 1);
- mpq_div(q, r, temp);
- mpq_clear(temp);
- }
- static void eval(mpq_ptr q, unsigned long int l, mpq_srcptr r)
- {
- mpq_t temp;
- mpq_init(temp);
- mpq_set_ui(temp, l, 1);
- mpq_div(q, temp, r);
- mpq_clear(temp);
- }
- static void eval(mpq_ptr q, mpq_srcptr r, signed long int l)
- {
- mpq_t temp;
- mpq_init(temp);
- mpq_set_si(temp, l, 1);
- mpq_div(q, r, temp);
- mpq_clear(temp);
- }
- static void eval(mpq_ptr q, signed long int l, mpq_srcptr r)
- {
- mpq_t temp;
- mpq_init(temp);
- mpq_set_si(temp, l, 1);
- mpq_div(q, temp, r);
- mpq_clear(temp);
- }
- static void eval(mpq_ptr q, mpq_srcptr r, double d)
- {
- mpq_t temp;
- mpq_init(temp);
- mpq_set_d(temp, d);
- mpq_div(q, r, temp);
- mpq_clear(temp);
- }
- static void eval(mpq_ptr q, double d, mpq_srcptr r)
- {
- mpq_t temp;
- mpq_init(temp);
- mpq_set_d(temp, d);
- mpq_div(q, temp, r);
- mpq_clear(temp);
- }
-
- static void eval(mpf_ptr f, mpf_srcptr g, mpf_srcptr h)
- { mpf_div(f, g, h); }
-
- static void eval(mpf_ptr f, mpf_srcptr g, unsigned long int l)
- { mpf_div_ui(f, g, l); }
- static void eval(mpf_ptr f, unsigned long int l, mpf_srcptr g)
- { mpf_ui_div(f, l, g); }
- static void eval(mpf_ptr f, mpf_srcptr g, signed long int l)
- {
- if (l >= 0)
- mpf_div_ui(f, g, l);
- else
- {
- mpf_div_ui(f, g, -l);
- mpf_neg(f, f);
- }
- }
- static void eval(mpf_ptr f, signed long int l, mpf_srcptr g)
- {
- if (l >= 0)
- mpf_ui_div(f, l, g);
- else
- {
- mpf_ui_div(f, -l, g);
- mpf_neg(f, f);
- }
- }
- static void eval(mpf_ptr f, mpf_srcptr g, double d)
- {
- mpf_t temp;
- mpf_init2(temp, 8*sizeof(double));
- mpf_set_d(temp, d);
- mpf_div(f, g, temp);
- mpf_clear(temp);
- }
- static void eval(mpf_ptr f, double d, mpf_srcptr g)
- {
- mpf_t temp;
- mpf_init2(temp, 8*sizeof(double));
- mpf_set_d(temp, d);
- mpf_div(f, temp, g);
- mpf_clear(temp);
- }
-};
-
-struct __gmp_binary_modulus
-{
- static void eval(mpz_ptr z, mpz_srcptr w, mpz_srcptr v)
- { mpz_tdiv_r(z, w, v); }
-
- static void eval(mpz_ptr z, mpz_srcptr w, unsigned long int l)
- { mpz_tdiv_r_ui(z, w, l); }
- static void eval(mpz_ptr z, unsigned long int l, mpz_srcptr w)
- {
- if (mpz_sgn(w) >= 0)
- {
- if (mpz_fits_ulong_p(w))
- mpz_set_ui(z, l % mpz_get_ui(w));
- else
- mpz_set_ui(z, l);
- }
- else
- {
- mpz_neg(z, w);
- if (mpz_fits_ulong_p(z))
- mpz_set_ui(z, l % mpz_get_ui(z));
- else
- mpz_set_ui(z, l);
- }
- }
- static void eval(mpz_ptr z, mpz_srcptr w, signed long int l)
- {
- mpz_tdiv_r_ui (z, w, (l >= 0 ? l : -l));
- }
- static void eval(mpz_ptr z, signed long int l, mpz_srcptr w)
- {
- if (mpz_fits_slong_p(w))
- mpz_set_si(z, l % mpz_get_si(w));
- else
- {
- /* if w is bigger than a long then the remainder is l unchanged,
- unless l==LONG_MIN and w==-LONG_MIN in which case it's 0 */
- mpz_set_si (z, mpz_cmpabs_ui (w, (l >= 0 ? l : -l)) == 0 ? 0 : l);
- }
- }
- static void eval(mpz_ptr z, mpz_srcptr w, double d)
- {
- mpz_t temp;
- mpz_init_set_d(temp, d);
- mpz_tdiv_r(z, w, temp);
- mpz_clear(temp);
- }
- static void eval(mpz_ptr z, double d, mpz_srcptr w)
- {
- mpz_t temp;
- mpz_init_set_d(temp, d);
- mpz_tdiv_r(z, temp, w);
- mpz_clear(temp);
- }
-};
-
-// Max allocations for plain types when converted to mpz_t
-// FIXME: how do we get the proper max "double" exponent?
-#define __GMP_DBL_LIMBS (2 + DBL_MAX_EXP / GMP_NUMB_BITS)
-#define __GMP_ULI_LIMBS (1 + (8 * sizeof (long) - 1) / GMP_NUMB_BITS)
-
-#define __GMPXX_TMP_UI \
- mpz_t temp; \
- mp_limb_t limbs[__GMP_ULI_LIMBS]; \
- temp->_mp_d = limbs; \
- temp->_mp_alloc = __GMP_ULI_LIMBS; \
- mpz_set_ui (temp, l)
-#define __GMPXX_TMP_SI \
- mpz_t temp; \
- mp_limb_t limbs[__GMP_ULI_LIMBS]; \
- temp->_mp_d = limbs; \
- temp->_mp_alloc = __GMP_ULI_LIMBS; \
- mpz_set_si (temp, l)
-#define __GMPXX_TMP_D \
- mpz_t temp; \
- mp_limb_t limbs[__GMP_DBL_LIMBS]; \
- temp->_mp_d = limbs; \
- temp->_mp_alloc = __GMP_DBL_LIMBS; \
- mpz_set_d (temp, d)
-
-struct __gmp_binary_and
-{
- static void eval(mpz_ptr z, mpz_srcptr w, mpz_srcptr v)
- { mpz_and(z, w, v); }
-
- static void eval(mpz_ptr z, mpz_srcptr w, unsigned long int l)
- { __GMPXX_TMP_UI; mpz_and (z, w, temp); }
- static void eval(mpz_ptr z, unsigned long int l, mpz_srcptr w)
- { __GMPXX_TMP_UI; mpz_and (z, w, temp); }
- static void eval(mpz_ptr z, mpz_srcptr w, signed long int l)
- { __GMPXX_TMP_SI; mpz_and (z, w, temp); }
- static void eval(mpz_ptr z, signed long int l, mpz_srcptr w)
- { __GMPXX_TMP_SI; mpz_and (z, w, temp); }
- static void eval(mpz_ptr z, mpz_srcptr w, double d)
- { __GMPXX_TMP_D; mpz_and (z, w, temp); }
- static void eval(mpz_ptr z, double d, mpz_srcptr w)
- { __GMPXX_TMP_D; mpz_and (z, w, temp); }
-};
-
-struct __gmp_binary_ior
-{
- static void eval(mpz_ptr z, mpz_srcptr w, mpz_srcptr v)
- { mpz_ior(z, w, v); }
- static void eval(mpz_ptr z, mpz_srcptr w, unsigned long int l)
- { __GMPXX_TMP_UI; mpz_ior (z, w, temp); }
- static void eval(mpz_ptr z, unsigned long int l, mpz_srcptr w)
- { __GMPXX_TMP_UI; mpz_ior (z, w, temp); }
- static void eval(mpz_ptr z, mpz_srcptr w, signed long int l)
- { __GMPXX_TMP_SI; mpz_ior (z, w, temp); }
- static void eval(mpz_ptr z, signed long int l, mpz_srcptr w)
- { __GMPXX_TMP_SI; mpz_ior (z, w, temp); }
- static void eval(mpz_ptr z, mpz_srcptr w, double d)
- { __GMPXX_TMP_D; mpz_ior (z, w, temp); }
- static void eval(mpz_ptr z, double d, mpz_srcptr w)
- { __GMPXX_TMP_D; mpz_ior (z, w, temp); }
-};
-
-struct __gmp_binary_xor
-{
- static void eval(mpz_ptr z, mpz_srcptr w, mpz_srcptr v)
- { mpz_xor(z, w, v); }
- static void eval(mpz_ptr z, mpz_srcptr w, unsigned long int l)
- { __GMPXX_TMP_UI; mpz_xor (z, w, temp); }
- static void eval(mpz_ptr z, unsigned long int l, mpz_srcptr w)
- { __GMPXX_TMP_UI; mpz_xor (z, w, temp); }
- static void eval(mpz_ptr z, mpz_srcptr w, signed long int l)
- { __GMPXX_TMP_SI; mpz_xor (z, w, temp); }
- static void eval(mpz_ptr z, signed long int l, mpz_srcptr w)
- { __GMPXX_TMP_SI; mpz_xor (z, w, temp); }
- static void eval(mpz_ptr z, mpz_srcptr w, double d)
- { __GMPXX_TMP_D; mpz_xor (z, w, temp); }
- static void eval(mpz_ptr z, double d, mpz_srcptr w)
- { __GMPXX_TMP_D; mpz_xor (z, w, temp); }
-};
-
-struct __gmp_binary_lshift
-{
- static void eval(mpz_ptr z, mpz_srcptr w, unsigned long int l)
- { mpz_mul_2exp(z, w, l); }
- static void eval(mpq_ptr q, mpq_srcptr r, unsigned long int l)
- { mpq_mul_2exp(q, r, l); }
- static void eval(mpf_ptr f, mpf_srcptr g, unsigned long int l)
- { mpf_mul_2exp(f, g, l); }
-};
-
-struct __gmp_binary_rshift
-{
- static void eval(mpz_ptr z, mpz_srcptr w, unsigned long int l)
- { mpz_fdiv_q_2exp(z, w, l); }
- static void eval(mpq_ptr q, mpq_srcptr r, unsigned long int l)
- { mpq_div_2exp(q, r, l); }
- static void eval(mpf_ptr f, mpf_srcptr g, unsigned long int l)
- { mpf_div_2exp(f, g, l); }
-};
-
-struct __gmp_binary_equal
-{
- static bool eval(mpz_srcptr z, mpz_srcptr w) { return mpz_cmp(z, w) == 0; }
-
- static bool eval(mpz_srcptr z, unsigned long int l)
- { return mpz_cmp_ui(z, l) == 0; }
- static bool eval(unsigned long int l, mpz_srcptr z)
- { return mpz_cmp_ui(z, l) == 0; }
- static bool eval(mpz_srcptr z, signed long int l)
- { return mpz_cmp_si(z, l) == 0; }
- static bool eval(signed long int l, mpz_srcptr z)
- { return mpz_cmp_si(z, l) == 0; }
- static bool eval(mpz_srcptr z, double d)
- { return mpz_cmp_d(z, d) == 0; }
- static bool eval(double d, mpz_srcptr z)
- { return mpz_cmp_d(z, d) == 0; }
-
- static bool eval(mpq_srcptr q, mpq_srcptr r)
- { return mpq_equal(q, r) != 0; }
-
- static bool eval(mpq_srcptr q, unsigned long int l)
- { return mpq_cmp_ui(q, l, 1) == 0; }
- static bool eval(unsigned long int l, mpq_srcptr q)
- { return mpq_cmp_ui(q, l, 1) == 0; }
- static bool eval(mpq_srcptr q, signed long int l)
- { return mpq_cmp_si(q, l, 1) == 0; }
- static bool eval(signed long int l, mpq_srcptr q)
- { return mpq_cmp_si(q, l, 1) == 0; }
- static bool eval(mpq_srcptr q, double d)
- {
- bool b;
- mpq_t temp;
- mpq_init(temp);
- mpq_set_d(temp, d);
- b = (mpq_equal(q, temp) != 0);
- mpq_clear(temp);
- return b;
- }
- static bool eval(double d, mpq_srcptr q)
- {
- bool b;
- mpq_t temp;
- mpq_init(temp);
- mpq_set_d(temp, d);
- b = (mpq_equal(temp, q) != 0);
- mpq_clear(temp);
- return b;
- }
-
- static bool eval(mpf_srcptr f, mpf_srcptr g) { return mpf_cmp(f, g) == 0; }
-
- static bool eval(mpf_srcptr f, unsigned long int l)
- { return mpf_cmp_ui(f, l) == 0; }
- static bool eval(unsigned long int l, mpf_srcptr f)
- { return mpf_cmp_ui(f, l) == 0; }
- static bool eval(mpf_srcptr f, signed long int l)
- { return mpf_cmp_si(f, l) == 0; }
- static bool eval(signed long int l, mpf_srcptr f)
- { return mpf_cmp_si(f, l) == 0; }
- static bool eval(mpf_srcptr f, double d)
- { return mpf_cmp_d(f, d) == 0; }
- static bool eval(double d, mpf_srcptr f)
- { return mpf_cmp_d(f, d) == 0; }
-};
-
-struct __gmp_binary_not_equal
-{
- static bool eval(mpz_srcptr z, mpz_srcptr w) { return mpz_cmp(z, w) != 0; }
-
- static bool eval(mpz_srcptr z, unsigned long int l)
- { return mpz_cmp_ui(z, l) != 0; }
- static bool eval(unsigned long int l, mpz_srcptr z)
- { return mpz_cmp_ui(z, l) != 0; }
- static bool eval(mpz_srcptr z, signed long int l)
- { return mpz_cmp_si(z, l) != 0; }
- static bool eval(signed long int l, mpz_srcptr z)
- { return mpz_cmp_si(z, l) != 0; }
- static bool eval(mpz_srcptr z, double d)
- { return mpz_cmp_d(z, d) != 0; }
- static bool eval(double d, mpz_srcptr z)
- { return mpz_cmp_d(z, d) != 0; }
-
- static bool eval(mpq_srcptr q, mpq_srcptr r)
- { return mpq_equal(q, r) == 0; }
-
- static bool eval(mpq_srcptr q, unsigned long int l)
- { return mpq_cmp_ui(q, l, 1) != 0; }
- static bool eval(unsigned long int l, mpq_srcptr q)
- { return mpq_cmp_ui(q, l, 1) != 0; }
- static bool eval(mpq_srcptr q, signed long int l)
- { return mpq_cmp_si(q, l, 1) != 0; }
- static bool eval(signed long int l, mpq_srcptr q)
- { return mpq_cmp_si(q, l, 1) != 0; }
- static bool eval(mpq_srcptr q, double d)
- {
- bool b;
- mpq_t temp;
- mpq_init(temp);
- mpq_set_d(temp, d);
- b = (mpq_equal(q, temp) == 0);
- mpq_clear(temp);
- return b;
- }
- static bool eval(double d, mpq_srcptr q)
- {
- bool b;
- mpq_t temp;
- mpq_init(temp);
- mpq_set_d(temp, d);
- b = (mpq_equal(temp, q) == 0);
- mpq_clear(temp);
- return b;
- }
-
- static bool eval(mpf_srcptr f, mpf_srcptr g) { return mpf_cmp(f, g) != 0; }
-
- static bool eval(mpf_srcptr f, unsigned long int l)
- { return mpf_cmp_ui(f, l) != 0; }
- static bool eval(unsigned long int l, mpf_srcptr f)
- { return mpf_cmp_ui(f, l) != 0; }
- static bool eval(mpf_srcptr f, signed long int l)
- { return mpf_cmp_si(f, l) != 0; }
- static bool eval(signed long int l, mpf_srcptr f)
- { return mpf_cmp_si(f, l) != 0; }
- static bool eval(mpf_srcptr f, double d)
- { return mpf_cmp_d(f, d) != 0; }
- static bool eval(double d, mpf_srcptr f)
- { return mpf_cmp_d(f, d) != 0; }
-};
-
-struct __gmp_binary_less
-{
- static bool eval(mpz_srcptr z, mpz_srcptr w) { return mpz_cmp(z, w) < 0; }
-
- static bool eval(mpz_srcptr z, unsigned long int l)
- { return mpz_cmp_ui(z, l) < 0; }
- static bool eval(unsigned long int l, mpz_srcptr z)
- { return mpz_cmp_ui(z, l) > 0; }
- static bool eval(mpz_srcptr z, signed long int l)
- { return mpz_cmp_si(z, l) < 0; }
- static bool eval(signed long int l, mpz_srcptr z)
- { return mpz_cmp_si(z, l) > 0; }
- static bool eval(mpz_srcptr z, double d)
- { return mpz_cmp_d(z, d) < 0; }
- static bool eval(double d, mpz_srcptr z)
- { return mpz_cmp_d(z, d) > 0; }
-
- static bool eval(mpq_srcptr q, mpq_srcptr r) { return mpq_cmp(q, r) < 0; }
-
- static bool eval(mpq_srcptr q, unsigned long int l)
- { return mpq_cmp_ui(q, l, 1) < 0; }
- static bool eval(unsigned long int l, mpq_srcptr q)
- { return mpq_cmp_ui(q, l, 1) > 0; }
- static bool eval(mpq_srcptr q, signed long int l)
- { return mpq_cmp_si(q, l, 1) < 0; }
- static bool eval(signed long int l, mpq_srcptr q)
- { return mpq_cmp_si(q, l, 1) > 0; }
- static bool eval(mpq_srcptr q, double d)
- {
- bool b;
- mpq_t temp;
- mpq_init(temp);
- mpq_set_d(temp, d);
- b = (mpq_cmp(q, temp) < 0);
- mpq_clear(temp);
- return b;
- }
- static bool eval(double d, mpq_srcptr q)
- {
- bool b;
- mpq_t temp;
- mpq_init(temp);
- mpq_set_d(temp, d);
- b = (mpq_cmp(temp, q) < 0);
- mpq_clear(temp);
- return b;
- }
-
- static bool eval(mpf_srcptr f, mpf_srcptr g) { return mpf_cmp(f, g) < 0; }
-
- static bool eval(mpf_srcptr f, unsigned long int l)
- { return mpf_cmp_ui(f, l) < 0; }
- static bool eval(unsigned long int l, mpf_srcptr f)
- { return mpf_cmp_ui(f, l) > 0; }
- static bool eval(mpf_srcptr f, signed long int l)
- { return mpf_cmp_si(f, l) < 0; }
- static bool eval(signed long int l, mpf_srcptr f)
- { return mpf_cmp_si(f, l) > 0; }
- static bool eval(mpf_srcptr f, double d)
- { return mpf_cmp_d(f, d) < 0; }
- static bool eval(double d, mpf_srcptr f)
- { return mpf_cmp_d(f, d) > 0; }
-};
-
-struct __gmp_binary_less_equal
-{
- static bool eval(mpz_srcptr z, mpz_srcptr w) { return mpz_cmp(z, w) <= 0; }
-
- static bool eval(mpz_srcptr z, unsigned long int l)
- { return mpz_cmp_ui(z, l) <= 0; }
- static bool eval(unsigned long int l, mpz_srcptr z)
- { return mpz_cmp_ui(z, l) >= 0; }
- static bool eval(mpz_srcptr z, signed long int l)
- { return mpz_cmp_si(z, l) <= 0; }
- static bool eval(signed long int l, mpz_srcptr z)
- { return mpz_cmp_si(z, l) >= 0; }
- static bool eval(mpz_srcptr z, double d)
- { return mpz_cmp_d(z, d) <= 0; }
- static bool eval(double d, mpz_srcptr z)
- { return mpz_cmp_d(z, d) >= 0; }
-
- static bool eval(mpq_srcptr q, mpq_srcptr r) { return mpq_cmp(q, r) <= 0; }
-
- static bool eval(mpq_srcptr q, unsigned long int l)
- { return mpq_cmp_ui(q, l, 1) <= 0; }
- static bool eval(unsigned long int l, mpq_srcptr q)
- { return mpq_cmp_ui(q, l, 1) >= 0; }
- static bool eval(mpq_srcptr q, signed long int l)
- { return mpq_cmp_si(q, l, 1) <= 0; }
- static bool eval(signed long int l, mpq_srcptr q)
- { return mpq_cmp_si(q, l, 1) >= 0; }
- static bool eval(mpq_srcptr q, double d)
- {
- bool b;
- mpq_t temp;
- mpq_init(temp);
- mpq_set_d(temp, d);
- b = (mpq_cmp(q, temp) <= 0);
- mpq_clear(temp);
- return b;
- }
- static bool eval(double d, mpq_srcptr q)
- {
- bool b;
- mpq_t temp;
- mpq_init(temp);
- mpq_set_d(temp, d);
- b = (mpq_cmp(temp, q) <= 0);
- mpq_clear(temp);
- return b;
- }
-
- static bool eval(mpf_srcptr f, mpf_srcptr g) { return mpf_cmp(f, g) <= 0; }
-
- static bool eval(mpf_srcptr f, unsigned long int l)
- { return mpf_cmp_ui(f, l) <= 0; }
- static bool eval(unsigned long int l, mpf_srcptr f)
- { return mpf_cmp_ui(f, l) >= 0; }
- static bool eval(mpf_srcptr f, signed long int l)
- { return mpf_cmp_si(f, l) <= 0; }
- static bool eval(signed long int l, mpf_srcptr f)
- { return mpf_cmp_si(f, l) >= 0; }
- static bool eval(mpf_srcptr f, double d)
- { return mpf_cmp_d(f, d) <= 0; }
- static bool eval(double d, mpf_srcptr f)
- { return mpf_cmp_d(f, d) >= 0; }
-};
-
-struct __gmp_binary_greater
-{
- static bool eval(mpz_srcptr z, mpz_srcptr w) { return mpz_cmp(z, w) > 0; }
-
- static bool eval(mpz_srcptr z, unsigned long int l)
- { return mpz_cmp_ui(z, l) > 0; }
- static bool eval(unsigned long int l, mpz_srcptr z)
- { return mpz_cmp_ui(z, l) < 0; }
- static bool eval(mpz_srcptr z, signed long int l)
- { return mpz_cmp_si(z, l) > 0; }
- static bool eval(signed long int l, mpz_srcptr z)
- { return mpz_cmp_si(z, l) < 0; }
- static bool eval(mpz_srcptr z, double d)
- { return mpz_cmp_d(z, d) > 0; }
- static bool eval(double d, mpz_srcptr z)
- { return mpz_cmp_d(z, d) < 0; }
-
- static bool eval(mpq_srcptr q, mpq_srcptr r) { return mpq_cmp(q, r) > 0; }
-
- static bool eval(mpq_srcptr q, unsigned long int l)
- { return mpq_cmp_ui(q, l, 1) > 0; }
- static bool eval(unsigned long int l, mpq_srcptr q)
- { return mpq_cmp_ui(q, l, 1) < 0; }
- static bool eval(mpq_srcptr q, signed long int l)
- { return mpq_cmp_si(q, l, 1) > 0; }
- static bool eval(signed long int l, mpq_srcptr q)
- { return mpq_cmp_si(q, l, 1) < 0; }
- static bool eval(mpq_srcptr q, double d)
- {
- bool b;
- mpq_t temp;
- mpq_init(temp);
- mpq_set_d(temp, d);
- b = (mpq_cmp(q, temp) > 0);
- mpq_clear(temp);
- return b;
- }
- static bool eval(double d, mpq_srcptr q)
- {
- bool b;
- mpq_t temp;
- mpq_init(temp);
- mpq_set_d(temp, d);
- b = (mpq_cmp(temp, q) > 0);
- mpq_clear(temp);
- return b;
- }
-
- static bool eval(mpf_srcptr f, mpf_srcptr g) { return mpf_cmp(f, g) > 0; }
-
- static bool eval(mpf_srcptr f, unsigned long int l)
- { return mpf_cmp_ui(f, l) > 0; }
- static bool eval(unsigned long int l, mpf_srcptr f)
- { return mpf_cmp_ui(f, l) < 0; }
- static bool eval(mpf_srcptr f, signed long int l)
- { return mpf_cmp_si(f, l) > 0; }
- static bool eval(signed long int l, mpf_srcptr f)
- { return mpf_cmp_si(f, l) < 0; }
- static bool eval(mpf_srcptr f, double d)
- { return mpf_cmp_d(f, d) > 0; }
- static bool eval(double d, mpf_srcptr f)
- { return mpf_cmp_d(f, d) < 0; }
-};
-
-struct __gmp_binary_greater_equal
-{
- static bool eval(mpz_srcptr z, mpz_srcptr w) { return mpz_cmp(z, w) >= 0; }
-
- static bool eval(mpz_srcptr z, unsigned long int l)
- { return mpz_cmp_ui(z, l) >= 0; }
- static bool eval(unsigned long int l, mpz_srcptr z)
- { return mpz_cmp_ui(z, l) <= 0; }
- static bool eval(mpz_srcptr z, signed long int l)
- { return mpz_cmp_si(z, l) >= 0; }
- static bool eval(signed long int l, mpz_srcptr z)
- { return mpz_cmp_si(z, l) <= 0; }
- static bool eval(mpz_srcptr z, double d)
- { return mpz_cmp_d(z, d) >= 0; }
- static bool eval(double d, mpz_srcptr z)
- { return mpz_cmp_d(z, d) <= 0; }
-
- static bool eval(mpq_srcptr q, mpq_srcptr r) { return mpq_cmp(q, r) >= 0; }
-
- static bool eval(mpq_srcptr q, unsigned long int l)
- { return mpq_cmp_ui(q, l, 1) >= 0; }
- static bool eval(unsigned long int l, mpq_srcptr q)
- { return mpq_cmp_ui(q, l, 1) <= 0; }
- static bool eval(mpq_srcptr q, signed long int l)
- { return mpq_cmp_si(q, l, 1) >= 0; }
- static bool eval(signed long int l, mpq_srcptr q)
- { return mpq_cmp_si(q, l, 1) <= 0; }
- static bool eval(mpq_srcptr q, double d)
- {
- bool b;
- mpq_t temp;
- mpq_init(temp);
- mpq_set_d(temp, d);
- b = (mpq_cmp(q, temp) >= 0);
- mpq_clear(temp);
- return b;
- }
- static bool eval(double d, mpq_srcptr q)
- {
- bool b;
- mpq_t temp;
- mpq_init(temp);
- mpq_set_d(temp, d);
- b = (mpq_cmp(temp, q) >= 0);
- mpq_clear(temp);
- return b;
- }
-
- static bool eval(mpf_srcptr f, mpf_srcptr g) { return mpf_cmp(f, g) >= 0; }
-
- static bool eval(mpf_srcptr f, unsigned long int l)
- { return mpf_cmp_ui(f, l) >= 0; }
- static bool eval(unsigned long int l, mpf_srcptr f)
- { return mpf_cmp_ui(f, l) <= 0; }
- static bool eval(mpf_srcptr f, signed long int l)
- { return mpf_cmp_si(f, l) >= 0; }
- static bool eval(signed long int l, mpf_srcptr f)
- { return mpf_cmp_si(f, l) <= 0; }
- static bool eval(mpf_srcptr f, double d)
- { return mpf_cmp_d(f, d) >= 0; }
- static bool eval(double d, mpf_srcptr f)
- { return mpf_cmp_d(f, d) <= 0; }
-};
-
-struct __gmp_unary_increment
-{
- static void eval(mpz_ptr z) { mpz_add_ui(z, z, 1); }
- static void eval(mpq_ptr q)
- { mpz_add(mpq_numref(q), mpq_numref(q), mpq_denref(q)); }
- static void eval(mpf_ptr f) { mpf_add_ui(f, f, 1); }
-};
-
-struct __gmp_unary_decrement
-{
- static void eval(mpz_ptr z) { mpz_sub_ui(z, z, 1); }
- static void eval(mpq_ptr q)
- { mpz_sub(mpq_numref(q), mpq_numref(q), mpq_denref(q)); }
- static void eval(mpf_ptr f) { mpf_sub_ui(f, f, 1); }
-};
-
-struct __gmp_abs_function
-{
- static void eval(mpz_ptr z, mpz_srcptr w) { mpz_abs(z, w); }
- static void eval(mpq_ptr q, mpq_srcptr r) { mpq_abs(q, r); }
- static void eval(mpf_ptr f, mpf_srcptr g) { mpf_abs(f, g); }
-};
-
-struct __gmp_trunc_function
-{
- static void eval(mpf_ptr f, mpf_srcptr g) { mpf_trunc(f, g); }
-};
-
-struct __gmp_floor_function
-{
- static void eval(mpf_ptr f, mpf_srcptr g) { mpf_floor(f, g); }
-};
-
-struct __gmp_ceil_function
-{
- static void eval(mpf_ptr f, mpf_srcptr g) { mpf_ceil(f, g); }
-};
-
-struct __gmp_sqrt_function
-{
- static void eval(mpz_ptr z, mpz_srcptr w) { mpz_sqrt(z, w); }
- static void eval(mpf_ptr f, mpf_srcptr g) { mpf_sqrt(f, g); }
-};
-
-struct __gmp_hypot_function
-{
- static void eval(mpf_ptr f, mpf_srcptr g, mpf_srcptr h)
- {
- mpf_t temp;
- mpf_init2(temp, mpf_get_prec(f));
- mpf_mul(temp, g, g);
- mpf_mul(f, h, h);
- mpf_add(f, f, temp);
- mpf_sqrt(f, f);
- mpf_clear(temp);
- }
-
- static void eval(mpf_ptr f, mpf_srcptr g, unsigned long int l)
- {
- mpf_t temp;
- mpf_init2(temp, mpf_get_prec(f));
- mpf_mul(temp, g, g);
- mpf_set_ui(f, l);
- mpf_mul(f, f, f);
- mpf_add(f, f, temp);
- mpf_sqrt(f, f);
- mpf_clear(temp);
- }
- static void eval(mpf_ptr f, unsigned long int l, mpf_srcptr g)
- {
- mpf_t temp;
- mpf_init2(temp, mpf_get_prec(f));
- mpf_mul(temp, g, g);
- mpf_set_ui(f, l);
- mpf_mul(f, f, f);
- mpf_add(f, f, temp);
- mpf_sqrt(f, f);
- mpf_clear(temp);
- }
- static void eval(mpf_ptr f, mpf_srcptr g, signed long int l)
- {
- mpf_t temp;
- mpf_init2(temp, mpf_get_prec(f));
- mpf_mul(temp, g, g);
- mpf_set_si(f, l);
- mpf_mul(f, f, f);
- mpf_add(f, f, temp);
- mpf_sqrt(f, f);
- mpf_clear(temp);
- }
- static void eval(mpf_ptr f, signed long int l, mpf_srcptr g)
- {
- mpf_t temp;
- mpf_init2(temp, mpf_get_prec(f));
- mpf_mul(temp, g, g);
- mpf_set_si(f, l);
- mpf_mul(f, f, f);
- mpf_add(f, f, temp);
- mpf_sqrt(f, f);
- mpf_clear(temp);
- }
- static void eval(mpf_ptr f, mpf_srcptr g, double d)
- {
- mpf_t temp;
- mpf_init2(temp, mpf_get_prec(f));
- mpf_mul(temp, g, g);
- mpf_set_d(f, d);
- mpf_mul(f, f, f);
- mpf_add(f, f, temp);
- mpf_sqrt(f, f);
- mpf_clear(temp);
- }
- static void eval(mpf_ptr f, double d, mpf_srcptr g)
- {
- mpf_t temp;
- mpf_init2(temp, mpf_get_prec(f));
- mpf_mul(temp, g, g);
- mpf_set_d(f, d);
- mpf_mul(f, f, f);
- mpf_add(f, f, temp);
- mpf_sqrt(f, f);
- mpf_clear(temp);
- }
-};
-
-struct __gmp_sgn_function
-{
- static int eval(mpz_srcptr z) { return mpz_sgn(z); }
- static int eval(mpq_srcptr q) { return mpq_sgn(q); }
- static int eval(mpf_srcptr f) { return mpf_sgn(f); }
-};
-
-struct __gmp_cmp_function
-{
- static int eval(mpz_srcptr z, mpz_srcptr w) { return mpz_cmp(z, w); }
-
- static int eval(mpz_srcptr z, unsigned long int l)
- { return mpz_cmp_ui(z, l); }
- static int eval(unsigned long int l, mpz_srcptr z)
- { return -mpz_cmp_ui(z, l); }
- static int eval(mpz_srcptr z, signed long int l)
- { return mpz_cmp_si(z, l); }
- static int eval(signed long int l, mpz_srcptr z)
- { return -mpz_cmp_si(z, l); }
- static int eval(mpz_srcptr z, double d)
- { return mpz_cmp_d(z, d); }
- static int eval(double d, mpz_srcptr z)
- { return -mpz_cmp_d(z, d); }
-
- static int eval(mpq_srcptr q, mpq_srcptr r) { return mpq_cmp(q, r); }
-
- static int eval(mpq_srcptr q, unsigned long int l)
- { return mpq_cmp_ui(q, l, 1); }
- static int eval(unsigned long int l, mpq_srcptr q)
- { return -mpq_cmp_ui(q, l, 1); }
- static int eval(mpq_srcptr q, signed long int l)
- { return mpq_cmp_si(q, l, 1); }
- static int eval(signed long int l, mpq_srcptr q)
- { return -mpq_cmp_si(q, l, 1); }
- static int eval(mpq_srcptr q, double d)
- {
- int i;
- mpq_t temp;
- mpq_init(temp);
- mpq_set_d(temp, d);
- i = mpq_cmp(q, temp);
- mpq_clear(temp);
- return i;
- }
- static int eval(double d, mpq_srcptr q)
- {
- int i;
- mpq_t temp;
- mpq_init(temp);
- mpq_set_d(temp, d);
- i = mpq_cmp(temp, q);
- mpq_clear(temp);
- return i;
- }
-
- static int eval(mpf_srcptr f, mpf_srcptr g) { return mpf_cmp(f, g); }
-
- static int eval(mpf_srcptr f, unsigned long int l)
- { return mpf_cmp_ui(f, l); }
- static int eval(unsigned long int l, mpf_srcptr f)
- { return -mpf_cmp_ui(f, l); }
- static int eval(mpf_srcptr f, signed long int l)
- { return mpf_cmp_si(f, l); }
- static int eval(signed long int l, mpf_srcptr f)
- { return -mpf_cmp_si(f, l); }
- static int eval(mpf_srcptr f, double d)
- { return mpf_cmp_d(f, d); }
- static int eval(double d, mpf_srcptr f)
- { return -mpf_cmp_d(f, d); }
-};
-
-struct __gmp_rand_function
-{
- static void eval(mpz_ptr z, gmp_randstate_t s, unsigned long int l)
- { mpz_urandomb(z, s, l); }
- static void eval(mpz_ptr z, gmp_randstate_t s, mpz_srcptr w)
- { mpz_urandomm(z, s, w); }
- static void eval(mpf_ptr f, gmp_randstate_t s, unsigned long int prec)
- { mpf_urandomb(f, s, prec); }
-};
-
-
-/**************** Auxiliary classes ****************/
-
-/* this is much the same as gmp_allocated_string in gmp-impl.h
- since gmp-impl.h is not publicly available, I redefine it here
- I use a different name to avoid possible clashes */
-
-extern "C" {
- typedef void (*__gmp_freefunc_t) (void *, size_t);
-}
-struct __gmp_alloc_cstring
-{
- char *str;
- __gmp_alloc_cstring(char *s) { str = s; }
- ~__gmp_alloc_cstring()
- {
- __gmp_freefunc_t freefunc;
- mp_get_memory_functions (NULL, NULL, &freefunc);
- (*freefunc) (str, std::strlen(str)+1);
- }
-};
-
-
-// general expression template class
-template <class T, class U>
-class __gmp_expr;
-
-
-// templates for resolving expression types
-template <class T>
-struct __gmp_resolve_ref
-{
- typedef T ref_type;
-};
-
-template <class T, class U>
-struct __gmp_resolve_ref<__gmp_expr<T, U> >
-{
- typedef const __gmp_expr<T, U> & ref_type;
-};
-
-
-template <class T, class U = T>
-struct __gmp_resolve_expr;
-
-template <>
-struct __gmp_resolve_expr<mpz_t>
-{
- typedef mpz_t value_type;
- typedef mpz_ptr ptr_type;
-};
-
-template <>
-struct __gmp_resolve_expr<mpq_t>
-{
- typedef mpq_t value_type;
- typedef mpq_ptr ptr_type;
-};
-
-template <>
-struct __gmp_resolve_expr<mpf_t>
-{
- typedef mpf_t value_type;
- typedef mpf_ptr ptr_type;
-};
-
-template <>
-struct __gmp_resolve_expr<mpz_t, mpq_t>
-{
- typedef mpq_t value_type;
-};
-
-template <>
-struct __gmp_resolve_expr<mpq_t, mpz_t>
-{
- typedef mpq_t value_type;
-};
-
-template <>
-struct __gmp_resolve_expr<mpz_t, mpf_t>
-{
- typedef mpf_t value_type;
-};
-
-template <>
-struct __gmp_resolve_expr<mpf_t, mpz_t>
-{
- typedef mpf_t value_type;
-};
-
-template <>
-struct __gmp_resolve_expr<mpq_t, mpf_t>
-{
- typedef mpf_t value_type;
-};
-
-template <>
-struct __gmp_resolve_expr<mpf_t, mpq_t>
-{
- typedef mpf_t value_type;
-};
-
-
-
-template <class T, class U, class V>
-struct __gmp_resolve_temp
-{
- typedef __gmp_expr<T, T> temp_type;
-};
-
-template <class T>
-struct __gmp_resolve_temp<T, T, T>
-{
- typedef const __gmp_expr<T, T> & temp_type;
-};
-
-
-// classes for evaluating unary and binary expressions
-template <class T, class Op>
-struct __gmp_unary_expr
-{
- const T &val;
-
- __gmp_unary_expr(const T &v) : val(v) { }
-private:
- __gmp_unary_expr();
-};
-
-template <class T, class U, class Op>
-struct __gmp_binary_expr
-{
- typename __gmp_resolve_ref<T>::ref_type val1;
- typename __gmp_resolve_ref<U>::ref_type val2;
-
- __gmp_binary_expr(const T &v1, const U &v2) : val1(v1), val2(v2) { }
-private:
- __gmp_binary_expr();
-};
-
-
-// functions for evaluating expressions
-template <class T, class U>
-void __gmp_set_expr(mpz_ptr, const __gmp_expr<T, U> &);
-template <class T, class U>
-void __gmp_set_expr(mpq_ptr, const __gmp_expr<T, U> &);
-template <class T, class U>
-void __gmp_set_expr(mpf_ptr, const __gmp_expr<T, U> &);
-
-
-/**************** Macros for in-class declarations ****************/
-/* This is just repetitive code that is easier to maintain if it's written
- only once */
-
-#define __GMPP_DECLARE_COMPOUND_OPERATOR(fun) \
- template <class T, class U> \
- __gmp_expr<value_type, value_type> & fun(const __gmp_expr<T, U> &);
-
-#define __GMPN_DECLARE_COMPOUND_OPERATOR(fun) \
- __gmp_expr & fun(signed char); \
- __gmp_expr & fun(unsigned char); \
- __gmp_expr & fun(signed int); \
- __gmp_expr & fun(unsigned int); \
- __gmp_expr & fun(signed short int); \
- __gmp_expr & fun(unsigned short int); \
- __gmp_expr & fun(signed long int); \
- __gmp_expr & fun(unsigned long int); \
- __gmp_expr & fun(float); \
- __gmp_expr & fun(double); \
- __gmp_expr & fun(long double);
-
-#define __GMP_DECLARE_COMPOUND_OPERATOR(fun) \
-__GMPP_DECLARE_COMPOUND_OPERATOR(fun) \
-__GMPN_DECLARE_COMPOUND_OPERATOR(fun)
-
-#define __GMP_DECLARE_COMPOUND_OPERATOR_UI(fun) \
- __gmp_expr & fun(unsigned long int);
-
-#define __GMP_DECLARE_INCREMENT_OPERATOR(fun) \
- inline __gmp_expr & fun(); \
- inline __gmp_expr fun(int);
-
-
-/**************** mpz_class -- wrapper for mpz_t ****************/
-
-template <>
-class __gmp_expr<mpz_t, mpz_t>
-{
-private:
- typedef mpz_t value_type;
- value_type mp;
-public:
- unsigned long int get_prec() const { return mpf_get_default_prec(); }
-
- // constructors and destructor
- __gmp_expr() { mpz_init(mp); }
-
- __gmp_expr(const __gmp_expr &z) { mpz_init_set(mp, z.mp); }
- template <class T, class U>
- __gmp_expr(const __gmp_expr<T, U> &expr)
- { mpz_init(mp); __gmp_set_expr(mp, expr); }
-
- __gmp_expr(signed char c) { mpz_init_set_si(mp, c); }
- __gmp_expr(unsigned char c) { mpz_init_set_ui(mp, c); }
-
- __gmp_expr(signed int i) { mpz_init_set_si(mp, i); }
- __gmp_expr(unsigned int i) { mpz_init_set_ui(mp, i); }
-
- __gmp_expr(signed short int s) { mpz_init_set_si(mp, s); }
- __gmp_expr(unsigned short int s) { mpz_init_set_ui(mp, s); }
-
- __gmp_expr(signed long int l) { mpz_init_set_si(mp, l); }
- __gmp_expr(unsigned long int l) { mpz_init_set_ui(mp, l); }
-
- __gmp_expr(float f) { mpz_init_set_d(mp, f); }
- __gmp_expr(double d) { mpz_init_set_d(mp, d); }
- // __gmp_expr(long double ld) { mpz_init_set_d(mp, ld); }
-
- explicit __gmp_expr(const char *s)
- {
- if (mpz_init_set_str (mp, s, 0) != 0)
- {
- mpz_clear (mp);
- throw std::invalid_argument ("mpz_set_str");
- }
- }
- __gmp_expr(const char *s, int base)
- {
- if (mpz_init_set_str (mp, s, base) != 0)
- {
- mpz_clear (mp);
- throw std::invalid_argument ("mpz_set_str");
- }
- }
- explicit __gmp_expr(const std::string &s)
- {
- if (mpz_init_set_str (mp, s.c_str(), 0) != 0)
- {
- mpz_clear (mp);
- throw std::invalid_argument ("mpz_set_str");
- }
- }
- __gmp_expr(const std::string &s, int base)
- {
- if (mpz_init_set_str(mp, s.c_str(), base) != 0)
- {
- mpz_clear (mp);
- throw std::invalid_argument ("mpz_set_str");
- }
- }
-
- explicit __gmp_expr(mpz_srcptr z) { mpz_init_set(mp, z); }
-
- ~__gmp_expr() { mpz_clear(mp); }
-
- // assignment operators
- __gmp_expr & operator=(const __gmp_expr &z)
- { mpz_set(mp, z.mp); return *this; }
- template <class T, class U>
- __gmp_expr<value_type, value_type> & operator=(const __gmp_expr<T, U> &expr)
- { __gmp_set_expr(mp, expr); return *this; }
-
- __gmp_expr & operator=(signed char c) { mpz_set_si(mp, c); return *this; }
- __gmp_expr & operator=(unsigned char c) { mpz_set_ui(mp, c); return *this; }
-
- __gmp_expr & operator=(signed int i) { mpz_set_si(mp, i); return *this; }
- __gmp_expr & operator=(unsigned int i) { mpz_set_ui(mp, i); return *this; }
-
- __gmp_expr & operator=(signed short int s)
- { mpz_set_si(mp, s); return *this; }
- __gmp_expr & operator=(unsigned short int s)
- { mpz_set_ui(mp, s); return *this; }
-
- __gmp_expr & operator=(signed long int l)
- { mpz_set_si(mp, l); return *this; }
- __gmp_expr & operator=(unsigned long int l)
- { mpz_set_ui(mp, l); return *this; }
-
- __gmp_expr & operator=(float f) { mpz_set_d(mp, f); return *this; }
- __gmp_expr & operator=(double d) { mpz_set_d(mp, d); return *this; }
- // __gmp_expr & operator=(long double ld)
- // { mpz_set_ld(mp, ld); return *this; }
-
- __gmp_expr & operator=(const char *s)
- {
- if (mpz_set_str (mp, s, 0) != 0)
- throw std::invalid_argument ("mpz_set_str");
- return *this;
- }
- __gmp_expr & operator=(const std::string &s)
- {
- if (mpz_set_str(mp, s.c_str(), 0) != 0)
- throw std::invalid_argument ("mpz_set_str");
- return *this;
- }
-
- // string input/output functions
- int set_str(const char *s, int base)
- { return mpz_set_str(mp, s, base); }
- int set_str(const std::string &s, int base)
- { return mpz_set_str(mp, s.c_str(), base); }
- std::string get_str(int base = 10) const
- {
- __gmp_alloc_cstring temp(mpz_get_str(0, base, mp));
- return std::string(temp.str);
- }
-
- // conversion functions
- mpz_srcptr __get_mp() const { return mp; }
- mpz_ptr __get_mp() { return mp; }
- mpz_srcptr get_mpz_t() const { return mp; }
- mpz_ptr get_mpz_t() { return mp; }
-
- signed long int get_si() const { return mpz_get_si(mp); }
- unsigned long int get_ui() const { return mpz_get_ui(mp); }
- double get_d() const { return mpz_get_d(mp); }
-
- // bool fits_schar_p() const { return mpz_fits_schar_p(mp); }
- // bool fits_uchar_p() const { return mpz_fits_uchar_p(mp); }
- bool fits_sint_p() const { return mpz_fits_sint_p(mp); }
- bool fits_uint_p() const { return mpz_fits_uint_p(mp); }
- bool fits_sshort_p() const { return mpz_fits_sshort_p(mp); }
- bool fits_ushort_p() const { return mpz_fits_ushort_p(mp); }
- bool fits_slong_p() const { return mpz_fits_slong_p(mp); }
- bool fits_ulong_p() const { return mpz_fits_ulong_p(mp); }
- // bool fits_float_p() const { return mpz_fits_float_p(mp); }
- // bool fits_double_p() const { return mpz_fits_double_p(mp); }
- // bool fits_ldouble_p() const { return mpz_fits_ldouble_p(mp); }
-
- // member operators
- __GMP_DECLARE_COMPOUND_OPERATOR(operator+=)
- __GMP_DECLARE_COMPOUND_OPERATOR(operator-=)
- __GMP_DECLARE_COMPOUND_OPERATOR(operator*=)
- __GMP_DECLARE_COMPOUND_OPERATOR(operator/=)
- __GMP_DECLARE_COMPOUND_OPERATOR(operator%=)
-
- __GMP_DECLARE_COMPOUND_OPERATOR(operator&=)
- __GMP_DECLARE_COMPOUND_OPERATOR(operator|=)
- __GMP_DECLARE_COMPOUND_OPERATOR(operator^=)
-
- __GMP_DECLARE_COMPOUND_OPERATOR_UI(operator<<=)
- __GMP_DECLARE_COMPOUND_OPERATOR_UI(operator>>=)
-
- __GMP_DECLARE_INCREMENT_OPERATOR(operator++)
- __GMP_DECLARE_INCREMENT_OPERATOR(operator--)
-};
-
-typedef __gmp_expr<mpz_t, mpz_t> mpz_class;
-
-
-/**************** mpq_class -- wrapper for mpq_t ****************/
-
-template <>
-class __gmp_expr<mpq_t, mpq_t>
-{
-private:
- typedef mpq_t value_type;
- value_type mp;
-public:
- unsigned long int get_prec() const { return mpf_get_default_prec(); }
- void canonicalize() { mpq_canonicalize(mp); }
-
- // constructors and destructor
- __gmp_expr() { mpq_init(mp); }
-
- __gmp_expr(const __gmp_expr &q) { mpq_init(mp); mpq_set(mp, q.mp); }
- template <class T, class U>
- __gmp_expr(const __gmp_expr<T, U> &expr)
- { mpq_init(mp); __gmp_set_expr(mp, expr); }
-
- __gmp_expr(signed char c) { mpq_init(mp); mpq_set_si(mp, c, 1); }
- __gmp_expr(unsigned char c) { mpq_init(mp); mpq_set_ui(mp, c, 1); }
-
- __gmp_expr(signed int i) { mpq_init(mp); mpq_set_si(mp, i, 1); }
- __gmp_expr(unsigned int i) { mpq_init(mp); mpq_set_ui(mp, i, 1); }
-
- __gmp_expr(signed short int s) { mpq_init(mp); mpq_set_si(mp, s, 1); }
- __gmp_expr(unsigned short int s) { mpq_init(mp); mpq_set_ui(mp, s, 1); }
-
- __gmp_expr(signed long int l) { mpq_init(mp); mpq_set_si(mp, l, 1); }
- __gmp_expr(unsigned long int l) { mpq_init(mp); mpq_set_ui(mp, l, 1); }
-
- __gmp_expr(float f) { mpq_init(mp); mpq_set_d(mp, f); }
- __gmp_expr(double d) { mpq_init(mp); mpq_set_d(mp, d); }
- // __gmp_expr(long double ld) { mpq_init(mp); mpq_set_ld(mp, ld); }
-
- explicit __gmp_expr(const char *s)
- {
- mpq_init (mp);
- if (mpq_set_str (mp, s, 0) != 0)
- {
- mpq_clear (mp);
- throw std::invalid_argument ("mpq_set_str");
- }
- }
- __gmp_expr(const char *s, int base)
- {
- mpq_init (mp);
- if (mpq_set_str(mp, s, base) != 0)
- {
- mpq_clear (mp);
- throw std::invalid_argument ("mpq_set_str");
- }
- }
- explicit __gmp_expr(const std::string &s)
- {
- mpq_init (mp);
- if (mpq_set_str (mp, s.c_str(), 0) != 0)
- {
- mpq_clear (mp);
- throw std::invalid_argument ("mpq_set_str");
- }
- }
- __gmp_expr(const std::string &s, int base)
- {
- mpq_init(mp);
- if (mpq_set_str (mp, s.c_str(), base) != 0)
- {
- mpq_clear (mp);
- throw std::invalid_argument ("mpq_set_str");
- }
- }
- explicit __gmp_expr(mpq_srcptr q) { mpq_init(mp); mpq_set(mp, q); }
-
- __gmp_expr(const mpz_class &num, const mpz_class &den)
- {
- mpq_init(mp);
- mpz_set(mpq_numref(mp), num.get_mpz_t());
- mpz_set(mpq_denref(mp), den.get_mpz_t());
- }
-
- ~__gmp_expr() { mpq_clear(mp); }
-
- // assignment operators
- __gmp_expr & operator=(const __gmp_expr &q)
- { mpq_set(mp, q.mp); return *this; }
- template <class T, class U>
- __gmp_expr<value_type, value_type> & operator=(const __gmp_expr<T, U> &expr)
- { __gmp_set_expr(mp, expr); return *this; }
-
- __gmp_expr & operator=(signed char c)
- { mpq_set_si(mp, c, 1); return *this; }
- __gmp_expr & operator=(unsigned char c)
- { mpq_set_ui(mp, c, 1); return *this; }
-
- __gmp_expr & operator=(signed int i) { mpq_set_si(mp, i, 1); return *this; }
- __gmp_expr & operator=(unsigned int i)
- { mpq_set_ui(mp, i, 1); return *this; }
-
- __gmp_expr & operator=(signed short int s)
- { mpq_set_si(mp, s, 1); return *this; }
- __gmp_expr & operator=(unsigned short int s)
- { mpq_set_ui(mp, s, 1); return *this; }
-
- __gmp_expr & operator=(signed long int l)
- { mpq_set_si(mp, l, 1); return *this; }
- __gmp_expr & operator=(unsigned long int l)
- { mpq_set_ui(mp, l, 1); return *this; }
-
- __gmp_expr & operator=(float f) { mpq_set_d(mp, f); return *this; }
- __gmp_expr & operator=(double d) { mpq_set_d(mp, d); return *this; }
- // __gmp_expr & operator=(long double ld)
- // { mpq_set_ld(mp, ld); return *this; }
-
- __gmp_expr & operator=(const char *s)
- {
- if (mpq_set_str (mp, s, 0) != 0)
- throw std::invalid_argument ("mpq_set_str");
- return *this;
- }
- __gmp_expr & operator=(const std::string &s)
- {
- if (mpq_set_str(mp, s.c_str(), 0) != 0)
- throw std::invalid_argument ("mpq_set_str");
- return *this;
- }
-
- // string input/output functions
- int set_str(const char *s, int base)
- { return mpq_set_str(mp, s, base); }
- int set_str(const std::string &s, int base)
- { return mpq_set_str(mp, s.c_str(), base); }
- std::string get_str(int base = 10) const
- {
- __gmp_alloc_cstring temp(mpq_get_str(0, base, mp));
- return std::string(temp.str);
- }
-
- // conversion functions
-
- // casting a reference to an mpz_t to mpz_class & is a dirty hack,
- // but works because the internal representation of mpz_class is
- // exactly an mpz_t
- const mpz_class & get_num() const
- { return reinterpret_cast<const mpz_class &>(*mpq_numref(mp)); }
- mpz_class & get_num()
- { return reinterpret_cast<mpz_class &>(*mpq_numref(mp)); }
- const mpz_class & get_den() const
- { return reinterpret_cast<const mpz_class &>(*mpq_denref(mp)); }
- mpz_class & get_den()
- { return reinterpret_cast<mpz_class &>(*mpq_denref(mp)); }
-
- mpq_srcptr __get_mp() const { return mp; }
- mpq_ptr __get_mp() { return mp; }
- mpq_srcptr get_mpq_t() const { return mp; }
- mpq_ptr get_mpq_t() { return mp; }
-
- mpz_srcptr get_num_mpz_t() const { return mpq_numref(mp); }
- mpz_ptr get_num_mpz_t() { return mpq_numref(mp); }
- mpz_srcptr get_den_mpz_t() const { return mpq_denref(mp); }
- mpz_ptr get_den_mpz_t() { return mpq_denref(mp); }
-
- double get_d() const { return mpq_get_d(mp); }
-
- // compound assignments
- __GMP_DECLARE_COMPOUND_OPERATOR(operator+=)
- __GMP_DECLARE_COMPOUND_OPERATOR(operator-=)
- __GMP_DECLARE_COMPOUND_OPERATOR(operator*=)
- __GMP_DECLARE_COMPOUND_OPERATOR(operator/=)
-
- __GMP_DECLARE_COMPOUND_OPERATOR_UI(operator<<=)
- __GMP_DECLARE_COMPOUND_OPERATOR_UI(operator>>=)
-
- __GMP_DECLARE_INCREMENT_OPERATOR(operator++)
- __GMP_DECLARE_INCREMENT_OPERATOR(operator--)
-};
-
-typedef __gmp_expr<mpq_t, mpq_t> mpq_class;
-
-
-/**************** mpf_class -- wrapper for mpf_t ****************/
-
-template <>
-class __gmp_expr<mpf_t, mpf_t>
-{
-private:
- typedef mpf_t value_type;
- value_type mp;
-public:
- unsigned long int get_prec() const { return mpf_get_prec(mp); }
-
- void set_prec(unsigned long int prec) { mpf_set_prec(mp, prec); }
- void set_prec_raw(unsigned long int prec) { mpf_set_prec_raw(mp, prec); }
-
- // constructors and destructor
- __gmp_expr() { mpf_init(mp); }
-
- __gmp_expr(const __gmp_expr &f)
- { mpf_init2(mp, f.get_prec()); mpf_set(mp, f.mp); }
- __gmp_expr(const __gmp_expr &f, unsigned long int prec)
- { mpf_init2(mp, prec); mpf_set(mp, f.mp); }
- template <class T, class U>
- __gmp_expr(const __gmp_expr<T, U> &expr)
- { mpf_init2(mp, expr.get_prec()); __gmp_set_expr(mp, expr); }
- template <class T, class U>
- __gmp_expr(const __gmp_expr<T, U> &expr, unsigned long int prec)
- { mpf_init2(mp, prec); __gmp_set_expr(mp, expr); }
-
- __gmp_expr(signed char c) { mpf_init_set_si(mp, c); }
- __gmp_expr(signed char c, unsigned long int prec)
- { mpf_init2(mp, prec); mpf_set_si(mp, c); }
- __gmp_expr(unsigned char c) { mpf_init_set_ui(mp, c); }
- __gmp_expr(unsigned char c, unsigned long int prec)
- { mpf_init2(mp, prec); mpf_set_ui(mp, c); }
-
- __gmp_expr(signed int i) { mpf_init_set_si(mp, i); }
- __gmp_expr(signed int i, unsigned long int prec)
- { mpf_init2(mp, prec); mpf_set_si(mp, i); }
- __gmp_expr(unsigned int i) { mpf_init_set_ui(mp, i); }
- __gmp_expr(unsigned int i, unsigned long int prec)
- { mpf_init2(mp, prec); mpf_set_ui(mp, i); }
-
- __gmp_expr(signed short int s) { mpf_init_set_si(mp, s); }
- __gmp_expr(signed short int s, unsigned long int prec)
- { mpf_init2(mp, prec); mpf_set_si(mp, s); }
- __gmp_expr(unsigned short int s) { mpf_init_set_ui(mp, s); }
- __gmp_expr(unsigned short int s, unsigned long int prec)
- { mpf_init2(mp, prec); mpf_set_ui(mp, s); }
-
- __gmp_expr(signed long int l) { mpf_init_set_si(mp, l); }
- __gmp_expr(signed long int l, unsigned long int prec)
- { mpf_init2(mp, prec); mpf_set_si(mp, l); }
- __gmp_expr(unsigned long int l) { mpf_init_set_ui(mp, l); }
- __gmp_expr(unsigned long int l, unsigned long int prec)
- { mpf_init2(mp, prec); mpf_set_ui(mp, l); }
-
- __gmp_expr(float f) { mpf_init_set_d(mp, f); }
- __gmp_expr(float f, unsigned long int prec)
- { mpf_init2(mp, prec); mpf_set_d(mp, f); }
- __gmp_expr(double d) { mpf_init_set_d(mp, d); }
- __gmp_expr(double d, unsigned long int prec)
- { mpf_init2(mp, prec); mpf_set_d(mp, d); }
- // __gmp_expr(long double ld) { mpf_init_set_d(mp, ld); }
- // __gmp_expr(long double ld, unsigned long int prec)
- // { mpf_init2(mp, prec); mpf_set_d(mp, ld); }
-
- explicit __gmp_expr(const char *s)
- {
- if (mpf_init_set_str (mp, s, 0) != 0)
- {
- mpf_clear (mp);
- throw std::invalid_argument ("mpf_set_str");
- }
- }
- __gmp_expr(const char *s, unsigned long int prec, int base = 0)
- {
- mpf_init2(mp, prec);
- if (mpf_set_str(mp, s, base) != 0)
- {
- mpf_clear (mp);
- throw std::invalid_argument ("mpf_set_str");
- }
- }
- explicit __gmp_expr(const std::string &s)
- {
- if (mpf_init_set_str(mp, s.c_str(), 0) != 0)
- {
- mpf_clear (mp);
- throw std::invalid_argument ("mpf_set_str");
- }
- }
- __gmp_expr(const std::string &s, unsigned long int prec, int base = 0)
- {
- mpf_init2(mp, prec);
- if (mpf_set_str(mp, s.c_str(), base) != 0)
- {
- mpf_clear (mp);
- throw std::invalid_argument ("mpf_set_str");
- }
- }
-
- explicit __gmp_expr(mpf_srcptr f)
- { mpf_init2(mp, mpf_get_prec(f)); mpf_set(mp, f); }
- __gmp_expr(mpf_srcptr f, unsigned long int prec)
- { mpf_init2(mp, prec); mpf_set(mp, f); }
-
- ~__gmp_expr() { mpf_clear(mp); }
-
- // assignment operators
- __gmp_expr & operator=(const __gmp_expr &f)
- { mpf_set(mp, f.mp); return *this; }
- template <class T, class U>
- __gmp_expr<value_type, value_type> & operator=(const __gmp_expr<T, U> &expr)
- { __gmp_set_expr(mp, expr); return *this; }
-
- __gmp_expr & operator=(signed char c) { mpf_set_si(mp, c); return *this; }
- __gmp_expr & operator=(unsigned char c) { mpf_set_ui(mp, c); return *this; }
-
- __gmp_expr & operator=(signed int i) { mpf_set_si(mp, i); return *this; }
- __gmp_expr & operator=(unsigned int i) { mpf_set_ui(mp, i); return *this; }
-
- __gmp_expr & operator=(signed short int s)
- { mpf_set_si(mp, s); return *this; }
- __gmp_expr & operator=(unsigned short int s)
- { mpf_set_ui(mp, s); return *this; }
-
- __gmp_expr & operator=(signed long int l)
- { mpf_set_si(mp, l); return *this; }
- __gmp_expr & operator=(unsigned long int l)
- { mpf_set_ui(mp, l); return *this; }
-
- __gmp_expr & operator=(float f) { mpf_set_d(mp, f); return *this; }
- __gmp_expr & operator=(double d) { mpf_set_d(mp, d); return *this; }
- // __gmp_expr & operator=(long double ld)
- // { mpf_set_ld(mp, ld); return *this; }
-
- __gmp_expr & operator=(const char *s)
- {
- if (mpf_set_str (mp, s, 0) != 0)
- throw std::invalid_argument ("mpf_set_str");
- return *this;
- }
- __gmp_expr & operator=(const std::string &s)
- {
- if (mpf_set_str(mp, s.c_str(), 0) != 0)
- throw std::invalid_argument ("mpf_set_str");
- return *this;
- }
-
- // string input/output functions
- int set_str(const char *s, int base)
- { return mpf_set_str(mp, s, base); }
- int set_str(const std::string &s, int base)
- { return mpf_set_str(mp, s.c_str(), base); }
- std::string get_str(mp_exp_t &expo, int base = 10, size_t size = 0) const
- {
- __gmp_alloc_cstring temp(mpf_get_str(0, &expo, base, size, mp));
- return std::string(temp.str);
- }
-
- // conversion functions
- mpf_srcptr __get_mp() const { return mp; }
- mpf_ptr __get_mp() { return mp; }
- mpf_srcptr get_mpf_t() const { return mp; }
- mpf_ptr get_mpf_t() { return mp; }
-
- signed long int get_si() const { return mpf_get_si(mp); }
- unsigned long int get_ui() const { return mpf_get_ui(mp); }
- double get_d() const { return mpf_get_d(mp); }
-
- // bool fits_schar_p() const { return mpf_fits_schar_p(mp); }
- // bool fits_uchar_p() const { return mpf_fits_uchar_p(mp); }
- bool fits_sint_p() const { return mpf_fits_sint_p(mp); }
- bool fits_uint_p() const { return mpf_fits_uint_p(mp); }
- bool fits_sshort_p() const { return mpf_fits_sshort_p(mp); }
- bool fits_ushort_p() const { return mpf_fits_ushort_p(mp); }
- bool fits_slong_p() const { return mpf_fits_slong_p(mp); }
- bool fits_ulong_p() const { return mpf_fits_ulong_p(mp); }
- // bool fits_float_p() const { return mpf_fits_float_p(mp); }
- // bool fits_double_p() const { return mpf_fits_double_p(mp); }
- // bool fits_ldouble_p() const { return mpf_fits_ldouble_p(mp); }
-
- // compound assignments
- __GMP_DECLARE_COMPOUND_OPERATOR(operator+=)
- __GMP_DECLARE_COMPOUND_OPERATOR(operator-=)
- __GMP_DECLARE_COMPOUND_OPERATOR(operator*=)
- __GMP_DECLARE_COMPOUND_OPERATOR(operator/=)
-
- __GMP_DECLARE_COMPOUND_OPERATOR_UI(operator<<=)
- __GMP_DECLARE_COMPOUND_OPERATOR_UI(operator>>=)
-
- __GMP_DECLARE_INCREMENT_OPERATOR(operator++)
- __GMP_DECLARE_INCREMENT_OPERATOR(operator--)
-};
-
-typedef __gmp_expr<mpf_t, mpf_t> mpf_class;
-
-
-
-/**************** I/O operators ****************/
-
-// these should (and will) be provided separately
-
-template <class T>
-inline std::ostream & operator<<
-(std::ostream &o, const __gmp_expr<T, T> &expr)
-{
- return o << expr.__get_mp();
-}
-
-template <class T, class U>
-inline std::ostream & operator<<
-(std::ostream &o, const __gmp_expr<T, U> &expr)
-{
- __gmp_expr<T, T> temp(expr);
- return o << temp.__get_mp();
-}
-
-
-template <class T>
-inline std::istream & operator>>(std::istream &i, __gmp_expr<T, T> &expr)
-{
- return i >> expr.__get_mp();
-}
-
-inline std::istream & operator>>(std::istream &i, mpq_class &q)
-{
- i >> q.get_mpq_t();
- // q.canonicalize(); // you might want to uncomment this
- return i;
-}
-
-
-/**************** Functions for type conversion ****************/
-
-template <>
-inline void __gmp_set_expr(mpz_ptr z, const mpz_class &w)
-{
- mpz_set(z, w.get_mpz_t());
-}
-
-template <class T>
-inline void __gmp_set_expr(mpz_ptr z, const __gmp_expr<mpz_t, T> &expr)
-{
- expr.eval(z);
-}
-
-template <>
-inline void __gmp_set_expr(mpz_ptr z, const mpq_class &q)
-{
- mpz_set_q(z, q.get_mpq_t());
-}
-
-template <class T>
-inline void __gmp_set_expr(mpz_ptr z, const __gmp_expr<mpq_t, T> &expr)
-{
- mpq_class temp(expr);
- mpz_set_q(z, temp.get_mpq_t());
-}
-
-template <class T>
-inline void __gmp_set_expr(mpz_ptr z, const mpf_class &f)
-{
- mpz_set_f(z, f.get_mpf_t());
-}
-
-template <class T>
-inline void __gmp_set_expr(mpz_ptr z, const __gmp_expr<mpf_t, T> &expr)
-{
- mpf_class temp(expr);
- mpz_set_f(z, temp.get_mpf_t());
-}
-
-template <>
-inline void __gmp_set_expr(mpq_ptr q, const mpz_class &z)
-{
- mpq_set_z(q, z.get_mpz_t());
-}
-
-template <class T>
-inline void __gmp_set_expr(mpq_ptr q, const __gmp_expr<mpz_t, T> &expr)
-{
- mpz_class temp(expr);
- mpq_set_z(q, temp.get_mpz_t());
-}
-
-template <>
-inline void __gmp_set_expr(mpq_ptr q, const mpq_class &r)
-{
- mpq_set(q, r.get_mpq_t());
-}
-
-template <class T>
-inline void __gmp_set_expr(mpq_ptr q, const __gmp_expr<mpq_t, T> &expr)
-{
- expr.eval(q);
-}
-
-template <class T>
-inline void __gmp_set_expr(mpq_ptr q, const mpf_class &f)
-{
- mpq_set_f(q, f.get_mpf_t());
-}
-
-template <class T>
-inline void __gmp_set_expr(mpq_ptr q, const __gmp_expr<mpf_t, T> &expr)
-{
- mpf_class temp(expr);
- mpq_set_f(q, temp.get_mpf_t());
-}
-
-template <class T>
-inline void __gmp_set_expr(mpf_ptr f, const mpz_class &z)
-{
- mpf_set_z(f, z.get_mpz_t());
-}
-
-template <class T>
-inline void __gmp_set_expr(mpf_ptr f, const __gmp_expr<mpz_t, T> &expr)
-{
- mpz_class temp(expr);
- mpf_set_z(f, temp.get_mpz_t());
-}
-
-template <class T>
-inline void __gmp_set_expr(mpf_ptr f, const mpq_class &q)
-{
- mpf_set_q(f, q.get_mpq_t());
-}
-
-template <class T>
-inline void __gmp_set_expr(mpf_ptr f, const __gmp_expr<mpq_t, T> &expr)
-{
- mpq_class temp(expr);
- mpf_set_q(f, temp.get_mpq_t());
-}
-
-template <>
-inline void __gmp_set_expr(mpf_ptr f, const mpf_class &g)
-{
- mpf_set(f, g.get_mpf_t());
-}
-
-template <class T>
-inline void __gmp_set_expr(mpf_ptr f, const __gmp_expr<mpf_t, T> &expr)
-{
- expr.eval(f, mpf_get_prec(f));
-}
-
-
-/**************** Specializations of __gmp_expr ****************/
-/* The eval() method of __gmp_expr<T, U> evaluates the corresponding
- expression and assigns the result to its argument, which is either an
- mpz_t, mpq_t, or mpf_t as specified by the T argument.
- Compound expressions are evaluated recursively (temporaries are created
- to hold intermediate values), while for simple expressions the eval()
- method of the appropriate function object (available as the Op argument
- of either __gmp_unary_expr<T, Op> or __gmp_binary_expr<T, U, Op>) is
- called. */
-
-
-/**************** Unary expressions ****************/
-/* cases:
- - simple: argument is mp*_class, that is, __gmp_expr<T, T>
- - compound: argument is __gmp_expr<T, U> (with U not equal to T) */
-
-
-// simple expressions
-
-template <class T, class Op>
-class __gmp_expr<T, __gmp_unary_expr<__gmp_expr<T, T>, Op> >
-{
-private:
- typedef __gmp_expr<T, T> val_type;
-
- __gmp_unary_expr<val_type, Op> expr;
-public:
- __gmp_expr(const val_type &val) : expr(val) { }
- void eval(typename __gmp_resolve_expr<T>::ptr_type p,
- unsigned long int = 0) const
- { Op::eval(p, expr.val.__get_mp()); }
- const val_type & get_val() const { return expr.val; }
- unsigned long int get_prec() const { return expr.val.get_prec(); }
-};
-
-
-// compound expressions
-
-template <class T, class U, class Op>
-class __gmp_expr<T, __gmp_unary_expr<__gmp_expr<T, U>, Op> >
-{
-private:
- typedef __gmp_expr<T, U> val_type;
-
- __gmp_unary_expr<val_type, Op> expr;
-public:
- __gmp_expr(const val_type &val) : expr(val) { }
- void eval(typename __gmp_resolve_expr<T>::ptr_type p) const
- { __gmp_expr<T, T> temp(expr.val); Op::eval(p, temp.__get_mp()); }
- void eval(typename __gmp_resolve_expr<T>::ptr_type p,
- unsigned long int prec) const
- { __gmp_expr<T, T> temp(expr.val, prec); Op::eval(p, temp.__get_mp()); }
- const val_type & get_val() const { return expr.val; }
- unsigned long int get_prec() const { return expr.val.get_prec(); }
-};
-
-
-/**************** Binary expressions ****************/
-/* simple:
- - arguments are both mp*_class
- - one argument is mp*_class, one is a built-in type
- compound:
- - one is mp*_class, one is __gmp_expr<T, U>
- - one is __gmp_expr<T, U>, one is built-in
- - both arguments are __gmp_expr<...> */
-
-
-// simple expressions
-
-template <class T, class Op>
-class __gmp_expr
-<T, __gmp_binary_expr<__gmp_expr<T, T>, __gmp_expr<T, T>, Op> >
-{
-private:
- typedef __gmp_expr<T, T> val1_type;
- typedef __gmp_expr<T, T> val2_type;
-
- __gmp_binary_expr<val1_type, val2_type, Op> expr;
-public:
- __gmp_expr(const val1_type &val1, const val2_type &val2)
- : expr(val1, val2) { }
- void eval(typename __gmp_resolve_expr<T>::ptr_type p,
- unsigned long int = 0) const
- { Op::eval(p, expr.val1.__get_mp(), expr.val2.__get_mp()); }
- const val1_type & get_val1() const { return expr.val1; }
- const val2_type & get_val2() const { return expr.val2; }
- unsigned long int get_prec() const
- {
- unsigned long int prec1 = expr.val1.get_prec(),
- prec2 = expr.val2.get_prec();
- return (prec1 > prec2) ? prec1 : prec2;
- }
-};
-
-
-// simple expressions, T is a built-in numerical type
-
-template <class T, class U, class Op>
-class __gmp_expr<T, __gmp_binary_expr<__gmp_expr<T, T>, U, Op> >
-{
-private:
- typedef __gmp_expr<T, T> val1_type;
- typedef U val2_type;
-
- __gmp_binary_expr<val1_type, val2_type, Op> expr;
-public:
- __gmp_expr(const val1_type &val1, const val2_type &val2)
- : expr(val1, val2) { }
- void eval(typename __gmp_resolve_expr<T>::ptr_type p,
- unsigned long int = 0) const
- { Op::eval(p, expr.val1.__get_mp(), expr.val2); }
- const val1_type & get_val1() const { return expr.val1; }
- const val2_type & get_val2() const { return expr.val2; }
- unsigned long int get_prec() const { return expr.val1.get_prec(); }
-};
-
-template <class T, class U, class Op>
-class __gmp_expr<T, __gmp_binary_expr<U, __gmp_expr<T, T>, Op> >
-{
-private:
- typedef U val1_type;
- typedef __gmp_expr<T, T> val2_type;
-
- __gmp_binary_expr<val1_type, val2_type, Op> expr;
-public:
- __gmp_expr(const val1_type &val1, const val2_type &val2)
- : expr(val1, val2) { }
- void eval(typename __gmp_resolve_expr<T>::ptr_type p,
- unsigned long int = 0) const
- { Op::eval(p, expr.val1, expr.val2.__get_mp()); }
- const val1_type & get_val1() const { return expr.val1; }
- const val2_type & get_val2() const { return expr.val2; }
- unsigned long int get_prec() const { return expr.val2.get_prec(); }
-};
-
-
-// compound expressions, one argument is a subexpression
-
-template <class T, class U, class V, class Op>
-class __gmp_expr
-<T, __gmp_binary_expr<__gmp_expr<T, T>, __gmp_expr<U, V>, Op> >
-{
-private:
- typedef __gmp_expr<T, T> val1_type;
- typedef __gmp_expr<U, V> val2_type;
-
- __gmp_binary_expr<val1_type, val2_type, Op> expr;
-public:
- __gmp_expr(const val1_type &val1, const val2_type &val2)
- : expr(val1, val2) { }
- void eval(typename __gmp_resolve_expr<T>::ptr_type p) const
- {
- __gmp_expr<T, T> temp(expr.val2);
- Op::eval(p, expr.val1.__get_mp(), temp.__get_mp());
- }
- void eval(typename __gmp_resolve_expr<T>::ptr_type p,
- unsigned long int prec) const
- {
- __gmp_expr<T, T> temp(expr.val2, prec);
- Op::eval(p, expr.val1.__get_mp(), temp.__get_mp());
- }
- const val1_type & get_val1() const { return expr.val1; }
- const val2_type & get_val2() const { return expr.val2; }
- unsigned long int get_prec() const
- {
- unsigned long int prec1 = expr.val1.get_prec(),
- prec2 = expr.val2.get_prec();
- return (prec1 > prec2) ? prec1 : prec2;
- }
-};
-
-template <class T, class U, class V, class Op>
-class __gmp_expr
-<T, __gmp_binary_expr<__gmp_expr<U, V>, __gmp_expr<T, T>, Op> >
-{
-private:
- typedef __gmp_expr<U, V> val1_type;
- typedef __gmp_expr<T, T> val2_type;
-
- __gmp_binary_expr<val1_type, val2_type, Op> expr;
-public:
- __gmp_expr(const val1_type &val1, const val2_type &val2)
- : expr(val1, val2) { }
- void eval(typename __gmp_resolve_expr<T>::ptr_type p) const
- {
- __gmp_expr<T, T> temp(expr.val1);
- Op::eval(p, temp.__get_mp(), expr.val2.__get_mp());
- }
- void eval(typename __gmp_resolve_expr<T>::ptr_type p,
- unsigned long int prec) const
- {
- __gmp_expr<T, T> temp(expr.val1, prec);
- Op::eval(p, temp.__get_mp(), expr.val2.__get_mp());
- }
- const val1_type & get_val1() const { return expr.val1; }
- const val2_type & get_val2() const { return expr.val2; }
- unsigned long int get_prec() const
- {
- unsigned long int prec1 = expr.val1.get_prec(),
- prec2 = expr.val2.get_prec();
- return (prec1 > prec2) ? prec1 : prec2;
- }
-};
-
-template <class T, class U, class Op>
-class __gmp_expr
-<T, __gmp_binary_expr<__gmp_expr<T, T>, __gmp_expr<T, U>, Op> >
-{
-private:
- typedef __gmp_expr<T, T> val1_type;
- typedef __gmp_expr<T, U> val2_type;
-
- __gmp_binary_expr<val1_type, val2_type, Op> expr;
-public:
- __gmp_expr(const val1_type &val1, const val2_type &val2)
- : expr(val1, val2) { }
- void eval(typename __gmp_resolve_expr<T>::ptr_type p) const
- {
- __gmp_expr<T, T> temp(expr.val2);
- Op::eval(p, expr.val1.__get_mp(), temp.__get_mp());
- }
- void eval(typename __gmp_resolve_expr<T>::ptr_type p,
- unsigned long int prec) const
- {
- __gmp_expr<T, T> temp(expr.val2, prec);
- Op::eval(p, expr.val1.__get_mp(), temp.__get_mp());
- }
- const val1_type & get_val1() const { return expr.val1; }
- const val2_type & get_val2() const { return expr.val2; }
- unsigned long int get_prec() const
- {
- unsigned long int prec1 = expr.val1.get_prec(),
- prec2 = expr.val2.get_prec();
- return (prec1 > prec2) ? prec1 : prec2;
- }
-};
-
-template <class T, class U, class Op>
-class __gmp_expr
-<T, __gmp_binary_expr<__gmp_expr<T, U>, __gmp_expr<T, T>, Op> >
-{
-private:
- typedef __gmp_expr<T, U> val1_type;
- typedef __gmp_expr<T, T> val2_type;
-
- __gmp_binary_expr<val1_type, val2_type, Op> expr;
-public:
- __gmp_expr(const val1_type &val1, const val2_type &val2)
- : expr(val1, val2) { }
- void eval(typename __gmp_resolve_expr<T>::ptr_type p) const
- {
- __gmp_expr<T, T> temp(expr.val1);
- Op::eval(p, temp.__get_mp(), expr.val2.__get_mp());
- }
- void eval(typename __gmp_resolve_expr<T>::ptr_type p,
- unsigned long int prec) const
- {
- __gmp_expr<T, T> temp(expr.val1, prec);
- Op::eval(p, temp.__get_mp(), expr.val2.__get_mp());
- }
- const val1_type & get_val1() const { return expr.val1; }
- const val2_type & get_val2() const { return expr.val2; }
- unsigned long int get_prec() const
- {
- unsigned long int prec1 = expr.val1.get_prec(),
- prec2 = expr.val2.get_prec();
- return (prec1 > prec2) ? prec1 : prec2;
- }
-};
-
-
-// one argument is a subexpression, one is a built-in
-
-template <class T, class U, class V, class Op>
-class __gmp_expr<T, __gmp_binary_expr<__gmp_expr<T, U>, V, Op> >
-{
-private:
- typedef __gmp_expr<T, U> val1_type;
- typedef V val2_type;
-
- __gmp_binary_expr<val1_type, val2_type, Op> expr;
-public:
- __gmp_expr(const val1_type &val1, const val2_type &val2)
- : expr(val1, val2) { }
- void eval(typename __gmp_resolve_expr<T>::ptr_type p) const
- {
- __gmp_expr<T, T> temp(expr.val1);
- Op::eval(p, temp.__get_mp(), expr.val2);
- }
- void eval(typename __gmp_resolve_expr<T>::ptr_type p,
- unsigned long int prec) const
- {
- __gmp_expr<T, T> temp(expr.val1, prec);
- Op::eval(p, temp.__get_mp(), expr.val2);
- }
- const val1_type & get_val1() const { return expr.val1; }
- const val2_type & get_val2() const { return expr.val2; }
- unsigned long int get_prec() const { return expr.val1.get_prec(); }
-};
-
-template <class T, class U, class V, class Op>
-class __gmp_expr<T, __gmp_binary_expr<U, __gmp_expr<T, V>, Op> >
-{
-private:
- typedef U val1_type;
- typedef __gmp_expr<T, V> val2_type;
-
- __gmp_binary_expr<val1_type, val2_type, Op> expr;
-public:
- __gmp_expr(const val1_type &val1, const val2_type &val2)
- : expr(val1, val2) { }
- void eval(typename __gmp_resolve_expr<T>::ptr_type p) const
- {
- __gmp_expr<T, T> temp(expr.val2);
- Op::eval(p, expr.val1, temp.__get_mp());
- }
- void eval(typename __gmp_resolve_expr<T>::ptr_type p,
- unsigned long int prec) const
- {
- __gmp_expr<T, T> temp(expr.val2, prec);
- Op::eval(p, expr.val1, temp.__get_mp());
- }
- const val1_type & get_val1() const { return expr.val1; }
- const val2_type & get_val2() const { return expr.val2; }
- unsigned long int get_prec() const { return expr.val2.get_prec(); }
-};
-
-
-// both arguments are subexpressions
-
-template <class T, class U, class V, class W, class Op>
-class __gmp_expr
-<T, __gmp_binary_expr<__gmp_expr<T, U>, __gmp_expr<V, W>, Op> >
-{
-private:
- typedef __gmp_expr<T, U> val1_type;
- typedef __gmp_expr<V, W> val2_type;
-
- __gmp_binary_expr<val1_type, val2_type, Op> expr;
-public:
- __gmp_expr(const val1_type &val1, const val2_type &val2)
- : expr(val1, val2) { }
- void eval(typename __gmp_resolve_expr<T>::ptr_type p) const
- {
- __gmp_expr<T, T> temp1(expr.val1), temp2(expr.val2);
- Op::eval(p, temp1.__get_mp(), temp2.__get_mp());
- }
- void eval(typename __gmp_resolve_expr<T>::ptr_type p,
- unsigned long int prec) const
- {
- __gmp_expr<T, T> temp1(expr.val1, prec), temp2(expr.val2, prec);
- Op::eval(p, temp1.__get_mp(), temp2.__get_mp());
- }
- const val1_type & get_val1() const { return expr.val1; }
- const val2_type & get_val2() const { return expr.val2; }
- unsigned long int get_prec() const
- {
- unsigned long int prec1 = expr.val1.get_prec(),
- prec2 = expr.val2.get_prec();
- return (prec1 > prec2) ? prec1 : prec2;
- }
-};
-
-template <class T, class U, class V, class W, class Op>
-class __gmp_expr
-<T, __gmp_binary_expr<__gmp_expr<U, V>, __gmp_expr<T, W>, Op> >
-{
-private:
- typedef __gmp_expr<U, V> val1_type;
- typedef __gmp_expr<T, W> val2_type;
-
- __gmp_binary_expr<val1_type, val2_type, Op> expr;
-public:
- __gmp_expr(const val1_type &val1, const val2_type &val2)
- : expr(val1, val2) { }
- void eval(typename __gmp_resolve_expr<T>::ptr_type p) const
- {
- __gmp_expr<T, T> temp1(expr.val1), temp2(expr.val2);
- Op::eval(p, temp1.__get_mp(), temp2.__get_mp());
- }
- void eval(typename __gmp_resolve_expr<T>::ptr_type p,
- unsigned long int prec) const
- {
- __gmp_expr<T, T> temp1(expr.val1, prec), temp2(expr.val2, prec);
- Op::eval(p, temp1.__get_mp(), temp2.__get_mp());
- }
- const val1_type & get_val1() const { return expr.val1; }
- const val2_type & get_val2() const { return expr.val2; }
- unsigned long int get_prec() const
- {
- unsigned long int prec1 = expr.val1.get_prec(),
- prec2 = expr.val2.get_prec();
- return (prec1 > prec2) ? prec1 : prec2;
- }
-};
-
-template <class T, class U, class V, class Op>
-class __gmp_expr
-<T, __gmp_binary_expr<__gmp_expr<T, U>, __gmp_expr<T, V>, Op> >
-{
-private:
- typedef __gmp_expr<T, U> val1_type;
- typedef __gmp_expr<T, V> val2_type;
-
- __gmp_binary_expr<val1_type, val2_type, Op> expr;
-public:
- __gmp_expr(const val1_type &val1, const val2_type &val2)
- : expr(val1, val2) { }
- void eval(typename __gmp_resolve_expr<T>::ptr_type p) const
- {
- __gmp_expr<T, T> temp1(expr.val1), temp2(expr.val2);
- Op::eval(p, temp1.__get_mp(), temp2.__get_mp());
- }
- void eval(typename __gmp_resolve_expr<T>::ptr_type p,
- unsigned long int prec) const
- {
- __gmp_expr<T, T> temp1(expr.val1, prec), temp2(expr.val2, prec);
- Op::eval(p, temp1.__get_mp(), temp2.__get_mp());
- }
- const val1_type & get_val1() const { return expr.val1; }
- const val2_type & get_val2() const { return expr.val2; }
- unsigned long int get_prec() const
- {
- unsigned long int prec1 = expr.val1.get_prec(),
- prec2 = expr.val2.get_prec();
- return (prec1 > prec2) ? prec1 : prec2;
- }
-};
-
-
-/**************** Special cases ****************/
-
-/* Some operations (i.e., add and subtract) with mixed mpz/mpq arguments
- can be done directly without first converting the mpz to mpq.
- Appropriate specializations of __gmp_expr are required. */
-
-
-#define __GMPZQ_DEFINE_EXPR(eval_fun) \
- \
-template <> \
-class __gmp_expr<mpq_t, __gmp_binary_expr<mpz_class, mpq_class, eval_fun> > \
-{ \
-private: \
- typedef mpz_class val1_type; \
- typedef mpq_class val2_type; \
- \
- __gmp_binary_expr<val1_type, val2_type, eval_fun> expr; \
-public: \
- __gmp_expr(const val1_type &val1, const val2_type &val2) \
- : expr(val1, val2) { } \
- void eval(mpq_ptr q) const \
- { eval_fun::eval(q, expr.val1.get_mpz_t(), expr.val2.get_mpq_t()); } \
- const val1_type & get_val1() const { return expr.val1; } \
- const val2_type & get_val2() const { return expr.val2; } \
- unsigned long int get_prec() const { return mpf_get_default_prec(); } \
-}; \
- \
-template <> \
-class __gmp_expr<mpq_t, __gmp_binary_expr<mpq_class, mpz_class, eval_fun> > \
-{ \
-private: \
- typedef mpq_class val1_type; \
- typedef mpz_class val2_type; \
- \
- __gmp_binary_expr<val1_type, val2_type, eval_fun> expr; \
-public: \
- __gmp_expr(const val1_type &val1, const val2_type &val2) \
- : expr(val1, val2) { } \
- void eval(mpq_ptr q) const \
- { eval_fun::eval(q, expr.val1.get_mpq_t(), expr.val2.get_mpz_t()); } \
- const val1_type & get_val1() const { return expr.val1; } \
- const val2_type & get_val2() const { return expr.val2; } \
- unsigned long int get_prec() const { return mpf_get_default_prec(); } \
-}; \
- \
-template <class T> \
-class __gmp_expr \
-<mpq_t, __gmp_binary_expr<mpz_class, __gmp_expr<mpq_t, T>, eval_fun> > \
-{ \
-private: \
- typedef mpz_class val1_type; \
- typedef __gmp_expr<mpq_t, T> val2_type; \
- \
- __gmp_binary_expr<val1_type, val2_type, eval_fun> expr; \
-public: \
- __gmp_expr(const val1_type &val1, const val2_type &val2) \
- : expr(val1, val2) { } \
- void eval(mpq_ptr q) const \
- { \
- mpq_class temp(expr.val2); \
- eval_fun::eval(q, expr.val1.get_mpz_t(), temp.get_mpq_t()); \
- } \
- const val1_type & get_val1() const { return expr.val1; } \
- const val2_type & get_val2() const { return expr.val2; } \
- unsigned long int get_prec() const { return mpf_get_default_prec(); } \
-}; \
- \
-template <class T> \
-class __gmp_expr \
-<mpq_t, __gmp_binary_expr<mpq_class, __gmp_expr<mpz_t, T>, eval_fun> > \
-{ \
-private: \
- typedef mpq_class val1_type; \
- typedef __gmp_expr<mpz_t, T> val2_type; \
- \
- __gmp_binary_expr<val1_type, val2_type, eval_fun> expr; \
-public: \
- __gmp_expr(const val1_type &val1, const val2_type &val2) \
- : expr(val1, val2) { } \
- void eval(mpq_ptr q) const \
- { \
- mpz_class temp(expr.val2); \
- eval_fun::eval(q, expr.val1.get_mpq_t(), temp.get_mpz_t()); \
- } \
- const val1_type & get_val1() const { return expr.val1; } \
- const val2_type & get_val2() const { return expr.val2; } \
- unsigned long int get_prec() const { return mpf_get_default_prec(); } \
-}; \
- \
-template <class T> \
-class __gmp_expr \
-<mpq_t, __gmp_binary_expr<__gmp_expr<mpz_t, T>, mpq_class, eval_fun> > \
-{ \
-private: \
- typedef __gmp_expr<mpz_t, T> val1_type; \
- typedef mpq_class val2_type; \
- \
- __gmp_binary_expr<val1_type, val2_type, eval_fun> expr; \
-public: \
- __gmp_expr(const val1_type &val1, const val2_type &val2) \
- : expr(val1, val2) { } \
- void eval(mpq_ptr q) const \
- { \
- mpz_class temp(expr.val1); \
- eval_fun::eval(q, temp.get_mpz_t(), expr.val2.get_mpq_t()); \
- } \
- const val1_type & get_val1() const { return expr.val1; } \
- const val2_type & get_val2() const { return expr.val2; } \
- unsigned long int get_prec() const { return mpf_get_default_prec(); } \
-}; \
- \
-template <class T> \
-class __gmp_expr \
-<mpq_t, __gmp_binary_expr<__gmp_expr<mpq_t, T>, mpz_class, eval_fun> > \
-{ \
-private: \
- typedef __gmp_expr<mpq_t, T> val1_type; \
- typedef mpz_class val2_type; \
- \
- __gmp_binary_expr<val1_type, val2_type, eval_fun> expr; \
-public: \
- __gmp_expr(const val1_type &val1, const val2_type &val2) \
- : expr(val1, val2) { } \
- void eval(mpq_ptr q) const \
- { \
- mpq_class temp(expr.val1); \
- eval_fun::eval(q, temp.get_mpq_t(), expr.val2.get_mpz_t()); \
- } \
- const val1_type & get_val1() const { return expr.val1; } \
- const val2_type & get_val2() const { return expr.val2; } \
- unsigned long int get_prec() const { return mpf_get_default_prec(); } \
-}; \
- \
-template <class T, class U> \
-class __gmp_expr<mpq_t, __gmp_binary_expr \
-<__gmp_expr<mpz_t, T>, __gmp_expr<mpq_t, U>, eval_fun> > \
-{ \
-private: \
- typedef __gmp_expr<mpz_t, T> val1_type; \
- typedef __gmp_expr<mpq_t, U> val2_type; \
- \
- __gmp_binary_expr<val1_type, val2_type, eval_fun> expr; \
-public: \
- __gmp_expr(const val1_type &val1, const val2_type &val2) \
- : expr(val1, val2) { } \
- void eval(mpq_ptr q) const \
- { \
- mpz_class temp1(expr.val1); \
- mpq_class temp2(expr.val2); \
- eval_fun::eval(q, temp1.get_mpz_t(), temp2.get_mpq_t()); \
- } \
- const val1_type & get_val1() const { return expr.val1; } \
- const val2_type & get_val2() const { return expr.val2; } \
- unsigned long int get_prec() const { return mpf_get_default_prec(); } \
-}; \
- \
-template <class T, class U> \
-class __gmp_expr<mpq_t, __gmp_binary_expr \
-<__gmp_expr<mpq_t, T>, __gmp_expr<mpz_t, U>, eval_fun> > \
-{ \
-private: \
- typedef __gmp_expr<mpq_t, T> val1_type; \
- typedef __gmp_expr<mpz_t, U> val2_type; \
- \
- __gmp_binary_expr<val1_type, val2_type, eval_fun> expr; \
-public: \
- __gmp_expr(const val1_type &val1, const val2_type &val2) \
- : expr(val1, val2) { } \
- void eval(mpq_ptr q) const \
- { \
- mpq_class temp1(expr.val1); \
- mpz_class temp2(expr.val2); \
- eval_fun::eval(q, temp1.get_mpq_t(), temp2.get_mpz_t()); \
- } \
- const val1_type & get_val1() const { return expr.val1; } \
- const val2_type & get_val2() const { return expr.val2; } \
- unsigned long int get_prec() const { return mpf_get_default_prec(); } \
-};
-
-
-__GMPZQ_DEFINE_EXPR(__gmp_binary_plus)
-__GMPZQ_DEFINE_EXPR(__gmp_binary_minus)
-
-
-
-/**************** Macros for defining functions ****************/
-/* Results of operators and functions are instances of __gmp_expr<T, U>.
- T determines the numerical type of the expression: it can be either
- mpz_t, mpq_t, or mpf_t. When the arguments of a binary
- expression have different numerical types, __gmp_resolve_expr is used
- to determine the "larger" type.
- U is either __gmp_unary_expr<V, Op> or __gmp_binary_expr<V, W, Op>,
- where V and W are the arguments' types -- they can in turn be
- expressions, thus allowing to build compound expressions to any
- degree of complexity.
- Op is a function object that must have an eval() method accepting
- appropriate arguments.
- Actual evaluation of a __gmp_expr<T, U> object is done when it gets
- assigned to an mp*_class ("lazy" evaluation): this is done by calling
- its eval() method. */
-
-
-// non-member unary operators and functions
-
-#define __GMP_DEFINE_UNARY_FUNCTION(fun, eval_fun) \
- \
-template <class T, class U> \
-inline __gmp_expr<T, __gmp_unary_expr<__gmp_expr<T, U>, eval_fun> > \
-fun(const __gmp_expr<T, U> &expr) \
-{ \
- return __gmp_expr<T, __gmp_unary_expr<__gmp_expr<T, U>, eval_fun> >(expr); \
-}
-
-#define __GMP_DEFINE_UNARY_TYPE_FUNCTION(type, fun, eval_fun) \
- \
-template <class T, class U> \
-inline type fun(const __gmp_expr<T, U> &expr) \
-{ \
- typename __gmp_resolve_temp<T, T, U>::temp_type temp(expr); \
- return eval_fun::eval(temp.__get_mp()); \
-}
-
-
-// non-member binary operators and functions
-
-#define __GMPP_DEFINE_BINARY_FUNCTION(fun, eval_fun) \
- \
-template <class T, class U, class V, class W> \
-inline __gmp_expr<typename __gmp_resolve_expr<T, V>::value_type, \
-__gmp_binary_expr<__gmp_expr<T, U>, __gmp_expr<V, W>, eval_fun> > \
-fun(const __gmp_expr<T, U> &expr1, const __gmp_expr<V, W> &expr2) \
-{ \
- return __gmp_expr<typename __gmp_resolve_expr<T, V>::value_type, \
- __gmp_binary_expr<__gmp_expr<T, U>, __gmp_expr<V, W>, eval_fun> > \
- (expr1, expr2); \
-}
-
-#define __GMPNN_DEFINE_BINARY_FUNCTION(fun, eval_fun, type, bigtype) \
- \
-template <class T, class U> \
-inline __gmp_expr \
-<T, __gmp_binary_expr<__gmp_expr<T, U>, bigtype, eval_fun> > \
-fun(const __gmp_expr<T, U> &expr, type t) \
-{ \
- return __gmp_expr \
- <T, __gmp_binary_expr<__gmp_expr<T, U>, bigtype, eval_fun> >(expr, t); \
-} \
- \
-template <class T, class U> \
-inline __gmp_expr \
-<T, __gmp_binary_expr<bigtype, __gmp_expr<T, U>, eval_fun> > \
-fun(type t, const __gmp_expr<T, U> &expr) \
-{ \
- return __gmp_expr \
- <T, __gmp_binary_expr<bigtype, __gmp_expr<T, U>, eval_fun> >(t, expr); \
-}
-
-#define __GMPNS_DEFINE_BINARY_FUNCTION(fun, eval_fun, type) \
-__GMPNN_DEFINE_BINARY_FUNCTION(fun, eval_fun, type, signed long int)
-
-#define __GMPNU_DEFINE_BINARY_FUNCTION(fun, eval_fun, type) \
-__GMPNN_DEFINE_BINARY_FUNCTION(fun, eval_fun, type, unsigned long int)
-
-#define __GMPND_DEFINE_BINARY_FUNCTION(fun, eval_fun, type) \
-__GMPNN_DEFINE_BINARY_FUNCTION(fun, eval_fun, type, double)
-
-#define __GMPNLD_DEFINE_BINARY_FUNCTION(fun, eval_fun, type) \
-__GMPNN_DEFINE_BINARY_FUNCTION(fun, eval_fun, type, long double)
-
-#define __GMPN_DEFINE_BINARY_FUNCTION(fun, eval_fun) \
-__GMPNS_DEFINE_BINARY_FUNCTION(fun, eval_fun, signed char) \
-__GMPNU_DEFINE_BINARY_FUNCTION(fun, eval_fun, unsigned char) \
-__GMPNS_DEFINE_BINARY_FUNCTION(fun, eval_fun, signed int) \
-__GMPNU_DEFINE_BINARY_FUNCTION(fun, eval_fun, unsigned int) \
-__GMPNS_DEFINE_BINARY_FUNCTION(fun, eval_fun, signed short int) \
-__GMPNU_DEFINE_BINARY_FUNCTION(fun, eval_fun, unsigned short int) \
-__GMPNS_DEFINE_BINARY_FUNCTION(fun, eval_fun, signed long int) \
-__GMPNU_DEFINE_BINARY_FUNCTION(fun, eval_fun, unsigned long int) \
-__GMPND_DEFINE_BINARY_FUNCTION(fun, eval_fun, float) \
-__GMPND_DEFINE_BINARY_FUNCTION(fun, eval_fun, double) \
-__GMPNLD_DEFINE_BINARY_FUNCTION(fun, eval_fun, long double)
-
-#define __GMP_DEFINE_BINARY_FUNCTION(fun, eval_fun) \
-__GMPP_DEFINE_BINARY_FUNCTION(fun, eval_fun) \
-__GMPN_DEFINE_BINARY_FUNCTION(fun, eval_fun)
-
-
-#define __GMP_DEFINE_BINARY_FUNCTION_UI(fun, eval_fun) \
- \
-template <class T, class U> \
-inline __gmp_expr \
-<T, __gmp_binary_expr<__gmp_expr<T, U>, unsigned long int, eval_fun> > \
-fun(const __gmp_expr<T, U> &expr, unsigned long int l) \
-{ \
- return __gmp_expr<T, __gmp_binary_expr \
- <__gmp_expr<T, U>, unsigned long int, eval_fun> >(expr, l); \
-}
-
-
-#define __GMPP_DEFINE_BINARY_TYPE_FUNCTION(type, fun, eval_fun) \
- \
-template <class T, class U, class V, class W> \
-inline type fun(const __gmp_expr<T, U> &expr1, \
- const __gmp_expr<V, W> &expr2) \
-{ \
- typedef typename __gmp_resolve_expr<T, V>::value_type eval_type; \
- typename __gmp_resolve_temp<eval_type, T, U>::temp_type temp1(expr1); \
- typename __gmp_resolve_temp<eval_type, V, W>::temp_type temp2(expr2); \
- return eval_fun::eval(temp1.__get_mp(), temp2.__get_mp()); \
-}
-
-#define __GMPNN_DEFINE_BINARY_TYPE_FUNCTION(type, fun, eval_fun, \
- type2, bigtype) \
- \
-template <class T, class U> \
-inline type fun(const __gmp_expr<T, U> &expr, type2 t) \
-{ \
- typename __gmp_resolve_temp<T, T, U>::temp_type temp(expr); \
- return eval_fun::eval(temp.__get_mp(), static_cast<bigtype>(t)); \
-} \
- \
-template <class T, class U> \
-inline type fun(type2 t, const __gmp_expr<T, U> &expr) \
-{ \
- typename __gmp_resolve_temp<T, T, U>::temp_type temp(expr); \
- return eval_fun::eval(static_cast<bigtype>(t), temp.__get_mp()); \
-}
-
-#define __GMPNS_DEFINE_BINARY_TYPE_FUNCTION(type, fun, eval_fun, type2) \
-__GMPNN_DEFINE_BINARY_TYPE_FUNCTION(type, fun, eval_fun, \
- type2, signed long int)
-
-#define __GMPNU_DEFINE_BINARY_TYPE_FUNCTION(type, fun, eval_fun, type2) \
-__GMPNN_DEFINE_BINARY_TYPE_FUNCTION(type, fun, eval_fun, \
- type2, unsigned long int)
-
-#define __GMPND_DEFINE_BINARY_TYPE_FUNCTION(type, fun, eval_fun, type2) \
-__GMPNN_DEFINE_BINARY_TYPE_FUNCTION(type, fun, eval_fun, type2, double)
-
-#define __GMPNLD_DEFINE_BINARY_TYPE_FUNCTION(type, fun, eval_fun, type2) \
-__GMPNN_DEFINE_BINARY_TYPE_FUNCTION(type, fun, eval_fun, type2, long double)
-
-#define __GMPN_DEFINE_BINARY_TYPE_FUNCTION(type, fun, eval_fun) \
-__GMPNS_DEFINE_BINARY_TYPE_FUNCTION(type, fun, eval_fun, signed char) \
-__GMPNU_DEFINE_BINARY_TYPE_FUNCTION(type, fun, eval_fun, unsigned char) \
-__GMPNS_DEFINE_BINARY_TYPE_FUNCTION(type, fun, eval_fun, signed int) \
-__GMPNU_DEFINE_BINARY_TYPE_FUNCTION(type, fun, eval_fun, unsigned int) \
-__GMPNS_DEFINE_BINARY_TYPE_FUNCTION(type, fun, eval_fun, signed short int) \
-__GMPNU_DEFINE_BINARY_TYPE_FUNCTION(type, fun, eval_fun, unsigned short int) \
-__GMPNS_DEFINE_BINARY_TYPE_FUNCTION(type, fun, eval_fun, signed long int) \
-__GMPNU_DEFINE_BINARY_TYPE_FUNCTION(type, fun, eval_fun, unsigned long int) \
-__GMPND_DEFINE_BINARY_TYPE_FUNCTION(type, fun, eval_fun, float) \
-__GMPND_DEFINE_BINARY_TYPE_FUNCTION(type, fun, eval_fun, double) \
-__GMPNLD_DEFINE_BINARY_TYPE_FUNCTION(type, fun, eval_fun, long double)
-
-#define __GMP_DEFINE_BINARY_TYPE_FUNCTION(type, fun, eval_fun) \
-__GMPP_DEFINE_BINARY_TYPE_FUNCTION(type, fun, eval_fun) \
-__GMPN_DEFINE_BINARY_TYPE_FUNCTION(type, fun, eval_fun)
-
-
-// member operators
-
-#define __GMPP_DEFINE_COMPOUND_OPERATOR(type, fun, eval_fun) \
- \
-template <class T, class U> \
-inline type##_class & type##_class::fun(const __gmp_expr<T, U> &expr) \
-{ \
- __gmp_set_expr(mp, __gmp_expr<type##_t, __gmp_binary_expr \
- <type##_class, __gmp_expr<T, U>, eval_fun> >(*this, expr)); \
- return *this; \
-}
-
-#define __GMPNN_DEFINE_COMPOUND_OPERATOR(type, fun, eval_fun, \
- type2, bigtype) \
- \
-inline type##_class & type##_class::fun(type2 t) \
-{ \
- __gmp_set_expr(mp, __gmp_expr<type##_t, __gmp_binary_expr \
- <type##_class, bigtype, eval_fun> >(*this, t)); \
- return *this; \
-}
-
-#define __GMPNS_DEFINE_COMPOUND_OPERATOR(type, fun, eval_fun, type2) \
-__GMPNN_DEFINE_COMPOUND_OPERATOR(type, fun, eval_fun, \
- type2, signed long int)
-
-#define __GMPNU_DEFINE_COMPOUND_OPERATOR(type, fun, eval_fun, type2) \
-__GMPNN_DEFINE_COMPOUND_OPERATOR(type, fun, eval_fun, \
- type2, unsigned long int)
-
-#define __GMPND_DEFINE_COMPOUND_OPERATOR(type, fun, eval_fun, type2) \
-__GMPNN_DEFINE_COMPOUND_OPERATOR(type, fun, eval_fun, type2, double)
-
-#define __GMPNLD_DEFINE_COMPOUND_OPERATOR(type, fun, eval_fun, type2) \
-__GMPNN_DEFINE_COMPOUND_OPERATOR(type, fun, eval_fun, type2, long double)
-
-#define __GMPN_DEFINE_COMPOUND_OPERATOR(type, fun, eval_fun) \
-__GMPNS_DEFINE_COMPOUND_OPERATOR(type, fun, eval_fun, signed char) \
-__GMPNU_DEFINE_COMPOUND_OPERATOR(type, fun, eval_fun, unsigned char) \
-__GMPNS_DEFINE_COMPOUND_OPERATOR(type, fun, eval_fun, signed int) \
-__GMPNU_DEFINE_COMPOUND_OPERATOR(type, fun, eval_fun, unsigned int) \
-__GMPNS_DEFINE_COMPOUND_OPERATOR(type, fun, eval_fun, signed short int) \
-__GMPNU_DEFINE_COMPOUND_OPERATOR(type, fun, eval_fun, unsigned short int) \
-__GMPNS_DEFINE_COMPOUND_OPERATOR(type, fun, eval_fun, signed long int) \
-__GMPNU_DEFINE_COMPOUND_OPERATOR(type, fun, eval_fun, unsigned long int) \
-__GMPND_DEFINE_COMPOUND_OPERATOR(type, fun, eval_fun, float) \
-__GMPND_DEFINE_COMPOUND_OPERATOR(type, fun, eval_fun, double) \
-/* __GMPNLD_DEFINE_COMPOUND_OPERATOR(type, fun, eval_fun, long double) */
-
-#define __GMP_DEFINE_COMPOUND_OPERATOR(type, fun, eval_fun) \
-__GMPP_DEFINE_COMPOUND_OPERATOR(type, fun, eval_fun) \
-__GMPN_DEFINE_COMPOUND_OPERATOR(type, fun, eval_fun)
-
-#define __GMPZ_DEFINE_COMPOUND_OPERATOR(fun, eval_fun) \
-__GMP_DEFINE_COMPOUND_OPERATOR(mpz, fun, eval_fun)
-
-#define __GMPQ_DEFINE_COMPOUND_OPERATOR(fun, eval_fun) \
-__GMP_DEFINE_COMPOUND_OPERATOR(mpq, fun, eval_fun)
-
-#define __GMPF_DEFINE_COMPOUND_OPERATOR(fun, eval_fun) \
-__GMP_DEFINE_COMPOUND_OPERATOR(mpf, fun, eval_fun)
-
-
-
-#define __GMP_DEFINE_COMPOUND_OPERATOR_UI(type, fun, eval_fun) \
- \
-inline type##_class & type##_class::fun(unsigned long int l) \
-{ \
- __gmp_set_expr(mp, __gmp_expr<type##_t, __gmp_binary_expr \
- <type##_class, unsigned long int, eval_fun> >(*this, l)); \
- return *this; \
-}
-
-#define __GMPZ_DEFINE_COMPOUND_OPERATOR_UI(fun, eval_fun) \
-__GMP_DEFINE_COMPOUND_OPERATOR_UI(mpz, fun, eval_fun)
-
-#define __GMPQ_DEFINE_COMPOUND_OPERATOR_UI(fun, eval_fun) \
-__GMP_DEFINE_COMPOUND_OPERATOR_UI(mpq, fun, eval_fun)
-
-#define __GMPF_DEFINE_COMPOUND_OPERATOR_UI(fun, eval_fun) \
-__GMP_DEFINE_COMPOUND_OPERATOR_UI(mpf, fun, eval_fun)
-
-
-
-#define __GMP_DEFINE_INCREMENT_OPERATOR(type, fun, eval_fun) \
- \
-inline type##_class & type##_class::fun() \
-{ \
- eval_fun::eval(mp); \
- return *this; \
-} \
- \
-inline type##_class type##_class::fun(int) \
-{ \
- type##_class temp(*this); \
- eval_fun::eval(mp); \
- return temp; \
-}
-
-#define __GMPZ_DEFINE_INCREMENT_OPERATOR(fun, eval_fun) \
-__GMP_DEFINE_INCREMENT_OPERATOR(mpz, fun, eval_fun)
-
-#define __GMPQ_DEFINE_INCREMENT_OPERATOR(fun, eval_fun) \
-__GMP_DEFINE_INCREMENT_OPERATOR(mpq, fun, eval_fun)
-
-#define __GMPF_DEFINE_INCREMENT_OPERATOR(fun, eval_fun) \
-__GMP_DEFINE_INCREMENT_OPERATOR(mpf, fun, eval_fun)
-
-
-
-/**************** Arithmetic operators and functions ****************/
-
-// non-member operators and functions
-
-__GMP_DEFINE_UNARY_FUNCTION(operator+, __gmp_unary_plus)
-__GMP_DEFINE_UNARY_FUNCTION(operator-, __gmp_unary_minus)
-__GMP_DEFINE_UNARY_FUNCTION(operator~, __gmp_unary_com)
-
-__GMP_DEFINE_BINARY_FUNCTION(operator+, __gmp_binary_plus)
-__GMP_DEFINE_BINARY_FUNCTION(operator-, __gmp_binary_minus)
-__GMP_DEFINE_BINARY_FUNCTION(operator*, __gmp_binary_multiplies)
-__GMP_DEFINE_BINARY_FUNCTION(operator/, __gmp_binary_divides)
-__GMP_DEFINE_BINARY_FUNCTION(operator%, __gmp_binary_modulus)
-__GMP_DEFINE_BINARY_FUNCTION(operator&, __gmp_binary_and)
-__GMP_DEFINE_BINARY_FUNCTION(operator|, __gmp_binary_ior)
-__GMP_DEFINE_BINARY_FUNCTION(operator^, __gmp_binary_xor)
-
-__GMP_DEFINE_BINARY_FUNCTION_UI(operator<<, __gmp_binary_lshift)
-__GMP_DEFINE_BINARY_FUNCTION_UI(operator>>, __gmp_binary_rshift)
-
-__GMP_DEFINE_BINARY_TYPE_FUNCTION(bool, operator==, __gmp_binary_equal)
-__GMP_DEFINE_BINARY_TYPE_FUNCTION(bool, operator!=, __gmp_binary_not_equal)
-__GMP_DEFINE_BINARY_TYPE_FUNCTION(bool, operator<, __gmp_binary_less)
-__GMP_DEFINE_BINARY_TYPE_FUNCTION(bool, operator<=, __gmp_binary_less_equal)
-__GMP_DEFINE_BINARY_TYPE_FUNCTION(bool, operator>, __gmp_binary_greater)
-__GMP_DEFINE_BINARY_TYPE_FUNCTION(bool, operator>=, \
- __gmp_binary_greater_equal)
-
-__GMP_DEFINE_UNARY_FUNCTION(abs, __gmp_abs_function)
-__GMP_DEFINE_UNARY_FUNCTION(trunc, __gmp_trunc_function)
-__GMP_DEFINE_UNARY_FUNCTION(floor, __gmp_floor_function)
-__GMP_DEFINE_UNARY_FUNCTION(ceil, __gmp_ceil_function)
-__GMP_DEFINE_UNARY_FUNCTION(sqrt, __gmp_sqrt_function)
-__GMP_DEFINE_BINARY_FUNCTION(hypot, __gmp_hypot_function)
-
-__GMP_DEFINE_UNARY_TYPE_FUNCTION(int, sgn, __gmp_sgn_function)
-__GMP_DEFINE_BINARY_TYPE_FUNCTION(int, cmp, __gmp_cmp_function)
-
-// member operators for mpz_class
-
-__GMPZ_DEFINE_COMPOUND_OPERATOR(operator+=, __gmp_binary_plus)
-__GMPZ_DEFINE_COMPOUND_OPERATOR(operator-=, __gmp_binary_minus)
-__GMPZ_DEFINE_COMPOUND_OPERATOR(operator*=, __gmp_binary_multiplies)
-__GMPZ_DEFINE_COMPOUND_OPERATOR(operator/=, __gmp_binary_divides)
-__GMPZ_DEFINE_COMPOUND_OPERATOR(operator%=, __gmp_binary_modulus)
-
-__GMPZ_DEFINE_COMPOUND_OPERATOR(operator&=, __gmp_binary_and)
-__GMPZ_DEFINE_COMPOUND_OPERATOR(operator|=, __gmp_binary_ior)
-__GMPZ_DEFINE_COMPOUND_OPERATOR(operator^=, __gmp_binary_xor)
-
-__GMPZ_DEFINE_COMPOUND_OPERATOR_UI(operator<<=, __gmp_binary_lshift)
-__GMPZ_DEFINE_COMPOUND_OPERATOR_UI(operator>>=, __gmp_binary_rshift)
-
-__GMPZ_DEFINE_INCREMENT_OPERATOR(operator++, __gmp_unary_increment)
-__GMPZ_DEFINE_INCREMENT_OPERATOR(operator--, __gmp_unary_decrement)
-
-// member operators for mpq_class
-
-__GMPQ_DEFINE_COMPOUND_OPERATOR(operator+=, __gmp_binary_plus)
-__GMPQ_DEFINE_COMPOUND_OPERATOR(operator-=, __gmp_binary_minus)
-__GMPQ_DEFINE_COMPOUND_OPERATOR(operator*=, __gmp_binary_multiplies)
-__GMPQ_DEFINE_COMPOUND_OPERATOR(operator/=, __gmp_binary_divides)
-
-__GMPQ_DEFINE_COMPOUND_OPERATOR_UI(operator<<=, __gmp_binary_lshift)
-__GMPQ_DEFINE_COMPOUND_OPERATOR_UI(operator>>=, __gmp_binary_rshift)
-
-__GMPQ_DEFINE_INCREMENT_OPERATOR(operator++, __gmp_unary_increment)
-__GMPQ_DEFINE_INCREMENT_OPERATOR(operator--, __gmp_unary_decrement)
-
-// member operators for mpf_class
-
-__GMPF_DEFINE_COMPOUND_OPERATOR(operator+=, __gmp_binary_plus)
-__GMPF_DEFINE_COMPOUND_OPERATOR(operator-=, __gmp_binary_minus)
-__GMPF_DEFINE_COMPOUND_OPERATOR(operator*=, __gmp_binary_multiplies)
-__GMPF_DEFINE_COMPOUND_OPERATOR(operator/=, __gmp_binary_divides)
-
-__GMPF_DEFINE_COMPOUND_OPERATOR_UI(operator<<=, __gmp_binary_lshift)
-__GMPF_DEFINE_COMPOUND_OPERATOR_UI(operator>>=, __gmp_binary_rshift)
-
-__GMPF_DEFINE_INCREMENT_OPERATOR(operator++, __gmp_unary_increment)
-__GMPF_DEFINE_INCREMENT_OPERATOR(operator--, __gmp_unary_decrement)
-
-
-
-/**************** Class wrapper for gmp_randstate_t ****************/
-
-class __gmp_urandomb_value { };
-class __gmp_urandomm_value { };
-
-template <>
-class __gmp_expr<mpz_t, __gmp_urandomb_value>
-{
-private:
- __gmp_randstate_struct *state;
- unsigned long int bits;
-public:
- __gmp_expr(gmp_randstate_t s, unsigned long int l) : state(s), bits(l) { }
- void eval(mpz_ptr z) const { __gmp_rand_function::eval(z, state, bits); }
- unsigned long int get_prec() const { return mpf_get_default_prec(); }
-};
-
-template <>
-class __gmp_expr<mpz_t, __gmp_urandomm_value>
-{
-private:
- __gmp_randstate_struct *state;
- mpz_class range;
-public:
- __gmp_expr(gmp_randstate_t s, const mpz_class &z) : state(s), range(z) { }
- void eval(mpz_ptr z) const
- { __gmp_rand_function::eval(z, state, range.get_mpz_t()); }
- unsigned long int get_prec() const { return mpf_get_default_prec(); }
-};
-
-template <>
-class __gmp_expr<mpf_t, __gmp_urandomb_value>
-{
-private:
- __gmp_randstate_struct *state;
- unsigned long int bits;
-public:
- __gmp_expr(gmp_randstate_t s, unsigned long int l) : state(s), bits(l) { }
- void eval(mpf_ptr f, unsigned long int prec) const
- { __gmp_rand_function::eval(f, state, (bits>0) ? get_prec() : prec); }
- unsigned long int get_prec() const
- {
- if (bits == 0)
- return mpf_get_default_prec();
- else
- return bits;
- }
-};
-
-extern "C" {
- typedef void __gmp_randinit_default_t (gmp_randstate_t);
- typedef void __gmp_randinit_lc_2exp_t (gmp_randstate_t, mpz_srcptr, unsigned long int, unsigned long int);
- typedef int __gmp_randinit_lc_2exp_size_t (gmp_randstate_t, unsigned long int);
-}
-
-class gmp_randclass
-{
-private:
- gmp_randstate_t state;
-
- // copy construction and assignment not allowed
- gmp_randclass(const gmp_randclass &);
- void operator=(const gmp_randclass &);
-public:
- // constructors and destructor
- gmp_randclass(gmp_randalg_t alg, unsigned long int size)
- {
- switch (alg)
- {
- case GMP_RAND_ALG_LC: // no other cases for now
- default:
- gmp_randinit(state, alg, size);
- break;
- }
- }
-
- // gmp_randinit_default
- gmp_randclass(__gmp_randinit_default_t* f) { f(state); }
-
- // gmp_randinit_lc_2exp
- gmp_randclass(__gmp_randinit_lc_2exp_t* f,
- mpz_class z, unsigned long int l1, unsigned long int l2)
- { f(state, z.get_mpz_t(), l1, l2); }
-
- // gmp_randinit_lc_2exp_size
- gmp_randclass(__gmp_randinit_lc_2exp_size_t* f,
- unsigned long int size)
- {
- if (f (state, size) == 0)
- throw std::length_error ("gmp_randinit_lc_2exp_size");
- }
-
- ~gmp_randclass() { gmp_randclear(state); }
-
- // initialize
- void seed(); // choose a random seed some way (?)
- void seed(unsigned long int s) { gmp_randseed_ui(state, s); }
- void seed(const mpz_class &z) { gmp_randseed(state, z.get_mpz_t()); }
-
- // get random number
- __gmp_expr<mpz_t, __gmp_urandomb_value> get_z_bits(unsigned long int l)
- { return __gmp_expr<mpz_t, __gmp_urandomb_value>(state, l); }
- __gmp_expr<mpz_t, __gmp_urandomb_value> get_z_bits(const mpz_class &z)
- { return get_z_bits(z.get_ui()); }
-
- __gmp_expr<mpz_t, __gmp_urandomm_value> get_z_range(const mpz_class &z)
- { return __gmp_expr<mpz_t, __gmp_urandomm_value>(state, z); }
-
- __gmp_expr<mpf_t, __gmp_urandomb_value> get_f(unsigned long int prec = 0)
- { return __gmp_expr<mpf_t, __gmp_urandomb_value>(state, prec); }
-};
-
-
-/**************** #undef all private macros ****************/
-
-#undef __GMPP_DECLARE_COMPOUND_OPERATOR
-#undef __GMPN_DECLARE_COMPOUND_OPERATOR
-#undef __GMP_DECLARE_COMPOUND_OPERATOR
-#undef __GMP_DECLARE_COMPOUND_OPERATOR_UI
-#undef __GMP_DECLARE_INCREMENT_OPERATOR
-
-#undef __GMPZQ_DEFINE_EXPR
-
-#undef __GMP_DEFINE_UNARY_FUNCTION
-#undef __GMP_DEFINE_UNARY_TYPE_FUNCTION
-
-#undef __GMPP_DEFINE_BINARY_FUNCTION
-#undef __GMPNN_DEFINE_BINARY_FUNCTION
-#undef __GMPNS_DEFINE_BINARY_FUNCTION
-#undef __GMPNU_DEFINE_BINARY_FUNCTION
-#undef __GMPND_DEFINE_BINARY_FUNCTION
-#undef __GMPNLD_DEFINE_BINARY_FUNCTION
-#undef __GMPN_DEFINE_BINARY_FUNCTION
-#undef __GMP_DEFINE_BINARY_FUNCTION
-
-#undef __GMP_DEFINE_BINARY_FUNCTION_UI
-
-#undef __GMPP_DEFINE_BINARY_TYPE_FUNCTION
-#undef __GMPNN_DEFINE_BINARY_TYPE_FUNCTION
-#undef __GMPNS_DEFINE_BINARY_TYPE_FUNCTION
-#undef __GMPNU_DEFINE_BINARY_TYPE_FUNCTION
-#undef __GMPND_DEFINE_BINARY_TYPE_FUNCTION
-#undef __GMPNLD_DEFINE_BINARY_TYPE_FUNCTION
-#undef __GMPN_DEFINE_BINARY_TYPE_FUNCTION
-#undef __GMP_DEFINE_BINARY_TYPE_FUNCTION
-
-#undef __GMPZ_DEFINE_COMPOUND_OPERATOR
-#undef __GMPZN_DEFINE_COMPOUND_OPERATOR
-#undef __GMPZNN_DEFINE_COMPOUND_OPERATOR
-#undef __GMPZNS_DEFINE_COMPOUND_OPERATOR
-#undef __GMPZNU_DEFINE_COMPOUND_OPERATOR
-#undef __GMPZND_DEFINE_COMPOUND_OPERATOR
-#undef __GMPZNLD_DEFINE_COMPOUND_OPERATOR
-
-#undef __GMPP_DEFINE_COMPOUND_OPERATOR
-#undef __GMPNN_DEFINE_COMPOUND_OPERATOR
-#undef __GMPNS_DEFINE_COMPOUND_OPERATOR
-#undef __GMPNU_DEFINE_COMPOUND_OPERATOR
-#undef __GMPND_DEFINE_COMPOUND_OPERATOR
-#undef __GMPNLD_DEFINE_COMPOUND_OPERATOR
-#undef __GMPN_DEFINE_COMPOUND_OPERATOR
-#undef __GMP_DEFINE_COMPOUND_OPERATOR
-
-#undef __GMPQ_DEFINE_COMPOUND_OPERATOR
-#undef __GMPF_DEFINE_COMPOUND_OPERATOR
-
-#undef __GMP_DEFINE_COMPOUND_OPERATOR_UI
-#undef __GMPZ_DEFINE_COMPOUND_OPERATOR_UI
-#undef __GMPQ_DEFINE_COMPOUND_OPERATOR_UI
-#undef __GMPF_DEFINE_COMPOUND_OPERATOR_UI
-
-#undef __GMP_DEFINE_INCREMENT_OPERATOR
-#undef __GMPZ_DEFINE_INCREMENT_OPERATOR
-#undef __GMPQ_DEFINE_INCREMENT_OPERATOR
-#undef __GMPF_DEFINE_INCREMENT_OPERATOR
-
-#endif /* __GMP_PLUSPLUS__ */
diff --git a/library/GMP/lib/libgmp.a b/library/GMP/lib/libgmp.a
deleted file mode 100644
index e53850ec..00000000
--- a/library/GMP/lib/libgmp.a
+++ /dev/null
Binary files differ
diff --git a/library/GMP/lib/libgmp.la b/library/GMP/lib/libgmp.la
deleted file mode 100644
index a0e34d40..00000000
--- a/library/GMP/lib/libgmp.la
+++ /dev/null
@@ -1,35 +0,0 @@
-# libgmp.la - a libtool library file
-# Generated by ltmain.sh - GNU libtool 1.5.24 (1.1220.2.455 2007/06/24 02:13:29)
-#
-# Please DO NOT delete this file!
-# It is necessary for linking the library.
-
-# The name that we can dlopen(3).
-dlname=''
-
-# Names of this library.
-library_names=''
-
-# The name of the static archive.
-old_library='libgmp.a'
-
-# Libraries that this one depends upon.
-dependency_libs=''
-
-# Version information for libgmp.
-current=7
-age=4
-revision=3
-
-# Is this an already installed library?
-installed=yes
-
-# Should we warn about portability when linking against -modules?
-shouldnotlink=no
-
-# Files to dlopen/dlpreopen
-dlopen=''
-dlpreopen=''
-
-# Directory that this library needs to be installed in:
-libdir='/c/gmp/lib'
diff --git a/library/GMP/lib/libgmpxx.a b/library/GMP/lib/libgmpxx.a
deleted file mode 100644
index 3c4452d3..00000000
--- a/library/GMP/lib/libgmpxx.a
+++ /dev/null
Binary files differ
diff --git a/library/GMP/lib/libgmpxx.la b/library/GMP/lib/libgmpxx.la
deleted file mode 100644
index dbb77dd0..00000000
--- a/library/GMP/lib/libgmpxx.la
+++ /dev/null
@@ -1,35 +0,0 @@
-# libgmpxx.la - a libtool library file
-# Generated by ltmain.sh - GNU libtool 1.5.24 (1.1220.2.455 2007/06/24 02:13:29)
-#
-# Please DO NOT delete this file!
-# It is necessary for linking the library.
-
-# The name that we can dlopen(3).
-dlname=''
-
-# Names of this library.
-library_names=''
-
-# The name of the static archive.
-old_library='libgmpxx.a'
-
-# Libraries that this one depends upon.
-dependency_libs=' /c/gmp/lib/libgmp.la'
-
-# Version information for libgmpxx.
-current=4
-age=0
-revision=3
-
-# Is this an already installed library?
-installed=yes
-
-# Should we warn about portability when linking against -modules?
-shouldnotlink=no
-
-# Files to dlopen/dlpreopen
-dlopen=''
-dlpreopen=''
-
-# Directory that this library needs to be installed in:
-libdir='/c/gmp/lib'
diff --git a/library/globalFunctions.cpp b/library/globalFunctions.cpp
index d0aad7a4..db7211ef 100644
--- a/library/globalFunctions.cpp
+++ b/library/globalFunctions.cpp
@@ -7,29 +7,6 @@ int globalFunctions::round(const double d)
return static_cast<int>(d<0?d-.5:d+.5);
}
-inline
-int globalFunctions::abs(const int d)
-{
- return(d<0?-d:d);
-}
-
-inline
-unsigned int globalFunctions::abs(const unsigned int d)
-{
- return(d<0?-d:d);
-}
-
-inline
-float globalFunctions::abs(const float d)
-{
- return(d<0?-d:d);
-};
-
-inline
-double globalFunctions::abs(const double d)
-{
- return(d<0?-d:d);
-}
string globalFunctions::numberToString(const unsigned int number)
{
@@ -38,6 +15,7 @@ string globalFunctions::numberToString(const unsigned int number)
return string(result);
}
+
string globalFunctions::numberToString(const int number)
{
char result[100];
@@ -45,6 +23,7 @@ string globalFunctions::numberToString(const int number)
return string(result);
}
+
string globalFunctions::numberToString(const float number)
{
char result[100];
@@ -52,33 +31,39 @@ string globalFunctions::numberToString(const float number)
return string(result);
}
+
wxString globalFunctions::numberToWxString(const unsigned int number)
{
return wxString::Format(wxT("%u"), number);
}
+
wxString globalFunctions::numberToWxString(const int number)
{
return wxString::Format(wxT("%i"), number);
}
+
wxString globalFunctions::numberToWxString(const float number)
{
return wxString::Format(wxT("%f"), number);
}
+
inline
int globalFunctions::stringToInt(const string& number)
{
return atoi(number.c_str());
}
+
inline
double globalFunctions::stringToDouble(const string& number)
{
return atof(number.c_str());
}
+
inline
int globalFunctions::wxStringToInt(const wxString& number)
{
@@ -89,6 +74,7 @@ int globalFunctions::wxStringToInt(const wxString& number)
throw std::runtime_error("Error when converting number to long");
}
+
inline
double globalFunctions::wxStringToDouble(const wxString& number)
{
@@ -99,6 +85,7 @@ double globalFunctions::wxStringToDouble(const wxString& number)
throw std::runtime_error("Error when converting number to double");
}
+
wxString& globalFunctions::includeNumberSeparator(wxString& number)
{
for (int i = number.size() - 3; i > 0; i-= 3)
diff --git a/library/globalFunctions.h b/library/globalFunctions.h
index 5fe576e1..d9c0d69f 100644
--- a/library/globalFunctions.h
+++ b/library/globalFunctions.h
@@ -12,10 +12,11 @@ namespace globalFunctions
{
int round(double d); //little rounding function
- int abs(const int d); //absolute value
- unsigned int abs(const unsigned int d); //absolute value
- float abs(const float d); //absolute value
- double abs(const double d); //absolute value
+ template <class T>
+ T abs(const T& d) //absolute value
+ {
+ return(d<0?-d:d);
+ }
string numberToString(const unsigned int number); //Convert number to string
string numberToString(const int number); //Convert number to string
diff --git a/library/md5.c b/library/md5.c
deleted file mode 100644
index 041860b4..00000000
--- a/library/md5.c
+++ /dev/null
@@ -1,650 +0,0 @@
-/*
- * Functions to compute MD5 message digest of files or memory blocks
- * according to the definition of MD5 in RFC 1321 from April 1992.
- * Copyright (C) 1995, 1996 Free Software Foundation, Inc. NOTE: The
- * canonical source of this file is maintained with the GNU C Library.
- * Bugs can be reported to bug-glibc@prep.ai.mit.edu.
- *
- * 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; either version 2, or (at your
- * option) any later version.
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- *
- * Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
- * Modified by Gray Watson <http://256.com/gray/>, 1997.
- *
- * $Id: md5.c,v 1.7 2006/03/05 15:38:09 gray Exp $
- */
-
-/*
- * NOTE: during quick performance tests on a Sun Sparc Ultra 1 and an
- * Alpha 255 300, these functions performed upwards of 3mb/sec
- * including disk I/O time.
- */
-
-/*
- * MD5 Test Suite from RFC1321: http://ds.internic.net:/rfc/rfc1321.txt
- *
- * MD5 ("") = d41d8cd98f00b204e9800998ecf8427e
- * MD5 ("a") = 0cc175b9c0f1b6a831c399e269772661
- * MD5 ("abc") = 900150983cd24fb0d6963f7d28e17f72
- * MD5 ("message digest") = f96b697d7cb7938d525a2f31aaf161d0
- * MD5 ("abcdefghijklmnopqrstuvwxyz") = c3fcd3d76192e4007dfb496cca67e13b
- * MD5 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") =
- * d174ab98d277d9f5a5611c2c9f419d9f
- * MD5 ("123456789012345678901234567890123456789012345678901234567890123456
- * 78901234567890") = 57edf4a22be3c955ac49da2e2107b67a
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include "md5.h"
-
-#define HEX_STRING "0123456789abcdef" /* to convert to hex */
-#define BLOCK_SIZE_MASK (MD5_BLOCK_SIZE - 1)
-
-/*
- * Define my endian-ness. Could not do in a portable manner using the
- * include files -- grumble.
- */
-#if defined(__alpha) || defined(WIN32) || defined(__i386__)
-/*
- * little endian
- */
-#define SWAP(n) (n)
-#endif
-
-#if defined(__sparc) || defined(__powerpc__)
-/*
- * big endian - big is better
- */
-#define SWAP(n) \
- (((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24))
-#endif
-
-/*
- * These are the four functions used in the four steps of the MD5
- * algorithm and defined in the RFC 1321. The first function is a
- * little bit optimized (as found in Colin Plumbs public domain
- * implementation).
- */
-/* #define FF(b, c, d) ((b & c) | (~b & d)) */
-#define FF(b, c, d) (d ^ (b & (c ^ d)))
-#define FG(b, c, d) FF(d, b, c)
-#define FH(b, c, d) (b ^ c ^ d)
-#define FI(b, c, d) (c ^ (b | ~d))
-
-/*
- * It is unfortunate that C does not provide an operator for cyclic
- * rotation. Hope the C compiler is smart enough. -- Modified to
- * remove the w = at the front - Gray 2/97
- */
-#define CYCLIC(w, s) ((w << s) | (w >> (32 - s)))
-
-/*
- * First Round: using the given function, the context and a constant
- * the next context is computed. Because the algorithms processing
- * unit is a 32-bit word and it is determined to work on words in
- * little endian byte order we perhaps have to change the byte order
- * before the computation. To reduce the work for the next steps we
- * store the swapped words in the array CORRECT_WORDS. -- Modified to
- * fix the handling of unaligned buffer spaces - Gray 7/97
- */
-#define OP1(a, b, c, d, b_p, c_p, s, T) \
- do { \
- memcpy(c_p, b_p, sizeof(md5_uint32)); \
- *c_p = SWAP(*c_p); \
- a += FF (b, c, d) + *c_p + T; \
- a = CYCLIC (a, s); \
- a += b; \
- b_p = (char *)b_p + sizeof(md5_uint32); \
- c_p++; \
- } while (0)
-
-/*
- * Second to Fourth Round: we have the possibly swapped words in
- * CORRECT_WORDS. Redefine the macro to take an additional first
- * argument specifying the function to use.
- */
-#define OP234(FUNC, a, b, c, d, k, s, T) \
- do { \
- a += FUNC (b, c, d) + k + T; \
- a = CYCLIC (a, s); \
- a += b; \
- } while (0)
-
-/****************************** local routines *******************************/
-
-/*
- * process_block
- *
- * DESCRIPTION:
- *
- * Process a block of bytes into a MD5 state structure.
- *
- * RETURNS:
- *
- * None.
- *
- * ARGUMENTS:
- *
- * md5_p - Pointer to MD5 structure from which we are getting the result.
- *
- * buffer - A buffer of bytes whose MD5 signature we are calculating.
- *
- * buf_len - The length of the buffer.
- */
-static void process_block(md5_t *md5_p, const void *buffer,
- const unsigned int buf_len)
-{
- md5_uint32 correct[16];
- const void *buf_p = buffer, *end_p;
- unsigned int words_n;
- md5_uint32 A, B, C, D;
-
- words_n = buf_len / sizeof(md5_uint32);
- end_p = (char *)buf_p + words_n * sizeof(md5_uint32);
-
- A = md5_p->md_A;
- B = md5_p->md_B;
- C = md5_p->md_C;
- D = md5_p->md_D;
-
- /*
- * First increment the byte count. RFC 1321 specifies the possible
- * length of the file up to 2^64 bits. Here we only compute the
- * number of bytes with a double word increment. Modified to do
- * this to better avoid overflows in the lower word -- Gray 10/97.
- */
- if (md5_p->md_total[0] > MAX_MD5_UINT32 - buf_len)
- {
- md5_p->md_total[1]++;
- md5_p->md_total[0] -= (MAX_MD5_UINT32 + 1 - buf_len);
- }
- else
- {
- md5_p->md_total[0] += buf_len;
- }
-
- /*
- * Process all bytes in the buffer with MD5_BLOCK bytes in each
- * round of the loop.
- */
- while (buf_p < end_p)
- {
- md5_uint32 A_save, B_save, C_save, D_save;
- md5_uint32 *corr_p = correct;
-
- A_save = A;
- B_save = B;
- C_save = C;
- D_save = D;
-
- /*
- * Before we start, one word to the strange constants. They are
- * defined in RFC 1321 as
- *
- * T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..MD5_BLOCK
- */
-
- /* Round 1. */
- OP1 (A, B, C, D, buf_p, corr_p, 7, 0xd76aa478);
- OP1 (D, A, B, C, buf_p, corr_p, 12, 0xe8c7b756);
- OP1 (C, D, A, B, buf_p, corr_p, 17, 0x242070db);
- OP1 (B, C, D, A, buf_p, corr_p, 22, 0xc1bdceee);
- OP1 (A, B, C, D, buf_p, corr_p, 7, 0xf57c0faf);
- OP1 (D, A, B, C, buf_p, corr_p, 12, 0x4787c62a);
- OP1 (C, D, A, B, buf_p, corr_p, 17, 0xa8304613);
- OP1 (B, C, D, A, buf_p, corr_p, 22, 0xfd469501);
- OP1 (A, B, C, D, buf_p, corr_p, 7, 0x698098d8);
- OP1 (D, A, B, C, buf_p, corr_p, 12, 0x8b44f7af);
- OP1 (C, D, A, B, buf_p, corr_p, 17, 0xffff5bb1);
- OP1 (B, C, D, A, buf_p, corr_p, 22, 0x895cd7be);
- OP1 (A, B, C, D, buf_p, corr_p, 7, 0x6b901122);
- OP1 (D, A, B, C, buf_p, corr_p, 12, 0xfd987193);
- OP1 (C, D, A, B, buf_p, corr_p, 17, 0xa679438e);
- OP1 (B, C, D, A, buf_p, corr_p, 22, 0x49b40821);
-
- /* Round 2. */
- OP234 (FG, A, B, C, D, correct[ 1], 5, 0xf61e2562);
- OP234 (FG, D, A, B, C, correct[ 6], 9, 0xc040b340);
- OP234 (FG, C, D, A, B, correct[ 11], 14, 0x265e5a51);
- OP234 (FG, B, C, D, A, correct[ 0], 20, 0xe9b6c7aa);
- OP234 (FG, A, B, C, D, correct[ 5], 5, 0xd62f105d);
- OP234 (FG, D, A, B, C, correct[ 10], 9, 0x02441453);
- OP234 (FG, C, D, A, B, correct[ 15], 14, 0xd8a1e681);
- OP234 (FG, B, C, D, A, correct[ 4], 20, 0xe7d3fbc8);
- OP234 (FG, A, B, C, D, correct[ 9], 5, 0x21e1cde6);
- OP234 (FG, D, A, B, C, correct[ 14], 9, 0xc33707d6);
- OP234 (FG, C, D, A, B, correct[ 3], 14, 0xf4d50d87);
- OP234 (FG, B, C, D, A, correct[ 8], 20, 0x455a14ed);
- OP234 (FG, A, B, C, D, correct[ 13], 5, 0xa9e3e905);
- OP234 (FG, D, A, B, C, correct[ 2], 9, 0xfcefa3f8);
- OP234 (FG, C, D, A, B, correct[ 7], 14, 0x676f02d9);
- OP234 (FG, B, C, D, A, correct[ 12], 20, 0x8d2a4c8a);
-
- /* Round 3. */
- OP234 (FH, A, B, C, D, correct[ 5], 4, 0xfffa3942);
- OP234 (FH, D, A, B, C, correct[ 8], 11, 0x8771f681);
- OP234 (FH, C, D, A, B, correct[ 11], 16, 0x6d9d6122);
- OP234 (FH, B, C, D, A, correct[ 14], 23, 0xfde5380c);
- OP234 (FH, A, B, C, D, correct[ 1], 4, 0xa4beea44);
- OP234 (FH, D, A, B, C, correct[ 4], 11, 0x4bdecfa9);
- OP234 (FH, C, D, A, B, correct[ 7], 16, 0xf6bb4b60);
- OP234 (FH, B, C, D, A, correct[ 10], 23, 0xbebfbc70);
- OP234 (FH, A, B, C, D, correct[ 13], 4, 0x289b7ec6);
- OP234 (FH, D, A, B, C, correct[ 0], 11, 0xeaa127fa);
- OP234 (FH, C, D, A, B, correct[ 3], 16, 0xd4ef3085);
- OP234 (FH, B, C, D, A, correct[ 6], 23, 0x04881d05);
- OP234 (FH, A, B, C, D, correct[ 9], 4, 0xd9d4d039);
- OP234 (FH, D, A, B, C, correct[ 12], 11, 0xe6db99e5);
- OP234 (FH, C, D, A, B, correct[ 15], 16, 0x1fa27cf8);
- OP234 (FH, B, C, D, A, correct[ 2], 23, 0xc4ac5665);
-
- /* Round 4. */
- OP234 (FI, A, B, C, D, correct[ 0], 6, 0xf4292244);
- OP234 (FI, D, A, B, C, correct[ 7], 10, 0x432aff97);
- OP234 (FI, C, D, A, B, correct[ 14], 15, 0xab9423a7);
- OP234 (FI, B, C, D, A, correct[ 5], 21, 0xfc93a039);
- OP234 (FI, A, B, C, D, correct[ 12], 6, 0x655b59c3);
- OP234 (FI, D, A, B, C, correct[ 3], 10, 0x8f0ccc92);
- OP234 (FI, C, D, A, B, correct[ 10], 15, 0xffeff47d);
- OP234 (FI, B, C, D, A, correct[ 1], 21, 0x85845dd1);
- OP234 (FI, A, B, C, D, correct[ 8], 6, 0x6fa87e4f);
- OP234 (FI, D, A, B, C, correct[ 15], 10, 0xfe2ce6e0);
- OP234 (FI, C, D, A, B, correct[ 6], 15, 0xa3014314);
- OP234 (FI, B, C, D, A, correct[ 13], 21, 0x4e0811a1);
- OP234 (FI, A, B, C, D, correct[ 4], 6, 0xf7537e82);
- OP234 (FI, D, A, B, C, correct[ 11], 10, 0xbd3af235);
- OP234 (FI, C, D, A, B, correct[ 2], 15, 0x2ad7d2bb);
- OP234 (FI, B, C, D, A, correct[ 9], 21, 0xeb86d391);
-
- /* Add the starting values of the context. */
- A += A_save;
- B += B_save;
- C += C_save;
- D += D_save;
- }
-
- /* Put checksum in context given as argument. */
- md5_p->md_A = A;
- md5_p->md_B = B;
- md5_p->md_C = C;
- md5_p->md_D = D;
-}
-
-/*
- * md5_get_result
- *
- * DESCRIPTION:
- *
- * Copy the resulting MD5 signature from MD5_P into the first 16 bytes
- * (MD5_SIZE) of the result buffer.
- *
- * RETURNS:
- *
- * None.
- *
- * ARGUMENTS:
- *
- * md5_p - Pointer to MD5 structure from which we are getting the result.
- *
- * result - A 16 byte buffer that will contain the MD5 signature.
- */
-static void md5_get_result(const md5_t *md5_p, void *result)
-{
- md5_uint32 hold;
- void *res_p = result;
-
- hold = SWAP(md5_p->md_A);
- memcpy(res_p, &hold, sizeof(md5_uint32));
- res_p = (char *)res_p + sizeof(md5_uint32);
-
- hold = SWAP(md5_p->md_B);
- memcpy(res_p, &hold, sizeof(md5_uint32));
- res_p = (char *)res_p + sizeof(md5_uint32);
-
- hold = SWAP(md5_p->md_C);
- memcpy(res_p, &hold, sizeof(md5_uint32));
- res_p = (char *)res_p + sizeof(md5_uint32);
-
- hold = SWAP(md5_p->md_D);
- memcpy(res_p, &hold, sizeof(md5_uint32));
-}
-
-/***************************** exported routines *****************************/
-
-/*
- * md5_init
- *
- * DESCRIPTION:
- *
- * Initialize structure containing state of MD5 computation. (RFC 1321,
- * 3.3: Step 3). This is for progressive MD5 calculations only. If
- * you have the complete string available, md5_buffer should be used.
- * md5_process should be called for each bunch of bytes and after the
- * last process call, md5_finish should be called to get the
- * signature.
- *
- * RETURNS:
- *
- * None.
- *
- * ARGUMENTS:
- *
- * md5_p - Pointer to md5 structure that we are initializing.
- */
-void md5_init(md5_t *md5_p)
-{
- md5_p->md_A = 0x67452301;
- md5_p->md_B = 0xefcdab89;
- md5_p->md_C = 0x98badcfe;
- md5_p->md_D = 0x10325476;
-
- md5_p->md_total[0] = 0;
- md5_p->md_total[1] = 0;
- md5_p->md_buf_len = 0;
-}
-
-/*
- * md5_process
- *
- * DESCRIPTION:
- *
- * This function is used to progressively calculate a MD5 signature some
- * number of bytes at a time. If you have the complete string
- * available, md5_buffer should be used. The MD5 structure should
- * have been initialized with md5_init and after the last process
- * call, md5_finish should be called to get the results.
- *
- * RETURNS:
- *
- * None.
- *
- * ARGUMENTS:
- *
- * md5_p - Pointer to MD5 structure which we are progressively updating.
- *
- * buffer - A buffer of bytes whose MD5 signature we are calculating.
- *
- * buf_len - The length of the buffer.
- */
-void md5_process(md5_t *md5_p, const void *buffer,
- const unsigned int buf_len)
-{
- unsigned int len = buf_len;
- unsigned int in_block, add;
-
- /*
- * When we already have some bytes in our internal buffer, copy some
- * from the user to fill the block.
- */
- if (md5_p->md_buf_len > 0)
- {
-
- in_block = md5_p->md_buf_len;
- if (in_block + len > sizeof(md5_p->md_buffer))
- {
- add = sizeof(md5_p->md_buffer) - in_block;
- }
- else
- {
- add = len;
- }
-
- memcpy (md5_p->md_buffer + in_block, buffer, add);
- md5_p->md_buf_len += add;
- in_block += add;
-
- if (in_block > MD5_BLOCK_SIZE)
- {
- process_block (md5_p, md5_p->md_buffer, in_block & ~BLOCK_SIZE_MASK);
- /* the regions in the following copy operation will not overlap. */
- memcpy (md5_p->md_buffer,
- md5_p->md_buffer + (in_block & ~BLOCK_SIZE_MASK),
- in_block & BLOCK_SIZE_MASK);
- md5_p->md_buf_len = in_block & BLOCK_SIZE_MASK;
- }
-
- buffer = (const char *)buffer + add;
- len -= add;
- }
-
- /* process available complete blocks right from the user buffer */
- if (len > MD5_BLOCK_SIZE)
- {
- process_block (md5_p, buffer, len & ~BLOCK_SIZE_MASK);
- buffer = (const char *) buffer + (len & ~BLOCK_SIZE_MASK);
- len &= BLOCK_SIZE_MASK;
- }
-
- /* copy remaining bytes into the internal buffer */
- if (len > 0)
- {
- memcpy (md5_p->md_buffer, buffer, len);
- md5_p->md_buf_len = len;
- }
-}
-
-/*
- * md5_finish
- *
- * DESCRIPTION:
- *
- * Finish a progressing MD5 calculation and copy the resulting MD5
- * signature into the result buffer which should be 16 bytes
- * (MD5_SIZE). After this call, the MD5 structure is invalid.
- *
- * RETURNS:
- *
- * None.
- *
- * ARGUMENTS:
- *
- * md5_p - Pointer to MD5 structure which we are finishing.
- *
- * signature - A 16 byte buffer that will contain the MD5 signature.
- */
-void md5_finish(md5_t *md5_p, void *signature)
-{
- md5_uint32 bytes, hold;
- int pad;
-
- /* take yet unprocessed bytes into account */
- bytes = md5_p->md_buf_len;
-
- /*
- * Count remaining bytes. Modified to do this to better avoid
- * overflows in the lower word -- Gray 10/97.
- */
- if (md5_p->md_total[0] > MAX_MD5_UINT32 - bytes)
- {
- md5_p->md_total[1]++;
- md5_p->md_total[0] -= (MAX_MD5_UINT32 + 1 - bytes);
- }
- else
- {
- md5_p->md_total[0] += bytes;
- }
-
- /*
- * Pad the buffer to the next MD5_BLOCK-byte boundary. (RFC 1321,
- * 3.1: Step 1). We need enough room for two size words and the
- * bytes left in the buffer. For some reason even if we are equal
- * to the block-size, we add an addition block of pad bytes.
- */
- pad = MD5_BLOCK_SIZE - (sizeof(md5_uint32) * 2) - bytes;
- if (pad <= 0)
- {
- pad += MD5_BLOCK_SIZE;
- }
-
- /*
- * Modified from a fixed array to this assignment and memset to be
- * more flexible with block-sizes -- Gray 10/97.
- */
- if (pad > 0)
- {
- /* some sort of padding start byte */
- md5_p->md_buffer[bytes] = (unsigned char)0x80;
- if (pad > 1)
- {
- memset (md5_p->md_buffer + bytes + 1, 0, pad - 1);
- }
- bytes += pad;
- }
-
- /*
- * Put the 64-bit file length in _bits_ (i.e. *8) at the end of the
- * buffer.
- */
- hold = SWAP((md5_p->md_total[0] & 0x1FFFFFFF) << 3);
- memcpy(md5_p->md_buffer + bytes, &hold, sizeof(md5_uint32));
- bytes += sizeof(md5_uint32);
-
- /* shift the high word over by 3 and add in the top 3 bits from the low */
- hold = SWAP((md5_p->md_total[1] << 3) |
- ((md5_p->md_total[0] & 0xE0000000) >> 29));
- memcpy(md5_p->md_buffer + bytes, &hold, sizeof(md5_uint32));
- bytes += sizeof(md5_uint32);
-
- /* process last bytes, the padding chars, and size words */
- process_block(md5_p, md5_p->md_buffer, bytes);
- md5_get_result(md5_p, signature);
-}
-
-/*
- * md5_buffer
- *
- * DESCRIPTION:
- *
- * This function is used to calculate a MD5 signature for a buffer of
- * bytes. If you only have part of a buffer that you want to process
- * then md5_init, md5_process, and md5_finish should be used.
- *
- * RETURNS:
- *
- * None.
- *
- * ARGUMENTS:
- *
- * buffer - A buffer of bytes whose MD5 signature we are calculating.
- *
- * buf_len - The length of the buffer.
- *
- * signature - A 16 byte buffer that will contain the MD5 signature.
- */
-void md5_buffer(const char *buffer, const unsigned int buf_len,
- void *signature)
-{
- md5_t md5;
-
- /* initialize the computation context */
- md5_init(&md5);
-
- /* process whole buffer but last buf_len % MD5_BLOCK bytes */
- md5_process(&md5, buffer, buf_len);
-
- /* put result in desired memory area */
- md5_finish(&md5, signature);
-}
-
-/*
- * md5_sig_to_string
- *
- * DESCRIPTION:
- *
- * Convert a MD5 signature in a 16 byte buffer into a hexadecimal string
- * representation.
- *
- * RETURNS:
- *
- * None.
- *
- * ARGUMENTS:
- *
- * signature - a 16 byte buffer that contains the MD5 signature.
- *
- * str - a string of charactes which should be at least 33 bytes long (2
- * characters per MD5 byte and 1 for the \0).
- *
- * str_len - the length of the string.
- */
-void md5_sig_to_string(void *signature, char *str, const int str_len)
-{
- unsigned char *sig_p;
- char *str_p, *max_p;
- unsigned int high, low;
-
- str_p = str;
- max_p = str + str_len;
-
- for (sig_p = (unsigned char *)signature;
- sig_p < (unsigned char *)signature + MD5_SIZE;
- sig_p++)
- {
- high = *sig_p / 16;
- low = *sig_p % 16;
- /* account for 2 chars */
- if (str_p + 1 >= max_p)
- {
- break;
- }
- *str_p++ = HEX_STRING[high];
- *str_p++ = HEX_STRING[low];
- }
- /* account for 2 chars */
- if (str_p < max_p)
- {
- *str_p++ = '\0';
- }
-}
-
-/*
- * md5_sig_from_string
- *
- * DESCRIPTION:
- *
- * Convert a MD5 signature from a hexadecimal string representation into
- * a 16 byte buffer.
- *
- * RETURNS:
- *
- * None.
- *
- * ARGUMENTS:
- *
- * signature - A 16 byte buffer that will contain the MD5 signature.
- *
- * str - A string of charactes which _must_ be at least 32 bytes long (2
- * characters per MD5 byte).
- */
-void md5_sig_from_string(void *signature, const char *str)
-{
- unsigned char *sig_p;
- const char *str_p;
- char *hex;
- unsigned int high, low, val;
-
- hex = HEX_STRING;
- sig_p = signature;
-
- for (str_p = str; str_p < str + MD5_SIZE * 2; str_p += 2)
- {
- high = strchr(hex, *str_p) - hex;
- low = strchr(hex, *(str_p + 1)) - hex;
- val = high * 16 + low;
- *sig_p++ = val;
- }
-}
diff --git a/library/md5.h b/library/md5.h
deleted file mode 100644
index 29c20847..00000000
--- a/library/md5.h
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
- * Declaration of functions and data types used for MD5 sum computing
- * library functions. Copyright (C) 1995, 1996 Free Software
- * Foundation, Inc. NOTE: The canonical source of this file is
- * maintained with the GNU C Library. Bugs can be reported to
- * bug-glibc@prep.ai.mit.edu.
- *
- * 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; either version 2, or (at
- * your option) any later version.
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- *
- * $Id: md5.h,v 1.4 2000/03/09 04:06:41 gray Exp $
- */
-
-/*
- * NOTE: during quick performance tests on a sun ultra and an alpha
- * 255 300, the md5 libraries performed upwards of 3mb/sec. That
- * included disk i/o on bobcat and panther.
- */
-
-#ifndef __MD5_H__
-#define __MD5_H__
-
-/*
- * Size of a standard MD5 signature in bytes. This definition is for
- * external programs only. The MD5 routines themselves reference the
- * signature as 4 unsigned 32-bit integers.
- */
-#define MD5_SIZE 16
-
-/*
- * NOTE: the following is assumed to generate a 32-bit unsigned data
- * type.
- */
-typedef unsigned int md5_uint32;
-#define MAX_MD5_UINT32 ((md5_uint32)4294967295U)
-
-/*
- * The MD5 algorithm works on blocks of characters of 64 bytes. This
- * is an internal value only and is not necessary for external use.
- */
-#define MD5_BLOCK_SIZE 64
-
-/*
- * Structure to save state of computation between the single steps.
- */
-typedef struct
-{
- md5_uint32 md_A; /* accumulater 1 */
- md5_uint32 md_B; /* accumulater 2 */
- md5_uint32 md_C; /* accumulater 3 */
- md5_uint32 md_D; /* accumulater 4 */
-
- md5_uint32 md_total[2]; /* totaling storage */
- md5_uint32 md_buf_len; /* length of the storage buffer */
- char md_buffer[MD5_BLOCK_SIZE * 2]; /* character storage buffer */
-} md5_t;
-
-/*<<<<<<<<<< The below prototypes are auto-generated by fillproto */
-
-/*
- * md5_init
- *
- * DESCRIPTION:
- *
- * Initialize structure containing state of MD5 computation. (RFC 1321,
- * 3.3: Step 3). This is for progressive MD5 calculations only. If
- * you have the complete string available, md5_buffer should be used.
- * md5_process should be called for each bunch of bytes and after the
- * last process call, md5_finish should be called to get the
- * signature.
- *
- * RETURNS:
- *
- * None.
- *
- * ARGUMENTS:
- *
- * md5_p - Pointer to md5 structure that we are initializing.
- */
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
- void md5_init(md5_t *md5_p);
-
- /*
- * md5_process
- *
- * DESCRIPTION:
- *
- * This function is used to progressively calculate a MD5 signature some
- * number of bytes at a time. If you have the complete string
- * available, md5_buffer should be used. The MD5 structure should
- * have been initialized with md5_init and after the last process
- * call, md5_finish should be called to get the results.
- *
- * RETURNS:
- *
- * None.
- *
- * ARGUMENTS:
- *
- * md5_p - Pointer to MD5 structure which we are progressively updating.
- *
- * buffer - A buffer of bytes whose MD5 signature we are calculating.
- *
- * buf_len - The length of the buffer.
- */
- void md5_process(md5_t *md5_p, const void *buffer,
- const unsigned int buf_len);
-
- /*
- * md5_finish
- *
- * DESCRIPTION:
- *
- * Finish a progressing MD5 calculation and copy the resulting MD5
- * signature into the result buffer which should be 16 bytes
- * (MD5_SIZE). After this call, the MD5 structure is invalid.
- *
- * RETURNS:
- *
- * None.
- *
- * ARGUMENTS:
- *
- * md5_p - Pointer to MD5 structure which we are finishing.
- *
- * signature - A 16 byte buffer that will contain the MD5 signature.
- */
- void md5_finish(md5_t *md5_p, void *signature);
-
- /*
- * md5_buffer
- *
- * DESCRIPTION:
- *
- * This function is used to calculate a MD5 signature for a buffer of
- * bytes. If you only have part of a buffer that you want to process
- * then md5_init, md5_process, and md5_finish should be used.
- *
- * RETURNS:
- *
- * None.
- *
- * ARGUMENTS:
- *
- * buffer - A buffer of bytes whose MD5 signature we are calculating.
- *
- * buf_len - The length of the buffer.
- *
- * signature - A 16 byte buffer that will contain the MD5 signature.
- */
- void md5_buffer(const char *buffer, const unsigned int buf_len,
- void *signature);
-
- /*
- * md5_sig_to_string
- *
- * DESCRIPTION:
- *
- * Convert a MD5 signature in a 16 byte buffer into a hexadecimal string
- * representation.
- *
- * RETURNS:
- *
- * None.
- *
- * ARGUMENTS:
- *
- * signature - a 16 byte buffer that contains the MD5 signature.
- *
- * str - a string of charactes which should be at least 33 bytes long (2
- * characters per MD5 byte and 1 for the \0).
- *
- * str_len - the length of the string.
- */
- void md5_sig_to_string(void *signature, char *str, const int str_len);
-
- /*
- * md5_sig_from_string
- *
- * DESCRIPTION:
- *
- * Convert a MD5 signature from a hexadecimal string representation into
- * a 16 byte buffer.
- *
- * RETURNS:
- *
- * None.
- *
- * ARGUMENTS:
- *
- * signature - A 16 byte buffer that will contain the MD5 signature.
- *
- * str - A string of charactes which _must_ be at least 32 bytes long (2
- * characters per MD5 byte).
- */
- void md5_sig_from_string(void *signature, const char *str);
-
- /*<<<<<<<<<< This is end of the auto-generated output from fillproto. */
-#ifdef __cplusplus
-} /* end extern "C" */
-#endif
-#endif /* ! __MD5_H__ */
diff --git a/library/multithreading.cpp b/library/multithreading.cpp
index dd96eaf4..c5f38605 100644
--- a/library/multithreading.cpp
+++ b/library/multithreading.cpp
@@ -17,7 +17,7 @@
-------------------------------
wait until thread is ready
-3. Call execAndUpdate
+3. Call execute
-------------------------------
send signal to start
start processing
@@ -135,7 +135,7 @@ void UpdateWhileExecuting::waitUntilReady()
}
// /|\ \|/ must be called directly after each other
-void UpdateWhileExecuting::execAndUpdate(StatusUpdater* statusUpdater)
+void UpdateWhileExecuting::execute(StatusUpdater* statusUpdater)
{
readyToReceiveResult.Lock();
diff --git a/library/multithreading.h b/library/multithreading.h
index 8466bb01..b8481a0f 100644
--- a/library/multithreading.h
+++ b/library/multithreading.h
@@ -9,22 +9,24 @@
class StatusUpdater
{
public:
- StatusUpdater() : abortionRequested(false) {}
+ StatusUpdater() :
+ abortionRequested(false) {}
virtual ~StatusUpdater() {}
//these four methods have to be implemented in the derived classes to handle error and status information
virtual void updateStatusText(const wxString& text) = 0;
virtual void initNewProcess(int objectsTotal, double dataTotal, int processID) = 0; //informs about the total amount of data that will be processed from now on
- virtual void updateProcessedData(int objectsProcessed, double dataProcessed) = 0; //called periodically after data was processed
+ virtual void updateProcessedData(int objectsProcessed, double dataProcessed) = 0; //called periodically after data was processed
virtual int reportError(const wxString& text) = 0;
//this method is triggered repeatedly and can be used to refresh the ui by dispatching pending events
- virtual void triggerUI_Refresh() {}
+ virtual void triggerUI_Refresh() = 0;
- void requestAbortion() //opportunity to abort must be implemented in the three virtual status and error methods (for example in triggerUI_Refresh())
+ void requestAbortion() //opportunity to abort must be implemented in a frequently executed method like triggerUI_Refresh()
{ //currently used by the UI status information screen, when button "Abort is pressed"
abortionRequested = true;
}
+
static const int continueNext = -1;
static const int retry = -2;
@@ -48,11 +50,11 @@ public:
virtual ~UpdateWhileExecuting();
void waitUntilReady();
- void execAndUpdate(StatusUpdater* statusUpdater);
+ void execute(StatusUpdater* statusUpdater);
private:
- //implement a longrunning method without dependencies (e.g. copy file function) returning "true" on success
+ //implement a longrunning method without dependencies (e.g. copy file function); share input/output parameters as instance variables
virtual void longRunner() = 0;
WorkerThread* theWorkerThread;
diff --git a/mingwm10.dll b/mingwm10.dll
index 1c50d073..9e704958 100644
--- a/mingwm10.dll
+++ b/mingwm10.dll
Binary files differ
diff --git a/ui/MainDialog.cpp b/ui/MainDialog.cpp
index 1528f0c8..ec83f302 100644
--- a/ui/MainDialog.cpp
+++ b/ui/MainDialog.cpp
@@ -9,13 +9,10 @@
#include "mainDialog.h"
#include <wx/filename.h>
-#include <stdexcept> //for std::runtime_error
#include "../library/globalFunctions.h"
#include <fstream>
#include <wx/clipbrd.h>
#include "../library/customGrid.h"
-#include <cmath>
-#include <wx/msgdlg.h>
using namespace globalFunctions;
@@ -25,13 +22,14 @@ MainDialog::MainDialog(wxFrame* frame, const wxString& cfgFileName) :
GuiGenerated(frame),
parent(frame),
stackObjects(0),
- selectedRange3Begin(0),
- selectedRange3End(0),
- selectionLead(0),
filteringInitialized(false),
filteringPending(false),
cmpStatusUpdaterTmp(0)
{
+ m_bpButtonCompare->SetLabel(_("&Compare"));
+ m_bpButtonSync->SetLabel(_("&Synchronize"));
+ m_bpButtonFilter->SetLabel(_("&Filter"));
+
//initialize sync configuration
readConfigurationFromHD(cfgFileName, true);
@@ -57,6 +55,18 @@ MainDialog::MainDialog(wxFrame* frame, const wxString& cfgFileName) :
m_panel1->SetDropTarget(new FileDropEvent(this, 1));
m_panel2->SetDropTarget(new FileDropEvent(this, 2));
+ //create a right-click context menu
+ contextMenu = new wxMenu;
+ contextMenu->Append(contextManualFilter, _("Filter manually"));
+ contextMenu->Append(contextCopyClipboard, _("Copy to clipboard\tCTRL+C"));
+#ifdef FFS_WIN
+ contextMenu->Append(contextOpenExplorer, _("Open with Explorer\tD-Click"));
+#endif
+ contextMenu->AppendSeparator();
+ contextMenu->Append(contextDeleteFiles, _("Delete files\tDEL"));
+
+ contextMenu->Connect(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainDialog::onContextMenuSelection), NULL, this);
+
//support for CTRL + C and DEL
m_grid1->Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(MainDialog::onGrid1ButtonEvent), NULL, this);
m_grid2->Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(MainDialog::onGrid2ButtonEvent), NULL, this);
@@ -92,7 +102,7 @@ MainDialog::MainDialog(wxFrame* frame, const wxString& cfgFileName) :
m_grid3->Connect(wxEVT_SCROLLWIN_LINEDOWN, wxEventHandler(MainDialog::onGrid3access), NULL, this);
m_grid3->GetGridWindow()->Connect(wxEVT_LEFT_DOWN, wxEventHandler(MainDialog::onGrid3access), NULL, this);
- m_grid3->GetGridWindow()->Connect(wxEVT_IDLE, wxEventHandler(MainDialog::OnIdleEvent), NULL, this);
+ Connect(wxEVT_IDLE, wxEventHandler(MainDialog::OnIdleEvent), NULL, this);
m_grid3->GetGridWindow()->Connect(wxEVT_LEFT_UP, wxEventHandler(MainDialog::OnGrid3LeftMouseUp), NULL, this);
m_grid3->GetGridWindow()->Connect(wxEVT_LEFT_DOWN, wxEventHandler(MainDialog::OnGrid3LeftMouseDown), NULL, this);
@@ -149,6 +159,17 @@ MainDialog::MainDialog(wxFrame* frame, const wxString& cfgFileName) :
addCfgFileToHistory(value);
}
m_choiceLoad->SetSelection(0);
+
+ //select rows only
+ m_grid1->SetSelectionMode(wxGrid::wxGridSelectRows);
+ m_grid2->SetSelectionMode(wxGrid::wxGridSelectRows);
+ m_grid3->SetSelectionMode(wxGrid::wxGridSelectRows);
+
+ //set color of selections
+ wxColour darkBlue(40, 35, 140);
+ m_grid1->SetSelectionBackground(darkBlue);
+ m_grid2->SetSelectionBackground(darkBlue);
+ m_grid3->SetSelectionBackground(darkBlue);
}
@@ -194,13 +215,17 @@ MainDialog::~MainDialog()
m_grid3->Disconnect(wxEVT_SCROLLWIN_LINEDOWN, wxEventHandler(MainDialog::onGrid3access), NULL, this);
m_grid3->GetGridWindow()->Disconnect(wxEVT_LEFT_DOWN, wxEventHandler(MainDialog::onGrid3access), NULL, this);
- m_grid3->GetGridWindow()->Disconnect(wxEVT_IDLE, wxEventHandler(MainDialog::OnIdleEvent), NULL, this);
+ Disconnect(wxEVT_IDLE, wxEventHandler(MainDialog::OnIdleEvent), NULL, this);
m_grid3->GetGridWindow()->Disconnect(wxEVT_LEFT_UP, wxEventHandler(MainDialog::OnGrid3LeftMouseUp), NULL, this);
m_grid3->GetGridWindow()->Disconnect(wxEVT_LEFT_DOWN, wxEventHandler(MainDialog::OnGrid3LeftMouseDown), NULL, this);
Disconnect(wxEVT_SIZE, wxEventHandler(MainDialog::onResizeMainWindow), NULL, this);
Disconnect(wxEVT_MOVE, wxEventHandler(MainDialog::onResizeMainWindow), NULL, this);
+ contextMenu->Disconnect(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainDialog::onContextMenuSelection), NULL, this);
+
+ delete contextMenu;
+
//write list of last used configuration files
int vectorSize = cfgFileNames.size();
for (int i = 0; i < CfgHistroyLength; ++i)
@@ -259,7 +284,7 @@ void MainDialog::onGrid3access(wxEvent& event)
}
-void MainDialog::filterRangeManual(const set<int>& rowsToFilterOnUI_View, int leadingRow)
+void MainDialog::filterRangeManual(const set<int>& rowsToFilterOnUI_View)
{
if (rowsToFilterOnUI_View.size() > 0)
{
@@ -267,7 +292,8 @@ void MainDialog::filterRangeManual(const set<int>& rowsToFilterOnUI_View, int le
bool newSelection = false; //default: deselect range
- //leadingRow should be set in OnGridSelectCell()
+ //leadingRow determines de-/selection of all other rows
+ int leadingRow = *rowsToFilterOnUI_View.begin();
if (0 <= leadingRow && leadingRow < currentUI_Size)
newSelection = !currentGridData[currentUI_View[leadingRow].linkToCurrentGridData].selectedForSynchronization;
@@ -290,7 +316,6 @@ void MainDialog::filterRangeManual(const set<int>& rowsToFilterOnUI_View, int le
}
}
-
//toggle selection of filtered rows
for (set<int>::iterator i = rowsToFilterOnGridData.begin(); i != rowsToFilterOnGridData.end(); ++i)
currentGridData[*i].selectedForSynchronization = newSelection;
@@ -309,7 +334,6 @@ void MainDialog::filterRangeManual(const set<int>& rowsToFilterOnUI_View, int le
filteredOutRowsOnUI.insert(i - currentUI_View.begin());
}
-
//signal UI that grids need to be refreshed on next Update()
m_grid1->ForceRefresh();
m_grid2->ForceRefresh();
@@ -329,37 +353,33 @@ void MainDialog::filterRangeManual(const set<int>& rowsToFilterOnUI_View, int le
updateStatusInformation(currentUI_View); //status information has to be recalculated!
}
}
- //clear selection on grid
+ //clear selection on grids
+ if (hideFiltered)
+ {
+ m_grid1->ClearSelection();
+ m_grid2->ClearSelection();
+ } //exception for grid 3
m_grid3->ClearSelection();
}
/*grid event choreography:
1. UI-Mouse-Down => OnGridSelectCell
-2. UI-Mouse-Up => OnGrid3SelectRange (if at least two rows are marked)
+2. UI-Mouse-Up => SelectRangeEvent (if at least two rows are marked)
-=> the decision if a range or a single cell is selected can be made only after Mouse-UP. But OnGrid3SelectRange unfortunately is not always
+=> the decision if a range or a single cell is selected can be made only after Mouse-UP. But SelectRangeEvent unfortunately is not always
executed (e.g. if single cell selected)
=> new choreography:
-
-1. UI-Mouse-Down => OnGridSelectCell -> set leading row
+1. UI-Mouse-Down => OnGrid3LeftMouseDown (notify that filtering was initialized: this is needed since under some circumstances it might happen that the program
+ receives a mouse-up without a preceding mouse-down (double-clicks)
2. UI-Mouse-Up => OnGrid3LeftMouseUp (notify that filtering shall be started on next idle event
-3. UI-Mouse-Up => OnGrid3SelectRange, possibly
+3. UI-Mouse-Up => SelectRangeEvent, possibly
4. Idle event => OnIdleEvent
-
- It's !crazy! but it works!
*/
-void MainDialog::OnGridSelectCell(wxGridEvent& event)
-{
- selectionLead = selectedRange3Begin = selectedRange3End = event.GetRow();
- event.Skip();
-}
-
void MainDialog::OnGrid3LeftMouseDown(wxEvent& event)
{
-
filteringInitialized = true;
event.Skip();
}
@@ -372,17 +392,6 @@ void MainDialog::OnGrid3LeftMouseUp(wxEvent& event)
}
-void MainDialog::OnGrid3SelectRange(wxGridRangeSelectEvent& event)
-{
- if (event.Selecting()) //this range event should only be processed on release left mouse button
- {
- selectedRange3Begin = event.GetTopRow();
- selectedRange3End = event.GetBottomRow();
- }
- event.Skip();
-}
-
-
void MainDialog::OnIdleEvent(wxEvent& event)
{
//process manually filtered rows
@@ -394,11 +403,7 @@ void MainDialog::OnIdleEvent(wxEvent& event)
{ //a mouse up event, but no mouse down! (e.g. when window is maximized and cursor is on grid3)
filteringInitialized = false;
- set<int> filteredRows;
- for (int i = selectedRange3Begin; i <= selectedRange3End; ++i)
- filteredRows.insert(i);
-
- filterRangeManual(filteredRows, selectionLead);
+ filterRangeManual(getSelectedRows());
}
}
@@ -421,90 +426,85 @@ void MainDialog::OnIdleEvent(wxEvent& event)
}
-void copySelectionToClipboard(wxGrid* grid)
+void MainDialog::copySelectionToClipboard(const set<int>& selectedRows, int selectedGrid)
{
- int rowTop, rowBottom, colLeft, colRight; //coords of selection
- wxString clipboardString;
+ if (selectedRows.size() > 0)
+ {
+ wxGrid* grid = 0;
+ switch (selectedGrid)
+ {
+ case 1:
+ grid = m_grid1;
+ break;
+ case 2:
+ grid = m_grid2;
+ break;
+ case 3:
+ grid = m_grid3;
+ break;
+ default:
+ return;
+ }
- wxArrayInt selectedRows, selectedColumns;
- selectedRows = grid->GetSelectedRows();
- selectedColumns = grid->GetSelectedCols();
+ wxString clipboardString;
- if (!selectedRows.IsEmpty())
- {
- for (unsigned int i = 0; i < selectedRows.GetCount(); ++i)
+ for (set<int>::iterator i = selectedRows.begin(); i != selectedRows.end(); ++i)
{
for (int k = 0; k < grid->GetNumberCols(); ++k)
{
- clipboardString+= grid->GetCellValue(selectedRows[i], k);
+ clipboardString+= grid->GetCellValue(*i, k);
if (k != grid->GetNumberCols() - 1)
clipboardString+= '\t';
}
clipboardString+= '\n';
}
- }
- else if (!selectedColumns.IsEmpty())
- {
- for (int k = 0; k < grid->GetNumberRows(); ++k)
- {
- for (unsigned int i = 0; i < selectedColumns.GetCount(); ++i)
- {
- clipboardString+= grid->GetCellValue(k, selectedColumns[i]);
- if (i != selectedColumns.GetCount() - 1)
- clipboardString+= '\t';
- }
- clipboardString+= '\n';
- }
- }
- else
- {
- wxGridCellCoordsArray tmpArray;
-
- tmpArray = grid->GetSelectionBlockTopLeft();
- if (!tmpArray.IsEmpty())
- {
- wxGridCellCoords topLeft = tmpArray[0];
-
- rowTop = topLeft.GetRow();
- colLeft = topLeft.GetCol();
- tmpArray = grid->GetSelectionBlockBottomRight();
- if (!tmpArray.IsEmpty())
+ if (!clipboardString.IsEmpty())
+ // Write text to the clipboard
+ if (wxTheClipboard->Open())
{
- wxGridCellCoords bottomRight = tmpArray[0];
-
- rowBottom = bottomRight.GetRow();
- colRight = bottomRight.GetCol();
-
- //save selection in one big string
- for (int j = rowTop; j <= rowBottom; ++j)
- {
- for (int i = colLeft; i <= colRight; ++i)
- {
- clipboardString+= grid->GetCellValue(j, i);
- if (i != colRight)
- clipboardString+= '\t';
- }
- clipboardString+= '\n';
- }
+ // these data objects are held by the clipboard,
+ // so do not delete them in the app.
+ wxTheClipboard->SetData( new wxTextDataObject(clipboardString) );
+ wxTheClipboard->Close();
}
- }
}
+}
+
- if (!clipboardString.IsEmpty())
- // Write some text to the clipboard
- if (wxTheClipboard->Open())
+void removeInvalidRows(set<int>& rows, const int currentUI_Size)
+{
+ set<int> validRows; //temporal table IS needed here
+ for (set<int>::iterator i = rows.begin(); i != rows.end(); ++i)
+ if (0 <= *i)
{
- // This data objects are held by the clipboard,
- // so do not delete them in the app.
- wxTheClipboard->SetData( new wxTextDataObject(clipboardString) );
- wxTheClipboard->Close();
+ if (*i >= currentUI_Size) //set is sorted, so no need to continue here
+ break;
+ validRows.insert(*i);
}
+ rows = validRows;
}
-set<int> getSelectedRows(wxGrid* grid)
+set<int> MainDialog::getSelectedRows()
{
+ wxGrid* grid = 0;
+
+ switch (leadingPanel)
+ {
+ case 1:
+ grid = m_grid1;
+ break;
+ case 2:
+ grid = m_grid2;
+ break;
+ case 3:
+ grid = m_grid3;
+ break;
+ default:
+ return set<int>();
+ }
+
set<int> output;
int rowTop, rowBottom; //coords of selection
@@ -548,21 +548,9 @@ set<int> getSelectedRows(wxGrid* grid)
}
}
- return output;
-}
-
+ removeInvalidRows(output, currentUI_View.size());
-void removeInvalidRows(set<int>& rows, const int currentUI_Size)
-{
- set<int> validRows; //temporal table IS needed here
- for (set<int>::iterator i = rows.begin(); i != rows.end(); ++i)
- if (0 <= *i)
- {
- if (*i >= currentUI_Size) //set is sorted, so no need to continue here
- break;
- validRows.insert(*i);
- }
- rows = validRows;
+ return output;
}
@@ -608,7 +596,7 @@ public:
void updateStatusText(const wxString& text) {}
void initNewProcess(int objectsTotal, double dataTotal, int processID) {}
void updateProcessedData(int objectsProcessed, double dataProcessed) {}
-
+ void triggerUI_Refresh() {}
private:
bool suppressUI_Errormessages;
@@ -616,16 +604,8 @@ private:
};
-void MainDialog::deleteFilesOnGrid(wxGrid* grid)
+void MainDialog::deleteFilesOnGrid(const set<int>& rowsToDeleteOnUI)
{
- set<int> rowsToDeleteOnUI = getSelectedRows(grid);
-
- if (0 <= selectionLead && unsigned(selectionLead) < currentUI_View.size())
- rowsToDeleteOnUI.insert(selectionLead); //add row of the currently selected cell
-
- removeInvalidRows(rowsToDeleteOnUI, currentUI_View.size());
-
-
if (rowsToDeleteOnUI.size())
{
//map grid lines from UI to grid lines in backend
@@ -680,7 +660,9 @@ void MainDialog::deleteFilesOnGrid(wxGrid* grid)
//redraw grid neccessary to update new dimensions and for UI-Backend data linkage
writeGrid(currentGridData); //do NOT use UI buffer here
- grid->ClearSelection(); //clear selection on grid
+ m_grid1->ClearSelection(); //clear selection on grid
+ m_grid2->ClearSelection(); //clear selection on grid
+ m_grid3->ClearSelection(); //clear selection on grid
}
break;
@@ -693,10 +675,43 @@ void MainDialog::deleteFilesOnGrid(wxGrid* grid)
}
+void MainDialog::openWithFileBrowser(int rowNumber, int gridNr)
+{
+#ifdef FFS_WIN
+ if (gridNr == 1)
+ {
+ wxString command = "explorer " + FreeFileSync::getFormattedDirectoryName(m_directoryPanel1->GetValue()); //default
+
+ if (0 <= rowNumber && rowNumber < int(currentUI_View.size()))
+ {
+ wxString filename = currentGridData[currentUI_View[rowNumber].linkToCurrentGridData].fileDescrLeft.filename;
+
+ if (!filename.IsEmpty())
+ command = "explorer /select," + filename;
+ }
+ wxExecute(command);
+ }
+ else if (gridNr == 2)
+ {
+ wxString command = "explorer " + FreeFileSync::getFormattedDirectoryName(m_directoryPanel2->GetValue()); //default
+
+ if (0 <= rowNumber && rowNumber < int(currentUI_View.size()))
+ {
+ wxString filename = currentGridData[currentUI_View[rowNumber].linkToCurrentGridData].fileDescrRight.filename;
+
+ if (!filename.IsEmpty())
+ command = "explorer /select," + filename;
+ }
+ wxExecute(command);
+ }
+#endif // FFS_WIN
+}
+
+
void MainDialog::pushStatusInformation(const wxString& text)
{
lastStatusChange = wxGetLocalTimeMillis();
- stackObjects++;
+ ++stackObjects;
m_statusBar1->PushStatusText(text, 1);
}
@@ -712,8 +727,25 @@ void MainDialog::onResizeMainWindow(wxEvent& event)
{
if (!IsMaximized())
{
- GetSize(&widthNotMaximized, &heightNotMaximized);
- GetPosition(&posXNotMaximized, &posYNotMaximized);
+ int width = 0;
+ int height = 0;
+ int x = 0;
+ int y = 0;
+
+ GetSize(&width, &height);
+ GetPosition(&x, &y);
+
+ if (width > 0 && height > 0)
+ {
+ widthNotMaximized = width;
+ heightNotMaximized = height;
+ }
+
+ if (x >= 0 && y >= 0) //might be < 0 under some strange circumstances
+ {
+ posXNotMaximized = x;
+ posYNotMaximized = y;
+ }
}
event.Skip();
}
@@ -724,22 +756,24 @@ void MainDialog::onGrid1ButtonEvent(wxKeyEvent& event)
//CTRL + C || CTRL + INS
if (event.ControlDown() && event.GetKeyCode() == 67 ||
event.ControlDown() && event.GetKeyCode() == WXK_INSERT)
- copySelectionToClipboard(m_grid1);
+ copySelectionToClipboard(getSelectedRows(), 1);
else if (event.GetKeyCode() == WXK_DELETE)
- deleteFilesOnGrid(m_grid1);
+ deleteFilesOnGrid(getSelectedRows());
event.Skip();
}
+
void MainDialog::onGrid2ButtonEvent(wxKeyEvent& event)
{
//CTRL + C || CTRL + INS
if (event.ControlDown() && event.GetKeyCode() == 67 ||
event.ControlDown() && event.GetKeyCode() == WXK_INSERT)
- copySelectionToClipboard(m_grid2);
+ copySelectionToClipboard(getSelectedRows(), 2);
+
else if (event.GetKeyCode() == WXK_DELETE)
- deleteFilesOnGrid(m_grid2);
+ deleteFilesOnGrid(getSelectedRows());
event.Skip();
}
@@ -750,9 +784,76 @@ void MainDialog::onGrid3ButtonEvent(wxKeyEvent& event)
//CTRL + C || CTRL + INS
if (event.ControlDown() && event.GetKeyCode() == 67 ||
event.ControlDown() && event.GetKeyCode() == WXK_INSERT)
- copySelectionToClipboard(m_grid3);
+ copySelectionToClipboard(getSelectedRows(), 3);
+
else if (event.GetKeyCode() == WXK_DELETE)
- deleteFilesOnGrid(m_grid3);
+ deleteFilesOnGrid(getSelectedRows());
+
+ event.Skip();
+}
+
+
+void MainDialog::OnOpenContextMenu( wxGridEvent& event )
+{
+ set<int> selection = getSelectedRows();
+
+ //enable/disable context menu entries
+ if (selection.size() > 0)
+ {
+ contextMenu->Enable(contextManualFilter, true);
+ contextMenu->Enable(contextCopyClipboard, true);
+ contextMenu->Enable(contextDeleteFiles, true);
+ }
+ else
+ {
+ contextMenu->Enable(contextManualFilter, false);
+ contextMenu->Enable(contextCopyClipboard, false);
+ contextMenu->Enable(contextDeleteFiles, false);
+ }
+
+#ifdef FFS_WIN
+ if ((leadingPanel == 1 || leadingPanel == 2) && selection.size() <= 1)
+ contextMenu->Enable(contextOpenExplorer, true);
+ else
+ contextMenu->Enable(contextOpenExplorer, false);
+#endif
+
+ //show context menu
+ PopupMenu(contextMenu);
+ event.Skip();
+}
+
+
+void MainDialog::onContextMenuSelection(wxCommandEvent& event)
+{
+ set<int> selection;
+
+ switch (event.GetId())
+ {
+ case contextManualFilter:
+ filterRangeManual(getSelectedRows());
+ break;
+
+ case contextCopyClipboard:
+ copySelectionToClipboard(getSelectedRows(), leadingPanel);
+ break;
+
+ case contextOpenExplorer:
+ selection = getSelectedRows();
+
+ if (leadingPanel == 1 || leadingPanel == 2)
+ {
+ if (selection.size() == 1)
+ openWithFileBrowser(*selection.begin(), leadingPanel);
+ else if (selection.size() == 0)
+ openWithFileBrowser(-1, leadingPanel);
+ }
+ break;
+
+ case contextDeleteFiles:
+ deleteFilesOnGrid(getSelectedRows());
+ break;
+ }
event.Skip();
}
@@ -953,7 +1054,7 @@ void MainDialog::OnSaveConfig(wxCommandEvent& event)
clearStatusBar();
- wxFileDialog* filePicker = new wxFileDialog(this, "", "", defaultFileName, "*.*", wxFD_SAVE);
+ wxFileDialog* filePicker = new wxFileDialog(this, "", "", defaultFileName, wxString(_("FreeFileSync configuration")) + " (*.FFS)|*.FFS", wxFD_SAVE);
if (filePicker->ShowModal() == wxID_OK)
{
@@ -988,7 +1089,7 @@ void MainDialog::OnLoadConfiguration(wxCommandEvent& event)
switch (selectedItem)
{
case 0: //load config from file
- wxFileDialog* filePicker = new wxFileDialog(this, "", "", "", "*.*", wxFD_OPEN);
+ wxFileDialog* filePicker = new wxFileDialog(this, "", "", "", wxString(_("FreeFileSync configuration")) + " (*.FFS)|*.FFS", wxFD_OPEN);
if (filePicker->ShowModal() == wxID_OK)
newCfgFile = filePicker->GetFilename();
@@ -1136,7 +1237,7 @@ void MainDialog::readConfigurationFromHD(const wxString& filename, bool programS
case compareByTimeAndSize:
m_radioBtnSizeDate->SetValue(true);
break;
- case compareByMD5:
+ case compareByContent:
m_radioBtnContent->SetValue(true);
break;
default:
@@ -1241,7 +1342,7 @@ void MainDialog::writeConfigurationToHD(const wxString& filename)
if (m_radioBtnSizeDate->GetValue())
config<<char(compareByTimeAndSize);
else if (m_radioBtnContent->GetValue())
- config<<char(compareByMD5);
+ config<<char(compareByContent);
else assert (false);
@@ -1326,7 +1427,7 @@ void MainDialog::OnConfigureFilter(wxHyperlinkEvent &event)
{
wxString beforeImage = includeFilter + wxChar(0) + excludeFilter;
- FilterDlg* filterDlg = new FilterDlg(this);
+ FilterDlg* filterDlg = new FilterDlg(this, includeFilter, excludeFilter);
if (filterDlg->ShowModal() == FilterDlg::okayButtonPressed)
{
wxString afterImage = includeFilter + wxChar(0) + excludeFilter;
@@ -1463,7 +1564,7 @@ void MainDialog::OnCompare(wxCommandEvent &event)
if (m_radioBtnSizeDate->GetValue())
cmpVar = compareByTimeAndSize;
else if (m_radioBtnContent->GetValue())
- cmpVar = compareByMD5;
+ cmpVar = compareByContent;
else assert (false);
try
@@ -1639,34 +1740,20 @@ void MainDialog::OnSync( wxCommandEvent& event )
void MainDialog::OnLeftGridDoubleClick(wxGridEvent& event)
-{ //default
- wxString command = "explorer " + FreeFileSync::getFormattedDirectoryName(m_directoryPanel1->GetValue());
-
- if (event.GetRow() < int(currentUI_View.size()))
- {
- wxString filename = currentGridData[currentUI_View[event.GetRow()].linkToCurrentGridData].fileDescrLeft.filename;
-
- if (!filename.IsEmpty())
- command = "explorer /select," + filename;
- }
- wxExecute(command);
+{
+ openWithFileBrowser(event.GetRow(), 1);
+ event.Skip();
}
-void MainDialog::OnRightGridDoubleClick(wxGridEvent& event)
-{ //default
- wxString command = "explorer " + FreeFileSync::getFormattedDirectoryName(m_directoryPanel2->GetValue());
- if (event.GetRow() < int(currentUI_View.size()))
- {
- wxString filename = currentGridData[currentUI_View[event.GetRow()].linkToCurrentGridData].fileDescrRight.filename;
-
- if (!filename.IsEmpty())
- command = "explorer /select," + filename;
- }
- wxExecute(command);
+void MainDialog::OnRightGridDoubleClick(wxGridEvent& event)
+{
+ openWithFileBrowser(event.GetRow(), 2);
+ event.Skip();
}
-//these two global variables are ONLY used for the sorting in the following methods
+
+//these three global variables are ONLY used for the sorting in the following methods
unsigned int currentSortColumn = 0;
bool sortAscending = true;
FileCompareResult* currentGridDataPtr = 0;
@@ -1872,31 +1959,24 @@ void MainDialog::updateStatusInformation(const UI_Grid& visibleGrid)
unsigned int objectsOnLeftView = 0;
unsigned int objectsOnRightView = 0;
- mpz_t filesizeLeftView, filesizeRightView, tmpInt;
- mpz_init(filesizeLeftView);
- mpz_init(filesizeRightView);
- mpz_init(tmpInt);
+ wxULongLong filesizeLeftView;
+ wxULongLong filesizeRightView;
- for (UI_Grid::const_iterator i = visibleGrid.begin(); i != visibleGrid.end(); i++)
+ for (UI_Grid::const_iterator i = visibleGrid.begin(); i != visibleGrid.end(); ++i)
{
const FileCompareLine& refLine = currentGridData[i->linkToCurrentGridData];
//calculate total number of bytes for each sied
if (refLine.fileDescrLeft.objType != isNothing)
{
- FreeFileSync::wxULongLongToMpz(tmpInt, refLine.fileDescrLeft.fileSize);
- mpz_add(filesizeLeftView, filesizeLeftView, tmpInt);
-
- objectsOnLeftView++;
+ filesizeLeftView+= refLine.fileDescrLeft.fileSize;
+ ++objectsOnLeftView;
}
if (refLine.fileDescrRight.objType != isNothing)
{
-
- FreeFileSync::wxULongLongToMpz(tmpInt, refLine.fileDescrRight.fileSize);
- mpz_add(filesizeRightView, filesizeRightView, tmpInt);
-
- objectsOnRightView++;
+ filesizeRightView+= refLine.fileDescrRight.fileSize;
+ ++objectsOnRightView;
}
}
@@ -1904,10 +1984,9 @@ void MainDialog::updateStatusInformation(const UI_Grid& visibleGrid)
wxString objectsViewLeft = numberToWxString(objectsOnLeftView);
globalFunctions::includeNumberSeparator(objectsViewLeft);
if (objectsOnLeftView == 1)
- m_statusBar1->SetStatusText(wxString(_("1 item on left, ")) + FreeFileSync::formatFilesizeToShortString(mpz_class(filesizeLeftView)), 0);
+ m_statusBar1->SetStatusText(wxString(_("1 item on left, ")) + FreeFileSync::formatFilesizeToShortString(filesizeLeftView), 0);
else
- m_statusBar1->SetStatusText(objectsViewLeft + _(" items on left, ") + FreeFileSync::formatFilesizeToShortString(mpz_class(filesizeLeftView)), 0);
-
+ m_statusBar1->SetStatusText(objectsViewLeft + _(" items on left, ") + FreeFileSync::formatFilesizeToShortString(filesizeLeftView), 0);
wxString objectsTotal = numberToWxString(currentGridData.size());
globalFunctions::includeNumberSeparator(objectsTotal);
@@ -1922,14 +2001,9 @@ void MainDialog::updateStatusInformation(const UI_Grid& visibleGrid)
wxString objectsViewRight = numberToWxString(objectsOnRightView);
globalFunctions::includeNumberSeparator(objectsViewRight);
if (objectsOnRightView == 1)
- m_statusBar1->SetStatusText(wxString(_("1 item on right, ")) + FreeFileSync::formatFilesizeToShortString(mpz_class(filesizeRightView)), 2);
+ m_statusBar1->SetStatusText(wxString(_("1 item on right, ")) + FreeFileSync::formatFilesizeToShortString(filesizeRightView), 2);
else
- m_statusBar1->SetStatusText(objectsViewRight + _(" items on right, ") + FreeFileSync::formatFilesizeToShortString(mpz_class(filesizeRightView)), 2);
-
- //-----------------------------------------------------
- mpz_clear(filesizeLeftView);
- mpz_clear(filesizeRightView);
- mpz_clear(tmpInt);
+ m_statusBar1->SetStatusText(objectsViewRight + _(" items on right, ") + FreeFileSync::formatFilesizeToShortString(filesizeRightView), 2);
}
@@ -1940,7 +2014,7 @@ void MainDialog::mapFileModelToUI(UI_Grid& output, const FileCompareResult& file
UI_GridLine gridline;
unsigned int currentRow = 0;
wxString fileSize; //tmp string
- for (FileCompareResult::const_iterator i = fileCmpResult.begin(); i != fileCmpResult.end(); i++, currentRow++)
+ for (FileCompareResult::const_iterator i = fileCmpResult.begin(); i != fileCmpResult.end(); ++i, ++currentRow)
{
//process UI filter settings
switch (i->cmpResult)
@@ -2072,6 +2146,7 @@ CompareStatusUpdater::CompareStatusUpdater(MainDialog* dlg) :
mainDialog->m_bpButton201->Disable();
mainDialog->m_choiceLoad->Disable();
mainDialog->m_bpButton10->Disable();
+ mainDialog->m_bpButton14->Disable();
//show abort button
mainDialog->m_buttonAbort->Show();
@@ -2110,6 +2185,7 @@ CompareStatusUpdater::~CompareStatusUpdater()
mainDialog->m_bpButton201->Enable();
mainDialog->m_choiceLoad->Enable();
mainDialog->m_bpButton10->Enable();
+ mainDialog->m_bpButton14->Enable();
if (abortionRequested)
mainDialog->pushStatusInformation(_("Operation aborted!"));
@@ -2138,8 +2214,8 @@ void CompareStatusUpdater::initNewProcess(int objectsTotal, double dataTotal, in
if (currentProcess == FreeFileSync::scanningFilesProcess)
;
- else if (currentProcess == FreeFileSync::calcMD5Process)
- statusPanel->resetMD5Gauge(objectsTotal, dataTotal);
+ else if (currentProcess == FreeFileSync::compareFileContentProcess)
+ statusPanel->resetCmpGauge(objectsTotal, dataTotal);
else assert(false);
}
@@ -2149,8 +2225,8 @@ void CompareStatusUpdater::updateProcessedData(int objectsProcessed, double data
{
if (currentProcess == FreeFileSync::scanningFilesProcess)
statusPanel->incScannedFiles_NoUpdate(objectsProcessed);
- else if (currentProcess == FreeFileSync::calcMD5Process)
- statusPanel->incProcessedMD5Data_NoUpdate(objectsProcessed, dataProcessed);
+ else if (currentProcess == FreeFileSync::compareFileContentProcess)
+ statusPanel->incProcessedCmpData_NoUpdate(objectsProcessed, dataProcessed);
else assert(false);
}
@@ -2160,6 +2236,8 @@ int CompareStatusUpdater::reportError(const wxString& text)
if (suppressUI_Errormessages)
return StatusUpdater::continueNext;
+ statusPanel->updateStatusPanelNow();
+
wxString errorMessage = text + _("\n\nContinue with next object, retry or abort comparison?");
ErrorDlg* errorDlg = new ErrorDlg(errorMessage, suppressUI_Errormessages);
@@ -2208,11 +2286,6 @@ SyncStatusUpdater::SyncStatusUpdater(wxWindow* dlg, bool hideErrorMessages) :
SyncStatusUpdater::~SyncStatusUpdater()
{
- if (abortionRequested)
- syncStatusFrame->processHasFinished(_("Aborted!")); //enable okay and close events
- else
- syncStatusFrame->processHasFinished(_("Completed"));
-
//print the results list
unsigned int failedItems = unhandledErrors.GetCount();
wxString result;
@@ -2230,7 +2303,14 @@ SyncStatusUpdater::~SyncStatusUpdater()
result+= _("Synchronization aborted: You may try to synchronize remaining items again (WITHOUT having to re-compare)!");
syncStatusFrame->setStatusText_NoUpdate(result);
- syncStatusFrame->updateStatusDialogNow();
+
+ //notify to syncStatusFrame that current process has ended
+ if (abortionRequested)
+ syncStatusFrame->processHasFinished(statusAborted); //enable okay and close events
+ else if (failedItems)
+ syncStatusFrame->processHasFinished(statusCompletedWithErrors);
+ else
+ syncStatusFrame->processHasFinished(statusCompletedWithSuccess);
}
@@ -2246,6 +2326,7 @@ void SyncStatusUpdater::initNewProcess(int objectsTotal, double dataTotal, int p
assert (processID == FreeFileSync::synchronizeFilesProcess);
syncStatusFrame->resetGauge(objectsTotal, dataTotal);
+ syncStatusFrame->setCurrentStatus(statusSynchronizing);
}
@@ -2264,6 +2345,8 @@ int SyncStatusUpdater::reportError(const wxString& text)
return StatusUpdater::continueNext;
}
+ syncStatusFrame->updateStatusDialogNow();
+
wxString errorMessage = text + _("\n\nContinue with next object, retry or abort synchronization?");
ErrorDlg* errorDlg = new ErrorDlg(errorMessage, suppressUI_Errormessages);
@@ -2301,5 +2384,3 @@ void SyncStatusUpdater::triggerUI_Refresh()
syncStatusFrame->updateStatusDialogNow();
}
-
-
diff --git a/ui/MainDialog.h b/ui/MainDialog.h
index 1f014502..3ac612fc 100644
--- a/ui/MainDialog.h
+++ b/ui/MainDialog.h
@@ -45,6 +45,15 @@ typedef vector<UI_GridLine> UI_Grid;
bool updateUI_IsAllowed(); //test if a specific amount of time is over
void updateUI_Now(); //do the updating
+//IDs for context menu items
+enum ContextItem
+{
+ contextManualFilter = 10,
+ contextCopyClipboard,
+ contextOpenExplorer,
+ contextDeleteFiles
+};
+
extern int leadingPanel;
class CompareStatusUpdater;
@@ -79,9 +88,12 @@ private:
void mapFileModelToUI(UI_Grid& output, const FileCompareResult& fileCmpResult);
void updateStatusInformation(const UI_Grid& output);
- void filterRangeManual(const set<int>& rowsToFilterOnUI_View, int leadingRow);
-
- void deleteFilesOnGrid(wxGrid* grid);
+ //context menu functions
+ set<int> getSelectedRows();
+ void filterRangeManual(const set<int>& rowsToFilterOnUI_View);
+ void copySelectionToClipboard(const set<int>& selectedRows, int selectedGrid);
+ void openWithFileBrowser(int rowNumber, int gridNr);
+ void deleteFilesOnGrid(const set<int>& rowsToDeleteOnUI);
//work to be done in idle time
void OnIdleEvent(wxEvent& event);
@@ -99,6 +111,7 @@ private:
void onGrid1ButtonEvent(wxKeyEvent& event);
void onGrid2ButtonEvent(wxKeyEvent& event);
void onGrid3ButtonEvent(wxKeyEvent& event);
+ void OnOpenContextMenu(wxGridEvent& event);
void OnEnterLeftDir(wxCommandEvent& event);
void OnEnterRightDir(wxCommandEvent& event);
@@ -107,10 +120,11 @@ private:
//manual filtering of rows:
void OnGridSelectCell(wxGridEvent& event);
- void OnGrid3SelectRange(wxGridRangeSelectEvent& event);
void OnGrid3LeftMouseUp(wxEvent& event);
void OnGrid3LeftMouseDown(wxEvent& event);
+ void onContextMenuSelection(wxCommandEvent& event);
+
void OnLeftGridDoubleClick( wxGridEvent& event);
void OnRightGridDoubleClick(wxGridEvent& event);
void OnSortLeftGrid( wxGridEvent& event);
@@ -181,6 +195,8 @@ private:
wxFrame* parent;
+ wxMenu* contextMenu;
+
//status information
wxLongLong lastStatusChange;
int stackObjects;
@@ -191,9 +207,6 @@ private:
static const int CfgHistroyLength = 10;
//variables for manual filtering of m_grid3
- int selectedRange3Begin; //only used for grid 3
- int selectedRange3End; //only used for grid 3
- int selectionLead; //used on all three grids
bool filteringInitialized;
bool filteringPending;
diff --git a/ui/Resources.cpp b/ui/Resources.cpp
index 3bbd1523..207ff7c1 100644
--- a/ui/Resources.cpp
+++ b/ui/Resources.cpp
@@ -53,6 +53,16 @@ wxBitmap* GlobalResources::bitmapSmallDown = 0;
wxBitmap* GlobalResources::bitmapSave = 0;
wxBitmap* GlobalResources::bitmapFFS = 0;
wxBitmap* GlobalResources::bitmapDeleteFile = 0;
+wxBitmap* GlobalResources::bitmapGPL = 0;
+wxBitmap* GlobalResources::bitmapStatusPause = 0;
+wxBitmap* GlobalResources::bitmapStatusError = 0;
+wxBitmap* GlobalResources::bitmapStatusSuccess = 0;
+wxBitmap* GlobalResources::bitmapStatusWarning = 0;
+wxBitmap* GlobalResources::bitmapStatusScanning = 0;
+wxBitmap* GlobalResources::bitmapStatusComparing = 0;
+wxBitmap* GlobalResources::bitmapStatusSyncing = 0;
+wxBitmap* GlobalResources::bitmapLogo = 0;
+wxBitmap* GlobalResources::bitmapFinished = 0;
wxAnimation* GlobalResources::animationMoney = 0;
wxAnimation* GlobalResources::animationSync = 0;
@@ -60,7 +70,6 @@ wxAnimation* GlobalResources::animationSync = 0;
void GlobalResources::loadResourceFiles()
{
-
floatingPointSeparator = _(".");
numberSeparator = _(",");
@@ -95,12 +104,22 @@ void GlobalResources::loadResourceFiles()
bitmapResource["exclude.png"] = (bitmapExclude = new wxBitmap(wxNullBitmap));
bitmapResource["filter active.png"] = (bitmapFilterOn = new wxBitmap(wxNullBitmap));
bitmapResource["filter not active.png"] = (bitmapFilterOff = new wxBitmap(wxNullBitmap));
- bitmapResource["Warning.png"] = (bitmapWarning = new wxBitmap(wxNullBitmap));
+ bitmapResource["warning.png"] = (bitmapWarning = new wxBitmap(wxNullBitmap));
bitmapResource["small arrow up.png"] = (bitmapSmallUp = new wxBitmap(wxNullBitmap));
bitmapResource["small arrow down.png"] = (bitmapSmallDown = new wxBitmap(wxNullBitmap));
bitmapResource["save.png"] = (bitmapSave = new wxBitmap(wxNullBitmap));
bitmapResource["FFS.png"] = (bitmapFFS = new wxBitmap(wxNullBitmap));
bitmapResource["deleteFile.png"] = (bitmapDeleteFile = new wxBitmap(wxNullBitmap));
+ bitmapResource["gpl.png"] = (bitmapGPL = new wxBitmap(wxNullBitmap));
+ bitmapResource["statusPause.png"] = (bitmapStatusPause = new wxBitmap(wxNullBitmap));
+ bitmapResource["statusError.png"] = (bitmapStatusError = new wxBitmap(wxNullBitmap));
+ bitmapResource["statusSuccess.png"] = (bitmapStatusSuccess = new wxBitmap(wxNullBitmap));
+ bitmapResource["statusWarning.png"] = (bitmapStatusWarning = new wxBitmap(wxNullBitmap));
+ bitmapResource["statusScanning.png"] = (bitmapStatusScanning = new wxBitmap(wxNullBitmap));
+ bitmapResource["statusComparing.png"] = (bitmapStatusComparing = new wxBitmap(wxNullBitmap));
+ bitmapResource["statusSyncing.png"] = (bitmapStatusSyncing = new wxBitmap(wxNullBitmap));
+ bitmapResource["logo.png"] = (bitmapLogo = new wxBitmap(wxNullBitmap));
+ bitmapResource["finished.png"] = (bitmapFinished = new wxBitmap(wxNullBitmap));
animationMoney = new wxAnimation(wxNullAnimation);
animationSync = new wxAnimation(wxNullAnimation);
diff --git a/ui/Resources.h b/ui/Resources.h
index e2ae1303..bfd2a8bc 100644
--- a/ui/Resources.h
+++ b/ui/Resources.h
@@ -55,6 +55,16 @@ public:
static wxBitmap* bitmapSave;
static wxBitmap* bitmapFFS;
static wxBitmap* bitmapDeleteFile;
+ static wxBitmap* bitmapGPL;
+ static wxBitmap* bitmapStatusPause;
+ static wxBitmap* bitmapStatusError;
+ static wxBitmap* bitmapStatusSuccess;
+ static wxBitmap* bitmapStatusWarning;
+ static wxBitmap* bitmapStatusScanning;
+ static wxBitmap* bitmapStatusComparing;
+ static wxBitmap* bitmapStatusSyncing;
+ static wxBitmap* bitmapLogo;
+ static wxBitmap* bitmapFinished;
static wxAnimation* animationMoney;
static wxAnimation* animationSync;
diff --git a/ui/SmallDialogs.cpp b/ui/SmallDialogs.cpp
index 77fc8a59..4e1cc148 100644
--- a/ui/SmallDialogs.cpp
+++ b/ui/SmallDialogs.cpp
@@ -1,13 +1,15 @@
#include "smallDialogs.h"
#include "../library/globalFunctions.h"
+#include <fstream>
using namespace globalFunctions;
-AboutDlg::AboutDlg(MainDialog* window) : AboutDlgGenerated(window)
+AboutDlg::AboutDlg(wxWindow* window) : AboutDlgGenerated(window)
{
m_bitmap9->SetBitmap(*GlobalResources::bitmapWebsite);
m_bitmap10->SetBitmap(*GlobalResources::bitmapEmail);
- m_bitmap11->SetBitmap(*GlobalResources::bitmapFFS);
+ m_bitmap11->SetBitmap(*GlobalResources::bitmapLogo);
+ m_bitmap13->SetBitmap(*GlobalResources::bitmapGPL);
m_animationControl1->SetAnimation(*GlobalResources::animationMoney);
m_animationControl1->Play();
@@ -33,7 +35,7 @@ void AboutDlg::OnOK(wxCommandEvent& event)
//########################################################################################
-HelpDlg::HelpDlg(MainDialog* window) : HelpDlgGenerated(window)
+HelpDlg::HelpDlg(wxWindow* window) : HelpDlgGenerated(window)
{
m_button8->SetFocus();
}
@@ -54,16 +56,17 @@ void HelpDlg::OnOK(wxCommandEvent& event)
//########################################################################################
-FilterDlg::FilterDlg(MainDialog* window) :
+FilterDlg::FilterDlg(wxWindow* window, wxString& filterIncl, wxString& filterExcl) :
FilterDlgGenerated(window),
- mainDialog(window)
+ includeFilter(filterIncl),
+ excludeFilter(filterExcl)
{
m_bitmap8->SetBitmap(*GlobalResources::bitmapInclude);
m_bitmap9->SetBitmap(*GlobalResources::bitmapExclude);
- m_textCtrlInclude->SetValue(mainDialog->includeFilter);
- m_textCtrlExclude->SetValue(mainDialog->excludeFilter);
+ m_textCtrlInclude->SetValue(includeFilter);
+ m_textCtrlExclude->SetValue(excludeFilter);
}
FilterDlg::~FilterDlg() {}
@@ -78,8 +81,8 @@ void FilterDlg::OnClose(wxCloseEvent& event)
void FilterDlg::OnOK(wxCommandEvent& event)
{
//only if user presses ApplyFilter, he wants the changes to be committed
- mainDialog->includeFilter = m_textCtrlInclude->GetValue();
- mainDialog->excludeFilter = m_textCtrlExclude->GetValue();
+ includeFilter = m_textCtrlInclude->GetValue();
+ excludeFilter = m_textCtrlExclude->GetValue();
//when leaving dialog: filter and redraw grid, if filter is active
EndModal(okayButtonPressed);
@@ -173,6 +176,98 @@ void ErrorDlg::OnAbort(wxCommandEvent& event)
}
//########################################################################################
+/*
+class for calculation of remaining time:
+----------------------------------------
+"filesize |-> time" is an affine linear function f(x) = z_1 + z_2 x
+
+For given n measurements, sizes x_0, ..., x_n and times f_0, ..., f_n, the function f (as a polynom of degree 1) can be lineary approximated by
+
+z_1 = (r - s * q / p) / ((n + 1) - s * s / p)
+z_2 = (q - s * z_1) / p = (r - (n + 1) z_1) / s
+
+with
+p := x_0^2 + ... + x_n^2
+q := f_0 x_0 + ... + f_n x_n
+r := f_0 + ... + f_n
+s := x_0 + ... + x_n
+
+=> the time to process N files with amount of data D is: N * z_1 + D * z_2
+
+Problem:
+--------
+Times f_0, ..., f_n can be very small so that precision of the PC clock is poor.
+=> Times have to be accumulated to enhance precision:
+Copying of m files with sizes x_i and times f_i (i = 1, ..., m) takes sum_i f(x_i) := m * z_1 + z_2 * sum x_i = sum f_i
+With X defined as the accumulated sizes and F the accumulated times this gives: (in theory...)
+m * z_1 + z_2 * X = F <=>
+z_1 + z_2 * X / m = F / m
+
+=> we optain a new (artificial) measurement with size X / m and time F / m to be used in the linear approximation above
+
+
+RemainingTime::RemainingTime() : n(0), m(0), X(0), F(0), p(0), q(0), r(0), s(0), z_1(0), z_2(0), lastExec(0) {}
+
+RemainingTime::~RemainingTime()
+{
+ ofstream output("test.txt");
+ for (unsigned i = 0; i < x.size(); ++i)
+ {
+ output<<x[i]<<" "<<f[i]<<endl;
+ }
+ output<<endl<<z_1<<" "<<z_2<<endl;
+ output.close();
+}
+
+
+wxLongLong RemainingTime::getRemainingTime(double processedDataSinceLastCall, int remainingFiles, double remainingData) //returns the remaining time in seconds
+{
+ wxLongLong newExec = wxGetLocalTimeMillis();
+
+ if (lastExec != 0)
+ {
+ X+= processedDataSinceLastCall;
+ F = (newExec - lastExec).ToDouble();
+ ++m;
+
+ if (F > 1000) //add new measurement only if F is accumulated to a certain degree
+ {
+ lastExec = newExec;
+ ++n;
+
+ double x_i = X / m;
+ double f_i = F / m;
+ X = 0;
+ F = 0;
+ m = 0;
+
+ x.push_back(x_i);
+ f.push_back(f_i);
+
+ p+= x_i * x_i;
+ q+= f_i * x_i;
+ r+= f_i;
+ s+= x_i;
+
+ if (p != 0)
+ {
+ double tmp = (n - s * s / p);
+ if (tmp != 0 && s != 0)
+ { //recalculate coefficients for affine-linear function
+ z_1 = (r - s * q / p) / tmp;
+ z_2 = (r - n * z_1) / s; //not (n + 1) here, since n already is the number of measurements
+ }
+ }
+ }
+
+ return int(remainingFiles * z_1 + remainingData * z_2);
+ }
+ //else
+ lastExec = newExec;
+ return 0;
+}*/
+
+//########################################################################################
SyncStatus::SyncStatus(StatusUpdater* updater, wxWindow* parentWindow) :
SyncStatusGenerated(parentWindow),
@@ -186,6 +281,7 @@ SyncStatus::SyncStatus(StatusUpdater* updater, wxWindow* parentWindow) :
totalObjects(0)
{
m_animationControl1->SetAnimation(*GlobalResources::animationSync);
+ m_animationControl1->SetInactiveBitmap(*GlobalResources::bitmapFinished);
m_animationControl1->Play();
//initialize gauge
@@ -205,6 +301,7 @@ SyncStatus::~SyncStatus()
{
windowToDis->Enable();
windowToDis->Raise();
+ windowToDis->SetFocus();
}
}
@@ -248,8 +345,9 @@ void SyncStatus::updateStatusDialogNow()
//remaining objects
m_staticTextRemainingObj->SetLabel(numberToWxString(totalObjects - currentObjects));
+
//remaining bytes left for copy
- const wxString remainingBytes = FreeFileSync::formatFilesizeToShortString(mpz_class(totalData - currentData));
+ const wxString remainingBytes = FreeFileSync::formatFilesizeToShortString(totalData - currentData);
m_staticTextDataRemaining->SetLabel(remainingBytes);
//do the ui update
@@ -257,11 +355,54 @@ void SyncStatus::updateStatusDialogNow()
}
-void SyncStatus::processHasFinished(const wxString& finalStatusText) //essential to call this in StatusUpdater derived class destructor
-{ //at the LATEST(!) to prevent access to currentStatusUpdater
+void SyncStatus::setCurrentStatus(SyncStatusID id)
+{
+ switch (id)
+ {
+ case statusAborted:
+ m_bitmapStatus->SetBitmap(*GlobalResources::bitmapStatusError);
+ m_staticTextStatus->SetLabel(_("Aborted"));
+ break;
+
+ case statusCompletedWithSuccess:
+ m_bitmapStatus->SetBitmap(*GlobalResources::bitmapStatusSuccess);
+ m_staticTextStatus->SetLabel(_("Completed"));
+ break;
+
+ case statusCompletedWithErrors:
+ m_bitmapStatus->SetBitmap(*GlobalResources::bitmapStatusWarning);
+ m_staticTextStatus->SetLabel(_("Completed"));
+ break;
+
+ case statusPause:
+ m_bitmapStatus->SetBitmap(*GlobalResources::bitmapStatusPause);
+ m_staticTextStatus->SetLabel(_("Pause"));
+ break;
+
+ case statusScanning:
+ m_bitmapStatus->SetBitmap(*GlobalResources::bitmapStatusComparing);
+ m_staticTextStatus->SetLabel(_("Scanning..."));
+ break;
+
+ case statusComparing:
+ m_bitmapStatus->SetBitmap(*GlobalResources::bitmapStatusComparing);
+ m_staticTextStatus->SetLabel(_("Comparing..."));
+ break;
+
+ case statusSynchronizing:
+ m_bitmapStatus->SetBitmap(*GlobalResources::bitmapStatusSyncing);
+ m_staticTextStatus->SetLabel(_("Synchronizing..."));
+ break;
+ }
+}
+
+
+void SyncStatus::processHasFinished(SyncStatusID id) //essential to call this in StatusUpdater derived class destructor
+{ //at the LATEST(!) to prevent access to currentStatusUpdater
currentProcessIsRunning = false; //enable okay and close events
- m_staticTextStatus->SetLabel(finalStatusText);
+ setCurrentStatus(id);
+
m_buttonAbort->Hide();
m_buttonOK->Show();
m_buttonOK->SetFocus();
@@ -297,13 +438,15 @@ void SyncStatus::OnClose(wxCloseEvent& event)
CompareStatus::CompareStatus(wxWindow* parentWindow) :
CompareStatusGenerated(parentWindow),
scannedFiles(0),
- totalMD5Data(0),
- currentMD5Data(0),
- scalingFactorMD5(0),
- currentMD5Objects(0),
- totalMD5Objects(0)
-{
- //initialize gauge
+ totalCmpData(0),
+ processedCmpData(0),
+ scalingFactorCmp(0),
+ processedCmpObjects(0),
+ totalCmpObjects(0)
+ /*timeRemaining(0),
+ timeRemainingTimeStamp(0)*/
+
+{ //initialize gauge
m_gauge2->SetRange(50000);
m_gauge2->SetValue(0);
}
@@ -312,18 +455,18 @@ CompareStatus::CompareStatus(wxWindow* parentWindow) :
CompareStatus::~CompareStatus() {}
-void CompareStatus::resetMD5Gauge(int totalMD5ObjectsToProcess, double totalMD5DataToProcess)
+void CompareStatus::resetCmpGauge(int totalCmpObjectsToProcess, double totalCmpDataToProcess)
{
- currentMD5Data = 0;
- totalMD5Data = totalMD5DataToProcess;
+ processedCmpData = 0;
+ totalCmpData = totalCmpDataToProcess;
- currentMD5Objects = 0;
- totalMD5Objects = totalMD5ObjectsToProcess;
+ processedCmpObjects = 0;
+ totalCmpObjects = totalCmpObjectsToProcess;
- if (totalMD5Data != 0)
- scalingFactorMD5 = 50000 / totalMD5Data; //let's normalize to 50000
+ if (totalCmpData != 0)
+ scalingFactorCmp = 50000 / totalCmpData; //let's normalize to 50000
else
- scalingFactorMD5 = 0;
+ scalingFactorCmp = 0;
}
@@ -333,10 +476,13 @@ void CompareStatus::incScannedFiles_NoUpdate(int number)
}
-void CompareStatus::incProcessedMD5Data_NoUpdate(int objectsProcessed, double dataProcessed)
+void CompareStatus::incProcessedCmpData_NoUpdate(int objectsProcessed, double dataProcessed)
{
- currentMD5Data+= dataProcessed;
- currentMD5Objects+= objectsProcessed;
+ processedCmpData+= dataProcessed;
+ processedCmpObjects+= objectsProcessed;
+
+/* timeRemaining = calcTimeLeft.getRemainingTime(dataProcessed, totalCmpObjects - processedCmpObjects, totalCmpData - processedCmpData);
+ timeRemainingTimeStamp = wxGetLocalTimeMillis();*/
}
@@ -353,16 +499,23 @@ void CompareStatus::updateStatusPanelNow()
m_staticTextScanned->SetLabel(numberToWxString(scannedFiles));
- //progress indicator for MD5
- m_gauge2->SetValue(int(currentMD5Data * scalingFactorMD5));
+ //progress indicator for "compare file content"
+ m_gauge2->SetValue(int(processedCmpData * scalingFactorCmp));
- //remaining MD5 objects
- m_staticTextFilesToCompare->SetLabel(numberToWxString(totalMD5Objects - currentMD5Objects));
+ //remaining file to compare
+ m_staticTextFilesToCompare->SetLabel(numberToWxString(totalCmpObjects - processedCmpObjects));
- //remaining bytes left for MD5 calculation
- const wxString remainingBytes = FreeFileSync::formatFilesizeToShortString(mpz_class(totalMD5Data - currentMD5Data));
+ //remaining bytes left for file comparison
+ const wxString remainingBytes = FreeFileSync::formatFilesizeToShortString(totalCmpData - processedCmpData);
m_staticTextDataToCompare->SetLabel(remainingBytes);
-
+/*
+ //remaining time in seconds
+ if (timeRemaining != 0)
+ {
+ int time = ((timeRemaining - (wxGetLocalTimeMillis() - timeRemainingTimeStamp)) / 1000).GetLo();
+ m_staticTextRemainingTime->SetLabel(numberToWxString(time) + " s");
+ }
+*/
//do the ui update
updateUI_Now();
}
diff --git a/ui/SmallDialogs.h b/ui/SmallDialogs.h
index 9ae3ae88..0eb22395 100644
--- a/ui/SmallDialogs.h
+++ b/ui/SmallDialogs.h
@@ -8,7 +8,7 @@ class MainDialog;
class AboutDlg : public AboutDlgGenerated
{
public:
- AboutDlg(MainDialog* window);
+ AboutDlg(wxWindow* window);
~AboutDlg();
private:
@@ -20,7 +20,7 @@ private:
class HelpDlg : public HelpDlgGenerated
{
public:
- HelpDlg(MainDialog* window);
+ HelpDlg(wxWindow* window);
~HelpDlg();
private:
@@ -32,7 +32,7 @@ private:
class FilterDlg : public FilterDlgGenerated
{
public:
- FilterDlg(MainDialog* window);
+ FilterDlg(wxWindow* window, wxString& filterIncl, wxString& filterExcl);
~FilterDlg();
static const int okayButtonPressed = 25;
@@ -43,7 +43,8 @@ private:
void OnCancel(wxCommandEvent& event);
void OnClose(wxCloseEvent& event);
- MainDialog* mainDialog;
+ wxString& includeFilter;
+ wxString& excludeFilter;
};
@@ -83,6 +84,18 @@ private:
};
+enum SyncStatusID
+{
+ statusAborted,
+ statusCompletedWithSuccess,
+ statusCompletedWithErrors,
+ statusPause,
+ statusScanning,
+ statusComparing,
+ statusSynchronizing
+};
+
+
class SyncStatus : public SyncStatusGenerated
{
public:
@@ -94,7 +107,8 @@ public:
void setStatusText_NoUpdate(const wxString& text);
void updateStatusDialogNow();
- void processHasFinished(const wxString& finalStatusText); //essential to call this in StatusUpdater derived class destructor at the LATEST(!) to prevent access to currentStatusUpdater
+ void setCurrentStatus(SyncStatusID id);
+ void processHasFinished(SyncStatusID id); //essential to call this in StatusUpdater derived class destructor at the LATEST(!) to prevent access to currentStatusUpdater
private:
void OnOkay(wxCommandEvent& event);
@@ -115,6 +129,31 @@ private:
wxString currentStatusText;
};
+/*
+class RemainingTime
+{
+public:
+ RemainingTime();
+ ~RemainingTime();
+ wxLongLong getRemainingTime(double processedDataSinceLastCall, int remainingFiles, double remainingData); //returns the remaining time in milliseconds
+
+private:
+ double n;
+ double m;
+ double X;
+ double F;
+ double p;
+ double q;
+ double r;
+ double s;
+ double z_1;
+ double z_2;
+ wxLongLong lastExec;
+
+ vector<double> x; //dummy: DELETE asap!
+ vector<double> f;
+};
+*/
class CompareStatus : public CompareStatusGenerated
{
@@ -122,9 +161,9 @@ public:
CompareStatus(wxWindow* parentWindow);
~CompareStatus();
- void resetMD5Gauge(int totalMD5ObjectsToProcess, double totalMD5DataToProcess);
+ void resetCmpGauge(int totalCmpObjectsToProcess, double totalCmpDataToProcess);
void incScannedFiles_NoUpdate(int number);
- void incProcessedMD5Data_NoUpdate(int objectsProcessed, double dataProcessed);
+ void incProcessedCmpData_NoUpdate(int objectsProcessed, double dataProcessed);
void setStatusText_NoUpdate(const wxString& text);
void updateStatusPanelNow();
@@ -134,11 +173,17 @@ private:
wxString currentStatusText;
//gauge variables
- double totalMD5Data; //each data element represents one byte for proper progress indicator scaling
- double currentMD5Data;
- double scalingFactorMD5; //nr of elements has to be normalized to smaller nr. because of range of int limitation
- int currentMD5Objects; //each object represents a file or directory processed
- int totalMD5Objects;
+ double totalCmpData; //each data element represents one byte for proper progress indicator scaling
+ double processedCmpData;
+ double scalingFactorCmp; //nr of elements has to be normalized to smaller nr. because of range of int limitation
+ int processedCmpObjects; //each object represents a file or directory processed
+ int totalCmpObjects;
+/*
+ //remaining time
+ RemainingTime calcTimeLeft;
+ wxLongLong timeRemaining; //time in milliseconds
+ wxLongLong timeRemainingTimeStamp; //time in milliseconds
+*/
};
diff --git a/ui/SyncDialog.cpp b/ui/SyncDialog.cpp
index a40da108..b97badf8 100644
--- a/ui/SyncDialog.cpp
+++ b/ui/SyncDialog.cpp
@@ -38,6 +38,8 @@ SyncDialog::SyncDialog(MainDialog* window)
else
m_radioBtn3->SetValue(true); //other
+
+ m_bpButton18->SetLabel(_("&Start"));
}
//#################################################################################################################
diff --git a/ui/guiGenerated.cpp b/ui/guiGenerated.cpp
index 1d51a28f..a6ad9e6c 100644
--- a/ui/guiGenerated.cpp
+++ b/ui/guiGenerated.cpp
@@ -34,7 +34,7 @@ GuiGenerated::GuiGenerated( wxWindow* parent, wxWindowID id, const wxString& tit
bSizer6->Add( 40, 0, 0, wxEXPAND, 5 );
wxBoxSizer* bSizer30;
- bSizer30 = new wxBoxSizer( wxHORIZONTAL );
+ bSizer30 = new wxBoxSizer( wxVERTICAL );
m_bpButtonCompare = new wxBitmapButton( this, wxID_OK, wxNullBitmap, wxDefaultPosition, wxSize( 190,37 ), wxBU_AUTODRAW|wxFULL_REPAINT_ON_RESIZE );
m_bpButtonCompare->SetDefault();
@@ -44,7 +44,7 @@ GuiGenerated::GuiGenerated( wxWindow* parent, wxWindowID id, const wxString& tit
bSizer30->Add( m_bpButtonCompare, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT, 5 );
- m_buttonAbort = new wxButton( this, wxID_ANY, _("Abort"), wxDefaultPosition, wxSize( 186,33 ), 0 );
+ m_buttonAbort = new wxButton( this, wxID_CANCEL, _("Abort"), wxDefaultPosition, wxSize( 186,33 ), 0 );
m_buttonAbort->SetFont( wxFont( 14, 74, 90, 92, false, wxT("Tahoma") ) );
m_buttonAbort->Hide();
@@ -168,7 +168,7 @@ GuiGenerated::GuiGenerated( wxWindow* parent, wxWindowID id, const wxString& tit
m_panel1->SetSizer( bSizer7 );
m_panel1->Layout();
bSizer7->Fit( m_panel1 );
- bSizer2->Add( m_panel1, 1, wxEXPAND|wxLEFT, 5 );
+ bSizer2->Add( m_panel1, 1, wxEXPAND, 5 );
m_panel3 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizer18;
@@ -267,7 +267,7 @@ GuiGenerated::GuiGenerated( wxWindow* parent, wxWindowID id, const wxString& tit
m_panel2->SetSizer( bSizer10 );
m_panel2->Layout();
bSizer10->Fit( m_panel2 );
- bSizer2->Add( m_panel2, 1, wxEXPAND|wxRIGHT, 5 );
+ bSizer2->Add( m_panel2, 1, wxEXPAND, 5 );
bSizer1->Add( bSizer2, 1, wxEXPAND, 5 );
@@ -369,7 +369,7 @@ GuiGenerated::GuiGenerated( wxWindow* parent, wxWindowID id, const wxString& tit
m_panel4->SetSizer( bSizer3 );
m_panel4->Layout();
bSizer3->Fit( m_panel4 );
- bSizer1->Add( m_panel4, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxRIGHT|wxLEFT, 5 );
+ bSizer1->Add( m_panel4, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
this->SetSizer( bSizer1 );
this->Layout();
@@ -389,16 +389,15 @@ GuiGenerated::GuiGenerated( wxWindow* parent, wxWindowID id, const wxString& tit
m_directoryPanel1->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( GuiGenerated::OnEnterLeftDir ), NULL, this );
m_dirPicker1->Connect( wxEVT_COMMAND_DIRPICKER_CHANGED, wxFileDirPickerEventHandler( GuiGenerated::OnDirChangedPanel1 ), NULL, this );
m_grid1->Connect( wxEVT_GRID_CELL_LEFT_DCLICK, wxGridEventHandler( GuiGenerated::OnLeftGridDoubleClick ), NULL, this );
+ m_grid1->Connect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( GuiGenerated::OnOpenContextMenu ), NULL, this );
m_grid1->Connect( wxEVT_GRID_LABEL_LEFT_CLICK, wxGridEventHandler( GuiGenerated::OnSortLeftGrid ), NULL, this );
- m_grid1->Connect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( GuiGenerated::OnGridSelectCell ), NULL, this );
m_bpButtonSwap->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnSwapDirs ), NULL, this );
- m_grid3->Connect( wxEVT_GRID_RANGE_SELECT, wxGridRangeSelectEventHandler( GuiGenerated::OnGrid3SelectRange ), NULL, this );
- m_grid3->Connect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( GuiGenerated::OnGridSelectCell ), NULL, this );
+ m_grid3->Connect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( GuiGenerated::OnOpenContextMenu ), NULL, this );
m_directoryPanel2->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( GuiGenerated::OnEnterRightDir ), NULL, this );
m_dirPicker2->Connect( wxEVT_COMMAND_DIRPICKER_CHANGED, wxFileDirPickerEventHandler( GuiGenerated::OnDirChangedPanel2 ), NULL, this );
m_grid2->Connect( wxEVT_GRID_CELL_LEFT_DCLICK, wxGridEventHandler( GuiGenerated::OnRightGridDoubleClick ), NULL, this );
+ m_grid2->Connect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( GuiGenerated::OnOpenContextMenu ), NULL, this );
m_grid2->Connect( wxEVT_GRID_LABEL_LEFT_CLICK, wxGridEventHandler( GuiGenerated::OnSortRightGrid ), NULL, this );
- m_grid2->Connect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( GuiGenerated::OnGridSelectCell ), NULL, this );
m_bpButton11->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnAbout ), NULL, this );
m_bpButton201->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnSaveConfig ), NULL, this );
m_choiceLoad->Connect( wxEVT_CHAR, wxKeyEventHandler( GuiGenerated::OnChoiceKeyEvent ), NULL, this );
@@ -428,16 +427,15 @@ GuiGenerated::~GuiGenerated()
m_directoryPanel1->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( GuiGenerated::OnEnterLeftDir ), NULL, this );
m_dirPicker1->Disconnect( wxEVT_COMMAND_DIRPICKER_CHANGED, wxFileDirPickerEventHandler( GuiGenerated::OnDirChangedPanel1 ), NULL, this );
m_grid1->Disconnect( wxEVT_GRID_CELL_LEFT_DCLICK, wxGridEventHandler( GuiGenerated::OnLeftGridDoubleClick ), NULL, this );
+ m_grid1->Disconnect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( GuiGenerated::OnOpenContextMenu ), NULL, this );
m_grid1->Disconnect( wxEVT_GRID_LABEL_LEFT_CLICK, wxGridEventHandler( GuiGenerated::OnSortLeftGrid ), NULL, this );
- m_grid1->Disconnect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( GuiGenerated::OnGridSelectCell ), NULL, this );
m_bpButtonSwap->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnSwapDirs ), NULL, this );
- m_grid3->Disconnect( wxEVT_GRID_RANGE_SELECT, wxGridRangeSelectEventHandler( GuiGenerated::OnGrid3SelectRange ), NULL, this );
- m_grid3->Disconnect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( GuiGenerated::OnGridSelectCell ), NULL, this );
+ m_grid3->Disconnect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( GuiGenerated::OnOpenContextMenu ), NULL, this );
m_directoryPanel2->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( GuiGenerated::OnEnterRightDir ), NULL, this );
m_dirPicker2->Disconnect( wxEVT_COMMAND_DIRPICKER_CHANGED, wxFileDirPickerEventHandler( GuiGenerated::OnDirChangedPanel2 ), NULL, this );
m_grid2->Disconnect( wxEVT_GRID_CELL_LEFT_DCLICK, wxGridEventHandler( GuiGenerated::OnRightGridDoubleClick ), NULL, this );
+ m_grid2->Disconnect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( GuiGenerated::OnOpenContextMenu ), NULL, this );
m_grid2->Disconnect( wxEVT_GRID_LABEL_LEFT_CLICK, wxGridEventHandler( GuiGenerated::OnSortRightGrid ), NULL, this );
- m_grid2->Disconnect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( GuiGenerated::OnGridSelectCell ), NULL, this );
m_bpButton11->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnAbout ), NULL, this );
m_bpButton201->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( GuiGenerated::OnSaveConfig ), NULL, this );
m_choiceLoad->Disconnect( wxEVT_CHAR, wxKeyEventHandler( GuiGenerated::OnChoiceKeyEvent ), NULL, this );
@@ -516,6 +514,28 @@ CompareStatusGenerated::CompareStatusGenerated( wxWindow* parent, wxWindowID id,
bSizer42->Add( sbSizer11, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
+
+ bSizer42->Add( 0, 0, 1, wxEXPAND, 5 );
+
+ wxStaticBoxSizer* sbSizer131;
+ sbSizer131 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxEmptyString ), wxHORIZONTAL );
+
+ m_staticText37 = new wxStaticText( this, wxID_ANY, _("Remaining time:"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_staticText37->Wrap( -1 );
+ m_staticText37->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) );
+ m_staticText37->Hide();
+
+ sbSizer131->Add( m_staticText37, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
+
+ m_staticTextRemainingTime = new wxStaticText( this, wxID_ANY, _("--.--"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_staticTextRemainingTime->Wrap( -1 );
+ m_staticTextRemainingTime->SetFont( wxFont( 10, 74, 90, 92, false, wxT("Tahoma") ) );
+ m_staticTextRemainingTime->Hide();
+
+ sbSizer131->Add( m_staticTextRemainingTime, 0, wxALIGN_CENTER_VERTICAL, 5 );
+
+ bSizer42->Add( sbSizer131, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
+
bSizer40->Add( bSizer42, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxALL, 5 );
wxBoxSizer* bSizer48;
@@ -585,10 +605,11 @@ SyncDialogGenerated::SyncDialogGenerated( wxWindow* parent, wxWindowID id, const
m_staticText37 = new wxStaticText( this, wxID_ANY, _("Objects to process:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText37->Wrap( -1 );
m_staticText37->SetFont( wxFont( 10, 74, 93, 90, false, wxT("Tahoma") ) );
+ m_staticText37->SetToolTip( _("Number of files and directories that will be copied or deleted") );
gSizer1->Add( m_staticText37, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
- m_textCtrl12 = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
+ m_textCtrl12 = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 85,-1 ), wxTE_READONLY );
m_textCtrl12->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 90, false, wxEmptyString ) );
m_textCtrl12->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_ACTIVEBORDER ) );
@@ -597,6 +618,7 @@ SyncDialogGenerated::SyncDialogGenerated( wxWindow* parent, wxWindowID id, const
m_staticText14 = new wxStaticText( this, wxID_ANY, _("Data to transfer:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText14->Wrap( -1 );
m_staticText14->SetFont( wxFont( 10, 74, 93, 90, false, wxT("Tahoma") ) );
+ m_staticText14->SetToolTip( _("Total amount of data that will be copied") );
gSizer1->Add( m_staticText14, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
@@ -691,7 +713,7 @@ SyncDialogGenerated::SyncDialogGenerated( wxWindow* parent, wxWindowID id, const
m_button6 = new wxButton( this, wxID_ANY, _("&Back"), wxDefaultPosition, wxSize( 100,32 ), 0 );
m_button6->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) );
- bSizer291->Add( m_button6, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT, 5 );
+ bSizer291->Add( m_button6, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_button16 = new wxButton( this, wxID_CANCEL, _("dummy"), wxDefaultPosition, wxSize( 0,-1 ), 0 );
bSizer291->Add( m_button16, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
@@ -714,7 +736,7 @@ SyncDialogGenerated::SyncDialogGenerated( wxWindow* parent, wxWindowID id, const
bSizer38->Add( m_checkBoxHideErrors, 0, wxALL, 5 );
- bSizer291->Add( bSizer38, 0, wxALIGN_BOTTOM, 5 );
+ bSizer291->Add( bSizer38, 0, wxALIGN_BOTTOM|wxBOTTOM, 5 );
bSizer29->Add( bSizer291, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
@@ -899,7 +921,7 @@ HelpDlgGenerated::HelpDlgGenerated( wxWindow* parent, wxWindowID id, const wxStr
bSizer20->Add( m_textCtrl8, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
- m_button8 = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxSize( 100,32 ), 0 );
+ m_button8 = new wxButton( this, wxID_OK, _("&OK"), wxDefaultPosition, wxSize( 100,32 ), 0 );
m_button8->SetDefault();
m_button8->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) );
@@ -930,54 +952,65 @@ AboutDlgGenerated::AboutDlgGenerated( wxWindow* parent, wxWindowID id, const wxS
bSizer31->Add( 0, 10, 0, wxEXPAND, 5 );
+ m_panel5 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxSize( -1,-1 ), wxSIMPLE_BORDER|wxTAB_TRAVERSAL );
+ m_panel5->SetBackgroundColour( wxColour( 255, 255, 255 ) );
+
wxBoxSizer* bSizer36;
bSizer36 = new wxBoxSizer( wxHORIZONTAL );
- m_bitmap11 = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 40,40 ), 0 );
+ m_bitmap11 = new wxStaticBitmap( m_panel5, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 277,55 ), 0 );
bSizer36->Add( m_bitmap11, 0, wxALIGN_CENTER_VERTICAL, 5 );
- m_staticText14 = new wxStaticText( this, wxID_ANY, _("FreeFileSync v1.4"), wxDefaultPosition, wxDefaultSize, 0 );
- m_staticText14->Wrap( -1 );
- m_staticText14->SetFont( wxFont( 16, 74, 90, 92, false, wxT("Tahoma") ) );
- bSizer36->Add( m_staticText14, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
+ bSizer36->Add( 0, 0, 1, wxEXPAND, 5 );
+
+ m_staticText39 = new wxStaticText( m_panel5, wxID_ANY, _("FreeFileSync v1.5"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_staticText39->Wrap( -1 );
+ m_staticText39->SetFont( wxFont( 18, 74, 90, 92, false, wxT("Tahoma") ) );
+ bSizer36->Add( m_staticText39, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
- bSizer36->Add( 40, 0, 0, wxALIGN_CENTER_VERTICAL, 5 );
- bSizer31->Add( bSizer36, 0, wxALIGN_CENTER_HORIZONTAL, 5 );
+ bSizer36->Add( 50, 0, 0, wxEXPAND, 5 );
+
+ m_panel5->SetSizer( bSizer36 );
+ m_panel5->Layout();
+ bSizer36->Fit( m_panel5 );
+ bSizer31->Add( m_panel5, 0, wxALL|wxEXPAND, 5 );
m_staticText15 = new wxStaticText( this, wxID_ANY, _("-Open-Source file synchronization-"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText15->Wrap( -1 );
- m_staticText15->SetFont( wxFont( 8, 74, 93, 90, false, wxT("Tahoma") ) );
+ m_staticText15->SetFont( wxFont( 8, 74, 90, 92, false, wxT("Tahoma") ) );
bSizer31->Add( m_staticText15, 0, wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_build = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_build->Wrap( -1 );
+ m_build->SetFont( wxFont( 8, 74, 90, 90, false, wxT("Tahoma") ) );
+
bSizer31->Add( m_build, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizer31->Add( 0, 10, 0, wxEXPAND, 5 );
- m_textCtrl3 = new wxTextCtrl( this, wxID_ANY, _("Source code written completely in C++ utilizing:\n\nMinGW \t\t- Windows port of GNU Compiler Collection\nwxWidgets \t- Open-Source GUI framework\nwxFormBuilder\t- wxWidgets GUI-builder\nGMP \t\t- arithmetic calculations\nCodeBlocks \t- Open-Source IDE\n\n by ZenJu"), wxDefaultPosition, wxSize( 350,140 ), wxTE_MULTILINE|wxTE_NO_VSCROLL|wxTE_READONLY|wxDOUBLE_BORDER );
+ m_textCtrl3 = new wxTextCtrl( this, wxID_ANY, _("Source code written completely in C++ utilizing:\n\n MinGW \t\t- Windows port of GNU Compiler Collection\n wxWidgets \t- Open-Source GUI framework\n wxFormBuilder\t- wxWidgets GUI-builder\n CodeBlocks \t- Open-Source IDE\n\n by ZenJu"), wxDefaultPosition, wxSize( 350,-1 ), wxTE_MULTILINE|wxTE_NO_VSCROLL|wxTE_READONLY|wxDOUBLE_BORDER );
m_textCtrl3->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_ACTIVEBORDER ) );
bSizer31->Add( m_textCtrl3, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 0 );
-
- bSizer31->Add( 0, 0, 1, wxEXPAND, 5 );
-
wxStaticBoxSizer* sbSizer7;
sbSizer7 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxEmptyString ), wxVERTICAL );
m_staticText131 = new wxStaticText( this, wxID_ANY, _("Feedback and suggestions are welcome at:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText131->Wrap( -1 );
- m_staticText131->SetFont( wxFont( 11, 74, 90, 90, false, wxT("Tahoma") ) );
+ m_staticText131->SetFont( wxFont( 11, 74, 93, 92, false, wxT("Tahoma") ) );
sbSizer7->Add( m_staticText131, 0, wxALIGN_CENTER_HORIZONTAL, 5 );
- bSizer31->Add( sbSizer7, 0, wxALIGN_CENTER_HORIZONTAL, 5 );
+ bSizer31->Add( sbSizer7, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP|wxBOTTOM, 5 );
+
+ m_staticline3 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
+ bSizer31->Add( m_staticline3, 0, wxALL|wxEXPAND, 5 );
wxFlexGridSizer* fgSizer2;
fgSizer2 = new wxFlexGridSizer( 3, 3, 0, 0 );
@@ -1022,13 +1055,33 @@ AboutDlgGenerated::AboutDlgGenerated( wxWindow* parent, wxWindowID id, const wxS
m_hyperlink3 = new wxHyperlinkCtrl( this, wxID_ANY, _("Donate with Paypal"), wxT("https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=florian%2db%40gmx%2enet&no_shipping=0&no_note=1&tax=0&currency_code=EUR&lc=DE&bn=PP%2dDonationsBF&charset=UTF%2d8"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE );
fgSizer2->Add( m_hyperlink3, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
- bSizer31->Add( fgSizer2, 0, wxEXPAND|wxLEFT, 10 );
+ bSizer31->Add( fgSizer2, 0, wxLEFT|wxEXPAND, 10 );
- m_button8 = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxSize( 100,32 ), 0 );
+ m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
+ bSizer31->Add( m_staticline2, 0, wxEXPAND | wxALL, 5 );
+
+ wxStaticBoxSizer* sbSizer14;
+ sbSizer14 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Published under the GNU General Public License:") ), wxHORIZONTAL );
+
+
+ sbSizer14->Add( 0, 0, 1, wxEXPAND, 5 );
+
+ m_bitmap13 = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 88,31 ), 0 );
+ sbSizer14->Add( m_bitmap13, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
+
+ m_hyperlink5 = new wxHyperlinkCtrl( this, wxID_ANY, _("http://www.gnu.org/licenses/gpl.html"), wxT("http://www.gnu.org/licenses/gpl.html"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE );
+ sbSizer14->Add( m_hyperlink5, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 );
+
+
+ sbSizer14->Add( 0, 0, 1, wxEXPAND, 5 );
+
+ bSizer31->Add( sbSizer14, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
+
+ m_button8 = new wxButton( this, wxID_OK, _("&OK"), wxDefaultPosition, wxSize( 100,32 ), 0 );
m_button8->SetDefault();
m_button8->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) );
- bSizer31->Add( m_button8, 0, wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
+ bSizer31->Add( m_button8, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 );
this->SetSizer( bSizer31 );
this->Layout();
@@ -1087,7 +1140,7 @@ ErrorDlgGenerated::ErrorDlgGenerated( wxWindow* parent, wxWindowID id, const wxS
bSizer25->Add( m_buttonContinue, 0, wxTOP|wxBOTTOM|wxLEFT, 5 );
- m_buttonRetry = new wxButton( this, wxID_ANY, _("&Retry"), wxDefaultPosition, wxSize( 80,30 ), 0 );
+ m_buttonRetry = new wxButton( this, wxID_RETRY, _("&Retry"), wxDefaultPosition, wxSize( 80,30 ), 0 );
m_buttonRetry->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) );
bSizer25->Add( m_buttonRetry, 0, wxTOP|wxBOTTOM|wxLEFT, 5 );
@@ -1156,13 +1209,13 @@ DeleteDialogGenerated::DeleteDialogGenerated( wxWindow* parent, wxWindowID id, c
wxBoxSizer* bSizer25;
bSizer25 = new wxBoxSizer( wxHORIZONTAL );
- m_buttonOK = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxSize( 80,30 ), 0 );
+ m_buttonOK = new wxButton( this, wxID_OK, _("&OK"), wxDefaultPosition, wxSize( 80,30 ), 0 );
m_buttonOK->SetDefault();
m_buttonOK->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) );
bSizer25->Add( m_buttonOK, 0, wxTOP|wxBOTTOM|wxLEFT, 5 );
- m_buttonCancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxSize( 80,30 ), 0 );
+ m_buttonCancel = new wxButton( this, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxSize( 80,30 ), 0 );
m_buttonCancel->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) );
bSizer25->Add( m_buttonCancel, 0, wxALL, 5 );
@@ -1253,7 +1306,7 @@ FilterDlgGenerated::FilterDlgGenerated( wxWindow* parent, wxWindowID id, const w
sbSizer8->Add( fgSizer4, 0, 0, 5 );
- bSizer21->Add( sbSizer8, 0, wxRIGHT|wxLEFT, 5 );
+ bSizer21->Add( sbSizer8, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_HORIZONTAL, 5 );
bSizer21->Add( 0, 0, 1, wxEXPAND, 5 );
@@ -1261,7 +1314,7 @@ FilterDlgGenerated::FilterDlgGenerated( wxWindow* parent, wxWindowID id, const w
wxBoxSizer* bSizer22;
bSizer22 = new wxBoxSizer( wxHORIZONTAL );
- m_button9 = new wxButton( this, wxID_ANY, _("&Default"), wxDefaultPosition, wxSize( 80,30 ), 0 );
+ m_button9 = new wxButton( this, wxID_DEFAULT, _("&Default"), wxDefaultPosition, wxSize( 80,30 ), 0 );
m_button9->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) );
bSizer22->Add( m_button9, 0, wxALL, 5 );
@@ -1272,7 +1325,7 @@ FilterDlgGenerated::FilterDlgGenerated( wxWindow* parent, wxWindowID id, const w
m_button17 = new wxButton( this, wxID_CANCEL, _("dummy"), wxDefaultPosition, wxSize( 0,-1 ), 0 );
bSizer22->Add( m_button17, 0, wxALL, 5 );
- m_button10 = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxSize( 80,30 ), 0 );
+ m_button10 = new wxButton( this, wxID_OK, _("&OK"), wxDefaultPosition, wxSize( 80,30 ), 0 );
m_button10->SetDefault();
m_button10->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) );
@@ -1323,11 +1376,25 @@ SyncStatusGenerated::SyncStatusGenerated( wxWindow* parent, wxWindowID id, const
bSizer27->Add( bSizer37, 0, wxALIGN_CENTER_HORIZONTAL, 5 );
+ wxBoxSizer* bSizer42;
+ bSizer42 = new wxBoxSizer( wxHORIZONTAL );
+
+
+ bSizer42->Add( 0, 0, 1, wxEXPAND, 5 );
+
+ m_bitmapStatus = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 28,28 ), 0 );
+ bSizer42->Add( m_bitmapStatus, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
+
m_staticTextStatus = new wxStaticText( this, wxID_ANY, _("Synchronizing..."), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextStatus->Wrap( -1 );
m_staticTextStatus->SetFont( wxFont( 14, 74, 93, 90, false, wxT("Tahoma") ) );
- bSizer27->Add( m_staticTextStatus, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP|wxRIGHT|wxLEFT, 5 );
+ bSizer42->Add( m_staticTextStatus, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
+
+
+ bSizer42->Add( 0, 0, 1, wxEXPAND, 5 );
+
+ bSizer27->Add( bSizer42, 0, wxEXPAND, 5 );
wxBoxSizer* bSizer31;
bSizer31 = new wxBoxSizer( wxHORIZONTAL );
@@ -1374,13 +1441,13 @@ SyncStatusGenerated::SyncStatusGenerated( wxWindow* parent, wxWindowID id, const
bSizer28->Add( 0, 0, 1, wxEXPAND, 5 );
- m_buttonOK = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxSize( 100,32 ), 0 );
+ m_buttonOK = new wxButton( this, wxID_OK, _("&OK"), wxDefaultPosition, wxSize( 100,32 ), 0 );
m_buttonOK->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) );
m_buttonOK->Hide();
bSizer28->Add( m_buttonOK, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
- m_buttonAbort = new wxButton( this, wxID_CANCEL, _("Abort"), wxDefaultPosition, wxSize( 100,32 ), 0 );
+ m_buttonAbort = new wxButton( this, wxID_CANCEL, _("&Abort"), wxDefaultPosition, wxSize( 100,32 ), 0 );
m_buttonAbort->SetDefault();
m_buttonAbort->SetFont( wxFont( 10, 74, 90, 90, false, wxT("Tahoma") ) );
diff --git a/ui/guiGenerated.h b/ui/guiGenerated.h
index 2b6f5b6d..30376834 100644
--- a/ui/guiGenerated.h
+++ b/ui/guiGenerated.h
@@ -107,10 +107,9 @@ class GuiGenerated : public wxFrame
virtual void OnEnterLeftDir( wxCommandEvent& event ){ event.Skip(); }
virtual void OnDirChangedPanel1( wxFileDirPickerEvent& event ){ event.Skip(); }
virtual void OnLeftGridDoubleClick( wxGridEvent& event ){ event.Skip(); }
+ virtual void OnOpenContextMenu( wxGridEvent& event ){ event.Skip(); }
virtual void OnSortLeftGrid( wxGridEvent& event ){ event.Skip(); }
- virtual void OnGridSelectCell( wxGridEvent& event ){ event.Skip(); }
virtual void OnSwapDirs( wxCommandEvent& event ){ event.Skip(); }
- virtual void OnGrid3SelectRange( wxGridRangeSelectEvent& event ){ event.Skip(); }
virtual void OnEnterRightDir( wxCommandEvent& event ){ event.Skip(); }
virtual void OnDirChangedPanel2( wxFileDirPickerEvent& event ){ event.Skip(); }
virtual void OnRightGridDoubleClick( wxGridEvent& event ){ event.Skip(); }
@@ -129,7 +128,7 @@ class GuiGenerated : public wxFrame
public:
- GuiGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("FreeFileSync - Folder Synchronization"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 933,612 ), long style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL );
+ GuiGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("FreeFileSync - Folder Comparison and Synchronization"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 933,612 ), long style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL );
~GuiGenerated();
};
@@ -150,6 +149,9 @@ class CompareStatusGenerated : public wxPanel
wxStaticText* m_staticText32;
wxStaticText* m_staticTextDataToCompare;
+
+ wxStaticText* m_staticText37;
+ wxStaticText* m_staticTextRemainingTime;
wxStaticText* m_staticText30;
wxTextCtrl* m_textCtrlFilename;
wxGauge* m_gauge2;
@@ -234,7 +236,7 @@ class SyncDialogGenerated : public wxDialog
public:
- SyncDialogGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Synchronization settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 525,356 ), long style = wxDEFAULT_DIALOG_STYLE );
+ SyncDialogGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Synchronization settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 523,356 ), long style = wxDEFAULT_DIALOG_STYLE );
~SyncDialogGenerated();
};
@@ -273,15 +275,17 @@ class AboutDlgGenerated : public wxDialog
protected:
+ wxPanel* m_panel5;
wxStaticBitmap* m_bitmap11;
- wxStaticText* m_staticText14;
+
+ wxStaticText* m_staticText39;
wxStaticText* m_staticText15;
wxStaticText* m_build;
wxTextCtrl* m_textCtrl3;
-
wxStaticText* m_staticText131;
+ wxStaticLine* m_staticline3;
wxStaticBitmap* m_bitmap9;
wxStaticText* m_staticText11;
wxHyperlinkCtrl* m_hyperlink1;
@@ -291,6 +295,11 @@ class AboutDlgGenerated : public wxDialog
wxAnimationCtrl* m_animationControl1;
wxStaticText* m_staticText151;
wxHyperlinkCtrl* m_hyperlink3;
+ wxStaticLine* m_staticline2;
+
+ wxStaticBitmap* m_bitmap13;
+ wxHyperlinkCtrl* m_hyperlink5;
+
wxButton* m_button8;
// Virtual event handlers, overide them in your derived class
@@ -299,7 +308,7 @@ class AboutDlgGenerated : public wxDialog
public:
- AboutDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("About"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 439,510 ), long style = wxDEFAULT_DIALOG_STYLE );
+ AboutDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("About"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 422,603 ), long style = wxDEFAULT_DIALOG_STYLE );
~AboutDlgGenerated();
};
@@ -397,7 +406,7 @@ class FilterDlgGenerated : public wxDialog
public:
- FilterDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Configure filter settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 484,350 ), long style = wxDEFAULT_DIALOG_STYLE );
+ FilterDlgGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Configure filter settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 472,367 ), long style = wxDEFAULT_DIALOG_STYLE );
~FilterDlgGenerated();
};
@@ -413,8 +422,13 @@ class SyncStatusGenerated : public wxDialog
wxAnimationCtrl* m_animationControl1;
wxStaticText* m_staticText20;
+
+ wxStaticBitmap* m_bitmapStatus;
+ wxStaticText* m_staticTextStatus;
+
wxStaticText* m_staticText21;
+ wxTextCtrl* m_textCtrlInfo;
wxStaticText* m_staticText26;
wxStaticText* m_staticTextDataRemaining;
@@ -430,8 +444,6 @@ class SyncStatusGenerated : public wxDialog
public:
- wxStaticText* m_staticTextStatus;
- wxTextCtrl* m_textCtrlInfo;
wxGauge* m_gauge1;
wxButton* m_buttonOK;
wxButton* m_buttonAbort;
bgstack15