diff options
author | Igor Pavlov <ipavlov@users.sourceforge.net> | 2009-12-14 03:00:00 +0300 |
---|---|---|
committer | Kornel LesiĆski <kornel@geekhood.net> | 2016-05-28 02:16:01 +0300 |
commit | 1fbaf0aac5000ca563a1ee2bb15ba6821a08e468 (patch) | |
tree | ec079944edffd096355ecb0c499f889364aefb4b /CPP/7zip/UI | |
parent | 2fed8721946901375d21d4a506fe8b114045b397 (diff) |
9.09 beta
Diffstat (limited to 'CPP/7zip/UI')
30 files changed, 1746 insertions, 487 deletions
diff --git a/CPP/7zip/UI/Agent/Agent.h b/CPP/7zip/UI/Agent/Agent.h index 50b101f4..6e157615 100755 --- a/CPP/7zip/UI/Agent/Agent.h +++ b/CPP/7zip/UI/Agent/Agent.h @@ -48,8 +48,7 @@ class CAgentFolder: { public: - MY_QUERYINTERFACE_BEGIN - MY_QUERYINTERFACE_ENTRY(IFolderFolder) + MY_QUERYINTERFACE_BEGIN2(IFolderFolder) MY_QUERYINTERFACE_ENTRY(IFolderProperties) MY_QUERYINTERFACE_ENTRY(IGetFolderArchiveProperties) MY_QUERYINTERFACE_ENTRY(IArchiveFolder) @@ -142,8 +141,7 @@ class CAgent: { public: - MY_QUERYINTERFACE_BEGIN - MY_QUERYINTERFACE_ENTRY(IInFolderArchive) + MY_QUERYINTERFACE_BEGIN2(IInFolderArchive) MY_QUERYINTERFACE_ENTRY(IFolderArchiveProperties) #ifndef EXTRACT_ONLY MY_QUERYINTERFACE_ENTRY(IOutFolderArchive) diff --git a/CPP/7zip/UI/Common/ArchiveCommandLine.cpp b/CPP/7zip/UI/Common/ArchiveCommandLine.cpp index cfb0f796..93806717 100755 --- a/CPP/7zip/UI/Common/ArchiveCommandLine.cpp +++ b/CPP/7zip/UI/Common/ArchiveCommandLine.cpp @@ -181,6 +181,7 @@ static const int kCommandIndex = 0; // exception messages static const char *kUserErrorMessage = "Incorrect command line"; +static const char *kCannotFindListFile = "Cannot find listfile"; static const char *kIncorrectListFile = "Incorrect item in listfile.\nCheck charset encoding and -scs switch."; static const char *kIncorrectWildCardInListFile = "Incorrect wildcard in listfile"; static const char *kIncorrectWildCardInCommandLine = "Incorrect wildcard in command line"; @@ -281,6 +282,8 @@ static void AddToCensorFromListFile(NWildcard::CCensor &wildcardCensor, LPCWSTR fileName, bool include, NRecursedType::EEnum type, UINT codePage) { UStringVector names; + if (!NFind::DoesFileExist(fileName)) + throw kCannotFindListFile; if (!ReadNamesFromListFile(fileName, names, codePage)) throw kIncorrectListFile; for (int i = 0; i < names.Size(); i++) diff --git a/CPP/7zip/UI/Common/Bench.cpp b/CPP/7zip/UI/Common/Bench.cpp new file mode 100755 index 00000000..36449660 --- /dev/null +++ b/CPP/7zip/UI/Common/Bench.cpp @@ -0,0 +1,1024 @@ +// Bench.cpp + +#include "StdAfx.h" + +#include "Bench.h" + +#ifndef _WIN32 +#define USE_POSIX_TIME +#define USE_POSIX_TIME2 +#endif + +#ifdef USE_POSIX_TIME +#include <time.h> +#ifdef USE_POSIX_TIME2 +#include <sys/time.h> +#endif +#endif + +#ifdef _WIN32 +#define USE_ALLOCA +#endif + +#ifdef USE_ALLOCA +#ifdef _WIN32 +#include <malloc.h> +#else +#include <stdlib.h> +#endif +#endif + +#include "../../../../C/7zCrc.h" +#include "../../../../C/Alloc.h" + +#ifndef _7ZIP_ST +#include "../../../Windows/Synchronization.h" +#include "../../../Windows/Thread.h" +#endif + +#include "../../../Windows/PropVariant.h" + +static const UInt32 kUncompressMinBlockSize = +#ifdef UNDER_CE +1 << 24; +#else +1 << 26; +#endif + +static const UInt32 kCrcBlockSize = +#ifdef UNDER_CE +1 << 25; +#else +1 << 30; +#endif + +static const UInt32 kAdditionalSize = (1 << 16); +static const UInt32 kCompressedAdditionalSize = (1 << 10); +static const UInt32 kMaxLzmaPropSize = 5; + +class CBaseRandomGenerator +{ + UInt32 A1; + UInt32 A2; +public: + CBaseRandomGenerator() { Init(); } + void Init() { A1 = 362436069; A2 = 521288629;} + UInt32 GetRnd() + { + return + ((A1 = 36969 * (A1 & 0xffff) + (A1 >> 16)) << 16) + + ((A2 = 18000 * (A2 & 0xffff) + (A2 >> 16)) ); + } +}; + +class CBenchBuffer +{ +public: + size_t BufferSize; + Byte *Buffer; + CBenchBuffer(): Buffer(0) {} + virtual ~CBenchBuffer() { Free(); } + void Free() + { + ::MidFree(Buffer); + Buffer = 0; + } + bool Alloc(size_t bufferSize) + { + if (Buffer != 0 && BufferSize == bufferSize) + return true; + Free(); + Buffer = (Byte *)::MidAlloc(bufferSize); + BufferSize = bufferSize; + return (Buffer != 0); + } +}; + +class CBenchRandomGenerator: public CBenchBuffer +{ + CBaseRandomGenerator *RG; +public: + void Set(CBaseRandomGenerator *rg) { RG = rg; } + UInt32 GetVal(UInt32 &res, int numBits) + { + UInt32 val = res & (((UInt32)1 << numBits) - 1); + res >>= numBits; + return val; + } + UInt32 GetLen(UInt32 &res) + { + UInt32 len = GetVal(res, 2); + return GetVal(res, 1 + len); + } + void Generate() + { + UInt32 pos = 0; + UInt32 rep0 = 1; + while (pos < BufferSize) + { + UInt32 res = RG->GetRnd(); + res >>= 1; + if (GetVal(res, 1) == 0 || pos < 1024) + Buffer[pos++] = (Byte)(res & 0xFF); + else + { + UInt32 len; + len = 1 + GetLen(res); + if (GetVal(res, 3) != 0) + { + len += GetLen(res); + do + { + UInt32 ppp = GetVal(res, 5) + 6; + res = RG->GetRnd(); + if (ppp > 30) + continue; + rep0 = /* (1 << ppp) +*/ GetVal(res, ppp); + res = RG->GetRnd(); + } + while (rep0 >= pos); + rep0++; + } + + for (UInt32 i = 0; i < len && pos < BufferSize; i++, pos++) + Buffer[pos] = Buffer[pos - rep0]; + } + } + } +}; + + +class CBenchmarkInStream: + public ISequentialInStream, + public CMyUnknownImp +{ + const Byte *Data; + size_t Pos; + size_t Size; +public: + MY_UNKNOWN_IMP + void Init(const Byte *data, size_t size) + { + Data = data; + Size = size; + Pos = 0; + } + STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize); +}; + +STDMETHODIMP CBenchmarkInStream::Read(void *data, UInt32 size, UInt32 *processedSize) +{ + size_t remain = Size - Pos; + UInt32 kMaxBlockSize = (1 << 20); + if (size > kMaxBlockSize) + size = kMaxBlockSize; + if (size > remain) + size = (UInt32)remain; + for (UInt32 i = 0; i < size; i++) + ((Byte *)data)[i] = Data[Pos + i]; + Pos += size; + if(processedSize != NULL) + *processedSize = size; + return S_OK; +} + +class CBenchmarkOutStream: + public ISequentialOutStream, + public CBenchBuffer, + public CMyUnknownImp +{ + // bool _overflow; +public: + UInt32 Pos; + // CBenchmarkOutStream(): _overflow(false) {} + void Init() + { + // _overflow = false; + Pos = 0; + } + MY_UNKNOWN_IMP + STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize); +}; + +STDMETHODIMP CBenchmarkOutStream::Write(const void *data, UInt32 size, UInt32 *processedSize) +{ + size_t curSize = BufferSize - Pos; + if (curSize > size) + curSize = size; + memcpy(Buffer + Pos, data, curSize); + Pos += (UInt32)curSize; + if(processedSize != NULL) + *processedSize = (UInt32)curSize; + if (curSize != size) + { + // _overflow = true; + return E_FAIL; + } + return S_OK; +} + +class CCrcOutStream: + public ISequentialOutStream, + public CMyUnknownImp +{ +public: + UInt32 Crc; + MY_UNKNOWN_IMP + void Init() { Crc = CRC_INIT_VAL; } + STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize); +}; + +STDMETHODIMP CCrcOutStream::Write(const void *data, UInt32 size, UInt32 *processedSize) +{ + Crc = CrcUpdate(Crc, data, size); + if (processedSize != NULL) + *processedSize = size; + return S_OK; +} + +static UInt64 GetTimeCount() +{ + #ifdef USE_POSIX_TIME + #ifdef USE_POSIX_TIME2 + timeval v; + if (gettimeofday(&v, 0) == 0) + return (UInt64)(v.tv_sec) * 1000000 + v.tv_usec; + return (UInt64)time(NULL) * 1000000; + #else + return time(NULL); + #endif + #else + /* + LARGE_INTEGER value; + if (::QueryPerformanceCounter(&value)) + return value.QuadPart; + */ + return GetTickCount(); + #endif +} + +static UInt64 GetFreq() +{ + #ifdef USE_POSIX_TIME + #ifdef USE_POSIX_TIME2 + return 1000000; + #else + return 1; + #endif + #else + /* + LARGE_INTEGER value; + if (::QueryPerformanceFrequency(&value)) + return value.QuadPart; + */ + return 1000; + #endif +} + +#ifndef USE_POSIX_TIME +static inline UInt64 GetTime64(const FILETIME &t) { return ((UInt64)t.dwHighDateTime << 32) | t.dwLowDateTime; } +#endif + +static UInt64 GetUserTime() +{ + #ifdef USE_POSIX_TIME + return clock(); + #else + FILETIME creationTime, exitTime, kernelTime, userTime; + if ( + #ifdef UNDER_CE + ::GetThreadTimes(::GetCurrentThread() + #else + ::GetProcessTimes(::GetCurrentProcess() + #endif + , &creationTime, &exitTime, &kernelTime, &userTime) != 0) + return GetTime64(userTime) + GetTime64(kernelTime); + return (UInt64)GetTickCount() * 10000; + #endif +} + +static UInt64 GetUserFreq() +{ + #ifdef USE_POSIX_TIME + return CLOCKS_PER_SEC; + #else + return 10000000; + #endif +} + +class CBenchProgressStatus +{ + #ifndef _7ZIP_ST + NWindows::NSynchronization::CCriticalSection CS; + #endif +public: + HRESULT Res; + bool EncodeMode; + void SetResult(HRESULT res) + { + #ifndef _7ZIP_ST + NWindows::NSynchronization::CCriticalSectionLock lock(CS); + #endif + Res = res; + } + HRESULT GetResult() + { + #ifndef _7ZIP_ST + NWindows::NSynchronization::CCriticalSectionLock lock(CS); + #endif + return Res; + } +}; + +class CBenchProgressInfo: + public ICompressProgressInfo, + public CMyUnknownImp +{ +public: + CBenchProgressStatus *Status; + CBenchInfo BenchInfo; + HRESULT Res; + IBenchCallback *callback; + CBenchProgressInfo(): callback(0) {} + MY_UNKNOWN_IMP + STDMETHOD(SetRatioInfo)(const UInt64 *inSize, const UInt64 *outSize); +}; + +static void SetStartTime(CBenchInfo &bi) +{ + bi.GlobalFreq = GetFreq(); + bi.UserFreq = GetUserFreq(); + bi.GlobalTime = ::GetTimeCount(); + bi.UserTime = ::GetUserTime(); +} + +static void SetFinishTime(const CBenchInfo &biStart, CBenchInfo &dest) +{ + dest.GlobalFreq = GetFreq(); + dest.UserFreq = GetUserFreq(); + dest.GlobalTime = ::GetTimeCount() - biStart.GlobalTime; + dest.UserTime = ::GetUserTime() - biStart.UserTime; +} + +STDMETHODIMP CBenchProgressInfo::SetRatioInfo(const UInt64 *inSize, const UInt64 *outSize) +{ + HRESULT res = Status->GetResult(); + if (res != S_OK) + return res; + if (!callback) + return res; + CBenchInfo info = BenchInfo; + SetFinishTime(BenchInfo, info); + if (Status->EncodeMode) + { + info.UnpackSize = *inSize; + info.PackSize = *outSize; + res = callback->SetEncodeResult(info, false); + } + else + { + info.PackSize = BenchInfo.PackSize + *inSize; + info.UnpackSize = BenchInfo.UnpackSize + *outSize; + res = callback->SetDecodeResult(info, false); + } + if (res != S_OK) + Status->SetResult(res); + return res; +} + +static const int kSubBits = 8; + +static UInt32 GetLogSize(UInt32 size) +{ + for (int i = kSubBits; i < 32; i++) + for (UInt32 j = 0; j < (1 << kSubBits); j++) + if (size <= (((UInt32)1) << i) + (j << (i - kSubBits))) + return (i << kSubBits) + j; + return (32 << kSubBits); +} + +static void NormalizeVals(UInt64 &v1, UInt64 &v2) +{ + while (v1 > 1000000) + { + v1 >>= 1; + v2 >>= 1; + } +} + +UInt64 GetUsage(const CBenchInfo &info) +{ + UInt64 userTime = info.UserTime; + UInt64 userFreq = info.UserFreq; + UInt64 globalTime = info.GlobalTime; + UInt64 globalFreq = info.GlobalFreq; + NormalizeVals(userTime, userFreq); + NormalizeVals(globalFreq, globalTime); + if (userFreq == 0) + userFreq = 1; + if (globalTime == 0) + globalTime = 1; + return userTime * globalFreq * 1000000 / userFreq / globalTime; +} + +UInt64 GetRatingPerUsage(const CBenchInfo &info, UInt64 rating) +{ + UInt64 userTime = info.UserTime; + UInt64 userFreq = info.UserFreq; + UInt64 globalTime = info.GlobalTime; + UInt64 globalFreq = info.GlobalFreq; + NormalizeVals(userFreq, userTime); + NormalizeVals(globalTime, globalFreq); + if (globalFreq == 0) + globalFreq = 1; + if (userTime == 0) + userTime = 1; + return userFreq * globalTime / globalFreq * rating / userTime; +} + +static UInt64 MyMultDiv64(UInt64 value, UInt64 elapsedTime, UInt64 freq) +{ + UInt64 elTime = elapsedTime; + NormalizeVals(freq, elTime); + if (elTime == 0) + elTime = 1; + return value * freq / elTime; +} + +UInt64 GetCompressRating(UInt32 dictionarySize, UInt64 elapsedTime, UInt64 freq, UInt64 size) +{ + UInt64 t = GetLogSize(dictionarySize) - (kBenchMinDicLogSize << kSubBits); + UInt64 numCommandsForOne = 870 + ((t * t * 5) >> (2 * kSubBits)); + UInt64 numCommands = (UInt64)(size) * numCommandsForOne; + return MyMultDiv64(numCommands, elapsedTime, freq); +} + +UInt64 GetDecompressRating(UInt64 elapsedTime, UInt64 freq, UInt64 outSize, UInt64 inSize, UInt32 numIterations) +{ + UInt64 numCommands = (inSize * 200 + outSize * 4) * numIterations; + return MyMultDiv64(numCommands, elapsedTime, freq); +} + +struct CEncoderInfo; + +struct CEncoderInfo +{ + #ifndef _7ZIP_ST + NWindows::CThread thread[2]; + #endif + CMyComPtr<ICompressCoder> encoder; + CBenchProgressInfo *progressInfoSpec[2]; + CMyComPtr<ICompressProgressInfo> progressInfo[2]; + UInt32 NumIterations; + #ifdef USE_ALLOCA + size_t AllocaSize; + #endif + + struct CDecoderInfo + { + CEncoderInfo *Encoder; + UInt32 DecoderIndex; + #ifdef USE_ALLOCA + size_t AllocaSize; + #endif + bool CallbackMode; + }; + CDecoderInfo decodersInfo[2]; + + CMyComPtr<ICompressCoder> decoders[2]; + HRESULT Results[2]; + CBenchmarkOutStream *outStreamSpec; + CMyComPtr<ISequentialOutStream> outStream; + IBenchCallback *callback; + UInt32 crc; + UInt32 kBufferSize; + UInt32 compressedSize; + CBenchRandomGenerator rg; + CBenchmarkOutStream *propStreamSpec; + CMyComPtr<ISequentialOutStream> propStream; + HRESULT Init(UInt32 dictionarySize, UInt32 numThreads, CBaseRandomGenerator *rg); + HRESULT Encode(); + HRESULT Decode(UInt32 decoderIndex); + + CEncoderInfo(): outStreamSpec(0), callback(0), propStreamSpec(0) {} + + #ifndef _7ZIP_ST + static THREAD_FUNC_DECL EncodeThreadFunction(void *param) + { + CEncoderInfo *encoder = (CEncoderInfo *)param; + #ifdef USE_ALLOCA + alloca(encoder->AllocaSize); + #endif + HRESULT res = encoder->Encode(); + encoder->Results[0] = res; + if (res != S_OK) + encoder->progressInfoSpec[0]->Status->SetResult(res); + + return 0; + } + static THREAD_FUNC_DECL DecodeThreadFunction(void *param) + { + CDecoderInfo *decoder = (CDecoderInfo *)param; + #ifdef USE_ALLOCA + alloca(decoder->AllocaSize); + #endif + CEncoderInfo *encoder = decoder->Encoder; + encoder->Results[decoder->DecoderIndex] = encoder->Decode(decoder->DecoderIndex); + return 0; + } + + HRESULT CreateEncoderThread() + { + return thread[0].Create(EncodeThreadFunction, this); + } + + HRESULT CreateDecoderThread(int index, bool callbackMode + #ifdef USE_ALLOCA + , size_t allocaSize + #endif + ) + { + CDecoderInfo &decoder = decodersInfo[index]; + decoder.DecoderIndex = index; + decoder.Encoder = this; + #ifdef USE_ALLOCA + decoder.AllocaSize = allocaSize; + #endif + decoder.CallbackMode = callbackMode; + return thread[index].Create(DecodeThreadFunction, &decoder); + } + #endif +}; + +HRESULT CEncoderInfo::Init(UInt32 dictionarySize, UInt32 numThreads, CBaseRandomGenerator *rgLoc) +{ + rg.Set(rgLoc); + kBufferSize = dictionarySize + kAdditionalSize; + UInt32 kCompressedBufferSize = (kBufferSize / 2) + kCompressedAdditionalSize; + if (!rg.Alloc(kBufferSize)) + return E_OUTOFMEMORY; + rg.Generate(); + crc = CrcCalc(rg.Buffer, rg.BufferSize); + + outStreamSpec = new CBenchmarkOutStream; + if (!outStreamSpec->Alloc(kCompressedBufferSize)) + return E_OUTOFMEMORY; + + outStream = outStreamSpec; + + propStreamSpec = 0; + if (!propStream) + { + propStreamSpec = new CBenchmarkOutStream; + propStream = propStreamSpec; + } + if (!propStreamSpec->Alloc(kMaxLzmaPropSize)) + return E_OUTOFMEMORY; + propStreamSpec->Init(); + + PROPID propIDs[] = + { + NCoderPropID::kDictionarySize, + NCoderPropID::kNumThreads + }; + const int kNumProps = sizeof(propIDs) / sizeof(propIDs[0]); + PROPVARIANT props[kNumProps]; + props[0].vt = VT_UI4; + props[0].ulVal = dictionarySize; + + props[1].vt = VT_UI4; + props[1].ulVal = numThreads; + + { + CMyComPtr<ICompressSetCoderProperties> setCoderProperties; + RINOK(encoder.QueryInterface(IID_ICompressSetCoderProperties, &setCoderProperties)); + if (!setCoderProperties) + return E_FAIL; + RINOK(setCoderProperties->SetCoderProperties(propIDs, props, kNumProps)); + + CMyComPtr<ICompressWriteCoderProperties> writeCoderProperties; + encoder.QueryInterface(IID_ICompressWriteCoderProperties, &writeCoderProperties); + if (writeCoderProperties) + { + RINOK(writeCoderProperties->WriteCoderProperties(propStream)); + } + } + return S_OK; +} + +HRESULT CEncoderInfo::Encode() +{ + CBenchmarkInStream *inStreamSpec = new CBenchmarkInStream; + CMyComPtr<ISequentialInStream> inStream = inStreamSpec; + inStreamSpec->Init(rg.Buffer, rg.BufferSize); + outStreamSpec->Init(); + + RINOK(encoder->Code(inStream, outStream, 0, 0, progressInfo[0])); + compressedSize = outStreamSpec->Pos; + encoder.Release(); + return S_OK; +} + +HRESULT CEncoderInfo::Decode(UInt32 decoderIndex) +{ + CBenchmarkInStream *inStreamSpec = new CBenchmarkInStream; + CMyComPtr<ISequentialInStream> inStream = inStreamSpec; + CMyComPtr<ICompressCoder> &decoder = decoders[decoderIndex]; + + CMyComPtr<ICompressSetDecoderProperties2> compressSetDecoderProperties; + decoder.QueryInterface(IID_ICompressSetDecoderProperties2, &compressSetDecoderProperties); + if (!compressSetDecoderProperties) + return E_FAIL; + + CCrcOutStream *crcOutStreamSpec = new CCrcOutStream; + CMyComPtr<ISequentialOutStream> crcOutStream = crcOutStreamSpec; + + CBenchProgressInfo *pi = progressInfoSpec[decoderIndex]; + pi->BenchInfo.UnpackSize = 0; + pi->BenchInfo.PackSize = 0; + + for (UInt32 j = 0; j < NumIterations; j++) + { + inStreamSpec->Init(outStreamSpec->Buffer, compressedSize); + crcOutStreamSpec->Init(); + + RINOK(compressSetDecoderProperties->SetDecoderProperties2(propStreamSpec->Buffer, propStreamSpec->Pos)); + UInt64 outSize = kBufferSize; + RINOK(decoder->Code(inStream, crcOutStream, 0, &outSize, progressInfo[decoderIndex])); + if (CRC_GET_DIGEST(crcOutStreamSpec->Crc) != crc) + return S_FALSE; + pi->BenchInfo.UnpackSize += kBufferSize; + pi->BenchInfo.PackSize += compressedSize; + } + decoder.Release(); + return S_OK; +} + +static const UInt32 kNumThreadsMax = (1 << 16); + +struct CBenchEncoders +{ + CEncoderInfo *encoders; + CBenchEncoders(UInt32 num): encoders(0) { encoders = new CEncoderInfo[num]; } + ~CBenchEncoders() { delete []encoders; } +}; + +HRESULT LzmaBench( + DECL_EXTERNAL_CODECS_LOC_VARS + UInt32 numThreads, UInt32 dictionarySize, IBenchCallback *callback) +{ + UInt32 numEncoderThreads = + #ifndef _7ZIP_ST + (numThreads > 1 ? numThreads / 2 : 1); + #else + 1; + #endif + UInt32 numSubDecoderThreads = + #ifndef _7ZIP_ST + (numThreads > 1 ? 2 : 1); + #else + 1; + #endif + if (dictionarySize < (1 << kBenchMinDicLogSize) || numThreads < 1 || numEncoderThreads > kNumThreadsMax) + { + return E_INVALIDARG; + } + + CBenchEncoders encodersSpec(numEncoderThreads); + CEncoderInfo *encoders = encodersSpec.encoders; + + + UInt32 i; + for (i = 0; i < numEncoderThreads; i++) + { + CEncoderInfo &encoder = encoders[i]; + encoder.callback = (i == 0) ? callback : 0; + + const UInt32 kLzmaId = 0x030101; + RINOK(CreateCoder(EXTERNAL_CODECS_LOC_VARS kLzmaId, encoder.encoder, true)); + for (UInt32 j = 0; j < numSubDecoderThreads; j++) + { + RINOK(CreateCoder(EXTERNAL_CODECS_LOC_VARS kLzmaId, encoder.decoders[j], false)); + } + } + + CBaseRandomGenerator rg; + rg.Init(); + for (i = 0; i < numEncoderThreads; i++) + { + RINOK(encoders[i].Init(dictionarySize, numThreads, &rg)); + } + + CBenchProgressStatus status; + status.Res = S_OK; + status.EncodeMode = true; + + for (i = 0; i < numEncoderThreads; i++) + { + CEncoderInfo &encoder = encoders[i]; + for (int j = 0; j < 2; j++) + { + encoder.progressInfo[j] = encoder.progressInfoSpec[j] = new CBenchProgressInfo; + encoder.progressInfoSpec[j]->Status = &status; + } + if (i == 0) + { + encoder.progressInfoSpec[0]->callback = callback; + encoder.progressInfoSpec[0]->BenchInfo.NumIterations = numEncoderThreads; + SetStartTime(encoder.progressInfoSpec[0]->BenchInfo); + } + + #ifndef _7ZIP_ST + if (numEncoderThreads > 1) + { + #ifdef USE_ALLOCA + encoder.AllocaSize = (i * 16 * 21) & 0x7FF; + #endif + RINOK(encoder.CreateEncoderThread()) + } + else + #endif + { + RINOK(encoder.Encode()); + } + } + #ifndef _7ZIP_ST + if (numEncoderThreads > 1) + for (i = 0; i < numEncoderThreads; i++) + encoders[i].thread[0].Wait(); + #endif + + RINOK(status.Res); + + CBenchInfo info; + + SetFinishTime(encoders[0].progressInfoSpec[0]->BenchInfo, info); + info.UnpackSize = 0; + info.PackSize = 0; + info.NumIterations = 1; // progressInfoSpec->NumIterations; + for (i = 0; i < numEncoderThreads; i++) + { + CEncoderInfo &encoder = encoders[i]; + info.UnpackSize += encoder.kBufferSize; + info.PackSize += encoder.compressedSize; + } + RINOK(callback->SetEncodeResult(info, true)); + + + status.Res = S_OK; + status.EncodeMode = false; + + UInt32 numDecoderThreads = numEncoderThreads * numSubDecoderThreads; + for (i = 0; i < numEncoderThreads; i++) + { + CEncoderInfo &encoder = encoders[i]; + encoder.NumIterations = 2 + kUncompressMinBlockSize / encoder.kBufferSize; + + if (i == 0) + { + encoder.progressInfoSpec[0]->callback = callback; + encoder.progressInfoSpec[0]->BenchInfo.NumIterations = numDecoderThreads; + SetStartTime(encoder.progressInfoSpec[0]->BenchInfo); + } + + #ifndef _7ZIP_ST + if (numDecoderThreads > 1) + { + for (UInt32 j = 0; j < numSubDecoderThreads; j++) + { + HRESULT res = encoder.CreateDecoderThread(j, (i == 0 && j == 0) + #ifdef USE_ALLOCA + , ((i * numSubDecoderThreads + j) * 16 * 21) & 0x7FF + #endif + ); + RINOK(res); + } + } + else + #endif + { + RINOK(encoder.Decode(0)); + } + } + #ifndef _7ZIP_ST + HRESULT res = S_OK; + if (numDecoderThreads > 1) + for (i = 0; i < numEncoderThreads; i++) + for (UInt32 j = 0; j < numSubDecoderThreads; j++) + { + CEncoderInfo &encoder = encoders[i]; + encoder.thread[j].Wait(); + if (encoder.Results[j] != S_OK) + res = encoder.Results[j]; + } + RINOK(res); + #endif + RINOK(status.Res); + SetFinishTime(encoders[0].progressInfoSpec[0]->BenchInfo, info); + #ifndef _7ZIP_ST + #ifdef UNDER_CE + if (numDecoderThreads > 1) + for (i = 0; i < numEncoderThreads; i++) + for (UInt32 j = 0; j < numSubDecoderThreads; j++) + { + FILETIME creationTime, exitTime, kernelTime, userTime; + if (::GetThreadTimes(encoders[i].thread[j], &creationTime, &exitTime, &kernelTime, &userTime) != 0) + info.UserTime += GetTime64(userTime) + GetTime64(kernelTime); + } + #endif + #endif + info.UnpackSize = 0; + info.PackSize = 0; + info.NumIterations = numSubDecoderThreads * encoders[0].NumIterations; + for (i = 0; i < numEncoderThreads; i++) + { + CEncoderInfo &encoder = encoders[i]; + info.UnpackSize += encoder.kBufferSize; + info.PackSize += encoder.compressedSize; + } + RINOK(callback->SetDecodeResult(info, false)); + RINOK(callback->SetDecodeResult(info, true)); + return S_OK; +} + + +inline UInt64 GetLZMAUsage(bool multiThread, UInt32 dictionary) +{ + UInt32 hs = dictionary - 1; + hs |= (hs >> 1); + hs |= (hs >> 2); + hs |= (hs >> 4); + hs |= (hs >> 8); + hs >>= 1; + hs |= 0xFFFF; + if (hs > (1 << 24)) + hs >>= 1; + hs++; + return ((hs + (1 << 16)) + (UInt64)dictionary * 2) * 4 + (UInt64)dictionary * 3 / 2 + + (1 << 20) + (multiThread ? (6 << 20) : 0); +} + +UInt64 GetBenchMemoryUsage(UInt32 numThreads, UInt32 dictionary) +{ + const UInt32 kBufferSize = dictionary; + const UInt32 kCompressedBufferSize = (kBufferSize / 2); + UInt32 numSubThreads = (numThreads > 1) ? 2 : 1; + UInt32 numBigThreads = numThreads / numSubThreads; + return (kBufferSize + kCompressedBufferSize + + GetLZMAUsage((numThreads > 1), dictionary) + (2 << 20)) * numBigThreads; +} + +static bool CrcBig(const void *data, UInt32 size, UInt32 numCycles, UInt32 crcBase) +{ + for (UInt32 i = 0; i < numCycles; i++) + if (CrcCalc(data, size) != crcBase) + return false; + return true; +} + +#ifndef _7ZIP_ST +struct CCrcInfo +{ + NWindows::CThread Thread; + const Byte *Data; + UInt32 Size; + UInt32 NumCycles; + UInt32 Crc; + bool Res; + void Wait() + { + Thread.Wait(); + Thread.Close(); + } +}; + +static THREAD_FUNC_DECL CrcThreadFunction(void *param) +{ + CCrcInfo *p = (CCrcInfo *)param; + p->Res = CrcBig(p->Data, p->Size, p->NumCycles, p->Crc); + return 0; +} + +struct CCrcThreads +{ + UInt32 NumThreads; + CCrcInfo *Items; + CCrcThreads(): Items(0), NumThreads(0) {} + void WaitAll() + { + for (UInt32 i = 0; i < NumThreads; i++) + Items[i].Wait(); + NumThreads = 0; + } + ~CCrcThreads() + { + WaitAll(); + delete []Items; + } +}; +#endif + +static UInt32 CrcCalc1(const Byte *buf, UInt32 size) +{ + UInt32 crc = CRC_INIT_VAL;; + for (UInt32 i = 0; i < size; i++) + crc = CRC_UPDATE_BYTE(crc, buf[i]); + return CRC_GET_DIGEST(crc); +} + +static void RandGen(Byte *buf, UInt32 size, CBaseRandomGenerator &RG) +{ + for (UInt32 i = 0; i < size; i++) + buf[i] = (Byte)RG.GetRnd(); +} + +static UInt32 RandGenCrc(Byte *buf, UInt32 size, CBaseRandomGenerator &RG) +{ + RandGen(buf, size, RG); + return CrcCalc1(buf, size); +} + +bool CrcInternalTest() +{ + CBenchBuffer buffer; + const UInt32 kBufferSize0 = (1 << 8); + const UInt32 kBufferSize1 = (1 << 10); + const UInt32 kCheckSize = (1 << 5); + if (!buffer.Alloc(kBufferSize0 + kBufferSize1)) + return false; + Byte *buf = buffer.Buffer; + UInt32 i; + for (i = 0; i < kBufferSize0; i++) + buf[i] = (Byte)i; + UInt32 crc1 = CrcCalc1(buf, kBufferSize0); + if (crc1 != 0x29058C73) + return false; + CBaseRandomGenerator RG; + RandGen(buf + kBufferSize0, kBufferSize1, RG); + for (i = 0; i < kBufferSize0 + kBufferSize1 - kCheckSize; i++) + for (UInt32 j = 0; j < kCheckSize; j++) + if (CrcCalc1(buf + i, j) != CrcCalc(buf + i, j)) + return false; + return true; +} + +HRESULT CrcBench(UInt32 numThreads, UInt32 bufferSize, UInt64 &speed) +{ + if (numThreads == 0) + numThreads = 1; + + CBenchBuffer buffer; + size_t totalSize = (size_t)bufferSize * numThreads; + if (totalSize / numThreads != bufferSize) + return E_OUTOFMEMORY; + if (!buffer.Alloc(totalSize)) + return E_OUTOFMEMORY; + + Byte *buf = buffer.Buffer; + CBaseRandomGenerator RG; + UInt32 numCycles = (kCrcBlockSize) / ((bufferSize >> 2) + 1) + 1; + + UInt64 timeVal; + #ifndef _7ZIP_ST + CCrcThreads threads; + if (numThreads > 1) + { + threads.Items = new CCrcInfo[numThreads]; + UInt32 i; + for (i = 0; i < numThreads; i++) + { + CCrcInfo &info = threads.Items[i]; + Byte *data = buf + (size_t)bufferSize * i; + info.Data = data; + info.NumCycles = numCycles; + info.Size = bufferSize; + info.Crc = RandGenCrc(data, bufferSize, RG); + } + timeVal = GetTimeCount(); + for (i = 0; i < numThreads; i++) + { + CCrcInfo &info = threads.Items[i]; + RINOK(info.Thread.Create(CrcThreadFunction, &info)); + threads.NumThreads++; + } + threads.WaitAll(); + for (i = 0; i < numThreads; i++) + if (!threads.Items[i].Res) + return S_FALSE; + } + else + #endif + { + UInt32 crc = RandGenCrc(buf, bufferSize, RG); + timeVal = GetTimeCount(); + if (!CrcBig(buf, bufferSize, numCycles, crc)) + return S_FALSE; + } + timeVal = GetTimeCount() - timeVal; + if (timeVal == 0) + timeVal = 1; + + UInt64 size = (UInt64)numCycles * totalSize; + speed = MyMultDiv64(size, timeVal, GetFreq()); + return S_OK; +} diff --git a/CPP/7zip/UI/Common/Bench.h b/CPP/7zip/UI/Common/Bench.h new file mode 100755 index 00000000..a8d02a19 --- /dev/null +++ b/CPP/7zip/UI/Common/Bench.h @@ -0,0 +1,42 @@ +// Bench.h + +#ifndef __7ZIP_BENCH_H +#define __7ZIP_BENCH_H + +#include "../../Common/CreateCoder.h" + +struct CBenchInfo +{ + UInt64 GlobalTime; + UInt64 GlobalFreq; + UInt64 UserTime; + UInt64 UserFreq; + UInt64 UnpackSize; + UInt64 PackSize; + UInt32 NumIterations; + CBenchInfo(): NumIterations(0) {} +}; + +struct IBenchCallback +{ + virtual HRESULT SetEncodeResult(const CBenchInfo &info, bool final) = 0; + virtual HRESULT SetDecodeResult(const CBenchInfo &info, bool final) = 0; +}; + +UInt64 GetUsage(const CBenchInfo &benchOnfo); +UInt64 GetRatingPerUsage(const CBenchInfo &info, UInt64 rating); +UInt64 GetCompressRating(UInt32 dictionarySize, UInt64 elapsedTime, UInt64 freq, UInt64 size); +UInt64 GetDecompressRating(UInt64 elapsedTime, UInt64 freq, UInt64 outSize, UInt64 inSize, UInt32 numIterations); + +HRESULT LzmaBench( + DECL_EXTERNAL_CODECS_LOC_VARS + UInt32 numThreads, UInt32 dictionarySize, IBenchCallback *callback); + +const int kBenchMinDicLogSize = 18; + +UInt64 GetBenchMemoryUsage(UInt32 numThreads, UInt32 dictionary); + +bool CrcInternalTest(); +HRESULT CrcBench(UInt32 numThreads, UInt32 bufferSize, UInt64 &speed); + +#endif diff --git a/CPP/7zip/UI/Common/CompressCall2.cpp b/CPP/7zip/UI/Common/CompressCall2.cpp index 0ed227ca..473f7d93 100755 --- a/CPP/7zip/UI/Common/CompressCall2.cpp +++ b/CPP/7zip/UI/Common/CompressCall2.cpp @@ -163,9 +163,14 @@ HRESULT Benchmark() HRESULT result; MY_TRY_BEGIN CREATE_CODECS + + #ifdef EXTERNAL_CODECS + CObjectVector<CCodecInfoEx> externalCodecs; + RINOK(LoadExternalCodecs(codecs, externalCodecs)); + #endif result = Benchmark( - #ifdef EXTERNAL_LZMA - codecs, + #ifdef EXTERNAL_CODECS + codecs, &externalCodecs, #endif (UInt32)-1, (UInt32)-1, g_HWND); MY_TRY_FINISH diff --git a/CPP/7zip/UI/Common/Extract.cpp b/CPP/7zip/UI/Common/Extract.cpp index 93329091..f9de663b 100755 --- a/CPP/7zip/UI/Common/Extract.cpp +++ b/CPP/7zip/UI/Common/Extract.cpp @@ -78,7 +78,7 @@ static HRESULT DecompressArchive( removePathParts, packSize); - #ifdef COMPRESS_MT + #if !defined(_7ZIP_ST) && !defined(_SFX) RINOK(SetProperties(archive, options.Properties)); #endif diff --git a/CPP/7zip/UI/Common/Extract.h b/CPP/7zip/UI/Common/Extract.h index 442dd2b0..5a939ed2 100755 --- a/CPP/7zip/UI/Common/Extract.h +++ b/CPP/7zip/UI/Common/Extract.h @@ -28,7 +28,7 @@ struct CExtractOptions // bool ShowDialog; // bool PasswordEnabled; // UString Password; - #ifdef COMPRESS_MT + #if !defined(_7ZIP_ST) && !defined(_SFX) CObjectVector<CProperty> Properties; #endif diff --git a/CPP/7zip/UI/Console/BenchCon.cpp b/CPP/7zip/UI/Console/BenchCon.cpp new file mode 100755 index 00000000..96997dcb --- /dev/null +++ b/CPP/7zip/UI/Console/BenchCon.cpp @@ -0,0 +1,297 @@ +// BenchCon.cpp + +#include "StdAfx.h" + +#include "../../../Common/IntToString.h" +#include "../../../Common/MyCom.h" + +#if !defined(_7ZIP_ST) || defined(_WIN32) +#include "../../../Windows/System.h" +#endif + +#include "../Common/Bench.h" + +#include "BenchCon.h" +#include "ConsoleClose.h" + +struct CTotalBenchRes +{ + UInt64 NumIterations; + UInt64 Rating; + UInt64 Usage; + UInt64 RPU; + void Init() { NumIterations = 0; Rating = 0; Usage = 0; RPU = 0; } + void Normalize() + { + if (NumIterations == 0) + return; + Rating /= NumIterations; + Usage /= NumIterations; + RPU /= NumIterations; + NumIterations = 1; + } + void SetMid(const CTotalBenchRes &r1, const CTotalBenchRes &r2) + { + Rating = (r1.Rating + r2.Rating) / 2; + Usage = (r1.Usage + r2.Usage) / 2; + RPU = (r1.RPU + r2.RPU) / 2; + NumIterations = (r1.NumIterations + r2.NumIterations) / 2; + } +}; + +struct CBenchCallback: public IBenchCallback +{ + CTotalBenchRes EncodeRes; + CTotalBenchRes DecodeRes; + FILE *f; + void Init() { EncodeRes.Init(); DecodeRes.Init(); } + void Normalize() { EncodeRes.Normalize(); DecodeRes.Normalize(); } + UInt32 dictionarySize; + HRESULT SetEncodeResult(const CBenchInfo &info, bool final); + HRESULT SetDecodeResult(const CBenchInfo &info, bool final); +}; + +static void NormalizeVals(UInt64 &v1, UInt64 &v2) +{ + while (v1 > 1000000) + { + v1 >>= 1; + v2 >>= 1; + } +} + +static UInt64 MyMultDiv64(UInt64 value, UInt64 elapsedTime, UInt64 freq) +{ + UInt64 elTime = elapsedTime; + NormalizeVals(freq, elTime); + if (elTime == 0) + elTime = 1; + return value * freq / elTime; +} + +static void PrintNumber(FILE *f, UInt64 value, int size) +{ + char s[32]; + ConvertUInt64ToString(value, s); + fprintf(f, " "); + for (int len = (int)strlen(s); len < size; len++) + fprintf(f, " "); + fprintf(f, "%s", s); +} + +static void PrintRating(FILE *f, UInt64 rating) +{ + PrintNumber(f, rating / 1000000, 6); +} + +static void PrintResults(FILE *f, UInt64 usage, UInt64 rpu, UInt64 rating) +{ + PrintNumber(f, (usage + 5000) / 10000, 5); + PrintRating(f, rpu); + PrintRating(f, rating); +} + + +static void PrintResults(FILE *f, const CBenchInfo &info, UInt64 rating, CTotalBenchRes &res) +{ + UInt64 speed = MyMultDiv64(info.UnpackSize, info.GlobalTime, info.GlobalFreq); + PrintNumber(f, speed / 1024, 7); + UInt64 usage = GetUsage(info); + UInt64 rpu = GetRatingPerUsage(info, rating); + PrintResults(f, usage, rpu, rating); + res.NumIterations++; + res.RPU += rpu; + res.Rating += rating; + res.Usage += usage; +} + +static void PrintTotals(FILE *f, const CTotalBenchRes &res) +{ + fprintf(f, " "); + PrintResults(f, res.Usage, res.RPU, res.Rating); +} + + +HRESULT CBenchCallback::SetEncodeResult(const CBenchInfo &info, bool final) +{ + if (NConsoleClose::TestBreakSignal()) + return E_ABORT; + if (final) + { + UInt64 rating = GetCompressRating(dictionarySize, info.GlobalTime, info.GlobalFreq, info.UnpackSize); + PrintResults(f, info, rating, EncodeRes); + } + return S_OK; +} + +static const char *kSep = " | "; + + +HRESULT CBenchCallback::SetDecodeResult(const CBenchInfo &info, bool final) +{ + if (NConsoleClose::TestBreakSignal()) + return E_ABORT; + if (final) + { + UInt64 rating = GetDecompressRating(info.GlobalTime, info.GlobalFreq, info.UnpackSize, info.PackSize, info.NumIterations); + fprintf(f, kSep); + CBenchInfo info2 = info; + info2.UnpackSize *= info2.NumIterations; + info2.PackSize *= info2.NumIterations; + info2.NumIterations = 1; + PrintResults(f, info2, rating, DecodeRes); + } + return S_OK; +} + +static void PrintRequirements(FILE *f, const char *sizeString, UInt64 size, const char *threadsString, UInt32 numThreads) +{ + fprintf(f, "\nRAM %s ", sizeString); + PrintNumber(f, (size >> 20), 5); + fprintf(f, " MB, # %s %3d", threadsString, (unsigned int)numThreads); +} + +HRESULT LzmaBenchCon( + DECL_EXTERNAL_CODECS_LOC_VARS + FILE *f, UInt32 numIterations, UInt32 numThreads, UInt32 dictionary) +{ + if (!CrcInternalTest()) + return S_FALSE; + #ifndef _7ZIP_ST + UInt64 ramSize = NWindows::NSystem::GetRamSize(); // + UInt32 numCPUs = NWindows::NSystem::GetNumberOfProcessors(); + PrintRequirements(f, "size: ", ramSize, "CPU hardware threads:", numCPUs); + if (numThreads == (UInt32)-1) + numThreads = numCPUs; + if (numThreads > 1) + numThreads &= ~1; + if (dictionary == (UInt32)-1) + { + int dicSizeLog; + for (dicSizeLog = 25; dicSizeLog > kBenchMinDicLogSize; dicSizeLog--) + if (GetBenchMemoryUsage(numThreads, ((UInt32)1 << dicSizeLog)) + (8 << 20) <= ramSize) + break; + dictionary = (1 << dicSizeLog); + } + #else + if (dictionary == (UInt32)-1) + dictionary = (1 << 22); + numThreads = 1; + #endif + + PrintRequirements(f, "usage:", GetBenchMemoryUsage(numThreads, dictionary), "Benchmark threads: ", numThreads); + + CBenchCallback callback; + callback.Init(); + callback.f = f; + + fprintf(f, "\n\nDict Compressing | Decompressing\n "); + int j; + for (j = 0; j < 2; j++) + { + fprintf(f, " Speed Usage R/U Rating"); + if (j == 0) + fprintf(f, kSep); + } + fprintf(f, "\n "); + for (j = 0; j < 2; j++) + { + fprintf(f, " KB/s %% MIPS MIPS"); + if (j == 0) + fprintf(f, kSep); + } + fprintf(f, "\n\n"); + for (UInt32 i = 0; i < numIterations; i++) + { + const int kStartDicLog = 22; + int pow = (dictionary < ((UInt32)1 << kStartDicLog)) ? kBenchMinDicLogSize : kStartDicLog; + while (((UInt32)1 << pow) > dictionary) + pow--; + for (; ((UInt32)1 << pow) <= dictionary; pow++) + { + fprintf(f, "%2d:", pow); + callback.dictionarySize = (UInt32)1 << pow; + HRESULT res = LzmaBench( + EXTERNAL_CODECS_LOC_VARS + numThreads, callback.dictionarySize, &callback); + fprintf(f, "\n"); + RINOK(res); + } + } + callback.Normalize(); + fprintf(f, "----------------------------------------------------------------\nAvr:"); + PrintTotals(f, callback.EncodeRes); + fprintf(f, " "); + PrintTotals(f, callback.DecodeRes); + fprintf(f, "\nTot:"); + CTotalBenchRes midRes; + midRes.SetMid(callback.EncodeRes, callback.DecodeRes); + PrintTotals(f, midRes); + fprintf(f, "\n"); + return S_OK; +} + +struct CTempValues +{ + UInt64 *Values; + CTempValues(UInt32 num) { Values = new UInt64[num]; } + ~CTempValues() { delete []Values; } +}; + +HRESULT CrcBenchCon(FILE *f, UInt32 numIterations, UInt32 numThreads, UInt32 dictionary) +{ + if (!CrcInternalTest()) + return S_FALSE; + + #ifndef _7ZIP_ST + UInt64 ramSize = NWindows::NSystem::GetRamSize(); + UInt32 numCPUs = NWindows::NSystem::GetNumberOfProcessors(); + PrintRequirements(f, "size: ", ramSize, "CPU hardware threads:", numCPUs); + if (numThreads == (UInt32)-1) + numThreads = numCPUs; + #else + numThreads = 1; + #endif + if (dictionary == (UInt32)-1) + dictionary = (1 << 24); + + CTempValues speedTotals(numThreads); + fprintf(f, "\n\nSize"); + for (UInt32 ti = 0; ti < numThreads; ti++) + { + fprintf(f, " %5d", ti + 1); + speedTotals.Values[ti] = 0; + } + fprintf(f, "\n\n"); + + UInt64 numSteps = 0; + for (UInt32 i = 0; i < numIterations; i++) + { + for (int pow = 10; pow < 32; pow++) + { + UInt32 bufSize = (UInt32)1 << pow; + if (bufSize > dictionary) + break; + fprintf(f, "%2d: ", pow); + UInt64 speed; + for (UInt32 ti = 0; ti < numThreads; ti++) + { + if (NConsoleClose::TestBreakSignal()) + return E_ABORT; + RINOK(CrcBench(ti + 1, bufSize, speed)); + PrintNumber(f, (speed >> 20), 5); + speedTotals.Values[ti] += speed; + } + fprintf(f, "\n"); + numSteps++; + } + } + if (numSteps != 0) + { + fprintf(f, "\nAvg:"); + for (UInt32 ti = 0; ti < numThreads; ti++) + PrintNumber(f, ((speedTotals.Values[ti] / numSteps) >> 20), 5); + fprintf(f, "\n"); + } + return S_OK; +} diff --git a/CPP/7zip/UI/Console/BenchCon.h b/CPP/7zip/UI/Console/BenchCon.h new file mode 100755 index 00000000..966a83a6 --- /dev/null +++ b/CPP/7zip/UI/Console/BenchCon.h @@ -0,0 +1,16 @@ +// BenchCon.h + +#ifndef __BENCH_CON_H +#define __BENCH_CON_H + +#include <stdio.h> + +#include "../../Common/CreateCoder.h" + +HRESULT LzmaBenchCon( + DECL_EXTERNAL_CODECS_LOC_VARS + FILE *f, UInt32 numIterations, UInt32 numThreads, UInt32 dictionary); + +HRESULT CrcBenchCon(FILE *f, UInt32 numIterations, UInt32 numThreads, UInt32 dictionary); + +#endif diff --git a/CPP/7zip/UI/Console/Console.dsp b/CPP/7zip/UI/Console/Console.dsp index 05d15e65..aa2e0cb8 100755 --- a/CPP/7zip/UI/Console/Console.dsp +++ b/CPP/7zip/UI/Console/Console.dsp @@ -44,7 +44,7 @@ RSC=rc.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "../../../" /D "NDEBUG" /D "_MBCS" /D "WIN32" /D "_CONSOLE" /D "COMPRESS_MT" /D "WIN_LONG_PATH" /D "EXTERNAL_LZMA" /D "EXTERNAL_CODECS" /D "BREAK_HANDLER" /D "BENCH_MT" /D "_7ZIP_LARGE_PAGES" /D "SUPPORT_DEVICE_FILE" /Yu"StdAfx.h" /FD /c +# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "../../../" /D "NDEBUG" /D "_MBCS" /D "WIN32" /D "_CONSOLE" /D "WIN_LONG_PATH" /D "EXTERNAL_CODECS" /D "_7ZIP_LARGE_PAGES" /D "SUPPORT_DEVICE_FILE" /FAs /Yu"StdAfx.h" /FD /c # ADD BASE RSC /l 0x419 /d "NDEBUG" # ADD RSC /l 0x419 /d "NDEBUG" BSC32=bscmake.exe @@ -69,7 +69,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "../../../" /D "_DEBUG" /D "_MBCS" /D "WIN32" /D "_CONSOLE" /D "COMPRESS_MT" /D "WIN_LONG_PATH" /D "EXTERNAL_LZMA" /D "EXTERNAL_CODECS" /D "BREAK_HANDLER" /D "BENCH_MT" /D "_7ZIP_LARGE_PAGES" /D "SUPPORT_DEVICE_FILE" /Yu"StdAfx.h" /FD /GZ /c +# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "../../../" /D "_DEBUG" /D "_MBCS" /D "WIN32" /D "_CONSOLE" /D "WIN_LONG_PATH" /D "EXTERNAL_CODECS" /D "_7ZIP_LARGE_PAGES" /D "SUPPORT_DEVICE_FILE" /Yu"StdAfx.h" /FD /GZ /c # ADD BASE RSC /l 0x419 /d "_DEBUG" # ADD RSC /l 0x419 /d "_DEBUG" BSC32=bscmake.exe @@ -94,7 +94,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /Gz /MD /W3 /GX /O1 /I "../../../" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"StdAfx.h" /FD /c -# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "../../../" /D "NDEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_CONSOLE" /D "COMPRESS_MT" /D "WIN_LONG_PATH" /D "EXTERNAL_LZMA" /D "EXTERNAL_CODECS" /D "BREAK_HANDLER" /D "BENCH_MT" /D "_7ZIP_LARGE_PAGES" /D "SUPPORT_DEVICE_FILE" /Yu"StdAfx.h" /FD /c +# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "../../../" /D "NDEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_CONSOLE" /D "WIN_LONG_PATH" /D "EXTERNAL_CODECS" /D "_7ZIP_LARGE_PAGES" /D "SUPPORT_DEVICE_FILE" /Yu"StdAfx.h" /FD /c # ADD BASE RSC /l 0x419 /d "NDEBUG" # ADD RSC /l 0x419 /d "NDEBUG" BSC32=bscmake.exe @@ -120,7 +120,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /Gz /W3 /Gm /GX /ZI /Od /I "../../../" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"StdAfx.h" /FD /GZ /c -# ADD CPP /nologo /Gz /W3 /Gm /GX /ZI /Od /I "../../../" /D "_DEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_CONSOLE" /D "COMPRESS_MT" /D "WIN_LONG_PATH" /D "EXTERNAL_LZMA" /D "EXTERNAL_CODECS" /D "BREAK_HANDLER" /D "BENCH_MT" /D "_7ZIP_LARGE_PAGES" /D "SUPPORT_DEVICE_FILE" /Yu"StdAfx.h" /FD /GZ /c +# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "../../../" /D "_DEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_CONSOLE" /D "WIN_LONG_PATH" /D "EXTERNAL_CODECS" /D "_7ZIP_LARGE_PAGES" /D "SUPPORT_DEVICE_FILE" /Yu"StdAfx.h" /FD /GZ /c # ADD BASE RSC /l 0x419 /d "_DEBUG" # ADD RSC /l 0x419 /d "_DEBUG" BSC32=bscmake.exe @@ -184,6 +184,14 @@ SOURCE=.\List.h # End Source File # Begin Source File +SOURCE=.\BenchCon.cpp +# End Source File +# Begin Source File + +SOURCE=.\BenchCon.h +# End Source File +# Begin Source File + SOURCE=.\Main.cpp # End Source File # Begin Source File @@ -540,6 +548,14 @@ SOURCE=..\Common\LoadCodecs.h # End Source File # Begin Source File +SOURCE=..\Common\Bench.cpp +# End Source File +# Begin Source File + +SOURCE=..\Common\Bench.h +# End Source File +# Begin Source File + SOURCE=..\Common\OpenArchive.cpp # End Source File # Begin Source File @@ -640,64 +656,60 @@ SOURCE=..\Common\ZipRegistry.h # PROP Default_Filter "" # Begin Source File -SOURCE=..\..\Common\FilePathAutoRename.cpp +SOURCE=..\..\Common\CreateCoder.cpp # End Source File # Begin Source File -SOURCE=..\..\Common\FilePathAutoRename.h +SOURCE=..\..\Common\CreateCoder.h # End Source File # Begin Source File -SOURCE=..\..\Common\FileStreams.cpp +SOURCE=..\..\Common\FilePathAutoRename.cpp # End Source File # Begin Source File -SOURCE=..\..\Common\FileStreams.h +SOURCE=..\..\Common\FilePathAutoRename.h # End Source File # Begin Source File -SOURCE=..\..\Common\ProgressUtils.cpp +SOURCE=..\..\Common\FileStreams.cpp # End Source File # Begin Source File -SOURCE=..\..\Common\ProgressUtils.h +SOURCE=..\..\Common\FileStreams.h # End Source File # Begin Source File -SOURCE=..\..\Common\RegisterArc.h +SOURCE=..\..\Common\FilterCoder.cpp # End Source File # Begin Source File -SOURCE=..\..\Common\StreamUtils.cpp +SOURCE=..\..\Common\FilterCoder.h # End Source File # Begin Source File -SOURCE=..\..\Common\StreamUtils.h +SOURCE=..\..\Common\ProgressUtils.cpp # End Source File -# End Group -# Begin Group "Compress" - -# PROP Default_Filter "" -# Begin Group "LzmaBench" - -# PROP Default_Filter "" # Begin Source File -SOURCE=..\..\Compress\LZMA_Alone\LzmaBench.cpp +SOURCE=..\..\Common\ProgressUtils.h # End Source File # Begin Source File -SOURCE=..\..\Compress\LZMA_Alone\LzmaBench.h +SOURCE=..\..\Common\RegisterArc.h # End Source File # Begin Source File -SOURCE=..\..\Compress\LZMA_Alone\LzmaBenchCon.cpp +SOURCE=..\..\Common\StreamUtils.cpp # End Source File # Begin Source File -SOURCE=..\..\Compress\LZMA_Alone\LzmaBenchCon.h +SOURCE=..\..\Common\StreamUtils.h # End Source File # End Group +# Begin Group "Compress" + +# PROP Default_Filter "" # Begin Source File SOURCE=..\..\Compress\CopyCoder.cpp @@ -713,7 +725,26 @@ SOURCE=..\..\Compress\CopyCoder.h # Begin Source File SOURCE=..\..\..\..\C\7zCrc.c + +!IF "$(CFG)" == "Console - Win32 Release" + +# ADD CPP /O2 +# SUBTRACT CPP /YX /Yc /Yu + +!ELSEIF "$(CFG)" == "Console - Win32 Debug" + +# SUBTRACT CPP /YX /Yc /Yu + +!ELSEIF "$(CFG)" == "Console - Win32 ReleaseU" + +# SUBTRACT CPP /YX /Yc /Yu + +!ELSEIF "$(CFG)" == "Console - Win32 DebugU" + # SUBTRACT CPP /YX /Yc /Yu + +!ENDIF + # End Source File # Begin Source File @@ -730,6 +761,15 @@ SOURCE=..\..\..\..\C\Alloc.h # End Source File # Begin Source File +SOURCE=..\..\..\..\C\CpuArch.c +# SUBTRACT CPP /YX /Yc /Yu +# End Source File +# Begin Source File + +SOURCE=..\..\..\..\C\CpuArch.h +# End Source File +# Begin Source File + SOURCE=..\..\..\..\C\Threads.c # SUBTRACT CPP /YX /Yc /Yu # End Source File @@ -750,5 +790,68 @@ SOURCE=..\..\Archive\Common\OutStreamWithCRC.cpp SOURCE=..\..\Archive\Common\OutStreamWithCRC.h # End Source File # End Group +# Begin Group "Asm" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=..\..\..\..\Asm\x86\7zAsm.asm +# End Source File +# Begin Source File + +SOURCE=..\..\..\..\Asm\x86\7zCrcOpt.asm + +!IF "$(CFG)" == "Console - Win32 Release" + +# Begin Custom Build +OutDir=.\Release +InputPath=..\..\..\..\Asm\x86\7zCrcOpt.asm +InputName=7zCrcOpt + +"$(OutDir)\$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ml.exe -c -Fo$(OutDir)\$(InputName).obj $(InputPath) + +# End Custom Build + +!ELSEIF "$(CFG)" == "Console - Win32 Debug" + +# Begin Custom Build +OutDir=.\Debug +InputPath=..\..\..\..\Asm\x86\7zCrcOpt.asm +InputName=7zCrcOpt + +"$(OutDir)\$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ml.exe -c -omf -Fo$(OutDir)\$(InputName).obj $(InputPath) + +# End Custom Build + +!ELSEIF "$(CFG)" == "Console - Win32 ReleaseU" + +# Begin Custom Build +OutDir=.\ReleaseU +InputPath=..\..\..\..\Asm\x86\7zCrcOpt.asm +InputName=7zCrcOpt + +"$(OutDir)\$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ml.exe -c -Fo$(OutDir)\$(InputName).obj $(InputPath) + +# End Custom Build + +!ELSEIF "$(CFG)" == "Console - Win32 DebugU" + +# Begin Custom Build +OutDir=.\DebugU +InputPath=..\..\..\..\Asm\x86\7zCrcOpt.asm +InputName=7zCrcOpt + +"$(OutDir)\$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + ml.exe -c -omf -Fo$(OutDir)\$(InputName).obj $(InputPath) + +# End Custom Build + +!ENDIF + +# End Source File +# End Group # End Target # End Project diff --git a/CPP/7zip/UI/Console/ConsoleClose.cpp b/CPP/7zip/UI/Console/ConsoleClose.cpp index f1356a28..5acae942 100755 --- a/CPP/7zip/UI/Console/ConsoleClose.cpp +++ b/CPP/7zip/UI/Console/ConsoleClose.cpp @@ -9,7 +9,7 @@ static const int kBreakAbortThreshold = 2; namespace NConsoleClose { -#ifndef UNDER_CE +#if !defined(UNDER_CE) && defined(_WIN32) static BOOL WINAPI HandlerRoutine(DWORD ctrlType) { if (ctrlType == CTRL_LOGOFF_EVENT) @@ -56,7 +56,7 @@ void CheckCtrlBreak() CCtrlHandlerSetter::CCtrlHandlerSetter() { - #ifndef UNDER_CE + #if !defined(UNDER_CE) && defined(_WIN32) if(!SetConsoleCtrlHandler(HandlerRoutine, TRUE)) throw "SetConsoleCtrlHandler fails"; #endif @@ -64,7 +64,7 @@ CCtrlHandlerSetter::CCtrlHandlerSetter() CCtrlHandlerSetter::~CCtrlHandlerSetter() { - #ifndef UNDER_CE + #if !defined(UNDER_CE) && defined(_WIN32) if(!SetConsoleCtrlHandler(HandlerRoutine, FALSE)) throw "SetConsoleCtrlHandler fails"; #endif diff --git a/CPP/7zip/UI/Console/Main.cpp b/CPP/7zip/UI/Console/Main.cpp index c8327361..7cb2a396 100755 --- a/CPP/7zip/UI/Console/Main.cpp +++ b/CPP/7zip/UI/Console/Main.cpp @@ -28,8 +28,7 @@ #endif #include "../Common/PropIDUtils.h" -#include "../../Compress/LZMA_Alone/LzmaBenchCon.h" - +#include "BenchCon.h" #include "ExtractCallbackConsole.h" #include "List.h" #include "OpenCallbackConsole.h" @@ -355,10 +354,17 @@ int Main2( } else { - HRESULT res = LzmaBenchCon( - #ifdef EXTERNAL_LZMA - codecs, - #endif + HRESULT res; + #ifdef EXTERNAL_CODECS + CObjectVector<CCodecInfoEx> externalCodecs; + res = LoadExternalCodecs(compressCodecsInfo, externalCodecs); + if (res != S_OK) + throw CSystemException(res); + #endif + res = LzmaBenchCon( + #ifdef EXTERNAL_CODECS + compressCodecsInfo, &externalCodecs, + #endif (FILE *)stdStream, options.NumIterations, options.NumThreads, options.DictionarySize); if (res != S_OK) { @@ -404,7 +410,7 @@ int Main2( eo.OutputDir = options.OutputDir; eo.YesToAll = options.YesToAll; eo.CalcCrc = options.CalcCrc; - #ifdef COMPRESS_MT + #if !defined(_7ZIP_ST) && !defined(_SFX) eo.Properties = options.ExtractProperties; #endif UString errorMessage; diff --git a/CPP/7zip/UI/Console/UpdateCallbackConsole.cpp b/CPP/7zip/UI/Console/UpdateCallbackConsole.cpp index ccb6c866..7f337319 100755 --- a/CPP/7zip/UI/Console/UpdateCallbackConsole.cpp +++ b/CPP/7zip/UI/Console/UpdateCallbackConsole.cpp @@ -5,7 +5,7 @@ #include "UpdateCallbackConsole.h" #include "Windows/Error.h" -#ifdef COMPRESS_MT +#ifndef _7ZIP_ST #include "Windows/Synchronization.h" #endif @@ -14,7 +14,7 @@ using namespace NWindows; -#ifdef COMPRESS_MT +#ifndef _7ZIP_ST static NSynchronization::CCriticalSection g_CriticalSection; #define MT_LOCK NSynchronization::CCriticalSectionLock lock(g_CriticalSection); #else diff --git a/CPP/7zip/UI/Console/makefile b/CPP/7zip/UI/Console/makefile index 467651ca..9b8fc37a 100755 --- a/CPP/7zip/UI/Console/makefile +++ b/CPP/7zip/UI/Console/makefile @@ -1,11 +1,7 @@ PROG = 7z.exe MY_CONSOLE = 1 CFLAGS = $(CFLAGS) -I ../../../ \ - -DCOMPRESS_MT \ - -DEXTERNAL_LZMA \ -DEXTERNAL_CODECS \ - -DBREAK_HANDLER \ - -DBENCH_MT \ !IFNDEF UNDER_CE CFLAGS = $(CFLAGS) -DWIN_LONG_PATH -D_7ZIP_LARGE_PAGES -DSUPPORT_DEVICE_FILE @@ -16,6 +12,7 @@ CONSOLE_OBJS = \ $O\ConsoleClose.obj \ $O\ExtractCallbackConsole.obj \ $O\List.obj \ + $O\BenchCon.obj \ $O\Main.obj \ $O\MainAr.obj \ $O\OpenCallbackConsole.obj \ @@ -53,8 +50,10 @@ WIN_OBJS = \ $O\Time.obj \ 7ZIP_COMMON_OBJS = \ + $O\CreateCoder.obj \ $O\FilePathAutoRename.obj \ $O\FileStreams.obj \ + $O\FilterCoder.obj \ $O\ProgressUtils.obj \ $O\StreamUtils.obj \ @@ -66,6 +65,7 @@ UI_COMMON_OBJS = \ $O\EnumDirItems.obj \ $O\Extract.obj \ $O\ExtractingFilePath.obj \ + $O\Bench.obj \ $O\LoadCodecs.obj \ $O\OpenArchive.obj \ $O\PropIDUtils.obj \ @@ -82,15 +82,12 @@ UI_COMMON_OBJS = \ AR_COMMON_OBJS = \ $O\OutStreamWithCRC.obj \ -LZMA_BENCH_OBJS = \ - $O\LzmaBench.obj \ - $O\LzmaBenchCon.obj \ - C_OBJS = \ $O\Alloc.obj \ + $O\CpuArch.obj \ $O\Threads.obj \ -!include "../../Crc2.mak" +!include "../../Crc.mak" OBJS = \ $O\StdAfx.obj \ @@ -101,9 +98,8 @@ OBJS = \ $(UI_COMMON_OBJS) \ $(AR_COMMON_OBJS) \ $O\CopyCoder.obj \ - $(LZMA_BENCH_OBJS) \ $(C_OBJS) \ - $(CRC_OBJS) \ + $(ASM_OBJS) \ $O\resource.res !include "../../../Build.mak" @@ -122,8 +118,7 @@ $(AR_COMMON_OBJS): ../../Archive/Common/$(*B).cpp $(COMPL) $O\CopyCoder.obj: ../../Compress/$(*B).cpp $(COMPL) -$(LZMA_BENCH_OBJS): ../../Compress/LZMA_Alone/$(*B).cpp - $(COMPL) $(C_OBJS): ../../../../C/$(*B).c $(COMPL_O2) -!include "../../Crc.mak" + +!include "../../Asm.mak" diff --git a/CPP/7zip/UI/Far/Far.dsp b/CPP/7zip/UI/Far/Far.dsp index 229035f9..0a96bc08 100755 --- a/CPP/7zip/UI/Far/Far.dsp +++ b/CPP/7zip/UI/Far/Far.dsp @@ -579,6 +579,11 @@ SOURCE=..\..\..\..\C\7zCrc.h # End Source File # Begin Source File +SOURCE=..\..\..\..\C\7zCrcOpt.c +# SUBTRACT CPP /YX /Yc /Yu +# End Source File +# Begin Source File + SOURCE=..\..\..\..\C\Alloc.c # SUBTRACT CPP /YX /Yc /Yu # End Source File @@ -588,6 +593,11 @@ SOURCE=..\..\..\..\C\Alloc.h # End Source File # Begin Source File +SOURCE=..\..\..\..\C\CpuArch.c +# SUBTRACT CPP /YX /Yc /Yu +# End Source File +# Begin Source File + SOURCE=..\..\..\..\C\Sort.c # SUBTRACT CPP /YX /Yc /Yu # End Source File diff --git a/CPP/7zip/UI/Far/makefile b/CPP/7zip/UI/Far/makefile index 29d7bcf4..076818e4 100755 --- a/CPP/7zip/UI/Far/makefile +++ b/CPP/7zip/UI/Far/makefile @@ -74,10 +74,11 @@ AGENT_OBJS = \ C_OBJS = \ $O\Alloc.obj \ + $O\CpuArch.obj \ $O\Sort.obj \ $O\Threads.obj \ -!include "../../Crc2.mak" +!include "../../Crc.mak" OBJS = \ $O\StdAfx.obj \ @@ -88,9 +89,9 @@ OBJS = \ $(UI_COMMON_OBJS) \ $(AR_COMMON_OBJS) \ $(AGENT_OBJS) \ - $(C_OBJS) \ $O\CopyCoder.obj \ - $(CRC_OBJS) \ + $(C_OBJS) \ + $(ASM_OBJS) \ $O\resource.res !include "../../../Build.mak" @@ -113,4 +114,4 @@ $O\CopyCoder.obj: ../../Compress/$(*B).cpp $(COMPL) $(C_OBJS): ../../../../C/$(*B).c $(COMPL_O2) -!include "../../Crc.mak" +!include "../../Asm.mak" diff --git a/CPP/7zip/UI/FileManager/FM.dsp b/CPP/7zip/UI/FileManager/FM.dsp index 615043b5..f8ec9364 100755 --- a/CPP/7zip/UI/FileManager/FM.dsp +++ b/CPP/7zip/UI/FileManager/FM.dsp @@ -660,6 +660,31 @@ SOURCE=..\..\..\..\C\7zCrc.h # End Source File # Begin Source File +SOURCE=..\..\..\..\C\7zCrcOpt.c + +!IF "$(CFG)" == "FM - Win32 Release" + +# ADD CPP /O2 +# SUBTRACT CPP /YX /Yc /Yu + +!ELSEIF "$(CFG)" == "FM - Win32 Debug" + +# SUBTRACT CPP /YX /Yc /Yu + +!ELSEIF "$(CFG)" == "FM - Win32 ReleaseU" + +# ADD CPP /O2 +# SUBTRACT CPP /YX /Yc /Yu + +!ELSEIF "$(CFG)" == "FM - Win32 DebugU" + +# SUBTRACT CPP /YX /Yc /Yu + +!ENDIF + +# End Source File +# Begin Source File + SOURCE=..\..\..\..\C\Alloc.c # SUBTRACT CPP /YX /Yc /Yu # End Source File @@ -669,6 +694,35 @@ SOURCE=..\..\..\..\C\Alloc.h # End Source File # Begin Source File +SOURCE=..\..\..\..\C\CpuArch.c + +!IF "$(CFG)" == "FM - Win32 Release" + +# ADD CPP /O2 +# SUBTRACT CPP /YX /Yc /Yu + +!ELSEIF "$(CFG)" == "FM - Win32 Debug" + +# SUBTRACT CPP /YX /Yc /Yu + +!ELSEIF "$(CFG)" == "FM - Win32 ReleaseU" + +# ADD CPP /O2 +# SUBTRACT CPP /YX /Yc /Yu + +!ELSEIF "$(CFG)" == "FM - Win32 DebugU" + +# SUBTRACT CPP /YX /Yc /Yu + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=..\..\..\..\C\CpuArch.h +# End Source File +# Begin Source File + SOURCE=..\..\..\..\C\Sha256.c !IF "$(CFG)" == "FM - Win32 Release" diff --git a/CPP/7zip/UI/FileManager/FSFolder.h b/CPP/7zip/UI/FileManager/FSFolder.h index 42e33242..e39004ad 100755 --- a/CPP/7zip/UI/FileManager/FSFolder.h +++ b/CPP/7zip/UI/FileManager/FSFolder.h @@ -50,7 +50,7 @@ class CFSFolder: { UInt64 GetSizeOfItem(int anIndex) const; public: - MY_QUERYINTERFACE_BEGIN + MY_QUERYINTERFACE_BEGIN2(IFolderFolder) MY_QUERYINTERFACE_ENTRY(IFolderWasChanged) // MY_QUERYINTERFACE_ENTRY(IFolderOperationsDeleteToRecycleBin) MY_QUERYINTERFACE_ENTRY(IFolderOperations) diff --git a/CPP/7zip/UI/FileManager/MyCom2.h b/CPP/7zip/UI/FileManager/MyCom2.h index 756a8169..98b1d708 100755 --- a/CPP/7zip/UI/FileManager/MyCom2.h +++ b/CPP/7zip/UI/FileManager/MyCom2.h @@ -10,23 +10,14 @@ STDMETHOD_(ULONG, AddRef)() { InterlockedIncrement((LONG *)&__m_RefCount); retur STDMETHOD_(ULONG, Release)() { InterlockedDecrement((LONG *)&__m_RefCount); if (__m_RefCount != 0) \ return __m_RefCount; delete this; return 0; } -#define MY_UNKNOWN_IMP_SPEC_MT(i) \ - MY_QUERYINTERFACE_BEGIN \ - MY_QUERYINTERFACE_ENTRY(IUnknown) \ - i \ - MY_QUERYINTERFACE_END \ - MY_ADDREF_RELEASE_MT - #define MY_UNKNOWN_IMP_SPEC_MT2(i1, i) \ MY_QUERYINTERFACE_BEGIN \ - if (iid == IID_IUnknown) \ - { *outObject = (void *)(IUnknown *)(i1 *)this; AddRef(); return S_OK; } i \ + MY_QUERYINTERFACE_ENTRY_UNKNOWN(i1) \ + i \ MY_QUERYINTERFACE_END \ MY_ADDREF_RELEASE_MT -#define MY_UNKNOWN_IMP_MT MY_UNKNOWN_IMP_SPEC_MT(;) - #define MY_UNKNOWN_IMP1_MT(i) MY_UNKNOWN_IMP_SPEC_MT2( \ i, \ MY_QUERYINTERFACE_ENTRY(i) \ diff --git a/CPP/7zip/UI/FileManager/PanelItemOpen.cpp b/CPP/7zip/UI/FileManager/PanelItemOpen.cpp index 2deea0af..b77d3e2a 100755 --- a/CPP/7zip/UI/FileManager/PanelItemOpen.cpp +++ b/CPP/7zip/UI/FileManager/PanelItemOpen.cpp @@ -172,7 +172,7 @@ static const wchar_t *kStartExtensions[] = L"docx", L"docm", L"dotx", L"dotm", L"xlsx", L"xlsm", L"xltx", L"xltm", L"xlsb", L"xlam", L"pptx", L"pptm", L"potx", L"potm", L"ppam", L"ppsx", L"ppsm", L"xsn", - + L"msg", L"dwf", L"flv", L"swf", diff --git a/CPP/7zip/UI/FileManager/PhysDriveFolder.cpp b/CPP/7zip/UI/FileManager/PhysDriveFolder.cpp deleted file mode 100755 index 12b7dce8..00000000 --- a/CPP/7zip/UI/FileManager/PhysDriveFolder.cpp +++ /dev/null @@ -1,295 +0,0 @@ -// PhysDriveFolder.cpp - -#include "StdAfx.h" - -#include "../../../../C/Alloc.h" - -#include "Common/Buffer.h" - -#include "Windows/PropVariant.h" -#include "Windows/FileDevice.h" -#include "Windows/FileSystem.h" - -#include "../../PropID.h" - -#include "PhysDriveFolder.h" - -using namespace NWindows; - -static const UInt32 kBufferSize = (4 << 20); -static STATPROPSTG kProperties[] = -{ - { NULL, kpidName, VT_BSTR}, - { NULL, kpidSize, VT_UI8} -}; - -HRESULT CPhysDriveFolder::Init(const UString &path) -{ - _prefix = L"\\\\.\\"; - _path = path; - NFile::NDevice::CInFile inFile; - if (!inFile.Open(GetFullPath())) - return GetLastError(); - return S_OK; -} - -STDMETHODIMP CPhysDriveFolder::LoadItems() -{ - _driveType = NFile::NSystem::MyGetDriveType(_path + L"\\"); - _name = _path.Left(1); - _name += L'.'; - if (_driveType == DRIVE_CDROM) - _name += L"iso"; - else - _name += L"img"; - Int32 dummy; - WasChanged(&dummy); - return GetLength(_length); -} - -STDMETHODIMP CPhysDriveFolder::GetNumberOfItems(UInt32 *numItems) -{ - *numItems = 1; - return S_OK; -} - -STDMETHODIMP CPhysDriveFolder::GetProperty(UInt32 itemIndex, PROPID propID, PROPVARIANT *value) -{ - NCOM::CPropVariant prop; - if (itemIndex >= 1) - return E_INVALIDARG; - switch(propID) - { - case kpidIsDir: prop = false; break; - case kpidName: prop = _name; break; - case kpidSize: prop = _length; break; - } - prop.Detach(value); - return S_OK; -} - -STDMETHODIMP CPhysDriveFolder::BindToFolder(UInt32 /* index */, IFolderFolder ** /* resultFolder */) - { return E_NOTIMPL; } - -STDMETHODIMP CPhysDriveFolder::BindToFolder(const wchar_t * /* name */, IFolderFolder ** /* resultFolder */) - { return E_NOTIMPL; } - -STDMETHODIMP CPhysDriveFolder::BindToParentFolder(IFolderFolder **resultFolder) -{ - *resultFolder = 0; - return S_OK; -} - -STDMETHODIMP CPhysDriveFolder::GetNumberOfProperties(UInt32 *numProperties) -{ - *numProperties = sizeof(kProperties) / sizeof(kProperties[0]); - return S_OK; -} - -STDMETHODIMP CPhysDriveFolder::GetPropertyInfo(UInt32 index, - BSTR *name, PROPID *propID, VARTYPE *varType) -{ - if (index >= sizeof(kProperties) / sizeof(kProperties[0])) - return E_INVALIDARG; - const STATPROPSTG &prop = kProperties[index]; - *propID = prop.propid; - *varType = prop.vt; - *name = 0; - return S_OK; -} - - -STDMETHODIMP CPhysDriveFolder::GetFolderProperty(PROPID propID, PROPVARIANT *value) -{ - NWindows::NCOM::CPropVariant prop; - switch(propID) - { - case kpidType: prop = L"PhysDrive"; break; - case kpidPath: prop = (GetFullPath() + L"\\"); break; - } - prop.Detach(value); - return S_OK; -} - -STDMETHODIMP CPhysDriveFolder::WasChanged(Int32 *wasChanged) -{ - bool wasChangedMain = false; - *wasChanged = BoolToInt(wasChangedMain); - return S_OK; -} - -STDMETHODIMP CPhysDriveFolder::Clone(IFolderFolder **resultFolder) -{ - CPhysDriveFolder *folderSpec = new CPhysDriveFolder; - CMyComPtr<IFolderFolder> folderNew = folderSpec; - folderSpec->Init(_path); - *resultFolder = folderNew.Detach(); - return S_OK; -} - -STDMETHODIMP CPhysDriveFolder::GetItemFullSize(UInt32 index, PROPVARIANT *value, IProgress * /* progress */) -{ - NCOM::CPropVariant prop; - if (index >= 1) - return E_INVALIDARG; - UInt64 size = 0; - HRESULT result = GetLength(size); - prop = size; - prop.Detach(value); - return result; -} - -STDMETHODIMP CPhysDriveFolder::CreateFolder(const wchar_t * /* name */, IProgress * /* progress */) - { return E_NOTIMPL; } - -STDMETHODIMP CPhysDriveFolder::CreateFile(const wchar_t * /* name */, IProgress * /* progress */) - { return E_NOTIMPL; } - -STDMETHODIMP CPhysDriveFolder::Rename(UInt32 /* index */, const wchar_t * /* newName */, IProgress * /* progress */) - { return E_NOTIMPL; } - -STDMETHODIMP CPhysDriveFolder::Delete(const UInt32 * /* indices */, UInt32 /* numItems */, IProgress * /* progress */) - { return E_NOTIMPL; } - -STDMETHODIMP CPhysDriveFolder::SetProperty(UInt32 index, PROPID /* propID */, - const PROPVARIANT * /* value */, IProgress * /* progress */) -{ - if (index >= 1) - return E_INVALIDARG; - return E_NOTIMPL; -} - -HRESULT CPhysDriveFolder::GetLength(UInt64 &length) const -{ - NFile::NDevice::CInFile inFile; - if (!inFile.Open(GetFullPath())) - return GetLastError(); - if (!inFile.GetLengthSmart(length)) - return GetLastError(); - return S_OK; -} - -struct CPhysTempBuffer -{ - void *buffer; - CPhysTempBuffer(): buffer(0) {} - ~CPhysTempBuffer() { MyFree(buffer); } -}; - -HRESULT CopyFileSpec(LPCWSTR fromPath, LPCWSTR toPath, bool writeToDisk, UInt64 fileSize, - UInt32 bufferSize, UInt64 progressStart, IProgress *progress) -{ - NFile::NIO::CInFile inFile; - if (!inFile.Open(fromPath)) - return GetLastError(); - if (fileSize == (UInt64)(Int64)-1) - { - if (!inFile.GetLength(fileSize)) - ::GetLastError(); - } - NFile::NIO::COutFile outFile; - if (writeToDisk) - { - if (!outFile.Open(toPath, FILE_SHARE_WRITE, OPEN_EXISTING, 0)) - return GetLastError(); - } - else - if (!outFile.Create(toPath, true)) - return GetLastError(); - CPhysTempBuffer tempBuffer; - tempBuffer.buffer = MyAlloc(bufferSize); - if (tempBuffer.buffer == 0) - return E_OUTOFMEMORY; - - for (UInt64 pos = 0; pos < fileSize;) - { - UInt64 progressCur = progressStart + pos; - RINOK(progress->SetCompleted(&progressCur)); - UInt64 rem = fileSize - pos; - UInt32 curSize = (UInt32)MyMin(rem, (UInt64)bufferSize); - UInt32 processedSize; - if (!inFile.Read(tempBuffer.buffer, curSize, processedSize)) - return GetLastError(); - if (processedSize == 0) - break; - curSize = processedSize; - if (writeToDisk) - { - const UInt32 kMask = 0x1FF; - curSize = (curSize + kMask) & ~kMask; - if (curSize > bufferSize) - return E_FAIL; - } - - if (!outFile.Write(tempBuffer.buffer, curSize, processedSize)) - return GetLastError(); - if (curSize != processedSize) - return E_FAIL; - pos += curSize; - } - return S_OK; -} - -STDMETHODIMP CPhysDriveFolder::CopyTo(const UInt32 * /* indices */, UInt32 numItems, - const wchar_t *path, IFolderOperationsExtractCallback *callback) -{ - if (numItems == 0) - return S_OK; - UString destPath = path; - if (destPath.IsEmpty()) - return E_INVALIDARG; - bool directName = (destPath[destPath.Length() - 1] != WCHAR_PATH_SEPARATOR); - if (directName) - { - if (numItems > 1) - return E_INVALIDARG; - } - else - destPath += _name; - - UInt64 fileSize; - if (GetLength(fileSize) == S_OK) - { - RINOK(callback->SetTotal(fileSize)); - } - - Int32 writeAskResult; - CMyComBSTR destPathResult; - RINOK(callback->AskWrite(GetFullPath(), BoolToInt(false), NULL, &fileSize, - destPath, &destPathResult, &writeAskResult)); - if (!IntToBool(writeAskResult)) - return S_OK; - - RINOK(callback->SetCurrentFilePath(GetFullPathWithName())); - - UInt32 bufferSize = (_driveType == DRIVE_REMOVABLE) ? (18 << 10) * 4 : kBufferSize; - return CopyFileSpec(GetFullPath(), destPathResult, false, fileSize, bufferSize, 0, callback); -} - -///////////////////////////////////////////////// -// Move Operations - -STDMETHODIMP CPhysDriveFolder::MoveTo( - const UInt32 * /* indices */, - UInt32 /* numItems */, - const wchar_t * /* path */, - IFolderOperationsExtractCallback * /* callback */) -{ - return E_NOTIMPL; -} - -STDMETHODIMP CPhysDriveFolder::CopyFrom( - const wchar_t * fromFolderPath, - const wchar_t ** itemsPaths, UInt32 numItems, IProgress *callback) -{ - if (numItems == 0) - return S_OK; - if (numItems != 1) - return E_INVALIDARG; - if (_driveType != DRIVE_REMOVABLE /* && _driveType != DRIVE_CDROM */) - return E_NOTIMPL; - UInt32 bufferSize = (_driveType == DRIVE_REMOVABLE) ? (18 << 10) * 4 : kBufferSize; - // MessageBoxW(0, fromFolderPath, itemsPaths[0], 0); - return CopyFileSpec((UString)fromFolderPath + itemsPaths[0], GetFullPath(), true, (UInt64)(Int64)-1, bufferSize, 0, callback); -} - diff --git a/CPP/7zip/UI/FileManager/PhysDriveFolder.h b/CPP/7zip/UI/FileManager/PhysDriveFolder.h deleted file mode 100755 index 64a36b91..00000000 --- a/CPP/7zip/UI/FileManager/PhysDriveFolder.h +++ /dev/null @@ -1,59 +0,0 @@ -// PhysDriveFolder.h - -#ifndef __PHYSDRIVEFOLDER_H -#define __PHYSDRIVEFOLDER_H - -#include "Common/MyString.h" -#include "Common/MyCom.h" -#include "../../Archive/IArchive.h" - -#include "IFolder.h" - -class CPhysDriveFolder: - public IFolderFolder, - public IFolderWasChanged, - public IFolderOperations, - public IFolderGetItemFullSize, - public IFolderClone, - // public IFolderGetSystemIconIndex, - public CMyUnknownImp -{ - UInt64 GetSizeOfItem(int anIndex) const; -public: - MY_QUERYINTERFACE_BEGIN - MY_QUERYINTERFACE_ENTRY(IFolderWasChanged) - MY_QUERYINTERFACE_ENTRY(IFolderOperations) - MY_QUERYINTERFACE_ENTRY(IFolderGetItemFullSize) - MY_QUERYINTERFACE_ENTRY(IFolderClone) - // MY_QUERYINTERFACE_ENTRY(IFolderGetSystemIconIndex) - MY_QUERYINTERFACE_END - MY_ADDREF_RELEASE - - - INTERFACE_FolderFolder(;) - INTERFACE_FolderOperations(;) - - STDMETHOD(WasChanged)(Int32 *wasChanged); - STDMETHOD(GetItemFullSize)(UInt32 index, PROPVARIANT *value, IProgress *progress); - STDMETHOD(Clone)(IFolderFolder **resultFolder); - - // STDMETHOD(GetSystemIconIndex)(UInt32 index, Int32 *iconIndex); - -private: - UString _name; - UString _prefix; - UString _path; - UString GetFullPath() const { return _prefix + _path; } - UString GetFullPathWithName() const { return GetFullPath() + L'\\' + _name; } - CMyComPtr<IFolderFolder> _parentFolder; - - UINT _driveType; - DISK_GEOMETRY geom; - UInt64 _length; - -public: - HRESULT Init(const UString &path); - HRESULT GetLength(UInt64 &size) const; -}; - -#endif diff --git a/CPP/7zip/UI/FileManager/ProgressDialog2.cpp b/CPP/7zip/UI/FileManager/ProgressDialog2.cpp index 2c9996ab..313b6181 100755 --- a/CPP/7zip/UI/FileManager/ProgressDialog2.cpp +++ b/CPP/7zip/UI/FileManager/ProgressDialog2.cpp @@ -46,6 +46,7 @@ static CIDLangPair kIDLangPairs[] = { IDC_PROGRESS_RATIO, 0x02000C06 }, { IDC_PROGRESS_SPEED, 0x02000C04 }, { IDC_PROGRESS_FILES, 0x02000320 }, + { IDC_PROGRESS_ERRORS, 0x0308000A }, { IDC_BUTTON_PROGRESS_PRIORITY, 0x02000C10 }, { IDC_BUTTON_PAUSE, 0x02000C12 }, { IDCANCEL, 0x02000711 }, @@ -86,6 +87,7 @@ CProgressDialog::CProgressDialog(): _timer(0), CompressingMode(true) _externalCloseMessageWasReceived = false; _numPostedMessages = 0; + _numAutoSizeMessages = 0; _errorsWereDisplayed = false; _waitCloseByCancelButton = false; _cancelWasPressed = false; @@ -843,13 +845,19 @@ void CProgressDialog::AddMessage(LPCWSTR message) AddMessageDirect(s); } +static unsigned GetNumDigits(UInt32 value) +{ + unsigned i; + for (i = 0; value >= 10; i++) + value /= 10; + return i; +} + void CProgressDialog::UpdateMessagesDialog() { - int numMessages; UStringVector messages; { NWindows::NSynchronization::CCriticalSectionLock lock(Sync._cs); - numMessages = _numPostedMessages; for (int i = _numPostedMessages; i < Sync.Messages.Size(); i++) messages.Add(Sync.Messages[i]); _numPostedMessages = Sync.Messages.Size(); @@ -858,10 +866,11 @@ void CProgressDialog::UpdateMessagesDialog() { for (int i = 0; i < messages.Size(); i++) AddMessage(messages[i]); - if (numMessages < 128) + if (_numAutoSizeMessages < 256 || GetNumDigits(_numPostedMessages) > GetNumDigits(_numAutoSizeMessages)) { _messageList.SetColumnWidthAuto(0); _messageList.SetColumnWidthAuto(1); + _numAutoSizeMessages = _numPostedMessages; } } } diff --git a/CPP/7zip/UI/FileManager/ProgressDialog2.h b/CPP/7zip/UI/FileManager/ProgressDialog2.h index bbdc5afa..ed096f06 100755 --- a/CPP/7zip/UI/FileManager/ProgressDialog2.h +++ b/CPP/7zip/UI/FileManager/ProgressDialog2.h @@ -237,6 +237,7 @@ private: bool _needClose; UInt32 _numPostedMessages; + UInt32 _numAutoSizeMessages; bool _errorsWereDisplayed; diff --git a/CPP/7zip/UI/FileManager/makefile b/CPP/7zip/UI/FileManager/makefile index d26aa04b..01016038 100755 --- a/CPP/7zip/UI/FileManager/makefile +++ b/CPP/7zip/UI/FileManager/makefile @@ -172,11 +172,12 @@ AGENT_OBJS = \ C_OBJS = \ $O\Alloc.obj \ + $O\CpuArch.obj \ $O\Sha256.obj \ $O\Sort.obj \ $O\Threads.obj \ -!include "../../Crc2.mak" +!include "../../Crc.mak" OBJS = \ $O\StdAfx.obj \ @@ -190,8 +191,8 @@ OBJS = \ $(EXPLORER_OBJS) \ $(AGENT_OBJS) \ $O\CopyCoder.obj \ - $(CRC_OBJS) \ $(C_OBJS) \ + $(ASM_OBJS) \ $O\resource.res \ !include "../../../Build.mak" @@ -220,4 +221,4 @@ $O\CopyCoder.obj: ../../Compress/$(*B).cpp $(C_OBJS): ../../../../C/$(*B).c $(COMPL_O2) -!include "../../Crc.mak" +!include "../../Asm.mak" diff --git a/CPP/7zip/UI/GUI/BenchmarkDialog.cpp b/CPP/7zip/UI/GUI/BenchmarkDialog.cpp index f669c0e1..e4d6c019 100755 --- a/CPP/7zip/UI/GUI/BenchmarkDialog.cpp +++ b/CPP/7zip/UI/GUI/BenchmarkDialog.cpp @@ -415,9 +415,7 @@ struct CThreadBenchmark { CBenchmarkDialog *BenchmarkDialog; UInt64 _startTime; - #ifdef EXTERNAL_LZMA - CCodecs *codecs; - #endif + DECL_EXTERNAL_CODECS_VARS // UInt32 dictionarySize; // UInt32 numThreads; @@ -514,9 +512,7 @@ HRESULT CThreadBenchmark::Process() try { result = LzmaBench( - #ifdef EXTERNAL_LZMA - codecs, - #endif + EXTERNAL_CODECS_VARS numThreads, dictionarySize, &callback); } catch(...) @@ -564,14 +560,13 @@ HRESULT CThreadBenchmark::Process() } HRESULT Benchmark( - #ifdef EXTERNAL_LZMA - CCodecs *codecs, - #endif + DECL_EXTERNAL_CODECS_LOC_VARS UInt32 numThreads, UInt32 dictionarySize, HWND hwndParent) { CThreadBenchmark benchmarker; - #ifdef EXTERNAL_LZMA - benchmarker.codecs = codecs; + #ifdef EXTERNAL_CODECS + benchmarker._codecsInfo = codecsInfo; + benchmarker._externalCodecs = *externalCodecs; #endif CBenchmarkDialog benchmarkDialog; diff --git a/CPP/7zip/UI/GUI/BenchmarkDialog.h b/CPP/7zip/UI/GUI/BenchmarkDialog.h index 3152ee6c..2b6216fd 100755 --- a/CPP/7zip/UI/GUI/BenchmarkDialog.h +++ b/CPP/7zip/UI/GUI/BenchmarkDialog.h @@ -3,13 +3,10 @@ #ifndef __BENCHMARK_DIALOG_H #define __BENCHMARK_DIALOG_H -#include "Windows/Control/ComboBox.h" #include "Windows/Synchronization.h" -#include "../../Compress/LZMA_Alone/LzmaBench.h" +#include "Windows/Control/ComboBox.h" -#ifdef EXTERNAL_LZMA -#include "../Common/LoadCodecs.h" -#endif +#include "../Common/Bench.h" #include "../FileManager/DialogSize.h" @@ -132,9 +129,7 @@ public: }; HRESULT Benchmark( - #ifdef EXTERNAL_LZMA - CCodecs *codecs, - #endif - UInt32 dictionarySize, UInt32 numThreads, HWND hwndParent = NULL); + DECL_EXTERNAL_CODECS_LOC_VARS + UInt32 numThreads, UInt32 dictionarySize, HWND hwndParent = NULL); #endif diff --git a/CPP/7zip/UI/GUI/GUI.cpp b/CPP/7zip/UI/GUI/GUI.cpp index a59e7557..377c7841 100755 --- a/CPP/7zip/UI/GUI/GUI.cpp +++ b/CPP/7zip/UI/GUI/GUI.cpp @@ -110,9 +110,16 @@ static int Main2() if (options.Command.CommandType == NCommandType::kBenchmark) { - HRESULT res = Benchmark( - #ifdef EXTERNAL_LZMA - codecs, + HRESULT res; + #ifdef EXTERNAL_CODECS + CObjectVector<CCodecInfoEx> externalCodecs; + res = LoadExternalCodecs(codecs, externalCodecs); + if (res != S_OK) + throw CSystemException(res); + #endif + res = Benchmark( + #ifdef EXTERNAL_CODECS + codecs, &externalCodecs, #endif options.NumThreads, options.DictionarySize); if (res != S_OK) @@ -138,7 +145,7 @@ static int Main2() eo.PathMode = options.Command.GetPathMode(); eo.TestMode = options.Command.IsTestMode(); eo.CalcCrc = options.CalcCrc; - #ifdef COMPRESS_MT + #if !defined(_7ZIP_ST) && !defined(_SFX) eo.Properties = options.ExtractProperties; #endif diff --git a/CPP/7zip/UI/GUI/GUI.dsp b/CPP/7zip/UI/GUI/GUI.dsp index 16a24d40..d54e944f 100755 --- a/CPP/7zip/UI/GUI/GUI.dsp +++ b/CPP/7zip/UI/GUI/GUI.dsp @@ -45,7 +45,7 @@ RSC=rc.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "COMPRESS_MT" /D "WIN_LONG_PATH" /D "EXTERNAL_LZMA" /D "EXTERNAL_CODECS" /D "BENCH_MT" /D "SUPPORT_DEVICE_FILE" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "WIN_LONG_PATH" /D "EXTERNAL_CODECS" /D "SUPPORT_DEVICE_FILE" /Yu"stdafx.h" /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x419 /d "NDEBUG" @@ -72,7 +72,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c -# ADD CPP /nologo /Gz /MDd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "COMPRESS_MT" /D "WIN_LONG_PATH" /D "EXTERNAL_LZMA" /D "EXTERNAL_CODECS" /D "BENCH_MT" /D "SUPPORT_DEVICE_FILE" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /Gz /MDd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "WIN_LONG_PATH" /D "EXTERNAL_CODECS" /D "SUPPORT_DEVICE_FILE" /Yu"stdafx.h" /FD /GZ /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x419 /d "_DEBUG" @@ -99,7 +99,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "COMPRESS_MT" /D "WIN_LONG_PATH" /D "EXTERNAL_LZMA" /D "EXTERNAL_CODECS" /D "BENCH_MT" /D "SUPPORT_DEVICE_FILE" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "WIN_LONG_PATH" /D "EXTERNAL_CODECS" /D "SUPPORT_DEVICE_FILE" /Yu"stdafx.h" /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x419 /d "NDEBUG" @@ -127,7 +127,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c -# ADD CPP /nologo /Gz /MDd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "COMPRESS_MT" /D "WIN_LONG_PATH" /D "EXTERNAL_LZMA" /D "EXTERNAL_CODECS" /D "BENCH_MT" /D "SUPPORT_DEVICE_FILE" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /Gz /MDd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "_UNICODE" /D "UNICODE" /D "WIN32" /D "_WINDOWS" /D "LANG" /D "WIN_LONG_PATH" /D "EXTERNAL_CODECS" /D "SUPPORT_DEVICE_FILE" /Yu"stdafx.h" /FD /GZ /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x419 /d "_DEBUG" @@ -205,6 +205,14 @@ SOURCE=..\Common\ArchiveOpenCallback.h # End Source File # Begin Source File +SOURCE=..\Common\Bench.cpp +# End Source File +# Begin Source File + +SOURCE=..\Common\Bench.h +# End Source File +# Begin Source File + SOURCE=..\Common\DefaultName.cpp # End Source File # Begin Source File @@ -545,6 +553,14 @@ SOURCE=.\UpdateGUI.h # PROP Default_Filter "" # Begin Source File +SOURCE=..\..\Common\CreateCoder.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Common\CreateCoder.h +# End Source File +# Begin Source File + SOURCE=..\..\Common\FilePathAutoRename.cpp # End Source File # Begin Source File @@ -561,6 +577,14 @@ SOURCE=..\..\Common\FileStreams.h # End Source File # Begin Source File +SOURCE=..\..\Common\FilterCoder.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Common\FilterCoder.h +# End Source File +# Begin Source File + SOURCE=..\..\Common\ProgressUtils.cpp # End Source File # Begin Source File @@ -579,18 +603,6 @@ SOURCE=..\..\Common\StreamUtils.h # Begin Group "Compress" # PROP Default_Filter "" -# Begin Group "LZMA Bench" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\Compress\LZMA_Alone\LzmaBench.cpp -# End Source File -# Begin Source File - -SOURCE=..\..\Compress\LZMA_Alone\LzmaBench.h -# End Source File -# End Group # Begin Source File SOURCE=..\..\Compress\CopyCoder.cpp @@ -633,6 +645,30 @@ SOURCE=..\..\..\..\C\7zCrc.h # End Source File # Begin Source File +SOURCE=..\..\..\..\C\7zCrcOpt.c + +!IF "$(CFG)" == "GUI - Win32 Release" + +# ADD CPP /O2 +# SUBTRACT CPP /YX /Yc /Yu + +!ELSEIF "$(CFG)" == "GUI - Win32 Debug" + +# SUBTRACT CPP /YX /Yc /Yu + +!ELSEIF "$(CFG)" == "GUI - Win32 ReleaseU" + +# SUBTRACT CPP /YX /Yc /Yu + +!ELSEIF "$(CFG)" == "GUI - Win32 DebugU" + +# SUBTRACT CPP /YX /Yc /Yu + +!ENDIF + +# End Source File +# Begin Source File + SOURCE=..\..\..\..\C\Alloc.c # SUBTRACT CPP /YX /Yc /Yu # End Source File @@ -642,6 +678,34 @@ SOURCE=..\..\..\..\C\Alloc.h # End Source File # Begin Source File +SOURCE=..\..\..\..\C\CpuArch.c + +!IF "$(CFG)" == "GUI - Win32 Release" + +# ADD CPP /O2 +# SUBTRACT CPP /YX /Yc /Yu + +!ELSEIF "$(CFG)" == "GUI - Win32 Debug" + +# SUBTRACT CPP /YX /Yc /Yu + +!ELSEIF "$(CFG)" == "GUI - Win32 ReleaseU" + +# SUBTRACT CPP /YX /Yc /Yu + +!ELSEIF "$(CFG)" == "GUI - Win32 DebugU" + +# SUBTRACT CPP /YX /Yc /Yu + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=..\..\..\..\C\CpuArch.h +# End Source File +# Begin Source File + SOURCE=..\..\..\..\C\Threads.c # SUBTRACT CPP /YX /Yc /Yu # End Source File diff --git a/CPP/7zip/UI/GUI/makefile b/CPP/7zip/UI/GUI/makefile index a3763cbf..fdedb44a 100755 --- a/CPP/7zip/UI/GUI/makefile +++ b/CPP/7zip/UI/GUI/makefile @@ -1,10 +1,7 @@ PROG = 7zG.exe CFLAGS = $(CFLAGS) -I ../../../ \ -DLANG \ - -DCOMPRESS_MT \ - -DEXTERNAL_LZMA \ -DEXTERNAL_CODECS \ - -DBENCH_MT \ !IFDEF UNDER_CE LIBS = $(LIBS) ceshell.lib Commctrl.lib @@ -62,8 +59,10 @@ WIN_CTRL_OBJS = \ $O\ListView.obj \ 7ZIP_COMMON_OBJS = \ + $O\CreateCoder.obj \ $O\FilePathAutoRename.obj \ $O\FileStreams.obj \ + $O\FilterCoder.obj \ $O\ProgressUtils.obj \ $O\StreamUtils.obj \ @@ -71,6 +70,7 @@ UI_COMMON_OBJS = \ $O\ArchiveCommandLine.obj \ $O\ArchiveExtractCallback.obj \ $O\ArchiveOpenCallback.obj \ + $O\Bench.obj \ $O\DefaultName.obj \ $O\EnumDirItems.obj \ $O\Extract.obj \ @@ -92,9 +92,6 @@ UI_COMMON_OBJS = \ AR_COMMON_OBJS = \ $O\OutStreamWithCRC.obj \ -LZMA_BENCH_OBJS = \ - $O\LzmaBench.obj \ - FM_OBJS = \ $O\ExtractCallback.obj \ $O\FormatUtils.obj \ @@ -117,9 +114,10 @@ FM_OBJS = $(FM_OBJS) \ C_OBJS = \ $O\Alloc.obj \ + $O\CpuArch.obj \ $O\Threads.obj \ -!include "../../Crc2.mak" +!include "../../Crc.mak" OBJS = \ $O\StdAfx.obj \ @@ -135,7 +133,7 @@ OBJS = \ $O\CopyCoder.obj \ $(LZMA_BENCH_OBJS) \ $(C_OBJS) \ - $(CRC_OBJS) \ + $(ASM_OBJS) \ $O\resource.res !include "../../../Build.mak" @@ -159,11 +157,9 @@ $(FM_OBJS): ../FileManager/$(*B).cpp $O\MyMessages.obj: ../Explorer/MyMessages.cpp $(COMPL) - $O\CopyCoder.obj: ../../Compress/$(*B).cpp $(COMPL) -$(LZMA_BENCH_OBJS): ../../Compress/LZMA_Alone/$(*B).cpp - $(COMPL) $(C_OBJS): ../../../../C/$(*B).c $(COMPL_O2) -!include "../../Crc.mak" + +!include "../../Asm.mak" |