mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
Compare commits
7 Commits
core-win-6
...
core-linux
| Author | SHA1 | Date | |
|---|---|---|---|
| e69c1677b2 | |||
| 4dae8f50fa | |||
| 9cc5ed1db0 | |||
| 6d1dd9c420 | |||
| 549e3dc579 | |||
| 8440b18223 | |||
| 470eddf2b1 |
@ -501,7 +501,7 @@ namespace DocFileFormat
|
||||
|
||||
facet.widen((char*)bytes, (char*)bytes + size, &result[0]);
|
||||
|
||||
for (size_t i=0; i < result.length(); i++)
|
||||
for (long i=0; i < result.length(); i++)
|
||||
{
|
||||
STLCollection->push_back(result[i]);
|
||||
}
|
||||
@ -536,7 +536,7 @@ namespace DocFileFormat
|
||||
delete [] pStrUtf16;
|
||||
return GetSTLCollectionFromLocale(STLCollection, bytes,size);
|
||||
}
|
||||
for (unsigned int i = 0; i < nLength; i++)
|
||||
for (long i=0; i < nLength; i++)
|
||||
{
|
||||
STLCollection->push_back(pStrUtf16[i]);
|
||||
}
|
||||
@ -566,7 +566,7 @@ namespace DocFileFormat
|
||||
delete [] pStrUtf32;
|
||||
return GetSTLCollectionFromLocale(STLCollection, bytes, size);
|
||||
}
|
||||
for (unsigned int i = 0; i < nLength; i++)
|
||||
for (long i=0; i < nLength; i++)
|
||||
{
|
||||
STLCollection->push_back(pStrUtf32[i]);
|
||||
}
|
||||
@ -652,7 +652,7 @@ namespace DocFileFormat
|
||||
NSUnicodeConverter::CUnicodeConverter oConverter;
|
||||
std::wstring unicode_string = oConverter.toUnicode((char*)bytes, size, sCodePage.c_str());
|
||||
|
||||
for (size_t i = 0; i < unicode_string.size(); i++)
|
||||
for (long i=0; i < unicode_string.size(); i++)
|
||||
{
|
||||
STLCollection->push_back(unicode_string[i]);
|
||||
}
|
||||
|
||||
@ -36,7 +36,7 @@ namespace BinDocxRW {
|
||||
|
||||
int Binary_VbaProjectTableReader::Read()
|
||||
{
|
||||
m_oFileWriter.m_pVbaProject = new OOX::VbaProject();
|
||||
m_oFileWriter.m_pVbaProject = new OOX::VbaProject();
|
||||
m_oFileWriter.m_pVbaProject->fromPPTY(&m_oBufferedStream);
|
||||
|
||||
return c_oSerConstants::ReadOk;
|
||||
@ -118,4 +118,4 @@ int Binary_HdrFtrTableReader::ReadHdrFtrItemContent(BYTE type, long length, void
|
||||
return pBinary_DocumentTableReader->ReadDocumentContent(type, length, NULL);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -285,7 +285,7 @@ public:
|
||||
}
|
||||
|
||||
int Read ();
|
||||
};
|
||||
};
|
||||
|
||||
class Binary_HdrFtrTableReader : public Binary_CommonReader<Binary_HdrFtrTableReader>
|
||||
{
|
||||
@ -885,11 +885,6 @@ public:
|
||||
pCStringWriter->WriteString(oSectPr.Write());
|
||||
pCStringWriter->WriteString(std::wstring(_T("</w:sectPr>")));
|
||||
}break;
|
||||
case c_oSerProp_pPrType::outlineLvl:
|
||||
{
|
||||
long outlineLvl = m_oBufferedStream.GetLong();
|
||||
pCStringWriter->WriteString(L"<w:outlineLvl w:val=\"" + std::to_wstring(outlineLvl) + L"\"/>");
|
||||
}break;
|
||||
default:
|
||||
res = c_oSerConstants::ReadUnknown;
|
||||
break;
|
||||
|
||||
@ -344,8 +344,7 @@ extern int g_nCurFormatVersion;
|
||||
FramePr = 30,
|
||||
SectPr = 31,
|
||||
numPr_Ins = 32,
|
||||
pPrChange = 33,
|
||||
outlineLvl = 34
|
||||
pPrChange = 33
|
||||
};}
|
||||
namespace c_oSerProp_rPrType{enum c_oSerProp_rPrType
|
||||
{
|
||||
|
||||
@ -1024,12 +1024,6 @@ namespace BinDocxRW
|
||||
WritePPrChange(pPr.m_oPPrChange.get());
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if(pPr.m_oOutlineLvl.IsInit() && pPr.m_oOutlineLvl->m_oVal.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_pPrType::outlineLvl);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Long);
|
||||
m_oBcw.m_oStream.WriteLONG(pPr.m_oOutlineLvl->m_oVal->GetValue());
|
||||
}
|
||||
//SectPr
|
||||
if(NULL != m_oBinaryHeaderFooterTableWriter && pPr.m_oSectPr.IsInit())
|
||||
{
|
||||
|
||||
@ -95,7 +95,7 @@ bool BinDocxRW::CDocxSerializer::saveToFile(const std::wstring& sSrcFileName, co
|
||||
oDrawingConverter.SetMainDocument(this);
|
||||
|
||||
oDrawingConverter.SetDstPath(pathMain.GetDirectory() + FILE_SEPARATOR_STR + L"word");
|
||||
oDrawingConverter.SetMediaDstPath(pathMedia.GetPath());
|
||||
oDrawingConverter.SetMediaDstPath(pathMedia.GetPath());
|
||||
|
||||
m_pParamsWriter = new ParamsWriter(&oBufferedStream, &fp, &oDrawingConverter, pEmbeddedFontsManager);
|
||||
|
||||
@ -265,10 +265,10 @@ bool BinDocxRW::CDocxSerializer::loadFromFile(const std::wstring& sSrcFileName,
|
||||
|
||||
if (NULL != pData)
|
||||
{
|
||||
oDrawingConverter.SetMainDocument(this);
|
||||
oDrawingConverter.SetMainDocument(this);
|
||||
oDrawingConverter.SetDstPath(sDstPath + FILE_SEPARATOR_STR + L"word");
|
||||
|
||||
oDrawingConverter.SetMediaDstPath(sMediaPath);
|
||||
oDrawingConverter.SetMediaDstPath(sMediaPath);
|
||||
oDrawingConverter.SetEmbedDstPath(sEmbedPath);
|
||||
|
||||
m_pCurFileWriter = new Writers::FileWriter(sDstPath, m_sFontDir, false, nVersion, m_bSaveChartAsImg, &oDrawingConverter, sThemePath);
|
||||
|
||||
@ -88,12 +88,12 @@ namespace BinXlsxRW{
|
||||
{
|
||||
std::wstring strFileInDir = NSSystemPath::GetDirectoryName(sSrcFileName);
|
||||
|
||||
NSBinPptxRW::CDrawingConverter oDrawingConverter;
|
||||
NSBinPptxRW::CDrawingConverter oDrawingConverter;
|
||||
|
||||
oDrawingConverter.SetDstPath(sDstPath + FILE_SEPARATOR_STR + L"xl");
|
||||
oDrawingConverter.SetSrcPath(strFileInDir, 2);
|
||||
|
||||
oDrawingConverter.SetMediaDstPath(sMediaDir);
|
||||
oDrawingConverter.SetMediaDstPath(sMediaDir);
|
||||
oDrawingConverter.SetEmbedDstPath(sEmbedDir);
|
||||
|
||||
BinXlsxRW::BinaryFileReader oBinaryFileReader;
|
||||
|
||||
@ -314,7 +314,7 @@
|
||||
17E17ED41AC453F800BEA2EA /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0900;
|
||||
LastUpgradeCheck = 0710;
|
||||
ORGANIZATIONNAME = "Ascensio System SIA";
|
||||
};
|
||||
buildConfigurationList = 17E17ED71AC453F800BEA2EA /* Build configuration list for PBXProject "ASCOfficeDocxFile2Lib" */;
|
||||
@ -402,7 +402,6 @@
|
||||
EXECUTABLE_PREFIX = lib;
|
||||
GCC_ENABLE_CPP_EXCEPTIONS = YES;
|
||||
GCC_ENABLE_CPP_RTTI = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
UNICODE,
|
||||
_UNICODE,
|
||||
@ -442,21 +441,13 @@
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
@ -464,7 +455,6 @@
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
@ -477,7 +467,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.10;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
@ -493,21 +483,13 @@
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
@ -515,14 +497,13 @@
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.10;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = macosx;
|
||||
|
||||
@ -154,7 +154,7 @@ namespace cpdoccore
|
||||
if (val)
|
||||
{
|
||||
std::wstring tmp = *val;
|
||||
tmp = XmlUtils::GetLower(tmp);
|
||||
XmlUtils::GetLower(tmp);
|
||||
return optional<bool>::Type((tmp == xml_char_value_type::trueVal));
|
||||
}
|
||||
else
|
||||
|
||||
@ -55,8 +55,8 @@ public:
|
||||
|
||||
void add_format(std::wstring const & condition, std::wstring const & format)
|
||||
{
|
||||
std::wstring c = XmlUtils::GetLower(condition);
|
||||
|
||||
std::wstring c = condition;
|
||||
XmlUtils::GetLower(c);
|
||||
XmlUtils::replace_all( c, L" ", L"");
|
||||
XmlUtils::replace_all( c, L"\t", L"");
|
||||
|
||||
|
||||
@ -70,22 +70,9 @@ public:
|
||||
std::wstring sVal;
|
||||
std::wstring sNode;
|
||||
};
|
||||
struct _reference
|
||||
{
|
||||
std::wstring name;
|
||||
int type = -1;
|
||||
std::wstring member_name;
|
||||
int member_type = -1;
|
||||
};
|
||||
struct _group
|
||||
{
|
||||
std::wstring name;
|
||||
std::vector<_field_value> caches;
|
||||
};
|
||||
struct _field
|
||||
{
|
||||
std::wstring name;
|
||||
std::wstring display_name;
|
||||
int type = -1;
|
||||
int hierarchy = -1;
|
||||
int function = -1;
|
||||
@ -93,20 +80,13 @@ public:
|
||||
bool data_layout = false;
|
||||
bool show_empty = false;
|
||||
bool repeat_item_labels = true;
|
||||
int type_groups = 0;
|
||||
int sort = 0;
|
||||
std::wstring source_groups;
|
||||
|
||||
std::vector<int> subtotals;
|
||||
|
||||
std::vector<_field_value> caches;
|
||||
std::vector<_reference> references;
|
||||
int references_field = -1;
|
||||
bool used_in_referenes = false;
|
||||
|
||||
int type_groups = 0;
|
||||
int base_group = -1;
|
||||
std::wstring source_groups;
|
||||
std::vector<_group> groups;
|
||||
std::vector<int> groups_discrete;
|
||||
|
||||
bool bDataFieldEnabled = false;
|
||||
bool bString = false;
|
||||
@ -162,10 +142,8 @@ public:
|
||||
|
||||
bool identify_categories = false;
|
||||
bool drill_enabled = true;
|
||||
bool ignore_empty_rows = false;
|
||||
|
||||
bool data_on_row = false;
|
||||
bool in_group = false;
|
||||
}current_;
|
||||
|
||||
void sort_fields();
|
||||
@ -281,162 +259,17 @@ xlsx_pivots_context::xlsx_pivots_context() : impl_(new xlsx_pivots_context::Impl
|
||||
}
|
||||
void xlsx_pivots_context::Impl::sort_fields()
|
||||
{
|
||||
size_t count_skip = 0;
|
||||
for (size_t i = 0; i < current_.fields.size() - count_skip; i++)
|
||||
for (size_t i = 0; i < current_.fields.size(); i++)
|
||||
{
|
||||
if (!current_.fields[i].source_groups.empty() && i != current_.fields.size() - count_skip)
|
||||
{
|
||||
current_.fields.push_back(current_.fields[i]);
|
||||
current_.fields.erase(current_.fields.begin() + i , current_.fields.begin() + i + 1);
|
||||
i--;
|
||||
count_skip++;
|
||||
}
|
||||
}
|
||||
count_skip = 0;
|
||||
for (size_t i = 0; i < current_.fields.size() - count_skip; i++)
|
||||
{
|
||||
if (current_.fields[i].name.empty() && i != current_.fields.size() - count_skip)
|
||||
{
|
||||
current_.fields.push_back(current_.fields[i]);
|
||||
current_.fields.erase(current_.fields.begin() + i , current_.fields.begin() + i + 1);
|
||||
i--;
|
||||
count_skip++;
|
||||
}
|
||||
}
|
||||
|
||||
bool bEmptyRowCache = false, bAddRepeateCol = false;
|
||||
bool bEmptyColCache = false, bAddRepeateRow = false;
|
||||
|
||||
int index_current = 0;
|
||||
for (size_t i = 0; i < current_.fields.size(); i++, index_current++)
|
||||
{
|
||||
if ( current_.fields[i].type_groups > 0 )
|
||||
{
|
||||
current_.fields[i].base_group = 0;
|
||||
|
||||
int index_group = 0;
|
||||
for (size_t k = 0; k < current_.fields.size(); k++)
|
||||
{
|
||||
if (current_.fields[k].type == 7) continue;
|
||||
if (current_.fields[k].name == current_.fields[i].source_groups && !current_.fields[i].source_groups.empty())
|
||||
{
|
||||
if (current_.fields[k].type_groups == 0)
|
||||
current_.fields[k].base_group = index_current; //опорный (если он и базовый - не писать)
|
||||
current_.fields[i].base_group = index_group;
|
||||
|
||||
for (size_t c = 0; !current_.fields[i].groups.empty() && c < current_.fields[k].caches.size(); c++)
|
||||
{
|
||||
for (size_t g = 0; g < current_.fields[i].groups.size(); g++)
|
||||
{
|
||||
for (size_t h = 0; h < current_.fields[i].groups[g].caches.size(); h++)
|
||||
{
|
||||
if (current_.fields[i].groups[g].caches[h].sVal == current_.fields[k].caches[c].sVal)
|
||||
current_.fields[i].groups_discrete.push_back(g);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
index_group++;
|
||||
}
|
||||
}
|
||||
if ( current_.fields[i].name.empty() &&
|
||||
!current_.fields[i].data_layout)
|
||||
if (current_.fields[i].type == 7)
|
||||
continue;
|
||||
|
||||
switch(current_.fields[i].type)
|
||||
if (!current_.fields[i].source_groups.empty() && i != current_.fields.size() -1)
|
||||
{
|
||||
case 0: // column
|
||||
{
|
||||
if (!current_.fields[i].name.empty())
|
||||
current_.col_fields.push_back(i);
|
||||
|
||||
if (current_.fields[i].data_layout)
|
||||
{
|
||||
if ((current_.fields[i].name.empty() && (!current_.identify_categories || current_.fields[i].hierarchy >= 0)) ||
|
||||
current_.fields[i].used_in_referenes )
|
||||
{
|
||||
if ((current_.col_fields.empty()) || (current_.col_fields.back() != -2))
|
||||
{
|
||||
bAddRepeateCol = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (current_.fields[i].caches.empty())
|
||||
bEmptyColCache = true;
|
||||
}break;
|
||||
case 1: // data
|
||||
{
|
||||
int index_field = -1;
|
||||
|
||||
for (size_t j = 0; j < i/*current_.fields.size()*/; j++)
|
||||
{
|
||||
if ( current_.fields[j].name == current_.fields[i].name )
|
||||
{
|
||||
current_.fields[j].bDataFieldEnabled = true;
|
||||
index_field = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (index_field >= 0)
|
||||
{
|
||||
if (current_.fields[i].caches.empty())
|
||||
{
|
||||
current_.fields[i].type = 7; //skip
|
||||
current_.fields_count--;
|
||||
index_current--;
|
||||
}
|
||||
|
||||
current_.fields[i].references_field = index_field;
|
||||
}
|
||||
|
||||
index_field = i;
|
||||
current_.fields[i].bDataFieldEnabled = true;
|
||||
current_.data_fields.push_back(index_field);
|
||||
}break;
|
||||
case 2: // hidden
|
||||
{
|
||||
}break;
|
||||
case 3: // page
|
||||
{
|
||||
current_.page_fields.push_back(i);
|
||||
}break;
|
||||
case 4: // row
|
||||
{
|
||||
if (!current_.fields[i].name.empty())
|
||||
current_.row_fields.push_back(i);
|
||||
|
||||
if (current_.fields[i].data_layout)
|
||||
{
|
||||
current_.data_on_row = true;
|
||||
|
||||
if ((current_.fields[i].name.empty() && (!current_.identify_categories || current_.fields[i].hierarchy >= 0)) ||
|
||||
current_.fields[i].used_in_referenes )
|
||||
{
|
||||
bAddRepeateRow = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (current_.fields[i].caches.empty())
|
||||
bEmptyRowCache = true;
|
||||
|
||||
}break;
|
||||
}
|
||||
|
||||
if (current_.fields[i].name.empty())
|
||||
{
|
||||
current_.fields.erase(current_.fields.begin() + i, current_.fields.begin() + i + 1);
|
||||
current_.fields_count--;
|
||||
current_.fields.push_back(current_.fields[i]);
|
||||
current_.fields.erase(current_.fields.begin() + i , current_.fields.begin() + i + 1);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
if (bAddRepeateCol || bEmptyColCache)
|
||||
current_.col_fields.push_back(-2);
|
||||
|
||||
if (bAddRepeateRow)
|
||||
current_.row_fields.push_back(-2);
|
||||
}
|
||||
void xlsx_pivots_context::Impl::serialize_view(std::wostream & strm)
|
||||
{
|
||||
@ -635,38 +468,22 @@ void xlsx_pivots_context::Impl::serialize_view(std::wostream & strm)
|
||||
}
|
||||
CP_XML_ATTR(L"defaultSubtotal", 0);
|
||||
|
||||
if (current_.fields[i].type != 2)
|
||||
if (!current_.fields[i].caches.empty() && current_.fields[i].type != 2)
|
||||
{
|
||||
if (!current_.fields[i].groups.empty())
|
||||
{
|
||||
CP_XML_NODE(L"items")
|
||||
{
|
||||
CP_XML_ATTR(L"count", current_.fields[i].groups.size());
|
||||
for (size_t j = 0; j < current_.fields[i].groups.size(); j++)
|
||||
{
|
||||
CP_XML_NODE(L"item")
|
||||
{
|
||||
CP_XML_ATTR(L"x", j);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!current_.fields[i].caches.empty())
|
||||
{
|
||||
CP_XML_NODE(L"items")
|
||||
{
|
||||
CP_XML_ATTR(L"count", current_.fields[i].caches.size());
|
||||
for (size_t j = 0; j < current_.fields[i].caches.size(); j++)
|
||||
{
|
||||
CP_XML_NODE(L"item")
|
||||
{
|
||||
CP_XML_ATTR(L"x", j);
|
||||
}
|
||||
CP_XML_NODE(L"items")
|
||||
{
|
||||
CP_XML_ATTR(L"count", current_.fields[i].caches.size());
|
||||
for (size_t j = 0; j < current_.fields[i].caches.size(); j++)
|
||||
{
|
||||
CP_XML_NODE(L"item")
|
||||
{
|
||||
CP_XML_ATTR(L"x", j);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//CP_XML_STREAM() << fields_[i].view_;
|
||||
}
|
||||
}
|
||||
if (!current_.row_fields.empty())
|
||||
@ -720,85 +537,35 @@ void xlsx_pivots_context::Impl::serialize_view(std::wostream & strm)
|
||||
CP_XML_ATTR(L"count", current_.data_fields.size());
|
||||
for (size_t i = 0; i < current_.data_fields.size(); i++)
|
||||
{
|
||||
int ind_field_dirty = current_.data_fields[i];
|
||||
|
||||
CP_XML_NODE(L"dataField")
|
||||
{
|
||||
int fld = 0, ind_fld = current_.fields[ind_field_dirty].references_field < 0 ? ind_field_dirty :
|
||||
current_.fields[ind_field_dirty].references_field;
|
||||
for (size_t k = 0; k < ind_fld; k++)
|
||||
{
|
||||
if (current_.fields[k].type != 7 ) fld++;
|
||||
}
|
||||
|
||||
CP_XML_ATTR(L"fld", fld);
|
||||
if (current_.fields[ind_field_dirty].references.empty())
|
||||
{
|
||||
CP_XML_ATTR(L"baseField", fld);
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t base_field = 0, base_item = 0;
|
||||
for (size_t k = 0; k < current_.fields.size(); k++)
|
||||
{
|
||||
if (current_.fields[k].type == 7 ) continue;
|
||||
{
|
||||
CP_XML_ATTR(L"fld", current_.data_fields[i]);
|
||||
CP_XML_ATTR(L"baseField", current_.data_fields[i]);
|
||||
//CP_XML_ATTR(L"baseItem", -1);
|
||||
//CP_XML_ATTR(L"name", L"");
|
||||
|
||||
if (current_.fields[k].name == current_.fields[ind_field_dirty].references[0].name)
|
||||
{
|
||||
for (size_t j = 0; j < current_.fields[k].caches.size(); j++)
|
||||
{
|
||||
if (current_.fields[k].caches[j].sVal == current_.fields[ind_field_dirty].references[0].member_name)
|
||||
{
|
||||
base_item = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
base_field++;
|
||||
}
|
||||
CP_XML_ATTR(L"baseField", base_field);
|
||||
CP_XML_ATTR(L"baseItem", base_item);
|
||||
|
||||
switch(current_.fields[ind_field_dirty].references[0].type)
|
||||
{
|
||||
case 1: CP_XML_ATTR(L"showDataAs", L"difference"); break;
|
||||
case 2: CP_XML_ATTR(L"showDataAs", L"percent"); break;
|
||||
case 3: CP_XML_ATTR(L"showDataAs", L"percentDiff"); break;
|
||||
}
|
||||
}
|
||||
std::wstring name;
|
||||
|
||||
if (ind_field_dirty >= 0 && ind_field_dirty < current_.fields.size())
|
||||
int ind_field = current_.data_fields[i];
|
||||
if (ind_field >= 0 && ind_field < current_.fields.size())
|
||||
{
|
||||
switch(current_.fields[ind_field_dirty].function)
|
||||
switch(current_.fields[ind_field].function)
|
||||
{
|
||||
case 1: CP_XML_ATTR(L"subtotal", L"average"); name = L"average "; break;
|
||||
case 2: CP_XML_ATTR(L"subtotal", L"count"); name = L"count "; break;
|
||||
case 3: CP_XML_ATTR(L"subtotal", L"countNums"); name = L"countNums "; break;
|
||||
case 4: CP_XML_ATTR(L"subtotal", L"max"); name = L"max "; break;
|
||||
case 5: CP_XML_ATTR(L"subtotal", L"min"); name = L"min "; break;
|
||||
case 6: CP_XML_ATTR(L"subtotal", L"product"); name = L"product "; break;
|
||||
case 7: CP_XML_ATTR(L"subtotal", L"stdDev"); name = L"stdDev Dev "; break;
|
||||
case 8: CP_XML_ATTR(L"subtotal", L"stdDevp"); name = L"stdDevp "; break;
|
||||
case 9: CP_XML_ATTR(L"subtotal", L"sum"); name = L"sum by "; break;
|
||||
case 10: CP_XML_ATTR(L"subtotal", L"var"); name = L"var "; break;
|
||||
case 11: CP_XML_ATTR(L"subtotal", L"varp"); name = L"varp "; break;
|
||||
case 1: CP_XML_ATTR(L"subtotal", L"average"); break;
|
||||
case 2: CP_XML_ATTR(L"subtotal", L"count"); break;
|
||||
case 3: CP_XML_ATTR(L"subtotal", L"countNums"); break;
|
||||
case 4: CP_XML_ATTR(L"subtotal", L"max"); break;
|
||||
case 5: CP_XML_ATTR(L"subtotal", L"min"); break;
|
||||
case 6: CP_XML_ATTR(L"subtotal", L"product"); break;
|
||||
case 7: CP_XML_ATTR(L"subtotal", L"stdDev"); break;
|
||||
case 8: CP_XML_ATTR(L"subtotal", L"stdDevp"); break;
|
||||
case 9: CP_XML_ATTR(L"subtotal", L"sum"); break;
|
||||
case 10: CP_XML_ATTR(L"subtotal", L"var"); break;
|
||||
case 11: CP_XML_ATTR(L"subtotal", L"varp"); break;
|
||||
case 12:
|
||||
{
|
||||
CP_XML_ATTR(L"subtotal", current_.fields[current_.data_fields[i]].user_function);
|
||||
}break;
|
||||
default: break;
|
||||
}
|
||||
if (current_.fields[ind_field_dirty].display_name.empty())
|
||||
{
|
||||
name += current_.fields[ind_field_dirty].name;
|
||||
}
|
||||
else
|
||||
{
|
||||
name = current_.fields[ind_field_dirty].display_name;
|
||||
}
|
||||
CP_XML_ATTR(L"name", name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -941,7 +708,6 @@ void xlsx_pivots_context::Impl::serialize_cache(std::wostream & strm)
|
||||
}
|
||||
}
|
||||
}
|
||||
int index_current = 0;
|
||||
|
||||
if (current_.fields.empty() == false)
|
||||
{
|
||||
@ -978,12 +744,11 @@ void xlsx_pivots_context::Impl::serialize_cache(std::wostream & strm)
|
||||
{
|
||||
CP_XML_ATTR(L"count", current_.fields[i].caches.size());
|
||||
}
|
||||
else if (current_.fields[i].type_groups < 8)
|
||||
{//group by date
|
||||
else
|
||||
{
|
||||
current_.fields[i].bDate = true;
|
||||
current_.fields[i].bString = false;
|
||||
}
|
||||
//else group by fields
|
||||
|
||||
serialize_type_field(CP_GET_XML_NODE(), current_.fields[i]);
|
||||
if ( current_.fields[i].type_groups == 0 )
|
||||
@ -1001,78 +766,37 @@ void xlsx_pivots_context::Impl::serialize_cache(std::wostream & strm)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (current_.fields[i].base_group >= 0)
|
||||
if ( current_.fields[i].type_groups != 0 )
|
||||
{
|
||||
CP_XML_NODE(L"fieldGroup")
|
||||
{
|
||||
if ( current_.fields[i].type_groups > 0)
|
||||
{
|
||||
CP_XML_ATTR(L"base", 0);
|
||||
CP_XML_NODE(L"rangePr")
|
||||
{
|
||||
CP_XML_ATTR(L"base", current_.fields[i].base_group);
|
||||
}
|
||||
else
|
||||
{
|
||||
CP_XML_ATTR(L"par", current_.fields[i].base_group);
|
||||
}
|
||||
if (current_.fields[i].type_groups > 0)
|
||||
{
|
||||
if (current_.fields[i].type_groups < 8)
|
||||
switch(current_.fields[i].type_groups)
|
||||
{
|
||||
CP_XML_NODE(L"rangePr")
|
||||
{
|
||||
switch(current_.fields[i].type_groups)
|
||||
{
|
||||
case 1: CP_XML_ATTR(L"groupBy", L"seconds"); break;
|
||||
case 2: CP_XML_ATTR(L"groupBy", L"minutes"); break;
|
||||
case 3: CP_XML_ATTR(L"groupBy", L"hours"); break;
|
||||
case 4: CP_XML_ATTR(L"groupBy", L"days"); break;
|
||||
case 5: CP_XML_ATTR(L"groupBy", L"months"); break;
|
||||
case 6: CP_XML_ATTR(L"groupBy", L"quarters"); break;
|
||||
case 7: CP_XML_ATTR(L"groupBy", L"years"); break;
|
||||
}
|
||||
CP_XML_ATTR(L"startDate", L"1899-12-31T00:00:00");
|
||||
CP_XML_ATTR(L"endDate", L"1899-12-31T00:00:00");
|
||||
}
|
||||
case 1: CP_XML_ATTR(L"groupBy", L"seconds"); break;
|
||||
case 2: CP_XML_ATTR(L"groupBy", L"minutes"); break;
|
||||
case 3: CP_XML_ATTR(L"groupBy", L"hours"); break;
|
||||
case 4: CP_XML_ATTR(L"groupBy", L"days"); break;
|
||||
case 5: CP_XML_ATTR(L"groupBy", L"months"); break;
|
||||
case 6: CP_XML_ATTR(L"groupBy", L"quarters"); break;
|
||||
case 7: CP_XML_ATTR(L"groupBy", L"years"); break;
|
||||
}
|
||||
if (!current_.fields[i].groups_discrete.empty())
|
||||
CP_XML_ATTR(L"startDate", L"1899-12-31T00:00:00");
|
||||
CP_XML_ATTR(L"endDate", L"1899-12-31T00:00:00");
|
||||
}
|
||||
CP_XML_NODE(L"groupItems")
|
||||
{
|
||||
CP_XML_ATTR(L"count", current_.fields[i].caches.size());
|
||||
|
||||
for (size_t j = 0; j < current_.fields[i].caches.size(); j++)
|
||||
{
|
||||
CP_XML_NODE(L"discretePr")
|
||||
CP_XML_NODE(current_.fields[i].caches[j].sNode)
|
||||
{
|
||||
CP_XML_ATTR(L"count", current_.fields[i].groups_discrete.size());
|
||||
for (size_t j = 0; j < current_.fields[i].groups_discrete.size(); j++)
|
||||
if (current_.fields[i].caches[j].sVal.empty() == false)
|
||||
{
|
||||
CP_XML_NODE(L"x")
|
||||
{
|
||||
CP_XML_ATTR(L"v", current_.fields[i].groups_discrete[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(L"groupItems")
|
||||
{
|
||||
if (!current_.fields[i].groups.empty())
|
||||
{
|
||||
CP_XML_ATTR(L"count", current_.fields[i].groups.size());
|
||||
for (size_t j = 0; j < current_.fields[i].groups.size(); j++)
|
||||
{
|
||||
CP_XML_NODE(L"s")
|
||||
{
|
||||
CP_XML_ATTR(L"v", current_.fields[i].groups[j].name);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CP_XML_ATTR(L"count", current_.fields[i].caches.size());
|
||||
|
||||
for (size_t j = 0; j < current_.fields[i].caches.size(); j++)
|
||||
{
|
||||
CP_XML_NODE(current_.fields[i].caches[j].sNode)
|
||||
{
|
||||
if (current_.fields[i].caches[j].sVal.empty() == false)
|
||||
{
|
||||
CP_XML_ATTR(L"v", current_.fields[i].caches[j].sVal);
|
||||
}
|
||||
}
|
||||
CP_XML_ATTR(L"v", current_.fields[i].caches[j].sVal);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1080,8 +804,6 @@ void xlsx_pivots_context::Impl::serialize_cache(std::wostream & strm)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
index_current++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1218,10 +940,6 @@ void xlsx_pivots_context::set_identify_categories(bool val)
|
||||
{
|
||||
impl_->current_.identify_categories = val;
|
||||
}
|
||||
void xlsx_pivots_context::set_ignore_empty_rows(bool val)
|
||||
{
|
||||
impl_->current_.ignore_empty_rows = val;
|
||||
}
|
||||
void xlsx_pivots_context::set_drill(bool val)
|
||||
{
|
||||
impl_->current_.drill_enabled = val;
|
||||
@ -1237,86 +955,75 @@ void xlsx_pivots_context::set_field_name(std::wstring name)
|
||||
{
|
||||
impl_->current_.fields.back().name = name;
|
||||
}
|
||||
void xlsx_pivots_context::set_field_display(std::wstring name)
|
||||
{
|
||||
impl_->current_.fields.back().display_name = name;
|
||||
}
|
||||
void xlsx_pivots_context::set_field_type(int type, int hierarchy)
|
||||
{
|
||||
impl_->current_.fields.back().type = type;
|
||||
impl_->current_.fields.back().hierarchy = hierarchy;
|
||||
|
||||
//if ( impl_->current_.fields.back().name.empty() &&
|
||||
// !impl_->current_.fields.back().data_layout)
|
||||
// return;
|
||||
if ( impl_->current_.fields.back().name.empty() &&
|
||||
!impl_->current_.fields.back().data_layout)
|
||||
return;
|
||||
|
||||
//switch(type)
|
||||
//{
|
||||
// case 0: // column
|
||||
// {
|
||||
// if (impl_->current_.fields.back().data_layout)
|
||||
// {
|
||||
// if (impl_->current_.fields.back().name.empty() && (!impl_->current_.identify_categories || hierarchy >= 0))
|
||||
// //impl_->current_.fields.back().repeat_item_labels )) //????
|
||||
// impl_->current_.col_fields.push_back(-2);
|
||||
// }
|
||||
// else
|
||||
// impl_->current_.col_fields.push_back(impl_->current_.fields.size() - 1);
|
||||
// }break;
|
||||
// case 1: // data
|
||||
// {
|
||||
// int index_field = -1;
|
||||
//
|
||||
// for (size_t i = 0; i < impl_->current_.fields.size() - 1; i++)
|
||||
// {
|
||||
// if (impl_->current_.fields[i].name == impl_->current_.fields.back().name &&
|
||||
// (impl_->current_.fields[i].type != 1 || !impl_->current_.fields.back().references.empty()))
|
||||
// {
|
||||
// impl_->current_.fields[i].bDataFieldEnabled = true;
|
||||
// index_field = i;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// if (index_field >= 0)
|
||||
// {
|
||||
// impl_->current_.fields.back().type = 7; //skip
|
||||
// impl_->current_.fields_count--;
|
||||
//
|
||||
// if (!impl_->current_.fields.back().references.empty())
|
||||
// {
|
||||
// impl_->current_.fields.back().references_field = index_field;
|
||||
// impl_->current_.fields.back().bDataFieldEnabled = true;
|
||||
//
|
||||
// index_field = impl_->current_.fields.size() - 1;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// index_field = impl_->current_.fields.size() - 1;
|
||||
// impl_->current_.fields.back().bDataFieldEnabled = true;
|
||||
// }
|
||||
// impl_->current_.data_fields.push_back(index_field);
|
||||
// }break;
|
||||
// case 2: // hidden
|
||||
// break;
|
||||
// case 3: // page
|
||||
// impl_->current_.page_fields.push_back(impl_->current_.fields.size() - 1);
|
||||
// break;
|
||||
// case 4: // row
|
||||
// if (impl_->current_.fields.back().data_layout)
|
||||
// {
|
||||
// impl_->current_.data_on_row = true;
|
||||
switch(type)
|
||||
{
|
||||
case 0: // column
|
||||
{
|
||||
if (impl_->current_.fields.back().data_layout)
|
||||
{
|
||||
if (impl_->current_.fields.back().name.empty() && (!impl_->current_.identify_categories || hierarchy >= 0))
|
||||
//impl_->current_.fields.back().repeat_item_labels )) //????
|
||||
impl_->current_.col_fields.push_back(-2);
|
||||
}
|
||||
else
|
||||
impl_->current_.col_fields.push_back(impl_->current_.fields.size() - 1);
|
||||
}break;
|
||||
case 1: // data
|
||||
{
|
||||
int index_field = -1;
|
||||
|
||||
for (size_t i = 0; i < impl_->current_.fields.size(); i++)
|
||||
{
|
||||
if (impl_->current_.fields[i].name == impl_->current_.fields.back().name &&
|
||||
impl_->current_.fields[i].type != 1)
|
||||
{
|
||||
impl_->current_.fields[i].bDataFieldEnabled = true;
|
||||
index_field = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (index_field >= 0)
|
||||
{
|
||||
impl_->current_.fields.back().type = 7;
|
||||
impl_->current_.fields_count--;
|
||||
impl_->current_.data_fields.push_back(index_field);
|
||||
}
|
||||
else
|
||||
{
|
||||
index_field = impl_->current_.fields.size() - 1;
|
||||
impl_->current_.fields.back().bDataFieldEnabled = true;
|
||||
impl_->current_.data_fields.push_back(index_field);
|
||||
}
|
||||
}break;
|
||||
case 2: // hidden
|
||||
break;
|
||||
case 3: // page
|
||||
impl_->current_.page_fields.push_back(impl_->current_.fields.size() - 1);
|
||||
break;
|
||||
case 4: // row
|
||||
if (impl_->current_.fields.back().data_layout)
|
||||
{
|
||||
impl_->current_.data_on_row = true;
|
||||
|
||||
// if (impl_->current_.fields.back().name.empty() && (!impl_->current_.identify_categories || hierarchy >= 0))
|
||||
// //(impl_->current_.fields.back().repeat_item_labels ||
|
||||
// // !impl_->current_.identify_categories ))
|
||||
// impl_->current_.row_fields.push_back(-2);
|
||||
if (impl_->current_.fields.back().name.empty() && (!impl_->current_.identify_categories || hierarchy >= 0))
|
||||
//(impl_->current_.fields.back().repeat_item_labels ||
|
||||
// !impl_->current_.identify_categories ))
|
||||
impl_->current_.row_fields.push_back(-2);
|
||||
|
||||
// }
|
||||
// else
|
||||
// impl_->current_.row_fields.push_back(impl_->current_.fields.size() - 1);
|
||||
// break;
|
||||
//}
|
||||
}
|
||||
else
|
||||
impl_->current_.row_fields.push_back(impl_->current_.fields.size() - 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
void xlsx_pivots_context::set_field_function(int type)
|
||||
{
|
||||
@ -1351,56 +1058,10 @@ void xlsx_pivots_context::set_field_groups_source(std::wstring name)
|
||||
{
|
||||
impl_->current_.fields.back().source_groups = name;
|
||||
}
|
||||
void xlsx_pivots_context::start_field_group()
|
||||
{
|
||||
impl_->current_.in_group = true;
|
||||
Impl::_group group;
|
||||
impl_->current_.fields.back().groups.push_back(group);
|
||||
}
|
||||
void xlsx_pivots_context::set_field_group_name (std::wstring name)
|
||||
{
|
||||
impl_->current_.fields.back().groups.back().name = name;
|
||||
}
|
||||
void xlsx_pivots_context::end_field_group()
|
||||
{
|
||||
impl_->current_.in_group = false;
|
||||
}
|
||||
void xlsx_pivots_context::set_field_sort(int type)
|
||||
{
|
||||
impl_->current_.fields.back().sort = type + 1;
|
||||
}
|
||||
void xlsx_pivots_context::start_field_reference()
|
||||
{
|
||||
Impl::_reference ref;
|
||||
impl_->current_.fields.back().references.push_back(ref);
|
||||
}
|
||||
void xlsx_pivots_context::end_field_reference()
|
||||
{
|
||||
}
|
||||
void xlsx_pivots_context::set_field_ref_name(std::wstring name)
|
||||
{
|
||||
impl_->current_.fields.back().references.back().name = name;
|
||||
|
||||
for (size_t i = 0; i < impl_->current_.fields.size(); i++)
|
||||
{
|
||||
if (impl_->current_.fields[i].name == name)
|
||||
{
|
||||
impl_->current_.fields[i].used_in_referenes = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
void xlsx_pivots_context::set_field_ref_type (int type)
|
||||
{
|
||||
impl_->current_.fields.back().references.back().type = type;
|
||||
}
|
||||
void xlsx_pivots_context::set_field_ref_member_name(std::wstring name)
|
||||
{
|
||||
impl_->current_.fields.back().references.back().member_name = name;
|
||||
}
|
||||
void xlsx_pivots_context::set_field_ref_member_type(int type)
|
||||
{
|
||||
impl_->current_.fields.back().references.back().member_type = type;
|
||||
}
|
||||
void xlsx_pivots_context::add_field_cache(int index, std::wstring value)
|
||||
{
|
||||
if (index < 0)
|
||||
@ -1470,20 +1131,14 @@ void xlsx_pivots_context::add_field_cache(int index, std::wstring value)
|
||||
}
|
||||
}
|
||||
impl_->current_.fields.back().caches.push_back(Impl::_field_value(value, node_name));
|
||||
|
||||
if (impl_->current_.in_group)
|
||||
{
|
||||
impl_->current_.fields.back().groups.back().caches.push_back(impl_->current_.fields.back().caches.back());
|
||||
}
|
||||
|
||||
}
|
||||
void xlsx_pivots_context::end_field()
|
||||
{
|
||||
//if (impl_->current_.fields.back().name.empty())
|
||||
//{
|
||||
// impl_->current_.fields_count--;
|
||||
// impl_->current_.fields.pop_back();
|
||||
//}
|
||||
if (impl_->current_.fields.back().name.empty())
|
||||
{
|
||||
impl_->current_.fields_count--;
|
||||
impl_->current_.fields.pop_back();
|
||||
}
|
||||
}
|
||||
void xlsx_pivots_context::set_source_range(std::wstring table_name, std::wstring ref)
|
||||
{
|
||||
|
||||
@ -51,7 +51,6 @@ public:
|
||||
|
||||
void start_field ();
|
||||
void set_field_name (std::wstring name);
|
||||
void set_field_display (std::wstring name);
|
||||
void set_field_type (int type, int hierarchy);
|
||||
void set_field_function (int type);
|
||||
void set_field_user_function (std::wstring f);
|
||||
@ -60,22 +59,9 @@ public:
|
||||
void set_field_show_empty (bool val);
|
||||
void set_field_data_layout (bool val);
|
||||
void set_field_sort (int type);
|
||||
void set_repeat_item_labels(bool val);
|
||||
|
||||
void set_field_groups (int type);
|
||||
void set_field_groups_source(std::wstring name);
|
||||
|
||||
void start_field_group();
|
||||
void set_field_group_name (std::wstring name);
|
||||
void end_field_group();
|
||||
|
||||
void start_field_reference();
|
||||
void set_field_ref_name(std::wstring name);
|
||||
void set_field_ref_type (int type);
|
||||
void set_field_ref_member_name(std::wstring name);
|
||||
void set_field_ref_member_type(int type);
|
||||
void end_field_reference();
|
||||
|
||||
void set_repeat_item_labels(bool val);
|
||||
void end_field();
|
||||
|
||||
int get_count();
|
||||
@ -87,7 +73,6 @@ public:
|
||||
void add_button_header(std::wstring ref);
|
||||
|
||||
void set_identify_categories(bool val);
|
||||
void set_ignore_empty_rows(bool val);
|
||||
void set_drill(bool val);
|
||||
|
||||
void set_source_range(std::wstring table_name, std::wstring ref);
|
||||
@ -113,6 +98,7 @@ public:
|
||||
private:
|
||||
class Impl;
|
||||
_CP_PTR(Impl) impl_;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@ -46,7 +46,8 @@ std::wostream & operator << (std::wostream & _Wostream, const Bool & _Val)
|
||||
}
|
||||
Bool Bool::parse(const std::wstring & Str)
|
||||
{
|
||||
std::wstring tmp = XmlUtils::GetLower(Str);
|
||||
std::wstring tmp = Str;
|
||||
XmlUtils::GetLower(tmp);
|
||||
|
||||
if (tmp == L"0" || tmp == L"false") return Bool(false);
|
||||
else return Bool(true);
|
||||
|
||||
@ -104,7 +104,8 @@ void styles_container::add_style( const std::wstring & Name,
|
||||
map_[n] = pos;
|
||||
|
||||
// TODO: как правильно??
|
||||
std::wstring lName = XmlUtils::GetLower(Name);
|
||||
std::wstring lName = Name;
|
||||
XmlUtils::GetLower(lName);
|
||||
//if ( boost::algorithm::contains(lName, L"internet_20_link") )
|
||||
if (lName == L"internet_20_link")///???????????????
|
||||
hyperlink_style_pos_ = pos;
|
||||
|
||||
@ -123,9 +123,6 @@ void table_data_pilot_table::xlsx_convert(oox::xlsx_conversion_context & Context
|
||||
if (table_identify_categories_)
|
||||
Context.get_pivots_context().set_identify_categories(table_identify_categories_->get());
|
||||
|
||||
if (table_ignore_empty_rows_)
|
||||
Context.get_pivots_context().set_ignore_empty_rows(table_ignore_empty_rows_->get());
|
||||
|
||||
if (table_drill_down_ondouble_click_)
|
||||
Context.get_pivots_context().set_drill(table_drill_down_ondouble_click_->get());
|
||||
|
||||
@ -158,7 +155,6 @@ void table_data_pilot_field::add_attributes( const xml::attributes_wc_ptr & Attr
|
||||
CP_APPLY_ATTR(L"loext:ignore-selected-page" , loext_ignore_selected_page_);
|
||||
CP_APPLY_ATTR(L"table:selected-page" , table_selected_page_);
|
||||
CP_APPLY_ATTR(L"table:is-data-layout-field" , table_is_data_layout_field_);
|
||||
CP_APPLY_ATTR(L"tableooo:display-name" , table_display_name_);
|
||||
}
|
||||
|
||||
void table_data_pilot_field::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
@ -179,9 +175,6 @@ void table_data_pilot_field::xlsx_convert(oox::xlsx_conversion_context & Context
|
||||
|
||||
Context.get_pivots_context().set_field_name(table_source_field_name_.get_value_or(L""));
|
||||
|
||||
if (table_display_name_)
|
||||
Context.get_pivots_context().set_field_display(*table_display_name_);
|
||||
|
||||
if (table_is_data_layout_field_)
|
||||
Context.get_pivots_context().set_field_data_layout(table_is_data_layout_field_->get());
|
||||
|
||||
@ -224,24 +217,7 @@ void table_data_pilot_field_reference::add_attributes( const xml::attributes_wc_
|
||||
|
||||
void table_data_pilot_field_reference::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
Context.get_pivots_context().start_field_reference();
|
||||
if (table_field_name_)
|
||||
{
|
||||
Context.get_pivots_context().set_field_ref_name(*table_field_name_);
|
||||
}
|
||||
if (table_type_)
|
||||
{
|
||||
Context.get_pivots_context().set_field_ref_type(table_type_->get_type());
|
||||
}
|
||||
if (table_member_name_)
|
||||
{
|
||||
Context.get_pivots_context().set_field_ref_member_name(*table_member_name_);
|
||||
}
|
||||
if (table_member_type_)
|
||||
{
|
||||
Context.get_pivots_context().set_field_ref_member_type(table_member_type_->get_type());
|
||||
}
|
||||
Context.get_pivots_context().end_field_reference();
|
||||
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
const wchar_t * table_database_source_table::ns = L"table";
|
||||
@ -429,8 +405,6 @@ void table_data_pilot_groups::xlsx_convert(oox::xlsx_conversion_context & Contex
|
||||
{
|
||||
if (table_grouped_by_)
|
||||
Context.get_pivots_context().set_field_groups(table_grouped_by_->get_type());
|
||||
else
|
||||
Context.get_pivots_context().set_field_groups(7);
|
||||
|
||||
if (table_source_field_name_)
|
||||
Context.get_pivots_context().set_field_groups_source(*table_source_field_name_);
|
||||
@ -455,16 +429,10 @@ void table_data_pilot_group::add_child_element( xml::sax * Reader, const std::ws
|
||||
}
|
||||
void table_data_pilot_group::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
Context.get_pivots_context().start_field_group();
|
||||
|
||||
if (table_name_)
|
||||
Context.get_pivots_context().set_field_group_name (*table_name_);
|
||||
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
content_[i]->xlsx_convert(Context);
|
||||
}
|
||||
Context.get_pivots_context().end_field_group();
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
const wchar_t * table_data_pilot_members::ns = L"table";
|
||||
@ -502,12 +470,12 @@ const wchar_t * table_data_pilot_group_member::name = L"data-pilot-group-member"
|
||||
|
||||
void table_data_pilot_group_member::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
CP_APPLY_ATTR(L"table:name", table_name_);
|
||||
CP_APPLY_ATTR(L"table:name", table_name_);
|
||||
}
|
||||
|
||||
void table_data_pilot_group_member::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
Context.get_pivots_context().add_field_cache(-1, table_name_.get_value_or(L""));
|
||||
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
const wchar_t * table_data_pilot_subtotals::ns = L"table";
|
||||
|
||||
@ -130,7 +130,6 @@ public:
|
||||
_CP_OPT(odf_types::Bool) loext_ignore_selected_page_;
|
||||
_CP_OPT(std::wstring) table_selected_page_;
|
||||
_CP_OPT(odf_types::Bool) table_is_data_layout_field_;
|
||||
_CP_OPT(std::wstring) table_display_name_;
|
||||
|
||||
office_element_ptr reference_;
|
||||
office_element_ptr level_;
|
||||
|
||||
@ -1922,7 +1922,7 @@
|
||||
17063B5B1AC5708E0056A3F1 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0900;
|
||||
LastUpgradeCheck = 0730;
|
||||
ORGANIZATIONNAME = "Ascensio System SIA";
|
||||
};
|
||||
buildConfigurationList = 17063B5E1AC5708E0056A3F1 /* Build configuration list for PBXProject "PPTXFormatLib" */;
|
||||
@ -2004,21 +2004,13 @@
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
@ -2026,7 +2018,6 @@
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
@ -2039,7 +2030,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.10;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
@ -2055,21 +2046,13 @@
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
@ -2077,14 +2060,13 @@
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.10;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = macosx;
|
||||
|
||||
@ -394,7 +394,7 @@
|
||||
6967B1211E27B44D00A129E2 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0900;
|
||||
LastUpgradeCheck = 0820;
|
||||
ORGANIZATIONNAME = OnlyOffce;
|
||||
TargetAttributes = {
|
||||
6967B1281E27B44D00A129E2 = {
|
||||
@ -468,9 +468,7 @@
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
@ -478,11 +476,7 @@
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
@ -505,7 +499,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.2;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
@ -521,9 +515,7 @@
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
@ -531,11 +523,7 @@
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
@ -552,7 +540,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.2;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
|
||||
@ -148,7 +148,7 @@
|
||||
6967AFB71E2798B900A129E2 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0900;
|
||||
LastUpgradeCheck = 0820;
|
||||
ORGANIZATIONNAME = OnlyOffce;
|
||||
TargetAttributes = {
|
||||
6967AFBE1E2798B900A129E2 = {
|
||||
@ -202,9 +202,7 @@
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
@ -212,11 +210,7 @@
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
@ -239,7 +233,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
@ -255,9 +249,7 @@
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
@ -265,11 +257,7 @@
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
@ -286,7 +274,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.2;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
|
||||
@ -514,31 +514,49 @@ const std::wstring tab2sheet_name(const short tabid, std::vector<std::wstring>&
|
||||
return L"#REF";
|
||||
}
|
||||
|
||||
const std::wstring xti_indexes2sheet_name(const short tabFirst, const short tabLast, std::vector<std::wstring>& names, const std::wstring prefix)
|
||||
//
|
||||
const std::wstring xti2sheets(const unsigned short ixti, std::vector<std::wstring>& xti_parsed)
|
||||
{
|
||||
if(-1 == tabFirst)
|
||||
if(ixti >= 0 && static_cast<unsigned short>(ixti) < xti_parsed.size())
|
||||
{
|
||||
return xti_parsed[ixti];
|
||||
}
|
||||
return L"#REF!";
|
||||
}
|
||||
//
|
||||
const std::wstring xti_indexes2sheet_name(const short itabFirst, const short itabLast, std::vector<std::wstring>& sheets_names)
|
||||
{
|
||||
if(-1 == itabFirst)
|
||||
{
|
||||
return L"#REF";
|
||||
}
|
||||
static boost::wregex correct_sheet_name(L"^\\'.+?\\'$");
|
||||
static boost::wregex test_sheet_name(L"[\\s)(\\'&:-]+"); //.??? 6442946.xls
|
||||
|
||||
std::wstring sheet_first = prefix + tab2sheet_name(tabFirst, names);
|
||||
static boost::wregex test_sheet_name(L"[\\s)(\\':.-]+");
|
||||
|
||||
std::wstring sheet_first = tab2sheet_name(itabFirst, sheets_names);
|
||||
if(!boost::regex_search(sheet_first.begin(), sheet_first.end(), correct_sheet_name))
|
||||
{
|
||||
if(boost::regex_search(sheet_first.begin(), sheet_first.end(), test_sheet_name))
|
||||
{
|
||||
sheet_first = boost::algorithm::replace_all_copy(sheet_first, L"'", L"''");
|
||||
sheet_first = std::wstring(L"'") + sheet_first + std::wstring(L"'");
|
||||
sheet_first = std::wstring(L"\'") + sheet_first + std::wstring(L"\'");
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
//todooo найти хоть один файл где в апострофах уже есть внутренний не экранированный апостроф
|
||||
//static boost::wregex test_sheet_name1(L"[\']+");
|
||||
//if(boost::regex_search(sheet_first.begin() + 1, sheet_first.end() - 1, test_sheet_name1))
|
||||
//{
|
||||
// sheet_first = boost::algorithm::replace_all_copy(sheet_first.begin()+1, sheet_first.end() - 1 , L"'", L"''");
|
||||
// sheet_first = std::wstring(L"\'") + sheet_first + std::wstring(L"\'");
|
||||
//}
|
||||
}
|
||||
|
||||
std::wstring sheet_last;
|
||||
if (tabLast != tabFirst)
|
||||
if (itabLast != itabFirst)
|
||||
{
|
||||
sheet_last = prefix + tab2sheet_name(tabLast, names);
|
||||
sheet_last = tab2sheet_name(itabLast, sheets_names);
|
||||
|
||||
if(!boost::regex_search(sheet_last.begin(), sheet_last.end(), correct_sheet_name))
|
||||
{
|
||||
@ -554,6 +572,20 @@ const std::wstring xti_indexes2sheet_name(const short tabFirst, const short tabL
|
||||
return sheet_first + sheet_last;
|
||||
}
|
||||
|
||||
const std::wstring make3dRef(const unsigned short ixti, const std::wstring cell_ref, std::vector<std::wstring>& xti_parsed, bool full_ref)
|
||||
{
|
||||
std::wstring sheets_prefix = xti2sheets(ixti, xti_parsed);
|
||||
|
||||
if(L"#REF!" == sheets_prefix)
|
||||
{
|
||||
return sheets_prefix;
|
||||
}
|
||||
else if (!sheets_prefix.empty()) sheets_prefix += L"!";
|
||||
else if (sheets_prefix.empty() && full_ref) sheets_prefix += L"#REF!";
|
||||
|
||||
return sheets_prefix + cell_ref;
|
||||
}
|
||||
|
||||
|
||||
} //namespace XMLSTUFF
|
||||
|
||||
|
||||
@ -95,7 +95,13 @@ namespace STR
|
||||
namespace XMLSTUFF
|
||||
{;
|
||||
|
||||
const std::wstring xti_indexes2sheet_name(const short tabFirst, const short tabLast, std::vector<std::wstring>& names, const std::wstring prefix = L"");
|
||||
// Makes a new tag and append it to parent (no attributes set)
|
||||
//BiffStructurePtr createElement(const std::wstring & tag_name, BiffStructurePtr & parent);
|
||||
|
||||
const std::wstring make3dRef(const unsigned short ixti, const std::wstring cell_ref, std::vector<std::wstring>& xti_parsed, bool full_ref = false);
|
||||
//const unsigned short sheetsnames2ixti(const std::wstring str, MSXML2::IXMLDOMDocumentPtr doc);
|
||||
|
||||
const std::wstring xti_indexes2sheet_name(const short itabFirst, const short itabLast, std::vector<std::wstring>& sheets_names);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -245,7 +245,7 @@ const bool CFRecord::isEOF() const
|
||||
{
|
||||
if(rdPtr > size_)
|
||||
{
|
||||
true;//throw;
|
||||
throw;// EXCEPT::LE::WrongFormatInterpretation(__FUNCTION__);
|
||||
}
|
||||
return rdPtr >= size_;
|
||||
}
|
||||
|
||||
@ -32,12 +32,14 @@
|
||||
#pragma once
|
||||
|
||||
#include "BiffRecord.h"
|
||||
|
||||
#include "../Biff_structures/BookExt_Conditional11.h"
|
||||
#include "../Biff_structures/BookExt_Conditional12.h"
|
||||
#include <Logic/Biff_structures/BookExt_Conditional11.h>
|
||||
#include <Logic/Biff_structures/BookExt_Conditional12.h>
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
// Logical representation of BookExt record in BIFF8
|
||||
class BookExt: public BiffRecord
|
||||
{
|
||||
BIFF_RECORD_DEFINE_TYPE_INFO(BookExt)
|
||||
@ -47,11 +49,13 @@ public:
|
||||
~BookExt();
|
||||
|
||||
BaseObjectPtr clone();
|
||||
|
||||
|
||||
void readFields(CFRecord& record);
|
||||
|
||||
static const ElementType type = typeBookExt;
|
||||
static const ElementType type = typeBookExt;
|
||||
|
||||
//-----------------------------
|
||||
_UINT32 cb;
|
||||
|
||||
bool fDontAutoRecover;
|
||||
|
||||
@ -31,6 +31,7 @@
|
||||
*/
|
||||
|
||||
#include "CRN.h"
|
||||
#include <Logic/Biff_structures/SerAr.h>
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
@ -39,10 +40,12 @@ CRN::CRN()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
CRN::~CRN()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
BaseObjectPtr CRN::clone()
|
||||
{
|
||||
return BaseObjectPtr(new CRN(*this));
|
||||
@ -52,12 +55,10 @@ BaseObjectPtr CRN::clone()
|
||||
void CRN::readFields(CFRecord& record)
|
||||
{
|
||||
record >> colLast >> colFirst >> row;
|
||||
|
||||
for(int i = 0; i < colLast - colFirst + 1; ++i)
|
||||
{
|
||||
unsigned char rec_type;
|
||||
record >> rec_type;
|
||||
|
||||
SerArPtr ser(SerAr::createSerAr(rec_type));
|
||||
record >> *ser;
|
||||
crnOper.push_back(ser);
|
||||
|
||||
@ -32,11 +32,13 @@
|
||||
#pragma once
|
||||
|
||||
#include "BiffRecord.h"
|
||||
#include "../Biff_structures/SerAr.h"
|
||||
#include <Logic/Biff_structures/SerAr.h>
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
// Logical representation of CRN record in BIFF8
|
||||
class CRN: public BiffRecord
|
||||
{
|
||||
BIFF_RECORD_DEFINE_TYPE_INFO(CRN)
|
||||
@ -46,16 +48,18 @@ public:
|
||||
~CRN();
|
||||
|
||||
BaseObjectPtr clone();
|
||||
|
||||
|
||||
void readFields(CFRecord& record);
|
||||
|
||||
static const ElementType type = typeCRN;
|
||||
static const ElementType type = typeCRN;
|
||||
|
||||
//-----------------------------
|
||||
unsigned char colLast;
|
||||
unsigned char colFirst;
|
||||
_UINT16 row;
|
||||
|
||||
BiffStructurePtrVector crnOper;
|
||||
|
||||
};
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -53,10 +53,7 @@ BaseObjectPtr CodeName::clone()
|
||||
|
||||
void CodeName::readFields(CFRecord& record)
|
||||
{
|
||||
XLUnicodeString codeName;
|
||||
record >> codeName;
|
||||
|
||||
value = codeName.value();
|
||||
}
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -37,6 +37,8 @@
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
// Logical representation of CodeName record in BIFF8
|
||||
class CodeName: public BiffRecord
|
||||
{
|
||||
BIFF_RECORD_DEFINE_TYPE_INFO(CodeName)
|
||||
@ -47,11 +49,14 @@ public:
|
||||
|
||||
BaseObjectPtr clone();
|
||||
|
||||
|
||||
void readFields(CFRecord& record);
|
||||
|
||||
static const ElementType type = typeCodeName;
|
||||
static const ElementType type = typeCodeName;
|
||||
|
||||
//-----------------------------
|
||||
XLUnicodeString codeName;
|
||||
|
||||
std::wstring value;
|
||||
};
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -35,8 +35,8 @@
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
ExternName::ExternName(const unsigned short supporting_link_type, bool bOle)
|
||||
: supbook_cch(supporting_link_type), cf(-1), bOleVirtualPath(bOle)
|
||||
ExternName::ExternName(const unsigned short supporting_link_type)
|
||||
: supbook_cch(supporting_link_type), cf(0)
|
||||
{
|
||||
}
|
||||
|
||||
@ -70,40 +70,53 @@ void ExternName::readFields(CFRecord& record)
|
||||
}
|
||||
else
|
||||
{
|
||||
if(fOle && !fOleLink)
|
||||
if(fOle && !fOleLink) // DDE data item
|
||||
{
|
||||
body = BiffStructurePtr(new ExternDdeLinkNoOper);
|
||||
}
|
||||
if(!fOle && fOleLink)
|
||||
if(!fOle && fOleLink) // DDE data item
|
||||
{
|
||||
body = BiffStructurePtr(new ExternOleDdeLink);
|
||||
}
|
||||
// Nu i kak ya dolzhen opredelit', DDE eto ili OLE?!!!
|
||||
// V Mikrosofte vse ebanutye - pust' sami parsyat, debily
|
||||
if(!fOle && !fOleLink)
|
||||
{
|
||||
if (bOleVirtualPath)
|
||||
{
|
||||
body = BiffStructurePtr(new ExternOleDdeLink);
|
||||
}
|
||||
else
|
||||
{
|
||||
body = BiffStructurePtr(new ExternDocName);
|
||||
}
|
||||
body = BiffStructurePtr(new ExternDocName);
|
||||
}
|
||||
// This fills in the gaps between AddinUdfs if the body is not AddinUdf. The simplest way to maintain indexing from my point of view.
|
||||
}
|
||||
body->load(record);
|
||||
|
||||
|
||||
//cache
|
||||
switch(cf)
|
||||
if(0x3A01 != supbook_cch)
|
||||
{
|
||||
case 0: // is text
|
||||
break;
|
||||
case 5: //csv (,)
|
||||
case 6: //Microsoft Symbolic Link (SYLK).
|
||||
case 8: //biff8
|
||||
case 44: //unicode text
|
||||
case 63: //biff12
|
||||
break;
|
||||
std::wstring name;
|
||||
if(!fOle && !fOleLink)
|
||||
{
|
||||
ExternDocName* n = dynamic_cast<ExternDocName*>(body.get());
|
||||
|
||||
if (n->ixals > 0)
|
||||
{
|
||||
//from SupBook
|
||||
}
|
||||
else
|
||||
{
|
||||
name = n->nameDefinition.getAssembledFormula();
|
||||
if (name.empty())
|
||||
name = n->extName.value();
|
||||
}
|
||||
}
|
||||
if(fOle && !fOleLink) // DDE data item
|
||||
{
|
||||
ExternDdeLinkNoOper* n = dynamic_cast<ExternDdeLinkNoOper*>(body.get());
|
||||
name = n->linkName.value();
|
||||
}
|
||||
if(!fOle && fOleLink)
|
||||
{
|
||||
ExternOleDdeLink* n = dynamic_cast<ExternOleDdeLink*>(body.get());
|
||||
name = n->linkName.value();
|
||||
}
|
||||
record.getGlobalWorkbookInfo()->arExternalNames.push_back(name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -48,10 +48,11 @@ class ExternName: public BiffRecord
|
||||
BIFF_RECORD_DEFINE_TYPE_INFO(ExternName)
|
||||
BASE_OBJECT_DEFINE_CLASS_NAME(ExternName)
|
||||
public:
|
||||
ExternName(const unsigned short supporting_link_type, bool bOle);
|
||||
ExternName(const unsigned short supporting_link_type);
|
||||
~ExternName();
|
||||
|
||||
BaseObjectPtr clone();
|
||||
|
||||
|
||||
void readFields(CFRecord& record);
|
||||
|
||||
@ -63,13 +64,24 @@ public:
|
||||
bool fWantPict;
|
||||
bool fOle;
|
||||
bool fOleLink;
|
||||
short cf;
|
||||
_UINT16 cf;
|
||||
bool fIcon;
|
||||
BiffStructurePtr body;
|
||||
|
||||
//-----------------------------
|
||||
_UINT16 supbook_cch;
|
||||
bool bOleVirtualPath;
|
||||
_UINT16 supbook_cch;
|
||||
|
||||
//if(0x3A01 == supbook_cch)
|
||||
//{
|
||||
// if(!body)
|
||||
// {
|
||||
// body = BiffStructurePtr(new AddinUdf);
|
||||
// }
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
//}
|
||||
|
||||
};
|
||||
|
||||
typedef boost::shared_ptr<ExternName> ExternNamePtr;
|
||||
|
||||
@ -58,14 +58,14 @@ void ExternSheet::readFields(CFRecord& record)
|
||||
if (record.getGlobalWorkbookInfo()->Version < 0x0600)
|
||||
{
|
||||
unsigned char type;
|
||||
|
||||
//record.skipNunBytes(record.getDataSize() - record.getRdPtr());
|
||||
ShortXLAnsiString stName;
|
||||
record >> type >> stName;
|
||||
|
||||
name = stName.value();
|
||||
//int type = stName.value().substr(0, 1).c_str()[0];
|
||||
//if (!name.empty())
|
||||
// record.getGlobalWorkbookInfo()->arExternalNames.push_back(name);
|
||||
std::wstring name = stName.value();
|
||||
//int type = stName.value().substr(0, 1).c_str()[0];
|
||||
if (!name.empty())
|
||||
record.getGlobalWorkbookInfo()->arExternalNames.push_back(name);
|
||||
|
||||
}
|
||||
else
|
||||
|
||||
@ -32,11 +32,13 @@
|
||||
#pragma once
|
||||
|
||||
#include "BiffRecord.h"
|
||||
#include "../Biff_structures/XTI.h"
|
||||
#include <Logic/Biff_structures/XTI.h>
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
// Logical representation of ExternSheet record in BIFF8
|
||||
class ExternSheet: public BiffRecord
|
||||
{
|
||||
BIFF_RECORD_DEFINE_TYPE_INFO(ExternSheet)
|
||||
@ -46,15 +48,15 @@ public:
|
||||
~ExternSheet();
|
||||
|
||||
BaseObjectPtr clone();
|
||||
|
||||
|
||||
void readFields(CFRecord& record);
|
||||
|
||||
static const ElementType type = typeExternSheet;
|
||||
static const ElementType type = typeExternSheet;
|
||||
|
||||
_UINT16 cXTI;
|
||||
BiffStructurePtrVector rgXTI;
|
||||
//------------------------------------------------
|
||||
std::wstring name; //biff5
|
||||
//-----------------------------
|
||||
ForwardOnlyParam<_UINT16> cXTI;
|
||||
BiffStructurePtrVector rgXTI;
|
||||
};
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -52,7 +52,7 @@ BaseObjectPtr ObProj::clone()
|
||||
|
||||
void ObProj::readFields(CFRecord& record)
|
||||
{
|
||||
//vba present in file .. выше .. по наличию собствено стороджа
|
||||
// the tag doesn't contain data
|
||||
}
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -36,6 +36,8 @@
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
// Logical representation of ObProj record in BIFF8
|
||||
class ObProj: public BiffRecord
|
||||
{
|
||||
BIFF_RECORD_DEFINE_TYPE_INFO(ObProj)
|
||||
@ -45,10 +47,13 @@ public:
|
||||
~ObProj();
|
||||
|
||||
BaseObjectPtr clone();
|
||||
|
||||
|
||||
void readFields(CFRecord& record);
|
||||
|
||||
static const ElementType type = typeObProj;
|
||||
|
||||
|
||||
};
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -32,10 +32,13 @@
|
||||
#pragma once
|
||||
|
||||
#include "BiffRecord.h"
|
||||
#include "../Biff_structures/SheetId.h"
|
||||
#include <Logic/Biff_structures/SheetId.h>
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
// Logical representation of RRTabId record in BIFF8
|
||||
class RRTabId: public BiffRecord
|
||||
{
|
||||
BIFF_RECORD_DEFINE_TYPE_INFO(RRTabId)
|
||||
@ -45,6 +48,7 @@ public:
|
||||
~RRTabId();
|
||||
|
||||
BaseObjectPtr clone();
|
||||
|
||||
|
||||
void readFields(CFRecord& record);
|
||||
|
||||
|
||||
@ -36,6 +36,8 @@
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
// Logical representation of RecalcId record in BIFF8
|
||||
class RecalcId: public BiffRecord
|
||||
{
|
||||
BIFF_RECORD_DEFINE_TYPE_INFO(RecalcId)
|
||||
@ -45,12 +47,16 @@ public:
|
||||
~RecalcId();
|
||||
|
||||
BaseObjectPtr clone();
|
||||
|
||||
|
||||
void readFields(CFRecord& record);
|
||||
|
||||
static const ElementType type = typeRecalcId;
|
||||
|
||||
|
||||
//-----------------------------
|
||||
_UINT32 dwBuild;
|
||||
|
||||
};
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -35,7 +35,7 @@
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
SupBook::SupBook() : bOleLink(false), bSimple(false), bPath(false)
|
||||
SupBook::SupBook()
|
||||
{
|
||||
}
|
||||
|
||||
@ -55,133 +55,22 @@ void SupBook::readFields(CFRecord& record)
|
||||
record >> ctab >> cch;
|
||||
if(0x0001 <= cch && 0x00ff >= cch)
|
||||
{
|
||||
XLUnicodeStringNoCch temp;
|
||||
temp.setSize(cch);
|
||||
record >> temp;
|
||||
|
||||
origin = temp.value();
|
||||
|
||||
while(!record.isEOF())
|
||||
virtPath.setSize(cch);
|
||||
record >> virtPath;
|
||||
//virtPath.EscapeUrlW(); //todooo проверить спец символы !!!
|
||||
//if(virtPath.isConformToVirtPath() && !virtPath.isConformToOleLink())
|
||||
{
|
||||
XLUnicodeString temp2;
|
||||
record >> temp2;
|
||||
|
||||
rgst.push_back(temp2.value());
|
||||
}
|
||||
}
|
||||
//virt-path = volume / unc-volume / rel-volume / transfer-protocol / startup / alt-startup / library / simple-file-path / ole-link
|
||||
|
||||
//ole-link = path-string %x0003 path-string
|
||||
//simple-file-path = [%x0001]
|
||||
//file-path startup = %x0001 %x0006 file-path
|
||||
//alt-startup = %x0001 %x0007 file-path
|
||||
//library = %x0001 %x0008 file-path
|
||||
//transfer-protocol = %x0001 %x0005 count transfer-path
|
||||
//transfer-path = transfer-base-path / "[" transfer-base-path "]" sheet-name
|
||||
//transfer-base-path = transfer-type "://" file-path
|
||||
//transfer-type = "ftp" / "http" / "https"
|
||||
//rel-volume = %x0001 %x0002 file-path
|
||||
//...
|
||||
bool bFilePathType = false;
|
||||
if (!origin.empty())
|
||||
{
|
||||
std::wstring sTmp = origin;
|
||||
|
||||
while(true)
|
||||
{
|
||||
int pos = sTmp.find(L"\x0001");
|
||||
if (pos >= 0)
|
||||
{
|
||||
if (bSimple)
|
||||
{
|
||||
bFilePathType = true;
|
||||
bPath = true; //xls_result.xls
|
||||
}
|
||||
else bSimple = true; //file name or file path
|
||||
|
||||
virtPath.push_back(sTmp.substr(0, pos));
|
||||
sTmp = sTmp.substr(pos + 1);
|
||||
continue;
|
||||
}
|
||||
pos = sTmp.find(L"\x0002");
|
||||
if (pos >= 0)
|
||||
{
|
||||
if (bSimple)
|
||||
bPath = true;
|
||||
virtPath.push_back(sTmp.substr(0, pos));
|
||||
sTmp = sTmp.substr(pos + 1);
|
||||
continue;
|
||||
}
|
||||
pos = sTmp.find(L"\x0003");
|
||||
if (pos >= 0)
|
||||
{
|
||||
if (bPath)
|
||||
{
|
||||
if (bFilePathType)
|
||||
{
|
||||
virtPath.back() += L"file:///" + sTmp.substr(0, 1) + L":\\" + sTmp.substr(1, pos - 1);
|
||||
bFilePathType = false;
|
||||
}
|
||||
else
|
||||
virtPath.back() += L"/" + sTmp.substr(0, pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
bOleLink = true;
|
||||
virtPath.push_back(sTmp.substr(0, pos));
|
||||
}
|
||||
sTmp = sTmp.substr(pos + 1);
|
||||
continue;
|
||||
}
|
||||
pos = sTmp.find(L"\x0004");
|
||||
if (pos >= 0)
|
||||
{
|
||||
virtPath.push_back(sTmp.substr(0, pos));
|
||||
sTmp = sTmp.substr(pos + 1);
|
||||
continue;
|
||||
}
|
||||
pos = sTmp.find(L"\x0005");
|
||||
if (pos >= 0)
|
||||
{
|
||||
virtPath.push_back(sTmp.substr(0, pos));
|
||||
//skip http size
|
||||
sTmp = sTmp.substr(pos + 2);
|
||||
continue;
|
||||
}
|
||||
pos = sTmp.find(L"\x0006");
|
||||
if (pos >= 0)
|
||||
{
|
||||
virtPath.push_back(sTmp.substr(0, pos));
|
||||
sTmp = sTmp.substr(pos + 1);
|
||||
continue;
|
||||
}
|
||||
pos = sTmp.find(L"\x0007");
|
||||
if (pos >= 0)
|
||||
{
|
||||
virtPath.push_back(sTmp.substr(0, pos));
|
||||
sTmp = sTmp.substr(pos + 1);
|
||||
continue;
|
||||
}
|
||||
pos = sTmp.find(L"\x0008");
|
||||
if (pos >= 0)
|
||||
{
|
||||
virtPath.push_back(sTmp.substr(0, pos));
|
||||
sTmp = sTmp.substr(pos + 1);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (bPath)
|
||||
{
|
||||
virtPath.back() += L"/" + sTmp;
|
||||
}
|
||||
else
|
||||
{
|
||||
virtPath.push_back(sTmp);
|
||||
record >> rgst;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const unsigned short SupBook::getSupportingLinkType() const
|
||||
{
|
||||
return cch;
|
||||
}
|
||||
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
|
||||
@ -37,6 +37,8 @@
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
// Logical representation of SupBook record in BIFF8
|
||||
class SupBook: public BiffRecord
|
||||
{
|
||||
BIFF_RECORD_DEFINE_TYPE_INFO(SupBook)
|
||||
@ -45,23 +47,22 @@ public:
|
||||
SupBook();
|
||||
~SupBook();
|
||||
|
||||
const unsigned short getSupportingLinkType() const;
|
||||
|
||||
BaseObjectPtr clone();
|
||||
|
||||
|
||||
void readFields(CFRecord& record);
|
||||
|
||||
static const ElementType type = typeSupBook;
|
||||
|
||||
_UINT16 ctab;
|
||||
_UINT16 cch;
|
||||
|
||||
std::wstring origin;
|
||||
std::vector<std::wstring> rgst;
|
||||
//-----------------------------
|
||||
std::vector<std::wstring> virtPath;
|
||||
_UINT16 ctab;
|
||||
_UINT16 cch;
|
||||
|
||||
XLUnicodeStringNoCch virtPath;
|
||||
XLUnicodeString rgst;
|
||||
|
||||
bool bOleLink;
|
||||
bool bSimple;
|
||||
bool bPath;
|
||||
};
|
||||
|
||||
typedef boost::shared_ptr<SupBook> SupBookPtr;
|
||||
|
||||
@ -35,6 +35,9 @@
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
// Logical representation of UsesELFs record in BIFF8
|
||||
class UsesELFs: public BiffRecord
|
||||
{
|
||||
BIFF_RECORD_DEFINE_TYPE_INFO(UsesELFs)
|
||||
@ -44,12 +47,15 @@ public:
|
||||
~UsesELFs();
|
||||
|
||||
BaseObjectPtr clone();
|
||||
|
||||
|
||||
void readFields(CFRecord& record);
|
||||
|
||||
static const ElementType type = typeUsesELFs;
|
||||
static const ElementType type = typeUsesELFs;
|
||||
|
||||
//-----------------------------
|
||||
Boolean<unsigned short> useselfs;
|
||||
|
||||
};
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -36,6 +36,8 @@
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
// Logical representation of XCT record in BIFF8
|
||||
class XCT: public BiffRecord
|
||||
{
|
||||
BIFF_RECORD_DEFINE_TYPE_INFO(XCT)
|
||||
@ -48,8 +50,9 @@ public:
|
||||
|
||||
void readFields(CFRecord& record);
|
||||
|
||||
static const ElementType type = typeXCT;
|
||||
static const ElementType type = typeXCT;
|
||||
|
||||
//-----------------------------
|
||||
_UINT16 ccrn;
|
||||
_UINT16 itab;
|
||||
bool itab_exist;
|
||||
|
||||
@ -46,6 +46,7 @@ void AddinUdf::load(CFRecord& record)
|
||||
{
|
||||
record.skipNunBytes(4); // reserved
|
||||
record >> udfName;
|
||||
record.getGlobalWorkbookInfo()->AddinUdfs.push_back(udfName);
|
||||
|
||||
unsigned short cb;
|
||||
record >> cb;
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "BiffStructure.h"
|
||||
#include "BiffString.h"
|
||||
#include <Logic/Biff_structures/BiffString.h>
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
@ -47,7 +47,8 @@ public:
|
||||
|
||||
virtual void load(CFRecord& record);
|
||||
|
||||
static const ElementType type = typeAddinUdf;
|
||||
|
||||
static const ElementType type = typeAddinUdf;
|
||||
|
||||
ShortXLUnicodeString udfName;
|
||||
};
|
||||
|
||||
@ -33,7 +33,7 @@
|
||||
|
||||
#include "BiffStructure.h"
|
||||
#include "CellRef.h"
|
||||
#include "BitMarkedStructs.h"
|
||||
#include <Logic/Biff_structures/BitMarkedStructs.h>
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
@ -51,6 +51,7 @@ public:
|
||||
|
||||
virtual void load(CFRecord& record);
|
||||
|
||||
|
||||
const CellRef getLocation() const;
|
||||
|
||||
static const ElementType type = typeCell;
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "BiffStructure.h"
|
||||
#include "BiffString.h"
|
||||
#include <Logic/Biff_structures/BiffString.h>
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
@ -47,6 +47,7 @@ public:
|
||||
|
||||
virtual void load(CFRecord& record);
|
||||
|
||||
|
||||
static const ElementType type = typeExternDdeLinkNoOper;
|
||||
|
||||
ShortXLUnicodeString linkName;
|
||||
|
||||
@ -48,7 +48,6 @@ void ExternDocName::load(CFRecord& record)
|
||||
record >> ixals;
|
||||
record.skipNunBytes(2); // reserved
|
||||
record >> extName;
|
||||
|
||||
nameDefinition.load(record);
|
||||
}
|
||||
|
||||
|
||||
@ -31,8 +31,9 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "ExtNameParsedFormula.h"
|
||||
#include "BiffString.h"
|
||||
#include "BiffStructure.h"
|
||||
#include <Logic/Biff_structures/ExtNameParsedFormula.h>
|
||||
#include <Logic/Biff_structures/BiffString.h>
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
@ -49,6 +50,7 @@ public:
|
||||
|
||||
virtual void load(CFRecord& record);
|
||||
|
||||
|
||||
unsigned short ixals;
|
||||
ShortXLUnicodeString extName;
|
||||
ExtNameParsedFormula nameDefinition;
|
||||
|
||||
@ -32,8 +32,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "BiffStructure.h"
|
||||
#include "MOper.h"
|
||||
#include "BiffString.h"
|
||||
#include <Logic/Biff_structures/MOper.h>
|
||||
#include <Logic/Biff_structures/BiffString.h>
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
@ -48,6 +48,7 @@ public:
|
||||
|
||||
virtual void load(CFRecord& record);
|
||||
|
||||
|
||||
static const ElementType type = typeExternOleDdeLink;
|
||||
|
||||
_UINT32 lStgName;
|
||||
|
||||
@ -32,11 +32,11 @@
|
||||
|
||||
#include "MOper.h"
|
||||
#include <Binary/CFRecord.h>
|
||||
#include <simple_xml_writer.h>
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
BiffStructurePtr MOper::clone()
|
||||
{
|
||||
return BiffStructurePtr(new MOper(*this));
|
||||
@ -45,52 +45,16 @@ BiffStructurePtr MOper::clone()
|
||||
void MOper::load(CFRecord& record)
|
||||
{
|
||||
record >> colLast >> rowLast;
|
||||
|
||||
for(int i = 0; i < (colLast + 1) * (rowLast + 1); ++i)
|
||||
{
|
||||
unsigned char rec_type;
|
||||
record >> rec_type;
|
||||
|
||||
SerArPtr ser(SerAr::createSerAr(rec_type));
|
||||
record >> *ser;
|
||||
|
||||
extOper.push_back(ser);
|
||||
}
|
||||
}
|
||||
|
||||
int MOper::serialize(std::wostream & strm)
|
||||
{
|
||||
if (extOper.empty()) return 0;
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"values")
|
||||
{
|
||||
for(size_t i = 0; i < extOper.size(); ++i)
|
||||
{
|
||||
CP_XML_NODE(L"value")
|
||||
{
|
||||
switch(extOper[i]->fixed_type)
|
||||
{
|
||||
case SerAr::typeSerNil: CP_XML_ATTR(L"t", L"nil"); break;
|
||||
case SerAr::typeSerNum: CP_XML_ATTR(L"t", L"n"); break;
|
||||
case SerAr::typeSerStr: CP_XML_ATTR(L"t", L"str"); break;
|
||||
case SerAr::typeSerBool: CP_XML_ATTR(L"t", L"b"); break;
|
||||
case SerAr::typeSerErr: CP_XML_ATTR(L"t", L"e"); break;
|
||||
}
|
||||
CP_XML_NODE(L"val")
|
||||
{
|
||||
if (extOper[i]->fixed_type == SerAr::typeSerStr)
|
||||
{
|
||||
CP_XML_ATTR(L"xml:space", L"preserve");
|
||||
}
|
||||
CP_XML_STREAM() << extOper[i]->toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
} // namespace XLS
|
||||
|
||||
|
||||
@ -32,8 +32,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "BiffStructure.h"
|
||||
#include "SerAr.h"
|
||||
#include "BitMarkedStructs.h"
|
||||
#include <Logic/Biff_structures/SerAr.h>
|
||||
#include <Logic/Biff_structures/BitMarkedStructs.h>
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
@ -49,7 +49,7 @@ public:
|
||||
static const ElementType type = typeMOper;
|
||||
|
||||
virtual void load(CFRecord& record);
|
||||
int serialize(std::wostream & strm);
|
||||
|
||||
|
||||
ColunByteU colLast;
|
||||
RwU rowLast;
|
||||
|
||||
@ -111,7 +111,6 @@ void PtgArea3d::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, bool f
|
||||
|
||||
if (global_info->Version < 0x0600)
|
||||
{
|
||||
ixti = ixals;
|
||||
if (ixals == 0xffff)
|
||||
{
|
||||
std::wstring prefix = XMLSTUFF::xti_indexes2sheet_name(itabFirst, itabLast, global_info->sheets_names);
|
||||
@ -119,14 +118,14 @@ void PtgArea3d::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, bool f
|
||||
|
||||
ptg_stack.push(prefix + range_ref);
|
||||
}
|
||||
else
|
||||
{//external !!
|
||||
ptg_stack.push(XMLSTUFF::make3dRef(ixals, range_ref, global_info->xti_parsed, full_ref));
|
||||
}
|
||||
}
|
||||
if (ixti != 0xffff)
|
||||
else
|
||||
{
|
||||
std::wstring link = global_info->arXti[ixti].link;
|
||||
if (!link.empty() && !range_ref.empty())
|
||||
link += L"!";
|
||||
|
||||
ptg_stack.push(link + range_ref); // full_ref ???
|
||||
ptg_stack.push(XMLSTUFF::make3dRef(ixti, range_ref, global_info->xti_parsed, full_ref));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -46,10 +46,9 @@ BiffStructurePtr PtgAreaErr3d::clone()
|
||||
|
||||
void PtgAreaErr3d::loadFields(CFRecord& record)
|
||||
{
|
||||
global_info = record.getGlobalWorkbookInfo();
|
||||
|
||||
record >> ixti;
|
||||
record.skipNunBytes(8); // unused
|
||||
global_info = record.getGlobalWorkbookInfo();
|
||||
}
|
||||
|
||||
|
||||
@ -63,11 +62,9 @@ void PtgAreaErr3d::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, boo
|
||||
extra_data.pop();
|
||||
return;
|
||||
}
|
||||
std::wstring link = global_info->arXti[ixti].link;
|
||||
if (!link.empty())
|
||||
link += L"!";
|
||||
|
||||
ptg_stack.push(link + L"#REF!"); // full_ref ???
|
||||
|
||||
ptg_stack.push(XMLSTUFF::make3dRef(ixti, L"#REF!", global_info->xti_parsed));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -79,7 +79,6 @@ void PtgNameX::loadFields(CFRecord& record)
|
||||
void PtgNameX::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, bool full_ref)
|
||||
{
|
||||
RevNamePtr tab_id;
|
||||
|
||||
if(!extra_data.empty() && (tab_id = boost::dynamic_pointer_cast<RevName>(extra_data.front())))
|
||||
{
|
||||
Log::error("PtgNameX struct for revisions is not assemble.");
|
||||
@ -88,32 +87,39 @@ void PtgNameX::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, bool fu
|
||||
return;
|
||||
}
|
||||
|
||||
if(ixti >= 0 && ixti < global_info->arXti.size())
|
||||
std::wstring _Name;
|
||||
if(nameindex > 0 && nameindex <= global_info->AddinUdfs.size() && !(_Name = global_info->AddinUdfs[nameindex - 1]).empty())
|
||||
{
|
||||
std::wstring link = global_info->arXti[ixti].link;
|
||||
std::wstring name;
|
||||
ptg_stack.push(_Name);
|
||||
}
|
||||
else if(ixti > 0 && ixti <= global_info->xti_parsed.size())
|
||||
{
|
||||
std::wstring sheet = global_info->xti_parsed[ixti-1];
|
||||
|
||||
if (global_info->arXti[ixti].pNames && nameindex > 0)
|
||||
if (!sheet.empty()) sheet += L"!";
|
||||
|
||||
if (nameindex > 0 && nameindex <= global_info->arDefineNames.size())
|
||||
{
|
||||
name = global_info->arXti[ixti].pNames->at(nameindex - 1);
|
||||
_Name = global_info->arDefineNames[nameindex - 1];
|
||||
}
|
||||
if (!link.empty() && !name.empty())
|
||||
|
||||
if (sheet.empty() && _Name.empty() && nameindex <= global_info->arExternalNames.size() && nameindex > 0)
|
||||
{
|
||||
ptg_stack.push(link + L"!" + name);
|
||||
_Name = global_info->arExternalNames[nameindex - 1];
|
||||
}
|
||||
else if (!name.empty())
|
||||
{
|
||||
ptg_stack.push(name);
|
||||
}
|
||||
else
|
||||
ptg_stack.push(link);
|
||||
|
||||
ptg_stack.push(sheet + _Name);
|
||||
}
|
||||
else
|
||||
{
|
||||
Log::warning("PtgNameX structure is not assemble.");
|
||||
ptg_stack.push(L"");
|
||||
//ptg_stack.push(L"#UNDEFINED_EXTERN_NAME(" + STR::int2wstr(nameindex) + L")!");
|
||||
ptg_stack.push(L""); // This would let us to continue without an error
|
||||
}
|
||||
|
||||
|
||||
// Example of result: "[1]!range"
|
||||
// in the formula window it looks like: "'D:\Projects\AVSWorksheetConverter\bin\InFiles\Blank2003_range.xls'!range"
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -106,7 +106,6 @@ void PtgRef3d::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, bool fu
|
||||
|
||||
if (global_info->Version < 0x0600)
|
||||
{
|
||||
ixti = ixals;
|
||||
if (ixals == 0xffff)
|
||||
{
|
||||
std::wstring prefix = XMLSTUFF::xti_indexes2sheet_name(itabFirst, itabLast, global_info->sheets_names);
|
||||
@ -114,14 +113,15 @@ void PtgRef3d::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, bool fu
|
||||
|
||||
ptg_stack.push(prefix + cell_ref);
|
||||
}
|
||||
else
|
||||
{
|
||||
ptg_stack.push(XMLSTUFF::make3dRef(ixals, cell_ref, global_info->xti_parsed, full_ref)); // from External !
|
||||
}
|
||||
}
|
||||
if (ixti != 0xffff)
|
||||
else
|
||||
{
|
||||
std::wstring link = global_info->arXti[ixti].link;
|
||||
if (!link.empty() && !cell_ref.empty())
|
||||
link += L"!";
|
||||
|
||||
ptg_stack.push(link + cell_ref); // full_ref ???
|
||||
cell_ref = XMLSTUFF::make3dRef(ixti, cell_ref, global_info->xti_parsed, full_ref);
|
||||
ptg_stack.push(cell_ref);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -57,10 +57,9 @@ BiffStructurePtr PtgRefErr3d::clone()
|
||||
|
||||
void PtgRefErr3d::loadFields(CFRecord& record)
|
||||
{
|
||||
global_info = record.getGlobalWorkbookInfo();
|
||||
|
||||
record >> ixti;
|
||||
record.skipNunBytes(4); // unused
|
||||
global_info = record.getGlobalWorkbookInfo();
|
||||
}
|
||||
|
||||
|
||||
@ -76,14 +75,7 @@ void PtgRefErr3d::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, bool
|
||||
return;
|
||||
}
|
||||
|
||||
if (ixti != 0xffff)
|
||||
{
|
||||
std::wstring link = global_info->arXti[ixti].link;
|
||||
if (!link.empty())
|
||||
link += L"!";
|
||||
|
||||
ptg_stack.push(link + L"#REF!"); // full_ref ???
|
||||
}
|
||||
ptg_stack.push(XMLSTUFF::make3dRef(ixti, L"#REF!", global_info->xti_parsed));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -56,7 +56,7 @@ public:
|
||||
|
||||
virtual const std::wstring toString() const = 0;
|
||||
|
||||
static const ElementType type = typeSerAr;
|
||||
static const ElementType type = typeSerAr;
|
||||
|
||||
SerType fixed_type;
|
||||
};
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "SerAr.h"
|
||||
#include "BiffString.h"
|
||||
#include <Logic/Biff_structures/BiffString.h>
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
@ -31,10 +31,6 @@
|
||||
*/
|
||||
|
||||
#include "XTI.h"
|
||||
#include "../GlobalsSubstream.h"
|
||||
#include "../Biff_unions/SUPBOOK.h"
|
||||
#include "../Biff_records/SupBook.h"
|
||||
|
||||
#include <Binary/CFRecord.h>
|
||||
|
||||
namespace XLS
|
||||
@ -52,6 +48,17 @@ void XTI::load(CFRecord& record)
|
||||
return;
|
||||
|
||||
record >> iSupBook >> itabFirst >> itabLast;
|
||||
|
||||
if (itabFirst < 0 && itabLast < 0)
|
||||
{
|
||||
record.getGlobalWorkbookInfo()->xti_parsed.push_back(L"");
|
||||
}
|
||||
else
|
||||
{
|
||||
std::wstring name = XMLSTUFF::xti_indexes2sheet_name(itabFirst, itabLast, record.getGlobalWorkbookInfo()->sheets_names);
|
||||
if (name == L"#REF") name += L"!";
|
||||
record.getGlobalWorkbookInfo()->xti_parsed.push_back( name );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -48,6 +48,7 @@ public:
|
||||
|
||||
virtual void load(CFRecord& record);
|
||||
|
||||
|
||||
unsigned short iSupBook;
|
||||
short itabFirst;
|
||||
short itabLast;
|
||||
|
||||
@ -72,7 +72,7 @@ const bool DVAXIS::loadContentRead(BinReaderProcessor& proc)
|
||||
bool ok = loadContent(proc);
|
||||
if(ok)
|
||||
{
|
||||
id = proc.getGlobalWorkbookInfo()->last_Axes_id++;
|
||||
id = proc.getGlobalWorkbookInfo()->GenerateAXESId();
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
@ -67,6 +67,7 @@ public:
|
||||
BaseObjectPtr m_TABLESTYLES;
|
||||
BaseObjectPtr m_THEME;
|
||||
|
||||
|
||||
GlobalWorkbookInfoPtr global_info;
|
||||
};
|
||||
|
||||
|
||||
@ -105,7 +105,7 @@ const bool FORMULA::loadContent(BinProcessor& proc)
|
||||
m_sharedIndex = shared_formulas_locations_ref_.size();
|
||||
shared_formulas_locations_ref_.push_back(shr_formula.ref_);
|
||||
}
|
||||
//proc.optional<SUB>();
|
||||
//proc.optional<SUB>(); // I haven't found any mention about SUB in the docs
|
||||
}
|
||||
|
||||
if ((formula) && (formula->fShrFmla))
|
||||
|
||||
@ -67,7 +67,7 @@ const bool IVAXIS::loadContentRead(BinReaderProcessor& proc)
|
||||
bool ok = loadContent(proc);
|
||||
if(ok)
|
||||
{
|
||||
id = proc.getGlobalWorkbookInfo()->last_Axes_id++;
|
||||
id = proc.getGlobalWorkbookInfo()->GenerateAXESId();
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
@ -36,6 +36,8 @@
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
// Logical representation of LBL union of records
|
||||
class LBL: public CompositeObject
|
||||
{
|
||||
BASE_OBJECT_DEFINE_CLASS_NAME(LBL)
|
||||
@ -49,14 +51,13 @@ public:
|
||||
|
||||
int serialize(std::wostream & stream);
|
||||
|
||||
static const ElementType type = typeLBL;
|
||||
static const ElementType type = typeLBL;
|
||||
|
||||
BaseObjectPtr m_Lbl;
|
||||
BaseObjectPtr m_NamePublish;
|
||||
BaseObjectPtr m_NameCmt;
|
||||
BaseObjectPtr m_NameFnGrp12;
|
||||
BaseObjectPtr m_Lbl;
|
||||
//-------------------------------------------------------
|
||||
|
||||
bool isSerialize;
|
||||
|
||||
};
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -76,26 +76,65 @@ const bool LBL::loadContent(BinProcessor& proc)
|
||||
if (!lbl) return false;
|
||||
|
||||
std::wstring name;
|
||||
std::wstring comment;
|
||||
|
||||
if (lbl->fBuiltin) name = lbl->Name.value().get_value_or(L"");
|
||||
if (name.empty()) name = lbl->Name_bin.value();
|
||||
|
||||
std::wstring value = lbl->rgce.getAssembledFormula(lbl->fWorkbookParam/*lbl->itab == 0 ? true : false*/);
|
||||
|
||||
NameCmt namecmt(name);
|
||||
if (proc.optional(namecmt))
|
||||
{
|
||||
m_NameCmt = elements_.back();
|
||||
elements_.pop_back();
|
||||
if (name.empty())
|
||||
name = namecmt.name.value();
|
||||
comment = namecmt.comment.value();
|
||||
}
|
||||
if (proc.optional<NameFnGrp12>())
|
||||
{
|
||||
m_NameFnGrp12 = elements_.back();
|
||||
elements_.pop_back();
|
||||
}
|
||||
if (proc.optional<NamePublish>())
|
||||
{
|
||||
m_NamePublish = elements_.back();
|
||||
elements_.pop_back();
|
||||
}
|
||||
|
||||
GlobalWorkbookInfoPtr global_info_ = proc.getGlobalWorkbookInfo();
|
||||
|
||||
|
||||
if (!value.empty() && !name.empty())
|
||||
{
|
||||
int ind_sheet = lbl->itab;
|
||||
|
||||
std::map<std::wstring, std::vector<std::wstring>>::iterator it = global_info_->mapDefineNames.find(name);
|
||||
|
||||
if (it != global_info_->mapDefineNames.end())
|
||||
{
|
||||
while ( it->second.size() <= ind_sheet)
|
||||
{
|
||||
it->second.push_back(L"");
|
||||
}
|
||||
it->second[ind_sheet] = value;
|
||||
//it->second.push_back(value);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<std::wstring> ar(ind_sheet + 1);
|
||||
|
||||
ar[ind_sheet] = value;
|
||||
//ar.push_back(value);
|
||||
|
||||
global_info_->mapDefineNames.insert(std::make_pair(name, ar));
|
||||
}
|
||||
isSerialize = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (lbl->fFunc)
|
||||
{
|
||||
if (name == L"FORMULA") //"general_formulas.xls"
|
||||
name = L"_xludf." + name;
|
||||
}
|
||||
}
|
||||
global_info_->arDefineNames.push_back(name);// для имен функций - todooo ... не все функции корректны !! БДИ !!
|
||||
return true;
|
||||
}
|
||||
int LBL::serialize(std::wostream & stream)
|
||||
@ -110,7 +149,7 @@ int LBL::serialize(std::wostream & stream)
|
||||
|
||||
int res = 0;
|
||||
|
||||
if ((lbl->itab == 0) && (res = value.find(L"#REF")) >= 0)
|
||||
if ((lbl->itab == 0) && (res = value.find(L"#REF!")) >= 0)
|
||||
{
|
||||
for (size_t i = 0 ; i < lbl->rgce.rgce.sequence.size(); i++)
|
||||
{
|
||||
@ -132,8 +171,6 @@ int LBL::serialize(std::wostream & stream)
|
||||
}
|
||||
}
|
||||
|
||||
if (value == L"#REF") value = L"#REF!";
|
||||
|
||||
CP_XML_WRITER(stream)
|
||||
{
|
||||
CP_XML_NODE(L"definedName")
|
||||
@ -152,10 +189,6 @@ int LBL::serialize(std::wostream & stream)
|
||||
{
|
||||
CP_XML_ATTR(L"localSheetId", lbl->itab - 1);
|
||||
}
|
||||
if (lbl->fHidden)
|
||||
{
|
||||
CP_XML_ATTR(L"hidden", 1);
|
||||
}
|
||||
|
||||
CP_XML_STREAM() << xml::utils::replace_text_to_xml(value);
|
||||
}
|
||||
|
||||
@ -83,7 +83,6 @@ int PIVOTPI::serialize(std::wostream & strm)
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
} // namespace XLS
|
||||
|
||||
|
||||
@ -64,7 +64,7 @@ const bool SERIESAXIS::loadContentRead(BinReaderProcessor& proc)
|
||||
bool ok = loadContent(proc);
|
||||
if(ok)
|
||||
{
|
||||
id = proc.getGlobalWorkbookInfo()->last_Axes_id++;
|
||||
id = proc.getGlobalWorkbookInfo()->GenerateAXESId();
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
@ -108,37 +108,37 @@ BaseObjectPtr SERIESDATA::clone()
|
||||
// SERIESDATA = Dimensions 3(SIIndex *(Number / BoolErr / Blank / Label))
|
||||
const bool SERIESDATA::loadContent(BinProcessor& proc)
|
||||
{
|
||||
bool result = false;
|
||||
if(proc.optional<Dimensions>())
|
||||
if(!proc.optional<Dimensions>())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (elements_.size() > 0)
|
||||
{
|
||||
m_Dimensions = elements_.back();
|
||||
elements_.pop_back();
|
||||
result = true;
|
||||
|
||||
}
|
||||
|
||||
int count = proc.repeated<Parenthesis_SERIESDATA_1>(3, 3);
|
||||
if (count > 0)
|
||||
{
|
||||
result = true;
|
||||
|
||||
int count1= elements_.size();
|
||||
while(count1 > 0)
|
||||
int count1= elements_.size();
|
||||
while(count1 > 0)
|
||||
{
|
||||
if ("SIIndex" == elements_.front()->getClassName())
|
||||
{
|
||||
if ("SIIndex" == elements_.front()->getClassName())
|
||||
{
|
||||
m_arSIIndex.push_back(elements_.front()); count--;
|
||||
}
|
||||
else
|
||||
{
|
||||
SIIndex * si_in = dynamic_cast<SIIndex *>(m_arSIIndex.back().get());
|
||||
if (si_in)
|
||||
si_in->m_arData.push_back(elements_.front());
|
||||
}
|
||||
elements_.pop_front(); count1--;
|
||||
m_arSIIndex.push_back(elements_.front()); count--;
|
||||
}
|
||||
else
|
||||
{
|
||||
SIIndex * si_in = dynamic_cast<SIIndex *>(m_arSIIndex.back().get());
|
||||
if (si_in)
|
||||
si_in->m_arData.push_back(elements_.front());
|
||||
}
|
||||
elements_.pop_front(); count1--;
|
||||
}
|
||||
|
||||
return result;
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -31,21 +31,17 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "../CompositeObject.h"
|
||||
#include <Logic/CompositeObject.h>
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
// Logical representation of SUPBOOK union of records
|
||||
class SUPBOOK: public CompositeObject
|
||||
{
|
||||
BASE_OBJECT_DEFINE_CLASS_NAME(SUPBOOK)
|
||||
public:
|
||||
struct _xct
|
||||
{
|
||||
BaseObjectPtr m_XCT;
|
||||
std::vector<BaseObjectPtr> m_arCRN;
|
||||
};
|
||||
|
||||
SUPBOOK();
|
||||
~SUPBOOK();
|
||||
|
||||
@ -53,27 +49,11 @@ public:
|
||||
|
||||
virtual const bool loadContent(BinProcessor& proc);
|
||||
|
||||
int serialize(std::wostream & strm);
|
||||
static const ElementType type = typeSUPBOOK;
|
||||
|
||||
static const ElementType type = typeSUPBOOK;
|
||||
|
||||
BaseObjectPtr m_SupBook;
|
||||
BaseObjectPtr m_ExternSheet;
|
||||
|
||||
std::vector<BaseObjectPtr> m_arExternName;
|
||||
std::vector<_xct> m_arXCT;
|
||||
|
||||
GlobalWorkbookInfoPtr global_info;
|
||||
|
||||
std::vector<std::wstring> arNames;
|
||||
bool IsExternal();
|
||||
BaseObjectPtr m_SupBook;
|
||||
BaseObjectPtr m_ExternSheet;
|
||||
|
||||
std::wstring sExternPathLink;
|
||||
int nExternIndex;
|
||||
|
||||
private:
|
||||
int serialize_book(std::wostream & strm);
|
||||
int serialize_dde(std::wostream & strm);
|
||||
};
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -31,22 +31,25 @@
|
||||
*/
|
||||
|
||||
#include "SUPBOOK.h"
|
||||
|
||||
#include "../Biff_records/SupBook.h"
|
||||
#include "../Biff_records/ExternName.h"
|
||||
#include "../Biff_records/ExternSheet.h"
|
||||
#include "../Biff_records/Continue.h"
|
||||
#include "../Biff_records/XCT.h"
|
||||
#include "../Biff_records/CRN.h"
|
||||
#include <Logic/Biff_records/SupBook.h>
|
||||
#include <Logic/Biff_records/ExternName.h>
|
||||
#include <Logic/Biff_records/ExternSheet.h>
|
||||
#include <Logic/Biff_records/Continue.h>
|
||||
#include <Logic/Biff_records/XCT.h>
|
||||
#include <Logic/Biff_records/CRN.h>
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
SUPBOOK::SUPBOOK() : nExternIndex(-1)
|
||||
{}
|
||||
|
||||
SUPBOOK::SUPBOOK()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
SUPBOOK::~SUPBOOK()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
class Parenthesis_SUPBOOK_1: public ABNFParenthesis
|
||||
{
|
||||
@ -79,8 +82,6 @@ BaseObjectPtr SUPBOOK::clone()
|
||||
// SUPBOOK = SupBook [*ExternName *(XCT *CRN)] [ExternSheet] *Continue
|
||||
const bool SUPBOOK::loadContent(BinProcessor& proc)
|
||||
{
|
||||
global_info = proc.getGlobalWorkbookInfo();
|
||||
|
||||
SupBook supbook;
|
||||
if(!proc.mandatory(supbook))
|
||||
{
|
||||
@ -89,292 +90,30 @@ const bool SUPBOOK::loadContent(BinProcessor& proc)
|
||||
m_SupBook = elements_.back();
|
||||
elements_.pop_back();
|
||||
|
||||
if(0x3A01 != supbook.cch && 0x0401 != supbook.cch)
|
||||
if (supbook.cch != 0x0401 && supbook.cch != 0x3A01 )
|
||||
{
|
||||
nExternIndex = global_info->last_Extern_id++;
|
||||
proc.getGlobalWorkbookInfo()->arExternalNames.clear();
|
||||
}
|
||||
|
||||
|
||||
while(true)
|
||||
{
|
||||
ExternName extern_name(supbook.cch, supbook.bOleLink);
|
||||
ExternName extern_name(supbook.getSupportingLinkType());
|
||||
if(!proc.optional(extern_name))
|
||||
{
|
||||
break;
|
||||
}
|
||||
m_arExternName.push_back(elements_.front()); elements_.pop_front();
|
||||
//--------------------------------------------------------------------------------------------
|
||||
std::wstring name;
|
||||
|
||||
ExternDocName* docName = dynamic_cast<ExternDocName*>(extern_name.body.get());
|
||||
if(docName)
|
||||
{
|
||||
if (docName->ixals > 0 && !supbook.rgst.empty())
|
||||
{
|
||||
name = supbook.rgst[docName->ixals];
|
||||
}
|
||||
else
|
||||
{
|
||||
name = docName->nameDefinition.getAssembledFormula();
|
||||
if (name.empty())
|
||||
{
|
||||
name = docName->extName.value();
|
||||
}
|
||||
}
|
||||
}
|
||||
ExternDdeLinkNoOper* ddeLink = dynamic_cast<ExternDdeLinkNoOper*>(extern_name.body.get());
|
||||
if (ddeLink)
|
||||
{
|
||||
name = ddeLink->linkName.value();
|
||||
}
|
||||
|
||||
ExternOleDdeLink* oleDdeLink = dynamic_cast<ExternOleDdeLink*>(extern_name.body.get());
|
||||
if (oleDdeLink)
|
||||
{
|
||||
name = oleDdeLink->linkName.value();
|
||||
}
|
||||
|
||||
AddinUdf *addinUdf = dynamic_cast<AddinUdf*>(extern_name.body.get());
|
||||
if (addinUdf)
|
||||
{
|
||||
name = addinUdf->udfName.value(); //_xll.name(
|
||||
}
|
||||
|
||||
if ( std::wstring::npos != name.find(L";") )
|
||||
name = L"'" + name + L"'";
|
||||
|
||||
arNames.push_back(name);
|
||||
}
|
||||
|
||||
int count = proc.repeated<Parenthesis_SUPBOOK_1>(0, 0);
|
||||
while(!elements_.empty())
|
||||
{
|
||||
if ("XCT" == elements_.front()->getClassName())
|
||||
{
|
||||
_xct xcf;
|
||||
|
||||
xcf.m_XCT = elements_.front();
|
||||
count--;
|
||||
m_arXCT.push_back(xcf);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_arXCT.empty())
|
||||
{
|
||||
break; // error !!!
|
||||
}
|
||||
m_arXCT.back().m_arCRN.push_back(elements_.front());
|
||||
}
|
||||
elements_.pop_front();
|
||||
}
|
||||
|
||||
if (proc.optional<ExternSheet>())
|
||||
{
|
||||
m_ExternSheet = elements_.back();
|
||||
elements_.pop_back();
|
||||
}
|
||||
//proc.repeated<Continue>(0, 0);
|
||||
return true;
|
||||
}
|
||||
bool SUPBOOK::IsExternal()
|
||||
{
|
||||
SupBook *book = dynamic_cast<SupBook*>(m_SupBook.get());
|
||||
|
||||
if (!book) return false;
|
||||
|
||||
if(0x3A01 == book->cch || 0x0401 == book->cch)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
int SUPBOOK::serialize(std::wostream & strm)
|
||||
{
|
||||
SupBook *book = dynamic_cast<SupBook*>(m_SupBook.get());
|
||||
if (!book) return 0;
|
||||
|
||||
if(0x3A01 == book->cch || 0x0401 == book->cch)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (book->bOleLink)
|
||||
{
|
||||
serialize_dde(strm);
|
||||
}
|
||||
else
|
||||
{
|
||||
serialize_book(strm);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
int SUPBOOK::serialize_book(std::wostream & strm)
|
||||
{
|
||||
SupBook *book = dynamic_cast<SupBook*>(m_SupBook.get());
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"externalBook")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
|
||||
CP_XML_ATTR(L"r:id", L"rId1");
|
||||
|
||||
sExternPathLink = book->virtPath.back();
|
||||
|
||||
if (!m_arXCT.empty() && !book->rgst.empty())
|
||||
{
|
||||
CP_XML_NODE(L"sheetNames")
|
||||
{
|
||||
for (size_t i = 0; i < m_arXCT.size(); i++)
|
||||
{
|
||||
CP_XML_NODE(L"sheetName")
|
||||
{
|
||||
std::wstring sheet;
|
||||
|
||||
XCT * name = dynamic_cast<XCT*>(m_arXCT[i].m_XCT.get());
|
||||
if ((name) && (name->itab_exist))
|
||||
sheet = book->rgst[name->itab];
|
||||
else
|
||||
sheet = L"Sheet " + std::to_wstring(i + 1);
|
||||
|
||||
CP_XML_ATTR(L"val", sheet);
|
||||
}
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(L"sheetDataSet")
|
||||
{
|
||||
for (size_t i = 0; i < m_arXCT.size(); i++)
|
||||
{
|
||||
XCT * name = dynamic_cast<XCT*>(m_arXCT[i].m_XCT.get());
|
||||
if (!name) continue;
|
||||
|
||||
CP_XML_NODE(L"sheetData")
|
||||
{
|
||||
CP_XML_ATTR(L"sheetId", i);
|
||||
int current_row = -1;
|
||||
for (size_t j = 0; j < m_arXCT[i].m_arCRN.size(); j++)
|
||||
{
|
||||
CRN * cell = dynamic_cast<CRN*>(m_arXCT[i].m_arCRN[j].get());
|
||||
if (!cell) continue;
|
||||
if (cell->row != current_row)
|
||||
{
|
||||
CP_XML_NODE(L"row")
|
||||
{
|
||||
current_row = cell->row;
|
||||
CP_XML_ATTR(L"r", cell->row + 1);
|
||||
|
||||
for (size_t k = j; k < m_arXCT[i].m_arCRN.size(); k++)
|
||||
{
|
||||
cell = dynamic_cast<CRN*>(m_arXCT[i].m_arCRN[k].get());
|
||||
if (cell->row != current_row)
|
||||
{
|
||||
j = k - 1;
|
||||
break;
|
||||
}
|
||||
|
||||
for (unsigned char col = cell->colFirst, v = 0; col <= cell->colLast; col++, v++)
|
||||
{
|
||||
CP_XML_NODE(L"cell")
|
||||
{
|
||||
SerAr* val = dynamic_cast<SerAr*>(cell->crnOper[v].get());
|
||||
|
||||
CellRef ref(cell->row, col, true, true);
|
||||
|
||||
CP_XML_ATTR(L"r", ref.toString());
|
||||
|
||||
std::wstring strVal = val->toString();
|
||||
if (val->fixed_type == SerAr::typeSerStr)
|
||||
{
|
||||
if (0 == strVal.find(L"\""))
|
||||
strVal = strVal.substr(1, strVal.length() - 2);
|
||||
}
|
||||
|
||||
switch (val->fixed_type)
|
||||
{
|
||||
case SerAr::typeSerNil: CP_XML_ATTR(L"t", L"nil"); break;
|
||||
case SerAr::typeSerNum: CP_XML_ATTR(L"t", L"n"); break;
|
||||
case SerAr::typeSerStr: CP_XML_ATTR(L"t", L"str"); break;
|
||||
case SerAr::typeSerBool: CP_XML_ATTR(L"t", L"b"); break;
|
||||
case SerAr::typeSerErr: CP_XML_ATTR(L"t", L"e"); break;
|
||||
}
|
||||
CP_XML_NODE(L"v")
|
||||
{
|
||||
CP_XML_STREAM() << strVal;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!book->rgst.empty())
|
||||
{
|
||||
CP_XML_NODE(L"sheetNames")
|
||||
{
|
||||
for (size_t i = 0; i < book->rgst.size(); i++)
|
||||
{
|
||||
CP_XML_NODE(L"sheetName")
|
||||
{
|
||||
CP_XML_ATTR(L"val", book->rgst[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(L"sheetDataSet")
|
||||
{
|
||||
for (size_t i = 0; i < book->rgst.size(); i++)
|
||||
{
|
||||
CP_XML_NODE(L"sheetData")
|
||||
{
|
||||
CP_XML_ATTR(L"sheetId", i);
|
||||
CP_XML_ATTR(L"refreshError", 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
int SUPBOOK::serialize_dde(std::wostream & strm)
|
||||
{
|
||||
SupBook *book = dynamic_cast<SupBook*>(m_SupBook.get());
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"ddeLink")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
|
||||
CP_XML_ATTR(L"ddeService", book->virtPath[0]);
|
||||
CP_XML_ATTR(L"ddeTopic", book->virtPath[1]);
|
||||
|
||||
CP_XML_NODE(L"ddeItems")
|
||||
{
|
||||
for (size_t i = 0; i < m_arExternName.size(); i++)
|
||||
{
|
||||
ExternName * external_name = dynamic_cast<ExternName*>(m_arExternName[i].get());
|
||||
|
||||
if (!external_name) continue;
|
||||
|
||||
ExternOleDdeLink *oleDdeLink = dynamic_cast<ExternOleDdeLink*>(external_name->body.get());
|
||||
if ((oleDdeLink) && (oleDdeLink->lStgName == 0))
|
||||
{
|
||||
CP_XML_NODE(L"ddeItem")
|
||||
{
|
||||
CP_XML_ATTR(L"name", oleDdeLink->linkName.value());
|
||||
CP_XML_ATTR(L"advise", external_name->fWantAdvise);
|
||||
|
||||
oleDdeLink->moper.serialize(CP_XML_STREAM());
|
||||
}
|
||||
}
|
||||
//ole items in oleLink
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
|
||||
@ -100,8 +100,7 @@ GlobalWorkbookInfo::GlobalWorkbookInfo(const unsigned short code_page, XlsConver
|
||||
fill_x_ids[FillInfo(0, 0, 0)] = 0;
|
||||
fill_x_ids[FillInfo(17, 64, 65)] = 1;
|
||||
|
||||
last_Axes_id = 0x2000000;
|
||||
last_Extern_id = 1;
|
||||
last_AXES_id = initial_AXES_id;
|
||||
|
||||
Version = 0x0600;
|
||||
|
||||
@ -120,9 +119,6 @@ GlobalWorkbookInfo::GlobalWorkbookInfo(const unsigned short code_page, XlsConver
|
||||
defaultDigitFontSize = std::pair<float, float>(0, 0);
|
||||
applicationFonts = NULL;
|
||||
|
||||
bVbaProjectExist = false;
|
||||
bMacrosExist = false;
|
||||
|
||||
idPivotCache = 0;
|
||||
}
|
||||
|
||||
@ -177,6 +173,11 @@ void GlobalWorkbookInfo::RegisterPaletteColor(int id, const std::wstring & rgb)
|
||||
colors_palette.insert(std::make_pair(id, rgb));
|
||||
}
|
||||
|
||||
unsigned int GlobalWorkbookInfo::GenerateAXESId()
|
||||
{
|
||||
return last_AXES_id += 1;
|
||||
}
|
||||
|
||||
void GlobalWorkbookInfo::GetDigitFontSizePixels()
|
||||
{
|
||||
if (defaultDigitFontSize.first > 0.01) return;
|
||||
|
||||
@ -81,87 +81,81 @@ public:
|
||||
|
||||
void GetDigitFontSizePixels();
|
||||
|
||||
bool bVbaProjectExist;
|
||||
bool bMacrosExist;
|
||||
unsigned int GenerateAXESId();
|
||||
|
||||
unsigned short CodePage;
|
||||
CRYPT::DecryptorPtr decryptor;
|
||||
std::wstring password;
|
||||
unsigned short CodePage;
|
||||
CRYPT::DecryptorPtr decryptor;
|
||||
std::wstring password;
|
||||
|
||||
std::vector<std::wstring> sheets_state;
|
||||
std::vector<std::wstring> sheets_names;
|
||||
std::vector<std::wstring> sheets_state;
|
||||
std::vector<std::wstring> sheets_names;
|
||||
std::vector<std::wstring> xti_parsed;
|
||||
std::vector<std::wstring> AddinUdfs;
|
||||
|
||||
boost::unordered_map<BorderInfo, int> border_x_ids;
|
||||
boost::unordered_map<FillInfo, int> fill_x_ids;
|
||||
|
||||
boost::unordered_map<BorderInfo, int> border_x_ids;
|
||||
boost::unordered_map<FillInfo, int> fill_x_ids;
|
||||
std::map<int, FillInfoExt> fonts_color_ext;
|
||||
std::map<int, int> fonts_charsets;
|
||||
std::map<int, std::wstring> colors_palette;
|
||||
|
||||
std::vector<BaseObjectPtr> *m_arFonts;
|
||||
|
||||
std::map<int, FillInfoExt> fonts_color_ext;
|
||||
std::map<int, int> fonts_charsets;
|
||||
std::map<int, std::wstring> colors_palette;
|
||||
unsigned int current_sheet;
|
||||
|
||||
std::vector<BaseObjectPtr> *m_arFonts;
|
||||
|
||||
unsigned int current_sheet;
|
||||
unsigned int last_AXES_id;
|
||||
const static unsigned int initial_AXES_id = 0x2000000;
|
||||
|
||||
unsigned int last_Axes_id;
|
||||
unsigned int last_Extern_id;
|
||||
short idPivotCache;
|
||||
std::map<int, int> mapPivotCacheIndex; //streamIdCache, write index order
|
||||
std::unordered_map<int, BaseObjectPtr> mapPivotCacheStream;//streamIdCache, object
|
||||
std::vector<int> arPivotCacheStream; //order streamIdCache = iCache
|
||||
|
||||
short idPivotCache;
|
||||
std::map<int, int> mapPivotCacheIndex; //streamIdCache, write index order
|
||||
std::unordered_map<int, BaseObjectPtr> mapPivotCacheStream;//streamIdCache, object
|
||||
std::vector<int> arPivotCacheStream; //order streamIdCache = iCache
|
||||
std::vector<bool> arPivotCacheFields;
|
||||
std::vector<bool> arPivotCacheFieldShortSize;
|
||||
|
||||
std::vector<bool> arPivotCacheFields;
|
||||
std::vector<bool> arPivotCacheFieldShortSize;
|
||||
|
||||
std::vector<_sx_name> arPivotSxNames;
|
||||
std::vector<std::wstring> arPivotCacheSxNames;
|
||||
std::vector<_sx_name> arPivotSxNames;
|
||||
std::vector<std::wstring> arPivotCacheSxNames;
|
||||
|
||||
std::unordered_map<std::wstring, std::wstring> mapPivotCacheExternal;
|
||||
|
||||
std::map<std::wstring, std::vector<std::wstring>> mapDefineNames;
|
||||
std::vector<std::wstring> arDefineNames;
|
||||
|
||||
std::vector<std::pair<boost::shared_array<char>, size_t> > bin_data;
|
||||
|
||||
struct _xti
|
||||
{
|
||||
int iSup;
|
||||
std::wstring link;
|
||||
std::vector<std::wstring>* pNames = NULL;
|
||||
};
|
||||
std::vector<_xti> arXti;
|
||||
|
||||
unsigned int startAddedSharedStrings;
|
||||
std::vector<std::wstring> arAddedSharedStrings;
|
||||
std::vector<std::wstring> arExternalNames;
|
||||
|
||||
unsigned int startAddedSharedStrings;
|
||||
std::vector<std::wstring> arAddedSharedStrings;
|
||||
|
||||
std::vector<std::pair<boost::shared_array<char>, size_t> > bin_data;
|
||||
|
||||
struct _sheet_size_info
|
||||
{
|
||||
std::map<int, double> customColumnsWidth;
|
||||
std::map<int, double> customRowsHeight;
|
||||
_sheet_size_info() : defaultColumnWidth(8.), defaultRowHeight (14.4) {}
|
||||
std::map<int, double> customColumnsWidth;
|
||||
std::map<int, double> customRowsHeight;
|
||||
|
||||
double defaultColumnWidth = 8.0;
|
||||
double defaultRowHeight = 14.4;
|
||||
double defaultColumnWidth;
|
||||
double defaultRowHeight;
|
||||
};
|
||||
std::vector<_sheet_size_info> sheet_size_info;
|
||||
std::vector<_sheet_size_info> sheet_size_info;
|
||||
|
||||
std::pair<float, float> defaultDigitFontSize;
|
||||
CApplicationFonts *applicationFonts;
|
||||
std::wstring fontsDirectory;
|
||||
std::pair<float, float> defaultDigitFontSize;
|
||||
CApplicationFonts *applicationFonts;
|
||||
std::wstring fontsDirectory;
|
||||
|
||||
int Version;
|
||||
int Version;
|
||||
|
||||
int cmt_rules;
|
||||
int cellXfs_count;
|
||||
int cellStyleXfs_count;
|
||||
int cellStyleDxfs_count;
|
||||
int cmt_rules;
|
||||
int cellXfs_count;
|
||||
int cellStyleXfs_count;
|
||||
int cellStyleDxfs_count;
|
||||
|
||||
std::wstringstream users_Dxfs_stream;
|
||||
std::wstringstream connections_stream;
|
||||
std::wstringstream users_Dxfs_stream;
|
||||
std::wstringstream connections_stream;
|
||||
|
||||
int connectionId;
|
||||
int connectionId;
|
||||
|
||||
XlsConverter *xls_converter;
|
||||
XlsConverter *xls_converter;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -31,73 +31,69 @@
|
||||
*/
|
||||
|
||||
#include "GlobalsSubstream.h"
|
||||
#include "AnyObject.h"
|
||||
|
||||
#include "Biff_unions/INTERFACE.h"
|
||||
#include "Biff_unions/PROTECTION.h"
|
||||
#include "Biff_unions/FNGROUPS.h"
|
||||
#include "Biff_unions/FORMATTING.h"
|
||||
#include "Biff_unions/PIVOTCACHEDEFINITION.h"
|
||||
#include "Biff_unions/DOCROUTE.h"
|
||||
#include "Biff_unions/BUNDLESHEET.h"
|
||||
#include "Biff_unions/METADATA.h"
|
||||
#include "Biff_unions/SUPBOOK.h"
|
||||
#include "Biff_unions/LBL.h"
|
||||
#include "Biff_unions/RTD.h"
|
||||
#include "Biff_unions/MSODRAWINGGROUP.h"
|
||||
#include "Biff_unions/SHAREDSTRINGS.h"
|
||||
#include "Biff_unions/THEME.h"
|
||||
#include "Biff_unions/STYLES.h"
|
||||
|
||||
#include "Biff_records/BOF.h"
|
||||
#include "Biff_records/WriteProtect.h"
|
||||
#include "Biff_records/FilePass.h"
|
||||
#include "Biff_records/Template.h"
|
||||
#include "Biff_records/WriteAccess.h"
|
||||
#include "Biff_records/FileSharing.h"
|
||||
#include "Biff_records/CodePage.h"
|
||||
#include "Biff_records/Lel.h"
|
||||
#include "Biff_records/DSF.h"
|
||||
#include "Biff_records/Excel9File.h"
|
||||
#include "Biff_records/RRTabId.h"
|
||||
#include "Biff_records/ObProj.h"
|
||||
#include "Biff_records/ObNoMacros.h"
|
||||
#include "Biff_records/CodeName.h"
|
||||
#include "Biff_records/Lbl.h"
|
||||
#include "Biff_records/OleObjectSize.h"
|
||||
#include "Biff_records/Window1.h"
|
||||
#include "Biff_records/Backup.h"
|
||||
#include "Biff_records/HideObj.h"
|
||||
#include "Biff_records/Date1904.h"
|
||||
#include "Biff_records/CalcPrecision.h"
|
||||
#include "Biff_records/RefreshAll.h"
|
||||
#include "Biff_records/BookBool.h"
|
||||
#include "Biff_records/UserBView.h"
|
||||
#include "Biff_records/UsesELFs.h"
|
||||
#include "Biff_records/MTRSettings.h"
|
||||
#include "Biff_records/ForceFullCalculation.h"
|
||||
#include "Biff_records/Country.h"
|
||||
#include "Biff_records/RecalcId.h"
|
||||
#include "Biff_records/HFPicture.h"
|
||||
#include "Biff_records/ExtSST.h"
|
||||
#include "Biff_records/WebPub.h"
|
||||
#include "Biff_records/WOpt.h"
|
||||
#include "Biff_records/CrErr.h"
|
||||
#include "Biff_records/BookExt.h"
|
||||
#include "Biff_records/FeatHdr.h"
|
||||
#include "Biff_records/DConn.h"
|
||||
#include "Biff_records/CompressPictures.h"
|
||||
#include "Biff_records/Compat12.h"
|
||||
#include "Biff_records/GUIDTypeLib.h"
|
||||
#include "Biff_records/EOF.h"
|
||||
#include "Biff_records/BOF.h"
|
||||
#include "Biff_records/MDTInfo.h"
|
||||
#include "Biff_records/ExternSheet.h"
|
||||
#include "Biff_records/XFExt.h"
|
||||
#include "Biff_records/XFCRC.h"
|
||||
#include "Biff_records/DXF.h"
|
||||
#include "Biff_records/SupBook.h"
|
||||
#include "Biff_records/NameCmt.h"
|
||||
#include <Logic/AnyObject.h>
|
||||
#include <Logic/Biff_records/BOF.h>
|
||||
#include <Logic/Biff_records/WriteProtect.h>
|
||||
#include <Logic/Biff_records/FilePass.h>
|
||||
#include <Logic/Biff_records/Template.h>
|
||||
#include <Logic/Biff_unions/INTERFACE.h>
|
||||
#include <Logic/Biff_records/WriteAccess.h>
|
||||
#include <Logic/Biff_records/FileSharing.h>
|
||||
#include <Logic/Biff_records/CodePage.h>
|
||||
#include <Logic/Biff_records/Lel.h>
|
||||
#include <Logic/Biff_records/DSF.h>
|
||||
#include <Logic/Biff_records/Excel9File.h>
|
||||
#include <Logic/Biff_records/RRTabId.h>
|
||||
#include <Logic/Biff_records/ObProj.h>
|
||||
#include <Logic/Biff_records/ObNoMacros.h>
|
||||
#include <Logic/Biff_records/CodeName.h>
|
||||
#include <Logic/Biff_unions/FNGROUPS.h>
|
||||
#include <Logic/Biff_records/Lbl.h>
|
||||
#include <Logic/Biff_records/OleObjectSize.h>
|
||||
#include <Logic/Biff_unions/PROTECTION.h>
|
||||
#include <Logic/Biff_records/Window1.h>
|
||||
#include <Logic/Biff_records/Backup.h>
|
||||
#include <Logic/Biff_records/HideObj.h>
|
||||
#include <Logic/Biff_records/Date1904.h>
|
||||
#include <Logic/Biff_records/CalcPrecision.h>
|
||||
#include <Logic/Biff_records/RefreshAll.h>
|
||||
#include <Logic/Biff_records/BookBool.h>
|
||||
#include <Logic/Biff_unions/FORMATTING.h>
|
||||
#include <Logic/Biff_unions/PIVOTCACHEDEFINITION.h>
|
||||
#include <Logic/Biff_unions/DOCROUTE.h>
|
||||
#include <Logic/Biff_records/UserBView.h>
|
||||
#include <Logic/Biff_records/UsesELFs.h>
|
||||
#include <Logic/Biff_unions/BUNDLESHEET.h>
|
||||
#include <Logic/Biff_unions/METADATA.h>
|
||||
#include <Logic/Biff_records/MTRSettings.h>
|
||||
#include <Logic/Biff_records/ForceFullCalculation.h>
|
||||
#include <Logic/Biff_records/Country.h>
|
||||
#include <Logic/Biff_unions/SUPBOOK.h>
|
||||
#include <Logic/Biff_unions/LBL.h>
|
||||
#include <Logic/Biff_unions/RTD.h>
|
||||
#include <Logic/Biff_records/RecalcId.h>
|
||||
#include <Logic/Biff_records/HFPicture.h>
|
||||
#include <Logic/Biff_unions/MSODRAWINGGROUP.h>
|
||||
#include <Logic/Biff_unions/SHAREDSTRINGS.h>
|
||||
#include <Logic/Biff_records/ExtSST.h>
|
||||
#include <Logic/Biff_records/WebPub.h>
|
||||
#include <Logic/Biff_records/WOpt.h>
|
||||
#include <Logic/Biff_records/CrErr.h>
|
||||
#include <Logic/Biff_records/BookExt.h>
|
||||
#include <Logic/Biff_records/FeatHdr.h>
|
||||
#include <Logic/Biff_records/DConn.h>
|
||||
#include <Logic/Biff_unions/THEME.h>
|
||||
#include <Logic/Biff_records/CompressPictures.h>
|
||||
#include <Logic/Biff_records/Compat12.h>
|
||||
#include <Logic/Biff_records/GUIDTypeLib.h>
|
||||
#include <Logic/Biff_records/EOF.h>
|
||||
#include <Logic/Biff_records/BOF.h>
|
||||
#include <Logic/Biff_records/MDTInfo.h>
|
||||
#include <Logic/Biff_records/ExternSheet.h>
|
||||
#include <Logic/Biff_records/XFExt.h>
|
||||
#include <Logic/Biff_records/XFCRC.h>
|
||||
#include <Logic/Biff_records/DXF.h>
|
||||
#include <Logic/Biff_unions/STYLES.h>
|
||||
|
||||
#include "Biff_structures/ODRAW/OfficeArtDgContainer.h"
|
||||
|
||||
@ -218,47 +214,13 @@ const bool GlobalsSubstream::loadContent(BinProcessor& proc)
|
||||
case rt_InterfaceHdr: proc.optional<INTERFACE_T>(); break;
|
||||
case rt_WriteAccess: proc.optional<WriteAccess>(); break;
|
||||
case rt_Lel: proc.repeated<Lel>(0, 2047); break;
|
||||
case rt_DSF: proc.optional<DSF>(); break; //resered record
|
||||
case rt_DSF: proc.optional<DSF>(); break;
|
||||
case rt_Excel9File: proc.optional<Excel9File>(); break;
|
||||
case rt_RRTabId:
|
||||
{
|
||||
if (proc.optional<RRTabId>())
|
||||
{
|
||||
m_RRTabId = elements_.back();
|
||||
elements_.pop_back();
|
||||
}
|
||||
}break;
|
||||
case rt_ObProj:
|
||||
{
|
||||
if (proc.optional<ObProj>())
|
||||
{
|
||||
global_info_->bVbaProjectExist = true;
|
||||
global_info_->bMacrosExist = true;
|
||||
}
|
||||
}break;
|
||||
case rt_ObNoMacros:
|
||||
{
|
||||
if (proc.optional<ObNoMacros>())
|
||||
{
|
||||
global_info_->bMacrosExist = false; //empty VbaProject
|
||||
}
|
||||
}break;
|
||||
case rt_CodeName:
|
||||
{
|
||||
if (proc.optional<CodeName>())
|
||||
{
|
||||
m_CodeName = elements_.back();
|
||||
elements_.pop_back();
|
||||
}
|
||||
}break;
|
||||
case rt_BuiltInFnGroupCount:
|
||||
{
|
||||
if (proc.optional<FNGROUPS>())
|
||||
{
|
||||
m_FNGROUPS = elements_.back();
|
||||
elements_.pop_back();
|
||||
}
|
||||
}break;
|
||||
case rt_RRTabId: proc.optional<RRTabId>(); break;
|
||||
case rt_ObProj: proc.optional<ObProj>(); break;
|
||||
case rt_ObNoMacros: proc.optional<ObNoMacros>(); break;
|
||||
case rt_CodeName: proc.optional<CodeName>(); break;
|
||||
case rt_BuiltInFnGroupCount:proc.optional<FNGROUPS>(); break;
|
||||
case rt_OleObjectSize: proc.optional<OleObjectSize>(); break;
|
||||
case rt_WinProtect:
|
||||
{
|
||||
@ -377,16 +339,7 @@ const bool GlobalsSubstream::loadContent(BinProcessor& proc)
|
||||
count--;
|
||||
}
|
||||
}break;
|
||||
case rt_BoundSheet8:
|
||||
{
|
||||
count = proc.repeated<BUNDLESHEET>(1, 0);
|
||||
while(count > 0)
|
||||
{
|
||||
m_arBUNDLESHEET.insert(m_arBUNDLESHEET.begin(), elements_.back());
|
||||
elements_.pop_back();
|
||||
count--;
|
||||
}
|
||||
}break;
|
||||
case rt_BoundSheet8: proc.repeated<BUNDLESHEET>(1, 0); break;
|
||||
case rt_MDTInfo: proc.optional<METADATA>(); break;
|
||||
case rt_MTRSettings: proc.optional<MTRSettings>(); break;
|
||||
case rt_ForceFullCalculation: proc.optional<ForceFullCalculation>(); break;
|
||||
@ -455,14 +408,7 @@ const bool GlobalsSubstream::loadContent(BinProcessor& proc)
|
||||
case rt_WebPub: proc.repeated<WebPub>(0, 0); break;
|
||||
case rt_WOpt: proc.repeated<WOpt>(0, 0); break;
|
||||
case rt_CrErr: proc.optional<CrErr>(); break;
|
||||
case rt_BookExt:
|
||||
{
|
||||
if (proc.optional<BookExt>())
|
||||
{
|
||||
m_BookExt = elements_.back();
|
||||
elements_.pop_back();
|
||||
}
|
||||
}break;
|
||||
case rt_BookExt: proc.optional<BookExt>(); break;
|
||||
case rt_FeatHdr:
|
||||
{
|
||||
FeatHdr feat_hdr(true);
|
||||
@ -536,8 +482,6 @@ const bool GlobalsSubstream::loadContent(BinProcessor& proc)
|
||||
}
|
||||
}
|
||||
LoadHFPicture();
|
||||
UpdateXti();
|
||||
UpdateDefineNames();
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -583,140 +527,4 @@ void GlobalsSubstream::LoadHFPicture()
|
||||
}
|
||||
}
|
||||
|
||||
void GlobalsSubstream::UpdateXti()
|
||||
{
|
||||
for (size_t s = 0; s < m_arSUPBOOK.size(); s++)
|
||||
{
|
||||
SUPBOOK* SUPP = dynamic_cast<SUPBOOK*>(m_arSUPBOOK[s].get());
|
||||
if (!SUPP) continue;
|
||||
|
||||
ExternSheet* extern_sheet = dynamic_cast<ExternSheet*>(SUPP->m_ExternSheet.get());
|
||||
|
||||
if (!extern_sheet) continue;
|
||||
|
||||
for (size_t i = 0; i < extern_sheet->rgXTI.size(); i++)
|
||||
{
|
||||
XTI* xti = dynamic_cast<XTI*>(extern_sheet->rgXTI[i].get());
|
||||
if (!xti) continue;
|
||||
|
||||
SUPBOOK* index_book = dynamic_cast<SUPBOOK*>(m_arSUPBOOK[xti->iSupBook].get());
|
||||
if (!index_book) continue;
|
||||
|
||||
SupBook *info = dynamic_cast<SupBook*>(index_book->m_SupBook.get());
|
||||
if (!info) continue;
|
||||
|
||||
GlobalWorkbookInfo::_xti val;
|
||||
|
||||
val.iSup = xti->iSupBook;
|
||||
val.pNames = &index_book->arNames;
|
||||
|
||||
if( index_book->nExternIndex > 0 )
|
||||
{
|
||||
val.link = L"[" + std::to_wstring(index_book->nExternIndex) + L"]";
|
||||
}
|
||||
if (xti->itabFirst >= 0 /*|| itabLast >= 0*/)
|
||||
{
|
||||
if (info->rgst.empty() && index_book->nExternIndex < 0)
|
||||
{
|
||||
val.link = XMLSTUFF::xti_indexes2sheet_name(xti->itabFirst, xti->itabLast, global_info_->sheets_names);
|
||||
}
|
||||
else
|
||||
{
|
||||
val.link = XMLSTUFF::xti_indexes2sheet_name(xti->itabFirst, xti->itabLast, info->rgst, val.link);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
global_info_->arXti.push_back(val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GlobalsSubstream::UpdateDefineNames()
|
||||
{
|
||||
for (size_t s = 0; s < m_arLBL.size(); s++)
|
||||
{
|
||||
LBL* LBL_ = dynamic_cast<LBL*>(m_arLBL[s].get());
|
||||
if (!LBL_) continue;
|
||||
|
||||
Lbl *lbl = dynamic_cast<Lbl*>(LBL_->m_Lbl.get());
|
||||
if (!lbl) continue;
|
||||
|
||||
std::wstring name;
|
||||
std::wstring comment;
|
||||
|
||||
if (lbl->fBuiltin) name = lbl->Name.value().get_value_or(L"");
|
||||
if (name.empty()) name = lbl->Name_bin.value();
|
||||
|
||||
NameCmt *namecmt = dynamic_cast<NameCmt*>(LBL_->m_NameCmt.get());
|
||||
if (namecmt)
|
||||
{
|
||||
if (name.empty())
|
||||
name = namecmt->name.value();
|
||||
comment = namecmt->comment.value();
|
||||
}
|
||||
|
||||
std::wstring value = lbl->rgce.getAssembledFormula(lbl->fWorkbookParam/*lbl->itab == 0 ? true : false*/);
|
||||
|
||||
if (!value.empty() && !name.empty())
|
||||
{
|
||||
int ind_sheet = lbl->itab;
|
||||
|
||||
std::map<std::wstring, std::vector<std::wstring>>::iterator it = global_info_->mapDefineNames.find(name);
|
||||
|
||||
if (it != global_info_->mapDefineNames.end())
|
||||
{
|
||||
while ( it->second.size() <= ind_sheet)
|
||||
{
|
||||
it->second.push_back(L"");
|
||||
}
|
||||
it->second[ind_sheet] = value;
|
||||
//it->second.push_back(value);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<std::wstring> ar(ind_sheet + 1);
|
||||
|
||||
ar[ind_sheet] = value;
|
||||
//ar.push_back(value);
|
||||
|
||||
global_info_->mapDefineNames.insert(std::make_pair(name, ar));
|
||||
}
|
||||
LBL_->isSerialize = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (lbl->fFunc)
|
||||
{
|
||||
if (name == L"FORMULA") //"general_formulas.xls"
|
||||
name = L"_xludf." + name;
|
||||
}
|
||||
}
|
||||
global_info_->arDefineNames.push_back(name);// для имен функций - todooo ... не все функции корректны !! БДИ !!
|
||||
}
|
||||
}
|
||||
|
||||
int GlobalsSubstream::serialize_format(std::wostream & _stream)
|
||||
{
|
||||
BookExt *book_ext = dynamic_cast<BookExt*>(m_BookExt.get());
|
||||
CodeName *code_name = dynamic_cast<CodeName*>(m_CodeName.get());
|
||||
|
||||
CP_XML_WRITER(_stream)
|
||||
{
|
||||
CP_XML_NODE(L"workbookPr")
|
||||
{
|
||||
if (code_name)
|
||||
{
|
||||
CP_XML_ATTR(L"codeName", code_name->value);
|
||||
}
|
||||
if (book_ext)
|
||||
{
|
||||
CP_XML_ATTR(L"hidePivotFieldList", book_ext->fHidePivotList);
|
||||
CP_XML_ATTR(L"filterPrivacy", book_ext->fFilterPrivacy);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -53,9 +53,7 @@ public:
|
||||
|
||||
virtual const bool loadContent(BinProcessor& proc);
|
||||
|
||||
static const ElementType type = typeGlobalsSubstream;
|
||||
|
||||
int serialize_format(std::wostream & _stream);
|
||||
static const ElementType type = typeGlobalsSubstream;
|
||||
|
||||
BaseObjectPtr m_THEME;
|
||||
BaseObjectPtr m_Formating;
|
||||
@ -66,17 +64,12 @@ public:
|
||||
BaseObjectPtr m_Country;
|
||||
BaseObjectPtr m_WriteProtect;
|
||||
BaseObjectPtr m_PROTECTION;
|
||||
BaseObjectPtr m_RRTabId;
|
||||
BaseObjectPtr m_FNGROUPS;
|
||||
BaseObjectPtr m_BookExt;
|
||||
BaseObjectPtr m_CodeName;
|
||||
|
||||
std::vector<BaseObjectPtr> m_arHFPicture;
|
||||
std::vector<BaseObjectPtr> m_arLBL;
|
||||
std::vector<BaseObjectPtr> m_arMSODRAWINGGROUP;
|
||||
std::vector<BaseObjectPtr> m_arWindow1;
|
||||
std::vector<BaseObjectPtr> m_arUserBView;
|
||||
std::vector<BaseObjectPtr> m_arBUNDLESHEET;
|
||||
std::vector<BaseObjectPtr> m_arSUPBOOK;
|
||||
std::vector<BaseObjectPtr> m_arPIVOTCACHEDEFINITION;
|
||||
|
||||
@ -87,8 +80,6 @@ public:
|
||||
|
||||
private:
|
||||
void LoadHFPicture();
|
||||
void UpdateXti();
|
||||
void UpdateDefineNames();
|
||||
};
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -82,6 +82,7 @@ const bool WorkbookStreamObject::loadContent(BinProcessor& proc)
|
||||
bool WorksheetSubstream_found = false;
|
||||
size_t ws_index = 0;
|
||||
|
||||
// Find all substreams in this stream
|
||||
while(to_continue)
|
||||
{
|
||||
unsigned short substream_type = 0;
|
||||
@ -101,8 +102,8 @@ const bool WorkbookStreamObject::loadContent(BinProcessor& proc)
|
||||
if((proc.mandatory(global_substream)) && (elements_.size() > 0))
|
||||
{
|
||||
GlobalsSubstream_found = true;
|
||||
|
||||
m_GlobalsSubstream = elements_.back(); elements_.pop_back();
|
||||
m_GlobalsSubstream = elements_.back();
|
||||
elements_.pop_back();
|
||||
}
|
||||
if (!GlobalsSubstream_found) return false;
|
||||
}
|
||||
@ -119,8 +120,8 @@ const bool WorkbookStreamObject::loadContent(BinProcessor& proc)
|
||||
if ((proc.mandatory(worksheet_substream)) && (elements_.size() > 0))
|
||||
{
|
||||
WorksheetSubstream_found = true;
|
||||
|
||||
m_arWorksheetSubstream.push_back(elements_.back()); elements_.pop_back();
|
||||
m_arWorksheetSubstream.push_back(elements_.back());
|
||||
elements_.pop_back();
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -135,8 +136,8 @@ const bool WorkbookStreamObject::loadContent(BinProcessor& proc)
|
||||
if ((proc.mandatory<ChartSheetSubstream>()) && (elements_.size() > 0))
|
||||
{
|
||||
WorksheetSubstream_found = true;
|
||||
|
||||
m_arWorksheetSubstream.push_back(elements_.back()); elements_.pop_back();
|
||||
m_arWorksheetSubstream.push_back(elements_.back());
|
||||
elements_.pop_back();
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -151,17 +152,14 @@ const bool WorkbookStreamObject::loadContent(BinProcessor& proc)
|
||||
if ((proc.mandatory<MacroSheetSubstream>()) && (elements_.size() > 0))
|
||||
{
|
||||
WorksheetSubstream_found = true;
|
||||
|
||||
m_arMacroSheetSubstream.push_back(elements_.back()); elements_.pop_back();
|
||||
m_arMacroSheetSubstream.push_back(elements_.back());
|
||||
elements_.pop_back();
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (substream_type != 0)
|
||||
{
|
||||
Log::warning("WARNING: Substream of unsupported type " + STR::int2str(substream_type, 10) +
|
||||
" The substream is skipped!");
|
||||
}
|
||||
Log::warning("WARNING: Substream of unsupported type " + STR::int2str(substream_type, 10) +
|
||||
" The substream is skipped! Sorry.");
|
||||
proc.SeekToEOF();
|
||||
proc.optional<EOF_T>();
|
||||
|
||||
|
||||
@ -60,29 +60,28 @@
|
||||
#include "../XlsFormat/Logic/Biff_unions/PIVOTVIEW.h"
|
||||
#include "../XlsFormat/Logic/Biff_unions/PIVOTCACHE.h"
|
||||
#include "../XlsFormat/Logic/Biff_unions/PIVOTCACHEDEFINITION.h"
|
||||
#include "../XlsFormat/Logic/Biff_unions/SUPBOOK.h"
|
||||
|
||||
#include "../XlsFormat/Logic/Biff_records/BkHim.h"
|
||||
#include "../XlsFormat/Logic/Biff_records/HLink.h"
|
||||
#include "../XlsFormat/Logic/Biff_records/MsoDrawingGroup.h"
|
||||
#include "../XlsFormat/Logic/Biff_records/MsoDrawing.h"
|
||||
#include "../XlsFormat/Logic/Biff_records/Obj.h"
|
||||
#include "../XlsFormat/Logic/Biff_records/TxO.h"
|
||||
#include "../XlsFormat/Logic/Biff_records/IMDATA.h"
|
||||
#include "../XlsFormat/Logic/Biff_records/Note.h"
|
||||
#include <Logic/Biff_records/BkHim.h>
|
||||
#include <Logic/Biff_records/HLink.h>
|
||||
#include <Logic/Biff_records/MsoDrawingGroup.h>
|
||||
#include <Logic/Biff_records/MsoDrawing.h>
|
||||
#include <Logic/Biff_records/Obj.h>
|
||||
#include <Logic/Biff_records/TxO.h>
|
||||
#include <Logic/Biff_records/IMDATA.h>
|
||||
#include <Logic/Biff_records/Note.h>
|
||||
|
||||
#include "../XlsFormat/Logic/Biff_structures/URLMoniker.h"
|
||||
#include "../XlsFormat/Logic/Biff_structures/FileMoniker.h"
|
||||
#include <Logic/Biff_structures/URLMoniker.h>
|
||||
#include <Logic/Biff_structures/FileMoniker.h>
|
||||
|
||||
#include "../XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtBStoreContainer.h"
|
||||
#include "../XlsFormat/Logic/Biff_structures/ODRAW/SimpleOfficeArtContainers.h"
|
||||
#include "../XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtFOPT.h"
|
||||
#include "../XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtFOPTE.h"
|
||||
#include "../XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtFSP.h"
|
||||
#include "../XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtBlip.h"
|
||||
#include "../XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtFSPGR.h"
|
||||
#include "../XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtClientAnchorSheet.h"
|
||||
#include "../XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtClientAnchorHF.h"
|
||||
#include <Logic/Biff_structures/ODRAW/OfficeArtBStoreContainer.h>
|
||||
#include <Logic/Biff_structures/ODRAW/SimpleOfficeArtContainers.h>
|
||||
#include <Logic/Biff_structures/ODRAW/OfficeArtFOPT.h>
|
||||
#include <Logic/Biff_structures/ODRAW/OfficeArtFOPTE.h>
|
||||
#include <Logic/Biff_structures/ODRAW/OfficeArtFSP.h>
|
||||
#include <Logic/Biff_structures/ODRAW/OfficeArtBlip.h>
|
||||
#include <Logic/Biff_structures/ODRAW/OfficeArtFSPGR.h>
|
||||
#include <Logic/Biff_structures/ODRAW/OfficeArtClientAnchorSheet.h>
|
||||
#include <Logic/Biff_structures/ODRAW/OfficeArtClientAnchorHF.h>
|
||||
|
||||
#include "xlsx_conversion_context.h"
|
||||
#include "xlsx_package.h"
|
||||
@ -542,8 +541,6 @@ void XlsConverter::convert(XLS::GlobalsSubstream* global)
|
||||
{
|
||||
convert((ODRAW::OfficeArtDgContainer*)global->m_arHFPictureDrawing[i].get());
|
||||
}
|
||||
|
||||
global->serialize_format(xlsx_context->workbook_format());
|
||||
|
||||
for (size_t i = 0 ; i < global->m_arWindow1.size(); i++)
|
||||
{
|
||||
@ -554,17 +551,11 @@ void XlsConverter::convert(XLS::GlobalsSubstream* global)
|
||||
global->m_arUserBView[i]->serialize(xlsx_context->custom_views());
|
||||
}
|
||||
|
||||
for (size_t i = 0 ; i < global->m_arSUPBOOK.size(); i++)
|
||||
{
|
||||
convert((XLS::SUPBOOK*)global->m_arSUPBOOK[i].get());
|
||||
}
|
||||
|
||||
for (size_t i = 0 ; i < global->m_arPIVOTCACHEDEFINITION.size(); i++)
|
||||
{
|
||||
convert((XLS::PIVOTCACHEDEFINITION*)global->m_arPIVOTCACHEDEFINITION[i].get());
|
||||
}
|
||||
xlsx_context->get_pivots_context().add_connections(xls_global_info->connections_stream.str());
|
||||
|
||||
}
|
||||
|
||||
typedef boost::unordered_map<XLS::FillInfo, int> mapFillInfo;
|
||||
@ -1977,22 +1968,4 @@ void XlsConverter::convert(XLS::PIVOTCACHEDEFINITION * pivot_cached)
|
||||
{
|
||||
xlsx_context->get_pivots_context().add_cache_external(xls_global_info->mapPivotCacheExternal);
|
||||
}
|
||||
}
|
||||
|
||||
void XlsConverter::convert(XLS::SUPBOOK * external)
|
||||
{
|
||||
if (external == NULL) return;
|
||||
if (external->IsExternal() == false) return;
|
||||
|
||||
xlsx_context->start_external();
|
||||
|
||||
external->serialize(xlsx_context->current_external().externalData());
|
||||
|
||||
if (!external->sExternPathLink.empty()) //???
|
||||
{
|
||||
xlsx_context->current_external().add_rels(false, L"rId1", external->sExternPathLink, oox::external_items::typeExternalLink);
|
||||
}
|
||||
|
||||
xlsx_context->end_external();
|
||||
|
||||
}
|
||||
}
|
||||
@ -72,7 +72,6 @@ namespace XLS
|
||||
class IMDATA;
|
||||
class PIVOTVIEW;
|
||||
class PIVOTCACHEDEFINITION;
|
||||
class SUPBOOK;
|
||||
|
||||
class Note;
|
||||
class TxO;
|
||||
@ -122,7 +121,6 @@ public:
|
||||
void convert(XLS::IMDATA * imadata);
|
||||
void convert(XLS::PIVOTVIEW * pivot_view);
|
||||
void convert(XLS::PIVOTCACHEDEFINITION * pivot_cached);
|
||||
void convert(XLS::SUPBOOK * external);
|
||||
|
||||
void convert(ODRAW::OfficeArtRecord * art);
|
||||
void convert(ODRAW::OfficeArtBStoreContainer* art_bstore, int start_id = 0);
|
||||
|
||||
@ -41,7 +41,7 @@ class rels;
|
||||
class external_items
|
||||
{
|
||||
public:
|
||||
enum Type { typeUnknown = 0, typeImage, typeChart, typeShape, typeTable, typeHyperlink, typeComment, typeMedia, typeGroup, typeExternalLink};
|
||||
enum Type { typeUnknown = 0, typeImage, typeChart, typeShape, typeTable, typeHyperlink, typeComment, typeMedia, typeGroup};
|
||||
|
||||
external_items()
|
||||
{
|
||||
|
||||
@ -58,11 +58,9 @@ std::wstring get_rel_type(external_items::Type type)
|
||||
{
|
||||
case external_items::typeImage:
|
||||
return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image";
|
||||
case external_items::typeChart:
|
||||
case external_items::typeChart:
|
||||
return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart";
|
||||
case external_items::typeExternalLink:
|
||||
return L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLinkPath";
|
||||
default:
|
||||
default:
|
||||
return L"";
|
||||
}
|
||||
}
|
||||
|
||||
@ -57,6 +57,8 @@ typedef std::vector<element_ptr> element_ptr_array;
|
||||
|
||||
class document;
|
||||
|
||||
|
||||
/// \class element
|
||||
class element
|
||||
{
|
||||
public:
|
||||
|
||||
@ -96,17 +96,6 @@ oox_chart_context & xlsx_conversion_context::current_chart()
|
||||
throw std::runtime_error("internal error");
|
||||
}
|
||||
}
|
||||
oox_external_context & xlsx_conversion_context::current_external()
|
||||
{
|
||||
if (!externals_.empty())
|
||||
{
|
||||
return *externals_.back().get();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw std::runtime_error("internal error");
|
||||
}
|
||||
}
|
||||
bool xlsx_conversion_context::start_table(const std::wstring & name)
|
||||
{
|
||||
sheets_.push_back(xlsx_xml_worksheet::create(name));
|
||||
@ -141,15 +130,6 @@ void xlsx_conversion_context::end_chart()
|
||||
{
|
||||
}
|
||||
|
||||
void xlsx_conversion_context::start_external()
|
||||
{
|
||||
externals_.push_back(oox_external_context::create());
|
||||
}
|
||||
void xlsx_conversion_context::end_external()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void xlsx_conversion_context::end_table()
|
||||
{
|
||||
get_table_context().serialize_hyperlinks(current_sheet().hyperlinks());
|
||||
@ -168,7 +148,7 @@ void xlsx_conversion_context::end_document()
|
||||
std::wstringstream workbook_content;
|
||||
|
||||
unsigned int count = 0;
|
||||
|
||||
// добавляем таблицы
|
||||
for (size_t i = 0; i < sheets_.size(); i++)
|
||||
{
|
||||
xlsx_xml_worksheet_ptr & sheet = sheets_[i];
|
||||
@ -241,7 +221,6 @@ void xlsx_conversion_context::end_document()
|
||||
|
||||
output_document_->get_xl_files().add_charts(content);
|
||||
}
|
||||
|
||||
//workbook_content << L"<calcPr iterateCount=\"100\" refMode=\"A1\" iterate=\"false\" iterateDelta=\"0.0001\" />";
|
||||
|
||||
output_document_->get_xl_files().set_sharedStrings( package::simple_element::create(L"sharedStrings.xml", xlsx_shared_strings_.str()) );
|
||||
@ -256,12 +235,8 @@ void xlsx_conversion_context::end_document()
|
||||
CP_XML_ATTR(L"xmlns", L"http://schemas.openxmlformats.org/spreadsheetml/2006/main");
|
||||
CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
|
||||
CP_XML_ATTR(L"xmlns:mc", L"http://schemas.openxmlformats.org/markup-compatibility/2006");
|
||||
CP_XML_ATTR(L"mc:Ignorable", L"x15");
|
||||
CP_XML_ATTR(L"xmlns:x15", L"http://schemas.microsoft.com/office/spreadsheetml/2010/11/main");
|
||||
|
||||
CP_XML_STREAM() << xlsx_workbook_pr_.str();
|
||||
|
||||
CP_XML_NODE(L"bookViews")
|
||||
CP_XML_NODE(L"bookViews")
|
||||
{
|
||||
CP_XML_STREAM() << xlsx_workbook_views_.str();
|
||||
}
|
||||
@ -270,27 +245,7 @@ void xlsx_conversion_context::end_document()
|
||||
{
|
||||
CP_XML_STREAM() << workbook_content.str();
|
||||
}
|
||||
if (externals_.empty() == false)
|
||||
{
|
||||
CP_XML_NODE(L"externalReferences")
|
||||
{
|
||||
for (size_t i = 0; i < externals_.size(); i++)
|
||||
{
|
||||
std::wstring rId = L"extId" + std::to_wstring(i+1);
|
||||
|
||||
CP_XML_NODE(L"externalReference")
|
||||
{
|
||||
CP_XML_ATTR(L"r:id", rId);
|
||||
}
|
||||
package::external_content_ptr content = package::external_content::create();
|
||||
|
||||
externals_[i]->dump_rels(content->get_rels());
|
||||
externals_[i]->write_to(content->content());
|
||||
|
||||
output_document_->get_xl_files().add_external(content);
|
||||
}
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(L"definedNames")
|
||||
{
|
||||
CP_XML_STREAM() << xlsx_defined_names_.str();
|
||||
|
||||
@ -42,7 +42,6 @@
|
||||
#include "xlsx_chart_context.h"
|
||||
#include "xlsx_comments_context.h"
|
||||
#include "xlsx_pivots_context.h"
|
||||
#include "xlsx_external_context.h"
|
||||
|
||||
#include "xlsx_output_xml.h"
|
||||
|
||||
@ -73,21 +72,16 @@ public:
|
||||
void start_chart();
|
||||
void end_chart();
|
||||
|
||||
void start_external();
|
||||
void end_external();
|
||||
|
||||
std::wostream & shared_strings() { return xlsx_shared_strings_; }
|
||||
std::wostream & defined_names() { return xlsx_defined_names_; }
|
||||
std::wostream & workbook_views() { return xlsx_workbook_views_; }
|
||||
std::wostream & custom_views() { return xlsx_custom_views_; }
|
||||
std::wostream & workbook_format() { return xlsx_workbook_pr_; }
|
||||
|
||||
xlsx_text_context & get_text_context() { return xlsx_text_context_; }
|
||||
xlsx_table_context & get_table_context() { return xlsx_table_context_; }
|
||||
xlsx_xml_worksheet & current_sheet();
|
||||
|
||||
oox_chart_context & current_chart();
|
||||
oox_external_context & current_external();
|
||||
|
||||
xlsx_pivots_context & get_pivots_context() {return xlsx_pivots_context_;}
|
||||
xlsx_drawing_context & get_drawing_context();
|
||||
@ -96,8 +90,6 @@ public:
|
||||
xlsx_comments_context_handle & get_comments_context_handle();
|
||||
|
||||
external_items & get_mediaitems() { return mediaitems_; }
|
||||
|
||||
void add_exteranal_content(std::wstring content);
|
||||
private:
|
||||
|
||||
void create_new_sheet(std::wstring const & name);
|
||||
@ -108,10 +100,8 @@ private:
|
||||
|
||||
std::vector<xlsx_xml_worksheet_ptr> sheets_;
|
||||
std::vector<oox_chart_context_ptr> charts_;
|
||||
|
||||
std::vector<oox_external_context_ptr> externals_;
|
||||
|
||||
//std::wstringstream defaultOutput_;
|
||||
|
||||
//std::wstringstream defaultOutput_;
|
||||
//std::pair<float,float> maxDigitSize_;
|
||||
//num_format_context num_format_context_;
|
||||
//size_t default_style_;
|
||||
@ -126,7 +116,6 @@ private:
|
||||
std::wstringstream xlsx_defined_names_;
|
||||
std::wstringstream xlsx_workbook_views_;
|
||||
std::wstringstream xlsx_custom_views_;
|
||||
std::wstringstream xlsx_workbook_pr_;
|
||||
|
||||
xlsx_drawing_context_handle xlsx_drawing_context_handle_;
|
||||
xlsx_comments_context_handle xlsx_comments_context_handle_;
|
||||
|
||||
@ -38,7 +38,7 @@
|
||||
#include <boost/shared_array.hpp>
|
||||
#include "../Common/common.h"
|
||||
|
||||
#include "../XlsFormat/Logic/Biff_structures/ODRAW/OfficeArtFOPTE.h"
|
||||
#include <Logic/Biff_structures/ODRAW/OfficeArtFOPTE.h>
|
||||
|
||||
#include "xlsx_drawings.h"
|
||||
|
||||
|
||||
@ -1,162 +0,0 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#include "xlsx_conversion_context.h"
|
||||
#include "oox_rels.h"
|
||||
#include "mediaitems_utils.h"
|
||||
|
||||
#include <boost/make_shared.hpp>
|
||||
|
||||
#include <simple_xml_writer.h>
|
||||
|
||||
namespace oox {
|
||||
|
||||
class oox_external_context::Impl
|
||||
{
|
||||
struct rel_
|
||||
{
|
||||
rel_(bool is_internal, std::wstring const & rid, std::wstring const & target, external_items::Type type) :
|
||||
is_internal_(is_internal),
|
||||
rid_(rid),
|
||||
target_(target),
|
||||
type_(type)
|
||||
{}
|
||||
|
||||
bool is_internal_;
|
||||
std::wstring rid_;
|
||||
std::wstring target_;
|
||||
external_items::Type type_;
|
||||
};
|
||||
|
||||
public:
|
||||
Impl() {}
|
||||
|
||||
std::wstringstream externalData_;
|
||||
std::vector<rel_> externalRels_;
|
||||
|
||||
void dump_rels(rels & Rels)
|
||||
{
|
||||
for (size_t i = 0; i < externalRels_.size(); i++)
|
||||
{
|
||||
rel_ & r = externalRels_[i];
|
||||
if (r.type_ == external_items::typeImage ||
|
||||
r.type_ == external_items::typeExternalLink)
|
||||
{
|
||||
Rels.add(relationship(
|
||||
r.rid_,
|
||||
utils::media::get_rel_type(r.type_),
|
||||
r.is_internal_ ? std::wstring(L"../") + r.target_ : r.target_,
|
||||
(r.is_internal_ ? L"" : L"External")
|
||||
)
|
||||
);
|
||||
}
|
||||
else if (r.type_ == external_items::typeHyperlink)
|
||||
{
|
||||
Rels.add(relationship(
|
||||
r.rid_,
|
||||
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",
|
||||
r.target_,
|
||||
L"External")
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void add_rels(
|
||||
bool isInternal,
|
||||
std::wstring const & rid,
|
||||
std::wstring const & target,
|
||||
external_items::Type type)
|
||||
{
|
||||
bool present = false;
|
||||
|
||||
for (size_t i = 0; i < externalRels_.size(); i++)
|
||||
{
|
||||
rel_ & r = externalRels_[i];
|
||||
if (r.rid_ == rid && r.target_ == target)
|
||||
present = true;
|
||||
}
|
||||
if (!present)
|
||||
{
|
||||
externalRels_.push_back(rel_(isInternal, rid, target, type));
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
oox_external_context_ptr oox_external_context::create()
|
||||
{
|
||||
return boost::make_shared<oox_external_context>();
|
||||
}
|
||||
|
||||
oox_external_context::oox_external_context() : impl_(new oox_external_context::Impl())
|
||||
{
|
||||
}
|
||||
std::wostream & oox_external_context::externalData()
|
||||
{
|
||||
return impl_->externalData_;
|
||||
}
|
||||
void oox_external_context::add_rels(
|
||||
bool isInternal,
|
||||
std::wstring const & rid,
|
||||
std::wstring const & target,
|
||||
external_items::Type type)
|
||||
{
|
||||
impl_->add_rels(isInternal, rid, target, type);
|
||||
}
|
||||
void oox_external_context::dump_rels(rels & Rels)
|
||||
{
|
||||
impl_->dump_rels(Rels);
|
||||
}
|
||||
void oox_external_context::write_to(std::wostream & strm)
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"externalLink")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns:x14", L"http://schemas.microsoft.com/office/spreadsheetml/2009/9/main");
|
||||
CP_XML_ATTR(L"xmlns", L"http://schemas.openxmlformats.org/spreadsheetml/2006/main");
|
||||
CP_XML_ATTR(L"mc:Ignorable", L"x14");
|
||||
CP_XML_ATTR(L"xmlns:mc", L"http://schemas.openxmlformats.org/markup-compatibility/2006");
|
||||
|
||||
CP_XML_STREAM() << impl_->externalData_.str();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
oox_external_context::~oox_external_context()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,64 +0,0 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#include "oox_package.h"
|
||||
|
||||
namespace oox {
|
||||
|
||||
class oox_external_context;
|
||||
typedef _CP_PTR(oox_external_context) oox_external_context_ptr;
|
||||
|
||||
class oox_external_context
|
||||
{
|
||||
public:
|
||||
oox_external_context();
|
||||
~oox_external_context();
|
||||
|
||||
std::wostream & externalData();
|
||||
|
||||
void write_to (std::wostream & strm);
|
||||
void dump_rels (rels & Rels);
|
||||
|
||||
static oox_external_context_ptr create();
|
||||
void add_rels( bool isInternal,
|
||||
std::wstring const & rid,
|
||||
std::wstring const & target,
|
||||
external_items::Type type);
|
||||
|
||||
|
||||
private:
|
||||
class Impl;
|
||||
_CP_PTR(Impl) impl_;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
@ -97,15 +97,6 @@ _CP_PTR(pivot_table_content) pivot_table_content::create()
|
||||
return boost::make_shared<pivot_table_content>();
|
||||
}
|
||||
//--------------------------------------------------------------------------------------------
|
||||
external_content::external_content() : rels_file_(rels_file::create(L""))
|
||||
{
|
||||
}
|
||||
|
||||
_CP_PTR(external_content) external_content::create()
|
||||
{
|
||||
return boost::make_shared<external_content>();
|
||||
}
|
||||
//--------------------------------------------------------------------------------------------
|
||||
sheet_content::sheet_content() : rels_(rels_file::create(L""))
|
||||
{
|
||||
|
||||
@ -256,11 +247,6 @@ void xl_files::write(const std::wstring & RootPath)
|
||||
charts_files_.set_main_document(get_main_document());
|
||||
charts_files_.write(path);
|
||||
}
|
||||
{
|
||||
externals_files_.set_rels(&rels_files_);
|
||||
externals_files_.set_main_document(get_main_document());
|
||||
externals_files_.write(path);
|
||||
}
|
||||
|
||||
if (drawings_)
|
||||
{
|
||||
@ -332,10 +318,6 @@ void xl_files::add_charts(chart_content_ptr chart)
|
||||
{
|
||||
charts_files_.add_chart(chart);
|
||||
}
|
||||
void xl_files::add_external(external_content_ptr external)
|
||||
{
|
||||
externals_files_.add_external(external);
|
||||
}
|
||||
void xl_files::add_pivot_cache(pivot_cache_content_ptr pivot_cache)
|
||||
{
|
||||
pivot_cache_files_.add_pivot_cache(pivot_cache);
|
||||
@ -466,47 +448,6 @@ void xl_charts_files::write(const std::wstring & RootPath)
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
void xl_externals_files::add_external(external_content_ptr external)
|
||||
{
|
||||
externals_.push_back(external);
|
||||
}
|
||||
void xl_externals_files::write(const std::wstring & RootPath)
|
||||
{
|
||||
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"externalLinks";
|
||||
NSDirectory::CreateDirectory(path.c_str());
|
||||
|
||||
content_type & contentTypes = this->get_main_document()->content_type().get_content_type();
|
||||
static const std::wstring kWSConType = L"application/vnd.openxmlformats-officedocument.spreadsheetml.externalLink+xml";
|
||||
|
||||
for (size_t i = 0; i < externals_.size(); i++)
|
||||
{
|
||||
if (!externals_[i]) continue;
|
||||
|
||||
const std::wstring fileName = std::wstring(L"externalLink") + std::to_wstring(i + 1) + L".xml";
|
||||
|
||||
contentTypes.add_override(std::wstring(L"/xl/externalLinks/") + fileName, kWSConType);
|
||||
|
||||
package::simple_element(fileName, externals_[i]->str()).write(path);
|
||||
|
||||
if (externals_[i]->get_rels().empty() == false)
|
||||
{
|
||||
rels_files relFiles;
|
||||
externals_[i]->rels_file_->set_file_name(fileName + L".rels");
|
||||
|
||||
relFiles.add_rel_file(externals_[i]->rels_file_);
|
||||
relFiles.write(path);
|
||||
}
|
||||
if (rels_)
|
||||
{
|
||||
const std::wstring id = std::wstring(L"extId") + std::to_wstring(i + 1);
|
||||
static const std::wstring kWSRel = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLink";
|
||||
const std::wstring fileRef = std::wstring(L"externalLinks/") + fileName;
|
||||
|
||||
rels_->add(id, kWSRel, fileRef);
|
||||
}
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
xl_drawings_ptr xl_drawings::create(const std::vector<drawing_elm> & elms)
|
||||
{
|
||||
return boost::make_shared<xl_drawings>(boost::ref(elms));
|
||||
|
||||
@ -103,24 +103,6 @@ private:
|
||||
};
|
||||
typedef _CP_PTR(pivot_table_content) pivot_table_content_ptr;
|
||||
//------------------------------------------------------------------------
|
||||
class external_content : boost::noncopyable
|
||||
{
|
||||
public:
|
||||
external_content();
|
||||
static _CP_PTR(external_content) create();
|
||||
|
||||
std::wostream & content() { return content_; }
|
||||
rels & get_rels() { return rels_file_->get_rels(); }
|
||||
|
||||
std::wstring str() { return content_.str(); }
|
||||
|
||||
friend class xl_externals_files;
|
||||
private:
|
||||
std::wstringstream content_;
|
||||
rels_file_ptr rels_file_;
|
||||
};
|
||||
typedef _CP_PTR(external_content) external_content_ptr;
|
||||
//------------------------------------------------------------------------
|
||||
class sheets_files : public element
|
||||
{
|
||||
public:
|
||||
@ -139,6 +121,7 @@ public:
|
||||
rels_files * rels_;
|
||||
|
||||
};
|
||||
|
||||
class xl_charts_files : public element
|
||||
{
|
||||
public:
|
||||
@ -150,22 +133,6 @@ public:
|
||||
std::vector<chart_content_ptr> charts_;
|
||||
|
||||
};
|
||||
|
||||
class xl_externals_files : public element
|
||||
{
|
||||
public:
|
||||
xl_externals_files(){}
|
||||
|
||||
void set_rels(rels_files * rels)
|
||||
{
|
||||
rels_ = rels;
|
||||
}
|
||||
void add_external(external_content_ptr external);
|
||||
virtual void write(const std::wstring & RootPath);
|
||||
|
||||
std::vector<external_content_ptr> externals_;
|
||||
rels_files * rels_;
|
||||
};
|
||||
class xl_pivot_table_files : public element
|
||||
{
|
||||
public:
|
||||
@ -238,7 +205,6 @@ private:
|
||||
rels_files * rels_;
|
||||
|
||||
};
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
class xl_files : public element
|
||||
{
|
||||
@ -258,7 +224,6 @@ public:
|
||||
void set_vml_drawings (element_ptr Element);
|
||||
void set_comments (element_ptr Element);
|
||||
void add_charts (chart_content_ptr chart);
|
||||
void add_external (external_content_ptr external);
|
||||
void add_pivot_cache (pivot_cache_content_ptr cache);
|
||||
void add_pivot_table (pivot_table_content_ptr table);
|
||||
|
||||
@ -267,7 +232,6 @@ private:
|
||||
rels_files rels_files_;
|
||||
sheets_files sheets_files_;
|
||||
xl_charts_files charts_files_;
|
||||
xl_externals_files externals_files_;
|
||||
xl_pivot_cache_files pivot_cache_files_;
|
||||
xl_pivot_table_files pivot_table_files_;
|
||||
|
||||
|
||||
@ -841,7 +841,6 @@ SOURCES += \
|
||||
../XlsXlsxConverter/xlsx_textcontext.cpp \
|
||||
../XlsXlsxConverter/xlsx_chart_context.cpp \
|
||||
../XlsXlsxConverter/xlsx_pivots_context.cpp \
|
||||
../XlsXlsxConverter/xlsx_external_context.cpp \
|
||||
../XlsXlsxConverter/xlsx_comments.cpp \
|
||||
../XlsXlsxConverter/xlsx_comments_context.cpp \
|
||||
|
||||
@ -1606,7 +1605,6 @@ HEADERS += \
|
||||
../XlsXlsxConverter/xlsx_protection.h \
|
||||
../XlsXlsxConverter/xlsx_tablecontext.h \
|
||||
../XlsXlsxConverter/xlsx_textcontext.h \
|
||||
../XlsXlsxConverter/xlsx_external_context.h \
|
||||
../XlsFormat/Logic/AnyObject.h \
|
||||
../XlsFormat/Logic/AnySubstream.h \
|
||||
../XlsFormat/Logic/BaseObject.h \
|
||||
|
||||
@ -392,14 +392,6 @@
|
||||
RelativePath="..\XlsXlsxConverter\xlsx_drawings.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\XlsXlsxConverter\xlsx_external_context.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\XlsXlsxConverter\xlsx_external_context.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\XlsXlsxConverter\xlsx_hyperlinks.cpp"
|
||||
>
|
||||
|
||||
@ -1,146 +1,143 @@
|
||||
// 3way.cpp - modifed by Wei Dai from Joan Daemen's 3way.c
|
||||
// The original code and all modifications are in the public domain.
|
||||
|
||||
#include "pch.h"
|
||||
#include "3way.h"
|
||||
#include "misc.h"
|
||||
|
||||
NAMESPACE_BEGIN(CryptoPP)
|
||||
|
||||
#if CRYPTOPP_DEBUG && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
|
||||
void ThreeWay_TestInstantiations()
|
||||
{
|
||||
ThreeWay::Encryption x1;
|
||||
ThreeWay::Decryption x2;
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace
|
||||
{
|
||||
const word32 START_E = 0x0b0b; // round constant of first encryption round
|
||||
const word32 START_D = 0xb1b1; // round constant of first decryption round
|
||||
#ifdef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
|
||||
const word32 RC_MODULUS = 0x11011;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline word32 reverseBits(word32 a)
|
||||
{
|
||||
a = ((a & 0xAAAAAAAA) >> 1) | ((a & 0x55555555) << 1);
|
||||
a = ((a & 0xCCCCCCCC) >> 2) | ((a & 0x33333333) << 2);
|
||||
return ((a & 0xF0F0F0F0) >> 4) | ((a & 0x0F0F0F0F) << 4);
|
||||
}
|
||||
|
||||
#define mu(a0, a1, a2) \
|
||||
{ \
|
||||
a1 = reverseBits(a1); \
|
||||
word32 t = reverseBits(a0); \
|
||||
a0 = reverseBits(a2); \
|
||||
a2 = t; \
|
||||
}
|
||||
|
||||
#define pi_gamma_pi(a0, a1, a2) \
|
||||
{ \
|
||||
word32 b0, b2; \
|
||||
b2 = rotlFixed(a2, 1U); \
|
||||
b0 = rotlFixed(a0, 22U); \
|
||||
a0 = rotlFixed(b0 ^ (a1|(~b2)), 1U); \
|
||||
a2 = rotlFixed(b2 ^ (b0|(~a1)), 22U);\
|
||||
a1 ^= (b2|(~b0)); \
|
||||
}
|
||||
|
||||
// thanks to Paulo Barreto for this optimized theta()
|
||||
#define theta(a0, a1, a2) \
|
||||
{ \
|
||||
word32 b0, b1, c; \
|
||||
c = a0 ^ a1 ^ a2; \
|
||||
c = rotlFixed(c, 16U) ^ rotlFixed(c, 8U); \
|
||||
b0 = (a0 << 24) ^ (a2 >> 8) ^ (a1 << 8) ^ (a0 >> 24); \
|
||||
b1 = (a1 << 24) ^ (a0 >> 8) ^ (a2 << 8) ^ (a1 >> 24); \
|
||||
a0 ^= c ^ b0; \
|
||||
a1 ^= c ^ b1; \
|
||||
a2 ^= c ^ (b0 >> 16) ^ (b1 << 16); \
|
||||
}
|
||||
|
||||
#define rho(a0, a1, a2) \
|
||||
{ \
|
||||
theta(a0, a1, a2); \
|
||||
pi_gamma_pi(a0, a1, a2); \
|
||||
}
|
||||
|
||||
void ThreeWay::Base::UncheckedSetKey(const byte *uk, unsigned int length, const NameValuePairs ¶ms)
|
||||
{
|
||||
AssertValidKeyLength(length);
|
||||
|
||||
m_rounds = GetRoundsAndThrowIfInvalid(params, this);
|
||||
|
||||
for (unsigned int i=0; i<3; i++)
|
||||
m_k[i] = (word32)uk[4*i+3] | ((word32)uk[4*i+2]<<8) | ((word32)uk[4*i+1]<<16) | ((word32)uk[4*i]<<24);
|
||||
|
||||
if (!IsForwardTransformation())
|
||||
{
|
||||
theta(m_k[0], m_k[1], m_k[2]);
|
||||
mu(m_k[0], m_k[1], m_k[2]);
|
||||
m_k[0] = ByteReverse(m_k[0]);
|
||||
m_k[1] = ByteReverse(m_k[1]);
|
||||
m_k[2] = ByteReverse(m_k[2]);
|
||||
}
|
||||
}
|
||||
|
||||
void ThreeWay::Enc::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const
|
||||
{
|
||||
typedef BlockGetAndPut<word32, BigEndian> Block;
|
||||
|
||||
word32 a0, a1, a2;
|
||||
Block::Get(inBlock)(a0)(a1)(a2);
|
||||
|
||||
word32 rc = START_E;
|
||||
|
||||
for(unsigned i=0; i<m_rounds; i++)
|
||||
{
|
||||
a0 ^= m_k[0] ^ (rc<<16);
|
||||
a1 ^= m_k[1];
|
||||
a2 ^= m_k[2] ^ rc;
|
||||
rho(a0, a1, a2);
|
||||
|
||||
rc <<= 1;
|
||||
if (rc&0x10000) rc ^= 0x11011;
|
||||
}
|
||||
a0 ^= m_k[0] ^ (rc<<16);
|
||||
a1 ^= m_k[1];
|
||||
a2 ^= m_k[2] ^ rc;
|
||||
theta(a0, a1, a2);
|
||||
|
||||
Block::Put(xorBlock, outBlock)(a0)(a1)(a2);
|
||||
}
|
||||
|
||||
void ThreeWay::Dec::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const
|
||||
{
|
||||
typedef BlockGetAndPut<word32, LittleEndian> Block;
|
||||
|
||||
word32 a0, a1, a2;
|
||||
Block::Get(inBlock)(a0)(a1)(a2);
|
||||
|
||||
word32 rc = START_D;
|
||||
|
||||
mu(a0, a1, a2);
|
||||
for(unsigned i=0; i<m_rounds; i++)
|
||||
{
|
||||
a0 ^= m_k[0] ^ (rc<<16);
|
||||
a1 ^= m_k[1];
|
||||
a2 ^= m_k[2] ^ rc;
|
||||
rho(a0, a1, a2);
|
||||
|
||||
rc <<= 1;
|
||||
if (rc&0x10000) rc ^= 0x11011;
|
||||
}
|
||||
a0 ^= m_k[0] ^ (rc<<16);
|
||||
a1 ^= m_k[1];
|
||||
a2 ^= m_k[2] ^ rc;
|
||||
theta(a0, a1, a2);
|
||||
mu(a0, a1, a2);
|
||||
|
||||
Block::Put(xorBlock, outBlock)(a0)(a1)(a2);
|
||||
}
|
||||
|
||||
NAMESPACE_END
|
||||
// 3way.cpp - modifed by Wei Dai from Joan Daemen's 3way.c
|
||||
// The original code and all modifications are in the public domain.
|
||||
|
||||
#include "pch.h"
|
||||
#include "3way.h"
|
||||
#include "misc.h"
|
||||
|
||||
NAMESPACE_BEGIN(CryptoPP)
|
||||
|
||||
#if !defined(NDEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
|
||||
void ThreeWay_TestInstantiations()
|
||||
{
|
||||
ThreeWay::Encryption x1;
|
||||
ThreeWay::Decryption x2;
|
||||
}
|
||||
#endif
|
||||
|
||||
static const word32 START_E = 0x0b0b; // round constant of first encryption round
|
||||
static const word32 START_D = 0xb1b1; // round constant of first decryption round
|
||||
#ifdef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
|
||||
static const word32 RC_MODULUS = 0x11011;
|
||||
#endif
|
||||
|
||||
static inline word32 reverseBits(word32 a)
|
||||
{
|
||||
a = ((a & 0xAAAAAAAA) >> 1) | ((a & 0x55555555) << 1);
|
||||
a = ((a & 0xCCCCCCCC) >> 2) | ((a & 0x33333333) << 2);
|
||||
return ((a & 0xF0F0F0F0) >> 4) | ((a & 0x0F0F0F0F) << 4);
|
||||
}
|
||||
|
||||
#define mu(a0, a1, a2) \
|
||||
{ \
|
||||
a1 = reverseBits(a1); \
|
||||
word32 t = reverseBits(a0); \
|
||||
a0 = reverseBits(a2); \
|
||||
a2 = t; \
|
||||
}
|
||||
|
||||
#define pi_gamma_pi(a0, a1, a2) \
|
||||
{ \
|
||||
word32 b0, b2; \
|
||||
b2 = rotlFixed(a2, 1U); \
|
||||
b0 = rotlFixed(a0, 22U); \
|
||||
a0 = rotlFixed(b0 ^ (a1|(~b2)), 1U); \
|
||||
a2 = rotlFixed(b2 ^ (b0|(~a1)), 22U);\
|
||||
a1 ^= (b2|(~b0)); \
|
||||
}
|
||||
|
||||
// thanks to Paulo Barreto for this optimized theta()
|
||||
#define theta(a0, a1, a2) \
|
||||
{ \
|
||||
word32 b0, b1, c; \
|
||||
c = a0 ^ a1 ^ a2; \
|
||||
c = rotlFixed(c, 16U) ^ rotlFixed(c, 8U); \
|
||||
b0 = (a0 << 24) ^ (a2 >> 8) ^ (a1 << 8) ^ (a0 >> 24); \
|
||||
b1 = (a1 << 24) ^ (a0 >> 8) ^ (a2 << 8) ^ (a1 >> 24); \
|
||||
a0 ^= c ^ b0; \
|
||||
a1 ^= c ^ b1; \
|
||||
a2 ^= c ^ (b0 >> 16) ^ (b1 << 16); \
|
||||
}
|
||||
|
||||
#define rho(a0, a1, a2) \
|
||||
{ \
|
||||
theta(a0, a1, a2); \
|
||||
pi_gamma_pi(a0, a1, a2); \
|
||||
}
|
||||
|
||||
void ThreeWay::Base::UncheckedSetKey(const byte *uk, unsigned int length, const NameValuePairs ¶ms)
|
||||
{
|
||||
AssertValidKeyLength(length);
|
||||
|
||||
m_rounds = GetRoundsAndThrowIfInvalid(params, this);
|
||||
|
||||
for (unsigned int i=0; i<3; i++)
|
||||
m_k[i] = (word32)uk[4*i+3] | ((word32)uk[4*i+2]<<8) | ((word32)uk[4*i+1]<<16) | ((word32)uk[4*i]<<24);
|
||||
|
||||
if (!IsForwardTransformation())
|
||||
{
|
||||
theta(m_k[0], m_k[1], m_k[2]);
|
||||
mu(m_k[0], m_k[1], m_k[2]);
|
||||
m_k[0] = ByteReverse(m_k[0]);
|
||||
m_k[1] = ByteReverse(m_k[1]);
|
||||
m_k[2] = ByteReverse(m_k[2]);
|
||||
}
|
||||
}
|
||||
|
||||
void ThreeWay::Enc::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const
|
||||
{
|
||||
typedef BlockGetAndPut<word32, BigEndian> Block;
|
||||
|
||||
word32 a0, a1, a2;
|
||||
Block::Get(inBlock)(a0)(a1)(a2);
|
||||
|
||||
word32 rc = START_E;
|
||||
|
||||
for(unsigned i=0; i<m_rounds; i++)
|
||||
{
|
||||
a0 ^= m_k[0] ^ (rc<<16);
|
||||
a1 ^= m_k[1];
|
||||
a2 ^= m_k[2] ^ rc;
|
||||
rho(a0, a1, a2);
|
||||
|
||||
rc <<= 1;
|
||||
if (rc&0x10000) rc ^= 0x11011;
|
||||
}
|
||||
a0 ^= m_k[0] ^ (rc<<16);
|
||||
a1 ^= m_k[1];
|
||||
a2 ^= m_k[2] ^ rc;
|
||||
theta(a0, a1, a2);
|
||||
|
||||
Block::Put(xorBlock, outBlock)(a0)(a1)(a2);
|
||||
}
|
||||
|
||||
void ThreeWay::Dec::ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const
|
||||
{
|
||||
typedef BlockGetAndPut<word32, LittleEndian> Block;
|
||||
|
||||
word32 a0, a1, a2;
|
||||
Block::Get(inBlock)(a0)(a1)(a2);
|
||||
|
||||
word32 rc = START_D;
|
||||
|
||||
mu(a0, a1, a2);
|
||||
for(unsigned i=0; i<m_rounds; i++)
|
||||
{
|
||||
a0 ^= m_k[0] ^ (rc<<16);
|
||||
a1 ^= m_k[1];
|
||||
a2 ^= m_k[2] ^ rc;
|
||||
rho(a0, a1, a2);
|
||||
|
||||
rc <<= 1;
|
||||
if (rc&0x10000) rc ^= 0x11011;
|
||||
}
|
||||
a0 ^= m_k[0] ^ (rc<<16);
|
||||
a1 ^= m_k[1];
|
||||
a2 ^= m_k[2] ^ rc;
|
||||
theta(a0, a1, a2);
|
||||
mu(a0, a1, a2);
|
||||
|
||||
Block::Put(xorBlock, outBlock)(a0)(a1)(a2);
|
||||
}
|
||||
|
||||
NAMESPACE_END
|
||||
|
||||
@ -1,68 +1,69 @@
|
||||
// 3way.h - written and placed in the public domain by Wei Dai
|
||||
|
||||
//! \file 3way.h
|
||||
//! \brief Classes for the 3-Way block cipher
|
||||
|
||||
#ifndef CRYPTOPP_THREEWAY_H
|
||||
#define CRYPTOPP_THREEWAY_H
|
||||
|
||||
#include "config.h"
|
||||
#include "seckey.h"
|
||||
#include "secblock.h"
|
||||
|
||||
NAMESPACE_BEGIN(CryptoPP)
|
||||
|
||||
//! \class ThreeWay_Info
|
||||
//! \brief ThreeWay block cipher information
|
||||
struct ThreeWay_Info : public FixedBlockSize<12>, public FixedKeyLength<12>, public VariableRounds<11>
|
||||
{
|
||||
CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() {return "3-Way";}
|
||||
};
|
||||
|
||||
//! \class ThreeWay
|
||||
//! \brief ThreeWay block cipher
|
||||
//! \sa <a href="http://www.weidai.com/scan-mirror/cs.html#3-Way">3-Way</a>
|
||||
class ThreeWay : public ThreeWay_Info, public BlockCipherDocumentation
|
||||
{
|
||||
//! \class Base
|
||||
//! \brief Class specific implementation and overrides used to operate the cipher.
|
||||
//! \details Implementations and overrides in \p Base apply to both \p ENCRYPTION and \p DECRYPTION directions
|
||||
class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<ThreeWay_Info>
|
||||
{
|
||||
public:
|
||||
void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs ¶ms);
|
||||
|
||||
protected:
|
||||
unsigned int m_rounds;
|
||||
FixedSizeSecBlock<word32, 3> m_k;
|
||||
};
|
||||
|
||||
//! \class Enc
|
||||
//! \brief Class specific methods used to operate the cipher in the forward direction.
|
||||
//! \details Implementations and overrides in \p Enc apply to \p ENCRYPTION.
|
||||
class CRYPTOPP_NO_VTABLE Enc : public Base
|
||||
{
|
||||
public:
|
||||
void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
|
||||
};
|
||||
|
||||
//! \class Dec
|
||||
//! \brief Class specific methods used to operate the cipher in the reverse direction.
|
||||
//! \details Implementations and overrides in \p Dec apply to \p DECRYPTION.
|
||||
class CRYPTOPP_NO_VTABLE Dec : public Base
|
||||
{
|
||||
public:
|
||||
void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
|
||||
};
|
||||
|
||||
public:
|
||||
typedef BlockCipherFinal<ENCRYPTION, Enc> Encryption;
|
||||
typedef BlockCipherFinal<DECRYPTION, Dec> Decryption;
|
||||
};
|
||||
|
||||
typedef ThreeWay::Encryption ThreeWayEncryption;
|
||||
typedef ThreeWay::Decryption ThreeWayDecryption;
|
||||
|
||||
NAMESPACE_END
|
||||
|
||||
#endif
|
||||
// 3way.h - written and placed in the public domain by Wei Dai
|
||||
|
||||
//! \file 3way.h
|
||||
//! \brief Classes for the 3-Way block cipher
|
||||
|
||||
#ifndef CRYPTOPP_THREEWAY_H
|
||||
#define CRYPTOPP_THREEWAY_H
|
||||
|
||||
#include "config.h"
|
||||
#include "seckey.h"
|
||||
#include "secblock.h"
|
||||
|
||||
NAMESPACE_BEGIN(CryptoPP)
|
||||
|
||||
//! \class ThreeWay_Info
|
||||
//! \brief The cipher's key, iv, block size and name information.
|
||||
struct ThreeWay_Info : public FixedBlockSize<12>, public FixedKeyLength<12>, public VariableRounds<11>
|
||||
{
|
||||
static const char *StaticAlgorithmName() {return "3-Way";}
|
||||
};
|
||||
|
||||
// <a href="http://www.weidai.com/scan-mirror/cs.html#3-Way">3-Way</a>
|
||||
|
||||
//! \class ThreeWay
|
||||
//! \brief Provides 3-Way encryption and decryption
|
||||
class ThreeWay : public ThreeWay_Info, public BlockCipherDocumentation
|
||||
{
|
||||
//! \class Base
|
||||
//! \brief Class specific implementation and overrides used to operate the cipher.
|
||||
//! \details Implementations and overrides in \p Base apply to both \p ENCRYPTION and \p DECRYPTION directions
|
||||
class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<ThreeWay_Info>
|
||||
{
|
||||
public:
|
||||
void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs ¶ms);
|
||||
|
||||
protected:
|
||||
unsigned int m_rounds;
|
||||
FixedSizeSecBlock<word32, 3> m_k;
|
||||
};
|
||||
|
||||
//! \class Enc
|
||||
//! \brief Class specific methods used to operate the cipher in the forward direction.
|
||||
//! \details Implementations and overrides in \p Enc apply to \p ENCRYPTION.
|
||||
class CRYPTOPP_NO_VTABLE Enc : public Base
|
||||
{
|
||||
public:
|
||||
void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
|
||||
};
|
||||
|
||||
//! \class Dec
|
||||
//! \brief Class specific methods used to operate the cipher in the reverse direction.
|
||||
//! \details Implementations and overrides in \p Dec apply to \p DECRYPTION.
|
||||
class CRYPTOPP_NO_VTABLE Dec : public Base
|
||||
{
|
||||
public:
|
||||
void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
|
||||
};
|
||||
|
||||
public:
|
||||
typedef BlockCipherFinal<ENCRYPTION, Enc> Encryption;
|
||||
typedef BlockCipherFinal<DECRYPTION, Dec> Decryption;
|
||||
};
|
||||
|
||||
typedef ThreeWay::Encryption ThreeWayEncryption;
|
||||
typedef ThreeWay::Decryption ThreeWayDecryption;
|
||||
|
||||
NAMESPACE_END
|
||||
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,420 +1,393 @@
|
||||
3way.cpp
|
||||
3way.h
|
||||
adhoc.cpp.proto
|
||||
adler32.cpp
|
||||
adler32.h
|
||||
aes.h
|
||||
algebra.cpp
|
||||
algebra.h
|
||||
algparam.cpp
|
||||
algparam.h
|
||||
arc4.cpp
|
||||
arc4.h
|
||||
argnames.h
|
||||
asn.cpp
|
||||
asn.h
|
||||
authenc.cpp
|
||||
authenc.h
|
||||
base32.cpp
|
||||
base32.h
|
||||
base64.cpp
|
||||
base64.h
|
||||
basecode.cpp
|
||||
basecode.h
|
||||
bench.h
|
||||
bds10.zip
|
||||
bench1.cpp
|
||||
bench2.cpp
|
||||
bfinit.cpp
|
||||
blake2.cpp
|
||||
blake2.h
|
||||
blowfish.cpp
|
||||
blowfish.h
|
||||
blumshub.cpp
|
||||
blumshub.h
|
||||
camellia.cpp
|
||||
camellia.h
|
||||
cast.cpp
|
||||
cast.h
|
||||
casts.cpp
|
||||
cbcmac.cpp
|
||||
cbcmac.h
|
||||
ccm.cpp
|
||||
ccm.h
|
||||
chacha.cpp
|
||||
chacha.h
|
||||
channels.cpp
|
||||
channels.h
|
||||
cmac.cpp
|
||||
cmac.h
|
||||
config.h
|
||||
config.compat
|
||||
cpu.cpp
|
||||
cpu.h
|
||||
crc.cpp
|
||||
crc.h
|
||||
cryptdll.vcxproj
|
||||
cryptdll.vcxproj.filters
|
||||
cryptest.sh
|
||||
cryptest.sln
|
||||
cryptest.vcxproj
|
||||
cryptest.vcxproj.user
|
||||
cryptest.vcxproj.filters
|
||||
cryptest.nmake
|
||||
cryptlib.cpp
|
||||
cryptlib.h
|
||||
cryptlib.vcxproj
|
||||
cryptlib.vcxproj.filters
|
||||
cryptopp.rc
|
||||
datatest.cpp
|
||||
default.cpp
|
||||
default.h
|
||||
des.cpp
|
||||
des.h
|
||||
dessp.cpp
|
||||
dh.cpp
|
||||
dh.h
|
||||
dh2.cpp
|
||||
dh2.h
|
||||
dll.cpp
|
||||
dll.h
|
||||
dlltest.cpp
|
||||
dlltest.vcxproj
|
||||
dlltest.vcxproj.filters
|
||||
dmac.h
|
||||
dsa.cpp
|
||||
dsa.h
|
||||
eax.cpp
|
||||
eax.h
|
||||
ec2n.cpp
|
||||
ec2n.h
|
||||
eccrypto.cpp
|
||||
eccrypto.h
|
||||
ecp.cpp
|
||||
ecp.h
|
||||
elgamal.cpp
|
||||
elgamal.h
|
||||
emsa2.cpp
|
||||
emsa2.h
|
||||
eprecomp.cpp
|
||||
eprecomp.h
|
||||
esign.cpp
|
||||
esign.h
|
||||
factory.h
|
||||
fhmqv.cpp
|
||||
fhmqv.h
|
||||
files.cpp
|
||||
files.h
|
||||
filters.cpp
|
||||
filters.h
|
||||
fips140.cpp
|
||||
fips140.h
|
||||
fipsalgt.cpp
|
||||
fipstest.cpp
|
||||
fltrimpl.h
|
||||
gcm.cpp
|
||||
gcm.h
|
||||
gf256.cpp
|
||||
gf256.h
|
||||
gf2_32.cpp
|
||||
gf2_32.h
|
||||
gf2n.cpp
|
||||
gf2n.h
|
||||
gfpcrypt.cpp
|
||||
gfpcrypt.h
|
||||
gost.cpp
|
||||
gost.h
|
||||
gzip.cpp
|
||||
gzip.h
|
||||
hex.cpp
|
||||
hex.h
|
||||
hkdf.h
|
||||
hmac.cpp
|
||||
hmac.h
|
||||
hmqv.cpp
|
||||
hmqv.h
|
||||
hrtimer.cpp
|
||||
hrtimer.h
|
||||
ida.cpp
|
||||
ida.h
|
||||
idea.cpp
|
||||
idea.h
|
||||
integer.cpp
|
||||
integer.h
|
||||
iterhash.cpp
|
||||
iterhash.h
|
||||
keccak.cpp
|
||||
keccak.h
|
||||
lubyrack.h
|
||||
luc.cpp
|
||||
luc.h
|
||||
mars.cpp
|
||||
mars.h
|
||||
marss.cpp
|
||||
md2.cpp
|
||||
md2.h
|
||||
md4.cpp
|
||||
md4.h
|
||||
md5.cpp
|
||||
md5.h
|
||||
mdc.h
|
||||
mersenne.h
|
||||
misc.cpp
|
||||
misc.h
|
||||
modarith.h
|
||||
modes.cpp
|
||||
modes.h
|
||||
modexppc.h
|
||||
mqueue.cpp
|
||||
mqueue.h
|
||||
mqv.cpp
|
||||
mqv.h
|
||||
nbtheory.cpp
|
||||
nbtheory.h
|
||||
network.cpp
|
||||
network.h
|
||||
nr.h
|
||||
oaep.cpp
|
||||
oaep.h
|
||||
oids.h
|
||||
osrng.cpp
|
||||
osrng.h
|
||||
ossig.h
|
||||
panama.cpp
|
||||
panama.h
|
||||
pch.cpp
|
||||
pch.h
|
||||
pkcspad.cpp
|
||||
pkcspad.h
|
||||
polynomi.cpp
|
||||
polynomi.h
|
||||
pssr.cpp
|
||||
pssr.h
|
||||
pubkey.cpp
|
||||
pubkey.h
|
||||
pwdbased.h
|
||||
queue.cpp
|
||||
queue.h
|
||||
rabin.cpp
|
||||
rabin.h
|
||||
randpool.cpp
|
||||
randpool.h
|
||||
rc2.cpp
|
||||
rc2.h
|
||||
rc5.cpp
|
||||
rc5.h
|
||||
rc6.cpp
|
||||
rc6.h
|
||||
rdrand-masm.cmd
|
||||
rdrand-nasm.sh
|
||||
rdrand.S
|
||||
rdrand.asm
|
||||
rdrand.cpp
|
||||
rdrand.h
|
||||
rdtables.cpp
|
||||
regtest.cpp
|
||||
resource.h
|
||||
rijndael.cpp
|
||||
rijndael.h
|
||||
ripemd.cpp
|
||||
ripemd.h
|
||||
rng.cpp
|
||||
rng.h
|
||||
rsa.cpp
|
||||
rsa.h
|
||||
rw.cpp
|
||||
rw.h
|
||||
safer.cpp
|
||||
safer.h
|
||||
salsa.cpp
|
||||
salsa.h
|
||||
seal.cpp
|
||||
seal.h
|
||||
secblock.h
|
||||
seckey.h
|
||||
seed.cpp
|
||||
seed.h
|
||||
serpent.cpp
|
||||
serpent.h
|
||||
serpentp.h
|
||||
sha.cpp
|
||||
sha.h
|
||||
sha3.cpp
|
||||
sha3.h
|
||||
shacal2.cpp
|
||||
shacal2.h
|
||||
shark.cpp
|
||||
shark.h
|
||||
sharkbox.cpp
|
||||
simple.cpp
|
||||
simple.h
|
||||
skipjack.cpp
|
||||
skipjack.h
|
||||
smartptr.h
|
||||
socketft.cpp
|
||||
socketft.h
|
||||
sosemanuk.cpp
|
||||
sosemanuk.h
|
||||
square.cpp
|
||||
square.h
|
||||
squaretb.cpp
|
||||
stdcpp.h
|
||||
strciphr.cpp
|
||||
strciphr.h
|
||||
tea.cpp
|
||||
tea.h
|
||||
test.cpp
|
||||
trap.h
|
||||
tftables.cpp
|
||||
tiger.cpp
|
||||
tiger.h
|
||||
tigertab.cpp
|
||||
trdlocal.cpp
|
||||
trdlocal.h
|
||||
trunhash.h
|
||||
ttmac.cpp
|
||||
ttmac.h
|
||||
twofish.cpp
|
||||
twofish.h
|
||||
validat1.cpp
|
||||
validat2.cpp
|
||||
validat3.cpp
|
||||
validate.h
|
||||
vmac.cpp
|
||||
vmac.h
|
||||
vc60.zip
|
||||
vs2005.zip
|
||||
wait.cpp
|
||||
wait.h
|
||||
wake.cpp
|
||||
wake.h
|
||||
whrlpool.cpp
|
||||
whrlpool.h
|
||||
winpipes.cpp
|
||||
winpipes.h
|
||||
words.h
|
||||
x64dll.asm
|
||||
x64masm.asm
|
||||
xtr.cpp
|
||||
xtr.h
|
||||
xtrcrypt.cpp
|
||||
xtrcrypt.h
|
||||
zdeflate.cpp
|
||||
zdeflate.h
|
||||
zinflate.cpp
|
||||
zinflate.h
|
||||
zlib.cpp
|
||||
zlib.h
|
||||
Doxyfile
|
||||
GNUmakefile
|
||||
GNUmakefile-cross
|
||||
License.txt
|
||||
Readme.txt
|
||||
Install.txt
|
||||
Filelist.txt
|
||||
TestData/3desval.dat
|
||||
TestData/3wayval.dat
|
||||
TestData/camellia.dat
|
||||
TestData/cast128v.dat
|
||||
TestData/cast256v.dat
|
||||
TestData/descert.dat
|
||||
TestData/dh1024.dat
|
||||
TestData/dh2048.dat
|
||||
TestData/dlie1024.dat
|
||||
TestData/dlie2048.dat
|
||||
TestData/dsa1024.dat
|
||||
TestData/dsa1024b.dat
|
||||
TestData/dsa512.dat
|
||||
TestData/elgc1024.dat
|
||||
TestData/esig1023.dat
|
||||
TestData/esig1536.dat
|
||||
TestData/esig2046.dat
|
||||
TestData/fhmqv160.dat
|
||||
TestData/fhmqv256.dat
|
||||
TestData/fhmqv384.dat
|
||||
TestData/fhmqv512.dat
|
||||
TestData/gostval.dat
|
||||
TestData/hmqv160.dat
|
||||
TestData/hmqv256.dat
|
||||
TestData/hmqv384.dat
|
||||
TestData/hmqv512.dat
|
||||
TestData/ideaval.dat
|
||||
TestData/luc1024.dat
|
||||
TestData/luc2048.dat
|
||||
TestData/lucc1024.dat
|
||||
TestData/lucc512.dat
|
||||
TestData/lucd1024.dat
|
||||
TestData/lucd512.dat
|
||||
TestData/lucs1024.dat
|
||||
TestData/lucs512.dat
|
||||
TestData/marsval.dat
|
||||
TestData/mqv1024.dat
|
||||
TestData/mqv2048.dat
|
||||
TestData/nr1024.dat
|
||||
TestData/nr2048.dat
|
||||
TestData/rabi1024.dat
|
||||
TestData/rabi2048.dat
|
||||
TestData/rc2val.dat
|
||||
TestData/rc5val.dat
|
||||
TestData/rc6val.dat
|
||||
TestData/rijndael.dat
|
||||
TestData/rsa1024.dat
|
||||
TestData/rsa2048.dat
|
||||
TestData/rsa400pb.dat
|
||||
TestData/rsa400pv.dat
|
||||
TestData/rsa512a.dat
|
||||
TestData/rw1024.dat
|
||||
TestData/rw2048.dat
|
||||
TestData/saferval.dat
|
||||
TestData/serpentv.dat
|
||||
TestData/shacal2v.dat
|
||||
TestData/sharkval.dat
|
||||
TestData/skipjack.dat
|
||||
TestData/squareva.dat
|
||||
TestData/twofishv.dat
|
||||
TestData/usage.dat
|
||||
TestData/xtrdh171.dat
|
||||
TestData/xtrdh342.dat
|
||||
TestVectors/Readme.txt
|
||||
TestVectors/aes.txt
|
||||
TestVectors/all.txt
|
||||
TestVectors/blake2.txt
|
||||
TestVectors/blake2b.txt
|
||||
TestVectors/blake2s.txt
|
||||
TestVectors/camellia.txt
|
||||
TestVectors/ccm.txt
|
||||
TestVectors/chacha.txt
|
||||
TestVectors/cmac.txt
|
||||
TestVectors/dlies.txt
|
||||
TestVectors/dsa.txt
|
||||
TestVectors/dsa_1363.txt
|
||||
TestVectors/eax.txt
|
||||
TestVectors/esign.txt
|
||||
TestVectors/gcm.txt
|
||||
TestVectors/hkdf.txt
|
||||
TestVectors/hmac.txt
|
||||
TestVectors/keccak.txt
|
||||
TestVectors/mars.txt
|
||||
TestVectors/nr.txt
|
||||
TestVectors/panama.txt
|
||||
TestVectors/rsa_oaep.txt
|
||||
TestVectors/rsa_pkcs1_1_5.txt
|
||||
TestVectors/rsa_pss.txt
|
||||
TestVectors/dsa_rfc6979.txt
|
||||
TestVectors/rw.txt
|
||||
TestVectors/salsa.txt
|
||||
TestVectors/seal.txt
|
||||
TestVectors/seed.txt
|
||||
TestVectors/sha.txt
|
||||
TestVectors/sha3_fips_202.txt
|
||||
TestVectors/sha3_224_fips_202.txt
|
||||
TestVectors/sha3_256_fips_202.txt
|
||||
TestVectors/sha3_384_fips_202.txt
|
||||
TestVectors/sha3_512_fips_202.txt
|
||||
TestVectors/shacal2.txt
|
||||
TestVectors/sosemanuk.txt
|
||||
TestVectors/tea.txt
|
||||
TestVectors/ttmac.txt
|
||||
TestVectors/vmac.txt
|
||||
TestVectors/wake.txt
|
||||
TestVectors/whrlpool.txt
|
||||
3way.cpp
|
||||
3way.h
|
||||
adhoc.cpp.proto
|
||||
adler32.cpp
|
||||
adler32.h
|
||||
aes.h
|
||||
algebra.cpp
|
||||
algebra.h
|
||||
algparam.cpp
|
||||
algparam.h
|
||||
arc4.cpp
|
||||
arc4.h
|
||||
argnames.h
|
||||
asn.cpp
|
||||
asn.h
|
||||
authenc.cpp
|
||||
authenc.h
|
||||
base32.cpp
|
||||
base32.h
|
||||
base64.cpp
|
||||
base64.h
|
||||
basecode.cpp
|
||||
basecode.h
|
||||
bench.cpp
|
||||
bench.h
|
||||
bench2.cpp
|
||||
bfinit.cpp
|
||||
blowfish.cpp
|
||||
blowfish.h
|
||||
blumshub.cpp
|
||||
blumshub.h
|
||||
camellia.cpp
|
||||
camellia.h
|
||||
cast.cpp
|
||||
cast.h
|
||||
casts.cpp
|
||||
cbcmac.cpp
|
||||
cbcmac.h
|
||||
ccm.cpp
|
||||
ccm.h
|
||||
channels.cpp
|
||||
channels.h
|
||||
cmac.cpp
|
||||
cmac.h
|
||||
config.h
|
||||
config.recommend
|
||||
cpu.cpp
|
||||
cpu.h
|
||||
crc.cpp
|
||||
crc.h
|
||||
cryptdll.dsp
|
||||
cryptdll.vcproj
|
||||
cryptest.dsp
|
||||
cryptest.dsw
|
||||
cryptest.sh
|
||||
cryptest.sln
|
||||
cryptest.vcproj
|
||||
cryptest_bds.bdsgroup
|
||||
cryptest_bds.bdsproj
|
||||
cryptest_bds.bpf
|
||||
cryptlib.cpp
|
||||
cryptlib.dsp
|
||||
cryptlib.h
|
||||
cryptlib.vcproj
|
||||
cryptlib_bds.bdsproj
|
||||
cryptlib_bds.cpp
|
||||
cryptopp.rc
|
||||
cryptopp563.diff
|
||||
datatest.cpp
|
||||
default.cpp
|
||||
default.h
|
||||
des.cpp
|
||||
des.h
|
||||
dessp.cpp
|
||||
dh.cpp
|
||||
dh.h
|
||||
dh2.cpp
|
||||
dh2.h
|
||||
dll.cpp
|
||||
dll.h
|
||||
dlltest.cpp
|
||||
dlltest.dsp
|
||||
dlltest.vcproj
|
||||
dmac.h
|
||||
dsa.cpp
|
||||
dsa.h
|
||||
eax.cpp
|
||||
eax.h
|
||||
ec2n.cpp
|
||||
ec2n.h
|
||||
eccrypto.cpp
|
||||
eccrypto.h
|
||||
ecp.cpp
|
||||
ecp.h
|
||||
elgamal.cpp
|
||||
elgamal.h
|
||||
emsa2.cpp
|
||||
emsa2.h
|
||||
eprecomp.cpp
|
||||
eprecomp.h
|
||||
esign.cpp
|
||||
esign.h
|
||||
factory.h
|
||||
files.cpp
|
||||
files.h
|
||||
filters.cpp
|
||||
filters.h
|
||||
fips140.cpp
|
||||
fips140.h
|
||||
fipsalgt.cpp
|
||||
fipstest.cpp
|
||||
fltrimpl.h
|
||||
gcm.cpp
|
||||
gcm.h
|
||||
gf256.cpp
|
||||
gf256.h
|
||||
gf2_32.cpp
|
||||
gf2_32.h
|
||||
gf2n.cpp
|
||||
gf2n.h
|
||||
gfpcrypt.cpp
|
||||
gfpcrypt.h
|
||||
gost.cpp
|
||||
gost.h
|
||||
gzip.cpp
|
||||
gzip.h
|
||||
hex.cpp
|
||||
hex.h
|
||||
hkdf.h
|
||||
hmac.cpp
|
||||
hmac.h
|
||||
hrtimer.cpp
|
||||
hrtimer.h
|
||||
ida.cpp
|
||||
ida.h
|
||||
idea.cpp
|
||||
idea.h
|
||||
integer.cpp
|
||||
integer.h
|
||||
iterhash.cpp
|
||||
iterhash.h
|
||||
lubyrack.h
|
||||
luc.cpp
|
||||
luc.h
|
||||
mars.cpp
|
||||
mars.h
|
||||
marss.cpp
|
||||
md2.cpp
|
||||
md2.h
|
||||
md4.cpp
|
||||
md4.h
|
||||
md5.cpp
|
||||
md5.h
|
||||
mdc.h
|
||||
mersenne.h
|
||||
misc.cpp
|
||||
misc.h
|
||||
modarith.h
|
||||
modes.cpp
|
||||
modes.h
|
||||
modexppc.h
|
||||
mqueue.cpp
|
||||
mqueue.h
|
||||
mqv.cpp
|
||||
mqv.h
|
||||
nbtheory.cpp
|
||||
nbtheory.h
|
||||
network.cpp
|
||||
network.h
|
||||
nr.h
|
||||
oaep.cpp
|
||||
oaep.h
|
||||
oids.h
|
||||
osrng.cpp
|
||||
osrng.h
|
||||
panama.cpp
|
||||
panama.h
|
||||
pch.cpp
|
||||
pch.h
|
||||
pkcspad.cpp
|
||||
pkcspad.h
|
||||
polynomi.cpp
|
||||
polynomi.h
|
||||
pssr.cpp
|
||||
pssr.h
|
||||
pubkey.cpp
|
||||
pubkey.h
|
||||
pwdbased.h
|
||||
queue.cpp
|
||||
queue.h
|
||||
rabin.cpp
|
||||
rabin.h
|
||||
randpool.cpp
|
||||
randpool.h
|
||||
rc2.cpp
|
||||
rc2.h
|
||||
rc5.cpp
|
||||
rc5.h
|
||||
rc6.cpp
|
||||
rc6.h
|
||||
rdrand-masm.cmd
|
||||
rdrand-nasm.sh
|
||||
rdrand.S
|
||||
rdrand.asm
|
||||
rdrand.cpp
|
||||
rdrand.h
|
||||
rdtables.cpp
|
||||
regtest.cpp
|
||||
resource.h
|
||||
rijndael.cpp
|
||||
rijndael.h
|
||||
ripemd.cpp
|
||||
ripemd.h
|
||||
rng.cpp
|
||||
rng.h
|
||||
rsa.cpp
|
||||
rsa.h
|
||||
rw.cpp
|
||||
rw.h
|
||||
safer.cpp
|
||||
safer.h
|
||||
salsa.cpp
|
||||
salsa.h
|
||||
seal.cpp
|
||||
seal.h
|
||||
secblock.h
|
||||
seckey.h
|
||||
seed.cpp
|
||||
seed.h
|
||||
serpent.cpp
|
||||
serpent.h
|
||||
serpentp.h
|
||||
sha.cpp
|
||||
sha.h
|
||||
sha3.cpp
|
||||
sha3.h
|
||||
shacal2.cpp
|
||||
shacal2.h
|
||||
shark.cpp
|
||||
shark.h
|
||||
sharkbox.cpp
|
||||
simple.cpp
|
||||
simple.h
|
||||
skipjack.cpp
|
||||
skipjack.h
|
||||
smartptr.h
|
||||
socketft.cpp
|
||||
socketft.h
|
||||
sosemanuk.cpp
|
||||
sosemanuk.h
|
||||
square.cpp
|
||||
square.h
|
||||
squaretb.cpp
|
||||
stdcpp.h
|
||||
strciphr.cpp
|
||||
strciphr.h
|
||||
tea.cpp
|
||||
tea.h
|
||||
test.cpp
|
||||
tftables.cpp
|
||||
tiger.cpp
|
||||
tiger.h
|
||||
tigertab.cpp
|
||||
trdlocal.cpp
|
||||
trdlocal.h
|
||||
trunhash.h
|
||||
ttmac.cpp
|
||||
ttmac.h
|
||||
twofish.cpp
|
||||
twofish.h
|
||||
validat1.cpp
|
||||
validat2.cpp
|
||||
validat3.cpp
|
||||
validate.h
|
||||
vmac.cpp
|
||||
vmac.h
|
||||
vs2010.zip
|
||||
wait.cpp
|
||||
wait.h
|
||||
wake.cpp
|
||||
wake.h
|
||||
whrlpool.cpp
|
||||
whrlpool.h
|
||||
winpipes.cpp
|
||||
winpipes.h
|
||||
words.h
|
||||
x64dll.asm
|
||||
x64masm.asm
|
||||
xtr.cpp
|
||||
xtr.h
|
||||
xtrcrypt.cpp
|
||||
xtrcrypt.h
|
||||
zdeflate.cpp
|
||||
zdeflate.h
|
||||
zinflate.cpp
|
||||
zinflate.h
|
||||
zlib.cpp
|
||||
zlib.h
|
||||
Doxyfile
|
||||
GNUmakefile
|
||||
GNUmakefile-cross
|
||||
License.txt
|
||||
Readme.txt
|
||||
Install.txt
|
||||
Filelist.txt
|
||||
TestData/3desval.dat
|
||||
TestData/3wayval.dat
|
||||
TestData/camellia.dat
|
||||
TestData/cast128v.dat
|
||||
TestData/cast256v.dat
|
||||
TestData/descert.dat
|
||||
TestData/dh1024.dat
|
||||
TestData/dh2048.dat
|
||||
TestData/dlie1024.dat
|
||||
TestData/dlie2048.dat
|
||||
TestData/dsa1024.dat
|
||||
TestData/dsa1024b.dat
|
||||
TestData/dsa512.dat
|
||||
TestData/elgc1024.dat
|
||||
TestData/esig1023.dat
|
||||
TestData/esig1536.dat
|
||||
TestData/esig2046.dat
|
||||
TestData/gostval.dat
|
||||
TestData/ideaval.dat
|
||||
TestData/luc1024.dat
|
||||
TestData/luc2048.dat
|
||||
TestData/lucc1024.dat
|
||||
TestData/lucc512.dat
|
||||
TestData/lucd1024.dat
|
||||
TestData/lucd512.dat
|
||||
TestData/lucs1024.dat
|
||||
TestData/lucs512.dat
|
||||
TestData/marsval.dat
|
||||
TestData/mqv1024.dat
|
||||
TestData/mqv2048.dat
|
||||
TestData/nr1024.dat
|
||||
TestData/nr2048.dat
|
||||
TestData/rabi1024.dat
|
||||
TestData/rabi2048.dat
|
||||
TestData/rc2val.dat
|
||||
TestData/rc5val.dat
|
||||
TestData/rc6val.dat
|
||||
TestData/rijndael.dat
|
||||
TestData/rsa1024.dat
|
||||
TestData/rsa2048.dat
|
||||
TestData/rsa400pb.dat
|
||||
TestData/rsa400pv.dat
|
||||
TestData/rsa512a.dat
|
||||
TestData/rw1024.dat
|
||||
TestData/rw2048.dat
|
||||
TestData/saferval.dat
|
||||
TestData/serpentv.dat
|
||||
TestData/shacal2v.dat
|
||||
TestData/sharkval.dat
|
||||
TestData/skipjack.dat
|
||||
TestData/squareva.dat
|
||||
TestData/twofishv.dat
|
||||
TestData/usage.dat
|
||||
TestData/xtrdh171.dat
|
||||
TestData/xtrdh342.dat
|
||||
TestVectors/Readme.txt
|
||||
TestVectors/aes.txt
|
||||
TestVectors/all.txt
|
||||
TestVectors/camellia.txt
|
||||
TestVectors/ccm.txt
|
||||
TestVectors/cmac.txt
|
||||
TestVectors/dlies.txt
|
||||
TestVectors/dsa.txt
|
||||
TestVectors/dsa_1363.txt
|
||||
TestVectors/eax.txt
|
||||
TestVectors/esign.txt
|
||||
TestVectors/gcm.txt
|
||||
TestVectors/hkdf.txt
|
||||
TestVectors/hmac.txt
|
||||
TestVectors/mars.txt
|
||||
TestVectors/nr.txt
|
||||
TestVectors/panama.txt
|
||||
TestVectors/rsa_oaep.txt
|
||||
TestVectors/rsa_pkcs1_1_5.txt
|
||||
TestVectors/rsa_pss.txt
|
||||
TestVectors/rw.txt
|
||||
TestVectors/salsa.txt
|
||||
TestVectors/seal.txt
|
||||
TestVectors/seed.txt
|
||||
TestVectors/sha.txt
|
||||
TestVectors/sha3.txt
|
||||
TestVectors/shacal2.txt
|
||||
TestVectors/sosemanuk.txt
|
||||
TestVectors/tea.txt
|
||||
TestVectors/ttmac.txt
|
||||
TestVectors/vmac.txt
|
||||
TestVectors/wake.txt
|
||||
TestVectors/whrlpool.txt
|
||||
|
||||
659
Common/3dParty/cryptopp/GNUmakefile
Executable file → Normal file
659
Common/3dParty/cryptopp/GNUmakefile
Executable file → Normal file
@ -1,162 +1,104 @@
|
||||
###########################################################
|
||||
##### System Attributes and Programs #####
|
||||
###########################################################
|
||||
# Base CXXFLAGS used if the user did not specify them
|
||||
CXXFLAGS ?= -DNDEBUG -g2 -O2
|
||||
|
||||
# -fPIC is supported, please report failures with steps to reproduce
|
||||
# If PIC is required but results in a crash, then use -DCRYPTOPP_DISABLE_ASM
|
||||
# CXXFLAGS += -fPIC
|
||||
|
||||
# Add the following options reduce code size, but breaks link
|
||||
# or makes link very slow on some systems
|
||||
# CXXFLAGS += -ffunction-sections -fdata-sections
|
||||
# On OS X, you need to use "LDFLAGS += -Wl,-dead_strip"
|
||||
# LDFLAGS += -Wl,--gc-sections
|
||||
|
||||
AR ?= ar
|
||||
ARFLAGS ?= -cr # ar needs the dash on OpenBSD
|
||||
ARFLAGS ?= -cr # ar needs the dash on OpenBSD
|
||||
RANLIB ?= ranlib
|
||||
|
||||
CP ?= cp
|
||||
MV ?= mv
|
||||
EGREP ?= egrep
|
||||
CHMOD ?= chmod
|
||||
MKDIR ?= mkdir
|
||||
LN ?= ln -sf
|
||||
LDCONF ?= /sbin/ldconfig -n
|
||||
UNAME := $(shell uname)
|
||||
EGREP ?= egrep
|
||||
|
||||
IS_X86 := $(shell uname -m | $(EGREP) -v "x86_64" | $(EGREP) -i -c "i.86|x86|i86")
|
||||
IS_X32 ?= 0
|
||||
IS_X64 := $(shell uname -m | $(EGREP) -i -c "(_64|d64)")
|
||||
IS_PPC := $(shell uname -m | $(EGREP) -i -c "ppc|power")
|
||||
IS_ARM32 := $(shell uname -m | $(EGREP) -i -c "arm")
|
||||
IS_ARM64 := $(shell uname -m | $(EGREP) -i -c "aarch64")
|
||||
UNAME := $(shell uname)
|
||||
IS_X86 := $(shell uname -m | $(EGREP) -i -c "i.86|x86|i86|amd64")
|
||||
IS_X86_64 := $(shell uname -m | $(EGREP) -i -c "(_64|d64)")
|
||||
IS_AARCH64 := $(shell uname -m | $(EGREP) -i -c "aarch64")
|
||||
|
||||
IS_SUN := $(shell uname | $(EGREP) -i -c "SunOS")
|
||||
IS_LINUX := $(shell $(CXX) -dumpmachine 2>&1 | $(EGREP) -i -c "Linux")
|
||||
IS_MINGW := $(shell $(CXX) -dumpmachine 2>&1 | $(EGREP) -i -c "MinGW")
|
||||
IS_CYGWIN := $(shell $(CXX) -dumpmachine 2>&1 | $(EGREP) -i -c "Cygwin")
|
||||
IS_DARWIN := $(shell $(CXX) -dumpmachine 2>&1 | $(EGREP) -i -c "Darwin")
|
||||
IS_NETBSD := $(shell $(CXX) -dumpmachine 2>&1 | $(EGREP) -i -c "NetBSD")
|
||||
|
||||
SUN_COMPILER := $(shell $(CXX) -V 2>&1 | $(EGREP) -i -c "CC: (Sun|Studio)")
|
||||
GCC_COMPILER := $(shell $(CXX) --version 2>&1 | $(EGREP) -i -v "clang" | $(EGREP) -i -c "(gcc|g\+\+)")
|
||||
SUN_COMPILER := $(shell $(CXX) -V 2>&1 | $(EGREP) -i -c "CC: Sun")
|
||||
GCC_COMPILER := $(shell $(CXX) --version 2>&1 | $(EGREP) -i -c "(gcc|g\+\+)")
|
||||
CLANG_COMPILER := $(shell $(CXX) --version 2>&1 | $(EGREP) -i -c "clang")
|
||||
INTEL_COMPILER := $(shell $(CXX) --version 2>&1 | $(EGREP) -i -c "\(icc\)")
|
||||
INTEL_COMPILER := $(shell $(CXX) --version 2>&1 | $(EGREP) -c "\(ICC\)")
|
||||
MACPORTS_COMPILER := $(shell $(CXX) --version 2>&1 | $(EGREP) -i -c "macports")
|
||||
|
||||
# Sun Studio 12.0 provides SunCC 0x0510; and Sun Studio 12.3 provides SunCC 0x0512
|
||||
SUNCC_510_OR_LATER := $(shell $(CXX) -V 2>&1 | $(EGREP) -c "CC: (Sun|Studio) .* (5\.1[0-9]|5\.[2-9]|6\.)")
|
||||
SUNCC_511_OR_LATER := $(shell $(CXX) -V 2>&1 | $(EGREP) -c "CC: (Sun|Studio) .* (5\.1[1-9]|5\.[2-9]|6\.)")
|
||||
SUNCC_512_OR_LATER := $(shell $(CXX) -V 2>&1 | $(EGREP) -c "CC: (Sun|Studio) .* (5\.1[2-9]|5\.[2-9]|6\.)")
|
||||
SUNCC_513_OR_LATER := $(shell $(CXX) -V 2>&1 | $(EGREP) -c "CC: (Sun|Studio) .* (5\.1[3-9]|5\.[2-9]|6\.)")
|
||||
|
||||
HAS_SOLIB_VERSION := $(IS_LINUX)
|
||||
|
||||
# Fixup SunOS
|
||||
ifeq ($(IS_SUN),1)
|
||||
IS_X86 := $(shell isainfo -k 2>/dev/null | grep -i -c "i386")
|
||||
IS_X64 := $(shell isainfo -k 2>/dev/null | grep -i -c "amd64")
|
||||
endif
|
||||
|
||||
###########################################################
|
||||
##### General Variables #####
|
||||
###########################################################
|
||||
|
||||
# Base CXXFLAGS used if the user did not specify them
|
||||
ifeq ($(SUN_COMPILER),1)
|
||||
ifeq ($(SUNCC_512_OR_LATER),1)
|
||||
CXXFLAGS ?= -DNDEBUG -g3 -xO2
|
||||
else
|
||||
CXXFLAGS ?= -DNDEBUG -g -xO2
|
||||
endif
|
||||
else
|
||||
CXXFLAGS ?= -DNDEBUG -g2 -O2
|
||||
endif
|
||||
|
||||
# Default prefix for make install
|
||||
ifeq ($(PREFIX),)
|
||||
PREFIX = /usr/local
|
||||
PREFIX = /usr
|
||||
endif
|
||||
|
||||
# http://www.gnu.org/prep/standards/html_node/Directory-Variables.html
|
||||
ifeq ($(DATADIR),)
|
||||
DATADIR := $(PREFIX)/share
|
||||
endif
|
||||
ifeq ($(LIBDIR),)
|
||||
LIBDIR := $(PREFIX)/lib
|
||||
endif
|
||||
ifeq ($(BINDIR),)
|
||||
BINDIR := $(PREFIX)/bin
|
||||
endif
|
||||
ifeq ($(INCLUDEDIR),)
|
||||
INCLUDEDIR := $(PREFIX)/include
|
||||
endif
|
||||
|
||||
# Fix CXX on Cygwin 1.1.4
|
||||
ifeq ($(CXX),gcc)
|
||||
ifeq ($(CXX),gcc) # for some reason CXX is gcc on cygwin 1.1.4
|
||||
CXX := g++
|
||||
endif
|
||||
|
||||
# We honor ARFLAGS, but the "v" option used by default causes a noisy make
|
||||
# We honor ARFLAGS, but the "v" often option used by default causes a noisy make
|
||||
ifeq ($(ARFLAGS),rv)
|
||||
ARFLAGS = r
|
||||
endif
|
||||
|
||||
###########################################################
|
||||
##### X86/X32/X64 Options #####
|
||||
###########################################################
|
||||
ifeq ($(IS_X86),1)
|
||||
|
||||
ifneq ($(IS_X86)$(IS_X32)$(IS_X64),000)
|
||||
|
||||
# Fixup. Clang integrated assembler will be used (-Wa,-q)
|
||||
ifneq ($(MACPORTS_COMPILER),1)
|
||||
IS_GAS := $(shell $(CXX) -xc -c /dev/null -Wa,-v -o/dev/null 2>&1 | $(EGREP) -c "GNU assembler")
|
||||
endif
|
||||
|
||||
ifneq ($(GCC_COMPILER),0)
|
||||
IS_GCC_29 := $(shell $(CXX) -v 2>&1 | $(EGREP) -i -c gcc-9[0-9][0-9])
|
||||
GCC42_OR_LATER := $(shell $(CXX) -v 2>&1 | $(EGREP) -i -c "gcc version (4\.[2-9]|[5-9]\.)")
|
||||
GCC46_OR_LATER := $(shell $(CXX) -v 2>&1 | $(EGREP) -i -c "gcc version (4\.[6-9]|[5-9]\.)")
|
||||
endif
|
||||
|
||||
ifneq ($(IS_GAS),0)
|
||||
GAS210_OR_LATER := $(shell $(CXX) -xc -c /dev/null -Wa,-v -o/dev/null 2>&1 | $(EGREP) -c "GNU assembler version (2\.[1-9][0-9]|[3-9])")
|
||||
GAS217_OR_LATER := $(shell $(CXX) -xc -c /dev/null -Wa,-v -o/dev/null 2>&1 | $(EGREP) -c "GNU assembler version (2\.1[7-9]|2\.[2-9]|[3-9])")
|
||||
GAS219_OR_LATER := $(shell $(CXX) -xc -c /dev/null -Wa,-v -o/dev/null 2>&1 | $(EGREP) -c "GNU assembler version (2\.19|2\.[2-9]|[3-9])")
|
||||
endif
|
||||
IS_GCC_29 := $(shell $(CXX) -v 2>&1 | $(EGREP) -i -c gcc-9[0-9][0-9])
|
||||
GCC42_OR_LATER := $(shell $(CXX) -v 2>&1 | $(EGREP) -i -c "gcc version (4\.[2-9]|[5-9]\.)")
|
||||
GCC46_OR_LATER := $(shell $(CXX) -v 2>&1 | $(EGREP) -i -c "gcc version (4\.[6-9]|[5-9]\.)")
|
||||
GCC48_OR_LATER := $(shell $(CXX) -v 2>&1 | $(EGREP) -i -c "gcc version (4\.[8-9]|[5-9]\.)")
|
||||
GCC49_OR_LATER := $(shell $(CXX) -v 2>&1 | $(EGREP) -i -c "gcc version (4\.9|[5-9]\.)")
|
||||
|
||||
ICC111_OR_LATER := $(shell $(CXX) --version 2>&1 | $(EGREP) -c "\(ICC\) ([2-9][0-9]|1[2-9]|11\.[1-9])")
|
||||
GAS210_OR_LATER := $(shell $(CXX) -xc -c /dev/null -Wa,-v -o/dev/null 2>&1 | $(EGREP) -c "GNU assembler version (2\.[1-9][0-9]|[3-9])")
|
||||
GAS217_OR_LATER := $(shell $(CXX) -xc -c /dev/null -Wa,-v -o/dev/null 2>&1 | $(EGREP) -c "GNU assembler version (2\.1[7-9]|2\.[2-9]|[3-9])")
|
||||
GAS219_OR_LATER := $(shell $(CXX) -xc -c /dev/null -Wa,-v -o/dev/null 2>&1 | $(EGREP) -c "GNU assembler version (2\.19|2\.[2-9]|[3-9])")
|
||||
|
||||
# Add -fPIC for targets *except* X86, X32, Cygwin or MinGW
|
||||
ifeq ($(IS_X86)$(IS_X32)$(IS_CYGWIN)$(IS_MINGW)$(SUN_COMPILER),00000)
|
||||
# Add -fPIC for x86_64, but not X32, Cygwin or MinGW
|
||||
ifneq ($(IS_X86_64),0)
|
||||
IS_X32 := $(shell $(CXX) -dM -E - < /dev/null 2>&1 | $(EGREP) -c "ILP32")
|
||||
ifeq ($(IS_X32)$(IS_CYGWIN)$(IS_MINGW),000)
|
||||
ifeq ($(findstring -fPIC,$(CXXFLAGS)),)
|
||||
CXXFLAGS += -fPIC
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
# Guard use of -march=native
|
||||
ifeq ($(GCC42_OR_LATER)$(IS_NETBSD),10)
|
||||
ifeq ($(GCC_COMPILER),0)
|
||||
CXXFLAGS += -march=native
|
||||
else ifneq ($(CLANG_COMPILER)$(INTEL_COMPILER),00)
|
||||
else ifneq ($(GCC42_OR_LATER),0)
|
||||
CXXFLAGS += -march=native
|
||||
else
|
||||
# GCC 3.3 and "unknown option -march="
|
||||
# Ubuntu GCC 4.1 compiler crash with -march=native
|
||||
# NetBSD GCC 4.8 compiler and "bad value (native) for -march= switch"
|
||||
# Sun compiler is handled below
|
||||
ifeq ($(SUN_COMPILER)$(IS_X64),01)
|
||||
# GCC 4.1 compiler crash with -march=native.
|
||||
ifneq ($(IS_X86_64),0)
|
||||
CXXFLAGS += -m64
|
||||
else ifeq ($(SUN_COMPILER)$(IS_X86),01)
|
||||
else
|
||||
CXXFLAGS += -m32
|
||||
endif # X86/X32/X64
|
||||
endif
|
||||
|
||||
# Aligned access required for -O3 and above due to vectorization
|
||||
# Aligned access required at -O3 for GCC due to vectorization (circa 08/2008). Expect other compilers to do the same.
|
||||
UNALIGNED_ACCESS := $(shell $(EGREP) -c "^[[:space:]]*//[[:space:]]*\#[[:space:]]*define[[:space:]]*CRYPTOPP_NO_UNALIGNED_DATA_ACCESS" config.h)
|
||||
ifneq ($(UNALIGNED_ACCESS),0)
|
||||
ifeq ($(findstring -DCRYPTOPP_NO_UNALIGNED_DATA_ACCESS,$(CXXFLAGS)),)
|
||||
ifeq ($(findstring -O3,$(CXXFLAGS)),-O3)
|
||||
ifneq ($(UNALIGNED_ACCESS),0)
|
||||
ifeq ($(GCC46_OR_LATER),1)
|
||||
ifeq ($(findstring -DCRYPTOPP_NO_UNALIGNED_DATA_ACCESS,$(CXXFLAGS)),)
|
||||
CXXFLAGS += -DCRYPTOPP_NO_UNALIGNED_DATA_ACCESS
|
||||
endif # -O3
|
||||
ifeq ($(findstring -O5,$(CXXFLAGS)),-O5)
|
||||
CXXFLAGS += -DCRYPTOPP_NO_UNALIGNED_DATA_ACCESS
|
||||
endif # -O5
|
||||
ifeq ($(findstring -Ofast,$(CXXFLAGS)),-Ofast)
|
||||
CXXFLAGS += -DCRYPTOPP_NO_UNALIGNED_DATA_ACCESS
|
||||
endif # -Ofast
|
||||
endif # CRYPTOPP_NO_UNALIGNED_DATA_ACCESS
|
||||
endif # GCC 4.6
|
||||
endif # UNALIGNED_ACCESS
|
||||
endif # Vectorization
|
||||
|
||||
ifneq ($(INTEL_COMPILER),0)
|
||||
CXXFLAGS += -wd68 -wd186 -wd279 -wd327 -wd161 -wd3180
|
||||
@ -167,100 +109,34 @@ CXXFLAGS += -DCRYPTOPP_DISABLE_ASM
|
||||
endif
|
||||
endif
|
||||
|
||||
# .intel_syntax wasn't supported until GNU assembler 2.10
|
||||
ifeq ($(GCC_COMPILER)$(MACPORTS_COMPILER)$(GAS210_OR_LATER),100)
|
||||
ifeq ($(GCC_COMPILER)$(GAS210_OR_LATER),10) # .intel_syntax wasn't supported until GNU assembler 2.10
|
||||
CXXFLAGS += -DCRYPTOPP_DISABLE_ASM
|
||||
else
|
||||
ifeq ($(GCC_COMPILER)$(MACPORTS_COMPILER)$(GAS217_OR_LATER),100)
|
||||
ifeq ($(GCC_COMPILER)$(GAS217_OR_LATER),10)
|
||||
CXXFLAGS += -DCRYPTOPP_DISABLE_SSSE3
|
||||
else
|
||||
ifeq ($(GCC_COMPILER)$(MACPORTS_COMPILER)$(GAS219_OR_LATER),100)
|
||||
ifeq ($(GCC_COMPILER)$(GAS219_OR_LATER),10)
|
||||
CXXFLAGS += -DCRYPTOPP_DISABLE_AESNI
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
# Tell MacPorts GCC to use Clang integrated assembler
|
||||
# http://github.com/weidai11/cryptopp/issues/190
|
||||
ifeq ($(GCC_COMPILER)$(MACPORTS_COMPILER),11)
|
||||
ifneq ($(findstring -Wa,-q,$(CXXFLAGS)),-Wa,-q)
|
||||
CXXFLAGS += -Wa,-q
|
||||
endif
|
||||
ifneq ($(findstring -Wa,-q,$(CXXFLAGS)),-DCRYPTOPP_CLANG_INTEGRATED_ASSEMBLER)
|
||||
CXXFLAGS += -DCRYPTOPP_CLANG_INTEGRATED_ASSEMBLER=1
|
||||
ifneq ($(IS_SUN),0)
|
||||
CXXFLAGS += -Wa,--divide # allow use of "/" operator
|
||||
endif
|
||||
endif
|
||||
|
||||
# GCC on Solaris needs -m64. Otherwise, i386 is default
|
||||
# http://github.com/weidai11/cryptopp/issues/230
|
||||
ifeq ($(IS_SUN)$(GCC_COMPILER)$(IS_X64),111)
|
||||
CXXFLAGS += -m64
|
||||
endif
|
||||
|
||||
# Allow use of "/" operator for GNU Assembler.
|
||||
# http://sourceware.org/bugzilla/show_bug.cgi?id=4572
|
||||
ifeq ($(findstring -DCRYPTOPP_DISABLE_ASM,$(CXXFLAGS)),)
|
||||
ifeq ($(IS_SUN)$(GCC_COMPILER),11)
|
||||
CXXFLAGS += -Wa,--divide
|
||||
endif
|
||||
endif
|
||||
endif # IS_X86
|
||||
|
||||
ifeq ($(UNAME),) # for DJGPP, where uname doesn't exist
|
||||
CXXFLAGS += -mbnu210
|
||||
else ifneq ($(findstring -save-temps,$(CXXFLAGS)),-save-temps)
|
||||
ifeq ($(SUN_COMPILER),0)
|
||||
CXXFLAGS += -pipe
|
||||
endif
|
||||
endif
|
||||
|
||||
else
|
||||
|
||||
###########################################################
|
||||
##### Not X86/X32/X64 #####
|
||||
###########################################################
|
||||
|
||||
# Add PIC
|
||||
ifeq ($(findstring -fPIC,$(CXXFLAGS)),)
|
||||
CXXFLAGS += -fPIC
|
||||
endif
|
||||
|
||||
# Add -pipe for everything except ARM (allow ARM-64 because they seems to have > 1 GB of memory)
|
||||
ifeq ($(IS_ARM32),0)
|
||||
ifeq ($(findstring -save-temps,$(CXXFLAGS)),)
|
||||
CXXFLAGS += -pipe
|
||||
endif
|
||||
endif
|
||||
|
||||
# Aligned access required for -O3 and above due to vectorization
|
||||
UNALIGNED_ACCESS := $(shell $(EGREP) -c "^[[:space:]]*//[[:space:]]*\#[[:space:]]*define[[:space:]]*CRYPTOPP_NO_UNALIGNED_DATA_ACCESS" config.h)
|
||||
ifneq ($(UNALIGNED_ACCESS),0)
|
||||
ifeq ($(findstring -DCRYPTOPP_NO_UNALIGNED_DATA_ACCESS,$(CXXFLAGS)),)
|
||||
ifeq ($(findstring -O3,$(CXXFLAGS)),-O3)
|
||||
CXXFLAGS += -DCRYPTOPP_NO_UNALIGNED_DATA_ACCESS
|
||||
endif # -O3
|
||||
ifeq ($(findstring -O5,$(CXXFLAGS)),-O5)
|
||||
CXXFLAGS += -DCRYPTOPP_NO_UNALIGNED_DATA_ACCESS
|
||||
endif # -O5
|
||||
ifeq ($(findstring -Ofast,$(CXXFLAGS)),-Ofast)
|
||||
CXXFLAGS += -DCRYPTOPP_NO_UNALIGNED_DATA_ACCESS
|
||||
endif # -Ofast
|
||||
endif # CRYPTOPP_NO_UNALIGNED_DATA_ACCESS
|
||||
endif # UNALIGNED_ACCESS
|
||||
|
||||
endif # IS_X86
|
||||
|
||||
###########################################################
|
||||
##### Common #####
|
||||
###########################################################
|
||||
|
||||
ifneq ($(IS_MINGW),0)
|
||||
LDLIBS += -lws2_32
|
||||
endif
|
||||
|
||||
ifneq ($(IS_SUN),0)
|
||||
LDLIBS += -lnsl -lsocket
|
||||
endif
|
||||
|
||||
ifeq ($(IS_LINUX),1)
|
||||
LDFLAGS += -pthread
|
||||
ifeq ($(findstring -fopenmp,$(CXXFLAGS)),-fopenmp)
|
||||
@ -268,8 +144,18 @@ ifeq ($(findstring -lgomp,$(LDLIBS)),)
|
||||
LDLIBS += -lgomp
|
||||
endif # LDLIBS
|
||||
endif # OpenMP
|
||||
ifneq ($(IS_X86_64),0)
|
||||
M32OR64 = -m64
|
||||
endif
|
||||
endif # IS_LINUX
|
||||
|
||||
# And add it for ARM64, too
|
||||
ifneq ($(IS_AARCH64),0)
|
||||
ifeq ($(findstring -fPIC,$(CXXFLAGS)),)
|
||||
CXXFLAGS += -fPIC
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq ($(IS_DARWIN),0)
|
||||
AR = libtool
|
||||
ARFLAGS = -static -o
|
||||
@ -281,35 +167,23 @@ LDFLAGS += -flat_namespace -undefined suppress -m
|
||||
endif
|
||||
endif
|
||||
|
||||
# Add -errtags=yes to get the name for a warning suppression
|
||||
ifneq ($(IS_SUN),0)
|
||||
LDLIBS += -lnsl -lsocket
|
||||
M32OR64 = -m$(shell isainfo -b)
|
||||
endif
|
||||
|
||||
ifneq ($(SUN_COMPILER),0) # override flags for CC Sun C++ compiler
|
||||
IS_64 := $(shell isainfo -b 2>/dev/null | grep -i -c "64")
|
||||
ifeq ($(IS_64),1)
|
||||
CXXFLAGS += -m64
|
||||
else ifeq ($(IS_64),0)
|
||||
CXXFLAGS += -m32
|
||||
endif
|
||||
ifneq ($(SUNCC_513_OR_LATER),0)
|
||||
CXXFLAGS += -native
|
||||
endif
|
||||
# Add for non-i386
|
||||
ifneq ($(IS_X86),1)
|
||||
CXXFLAGS += -KPIC
|
||||
endif
|
||||
# Add to all Solaris
|
||||
CXXFLAGS += -template=no%extdef
|
||||
CXXFLAGS ?= -DNDEBUG -O -g0 -native -template=no%extdef $(M32OR64)
|
||||
LDFLAGS =
|
||||
AR = $(CXX)
|
||||
ARFLAGS = -xar -o
|
||||
RANLIB = true
|
||||
SUN_CC10_BUGGY := $(shell $(CXX) -V 2>&1 | $(EGREP) -c "CC: Sun .* 5\.10 .* (2009|2010/0[1-4])")
|
||||
ifneq ($(SUN_CC10_BUGGY),0)
|
||||
# -DCRYPTOPP_INCLUDE_VECTOR_CC is needed for Sun Studio 12u1 Sun C++ 5.10 SunOS_i386 128229-02 2009/09/21 and was fixed in May 2010
|
||||
# remove it if you get "already had a body defined" errors in vector.cc
|
||||
CXXFLAGS += -DCRYPTOPP_INCLUDE_VECTOR_CC
|
||||
endif
|
||||
#ifneq ($SUNCC_512_OR_LATER),0)
|
||||
#CXXFLAGS += -xarch=aes -D__AES__=1 -xarch=no%sse4_1 -xarch=no%sse4_2
|
||||
#endif
|
||||
AR = $(CXX)
|
||||
ARFLAGS = -xar -o
|
||||
RANLIB = true
|
||||
endif
|
||||
|
||||
# Undefined Behavior Sanitizer (UBsan) testing. There's no sense in
|
||||
@ -323,72 +197,71 @@ CXXFLAGS += -DCRYPTOPP_NO_UNALIGNED_DATA_ACCESS
|
||||
endif # CXXFLAGS
|
||||
endif # UBsan
|
||||
|
||||
# Address Sanitizer (Asan) testing. Issue 'make asan'.
|
||||
# Address Sanitizer (Asan) testing
|
||||
ifeq ($(findstring asan,$(MAKECMDGOALS)),asan)
|
||||
ifeq ($(findstring -fsanitize=address,$(CXXFLAGS)),)
|
||||
CXXFLAGS += -fsanitize=address
|
||||
endif # CXXFLAGS
|
||||
ifeq ($(findstring -fno-omit-frame-pointer,$(CXXFLAGS)),)
|
||||
CXXFLAGS += -fno-omit-frame-pointer
|
||||
endif # CXXFLAGS
|
||||
endif # Asan
|
||||
|
||||
# LD gold linker testing. Triggered by 'LD=ld.gold'.
|
||||
# LD gold linker testing
|
||||
ifeq ($(findstring ld.gold,$(LD)),ld.gold)
|
||||
ifeq ($(findstring -fuse-ld=gold,$(CXXFLAGS)),)
|
||||
ifeq ($(findstring -Wl,-fuse-ld=gold,$(CXXFLAGS)),)
|
||||
ELF_FORMAT := $(shell file `which ld.gold` 2>&1 | cut -d":" -f 2 | $(EGREP) -i -c "elf")
|
||||
ifneq ($(ELF_FORMAT),0)
|
||||
LDFLAGS += -fuse-ld=gold
|
||||
GOLD_OPTION = -Wl,-fuse-ld=gold
|
||||
endif # ELF/ELF64
|
||||
endif # CXXFLAGS
|
||||
endif # Gold
|
||||
|
||||
# Aligned access testing. Issue 'make aligned'.
|
||||
# Aligned access testing
|
||||
ifneq ($(filter align aligned,$(MAKECMDGOALS)),)
|
||||
ifeq ($(findstring -DCRYPTOPP_NO_UNALIGNED_DATA_ACCESS,$(CXXFLAGS)),)
|
||||
CXXFLAGS += -DCRYPTOPP_NO_UNALIGNED_DATA_ACCESS
|
||||
endif # CXXFLAGS
|
||||
endif # # CXXFLAGS
|
||||
endif # Aligned access
|
||||
|
||||
# GCC code coverage. Issue 'make coverage'.
|
||||
ifneq ($(filter coverage,$(MAKECMDGOALS)),)
|
||||
ifeq ($(findstring -coverage,$(CXXFLAGS)),)
|
||||
CXXFLAGS += -coverage
|
||||
endif # -coverage
|
||||
endif # GCC code coverage
|
||||
|
||||
# Debug testing on GNU systems. Triggered by -DDEBUG.
|
||||
# Newlib test due to http://sourceware.org/bugzilla/show_bug.cgi?id=20268
|
||||
# Debug testing on GNU systems
|
||||
ifneq ($(filter -DDEBUG -DDEBUG=1,$(CXXFLAGS)),)
|
||||
USING_GLIBCXX := $(shell $(CXX) -x c++ $(CXXFLAGS) -E adhoc.cpp.proto 2>&1 | $(EGREP) -i -c "__GLIBCXX__")
|
||||
ifneq ($(USING_GLIBCXX),0)
|
||||
HAS_NEWLIB := $(shell $(CXX) -x c++ $(CXXFLAGS) -E adhoc.cpp.proto 2>&1 | $(EGREP) -i -c "__NEWLIB__")
|
||||
ifeq ($(HAS_NEWLIB),0)
|
||||
ifeq ($(findstring -D_GLIBCXX_DEBUG,$(CXXFLAGS)),)
|
||||
CXXFLAGS += -D_GLIBCXX_DEBUG
|
||||
endif # CXXFLAGS
|
||||
endif # NAS_NEWLIB
|
||||
ifeq ($(findstring -D_GLIBCXX_CONCEPT_CHECKS,$(CXXFLAGS)),)
|
||||
CXXFLAGS += -D_GLIBCXX_CONCEPT_CHECKS
|
||||
endif # CXXFLAGS
|
||||
endif # USING_GLIBCXX
|
||||
endif # GNU Debug build
|
||||
|
||||
# Dead code stripping. Issue 'make lean'.
|
||||
ifeq ($(findstring lean,$(MAKECMDGOALS)),lean)
|
||||
ifeq ($(findstring -ffunction-sections,$(CXXFLAGS)),)
|
||||
CXXFLAGS += -ffunction-sections
|
||||
endif # CXXFLAGS
|
||||
ifeq ($(findstring -fdata-sections,$(CXXFLAGS)),)
|
||||
CXXFLAGS += -fdata-sections
|
||||
endif # CXXFLAGS
|
||||
ifneq ($(IS_DARWIN),0)
|
||||
ifeq ($(findstring -Wl,-dead_strip,$(LDFLAGS)),)
|
||||
LDFLAGS += -Wl,-dead_strip
|
||||
endif # CXXFLAGS
|
||||
else # BSD, Linux and Unix
|
||||
ifeq ($(findstring -Wl,--gc-sections,$(LDFLAGS)),)
|
||||
LDFLAGS += -Wl,--gc-sections
|
||||
endif # LDFLAGS
|
||||
endif # MAKECMDGOALS
|
||||
endif # Dead code stripping
|
||||
# List cryptlib.cpp first and cpu.o second in an attempt to tame C++ static initialization problems. The issue
|
||||
# spills into POD data types, so cpu.cpp is the second candidate for explicit initialization order.
|
||||
SRCS := cryptlib.cpp cpu.cpp $(filter-out cryptlib.cpp cpu.cpp pch.cpp simple.cpp winpipes.cpp cryptlib_bds.cpp,$(wildcard *.cpp))
|
||||
|
||||
# No need for CPU or RDRAND on non-X86 systems. X32 is represented with X64.
|
||||
ifeq ($(IS_X86)$(IS_X86_64),00)
|
||||
SRCS := $(filter-out cpu.cpp rdrand.cpp, $(SRCS))
|
||||
endif
|
||||
|
||||
ifneq ($(IS_MINGW),0)
|
||||
SRCS += winpipes.cpp
|
||||
endif
|
||||
|
||||
# List of objects with crytlib.o and cpu.o at the first and second index position
|
||||
OBJS := $(SRCS:.cpp=.o)
|
||||
|
||||
# test.o needs to be after bench.o for cygwin 1.1.4 (possible ld bug?)
|
||||
TESTOBJS := bench.o bench2.o test.o validat1.o validat2.o validat3.o adhoc.o datatest.o regtest.o fipsalgt.o dlltest.o
|
||||
LIBOBJS := $(filter-out $(TESTOBJS),$(OBJS))
|
||||
|
||||
# List cryptlib.cpp first in an attempt to tame C++ static initialization problems
|
||||
DLLSRCS := cryptlib.cpp algebra.cpp algparam.cpp asn.cpp basecode.cpp cbcmac.cpp channels.cpp des.cpp dessp.cpp dh.cpp dll.cpp dsa.cpp ec2n.cpp eccrypto.cpp ecp.cpp eprecomp.cpp files.cpp filters.cpp fips140.cpp fipstest.cpp gf2n.cpp gfpcrypt.cpp hex.cpp hmac.cpp integer.cpp iterhash.cpp misc.cpp modes.cpp modexppc.cpp mqueue.cpp nbtheory.cpp oaep.cpp osrng.cpp pch.cpp pkcspad.cpp pubkey.cpp queue.cpp randpool.cpp rdtables.cpp rijndael.cpp rng.cpp rsa.cpp sha.cpp simple.cpp skipjack.cpp strciphr.cpp trdlocal.cpp
|
||||
DLLOBJS := $(DLLSRCS:.cpp=.export.o)
|
||||
|
||||
# Import lib testing
|
||||
LIBIMPORTOBJS := $(LIBOBJS:.o=.import.o)
|
||||
TESTIMPORTOBJS := $(TESTOBJS:.o=.import.o)
|
||||
DLLTESTOBJS := dlltest.dllonly.o
|
||||
|
||||
# For Shared Objects, Diff, Dist/Zip rules
|
||||
LIB_VER := $(shell $(EGREP) "define CRYPTOPP_VERSION" config.h | cut -d" " -f 3)
|
||||
@ -400,56 +273,6 @@ ifeq ($(strip $(LIB_PATCH)),)
|
||||
LIB_PATCH := 0
|
||||
endif
|
||||
|
||||
ifeq ($(HAS_SOLIB_VERSION),1)
|
||||
# Full version suffix for shared library
|
||||
SOLIB_VERSION_SUFFIX=.$(LIB_MAJOR).$(LIB_MINOR).$(LIB_PATCH)
|
||||
# Different patchlevels are compatible, minor versions are not
|
||||
SOLIB_COMPAT_SUFFIX=.$(LIB_MAJOR).$(LIB_MINOR)
|
||||
SOLIB_FLAGS=-Wl,-soname,libcryptopp.so$(SOLIB_COMPAT_SUFFIX)
|
||||
endif # HAS_SOLIB_VERSION
|
||||
|
||||
###########################################################
|
||||
##### Source and object files #####
|
||||
###########################################################
|
||||
|
||||
# List cryptlib.cpp first, then cpu.cpp, then integer.cpp to tame C++ static initialization problems.
|
||||
SRCS := cryptlib.cpp cpu.cpp integer.cpp $(filter-out cryptlib.cpp cpu.cpp integer.cpp pch.cpp simple.cpp winpipes.cpp cryptlib_bds.cpp,$(wildcard *.cpp))
|
||||
|
||||
# Need CPU for X86/X64/X32 and ARM
|
||||
ifeq ($(IS_X86)$(IS_X64)$(IS_ARM32)$(IS_ARM64),0000)
|
||||
SRCS := $(filter-out cpu.cpp, $(SRCS))
|
||||
endif
|
||||
# Need RDRAND for X86/X64/X32
|
||||
ifeq ($(IS_X86)$(IS_X64),00)
|
||||
SRCS := $(filter-out rdrand.cpp, $(SRCS))
|
||||
endif
|
||||
|
||||
ifneq ($(IS_MINGW),0)
|
||||
SRCS += winpipes.cpp
|
||||
endif
|
||||
|
||||
# List cryptlib.cpp first, then cpu.cpp, then integer.cpp to tame C++ static initialization problems.
|
||||
OBJS := $(SRCS:.cpp=.o)
|
||||
|
||||
# List test.cpp first to tame C++ static initialization problems.
|
||||
TESTSRCS := test.cpp bench1.cpp bench2.cpp validat1.cpp validat2.cpp validat3.cpp adhoc.cpp datatest.cpp regtest.cpp fipsalgt.cpp dlltest.cpp
|
||||
TESTOBJS := $(TESTSRCS:.cpp=.o)
|
||||
LIBOBJS := $(filter-out $(TESTOBJS),$(OBJS))
|
||||
|
||||
# List cryptlib.cpp first, then cpu.cpp, then integer.cpp to tame C++ static initialization problems.
|
||||
DLLSRCS := cryptlib.cpp cpu.cpp integer.cpp shacal2.cpp md5.cpp shark.cpp zinflate.cpp gf2n.cpp salsa.cpp xtr.cpp oaep.cpp polynomi.cpp rc2.cpp default.cpp wait.cpp wake.cpp twofish.cpp iterhash.cpp adler32.cpp elgamal.cpp marss.cpp blowfish.cpp ecp.cpp filters.cpp strciphr.cpp camellia.cpp ida.cpp zlib.cpp des.cpp crc.cpp algparam.cpp dessp.cpp tea.cpp eax.cpp network.cpp emsa2.cpp pkcspad.cpp squaretb.cpp idea.cpp authenc.cpp hmac.cpp zdeflate.cpp xtrcrypt.cpp queue.cpp mars.cpp rc5.cpp blake2.cpp hrtimer.cpp eprecomp.cpp hex.cpp dsa.cpp sha.cpp fips140.cpp gzip.cpp seal.cpp files.cpp base32.cpp vmac.cpp tigertab.cpp sharkbox.cpp safer.cpp randpool.cpp esign.cpp arc4.cpp osrng.cpp skipjack.cpp seed.cpp sha3.cpp sosemanuk.cpp bfinit.cpp rabin.cpp 3way.cpp rw.cpp rdrand.cpp rsa.cpp rdtables.cpp gost.cpp socketft.cpp tftables.cpp nbtheory.cpp panama.cpp modes.cpp rijndael.cpp casts.cpp chacha.cpp gfpcrypt.cpp poly1305.cpp dll.cpp ec2n.cpp blumshub.cpp algebra.cpp basecode.cpp base64.cpp cbcmac.cpp rc6.cpp dh2.cpp gf256.cpp mqueue.cpp misc.cpp pssr.cpp channels.cpp tiger.cpp cast.cpp rng.cpp square.cpp asn.cpp whrlpool.cpp md4.cpp dh.cpp ccm.cpp md2.cpp mqv.cpp gf2_32.cpp ttmac.cpp luc.cpp trdlocal.cpp pubkey.cpp gcm.cpp ripemd.cpp eccrypto.cpp serpent.cpp cmac.cpp
|
||||
DLLOBJS := $(DLLSRCS:.cpp=.export.o)
|
||||
|
||||
# Import lib testing
|
||||
LIBIMPORTOBJS := $(LIBOBJS:.o=.import.o)
|
||||
TESTIMPORTOBJS := $(TESTOBJS:.o=.import.o)
|
||||
DLLTESTOBJS := dlltest.dllonly.o
|
||||
|
||||
###########################################################
|
||||
##### Targets and Recipes #####
|
||||
###########################################################
|
||||
|
||||
.PHONY: all
|
||||
all: cryptest.exe
|
||||
|
||||
ifneq ($(IS_DARWIN),0)
|
||||
@ -457,82 +280,49 @@ static: libcryptopp.a
|
||||
shared dynamic dylib: libcryptopp.dylib
|
||||
else
|
||||
static: libcryptopp.a
|
||||
shared dynamic: libcryptopp.so$(SOLIB_VERSION_SUFFIX)
|
||||
shared dynamic: libcryptopp.so
|
||||
endif
|
||||
|
||||
.PHONY: deps
|
||||
deps GNUmakefile.deps:
|
||||
$(CXX) $(CXXFLAGS) -MM *.cpp > GNUmakefile.deps
|
||||
|
||||
# CXXFLAGS are tuned earlier.
|
||||
.PHONY: asan ubsan align aligned
|
||||
asan ubsan align aligned: libcryptopp.a cryptest.exe
|
||||
|
||||
# CXXFLAGS are tuned earlier. Applications must use linker flags
|
||||
# -Wl,--gc-sections (Linux and Unix) or -Wl,-dead_strip (OS X)
|
||||
.PHONY: lean
|
||||
lean: static dynamic cryptest.exe
|
||||
|
||||
# May want to export CXXFLAGS="-g3 -O1"
|
||||
.PHONY: coverage
|
||||
coverage: libcryptopp.a cryptest.exe
|
||||
lcov --base-directory . --directory . --zerocounters -q
|
||||
./cryptest.exe v
|
||||
./cryptest.exe tv all
|
||||
lcov --base-directory . --directory . -c -o cryptest.info
|
||||
lcov --remove cryptest.info "*test.*" "bench*.cpp" "validat*.*" "/usr/*" -o cryptest.info
|
||||
rm -rf ./TestCoverage/
|
||||
genhtml -o ./TestCoverage/ -t "cryptest.exe test coverage" --num-spaces 4 cryptest.info
|
||||
|
||||
.PHONY: test check
|
||||
test check: cryptest.exe
|
||||
./cryptest.exe v
|
||||
|
||||
# Used to generate list of source files for Autotools, CMakeList, Android.mk, etc
|
||||
.PHONY: sources
|
||||
sources:
|
||||
$(info Library sources: $(filter-out fipstest.cpp $(TESTSRCS),$(SRCS)))
|
||||
$(info )
|
||||
$(info Test sources: $(TESTSRCS))
|
||||
|
||||
# Directory we want (can't specify on Doygen command line)
|
||||
DOCUMENT_DIRECTORY := ref$(LIB_VER)
|
||||
# Directory Doxygen uses (specified in Doygen config file)
|
||||
ifeq ($(wildcard Doxyfile),Doxyfile)
|
||||
DOXYGEN_DIRECTORY := $(strip $(shell $(EGREP) "OUTPUT_DIRECTORY" Doxyfile | grep -v "\#" | cut -d "=" -f 2))
|
||||
endif
|
||||
# Default directory (in case its missing in the config file)
|
||||
# Default directory (missing in config file)
|
||||
ifeq ($(strip $(DOXYGEN_DIRECTORY)),)
|
||||
DOXYGEN_DIRECTORY := html-docs
|
||||
endif
|
||||
|
||||
# Builds the documentation. Directory name is ref563, ref570, etc.
|
||||
.PHONY: docs html
|
||||
docs html:
|
||||
-$(RM) -r $(DOXYGEN_DIRECTORY)/ $(DOCUMENT_DIRECTORY)/ html-docs/
|
||||
doxygen Doxyfile -d CRYPTOPP_DOXYGEN_PROCESSING
|
||||
$(MV) $(DOXYGEN_DIRECTORY)/ $(DOCUMENT_DIRECTORY)/
|
||||
mv $(DOXYGEN_DIRECTORY)/ $(DOCUMENT_DIRECTORY)/
|
||||
-$(RM) CryptoPPRef.zip
|
||||
zip -9 CryptoPPRef.zip -x ".*" -x "*/.*" -r $(DOCUMENT_DIRECTORY)/
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
-$(RM) libcryptopp.a libcryptopp.so$(SOLIB_VERSION_SUFFIX) libcryptopp.dylib cryptopp.dll libcryptopp.dll.a libcryptopp.import.a
|
||||
ifeq ($(HAS_SOLIB_VERSION),1)
|
||||
-$(RM) libcryptopp.so libcryptopp.so$(SOLIB_COMPAT_SUFFIX)
|
||||
endif
|
||||
-$(RM) adhoc.cpp.o adhoc.cpp.proto.o $(LIBOBJS) $(TESTOBJS) $(DLLOBJS) $(LIBIMPORTOBJS) $(TESTIMPORTOBJS) $(DLLTESTOBJS)
|
||||
-$(RM) cryptest.exe dlltest.exe cryptest.import.exe cryptest.info ct rdrand-???.o
|
||||
-$(RM) *.gcno *.gcda *.stackdump core-*
|
||||
-$(RM) /tmp/adhoc.exe
|
||||
ifneq ($(wildcard /tmp/cryptopp_test/),)
|
||||
-$(RM) -r /tmp/cryptopp_test/
|
||||
endif
|
||||
-$(RM) libcryptopp.a libcryptopp.so libcryptopp.dylib cryptopp.dll libcryptopp.dll.a libcryptopp.import.a
|
||||
-$(RM) adhoc.cpp.o adhoc.cpp.proto.o $(LIBOBJS) $(TESTOBJS) $(DLLOBJS) $(LIBIMPORTOBJS) $(TESTIMPORTOBJS) $(DLLTESTOBJS) *.stackdump core-*
|
||||
-$(RM) cryptest.exe dlltest.exe cryptest.import.exe ct rdrand-???.o
|
||||
ifneq ($(wildcard *.exe.dSYM),)
|
||||
-$(RM) -r *.exe.dSYM/
|
||||
endif
|
||||
ifneq ($(wildcard *.dylib.dSYM),)
|
||||
-$(RM) -r *.dylib.dSYM/
|
||||
ifneq ($(wildcard $(DOCUMENT_DIRECTORY)/),)
|
||||
-$(RM) -r $(DOCUMENT_DIRECTORY)/
|
||||
endif
|
||||
ifneq ($(wildcard cov-int/),)
|
||||
-$(RM) -r cov-int/
|
||||
@ -540,18 +330,7 @@ endif
|
||||
|
||||
.PHONY: distclean
|
||||
distclean: clean
|
||||
-$(RM) adhoc.cpp adhoc.cpp.copied GNUmakefile.deps benchmarks.html cryptest.txt cryptest-*.txt
|
||||
-$(RM) CMakeCache.txt Makefile CTestTestfile.cmake cmake_install.cmake cryptopp-config-version.cmake
|
||||
-$(RM) cryptopp.tgz *.o *.bc *.ii *.s *~
|
||||
ifneq ($(wildcard CMakeFiles/),)
|
||||
-$(RM) -r CMakeFiles/
|
||||
endif
|
||||
ifneq ($(wildcard $(DOCUMENT_DIRECTORY)/),)
|
||||
-$(RM) -r $(DOCUMENT_DIRECTORY)/
|
||||
endif
|
||||
ifneq ($(wildcard TestCoverage/),)
|
||||
-$(RM) -r TestCoverage/
|
||||
endif
|
||||
-$(RM) adhoc.cpp adhoc.cpp.copied GNUmakefile.deps benchmarks.html cryptest.txt cryptest-*.txt *.o *.ii *.s
|
||||
ifneq ($(wildcard cryptopp$(LIB_VER)\.*),)
|
||||
-$(RM) cryptopp$(LIB_VER)\.*
|
||||
endif
|
||||
@ -564,87 +343,47 @@ endif
|
||||
|
||||
.PHONY: install
|
||||
install:
|
||||
$(MKDIR) -p $(DESTDIR)$(INCLUDEDIR)/cryptopp
|
||||
$(CP) *.h $(DESTDIR)$(INCLUDEDIR)/cryptopp
|
||||
-$(CHMOD) 0755 $(DESTDIR)$(INCLUDEDIR)/cryptopp
|
||||
-$(CHMOD) 0644 $(DESTDIR)$(INCLUDEDIR)/cryptopp/*.h
|
||||
ifneq ($(wildcard libcryptopp.a),)
|
||||
$(MKDIR) -p $(DESTDIR)$(LIBDIR)
|
||||
$(CP) libcryptopp.a $(DESTDIR)$(LIBDIR)
|
||||
-$(CHMOD) 0644 $(DESTDIR)$(LIBDIR)/libcryptopp.a
|
||||
endif
|
||||
ifneq ($(wildcard cryptest.exe),)
|
||||
$(MKDIR) -p $(DESTDIR)$(BINDIR)
|
||||
$(CP) cryptest.exe $(DESTDIR)$(BINDIR)
|
||||
-$(CHMOD) 0755 $(DESTDIR)$(BINDIR)/cryptest.exe
|
||||
$(MKDIR) -p $(DESTDIR)$(DATADIR)/cryptopp
|
||||
$(CP) -r TestData $(DESTDIR)$(DATADIR)/cryptopp
|
||||
$(CP) -r TestVectors $(DESTDIR)$(DATADIR)/cryptopp
|
||||
-$(CHMOD) 0755 $(DESTDIR)$(DATADIR)/cryptopp
|
||||
-$(CHMOD) 0755 $(DESTDIR)$(DATADIR)/cryptopp/TestData
|
||||
-$(CHMOD) 0755 $(DESTDIR)$(DATADIR)/cryptopp/TestVectors
|
||||
-$(CHMOD) 0644 $(DESTDIR)$(DATADIR)/cryptopp/TestData/*.dat
|
||||
-$(CHMOD) 0644 $(DESTDIR)$(DATADIR)/cryptopp/TestVectors/*.txt
|
||||
endif
|
||||
ifneq ($(wildcard libcryptopp.dylib),)
|
||||
$(MKDIR) -p $(DESTDIR)$(LIBDIR)
|
||||
$(CP) libcryptopp.dylib $(DESTDIR)$(LIBDIR)
|
||||
-install_name_tool -id $(DESTDIR)$(LIBDIR)/libcryptopp.dylib $(DESTDIR)$(LIBDIR)/libcryptopp.dylib
|
||||
-$(CHMOD) 0755 $(DESTDIR)$(LIBDIR)/libcryptopp.dylib
|
||||
endif
|
||||
ifneq ($(wildcard libcryptopp.so$(SOLIB_VERSION_SUFFIX)),)
|
||||
$(MKDIR) -p $(DESTDIR)$(LIBDIR)
|
||||
$(CP) libcryptopp.so$(SOLIB_VERSION_SUFFIX) $(DESTDIR)$(LIBDIR)
|
||||
-$(CHMOD) 0755 $(DESTDIR)$(LIBDIR)/libcryptopp.so$(SOLIB_VERSION_SUFFIX)
|
||||
ifeq ($(HAS_SOLIB_VERSION),1)
|
||||
-$(LN) -sf libcryptopp.so$(SOLIB_VERSION_SUFFIX) $(DESTDIR)$(LIBDIR)/libcryptopp.so
|
||||
$(LDCONF) $(DESTDIR)$(LIBDIR)
|
||||
endif
|
||||
$(MKDIR) -p $(PREFIX)/include/cryptopp $(PREFIX)/lib $(PREFIX)/bin
|
||||
-$(CP) *.h $(PREFIX)/include/cryptopp
|
||||
-$(CHMOD) 755 $(PREFIX)/include/cryptopp
|
||||
-$(CHMOD) 644 $(PREFIX)/include/cryptopp/*.h
|
||||
-$(CP) libcryptopp.a $(PREFIX)/lib
|
||||
-$(CHMOD) 644 $(PREFIX)/lib/libcryptopp.a
|
||||
-$(CP) cryptest.exe $(PREFIX)/bin
|
||||
-$(CHMOD) 755 $(PREFIX)/bin/cryptest.exe
|
||||
ifneq ($(IS_DARWIN),0)
|
||||
-$(CP) libcryptopp.dylib $(PREFIX)/lib
|
||||
-$(CHMOD) 755 $(PREFIX)/lib/libcryptopp.dylib
|
||||
else
|
||||
-$(CP) libcryptopp.so $(PREFIX)/lib
|
||||
-$(CHMOD) 755 $(PREFIX)/lib/libcryptopp.so
|
||||
endif
|
||||
|
||||
.PHONY: remove uninstall
|
||||
remove uninstall:
|
||||
-$(RM) -r $(DESTDIR)$(INCLUDEDIR)/cryptopp
|
||||
-$(RM) $(DESTDIR)$(LIBDIR)/libcryptopp.a
|
||||
-$(RM) $(DESTDIR)$(BINDIR)/cryptest.exe
|
||||
-$(RM) -r $(DESTDIR)$(DATADIR)/cryptopp
|
||||
-$(RM) -r $(PREFIX)/include/cryptopp
|
||||
-$(RM) $(PREFIX)/lib/libcryptopp.a
|
||||
-$(RM) $(PREFIX)/bin/cryptest.exe
|
||||
ifneq ($(IS_DARWIN),0)
|
||||
-$(RM) $(DESTDIR)$(LIBDIR)/libcryptopp.dylib
|
||||
-$(RM) $(PREFIX)/lib/libcryptopp.dylib
|
||||
else
|
||||
-$(RM) $(DESTDIR)$(LIBDIR)/libcryptopp.so$(SOLIB_VERSION_SUFFIX)
|
||||
ifeq ($(HAS_SOLIB_VERSION),1)
|
||||
-$(RM) $(DESTDIR)$(LIBDIR)/libcryptopp.so$(SOLIB_COMPAT_SUFFIX)
|
||||
-$(RM) $(DESTDIR)$(LIBDIR)/libcryptopp.so
|
||||
$(LDCONF) $(DESTDIR)$(LIBDIR)
|
||||
endif
|
||||
-$(RM) $(PREFIX)/lib/libcryptopp.so
|
||||
endif
|
||||
|
||||
libcryptopp.a: $(LIBOBJS)
|
||||
libcryptopp.a: public_service | $(LIBOBJS)
|
||||
$(AR) $(ARFLAGS) $@ $(LIBOBJS)
|
||||
ifeq ($(IS_SUN),0)
|
||||
$(RANLIB) $@
|
||||
endif
|
||||
|
||||
ifeq ($(HAS_SOLIB_VERSION),1)
|
||||
.PHONY: libcryptopp.so
|
||||
libcryptopp.so: libcryptopp.so$(SOLIB_VERSION_SUFFIX) | so_warning
|
||||
endif
|
||||
|
||||
libcryptopp.so$(SOLIB_VERSION_SUFFIX): $(LIBOBJS)
|
||||
$(CXX) -shared $(SOLIB_FLAGS) -o $@ $(CXXFLAGS) $(LDFLAGS) $(LIBOBJS) $(LDLIBS)
|
||||
ifeq ($(HAS_SOLIB_VERSION),1)
|
||||
-$(LN) libcryptopp.so$(SOLIB_VERSION_SUFFIX) libcryptopp.so
|
||||
-$(LN) libcryptopp.so$(SOLIB_VERSION_SUFFIX) libcryptopp.so$(SOLIB_COMPAT_SUFFIX)
|
||||
endif
|
||||
libcryptopp.so: public_service | $(LIBOBJS)
|
||||
$(CXX) -shared -o $@ $(CXXFLAGS) $(GOLD_OPTION) $(LIBOBJS) $(LDLIBS)
|
||||
|
||||
libcryptopp.dylib: $(LIBOBJS)
|
||||
$(CXX) -dynamiclib -o $@ $(CXXFLAGS) -install_name "$@" -current_version "$(LIB_MAJOR).$(LIB_MINOR).$(LIB_PATCH)" -compatibility_version "$(LIB_MAJOR).$(LIB_MINOR)" -headerpad_max_install_names $(LDFLAGS) $(LIBOBJS)
|
||||
$(CXX) -dynamiclib -o $@ $(CXXFLAGS) -install_name "$@" -current_version "$(LIB_MAJOR).$(LIB_MINOR).$(LIB_PATCH)" -compatibility_version "$(LIB_MAJOR).$(LIB_MINOR)" $(LIBOBJS)
|
||||
|
||||
cryptest.exe: libcryptopp.a $(TESTOBJS)
|
||||
$(CXX) -o $@ $(CXXFLAGS) $(TESTOBJS) ./libcryptopp.a $(LDFLAGS) $(LDLIBS)
|
||||
cryptest.exe: public_service | libcryptopp.a $(TESTOBJS)
|
||||
$(CXX) -o $@ $(CXXFLAGS) $(TESTOBJS) ./libcryptopp.a $(LDFLAGS) $(GOLD_OPTION) $(LDLIBS)
|
||||
|
||||
# Makes it faster to test changes
|
||||
nolib: $(OBJS)
|
||||
nolib: $(OBJS) # makes it faster to test changes
|
||||
$(CXX) -o ct $(CXXFLAGS) $(OBJS) $(LDFLAGS) $(LDLIBS)
|
||||
|
||||
dll: cryptest.import.exe dlltest.exe
|
||||
@ -654,9 +393,7 @@ cryptopp.dll: $(DLLOBJS)
|
||||
|
||||
libcryptopp.import.a: $(LIBIMPORTOBJS)
|
||||
$(AR) $(ARFLAGS) $@ $(LIBIMPORTOBJS)
|
||||
ifeq ($(IS_SUN),0)
|
||||
$(RANLIB) $@
|
||||
endif
|
||||
|
||||
cryptest.import.exe: cryptopp.dll libcryptopp.import.a $(TESTIMPORTOBJS)
|
||||
$(CXX) -o $@ $(CXXFLAGS) $(TESTIMPORTOBJS) -L. -lcryptopp.dll -lcryptopp.import $(LDFLAGS) $(LDLIBS)
|
||||
@ -664,58 +401,36 @@ cryptest.import.exe: cryptopp.dll libcryptopp.import.a $(TESTIMPORTOBJS)
|
||||
dlltest.exe: cryptopp.dll $(DLLTESTOBJS)
|
||||
$(CXX) -o $@ $(CXXFLAGS) $(DLLTESTOBJS) -L. -lcryptopp.dll $(LDFLAGS) $(LDLIBS)
|
||||
|
||||
# This recipe requires a previous "svn co -r 541 http://svn.code.sf.net/p/cryptopp/code/trunk/c5"
|
||||
.PHONY: diff
|
||||
diff:
|
||||
-$(RM) cryptopp$(LIB_VER).diff
|
||||
-svn diff -r 541 > cryptopp$(LIB_VER).diff
|
||||
|
||||
# This recipe prepares the distro files
|
||||
TEXT_FILES := *.h *.cpp adhoc.cpp.proto License.txt Readme.txt Install.txt Filelist.txt CMakeLists.txt config.compat Doxyfile cryptest* cryptlib* dlltest* cryptdll* *.sln *.vcxproj *.filters cryptopp.rc TestVectors/*.txt TestData/*.dat TestScripts/*.sh TestScripts/*.pl TestScripts/*.cmd
|
||||
EXEC_FILES := GNUmakefile GNUmakefile-cross TestData/ TestVectors/ TestScripts/
|
||||
TEXT_FILES := *.h *.cpp adhoc.cpp.proto License.txt Readme.txt Install.txt Filelist.txt config.recommend Doxyfile cryptest* cryptlib* dlltest* cryptdll* *.sln *.vcproj *.dsw *.dsp cryptopp.rc TestVectors/*.txt TestData/*.dat
|
||||
EXEC_FILES := GNUmakefile GNUmakefile-cross cryptest.sh rdrand-nasm.sh TestData/ TestVectors/
|
||||
|
||||
ifeq ($(wildcard Filelist.txt),Filelist.txt)
|
||||
DIST_FILES := $(shell cat Filelist.txt)
|
||||
endif
|
||||
|
||||
.PHONY: trim
|
||||
trim:
|
||||
ifneq ($(IS_DARWIN),0)
|
||||
sed -i '' -e's/[[:space:]]*$$//' *.compat *.sh *.h *.cpp *.sln *.vcxproj GNUmakefile GNUmakefile-cross
|
||||
make convert
|
||||
else
|
||||
sed -i -e's/[[:space:]]*$$//' *.compat *.sh *.h *.cpp *.sln *.vcxproj GNUmakefile GNUmakefile-cross
|
||||
make convert
|
||||
endif
|
||||
|
||||
.PHONY: convert
|
||||
convert:
|
||||
-$(CHMOD) 0700 TestVectors/ TestData/ TestScripts/
|
||||
-$(CHMOD) 0600 $(TEXT_FILES) *.asm *.S *.zip *.cmake TestVectors/*.txt TestData/*.dat
|
||||
-$(CHMOD) 0700 $(EXEC_FILES) *.sh *.cmd TestScripts/*.sh TestScripts/*.pl TestScripts/*.cmd
|
||||
-$(CHMOD) 0700 *.cmd *.sh GNUmakefile GNUmakefile-cross TestScripts/*.sh TestScripts/*.pl
|
||||
-unix2dos --keepdate --quiet $(TEXT_FILES) *.asm *.cmd *.cmake TestScripts/*.pl TestScripts/*.cmd
|
||||
-dos2unix --keepdate --quiet GNUmakefile GNUmakefile-cross *.S *.sh TestScripts/*.sh
|
||||
chmod 0700 TestVectors/ TestData/
|
||||
chmod 0600 $(TEXT_FILES) *.zip
|
||||
chmod 0700 $(EXEC_FILES)
|
||||
chmod u+x *.cmd *.sh
|
||||
unix2dos --keepdate --quiet $(TEXT_FILES) *.asm *.cmd
|
||||
dos2unix --keepdate --quiet GNUmakefile GNUmakefile-cross *.S *.sh
|
||||
ifneq ($(IS_DARWIN),0)
|
||||
-xattr -c *
|
||||
xattr -c *
|
||||
endif
|
||||
|
||||
# Build the ZIP file with source files. No documentation.
|
||||
.PHONY: zip dist
|
||||
zip dist: | distclean convert
|
||||
zip dist: | distclean convert diff
|
||||
zip -q -9 cryptopp$(LIB_VER).zip $(DIST_FILES)
|
||||
|
||||
# Build the ISO to transfer the ZIP to old distros via CDROM
|
||||
.PHONY: iso
|
||||
iso: | zip
|
||||
ifneq ($(IS_DARWIN),0)
|
||||
$(MKDIR) -p $(PWD)/cryptopp$(LIB_VER)
|
||||
$(CP) cryptopp$(LIB_VER).zip $(PWD)/cryptopp$(LIB_VER)
|
||||
hdiutil makehybrid -iso -joliet -o cryptopp$(LIB_VER).iso $(PWD)/cryptopp$(LIB_VER)
|
||||
-$(RM) -r $(PWD)/cryptopp$(LIB_VER)
|
||||
else ifneq ($(IS_LINUX),0)
|
||||
$(MKDIR) -p $(PWD)/cryptopp$(LIB_VER)
|
||||
$(CP) cryptopp$(LIB_VER).zip $(PWD)/cryptopp$(LIB_VER)
|
||||
genisoimage -q -o cryptopp$(LIB_VER).iso $(PWD)/cryptopp$(LIB_VER)
|
||||
-$(RM) -r $(PWD)/cryptopp$(LIB_VER)
|
||||
endif
|
||||
|
||||
# CRYPTOPP_CPU_SPEED in GHz
|
||||
CRYPTOPP_CPU_SPEED ?= 2.4
|
||||
.PHONY: bench benchmark benchmarks
|
||||
bench benchmark benchmarks: cryptest.exe
|
||||
rm -f benchmarks.html
|
||||
@ -725,9 +440,9 @@ bench benchmark benchmarks: cryptest.exe
|
||||
echo "<TITLE>Speed Comparison of Popular Crypto Algorithms</TITLE>" >> benchmarks.html
|
||||
echo "</HEAD>" >> benchmarks.html
|
||||
echo "<BODY>" >> benchmarks.html
|
||||
echo "<H1><a href=\"http://www.cryptopp.com\">Crypto++</a>" $(LIB_MAJOR).$(LIB_MINOR).$(LIB_PATCH) "Benchmarks</H1>" >> benchmarks.html
|
||||
echo "<H1><a href=\"http://www.cryptopp.com\">Crypto++</a>" $(LIB_MAJOR).$(LIB_MINOR).$(LIB_REVISION) "Benchmarks</H1>" >> benchmarks.html
|
||||
echo "<P>Here are speed benchmarks for some commonly used cryptographic algorithms.</P>" >> benchmarks.html
|
||||
./cryptest.exe b 3 $(CRYPTOPP_CPU_SPEED) >> benchmarks.html
|
||||
./cryptest.exe b 3 2.4 >> benchmarks.html
|
||||
echo "</BODY>" >> benchmarks.html
|
||||
echo "</HTML>" >> benchmarks.html
|
||||
|
||||
@ -754,20 +469,6 @@ cpu.o:
|
||||
endif
|
||||
endif
|
||||
|
||||
# Only use CRYPTOPP_DATA_DIR if its not set in CXXFLAGS
|
||||
ifeq ($(findstring -DCRYPTOPP_DATA_DIR,$(CXXFLAGS)),)
|
||||
ifneq ($(strip $(CRYPTOPP_DATA_DIR)),)
|
||||
validat%.o : validat%.cpp
|
||||
$(CXX) $(CXXFLAGS) -DCRYPTOPP_DATA_DIR=\"$(CRYPTOPP_DATA_DIR)\" -c $<
|
||||
bench%.o : bench%.cpp
|
||||
$(CXX) $(CXXFLAGS) -DCRYPTOPP_DATA_DIR=\"$(CRYPTOPP_DATA_DIR)\" -c $<
|
||||
datatest.o : datatest.cpp
|
||||
$(CXX) $(CXXFLAGS) -DCRYPTOPP_DATA_DIR=\"$(CRYPTOPP_DATA_DIR)\" -c $<
|
||||
test.o : test.cpp
|
||||
$(CXX) $(CXXFLAGS) -DCRYPTOPP_DATA_DIR=\"$(CRYPTOPP_DATA_DIR)\" -c $<
|
||||
endif
|
||||
endif
|
||||
|
||||
%.dllonly.o : %.cpp
|
||||
$(CXX) $(CXXFLAGS) -DCRYPTOPP_DLL_ONLY -c $< -o $@
|
||||
|
||||
@ -777,17 +478,27 @@ endif
|
||||
%.export.o : %.cpp
|
||||
$(CXX) $(CXXFLAGS) -DCRYPTOPP_EXPORTS -c $< -o $@
|
||||
|
||||
%.bc : %.cpp
|
||||
$(CXX) $(CXXFLAGS) -c $<
|
||||
|
||||
%.o : %.cpp
|
||||
$(CXX) $(CXXFLAGS) -c $<
|
||||
|
||||
.PHONY: so_warning
|
||||
so_warning:
|
||||
ifeq ($(HAS_SOLIB_VERSION),1)
|
||||
$(info WARNING: Only the symlinks to the shared-object library have been updated.)
|
||||
$(info WARNING: If the library is installed in a system directory you will need)
|
||||
$(info WARNING: to run 'ldconfig' to update the shared-object library cache.)
|
||||
# Warn of potential configurations issues. They will go away after 5.6.3.
|
||||
UNALIGNED_ACCESS := $(shell $(EGREP) -c "^[[:space:]]*//[[:space:]]*\#[[:space:]]*define[[:space:]]*CRYPTOPP_NO_UNALIGNED_DATA_ACCESS" config.h)
|
||||
NO_INIT_PRIORITY := $(shell $(EGREP) -c "^[[:space:]]*//[[:space:]]*\#[[:space:]]*define[[:space:]]*CRYPTOPP_INIT_PRIORITY" config.h)
|
||||
COMPATIBILITY_562 := $(shell $(EGREP) -c "^[[:space:]]*\#[[:space:]]*define[[:space:]]*CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562" config.h)
|
||||
.PHONY: public_service
|
||||
public_service:
|
||||
ifneq ($(UNALIGNED_ACCESS),0)
|
||||
$(info WARNING: CRYPTOPP_NO_UNALIGNED_DATA_ACCESS is not defined in config.h.)
|
||||
endif
|
||||
ifneq ($(NO_INIT_PRIORITY),0)
|
||||
$(info WARNING: CRYPTOPP_INIT_PRIORITY is not defined in config.h.)
|
||||
endif
|
||||
ifneq ($(COMPATIBILITY_562),0)
|
||||
$(info WARNING: CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562 is defined in config.h.)
|
||||
endif
|
||||
ifneq ($(UNALIGNED_ACCESS)$(NO_INIT_PRIORITY)$(COMPATIBILITY_562),000)
|
||||
$(info WARNING: You should make these changes in config.h, and not CXXFLAGS.)
|
||||
$(info WARNING: You can 'mv config.recommend config.h', but it breaks versioning.)
|
||||
$(info WARNING: See http://cryptopp.com/wiki/config.h for more details.)
|
||||
$(info )
|
||||
endif
|
||||
|
||||
252
Common/3dParty/cryptopp/GNUmakefile-cross
Executable file → Normal file
252
Common/3dParty/cryptopp/GNUmakefile-cross
Executable file → Normal file
@ -4,50 +4,26 @@ CXXFLAGS ?= -DNDEBUG -g2 -Os -fPIC -pipe
|
||||
# CXXFLAGS += -ffunction-sections -fdata-sections
|
||||
# LDFLAGS += -Wl,--gc-sections
|
||||
|
||||
AR ?= ar
|
||||
ARFLAGS ?= cr
|
||||
ARFLAGS = -cr # ar needs the dash on OpenBSD
|
||||
RANLIB ?= ranlib
|
||||
CP ?= cp
|
||||
MV ?= mv
|
||||
CHMOD ?= chmod
|
||||
MKDIR ?= mkdir
|
||||
EGREP ?= egrep
|
||||
LN ?= ln -sf
|
||||
CP = cp
|
||||
MKDIR = mkdir
|
||||
EGREP = egrep
|
||||
CHMOD = chmod
|
||||
|
||||
CLANG_COMPILER = $(shell $(CXX) --version 2>&1 | $(EGREP) -i -c "clang")
|
||||
|
||||
IS_IOS ?= 0
|
||||
IS_ANDROID ?= 0
|
||||
IS_ARM_EMBEDDED ?= 0
|
||||
|
||||
# Can be used by Android and Embeeded cross-compiles. Disable by default because
|
||||
# Android and embedded users typically don't run this configuration.
|
||||
HAS_SOLIB_VERSION ?= 0
|
||||
IS_X86=0
|
||||
IS_LINUX=0
|
||||
IS_MINGW=0
|
||||
IS_DARWIN=0
|
||||
UNAME=CrossCompile
|
||||
|
||||
# Default prefix for make install
|
||||
ifeq ($(PREFIX),)
|
||||
PREFIX = /usr/local
|
||||
endif
|
||||
|
||||
# http://www.gnu.org/prep/standards/html_node/Directory-Variables.html
|
||||
ifeq ($(DATADIR),)
|
||||
DATADIR := $(PREFIX)/share
|
||||
endif
|
||||
ifeq ($(LIBDIR),)
|
||||
LIBDIR := $(PREFIX)/lib
|
||||
endif
|
||||
ifeq ($(BINDIR),)
|
||||
BINDIR := $(PREFIX)/bin
|
||||
endif
|
||||
ifeq ($(INCLUDEDIR),)
|
||||
INCLUDEDIR := $(PREFIX)/include
|
||||
endif
|
||||
|
||||
# We honor ARFLAGS, but the "v" option used by default causes a noisy make
|
||||
ifeq ($(ARFLAGS),rv)
|
||||
ARFLAGS = r
|
||||
endif
|
||||
|
||||
# Sadly, we can't actually use GCC_PRAGMA_AWARE because of GCC bug 53431.
|
||||
# Its a shame because GCC has so much to offer by the way of analysis.
|
||||
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53431
|
||||
@ -55,200 +31,120 @@ ifneq ($(CLANG_COMPILER),0)
|
||||
CXXFLAGS += -Wall
|
||||
endif
|
||||
|
||||
# iOS cross-compile configuration.
|
||||
# iOS cross-compile configuration. Works in conjunction with IS_CROSS_COMPILE.
|
||||
# See http://www.cryptopp.com/wiki/iOS_(Command_Line).
|
||||
ifeq ($(IS_IOS),1)
|
||||
CXX = clang++
|
||||
|
||||
CXXFLAGS += $(IOS_FLAGS) -arch $(IOS_ARCH)
|
||||
CXXFLAGS += -isysroot $(IOS_SYSROOT) -stdlib=libc++
|
||||
CXXFLAGS += -DCRYPTOPP_DISABLE_ASM $(IOS_FLAGS)
|
||||
CXXFLAGS += -arch $(IOS_ARCH) -isysroot $(IOS_SYSROOT)
|
||||
CXXFLAGS += -stdlib=libc++
|
||||
|
||||
AR = libtool
|
||||
ARFLAGS = -static -o
|
||||
RANLIB = ranlib
|
||||
endif
|
||||
|
||||
# Android cross-compile configuration.
|
||||
# Android cross-compile configuration. Works in conjunction with IS_CROSS_COMPILE.
|
||||
# See http://www.cryptopp.com/wiki/Android_(Command_Line).
|
||||
ifeq ($(IS_ANDROID),1)
|
||||
# CPP, CXX, AR, RANLIB, LD, etc are set in 'setenv-android.sh'
|
||||
CXXFLAGS += $(AOSP_FLAGS) -DANDROID --sysroot=$(AOSP_SYSROOT)
|
||||
CXXFLAGS += -Wa,--noexecstack -I$(AOSP_STL_INC)
|
||||
|
||||
# c++config.h shows up in odd places at times.
|
||||
ifneq ($(AOSP_BITS_INC),)
|
||||
CXXFLAGS += -I$(AOSP_BITS_INC)
|
||||
endif
|
||||
|
||||
LDLIBS += $(AOSP_STL_LIB)
|
||||
CXXFLAGS += -DCRYPTOPP_DISABLE_ASM $(ANDROID_FLAGS)
|
||||
CXXFLAGS += --sysroot=$(ANDROID_SYSROOT) -I$(ANDROID_STL_INC)
|
||||
LDLIBS += $(ANDROID_STL_LIB)
|
||||
endif
|
||||
|
||||
# ARM embedded cross-compile configuration.
|
||||
# ARM embedded cross-compile configuration. Works in conjunction with IS_CROSS_COMPILE.
|
||||
# See http://www.cryptopp.com/wiki/ARM_Embedded_(Command_Line)
|
||||
# and http://www.cryptopp.com/wiki/ARM_Embedded_(Bare Metal).
|
||||
ifeq ($(IS_ARM_EMBEDDED),1)
|
||||
# CPP, CXX, AR, RANLIB, LD, etc are set in 'setenv-embedded.sh'
|
||||
CXXFLAGS += $(ARM_EMBEDDED_FLAGS) --sysroot=$(ARM_EMBEDDED_SYSROOT)
|
||||
CXXFLAGS += -DCRYPTOPP_DISABLE_ASM $(ARM_EMBEDDED_FLAGS)
|
||||
CXXFLAGS += --sysroot=$(ARM_EMBEDDED_SYSROOT)
|
||||
endif
|
||||
|
||||
# Dead code stripping. Issue 'make lean'.
|
||||
ifeq ($(findstring lean,$(MAKECMDGOALS)),lean)
|
||||
ifeq ($(findstring -ffunction-sections,$(CXXFLAGS)),)
|
||||
CXXFLAGS += -ffunction-sections
|
||||
endif # CXXFLAGS
|
||||
ifeq ($(findstring -fdata-sections,$(CXXFLAGS)),)
|
||||
CXXFLAGS += -fdata-sections
|
||||
endif # CXXFLAGS
|
||||
ifeq ($(IS_IOS),1)
|
||||
ifeq ($(findstring -Wl,-dead_strip,$(LDFLAGS)),)
|
||||
LDFLAGS += -Wl,-dead_strip
|
||||
endif # CXXFLAGS
|
||||
else # BSD, Linux and Unix
|
||||
ifeq ($(findstring -Wl,--gc-sections,$(LDFLAGS)),)
|
||||
LDFLAGS += -Wl,--gc-sections
|
||||
endif # LDFLAGS
|
||||
endif # MAKECMDGOALS
|
||||
endif # Dead code stripping
|
||||
# List cryptlib.cpp first in an attempt to tame C++ static initialization problems
|
||||
SRCS := cryptlib.cpp cpu.cpp $(filter-out cryptlib.cpp cpu.cpp pch.cpp simple.cpp winpipes.cpp cryptlib_bds.cpp,$(wildcard *.cpp))
|
||||
|
||||
# List cryptlib.cpp first and cpu.cpp second in an attempt to tame C++ static initialization problems.
|
||||
# The issue spills into POD data types of cpu.cpp due to the storage class of the bools, so cpu.cpp
|
||||
# is the second candidate for explicit initialization order.
|
||||
SRCS := cryptlib.cpp cpu.cpp integer.cpp $(filter-out cryptlib.cpp cpu.cpp integer.cpp pch.cpp simple.cpp winpipes.cpp cryptlib_bds.cpp,$(wildcard *.cpp))
|
||||
# List of objects with crytlib.o at the first index position
|
||||
OBJS := $(SRCS:.cpp=.o)
|
||||
|
||||
# test.o needs to be after bench.o for cygwin 1.1.4 (possible ld bug?)
|
||||
TESTSRCS := bench1.cpp bench2.cpp test.cpp validat1.cpp validat2.cpp validat3.cpp adhoc.cpp datatest.cpp regtest.cpp fipsalgt.cpp dlltest.cpp
|
||||
TESTOBJS := $(TESTSRCS:.cpp=.o)
|
||||
TESTOBJS := bench.o bench2.o test.o validat1.o validat2.o validat3.o adhoc.o datatest.o regtest.o fipsalgt.o dlltest.o
|
||||
LIBOBJS := $(filter-out $(TESTOBJS),$(OBJS))
|
||||
|
||||
# For Shared Objects, Diff, Dist/Zip rules
|
||||
LIB_VER := $(shell $(EGREP) "define CRYPTOPP_VERSION" config.h | cut -d" " -f 3)
|
||||
LIB_MAJOR := $(shell echo $(LIB_VER) | cut -c 1)
|
||||
LIB_MINOR := $(shell echo $(LIB_VER) | cut -c 2)
|
||||
LIB_PATCH := $(shell echo $(LIB_VER) | cut -c 3)
|
||||
# List cryptlib.cpp first in an attempt to tame C++ static initialization problems
|
||||
DLLSRCS := cryptlib.cpp cpu.cpp algebra.cpp algparam.cpp asn.cpp basecode.cpp cbcmac.cpp channels.cpp des.cpp dessp.cpp dh.cpp dll.cpp dsa.cpp ec2n.cpp eccrypto.cpp ecp.cpp eprecomp.cpp files.cpp filters.cpp fips140.cpp fipstest.cpp gf2n.cpp gfpcrypt.cpp hex.cpp hmac.cpp integer.cpp iterhash.cpp misc.cpp modes.cpp modexppc.cpp mqueue.cpp nbtheory.cpp oaep.cpp osrng.cpp pch.cpp pkcspad.cpp pubkey.cpp queue.cpp randpool.cpp rdtables.cpp rijndael.cpp rng.cpp rsa.cpp sha.cpp simple.cpp skipjack.cpp strciphr.cpp trdlocal.cpp
|
||||
DLLOBJS := $(DLLSRCS:.cpp=.export.o)
|
||||
|
||||
ifeq ($(strip $(LIB_PATCH)),)
|
||||
LIB_PATCH := 0
|
||||
endif
|
||||
# Import lib testing
|
||||
LIBIMPORTOBJS := $(LIBOBJS:.o=.import.o)
|
||||
TESTIMPORTOBJS := $(TESTOBJS:.o=.import.o)
|
||||
DLLTESTOBJS := dlltest.dllonly.o
|
||||
|
||||
ifeq ($(HAS_SOLIB_VERSION),1)
|
||||
# Full version suffix for shared library
|
||||
SOLIB_VERSION_SUFFIX=.$(LIB_MAJOR).$(LIB_MINOR).$(LIB_PATCH)
|
||||
# Different patchlevels are compatible, minor versions are not
|
||||
SOLIB_COMPAT_SUFFIX=.$(LIB_MAJOR).$(LIB_MINOR)
|
||||
SOLIB_FLAGS=-Wl,-soname,libcryptopp.so$(SOLIB_COMPAT_SUFFIX)
|
||||
endif # HAS_SOLIB_VERSION
|
||||
|
||||
.PHONY: all
|
||||
all: cryptest.exe
|
||||
|
||||
ifneq ($(IS_IOS),0)
|
||||
ifneq ($(IS_DARWIN),0)
|
||||
static: libcryptopp.a
|
||||
shared dynamic dylib: libcryptopp.dylib
|
||||
else
|
||||
static: libcryptopp.a
|
||||
shared dynamic: libcryptopp.so$(SOLIB_VERSION_SUFFIX)
|
||||
shared dynamic: libcryptopp.so
|
||||
endif
|
||||
|
||||
test: cryptest.exe
|
||||
./cryptest.exe v
|
||||
|
||||
# CXXFLAGS are tuned earlier. Applications must use linker flags
|
||||
# -Wl,--gc-sections (Linux and Unix) or -Wl,-dead_strip (OS X)
|
||||
.PHONY: lean
|
||||
lean: static dynamic cryptest.exe
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
-$(RM) cryptest.exe libcryptopp.a libcryptopp.so$(SOLIB_VERSION_SUFFIX) libcryptopp.dylib
|
||||
ifeq ($(HAS_SOLIB_VERSION),1)
|
||||
-$(RM) libcryptopp.so libcryptopp.so$(SOLIB_COMPAT_SUFFIX)
|
||||
endif
|
||||
-$(RM) adhoc.cpp.o adhoc.cpp.proto.o $(LIBOBJS) $(TESTOBJS)
|
||||
ifneq ($(wildcard *.exe.dSYM),)
|
||||
-$(RM) -r *.exe.dSYM/
|
||||
endif
|
||||
ifneq ($(wildcard *.dylib.dSYM),)
|
||||
-$(RM) -r *.dylib.dSYM/
|
||||
-$(RM) cryptest.exe dlltest.exe libcryptopp.a libcryptopp.so libcryptopp.dylib cryptopp.dll libcryptopp.dll.a libcryptopp.import.a cryptest.import.exe ct
|
||||
-$(RM) adhoc.cpp.o adhoc.cpp.proto.o $(LIBOBJS) $(TESTOBJS) $(DLLOBJS) $(LIBIMPORTOBJS) $(TESTIMPORTOBJS) $(DLLTESTOBJS)
|
||||
ifneq ($(wildcard *.dSYM),)
|
||||
-$(RM) -r cryptest.exe.dSYM dlltest.exe.dSYM
|
||||
endif
|
||||
|
||||
.PHONY: distclean
|
||||
distclean: clean
|
||||
-$(RM) adhoc.cpp adhoc.cpp.copied GNUmakefile.deps cryptopp.tgz *.o *.ii *.s
|
||||
-$(RM) adhoc.cpp adhoc.cpp.copied GNUmakefile.deps cryptopp$(LIB_VER).diff cryptopp$(LIB_VER).zip *.o *.ii *.s
|
||||
|
||||
.PHONY: install
|
||||
install:
|
||||
$(MKDIR) -p $(DESTDIR)$(INCLUDEDIR)/cryptopp
|
||||
$(CP) *.h $(DESTDIR)$(INCLUDEDIR)/cryptopp
|
||||
-$(CHMOD) 755 $(DESTDIR)$(INCLUDEDIR)/cryptopp
|
||||
-$(CHMOD) 644 $(DESTDIR)$(INCLUDEDIR)/cryptopp/*.h
|
||||
ifneq ($(wildcard cryptest.exe),)
|
||||
$(MKDIR) -p $(DESTDIR)$(BINDIR)
|
||||
$(CP) cryptest.exe $(DESTDIR)$(BINDIR)
|
||||
-$(CHMOD) 755 $(DESTDIR)$(BINDIR)/cryptest.exe
|
||||
endif
|
||||
ifneq ($(wildcard libcryptopp.a),)
|
||||
$(MKDIR) -p $(DESTDIR)$(LIBDIR)
|
||||
$(CP) libcryptopp.a $(DESTDIR)$(LIBDIR)
|
||||
-$(CHMOD) 644 $(DESTDIR)$(LIBDIR)/libcryptopp.a
|
||||
endif
|
||||
ifneq ($(wildcard libcryptopp.dylib),)
|
||||
$(MKDIR) -p $(DESTDIR)$(LIBDIR)
|
||||
$(CP) libcryptopp.dylib $(DESTDIR)$(LIBDIR)
|
||||
-$(CHMOD) 755 $(DESTDIR)$(LIBDIR)/libcryptopp.dylib
|
||||
endif
|
||||
ifneq ($(wildcard libcryptopp.so$(SOLIB_VERSION_SUFFIX)),)
|
||||
$(CP) libcryptopp.so $(DESTDIR)$(LIBDIR)
|
||||
-$(CHMOD) 755 $(DESTDIR)$(LIBDIR)/libcryptopp.so$(SOLIB_VERSION_SUFFIX)
|
||||
ifeq ($(HAS_SOLIB_VERSION),1)
|
||||
-$(LN) -sf libcryptopp.so$(SOLIB_VERSION_SUFFIX) $(DESTDIR)$(LIBDIR)/libcryptopp.so
|
||||
endif
|
||||
$(MKDIR) -p $(PREFIX)/include/cryptopp $(PREFIX)/lib $(PREFIX)/bin
|
||||
-$(CP) *.h $(PREFIX)/include/cryptopp
|
||||
-$(CHMOD) 755 $(PREFIX)/include/cryptopp
|
||||
-$(CHMOD) 644 $(PREFIX)/include/cryptopp/*.h
|
||||
-$(CP) libcryptopp.a $(PREFIX)/lib
|
||||
-$(CHMOD) 644 $(PREFIX)/lib/libcryptopp.a
|
||||
-$(CP) cryptest.exe $(PREFIX)/bin
|
||||
-$(CHMOD) 755 $(PREFIX)/bin/cryptest.exe
|
||||
ifneq ($(IS_DARWIN),0)
|
||||
-$(CP) libcryptopp.dylib $(PREFIX)/lib
|
||||
-$(CHMOD) 755 $(PREFIX)/lib/libcryptopp.dylib
|
||||
else
|
||||
-$(CP) libcryptopp.so $(PREFIX)/lib
|
||||
-$(CHMOD) 755 $(PREFIX)/lib/libcryptopp.so
|
||||
endif
|
||||
|
||||
.PHONY: remove uninstall
|
||||
remove uninstall:
|
||||
-$(RM) -r $(DESTDIR)$(INCLUDEDIR)/cryptopp
|
||||
-$(RM) $(DESTDIR)$(LIBDIR)/libcryptopp.a
|
||||
-$(RM) $(DESTDIR)$(BINDIR)/cryptest.exe
|
||||
ifneq ($(IS_IOS),0)
|
||||
-$(RM) $(DESTDIR)$(LIBDIR)/libcryptopp.dylib
|
||||
-$(RM) -r $(PREFIX)/include/cryptopp
|
||||
-$(RM) $(PREFIX)/lib/libcryptopp.a
|
||||
-$(RM) $(PREFIX)/bin/cryptest.exe
|
||||
ifneq ($(IS_DARWIN),0)
|
||||
-$(RM) $(PREFIX)/lib/libcryptopp.dylib
|
||||
else
|
||||
-$(RM) $(DESTDIR)$(LIBDIR)/libcryptopp.so$(SOLIB_VERSION_SUFFIX)
|
||||
ifeq ($(HAS_SOLIB_VERSION),1)
|
||||
-$(RM) $(DESTDIR)$(LIBDIR)/libcryptopp.so$(SOLIB_COMPAT_SUFFIX)
|
||||
-$(RM) $(DESTDIR)$(LIBDIR)/libcryptopp.so
|
||||
endif
|
||||
-$(RM) $(PREFIX)/lib/libcryptopp.so
|
||||
endif
|
||||
|
||||
libcryptopp.a: $(LIBOBJS)
|
||||
libcryptopp.a: public_service | $(LIBOBJS)
|
||||
$(AR) $(ARFLAGS) $@ $(LIBOBJS)
|
||||
$(RANLIB) $@
|
||||
|
||||
ifeq ($(HAS_SOLIB_VERSION),1)
|
||||
.PHONY: libcryptopp.so
|
||||
libcryptopp.so: libcryptopp.so$(SOLIB_VERSION_SUFFIX)
|
||||
endif
|
||||
libcryptopp.so: public_service | $(LIBOBJS)
|
||||
$(CXX) $(CXXFLAGS) -shared -o $@ $(LIBOBJS) $(LDFLAGS) $(LDLIBS)
|
||||
|
||||
libcryptopp.so$(SOLIB_VERSION_SUFFIX): $(LIBOBJS)
|
||||
$(CXX) -shared $(SOLIB_FLAGS) -o $@ $(CXXFLAGS) -Wl,--exclude-libs,ALL $(LIBOBJS) $(LDFLAGS) $(LDLIBS)
|
||||
ifeq ($(HAS_SOLIB_VERSION),1)
|
||||
-$(LN) libcryptopp.so$(SOLIB_VERSION_SUFFIX) libcryptopp.so
|
||||
-$(LN) libcryptopp.so$(SOLIB_VERSION_SUFFIX) libcryptopp.so$(SOLIB_COMPAT_SUFFIX)
|
||||
endif
|
||||
|
||||
libcryptopp.dylib: $(LIBOBJS)
|
||||
$(CXX) -dynamiclib -o $@ $(CXXFLAGS) -install_name "$@" -current_version "$(LIB_MAJOR).$(LIB_MINOR).$(LIB_PATCH)" -compatibility_version "$(LIB_MAJOR).$(LIB_MINOR)" -headerpad_max_install_names $(LDFLAGS) $(LIBOBJS)
|
||||
|
||||
cryptest.exe: libcryptopp.a $(TESTOBJS)
|
||||
cryptest.exe: public_service | libcryptopp.a $(TESTOBJS)
|
||||
$(CXX) -o $@ $(CXXFLAGS) $(TESTOBJS) ./libcryptopp.a $(LDFLAGS) $(LDLIBS)
|
||||
|
||||
# Used to generate list of source files for Autotools, CMakeList and Android.mk
|
||||
.PHONY: sources
|
||||
sources:
|
||||
$(info Library sources: $(filter-out fipstest.cpp $(TESTSRCS),$(SRCS)))
|
||||
$(info )
|
||||
$(info Test sources: $(TESTSRCS))
|
||||
|
||||
adhoc.cpp: adhoc.cpp.proto
|
||||
ifeq ($(wildcard adhoc.cpp),)
|
||||
cp adhoc.cpp.proto adhoc.cpp
|
||||
@ -266,3 +162,25 @@ endif # Dependencies
|
||||
|
||||
GNUmakefile.deps:
|
||||
$(CXX) $(CXXFLAGS) -MM *.cpp > GNUmakefile.deps
|
||||
|
||||
# Warn of potential configurations issues. This will go away after 5.6.3
|
||||
UNALIGNED_ACCESS := $(shell $(EGREP) -c "^[[:space:]]*//[[:space:]]*\#[[:space:]]*define[[:space:]]*CRYPTOPP_NO_UNALIGNED_DATA_ACCESS" config.h)
|
||||
NO_INIT_PRIORITY := $(shell $(EGREP) -c "^[[:space:]]*//[[:space:]]*\#[[:space:]]*define[[:space:]]*CRYPTOPP_INIT_PRIORITY" config.h)
|
||||
COMPATIBILITY_562 := $(shell $(EGREP) -c "^[[:space:]]*\#[[:space:]]*define[[:space:]]*CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562" config.h)
|
||||
.PHONY: public_service
|
||||
public_service:
|
||||
ifneq ($(UNALIGNED_ACCESS),0)
|
||||
$(info WARNING: CRYPTOPP_NO_UNALIGNED_DATA_ACCESS is not defined in config.h.)
|
||||
endif
|
||||
ifneq ($(NO_INIT_PRIORITY),0)
|
||||
$(info WARNING: CRYPTOPP_INIT_PRIORITY is not defined in config.h.)
|
||||
endif
|
||||
ifneq ($(COMPATIBILITY_562),0)
|
||||
$(info WARNING: CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562 is defined in config.h.)
|
||||
endif
|
||||
ifneq (x$(UNALIGNED_ACCESS)$(NO_INIT_PRIORITY)$(COMPATIBILITY_562),x000)
|
||||
$(info WARNING: You should make these changes in config.h, and not CXXFLAGS.)
|
||||
$(info WARNING: You can 'mv config.recommend config.h', but it breaks versioning.)
|
||||
$(info WARNING: See http://cryptopp.com/wiki/config.h for more details.)
|
||||
$(info )
|
||||
endif
|
||||
|
||||
@ -1,185 +1,169 @@
|
||||
CONTENTS OF THIS FILE
|
||||
---------------------
|
||||
|
||||
* Introduction
|
||||
* Building the Library
|
||||
* Alternate Build Systems
|
||||
* Installing the Library
|
||||
* Makefile Targets
|
||||
* Dynamic Analysis
|
||||
* Acceptance Testing
|
||||
* Reporting problems
|
||||
|
||||
INTRODUCTION
|
||||
------------
|
||||
|
||||
Crypto++ Library is a free C++ class library of cryptographic algorithms and schemes. It was written and placed in public domain by Wei Dai. The library homepage is at http://www.cryptopp.com/. The latest library source code can be found at http://github.com/weidai11/cryptopp. For licensing and copyright information, please see License.txt.
|
||||
|
||||
These are general instructions for the BSDs, Linux, OS X, Solaris and Unix. The library uses a GNU makefile, which combines configuration and a non-anemic make. On BSD and Solaris you will likely have to use `gmake` to build the library. On Linux, OS X and Unix, the system's make should be OK. On Windows, Crypto++ provides Borland and Visual Studio solutions.
|
||||
|
||||
You should look through the GNUmakefile and config.h to ensure settings look reasonable before building. If you need compatibility with Crypto++ 5.6.2, then you can use `config.compat` in place of `config.h`. You are discouraged from using `config.compat` because it re-introduces undefined behavior that was cleared at Crypto++ 5.6.3.
|
||||
|
||||
Wiki pages are available for some platforms with specific build instructions. The wiki can be found at http://cryptopp.com/wiki/. The pages include Android, ARM, iOS and Solaris. Solaris users should visit the wiki for important information on compiling the library with different versions of SunCC and options, and information on improving library performance and features.
|
||||
|
||||
Crypto++ does not depend upon other tools or libraries. It does not use Autotools, does not use CMake, and does not use Boost. If you use an alternate build system, like Autotools or CMake, then see the warning below about CXXFLAGS and lack of -DNDEBUG. CMake is available in Master as a matter of convenience, but its not officially supported.
|
||||
|
||||
|
||||
BUILDING THE LIBRARY
|
||||
--------------------
|
||||
|
||||
In general, all you should have to do is open a terminal, and then:
|
||||
|
||||
make
|
||||
make test
|
||||
sudo make install
|
||||
|
||||
The command above builds the static library and cryptest.exe program. If you want to build the shared object, then issue:
|
||||
|
||||
make static dynamic cryptest.exe
|
||||
|
||||
Or:
|
||||
|
||||
make libcryptopp.a libcryptopp.so cryptest.exe
|
||||
|
||||
|
||||
If you would like to use a different compiler, the set CXX:
|
||||
|
||||
export CXX=/opt/intel/bin/icpc
|
||||
make
|
||||
|
||||
If you want to build using C++11, then:
|
||||
|
||||
make CXXFLAGS="-std=c++11"
|
||||
|
||||
Or:
|
||||
|
||||
CXXFLAGS="-std=c++11"
|
||||
make
|
||||
|
||||
LLVM's libc++ is also supported, so you can:
|
||||
|
||||
CXXFLAGS="-std=c++11 -stdlib=libc++"
|
||||
make
|
||||
|
||||
|
||||
ALTERNATE BUILD SYSTEMS
|
||||
-----------------------
|
||||
|
||||
The Crypto++ library is Make based and uses GNU Make by default. The makefile uses '-DNDEBUG -g2 -O2' CXXFLAGS by default. If you use an alternate build system, like Autotools or CMake, then ensure the build system includes '-DNDEBUG' for production or release builds. The Crypto++ library uses asserts for debugging and diagnostics during development; it does not rely on them to crash a program at runtime.
|
||||
|
||||
If an assert triggers in production software, then unprotected sensitive information could be egressed from the program to the filesystem or the platform's error reporting program, like Apport on Ubuntu or CrashReporter on Apple.
|
||||
|
||||
The makefile orders object files to help remediate problems associated with C++ static initialization order. The library does not use custom linker scripts. If you use an alternate build system, like Autotools or CMake, and collect source files into a list, then ensure these three are at the head of the list: 'cryptlib.cpp cpu.cpp integer.cpp <other sources>'. They should be linked in the same order: 'cryptlib.o cpu.o integer.o <other objects>'.
|
||||
|
||||
If your linker supports initialization attributes, like init_priority, then you can define CRYPTOPP_INIT_PRIORITY to control object initialization order. Set it to a value like 250. User programs can use CRYPTOPP_USER_PRIORITY to avoid conflicts with library values. Initialization attributes are more reliable than object file ordering, but its not ubiquitously supported by linkers.
|
||||
|
||||
The makefile links to the static version of the Crypto++ library to avoid binary planting and other LD_PRELOAD tricks. You should use the static version of the library in your programs to help avoid unwanted redirections.
|
||||
|
||||
INSTALLING THE LIBRARY
|
||||
----------------------
|
||||
|
||||
To install the library into a user selected directory, perform:
|
||||
|
||||
make install PREFIX=/usr/local
|
||||
|
||||
If you are going to run `make install PREFIX=/usr/local`, then you should build with '-DCRYPTOPP_DATA_DIR='\"$PREFIX/share/cryptopp/\"' to ensure cryptest.exe can locate the test data files and test vectors after installation. The trailing slash in the path is needed because simple preprocessor concatenation is used.
|
||||
|
||||
During install, the makefile copies cryptest.exe into $PREFIX/bin, copies headers into $PREFIX/include/cryptopp, and copies libraries into $PREFIX/lib. If you only built a static or dynamic version of the library, then only one library is copied. The install recipe does not fail if the static library or shared object is not built.
|
||||
|
||||
PREFIX is non-standard, but its retained for historical purposes. The makefile also responds to `prefix=<path>`.
|
||||
|
||||
|
||||
MAKEFILE TARGETS
|
||||
----------------
|
||||
|
||||
The following are some of the targets provided by the GNU makefile.
|
||||
|
||||
`make` invokes the default rule, which builds the Crypto++ static library and test harness. They are called `libcryptopp.a` and `cryptest.exe`, respectively. `cryptest.exe` links against `libcryptopp.a`, so the static library is a prerequisite for the target.
|
||||
|
||||
`make libcryptopp.a` and `make static` build the static version of the library.
|
||||
|
||||
`make libcryptopp.so` and `make dynamic` build the dynamic version of the library. On Mac OS X, the recipe builds `libcryptopp.dylib` instead.
|
||||
|
||||
`make cryptest.exe` builds the library test harness.
|
||||
|
||||
`make test` and `make check` are the same recipe and invoke the test harness with the the validation option. That is, it executes `cryptest.exe v`.
|
||||
|
||||
`make install` installs the library. By default, the makefile copies into `/usr/local` by default.
|
||||
|
||||
`make clean` cleans most transient and temporary objects.
|
||||
|
||||
`make disclean` cleans most objects that are not part of the original distribution.
|
||||
|
||||
`make dist` and `make zip` builds ZIP file that is suitable for distribution.
|
||||
|
||||
`make iso` builds an ISO on Linux or OS X that is suitable for alternate distribution.
|
||||
|
||||
`make ubsan` and `make asan` builds the library with the respective sanitizer.
|
||||
|
||||
|
||||
DYNAMIC ANALYSIS
|
||||
----------------
|
||||
|
||||
The Crypto++ embraces tools like Undefined Behavior sanitizer (UBsan), Address sanitizer (Asan) and Valgrind. Both Clang 3.2 and above and GCC 4.8 and above provide sanitizers. Please check with your distribution on how to install the compiler with its sanitizer libraries (they are sometimes a separate install item).
|
||||
|
||||
UBsan and Asan are mutually exclusive options, so you can perform only one of these at a time:
|
||||
|
||||
make ubsan
|
||||
./cryptest.exe v 2>&1 | egrep "(error|FAILED)"
|
||||
./cryptest.exe tv all 2>&1 | egrep "(error|FAILED)"
|
||||
|
||||
Or:
|
||||
|
||||
make asan
|
||||
./cryptest.exe v 2>&1 | egrep "(error|FAILED)"
|
||||
./cryptest.exe tv all 2>&1 | egrep "(error|FAILED)"
|
||||
|
||||
If you experience self test failures or see reports of undefined behavior, then you should ensure CRYPTOPP_NO_UNALIGNED_DATA_ACCESS is defined in config.h. CRYPTOPP_NO_UNALIGNED_DATA_ACCESS is not defined due to historical purposes.
|
||||
|
||||
If you experience failures under Asan, then gather more information with:
|
||||
|
||||
./cryptest.exe v 2>&1 | asan_symbolize
|
||||
|
||||
If you moved Crypto++ such that the paths have changed, then perform:
|
||||
|
||||
./cryptest.exe v 2>&1 | sed "s/<old path>/<new path>/g" | asan_symbolize
|
||||
|
||||
|
||||
ACCEPTANCE TESTING
|
||||
------------------
|
||||
|
||||
Crypto++ uses five security gates in its engineering process. The library must maintain the quality provided by the review system and integrity of the test suites. You can use the information to decide if the Crypto++ library suits your needs and provides a compatible security posture.
|
||||
|
||||
The first gate is code review and discussion of proposed patches. Git commits often cross reference a User Group discussions.
|
||||
|
||||
Second is the compiler warning system. The code must clean compile under the equivalent of GCC's -Wall -Wextra (modulo -Wno-type-limits -Wno-unknown-pragmas). This is a moving target as compiler analysis improves.
|
||||
|
||||
Third, the code must pass cleanly though GCC and Clang's Undefined Behavior sanitizer (UBsan) and Address sanitizer (Asan) with CRYPTOPP_NO_UNALIGNED_DATA_ACCESS defined in config.h. See DYNAMIC ANALYSIS above on how to execute them.
|
||||
|
||||
Fourth, the test harness provides a "validation" option which performs basic system checks (like endianess and word sizes) and exercises algorithms (like AES and SHA). You run the validation suite as shown below. The tail of the output should indicate 0 failed tests.
|
||||
|
||||
./cryptest.exe v
|
||||
...
|
||||
|
||||
All tests passed!
|
||||
Test ended at Sun Jul 26 02:10:57 2015
|
||||
Seed used was: 1437891055
|
||||
|
||||
Fifth, the test harness provides a "test vector" option which uses many known test vectors, even those published by other people (like Brian Gladman for AES). You run the test vectors as shown below. The tail of the output should indicate 0 failed tests.
|
||||
|
||||
./cryptest.exe tv all
|
||||
...
|
||||
|
||||
Testing SymmetricCipher algorithm MARS/ECB.
|
||||
.................
|
||||
Tests complete. Total tests = 4094. Failed tests = 0.
|
||||
|
||||
The library also offers its test script for those who want to use it. The test script is names cryptest.sh, and it repeatedly builds the library and exectues the tests under various configurations. It takes 2 to 4 hours to run on a semi-modern desktop or server; and days to run on an IoT gadget. Also see http://github.com/weidai11/cryptopp/blob/master/cryptest.sh and http://cryptopp.com/wiki/Cryptest.sh.
|
||||
|
||||
|
||||
REPORTING PROBLEMS
|
||||
------------------
|
||||
|
||||
Dirty compiles and failures in the validation suite or test vectors should be reported at the Crypto++ User Group. The User Group is located at http://groups.google.com/forum/#!forum/cryptopp-users.
|
||||
|
||||
Also see http://www.cryptopp.com/wiki/Bug_Report.
|
||||
CONTENTS OF THIS FILE
|
||||
---------------------
|
||||
|
||||
* Introduction
|
||||
* Building the Library
|
||||
* Installing the Library
|
||||
* Makefile Targets
|
||||
* DataDir Patch
|
||||
* Dynamic Analysis
|
||||
* Acceptance Testing
|
||||
* Reporting problems
|
||||
|
||||
INTRODUCTION
|
||||
------------
|
||||
|
||||
Crypto++ Library is a free C++ class library of cryptographic algorithms and schemes. It was written and placed in public domain by Wei Dai. The library homepage is at http://www.cryptopp.com/. The latest library source code can be found at https://github.com/weidai11/cryptopp. For licensing and copyright information, please see License.txt.
|
||||
|
||||
These are general instructions for the BSDs, Linux, OS X, Solaris and Unix. On BSD you will likely have to use `gmake` to build the library. On Linux, OS X, Solaris and Unix, the system's make should be OK. On Windows, Crypto++ provides Borland and Visual Studio solutions.
|
||||
|
||||
Crypto++ uses a GNU makefile, which combines configuration and a non-anemic make. You should look through the GNUmakefile and config.h to ensure settings look reasonable before building. Please pay particular attention to CRYPTOPP_NO_UNALIGNED_DATA_ACCESS in config.h.
|
||||
|
||||
Crypto++ does not depend upon other tools or libraries. It does not use Autotools, does not use Cmake, and does not use Boost.
|
||||
|
||||
|
||||
BUILDING THE LIBRARY
|
||||
--------------------
|
||||
|
||||
In general, all you should have to do is open a terminal, and then:
|
||||
|
||||
make
|
||||
make test
|
||||
sudo make install
|
||||
|
||||
The command above builds the static library and cryptest.exe program. If you want to build the shared object, then issue:
|
||||
|
||||
make static dynamic cryptest.exe
|
||||
|
||||
Or:
|
||||
|
||||
make libcryptopp.a libcryptopp.so cryptest.exe
|
||||
|
||||
|
||||
If you would like to use a different compiler, the set CXX:
|
||||
|
||||
export CXX=/opt/intel/bin/icpc
|
||||
make
|
||||
|
||||
If you want to build using C++11, then:
|
||||
|
||||
make CXXFLAGS="-std=c++11"
|
||||
|
||||
Or:
|
||||
|
||||
CXXFLAGS="-std=c++11"
|
||||
make
|
||||
|
||||
LLVM's libc++ is also supported, so you can:
|
||||
|
||||
CXXFLAGS="-std=c++11 -stdlib=libc++"
|
||||
make
|
||||
|
||||
|
||||
INSTALLING THE LIBRARY
|
||||
----------------------
|
||||
|
||||
To install the library into a user selected directory, perform:
|
||||
|
||||
make install PREFIX=/usr/local
|
||||
|
||||
During install, the makefile copies cryptest.exe into $PREFIX/bin, copies headers into $PREFIX/include/cryptopp, and copies libraries into $PREFIX/lib. If you only built a static or dynamic version of the library, then only one library is copied. The install recipe does not fail if the static library or shared object is not built.
|
||||
|
||||
PREFIX is non-standard, but its retained for historical purposes. The makefile also responds to `prefix=<path>`.
|
||||
|
||||
There are some open issues installing the library because cryptest.exe is not sympathetic to path changes of of its test vectors and test data. See the DataDir patch below to fix it.
|
||||
|
||||
|
||||
MAKEFILE TARGETS
|
||||
----------------
|
||||
|
||||
The following are some of the targets provided by the GNU makefile.
|
||||
|
||||
`make` invokes the default rule, which builds the Crypto++ static library and test harness. They are called `libcryptopp.a` and `cryptest.exe`, respectively. `cryptest.exe` links against `libcryptopp.a`, so the static library is a prerequisite for the target.
|
||||
|
||||
`make libcryptopp.a` and `make static` build the static version of the library.
|
||||
|
||||
`make libcryptopp.so` and `make dynamic` build the dynamic version of the library. On Mac OS X, the recipe builds `libcryptopp.dylib` instead.
|
||||
|
||||
`make cryptest.exe` builds the library test harness.
|
||||
|
||||
`make test` and `make check` are the same recipe and invoke the test harness with the the validation option. That is, it executes `cryptest.exe v`.
|
||||
|
||||
`make install` installs the library. By default, the makefile copies into `/usr`. On OpenBSD, `make install` uses `/usr/local` by default because C++ headers should not be placed with the system headers.
|
||||
|
||||
`make clean` cleans most transient and temporary objects.
|
||||
|
||||
`make disclean` cleans most objects that are not part of the original distribution.
|
||||
|
||||
`make dist` and `make zip` build s ZIP file that is suitable for distribution.
|
||||
|
||||
|
||||
DATADIR PATCH
|
||||
-------------
|
||||
|
||||
The library offers a DataDir patch to help with post-installation issues regarding the location of the test vectors and test data. Its a patch provided by the community, so it must be applied manually. To acquire the patch, see http://www.cryptopp.com/wiki/DataDir.
|
||||
|
||||
|
||||
DYNAMIC ANALYSIS
|
||||
----------------
|
||||
|
||||
The Crypto++ embraces tools like Undefined Behavior sanitizer (UBsan), Address sanitizer (Asan) and Valgrind. Both Clang 3.2 and above and GCC 4.8 and above provide sanitizers. Please check with your distribution on how to install the compiler with its sanitizer libraries (they are sometimes a separate install item).
|
||||
|
||||
UBsan and Asan are mutually exclusive options, so you can perform only one of these at a time:
|
||||
|
||||
make ubsan
|
||||
./cryptest.exe v 2>&1 | egrep "(error|FAILED)"
|
||||
./cryptest.exe tv all 2>&1 | egrep "(error|FAILED)"
|
||||
|
||||
Or:
|
||||
|
||||
make asan
|
||||
./cryptest.exe v 2>&1 | egrep "(error|FAILED)"
|
||||
./cryptest.exe tv all 2>&1 | egrep "(error|FAILED)"
|
||||
|
||||
If you experience self test failures or see reports of undefined behavior, then you should ensure CRYPTOPP_NO_UNALIGNED_DATA_ACCESS is defined in config.h. CRYPTOPP_NO_UNALIGNED_DATA_ACCESS is not defined due to historical purposes.
|
||||
|
||||
If you experience failures under Asan, then gather more information with:
|
||||
|
||||
./cryptest.exe v 2>&1 | asan_symbolize
|
||||
|
||||
If you moved Crypto++ such that the paths have changed, then perform:
|
||||
|
||||
./cryptest.exe v 2>&1 | sed "s/<old path>/<new path>/g" | asan_symbolize
|
||||
|
||||
|
||||
ACCEPTANCE TESTING
|
||||
------------------
|
||||
|
||||
Crypto++ uses five security gates in its engineering process. The library must maintain the quality provided by the review system and integrity of the test suites. You can use the information to decide if the Crypto++ library suits your needs and provides a compatible security posture.
|
||||
|
||||
The first gate is code review and discussion of proposed patches. Git commits often cross reference a User Group discussions.
|
||||
|
||||
Second is the compiler warning system. The code must clean compile under the equivalent of GCC's -Wall -Wextra (modulo -Wno-type-limits -Wno-unknown-pragmas). This is a moving target as compiler analysis improves.
|
||||
|
||||
Third, the code must pass cleanly though GCC and Clang's Undefined Behavior sanitizer (UBsan) and Address sanitizer (Asan) with CRYPTOPP_NO_UNALIGNED_DATA_ACCESS defined in config.h. See DYNAMIC ANALYSIS above on how to execute them.
|
||||
|
||||
Fourth, the test harness provides a "validation" option which performs basic system checks (like endianess and word sizes) and exercises algorithms (like AES and SHA). You run the validation suite as shown below. The tail of the output should indicate 0 failed tests.
|
||||
|
||||
./cryptest.exe v
|
||||
...
|
||||
|
||||
All tests passed!
|
||||
Test ended at Sun Jul 26 02:10:57 2015
|
||||
Seed used was: 1437891055
|
||||
|
||||
Fifth, the test harness provides a "test vector" option which uses many known test vectors, even those published by other people (like Brian Gladman for AES). You run the test vectors as shown below. The tail of the output should indicate 0 failed tests.
|
||||
|
||||
./cryptest.exe tv all
|
||||
...
|
||||
|
||||
Testing SymmetricCipher algorithm MARS/ECB.
|
||||
.................
|
||||
Tests complete. Total tests = 4094. Failed tests = 0.
|
||||
|
||||
REPORTING PROBLEMS
|
||||
------------------
|
||||
|
||||
Dirty compiles and failures in the validation suite or test vectors should be reported at the Crypto++ User Group. The User Group is located at https://groups.google.com/forum/#!forum/cryptopp-users.
|
||||
|
||||
Also see http://www.cryptopp.com/wiki/Bug_Report.
|
||||
|
||||
@ -1,51 +1,51 @@
|
||||
Compilation Copyright (c) 1995-2016 by Wei Dai. All rights reserved.
|
||||
This copyright applies only to this software distribution package
|
||||
as a compilation, and does not imply a copyright on any particular
|
||||
file in the package.
|
||||
|
||||
All individual files in this compilation are placed in the public domain by
|
||||
Wei Dai and other contributors.
|
||||
|
||||
I would like to thank the following authors for placing their works into
|
||||
the public domain:
|
||||
|
||||
Joan Daemen - 3way.cpp
|
||||
Leonard Janke - cast.cpp, seal.cpp
|
||||
Steve Reid - cast.cpp
|
||||
Phil Karn - des.cpp
|
||||
Andrew M. Kuchling - md2.cpp, md4.cpp
|
||||
Colin Plumb - md5.cpp
|
||||
Seal Woods - rc6.cpp
|
||||
Chris Morgan - rijndael.cpp
|
||||
Paulo Baretto - rijndael.cpp, skipjack.cpp, square.cpp
|
||||
Richard De Moliner - safer.cpp
|
||||
Matthew Skala - twofish.cpp
|
||||
Kevin Springle - camellia.cpp, shacal2.cpp, ttmac.cpp, whrlpool.cpp, ripemd.cpp
|
||||
Ronny Van Keer - sha3.cpp
|
||||
|
||||
The Crypto++ Library (as a compilation) is currently licensed under the Boost
|
||||
Software License 1.0 (http://www.boost.org/users/license.html).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
Permission is hereby granted, free of charge, to any person or organization
|
||||
obtaining a copy of the software and accompanying documentation covered by
|
||||
this license (the "Software") to use, reproduce, display, distribute,
|
||||
execute, and transmit the Software, and to prepare derivative works of the
|
||||
Software, and to permit third-parties to whom the Software is furnished to
|
||||
do so, all subject to the following:
|
||||
|
||||
The copyright notices in the Software and this entire statement, including
|
||||
the above license grant, this restriction and the following disclaimer,
|
||||
must be included in all copies of the Software, in whole or in part, and
|
||||
all derivative works of the Software, unless such copies or derivative
|
||||
works are solely in the form of machine-executable object code generated by
|
||||
a source language processor.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
Compilation Copyright (c) 1995-2013 by Wei Dai. All rights reserved.
|
||||
This copyright applies only to this software distribution package
|
||||
as a compilation, and does not imply a copyright on any particular
|
||||
file in the package.
|
||||
|
||||
All individual files in this compilation are placed in the public domain by
|
||||
Wei Dai and other contributors.
|
||||
|
||||
I would like to thank the following authors for placing their works into
|
||||
the public domain:
|
||||
|
||||
Joan Daemen - 3way.cpp
|
||||
Leonard Janke - cast.cpp, seal.cpp
|
||||
Steve Reid - cast.cpp
|
||||
Phil Karn - des.cpp
|
||||
Andrew M. Kuchling - md2.cpp, md4.cpp
|
||||
Colin Plumb - md5.cpp
|
||||
Seal Woods - rc6.cpp
|
||||
Chris Morgan - rijndael.cpp
|
||||
Paulo Baretto - rijndael.cpp, skipjack.cpp, square.cpp
|
||||
Richard De Moliner - safer.cpp
|
||||
Matthew Skala - twofish.cpp
|
||||
Kevin Springle - camellia.cpp, shacal2.cpp, ttmac.cpp, whrlpool.cpp, ripemd.cpp
|
||||
Ronny Van Keer - sha3.cpp
|
||||
|
||||
The Crypto++ Library (as a compilation) is currently licensed under the Boost
|
||||
Software License 1.0 (http://www.boost.org/users/license.html).
|
||||
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
Permission is hereby granted, free of charge, to any person or organization
|
||||
obtaining a copy of the software and accompanying documentation covered by
|
||||
this license (the "Software") to use, reproduce, display, distribute,
|
||||
execute, and transmit the Software, and to prepare derivative works of the
|
||||
Software, and to permit third-parties to whom the Software is furnished to
|
||||
do so, all subject to the following:
|
||||
|
||||
The copyright notices in the Software and this entire statement, including
|
||||
the above license grant, this restriction and the following disclaimer,
|
||||
must be included in all copies of the Software, in whole or in part, and
|
||||
all derivative works of the Software, unless such copies or derivative
|
||||
works are solely in the form of machine-executable object code generated by
|
||||
a source language processor.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
File diff suppressed because it is too large
Load Diff
3
Common/3dParty/cryptopp/TestData/3desval.dat
Normal file
3
Common/3dParty/cryptopp/TestData/3desval.dat
Normal file
@ -0,0 +1,3 @@
|
||||
0123456789abcdeffedcba9876543210 0123456789abcde7 7f1d0a77826b8aff
|
||||
0123456789abcdeffedcba987654321089abcdef01234567 0123456789abcde7 de0b7c06ae5e0ed5
|
||||
0123456789ABCDEF01010101010101011011121314151617 94DBE082549A14EF 9011121314151617
|
||||
5
Common/3dParty/cryptopp/TestData/3wayval.dat
Normal file
5
Common/3dParty/cryptopp/TestData/3wayval.dat
Normal file
@ -0,0 +1,5 @@
|
||||
000000000000000000000000 000000010000000100000001 4059c76e83ae9dc4ad21ecf7
|
||||
000000060000000500000004 000000030000000200000001 d2f05b5ed6144138cab920cd
|
||||
def01234456789abbcdef012 234567899abcdef001234567 0aa55dbb9cdddb6d7cdb76b2
|
||||
d2f05b5ed6144138cab920cd 4059c76e83ae9dc4ad21ecf7 478ea8716b13f17c15b155ed
|
||||
|
||||
45
Common/3dParty/cryptopp/TestData/camellia.dat
Normal file
45
Common/3dParty/cryptopp/TestData/camellia.dat
Normal file
@ -0,0 +1,45 @@
|
||||
0123456789ABCDEFFEDCBA9876543210 0123456789ABCDEFFEDCBA9876543210 67673138549669730857065648EABE43
|
||||
80000000000000000000000000000000 00000000000000000000000000000000 6C227F749319A3AA7DA235A9BBA05A2C
|
||||
00000000000000000000000000000001 00000000000000000000000000000000 41E0E6DC2DDEC65D8B8120E60977B82D
|
||||
00000000000000000000000000000000 80000000000000000000000000000000 07923A39EB0A817D1C4D87BDB82D1F1C
|
||||
00000000000000000000000000000000 00000000000000000000000000000001 F5574ACC3148DFCB9015200631024DF9
|
||||
00000000000000000000000000000000 00000000000000000000000000000000 3D028025B156327C17F762C1F2CBCA71
|
||||
01010101010101010101010101010101 01010101010101010101010101010101 637084CB1120D6F25DB618893040AA27
|
||||
02020202020202020202020202020202 02020202020202020202020202020202 612834AAC9EF906BAEAA076E1C75179D
|
||||
04040404040404040404040404040404 04040404040404040404040404040404 B24FAF8A579E4EFE986571FB2F68B5B4
|
||||
08080808080808080808080808080808 08080808080808080808080808080808 3E5CAFBB70545AABB1109293A1C44C14
|
||||
10101010101010101010101010101010 10101010101010101010101010101010 E1FA5FD3F40B766BBE3DF469AF41B420
|
||||
20202020202020202020202020202020 20202020202020202020202020202020 7E724027BB2F591C63254D936FCC4B43
|
||||
40404040404040404040404040404040 40404040404040404040404040404040 538ADCBE104A3483B3C2A3D8CE72FBD6
|
||||
80808080808080808080808080808080 80808080808080808080808080808080 AA7627F70F6B54C217C3EF232D362459
|
||||
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF 25DD9EB9DD67FBC6E8431F56F4FBE651
|
||||
0123456789ABCDEFFEDCBA98765432100011223344556677 0123456789ABCDEFFEDCBA9876543210 B4993401B3E996F84EE5CEE7D79B09B9
|
||||
800000000000000000000000000000000000000000000000 00000000000000000000000000000000 1B6220D365C2176C1D41A5826520FCA1
|
||||
000000000000000000000000000000000000000000000001 00000000000000000000000000000000 E37577F71E0E643C4D3F55219ABA1394
|
||||
000000000000000000000000000000000000000000000000 80000000000000000000000000000000 3EB6CC5618EFC98455B5992050D474E7
|
||||
000000000000000000000000000000000000000000000000 00000000000000000000000000000001 BA9AE89FDDCE4B51131E17C4D65CE587
|
||||
000000000000000000000000000000000000000000000000 00000000000000000000000000000000 56E1E129CA5C02C7F9AC6AFDEF86ADC3
|
||||
010101010101010101010101010101010101010101010101 01010101010101010101010101010101 8F764397C10BE84BA876CEEFA4225BFF
|
||||
020202020202020202020202020202020202020202020202 02020202020202020202020202020202 60B00674BFD444D07B5A19851E6151CD
|
||||
040404040404040404040404040404040404040404040404 04040404040404040404040404040404 81B26FF4F6B4377CC555873504B3A38B
|
||||
080808080808080808080808080808080808080808080808 08080808080808080808080808080808 A2AA1C6693DC2B70D75C9B39B9B214D0
|
||||
101010101010101010101010101010101010101010101010 10101010101010101010101010101010 A907BFDAEEF8C81D05855235E8D3BE08
|
||||
202020202020202020202020202020202020202020202020 20202020202020202020202020202020 87F8EA30332036F17CEAC0097CE33BC1
|
||||
404040404040404040404040404040404040404040404040 40404040404040404040404040404040 A2C32EA499E41A248565253BACC11E3B
|
||||
808080808080808080808080808080808080808080808080 80808080808080808080808080808080 F602BA7F515B082983B8F7A27F92408F
|
||||
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF 3F8D5676F51CE23DC3BDB627F8B3883E
|
||||
0123456789ABCDEFFEDCBA987654321000112233445566778899AABBCCDDEEFF 0123456789ABCDEFFEDCBA9876543210 9ACC237DFF16D76C20EF7C919E3A7509
|
||||
8000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000 2136FABDA091DFB5171B94B8EFBB5D08
|
||||
0000000000000000000000000000000000000000000000000000000000000001 00000000000000000000000000000000 AFCD38B195E0A736304E89B9AE3019D3
|
||||
0000000000000000000000000000000000000000000000000000000000000000 80000000000000000000000000000000 B0C6B88AEA518AB09E847248E91B1B9D
|
||||
0000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000001 9CDB269B5D293BC5DB9C55B057D9B591
|
||||
0000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000 396154111ADEFC500CF6E5C99038BC17
|
||||
0101010101010101010101010101010101010101010101010101010101010101 01010101010101010101010101010101 438D0C2E7E86869B56EBA23B66086A01
|
||||
0202020202020202020202020202020202020202020202020202020202020202 02020202020202020202020202020202 D4F553BFA794F55EF3B7A578629F6DEA
|
||||
0404040404040404040404040404040404040404040404040404040404040404 04040404040404040404040404040404 5E858730ABC9823A93CA4CAB67F0B423
|
||||
0808080808080808080808080808080808080808080808080808080808080808 08080808080808080808080808080808 F9A9C1540AE1B314DBEDF9A49054DC9D
|
||||
1010101010101010101010101010101010101010101010101010101010101010 10101010101010101010101010101010 6693FC130669F194F81E8D175194DDA2
|
||||
2020202020202020202020202020202020202020202020202020202020202020 20202020202020202020202020202020 F3E1FDA6B9C8314799F4654C29F1C690
|
||||
4040404040404040404040404040404040404040404040404040404040404040 40404040404040404040404040404040 4A30476F1141FBF303ED63FCD3CB0536
|
||||
8080808080808080808080808080808080808080808080808080808080808080 80808080808080808080808080808080 0C765AA494E048FC8BB23139F2124CB6
|
||||
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF 4F05F28CA23EEAE205B67B1C95CD5280
|
||||
11
Common/3dParty/cryptopp/TestData/cast128v.dat
Normal file
11
Common/3dParty/cryptopp/TestData/cast128v.dat
Normal file
@ -0,0 +1,11 @@
|
||||
01 23 45 67 12 34 56 78 23 45 67 89 34 56 78 9A
|
||||
01 23 45 67 89 AB CD EF
|
||||
23 8B 4F E5 84 7E 44 B2
|
||||
|
||||
01 23 45 67 12 34 56 78 23 45
|
||||
01 23 45 67 89 AB CD EF
|
||||
EB 6A 71 1A 2C 02 27 1B
|
||||
|
||||
01 23 45 67 12
|
||||
01 23 45 67 89 AB CD EF
|
||||
7A C8 16 D1 6E 9B 30 2E
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user