#!/bin/sh
-# $Id: postbuild.sh 646121 2022-03-02 16:57:04Z ucko $
+# $Id: postbuild.sh 676732 2023-12-21 15:55:08Z sadyrovr $
# ===========================================================================
#
# PUBLIC DOMAIN NOTICE
fi
done
product=$TARGET_BUILD_DIR/$FULL_PRODUCT_NAME
-vdbdlib="${NCBI_VDB_LIBPATH}/vdb/vdb-versions/cxx_toolkit/3/mac/release/x86_64/lib/libncbi-vdb.3.dylib"
+arch=`lipo -archs $product`
+vdbdlib="${NCBI_VDB_LIBPATH}/vdb/vdb-versions/cxx_toolkit/3/mac/release/$arch/lib/libncbi-vdb.3.dylib"
if test "$ACTION" = "build"; then
if test "$MACH_O_TYPE" = "mh_execute" -o "$MACH_O_TYPE" = "mh_dylib"; then
vdb=`otool -L $product | grep libncbi-vdb | grep dylib`
if test -n "$vdb"; then
ref=`echo $vdb | awk 'NR==1{print $1}'`
- install_name_tool -change $ref $vdbdlib $product
+ install_name_tool -change $ref "$vdbdlib" $product
fi
fi
fi
-/* $Id: blast_dbindex.hpp 575325 2018-11-27 18:22:00Z ucko $
+/* $Id: blast_dbindex.hpp 683528 2024-05-30 12:54:11Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
NCBI_XBLAST_EXPORT
std::string DbIndexInit(
- const string & indexname, bool old_style, bool & partial );
+ const string & indexname, bool old_style, bool & partial, const int word_size);
NCBI_XBLAST_EXPORT
void SetUpDbIndexCallbacks( void );
NCBI_XBLAST_EXPORT
void ClearDbIndexCallbacks( void );
-/** Get minimal word size accepted by indexing library.
-*/
NCBI_XBLAST_EXPORT
int MinIndexWordSize();
-/* $Id: blast_exception.hpp 575325 2018-11-27 18:22:00Z ucko $
+/* $Id: blast_exception.hpp 683531 2024-05-30 12:54:42Z ivanov $
* ===========================================================================
*
* public DOMAIN NOTICE
eSeqSrcInit, ///< Initialization error in BlastSeqSrc
/// implementation
eRpsInit, ///< Error while initializing RPS-BLAST
- eSetup ///< Error while setting up BLAST
+ eSetup, ///< Error while setting up BLAST
+ eSystem ///< System exception
};
/// Translate from the error code value to its string representation
case eInvalidCharacter: return "eInvalidCharacter";
case eSeqSrcInit: return "eSeqSrcInit";
case eRpsInit: return "eRpsInit";
+ case eSystem: return "eSystem";
default: return CException::GetErrCodeString();
}
}
-/* $Id: blast_node.hpp 628367 2021-03-30 12:39:19Z fongah2 $
+/* $Id: blast_node.hpp 683928 2024-06-10 12:07:11Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
return rv;
}
void UnreadMsg(CRef<CBlastNodeMsg> msg) { CFastMutexGuard guard(m_Mutex); m_MsgQueue.push_front(msg);}
- int GetNumMsgs () { CFastMutexGuard guard(m_Mutex); return m_MsgQueue.size(); }
+ int GetNumMsgs () { CFastMutexGuard guard(m_Mutex); return static_cast<int>(m_MsgQueue.size()); }
int GetNodeNum() { return m_NodeNum; }
~CBlastNodeMailbox() { m_MsgQueue.resize(0); }
private:
typedef map<int, double> TActiveNodes;
typedef map<int, CRef<CBlastNodeMsg> > TFormatQueue;
void RegisterNode(CBlastNode * node, CBlastNodeMailbox * mailbox);
- int GetNumNodes() { return m_RegisteredNodes.size();}
+ int GetNumNodes() { return static_cast<int>(m_RegisteredNodes.size());}
int IsFull();
void Shutdown() { m_MaxNumNodes = -1; }
bool Processing();
#ifndef ALGO_BLAST_API__CDD_PSSM_INPUT__HPP
#define ALGO_BLAST_API__CDD_PSSM_INPUT__HPP
-/* $Id: cdd_pssm_input.hpp 389681 2013-02-20 13:16:20Z kornbluh $
+/* $Id: cdd_pssm_input.hpp 683928 2024-06-10 12:07:11Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
/// Get query length
/// @return Query length
///
- unsigned int GetQueryLength(void) {return m_QueryData.size();}
+ unsigned int GetQueryLength(void) {return static_cast<unsigned int>(m_QueryData.size());}
/// Get scoring matrix name
/// @return Scoring matrix name
-/* $Id: blast_args.hpp 673577 2023-10-04 13:18:08Z ivanov $
+/* $Id: blast_args.hpp 683928 2024-06-10 12:07:11Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
m_DfltNumAlignments = m_DfltNumDescriptions = 10;
} else {
m_DfltNumAlignments = static_cast<ncbi::TSeqPos>(align_format::kDfltArgNumAlignments) ;
- m_DfltNumDescriptions = align_format::kDfltArgNumDescriptions;
+ m_DfltNumDescriptions = static_cast<TSeqPos>(align_format::kDfltArgNumDescriptions);
}
};
-/* $Id: blast_message.h 673573 2023-10-04 13:17:42Z ivanov $
+/* $Id: blast_message.h 683531 2024-05-30 12:54:42Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
/** Blast seqsrc returns BLAST_SEQSRC_ERROR */
#define BLASTERR_SEQSRC 300
+/** Database file error */
+#define BLASTERR_DB_MEMORY_MAP 400
+#define BLASTERR_DB_OPEN_FILES 401
+
#ifdef __cplusplus
}
-/* $Id: blast_options.h 662804 2023-02-07 13:36:00Z fongah2 $
+/* $Id: blast_options.h 683527 2024-05-30 12:54:02Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
#define BLAST_WORD_THRESHOLD_BLASTP 11 /**< default neighboring threshold
(blastp and for rpsblast at RPS-BLAST
database creation time) */
-#define BLAST_WORD_THRESHOLD_BLASTP_FAST 19.3 //neighboring threshold for word size 5 (blastp/x-fast)
+#define BLAST_WORD_THRESHOLD_BLASTP_FAST 20 //neighboring threshold for word size 5 (blastp/x-fast)
#define BLAST_WORD_THRESHOLD_BLASTP_WD_SZ_6 21 //neighboring threshold for word size 6
#define BLAST_WORD_THRESHOLD_BLASTP_WD_SZ_7 20.25 //neighboring threshold for word size 7
-/* $Id: dbindex.hpp 575325 2018-11-27 18:22:00Z ucko $
+/* $Id: dbindex.hpp 683928 2024-06-10 12:07:11Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
TSeqNum start = MapSubject( subj, 0 );
TSeqNum end = MapSubject( subj + 1, 0 );
- if( end == 0 ) end = start_ + results_.size() + 1;
+ if( end == 0 ) end = start_ + static_cast<TSeqNum>(results_.size()) + 1;
for( TSeqNum chunk = start; chunk < end; ++chunk ) {
if( GetResults( chunk ) != 0 ) {
/** Get the number of logical sequences in the results set.
@return number of sequences in the result set
*/
- TSeqNum NumSeq() const { return results_.size(); }
+ TSeqNum NumSeq() const { return static_cast<TSeqNum>(results_.size()); }
private:
@return number of chunks in the map
*/
TSeqNum NumSubjects() const
- { return 1 + (lid_map_.size()>>2); }
+ { return static_cast<TSeqNum>(1 + (lid_map_.size()>>2)); }
/** Get the length of the subject sequence.
if( t.first < subjects_.size() - 1 ) {
TSeqNum nc = subjects_[t.first + 1] - subjects_[t.first];
- return (t.second == nc - 1) ? max_chunk_size_ :
+ return (t.second == nc - 1) ? static_cast<TWord>(max_chunk_size_) :
getSubjectLength( t.first )%(
- max_chunk_size_ - chunk_overlap_ );
+ static_cast<TWord>(max_chunk_size_ - chunk_overlap_ ));
}
- else return max_chunk_size_;
+ else return static_cast<TWord>(max_chunk_size_);
}
else {
- return getSubjectLength( subjects_.size() - 2 )%(
- max_chunk_size_ - chunk_overlap_ );
+ return static_cast<TWord>( getSubjectLength( static_cast<TSeqNum>(subjects_.size() - 2) )%(
+ max_chunk_size_ - chunk_overlap_ ) );
}
}
{
ASSERT( sid < subjects_.size() - 1 );
ASSERT( subjects_[sid] - 1 + rcid < chunks_.size() );
- TSeqPos res = rcid*(max_chunk_size_ - chunk_overlap_) + coff;
+ TSeqPos res = static_cast<TSeqPos>(rcid*(max_chunk_size_ - chunk_overlap_) + coff);
ASSERT( res < lengths_[sid] );
return res;
}
- TSeqNum getNumSubjects() const { return subjects_.size() - 1; }
- TSeqNum getNumChunks() const { return chunks_.size(); }
+ TSeqNum getNumSubjects() const { return static_cast<TSeqNum>(subjects_.size() - 1); }
+ TSeqNum getNumChunks() const { return static_cast<TSeqNum>(chunks_.size()); }
TSeqNum getNumChunks( TSeqNum sid ) const
{
if( sid < subjects_.size() - 2 ) {
return subjects_[sid + 1] - subjects_[sid];
}
- else return chunks_.size() + 1 - subjects_[sid];
+ else return static_cast<TSeqNum>( chunks_.size() + 1 - subjects_[sid]);
}
const Uint1 * getSeqData( TSeqNum sid ) const
-/* $Id: data4xmlformat.hpp 393164 2013-03-22 13:39:25Z fongah2 $
+/* $Id: data4xmlformat.hpp 683928 2024-06-10 12:07:11Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
CBlastFormattingMatrix* GetMatrix(void) const;
/// @inheritDoc
- unsigned int GetNumQueries(void) const { return m_Queries->Size(); }
+ unsigned int GetNumQueries(void) const { return static_cast<unsigned int>(m_Queries->Size()); }
/// @inheritDoc
const TMaskedQueryRegions*
-/* $Id: mhfile.hpp 621855 2020-12-17 15:26:40Z grichenk $
+/* $Id: mhfile.hpp 683928 2024-06-10 12:07:11Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
void GetMinHits(int oid, int& subjectOid, vector<uint32_t>& hits) const;
/// Returns the number of hash arrays.
- int GetNumSignatures() const {return (m_DataFileSize/(GetDataWidth()*GetNumHashes()+4));}
+ int GetNumSignatures() const {return static_cast<int>(m_DataFileSize/(GetDataWidth()*GetNumHashes()+4));}
private:
-/* $Id: blastn_vdb_args.hpp 640787 2021-11-18 13:03:23Z fongah2 $
+/* $Id: blastn_vdb_args.hpp 676153 2023-12-11 14:53:51Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
BEGIN_SCOPE(blast)
extern const string kArgSRASearchMode;
+extern const string kArgIncludeFilteredReads;
/// Argument class to collect database/subject arguments
class CBlastVDatabaseArgs : public CBlastDatabaseArgs
#ifndef ALGO_BLAST_VDB___SEQSRC_VDB__H
#define ALGO_BLAST_VDB___SEQSRC_VDB__H
-/* $Id: seqsrc_vdb.h 640787 2021-11-18 13:03:23Z fongah2 $
+/* $Id: seqsrc_vdb.h 676153 2023-12-11 14:53:51Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
BlastSeqSrc*
SRABlastSeqSrcInit(const char** sraRunAccessions, Uint4 numRuns,
Boolean isProtein, Boolean* excluded_runs, Uint4 * status,
- Boolean isCSRA);
+ Boolean isCSRA, Boolean include_filtered_reads);
// ==========================================================================//
#ifndef ALGO_BLAST_VDB___VDB2BLAST_UTIL__HPP
#define ALGO_BLAST_VDB___VDB2BLAST_UTIL__HPP
-/* $Id: vdb2blast_util.hpp 640787 2021-11-18 13:03:23Z fongah2 $
+/* $Id: vdb2blast_util.hpp 676153 2023-12-11 14:53:51Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
/// @throws CException
CVDBBlastUtil(const string& strAllRuns,
bool bOwnSeqSrc = false,
- bool bCSRA = false);
+ bool bCSRA = false,
+ bool bIncludeFilteredReads = false);
/// Destructor
virtual ~CVDBBlastUtil();
/// Pointer to a properly initialized SRA BlastSeqSrc.
BlastSeqSrc* m_seqSrc;
bool m_isCSRAUtil;
+ bool m_IncludeFilteredReads;
+
};
-/* $Id: vdbblast_local.hpp 640787 2021-11-18 13:03:23Z fongah2 $
+/* $Id: vdbblast_local.hpp 676153 2023-12-11 14:53:51Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
vector<vector<string> > & m_chunks_for_thread;
unsigned int m_num_threads;
Int4 m_num_extensions;
+ bool m_include_filtered_reads;
CRef<objects::CPssmWithParameters> m_pssm;
public:
*/
CLocalVDBBlast(CRef<CBlastQueryVector> query_vector,
CRef<CBlastOptionsHandle> options,
- CLocalVDBBlast::SLocalVDBStruct & local_vdb);
+ CLocalVDBBlast::SLocalVDBStruct & local_vdb,
+ bool include_filtered_reads = false);
CLocalVDBBlast(CRef<objects::CPssmWithParameters> pssm,
CRef<CBlastOptionsHandle> options,
- SLocalVDBStruct & local_vdb);
+ SLocalVDBStruct & local_vdb,
+ bool include_filtered_reads = false);
/*
* Run Local VDB Search
--- /dev/null
+#ifndef CGI___CAF_ENCODED__HPP
+#define CGI___CAF_ENCODED__HPP
+
+/* $Id: caf_encoded.hpp 667390 2023-05-15 16:18:37Z lavr $
+* ===========================================================================
+*
+* PUBLIC DOMAIN NOTICE
+* National Center for Biotechnology Information
+*
+* This software/database is a "United States Government Work" under the
+* terms of the United States Copyright Act. It was written as part of
+* the author's official duties as a United States Government employee and
+* thus cannot be copyrighted. This software/database is freely available
+* to the public for use. The National Library of Medicine and the U.S.
+* Government have not placed any restriction on its use or reproduction.
+*
+* Although all reasonable efforts have been taken to ensure the accuracy
+* and reliability of the software and data, the NLM and the U.S.
+* Government do not and cannot warrant the performance or results that
+* may be obtained by using this software or data. The NLM and the U.S.
+* Government disclaim all warranties, express or implied, including
+* warranties of performance, merchantability or fitness for any particular
+* purpose.
+*
+* Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+* Author: Anton Lavrentiev
+*
+* File Description:
+* Forward header for encrypted implementation of cookie affinity interface
+*
+*/
+
+#error "Please use <cppcore/connext2/caf_encoded.hpp>"
+
+#endif /* CGI___CAF_ENCODED__HPP */
--- /dev/null
+#ifndef CGI___CAF_PLAIN__HPP
+#define CGI___CAF_PLAIN__HPP
+
+/* $Id: caf_plain.hpp 666534 2023-04-27 03:54:21Z lavr $
+* ===========================================================================
+*
+* PUBLIC DOMAIN NOTICE
+* National Center for Biotechnology Information
+*
+* This software/database is a "United States Government Work" under the
+* terms of the United States Copyright Act. It was written as part of
+* the author's official duties as a United States Government employee and
+* thus cannot be copyrighted. This software/database is freely available
+* to the public for use. The National Library of Medicine and the U.S.
+* Government have not placed any restriction on its use or reproduction.
+*
+* Although all reasonable efforts have been taken to ensure the accuracy
+* and reliability of the software and data, the NLM and the U.S.
+* Government do not and cannot warrant the performance or results that
+* may be obtained by using this software or data. The NLM and the U.S.
+* Government disclaim all warranties, express or implied, including
+* warranties of performance, merchantability or fitness for any particular
+* purpose.
+*
+* Please cite the author in any work or product based on this material.
+*
+* ===========================================================================
+*
+* Author: Anatoliy Kuznetsov
+*
+* File Description:
+* Non-encoded implementation of cookie affinity interface
+*
+*/
+
+#include <caf.hpp>
+#include <connect/ext/ncbi_ifconf.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+/** @addtogroup CookieAffinity
+ *
+ * @{
+ */
+
+
+BEGIN_NCBI_SCOPE
+
+
+///////////////////////////////////////////////////////
+//
+// CCookieAffinity_Plain::
+//
+// Cookie affinity service interface implementation with no encoding
+//
+
+class CCookieAffinity_Plain : public CCookieAffinity
+{
+public:
+ // Return copy of the "str", or 0 if failed.
+ // The returned string is to be free()'d by the caller.
+ virtual char* Encode(const char* str, const char* key);
+
+ // Return IP address of the current host, or 0 if failed.
+ virtual char* GetHostIP(char* buf, size_t bufsize);
+};
+
+
+/* @} */
+
+
+/////////////////////////////////////////////////////////////////////////////
+// IMPLEMENTATION of INLINE functions
+/////////////////////////////////////////////////////////////////////////////
+
+
+inline char* CCookieAffinity_Plain::Encode(const char* str,
+ const char* /*key*/)
+{
+ size_t len = ::strlen(str);
+ if ( !len )
+ return 0;
+ char* buf = (char*) ::malloc(len + 1);
+ ::strcpy(buf, str);
+ return buf;
+}
+
+
+inline char* CCookieAffinity_Plain::GetHostIP(char* buf, size_t bufsize)
+{
+ return NcbiGetHostIP(buf, bufsize);
+}
+
+
+END_NCBI_SCOPE
+
+#endif /* CGI___CAF_PLAIN__HPP */
#ifndef CGI___CGI_EXCEPTION__HPP
#define CGI___CGI_EXCEPTION__HPP
-/* $Id: cgi_exception.hpp 597641 2019-11-25 18:03:55Z grichenk $
+/* $Id: cgi_exception.hpp 674534 2023-10-30 13:23:30Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
e416_RangeNotSatisfiable = CRequestStatus::e416_RangeNotSatisfiable,
e417_ExpectationFailed = CRequestStatus::e417_ExpectationFailed,
e422_UnprocessableEntity = CRequestStatus::e422_UnprocessableEntity,
+ e451_Unavailable_For_Legal_Reasons = CRequestStatus::e451_Unavailable_For_Legal_Reasons,
e500_InternalServerError = CRequestStatus::e500_InternalServerError,
e501_NotImplemented = CRequestStatus::e501_NotImplemented,
#ifndef COMMON___NCBI_EXPORT__H
#define COMMON___NCBI_EXPORT__H
-/* $Id: ncbi_export.h 640788 2021-11-18 13:03:30Z fongah2 $
+/* $Id: ncbi_export.h 680756 2024-03-27 13:49:07Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
# define NCBI_XOBJWRITE_EXPORTS
# define NCBI_XOBJUTIL_EXPORTS
# define NCBI_XOBJMANIP_EXPORTS
+# define NCBI_XHUGEASN_EXPORTS
#endif
# define NCBI_SEQEDIT_EXPORT NCBI_DLL_IMPORT
#endif
+/* Export specifier for library xhugeasn
+ * */
+#ifdef NCBI_XHUGEASN_EXPORTS
+# define NCBI_XHUGEASN_EXPORT NCBI_DLL_EXPORT
+#else
+# define NCBI_XHUGEASN_EXPORT NCBI_DLL_IMPORT
+#endif
+
/* Export specifier for library seqtest
*/
#ifdef NCBI_SEQTEST_EXPORTS
#define NCBI_PACKAGE 1
#define NCBI_PACKAGE_NAME "blast"
#define NCBI_PACKAGE_VERSION_MAJOR 2
-#define NCBI_PACKAGE_VERSION_MINOR 15
+#define NCBI_PACKAGE_VERSION_MINOR 16
#define NCBI_PACKAGE_VERSION_PATCH 0
#define NCBI_PACKAGE_CONFIG ""
-/* $Id: ncbi_source_ver.h 668465 2023-06-06 04:03:02Z syncbot $
+/* $Id: ncbi_source_ver.h 676126 2023-12-09 05:03:05Z syncbot $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
#include <ncbiconf.h>
#include <common/ncbi_build_info.h>
-/* #undef NCBI_PRODUCTION_VER */
+#define NCBI_PRODUCTION_VER 20231209
#define NCBI_DEVELOPMENT_VER 20230606
#if defined(NCBI_PRODUCTION_VER)
#ifndef CONNECT__IMPL__SOCKET_ADDRESS__HPP
#define CONNECT__IMPL__SOCKET_ADDRESS__HPP
-/* $Id: connect_misc.hpp 656696 2022-09-26 19:38:16Z sadyrovr $
+/* $Id: connect_misc.hpp 675422 2023-11-21 19:49:15Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
struct NCBI_XCONNECT_EXPORT SHost
{
+ enum class EName { eResolved, eOriginal };
+
+ std::optional<string> name;
unsigned host;
+
SHost(unsigned h) : host(h) {}
- SHost(const string& h);
+ SHost(const string& h, EName n = EName::eResolved);
};
struct SPort
SPort(CTempString p) : port(NStr::StringToNumeric<unsigned short>(p)) {}
};
- SSocketAddress(SHost h, SPort p) : host(h.host), port(p.port) {}
+ SSocketAddress(SHost h, SPort p) : host(h.host), port(p.port), m_Name(h.name) {}
explicit operator bool() const { return host && port; }
string GetHostName() const;
string AsString() const { return GetHostName() + ':' + NStr::UIntToString(port); }
- static SSocketAddress Parse(const string& address);
+ static SSocketAddress Parse(const string& address, SHost::EName name = SHost::EName::eResolved);
friend ostream& operator<<(ostream& os, const SSocketAddress& address) { return os << address.AsString(); }
+
+private:
+ std::optional<string> m_Name;
};
NCBI_XCONNECT_EXPORT bool operator==(const SSocketAddress& lhs, const SSocketAddress& rhs);
class NCBI_XCONNECT_EXPORT CServiceDiscovery
{
public:
- CServiceDiscovery(const string& service_name);
+ CServiceDiscovery(const string& service_name, SSocketAddress::SHost::EName name = SSocketAddress::SHost::EName::eOriginal);
using TServer = pair<SSocketAddress, double>;
using TServers = vector<TServer>;
#ifndef CONNECT__IMPL__NCBI_UV_NGHTTP2__HPP
#define CONNECT__IMPL__NCBI_UV_NGHTTP2__HPP
-/* $Id: ncbi_uv_nghttp2.hpp 669301 2023-06-26 18:31:29Z ivanov $
+/* $Id: ncbi_uv_nghttp2.hpp 680769 2024-03-27 13:51:03Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
SUvNgHttp2_Error(const char* t, TFunc f, T e, const char* w)
{
m_Value << t << f(e) << " (" << e << ") " << w;
- };
+ }
stringstream m_Value;
};
function<TR(TArgs...)> BindThis(TR (SUvNgHttp2_SessionBase::*member)(TArgs...))
{
return [this, member](TArgs&&... args) -> TR { return (this->*member)(forward<TArgs>(args)...); };
- };
+ }
void OnConnect(int status);
void OnWrite(int status);
#ifndef CORELIB___REQUEST_STATUS__HPP
#define CORELIB___REQUEST_STATUS__HPP
-/* $Id: request_status.hpp 597623 2019-11-25 15:06:05Z grichenk $
+/* $Id: request_status.hpp 674533 2023-10-30 13:23:10Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
e416_RangeNotSatisfiable = 416,
e417_ExpectationFailed = 417,
e422_UnprocessableEntity = 422,
+ e451_Unavailable_For_Legal_Reasons = 451,
/// Non-standard status code - used to indicate broken connection
/// while serving normal request.
#ifndef MISC_JSONWRAPP___JSONWRAPP11__HPP
#define MISC_JSONWRAPP___JSONWRAPP11__HPP
-/* $Id: jsonwrapp11.hpp 671818 2023-08-24 18:17:15Z gouriano $
+/* $Id: jsonwrapp11.hpp 675766 2023-12-01 14:57:17Z gouriano $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
bool ReadBuffered(const std::string& filename);
/// Test if the most recent read was successful
- bool ReadSucceeded(void);
+ bool ReadSucceeded(void) const;
/// Most recent read produced empty document
// No more data in input stream
- bool EndOfData(void);
+ bool EndOfData(void) const;
/// Get most recent read error
std::string GetReadError(void) const;
}
/// Traverse the document contents
- void Walk(CJson_WalkHandler& walk) const;
+ /// returns TRUE if all the contents was processed
+ bool Walk(CJson_WalkHandler& walk) const;
/// Traverse the JSON data stream contents
- static void Walk(std::istream& in, CJson_WalkHandler& walk);
+ /// returns TRUE if all the contents was processed
+ static bool Walk(std::istream& in, CJson_WalkHandler& walk);
/// Check that the JSON document is a valid JSON schema
bool IsSchema(void) const;
std::vector<CJson_Node::TKeyType>::const_iterator n = m_name.begin();
CJson_Node::TKeyType path;
for ( ++t, ++i, ++n; t != te; ++t, ++i, ++n) {
- if (*t) {
+ if (*t && !n->empty()) {
path += JSONWRAPP_TO_NCBIUTF8("/");
path += JSONWRAPP_TO_NCBIUTF8(*n);
} else if (*i != size_t(-1)) {
path += JSONWRAPP_TO_NCBIUTF8("]");
}
}
- return path;
+ return path.empty() ? "/" : path;
}
inline CJson_Node::TKeyType CJson_WalkHandler::GetCurrentJPointer(void) const {
std::vector<CJson_Node::TKeyType>::const_iterator n = m_name.begin();
CJson_Node::TKeyType path;
for ( ++t, ++i, ++n; t != te; ++t, ++i, ++n) {
- path += JSONWRAPP_TO_NCBIUTF8("/");
- if (*t) {
+ if (*t && !n->empty()) {
+ path += JSONWRAPP_TO_NCBIUTF8("/");
path += JSONWRAPP_TO_NCBIUTF8(*n);
} else if (*i != size_t(-1)) {
+ path += JSONWRAPP_TO_NCBIUTF8("/");
path += JSONWRAPP_TO_NCBIUTF8(ncbi::NStr::NumericToString(*i));
}
}
- return path;
+ return path.empty() ? "/" : path;
}
inline bool CJson_WalkHandler::Read(CJson_Document& doc) {
return !m_DocImpl.HasParseError();
}
-inline bool CJson_Document::ReadSucceeded(void) {
+inline bool CJson_Document::ReadSucceeded(void) const {
return !m_DocImpl.HasParseError();
}
-inline bool CJson_Document::EndOfData(void) {
+inline bool CJson_Document::EndOfData(void) const {
return m_DocImpl.GetParseError() == rapidjson::kParseErrorDocumentEmpty;
}
return res;
}
-inline void CJson_Document::Walk(CJson_WalkHandler& walk) const {
+inline bool CJson_Document::Walk(CJson_WalkHandler& walk) const {
walk.x_SetSource(0);
- m_DocImpl.Accept(walk);
+ return m_DocImpl.Accept(walk);
}
-inline void CJson_Document::Walk(std::istream& in,
+inline bool CJson_Document::Walk(std::istream& in,
CJson_WalkHandler& walk) {
walk.x_SetSource(&in);
rapidjson::IStreamWrapper ifs(in);
rapidjson::Reader rdr;
- rdr.Parse<rapidjson::kParseStopWhenDoneFlag>(ifs,walk);
+ return !rdr.Parse<rapidjson::kParseStopWhenDoneFlag>(ifs,walk).IsError();
}
inline bool CJson_Document::IsSchema(void) const {
#if defined(NCBI_USE_PCH) && !defined(NCBI_PCH__HPP)
-/* $Id: ncbi_pch.hpp 674172 2023-10-19 17:21:21Z blastadm $
+/* $Id: ncbi_pch.hpp 684489 2024-06-25 12:36:39Z blastadm $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
-/* $Id: ncbi_source_ver.h 674172 2023-10-19 17:21:21Z blastadm $
+/* $Id: ncbi_source_ver.h 684489 2024-06-25 12:36:39Z blastadm $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
#ifndef FORWARDING_NCBICONF_H
#define FORWARDING_NCBICONF_H
-/* $Id: ncbiconf.h 674172 2023-10-19 17:21:21Z blastadm $
+/* $Id: ncbiconf.h 684489 2024-06-25 12:36:39Z blastadm $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
-/* $Id: Dbtag.hpp 666129 2023-04-20 19:39:18Z kans $
+/* $Id: Dbtag.hpp 683247 2024-05-21 12:43:30Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
eDbtagType_dbVar,
eDbtagType_EnsemblRapid,
eDbtagType_AllianceGenome,
- eDbtagType_EchinoBase
+ eDbtagType_EchinoBase,
+ eDbtagType_AmoebaDB,
+ eDbtagType_CryptoDB,
+ eDbtagType_FungiDB,
+ eDbtagType_GiardiaDB,
+ eDbtagType_MicrosporidiaDB,
+ eDbtagType_PiroplasmaDB,
+ eDbtagType_PlasmoDB,
+ eDbtagType_ToxoDB,
+ eDbtagType_TrichDB,
+ eDbtagType_TriTrypDB,
+ eDbtagType_VEuPathDB
};
enum EDbtagGroup {
-/* $Id: OrgMod.hpp 535708 2017-05-11 10:58:04Z bollin $
+/* $Id: OrgMod.hpp 684486 2024-06-25 12:34:24Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
static bool IsINSDCValidTypeMaterial(const string& type_material);
typedef map<string, string, PNocase> TInstitutionCodeMap;
- private:
+
+ // Allows instant transition when quarantine period ends.
+ static bool NCBI_ValidateForMultipleIsolates(void);
+
+private:
// Prohibit copy constructor and assignment operator
COrgMod(const COrgMod& value);
COrgMod& operator=(const COrgMod& value);
-/* $Id: SubSource.hpp 650764 2022-06-02 00:17:32Z gotvyans $
+/* $Id: SubSource.hpp 678688 2024-02-08 19:25:25Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
void GetLabel(string* str) const;
+ // Allows instant transition when quarantine period ends.
+ static bool NCBI_UseGeoLocNameForCountry(void);
+
enum EVocabulary {
eVocabulary_raw, // per ASN.1, except eSubtype_other <-> "note"
eVocabulary_insdc // per GB/DDBJ/EMBL qualifier names
-/* $Id: Seq_id.hpp 666463 2023-04-26 15:21:25Z grichenk $
+/* $Id: Seq_id.hpp 681843 2024-04-15 19:25:42Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
/// For IdentifyAccession (below)
enum EAccessionInfo {
+ // E_Choice values, explicitly pulled in to help avoid warnings
+ // elsewhere about bitwise operations between different enum types.
+ eSeqId_not_set = e_not_set,
+ eSeqId_local = e_Local,
+ eSeqId_gibbsq = e_Gibbsq,
+ eSeqId_gibbmt = e_Gibbmt,
+ eSeqId_giim = e_Giim,
+ eSeqId_genbank = e_Genbank,
+ eSeqId_embl = e_Embl,
+ eSeqId_pir = e_Pir,
+ eSeqId_swissprot = e_Swissprot,
+ eSeqId_patent = e_Patent,
+ eSeqId_other = e_Other,
+ eSeqId_refseq = eSeqId_other,
+ eSeqId_general = e_General,
+ eSeqId_gi = e_Gi,
+ eSeqId_ddbj = e_Ddbj,
+ eSeqId_prf = e_Prf,
+ eSeqId_pdb = e_Pdb,
+ eSeqId_tpg = e_Tpg,
+ eSeqId_tpe = e_Tpe,
+ eSeqId_tpd = e_Tpd,
+ eSeqId_gpipe = e_Gpipe,
+ eSeqId_named_annot_track = e_Named_annot_track,
+
// Mask for Seq_id type; allow 8 bits to be safe
eAcc_type_mask = 0xff,
// albeit not necessarily applicable to all divisions).
fAcc_nuc = 0x80000000,
fAcc_prot = 0x40000000,
+ fAcc_seq = 0,
fAcc_predicted = 0x20000000, // only for refseq
fAcc_specials = 0x10000000, // has special cases; only used internally
fAcc_master = 0x08000000,
eAcc_tsa_vdb_master = eAcc_tsa | fAcc_master | fAcc_vdb_only,
eAcc_targeted_vdb_master = eAcc_targeted | fAcc_master | fAcc_vdb_only,
+ // Internal macro, left defined only temporarily
+#define NCBI_ACC(type, div, mol) eSeqId_##type | eAcc_##div | fAcc_##mol
// Actual return values with EXAMPLE prefixes (to be followed
// by digits) or IDs, grouped by Seq-id type. In most cases,
// there are other prefixes with the same classification, and
// if not there could be in principle.
- eAcc_unknown = e_not_set | eAcc_other,
+ eAcc_unknown = NCBI_ACC(not_set, other, seq),
// Most N accessions are GenBank ESTs, but some low-numbered
// ones (now only used as secondary accessions) were assigned
// haphazardly, and some are therefore ambiguous.
- eAcc_ambiguous_nuc = e_not_set | eAcc_ambig | fAcc_nuc, // N0-N1
- eAcc_maybe_gb = e_not_set | eAcc_ambig_g | fAcc_nuc,
- eAcc_maybe_embl = e_not_set | eAcc_ambig_e | fAcc_nuc,
- eAcc_maybe_ddbj = e_not_set | eAcc_ambig_d | fAcc_nuc,
- eAcc_gb_embl = e_not_set | eAcc_ambig_ge | fAcc_nuc, //N00001
- eAcc_gb_ddbj = e_not_set | eAcc_ambig_gd | fAcc_nuc, //N00006
- eAcc_embl_ddbj = e_not_set | eAcc_ambig_ed | fAcc_nuc, //N00070
- eAcc_gb_embl_ddbj = e_not_set | eAcc_ambig_ged | fAcc_nuc, //N00005
- eAcc_unreserved_nuc = e_not_set | eAcc_unreserved | fAcc_nuc, // XY
- eAcc_unreserved_prot = e_not_set | eAcc_unreserved | fAcc_prot,// XYZ
-
- eAcc_local = e_Local | eAcc_other,
- eAcc_gibbsq = e_Gibbsq | eAcc_other,
- eAcc_gibbmt = e_Gibbmt | eAcc_other,
- eAcc_giim = e_Giim | eAcc_other,
-
- eAcc_gb_other = e_Genbank | eAcc_other,
- eAcc_gb_prot = e_Genbank | eAcc_other | fAcc_prot, // AAA
- eAcc_gb_other_nuc = e_Genbank | eAcc_other | fAcc_nuc, // AS
- eAcc_gb_est = e_Genbank | eAcc_est | fAcc_nuc, // H
- eAcc_gb_dirsub = e_Genbank | eAcc_dirsub | fAcc_nuc, // U
- eAcc_gb_patent = e_Genbank | eAcc_div_patent /* | fAcc_nuc */, //I
- eAcc_gb_patent_prot = e_Genbank | eAcc_div_patent | fAcc_prot, // AAE
- eAcc_gb_cdna = e_Genbank | eAcc_mrna | fAcc_nuc, // BC
- eAcc_gsdb_dirsub = e_Genbank | eAcc_gsdb_ds | fAcc_nuc, // J
- eAcc_gb_gsdb = e_Genbank | eAcc_gsdb | fAcc_nuc, // AD
- eAcc_gb_backbone = e_Genbank | eAcc_backbone | fAcc_nuc, // S
- eAcc_gb_tsa_nuc = e_Genbank | eAcc_tsa | fAcc_nuc, // EZ
- eAcc_gb_tsa_prot = e_Genbank | eAcc_tsa | fAcc_prot, // JAA
- eAcc_gb_tsam_nuc = e_Genbank | eAcc_tsa_master | fAcc_nuc,
- eAcc_gb_tsam_prot = e_Genbank | eAcc_tsa_master | fAcc_prot,
- eAcc_gb_tsav_nuc = e_Genbank | eAcc_tsa_vdb_only | fAcc_nuc,
- eAcc_gb_tsav_prot = e_Genbank | eAcc_tsa_vdb_only | fAcc_prot,
- eAcc_gb_tsavm_nuc = e_Genbank | eAcc_tsa_vdb_master | fAcc_nuc,
- eAcc_gb_tsavm_prot = e_Genbank | eAcc_tsa_vdb_master | fAcc_prot,
- eAcc_gb_segset = e_Genbank | eAcc_segset /* | fAcc_nuc */, // AH
- eAcc_gb_gss = e_Genbank | eAcc_gss | fAcc_nuc, // B
- eAcc_gb_genome = e_Genbank | eAcc_genome | fAcc_nuc, // AE
- eAcc_gb_htgs = e_Genbank | eAcc_htgs | fAcc_nuc, // AC
- eAcc_gb_con = e_Genbank | eAcc_con | fAcc_nuc, // CH
- eAcc_gb_wgs_nuc = e_Genbank | eAcc_wgs | fAcc_nuc, // AAAA
- eAcc_gb_wgs_prot = e_Genbank | eAcc_wgs | fAcc_prot, // EAA
- eAcc_gb_wgsm_nuc = e_Genbank | eAcc_wgs_master | fAcc_nuc,
- eAcc_gb_wgsm_prot = e_Genbank | eAcc_wgs_master | fAcc_prot,
- eAcc_gb_wgsv_nuc = e_Genbank | eAcc_wgs_vdb_only | fAcc_nuc,
- eAcc_gb_wgsv_prot = e_Genbank | eAcc_wgs_vdb_only | fAcc_prot, // MAA
- eAcc_gb_wgsvm_nuc = e_Genbank | eAcc_wgs_vdb_master | fAcc_nuc,
- eAcc_gb_wgsvm_prot = e_Genbank | eAcc_wgs_vdb_master | fAcc_prot,
- eAcc_gb_chromosome = e_Genbank | eAcc_chromosome | fAcc_nuc, // CM
- eAcc_gb_sts = e_Genbank | eAcc_sts | fAcc_nuc, // G
- eAcc_gb_mga = e_Genbank | eAcc_mga | fAcc_nuc, // unused
- eAcc_gb_optical_map = e_Genbank | eAcc_optical_map| fAcc_nuc, // MAP_
- eAcc_gb_targeted_nuc= e_Genbank | eAcc_targeted | fAcc_nuc, // KAAA
-
- eAcc_embl_other = e_Embl | eAcc_other,
- eAcc_embl_prot = e_Embl | eAcc_other | fAcc_prot, // CAA
- eAcc_embl_other_nuc = e_Embl | eAcc_other | fAcc_nuc, // AL
- eAcc_embl_est = e_Embl | eAcc_est | fAcc_nuc, // F
- eAcc_embl_dirsub = e_Embl | eAcc_dirsub | fAcc_nuc, // V
- eAcc_embl_patent = e_Embl | eAcc_div_patent | fAcc_nuc, // A
- eAcc_embl_tsa_nuc = e_Embl | eAcc_tsa | fAcc_nuc, // HAAA
- eAcc_embl_tsa_prot = e_Embl | eAcc_tsa | fAcc_prot, // unused
- eAcc_embl_tsam_nuc = e_Embl | eAcc_tsa_master | fAcc_nuc,
- eAcc_embl_tsam_prot = e_Embl | eAcc_tsa_master | fAcc_prot,
- eAcc_embl_tsav_nuc = e_Embl | eAcc_tsa_vdb_only | fAcc_nuc,
- eAcc_embl_tsav_prot = e_Embl | eAcc_tsa_vdb_only | fAcc_prot,
- eAcc_embl_tsavm_nuc = e_Embl | eAcc_tsa_vdb_master | fAcc_nuc,
- eAcc_embl_tsavm_prot= e_Embl | eAcc_tsa_vdb_master | fAcc_prot,
- eAcc_embl_gss = e_Embl | eAcc_gss | fAcc_nuc, // AJ864682
- eAcc_embl_genome = e_Embl | eAcc_genome | fAcc_nuc, // unused
- eAcc_embl_htgs = e_Embl | eAcc_htgs | fAcc_nuc, // unused
- eAcc_embl_con = e_Embl | eAcc_con | fAcc_nuc, // AN
- eAcc_embl_wgs_nuc = e_Embl | eAcc_wgs | fAcc_nuc, // CAAA
- eAcc_embl_wgs_prot = e_Embl | eAcc_wgs | fAcc_prot, // unused
- eAcc_embl_wgsm_nuc = e_Embl | eAcc_wgs_master | fAcc_nuc,
- eAcc_embl_wgsm_prot = e_Embl | eAcc_wgs_master | fAcc_prot,
- eAcc_embl_wgsv_nuc = e_Embl | eAcc_wgs_vdb_only | fAcc_nuc,
- eAcc_embl_wgsv_prot = e_Embl | eAcc_wgs_vdb_only | fAcc_prot,
- eAcc_embl_wgsvm_nuc = e_Embl | eAcc_wgs_vdb_master | fAcc_nuc,
- eAcc_embl_wgsvm_prot= e_Embl | eAcc_wgs_vdb_master | fAcc_prot,
- eAcc_embl_mga = e_Embl | eAcc_mga | fAcc_nuc, // unused
-
- eAcc_pir = e_Pir | eAcc_other | fAcc_prot,
- eAcc_swissprot = e_Swissprot | eAcc_other | fAcc_prot, // P
- eAcc_patent = e_Patent | eAcc_div_patent,
-
- eAcc_refseq_prot = e_Other | eAcc_other | fAcc_prot,//NP_
- eAcc_refseq_mrna = e_Other | eAcc_mrna | fAcc_nuc, //NM_
- eAcc_refseq_ncrna = e_Other | eAcc_ncrna | fAcc_nuc, //NR_
- eAcc_refseq_unique_prot = e_Other | eAcc_unique | fAcc_prot,//WP_
- eAcc_refseq_unreserved = e_Other | eAcc_unreserved, //AA_
- eAcc_refseq_genome = e_Other | eAcc_genome | fAcc_nuc, //NS_
- eAcc_refseq_contig = e_Other | eAcc_con | fAcc_nuc, //NT_
- eAcc_refseq_wgs_nuc = e_Other | eAcc_wgs | fAcc_nuc, //NZ_
- eAcc_refseq_wgs_prot = e_Other | eAcc_wgs | fAcc_prot,//ZP_
- eAcc_refseq_wgsm_nuc = e_Other | eAcc_wgs_master | fAcc_nuc,
- eAcc_refseq_wgsm_prot = e_Other | eAcc_wgs_master | fAcc_prot,
- eAcc_refseq_wgsv_nuc = e_Other | eAcc_wgs_vdb_only | fAcc_nuc,
- eAcc_refseq_wgsv_prot = e_Other | eAcc_wgs_vdb_only | fAcc_prot,
- eAcc_refseq_wgsvm_nuc = e_Other | eAcc_wgs_vdb_master | fAcc_nuc,
- eAcc_refseq_wgsvm_prot = e_Other | eAcc_wgs_vdb_master | fAcc_prot,
- eAcc_refseq_chromosome = e_Other | eAcc_chromosome | fAcc_nuc, //NC_
- eAcc_refseq_genomic = e_Other | eAcc_genomic_rgn | fAcc_nuc, //NG_
- eAcc_refseq_wgs_intermed= e_Other | eAcc_wgs_intermed | fAcc_nuc, //NW_
- eAcc_refseq_wgsm_intermed=e_Other | eAcc_wgs_intermed_master | fAcc_nuc,
- eAcc_refseq_wgsv_intermed
- = e_Other | eAcc_wgs_intermed_vdb_only | fAcc_nuc,
- eAcc_refseq_wgsvm_intermed
- = e_Other | eAcc_wgs_intermed_vdb_master | fAcc_nuc,
+ eAcc_ambiguous_nuc = NCBI_ACC(not_set, ambig, nuc), // N0-N1
+ eAcc_maybe_gb = NCBI_ACC(not_set, ambig_g, nuc),
+ eAcc_maybe_embl = NCBI_ACC(not_set, ambig_e, nuc),
+ eAcc_maybe_ddbj = NCBI_ACC(not_set, ambig_d, nuc),
+ eAcc_gb_embl = NCBI_ACC(not_set, ambig_ge, nuc), // N00001
+ eAcc_gb_ddbj = NCBI_ACC(not_set, ambig_gd, nuc), // N00006
+ eAcc_embl_ddbj = NCBI_ACC(not_set, ambig_ed, nuc), // N00070
+ eAcc_gb_embl_ddbj = NCBI_ACC(not_set, ambig_ged, nuc), // N00005
+ eAcc_unreserved_nuc = NCBI_ACC(not_set, unreserved, nuc), // XY
+ eAcc_unreserved_prot = NCBI_ACC(not_set, unreserved, prot), // XYZ
+
+ eAcc_local = NCBI_ACC(local, other, seq),
+ eAcc_gibbsq = NCBI_ACC(gibbsq, other, seq),
+ eAcc_gibbmt = NCBI_ACC(gibbmt, other, seq),
+ eAcc_giim = NCBI_ACC(giim, other, seq),
+
+ // NB: eAcc_gb_patent and eAcc_gb_segset are only *mostly* nucleotide,
+ // and eAcc_gb_mga is so far unused.
+ eAcc_gb_other = NCBI_ACC(genbank, other, seq),
+ eAcc_gb_prot = NCBI_ACC(genbank, other, prot), // AAA
+ eAcc_gb_other_nuc = NCBI_ACC(genbank, other, nuc), // AS
+ eAcc_gb_est = NCBI_ACC(genbank, est, nuc), // H
+ eAcc_gb_dirsub = NCBI_ACC(genbank, dirsub, nuc), // U
+ eAcc_gb_patent = NCBI_ACC(genbank, div_patent, seq), // I
+ eAcc_gb_patent_prot = NCBI_ACC(genbank, div_patent, prot), // AAE
+ eAcc_gb_cdna = NCBI_ACC(genbank, mrna, nuc), // BC
+ eAcc_gsdb_dirsub = NCBI_ACC(genbank, gsdb_ds, nuc), // J
+ eAcc_gb_gsdb = NCBI_ACC(genbank, gsdb, nuc), // AD
+ eAcc_gb_backbone = NCBI_ACC(genbank, backbone, nuc), // S
+ eAcc_gb_tsa_nuc = NCBI_ACC(genbank, tsa, nuc), // EZ
+ eAcc_gb_tsa_prot = NCBI_ACC(genbank, tsa, prot), // JAA
+ eAcc_gb_tsam_nuc = NCBI_ACC(genbank, tsa_master, nuc),
+ eAcc_gb_tsam_prot = NCBI_ACC(genbank, tsa_master, prot),
+ eAcc_gb_tsav_nuc = NCBI_ACC(genbank, tsa_vdb_only, nuc),
+ eAcc_gb_tsav_prot = NCBI_ACC(genbank, tsa_vdb_only, prot),
+ eAcc_gb_tsavm_nuc = NCBI_ACC(genbank, tsa_vdb_master, nuc),
+ eAcc_gb_tsavm_prot = NCBI_ACC(genbank, tsa_vdb_master, prot),
+ eAcc_gb_segset = NCBI_ACC(genbank, segset, seq), // AH
+ eAcc_gb_gss = NCBI_ACC(genbank, gss, nuc), // B
+ eAcc_gb_genome = NCBI_ACC(genbank, genome, nuc), // AE
+ eAcc_gb_htgs = NCBI_ACC(genbank, htgs, nuc), // AC
+ eAcc_gb_con = NCBI_ACC(genbank, con, nuc), // CH
+ eAcc_gb_wgs_nuc = NCBI_ACC(genbank, wgs, nuc), // AAAA
+ eAcc_gb_wgs_prot = NCBI_ACC(genbank, wgs, prot), // EAA
+ eAcc_gb_wgsm_nuc = NCBI_ACC(genbank, wgs_master, nuc),
+ eAcc_gb_wgsm_prot = NCBI_ACC(genbank, wgs_master, prot),
+ eAcc_gb_wgsv_nuc = NCBI_ACC(genbank, wgs_vdb_only, nuc),
+ eAcc_gb_wgsv_prot = NCBI_ACC(genbank, wgs_vdb_only, prot),
+ eAcc_gb_wgsvm_nuc = NCBI_ACC(genbank, wgs_vdb_master, nuc),
+ eAcc_gb_wgsvm_prot = NCBI_ACC(genbank, wgs_vdb_master, prot),
+ eAcc_gb_chromosome = NCBI_ACC(genbank, chromosome, nuc), // CM
+ eAcc_gb_sts = NCBI_ACC(genbank, sts, nuc), // G
+ eAcc_gb_mga = NCBI_ACC(genbank, mga, nuc),
+ eAcc_gb_optical_map = NCBI_ACC(genbank, optical_map, nuc), // MAP_
+ eAcc_gb_targeted_nuc = NCBI_ACC(genbank, targeted, nuc), // KAAA
+
+ eAcc_embl_other = NCBI_ACC(embl, other, seq),
+ eAcc_embl_prot = NCBI_ACC(embl, other, prot), // CAA
+ eAcc_embl_other_nuc = NCBI_ACC(embl, other, nuc), // AL
+ eAcc_embl_est = NCBI_ACC(embl, est, nuc), // F
+ eAcc_embl_dirsub = NCBI_ACC(embl, dirsub, nuc), // V
+ eAcc_embl_patent = NCBI_ACC(embl, div_patent, nuc), // A
+ eAcc_embl_tsa_nuc = NCBI_ACC(embl, tsa, nuc), // HAAA
+ eAcc_embl_tsa_prot = NCBI_ACC(embl, tsa, prot), // unused
+ eAcc_embl_tsam_nuc = NCBI_ACC(embl, tsa_master, nuc),
+ eAcc_embl_tsam_prot = NCBI_ACC(embl, tsa_master, prot),
+ eAcc_embl_tsav_nuc = NCBI_ACC(embl, tsa_vdb_only, nuc),
+ eAcc_embl_tsav_prot = NCBI_ACC(embl, tsa_vdb_only, prot),
+ eAcc_embl_tsavm_nuc = NCBI_ACC(embl, tsa_vdb_master, nuc),
+ eAcc_embl_tsavm_prot = NCBI_ACC(embl, tsa_vdb_master, prot),
+ eAcc_embl_gss = NCBI_ACC(embl, gss, nuc), // AJ864682
+ eAcc_embl_genome = NCBI_ACC(embl, genome, nuc), // unused
+ eAcc_embl_htgs = NCBI_ACC(embl, htgs, nuc), // unused
+ eAcc_embl_con = NCBI_ACC(embl, con, nuc), // AN
+ eAcc_embl_wgs_nuc = NCBI_ACC(embl, wgs, nuc), // CAAA
+ eAcc_embl_wgs_prot = NCBI_ACC(embl, wgs, prot), // unused
+ eAcc_embl_wgsm_nuc = NCBI_ACC(embl, wgs_master, nuc),
+ eAcc_embl_wgsm_prot = NCBI_ACC(embl, wgs_master, prot),
+ eAcc_embl_wgsv_nuc = NCBI_ACC(embl, wgs_vdb_only, nuc),
+ eAcc_embl_wgsv_prot = NCBI_ACC(embl, wgs_vdb_only, prot),
+ eAcc_embl_wgsvm_nuc = NCBI_ACC(embl, wgs_vdb_master, nuc),
+ eAcc_embl_wgsvm_prot = NCBI_ACC(embl, wgs_vdb_master, prot),
+ eAcc_embl_mga = NCBI_ACC(embl, mga, nuc), // unused
+
+ eAcc_pir = NCBI_ACC(pir, other, prot),
+ eAcc_swissprot = NCBI_ACC(swissprot, other, prot), // P
+ eAcc_patent = NCBI_ACC(patent, div_patent, seq),
+
+ eAcc_refseq_prot = NCBI_ACC(refseq, other, prot),//NP_
+ eAcc_refseq_mrna = NCBI_ACC(refseq, mrna, nuc), //NM_
+ eAcc_refseq_ncrna = NCBI_ACC(refseq, ncrna, nuc), //NR_
+ eAcc_refseq_unique_prot = NCBI_ACC(refseq, unique, prot),//WP_
+ eAcc_refseq_unreserved = NCBI_ACC(refseq, unreserved, seq), //AA_
+ eAcc_refseq_genome = NCBI_ACC(refseq, genome, nuc), //NS_
+ eAcc_refseq_contig = NCBI_ACC(refseq, con, nuc), //NT_
+ eAcc_refseq_wgs_nuc = NCBI_ACC(refseq, wgs, nuc), //NZ_
+ eAcc_refseq_wgs_prot = NCBI_ACC(refseq, wgs, prot),//ZP_
+ eAcc_refseq_wgsm_nuc = NCBI_ACC(refseq, wgs_master, nuc),
+ eAcc_refseq_wgsm_prot = NCBI_ACC(refseq, wgs_master, prot),
+ eAcc_refseq_wgsv_nuc = NCBI_ACC(refseq, wgs_vdb_only, nuc),
+ eAcc_refseq_wgsv_prot = NCBI_ACC(refseq, wgs_vdb_only, prot),
+ eAcc_refseq_wgsvm_nuc = NCBI_ACC(refseq, wgs_vdb_master, nuc),
+ eAcc_refseq_wgsvm_prot = NCBI_ACC(refseq, wgs_vdb_master, prot),
+ eAcc_refseq_chromosome = NCBI_ACC(refseq, chromosome, nuc), //NC_
+ eAcc_refseq_genomic = NCBI_ACC(refseq, genomic_rgn, nuc), //NG_
+ eAcc_refseq_wgs_intermed = NCBI_ACC(refseq, wgs_intermed, nuc), //NW_
+ eAcc_refseq_wgsm_intermed = NCBI_ACC(refseq, wgs_intermed_master,
+ nuc),
+ eAcc_refseq_wgsv_intermed = NCBI_ACC(refseq, wgs_intermed_vdb_only,
+ nuc),
+ eAcc_refseq_wgsvm_intermed = NCBI_ACC(refseq, wgs_intermed_vdb_master,
+ nuc),
eAcc_refseq_prot_predicted = eAcc_refseq_prot | fAcc_predicted, //XP_
eAcc_refseq_mrna_predicted = eAcc_refseq_mrna | fAcc_predicted, //XM_
eAcc_refseq_ncrna_predicted = eAcc_refseq_ncrna | fAcc_predicted, //XR_
eAcc_refseq_chromosome_ncbo = eAcc_refseq_chromosome | fAcc_ncbo, //WC_
eAcc_refseq_contig_ncbo = eAcc_refseq_contig | fAcc_ncbo, //WT_
- eAcc_general = e_General | eAcc_other,
- eAcc_general_nuc = e_General | eAcc_other | fAcc_nuc, // TRACE_ASSM
- eAcc_general_prot = e_General | eAcc_other | fAcc_prot,
-
- eAcc_gi = e_Gi | eAcc_other,
-
- eAcc_ddbj_other = e_Ddbj | eAcc_other,
- eAcc_ddbj_prot = e_Ddbj | eAcc_other | fAcc_prot, // BAA
- eAcc_ddbj_other_nuc = e_Ddbj | eAcc_other | fAcc_nuc, // N00028
- eAcc_ddbj_est = e_Ddbj | eAcc_est | fAcc_nuc, // C
- eAcc_ddbj_dirsub = e_Ddbj | eAcc_dirsub | fAcc_nuc, // D
- eAcc_ddbj_patent = e_Ddbj | eAcc_div_patent | fAcc_nuc, // E
- eAcc_ddbj_mrna = e_Ddbj | eAcc_mrna | fAcc_nuc, // AK
- eAcc_ddbj_tsa_nuc = e_Ddbj | eAcc_tsa | fAcc_nuc, // FX
- eAcc_ddbj_tsa_prot = e_Ddbj | eAcc_tsa | fAcc_prot, // LAA
- eAcc_ddbj_tsam_nuc = e_Ddbj | eAcc_tsa_master | fAcc_nuc,
- eAcc_ddbj_tsam_prot = e_Ddbj | eAcc_tsa_master | fAcc_prot,
- eAcc_ddbj_tsav_nuc = e_Ddbj | eAcc_tsa_vdb_only | fAcc_nuc,
- eAcc_ddbj_tsav_prot = e_Ddbj | eAcc_tsa_vdb_only | fAcc_prot,
- eAcc_ddbj_tsavm_nuc = e_Ddbj | eAcc_tsa_vdb_master | fAcc_nuc,
- eAcc_ddbj_tsavm_prot= e_Ddbj | eAcc_tsa_vdb_master | fAcc_prot,
- eAcc_ddbj_gss = e_Ddbj | eAcc_gss | fAcc_nuc, // AG
- eAcc_ddbj_genome = e_Ddbj | eAcc_genome | fAcc_nuc, // AP
- eAcc_ddbj_htgs = e_Ddbj | eAcc_htgs | fAcc_nuc, // unused
- eAcc_ddbj_con = e_Ddbj | eAcc_con | fAcc_nuc, // BA
- eAcc_ddbj_wgs_nuc = e_Ddbj | eAcc_wgs | fAcc_nuc, // BAAA
- eAcc_ddbj_wgs_prot = e_Ddbj | eAcc_wgs | fAcc_prot, // GAA
- eAcc_ddbj_wgsm_nuc = e_Ddbj | eAcc_wgs_master | fAcc_nuc,
- eAcc_ddbj_wgsm_prot = e_Ddbj | eAcc_wgs_master | fAcc_prot,
- eAcc_ddbj_wgsv_nuc = e_Ddbj | eAcc_wgs_vdb_only | fAcc_nuc,
- eAcc_ddbj_wgsv_prot = e_Ddbj | eAcc_wgs_vdb_only | fAcc_prot,
- eAcc_ddbj_wgsvm_nuc = e_Ddbj | eAcc_wgs_vdb_master | fAcc_nuc,
- eAcc_ddbj_wgsvm_prot = e_Ddbj | eAcc_wgs_vdb_master | fAcc_prot,
- eAcc_ddbj_mga = e_Ddbj | eAcc_mga | fAcc_nuc, // AAAAA
- eAcc_ddbj_targeted_nuc=e_Ddbj| eAcc_targeted | fAcc_nuc, // TAAA
- eAcc_ddbj_targetedm_nuc = e_Ddbj | eAcc_targeted_master | fAcc_nuc,
- eAcc_ddbj_targetedv_nuc = e_Ddbj | eAcc_targeted_vdb_only | fAcc_nuc,
- eAcc_ddbj_targetedvm_nuc= e_Ddbj | eAcc_targeted_vdb_master | fAcc_nuc,
-
- eAcc_prf = e_Prf | eAcc_other | fAcc_prot,
- eAcc_pdb = e_Pdb | eAcc_other, // not necessarily protein!
-
- eAcc_gb_tpa_other = e_Tpg | eAcc_other,
- eAcc_gb_tpa_nuc = e_Tpg | eAcc_other | fAcc_nuc, // BK
- eAcc_gb_tpa_prot = e_Tpg | eAcc_other | fAcc_prot, // DAA
- eAcc_gb_tpa_segset = e_Tpg | eAcc_segset | fAcc_nuc, // BL
- eAcc_gb_tpa_con = e_Tpg | eAcc_con | fAcc_nuc, // GJ
- eAcc_gb_tpa_wgs_nuc = e_Tpg | eAcc_wgs | fAcc_nuc, // DAAA
- eAcc_gb_tpa_wgs_prot = e_Tpg | eAcc_wgs | fAcc_prot,
- eAcc_gb_tpa_wgsm_nuc = e_Tpg | eAcc_wgs_master | fAcc_nuc,
- eAcc_gb_tpa_wgsm_prot = e_Tpg | eAcc_wgs_master | fAcc_prot,
- eAcc_gb_tpa_wgsv_nuc = e_Tpg | eAcc_wgs_vdb_only | fAcc_nuc,
- eAcc_gb_tpa_wgsv_prot = e_Tpg | eAcc_wgs_vdb_only | fAcc_prot, // HAA
- eAcc_gb_tpa_wgsvm_nuc = e_Tpg | eAcc_wgs_vdb_master | fAcc_nuc,
- eAcc_gb_tpa_wgsvm_prot = e_Tpg | eAcc_wgs_vdb_master | fAcc_prot,
- eAcc_gb_tpa_chromosome = e_Tpg | eAcc_chromosome | fAcc_nuc, // GK
-
- eAcc_embl_tpa_other = e_Tpe | eAcc_other,
- eAcc_embl_tpa_nuc = e_Tpe | eAcc_other | fAcc_nuc, // BN
- eAcc_embl_tpa_prot = e_Tpe | eAcc_other | fAcc_prot, // CAD29848
- eAcc_embl_tpa_tsa_nuc = e_Tpe | eAcc_tsa | fAcc_nuc,
- eAcc_embl_tpa_tsa_prot = e_Tpe | eAcc_tsa | fAcc_prot,
- eAcc_embl_tpa_tsam_nuc = e_Tpe | eAcc_tsa_master | fAcc_nuc,
- eAcc_embl_tpa_tsam_prot = e_Tpe | eAcc_tsa_master | fAcc_prot,
- eAcc_embl_tpa_tsav_nuc = e_Tpe | eAcc_tsa_vdb_only | fAcc_nuc,
- eAcc_embl_tpa_tsav_prot = e_Tpe | eAcc_tsa_vdb_only | fAcc_prot,
- eAcc_embl_tpa_tsavm_nuc = e_Tpe | eAcc_tsa_vdb_master | fAcc_nuc,
- eAcc_embl_tpa_tsavm_prot = e_Tpe | eAcc_tsa_vdb_master | fAcc_prot,
- eAcc_embl_tpa_wgs_nuc = e_Tpe | eAcc_wgs | fAcc_nuc, // unused
- eAcc_embl_tpa_wgs_prot = e_Tpe | eAcc_wgs | fAcc_prot, // unused
- eAcc_embl_tpa_wgsm_nuc = e_Tpe | eAcc_wgs_master | fAcc_nuc,
- eAcc_embl_tpa_wgsm_prot = e_Tpe | eAcc_wgs_master | fAcc_prot,
- eAcc_embl_tpa_wgsv_nuc = e_Tpe | eAcc_wgs_vdb_only | fAcc_nuc,
- eAcc_embl_tpa_wgsv_prot = e_Tpe | eAcc_wgs_vdb_only | fAcc_prot,
- eAcc_embl_tpa_wgsvm_nuc = e_Tpe | eAcc_wgs_vdb_master | fAcc_nuc,
- eAcc_embl_tpa_wgsvm_prot = e_Tpe | eAcc_wgs_vdb_master | fAcc_prot,
-
- eAcc_ddbj_tpa_other = e_Tpd | eAcc_other,
- eAcc_ddbj_tpa_nuc = e_Tpd | eAcc_other | fAcc_nuc, // BR
- eAcc_ddbj_tpa_prot = e_Tpd | eAcc_other | fAcc_prot, // FAA
- eAcc_ddbj_tpa_tsa_nuc = e_Tpd | eAcc_tsa | fAcc_nuc, // YAAA
- eAcc_ddbj_tpa_tsa_prot = e_Tpd | eAcc_tsa | fAcc_prot, // unused
- eAcc_ddbj_tpa_tsam_nuc = e_Tpd | eAcc_tsa_master | fAcc_nuc,
- eAcc_ddbj_tpa_tsam_prot = e_Tpd | eAcc_tsa_master | fAcc_prot,
- eAcc_ddbj_tpa_tsav_nuc = e_Tpd | eAcc_tsa_vdb_only | fAcc_nuc,
- eAcc_ddbj_tpa_tsav_prot = e_Tpd | eAcc_tsa_vdb_only | fAcc_prot,
- eAcc_ddbj_tpa_tsavm_nuc = e_Tpd | eAcc_tsa_vdb_master | fAcc_nuc,
- eAcc_ddbj_tpa_tsavm_prot = e_Tpd | eAcc_tsa_vdb_master | fAcc_prot,
- eAcc_ddbj_tpa_con = e_Tpd | eAcc_con | fAcc_nuc, // HT
- eAcc_ddbj_tpa_wgs_nuc = e_Tpd | eAcc_wgs | fAcc_nuc, // EAAA
- eAcc_ddbj_tpa_wgs_prot = e_Tpd | eAcc_wgs | fAcc_prot, // IAA
- eAcc_ddbj_tpa_wgsm_nuc = e_Tpd | eAcc_wgs_master | fAcc_nuc,
- eAcc_ddbj_tpa_wgsm_prot = e_Tpd | eAcc_wgs_master | fAcc_prot,
- eAcc_ddbj_tpa_wgsv_nuc = e_Tpd | eAcc_wgs_vdb_only | fAcc_nuc,
- eAcc_ddbj_tpa_wgsv_prot = e_Tpd | eAcc_wgs_vdb_only | fAcc_prot,
- eAcc_ddbj_tpa_wgsvm_nuc = e_Tpd | eAcc_wgs_vdb_master | fAcc_nuc,
- eAcc_ddbj_tpa_wgsvm_prot = e_Tpd | eAcc_wgs_vdb_master | fAcc_prot,
- eAcc_ddbj_tpa_chromosome = e_Tpd | eAcc_chromosome | fAcc_nuc, // HU
- eAcc_ddbj_tpa_targeted_nuc = e_Tpd | eAcc_targeted | fAcc_nuc, // ZAAA
- eAcc_ddbj_tpa_targetedm_nuc= e_Tpd | eAcc_targeted_master | fAcc_nuc,
- eAcc_ddbj_tpa_targetedv_nuc= e_Tpd | eAcc_targeted_vdb_only | fAcc_nuc,
- eAcc_ddbj_tpa_targetedvm_nuc=e_Tpd | eAcc_targeted_vdb_master | fAcc_nuc,
+ eAcc_general = NCBI_ACC(general, other, seq),
+ eAcc_general_nuc = NCBI_ACC(general, other, nuc), // TRACE_ASSM
+ eAcc_general_prot = NCBI_ACC(general, other, prot),
+
+ eAcc_gi = NCBI_ACC(gi, other, seq),
+
+ eAcc_ddbj_other = NCBI_ACC(ddbj, other, seq),
+ eAcc_ddbj_prot = NCBI_ACC(ddbj, other, prot), // BAA
+ eAcc_ddbj_other_nuc = NCBI_ACC(ddbj, other, nuc),//N00028
+ eAcc_ddbj_est = NCBI_ACC(ddbj, est, nuc), // C
+ eAcc_ddbj_dirsub = NCBI_ACC(ddbj, dirsub, nuc), // D
+ eAcc_ddbj_patent = NCBI_ACC(ddbj, div_patent, nuc), // E
+ eAcc_ddbj_mrna = NCBI_ACC(ddbj, mrna, nuc), // AK
+ eAcc_ddbj_tsa_nuc = NCBI_ACC(ddbj, tsa, nuc), // FX
+ eAcc_ddbj_tsa_prot = NCBI_ACC(ddbj, tsa, prot), // LAA
+ eAcc_ddbj_tsam_nuc = NCBI_ACC(ddbj, tsa_master, nuc),
+ eAcc_ddbj_tsam_prot = NCBI_ACC(ddbj, tsa_master, prot),
+ eAcc_ddbj_tsav_nuc = NCBI_ACC(ddbj, tsa_vdb_only, nuc),
+ eAcc_ddbj_tsav_prot = NCBI_ACC(ddbj, tsa_vdb_only, prot),
+ eAcc_ddbj_tsavm_nuc = NCBI_ACC(ddbj, tsa_vdb_master, nuc),
+ eAcc_ddbj_tsavm_prot = NCBI_ACC(ddbj, tsa_vdb_master, prot),
+ eAcc_ddbj_gss = NCBI_ACC(ddbj, gss, nuc), // AG
+ eAcc_ddbj_genome = NCBI_ACC(ddbj, genome, nuc), // AP
+ eAcc_ddbj_htgs = NCBI_ACC(ddbj, htgs, nuc), // {}
+ eAcc_ddbj_con = NCBI_ACC(ddbj, con, nuc), // BA
+ eAcc_ddbj_wgs_nuc = NCBI_ACC(ddbj, wgs, nuc), // BAAA
+ eAcc_ddbj_wgs_prot = NCBI_ACC(ddbj, wgs, prot), // GAA
+ eAcc_ddbj_wgsm_nuc = NCBI_ACC(ddbj, wgs_master, nuc),
+ eAcc_ddbj_wgsm_prot = NCBI_ACC(ddbj, wgs_master, prot),
+ eAcc_ddbj_wgsv_nuc = NCBI_ACC(ddbj, wgs_vdb_only, nuc),
+ eAcc_ddbj_wgsv_prot = NCBI_ACC(ddbj, wgs_vdb_only, prot),
+ eAcc_ddbj_wgsvm_nuc = NCBI_ACC(ddbj, wgs_vdb_master, nuc),
+ eAcc_ddbj_wgsvm_prot = NCBI_ACC(ddbj, wgs_vdb_master, prot),
+ eAcc_ddbj_mga = NCBI_ACC(ddbj, mga, nuc), //AAAAA
+ eAcc_ddbj_targeted_nuc = NCBI_ACC(ddbj, targeted, nuc), // TAAA
+ eAcc_ddbj_targetedm_nuc = NCBI_ACC(ddbj, targeted_master, nuc),
+ eAcc_ddbj_targetedv_nuc = NCBI_ACC(ddbj, targeted_vdb_only, nuc),
+ eAcc_ddbj_targetedvm_nuc = NCBI_ACC(ddbj, targeted_vdb_master, nuc),
+
+ eAcc_prf = NCBI_ACC(prf, other, prot),
+ eAcc_pdb = NCBI_ACC(pdb, other, seq), // not necessarily protein!
+
+ eAcc_gb_tpa_other = NCBI_ACC(tpg, other, seq),
+ eAcc_gb_tpa_nuc = NCBI_ACC(tpg, other, nuc), // BK
+ eAcc_gb_tpa_prot = NCBI_ACC(tpg, other, prot), // DAA
+ eAcc_gb_tpa_segset = NCBI_ACC(tpg, segset, nuc), // BL
+ eAcc_gb_tpa_con = NCBI_ACC(tpg, con, nuc), // GJ
+ eAcc_gb_tpa_wgs_nuc = NCBI_ACC(tpg, wgs, nuc), // DAAA
+ eAcc_gb_tpa_wgs_prot = NCBI_ACC(tpg, wgs, prot),
+ eAcc_gb_tpa_wgsm_nuc = NCBI_ACC(tpg, wgs_master, nuc),
+ eAcc_gb_tpa_wgsm_prot = NCBI_ACC(tpg, wgs_master, prot),
+ eAcc_gb_tpa_wgsv_nuc = NCBI_ACC(tpg, wgs_vdb_only, nuc),
+ eAcc_gb_tpa_wgsv_prot = NCBI_ACC(tpg, wgs_vdb_only, prot), // HAA
+ eAcc_gb_tpa_wgsvm_nuc = NCBI_ACC(tpg, wgs_vdb_master, nuc),
+ eAcc_gb_tpa_wgsvm_prot = NCBI_ACC(tpg, wgs_vdb_master, prot),
+ eAcc_gb_tpa_chromosome = NCBI_ACC(tpg, chromosome, nuc), // GK
+
+ eAcc_embl_tpa_other = NCBI_ACC(tpe, other, seq),
+ eAcc_embl_tpa_nuc = NCBI_ACC(tpe, other, nuc), // BN
+ eAcc_embl_tpa_prot = NCBI_ACC(tpe, other, prot), // CAD29848
+ eAcc_embl_tpa_tsa_nuc = NCBI_ACC(tpe, tsa, nuc),
+ eAcc_embl_tpa_tsa_prot = NCBI_ACC(tpe, tsa, prot),
+ eAcc_embl_tpa_tsam_nuc = NCBI_ACC(tpe, tsa_master, nuc),
+ eAcc_embl_tpa_tsam_prot = NCBI_ACC(tpe, tsa_master, prot),
+ eAcc_embl_tpa_tsav_nuc = NCBI_ACC(tpe, tsa_vdb_only, nuc),
+ eAcc_embl_tpa_tsav_prot = NCBI_ACC(tpe, tsa_vdb_only, prot),
+ eAcc_embl_tpa_tsavm_nuc = NCBI_ACC(tpe, tsa_vdb_master, nuc),
+ eAcc_embl_tpa_tsavm_prot = NCBI_ACC(tpe, tsa_vdb_master, prot),
+ eAcc_embl_tpa_wgs_nuc = NCBI_ACC(tpe, wgs, nuc), // {}
+ eAcc_embl_tpa_wgs_prot = NCBI_ACC(tpe, wgs, prot), // {}
+ eAcc_embl_tpa_wgsm_nuc = NCBI_ACC(tpe, wgs_master, nuc),
+ eAcc_embl_tpa_wgsm_prot = NCBI_ACC(tpe, wgs_master, prot),
+ eAcc_embl_tpa_wgsv_nuc = NCBI_ACC(tpe, wgs_vdb_only, nuc),
+ eAcc_embl_tpa_wgsv_prot = NCBI_ACC(tpe, wgs_vdb_only, prot),
+ eAcc_embl_tpa_wgsvm_nuc = NCBI_ACC(tpe, wgs_vdb_master, nuc),
+ eAcc_embl_tpa_wgsvm_prot = NCBI_ACC(tpe, wgs_vdb_master, prot),
+
+ eAcc_ddbj_tpa_other = NCBI_ACC(tpd, other, seq),
+ eAcc_ddbj_tpa_nuc = NCBI_ACC(tpd, other, nuc), //BR
+ eAcc_ddbj_tpa_prot = NCBI_ACC(tpd, other, prot),//FAA
+ eAcc_ddbj_tpa_tsa_nuc = NCBI_ACC(tpd, tsa, nuc), //YAAA
+ eAcc_ddbj_tpa_tsa_prot = NCBI_ACC(tpd, tsa, prot),//{}
+ eAcc_ddbj_tpa_tsam_nuc = NCBI_ACC(tpd, tsa_master, nuc),
+ eAcc_ddbj_tpa_tsam_prot = NCBI_ACC(tpd, tsa_master, prot),
+ eAcc_ddbj_tpa_tsav_nuc = NCBI_ACC(tpd, tsa_vdb_only, nuc),
+ eAcc_ddbj_tpa_tsav_prot = NCBI_ACC(tpd, tsa_vdb_only, prot),
+ eAcc_ddbj_tpa_tsavm_nuc = NCBI_ACC(tpd, tsa_vdb_master, nuc),
+ eAcc_ddbj_tpa_tsavm_prot = NCBI_ACC(tpd, tsa_vdb_master, prot),
+ eAcc_ddbj_tpa_con = NCBI_ACC(tpd, con, nuc), //HT
+ eAcc_ddbj_tpa_wgs_nuc = NCBI_ACC(tpd, wgs, nuc), //EAAA
+ eAcc_ddbj_tpa_wgs_prot = NCBI_ACC(tpd, wgs, prot),//IAA
+ eAcc_ddbj_tpa_wgsm_nuc = NCBI_ACC(tpd, wgs_master, nuc),
+ eAcc_ddbj_tpa_wgsm_prot = NCBI_ACC(tpd, wgs_master, prot),
+ eAcc_ddbj_tpa_wgsv_nuc = NCBI_ACC(tpd, wgs_vdb_only, nuc),
+ eAcc_ddbj_tpa_wgsv_prot = NCBI_ACC(tpd, wgs_vdb_only, prot),
+ eAcc_ddbj_tpa_wgsvm_nuc = NCBI_ACC(tpd, wgs_vdb_master, nuc),
+ eAcc_ddbj_tpa_wgsvm_prot = NCBI_ACC(tpd, wgs_vdb_master, prot),
+ eAcc_ddbj_tpa_chromosome = NCBI_ACC(tpd, chromosome, nuc), //HU
+ eAcc_ddbj_tpa_targeted_nuc = NCBI_ACC(tpd, targeted, nuc), //ZAAA
+ eAcc_ddbj_tpa_targetedm_nuc = NCBI_ACC(tpd, targeted_master, nuc),
+ eAcc_ddbj_tpa_targetedv_nuc = NCBI_ACC(tpd, targeted_vdb_only, nuc),
+ eAcc_ddbj_tpa_targetedvm_nuc = NCBI_ACC(tpd, targeted_vdb_master, nuc),
// genome pipeline, modeled after RefSeq
- eAcc_gpipe_other_nuc = e_Gpipe | eAcc_other | fAcc_nuc, // GPN_
- eAcc_gpipe_prot = e_Gpipe | eAcc_other | fAcc_prot, // GPP_
- eAcc_gpipe_scaffold = e_Gpipe | eAcc_con | fAcc_nuc, // GPS_
- eAcc_gpipe_mrna = e_Gpipe | eAcc_mrna | fAcc_nuc, // GPM_
- eAcc_gpipe_chromosome = e_Gpipe | eAcc_chromosome | fAcc_nuc, // GPC_
- eAcc_gpipe_genomic = e_Gpipe | eAcc_genomic_rgn| fAcc_nuc, // GPG_
- eAcc_gpipe_ncrna = e_Gpipe | eAcc_ncrna | fAcc_nuc, // GPR_
- eAcc_gpipe_unreserved = e_Gpipe | eAcc_unreserved, // GPX_
+ eAcc_gpipe_other_nuc = NCBI_ACC(gpipe, other, nuc), // GPN_
+ eAcc_gpipe_prot = NCBI_ACC(gpipe, other, prot), // GPP_
+ eAcc_gpipe_scaffold = NCBI_ACC(gpipe, con, nuc), // GPS_
+ eAcc_gpipe_mrna = NCBI_ACC(gpipe, mrna, nuc), // GPM_
+ eAcc_gpipe_chromosome = NCBI_ACC(gpipe, chromosome, nuc), // GPC_
+ eAcc_gpipe_genomic = NCBI_ACC(gpipe, genomic_rgn, nuc), // GPG_
+ eAcc_gpipe_ncrna = NCBI_ACC(gpipe, ncrna, nuc), // GPR_
+ eAcc_gpipe_unreserved = NCBI_ACC(gpipe, unreserved, seq), // GPX_
// named annotation track; mixed nucleotides and proteins
- eAcc_named_annot_track = e_Named_annot_track | eAcc_other // AT_
+ eAcc_named_annot_track = NCBI_ACC(named_annot_track, other, seq) // AT_
+#undef NCBI_ACC
};
static E_Choice GetAccType(EAccessionInfo info)
-/* $Id: ValidErrItem.hpp 660629 2022-12-20 23:10:05Z kans $
+/* $Id: ValidErrItem.hpp 684486 2024-06-25 12:34:24Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
eErr_SEQ_INST_CircBactGenomeProblem,
eErr_SEQ_INST_ContigsTooShort,
eErr_SEQ_INST_InstantiatedGapMismatch,
+ eErr_SEQ_INST_BadSeqIdCharacter,
+ eErr_SEQ_INST_BadSeqIdLength,
ERR_CODE_END(SEQ_INST),
ERR_CODE_BEGIN(SEQ_DESCR) = 1000,
eErr_SEQ_DESCR_ChromosomeWithoutLocation,
eErr_SEQ_DESCR_TaxonomyBlankSample,
eErr_SEQ_DESCR_NonViralSegment,
+ eErr_SEQ_DESCR_BadGeoLocNameCode,
+ eErr_SEQ_DESCR_LatLonGeoLocName,
+ eErr_SEQ_DESCR_ReplacedGeoLocNameCode,
+ eErr_SEQ_DESCR_BadGeoLocNameCapitalization,
+ eErr_SEQ_DESCR_BadInstitutionGeoLocName,
+ eErr_SEQ_DESCR_MultipleIsolates,
ERR_CODE_END(SEQ_DESCR),
eErr_GENERIC_DeltaSeqError,
eErr_GENERIC_DuplicateIDs,
eErr_GENERIC_MissingPubRequirement,
+ eErr_GENERIC_BadSubmissionAuthorName,
+ eErr_GENERIC_BarcodeMissingGeoLocName,
ERR_CODE_END(GENERIC),
ERR_CODE_BEGIN(SEQ_PKG) = 3000,
public:
// destructor
- CValidErrItem(void);
- ~CValidErrItem(void);
+ CValidErrItem();
+ ~CValidErrItem();
// severity with proper type.
- EDiagSev GetSeverity (void) const;
+ EDiagSev GetSeverity() const;
// Error code
- const string GetErrCode (void) const;
- static size_t GetErrCount(void);
+ const string GetErrCode() const;
+ static size_t GetErrCount();
// Error group (SEQ_FEAT, SEQ_INST etc.)
- const string GetErrGroup (void) const;
+ const string GetErrGroup() const;
// Verbose message
- const string GetVerbose (void) const;
+ const string GetVerbose() const;
// Offending object
- const CSerialObject& GetObject (void) const;
- bool IsSetObject (void) const;
+ const CSerialObject& GetObject() const;
+ bool IsSetObject() const;
void SetObject(const CSerialObject& obj);
// Convert Severity from enum to a string representation
- static const string ConvertSeverity(EDiagSev sev);
- static const string ConvertErrCode(unsigned int);
- static const string ConvertErrGroup(unsigned int);
+ static const string& ConvertSeverity(EDiagSev sev);
+ static const string& ConvertErrCode(unsigned int);
+ static const string& ConvertErrGroup(unsigned int);
// Convert error code from string to unsigned int
static unsigned int ConvertToErrCode(const string& str);
- bool IsSetContext(void) const;
- const CSeq_entry& GetContext(void) const;
+ bool IsSetContext() const;
+ const CSeq_entry& GetContext() const;
void SetContext(CConstRef<CSeq_entry> ctx) { m_Ctx = ctx; }
// use previously populated fields to construct the "standard" description
void SetFeatureObjDescFromFields();
-private:
- friend class CValidError;
// constructor
- CValidErrItem(EDiagSev sev, // severity
- unsigned int ec, // error code
- const string& msg, // message
- const string& obj_desc, // object description
- const CSerialObject& obj, // offending object
- const string& acc, // accession
- const int ver, // version of object.
- const int seq_offset = 0); // sequence offset
-
- CValidErrItem(EDiagSev sev, // severity
- unsigned int ec, // error code
- const string& msg, // message
- const string& obj_desc, // object description
- const string& acc, // accession
- const int ver, // version of object.
- const int seq_offset = 0); // sequence offset
-
- CValidErrItem(EDiagSev sev, // severity
- unsigned int ec, // error code
- const string& msg, // message
- const string& obj_desc, // object description
- const CSerialObject& obj, // offending object
- const string& acc, // accession
- const int ver, // version of object.
- const string& feature_id, // feature ID
- const int seq_offset = 0); // sequence offset
+ CValidErrItem(
+ EDiagSev sev, // severity
+ unsigned int ec, // error code
+ const string& msg, // message
+ const string& obj_desc, // object description
+ const CSerialObject* obj, // offending object
+ const CSeq_entry* context, // desc's context.
+ const string& acc, // accession
+ const int ver, // version of object.
+ const int seq_offset = 0); // sequence offset
- // constructor
- CValidErrItem(EDiagSev sev, // severity
- unsigned int ec, // error code
- const string& msg, // message
- const string& obj_desc, // object description
- const CSerialObject& obj, // offending object
- const CSeq_entry& context, // desc's context.
- const string& acc, // accession
- const int ver, // version of object.
- const int seq_offset = 0); // sequence offset
+private:
+// friend class CValidError;
// Prohibit default & copy constructor and assignment operator
- CValidErrItem(const CValidErrItem& value);
- CValidErrItem& operator=(const CValidErrItem& value);
+ CValidErrItem(const CValidErrItem& value) = delete;
+ CValidErrItem& operator=(const CValidErrItem& value) = delete;
// member data values that are not serialized.
CConstRef<CSerialObject> m_Object; // offending object
// constructor
inline
-CValidErrItem::CValidErrItem(void)
+CValidErrItem::CValidErrItem()
{
}
inline
-EDiagSev CValidErrItem::GetSeverity(void) const
+EDiagSev CValidErrItem::GetSeverity() const
{
// convert from internal integer to external enum type.
return static_cast<EDiagSev>(GetSev());
inline
-bool CValidErrItem::IsSetContext(void) const
-{
- return m_Ctx.NotEmpty();
+bool CValidErrItem::IsSetContext() const
+{
+ return m_Ctx.NotEmpty();
}
inline
-const CSeq_entry& CValidErrItem::GetContext(void) const
-{
- return *m_Ctx;
+const CSeq_entry& CValidErrItem::GetContext() const
+{
+ return *m_Ctx;
}
-/* $Id: ValidError.hpp 657933 2022-10-20 18:09:57Z ludwigf $
+/* $Id: ValidError.hpp 682281 2024-04-25 18:00:28Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
class CSeqdesc;
class CSeq_entry;
+class NCBI_VALERR_EXPORT IValidError
+{
+public:
+ virtual ~IValidError() = default;
+
+ virtual void AddValidErrItem(
+ EDiagSev sev, // severity
+ unsigned int ec, // error code
+ const string& msg, // specific error message
+ const string& desc, // offending object's description
+ const CSerialObject& obj, // offending object
+ const string& acc, // accession of object.
+ const int ver, // version of object.
+ const string& location = kEmptyStr, // formatted location of object
+ const int seq_offset = 0) = 0;
+
+ virtual void AddValidErrItem(
+ EDiagSev sev, // severity
+ unsigned int ec, // error code
+ const string& msg, // specific error message
+ const string& desc, // offending object's description
+ const string& acc, // accession of object.
+ const int ver, // version of object.
+ const string& location = kEmptyStr, // formatted location of object
+ const int seq_offset = 0) = 0;
+
+ virtual void AddValidErrItem(
+ EDiagSev sev, // severity
+ unsigned int ec, // error code
+ const string& msg, // specific error message
+ const string& desc, // offending object's description
+ const CSeqdesc& seqdesc, // offending object
+ const CSeq_entry& ctx, // place of packaging
+ const string& acc, // accession of object or context.
+ const int ver, // version of object.
+ const int seq_offset = 0) = 0;
+
+ virtual void AddValidErrItem(
+ EDiagSev sev, // severity
+ unsigned int ec, // error code
+ const string& msg) // specific error message
+ = 0;
+
+ virtual void AddValidErrItem(CRef<CValidErrItem> item) = 0;
+};
+
/////////////////////////////////////////////////////////////////////////////
-class NCBI_VALERR_EXPORT CValidError : public CValidError_Base
+class NCBI_VALERR_EXPORT CValidError :
+ public CValidError_Base,
+ public IValidError
{
typedef CValidError_Base Tparent;
public:
// constructor
- CValidError(const CSerialObject* obj = NULL);
+ CValidError(const CSerialObject* obj = nullptr);
// destructor
- ~CValidError(void);
-
- void AddValidErrItem(EDiagSev sev, // severity
- unsigned int ec, // error code
- const string& msg, // specific error message
- const string& desc, // offending object's description
- const CSerialObject& obj, // offending object
- const string& acc, // accession of object.
- const int ver, // version of object.
- const string& location = kEmptyStr, // formatted location of object
- const int seq_offset = 0);
-
- void AddValidErrItem(EDiagSev sev, // severity
- unsigned int ec, // error code
- const string& msg, // specific error message
- const string& desc, // offending object's description
- const string& acc, // accession of object.
- const int ver, // version of object.
- const string& location = kEmptyStr, // formatted location of object
- const int seq_offset = 0);
-
- void AddValidErrItem(EDiagSev sev, // severity
- unsigned int ec, // error code
- const string& msg, // specific error message
- const string& desc, // offending object's description
- const CSerialObject& obj, // offending object
- const string& acc, // accession of object.
- const int ver, // version of object.
- const string& feature_id, // feature ID for object
- const string& location, // formatted location of object
- const int seq_offset = 0);
-
- void AddValidErrItem(EDiagSev sev, // severity
- unsigned int ec, // error code
- const string& msg, // specific error message
- const string& desc, // offending object's description
- const CSeqdesc& seqdesc, // offending object
- const CSeq_entry& ctx, // place of packaging
- const string& acc, // accession of object or context.
- const int ver, // version of object.
- const int seq_offset = 0);
-
- void AddValidErrItem(EDiagSev sev, // severity
- unsigned int ec, // error code
- const string& msg); // specific error message
-
- void AddValidErrItem(CRef<CValidErrItem> item);
+ virtual ~CValidError();
+
+ void AddValidErrItem(
+ EDiagSev sev, // severity
+ unsigned int ec, // error code
+ const string& msg, // specific error message
+ const string& desc, // offending object's description
+ const CSerialObject& obj, // offending object
+ const string& acc, // accession of object.
+ const int ver, // version of object.
+ const string& location = kEmptyStr, // formatted location of object
+ const int seq_offset = 0) final;
+
+ void AddValidErrItem(
+ EDiagSev sev, // severity
+ unsigned int ec, // error code
+ const string& msg, // specific error message
+ const string& desc, // offending object's description
+ const string& acc, // accession of object.
+ const int ver, // version of object.
+ const string& location = kEmptyStr, // formatted location of object
+ const int seq_offset = 0) final;
+
+ void AddValidErrItem(
+ EDiagSev sev, // severity
+ unsigned int ec, // error code
+ const string& msg, // specific error message
+ const string& desc, // offending object's description
+ const CSeqdesc& seqdesc, // offending object
+ const CSeq_entry& ctx, // place of packaging
+ const string& acc, // accession of object or context.
+ const int ver, // version of object.
+ const int seq_offset = 0) final;
+
+ void AddValidErrItem(
+ EDiagSev sev, // severity
+ unsigned int ec, // error code
+ const string& msg) final; // specific error message
+
+ void AddValidErrItem(CRef<CValidErrItem> item) final;
// Statistics
- SIZE_TYPE TotalSize(void) const;
+ SIZE_TYPE TotalSize() const;
SIZE_TYPE Size(EDiagSev sev) const;
- SIZE_TYPE InfoSize (void) const;
- SIZE_TYPE WarningSize (void) const;
- SIZE_TYPE ErrorSize (void) const;
- SIZE_TYPE CriticalSize(void) const;
- SIZE_TYPE FatalSize (void) const;
+ SIZE_TYPE InfoSize () const;
+ SIZE_TYPE WarningSize () const;
+ SIZE_TYPE ErrorSize () const;
+ SIZE_TYPE CriticalSize() const;
+ SIZE_TYPE FatalSize () const;
// Get the validated object (Seq-entry, Seq-submit or Seq-align)
- const CSerialObject* GetValidated(void) const;
+ const CSerialObject* GetValidated() const;
// for suppressing errors by type. Suppression list
// will be checked at the time that a AddValidErrItem
void SuppressError(unsigned int ec);
bool ShouldSuppress(unsigned int ec);
void ClearSuppressions();
-
- bool IsCatastrophic() const;
+
+ NCBI_DEPRECATED bool IsCatastrophic() const;
protected:
friend class CValidError_CI;
- typedef map<EDiagSev, SIZE_TYPE> TSevStats;
- typedef CConstRef<CSerialObject> TValidated;
- typedef CConstRef<CSeq_entry> TContext;
+ typedef map<EDiagSev, SIZE_TYPE> TSevStats;
+ typedef CConstRef<CSerialObject> TValidated;
+ typedef CConstRef<CSeq_entry> TContext;
// data
TSevStats m_Stats; // severity statistics
private:
// Prohibit copy constructor & assignment operator
- CValidError(const CValidError&);
- CValidError& operator= (const CValidError&);
-
+ CValidError(const CValidError&) = delete;
+ CValidError& operator=(const CValidError&) = delete;
};
class NCBI_VALERR_EXPORT CValidError_CI
{
public:
- CValidError_CI(void);
- CValidError_CI(const CValidError& ve,
- const string& errcode = kEmptyStr,
- EDiagSev minsev = eDiagSevMin,
- EDiagSev maxsev = eDiagSevMax);
+ CValidError_CI();
+ CValidError_CI(
+ const CValidError& ve,
+ const string& errcode = kEmptyStr,
+ EDiagSev minsev = eDiagSevMin,
+ EDiagSev maxsev = eDiagSevMax);
CValidError_CI(const CValidError_CI& iter);
- virtual ~CValidError_CI(void);
+ virtual ~CValidError_CI();
CValidError_CI& operator=(const CValidError_CI& iter);
- CValidError_CI& operator++(void);
+ CValidError_CI& operator++();
- bool IsValid(void) const;
+ bool IsValid() const;
DECLARE_OPERATOR_BOOL(IsValid());
- const CValidErrItem& operator* (void) const;
- const CValidErrItem* operator->(void) const;
+ const CValidErrItem& operator*() const;
+ const CValidErrItem* operator->() const;
private:
bool Filter(const CValidErrItem& item) const;
- bool AtEnd(void) const;
- void Next(void);
+ bool AtEnd() const;
+ void Next();
CConstRef<CValidError> m_Validator;
CValidError::TErrs::const_iterator m_Current;
// constructor
inline
-SIZE_TYPE CValidError::TotalSize(void) const
+SIZE_TYPE CValidError::TotalSize() const
{
return GetErrs().size();
}
inline
-SIZE_TYPE CValidError::Size(EDiagSev sev) const
+SIZE_TYPE CValidError::Size(EDiagSev sev) const
{
- return const_cast<CValidError*>(this)->m_Stats[sev];
+ return const_cast<CValidError*>(this)->m_Stats[sev];
}
inline
-SIZE_TYPE CValidError::InfoSize(void) const
+SIZE_TYPE CValidError::InfoSize() const
{
return Size(eDiag_Info);
}
inline
-SIZE_TYPE CValidError::WarningSize(void) const
+SIZE_TYPE CValidError::WarningSize() const
{
return Size(eDiag_Warning);
}
inline
-SIZE_TYPE CValidError::ErrorSize(void) const
+SIZE_TYPE CValidError::ErrorSize() const
{
return Size(eDiag_Error);
}
inline
-SIZE_TYPE CValidError::CriticalSize(void) const
+SIZE_TYPE CValidError::CriticalSize() const
{
return Size(eDiag_Critical);
}
inline
-SIZE_TYPE CValidError::FatalSize(void) const
+SIZE_TYPE CValidError::FatalSize() const
{
return Size(eDiag_Fatal);
}
inline
-const CSerialObject* CValidError::GetValidated(void) const
+const CSerialObject* CValidError::GetValidated() const
{
return m_Validated.GetPointerOrNull();
}
-/* $Id: align_format_util.hpp 664623 2023-03-17 12:37:00Z zaretska $
+/* $Id: align_format_util.hpp 683948 2024-06-10 12:11:11Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
///@param out: ostream to add white space
///@param number: the number of white spaces desired
///
- static void AddSpace(CNcbiOstream& out, int number);
+ static void AddSpace(CNcbiOstream& out, size_t number);
///Return ID for GNL label
///@param dtg: dbtag to build label from
///@return actual number of subject sequences
static void PruneSeqalign(const objects::CSeq_align_set& source_aln,
objects::CSeq_align_set& new_aln,
- unsigned int num = kDfltArgNumAlignments);
+ unsigned int num = static_cast<unsigned int>(kDfltArgNumAlignments));
///Calculate number of subject sequnces in alignment limitted by num
///@param source_aln: the original alnset
///Calculate the number of spaces and add them to paramVal
///@param string: input parameter value
- ///@param string: max length for the string that holds parameter
+ ///@param size_t: max length for the string that holds parameter
///@param int: additional fomatting after adding spaces
///@param string: the position of spaces and additional formatting
///@return:string containing paramVal and spaces place appropriately
- static string AddSpaces(string paramVal, unsigned int maxParamLength, int spacesFormatFlag = eSpacePosToCenter);
+ static string AddSpaces(string paramVal, size_t maxParamLength, int spacesFormatFlag = eSpacePosToCenter);
static string GetProtocol(void);
///@return: bool indicating if accession is WGS
static bool IsWGSPattern(string &wgsAccession);
- ///Get Gene symobol for gi
- ///@param giForGeneLookup: gi
- ///@return: string gene symbol
- static string GetGeneInfo(TGi giForGeneLookup);
-
-
static unique_ptr<CNcbiRegistry> m_Reg;
static string m_Protocol;
static bool m_geturl_debug_flag;
- static unique_ptr<CGeneInfoFileReader> m_GeneInfoReader;
+
/// Calculate the uniq subject query coverage range (blastn only)
static int GetUniqSeqCoverage(objects::CSeq_align_set & alnset);
-/* $Id: showalign.hpp 621514 2020-12-14 15:36:59Z grichenk $
+/* $Id: showalign.hpp 683946 2024-06-10 12:10:50Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
string feature_string;
list<TSeqPos> feature_start;
CRange < TSignedSeqPos > aln_range;
+ int genetic_code; //genetice code used to this feature if applicable
};
typedef list< CRef<SAlnFeatureInfo> > TSAlnFeatureInfoList;
///get feature info
///@param feature: where feature info to be filled
+ ///@param custom_genetic_code: use this code (set to -1 if you don't want to use this code)
///@param scope: scope to fectch sequence
///@param choice: which feature to get
///@param row: current row number
///@param feat_seq_strand: strand to be filled corresponding to feat_seq_range
///@param fill_feat_range: to fill feat_seq_range?
///
- void x_GetFeatureInfo(TSAlnFeatureInfoList& feature, objects::CScope & scope,
+ void x_GetFeatureInfo(TSAlnFeatureInfoList& feature,
+ int custom_genetic_code,
+ objects::CScope & scope,
objects::CSeqFeatData::E_Choice choice, int row,
string& sequence,
list<list<CRange<TSeqPos> > >& feat_seq_range,
void x_SetFeatureInfo(CRef<SAlnFeatureInfo> feat_info, const objects::CSeq_loc& seqloc,
int aln_from, int aln_to, int aln_stop,
char pattern_char, string pattern_id,
- string& alternative_feat_str) const;
+ string& alternative_feat_str, int genetic_code) const;
///get insert information
///@param insert_list: list to be filled
objects::CAlnMap::TSeqPosList& insert_length,
int line_aln_stop);
- ///check if Gene info is enabled and a Gene link is present for a hit
- ///@param aln_vec_info: alnvec list
- ///
- bool x_IsGeneInfoAvailable(SAlnInfo* aln_vec_info);
-
+
///get the URL of the Gene info link.
///@param gene_id: gene id to link to.
///@return: fully formatted URL of the Gene info link.
CNcbiOstream& out);
CRef<objects::CAlnVec> x_GetAlnVecForSeqalign(const objects::CSeq_align& align);
- ///Display Gene Info
- ///
- string x_DisplayGeneInfo(const objects::CBioseq_Handle& bsp_handle,SAlnInfo* aln_vec_info);
///Dipslay Bl2seq TBLASTX link
///
#ifndef OBJTOOLS_READERS_SEQDB__SEQDBATLAS_HPP
#define OBJTOOLS_READERS_SEQDB__SEQDBATLAS_HPP
-/* $Id: seqdbatlas.hpp 630682 2021-05-06 15:39:49Z fongah2 $
+/* $Id: seqdbatlas.hpp 683533 2024-05-30 12:54:51Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
#include <corelib/ncbiapp_api.hpp>
#include <objtools/blast/seqdb_reader/impl/seqdbgeneral.hpp>
-
#include <vector>
#include <map>
#include <set>
m_MappedFile = m_Atlas.GetMemoryFile(m_Filename);
m_Mapped = true;
}
- catch (const std::exception&) {
- NCBI_THROW(CSeqDBException,
- eFileErr,
- "Cannot memory map " + m_Filename + ". Number of files opened: " + NStr::IntToString(m_Atlas.GetOpenedFilseCount()));
+ catch (const std::exception& e) {
+ string err_msg = e.what();
+ if (err_msg.find("Too many open files") == std::string::npos ) {
+ NCBI_THROW(CSeqDBException, eFileErr, e.what());
+ }
+ else {
+ NCBI_THROW(CSeqDBException, eOpenFileErr, e.what());
+ }
}
m_DataPtr = (char *)(m_MappedFile->GetPtr());
#ifndef CORELIB__SEQDB__SEQDBGENERAL_HPP
#define CORELIB__SEQDB__SEQDBGENERAL_HPP
-/* $Id: seqdbgeneral.hpp 624923 2021-02-05 18:10:16Z fongah2 $
+/* $Id: seqdbgeneral.hpp 683929 2024-06-10 12:07:52Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
i++;
}
- return i;
+ return static_cast<int>(i);
}
END_NCBI_SCOPE
#ifndef OBJTOOLS_READERS_SEQDB__SEQDBISAM_HPP
#define OBJTOOLS_READERS_SEQDB__SEQDBISAM_HPP
-/* $Id: seqdbisam.hpp 626985 2021-03-08 13:57:13Z fongah2 $
+/* $Id: seqdbisam.hpp 683929 2024-06-10 12:07:52Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
for (int index=0; index < m_NumSamples; ++index) {
- keys.push_back(x_GetNumericKey(keydatap));
+ keys.push_back(static_cast<T>(x_GetNumericKey(keydatap)));
// vals.push_back(x_GetNumericData(keydatap));
offs.push_back(index * m_PageSize * m_TermSize);
keydatap += m_TermSize;
for (int index=0; index < num_keys; ++index) {
- keys.push_back(x_GetNumericKey(keydatap));
+ keys.push_back(static_cast<T>(x_GetNumericKey(keydatap)));
vals.push_back(x_GetNumericData(keydatap));
keydatap += m_TermSize;
}
#ifndef OBJTOOLS_READERS_SEQDB__SEQDBVOL_HPP
#define OBJTOOLS_READERS_SEQDB__SEQDBVOL_HPP
-/* $Id: seqdbvol.hpp 651939 2022-06-28 12:33:29Z fongah2 $
+/* $Id: seqdbvol.hpp 679614 2024-02-28 18:46:23Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
if (! have_user) {
if (m_UserGiList.NotEmpty() && m_UserGiList->HasIdFilters()) {
have_user |= x_ListIncludesId(*m_UserGiList, id);
- } else if (m_NegativeList.NotEmpty() && m_NegativeList->GetNumTaxIds() == 0 && m_NegativeList->GetNumPigs() == 0 ) {
+ } else if (m_NegativeList.NotEmpty() && m_NegativeList->HasIdFilters() ) {
have_user |= x_ListIncludesId(*m_NegativeList, id);
} else {
have_user = true;
#ifndef OBJTOOLS_BLAST_SEQDB_READER___SEQDBCOMMON__HPP
#define OBJTOOLS_BLAST_SEQDB_READER___SEQDBCOMMON__HPP
-/* $Id: seqdbcommon.hpp 651939 2022-06-28 12:33:29Z fongah2 $
+/* $Id: seqdbcommon.hpp 683533 2024-05-30 12:54:51Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
eVersionErr,
/// No Tax Id Found
- eTaxidErr
+ eTaxidErr,
+
+ /// Too many open files
+ eOpenFileErr
};
/// Get a message describing the situation leading to the throw.
switch ( GetErrCode() ) {
case eArgErr: return "eArgErr";
case eFileErr: return "eFileErr";
+ case eMemErr: return "eMemErr";
case eVersionErr: return "eVersionErr";
+ case eTaxidErr: return "eTaxidErr";
+ case eOpenFileErr: return "eOpenFileErr";
default: return CException::GetErrCodeString();
}
}
return size;
}
+ bool HasIdFilters() const
+ {
+ return (GetNumGis() || GetNumSis() || GetNumTis());
+ }
+
/// Return false if there are elements present.
bool Empty() const
{
-/* $Id: build_db.hpp 649164 2022-04-28 11:08:55Z fongah2 $
+/* $Id: build_db.hpp 675078 2023-11-14 13:36:47Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
/// @param long_seqids if true, requires long sequence ids
/// (database|accession) when parsing fasta sequences [in]
/// @param dbver version of BLAST database to generate [in]
+ /// @param scan_bioseq_4_cfastareader_usrobj [in]
+ /// If true, scan the Bioseq objects for a CFastaReader-created User-object
+ /// containing a defline
CBuildDatabase(const string & dbname,
const string & title,
bool is_protein,
bool long_seqids = false,
EBlastDbVersion dbver = eBDB_Version4,
bool limit_defline = false,
- Uint8 oid_masks = EOidMaskType::fNone);
+ Uint8 oid_masks = EOidMaskType::fNone,
+ bool scan_bioseq_4_cfastareader_usrobj = true);
// Note -- should deprecate (or just remove) the following one:
// - sparse does nothing
/// @param indexing index fields to add to database. [in]
/// @param long_seqids if true, requires long sequence ids
/// (database|accession) when parsing fasta sequences [in]
+ /// @param scan_bioseq_4_cfastareader_usrobj [in]
+ /// If true, scan the Bioseq objects for a CFastaReader-created User-object
+ /// containing a defline
CBuildDatabase(const string & dbname,
const string & title,
bool is_protein,
bool long_seqids = false,
EBlastDbVersion dbver = eBDB_Version4,
bool limit_defline = false,
- Uint8 oid_masks = EOidMaskType::fNone);
+ Uint8 oid_masks = EOidMaskType::fNone,
+ bool scan_bioseq_4_cfastareader_usrobj = true);
~CBuildDatabase();
bool m_SkipLargeGis;
string m_OutputDbName;
+
+ bool m_ScanBioseq4CFastaReaderUsrObjct;
};
END_NCBI_SCOPE
#ifndef OBJTOOLS_BLAST_SEQDB_WRITER___WRITEDB__HPP
#define OBJTOOLS_BLAST_SEQDB_WRITER___WRITEDB__HPP
-/* $Id: writedb.hpp 651607 2022-06-21 14:07:14Z fongah2 $
+/* $Id: writedb.hpp 675078 2023-11-14 13:36:47Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
/// If true, generate GI-based mask files [in]
/// @param dbver
/// version of BLAST database to generate [in]
+ /// @param scan_bioseq_4_cfastareader_usrobj [in]
+ /// If true, scan the Bioseq objects for a CFastaReader-created User-object
+ /// containing a defline
CWriteDB(const string & dbname,
ESeqType seqtype,
const string & title,
bool use_gi_mask = false,
EBlastDbVersion dbver = eBDB_Version4,
bool limit_defline = false,
- Uint8 oid_masks = EOidMaskType::fNone);
+ Uint8 oid_masks = EOidMaskType::fNone,
+ bool scan_bioseq_4_cfastareader_usrobj = false);
/// Destructor.
///
/// @param bs The bioseq from which to extract a defline set. [in]
/// @param parse_ids If seqid should be parsed [in]
/// @param long_ids It true, use long sequence ids (database|accession) [in]
+ /// @param scan_bioseq_4_cfastareader_usrobj [in]
+ /// If true, scan the Bioseq objects for a CFastaReader-created User-object
+ /// containing a defline
/// @return A set of deflines for this CBioseq.
static CRef<CBlast_def_line_set>
ExtractBioseqDeflines(const CBioseq & bs, bool parse_ids=true,
- bool long_ids=false);
+ bool long_ids=false,
+ bool scan_bioseq_4_cfastareader_usrobj=false);
/// Set letters that should not be used in sequences.
///
#ifndef _CAPITALIZATION_INSTRINGS_HPP_
#define _CAPITALIZATION_INSTRINGS_HPP_
-/* $Id: capitalization_string.hpp 582960 2019-03-21 19:22:51Z asztalos $
+/* $Id: capitalization_string.hpp 681618 2024-04-11 12:27:43Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
NCBI_CLEANUP_EXPORT void RemoveFieldNameFromString( const string& field_name, string& str);
NCBI_CLEANUP_EXPORT void GetStateAbbreviation(string& state);
+NCBI_CLEANUP_EXPORT void GetCanadaStateAbbreviation(string& state);
NCBI_CLEANUP_EXPORT bool FixStateAbbreviationsInCitSub(CCit_sub& sub);
NCBI_CLEANUP_EXPORT bool FixUSAAbbreviationInAffil(CAffil& affil);
NCBI_CLEANUP_EXPORT bool FixStateAbbreviationsInAffil(CAffil& affil);
#ifndef CLEANUP___CLEANUP__HPP
#define CLEANUP___CLEANUP__HPP
-/* $Id: cleanup.hpp 671837 2023-08-24 19:42:54Z ivanov $
+/* $Id: cleanup.hpp 681442 2024-04-09 14:53:56Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
static void SetMrnaName(CSeq_feat& mrna, const string& protein_name);
static const string& GetProteinName(const CProt_ref& prot);
static const string& GetProteinName(const CSeq_feat& cds, CSeq_entry_Handle seh);
- NCBI_DEPRECATED static const string& GetProteinName(const CSeq_feat& cds, CScope& scope);
/// Sets MolInfo::tech for a sequence
/// @param seq Bioseq to edit
static void AutodefId(CSeq_entry_Handle seh);
+ // for finding the correct amino acid letter given an abbreviation
+ static char ValidAminoAcid(string_view abbrev);
+
private:
CRef<CScope> m_Scope;
#ifndef CLEANUP___CLEANUP_CHANGE__HPP
#define CLEANUP___CLEANUP_CHANGE__HPP
-/* $Id: cleanup_change.hpp 658644 2022-11-04 14:08:42Z gotvyans $
+/* $Id: cleanup_change.hpp 674909 2023-11-08 12:38:04Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
operator bool() const { return !m_Changes.empty(); }
vector<EChanges> GetAllChanges() const;
- NCBI_DEPRECATED vector<string> GetAllDescriptions() const;
vector<string_view> GetDescriptions() const;
static string_view GetDescription(EChanges e);
+++ /dev/null
-#ifndef HUGE_FILE_CLEANUP_HPP
-#define HUGE_FILE_CLEANUP_HPP
-
-/* $Id: huge_file_cleanup.hpp 664176 2023-03-08 20:23:24Z foleyjp $
- * ===========================================================================
- *
- * PUBLIC DOMAIN NOTICE
- * National Center for Biotechnology Information
- *
- * This software/database is a "United States Government Work" under the
- * terms of the United States Copyright Act. It was written as part of
- * the author's official duties as a United States Government employee and
- * thus cannot be copyrighted. This software/database is freely available
- * to the public for use. The National Library of Medicine and the U.S.
- * Government have not placed any restriction on its use or reproduction.
- *
- * Although all reasonable efforts have been taken to ensure the accuracy
- * and reliability of the software and data, the NLM and the U.S.
- * Government do not and cannot warrant the performance or results that
- * may be obtained by using this software or data. The NLM and the U.S.
- * Government disclaim all warranties, express or implied, including
- * warranties of performance, merchantability or fitness for any particular
- * purpose.
- *
- * Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- * Author: Justin Foley
- * File Description:
- */
-
-#include <corelib/ncbistd.hpp>
-#include <corelib/ncbiobj.hpp>
-#include <objtools/edit/huge_asn_reader.hpp>
-#include <objtools/edit/huge_file_process.hpp>
-#include <objtools/cleanup/cleanup_change.hpp>
-#include <objects/general/Object_id.hpp>
-#include <objects/seqfeat/Feat_id.hpp>
-
-#include <map>
-#include <set>
-
-BEGIN_NCBI_SCOPE
-BEGIN_SCOPE(objects)
-
-class CFeat_id;
-
-class NCBI_CLEANUP_EXPORT CCleanupHugeAsnReader :
- public edit::CHugeAsnReader
-{
-public:
- enum EOptions {
- eExtendedCleanup = 1,
- eNoNcbiUserObjects = 1<<1,
- eEnableSmallGenomeSets = 1<<2,
- };
-
- using TOptions = int;
-
- CCleanupHugeAsnReader(TOptions options);
- virtual ~CCleanupHugeAsnReader() = default;
- using TParent = edit::CHugeAsnReader;
-
- void FlattenGenbankSet() override;
- CRef<CSeq_entry> LoadSeqEntry(const TBioseqSetInfo& info,
- eAddTopEntry add_top_entry = eAddTopEntry::yes) const override;
- const CCleanupChangeCore& GetChanges() const;
-
- using TFeatId = CFeat_id::TLocal::TId;
-private:
- bool x_IsExtendedCleanup() const;
- void x_SetHooks(CObjectIStream& objStream, TContext& context) override;
- void x_SetBioseqHooks(CObjectIStream& objStream, TContext& context) override;
- void x_SetBioseqSetHooks(CObjectIStream& objStream, TContext& context) override;
- void x_SetSeqFeatHooks(CObjectIStream& objStream, TContext& context);
-
- void x_RecordFeatureId(const CFeat_id& featId);
-
- void x_CreateSmallGenomeSets();
- void x_PruneIfFeatsIncomplete();
- void x_PruneAndReorderTopIds();
- void x_PruneIfSegsMissing(const string& fluLabel, const set<size_t>& segsFound);
-
- void x_CleanupTopLevelDescriptors();
- bool x_LooksLikeNucProtSet() const;
- void x_AddTopLevelDescriptors(CSeq_entry& entry) const;
- list<CRef<CSeqdesc>> m_TopLevelBiosources;
- CRef<CSeqdesc> m_pTopLevelMolInfo;
- const TOptions m_CleanupOptions;
- mutable CCleanupChangeCore m_Changes;
- using TIdToFluLabel = map<CConstRef<CSeq_id>,string,CRefLess>;
- TIdToFluLabel m_IdToFluLabel;
- TIdToFluLabel::iterator x_GetFluLabel(const CConstRef<CSeq_id>& pId);
- map<string, list<TBioseqSetInfo>> m_FluLabelToSetInfo;
- map<TFileSize, string> m_SetPosToFluLabel;
- set<CConstRef<CSeq_id>, CRefLess> m_HasIncompleteFeats;
-
-
- struct TFeatIdInfo {
- using TFeatIdMap = map<TFeatId, TFeatId>;
- using TPosToFeatIds = map<CHugeAsnReader::TStreamPos, TFeatIdMap>;
-
- set<TFeatId> ExistingIds;
- set<TFeatId> NewIds;
- set<TFeatId> NewExistingIds;
- TFeatIdMap RemappedIds;
- TFeatId IdOffset{0};
- TPosToFeatIds PosToIdMap;
- };
-
- TFeatIdInfo m_FeatIdInfo;
-};
-
-END_SCOPE(object)
-END_NCBI_SCOPE
-
-#endif /// HUGE_FILE_CLEANUP
--- /dev/null
+#ifndef _INFLUENZA_SET_HPP_
+#define _INFLUENZA_SET_HPP_
+
+/* $Id: influenza_set.hpp 680750 2024-03-27 13:48:22Z ivanov $
+ * ===========================================================================
+ *
+ * PUBLIC DOMAIN NOTICE
+ * National Center for Biotechnology Information
+ *
+ * This software/database is a "United States Government Work" under the
+ * terms of the United States Copyright Act. It was written as part of
+ * the author's official duties as a United States Government employee and
+ * thus cannot be copyrighted. This software/database is freely available
+ * to the public for use. The National Library of Medicine and the U.S.
+ * Government have not placed any restriction on its use or reproduction.
+ *
+ * Although all reasonable efforts have been taken to ensure the accuracy
+ * and reliability of the software and data, the NLM and the U.S.
+ * Government do not and cannot warrant the performance or results that
+ * may be obtained by using this software or data. The NLM and the U.S.
+ * Government disclaim all warranties, express or implied, including
+ * warranties of performance, merchantability or fitness for any particular
+ * purpose.
+ *
+ * Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ * Author:
+ *
+ * File Description:
+ *
+ * ===========================================================================
+ */
+
+#include <corelib/ncbistd.hpp>
+#include <objmgr/bioseq_handle.hpp>
+
+BEGIN_NCBI_SCOPE
+BEGIN_SCOPE(objects)
+
+class NCBI_CLEANUP_EXPORT CInfluenzaSet : public CObject {
+public:
+ CInfluenzaSet(const string& key);
+ ~CInfluenzaSet() {}
+
+ static string GetKey(const COrg_ref& org);
+ bool OkToMakeSet() const;
+ void MakeSet();
+
+ typedef enum {
+ eNotInfluenza = 0,
+ eInfluenzaA,
+ eInfluenzaB,
+ eInfluenzaC,
+ eInfluenzaD
+ } EInfluenzaType;
+
+ static EInfluenzaType GetInfluenzaType(const string& taxname);
+ static size_t GetNumRequired(EInfluenzaType fluType);
+
+ void AddBioseq(CBioseq_Handle bsh);
+
+protected:
+ typedef vector<CBioseq_Handle> TMembers;
+ TMembers m_Members;
+ const string m_Key;
+ EInfluenzaType m_FluType;
+ size_t m_Required;
+};
+
+bool NCBI_CLEANUP_EXPORT g_FindSegs(const CBioSource& src, size_t numRequired, set<size_t>& segsFound);
+
+END_SCOPE(objects)
+END_NCBI_SCOPE
+
+#endif // _INFLUENZA_SET_HPP_
#ifndef GBLOADER__HPP_INCLUDED
#define GBLOADER__HPP_INCLUDED
-/* $Id: gbloader.hpp 673835 2023-10-11 14:57:07Z ivanov $
+/* $Id: gbloader.hpp 675419 2023-11-21 19:45:39Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
class CSeqref;
class CReadDispatcher;
class CGBInfoManager;
-class CReaderParams;
// Parameter names used by loader factory
const string& web_cookie = NcbiEmptyString)
{
m_HasHUPIncluded = include_hup;
- if (include_hup && !web_cookie.empty())
- m_WebCookie = web_cookie;
+ m_WebCookie = web_cookie;
}
bool HasHUPIncluded(void) const
{
m_PSGServiceName = service_name;
}
+ bool GetUsePSG() const;
+ void SetUsePSG(bool use_psg = true)
+ {
+ m_UsePSG = use_psg;
+ m_UsePSGInitialized = true;
+ }
+
bool GetPSGNoSplit(void) const
{
return m_PSGNoSplit;
CRef<CReader> m_ReaderPtr;
const TParamTree* m_ParamTree;
EPreopenConnection m_Preopen;
+ mutable bool m_UsePSGInitialized; // can be changed in GetUsePSG()
+ mutable bool m_UsePSG;
+ bool m_PSGNoSplit;
bool m_HasHUPIncluded;
string m_WebCookie;
string m_LoaderName;
string m_PSGServiceName;
- bool m_PSGNoSplit;
+ CNullable<bool> m_EnableSNP;
+ CNullable<bool> m_EnableWGS;
+ CNullable<bool> m_EnableCDD;
friend class CGBDataLoader_Native;
- unique_ptr<CReaderParams> m_ReaderParams;
};
class NCBI_XLOADER_GENBANK_EXPORT CGBDataLoader : public CDataLoader
EIncludeHUP include_hup,
CObjectManager::EIsDefault is_default = CObjectManager::eNonDefault,
CObjectManager::TPriority priority = CObjectManager::kPriority_NotSet);
+ static string GetLoaderNameFromArgs(EIncludeHUP include_hup);
static TRegisterLoaderInfo RegisterInObjectManager(
CObjectManager& om,
EIncludeHUP include_hup,
const string& web_cookie,
CObjectManager::EIsDefault is_default = CObjectManager::eNonDefault,
CObjectManager::TPriority priority = CObjectManager::kPriority_NotSet);
- static string GetLoaderNameFromArgs(EIncludeHUP include_hup);
+ static string GetLoaderNameFromArgs(EIncludeHUP include_hup,
+ const string& web_cookie);
// GBLoader with HUP data included.
// The reader can be either pubseqos or pubseqos2.
EIncludeHUP include_hup,
CObjectManager::EIsDefault is_default = CObjectManager::eNonDefault,
CObjectManager::TPriority priority = CObjectManager::kPriority_NotSet);
+ static string GetLoaderNameFromArgs(const string& reader_name, // pubseqos or pubseqos2
+ EIncludeHUP include_hup);
static TRegisterLoaderInfo RegisterInObjectManager(
CObjectManager& om,
const string& reader_name, // pubseqos or pubseqos2
CObjectManager::EIsDefault is_default = CObjectManager::eNonDefault,
CObjectManager::TPriority priority = CObjectManager::kPriority_NotSet);
static string GetLoaderNameFromArgs(const string& reader_name, // pubseqos or pubseqos2
- EIncludeHUP include_hup);
+ EIncludeHUP include_hup,
+ const string& web_cookie);
// Setup loader using param tree. If tree is null or failed to find params,
// use environment or select default reader.
virtual bool GetTrackSplitSeq() const override;
protected:
+ template <class TDataLoader>
+ class CGBLoaderMaker : public CLoaderMaker_Base
+ {
+ public:
+ CGBLoaderMaker(const CGBLoaderParams& params)
+ : m_Params(params)
+ {
+ m_Name = CGBDataLoader::GetLoaderNameFromArgs(params);
+ }
+
+ virtual ~CGBLoaderMaker(void) {}
+
+ virtual CDataLoader* CreateLoader(void) const
+ {
+ return new TDataLoader(m_Name, m_Params);
+ }
+ typedef SRegisterLoaderInfo<CGBDataLoader> TRegisterInfo;
+ TRegisterInfo GetRegisterInfo(void)
+ {
+ TRegisterInfo info;
+ info.Set(m_RegisterInfo.GetLoader(), m_RegisterInfo.IsCreated());
+ return info;
+ }
+ protected:
+ CGBLoaderParams m_Params;
+ };
CGBDataLoader(const string& loader_name,
const CGBLoaderParams& params);
- static void SetLoaderMethod(CGBLoaderParams& params);
+ static string x_GetLoaderMethod(const TParamTree* params);
TExpirationTimeout m_IdExpirationTimeout;
#ifndef GBNATIVE__HPP_INCLUDED
#define GBNATIVE__HPP_INCLUDED
-/* $Id: gbnative.hpp 673828 2023-10-11 14:56:18Z ivanov $
+/* $Id: gbnative.hpp 675419 2023-11-21 19:45:39Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
private:
friend class CGBDataLoader;
- typedef CParamLoaderMaker<CGBDataLoader_Native, const CGBLoaderParams&> TGBMaker;
- friend class CParamLoaderMaker<CGBDataLoader_Native, const CGBLoaderParams&>;
+ friend class CGBLoaderMaker<CGBDataLoader_Native>;
TRealBlobId x_GetRealBlobId(const TBlobId& blob_id) const override;
- static TRegisterLoaderInfo ConvertRegInfo(const TGBMaker::TRegisterInfo& info);
-
CGBDataLoader_Native(const string& loader_name,
const CGBLoaderParams& params);
pair<string, string> GetReaderWriterName(const TParamTree* params, const CGBLoaderParams& loader_params) const;
bool x_CreateReaders(const string& str,
const TParamTree* params,
- const CReaderParams& reader_params,
+ const CGBLoaderParams& gb_params,
CGBLoaderParams::EPreopenConnection preopen);
void x_CreateWriters(const string& str, const TParamTree* params);
- CReader* x_CreateReader(const string& names, const CReaderParams& reader_params, const TParamTree* params = 0);
+ CReader* x_CreateReader(const string& names, const CGBLoaderParams& gb_params, const TParamTree* params = 0);
CWriter* x_CreateWriter(const string& names, const TParamTree* params = 0);
typedef CPluginManager<CReader> TReaderManager;
#define DISPATCHER__HPP_INCLUDED
/* */
-/* $Id: dispatcher.hpp 610970 2020-06-26 12:56:46Z grichenk $
+/* $Id: dispatcher.hpp 675188 2023-11-16 13:46:47Z ivanov $
* ===========================================================================
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
void InsertReader (TLevel level, CRef<CReader> reader);
void InsertWriter (TLevel level, CRef<CWriter> writer);
void InsertProcessor(CRef<CProcessor> processor);
+ bool HasReaderWithHUPIncluded() const;
CWriter* GetWriter(const CReaderRequestResult& result,
CWriter::EType type) const;
#ifndef OBJTOOLS_DATA_LOADERS_PSG___PSG_LOADER_IMPL__HPP
#define OBJTOOLS_DATA_LOADERS_PSG___PSG_LOADER_IMPL__HPP
-/* $Id: psg_loader_impl.hpp 669328 2023-06-27 13:18:16Z ivanov $
+/* $Id: psg_loader_impl.hpp 675200 2023-11-16 13:48:27Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
CPSG_Request_Biodata::EIncludeData m_TSERequestModeBulk = CPSG_Request_Biodata::eWholeTSE;
bool m_AddWGSMasterDescr = true;
shared_ptr<CPSG_Queue> m_Queue;
+ CRef<CRequestContext> m_RequestContext;
unique_ptr<CPSGBlobMap> m_BlobMap;
unique_ptr<CPSGIpgTaxIdMap> m_IpgTaxIdMap;
unique_ptr<CPSGBioseqCache> m_BioseqCache;
#ifndef OBJTOOLS_DATA_LOADERS_PSG___PSG_LOADER__HPP
#define OBJTOOLS_DATA_LOADERS_PSG___PSG_LOADER__HPP
-/* $Id: psg_loader.hpp 673827 2023-10-11 14:56:08Z ivanov $
+/* $Id: psg_loader.hpp 675419 2023-11-21 19:45:39Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
static void SetSNP_Scale_Limit(CSeq_id::ESNPScaleLimit value);
private:
- typedef CParamLoaderMaker<CPSGDataLoader, CGBLoaderParams> TMaker;
- friend class CParamLoaderMaker<CPSGDataLoader, CGBLoaderParams>;
+ friend class CGBLoaderMaker<CPSGDataLoader>;
TRealBlobId x_GetRealBlobId(const TBlobId& blob_id) const override;
- static TRegisterLoaderInfo ConvertRegInfo(const TMaker::TRegisterInfo& info);
-
// default constructor
CPSGDataLoader(void);
// parametrized constructor
#ifndef READER__HPP_INCLUDED
#define READER__HPP_INCLUDED
-/* $Id: reader.hpp 673829 2023-10-11 14:56:26Z ivanov $
+/* $Id: reader.hpp 675198 2023-11-16 13:48:10Z ivanov $
* ===========================================================================
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
struct SAnnotSelector;
-class NCBI_XREADER_EXPORT CReaderParams
+class CReaderParams
{
public:
- CReaderParams(void) {}
- ~CReaderParams(void) {}
-
bool IsSetEnableSNP(void) const { return !m_EnableSNP.IsNull(); }
bool GetEnableSNP(void) const { return m_EnableSNP.GetValue(); }
+ void SetEnableSNP(CNullable<bool> enable) { m_EnableSNP = enable; }
void SetEnableSNP(bool enable) { m_EnableSNP = enable; }
bool IsSetEnableWGS(void) const { return !m_EnableWGS.IsNull(); }
bool GetEnableWGS(void) const { return m_EnableWGS.GetValue(); }
+ void SetEnableWGS(CNullable<bool> enable) { m_EnableWGS = enable; }
void SetEnableWGS(bool enable) { m_EnableWGS = enable; }
bool IsSetEnableCDD(void) const { return !m_EnableCDD.IsNull(); }
bool GetEnableCDD(void) const { return m_EnableCDD.GetValue(); }
+ void SetEnableCDD(CNullable<bool> enable) { m_EnableCDD = enable; }
void SetEnableCDD(bool enable) { m_EnableCDD = enable; }
private:
virtual void SetIncludeHUP(bool include_hup = true,
const string& web_cookie = NcbiEmptyString);
+ bool HasHUPIncluded() const
+ {
+ return m_IncludeHUP;
+ }
virtual void SetParams(const CReaderParams& params);
// report failed or stale connection
void x_ReportDisconnect(const char* reader, const char* server,
TConn conn, bool failed) const;
+ void x_SetIncludeHUP(bool include_hup)
+ {
+ m_IncludeHUP = include_hup;
+ }
private:
friend class CReaderAllocatedConnection;
// parameters
TConn m_MaxConnections;
bool m_PreopenConnection;
+ bool m_IncludeHUP;
// current state
TConn m_NextNewConnection;
+/* $Id: eutils_updater.hpp 676881 2023-12-27 15:10:07Z sadyrovr $
+ * ===========================================================================
+ *
+ * PUBLIC DOMAIN NOTICE
+ * National Center for Biotechnology Information
+ *
+ * This software/database is a "United States Government Work" under the
+ * terms of the United States Copyright Act. It was written as part of
+ * the author's official duties as a United States Government employee and
+ * thus cannot be copyrighted. This software/database is freely available
+ * to the public for use. The National Library of Medicine and the U.S.
+ * Government have not placed any restriction on its use or reproduction.
+ *
+ * Although all reasonable efforts have been taken to ensure the accuracy
+ * and reliability of the software and data, the NLM and the U.S.
+ * Government do not and cannot warrant the performance or results that
+ * may be obtained by using this software or data. The NLM and the U.S.
+ * Government disclaim all warranties, express or implied, including
+ * warranties of performance, merchantability or fitness for any particular
+ * purpose.
+ *
+ * Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ * Author: Vitaly Stakhovsky, NCBI
+ *
+ * File Description:
+ * Pubmed Updater based on EUtils
+ *
+ * ===========================================================================
+ */
+
#ifndef _EUTILS_UPDATER_HPP_
#define _EUTILS_UPDATER_HPP_
#include <objtools/eutils/api/eutils.hpp>
-#include <objtools/edit/pubmed_updater.hpp>
+#include <corelib/ncbiobj.hpp>
BEGIN_NCBI_SCOPE
BEGIN_SCOPE(objects)
+class CPub;
+class CCit_art;
+class CPubmed_entry;
BEGIN_SCOPE(edit)
-class NCBI_XOBJEDIT_EXPORT CEUtilsUpdaterBase : public IPubmedUpdater
+enum class EPubmedError {
+ ok,
+ not_found,
+ operational_error,
+ citation_not_found,
+ citation_ambiguous,
+ cannot_connect_pmdb,
+ cannot_connect_searchbackend_pmdb,
+};
+
+NCBI_XOBJEDIT_EXPORT
+CNcbiOstream& operator<<(CNcbiOstream&, EPubmedError);
+
+struct NCBI_XOBJEDIT_EXPORT SCitMatch {
+ string Journal;
+ string Volume;
+ string Page;
+ string Year;
+ string Author;
+ string Issue;
+ string Title;
+ bool InPress = false;
+ bool Option1 = false;
+
+ void FillFromArticle(const CCit_art&);
+};
+
+using TPubInterceptor = std::function<void(CRef<CPub>&)>;
+
+class NCBI_XOBJEDIT_EXPORT CEUtilsUpdater
{
public:
- CEUtilsUpdaterBase(bool bNorm);
- TEntrezId CitMatch(const CPub&, EPubmedError* = nullptr) override;
- TEntrezId CitMatch(const SCitMatch&, EPubmedError* = nullptr) override;
- CRef<CPub> x_GetPub(TEntrezId pmid, EPubmedError*);
+ enum class ENormalize { Off, On };
+
+public:
+ CEUtilsUpdater(ENormalize = ENormalize::Off);
+ virtual ~CEUtilsUpdater() {}
+
+ virtual bool Init() { return true; }
+ virtual void Fini() {}
+ virtual TEntrezId CitMatch(const CPub&, EPubmedError* = nullptr);
+ virtual TEntrezId CitMatch(const SCitMatch&, EPubmedError* = nullptr);
+ virtual CRef<CPub> GetPubmedEntry(TEntrezId pmid, EPubmedError* = nullptr);
+ CRef<CPub> GetPub(TEntrezId pmid, EPubmedError* = nullptr);
+
+ TPubInterceptor SetPubInterceptor(TPubInterceptor f)
+ {
+ TPubInterceptor old = m_pub_interceptor;
+ m_pub_interceptor = f;
+ return old;
+ }
// Hydra replacement using citmatch api; RW-1918,RW-1999
static bool DoPubSearch(const std::vector<string>& query, std::vector<TEntrezId>& pmids);
-private:
+protected:
+ CRef<CPubmed_entry> x_GetPubmedEntry(TEntrezId pmid, EPubmedError*);
+ CRef<CPub> x_GetPub(TEntrezId pmid, EPubmedError*);
+
+protected:
CRef<CEUtils_ConnContext> m_Ctx;
- bool m_bNorm;
+ ENormalize m_Norm;
+ TPubInterceptor m_pub_interceptor = nullptr;
};
-class NCBI_XOBJEDIT_EXPORT CEUtilsUpdaterWithCache : public CEUtilsUpdaterBase
-{
- CRef<CPub> GetPub(TEntrezId pmid, EPubmedError* = nullptr) override;
+using IPubmedUpdater = CEUtilsUpdater;
+class NCBI_XOBJEDIT_EXPORT CEUtilsUpdaterWithCache : public CEUtilsUpdater
+{
public:
- CEUtilsUpdaterWithCache(bool bNorm = false) :
- CEUtilsUpdaterBase(bNorm) {}
+ CEUtilsUpdaterWithCache(ENormalize norm = ENormalize::Off) :
+ CEUtilsUpdater(norm) {}
+
+ CRef<CPub> GetPubmedEntry(TEntrezId pmid, EPubmedError* = nullptr) override;
+
void ReportStats(std::ostream&);
void ClearCache();
private:
map<TEntrezId, CConstRef<CPub>> m_cache;
- size_t m_num_requests = 0;
- size_t m_cache_hits = 0;
-};
-class NCBI_XOBJEDIT_EXPORT CEUtilsUpdater : public CEUtilsUpdaterWithCache
-{
-public:
- CEUtilsUpdater(bool bNorm = false) :
- CEUtilsUpdaterWithCache(bNorm) {}
- CRef<CPub> GetPub(TEntrezId pmid, EPubmedError* = nullptr) override;
+ size_t m_num_requests = 0;
+ size_t m_cache_hits = 0;
};
END_SCOPE(edit)
-/* $Id: feattable_edit.hpp 636221 2021-08-18 14:17:15Z ludwigf $
+/* $Id: feattable_edit.hpp 677912 2024-01-25 14:13:06Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
void xRenameFeatureId(
const CObject_id&,
FeatMap&);
-
+private:
+ void xGenerateMissingMrnaForCds(const CMappedFeat& cds);
+ void xGenerateMissingGeneForFeat(const CMappedFeat& feat);
+ void xGenerateMissingGeneForFeats(const SAnnotSelector& sel,
+ const CGff3LocationMerger* =nullptr);
+protected:
CSeq_annot& mAnnot;
unsigned int mSequenceSize;
CRef<CScope> mpScope;
-/* $Id: huge_asn_loader.hpp 661268 2023-01-07 18:04:49Z gotvyans $
-* ===========================================================================
-*
-* PUBLIC DOMAIN NOTICE
-* National Center for Biotechnology Information
-*
-* This software/database is a "United States Government Work" under the
-* terms of the United States Copyright Act. It was written as part of
-* the author's official duties as a United States Government employee and
-* thus cannot be copyrighted. This software/database is freely available
-* to the public for use. The National Library of Medicine and the U.S.
-* Government have not placed any restriction on its use or reproduction.
-*
-* Although all reasonable efforts have been taken to ensure the accuracy
-* and reliability of the software and data, the NLM and the U.S.
-* Government do not and cannot warrant the performance or results that
-* may be obtained by using this software or data. The NLM and the U.S.
-* Government disclaim all warranties, express or implied, including
-* warranties of performance, merchantability or fitness for any particular
-* purpose.
-*
-* Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-* Authors: Sergiy Gotvyanskyy
-*
-* File Description:
-*
-*
+/* $Id: huge_asn_loader.hpp 680752 2024-03-27 13:48:44Z ivanov $
*/
-
-#ifndef _HUGE_ASN_DATALOADER_HPP_INCLUDED_
-#define _HUGE_ASN_DATALOADER_HPP_INCLUDED_
-
-#include <corelib/ncbistd.hpp>
-#include <objmgr/data_loader.hpp>
-
-BEGIN_NCBI_SCOPE
-
-BEGIN_SCOPE(objects)
-
-namespace edit
-{
- class CHugeAsnReader;
- class CHugeFile;
-}
-
-BEGIN_SCOPE(edit)
-
-class NCBI_XOBJEDIT_EXPORT CHugeAsnDataLoader: public CDataLoader
-{
-public:
- typedef SRegisterLoaderInfo<CHugeAsnDataLoader> TRegisterLoaderInfo;
- CHugeAsnDataLoader(const string& name, CHugeAsnReader* reader);
- ~CHugeAsnDataLoader();
-
- static TRegisterLoaderInfo RegisterInObjectManager(
- CObjectManager& om,
- const string& loader_name,
- CHugeAsnReader* reader,
- CObjectManager::EIsDefault is_default = CObjectManager::eNonDefault,
- CObjectManager::TPriority priority = CObjectManager::kPriority_Default);
-
- TTSE_LockSet GetRecords(const CSeq_id_Handle& idh, EChoice choice) override;
- TBlobId GetBlobId(const CSeq_id_Handle& idh) override;
- TTSE_Lock GetBlobById(const TBlobId& blob_id) override;
- TSeqPos GetSequenceLength(const CSeq_id_Handle& idh) override;
- void GetIds(const CSeq_id_Handle& idh, CDataLoader::TIds& ids) override;
- CSeq_inst::TMol GetSequenceType(const CSeq_id_Handle& idh) override;
- STypeFound GetSequenceTypeFound(const CSeq_id_Handle& idh) override;
- TTaxId GetTaxId(const CSeq_id_Handle& idh) override;
-
- bool CanGetBlobById(void) const override
- {
- return true;
- }
-
-private:
- CHugeAsnReader* m_reader = nullptr;
- bool m_owning = false;
-};
-
-END_SCOPE(edit)
-END_SCOPE(objects)
-END_NCBI_SCOPE
-
-#endif // _HUGE_ASN_DATALOADER_HPP_INCLUDED_
+#include <objtools/huge_asn/huge_asn_loader.hpp>
+++ /dev/null
-/* $Id: huge_asn_macro_reader.hpp 658723 2022-11-07 18:22:37Z asztalos $
-* ===========================================================================
-*
-* PUBLIC DOMAIN NOTICE
-* National Center for Biotechnology Information
-*
-* This software/database is a "United States Government Work" under the
-* terms of the United States Copyright Act. It was written as part of
-* the author's official duties as a United States Government employee and
-* thus cannot be copyrighted. This software/database is freely available
-* to the public for use. The National Library of Medicine and the U.S.
-* Government have not placed any restriction on its use or reproduction.
-*
-* Although all reasonable efforts have been taken to ensure the accuracy
-* and reliability of the software and data, the NLM and the U.S.
-* Government do not and cannot warrant the performance or results that
-* may be obtained by using this software or data. The NLM and the U.S.
-* Government disclaim all warranties, express or implied, including
-* warranties of performance, merchantability or fitness for any particular
-* purpose.
-*
-* Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-* Authors: Sergiy Gotvyanskyy, Andrea Asztalos
-*
-* File Description:
-* Reader used in huge file mode in gbenchmacro cmd line tool
-*
-*/
-
-#ifndef _HUGE_ASN_MACRO_READER_HPP_INCLUDED_
-#define _HUGE_ASN_MACRO_READER_HPP_INCLUDED_
-
-#include <corelib/ncbistd.hpp>
-#include <objtools/edit/huge_asn_reader.hpp>
-
-BEGIN_NCBI_SCOPE
-BEGIN_SCOPE(objects)
-BEGIN_SCOPE(edit)
-
-
-class NCBI_XOBJEDIT_EXPORT CMacroHugeAsnReader : public CHugeAsnReader
-{
-public:
- void ResetTopEntry();
-};
-
-
-END_SCOPE(edit)
-END_SCOPE(objects)
-END_NCBI_SCOPE
-
-#endif // _HUGE_ASN_MACRO_READER_HPP_INCLUDED_
-
-
-/* $Id: huge_asn_reader.hpp 663759 2023-02-28 18:53:36Z foleyjp $
-* ===========================================================================
-*
-* PUBLIC DOMAIN NOTICE
-* National Center for Biotechnology Information
-*
-* This software/database is a "United States Government Work" under the
-* terms of the United States Copyright Act. It was written as part of
-* the author's official duties as a United States Government employee and
-* thus cannot be copyrighted. This software/database is freely available
-* to the public for use. The National Library of Medicine and the U.S.
-* Government have not placed any restriction on its use or reproduction.
-*
-* Although all reasonable efforts have been taken to ensure the accuracy
-* and reliability of the software and data, the NLM and the U.S.
-* Government do not and cannot warrant the performance or results that
-* may be obtained by using this software or data. The NLM and the U.S.
-* Government disclaim all warranties, express or implied, including
-* warranties of performance, merchantability or fitness for any particular
-* purpose.
-*
-* Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-* Authors: Sergiy Gotvyanskyy
-*
-* File Description:
-*
-*
+/* $Id: huge_asn_reader.hpp 680752 2024-03-27 13:48:44Z ivanov $
*/
-
-#ifndef _HUGE_ASN_READER_HPP_INCLUDED_
-#define _HUGE_ASN_READER_HPP_INCLUDED_
-
-#include <corelib/ncbistd.hpp>
-#include <corelib/ncbiutil.hpp>
-#include <objects/seqset/Seq_entry.hpp>
-#include <objects/seqset/Bioseq_set.hpp>
-#include <objects/seq/Seq_descr.hpp>
-#include <objects/submit/Submit_block.hpp>
-#include <objects/seqloc/Seq_id.hpp>
-#include <objects/seq/Seq_inst.hpp>
-#include <objects/seq/Seqdesc.hpp>
-#include <objtools/edit/huge_file.hpp>
-#include <optional>
-
-BEGIN_NCBI_SCOPE
-
-class CObjectIStream;
-
-BEGIN_SCOPE(objects)
-
-class CBioseq;
-class CSeq_submit;
-class CSeqdesc;
-
-BEGIN_SCOPE(edit)
-
-
-class NCBI_XOBJEDIT_EXPORT CHugeAsnReader: public IHugeAsnSource
-{
-public:
- using TFileSize = std::streamoff;
-
- CHugeAsnReader();
- CHugeAsnReader(CHugeFile* file, ILineErrorListener * pMessageListener);
- virtual ~CHugeAsnReader();
-
- void Open(CHugeFile* file, ILineErrorListener * pMessageListener) override;
- bool GetNextBlob() override;
- CRef<CSeq_entry> GetNextSeqEntry() override;
- CConstRef<CSubmit_block> GetSubmitBlock() const override;
- CRef<CSerialObject> ReadAny();
-
- struct TBioseqInfo;
- struct TBioseqSetInfo;
- using TBioseqSetList = std::list<TBioseqSetInfo>;
- using TBioseqList = std::list<TBioseqInfo>;
-
- struct TBioseqInfo
- {
- TFileSize m_pos;
- TBioseqSetList::const_iterator m_parent_set;
- TSeqPos m_length = -1;
- CConstRef<CSeq_descr> m_descr;
- std::list<CConstRef<CSeq_id>> m_ids;
- CSeq_inst::TMol m_mol = CSeq_inst::eMol_not_set;
- CSeq_inst::TRepr m_repr = CSeq_inst::eRepr_not_set;
- };
-
- struct TBioseqSetInfo
- {
- TFileSize m_pos;
- TBioseqSetList::const_iterator m_parent_set;
- CBioseq_set::TClass m_class = CBioseq_set::eClass_not_set;
- CConstRef<CSeq_descr> m_descr;
- bool m_HasAnnot{false};
- optional<int> m_Level;
- };
-
- using CRefLess = PPtrLess<CConstRef<CSeq_id>>;
-
- using TBioseqIndex = std::map<CConstRef<CSeq_id>, TBioseqList::const_iterator, CRefLess>;
- using TBioseqSetIndex = std::map<CConstRef<CSeq_id>, TBioseqSetList::const_iterator, CRefLess>;
-
- auto& GetBioseqs() const { return m_bioseq_list; };
- auto& GetBiosets() const { return m_bioseq_set_list; };
- auto GetFormat() const { return m_file->m_format; };
- auto GetMaxLocalId() const { return m_max_local_id; };
-
- // These metods are for CDataLoader, each top object is a 'blob'
- const TBioseqSetInfo* FindTopObject(CConstRef<CSeq_id> seqid) const;
-
- enum class eAddTopEntry{ yes, no };
- virtual CRef<CSeq_entry> LoadSeqEntry(const TBioseqSetInfo& info, eAddTopEntry add_top_entry = eAddTopEntry::yes) const;
-
- const TBioseqInfo* FindBioseq(CConstRef<CSeq_id> seqid) const;
- CConstRef<CSeqdesc> GetClosestDescriptor(const TBioseqInfo& info, CSeqdesc::E_Choice choice) const;
- CConstRef<CSeqdesc> GetClosestDescriptor(const CSeq_id& id, CSeqdesc::E_Choice choice) const;
-
- // Direct loading methods
- CRef<CSeq_entry> LoadSeqEntry(CConstRef<CSeq_id> seqid) const;
- CRef<CBioseq> LoadBioseq(CConstRef<CSeq_id> seqid) const;
-
- bool IsMultiSequence() const override;
- bool HasHugeSetAnnot() const { return m_HasHugeSetAnnot; }
- static bool IsHugeSet(CBioseq_set::TClass setClass);
-
-
- virtual void FlattenGenbankSet();
- auto& GetTopEntry() const { return m_top_entry; }
- auto& GetFlattenedIndex() const { return m_FlattenedIndex; }
- auto& GetTopIds() const { return m_top_ids; }
- unique_ptr<CObjectIStream> MakeObjStream(TFileSize pos) const;
-
- const CBioseq_set::TClass* GetTopLevelClass() const;
-protected:
- // temporary structure for indexing
- struct TBioseqInfoRec
- {
- list<CConstRef<CSeq_id>> m_ids;
- TSeqPos m_length = 0;
- CRef<CSeq_descr> m_descr;
- CSeq_inst::TMol m_mol = CSeq_inst::eMol_not_set;
- CSeq_inst::TRepr m_repr = CSeq_inst::eRepr_not_set;
- };
-
- struct TContext
- {
- std::deque<TBioseqInfoRec> bioseq_stack;
- std::deque<TBioseqSetList::iterator> bioseq_set_stack;
- };
-
- virtual void x_SetHooks(CObjectIStream& objStream, TContext& context);
- virtual void x_SetFeatIdHooks(CObjectIStream& objStream, TContext& context);
- virtual void x_SetBioseqHooks(CObjectIStream& objStream, TContext& context);
- virtual void x_SetBioseqSetHooks(CObjectIStream& objStream, TContext& context);
-
- void x_ResetTopEntry();
- using TStreamPos = streampos;
- TStreamPos GetCurrentPos() const;
-
-
-private:
- void x_ResetIndex();
- void x_IndexNextAsn1();
- void x_ThrowDuplicateId(
- const TBioseqSetInfo& existingInfo,const TBioseqSetInfo& newInfo, const CSeq_id& duplicateId);
-
- CRef<CSeq_descr> x_GetTopLevelDescriptors() const;
- bool x_HasNestedGenbankSets() const;
-
-
- ILineErrorListener * mp_MessageListener = nullptr;
- TStreamPos m_current_pos = 0; // points to current blob in concatenated ASN.1 file
- CHugeFile* m_file = nullptr;
-
-// global lists, readonly after indexing
-protected:
- TBioseqList m_bioseq_list;
- TStreamPos m_next_pos = 0; // points to next unprocessed blob in concatenated ASN.1 file
- int m_max_local_id = 0;
- TBioseqSetList m_bioseq_set_list;
- CRef<CSeq_entry> m_top_entry;
- std::list<CConstRef<CSeq_id>> m_top_ids;
- bool m_HasHugeSetAnnot{ false };
-private:
- CConstRef<CSubmit_block> m_submit_block;
-
-// flattenization structures, readonly after flattenization, accept m_Current
- TBioseqIndex m_bioseq_index;
- TBioseqSetIndex m_FlattenedIndex;
- TBioseqSetList m_FlattenedSets;
- TBioseqSetList::const_iterator m_Current;
- const CBioseq_set::TClass* m_pTopLevelClass { nullptr };
-};
-
-END_SCOPE(edit)
-END_SCOPE(objects)
-END_NCBI_SCOPE
-
-#endif // _HUGE_ASN_READER_HPP_INCLUDED_
+#include <objtools/huge_asn/huge_asn_reader.hpp>
-/* $Id: huge_file.hpp 671844 2023-08-24 20:01:10Z ivanov $
-* ===========================================================================
-*
-* PUBLIC DOMAIN NOTICE
-* National Center for Biotechnology Information
-*
-* This software/database is a "United States Government Work" under the
-* terms of the United States Copyright Act. It was written as part of
-* the author's official duties as a United States Government employee and
-* thus cannot be copyrighted. This software/database is freely available
-* to the public for use. The National Library of Medicine and the U.S.
-* Government have not placed any restriction on its use or reproduction.
-*
-* Although all reasonable efforts have been taken to ensure the accuracy
-* and reliability of the software and data, the NLM and the U.S.
-* Government do not and cannot warrant the performance or results that
-* may be obtained by using this software or data. The NLM and the U.S.
-* Government disclaim all warranties, express or implied, including
-* warranties of performance, merchantability or fitness for any particular
-* purpose.
-*
-* Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-* Authors: Sergiy Gotvyanskyy
-*
-* File Description:
-*
-*
+/* $Id: huge_file.hpp 680752 2024-03-27 13:48:44Z ivanov $
*/
-
-#ifndef _HUGE_FILE_HPP_INCLUDED_
-#define _HUGE_FILE_HPP_INCLUDED_
-
-#include <corelib/ncbistd.hpp>
-#include <corelib/ncbiobj.hpp>
-#include <serial/serialdef.hpp>
-#include <util/format_guess.hpp>
-
-BEGIN_NCBI_SCOPE
-
-class CMemoryFile;
-class CObjectIStream;
-
-BEGIN_SCOPE(objects)
-
-class CSeq_entry;
-class CSeq_submit;
-class CSubmit_block;
-class ILineErrorListener;
-
-BEGIN_SCOPE(edit)
-
-class NCBI_XOBJEDIT_EXPORT CHugeFile
-{
-public:
- CHugeFile();
- virtual ~CHugeFile();
- const set<TTypeInfo>* m_supported_types = nullptr;
-
- std::unique_ptr<CMemoryFile> m_memfile;
- std::unique_ptr<std::istream> m_stream;
- std::unique_ptr<std::streambuf> m_streambuf;
- std::string m_filename;
- const char* m_memory = nullptr;
- std::streampos m_filesize = 0;
-
- ESerialDataFormat m_serial_format = eSerial_None;
- CFormatGuess::EFormat m_format = CFormatGuess::eUnknown;
- TTypeInfo m_content = nullptr;
-
- class CMemoryStreamBuf: public std::streambuf
- {
- public:
- CMemoryStreamBuf(const char* ptr, size_t size)
- {
- setg((char*)ptr, (char*)ptr, (char*)ptr+size);
- }
- };
-
- void Reset();
- void Open(const std::string& filename, const set<TTypeInfo>* supported_types);
- bool IsOpen() const { return m_filesize != 0; }
- TTypeInfo RecognizeContent(std::streampos pos);
- TTypeInfo RecognizeContent(std::istream& istr);
- unique_ptr<CObjectIStream> MakeObjStream(std::streampos pos = 0) const;
-
-private:
- bool x_TryOpenStreamFile(const string& filename, std::streampos filesize);
- bool x_TryOpenMemoryFile(const string& filename, std::streampos filesize);
-};
-
-class NCBI_XOBJEDIT_EXPORT CHugeFileException : public CException
-{
-public:
- enum EErrCode
- {
- eDuplicateSeqIds,
- eDuplicateFeatureIds,
- };
- //virtual const char* GetErrCodeString(void) const override;
- NCBI_EXCEPTION_DEFAULT(CHugeFileException,CException);
-};
-
-class NCBI_XOBJEDIT_EXPORT IHugeAsnSource
-{
-public:
- virtual void Open(CHugeFile* file, ILineErrorListener * pMessageListener) = 0;
- virtual bool GetNextBlob() = 0;
- virtual CRef<CSeq_entry> GetNextSeqEntry() = 0;
- virtual bool IsMultiSequence() const = 0;
- virtual CConstRef<CSubmit_block> GetSubmitBlock() const = 0;
- virtual ~IHugeAsnSource(){};
-protected:
- IHugeAsnSource(){};
-};
-
-END_SCOPE(edit)
-END_SCOPE(objects)
-END_NCBI_SCOPE
-
-#endif // _HUGE_ASN_READER_HPP_INCLUDED_
+#include <objtools/huge_asn/huge_file.hpp>
-#ifndef HUGE_FILE_PROCESS_HPP
-#define HUGE_FILE_PROCESS_HPP
-
-/* $Id: huge_file_process.hpp 661438 2023-01-11 15:47:11Z gotvyans $
- * ===========================================================================
- *
- * PUBLIC DOMAIN NOTICE
- * National Center for Biotechnology Information
- *
- * This software/database is a "United States Government Work" under the
- * terms of the United States Copyright Act. It was written as part of
- * the author's official duties as a United States Government employee and
- * thus cannot be copyrighted. This software/database is freely available
- * to the public for use. The National Library of Medicine and the U.S.
- * Government have not placed any restriction on its use or reproduction.
- *
- * Although all reasonable efforts have been taken to ensure the accuracy
- * and reliability of the software and data, the NLM and the U.S.
- * Government do not and cannot warrant the performance or results that
- * may be obtained by using this software or data. The NLM and the U.S.
- * Government disclaim all warranties, express or implied, including
- * warranties of performance, merchantability or fitness for any particular
- * purpose.
- *
- * Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- * Author: Mati Shomrat
- * File Description:
- * Utility class for processing Genbank release files.
- */
-
-#include <corelib/ncbistd.hpp>
-#include <corelib/ncbiobj.hpp>
-#include <serial/serialdef.hpp>
-
-BEGIN_NCBI_SCOPE
-
-/// forward declarations
-class CObjectIStream;
-BEGIN_SCOPE(objects)
-
-class CScope;
-class CSeq_entry_Handle;
-class CBioseq_Handle;
-class CSubmit_block;
-class CSeq_entry;
-class CSeq_id;
-
-BEGIN_SCOPE(edit)
-class CHugeFile;
-class CHugeAsnReader;
-
-class NCBI_XOBJEDIT_EXPORT CHugeFileProcess
-{
-public:
-
- static const set<TTypeInfo> g_supported_types;
-
- /// constructors
- CHugeFileProcess();
- CHugeFileProcess(CHugeAsnReader* pReader);
- CHugeFileProcess(const string& file_name, const set<TTypeInfo>* types = &g_supported_types);
- /// destructor
- virtual ~CHugeFileProcess(void);
- void Open(const string& file_name, const set<TTypeInfo>* types = &g_supported_types);
- void OpenFile(const string& file_name);
- void OpenFile(const string& file_name, const set<TTypeInfo>* types);
- void OpenReader();
-
- using THandler = std::function<void(CConstRef<CSubmit_block>, CRef<CSeq_entry>)>;
- using THandlerIds = std::function<bool(CHugeAsnReader*, const std::list<CConstRef<CSeq_id>>&)>;
- using THandlerBlobs = std::function<bool(CHugeFileProcess&)>;
- using THandlerEntries = std::function<bool(CSeq_entry_Handle& seh)>;
-
- [[nodiscard]] bool Read(THandler handler, CRef<CSeq_id> seqid);
- [[nodiscard]] bool Read(THandlerIds handler);
- [[nodiscard]] bool ForEachBlob(THandlerBlobs);
- [[nodiscard]] bool ForEachEntry(CRef<CScope> scope, THandlerEntries handler);
- [[nodiscard]] bool ReadNextBlob();
- static CSeq_entry_Handle GetTopLevelEntry(CBioseq_Handle beh);
-
- CHugeAsnReader& GetReader() { return *m_pReader; }
- CHugeFile& GetFile() { return *m_pHugeFile; }
- const CHugeFile& GetConstFile() const { return *m_pHugeFile; }
- static bool IsSupported(TTypeInfo info);
-
-private:
- unique_ptr<CHugeFile> m_pHugeFile;
- unique_ptr<CHugeAsnReader> m_pReader;
-};
-
-END_SCOPE(edit)
-END_SCOPE(object)
-END_NCBI_SCOPE
-
-#endif /// NEW_GB_RELEASE_FILE__HPP
+/* $Id: huge_file_process.hpp 680752 2024-03-27 13:48:44Z ivanov $
+*/
+#include <objtools/huge_asn/huge_file_process.hpp>
#ifndef _PUB_FIX_HPP_
#define _PUB_FIX_HPP_
-/* $Id: pub_fix.hpp 644550 2022-01-28 20:22:33Z stakhovv $
+/* $Id: pub_fix.hpp 676568 2023-12-18 19:55:19Z sadyrovr $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
#include <corelib/ncbistd.hpp>
#include <corelib/ncbiobj.hpp>
-#include <objtools/edit/pubmed_updater.hpp>
+#include <objtools/edit/eutils_updater.hpp>
BEGIN_NCBI_SCOPE
{
public:
- CPubFix(bool always_lookup, bool replace_cit, bool merge_ids, IMessageListener* err_log, IPubmedUpdater* upd) :
+ CPubFix(bool always_lookup, bool replace_cit, bool merge_ids, IMessageListener* err_log, CEUtilsUpdater* upd) :
m_always_lookup(always_lookup),
m_replace_cit(replace_cit),
m_merge_ids(merge_ids),
void FixPubEquiv(CPub_equiv& pub_equiv);
const CAuthListValidator& GetValidator() const { return m_authlist_validator; };
- static CRef<CCit_art> FetchPubPmId(TEntrezId pmid, IPubmedUpdater*);
+ static CRef<CCit_art> FetchPubPmId(TEntrezId pmid, CEUtilsUpdater*);
static string GetErrorId(int code, int subcode);
private:
IMessageListener* m_err_log;
CAuthListValidator m_authlist_validator;
- IPubmedUpdater* m_upd;
+ CEUtilsUpdater* m_upd;
};
END_SCOPE(edit)
-/* $Id: pubmed_updater.hpp 672329 2023-09-05 18:18:20Z ivanov $
- * ===========================================================================
- *
- * PUBLIC DOMAIN NOTICE
- * National Center for Biotechnology Information
- *
- * This software/database is a "United States Government Work" under the
- * terms of the United States Copyright Act. It was written as part of
- * the author's official duties as a United States Government employee and
- * thus cannot be copyrighted. This software/database is freely available
- * to the public for use. The National Library of Medicine and the U.S.
- * Government have not placed any restriction on its use or reproduction.
- *
- * Although all reasonable efforts have been taken to ensure the accuracy
- * and reliability of the software and data, the NLM and the U.S.
- * Government do not and cannot warrant the performance or results that
- * may be obtained by using this software or data. The NLM and the U.S.
- * Government disclaim all warranties, express or implied, including
- * warranties of performance, merchantability or fitness for any particular
- * purpose.
- *
- * Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- * Author:
- *
- * File Description:
- *
- * ===========================================================================
- */
-
-#ifndef _PUBMED_UPDATER_HPP_
-#define _PUBMED_UPDATER_HPP_
-
-#include <corelib/ncbiobj.hpp>
-
-BEGIN_NCBI_SCOPE
-BEGIN_SCOPE(objects)
-
-class CPub;
-
-BEGIN_SCOPE(edit)
-
-enum class EPubmedError {
- ok,
- not_found,
- operational_error,
- citation_not_found,
- citation_ambiguous,
- cannot_connect_pmdb,
- cannot_connect_searchbackend_pmdb,
-};
-
-NCBI_XOBJEDIT_EXPORT
-CNcbiOstream& operator<<(CNcbiOstream& os, EPubmedError err);
-
-struct NCBI_XOBJEDIT_EXPORT SCitMatch {
- string Journal;
- string Volume;
- string Page;
- string Year;
- string Author;
- string Issue;
- string Title;
- bool InPress = false;
- bool Option1 = false;
-};
-
-using TPubInterceptor = std::function<void(CRef<CPub>&)>;
-
-class NCBI_XOBJEDIT_EXPORT IPubmedUpdater
-{
-public:
- virtual ~IPubmedUpdater() {}
- virtual bool Init() { return true; }
- virtual void Fini() {}
- virtual TEntrezId CitMatch(const CPub&, EPubmedError* = nullptr) = 0;
- virtual TEntrezId CitMatch(const SCitMatch&, EPubmedError* = nullptr) = 0;
- virtual CRef<CPub> GetPub(TEntrezId pmid, EPubmedError* = nullptr) = 0;
-
- void SetPubInterceptor(TPubInterceptor f)
- {
- m_pub_interceptor = f;
- }
- static void Normalize(CPub&);
-
-protected:
- TPubInterceptor m_pub_interceptor = nullptr;
-};
-
-END_SCOPE(edit)
-END_SCOPE(objects)
-END_NCBI_SCOPE
-
-#endif // _PUBMED_UPDATER_HPP_
+#pragma message("<pubmed_updater.hpp> is obsolete. Use <eutils_updater.hpp> instead!")
+#include "eutils_updater.hpp"
-/* $Id: remote_updater.hpp 669945 2023-07-13 19:23:06Z ivanov $
-* ===========================================================================
-*
-* PUBLIC DOMAIN NOTICE
-* National Center for Biotechnology Information
-*
-* This software/database is a "United States Government Work" under the
-* terms of the United States Copyright Act. It was written as part of
-* the author's official duties as a United States Government employee and
-* thus cannot be copyrighted. This software/database is freely available
-* to the public for use. The National Library of Medicine and the U.S.
-* Government have not placed any restriction on its use or reproduction.
-*
-* Although all reasonable efforts have been taken to ensure the accuracy
-* and reliability of the software and data, the NLM and the U.S.
-* Government do not and cannot warrant the performance or results that
-* may be obtained by using this software or data. The NLM and the U.S.
-* Government disclaim all warranties, express or implied, including
-* warranties of performance, merchantability or fitness for any particular
-* purpose.
-*
-* Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-* Authors: Sergiy Gotvyanskyy, NCBI
-* Colleen Bolin, NCBI
-*
-* File Description:
-* Front-end class for making remote request to MLA and taxon
-*
-* ===========================================================================
-*/
+/* $Id: remote_updater.hpp 677028 2024-01-03 14:08:01Z ivanov $
+ * ===========================================================================
+ *
+ * PUBLIC DOMAIN NOTICE
+ * National Center for Biotechnology Information
+ *
+ * This software/database is a "United States Government Work" under the
+ * terms of the United States Copyright Act. It was written as part of
+ * the author's official duties as a United States Government employee and
+ * thus cannot be copyrighted. This software/database is freely available
+ * to the public for use. The National Library of Medicine and the U.S.
+ * Government have not placed any restriction on its use or reproduction.
+ *
+ * Although all reasonable efforts have been taken to ensure the accuracy
+ * and reliability of the software and data, the NLM and the U.S.
+ * Government do not and cannot warrant the performance or results that
+ * may be obtained by using this software or data. The NLM and the U.S.
+ * Government disclaim all warranties, express or implied, including
+ * warranties of performance, merchantability or fitness for any particular
+ * purpose.
+ *
+ * Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ * Authors: Sergiy Gotvyanskyy, NCBI
+ * Colleen Bolin, NCBI
+ *
+ * File Description:
+ * Front-end class for making remote request to MLA and taxon
+ *
+ * ===========================================================================
+ */
#ifndef __REMOTE_UPDATER_HPP_INCLUDED__
#define __REMOTE_UPDATER_HPP_INCLUDED__
#include <corelib/ncbimisc.hpp>
#include <functional>
+#include <objects/pub/Pub.hpp>
#include <objtools/edit/edit_error.hpp>
-#include <objtools/edit/pubmed_updater.hpp>
+#include <objtools/edit/eutils_updater.hpp>
#include <objects/taxon3/itaxon3.hpp>
#include <mutex>
class COrg_ref;
class CAuth_list;
class IObjtoolsListener;
-class CPub;
class CPubdesc;
class CTaxon3_reply;
enum class EPubmedSource
{
- eNone,
eEUtils,
- eMLA, // deprecated; same as eEUtils
};
class CCachedTaxon3_impl;
// With this constructor, failure to retrieve
// a publication for a PMID is logged with the supplied message listener.
// If no message listener is supplied, an exception is thrown.
- CRemoteUpdater(IObjtoolsListener* pMessageListener, EPubmedSource = EPubmedSource::eEUtils, bool bNormalize = false);
- CRemoteUpdater(FLogger logger, EPubmedSource = EPubmedSource::eEUtils, bool bNormalize = false);
+ CRemoteUpdater(IObjtoolsListener* pMessageListener, CEUtilsUpdater::ENormalize = CEUtilsUpdater::ENormalize::Off);
+ // NCBI_DEPRECATED
+ CRemoteUpdater(FLogger logger, CEUtilsUpdater::ENormalize norm = CEUtilsUpdater::ENormalize::Off);
+ NCBI_DEPRECATED
+ CRemoteUpdater(IObjtoolsListener* pMessageListener, EPubmedSource, CEUtilsUpdater::ENormalize norm = CEUtilsUpdater::ENormalize::Off) :
+ CRemoteUpdater(pMessageListener, norm)
+ {
+ }
+ NCBI_DEPRECATED
+ CRemoteUpdater(FLogger logger, EPubmedSource, CEUtilsUpdater::ENormalize norm = CEUtilsUpdater::ENormalize::Off) :
+ CRemoteUpdater(logger, norm)
+ {
+ }
~CRemoteUpdater();
void UpdatePubReferences(CSerialObject& obj);
void UpdatePubReferences(CSeq_entry_EditHandle& obj);
void SetMaxMlaAttempts(int max);
- CConstRef<CTaxon3_reply> SendOrgRefList(const vector<CRef<COrg_ref>>& list);
+ // Specify flavor of updated CPub: CMedline_entry or CCit_art
+ void SetPubReturnType(CPub::E_Choice t)
+ {
+ if (t == CPub::e_Medline || t == CPub::e_Article) {
+ m_pm_pub_type = t;
+ } else {
+ throw std::invalid_argument("invalid CPub choice");
+ }
+ }
- // These methods are deprecated, please use CRemoteUpdater constructor to specify logger
- NCBI_DEPRECATED void UpdateOrgFromTaxon(FLogger f_logger, CSeq_entry& entry);
- NCBI_DEPRECATED void UpdateOrgFromTaxon(FLogger f_logger, CSeq_entry_EditHandle& obj);
- NCBI_DEPRECATED void UpdateOrgFromTaxon(FLogger f_logger, CSeqdesc& obj);
+ CConstRef<CTaxon3_reply> SendOrgRefList(const vector<CRef<COrg_ref>>& list);
void UpdateOrgFromTaxon(CSeq_entry& entry);
void UpdateOrgFromTaxon(CSeqdesc& desc);
static void PostProcessPubs(CSeq_entry& obj);
static void PostProcessPubs(CPubdesc& pubdesc);
- void SetPubmedClient(IPubmedUpdater*);
+ void SetPubmedClient(CEUtilsUpdater*);
// Use either shared singleton or individual instances
NCBI_DEPRECATED static CRemoteUpdater& GetInstance();
void ReportStats(std::ostream& str);
private:
void xUpdatePubReferences(CSeq_entry& entry);
void xUpdatePubReferences(CSeq_descr& descr);
- void xUpdateOrgTaxname(COrg_ref& org, FLogger logger);
+ void xUpdateOrgTaxname(COrg_ref& org);
bool xUpdatePubPMID(list<CRef<CPub>>& pubs, TEntrezId id);
bool xSetFromConfig();
void xInitTaxCache();
IObjtoolsListener* m_pMessageListener = nullptr;
FLogger m_logger = nullptr; // wrapper for compatibility between IObjtoolsListener and old FLogger
- EPubmedSource m_pm_source = EPubmedSource::eNone;
string m_pm_url;
- unique_ptr<IPubmedUpdater> m_pubmed;
+ unique_ptr<CEUtilsUpdater> m_pubmed;
bool m_pm_use_cache = true;
- bool m_pm_normalize = false;
+ CEUtilsUpdater::ENormalize m_pm_normalize = CEUtilsUpdater::ENormalize::Off;
TPubInterceptor m_pm_interceptor = nullptr;
+ CPub::E_Choice m_pm_pub_type = CPub::e_Article;
unique_ptr<CCachedTaxon3_impl> m_taxClient;
taxupdate_func_t m_taxon_update;
#ifndef OBJTOOLS_FORMAT___FLAT_FILE_CONFIG__HPP
#define OBJTOOLS_FORMAT___FLAT_FILE_CONFIG__HPP
-/* $Id: flat_file_config.hpp 665626 2023-04-10 15:10:28Z kans $
+/* $Id: flat_file_config.hpp 676886 2023-12-27 15:10:53Z sadyrovr $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
fShowDeflineModifiers = 1 << 17,
fDoNotUseAutoDef = 1 << 18,
fOldTpaDisplay = 1 << 19,
- fDisableDefaultIndex = 1 << 20
+ fDisableDefaultIndex = 1 << 20,
+ fGeoLocNameCountry = 1 << 21
};
enum EView {
bool DoNotUseAutoDef (void) const;
bool OldTpaDisplay (void) const;
bool DisableDefaultIndex (void) const;
+ bool GeoLocNameCountry (void) const;
// setters
void SetCustom(const TCustom& custom) { m_Custom = custom; }
CFlatFileConfig& SetDoNotUseAutoDef (bool val = true);
CFlatFileConfig& SetOldTpaDisplay (bool val = true);
CFlatFileConfig& SetDisableDefaultIndex (bool val = true);
+ CFlatFileConfig& SetGeoLocNameCountry (bool val = true);
// adjust mode dependant flags for RefSeq
void SetRefSeqConventions(void);
CUSTOM_ARG_IMP(DoNotUseAutoDef)
CUSTOM_ARG_IMP(OldTpaDisplay)
CUSTOM_ARG_IMP(DisableDefaultIndex)
+CUSTOM_ARG_IMP(GeoLocNameCountry)
#undef FLAG_ARG_IMP
#undef FLAG_ARG_GET
#ifndef OBJTOOLS_FORMAT_ITEMS___SOURCE_ITEM__HPP
#define OBJTOOLS_FORMAT_ITEMS___SOURCE_ITEM__HPP
-/* $Id: source_item.hpp 665891 2023-04-17 14:20:00Z gotvyans $
+/* $Id: source_item.hpp 675921 2023-12-05 13:47:36Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
EItem GetItemType() const override;
private:
void x_GatherInfo(CBioseqContext& ctx) override;
- void x_GatherInfoIdx(CBioseqContext& ctx);
void x_GatherInfo(CBioseqContext& ctx, const CBioSource& bsrc, const CSerialObject& obj);
// Populate the object based on the source of the data
#ifndef OBJTOOLS__PUBSEQ_GATEWAY__CLIENT__IMPL__MISC__HPP
#define OBJTOOLS__PUBSEQ_GATEWAY__CLIENT__IMPL__MISC__HPP
-/* $Id: misc.hpp 672386 2023-09-06 18:53:41Z ivanov $
+/* $Id: misc.hpp 675367 2023-11-20 16:22:48Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
NCBI_PARAM_DECL(double, PSG, no_servers_retry_delay);
typedef NCBI_PARAM_TYPE(PSG, no_servers_retry_delay) TPSG_NoServersRetryDelay;
+NCBI_PARAM_DECL(string, PSG, service);
+using TPSG_Service = NCBI_PARAM_TYPE(PSG, service);
+
NCBI_PARAM_DECL(string, PSG, auth_token_name);
using TPSG_AuthTokenName = PSG_PARAM_VALUE_TYPE(PSG, auth_token_name);
#ifndef OBJTOOLS__PUBSEQ_GATEWAY__PSG_CLIENT_HPP
#define OBJTOOLS__PUBSEQ_GATEWAY__PSG_CLIENT_HPP
-/* $Id: psg_client.hpp 666909 2023-05-03 21:33:24Z sadyrovr $
+/* $Id: psg_client.hpp 675367 2023-11-20 16:22:48Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
eIpgResolve,
};
+ enum EFlags {
+ fExcludeHUP = (0 << 0),
+ fIncludeHUP = (1 << 0),
+ eDefaultFlags = fExcludeHUP
+ };
+ DECLARE_SAFE_FLAGS_TYPE(EFlags, TFlags);
+ using TOptionalFlags = CNullable<TFlags>;
+
/// Get the user-provided context
template<typename TUserContext>
shared_ptr<TUserContext> GetUserContext() const
// Get request ID
string GetId() const { return x_GetId(); }
+ /// Set flags
+ void SetFlags(TOptionalFlags flags) { m_Flags = move(flags); }
+
/// Set arbitrary URL arguments to add to this request.
/// @code
/// request->SetUserArgs("param1=value1¶m1=value2¶m2=value3");
shared_ptr<void> m_UserContext;
CRef<CRequestContext> m_RequestContext;
+ TOptionalFlags m_Flags;
SPSG_UserArgs m_UserArgs;
friend class CPSG_Queue;
eCanceled,
eTimeout,
eError,
+ eUnauthorized,
eUnknown,
};
/// @param service
/// Either a name of service (which can be resolved into a set of PSG
/// servers) or a single fixed PSG server (in format "host:port")
+ /// or empty value to use one from configuration file/environment/default.
CPSG_Queue(const string& service);
~CPSG_Queue();
bool RejectsRequests() const;
+ /// Set request flags
+ void SetRequestFlags(CPSG_Request::TFlags request_flags);
+
+
/// Set arbitrary URL arguments to add to every request.
/// @code
/// queue.SetUserArgs("param1=value1¶m1=value2¶m2=value3");
/// @param service
/// Either a name of service (which can be resolved into a set of PSG
/// servers) or a single fixed PSG server (in format "host:port")
+ /// or empty value to use one from configuration file/environment/default.
/// @param item_complete
/// Mandatory user callback to call when an item is complete (i.e. not eInProgress)
/// @param reply_complete
}
+DECLARE_SAFE_FLAGS(CPSG_Request::EFlags);
DECLARE_SAFE_FLAGS(CPSG_Request_Resolve::EIncludeInfo);
END_NCBI_SCOPE
#ifndef OBJTOOLS_READERS___AGP_UTIL__HPP
#define OBJTOOLS_READERS___AGP_UTIL__HPP
-/* $Id: agp_util.hpp 670811 2023-08-01 15:20:36Z ivanov $
+/* $Id: agp_util.hpp 678441 2024-02-05 19:56:54Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
eGapShort_arm ,
eGapHeterochromatin,
eGapTelomere ,
+ eGapUnknown ,
eGapCount,
eGapYes_count=eGapContamination+1
#ifndef OBJTOOLS_READERS___FASTA__HPP
#define OBJTOOLS_READERS___FASTA__HPP
-/* $Id: fasta.hpp 673190 2023-09-25 14:08:51Z ivanov $
+/* $Id: fasta.hpp 680777 2024-03-27 13:52:05Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
TSeqPos pos = m_CurrentPos;
switch (pos_type) {
case ePosWithGapsAndSegs:
- pos += m_SegmentBase;
- // FALL THROUGH!!
+ return pos + m_SegmentBase + m_TotalGapLength;
case ePosWithGaps:
- pos += m_TotalGapLength;
- // FALL THROUGH!!
+ return pos + m_TotalGapLength;
case eRawPos:
return pos;
default:
#ifndef OBJTOOLS_READERS___FASTA_EXCEPTION__HPP
#define OBJTOOLS_READERS___FASTA_EXCEPTION__HPP
-/* $Id: fasta_exception.hpp 671848 2023-08-24 20:01:29Z ivanov $
+/* $Id: fasta_exception.hpp 680775 2024-03-27 13:51:53Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
* Exceptions for CFastaReader.
*/
-#include <objtools/readers/reader_exception.hpp>
-#include <objects/seqloc/Seq_id.hpp>
+#include <corelib/ncbiexpt.hpp>
+#include <corelib/ncbiobj.hpp>
BEGIN_NCBI_SCOPE
BEGIN_SCOPE(objects)
-class CBadResiduesException : public CObjReaderException
+class CSeq_id;
+
+class CBadResiduesException : public CException
{
public:
enum EErrCode {
- eBadResidues
+ eBadResidues,
+ eInvalid = -1
};
+ EErrCode GetErrCode(void) const
+ {
+ return typeid(*this) == typeid(CBadResiduesException) ?
+ (EErrCode) this->x_GetErrCode() :
+ (EErrCode) CException::eInvalid;
+ }
+
virtual const char* GetErrCodeString(void) const override
{
switch (GetErrCode()) {
TBadIndexMap m_BadIndexMap;
};
- virtual void ReportExtra(ostream& out) const override;
-
- CBadResiduesException(const CDiagCompileInfo& info,
+ void ReportExtra(ostream& out) const override;
+ CBadResiduesException(
+ const CDiagCompileInfo &info,
const CException* prev_exception,
- EErrCode err_code, const string& message,
+ EErrCode err_code,
+ const string& message,
const SBadResiduePositions& badResiduePositions,
- EDiagSev /*severity*/ = eDiag_Error) THROWS_NONE
- : CObjReaderException(info, prev_exception,
- (CObjReaderException::EErrCode) err_code,
- message), m_BadResiduePositions(badResiduePositions)
+ EDiagSev severity = eDiag_Error)
+ : CException(info, prev_exception, (CException::EErrCode) err_code, message, severity, 0),
+ m_BadResiduePositions(badResiduePositions)
{}
- virtual const CException* x_Clone(void) const override
- {
- return new CBadResiduesException(*this);
- }
-
+ CBadResiduesException() = delete;
CBadResiduesException(const CBadResiduesException&) = default;
-
-public:
// Returns the bad residues found, which might not be complete
// if we bailed out early.
const SBadResiduePositions& GetBadResiduePositions(void) const THROWS_NONE
return m_BadResiduePositions.m_BadIndexMap.empty();
}
+protected:
+ const CException* x_Clone(void) const override
+ {
+ return new CBadResiduesException(*this);
+ }
+
private:
SBadResiduePositions m_BadResiduePositions;
};
- /* $Id: gtf_reader.hpp 630386 2021-05-01 20:54:52Z stakhovv $
+ /* $Id: gtf_reader.hpp 674645 2023-11-01 12:38:20Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
#include <corelib/ncbistd.hpp>
#include <objtools/readers/gff2_reader.hpp>
+#include <set>
+#include <map>
BEGIN_NCBI_SCOPE
BEGIN_SCOPE(objects) // namespace ncbi::objects::
class CGtfLocationMerger;
+class CGtfAttributes;
+
+CGtfAttributes g_GetIntersection(const CGtfAttributes& x, const CGtfAttributes& y);
// ============================================================================
class CGtfAttributes
// ============================================================================
{
public:
- using MultiValue = vector<string>;
+ // using MultiValue = vector<string>;
+ using MultiValue = set<string>;
+
using MultiAttributes = map<string, MultiValue>;
const MultiAttributes&
MultiValue values;
GetValues(key, values);
if (values.size() == 1) {
- return values.front();
+ return *(values.begin());
}
return "";
}
if (it == mAttributes.end()) {
return false;
}
+ if (value.empty()) {
+ return true;
+ }
+
const auto& values = it->second;
if (values.empty()) {
return false;
}
- if (value.empty()) {
- return true;
- }
- return (find(values.begin(), values.end(), value) != values.end());
+ return (values.find(value) != values.end());
};
void
const string& key,
MultiValue& values) const
{
- const MultiValue empty;
- values = empty;
- auto it = mAttributes.find(key);
- if (it != mAttributes.end()) {
+ if (auto it = mAttributes.find(key); it != mAttributes.end()) {
values = it->second;
}
+ else {
+ values.clear();
+ }
};
+
void
AddValue(
const string& key,
{
auto kit = mAttributes.find(key);
if (kit == mAttributes.end()) {
- kit = mAttributes.insert(make_pair(key, MultiValue())).first;
- }
- auto vit = find(kit->second.begin(), kit->second.end(), value);
- if (vit == kit->second.end()) {
- kit->second.push_back(value);
+ kit = mAttributes.emplace(key, MultiValue()).first;
}
+ kit->second.insert(value);
};
+ void
+ Remove(const string& key)
+ {
+ auto it = mAttributes.find(key);
+ if (it == mAttributes.end()) {
+ return;
+ }
+ mAttributes.erase(it);
+ }
+
+ void
+ RemoveValue(const string& key, const string& value)
+ {
+ auto it = mAttributes.find(key);
+ if (it == mAttributes.end()) {
+ return;
+ }
+
+ auto& values = it->second;
+ if (auto vit = values.find(value); vit != values.end()) {
+ values.erase(vit);
+ if (values.empty()) {
+ mAttributes.erase(it);
+ }
+ }
+ }
+
+ friend CGtfAttributes g_GetIntersection(const CGtfAttributes& x, const CGtfAttributes& y);
protected:
MultiAttributes mAttributes;
};
+
// ============================================================================
class CGtfReadRecord
// ============================================================================
return GeneKey() + "_" + transcriptId;
}
+ string TranscriptId() const
+ {
+ return mAttributes.ValueOf("transcript_id");
+ }
+
protected:
bool xAssignAttributesFromGff(
const string&,
const CGtfReadRecord&,
CSeq_annot&);
+private:
+ bool xUpdateAnnotParent(
+ const CGtfReadRecord& record,
+ const string& parentType,
+ CSeq_annot& annot);
+
+protected:
void xPostProcessAnnot(
CSeq_annot&) override;
const CGtfReadRecord& record,
CSeq_feat&);
+private:
+ bool xFeatureSetQualifiers(
+ const CGtfReadRecord& record,
+ const set<string>& ignoredAttrs,
+ CSeq_feat&);
+
+protected:
+
bool xCreateParentCds(
const CGtfReadRecord&,
CSeq_annot&);
bool xFeatureTrimQualifiers(
const CGtfReadRecord&,
CSeq_feat&);
+private:
+ bool xFeatureTrimQualifiers(
+ const CGtfAttributes& attributes,
+ CSeq_feat&);
+
+ bool xFeatureTrimQualifiers(
+ const CGtfAttributes& prevAttributes,
+ const CGtfAttributes& currentAttributes,
+ CSeq_feat&);
+
+
+ void xCheckForGeneIdConflict(
+ const CGtfReadRecord& record);
+
+ void xPropagateQualToParent(
+ const CGtfReadRecord& record,
+ const string& qualName,
+ CSeq_feat& parent);
+
+
+protected:
CRef<CSeq_feat> xFindFeatById(
const string&);
CSeq_feat&) override;
unique_ptr<CGtfLocationMerger> mpLocations;
+
+private:
+ using TChildQualMap = map<string, CGtfAttributes>;
+ using TParentChildQualMap = map<string, TChildQualMap>;
+
+ map<string, string> m_TranscriptToGeneMap;
+ TParentChildQualMap m_ParentChildQualMap;
};
END_SCOPE(objects)
-/* $Id: line_error.hpp 673184 2023-09-25 14:08:03Z ivanov $
+/* $Id: line_error.hpp 684363 2024-06-20 19:34:09Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
#include <corelib/ncbistd.hpp>
#include <corelib/ncbimisc.hpp>
#include <corelib/ncbiobj.hpp>
-//#include <corelib/ncbi_message.hpp>
-#include<objtools/logging/message.hpp>
+#include <objtools/logging/message.hpp>
#include <objtools/readers/reader_exception.hpp>
-
+#include <serial/serialbase.hpp>
BEGIN_NCBI_SCOPE
eProblem_InconsistentQualifiers, // qualifiers should match across features, but don't
eProblem_DuplicateIDs,
- //vcf specific
+ // vcf specific
eProblem_BadInfoLine,
eProblem_BadFormatLine,
eProblem_BadFilterLine,
/// This is here because the copy constructor may be protected
/// eventually.
- virtual ILineError *Clone(void) const {
- /// throw instead of making it pure virtual for backward
- /// compatibility.
- NCBI_USER_THROW("not implemented: ILineError::Clone");
- }
+ virtual ILineError* Clone(void) const = 0;
virtual ~ILineError(void) noexcept {}
virtual EProblem
Problem(void) const = 0;
- virtual const std::string &
- SeqId(void) const = 0;
+ virtual const string& SeqId(void) const = 0;
- virtual unsigned int
- Line(void) const =0;
+ virtual unsigned int Line(void) const = 0;
typedef vector<unsigned int> TVecOfLines;
- virtual const TVecOfLines &
- OtherLines(void) const = 0;
- virtual const std::string &
- FeatureName(void) const = 0;
+ virtual const TVecOfLines& OtherLines(void) const = 0;
- virtual const std::string &
- QualifierName(void) const = 0;
+ virtual const string& FeatureName(void) const = 0;
- virtual const std::string &
- QualifierValue(void) const = 0;
+ virtual const string& QualifierName(void) const = 0;
+
+ virtual const string& QualifierValue(void) const = 0;
// combines the other fields to print a reasonable error message
- virtual std::string
- Message(void) const
- {
- CNcbiOstrstream result;
- result << "On SeqId '" << SeqId() << "', line " << Line() << ", severity " << SeverityStr() << ": '"
- << ProblemStr() << "'";
- if( ! FeatureName().empty() ) {
- result << ", with feature name '" << FeatureName() << "'";
- }
- if( ! QualifierName().empty() ) {
- result << ", with qualifier name '" << QualifierName() << "'";
- }
- if( ! QualifierValue().empty() ) {
- result << ", with qualifier value '" << QualifierValue() << "'";
- }
- if( ! OtherLines().empty() ) {
- result << ", with other possibly relevant line(s):";
- ITERATE( TVecOfLines, line_it, OtherLines() ) {
- result << ' ' << *line_it;
- }
- }
- return (string)CNcbiOstrstreamToString(result);
- }
+ virtual string Message() const;
+ string SeverityStr() const;
- std::string
- SeverityStr(void) const
- {
- return CNcbiDiag::SeverityName(Severity());
- };
+ virtual const string& ErrorMessage() const;
- virtual const std::string&
- ErrorMessage(void) const {
- static string empty("");
- return empty;
- }
+ virtual string ProblemStr() const;
- virtual std::string
- ProblemStr(void) const
- {
- return ProblemStr(Problem());
- }
+ static string ProblemStr(EProblem eProblem);
- static
- std::string
- ProblemStr(EProblem eProblem)
- {
- switch(eProblem) {
- case eProblem_Unset:
- return "Unset";
- case eProblem_UnrecognizedFeatureName:
- return "Unrecognized feature name";
- case eProblem_UnrecognizedQualifierName:
- return "Unrecognized qualifier name";
- case eProblem_NumericQualifierValueHasExtraTrailingCharacters:
- return "Numeric qualifier value has extra trailing characters after the number";
- case eProblem_NumericQualifierValueIsNotANumber:
- return "Numeric qualifier value should be a number";
- case eProblem_FeatureNameNotAllowed:
- return "Feature name not allowed";
- case eProblem_NoFeatureProvidedOnIntervals:
- return "No feature provided on intervals";
- case eProblem_QualifierWithoutFeature:
- return "No feature provided for qualifiers";
- case eProblem_FeatureBadStartAndOrStop:
- return "Feature bad start and/or stop";
- case eProblem_GeneralParsingError:
- return "General parsing error";
- case eProblem_BadFeatureInterval:
- return "Bad feature interval";
- case eProblem_QualifierBadValue:
- return "Qualifier had bad value";
- case eProblem_BadScoreValue:
- return "Invalid score value";
- case eProblem_MissingContext:
- return "Value ignored due to missing context";
- case eProblem_BadTrackLine:
- return "Bad track line: Expected \"track key1=value1 key2=value2 ...\"";
- case eProblem_InternalPartialsInFeatLocation:
- return "Feature's location has internal partials";
- case eProblem_FeatMustBeInXrefdGene:
- return "Feature has xref to a gene, but that gene does NOT contain the feature.";
- case eProblem_CreatedGeneFromMultipleFeats:
- return "Feature is trying to create a gene that conflicts with the gene created by another feature.";
- case eProblem_UnrecognizedSquareBracketCommand:
- return "Unrecognized square bracket command";
- case eProblem_TooLong:
- return "Feature is too long";
- case eProblem_UnexpectedNucResidues:
- return "Nucleotide residues unexpectedly found in feature";
- case eProblem_UnexpectedAminoAcids:
- return "Amino acid residues unexpectedly found in feature";
- case eProblem_TooManyAmbiguousResidues:
- return "Too many ambiguous residues";
- case eProblem_InvalidResidue:
- return "Invalid residue(s)";
- case eProblem_ModifierFoundButNoneExpected:
- return "Modifiers were found where none were expected";
- case eProblem_ExtraModifierFound:
- return "Extraneous modifiers found";
- case eProblem_ExpectedModifierMissing:
- return "Expected modifier missing";
- case eProblem_Missing:
- return "Feature is missing";
- case eProblem_NonPositiveLength:
- return "Feature's length must be greater than zero.";
- case eProblem_ParsingModifiers:
- return "Could not parse modifiers.";
- case eProblem_ContradictoryModifiers:
- return "Multiple different values for modifier";
- case eProblem_InvalidLengthAutoCorrected:
- return "Feature had invalid length, but this was automatically corrected.";
- case eProblem_IgnoredResidue:
- return "An invalid residue has been ignored";
- case eProblem_InvalidQualifier:
- return "Invalid qualifier for feature";
-
- case eProblem_BadInfoLine:
- return "Broken ##INFO line";
- case eProblem_BadFormatLine:
- return "Broken ##FORMAT line";
- case eProblem_BadFilterLine:
- return "Broken ##FILTER line";
-
- case eProblem_ProgressInfo:
- return "Just a progress info message (no error)";
- default:
- return "Unknown problem";
- }
- }
-
- virtual void Write(
- CNcbiOstream& out ) const
- {
-
- out << " " << SeverityStr() << ":" << endl;
- out << "Problem: " << ProblemStr() << endl;
- if (GetCode()) {
- out << "Code: " << GetCode();
- if (GetSubCode()) {
- out << "." << GetSubCode();
- }
- out << endl;
- }
- const string & seqid = SeqId();
- if (!seqid.empty()) {
- out << "SeqId: " << seqid << endl;
- }
- if (Line()) {
- out << "Line: " << Line() << endl;
- }
- const string & feature = FeatureName();
- if (!feature.empty()) {
- out << "FeatureName: " << feature << endl;
- }
- const string & qualname = QualifierName();
- if (!qualname.empty()) {
- out << "QualifierName: " << qualname << endl;
- }
- const string & qualval = QualifierValue();
- if (!qualval.empty()) {
- out << "QualifierValue: " << qualval << endl;
- }
- const TVecOfLines & vecOfLines = OtherLines();
- if( ! vecOfLines.empty() ) {
- out << "OtherLines:";
- ITERATE(TVecOfLines, line_it, vecOfLines) {
- out << ' ' << *line_it;
- }
- out << endl;
- }
- out << endl;
- };
+ virtual void Write(CNcbiOstream& out) const;
// dump the XML on one line since some tools assume that
- virtual void WriteAsXML(
- CNcbiOstream& out ) const
- {
- out << "<message severity=\"" << NStr::XmlEncode(SeverityStr()) << "\" "
- << "problem=\"" << NStr::XmlEncode(ProblemStr()) << "\" ";
- if (GetCode()) {
- string code = NStr::IntToString(GetCode());
- if (GetSubCode()) {
- code += "." + NStr::IntToString(GetSubCode());
- }
- out << "code=\"" << NStr::XmlEncode(code) << "\" ";
- }
- const string & seqid = SeqId();
- if (!seqid.empty()) {
- out << "seqid=\"" << NStr::XmlEncode(seqid) << "\" ";
- }
- out << "line=\"" << Line() << "\" ";
- const string & feature = FeatureName();
- if (!feature.empty()) {
- out << "feature_name=\"" << NStr::XmlEncode(feature) << "\" ";
- }
- const string & qualname = QualifierName();
- if (!qualname.empty()) {
- out << "qualifier_name=\"" << NStr::XmlEncode(qualname) << "\" ";
- }
- const string & qualval = QualifierValue();
- if (!qualval.empty()) {
- out << "qualifier_value=\"" << NStr::XmlEncode(qualval) << "\" ";
- }
- out << ">";
-
- // child nodes
- ITERATE(TVecOfLines, line_it, OtherLines()) {
- out << "<other_line>" << *line_it << "</other_line>";
- }
-
- out << "</message>" << endl;
- };
+ virtual void WriteAsXML(CNcbiOstream& out) const;
// IMessage methods - default implementations or wrappers for ILineError
// methods (for backward compatibility).
- virtual string GetText(void) const { return Message(); }
- virtual EDiagSev GetSeverity(void) const { return Severity(); }
- virtual int GetCode(void) const { return 0; }
- virtual int GetSubCode(void) const { return 0; }
- virtual void Dump(CNcbiOstream& out) const { Write(out); }
+ virtual string GetText(void) const { return Message(); }
+ virtual EDiagSev GetSeverity(void) const { return Severity(); }
+ virtual int GetCode(void) const { return 0; }
+ virtual int GetSubCode(void) const { return 0; }
+ virtual void Dump(CNcbiOstream& out) const { Write(out); }
virtual std::string Compose(void) const
{
return Message();
};
// ============================================================================
-class NCBI_XOBJUTIL_EXPORT CLineError:
-// ============================================================================
+class NCBI_XOBJUTIL_EXPORT CLineError :
+ // ============================================================================
public ILineError
{
public:
-
/// Use this because the constructor is protected.
///
/// @returns
/// Caller is responsible for the return value.
static CLineError* Create(
- EProblem eProblem,
- EDiagSev eSeverity,
+ EProblem eProblem,
+ EDiagSev eSeverity,
const std::string& strSeqId,
- unsigned int uLine,
- const std::string & strFeatureName = string(""),
- const std::string & strQualifierName = string(""),
- const std::string & strQualifierValue = string(""),
- const std::string & strErrorMessage = string(""),
- const TVecOfLines & vecOfOtherLines = TVecOfLines() );
+ unsigned int uLine,
+ const std::string& strFeatureName = string(""),
+ const std::string& strQualifierName = string(""),
+ const std::string& strQualifierValue = string(""),
+ const std::string& strErrorMessage = string(""),
+ const TVecOfLines& vecOfOtherLines = TVecOfLines());
/// Use this because copy ctor is protected.
- virtual ILineError *Clone(void) const;
+ virtual ILineError* Clone(void) const;
virtual ~CLineError(void) noexcept {}
unsigned int uLine) { m_uLine = uLine; };
void PatchErrorMessage(
- const string& errorMessage) {
+ const string& errorMessage)
+ {
m_strErrorMessage = errorMessage;
};
// "OtherLines" not set in ctor because it's
// use should be somewhat rare
- void AddOtherLine(unsigned int uOtherLine) {
+ void AddOtherLine(unsigned int uOtherLine)
+ {
m_vecOfOtherLines.push_back(uOtherLine);
}
virtual EDiagSev
Severity(void) const { return m_eSeverity; }
- const std::string &
+ const std::string&
SeqId(void) const { return m_strSeqId; }
unsigned int
Line(void) const { return m_uLine; }
- const TVecOfLines &
+ const TVecOfLines&
OtherLines(void) const { return m_vecOfOtherLines; }
- const std::string &
+ const std::string&
FeatureName(void) const { return m_strFeatureName; }
- const std::string &
+ const std::string&
QualifierName(void) const { return m_strQualifierName; }
- const std::string &
+ const std::string&
QualifierValue(void) const { return m_strQualifierValue; }
virtual std::string
ProblemStr(void) const
{
- if (const auto& msg = ErrorMessage(); !msg.empty()) {
+ if (const auto& msg = ErrorMessage(); ! msg.empty()) {
return msg;
}
return ILineError::ProblemStr(Problem());
}
- const std::string &ErrorMessage(void) const { return m_strErrorMessage; }
+ const std::string& ErrorMessage(void) const { return m_strErrorMessage; }
protected:
-
- EProblem m_eProblem;
- EDiagSev m_eSeverity;
- std::string m_strSeqId;
+ EProblem m_eProblem;
+ EDiagSev m_eSeverity;
+ std::string m_strSeqId;
unsigned int m_uLine;
- std::string m_strFeatureName;
- std::string m_strQualifierName;
- std::string m_strQualifierValue;
- std::string m_strErrorMessage;
- TVecOfLines m_vecOfOtherLines;
+ std::string m_strFeatureName;
+ std::string m_strQualifierName;
+ std::string m_strQualifierValue;
+ std::string m_strErrorMessage;
+ TVecOfLines m_vecOfOtherLines;
/// protected instead of public. Please use the Create function instead.
CLineError(
- EProblem eProblem,
- EDiagSev eSeverity,
+ EProblem eProblem,
+ EDiagSev eSeverity,
const std::string& strSeqId,
- unsigned int uLine,
- const std::string & strFeatureName,
- const std::string & strQualifierName,
- const std::string & strQualifierValue,
- const std::string & strErrorMessage,
- const TVecOfLines & m_vecOfOtherLine);
+ unsigned int uLine,
+ const std::string& strFeatureName,
+ const std::string& strQualifierName,
+ const std::string& strQualifierValue,
+ const std::string& strErrorMessage,
+ const TVecOfLines& m_vecOfOtherLine);
/// protected instead of public. Please use the Throw function to throw
/// this exception and try to avoid using the copy constructor at all.
- CLineError(const CLineError & rhs );
+ CLineError(const CLineError& rhs);
};
// ============================================================================
-class NCBI_XOBJUTIL_EXPORT CLineErrorEx:
-// ============================================================================
+class NCBI_XOBJUTIL_EXPORT CLineErrorEx :
+ // ============================================================================
public ILineError
{
public:
-
/// Use this because the constructor is protected.
///
/// @returns
/// Caller is responsible for the return value.
static CLineErrorEx* Create(
- EProblem eProblem,
- EDiagSev eSeverity,
- int code,
- int subcode,
+ EProblem eProblem,
+ EDiagSev eSeverity,
+ int code,
+ int subcode,
const std::string& strSeqId,
- unsigned int uLine,
- const std::string & strErrorMessage = string(""),
- const std::string & strFeatureName = string(""),
- const std::string & strQualifierName = string(""),
- const std::string & strQualifierValue = string(""),
- const TVecOfLines & vecOfOtherLines = TVecOfLines() );
+ unsigned int uLine,
+ const std::string& strErrorMessage = string(""),
+ const std::string& strFeatureName = string(""),
+ const std::string& strQualifierName = string(""),
+ const std::string& strQualifierValue = string(""),
+ const TVecOfLines& vecOfOtherLines = TVecOfLines());
/// Use this because copy ctor is protected.
- virtual ILineError *Clone(void) const override;
+ virtual ILineError* Clone(void) const override;
virtual ~CLineErrorEx(void) {}
// "OtherLines" not set in ctor because it's
// use should be somewhat rare
- void AddOtherLine(unsigned int uOtherLine) {
+ void AddOtherLine(unsigned int uOtherLine)
+ {
m_vecOfOtherLines.push_back(uOtherLine);
}
virtual EDiagSev
Severity(void) const override { return m_eSeverity; }
- const std::string &
+ const std::string&
SeqId(void) const override { return m_strSeqId; }
unsigned int
Line(void) const override { return m_uLine; }
- const TVecOfLines &
+ const TVecOfLines&
OtherLines(void) const override { return m_vecOfOtherLines; }
- const std::string &
+ const std::string&
FeatureName(void) const override { return m_strFeatureName; }
- const std::string &
+ const std::string&
QualifierName(void) const override { return m_strQualifierName; }
- const std::string &
+ const std::string&
QualifierValue(void) const override { return m_strQualifierValue; }
virtual std::string
ProblemStr(void) const override
{
- if (m_eProblem == ILineError::eProblem_GeneralParsingError &&
- !ErrorMessage().empty()) {
+ if (m_eProblem == ILineError::eProblem_GeneralParsingError &&
+ ! ErrorMessage().empty()) {
return ErrorMessage();
}
return ILineError::ProblemStr(Problem());
}
- const std::string &ErrorMessage(void) const override { return m_strErrorMessage; }
+ const std::string& ErrorMessage(void) const override { return m_strErrorMessage; }
virtual string Message(void) const override
{
- return (m_strErrorMessage.empty() ?
- ILineError::Message() :
- m_strErrorMessage);
+ return (m_strErrorMessage.empty() ? ILineError::Message() : m_strErrorMessage);
}
virtual int GetCode(void) const override { return m_Code; };
virtual int GetSubCode(void) const override { return m_Subcode; }
protected:
-
- EProblem m_eProblem;
- EDiagSev m_eSeverity;
- int m_Code;
- int m_Subcode;
- std::string m_strSeqId;
+ EProblem m_eProblem;
+ EDiagSev m_eSeverity;
+ int m_Code;
+ int m_Subcode;
+ std::string m_strSeqId;
unsigned int m_uLine;
- std::string m_strFeatureName;
- std::string m_strQualifierName;
- std::string m_strQualifierValue;
- std::string m_strErrorMessage;
- TVecOfLines m_vecOfOtherLines;
+ std::string m_strFeatureName;
+ std::string m_strQualifierName;
+ std::string m_strQualifierValue;
+ std::string m_strErrorMessage;
+ TVecOfLines m_vecOfOtherLines;
/// protected instead of public. Please use the Create function instead.
CLineErrorEx(
- EProblem eProblem,
- EDiagSev eSeverity,
- int code,
- int subcode,
+ EProblem eProblem,
+ EDiagSev eSeverity,
+ int code,
+ int subcode,
const std::string& strSeqId,
- unsigned int uLine,
- const std::string & strErrorMessage,
- const std::string & strFeatureName,
- const std::string & strQualifierName,
- const std::string & strQualifierValue,
- const TVecOfLines & m_vecOfOtherLine);
+ unsigned int uLine,
+ const std::string& strErrorMessage,
+ const std::string& strFeatureName,
+ const std::string& strQualifierName,
+ const std::string& strQualifierValue,
+ const TVecOfLines& m_vecOfOtherLine);
/// protected instead of public. Please use the Throw function to throw
/// this exception and try to avoid using the copy constructor at all.
- CLineErrorEx(const CLineErrorEx & rhs);
+ CLineErrorEx(const CLineErrorEx& rhs);
};
-
// ============================================================================
class NCBI_XOBJUTIL_EXPORT CObjReaderLineException
-// ============================================================================
+ // ============================================================================
// must inherit from ILineError first due to the way CObject detects
// whether or not it's on the heap.
- : public ILineError, public CObjReaderParseException
+ : public ILineError,
+ public CObjReaderParseException
{
public:
-
using CObjReaderParseException::EErrCode;
/// Please use this instead of the constructor because the ctor
/// @returns
/// Caller is responsible for the return value.
static CObjReaderLineException* Create(
- EDiagSev eSeverity,
- unsigned int uLine,
- const std::string &strMessage,
- EProblem eProblem = eProblem_GeneralParsingError,
- const std::string& strSeqId = string(""),
- const std::string & strFeatureName = string(""),
- const std::string & strQualifierName = string(""),
- const std::string & strQualifierValue = string(""),
- CObjReaderLineException::EErrCode eErrCode = eFormat,
- const TVecOfLines & vecOfOtherLines = TVecOfLines()
- );
-
- /// Use instead of copy constructor, which is protected.
- virtual ILineError *Clone(void) const;
-
- // Copy constructor is protected, so please use
+ EDiagSev eSeverity,
+ unsigned int uLine,
+ const std::string& strMessage,
+ EProblem eProblem = eProblem_GeneralParsingError,
+ const std::string& strSeqId = string(""),
+ const std::string& strFeatureName = string(""),
+ const std::string& strQualifierName = string(""),
+ const std::string& strQualifierValue = string(""),
+ CObjReaderLineException::EErrCode eErrCode = eFormat,
+ const TVecOfLines& vecOfOtherLines = TVecOfLines());
+
+ /// Use instead of copy constructor, which is private.
+ virtual ILineError* Clone(void) const;
+
+ // Copy constructor is private, so please use
/// this function to throw this object.
NCBI_NORETURN void Throw(void) const;
- ~CObjReaderLineException(void) noexcept { }
+ ~CObjReaderLineException(void) noexcept {}
TErrCode GetErrCode(void) const
{
- return (TErrCode) this->x_GetErrCode();
+ return (TErrCode)this->x_GetErrCode();
}
- EProblem Problem(void) const { return m_eProblem; }
- const std::string &SeqId(void) const { return m_strSeqId; }
- EDiagSev Severity(void) const { return CObjReaderParseException::GetSeverity(); }
- unsigned int Line(void) const { return m_uLineNumber; }
- const TVecOfLines & OtherLines(void) const { return m_vecOfOtherLines; }
- const std::string &FeatureName(void) const { return m_strFeatureName; }
- const std::string &QualifierName(void) const { return m_strQualifierName; }
- const std::string &QualifierValue(void) const { return m_strQualifierValue; }
+ EProblem Problem(void) const { return m_eProblem; }
+ const std::string& SeqId(void) const { return m_strSeqId; }
+ EDiagSev Severity(void) const { return CObjReaderParseException::GetSeverity(); }
+ unsigned int Line(void) const { return m_uLineNumber; }
+ const TVecOfLines& OtherLines(void) const { return m_vecOfOtherLines; }
+ const std::string& FeatureName(void) const { return m_strFeatureName; }
+ const std::string& QualifierName(void) const { return m_strQualifierName; }
+ const std::string& QualifierValue(void) const { return m_strQualifierValue; }
- const std::string &ErrorMessage(void) const { return m_strErrorMessage; }
+ const std::string& ErrorMessage(void) const { return m_strErrorMessage; }
std::string ProblemStr() const;
- std::string Message() const { return ( GetMsg().empty() ? ILineError::Message() : GetMsg()); }
+ std::string Message() const { return (GetMsg().empty() ? ILineError::Message() : GetMsg()); }
//
// Cludge alert: The line number may not be known at the time the exception
//
void
SetLineNumber(
- unsigned int uLineNumber ) { m_uLineNumber = uLineNumber; }
+ unsigned int uLineNumber) { m_uLineNumber = uLineNumber; }
// "OtherLines" not set in ctor because it's
// use should be somewhat rare
- void AddOtherLine(unsigned int uOtherLine) {
+ void AddOtherLine(unsigned int uOtherLine)
+ {
m_vecOfOtherLines.push_back(uOtherLine);
}
-protected:
+ void SetObject(CRef<CSerialObject> pObject);
- EProblem m_eProblem;
- std::string m_strSeqId;
- unsigned int m_uLineNumber;
- std::string m_strFeatureName;
- std::string m_strQualifierName;
- std::string m_strQualifierValue;
- std::string m_strErrorMessage;
- TVecOfLines m_vecOfOtherLines;
+ CConstRef<CSerialObject> GetObject() const;
- /// protected instead of public. Please use the Create function instead.
+private:
+ EProblem m_eProblem;
+ std::string m_strSeqId;
+ unsigned int m_uLineNumber;
+ std::string m_strFeatureName;
+ std::string m_strQualifierName;
+ std::string m_strQualifierValue;
+ std::string m_strErrorMessage;
+ TVecOfLines m_vecOfOtherLines;
+ CRef<CSerialObject> m_pObject;
+
+ /// private instead of public. Please use the Create function instead.
CObjReaderLineException(
- EDiagSev eSeverity,
- unsigned int uLine,
- const std::string &strMessage,
- EProblem eProblem = eProblem_GeneralParsingError,
- const std::string& strSeqId = string(""),
- const std::string & strFeatureName = string(""),
- const std::string & strQualifierName = string(""),
- const std::string & strQualifierValue = string(""),
- CObjReaderLineException::EErrCode eErrCode = eFormat,
- const TVecOfLines & vecOfOtherLines = TVecOfLines()
- );
-
- /// Protected, so use Clone or Throw instead.
- CObjReaderLineException(const CObjReaderLineException & rhs );
+ EDiagSev eSeverity,
+ unsigned int uLine,
+ const std::string& strMessage,
+ EProblem eProblem = eProblem_GeneralParsingError,
+ const std::string& strSeqId = string(""),
+ const std::string& strFeatureName = string(""),
+ const std::string& strQualifierName = string(""),
+ const std::string& strQualifierValue = string(""),
+ CObjReaderLineException::EErrCode eErrCode = eFormat,
+ const TVecOfLines& vecOfOtherLines = TVecOfLines());
+
+ /// Private, so use Clone or Throw instead.
+ CObjReaderLineException(const CObjReaderLineException& rhs);
};
-/* $Id: message_listener.hpp 669180 2023-06-22 16:27:32Z ivanov $
+/* $Id: message_listener.hpp 684363 2024-06-20 19:34:09Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
// ============================================================================
class ILineErrorListener : public CObject, public IObjtoolsListener
-// ============================================================================
{
public:
~ILineErrorListener() override {}
///
virtual bool PutError(const ILineError&) = 0;
- bool PutMessage(const IObjtoolsMessage& message) override {
+ bool PutMessage(const IObjtoolsMessage& message) override
+ {
const ILineError* le = dynamic_cast<const ILineError*>(&message);
if (! le)
return true;
};
-// Compatibility declaration, avoid using objects::IMessageListener -
-// use ncbi::IMessageListener or objects::ILineErrorListener instead.
-class IMessageListener : public ILineErrorListener
-{
-public:
- ~IMessageListener() override {}
-};
-
-
-// ============================================================================
-class NCBI_XOBJREAD_EXPORT CMessageListenerBase : public objects::IMessageListener
// ============================================================================
+class NCBI_XOBJREAD_EXPORT CMessageListenerBase : public ILineErrorListener
{
public:
- CMessageListenerBase() : m_pProgressOstrm(nullptr) {}
+ CMessageListenerBase() :
+ m_pProgressOstrm(nullptr) {}
~CMessageListenerBase() override {}
public:
// private so later we can change the structure if
// necessary (e.g. to have indexing and such to speed up
// level-counting)
- // typedef std::vector< AutoPtr<ILineError> > TLineErrVec;
+ // typedef std::vector< unique_ptr<ILineError> > TLineErrVec;
- using TLineErrVec = vector<AutoPtr<IObjtoolsMessage>>;
+ using TLineErrVec = vector<unique_ptr<IObjtoolsMessage>>;
TLineErrVec m_Errors;
// do not read this pointer. It's just used to make
// sure m_pProgressOstrm is destroyed if we own it.
- AutoPtr<CNcbiOstream> m_progressOstrmDestroyer;
+ unique_ptr<CNcbiOstream> m_progressOstrmDestroyer;
protected:
// Child classes should use this to store errors
void StoreMessage(const IObjtoolsMessage& message)
{
- m_Errors.emplace_back(dynamic_cast<IObjtoolsMessage*>(message.Clone()));
+ m_Errors.emplace_back(message.Clone());
}
};
// ============================================================================
-class CMessageListenerLenient :
-//
// Accept everything.
-// ============================================================================
- public CMessageListenerBase
+class CMessageListenerLenient : public CMessageListenerBase
{
public:
CMessageListenerLenient() {}
};
// ============================================================================
-class CMessageListenerStrict :
-//
// Don't accept any errors, at all.
-// ============================================================================
- public CMessageListenerBase
+class CMessageListenerStrict : public CMessageListenerBase
{
public:
CMessageListenerStrict() {}
};
// ===========================================================================
-class CMessageListenerCount :
-//
// Accept up to <<count>> errors, any level.
-// ===========================================================================
- public CMessageListenerBase
+class CMessageListenerCount : public CMessageListenerBase
{
public:
CMessageListenerCount(
};
// ===========================================================================
-class CMessageListenerLevel :
-//
// Accept evrything up to a certain level.
-// ===========================================================================
- public CMessageListenerBase
+class CMessageListenerLevel : public CMessageListenerBase
{
public:
CMessageListenerLevel(int iLevel) :
};
// ===========================================================================
-class CMessageListenerWithLog :
-//
// Accept everything, and besides storing all errors, post them.
-// ===========================================================================
- public CMessageListenerBase
+class CMessageListenerWithLog : public CMessageListenerBase
{
public:
CMessageListenerWithLog(const CDiagCompileInfo& info) :
// ===========================================================================
-class NCBI_XOBJREAD_EXPORT CGPipeMessageListener :
-// ===========================================================================
- public CMessageListenerBase
+class NCBI_XOBJREAD_EXPORT CGPipeMessageListener : public CMessageListenerBase
{
public:
- CGPipeMessageListener(bool ignoreBadModValue=false);
+ CGPipeMessageListener(bool ignoreBadModValue = false);
bool PutError(const ILineError& err) override final;
+
private:
bool m_IgnoreBadModValue;
};
fLeaveProteinIds = (1<<7), ///< = 0x80 (Leave all protein_id as a qualifiers)
fAllIdsAsLocal = (1<<8), ///< = 0x100 (Do not attempt to parse accessions)
fPreferGenbankId = (1<<9), ///< = 0x200 (Prefer Genbank accession ids)
- fSuppressBadKeyWarning = (1<<10), ///<= 0x400 (Suppress 'bad key' errors; Not recommended.)
+ fSuppressBadKeyWarning = (1<<10), ///< = 0x400 (Suppress 'bad key' errors; Not recommended.)
+ fIncludeObjectInMsg = (1<<11), ///< = 0x800 (Include reference to feature object in message).
};
using TFlags = long; ///< binary OR of EFlags
static void AddStringFlags(
#ifndef OBJTOOLS_DATA_LOADERS_BAM___BAMLOADER_IMPL__HPP
#define OBJTOOLS_DATA_LOADERS_BAM___BAMLOADER_IMPL__HPP
-/* $Id: bamloader_impl.hpp 646084 2022-03-01 20:02:52Z vasilche $
+/* $Id: bamloader_impl.hpp 674300 2023-10-23 19:56:38Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
{
public:
CBamRefSeqChunkInfo(void)
- : m_AlignCount(0), m_MaxRefSeqFrom(0)
+ : m_AlignCount(0), m_DataSize(0), m_MaxRefSeqFrom(0)
{
}
friend class CBamRefSeqInfo;
Uint8 m_AlignCount; // 0 - graph only
+ Uint8 m_DataSize;
TRange m_RefSeqRange;
TSeqPos m_MaxRefSeqFrom;
};
{
BM_ASSERT(!is_ro());
+ if (!size_in)
+ return;
+
size_type n, start(0), stop(size_in);
block_idx_type nblock;
import_block(ids, nblock, 0, stop);
return;
}
+ // multi-block import, do top block space reservation
+ unsigned i, j;
+ bm::get_block_coord(nblock_end, i, j);
+ blockman_.reserve_top_blocks(i+1);
}
break;
default:
#else
bm::set_block_bits_u32(blk, ids, start, stop);
#endif
+ if (new_blocks_strat_ == BM_GAP) // optimization required
+ {
+ BM_DECLARE_TEMP_BLOCK(temp_blk);
+ unsigned i0, j0;
+ bm::get_block_coord(nblock, i0, j0);
+ blockman_.optimize_block(i0, j0, blk, temp_blk, opt_compress, 0);
+ }
+
if (nblock == bm::set_total_blocks-1)
- blk[bm::set_block_size-1] &= ~(1u<<31);
+ blk[bm::set_block_size-1] &= ~(1u<<31); // clear the "impossible" last just in case
}
}
unsigned threashold = this->glen(bm::gap_max_level)-4;
if (gap_count < threashold) // compressable
- {
- unsigned len;
- bm::gap_word_t tmp_gap_buf[bm::gap_equiv_len * 2];
-
- len = bm::bit_to_gap(tmp_gap_buf, block, threashold);
- BM_ASSERT(len);
- int level = bm::gap_calc_level(len, this->glen());
- BM_ASSERT(level >= 0);
- bm::gap_word_t* gap_blk =
- allocate_gap_block(unsigned(level), tmp_gap_buf);
- top_blocks_[i][j] = (bm::word_t*)BMPTR_SETBIT0(gap_blk);
- return_tempblock(block);
- }
+ optimize_gap_convert_bit_block(i, j, block, threashold);
}
}
+ /**
+ Full Optimize bit-block at i-j position (no checks)
+ */
+ void optimize_bit_block_nocheck(unsigned i, unsigned j)
+ {
+ bm::word_t* block = get_block_ptr(i, j);
+
+ BM_ASSERT(IS_VALID_ADDR(block));
+ BM_ASSERT(!BM_IS_GAP(block));
+
+ unsigned gap_count = bm::bit_block_calc_change(block);
+ if (gap_count == 1) // solid block
+ {
+ top_blocks_[i][j] = (*block) ? FULL_BLOCK_FAKE_ADDR : 0;
+ return_tempblock(block);
+ return;
+ }
+ unsigned threashold = this->glen(bm::gap_max_level)-4;
+ if (gap_count < threashold) // compressable
+ optimize_gap_convert_bit_block(i, j, block, threashold);
+ }
+
+ void optimize_gap_convert_bit_block(unsigned i, unsigned j,
+ bm::word_t* block,
+ unsigned threashold)
+ {
+ unsigned len;
+ bm::gap_word_t tmp_gap_buf[bm::gap_equiv_len * 2];
+
+ len = bm::bit_to_gap(tmp_gap_buf, block, threashold);
+ BM_ASSERT(len);
+ int level = bm::gap_calc_level(len, this->glen());
+ BM_ASSERT(level >= 0);
+ bm::gap_word_t* gap_blk =
+ allocate_gap_block(unsigned(level), tmp_gap_buf);
+ top_blocks_[i][j] = (bm::word_t*)BMPTR_SETBIT0(gap_blk);
+ return_tempblock(block);
+ }
/**
top_block_size_ = top_blocks;
return top_block_size_;
}
+
+ /**
+ \brief shrink unused top blocks array (via reallocation)
+ */
+ void shrink_top_blocks()
+ {
+ if (!top_blocks_)
+ return;
+ unsigned tb_cnt = top_block_size() - 1;
+ for ( ; tb_cnt; --tb_cnt)
+ {
+ if (top_blocks_[tb_cnt])
+ break;
+ } // for
+ if (++tb_cnt < top_block_size_) // shrink is possible
+ {
+ BM_ASSERT(tb_cnt <= top_block_size_);
+ bm::word_t*** new_blocks =
+ (bm::word_t***)alloc_.alloc_ptr(tb_cnt);
+ ::memcpy(&new_blocks[0], &top_blocks_[0],
+ tb_cnt * sizeof(top_blocks_[0]));
+ alloc_.free_ptr(top_blocks_, top_block_size_);
+ top_blocks_ = new_blocks;
+ top_block_size_ = tb_cnt;
+ }
+ }
/** \brief Returns reference on the allocator
*/
///@{
basic_bmatrix(size_type rsize,
+ bool is_dynamic = true,
allocation_policy_type ap = allocation_policy_type(),
size_type bv_max_size = bm::id_max,
const allocator_type& alloc = allocator_type());
*/
void bit_and_rows(const bvector_type& bv);
+ /// Return if matrix is dynamic resizable
+ bool is_dynamic() const BMNOEXCEPT { return is_dynamic_; }
+
+
+ /// Debugging function to check if two matrixes have the same rows created
+ /// @return true - if the same
+ ///
+ bool is_same_structure(const basic_bmatrix<BV>& bbm) const BMNOEXCEPT;
///@}
size_type bv_size_;
allocator_type alloc_;
allocation_policy_type ap_;
- allocator_pool_type* pool_;
+ allocator_pool_type* pool_ = 0;
- bvector_type_ptr* bv_rows_;
- size_type rsize_;
- size_type null_idx_; ///< Index of the NULL row
+ bvector_type_ptr* bv_rows_ = 0;
+ size_type rsize_ = 0;
+ bool is_dynamic_ = true; ///< if rsize is dynamic (variable length)
+ size_type null_idx_ = 0; ///< Index of the NULL row
};
/**
base_sparse_vector();
base_sparse_vector(bm::null_support null_able,
+ bool is_dynamic,
allocation_policy_type ap = allocation_policy_type(),
size_type bv_max_size = bm::id_max,
const allocator_type& alloc = allocator_type());
template<typename BV>
basic_bmatrix<BV>::basic_bmatrix(size_type rsize,
+ bool is_dynamic,
allocation_policy_type ap,
size_type bv_max_size,
const allocator_type& alloc)
: bv_size_(bv_max_size),
alloc_(alloc),
- ap_(ap),
- pool_(0),
- bv_rows_(0),
- rsize_(0),
- null_idx_(0)
+ ap_(ap)
{
allocate_rows(rsize);
+ is_dynamic_ = is_dynamic;
}
//---------------------------------------------------------------------
basic_bmatrix<BV>::basic_bmatrix(const basic_bmatrix<BV>& bbm)
: bv_size_(bbm.bv_size_),
alloc_(bbm.alloc_),
- ap_(bbm.ap_),
- pool_(0),
- bv_rows_(0),
- rsize_(0),
- null_idx_(0)
+ ap_(bbm.ap_)
{
copy_from(bbm);
+ is_dynamic_ = bbm.is_dynamic_;
}
//---------------------------------------------------------------------
basic_bmatrix<BV>::basic_bmatrix(basic_bmatrix<BV>&& bbm) BMNOEXCEPT
: bv_size_(bbm.bv_size_),
alloc_(bbm.alloc_),
- ap_(bbm.ap_),
- pool_(0),
- bv_rows_(0),
- rsize_(0),
- null_idx_(0)
+ ap_(bbm.ap_)
{
swap(bbm);
+ is_dynamic_ = bbm.is_dynamic_;
}
//---------------------------------------------------------------------
bv_rows_[rsize-1] = bv_rows_[null_idx_];
bv_rows_[null_idx_] = 0;
null_idx_ = rsize-1;
+ BM_ASSERT(rsize & 1u);
}
}
}
//---------------------------------------------------------------------
+template<typename BV>
+bool basic_bmatrix<BV>::is_same_structure(
+ const basic_bmatrix<BV>& bbm) const BMNOEXCEPT
+{
+ BM_ASSERT(this != &bbm);
+
+ if (rsize_ != bbm.rsize_)
+ return false;
+ if (null_idx_ != bbm.null_idx_)
+ return false;
+ for (size_type i = 0; i < rsize_; ++i)
+ {
+ const bvector_type* bv = bv_rows_[i];
+ const bvector_type* bv_arg = bbm.bv_rows_[i];
+ if (bool(bv) != bool(bv_arg))
+ return false;
+ } // for i
+
+
+ return true;
+}
+
+//---------------------------------------------------------------------
+
template<typename BV>
void basic_bmatrix<BV>::set_allocator_pool(allocator_pool_type* pool_ptr) BMNOEXCEPT
{
typename basic_bmatrix<BV>::bvector_type_ptr
basic_bmatrix<BV>::construct_row(size_type row)
{
- if (row >= rsize_)
- allocate_rows(row + 8);
+ if (is_dynamic())
+ {
+ if (row >= rsize_)
+ allocate_rows(rsize_ + 8);
+ }
BM_ASSERT(row < rsize_);
bvector_type_ptr bv = bv_rows_[row];
if (!bv)
template<class Val, class BV, unsigned MAX_SIZE>
base_sparse_vector<Val, BV, MAX_SIZE>::base_sparse_vector()
-: bmatr_(sv_slices, allocation_policy_type(), bm::id_max, allocator_type())
+: bmatr_(sv_slices, true, allocation_policy_type(), bm::id_max, allocator_type())
{}
//---------------------------------------------------------------------
template<class Val, class BV, unsigned MAX_SIZE>
base_sparse_vector<Val, BV, MAX_SIZE>::base_sparse_vector(
bm::null_support null_able,
+ bool is_dynamic,
allocation_policy_type ap,
size_type bv_max_size,
const allocator_type& alloc)
-: bmatr_(sv_slices, ap, bv_max_size, alloc)
+: bmatr_(sv_slices, is_dynamic, ap, bv_max_size, alloc)
{
if (null_able == bm::use_null)
{
/// adjust current size (no need to reallocate)
void resize_no_check(size_t new_size) BMNOEXCEPT
{
- BM_ASSERT(new_size < capacity_ || !new_size);
+ BM_ASSERT(new_size <= capacity_ || !new_size);
this->size_ = new_size;
}
void free() BMNOEXCEPT
{
buffer_.free_buffer();
+ rows_ = 0; cols_ = 0;
}
size_type rows() const BMNOEXCEPT { return rows_; }
#define BM_VERSION_MAJOR 7
#define BM_VERSION_MINOR 13
-#define BM_VERSION_PATCH 3
+#define BM_VERSION_PATCH 4
template<bool T> const char _copyright<T>::_p[] =
- "BitMagic Library. v.7.13.3 (c) 2002-2022 Anatoliy Kuznetsov.";
+ "BitMagic Library. v.7.13.4 (c) 2002-2022 Anatoliy Kuznetsov.";
template<bool T> const unsigned _copyright<T>::_v[3] =
{ BM_VERSION_MAJOR, BM_VERSION_MINOR, BM_VERSION_PATCH };
/** reset range deserialization and reference vectors
@sa set_range()
*/
- void reset() BMNOEXCEPT
- {
- unset_range(); set_ref_vectors(0);
- }
+ void reset() BMNOEXCEPT { unset_range(); set_ref_vectors(0); }
+
protected:
typedef typename BV::blocks_manager_type blocks_manager_type;
block_idx_type x_nb_;
unsigned xor_chain_size_;
bm::match_pair xor_chain_[64];
-// bool x_ref_gap_;
// Range deserialization settings
//
{
blocks_manager_type& bman = bv.get_blocks_manager();
if (!bman.is_init())
- bman.init_tree();
+ {
+ auto bc = bman.compute_top_block_size(bm::id_max-1);
+ bman.init_tree(bc);
+ }
bm::word_t* temp_block = temp_block_;
bm::strategy strat = bv.get_new_blocks_strat();
- bv.set_new_blocks_strat(BM_GAP);
+ //bv.set_new_blocks_strat(BM_GAP);
typename bvector_type::mem_pool_guard mp_guard_bv;
mp_guard_bv.assign_if_not_set(pool_, bv);
bv.set_new_blocks_strat(strat);
+ bman.shrink_top_blocks(); // reduce top blocks to necessary size
+
return dec.size();
}
if (nb_from == x_nb_ || nb_to == x_nb_)
return;
}
- bman.optimize_bit_block(i0, j0, BV::opt_compress);
+ bman.optimize_bit_block_nocheck(i0, j0);
}
// ---------------------------------------------------------------------------
{
if (this != &sv)
{
- clear_all(true);
+ clear_all(true, 0);
swap(sv);
}
return *this;
void clear(const bvector_type& bv_idx)
{ this->bit_sub_rows(bv_idx, false); }
+ /** Get raw unsigned value first N bits
+ \param idx - element index in the vector
+ \param N_bits - number of bits to be extracted (should be > 0)
+ @return unsigned value for
+ */
+ unsigned_value_type get_unsigned_bits(size_type idx,
+ size_type N_bits) const BMNOEXCEPT;
///@}
/*! @name Clear */
///@{
- /*! \brief resize to zero, free memory */
- void clear_all(bool free_mem) BMNOEXCEPT;
+ /*! \brief resize to zero, free memory
+ @param free_mem - true - indicates the need to free underlying memory in bit-vectors
+ */
+ void clear_all(bool free_mem, unsigned ) BMNOEXCEPT;
/*! \brief resize to zero, free memory */
- void clear() BMNOEXCEPT { clear_all(true); }
+ void clear() BMNOEXCEPT { clear_all(true, 0); }
/*!
\brief clear range (assign bit 0 for all planes)
static
void u2s_translate(value_type* arr, size_type sz) BMNOEXCEPT;
- // get raw unsigned value
+ /// get raw unsigned value
unsigned_value_type get_unsigned(size_type idx) const BMNOEXCEPT;
+
protected:
template<class V, class SV> friend class rsc_sparse_vector;
template<class SVect, unsigned S_FACTOR> friend class sparse_vector_scanner;
allocation_policy_type ap,
size_type bv_max_size,
const allocator_type& alloc)
-: parent_type(null_able, ap, bv_max_size, alloc)
+: parent_type(null_able, false, ap, bv_max_size, alloc)
{}
//---------------------------------------------------------------------
return size;
}
::memset(arr, 0, sizeof(value_type)*size);
-
for (size_type i = 0; i < size;)
{
- bool sorted_block = true;
+ bool sorted_block = true; // initial assumption
// look ahead for the depth of the same block
// (speculate more than one index lookup per block)
{
case BM_UNKNOWN:
{
- sorted_block = true; // initial assumption
+ // check if sorted, it pays off to verify
size_type idx_prev = idx[r];
for (; (r < size) && (nb == (idx[r] >> bm::set_block_shift)); ++r)
{
BM_ASSERT(i < bm::id_max);
unsigned_value_type uv = 0;
- unsigned eff_planes = this->effective_slices();
+ const unsigned eff_planes = this->effective_slices();
BM_ASSERT(eff_planes <= (sizeof(value_type) * 8));
unsigned_value_type smask = this->slice_mask_;
return uv;
}
+//---------------------------------------------------------------------
+
+template<class Val, class BV>
+typename sparse_vector<Val, BV>::unsigned_value_type
+sparse_vector<Val, BV>::get_unsigned_bits(size_type idx,
+ size_type N_bits) const BMNOEXCEPT
+{
+ BM_ASSERT(idx < bm::id_max);
+ const unsigned eff_planes = this->effective_slices();
+ BM_ASSERT(eff_planes <= (sizeof(value_type) * 8));
+ if (N_bits > eff_planes)
+ N_bits = eff_planes;
+ unsigned_value_type uv = 0;
+
+ for (unsigned j = 0; j < N_bits; ++j)
+ {
+ const bvector_type* bv = this->bmatr_.get_row(j);
+ if (bv)
+ {
+ bool b = bv->test(idx);
+ if (b)
+ uv |= unsigned_value_type(1) << j;
+ }
+ } // for j
+ return uv;
+}
+
+
//---------------------------------------------------------------------
template<class Val, class BV>
//---------------------------------------------------------------------
template<class Val, class BV>
-void sparse_vector<Val, BV>::clear_all(bool free_mem) BMNOEXCEPT
+void sparse_vector<Val, BV>::clear_all(bool free_mem, unsigned) BMNOEXCEPT
{
parent_type::clear_all(free_mem);
}
{
if (this != &csv)
{
- clear_all(true);
+ clear_all(true, 0);
sv_.swap(csv.sv_);
size_ = csv.size_; max_id_ = csv.max_id_; in_sync_ = csv.in_sync_;
if (in_sync_)
*/
value_type get(size_type idx) const BMNOEXCEPT;
+ /** Get raw unsigned value first N bits
+ \param idx - element index in the vector
+ \param N_bits - number of bits to be extracted (should be > 0)
+ @return unsigned value for
+ */
+ unsigned_value_type get_unsigned_bits(size_type idx,
+ size_type N_bits) const BMNOEXCEPT;
+
+
/**
\brief get specified element with NOT NULL check
\param idx - element index
/*! \brief resize to zero, free memory
@param free_mem - free bit vector slices if true
*/
- void clear_all(bool free_mem) BMNOEXCEPT;
+ void clear_all(bool free_mem, unsigned) BMNOEXCEPT;
/*! \brief resize to zero, free memory
@param free_mem - free bit vector slices if true
*/
- void clear() BMNOEXCEPT { clear_all(true); }
+ void clear() BMNOEXCEPT { clear_all(true, 0); }
/*!
@brief Calculates memory statistics.
bvector_type_ptr get_create_slice(unsigned i)
{ return sv_.get_create_slice(i); }
-
+
+ bvector_type_ptr slice(unsigned i)
+ { return sv_.slice(i); }
+
/*!
Number of effective bit-slices in the value type
*/
}
else
{
- sv_.clear_all(true);
+ sv_.clear_all(true, 0);
*bv_null = *bv_null_src;
bm::rank_compressor<bvector_type> rank_compr; // re-used for planes
template<class Val, class SV>
void rsc_sparse_vector<Val, SV>::load_to(sparse_vector_type& sv) const
{
- sv.clear_all(true);
+ sv.clear_all(true, 0);
const bvector_type* bv_null_src = this->get_null_bvector();
if (!bv_null_src)
//---------------------------------------------------------------------
+template<class Val, class SV>
+typename rsc_sparse_vector<Val, SV>::unsigned_value_type
+rsc_sparse_vector<Val, SV>::get_unsigned_bits(size_type idx,
+ size_type N_bits) const BMNOEXCEPT
+{
+ size_type sv_idx;
+ bool found = resolve(idx, &sv_idx);
+ if (!found)
+ return unsigned_value_type(0);
+ BM_ASSERT(!is_null(idx));
+ return sv_.get_unsigned_bits(--sv_idx, N_bits);
+}
+
+//---------------------------------------------------------------------
+
template<class Val, class SV>
bool rsc_sparse_vector<Val, SV>::try_get(
size_type idx, value_type& v) const BMNOEXCEPT
//---------------------------------------------------------------------
template<class Val, class SV>
-void rsc_sparse_vector<Val, SV>::clear_all(bool free_mem) BMNOEXCEPT
+void rsc_sparse_vector<Val, SV>::clear_all(bool free_mem, unsigned) BMNOEXCEPT
{
- sv_.clear_all(free_mem);
+ sv_.clear_all(free_mem, 0);
in_sync_ = false; max_id_ = size_ = 0;
}
bool range_valid = csv.resolve_range(left, right, &sv_left, &sv_right);
if (!range_valid)
{
- sv_.clear_all(true); sv_.resize(size_);
+ sv_.clear_all(true, 0); sv_.resize(size_);
bvector_type* bv_null = sv_.get_null_bvect();
bv_null->copy_range(*arg_bv_null, 0, right);
return;
};
/**
- Parallel plan builder for the XOR filter scanner
+ Parallel plan builder for the XOR filter scanner.
+ Parallelization principle here is based on makig a task per 64K bit block (task per NP)
@ingroup bmtasks
*/
template<typename BV>
typedef typename parent_type::task_vector_type task_vector_type;
};
+ /**
+ Construct task batch for parallel execution. (Every task is a lambda).
+ */
void build_plan(task_batch& batch,
bm::xor_sim_model<BV>& sim_model,
const bv_ref_vector_type& ref_vect,
const unsigned char* buf,
bool clear_sv)
{
+ BM_ASSERT(buf);
+
idx_range_set_ = false;
deserialize_sv(sv, buf, 0, clear_sv);
}
unsigned char matr_s_ser = 0;
unsigned planes = load_header(dec, sv, matr_s_ser);
- if (planes == 0)
+ if (!planes)
return;
load_planes_off_table(buf, dec, planes); // read the offset vector of bit-planes
+
+ sv.get_bmatrix().allocate_rows(planes);
+
for (unsigned i = 0; i < planes; ++i)
{
if (!off_vect_[i]) // empty vector
bool clear_sv)
{
if (clear_sv)
- sv.clear_all(true);
+ sv.clear_all(true, 1);
idx_range_set_ = true; idx_range_from_ = from; idx_range_to_ = to;
bool clear_sv)
{
if (clear_sv)
- sv.clear_all(true);
+ sv.clear_all(true, 1); // free memory, keep remap matrix
remap_buf_ptr_ = 0;
bm::decoder dec(buf); // TODO: implement correct processing of byte-order
// the NULL vector just to get to the offset of remap table
const unsigned char* bv_buf_ptr = buf + offset; // seek to position
- bvector_type* bv = sv.get_create_slice(unsigned(i));
+ bvector_type* bv = sv.slice(unsigned(i));
if (!bv_ref_ptr_)
bv_ref_.add(bv, unsigned(i));
__m128i nbA = _mm_srli_epi32(idxA, bm::set_block_shift); // idx[k] >> bm::set_block_shift
__m128i nbB = _mm_srli_epi32(idxB, bm::set_block_shift);
- if (!_mm_test_all_ones(_mm_cmpeq_epi32(nbM, nbA)) |
- !_mm_test_all_ones(_mm_cmpeq_epi32 (nbM, nbB)))
+ if (!_mm_test_all_ones(_mm_and_si128(_mm_cmpeq_epi32(nbM, nbA),
+ _mm_cmpeq_epi32(nbM, nbB))))
break;
} // for k
/*! @name Clear */
///@{
- /*! \brief resize to zero, free memory */
- void clear_all(bool free_mem) BMNOEXCEPT;
+ /*! \brief resize to zero, free memory
+ @param free_mem - true - free all bit-vectors memory,
+ false - set bit-vecor to zero (memory remains reserved)
+ @param remap - 0 - set to no-remap (default), 1 - keep remap substitution matrix for possible re-use
+ (if remap() was ever called on this vector with the datawith same frequency profiles)
+ Note that feeding the data with disimilar frequency profile would cause undefined behavior.
+ @sa remap
+ */
+ void clear_all(bool free_mem, unsigned remap=0) BMNOEXCEPT;
- /*! \brief resize to zero, free memory */
- void clear() BMNOEXCEPT { clear_all(true); }
+ /*! \brief resize to zero, free memory, reset remapping */
+ void clear() BMNOEXCEPT { clear_all(true, 0); }
/*!
\brief clear range (assign bit 0 for all planes)
allocation_policy_type ap,
size_type bv_max_size,
const allocator_type& alloc)
-: parent_type(null_able, ap, bv_max_size, alloc),
+: parent_type(null_able, true, ap, bv_max_size, alloc),
remap_flags_(0)
{
static_assert(STR_SIZE > 1,
template<class CharType, class BV, unsigned STR_SIZE>
str_sparse_vector<CharType, BV, STR_SIZE>::str_sparse_vector(
const str_sparse_vector& str_sv, bm::remap_setup remap_mode)
-: parent_type(str_sv.get_null_support()),
+: parent_type(str_sv.get_null_support(), true),
remap_flags_(str_sv.remap_flags_),
remap_matrix1_(str_sv.remap_matrix1_),
remap_matrix2_(str_sv.remap_matrix2_)
const value_type* BMRESTRICT str,
const slice_octet_matrix_type& BMRESTRICT octet_remap_matrix2) BMNOEXCEPT
{
+ if (!octet_remap_matrix2.rows())
+ return false;
+
const unsigned char* remap_row = octet_remap_matrix2.row(0);
for (unsigned i = 0; i < buf_size; ++i, remap_row += 256)
{
sv_str[i] = ch;
break;
}
-// const unsigned char* remap_row = octet_remap_matrix2.row(i);
unsigned char remap_value = remap_row[unsigned(ch)];
sv_str[i] = CharType(remap_value);
if (!remap_value) // unknown dictionary element
template<class CharType, class BV, unsigned STR_SIZE>
void str_sparse_vector<CharType, BV, STR_SIZE>::clear_all(
- bool free_mem) BMNOEXCEPT
+ bool free_mem, unsigned remap) BMNOEXCEPT
{
parent_type::clear_all(free_mem);
+ if (remap_flags_ && (remap == 0))
+ {
+ remap_flags_ = 0;
+ remap_matrix1_.free();
+ remap_matrix2_.free();
+ }
}
//---------------------------------------------------------------------
bm::gap_word_t lo,
bm::gap_word_t hi) BMNOEXCEPT
{
- for (;sz;)
+ BM_ASSERT(sz);
+ do // for (;sz;)
{
BM_ASSERT(lo <= hi);
BM_ASSERT(mid_idx < 65536);
arr[mid_idx] = bm::gap_word_t(val);
- if (sz == 1)
+ if (sz <= 1)
return;
+
bic_decode_u16_rg(arr, mid_idx, lo, bm::gap_word_t(val - 1));
arr += mid_idx + 1;
sz -= mid_idx + 1;
lo = bm::gap_word_t(val + 1);
- } // for sz
+ } while (sz); // for sz
}
// ----------------------------------------------------------------------
bm::word_t hi) BMNOEXCEPT
{
BM_ASSERT(sz);
- do //for (;sz;)
+ do
{
BM_ASSERT(lo <= hi);
-
- unsigned val;
-
// read the interpolated value
// x = read(r)+ lo + mid, where r = (hi - lo - sz + 1);
- val = hi - lo - sz + 1;
+ unsigned val = hi - lo - sz + 1;
if (val)
{
unsigned logv = bm::bit_scan_reverse32(val+1);
unsigned mid_idx = sz >> 1;
val += lo + mid_idx;
arr[mid_idx] = val;
- if (sz == 1)
+
+ if (sz <= 1)
return;
bic_decode_u32_cm(arr, mid_idx, lo, val-1);
bm::gap_word_t hi) BMNOEXCEPT
{
BM_ASSERT(sz);
- //for (;sz;)
do
{
BM_ASSERT(lo <= hi);
-
- unsigned val;
-
// read the interpolated value
// x = read(r)+ lo + mid, where r = (hi - lo - sz + 1);
- val = hi - lo - sz + 1;
+ unsigned val = hi - lo - sz + 1;
if (val)
{
unsigned logv = bm::bit_scan_reverse32(val+1);
unsigned mid_idx = sz >> 1;
val += lo + mid_idx;
arr[mid_idx] = bm::gap_word_t(val);
- if (sz == 1)
+
+ if (sz <= 1)
return;
bic_decode_u16_cm(arr, mid_idx, lo, bm::gap_word_t(val-1));
bm::gap_word_t lo,
bm::gap_word_t hi) BMNOEXCEPT
{
- for (;sz;)
+ BM_ASSERT(sz);
+ do
{
BM_ASSERT(lo <= hi);
-
- unsigned val;
-
// read the interpolated value
// x = read(r)+ lo + mid, where r = (hi - lo - sz + 1);
- val = hi - lo - sz + 1;
+ unsigned val = hi - lo - sz + 1;
if (val)
{
unsigned logv = bm::bit_scan_reverse32(val+1);
-
+
unsigned c = unsigned((1ull << (logv + 1)) - val - 1);
int64_t half_c = c >> 1; // c / 2;
int64_t half_r = val >> 1; // r / 2;
if (val <= lo1 || val >= hi1)
val += (get_bit() << logv);
}
-
+
unsigned mid_idx = sz >> 1;
val += lo + mid_idx;
block[nword] |= (1u << (val & bm::set_word_mask));
}
- if (sz == 1)
+ if (sz <= 1)
return;
-
+
bic_decode_u16_cm_bitset(block, mid_idx, lo, bm::gap_word_t(val-1));
// tail recursive call:
// bic_decode_u32_cm(block, sz - mid_idx - 1, val + 1, hi);
- sz -= ++mid_idx;// +1;
+ sz -= ++mid_idx;
lo = bm::gap_word_t(val + 1);
- } // for sz
+ } while (sz);
}
// ----------------------------------------------------------------------
bm::gap_word_t lo,
bm::gap_word_t hi) BMNOEXCEPT
{
- for (;sz;)
+ BM_ASSERT(sz);
+ do
{
BM_ASSERT(lo <= hi);
int64_t hi1 = half_r + half_c + 1;
r = get_bits(logv);
if (r <= lo1 || r >= hi1)
- r += (get_bits(1) << logv);
+ r += (get_bit() << logv);
}
val = r;
}
unsigned mid_idx = sz >> 1;
val += lo + mid_idx;
- if (sz == 1)
+ if (sz <= 1)
return;
bic_decode_u16_cm_dry(mid_idx, lo, bm::gap_word_t(val-1));
// tail recursive call:
// bic_decode_u32_cm_dry(sz - mid_idx - 1, val + 1, hi);
- sz -= mid_idx + 1;
+ sz -= mid_idx + 1;
lo = bm::gap_word_t(val + 1);
- } // for sz
+ } while (sz); // for sz
}
bm::gap_word_t lo,
bm::gap_word_t hi) BMNOEXCEPT
{
- for (;sz;)
+ BM_ASSERT(sz);
+ do //for (;sz;)
{
BM_ASSERT(lo <= hi);
//bic_decode_u16_bitset(block, sz - mid_idx - 1, bm::gap_word_t(val + 1), hi);
sz -= mid_idx + 1;
lo = bm::gap_word_t(val + 1);
- } // for sz
+ } while(sz); // for sz
}
// ----------------------------------------------------------------------
template<class TDecoder>
unsigned bit_in<TDecoder>::get_bit() BMNOEXCEPT
{
- const unsigned maskFF = ~0u;
- unsigned value = 0;
- unsigned free_bits = unsigned((sizeof(accum_) * 8) - used_bits_);
- if (1 <= free_bits)
+ const unsigned mask = (~0u) >> (32 - 1); // 100000...
+ unsigned value = accum_ & mask;
+ if (unsigned free_bits = unsigned(32u - used_bits_); free_bits)
{
- take_accum:
- value = accum_ & (maskFF >> (32 - 1));
- accum_ >>= 1;
- used_bits_ += 1;
- return value;
+ accum_ >>= 1; ++used_bits_;
}
- if (used_bits_ == (sizeof(accum_) * 8))
+ else
{
- accum_ = src_.get_32();
- used_bits_ = 0;
- goto take_accum;
+ BM_ASSERT(used_bits_ == (sizeof(accum_) * 8));
+ unsigned a = src_.get_32();
+ value = a & mask;
+ used_bits_ = 1;
+ accum_ = (a >> 1);
}
- value = accum_;
- accum_ = src_.get_32();
- used_bits_ = 1 - free_bits;
- value |= ((accum_ & (maskFF >> (32 - used_bits_))) << free_bits);
- accum_ >>= used_bits_;
return value;
}
#ifndef UTIL___STREAM_SOURCE__HPP
#define UTIL___STREAM_SOURCE__HPP
-/* $Id: stream_source.hpp 534859 2017-05-03 12:47:35Z ivanov $
+/* $Id: stream_source.hpp 680708 2024-03-26 13:05:01Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
///
/// If these conditions aren't met, throws an exception.
///
- virtual CInputStreamSource& operator++();
+ CInputStreamSource& operator++();
/// Determine if there are any more streams to be processed
///
/// the current file index
size_t GetCurrentStreamIndex(size_t* count = nullptr) const;
+ /// Jump to specified file in input list
+ CInputStreamSource& JumpToFile(unsigned index);
+
protected:
CArgs m_Args;
string m_Prefix;
size_t m_CurrIndex;
string m_CurrFile;
+ void x_Reset();
+
+ void x_OpenOwnedStream(CNcbiIstream *is);
+
+ // Advance to the next stream, if there is any.
+ virtual void x_OpenNextFile();
+
private:
/// forbidden
CInputStreamSource(const CInputStreamSource&);
#! /bin/sh
-# $Id: check_exec.sh 487998 2015-12-23 18:21:14Z ivanov $
+# $Id: check_exec.sh 676064 2023-12-07 19:04:25Z ivanov $
# Author: Vladimir Ivanov, NCBI
#
###########################################################################
# Reinforce timeout
# Note, we cannot set it to $timeout for MT-test, because
# CPU time count for each thread and sum.
-ulimit -t `expr $timeout \* 3` > /dev/null 2>&1
+ulimit -t `expr $timeout \* 25` > /dev/null 2>&1
# Use different kill on Unix and Cygwin
case `uname -s` in
#! /bin/sh
-# $Id: check_exec_test.sh 658859 2022-11-09 16:45:22Z vakatov $
+# $Id: check_exec_test.sh 676064 2023-12-07 19:04:25Z ivanov $
# Author: Vladimir Ivanov, NCBI
#
###########################################################################
# Reinforce timeout
# Note, we cannot set it to $timeout for MT-test, because
# CPU time count for each thread and sum.
-ulimit -t `expr $timeout \* 3` > /dev/null 2>&1 || true
+ulimit -t `expr $timeout \* 25` > /dev/null 2>&1 || true
# Use different kill on Unix and Cygwin
case `uname -s` in
#! /bin/sh
-# $Id: check_make_cfg.sh 651895 2022-06-27 17:39:46Z ivanov $
+# $Id: check_make_cfg.sh 677891 2024-01-24 19:09:24Z ivanov $
# Author: Vladimir Ivanov, NCBI
#
###########################################################################
exec_time=\`echo "\$exec_time" | tr '\n\r' '%%'\`
echo \$exec_time | grep 'real [0-9]\|Maximum execution .* is exceeded' > /dev/null 2>&1
if test \$? -eq 0; then
- exec_time=\`echo \$exec_time | sed -e 's/^%*//' -e 's/%*$//' -e 's/%%/%/g' -e 's/%/, /g' -e 's/[ ] */ /g'\`
+ exec_time=\`echo \$exec_time | tr -d '\n\r' | sed -e 's/^%*//' -e 's/%*$//' -e 's/%%/%/g' -e 's/%/, /g' -e 's/[ ] */ /g'\`
else
exec_time='unparsable timing stats'
fi
# Always load test results for automated builds on a 'run' command.
if \$is_run && \$is_db_load; then
- echo "\$x_path_app:" >> "\$build_dir/test_stat_load.log" 2>&1
+ stat_out="\$build_dir/test_stat_load.tmp.\$x_app"
+ retry="${x_check_scripts_dir}/retry_db_load.sh"
+ echo "======================================================================" >> \$stat_out 2>&1
+ echo "[\$build_tree/\$build_cfg] \$x_name" >> \$stat_out 2>&1
+ echo "======================================================================" >> \$stat_out 2>&1
+ echo >> \$stat_out 2>&1
if test -n "\$saved_phid"; then
NCBI_LOG_HIT_ID=\$saved_phid
export NCBI_LOG_HIT_ID
fi
case "$x_compiler" in
MSVC )
- test_stat_load "\$(cygpath -w "\$x_test_rep")" "\$(cygpath -w "\$x_test_out")" "\$(cygpath -w "\$x_boost_rep")" "\$(cygpath -w "\$top_srcdir/build_info")" >> "\$build_dir/test_stat_load.log" 2>&1
+ # To avoid problems with retry script:
+ # - convert Cygwin paths to Windows paths
+ # - convert back slashes to forward slashes
+ args=""
+ for arg in "\$(cygpath -w "\$x_test_rep")" "\$(cygpath -w "\$x_test_out")" "\$(cygpath -w "\$x_boost_rep")" "\$(cygpath -w "\$top_srcdir/build_info")"; do
+ args="\$args \$arg"
+ done
+ args=\`echo \$args | tr '\\\\\' '/'\`
+ \$retry \$stat_out test_stat_load \$args
;;
XCODE )
- $NCBI/bin/_production/CPPCORE/test_stat_load "\$x_test_rep" "\$x_test_out" "\$x_boost_rep" "\$top_srcdir/build_info" >> "\$build_dir/test_stat_load.log" 2>&1
+ \$retry \$stat_out $NCBI/bin/_production/CPPCORE/test_stat_load "\$x_test_rep" "\$x_test_out" "\$x_boost_rep" "\$top_srcdir/build_info"
;;
esac
- echo >> "\$build_dir/test_stat_load.log" 2>&1
+ case \$? in
+ 0 )
+ echo "OK: [\$build_tree/\$build_cfg] \$x_name" >> \$stat_out 2>&1 ;;
+ 4 )
+ echo "TO: Error loading results for [\$build_tree/\$build_cfg] \$x_name" >> \$stat_out 2>&1 ;;
+ * )
+ echo "ERR: Error loading results for [\$build_tree/\$build_cfg] \$x_name" >> \$stat_out 2>&1 ;;
+ esac
+ echo >> \$stat_out 2>&1
+ cat \$stat_out >> "\$build_dir/test_stat_load.log" 2>&1
+ rm -f \$stat_out > /dev/null 2>&1
fi
if test \$is_run -a -n "\$saved_phid"; then
rm -f \$saved_phid* > /dev/null 2>&1
#! /bin/sh
-# $Id: check_make_unix.sh 666773 2023-05-01 18:05:45Z ivanov $
+# $Id: check_make_unix.sh 680027 2024-03-08 18:23:04Z ivanov $
# Author: Vladimir Ivanov, NCBI
#
###########################################################################
if test -f "$x_conf_dir/status/MaxDebug.enabled"; then
is_max_debug=true
fi
-if test "\$NCBI_CHECK_SETLIMITS" != "0" -a ! \$is_max_debug; then
+if test "\$NCBI_CHECK_SETLIMITS" != "0" -a \$is_max_debug = false; then
ulimit -c 1000000
ulimit -n 8192
if [ \$cygwin = false ]; then
if test "\$NCBI_CHECK_TOOLS" = "regular"; then
- ulimit -v 48000000
+ ulimit -v 110000000
else
# Increase memory limits if run under check tool
- ulimit -v 64000000
+ ulimit -v 150000000
fi
fi
fi
exec_time=\`\$build_dir/sysdep.sh tl 7 \$x_log | tr '\n\r' '%%' | tr -d '\000-\037' | tr -d '\176-\377'\`
echo \$exec_time | egrep 'real [0-9]|Maximum execution .* is exceeded' > /dev/null 2>&1
if test \$? -eq 0; then
- exec_time=\`echo \$exec_time | \\
+ exec_time=\`echo \$exec_time | tr -d '\n\r' | \\
sed -e 's/%%/%/g' \\
-e 's/%$//' \\
-e 's/%/, /g' \\
# Always load test results for automated builds on a 'run' command.
if \$is_run && \$is_db_load; then
- echo "======================================================================" >> "\$build_dir/test_stat_load.log" 2>&1
- echo "[\$x_work_dir_tail] \$x_name" >> "\$build_dir/test_stat_load.log" 2>&1
- echo "" >> "\$build_dir/test_stat_load.log" 2>&1
+ stat_out="./test_stat_load.tmp.\$x_app"
+ retry="\${script_dir}/common/check/retry_db_load.sh"
+ echo "======================================================================" >> \$stat_out 2>&1
+ echo "[\$x_work_dir_tail] \$x_name" >> \$stat_out 2>&1
+ echo "======================================================================" >> \$stat_out 2>&1
+ echo >> \$stat_out 2>&1
if test -n "\$saved_phid"; then
NCBI_LOG_HIT_ID=\$saved_phid
export NCBI_LOG_HIT_ID
fi
case \`uname -s\` in
CYGWIN* )
- test_stat_load "\$(cygpath -w "\$x_test_rep")" "\$(cygpath -w "\$x_test_out")" "\$(cygpath -w "\$x_boost_rep")" "\$(cygpath -w "\$top_srcdir/build_info")" >> "$x_build_dir/test_stat_load.log" 2>&1 ;;
+ # To avoid problems with retry script:
+ # - convert Cygwin paths to Windows paths
+ # - convert back slashes to forward slashes
+ args=""
+ for arg in "\$(cygpath -w "\$x_test_rep")" "\$(cygpath -w "\$x_test_out")" "\$(cygpath -w "\$x_boost_rep")" "\$(cygpath -w "\$top_srcdir/build_info")"; do
+ args="\$args \$arg"
+ done
+ args=\`echo \$args | tr '\\\\\' '/'\`
+ \$retry \$stat_out test_stat_load \$args
+ ;;
IRIX* )
- test_stat_load.sh "\$x_test_rep" "\$x_test_out" "\$x_boost_rep" "\$top_srcdir/build_info" >> "$x_build_dir/test_stat_load.log" 2>&1 ;;
+ \$retry \$stat_out test_stat_load.sh "\$x_test_rep" "\$x_test_out" "\$x_boost_rep" "\$top_srcdir/build_info" ;;
* )
- test_stat_load "\$x_test_rep" "\$x_test_out" "\$x_boost_rep" "\$top_srcdir/build_info" >> "$x_build_dir/test_stat_load.log" 2>&1 ;;
- esac
- echo >> "$x_build_dir/test_stat_load.log" 2>&1
+ \$retry \$stat_out test_stat_load "\$x_test_rep" "\$x_test_out" "\$x_boost_rep" "\$top_srcdir/build_info" ;;
+ esac
+ case \$? in
+ 0 )
+ echo "OK: [\$x_work_dir_tail] \$x_name" >> \$stat_out 2>&1 ;;
+ 4 )
+ echo "TO: Error loading results for [\$x_work_dir_tail] \$x_name" >> \$stat_out 2>&1 ;;
+ * )
+ echo "ERR: Error loading results for [\$x_work_dir_tail] \$x_name" >> \$stat_out 2>&1 ;;
+ esac
+ echo >> \$stat_out 2>&1
+ cat \$stat_out >> "\$build_dir/test_stat_load.log" 2>&1
+ rm -f \$stat_out > /dev/null 2>&1
fi
if test \$is_run -a -n "\$saved_phid"; then
- rm -f \$saved_phid* > /dev/null 2>&1
+ rm -f \$saved_phid* > /dev/null 2>&1
fi
done # Run test under all specified check tools
#! /bin/sh
-# $Id: check_make_unix_cmake.sh 670428 2023-07-25 12:16:14Z ivanov $
+# $Id: check_make_unix_cmake.sh 680027 2024-03-08 18:23:04Z ivanov $
# Author: Vladimir Ivanov, NCBI
#
###########################################################################
if test -f "\${conf_dir}/status/MaxDebug.enabled"; then
is_max_debug=true
fi
-if test "\$NCBI_CHECK_SETLIMITS" != "0" -a ! \$is_max_debug; then
+if test "\$NCBI_CHECK_SETLIMITS" != "0" -a \$is_max_debug = false; then
ulimit -c 1000000
ulimit -n 8192
if [ \$cygwin = false ]; then
if test "\$NCBI_CHECK_TOOLS" = "regular"; then
- ulimit -v 48000000
+ ulimit -v 110000000
else
# Increase memory limits if run under check tool
- ulimit -v 64000000
+ ulimit -v 150000000
fi
fi
fi
exec_time=\`\${checkroot}/sysdep.sh tl 7 \$x_log | tr '\n\r' '%%' | tr -d '\000-\037' | tr -d '\176-\377'\`
echo \$exec_time | egrep 'real [0-9]|Maximum execution .* is exceeded' > /dev/null 2>&1
if test \$? -eq 0; then
- exec_time=\`echo \$exec_time | \\
+ exec_time=\`echo \$exec_time | tr -d '\n\r' | \\
sed -e 's/%%/%/g' \\
-e 's/%$//' \\
-e 's/%/, /g' \\
if \$is_run && \$is_db_load; then
while ! mkdir "\$checkdir/~test_stat_load.lock" 2>/dev/null
do
- sleep 1
+ sleep 1
done
- if test -n "\$saved_phid"; then
- NCBI_LOG_HIT_ID=\$saved_phid
- export NCBI_LOG_HIT_ID
- fi
- case \`uname -s\` in
- CYGWIN* )
- test_stat_load "\$(cygpath -w "\$x_test_rep")" "\$(cygpath -w "\$x_test_out")" "\$(cygpath -w "\$x_boost_rep")" "\$(cygpath -w "\$top_srcdir/build_info")" >> "\${checkdir}/test_stat_load.log" 2>&1 ;;
- IRIX* )
- test_stat_load.sh "\$x_test_rep" "\$x_test_out" "\$x_boost_rep" "\$top_srcdir/build_info" >> "\${checkdir}/test_stat_load.log" 2>&1 ;;
- * )
- test_stat_load "\$x_test_rep" "\$x_test_out" "\$x_boost_rep" "\$top_srcdir/build_info" >> "\${checkdir}/test_stat_load.log" 2>&1 ;;
+ stat_out="\${checkdir}/test_stat_load.tmp.\$x_name"
+ retry="\${script_dir}/common/check/retry_db_load.sh"
+ echo "======================================================================" >> \$stat_out 2>&1
+ echo "[\$x_work_dir_tail] \$x_name" >> \$stat_out 2>&1
+ echo "======================================================================" >> \$stat_out 2>&1
+ echo >> \$stat_out 2>&1
+ if test -n "\$saved_phid"; then
+ NCBI_LOG_HIT_ID=\$saved_phid
+ export NCBI_LOG_HIT_ID
+ fi
+ case \`uname -s\` in
+ CYGWIN* )
+ # To avoid problems with retry script:
+ # - convert Cygwin paths to Windows paths
+ # - convert back slashes to forward slashes
+ args=""
+ for arg in "\$(cygpath -w "\$x_test_rep")" "\$(cygpath -w "\$x_test_out")" "\$(cygpath -w "\$x_boost_rep")" "\$(cygpath -w "\$top_srcdir/build_info")"; do
+ args="\$args \$arg"
+ done
+ args=\`echo \$args | tr '\\\\\' '/'\`
+ \$retry \$stat_out test_stat_load \$args
+ ;;
+ IRIX* )
+ \$retry \$stat_out test_stat_load.sh "\$x_test_rep" "\$x_test_out" "\$x_boost_rep" "\$top_srcdir/build_info" ;;
+ * )
+ \$retry \$stat_out test_stat_load "\$x_test_rep" "\$x_test_out" "\$x_boost_rep" "\$top_srcdir/build_info" ;;
+ esac
+ case \$? in
+ 0 )
+ echo "OK: [\$x_work_dir_tail] \$x_name" >> \$stat_out 2>&1 ;;
+ 4 )
+ echo "TO: Error loading results for [\$x_work_dir_tail] \$x_name" >> \$stat_out 2>&1 ;;
+ * )
+ echo "ERR: Error loading results for [\$x_work_dir_tail] \$x_name" >> \$stat_out 2>&1 ;;
esac
- echo >> "\${checkdir}/test_stat_load.log" 2>&1
+ echo >> \$stat_out 2>&1
+ cat \$stat_out >> "\${checkdir}/test_stat_load.log" 2>&1
+ rm -f \$stat_out > /dev/null 2>&1
rm -rf "\$checkdir/~test_stat_load.lock"
fi
if test \$is_run -a -n "\$saved_phid"; then
a_run=\`ls \${checkdir}/*.in_progress 2>/dev/null\`
a_run=\`echo \$a_run | wc -w | sed -e 's/ //g'\`
if test "\${a_run}" -ne "\${a_run}"; then
-echo "error: 1 a_run = \$a_run"
a_run=0
fi
a_run=\`ls \${checkdir}/*.in_progress 2>/dev/null\`
a_run=\`echo \$a_run | wc -w | sed -e 's/ //g'\`
if test "\${a_run}" -ne "\${a_run}"; then
-echo "error: 2 a_run = \$a_run"
break
fi
if test "\${a_run}" -le 0; then
#! /bin/sh
-# $Id: check_run.sh 565074 2018-06-06 15:06:53Z ivanov $
+# $Id: check_run.sh 677875 2024-01-24 18:52:55Z ivanov $
# Author: Vladimir Ivanov, NCBI
#
###########################################################################
if test -n "$NCBI_AUTOMATED_BUILD" -a -z "$TEAMCITY_VERSION"; then
# Report test_stat_load errors if any
if [ -f "$build_dir/test_stat_load.log" ]; then
- grep "test_stat_load Error" $build_dir/test_stat_load.log > /tmp/$$.mail_stat
+ grep "ERR: " $build_dir/test_stat_load.log > /tmp/$$.mail_stat
if [ $? -eq 0 ] ; then
cat <<-EOF >> /tmp/$$.mail_stat
--- /dev/null
+#! /bin/sh
+# $Id: retry_db_load.sh 677889 2024-01-24 19:09:08Z ivanov $
+#
+# Author: Vladimir Ivanov
+#
+# Helper to load test results to a Database and retry if necessary
+# to avoid possible lock/timeout issues.
+#
+# USAGE:
+# retry_db_load.sh <output_file> <command line to run>
+#
+# Exit codes:
+# 0 - success
+# 4 - timeout
+# * - error (any other codes except 0 and 4)
+
+
+#---------------- Arguments ----------------
+
+script="$0"
+
+if [ "$#" -le 2 ]; then
+ echo "USAGE: `basename $script` <output_file> <command line to run>"
+ exit 1
+fi
+
+out=$1
+shift
+cmdline=$*
+
+#---------------- Configuration ----------------
+
+# Maximum number of attempts
+max_attempts=3
+
+#---------------- Main -------------------------
+
+attempt=1
+status=0
+
+while [ "$attempt" -le "$max_attempts" ]
+do
+ # Run build
+ (eval $cmdline) >> $out 2>&1
+ if [ $? -eq 0 ] ; then
+ # Success
+ exit 0
+ fi
+ status=1
+
+ tryagain=false
+ grep "Server connection timed out" $out > /dev/null 2>&1 && tryagain=true
+
+ # Stop on any other error
+ $tryagain || exit $status
+
+ # Try again
+ attempt=`expr $attempt + 1`
+ if [ "$attempt" -le "$max_attempts" ]; then
+ echo >> $out
+ echo "retrying..." >> $out
+ fi
+ status=4
+done
+
+exit $status
echo "[`date`]"
-svn_location=`echo '$URL: https://svn.ncbi.nlm.nih.gov/repos/toolkit/release/blast/2.15.0/c++/scripts/common/impl/install.sh $' | sed "s%\\$[U]RL: *\\([^$][^$]*\\) \\$.*%\\1%"`
+svn_location=`echo '$URL: https://svn.ncbi.nlm.nih.gov/repos/toolkit/release/blast/2.16.0/c++/scripts/common/impl/install.sh $' | sed "s%\\$[U]RL: *\\([^$][^$]*\\) \\$.*%\\1%"`
svn_revision=`echo '$Revision: 631931 $' | sed "s%\\$[R]evision: *\\([^$][^$]*\\) \\$.*%\\1%"`
script_name=`basename $0`
-# $Id: ncbicxx_build_info.py 662641 2023-02-03 14:13:00Z ucko $
+# $Id: ncbicxx_build_info.py 675074 2023-11-14 13:33:27Z ivanov $
import ast
from datetime import date, datetime, timedelta, timezone
from distutils.sysconfig import parse_makefile, expand_makefile_vars
def get_vcs_info(self, srcdir, rest = (), fallback = None):
if os.path.isdir(os.path.join(srcdir, '.svn')):
return self.get_svn_info(srcdir, rest)
- elif os.path.isdir(os.path.join(srcdir, '.git')):
+ elif os.path.exists(os.path.join(srcdir, '.git')):
return self.get_git_info(srcdir, rest)
elif len(rest) == 0 and os.path.isdir(os.path.join(srcdir, 'CVS')):
return self.get_cvs_info(srcdir)
break
if 'vcs_path' not in info:
# Maybe controlled by git after all, in a hybrid layout?
- if os.path.isdir(os.path.join(srcdir, '.git')):
+ if os.path.exists(os.path.join(srcdir, '.git')):
return self.get_git_info(srcdir, rest)
while srcdir != '/':
(srcdir, child) = os.path.split(srcdir)
- if os.path.isdir(os.path.join(srcdir, '.git')):
+ if os.path.exists(os.path.join(srcdir, '.git')):
return self.get_git_info(srcdir, (child,) + rest)
return None
return info
universal_newlines = True,
cwd = srcdir) as remote:
for l in remote.stdout:
- (k, v) = l.strip().split(': ', 1)
- if k == 'Fetch URL':
- url = v
- break
+ if 'Fetch URL: ' in l:
+ url = l.strip()[11:]
except subprocess.CalledProcessError:
pass
if url is None:
#!/bin/sh
#############################################################################
-# $Id: new_cmake_project.sh 638038 2021-09-22 19:38:26Z gouriano $
+# $Id: new_cmake_project.sh 674846 2023-11-06 19:12:27Z ivanov $
# Create new CMake project which uses prebuilt NCBI C++ toolkit from a sample
# Author: Andrei Gourianov, gouriano@ncbi
#############################################################################
echo
echo The following project types are available:
svn list -R $repository/$rep_src/$rep_sample | while IFS= read -r line; do
- if [[ $line =~ .*/$ ]]; then
+ case "$line" in */ )
count=`echo $line | tr -cd '/' | wc -c`
- if [[ $count -eq 2 ]]; then
+ if [ $count -eq 2 ]; then
prj=${line%?}
case "$prj" in
app/alnmgr) echo " app/alnmgr an application that uses Alignment Manager";;
*) echo " $prj";;
esac
fi
- fi
+ ;;
+ esac
done
fi
echo " "
#
# Filename: Manifest
#
-# $Id: Manifest 665494 2023-04-05 16:11:45Z camacho $
+# $Id: Manifest 679535 2024-02-27 20:05:14Z satskyse $
#
# Author: Christiam Camacho
#
#Linux64-Centos : icc : ICC.sh 1900 --with-static --without-dll --with-bin-release --with-strip --without-debug --without-pcre --with-mt --with-openmp --with-flat-makefile --with-experimental=Int8GI --without-gnutls --without-gcrypt --with-vdb=/panfs/traces01.be-md.ncbi.nlm.nih.gov/trace_software/vdb --with-static-vdb <ENV>OPENMP_FLAGS='-qopenmp -qopenmp-link=static';LDFLAGS=-Wl,--as-needed</ENV>
Linux64-Centos : gcc : GCC.sh --with-static --without-dll --with-bin-release --with-strip --without-debug --without-pcre --with-mt --with-openmp --with-flat-makefile --with-experimental=Int8GI --without-gnutls --without-gcrypt --with-vdb=/panfs/traces01.be-md.ncbi.nlm.nih.gov/trace_software/vdb --with-static-vdb
+Linux64-Alma : gcc : GCC.sh --with-static --without-dll --with-bin-release --with-strip --without-debug --without-pcre --with-mt --with-openmp --with-flat-makefile --with-experimental=Int8GI --without-gnutls --without-gcrypt --with-vdb=/panfs/traces01.be-md.ncbi.nlm.nih.gov/trace_software/vdb --with-static-vdb
#
#DEFAULT_CONFIGURATIONS: Linux64-Centos:icc
#IntelMAC : clang : Clang.sh --with-bin-release --without-debug --without-pcre --with-mt --with-openmp --with-flat-makefile --with-ncbi-public --with-experimental=Int8GI --without-vdb --without-gnutls --without-gcrypt
IntelMAC : clang : Clang.sh --without-dll --with-bin-release --without-debug --without-pcre --with-mt --without-openmp --with-flat-makefile --with-ncbi-public --with-experimental=Int8GI --without-gnutls --without-gcrypt --with-vdb=/net/snowman/vol/projects/trace_software/vdb/vdb-versions/cxx_toolkit/2 --with-static-vdb --without-lzo --without-zstd
+ArmMAC : clang : Clang.sh --without-dll --with-bin-release --without-debug --without-pcre --with-mt --without-openmp --with-flat-makefile --with-ncbi-public --with-experimental=Int8GI --without-gnutls --without-gcrypt --with-vdb=/net/snowman/vol/projects/trace_software/vdb/vdb-versions/cxx_toolkit/3 --with-static-vdb --without-lzo --without-zstd
+
+ArmMAC : clang-x86 : ../../configure --host=x86_64-apple-darwin21 --without-dll --with-bin-release --without-debug --without-pcre --with-mt --without-openmp --with-flat-makefile --with-ncbi-public --with-experimental=Int8GI --without-gnutls --without-gcrypt --with-vdb=/net/snowman/vol/projects/trace_software/vdb/vdb-versions/cxx_toolkit/3 --with-static-vdb --without-lzo --without-zstd <ENV>CC='clang -arch x86_64';CXX='clang++ -arch x86_64'</ENV>
+
USE_COMPONENTS
retval += "-ia32-linux"
elif platform.startswith("Linux64"):
retval += "-x64-linux"
- elif platform.startswith("IntelMAC"):
+ elif platform == "ArmMAC:clang":
+ retval += "-aarch64-macosx"
+ elif platform == "ArmMAC:clang-x86":
retval += "-x64-macosx"
elif platform == "SunOSSparc":
retval += "-sparc64-solaris"
def determine_platform():
""" Determines the platform (as defined in prepare_release) for the current
- hostname
+ host, i.e.: the output of the one-liner below
+
+ python3 -mplatform 'print platform.platform()'
"""
p = platform.platform().lower()
return "Win64"
else:
return "Win32"
- elif p.find("darwin") != -1 or p.find("macos") != -1:
- return "IntelMAC"
+ elif p.find("darwin") != -1 or (p.find("macos") != -1 and p.find("x86_64") == -1):
+ return "ArmMAC:clang"
+ elif p.find("darwin") != -1 or (p.find("macos") != -1 and p.find("x86_64") != -1):
+ return "ArmMAC:clang-x86"
else:
raise RuntimeError("Unknown platform: " + p)
--- /dev/null
+#!/bin/bash -x
+
+RELEASE=$1
+ARM_PATH="arm"
+x86_PATH="x86"
+UNIVERSAL_PATH="universal"
+RELEASE_TAG="ncbi-blast-${RELEASE}+"
+
+if [ -d "$ARM_PATH" ]; then
+ rm -rf $ARM_PATH
+fi
+if [ -d "$x86_PATH" ]; then
+rm -rf $x86_PATH
+fi
+
+if [ -d "$UNIVERSAL_PATH" ]; then
+rm -rf $UNIVERSAL_PATH
+fi
+
+mkdir $ARM_PATH
+mkdir $x86_PATH
+mkdir $UNIVERSAL_PATH
+
+x86_package="${RELEASE_TAG}-x64-macosx.tar.gz"
+cp $RELEASE/$x86_package $x86_PATH/
+tar -vxf $x86_PATH/$x86_package -C $x86_PATH/
+
+arm_package="${RELEASE_TAG}-aarch64-macosx.tar.gz"
+cp $RELEASE/$arm_package $ARM_PATH/
+tar -vxf $ARM_PATH/$arm_package -C $ARM_PATH/
+
+cp $RELEASE/$arm_package $UNIVERSAL_PATH/
+tar -vxf $UNIVERSAL_PATH/$arm_package -C $UNIVERSAL_PATH/
+
+blast_programs=("blast_formatter"
+"blast_formatter_vdb"
+"blast_vdb_cmd"
+"blastdb_aliastool"
+"blastdbcheck"
+"blastdbcmd"
+"blastn"
+"blastn_vdb"
+"blastp"
+"blastx"
+"convert2blastmask"
+"deltablast"
+"dustmasker"
+"makeblastdb"
+"makembindex"
+"makeprofiledb"
+"psiblast"
+"rpsblast"
+"rpstblastn"
+"segmasker"
+"tblastn"
+"tblastn_vdb"
+"tblastx"
+"windowmasker")
+
+for program in "${blast_programs[@]}"
+do
+rm $UNIVERSAL_PATH/${RELEASE_TAG}/bin/$program
+done
+
+for program in "${blast_programs[@]}"
+do
+lipo -create $ARM_PATH/${RELEASE_TAG}/bin/$program $x86_PATH/${RELEASE_TAG}/bin/$program -output $UNIVERSAL_PATH/${RELEASE_TAG}/bin/$program
+done
+
+rm -rf $ARM_PATH
+rm -rf $x86_PATH
+POST_BUILD_DIR="blast/post_build/macosx"
+$POST_BUILD_DIR/ncbi-blast.sh universal/${RELEASE_TAG} $POST_BUILD_DIR $RELEASE
+cd $UNIVERSAL_PATH
+mv ${RELEASE_TAG}/installer/${RELEASE_TAG}.dmg ./${RELEASE_TAG}-universal.dmg
+rm -rf ${RELEASE_TAG}/install
+tar czf ${RELEASE_TAG}-universal-macosx.tar.gz $RELEASE_TAG
+
+rm -rf $RELEASE_TAG
+rm $arm_package
+/sbin/md5 -r ${RELEASE_TAG}-universal-macosx.tar.gz > ${RELEASE_TAG}-universal-macosx.tar.gz.md5
+/sbin/md5 -r ${RELEASE_TAG}-universal.dmg > ${RELEASE_TAG}-universal.dmg.md5
+
+
du -shc $PRODUCT # For diagnostics
# Note: if this command fails, it could be because the -size argument is no
# longer large enough, adjust accordingly
- /usr/bin/hdiutil create $PRODUCT.dmg -srcfolder $PRODUCT -verbose -size 300m
+ /usr/bin/hdiutil create $PRODUCT.dmg -srcfolder $PRODUCT -verbose -size 500m
mkdir $INSTALLDIR/installer
mv $PRODUCT.dmg $INSTALLDIR/installer
}
--- /dev/null
+#!/bin/sh
+#
+# $Id: build_uninstaller.sh 683372 2024-05-24 16:08:21Z merezhuk $
+# * ===========================================================================
+# *
+# * PUBLIC DOMAIN NOTICE
+# * National Center for Biotechnology Information
+# *
+# * This software/database is a "United States Government Work" under the
+# * terms of the United States Copyright Act. It was written as part of
+# * the author's official duties as a United States Government employee and
+# * thus cannot be copyrighted. This software/database is freely available
+# * to the public for use. The National Library of Medicine and the U.S.
+# * Government have not placed any restriction on its use or reproduction.
+# *
+# * Although all reasonable efforts have been taken to ensure the accuracy
+# * and reliability of the software and data, the NLM and the U.S.
+# * Government do not and cannot warrant the performance or results that
+# * may be obtained by using this software or data. The NLM and the U.S.
+# * Government disclaim all warranties, express or implied, including
+# * warranties of performance, merchantability or fitness for any particular
+# * purpose.
+# *
+# * Please cite the author in any work or product based on this material.
+# *
+# * ===========================================================================
+# *
+# * Authors: Yury Merezhuk
+# *
+#
+
+ASCRIPT=uninstall_ncbi_blast.applescript
+APP_NAME=uninstall_ncbi_blast.app
+ZIP_NAME=uninstall_ncbi_blast.zip
+OSACOMPILE="/usr/bin/osacompile"
+
+#
+# Check re requisites
+#
+if [ ! -f ${ASCRIPT} ] ; then
+ echo "Error: missing ${ASCRIPT}"
+ exit 1
+fi
+
+if [ ! -x ${OSACOMPILE} ] ; then
+ echo "Error: missing AppleScript compiler ${OSACOMPILE}"
+ exit 2
+fi
+if [ X`which zip` = X ] ; then
+ echo "Error: missing zip utility."
+ exit 22
+fi
+if [ X`which unzip` = X ] ; then
+ echo "Error: missing unzip utility."
+ exit 23
+fi
+if [ X`which awk` = X ] ; then
+ echo "Error: missing awk utility."
+ exit 23
+fi
+
+
+# Some clean ups
+if [ -f ${ZIP_NAME} ] ; then
+ tm_mark=`date +%s`
+ mv ${ZIP_NAME} ${ZIP_NAME}.${tm_mark}
+ if [ ! -f ${ZIP_NAME}.${tm_mark} ] ; then
+ echo "Error: Can't move old ${ZIP_NAME} to ${ZIP_NAME}.${tm_mark}"
+ exit 3
+ else
+ echo "Info: old ${ZIP_NAME} renamed to ${ZIP_NAME}.${tm_mark}"
+ fi
+fi
+
+if [ -d ${APP_NAME} ] ; then
+ rm -rf ${APP_NAME}
+fi
+
+# ..... Compile new version
+${OSACOMPILE} -o ${APP_NAME} ${ASCRIPT}
+if [ ! -d ${APP_NAME} ] ; then
+ echo "Error: Can't compile ${ASCRIPT} to Application"
+ exit 4
+fi
+echo "Info:"
+echo "Info: Application ${APP_NAME} created"
+find uninstall_ncbi_blast.app | awk '{ print "Info: "$0}'
+# .... create zip archive
+zip -q -r ${ZIP_NAME} ${APP_NAME}
+if [ ! -f ${ZIP_NAME} ] ; then
+ echo "Error: Can't create zip archive from ${APP_NAME}"
+ exit 5
+fi
+echo "Info:"
+echo "Info: Zip archive ${ZIP_NAME} created"
+unzip -l uninstall_ncbi_blast.zip | awk '{ print "Info: "$0}'
+echo "Info: Done."
+
+
+
+
+
+
--- /dev/null
+-- $Id: uninstall_ncbi_blast.applescript 683376 2024-05-24 16:10:57Z merezhuk $
+-- * ===========================================================================
+-- *
+-- * PUBLIC DOMAIN NOTICE
+-- * National Center for Biotechnology Information
+-- *
+-- * This software/database is a "United States Government Work" under the
+-- * terms of the United States Copyright Act. It was written as part of
+-- * the author's official duties as a United States Government employee and
+-- * thus cannot be copyrighted. This software/database is freely available
+-- * to the public for use. The National Library of Medicine and the U.S.
+-- * Government have not placed any restriction on its use or reproduction.
+-- *
+-- * Although all reasonable efforts have been taken to ensure the accuracy
+-- * and reliability of the software and data, the NLM and the U.S.
+-- * Government do not and cannot warrant the performance or results that
+-- * may be obtained by using this software or data. The NLM and the U.S.
+-- * Government disclaim all warranties, express or implied, including
+-- * warranties of performance, merchantability or fitness for any particular
+-- * purpose.
+-- *
+-- * Please cite the author in any work or product based on this material.
+-- *
+-- * ===========================================================================
+-- *
+-- * Authors: Yury Merezhuk
+--
+-- This is AppleScript file to uninstall BLAST+ package.
+--
+property svn_date : "$Revision: 683376 $"
+
+on run
+ set blast_folder to POSIX file "/usr/local/ncbi/blast" -- DEFAULT. Not used.
+ set blast_path to POSIX file "/etc/paths.d/ncbi_blast" -- DEFAULT
+
+ if not DasExist(blast_path) then
+ return
+ end if
+ -- Discover actual BLAST+ binaries location by reading PATH settings
+ set blast_bin_path to (read file blast_path)
+ set blast_user_folder to POSIX file findAndReplaceInText(blast_bin_path, "/bin" & linefeed, "")
+ -- log "DEBUG: READ: blast_bin_path: " & blast_bin_path
+
+ -- Ask user to actually uninstall BLAST+ binaries?
+ set theAlertText to "Attention"
+ set theAlertMessage to "Proceed to uninstall BLAST+ binaries " & linefeed & "from " & POSIX file blast_user_folder & " ?" & linefeed & linefeed & linefeed & linefeed & linefeed & svn_date
+ set user_choice to button returned of (display alert theAlertText message theAlertMessage as critical buttons {"Don't Continue", "Continue"} default button "Continue" cancel button "Don't Continue")
+ if user_choice is "Don't Continue" then return
+
+ -- log "DO UNINSTALL."
+ -- log "blast_folder (default): " & blast_folder
+ -- log "blast_user_folder (from path): " & blast_user_folder
+
+
+
+
+ -- Check if anything to delete...
+ if DasExist(blast_user_folder) then
+ -- Actual deletion.
+ try
+ -- Actual delete operation
+ tell application "Finder"
+ delete (files of folder blast_user_folder) & (folders of folder blast_user_folder) & (delete blast_user_folder) & (delete blast_path)
+ -- log blast_user_folder
+ end tell
+ on error e number n
+ -- display dialog "Uninstallation error code: " & n & " : " & e
+ end try
+ display dialog "BLAST+ binaries uninstalled and moved to Trash"
+ end if
+
+
+
+end run
+
+-- Utility function check file/folder existance via resolving alias
+-- https://developer.apple.com/library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide/conceptual/ASLR_fundamentals.html#//apple_ref/doc/uid/TP40000983-CH218-SW28
+on DasExist(checked_file_folder)
+ try
+ alias checked_file_folder
+ return true
+ on error
+ return false
+ end try
+end DasExist
+
+-- Utility function: string find/replace
+-- https://developer.apple.com/library/archive/documentation/LanguagesUtilities/Conceptual/MacAutomationScriptingGuide/ManipulateText.html
+--
+on findAndReplaceInText(theText, theSearchString, theReplacementString)
+ set AppleScript's text item delimiters to theSearchString
+ set theTextItems to every text item of theText
+ set AppleScript's text item delimiters to theReplacementString
+ set theText to theTextItems as string
+ set AppleScript's text item delimiters to ""
+ return theText
+end findAndReplaceInText
#!/usr/bin/env python3
"""Driver program for post-build processing"""
-# $Id: make_installers.py 667857 2023-05-22 20:23:21Z camacho $
+# $Id: make_installers.py 677959 2024-01-25 20:27:47Z camacho $
#
# Author: Christiam Camacho
#
if platform == "FreeBSD32" or platform.startswith("SunOS") or \
platform.startswith("Linux32"):
return do_nothing(platform)
- if platform.startswith("IntelMAC"):
+ if platform.startswith("ArmMAC"):
return mac_post_build(installdir, blast_version)
print("Unknown OS identifier:" + platform, file=sys.stderr)
Name: ncbi-blast
Version: BLAST_VERSION+
-Release: 3
+Release: 1
Source0: %{name}-%{version}.tgz
Summary: NCBI BLAST finds regions of similarity between biological sequences.
Exclusiveos: linux
util/tables$
util/creaders$
util/checksum
-util/compress$
-util/compress/bzip2$
-util/compress/zlib$
-util/compress/api
+util/compress
util/regexp
util/xregexp
util/sequtil$
sra$
sra/data_loaders
-sra/data_loaders/wgs/test
+-sra/data_loaders/snp/test
sra/readers$
sra/readers/sra/impl$
sra/readers/bam$
retval += "-ia32-linux"
elif platform.startswith("Linux64"):
retval += "-x64-linux"
- elif platform.startswith("IntelMAC"):
+ elif platform.startswith("ArmMAC"):
retval += "-x64-macosx"
elif platform == "SunOSSparc":
retval += "-sparc64-solaris"
else:
return "Win32"
elif p.find("darwin") != -1:
- return "IntelMAC"
+ return "ArmMAC"
else:
raise RuntimeError("Unknown platform: " + p)
#!/usr/bin/env python3
"""Driver program for post-build processing"""
-# $Id: make_installers.py 544372 2017-08-22 17:51:41Z boratyng $
+# $Id: make_installers.py 677967 2024-01-25 20:34:59Z camacho $
#
# Author: Christiam Camacho
#
if platform == "FreeBSD32" or platform.startswith("SunOS") or \
platform.startswith("Linux32"):
return do_nothing(platform)
- if platform.startswith("IntelMAC"):
+ if platform.startswith("ArmMAC"):
return mac_post_build(installdir, blast_version)
print("Unknown OS identifier:" + platform, file=sys.stderr)
February 24, 2023, CXX-12875
version 2.23.1
Corrected list of generated files, added RPC client ones.
+
+April 15, 2024, CXX-13563
+version 2.24.0
+Dropped generation of empty union.
#
# Filename: Manifest
#
-# $Id: Manifest 649757 2022-05-10 14:01:12Z gouriano $
+# $Id: Manifest 681808 2024-04-15 17:33:26Z gouriano $
#
# Author: Sergey Satskiy
#
FreeBSD64 : plain : Clang.sh --without-debug --without-mt --with-static --without-runpath --with-flat-makefile --without-ncbi-c --without-downloaded-vdb
-IntelMAC : plain : GCC.sh --without-debug --without-mt --with-static --without-runpath --with-flat-makefile --without-ncbi-c --without-downloaded-vdb
+#IntelMAC : plain : GCC.sh --without-debug --without-mt --with-static --without-runpath --with-flat-makefile --without-ncbi-c --without-downloaded-vdb
+ArmMAC : plain : Clang.sh --without-debug --without-mt --with-static --without-runpath --with-flat-makefile --without-ncbi-c --without-downloaded-vdb
Win64_19 : static-64 : static 64 ReleaseMT
[components]
-infrastructure 27.0
-core 27.0
+infrastructure 28.0
+core 28.0
+++ /dev/null
- PUBLIC DOMAIN NOTICE
- National Center for Biotechnology Information
-
- This software/database is a "United States Government Work" under the
- terms of the United States Copyright Act. It was written as part of
- the author's official duties as a United States Government employee and
- thus cannot be copyrighted. This software/database is freely available
- to the public for use. The National Library of Medicine and the U.S.
- Government have not placed any restriction on its use or reproduction.
-
- Although all reasonable efforts have been taken to ensure the accuracy
- and reliability of the software and data, the NLM and the U.S.
- Government do not and cannot warrant the performance or results that
- may be obtained by using this software or data. The NLM and the U.S.
- Government disclaim all warranties, express or implied, including
- warranties of performance, merchantability or fitness for any particular
- purpose.
-
- Please cite the author in any work or product based on this material.
+++ /dev/null
-# $Id: Manifest 620990 2020-12-03 17:40:24Z lavr $
-#
-# Author: Sergey Satskiy
-#
-# Purpose: This file holds all the supported configurations of a package.
-# It is used by release configurator.
-#
-
-APP: lbsmd lbsmc lbsm_feedback
-APP: launcherd fwdaemon servnsd dispd.cgi
-APP: ncbi_dblb_cli
-
-LIB: libconnect.a libconnext.a libmghbn.a liblbsmdapi.a
-
-DEFAULT_CONFIGURATIONS: Linux64-Centos:GCC
-
-COPY: $bindir/test_mghbn $installdir/bin/ncbi_mghbn
-COPY: $bindir/test_ncbi_dblb $installdir/bin/ncbi_dblb
-COPY: $srcdir/src/connect/daemons/mod/*mod* $installdir/src/
-COPY: $srcdir/include/connect/*.h $installdir/include/connect/
-COPY: $srcdir/include/connect/ext/*.h $installdir/include/connect/ext/
-COPY: $srcdir/include/connect/daemons/*.h $installdir/include/connect/daemons/
-COPY: $srcdir/include/internal/signon3/id.h $installdir/include/internal/signon3/
-
-POSTBUILD: [ "$platform" != "Cygwin64" ] || { cp -vp /bin/cyg{check,runsrv}.exe $installdir/bin/; }
-POSTBUILD: [ "$platform" != "Cygwin64" ] || { cp -vp /bin/cyg{bz2-1,iconv-2,intl-8,win1,z}.dll $installdir/bin/; }
-POSTBUILD: [ "$platform" != "Cygwin64" ] || { cp -vp /usr/{bin/ipcs,bin/true,sbin/cygserver}.exe $installdir/bin/; }
-
-# Each line describes a single configuration
-# The format is as follows:
-# <HardwareIdentifier> : <ReleaseSuffix> : <CompilerConfigurationScriptWithKeys>
-# Configuration script is relative to c++/compilers/unix/ .
-# Release configurator assumes that this script will eventually call standard configure script and pass all options
-# to it. So some standard options may be added by release configurator, such as --build-root-sfx, --with-projects,
-# --with-distcc, --with-action etc.
-Linux64-Centos : ICC : ICC.sh --without-debug --without-mt --with-static --without-runpath --with-local-lbsm --without-gnutls --without-vdb --without-serial --with-flat-makefile
-Linux64-Centos : GCC : GCC.sh --without-debug --without-mt --with-static --without-runpath --with-local-lbsm --without-gnutls --without-vdb --without-serial --with-flat-makefile
-FreeBSD64 : Clang : Clang.sh --without-debug --without-mt --with-static --without-runpath --with-local-lbsm --without-gnutls --without-vdb --without-serial --with-flat-makefile
-IntelMAC : GCC : GCC.sh --without-debug --without-mt --with-static --without-runpath --with-local-lbsm --without-gnutls --without-vdb --without-serial --with-flat-makefile
-Cygwin64 : GCC : GCC.sh --without-debug --without-mt --with-static --without-runpath --with-local-lbsm --without-gnutls --without-vdb --without-serial --without-flat-makefile --with-bin-release --with-connext --with-ncbi-crypt --without-krb5 LDFLAGS=-static-libgcc
+++ /dev/null
-https://ncbi.github.io/cxx-toolkit/pages/ch_app#ch_app.Load_Balancing
+++ /dev/null
-./include/corelib/impl$
-./include/common$
-./include/util$
-corelib$
-connect$
-connect/ext
-connect/mbedtls
-connect/daemons$
-connect/daemons/mod$
-internal/signon3$ update-only
-app$
-app/dblb
-dbapi$
-dbapi/driver$
-dbapi/driver/impl$
-dbapi/driver/util$
-dbapi/driver/odbc/unix_odbc$ update-only
-dbapi/driver/ctlib$
-dbapi/driver/ftds100$
-dbapi/driver/ftds100/impl
-dbapi/driver/ftds100/ctlib$
-dbapi/driver/ftds100/freetds
--dbapi/driver/ftds100/ctlib/samples
-dbapi/driver/ftds-default
-dbapi/simple$
-util
+++ /dev/null
-Apr 12, 2011
-prepare_release framework configuration initialised for the project
+++ /dev/null
- PUBLIC DOMAIN NOTICE
- National Center for Biotechnology Information
-
- This software/database is a "United States Government Work" under the
- terms of the United States Copyright Act. It was written as part of
- the author's official duties as a United States Government employee and
- thus cannot be copyrighted. This software/database is freely available
- to the public for use. The National Library of Medicine and the U.S.
- Government have not placed any restriction on its use or reproduction.
-
- Although all reasonable efforts have been taken to ensure the accuracy
- and reliability of the software and data, the NLM and the U.S.
- Government do not and cannot warrant the performance or results that
- may be obtained by using this software or data. The NLM and the U.S.
- Government disclaim all warranties, express or implied, including
- warranties of performance, merchantability or fitness for any particular
- purpose.
-
- Please cite the author in any work or product based on this material.
+++ /dev/null
-#
-# Filename: Manifest
-#
-# $Id: Manifest 562491 2018-04-23 15:59:02Z fukanchi $
-#
-# Author: Alexey Rafanovich
-#
-# Purpose: This file holds all the supported configurations of a package
-# It is used by release configurator.
-#
-
-APP: fwdaemon
-
-COPY: $srcdir/src/connect/daemons/fwdaemon_conn_stats.py $installdir/
-COPY: $srcdir/src/connect/daemons/fwdaemon_fallback_cmp.py $installdir/
-COPY: $srcdir/src/connect/daemons/fwdaemon_high_load_analysis.py $installdir/
-COPY: $srcdir/src/connect/daemons/fwdaemon_purge_abusers.py $installdir/
-
-DEFAULT_CONFIGURATIONS: Linux64-Centos:GCC
-
-Linux64-Centos : GCC : GCC.sh --without-debug --without-mt --with-static --without-runpath --with-local-lbsm --without-gnutls --without-vdb --without-serial --with-flat-makefile
+++ /dev/null
-http://www.ncbi.nlm.nih.gov/toolkit/doc/book/ch_app/#ch_app.Firewall_Daemon_FWDa
+++ /dev/null
-#define TAGS fwdaemon
-./include/corelib$
-./include/util$
-connect$
-connect/ext$
-connect/daemons$
#
# Filename: Manifest
#
-# $Id: Manifest 665694 2023-04-11 20:01:33Z jianye $
+# $Id: Manifest 679124 2024-02-16 20:40:08Z camacho $
#
# Author: Christiam Camacho
#
IntelMAC : clang : Clang.sh --without-dll --with-bin-release --without-debug --without-pcre --without-openmp --with-mt --with-flat-makefile --with-ncbi-public --with-vdb=/net/snowman/vol/projects/trace_software/vdb/vdb-versions/cxx_toolkit/2 --with-static-vdb --without-gnutls --without-gcrypt --with-libuv=/netopt/ncbi_tools/libuv-1.35.0 --with-nghttp2=/netopt/ncbi_tools/nghttp2-1.40.0 --without-python --without-lzo --without-zstd
+ArmMAC : clang : Clang.sh --without-dll --with-bin-release --without-debug --without-pcre --without-openmp --with-mt --with-flat-makefile --with-ncbi-public --with-vdb=/net/snowman/vol/projects/trace_software/vdb/vdb-versions/cxx_toolkit/3 --with-static-vdb --without-gnutls --without-gcrypt --with-libuv=/netopt/ncbi_tools/libuv-1.35.0 --with-nghttp2=/netopt/ncbi_tools/nghttp2-1.40.0 --without-python --without-lzo --without-zstd
+
+ArmMAC : clang-x86 : ../../configure --host=x86_64-apple-darwin21 --without-dll --with-bin-release --without-debug --without-pcre --without-openmp --with-mt --with-flat-makefile --with-ncbi-public --with-vdb=/net/snowman/vol/projects/trace_software/vdb/vdb-versions/cxx_toolkit/3 --with-static-vdb --without-gnutls --without-gcrypt --with-libuv=/netopt/ncbi_tools/libuv-1.35.0 --with-nghttp2=/netopt/ncbi_tools/nghttp2-1.40.0 --without-python --without-lzo --without-zstd <ENV>CC='clang -arch x86_64';CXX='clang++ -arch x86_64'</ENV>
+
USE_COMPONENTS
retval += "-ia32-linux"
elif platform.startswith("Linux64"):
retval += "-x64-linux"
- elif platform.startswith("IntelMAC"):
+ elif platform.startswith("ArmMAC"):
retval += "-x64-macosx"
elif platform == "SunOSSparc":
retval += "-sparc64-solaris"
else:
return "Win32"
elif p.find("darwin") != -1:
- return "IntelMAC"
+ return "ArmMAC"
else:
raise RuntimeError("Unknown platform: " + p)
#!/usr/bin/env python3
"""Driver program for post-build processing"""
-# $Id: make_installers.py 667857 2023-05-22 20:23:21Z camacho $
+# $Id: make_installers.py 677969 2024-01-25 20:35:09Z camacho $
#
# Author: Christiam Camacho
#
if platform == "FreeBSD32" or platform.startswith("SunOS") or \
platform.startswith("Linux32"):
return do_nothing(platform)
- if platform.startswith("IntelMAC"):
+ if platform.startswith("ArmMAC"):
return mac_post_build(installdir, blast_version)
print("Unknown OS identifier:" + platform, file=sys.stderr)
util/creaders$
util/tables$
util/checksum
-util/compress$
-util/compress/bzip2$
-util/compress/zlib$
-util/compress/api
+util/compress
util/regexp
util/xregexp
util/sequtil$
+++ /dev/null
-Sep 11, 2011
-prepare_release framework configuration initialised for the project
+++ /dev/null
- PUBLIC DOMAIN NOTICE
- National Center for Biotechnology Information
-
- This software/database is a "United States Government Work" under the
- terms of the United States Copyright Act. It was written as part of
- the author's official duties as a United States Government employee and
- thus cannot be copyrighted. This software/database is freely available
- to the public for use. The National Library of Medicine and the U.S.
- Government have not placed any restriction on its use or reproduction.
-
- Although all reasonable efforts have been taken to ensure the accuracy
- and reliability of the software and data, the NLM and the U.S.
- Government do not and cannot warrant the performance or results that
- may be obtained by using this software or data. The NLM and the U.S.
- Government disclaim all warranties, express or implied, including
- warranties of performance, merchantability or fitness for any particular
- purpose.
-
- Please cite the author in any work or product based on this material.
+++ /dev/null
-#
-# Filename: Manifest
-#
-# $Id
-#
-# Author: Alexey Rafanovich
-#
-# Purpose: This file holds all the supported configurations of a package
-# It is used by release configurator.
-#
-
-APP: lbsbd
-
-DEFAULT_CONFIGURATIONS: Linux64-Centos:GCC
-
-Linux64-Centos : GCC : GCC.sh 4.4.2 --without-debug --without-mt --with-static --without-version --without-serial --without-runpath --with-flat-makefile
+++ /dev/null
-corelib$
-util$
-connect$
-connect/ext$
-connect/daemons$
#IntelMAC : gcc : GCC.sh --with-bin-release --without-debug --without-pcre --with-mt --with-openmp --with-flat-makefile --with-ncbi-public --with-vdb=/net/traces01.be-md.ncbi.nlm.nih.gov/trace_software/vdb --with-static-vdb
#IntelMAC : clang : Clang.sh --with-bin-release --without-debug --without-pcre --with-mt --with-openmp --with-flat-makefile --with-ncbi-public --with-vdb=/net/traces01.be-md.ncbi.nlm.nih.gov/trace_software/vdb --with-static-vdb --without-gnutls --without-gcrypt
-IntelMAC : clang : Clang.sh --without-dll --with-bin-release --without-debug --without-pcre --with-mt --without-openmp --with-flat-makefile --with-ncbi-public --with-vdb=/net/traces01.be-md.ncbi.nlm.nih.gov/trace_software/vdb --with-static-vdb --without-gnutls --without-gcrypt --without-lzo --without-zstd
+IntelMAC : clang : Clang.sh --without-dll --with-bin-release --without-debug --without-pcre --with-mt --without-openmp --with-flat-makefile --with-ncbi-public --with-vdb=/net/traces01.be-md.ncbi.nlm.nih.gov/trace_software/vdb --with-static-vdb --without-gnutls --without-gcrypt --without-lzo --without-zstd
+
+ArmMAC : clang : Clang.sh --without-dll --with-bin-release --without-debug --without-pcre --with-mt --without-openmp --with-flat-makefile --with-ncbi-public --with-vdb=/net/snowman/vol/projects/trace_software/vdb/vdb-versions/cxx_toolkit/3 --with-static-vdb --without-gnutls --without-gcrypt --without-lzo --without-zstd
+
+ArmMAC : clang-x86 : ../../configure --host=x86_64-apple-darwin21 --without-dll --with-bin-release --without-debug --without-pcre --with-mt --without-openmp --with-flat-makefile --with-ncbi-public --with-vdb=/net/snowman/vol/projects/trace_software/vdb/vdb-versions/cxx_toolkit/3 --with-static-vdb --without-gnutls --without-gcrypt --without-lzo --without-zstd <ENV>CC='clang -arch x86_64';CXX='clang++ -arch x86_64'</ENV>
USE_COMPONENTS
retval += "-ia32-linux"
elif platform.startswith("Linux64"):
retval += "-x64-linux"
- elif platform.startswith("IntelMAC"):
+ elif platform.startswith("ArmMAC"):
retval += "-x64-macosx"
elif platform == "SunOSSparc":
retval += "-sparc64-solaris"
else:
return "Win32"
elif p.find("darwin") != -1:
- return "IntelMAC"
+ return "ArmMAC"
else:
raise RuntimeError("Unknown platform: " + p)
#!/usr/bin/env python3
"""Driver program for post-build processing"""
-# $Id: make_installers.py 667857 2023-05-22 20:23:21Z camacho $
+# $Id: make_installers.py 677968 2024-01-25 20:35:05Z camacho $
#
# Author: Christiam Camacho
#
if platform == "FreeBSD32" or platform.startswith("SunOS") or \
platform.startswith("Linux32"):
return do_nothing(platform)
- if platform.startswith("IntelMAC"):
+ if platform.startswith("ArmMAC"):
return mac_post_build(installdir, blast_version)
print("Unknown OS identifier:" + platform, file=sys.stderr)
util/creaders$
util/tables$
util/checksum
-util/compress$
-util/compress/bzip2$
-util/compress/zlib$
-util/compress/api
+util/compress
util/regexp
util/xregexp
util/sequtil$
+++ /dev/null
-Feb 23, 2018
-PrepareRelease framework initialised
+++ /dev/null
- PUBLIC DOMAIN NOTICE
- National Center for Biotechnology Information
-
- This software/database is a "United States Government Work" under the
- terms of the United States Copyright Act. It was written as part of
- the author's official duties as a United States Government employee and
- thus cannot be copyrighted. This software/database is freely available
- to the public for use. The National Library of Medicine and the U.S.
- Government have not placed any restriction on its use or reproduction.
-
- Although all reasonable efforts have been taken to ensure the accuracy
- and reliability of the software and data, the NLM and the U.S.
- Government do not and cannot warrant the performance or results that
- may be obtained by using this software or data. The NLM and the U.S.
- Government disclaim all warranties, express or implied, including
- warranties of performance, merchantability or fitness for any particular
- purpose.
-
- Please cite the author in any work or product based on this material.
+++ /dev/null
-#
-# Filename: Manifest
-#
-# $Id: Manifest 581233 2019-02-26 20:58:29Z fukanchi $
-#
-# Author: Sergey Fukanchik, NCBI
-#
-# Purpose: This file holds all the supported configurations of a package
-# It is used by release configurator.
-#
-
-APP: test_lbsmdapi
-LIB: libconnect.a libconnext.a liblbsmdapi.a libmghbn.a
-SRC: src/connect/daemons/mod/mod_caf.c src/connect/daemons/mod/README.mod_caf
-
-Linux64-Centos : gcc : GCC.sh --without-debug --with-mt --with-64 --with-static --without-runpath --with-local-lbsm --without-gnutls --without-vdb --with-flat-makefile
-Linux64-Centos : gcc-dbg : GCC.sh --with-debug --with-mt --with-64 --with-static --without-runpath --with-local-lbsm --without-gnutls --without-vdb --with-flat-makefile
-
+++ /dev/null
-#define TAGS mod_caf
-common$
-corelib$ update-only
-connect$
-connect/ext$
-connect/daemons$
-connect/daemons/mod$
-internal/signon3$ update-only
+++ /dev/null
-Mar 07, 2012
-PrepareRelease framework initialised
+++ /dev/null
- PUBLIC DOMAIN NOTICE
- National Center for Biotechnology Information
-
- This software/database is a "United States Government Work" under the
- terms of the United States Copyright Act. It was written as part of
- the author's official duties as a United States Government employee and
- thus cannot be copyrighted. This software/database is freely available
- to the public for use. The National Library of Medicine and the U.S.
- Government have not placed any restriction on its use or reproduction.
-
- Although all reasonable efforts have been taken to ensure the accuracy
- and reliability of the software and data, the NLM and the U.S.
- Government do not and cannot warrant the performance or results that
- may be obtained by using this software or data. The NLM and the U.S.
- Government disclaim all warranties, express or implied, including
- warranties of performance, merchantability or fitness for any particular
- purpose.
-
- Please cite the author in any work or product based on this material.
+++ /dev/null
-#
-# Filename: Manifest
-#
-# $Id: Manifest 359988 2012-04-18 20:21:17Z rafanovi $
-#
-# Author: Alexey Rafanovich
-#
-# Purpose: This file holds all the supported configurations of a package
-# It is used by release configurator.
-#
-
-APP: test_lbsmdapi
-LIB: libconnect.a liblbsmdapi.a
-
-POSTBUILD: $srcdir/src/connect/daemons/mod/pull_prepare_release.sh `readlink -f $srcdir` `readlink -f $installdir`
-
-Linux64-Centos : gcc : GCC.sh --without-debug --with-mt --with-64 --with-static --without-runpath --with-flat-makefile
+++ /dev/null
-MOD_LOADINFO
+++ /dev/null
-#define TAGS mod_loadinfo
-corelib$
-common$
-connect$
-connect/daemons$
-connect/daemons/mod$
+1.4.5 (03/29/2024)
+ Technical release, no any functionality changes
+ - Add Linux64-Alma and ArmMAC platforms, build with --with-bin-release. JIRA:CXX-13509
+ - Build on Mac with --without-pcre.
+
1.4.4 (09/29/2022)
- NcbiLogP_Raw2() \96 improve choosing correct file handle for a "file" destination. CXX-12534
- Add a guard on a local file reopening and disable logging on a critical errors. CXX-12534
#
# Filename: Manifest
#
-# $Id: Manifest 653415 2022-07-27 17:43:38Z ivanov $
+# $Id: Manifest 680940 2024-03-29 17:52:22Z ivanov $
#
# Author: Alexey Rafanovich
#
# to it. So some standard options may be added by release configurator, such as --build-root-sfx, --with-projects,
# --with-distcc, --with-action etc.
-Linux64-Centos : plain : GCC.sh --without-debug --without-mt --with-static --without-runpath --with-flat-makefile
-FreeBSD64 : plain : Clang.sh --without-debug --without-mt --with-static --without-runpath --with-flat-makefile
-IntelMAC : plain : GCC.sh --without-debug --without-mt --with-static --without-runpath --with-flat-makefile
-Win64_19 : plain : static 64 ReleaseMT
-Linux64-Ubuntu : plain : GCC.sh --without-debug --without-mt --with-static --without-runpath --with-flat-makefile
-Linux64-Ubuntu-Public : plain : GCC.sh --without-debug --without-mt --with-static --without-runpath --with-flat-makefile
+Linux64-Centos : plain : GCC.sh --without-debug --without-mt --with-static --without-runpath --with-flat-makefile --with-bin-release
+Linux64-Ubuntu : plain : GCC.sh --without-debug --without-mt --with-static --without-runpath --with-flat-makefile --with-bin-release
+Linux64-Ubuntu-Public : plain : GCC.sh --without-debug --without-mt --with-static --without-runpath --with-flat-makefile --with-bin-release
+Linux64-Alma : plain : GCC.sh --without-debug --without-mt --with-static --without-runpath --with-flat-makefile --with-bin-release
+FreeBSD64 : plain : Clang.sh --without-debug --without-mt --with-static --without-runpath --with-flat-makefile --with-bin-release
+IntelMAC : plain : GCC.sh --without-debug --without-mt --with-static --without-runpath --with-flat-makefile --with-bin-release --without-pcre
+ArmMAC : plain : Clang.sh --without-debug --without-mt --with-static --without-runpath --with-flat-makefile --with-bin-release --without-pcre
+Win64_19 : plain : static 64 ReleaseMT
#USE_COMPONENTS
#
db
dbapi
html
-internal/align_model$
internal/ID/utils$
internal/ID/utils/wgs$
internal/ID/utils/wgs/format$
db
dbapi
html
-internal/align_model$
internal/ID/utils$
internal/ID/utils/wgs$
internal/ID/utils/wgs/format$
-internal/gbench/app/treeview
-internal/gbench/app/uud
-internal/gbench/app/data_crawler
--dbapi/driver/ftds100/freetds/ctlib/unittests
--dbapi/driver/ftds100/freetds/dblib/unittests
--dbapi/driver/ftds100/freetds/odbc/unittests
--dbapi/driver/ftds100/freetds/tds/unittests
--dbapi/driver/ftds100/freetds/replacements/unittests
+-dbapi/driver/ftds.*/freetds/.*/unittests
html
internal/objects/alndb_query$
internal/grpcapi/ncbi/grpcapi/dbsnp
-internal/align_model$
internal/contigdb$
internal/blast
internal/asn_cache
gui
html
internal/algo/id_mapper
-internal/align_model
internal/idx
internal/idxext
internal/ilink
dbapi/driver/ctlib$
dbapi/driver/ftds100
-dbapi/driver/ftds100/ctlib/samples
+dbapi/driver/ftds14
+-dbapi/driver/ftds14/ctlib/samples
dbapi/driver/ftds-default
dbapi/simple$
dbapi/driver/ftds100/ctlib$
dbapi/driver/ftds100/impl update-only
dbapi/driver/ftds100/freetds/replacements$
+dbapi/driver/ftds14$
+dbapi/driver/ftds14/freetds$
+dbapi/driver/ftds14/freetds/freetds update-only
+dbapi/driver/ftds14/freetds/replacements update-only
+dbapi/driver/ftds14/freetds/utils update-only
+dbapi/driver/ftds14/freetds/tds$
+dbapi/driver/ftds14/freetds/ctlib$
+dbapi/driver/ftds14/ctlib$
+dbapi/driver/ftds14/impl update-only
+dbapi/driver/ftds14/freetds/replacements$
dbapi/driver/ftds-default
dbapi/simple$
March 30, 2022
version 4.12.2, CXX-12418
Extended features_and_packages lists to include all potentially required packages.
+
+November 30, 2023
+version 4.12.3, CXX-13323
+Ehanced support of Git and Subversion revision information.
+Support PTB extensions in XCode metamakefile.
#
# Filename: Manifest
#
-# $Id: Manifest 638081 2021-09-23 12:45:49Z gouriano $
+# $Id: Manifest 675712 2023-11-30 16:53:27Z gouriano $
#
# Author: Sergey Satskiy
#
FreeBSD64 : plain : Clang.sh --without-pcre --without-libdw --without-debug --without-mt --with-static --without-runpath --with-flat-makefile --without-ncbi-c --without-pcre --without-downloaded-vdb
-IntelMAC : plain : GCC.sh --without-debug --without-mt --with-static --without-runpath --with-flat-makefile --without-ncbi-c --without-downloaded-vdb
+IntelMAC : plain : GCC.sh --without-debug --without-mt --with-static --without-runpath --with-flat-makefile --without-ncbi-c --without-downloaded-vdb --without-pcre
Win64_19 : static-64 : static 64 ReleaseMT
-XCode : plain : Xcode.sh 30 --without-debug --without-ncbi-c
+XCode : plain : Xcode.sh 30 --without-debug --without-ncbi-c --without-pcre
USE_COMPONENTS
[components]
-infrastructure 25.0
-core 25.0
+infrastructure 28.0
+core 28.0
#
# Filename: Manifest
#
-# $Id: Manifest 672663 2023-09-12 18:18:22Z satskyse $
+# $Id: Manifest 677455 2024-01-16 17:19:32Z sadyrovr $
#
# Author: Rafael Sadyrov
#
Linux64-Centos : Debug : GCC.sh --with-debug --with-mt --without-bdb --without-runpath
Linux64-Ubuntu : Release : GCC.sh --without-debug --with-optimization --with-symbols --with-mt --without-bdb --without-runpath
Linux64-Ubuntu : Debug : GCC.sh --with-debug --with-mt --without-bdb --without-runpath
+FreeBSD64 : Release : Clang.sh --without-debug --with-optimization --with-symbols --with-mt --without-bdb --without-runpath
+FreeBSD64 : Debug : Clang.sh --with-debug --with-mt --without-bdb --without-runpath
USE_COMPONENTS
core 28.0
misc 28.0
objects 28.0
-objtools 28.0
web 28.0
#
# Filename: Manifest
#
-# $Id: Manifest 673591 2023-10-04 16:56:27Z satskyse $
+# $Id: Manifest 682003 2024-04-18 20:54:51Z satskyse $
#
# Author: Sergey Satskiy
#
# Release configurator assumes that this script will eventually call standard configure script and pass all options
# to it. So some standard options may be added by release configurator, such as --build-root-sfx, --with-projects,
# --with-distcc, --with-action etc.
-Linux64-Centos : Release : GCC.sh 7.3.0 --without-debug --with-mt --with-flat-makefile --with-libuv=$NCBI/libuv-1.42.0 --with-cassandra=$NCBI/datastax-cpp-driver-2.16.0+uv1.42 --with-h2o=$NCBI/h2o-2.2.6-ncbi2 --with-lmdb=$NCBI/lmdb-0.9.24
-Linux64-Centos : Debug : GCC.sh 7.3.0 --with-debug --with-mt --with-flat-makefile --with-libuv=$NCBI/libuv-1.42.0 --with-cassandra=$NCBI/datastax-cpp-driver-2.16.0+uv1.42 --with-h2o=$NCBI/h2o-2.2.6-ncbi2 --with-lmdb=$NCBI/lmdb-0.9.24
-Linux64-Centos : O2g : GCC.sh 7.3.0 --without-debug --with-symbols --with-mt --with-flat-makefile --with-libuv=$NCBI/libuv-1.42.0 --with-cassandra=$NCBI/datastax-cpp-driver-2.16.0+uv1.42 --with-h2o=$NCBI/h2o-2.2.6-ncbi2 --with-lmdb=$NCBI/lmdb-0.9.24
+Linux64-Centos : Release : GCC.sh 7.3.0 --without-debug --with-mt --with-flat-makefile --with-libuv=$NCBI/libuv-1.42.0 --with-cassandra=$NCBI/datastax-cpp-driver-2.17.1 --with-h2o=$NCBI/h2o-2.2.6-ncbi3 --with-lmdb=$NCBI/lmdb-0.9.24
+Linux64-Centos : Debug : GCC.sh 7.3.0 --with-debug --with-mt --with-flat-makefile --with-libuv=$NCBI/libuv-1.42.0 --with-cassandra=$NCBI/datastax-cpp-driver-2.17.1 --with-h2o=$NCBI/h2o-2.2.6-ncbi3 --with-lmdb=$NCBI/lmdb-0.9.24
+Linux64-Centos : O2g : GCC.sh 7.3.0 --without-debug --with-symbols --with-mt --with-flat-makefile --with-libuv=$NCBI/libuv-1.42.0 --with-cassandra=$NCBI/datastax-cpp-driver-2.17.1 --with-h2o=$NCBI/h2o-2.2.6-ncbi3 --with-lmdb=$NCBI/lmdb-0.9.24
-Linux64-Centos : O2gNoH2OPatch : GCC.sh 7.3.0 --without-debug --with-symbols --with-mt --with-flat-makefile --with-libuv=$NCBI/libuv-1.42.0 --with-cassandra=$NCBI/datastax-cpp-driver-2.16.0+uv1.42 --with-h2o=$NCBI/h2o-2.2.6+uv1.42 --with-lmdb=$NCBI/lmdb-0.9.24
+Linux64-Centos : O2gNoH2OPatch : GCC.sh 7.3.0 --without-debug --with-symbols --with-mt --with-flat-makefile --with-libuv=$NCBI/libuv-1.42.0 --with-cassandra=$NCBI/datastax-cpp-driver-2.17.1 --with-h2o=$NCBI/h2o-2.2.6+uv1.42 --with-lmdb=$NCBI/lmdb-0.9.24
# --with-max-debug builds with a GCC sanitizer
-Linux64-Centos : MaxDebug : GCC.sh 7.3.0 --with-max-debug --with-mt --with-flat-makefile --with-libuv=$NCBI/libuv-1.42.0 --with-cassandra=$NCBI/datastax-cpp-driver-2.16.0+uv1.42 --with-h2o=$NCBI/h2o-2.2.6-ncbi2 --with-lmdb=$NCBI/lmdb-0.9.24
-Linux64-Centos : MaxDebugNoH2OPatch : GCC.sh 7.3.0 --with-max-debug --with-mt --with-flat-makefile --with-libuv=$NCBI/libuv-1.42.0 --with-cassandra=$NCBI/datastax-cpp-driver-2.16.0+uv1.42 --with-h2o=$NCBI/h2o-2.2.6+uv1.42 --with-lmdb=$NCBI/lmdb-0.9.24
+Linux64-Centos : MaxDebug : GCC.sh 7.3.0 --with-max-debug --with-mt --with-flat-makefile --with-libuv=$NCBI/libuv-1.42.0 --with-cassandra=$NCBI/datastax-cpp-driver-2.17.1 --with-h2o=$NCBI/h2o-2.2.6-ncbi3 --with-lmdb=$NCBI/lmdb-0.9.24
+Linux64-Centos : MaxDebugNoH2OPatch : GCC.sh 7.3.0 --with-max-debug --with-mt --with-flat-makefile --with-libuv=$NCBI/libuv-1.42.0 --with-cassandra=$NCBI/datastax-cpp-driver-2.17.1 --with-h2o=$NCBI/h2o-2.2.6+uv1.42 --with-lmdb=$NCBI/lmdb-0.9.24
+Linux64-Alma : O2g : GCC.sh 7.3.0 --without-debug --with-symbols --with-mt --with-flat-makefile --with-libuv=$NCBI/libuv-1.42.0 --with-cassandra=$NCBI/datastax-cpp-driver-2.17.1+a8 --with-h2o=$NCBI/h2o-2.2.6-ncbi3+a8 --with-libssh2=$NCBI/libssh2-1.11.0 --with-lmdb=$NCBI/lmdb-0.9.24
+Linux64-Alma : O2gWithH2oAssert : GCC.sh 7.3.0 --without-debug --with-symbols --with-mt --with-flat-makefile --with-libuv=$NCBI/libuv-1.42.0 --with-cassandra=$NCBI/datastax-cpp-driver-2.17.1+a8 --with-h2o=$NCBI/h2o-2.2.6-ncbi3+a8/GCC730-DebugMT64 --with-libssh2=$NCBI/libssh2-1.11.0 --with-lmdb=$NCBI/lmdb-0.9.24
+Linux64-Alma : MaxDebug : GCC.sh 7.3.0 --with-max-debug --with-mt --with-flat-makefile --with-libuv=$NCBI/libuv-1.42.0 --with-cassandra=$NCBI/datastax-cpp-driver-2.17.1+a8 --with-h2o=$NCBI/h2o-2.2.6-ncbi3+a8 --with-libssh2=$NCBI/libssh2-1.11.0 --with-lmdb=$NCBI/lmdb-0.9.24
# USE_COMPONENTS
check
dll
misc$
+misc/xmlwrapp
misc/third_party
misc/third_party_static
objtools/pubseq_gateway/cache
objtools/pubseq_gateway/protobuf
objtools/pubseq_gateway/ipg
+objtools/pubseq_gateway/myncbi
objtools/cdd
objtools/readers/sra
objtools/logging
util/cache$
util/sequtil$
util/xregexp
+util/regexp$
+util/regexp/testdata$
util/compress
util/checksum
+cgi
+-cgi/demo
+-cgi/test
+
sra$
sra/readers$
sra/readers/sra
+Version 1.25.4 (2023-10-27):
+* Implement a set_logger extension. (This module historically always used
+ the root logger directly, and still does by default.)
+
Version 1.25.3 (2023-10-03):
* Avoid prematurely freeing logging-related Python objects.
dbapi/driver/ftds100/freetds/replacements$
dbapi/driver/ftds100/freetds/ctlib$
dbapi/driver/ftds100/ctlib$
+dbapi/driver/ftds14$
+dbapi/driver/ftds14/impl$ update-only
+dbapi/driver/ftds14/freetds$
+dbapi/driver/ftds14/freetds/freetds$ update-only
+dbapi/driver/ftds14/freetds/replacements$
+dbapi/driver/ftds14/freetds/utils$
+dbapi/driver/ftds14/freetds/tds$
+dbapi/driver/ftds14/freetds/ctlib$
+dbapi/driver/ftds14/ctlib$
dbapi/driver/ftds-default$
dbapi/lang_bind$
dbapi/lang_bind/python
#
# Filename: Manifest
#
-# $Id: Manifest 669486 2023-06-30 18:02:16Z satskyse $
+# $Id: Manifest 679388 2024-02-23 19:03:37Z satskyse $
#
# Author: Sergey Satskiy
#
LIB: libxmlwrapp.a
SRC: src/misc/xmlwrapp/dtd.cpp
-DEFAULT_CONFIGURATIONS: Linux64-Centos:plain-GCC
+#DEFAULT_CONFIGURATIONS: Linux64-Centos:plain-GCC
DEFAULT_CONFIGURE_FLAGS: --without-debug --with-mt
# Each line describes a single configuration
# to it. So some standard options may be added by release configurator, such as --build-root-sfx, --with-projects,
# --with-distcc, --with-action etc.
-FreeBSD64 : plain : Clang.sh --without-debug --with-mt --without-runpath --with-flat-makefile
+# FreeBSD64 : plain : Clang.sh --without-debug --with-mt --without-runpath --with-flat-makefile
-Linux64-Centos : plain-GCC : GCC.sh --without-debug --with-mt --without-runpath --with-flat-makefile
-Linux64-Centos : GCC-nomt : GCC.sh --without-debug --without-mt --without-runpath --with-flat-makefile
-Linux64-Centos : ICC-17 : ICC.sh 17.0 --without-debug --with-mt --without-runpath --with-flat-makefile
-Linux64-Centos : plain-ICC : ICC.sh --without-debug --with-mt --without-runpath --with-flat-makefile
+# Linux64-Centos : plain-GCC : GCC.sh --without-debug --with-mt --without-runpath --with-flat-makefile
+# Linux64-Centos : GCC-nomt : GCC.sh --without-debug --without-mt --without-runpath --with-flat-makefile
+# Linux64-Centos : ICC-17 : ICC.sh 17.0 --without-debug --with-mt --without-runpath --with-flat-makefile
+# Linux64-Centos : plain-ICC : ICC.sh --without-debug --with-mt --without-runpath --with-flat-makefile
Linux64-Centos : Release : GCC.sh --without-debug --with-mt --without-runpath --with-flat-makefile
+Linux64-Alma : Release : GCC.sh --without-debug --with-mt --without-runpath --with-flat-makefile
-Linux64-Ubuntu : plain-GCC : GCC.sh --without-debug --with-mt --without-runpath --with-flat-makefile
-Linux64-Ubuntu-Public : plain-GCC : GCC.sh --without-debug --with-mt --without-runpath --with-flat-makefile
+# Linux64-Ubuntu : plain-GCC : GCC.sh --without-debug --with-mt --without-runpath --with-flat-makefile
+# Linux64-Ubuntu-Public : plain-GCC : GCC.sh --without-debug --with-mt --without-runpath --with-flat-makefile
-Cygwin64 : GCC : GCC.sh --without-debug --with-mt --without-runpath --with-flat-makefile
+# Cygwin64 : GCC : GCC.sh --without-debug --with-mt --without-runpath --with-flat-makefile
-Win64_17 : 17-debug-64 : static 64 DebugDLL
-Win64_17 : 17-static-64 : static 64 ReleaseDLL
-Win64_19 : 19-static-64 : static 64 ReleaseDLL
+# Win64_17 : 17-debug-64 : static 64 DebugDLL
+# Win64_17 : 17-static-64 : static 64 ReleaseDLL
+# Win64_19 : 19-static-64 : static 64 ReleaseDLL
-IntelMAC : clang : Clang.sh --without-debug --with-mt --without-runpath --with-flat-makefile --with-3psw=system:netopt --without-ncbi-public
-IntelMAC : plain : GCC.sh --without-debug --with-mt --without-runpath --with-flat-makefile --with-3psw=system:netopt --without-ncbi-public
-IntelMAC : GCC : GCC.sh --without-debug --with-mt --without-runpath --with-flat-makefile
-XCode : plain : Xcode.sh 30
+#IntelMAC : clang : Clang.sh --without-debug --with-mt --without-runpath --with-flat-makefile --with-3psw=system:netopt --without-ncbi-public
+#IntelMAC : plain : GCC.sh --without-debug --with-mt --without-runpath --with-flat-makefile --with-3psw=system:netopt --without-ncbi-public
+#IntelMAC : GCC : GCC.sh --without-debug --with-mt --without-runpath --with-flat-makefile
+#XCode : plain : Xcode.sh 30
+
+ArmMAC : clang : Clang.sh --without-debug --with-mt --without-runpath --with-flat-makefile --with-3psw=system:netopt --without-ncbi-public
#############################################################################
-# $Id: CMakeLists.txt 674172 2023-10-19 17:21:21Z blastadm $
+# $Id: CMakeLists.txt 684489 2024-06-25 12:36:39Z blastadm $
#############################################################################
cmake_minimum_required(VERSION 3.15)
-# $Id: Makefile.in 674172 2023-10-19 17:21:21Z blastadm $
+# $Id: Makefile.in 684489 2024-06-25 12:36:39Z blastadm $
# Master (top-level) makefile for all NCBI C++ projects
##################################################################
// FIXME: are ambiguities randomized if the encoding requested is
// ncbi2na?
vector<char> tmp;
- TSeqPos nconv = CSeqConvert::Convert(m_SequenceData, m_Encoding,
+ TSeqPos nconv = static_cast<TSeqPos>(CSeqConvert::Convert(m_SequenceData, m_Encoding,
0, size(),
tmp,
- x_Encoding_CSeq_data2CSeqUtil(c));
+ x_Encoding_CSeq_data2CSeqUtil(c)));
_ASSERT(nconv == tmp.size());
nconv += 0; // to eliminate compiler warning
m_Encoding = x_Encoding_CSeq_data2CSeqUtil(c);
inline TSeqPos
CBlastSeqVectorFromCSeq_data::x_Size() const
{
- return m_SequenceData.size();
+ return static_cast<TSeqPos>(m_SequenceData.size());
}
inline Uint1
void
CBlastSeqVectorFromCSeq_data::x_ComplementData()
{
- TSeqPos nconv = CSeqManip::ReverseComplement(m_SequenceData,
- m_Encoding, 0, size());
+ TSeqPos nconv = static_cast<TSeqPos>(CSeqManip::ReverseComplement(m_SequenceData,
+ m_Encoding, 0, size()));
_ASSERT(nconv == size());
nconv += 0; // eliminate compiler warning
}
TSeqPos
CBlastQuerySourceBioseqSet::Size() const
{
- return m_Bioseqs.size();
+ return static_cast<TSeqPos>(m_Bioseqs.size());
}
CConstRef<objects::CSeq_loc>
}
} else {
for(size_t i = 0; i < alignments.size(); i++) {
- CRef<CBlastAncillaryData> s(new CBlastAncillaryData(program, i,
+ CRef<CBlastAncillaryData> s(new CBlastAncillaryData(program, static_cast<int>(i),
sbp,
qinfo));
retval.push_back(s);
-/* $Id: blast_dbindex.cpp 536746 2017-05-23 12:44:32Z madden $
+/* $Id: blast_dbindex.cpp 683949 2024-06-10 12:11:15Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
#include <algo/blast/api/blast_dbindex.hpp>
#include <algo/blast/dbindex/dbindex.hpp>
+#include <algo/blast/dbindex/dbindex_sp.hpp>
#include "algo/blast/core/mb_indexed_lookup.h"
USING_SCOPE( ncbi::objects );
USING_SCOPE( ncbi::blastdbindex );
-/// Get the minimum acceptable word size to use with indexed search.
-/// @return the minimum acceptable word size
-int MinIndexWordSize() { return 16; }
-
/** No-op callback for setting concurrency state.
@sa DbIndexSetUsingThreadsFnType()
*/
CDbIndex::TSeqNum oid,
CDbIndex::TSeqNum chunk,
BlastInitHitList * init_hitlist ) const = 0;
+
+ virtual int MinIndexWordSize() = 0;
};
//------------------------------------------------------------------------------
/** Not used */
virtual void EndSearchIndication( Int4 ) {}
+ virtual int MinIndexWordSize();
+
private:
/** Invoke the seed search procedure on each of the loaded indices.
*/
void AddIndexInfo( const std::string & vol_name, bool & idx_not_resolved );
+ virtual int MinIndexWordSize();
+
/** Find a volume containing the given subject ordinal id. */
TVolList::const_iterator FindVolume( SIZE_TYPE oid ) const
{
}
}
+static int s_GetMinimumSupportedWordSizeByIndex(const string& fname)
+{
+ CMemoryFile index_map(fname);
+ SIndexHeader header = ReadIndexHeader< false >(index_map.GetPtr());
+ int rv = header.hkey_width_ + header.stride_ -1;
+ ERR_POST(Info << "Minimal supported word size in " << fname << " is " << rv);
+ return rv;
+}
+
+int CIndexedDb_New::MinIndexWordSize()
+{
+ int rv = 0;
+ if (volumes_.size() > 0){
+ rv = s_GetMinimumSupportedWordSizeByIndex(volumes_[0].name);
+ }
+ return rv;
+}
//------------------------------------------------------------------------------
CIndexedDb_Old::CIndexedDb_Old( const string & indexnames )
{
return 0;
}
}
-
+/// Get the minimum acceptable word size to use with indexed search.
+/// @return the minimum acceptable word size
+int CIndexedDb_Old::MinIndexWordSize()
+{
+ int rv = 0;
+ if (index_names_.size() > 0){
+ rv = s_GetMinimumSupportedWordSizeByIndex(index_names_[0]);
+ }
+ return rv;
+}
//------------------------------------------------------------------------------
+
+std::string s_CheckMinWordSize(int word_size)
+{
+ string rv = kEmptyStr;
+ if (CIndexedDb::Index_Set_Instance != 0 ) {
+ try {
+ int min_ws = CIndexedDb::Index_Set_Instance->MinIndexWordSize() ;
+ if (word_size < min_ws) {
+ CIndexedDb::Index_Set_Instance.Reset();
+ rv = "MegaBLAST database index requires word size greater than ";
+ rv += NStr::IntToString(min_ws);
+ rv += ".";
+ }
+ }
+ catch (CException & e) {
+ rv = "Failed to read index MegaBLAST db min word size.";
+ }
+
+ }
+ else {
+ rv = "Empty index db instance";
+ }
+ return rv;
+}
+
std::string DbIndexInit(
- const string & indexname, bool old_style, bool & partial )
+ const string & indexname, bool old_style, bool & partial, const int word_size )
{
- std::string result;
+ std::string result=kEmptyStr;
partial = false;
if( !old_style ) {
if( partial ) {
ERR_POST( Info << "some volumes are not resolved" );
}
-
- return "";
+ return s_CheckMinWordSize(word_size);
}
else return "index allocation error";
}
}
}
+
try{
- ERR_POST( Info << "trying to load old style index at "
- << indexname );
- CIndexedDb::Index_Set_Instance.Reset(
- new CIndexedDb_Old( indexname ) );
-
- if( CIndexedDb::Index_Set_Instance != 0 ) {
- ERR_POST( Info << "old style index loaded" );
- return "";
- }
- else return "index allocation error";
+ ERR_POST( Info << "trying to load old style index at "
+ << indexname );
+ CIndexedDb::Index_Set_Instance.Reset(
+ new CIndexedDb_Old( indexname ) );
+
+ if( CIndexedDb::Index_Set_Instance != 0 ) {
+ ERR_POST( Info << "old style index loaded" );
+ return s_CheckMinWordSize(word_size);
+ }
+ else return "index allocation error";
}
catch( CException & e ) {
ERR_POST( Info << "old style index failed to load" );
- result += "\n";
- result += e.what();
+ result += "\n";
+ result += e.what();
}
return result;
-/* $Id: blast_seqalign.cpp 580355 2019-02-13 17:24:26Z boratyng $
+/* $Id: blast_seqalign.cpp 683928 2024-06-10 12:07:11Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
BlastHitList2SeqAlign_OMF(hit_list,
prog,
*query.GetSeq_loc(0),
- query.GetSeqLength(0),
+ static_cast<TSeqPos>(query.GetSeqLength(0)),
seqinfo_src,
true,
false,
BlastHitList2SeqAlign_OMF(NULL,
prog,
*query.GetSeq_loc(0),
- query.GetSeqLength(0),
+ static_cast<TSeqPos>(query.GetSeqLength(0)),
seqinfo_src,
true,
false,
CConstRef<CSeq_loc> seqloc = query_data.GetSeq_loc(qindex);
CRef<CSeq_id> query_id(new CSeq_id);
SerialAssign(*query_id, *seqloc->GetId());
- TSeqPos query_length = query_data.GetSeqLength(qindex);
+ TSeqPos query_length = static_cast<TSeqPos>(query_data.GetSeqLength(qindex));
s_AdjustNegativeSubjFrameInBlastn(kSubjStrand, prog, hsp_list);
vector<string> seqid_list;
seq_aligns(BlastHitList2SeqAlign_OMF(hit_list,
prog,
*query.GetSeq_loc(index),
- query.GetSeqLength(index),
+ static_cast<TSeqPos>(query.GetSeqLength(index)),
seqinfo_src,
is_gapped,
is_ooframe,
if (translate) {
for (unsigned int i = 0; i < kNumContexts; i++) {
unsigned int prot_length =
- BLAST_GetTranslatedProteinLength(length, i);
+ static_cast<unsigned int>(BLAST_GetTranslatedProteinLength(length, i));
max_length = MAX(max_length, prot_length);
min_length = MIN(min_length, prot_length);
const TFrameSet& frames = frame_to_bsl.ListFrames();
const size_t kNumFrames = frame_to_bsl.GetNumFrames();
_ASSERT(kNumFrames != 0);
- const int first_ctx = kNumFrames * query_index;
- const int last_ctx = kNumFrames * (query_index + 1);
+ const int first_ctx = static_cast<int>(kNumFrames) * query_index;
+ const int last_ctx = static_cast<int>(kNumFrames) * (query_index + 1);
ITERATE(TFrameSet, iter, frames) {
int seqloc_frame = *iter;
/// TODO bl2seq only use soft masking?
subj->length = length;
BlastSeqBlkSetSeqRanges(subj, (SSeqRange*) masked_ranges.get_data(),
- masked_ranges.size() + 1, true, eSoftSubjMasking);
+ static_cast<Uint4>(masked_ranges.size()) + 1, true, eSoftSubjMasking);
} else {
subj->num_seq_ranges = 0;
}
-/* $Id: cdd_pssm_input.cpp 500404 2016-05-04 14:59:01Z camacho $
+/* $Id: cdd_pssm_input.cpp 683928 2024-06-10 12:07:11Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
x_RemoveMultipleCdHits();
// this is required by PSSM engine code
- m_MsaDimensions.query_length = m_QueryData.size();
- m_MsaDimensions.num_seqs = m_Hits.size();
+ m_MsaDimensions.query_length = static_cast<Uint4>(m_QueryData.size());
+ m_MsaDimensions.num_seqs = static_cast<Uint4>(m_Hits.size());
m_CddData.dimensions = &m_MsaDimensions;
x_FillHitsData();
// for each kept hit with the same subject accession as it and better
// e-value
- for (int i=new_hits.size() - 1;i >= 0
+ for (int i=static_cast<int>(new_hits.size()) - 1;i >= 0
&& (*it)->m_SubjectId->Match(*new_hits[i]->m_SubjectId);i--) {
const CHit* kept_hit = new_hits[i];
void CCddInputData::x_CreateMsa(void)
{
- const int kQueryLength = m_QueryData.size();
- const int kNumCds = m_Hits.size();
+ const int kQueryLength = static_cast<int>(m_QueryData.size());
+ const int kNumCds = static_cast<int>(m_Hits.size());
// initialize msa map
PSICdMsaCell cell;
m_Msa[hit_idx][q_from + i].data = &(*it)->m_MsaData[i];
}
}
- m_Hits[hit_idx]->m_MsaIdx = hit_idx;
+ m_Hits[hit_idx]->m_MsaIdx = static_cast<int>(hit_idx);
}
m_CddData.msa = m_Msa;
bool CCddInputData::x_ValidateMsa(void) const
{
_ASSERT(m_Msa);
- const int kQueryLength = m_QueryData.size();
- const int kNumCds = m_Hits.size();
+ const int kQueryLength = static_cast<int>(m_QueryData.size());
+ const int kNumCds = static_cast<int>(m_Hits.size());
const Uint1 kGapChar = AMINOACID_TO_NCBISTDAA[(int)'-'];
for (int i=0;i < kNumCds;i++) {
_ASSERT(m_Msa[i]);
-/* $Id: deltablast.cpp 500404 2016-05-04 14:59:01Z camacho $
+/* $Id: deltablast.cpp 683928 2024-06-10 12:07:11Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
CRef<CCddInputData> pssm_input(
new CCddInputData(query_seq[i],
- query_lens[i],
+ static_cast<unsigned int>(query_lens[i]),
(*m_DomainResults)[i].GetSeqAlign(),
*opts.Get(),
m_DomainDb->GetDatabaseName(),
-/* $Id: effsearchspace_calc.cpp 621913 2020-12-17 15:27:59Z grichenk $
+/* $Id: effsearchspace_calc.cpp 683928 2024-06-10 12:07:11Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
CEffectiveSearchSpaceCalculator::GetEffSearchSpace(size_t query_index) const
{
_ASSERT((Int4)query_index < m_QueryInfo->num_queries);
- return BlastQueryInfoGetEffSearchSpace(m_QueryInfo, m_Program, query_index);
+ return BlastQueryInfoGetEffSearchSpace(m_QueryInfo, m_Program, static_cast<Int4>(query_index));
}
Int8
res_type = eSequenceComparison;
IBlastSeqInfoSrc * subject_infosrc = m_LocalDbAdapter->MakeSeqInfoSrc();
if(subject_infosrc != NULL) {
- num_subjects = subject_infosrc->Size();
+ num_subjects = static_cast<unsigned int>(subject_infosrc->Size());
}
}
TSearchMessages msg_vec;
if(e.GetErrCode() == CBlastException::eCoreBlastError) {
throw;
}
- }catch (...) {
}
+ catch (CSeqDBException & e) {
+ if (e.GetErrCode() == CSeqDBException::eOpenFileErr) {
+ string err_msg = BlastErrorCode2String(BLASTERR_DB_OPEN_FILES);
+ NCBI_THROW(CBlastException, eCoreBlastError, err_msg);
+ }
+ else {
+ string err_msg = BlastErrorCode2String(BLASTERR_DB_MEMORY_MAP);
+ NCBI_THROW(CBlastException, eCoreBlastError, err_msg);
+ }
+ }
+ catch (std::exception & e) {
+ NCBI_THROW(CBlastException, eSystem, e.what());
+ }
//_ASSERT(m_InternalData);
BLAST_PROF_MARK2( m_batch_num_str + string("_BLAST.PRE.STOP") );
-/* $Id: magicblast.cpp 644901 2022-02-04 13:49:46Z boratyng $
+/* $Id: magicblast.cpp 683928 2024-06-10 12:07:11Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
CRef<CSeq_id> query_id(new CSeq_id);
SerialAssign(*query_id, CSeq_loc_CI(*query_loc).GetSeq_id());
_ASSERT(query_id);
- TSeqPos query_length = qdata->GetSeqLength(query_index);
+ TSeqPos query_length = static_cast<TSeqPos>(qdata->GetSeqLength(query_index));
CRef<CSeq_id> subject_id;
TSeqPos subj_length;
_ASSERT(m_Query);
_ASSERT(m_MsaDimensions.query_length);
// query is included in m_AsciiMsa, so decrement it by 1
- m_MsaDimensions.num_seqs = m_AsciiMsa.size() - 1;
+ m_MsaDimensions.num_seqs = static_cast<Uint4>(m_AsciiMsa.size() - 1);
m_Msa = NULL;
kNumGaps++;
}
}
- const unsigned int kQueryLength = kQuery.size() - kNumGaps;
+ const unsigned int kQueryLength = static_cast<unsigned int>(kQuery.size() - kNumGaps);
m_MsaDimensions.query_length = kQueryLength;
m_Query.reset(new Uint1[kQueryLength]);
i++;
}
- int k = i + 1;
+ int k = static_cast<int>(i) + 1;
while (k < m_Msa->dimensions->query_length &&
m_Msa->data[seq_index][k].letter == kGapResidue) {
k++;
}
if (k - i >= kLongGapLen) {
- for (int j=i;j < k;j++) {
+ for (int j=static_cast<int>(i);j < k;j++) {
m_Msa->data[seq_index][j].is_aligned = false;
}
}
CConstRef<CSeq_loc>
CObjMgr_LocalQueryData::GetSeq_loc(size_t index)
{
- return m_QuerySource->GetSeqLoc(index);
+ return m_QuerySource->GetSeqLoc(static_cast<int>(index));
}
size_t
CObjMgr_LocalQueryData::GetSeqLength(size_t index)
{
- return m_QuerySource->GetLength(index);
+ return m_QuerySource->GetLength(static_cast<int>(index));
}
size_t
CObjMgrFree_LocalQueryData::GetSeqLength(size_t index)
{
- return m_QuerySource->GetLength(index);
+ return m_QuerySource->GetLength(static_cast<int>(index));
}
/**
-/* $Id: prelim_search_runner.hpp 514950 2016-09-27 14:52:47Z rackerst $
+/* $Id: prelim_search_runner.hpp 683531 2024-05-30 12:54:42Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
}
virtual void* Main(void) {
+ try {
return (void*)
((intptr_t) CPrelimSearchRunner(m_InternalData, m_OptsMemento)());
+ }
+ catch (CSeqDBException & e) {
+ if (e.GetErrCode() == CSeqDBException::eOpenFileErr) {
+ return (void*) BLASTERR_DB_OPEN_FILES;
+ }
+ else {
+ return (void*) BLASTERR_DB_MEMORY_MAP;
+ }
+ }
}
private:
// -RMH- This appears to be a problem right now. When used...this
// can cause all the work to go to a single thread! (-MN- This is fixed in SB-768)
BlastSeqSrcSetNumberOfThreads(m_InternalData->m_SeqSrc->GetPointer(),
- GetNumberOfThreads());
+ static_cast<int>(GetNumberOfThreads()));
// Create the threads ...
NON_CONST_ITERATE(TBlastThreads, thread, the_threads) {
BlastSeqSrcSetNumberOfThreads(m_InternalData->m_SeqSrc->GetPointer(), 0);
if (retv) {
- NCBI_THROW(CBlastException, eCoreBlastError,
- BlastErrorCode2String((Int2)retv));
+ Int2 err_code = (Int2) retv;
+ if (err_code == BLASTERR_DB_MEMORY_MAP) {
+ NCBI_THROW(CSeqDBException, eFileErr, BlastErrorCode2String(err_code));
+ }
+ else if (err_code == BLASTERR_DB_OPEN_FILES) {
+ NCBI_THROW(CSeqDBException, eOpenFileErr, BlastErrorCode2String(err_code));
+ }
+ else {
+ NCBI_THROW(CBlastException, eCoreBlastError, BlastErrorCode2String(err_code));
+ }
}
return 0;
}
for(int i=0; i < num_queries; i++)
{
CConstRef<CSeq_loc> query_loc = local_query_data->GetSeq_loc(i);
- TSeqPos query_length = local_query_data->GetSeqLength(i);
+ TSeqPos query_length = static_cast<TSeqPos>(local_query_data->GetSeqLength(i));
BlastHitList * hit_list = q_list_ptr[i];
if(NULL != hit_list)
{
double evalue = GetLowestEvalue((*itr)->GetScore(), &bit_score);
CSeq_id* current_sid = const_cast<CSeq_id*> (&(*itr)->GetSeq_id(1));
- // Increment msa_index (if appropriate) after all CDense_seg for a given target
- // sequence have been processed.
- if (last_sid && !current_sid->Match(*last_sid)) {
- msa_index++;
- }
-
// ... below the e-value inclusion threshold
if (evalue < m_Opts.inclusion_ethresh) {
+ // Increment msa_index (if appropriate) after all CDense_seg for a
+ // given target sequence have been processed.
+ if (last_sid && !current_sid->Match(*last_sid)) {
+ msa_index++;
+ }
_ASSERT(msa_index < GetNumAlignedSequences() + 1);
const CDense_seg& seg = (*itr)->GetSegs().GetDenseg();
x_ProcessDenseg(seg, msa_index, evalue, bit_score);
seqinfo_src,
search_messages);
tback.SetResultType(m_ResultType);
+ tback.SetNumberOfThreads(GetNumberOfThreads());
m_Results = tback.Run();
// Save the K&A values be as they might have been modified in the
-/* $Id: remote_blast.cpp 640514 2021-11-12 13:02:32Z fongah2 $
+/* $Id: remote_blast.cpp 683928 2024-06-10 12:07:11Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
unique_ptr<fstream> tmp_stream( CDirEntry::CreateTmpFile() );
do{
- n_read = CStreamUtils::Readsome(ios,incoming_buffer, read_max);
+ n_read = static_cast<int>( CStreamUtils::Readsome(ios,incoming_buffer, read_max) );
if( n_read > 0 ){
l_total_bytes += n_read;
try{
-/* $Id: rpsblast_local.cpp 657772 2022-10-17 14:43:47Z fongah2 $
+/* $Id: rpsblast_local.cpp 683928 2024-06-10 12:07:11Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
static void s_ConvertConcatStringToVectorOfString(const string & s, vector<string> & v)
{
- int pos_start = 0;
+ size_t pos_start = 0;
while(1)
{
size_t pos_find = s.find(delimiter, pos_start);
if(pos_find == string::npos)
break;
- TSeqPos length = pos_find - pos_start;
+ size_t length = pos_find - pos_start;
v.push_back(s.substr(pos_start, length));
pos_start = pos_find + delimiter_len;
}
static void s_MapDbToThread(vector<string> & db, unsigned int num_of_threads)
{
- unsigned int db_size = db.size();
+ unsigned int db_size = static_cast<unsigned int>(db.size());
vector <pair <string, Int8> > p;
for(unsigned int i=0; i < db_size; i++)
CRef<CSearchResultSet> CRPSThread::RunTandemSearches(void)
{
- unsigned int num_of_db = m_db.size();
+ unsigned int num_of_db = static_cast<unsigned int>(m_db.size());
vector<CRef<CSearchResultSet> > results;
for(unsigned int i=0; i < num_of_db; i++)
m_num_of_dbs(0)
{
CSeqDB::FindVolumePaths(db, CSeqDB::eProtein, m_rps_databases, NULL, true, true);
- m_num_of_dbs = m_rps_databases.size();
+ m_num_of_dbs = static_cast<unsigned int>(m_rps_databases.size());
if( 1 == m_num_of_dbs)
{
m_num_of_threads = kDisableThreadedSearch;
(m_num_of_threads > m_rps_databases.size()))
{
//Default num of thread : a thread for each db
- m_num_of_threads = m_rps_databases.size();
+ m_num_of_threads = static_cast<unsigned int>(m_rps_databases.size());
}
else if(m_num_of_threads < m_rps_databases.size())
{
-/* $Id: seqsrc_query_factory.cpp 351200 2012-01-26 19:01:24Z maning $
+/* $Id: seqsrc_query_factory.cpp 683928 2024-06-10 12:07:11Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
CQueryFactoryInfo::CQueryFactoryInfo(const TSeqLocVector& subj_seqs,
EBlastProgramType program)
: m_IsProt(Blast_SubjectIsProtein(program) ? true : false), m_MaxLength(0),
- m_MinLength(1), m_AvgLength(0), m_QuerySource(0), m_NumSeqs(subj_seqs.size())
+ m_MinLength(1), m_AvgLength(0), m_QuerySource(0), m_NumSeqs(static_cast<Uint4>(subj_seqs.size()))
{
// Fix subject location for tblast[nx].
if (Blast_SubjectIsTranslated(program))
static
CRef<CPacked_seqint> s_LocalQueryData2Packed_seqint(ILocalQueryData& query_data)
{
- const int kNumQueries = query_data.GetNumQueries();
+ const int kNumQueries = static_cast<int>(query_data.GetNumQueries());
if (kNumQueries == 0) {
return CRef<CPacked_seqint>();
}
retval->AddInterval(query_data.GetSeq_loc(i)->GetInt());
} else if (id.NotEmpty()) {
TSeqPos len = 0;
- try { len = query_data.GetSeqLength(i); }
+ try { len = static_cast<TSeqPos>(query_data.GetSeqLength(i)); }
catch (...) {
/* exception means that it's an invalid seqid, so we do
* nothing, the error message should be captured elsewhere */
rps_info ? (*rps_info)() : 0,
&blast_msg,
seqsrc,
- num_threads);
+ static_cast<Uint4>(num_threads));
if (status != 0) {
TSearchMessages search_messages;
Blast_Message2TSearchMessages(blast_msg.Get(),
_ASSERT(opts_memento);
return BlastHSPStreamNew(opts_memento->m_ProgramType,
opts_memento->m_ExtnOpts, TRUE,
- number_of_queries, writer);
+ static_cast<Int4>(number_of_queries), writer);
}
BlastHSPWriter*
errstr = "Database indexing is not available for discontiguous ";
errstr += "searches.";
}
- else if( options->GetWordSize() < MinIndexWordSize() ) {
- errstr = "MegaBLAST database index requires word size greater than ";
- errstr += NStr::IntToString(MinIndexWordSize() - 1);
- errstr += ".";
- }
else {
errstr = DbIndexInit(
options->GetIndexName(),
- options->GetIsOldStyleMBIndex(), partial );
+ options->GetIsOldStyleMBIndex(), partial, options->GetWordSize() );
}
if( errstr != "" ) {
- if( options->GetForceIndex() ) {
- NCBI_THROW( CIndexedDbException, eIndexInitError, errstr );
- }
- else {
- ERR_POST_EX(1, 1, Info << errstr << " Database index will not be used." );
+ ERR_POST_EX(1, 1, Warning << errstr << " Database index will not be used." );
options->SetUseIndex( false );
return;
- }
}
options->SetMBIndexLoaded();
if (itr == context_indices.end()) {
return kInvalidContext;
}
- return itr - context_indices.begin();
+ return static_cast<int>(itr - context_indices.begin()); // FIXED
}
int
_ASSERT(chunk_num < m_QueryIndicesPerChunk.size());
size_t pos = x_ContextInChunkToQueryIndex(context_in_chunk);
_ASSERT(pos < m_QueryIndicesPerChunk[chunk_num].size());
- return GetQueryLength(m_QueryIndicesPerChunk[chunk_num][pos]);
+ return GetQueryLength(static_cast<int>(m_QueryIndicesPerChunk[chunk_num][pos]));
}
size_t
_ASSERT(chunk_num < m_QueryIndicesPerChunk.size());
size_t pos = x_ContextInChunkToQueryIndex(context_in_chunk);
_ASSERT(pos < m_QueryIndicesPerChunk[chunk_num].size());
- return GetLastChunk(m_QueryIndicesPerChunk[chunk_num][pos]);
+ return GetLastChunk(static_cast<int>(m_QueryIndicesPerChunk[chunk_num][pos]));
}
int
{
size_t retval = 0;
Int2 rv = SplitQueryBlk_GetNumQueriesForChunk(m_SplitQueryBlk,
- chunk_num,
+ static_cast<Uint4>(chunk_num),
&retval);
if (rv != 0) {
throw runtime_error("SplitQueryBlk_GetNumQueriesForChunk");
vector<size_t> retval;
Uint4* query_indices = NULL;
Int2 rv = SplitQueryBlk_GetQueryIndicesForChunk(m_SplitQueryBlk,
- chunk_num,
+ static_cast<Uint4>(chunk_num),
&query_indices);
if (rv != 0) {
throw runtime_error("SplitQueryBlk_GetQueryIndicesForChunk");
Int4* query_contexts = NULL;
Uint4 num_contexts = 0;
Int2 rv = SplitQueryBlk_GetQueryContextsForChunk(m_SplitQueryBlk,
- chunk_num,
+ static_cast<Uint4>(chunk_num),
&query_contexts,
&num_contexts);
if (rv != 0) {
vector<size_t> retval;
Uint4* context_offsets = NULL;
Int2 rv = SplitQueryBlk_GetContextOffsetsForChunk(m_SplitQueryBlk,
- chunk_num,
+ static_cast<Uint4>(chunk_num),
&context_offsets);
if (rv != 0) {
throw runtime_error("SplitQueryBlk_GetContextOffsetsForChunk");
{
TChunkRange retval;
pair<size_t, size_t> chunk_bounds(0, 0);
- Int2 rv = SplitQueryBlk_GetChunkBounds(m_SplitQueryBlk, chunk_num,
+ Int2 rv = SplitQueryBlk_GetChunkBounds(m_SplitQueryBlk, static_cast<Uint4>(chunk_num),
&chunk_bounds.first,
&chunk_bounds.second);
if (rv != 0) {
throw runtime_error("SplitQueryBlk_GetChunkBounds");
}
- retval.SetOpen(chunk_bounds.first, chunk_bounds.second);
+ retval.SetOpen(static_cast<unsigned int>(chunk_bounds.first), static_cast<unsigned int>(chunk_bounds.second)); // FIXED
return retval;
}
const TChunkRange& chunk_range)
{
Int2 rv = SplitQueryBlk_SetChunkBounds(m_SplitQueryBlk,
- chunk_num,
+ static_cast<int>(chunk_num),
chunk_range.GetFrom(),
chunk_range.GetToOpen());
if (rv != 0) {
CSplitQueryBlk::AddQueryToChunk(size_t chunk_num, Int4 query_index)
{
Int2 rv = SplitQueryBlk_AddQueryToChunk(m_SplitQueryBlk, query_index,
- chunk_num);
+ static_cast<Uint4>(chunk_num));
if (rv != 0) {
throw runtime_error("Failed to add query to SplitQueryBlk");
}
CSplitQueryBlk::AddContextToChunk(size_t chunk_num, Int4 context_index)
{
Int2 rv = SplitQueryBlk_AddContextToChunk(m_SplitQueryBlk,
- context_index, chunk_num);
+ context_index, static_cast<Uint4>(chunk_num));
if (rv != 0) {
throw runtime_error("Failed to add context to SplitQueryBlk");
}
CSplitQueryBlk::AddContextOffsetToChunk(size_t chunk_num, Int4 context_offset)
{
Int2 rv = SplitQueryBlk_AddContextOffsetToChunk(m_SplitQueryBlk,
- context_offset, chunk_num);
+ context_offset, static_cast<Uint4>(chunk_num));
if (rv != 0) {
throw runtime_error("Failed to add context offset to "
"SplitQueryBlk");
}
m_SplitBlk->SetChunkBounds(chunk_num,
- TChunkRange(chunk_start, chunk_end));
+ TChunkRange(static_cast<unsigned int>(chunk_start), static_cast<unsigned int>(chunk_end)));
_TRACE("Chunk " << chunk_num << ": ranges from " << chunk_start
<< " to " << chunk_end);
void
CQuerySplitter::x_ComputeQueryIndicesForChunks()
{
- const int kNumQueries = m_LocalQueryData->GetNumQueries();
+ const int kNumQueries = static_cast<int>(m_LocalQueryData->GetNumQueries());
const EBlastProgramType kProgram = m_Options->GetProgramType();
const ENa_strand kStrandOption = m_Options->GetStrandOption();
// Build vector of query ranges along the concatenated query
vector<TChunkRange> query_ranges;
query_ranges.reserve(kNumQueries);
- query_ranges.push_back(TChunkRange(0, m_LocalQueryData->GetSeqLength(0)));
+ query_ranges.push_back(TChunkRange(0, static_cast<unsigned int>(m_LocalQueryData->GetSeqLength(0)))); // FIXED
_TRACE("Query 0: " << query_ranges.back().GetFrom() << "-" <<
query_ranges.back().GetToOpen());
for (int i = 1; i < kNumQueries; i++) {
TSeqPos query_start = query_ranges[i-1].GetTo() + 1;
- TSeqPos query_end = query_start + m_LocalQueryData->GetSeqLength(i);
+ TSeqPos query_end = query_start + static_cast<TSeqPos>(m_LocalQueryData->GetSeqLength(i));
query_ranges.push_back(TChunkRange(query_start, query_end));
_TRACE("Query " << i << ": " << query_ranges.back().GetFrom()
<< "-" << query_ranges.back().GetToOpen());
if ( !chunk.IntersectingWith(query_range) ) {
continue;
}
- m_SplitBlk->AddQueryToChunk(chunk_num, qindex);
+ m_SplitBlk->AddQueryToChunk(chunk_num, static_cast<Int4>(qindex));
if (m_SplitQueriesInChunk[chunk_num].Empty()) {
m_SplitQueriesInChunk[chunk_num].Reset(new CBlastQueryVector);
}
BlastSetup_GetStrand(*sl, kProgram, kStrandOption);
if (Blast_QueryIsTranslated(kProgram)) {
- size_t qlength = qdpc->GetQueryLength(queries[i]);
- int last_query_chunk = qdpc->GetLastChunk(queries[i]);
+ size_t qlength = qdpc->GetQueryLength(static_cast<int>(queries[i]));
+ int last_query_chunk = qdpc->GetLastChunk(static_cast<int>(queries[i]));
_ASSERT(last_query_chunk != -1);
int shift = s_GetShiftForTranslatedNegStrand(qlength);
kInvalidContext);
} else {
m_SplitBlk->AddContextToChunk(chunk_num,
- kNumContexts*queries[i]+ctx);
+ static_cast<Int4>(kNumContexts*queries[i]+ctx));
}
} else { // handle the negative strand
if (kStrand == eNa_strand_plus) {
if (chunk_num == (size_t)last_query_chunk) {
// last chunk doesn't have shift
m_SplitBlk->AddContextToChunk(chunk_num,
- kNumContexts*queries[i]+ctx);
+ static_cast<Int4>(kNumContexts*queries[i]+ctx));
} else {
m_SplitBlk->AddContextToChunk(chunk_num,
- kNumContexts*queries[i]+
- s_AddShift(ctx, shift));
+ static_cast<Int4>(kNumContexts*queries[i]+
+ s_AddShift(ctx, shift)));
}
}
}
kInvalidContext);
} else {
m_SplitBlk->AddContextToChunk(chunk_num,
- kNumContexts*queries[i]+ctx);
+ static_cast<Int4>(kNumContexts*queries[i]+ctx));
}
} else { // handle the negative strand
if (kStrand == eNa_strand_plus) {
kInvalidContext);
} else {
m_SplitBlk->AddContextToChunk(chunk_num,
- kNumContexts*queries[i]+ctx);
+ static_cast<Int4>(kNumContexts*queries[i]+ctx));
}
}
}
} else if (Blast_QueryIsProtein(kProgram)) {
m_SplitBlk->AddContextToChunk(chunk_num,
- kNumContexts*queries[i]);
+ static_cast<Int4>(kNumContexts*queries[i]));
} else {
abort();
}
if (s_IsPlusStrand(chunk_qinfo[chunk_num], ctx)) {
- for (int c = chunk_num; c != starting_chunk; c--) {
+ for (int c = static_cast<int>(chunk_num); c != starting_chunk; c--) {
size_t prev_len = s_GetAbsoluteContextLength(chunk_qinfo,
c - 1,
ctx_translator,
size_t subtrahend = 0;
- for (int c = chunk_num; c >= starting_chunk && c >= 0; c--) {
+ for (int c = static_cast<int>(chunk_num); c >= starting_chunk && c >= 0; c--) {
size_t prev_len = s_GetAbsoluteContextLength(chunk_qinfo,
c - 1,
ctx_translator,
}
_ASSERT((chunk_qinfo[chunk_num]->contexts[ctx].is_valid));
- m_SplitBlk->AddContextOffsetToChunk(chunk_num, correction);
+ m_SplitBlk->AddContextOffsetToChunk(chunk_num, static_cast<int>(correction));
#ifdef DEBUG_COMPARE_SEQUENCES
{
int global_offset = global_qinfo->contexts[absolute_context].query_offset +
if (s_IsPlusStrand(chunk_qinfo[chunk_num], ctx)) {
- for (int c = chunk_num; c != starting_chunk; c--) {
+ for (int c = static_cast<int>(chunk_num); c != starting_chunk; c--) {
size_t prev_len = s_GetAbsoluteContextLength(chunk_qinfo,
c - 1,
ctx_translator,
size_t subtrahend = 0;
- for (int c = chunk_num; c >= starting_chunk && c >= 0; c--) {
+ for (int c = static_cast<int>(chunk_num); c >= starting_chunk && c >= 0; c--) {
size_t prev_len = s_GetAbsoluteContextLength(chunk_qinfo,
c - 1,
ctx_translator,
error_check:
_ASSERT((chunk_qinfo[chunk_num]->contexts[ctx].is_valid));
- m_SplitBlk->AddContextOffsetToChunk(chunk_num, correction);
+ m_SplitBlk->AddContextOffsetToChunk(chunk_num, static_cast<Int4>(correction));
#ifdef DEBUG_COMPARE_SEQUENCES
{
int global_offset = global_qinfo->contexts[absolute_context].query_offset +
-/* $Id: blast_args.cpp 674166 2023-10-19 17:00:39Z ivanov $
+/* $Id: blast_args.cpp 683928 2024-06-10 12:07:11Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
const int kMinValue = static_cast<int>(CThreadable::kMinNumThreads);
const int kMaxValue = static_cast<int>(CSystemInfo::GetCpuCount());
const int kDfltValue = m_NumThreads != CThreadable::kMinNumThreads
- ? std::min<int>(m_NumThreads, kMaxValue) : kMinValue;
+ ? std::min<int>(static_cast<int>(m_NumThreads), kMaxValue) : kMinValue;
arg_desc.AddDefaultKey(kArgNumThreads, "int_value",
"Number of threads (CPUs) to use in the BLAST search",
-/* $Id: blast_fasta_input.cpp 654211 2022-08-10 13:45:37Z boratyng $
+/* $Id: blast_fasta_input.cpp 683928 2024-06-10 12:07:11Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
}
bioseq.SetInst().SetMol(CSeq_inst::eMol_na);
bioseq.SetInst().SetRepr(CSeq_inst::eRepr_raw);
- bioseq.SetInst().SetLength(first_len);
+ bioseq.SetInst().SetLength(static_cast<CSeq_inst_Base::TLength>(first_len));
first[first_len] = 0;
bioseq.SetInst().SetSeq_data().SetIupacna(CIUPACna(first));
bioseq.SetDescr().Set().push_back(seqdesc_first);
}
bioseq.SetInst().SetMol(CSeq_inst::eMol_na);
bioseq.SetInst().SetRepr(CSeq_inst::eRepr_raw);
- bioseq.SetInst().SetLength(second_len);
+ bioseq.SetInst().SetLength(static_cast<CSeq_inst_Base::TLength>(second_len));
second[second_len] = 0;
bioseq.SetInst().SetSeq_data().SetIupacna(CIUPACna(second));
bioseq.SetDescr().Set().push_back(seqdesc_last);
// increase the sequence buffer if necessary
if (start + line.length() + 1 > m_SeqBuffLen) {
string tmp;
- m_SeqBuffLen = 2 * (start + line.length() + 1);
+ m_SeqBuffLen = static_cast<TSeqPos>(2 * (start + line.length() + 1));
tmp.resize(m_SeqBuffLen);
memcpy(&tmp[0], &m_Sequence[0], start);
m_Sequence.swap(tmp);
empty_sequence = true;
}
else {
- bioseq.SetInst().SetLength(line.length());
+ bioseq.SetInst().SetLength(static_cast<CSeq_inst_Base::TLength>(line.length()));
bioseq.SetInst().SetSeq_data().SetIupacna(CIUPACna(line.data()));
m_BasesAdded += line.length();
}
-/* $Id: blast_aascan.c 663684 2023-02-27 15:47:41Z fongah2 $
+/* $Id: blast_aascan.c 683930 2024-06-10 12:07:59Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
/* copy the hits. */
{
Int4 i;
- Int4 s_off = s - subject->sequence;
+ Int4 s_off = (Int4)(s - subject->sequence);
for (i = 0; i < numhits; i++) {
offset_pairs[i + totalhits].qs_offsets.q_off = src[i];
offset_pairs[i + totalhits].qs_offsets.s_off = s_off;
} else
/* not enough space in the destination array; return early */
{
- s_range[1] = s - subject->sequence;
+ s_range[1] = (Int4)(s - subject->sequence);
return totalhits;
}
}
} /* end for */
- s_range[1] = s - subject->sequence;
+ s_range[1] = (Int4)(s - subject->sequence);
} /* end while */
/* if we get here, we fell off the end of the sequence */
/* copy the hits. */
{
Int4 i;
- Int4 s_off = s - subject->sequence;
+ Int4 s_off = (Int4)(s - subject->sequence);
for (i = 0; i < numhits; i++) {
offset_pairs[i + totalhits].qs_offsets.q_off = src[i];
offset_pairs[i + totalhits].qs_offsets.s_off = s_off;
} else
/* not enough space in the destination array; return early */
{
- s_range[1] = s - subject->sequence;
+ s_range[1] = (Int4)(s - subject->sequence);
return totalhits;
}
}
} /* end for */
- s_range[1] = s - subject->sequence;
+ s_range[1] = (Int4)(s - subject->sequence);
} /* end while */
/* if we get here, we fell off the end of the sequence */
/* if there are hits */
if (PV_TEST(pv, index, pv_array_bts)) {
- Int4 s_off = s - subject->sequence;
+ Int4 s_off = (Int4)(s - subject->sequence);
CompressedLookupBackboneCell* backbone_cell =
lookup->backbone + index;
else
/* not enough space in the destination array */
{
- s_range[1] = s - subject->sequence;
+ s_range[1] = (Int4)(s - subject->sequence);
return totalhits;
}
}
}
} /* end for */
- s_range[1] = s - subject->sequence;
+ s_range[1] = (Int4)(s - subject->sequence);
} /* end while */
/* if we get here, we fell off the end of the sequence */
Int4 *src;
Int4 i;
Uint4 q_off;
- Uint4 s_off = s - abs_start;
+ Uint4 s_off = (Uint4)(s - abs_start);
if (numhits <= RPS_HITS_PER_CELL) {
for (i = 0; i < numhits; i++) {
q_off = cell->entries[i] - table_correction;
}
/* if we get here, we fell off the end of the sequence */
- *offset = s - abs_start;
+ *offset = (Int4)(s - abs_start);
return totalhits;
}
-/* $Id: blast_engine.c 672916 2023-09-18 17:55:28Z ivanov $
+/* $Id: blast_engine.c 683952 2024-06-10 12:29:05Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
#define CONV_NUCL2PROT_COORDINATES(length) (length) / CODON_LENGTH
NCBI_XBLAST_EXPORT const int kBlastMajorVersion = 2;
-NCBI_XBLAST_EXPORT const int kBlastMinorVersion = 15;
+NCBI_XBLAST_EXPORT const int kBlastMinorVersion = 16;
NCBI_XBLAST_EXPORT const int kBlastPatchVersion = 0;
/** Structure to be passed to s_BlastSearchEngineCore, containing pointers
-/* $Id: blast_filter.c 533522 2017-04-17 15:50:34Z boratyng $
+/* $Id: blast_filter.c 683930 2024-06-10 12:07:59Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
switch(arg) {
case 0:
sscanf(buffer, "%ld", &tmplong);
- level_pri = tmplong;
+ level_pri = (int)tmplong;
break;
case 1:
sscanf(buffer, "%ld", &tmplong);
- window_pri = tmplong;
+ window_pri = (int)tmplong;
break;
case 2:
sscanf(buffer, "%ld", &tmplong);
- linker_pri = tmplong;
+ linker_pri = (int)tmplong;
break;
default:
break;
size_t target_size = MAX(string2append_length, dest_length) * 2;
*dest = (char*)realloc((void*)*dest, target_size);
if (*dest) {
- (*dest_size) = target_size;
+ (*dest_size) = (unsigned int)target_size;
} else {
sfree(*dest);
return 0;
-/* $Id: blast_hits.c 594743 2019-10-09 11:00:47Z fongah2 $
+/* $Id: blast_hits.c 683930 2024-06-10 12:07:59Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
if (hsp->score >= cutoff_score) {
/* Update all HSP offsets. */
- hsp->query.offset = best_q_start - query_start;
- hsp->query.end = hsp->query.offset + best_q_end - best_q_start;
- hsp->subject.offset = best_s_start - subject_start;
- hsp->subject.end = hsp->subject.offset + best_s_end - best_s_start;
+ hsp->query.offset = (Int4)(best_q_start - query_start);
+ hsp->query.end = (Int4)(hsp->query.offset + best_q_end - best_q_start);
+ hsp->subject.offset = (Int4)(best_s_start - subject_start);
+ hsp->subject.end = (Int4)(hsp->subject.offset + best_s_end - best_s_start);
if (gapped) {
int last_num=hsp->gap_info->size - 1;
ASSERT(esp->op_type[best_start_esp_index] == eGapAlignSub);
ASSERT(esp->op_type[best_end_esp_index] == eGapAlignSub);
- qp = best_q_start - q;
- sp = best_s_start - s;
+ qp = (Int4)(best_q_start - q);
+ sp = (Int4)(best_s_start - s);
ext = 0;
while(qp > 0 && sp > 0 && (q[--qp] == s[--sp]) && q[qp]<4) ext++;
best_q_start -= ext;
if (best_end_esp_index == best_start_esp_index) best_end_esp_num += ext;
score += ext * score_params->reward;
- qp = best_q_end - q;
- sp = best_s_end - s;
+ qp = (Int4)(best_q_end - q);
+ sp = (Int4)(best_s_end - s);
ext = 0;
while(qp < qlen && sp < slen && q[qp]<4 && (q[qp++] == s[sp++])) ext++;
best_q_end += ext;
BlastHSP** hsp_array;
Int4 hsp_cnt = 0;
Int4 index;
+ Boolean removed = FALSE;
if ((hsp_list == NULL) || (hsp_list->hspcnt == 0) || (hit_options->query_cov_hsp_perc == 0))
return 0;
if ( Blast_HSPQueryCoverageTest(hsp, hit_options->query_cov_hsp_perc,
query_info->contexts[hsp->context].query_length)) {
hsp_array[index] = Blast_HSPFree(hsp_array[index]);
+ removed = TRUE;
} else {
if (index > hsp_cnt)
hsp_array[hsp_cnt] = hsp_array[index];
hsp_list->hspcnt = hsp_cnt;
+ if (removed) {
+ hsp_list->best_evalue = s_BlastGetBestEvalue(hsp_list);
+ }
+
return 0;
}
-/* $Id: blast_hspstream.c 594743 2019-10-09 11:00:47Z fongah2 $
+/* $Id: blast_hspstream.c 683930 2024-06-10 12:07:59Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
Blast_HitListMerge(results1->hitlist_array + i,
results2->hitlist_array + global_query,
contexts_per_query, split_points,
- SplitQueryBlk_GetChunkOverlapSize(squery_blk),
+ (Int4)SplitQueryBlk_GetChunkOverlapSize(squery_blk),
SplitQueryBlk_AllowGap(squery_blk));
}
-/* $Id: blast_kappa.c 663873 2023-03-02 15:07:26Z madden $
+/* $Id: blast_kappa.c 683930 2024-06-10 12:07:59Z ivanov $
* ==========================================================================
*
* PUBLIC DOMAIN NOTICE
for(hsp_index = 0; hsp_index < hsp_list->hspcnt; hsp_index++) {
BlastHSP * hsp = hsp_list->hsp_array[hsp_index];
- hsp->score = BLAST_Nint(((double) hsp->score) / scoreDivisor);
+ hsp->score = (Int4)BLAST_Nint(((double) hsp->score) / scoreDivisor);
/* Compute the bit score using the newly computed scaled score. */
hsp->bit_score = (hsp->score*lambda*scoreDivisor - logK)/NCBIMATH_LN2;
}
}
}
- sp->gap_open = BLAST_Nint(sp->gap_open * scale_factor);
- sp->gap_extend = BLAST_Nint(sp->gap_extend * scale_factor);
+ sp->gap_open = (Int4)BLAST_Nint(sp->gap_open * scale_factor);
+ sp->gap_extend = (Int4)BLAST_Nint(sp->gap_extend * scale_factor);
sp->scale_factor = scale_factor;
}
const char * matrixName)
{
int status = 0; /* return status */
- int lenName; /* length of matrixName as a string */
+ size_t lenName; /* length of matrixName as a string */
/* copy the matrix name (strdup is not standard C) */
lenName = strlen(matrixName);
-/* $Id: blast_message.c 673573 2023-10-04 13:17:42Z ivanov $
+/* $Id: blast_message.c 683534 2024-05-30 12:54:55Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
new_msg->severity = eBlastSevFatal;
new_msg->context = context;
break;
+ case BLASTERR_DB_MEMORY_MAP :
+ new_msg->message = strdup("Database memory map file error");
+ new_msg->severity = eBlastSevFatal;
+ new_msg->context = context;
+ break;
+ case BLASTERR_DB_OPEN_FILES :
+ new_msg->message = strdup("Too many open files, please raise the open file limit");
+ new_msg->severity = eBlastSevFatal;
+ new_msg->context = context;
+ break;
/* No error, just free the structure */
case 0:
new_msg = Blast_MessageFree(new_msg);
-/* $Id: blast_nalookup.c 573109 2018-10-23 14:18:55Z boratyng $
+/* $Id: blast_nalookup.c 683930 2024-06-10 12:07:59Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
if (mb_lt->lut_word_length <= 12) {
if (mb_lt->hashsize <= 8 * kTargetPVSize)
- pv_size = mb_lt->hashsize >> PV_ARRAY_BTS;
+ pv_size = (Int4)(mb_lt->hashsize >> PV_ARRAY_BTS);
else
pv_size = kTargetPVSize / PV_ARRAY_BYTES;
}
}
retval->bitfield = bitfield;
- retval->length = len >> PV_ARRAY_BTS;
+ retval->length = (Uint4)(len >> PV_ARRAY_BTS);
retval->counts = calloc(retval->length, sizeof(Int4));
if (!retval->counts) {
BlastSparseUint1ArrayFree(retval);
BlastSparseUint1ArrayGetIndex(BlastSparseUint1Array* array, Int8 index)
{
/* index into bitfield */
- Int4 idx = index >> PV_ARRAY_BTS;
+ Int4 idx = (Int4)(index >> PV_ARRAY_BTS);
/* bit number within a bitfield cell (mod 32) */
Int4 bit_number = index & PV_ARRAY_MASK;
-/* $Id: blast_nascan.c 505619 2016-06-27 18:51:47Z boratyng $
+/* $Id: blast_nascan.c 683930 2024-06-10 12:07:59Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
s_BlastLookupRetrieve(lookup,
index,
offset_pairs + total_hits,
- (s - abs_start) * COMPRESSION_RATIO);
+ (Int4)((s - abs_start) * COMPRESSION_RATIO));
total_hits += num_hits;
}
- scan_range[0] = (s - abs_start) * COMPRESSION_RATIO;
+ scan_range[0] = (Int4)((s - abs_start) * COMPRESSION_RATIO);
return total_hits;
}
s_BlastLookupRetrieve(lookup,
index,
offset_pairs + total_hits,
- (s - abs_start) * COMPRESSION_RATIO);
+ (Int4)((s - abs_start) * COMPRESSION_RATIO));
total_hits += num_hits;
}
- scan_range[0] = (s - abs_start) * COMPRESSION_RATIO;
+ scan_range[0] = (Int4)((s - abs_start) * COMPRESSION_RATIO);
} else {
/* when the stride is not a multiple of 4, extra bases may occur
both before and after every word read from the subject
if (total_hits > max_hits)
break;
- s_off = (s - abs_start) * COMPRESSION_RATIO;
+ s_off = (Int4)((s - abs_start) * COMPRESSION_RATIO);
total_hits += s_BlastSmallNaRetrieveHits(offset_pairs,
index, s_off,
total_hits,
overflow);
}
}
- scan_range[0] = (s - abs_start) * COMPRESSION_RATIO;
+ scan_range[0] = (Int4)((s - abs_start) * COMPRESSION_RATIO);
} else {
/* when the stride is not a multiple of 4, extra bases may occur
both before and after every word read from the subject
if (s_BlastMBLookupHasHits(mb_lt, index)) {
if (total_hits >= max_hits)
break;
- s_off = (s - abs_start)*COMPRESSION_RATIO;
+ s_off = (Int4)((s - abs_start)*COMPRESSION_RATIO);
total_hits += s_BlastMBLookupRetrieve(mb_lt,
index,
offset_pairs + total_hits,
s_off);
}
}
- scan_range[0] = (s - abs_start)*COMPRESSION_RATIO;
+ scan_range[0] = (Int4)((s - abs_start)*COMPRESSION_RATIO);
} else if (lut_word_length == 16 && scan_step == 1) {
/* scan for lookup table width 16 and stride 1 */
-/* $Id: blast_options.c 662032 2023-01-24 15:56:52Z boratyng $
+/* $Id: blast_options.c 683940 2024-06-10 12:09:42Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
Blast_MessageWrite(blast_msg, eBlastSevError, kBlastMessageNoContext,
"Word-size must be 4 or greater for nucleotide comparison");
return BLASTERR_OPTION_VALUE_INVALID;
+ } else if (program_number == eBlastTypeBlastn &&
+ options->word_size > DBSEQ_CHUNK_OVERLAP) {
+ char buffer[256];
+ int bytes_written = snprintf(buffer, DIM(buffer),
+ "Word-size must be less than or equal to %d", DBSEQ_CHUNK_OVERLAP);
+ ASSERT(bytes_written < DIM(buffer));
+ Blast_MessageWrite(blast_msg, eBlastSevError, kBlastMessageNoContext, buffer);
+ return BLASTERR_OPTION_VALUE_INVALID;
} else if (program_number != eBlastTypeBlastn &&
- program_number != eBlastTypeMapping && options->word_size > 5)
+ program_number != eBlastTypeMapping && options->word_size > 4)
{
if (program_number == eBlastTypeBlastp ||
program_number == eBlastTypeTblastn ||
return BLASTERR_OPTION_VALUE_INVALID;
}
}
+ else if (program_number == eBlastTypePsiBlast &&
+ options->word_size > 4) {
+ Blast_MessageWrite(blast_msg, eBlastSevError,
+ kBlastMessageNoContext,
+ "Word-size must be less "
+ "than 5 for psiblast");
+ return BLASTERR_OPTION_VALUE_INVALID;
+ }
else {
Blast_MessageWrite(blast_msg, eBlastSevError,
kBlastMessageNoContext,
-/* $Id: blast_parameters.c 573108 2018-10-23 14:05:07Z boratyng $
+/* $Id: blast_parameters.c 683930 2024-06-10 12:07:59Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
/* Subtract off the expected score. */
- expected_length = BLAST_Nint(log(kbp->K*((double) query_length)*
+ expected_length = (Int4)BLAST_Nint(log(kbp->K*((double) query_length)*
((double) subject_length))/(kbp->H));
query_length = query_length - expected_length;
for (c = 0; c < dim1; c++) {
for (a = 0; a < dim2; a++) {
if (BLAST_SCORE_MIN != private_matrix[c][a]) {
- matrix[c][a] = BLAST_Nint((double) private_matrix[c][a] *
+ matrix[c][a] = (int)BLAST_Nint((double) private_matrix[c][a] *
factor / kPSIScaleFactor);
}
}
for (a = 0; a < dim2; a++) {
if (BLAST_SCORE_MIN != private_matrix[c][a]) {
private_matrix[c][a] =
- BLAST_Nint((double) private_matrix[c][a] * factor *
+ (int)BLAST_Nint((double) private_matrix[c][a] * factor *
scalefactor);
}
}
kPSIScaleFactor * freq_ratios->bit_scale_factor *
log(freq_ratios->data[kResidue][j])/NCBIMATH_LN2;
- internal_pssm->scaled_pssm[i][j] = BLAST_Nint(tmp);
+ internal_pssm->scaled_pssm[i][j] = (int)BLAST_Nint(tmp);
} else {
internal_pssm->scaled_pssm[i][j] = BLAST_SCORE_MIN;
}
for (j = 0; j < internal_pssm->nrows; j++) {
if (scaled_pssm[i][j] != BLAST_SCORE_MIN) {
pssm[i][j] =
- BLAST_Nint(factor*scaled_pssm[i][j]/kPSIScaleFactor);
+ (int)BLAST_Nint(factor*scaled_pssm[i][j]/kPSIScaleFactor);
} else {
pssm[i][j] = BLAST_SCORE_MIN;
}
for (j = 0; j < internal_pssm->nrows; j++) {
if (scaled_pssm[i][j] != BLAST_SCORE_MIN) {
pssm[i][j] =
- BLAST_Nint(factor*scaled_pssm[i][j]/kPSIScaleFactor);
+ (int)BLAST_Nint(factor*scaled_pssm[i][j]/kPSIScaleFactor);
} else {
pssm[i][j] = BLAST_SCORE_MIN;
}
-/* $Id: blast_stat.c 633542 2021-06-21 19:27:23Z grichenk $
+/* $Id: blast_stat.c 683930 2024-06-10 12:07:59Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
if (matrix->data) {
matrix->data = (int**) _PSIDeallocateMatrix((void**) matrix->data,
- matrix->ncols);
+ (unsigned int)matrix->ncols);
}
/* Deallocate the matrix frequencies which is used by the
return SBlastScoreMatrixFree(retval);
}
- retval->data = (int**) _PSIAllocateMatrix(ncols, nrows, sizeof(int));
+ retval->data = (int**) _PSIAllocateMatrix((unsigned int)ncols, (unsigned int)nrows, sizeof(int));
if ( !retval->data ) {
return SBlastScoreMatrixFree(retval);
}
if (matrix->freq_ratios) {
matrix->freq_ratios = (double**) _PSIDeallocateMatrix((void**)
matrix->freq_ratios,
- matrix->pssm->ncols);
+ (unsigned int)matrix->pssm->ncols);
}
matrix->pssm = SBlastScoreMatrixFree(matrix->pssm);
return SPsiBlastScoreMatrixFree(retval);
}
- retval->freq_ratios = (double**) _PSIAllocateMatrix(ncols, BLASTAA_SIZE,
+ retval->freq_ratios = (double**) _PSIAllocateMatrix((unsigned int)ncols, BLASTAA_SIZE,
sizeof(double));
if ( !retval->freq_ratios ) {
return SPsiBlastScoreMatrixFree(retval);
if (BLASTNA_TO_NCBI4NA[index1] & BLASTNA_TO_NCBI4NA[index2]) {
/* round up for positive scores, down for negatives. */
matrix[index1][index2] =
- BLAST_Nint( (double) ((degeneracy[index2]-1)*penalty +
+ (Int4)BLAST_Nint( (double) ((degeneracy[index2]-1)*penalty +
reward)/ (double) degeneracy[index2]);
if (index1 != index2)
{
FILE *fp = NULL;
char* full_matrix_path = NULL;
- int path_len = strlen(matrix_path);
- int buflen = path_len + strlen(sbp->name);
+ size_t path_len = strlen(matrix_path);
+ size_t buflen = path_len + strlen(sbp->name);
full_matrix_path = (char*) malloc((buflen + 1) * sizeof(char));
if (!full_matrix_path) {
return -1;
}
- strncpy(full_matrix_path, matrix_path, buflen);
- strncat(full_matrix_path, sbp->name, buflen - path_len);
+ strncpy(full_matrix_path, matrix_path, path_len);
+ strncpy(full_matrix_path + path_len, sbp->name, buflen - path_len);
+ full_matrix_path[buflen] = '\0';
sfree(matrix_path);
} else if (error_return) {
char buffer[8192];
int i=0;
- int len=0;
+ size_t len=0;
/* Unsupported gap costs combination. */
sprintf(buffer, "Gap existence and extension values %ld and %ld "
"are not supported for substitution scores %ld and %ld\n",
Blast_FillResidueProbability(rps_query_seq, rps_query_length, resProb);
- alphabet_size = sbp->psi_matrix->pssm->nrows;
+ alphabet_size = (Int4)sbp->psi_matrix->pssm->nrows;
RPSFillScores(posMatrix, db_seq_length, resProb, scoreArray,
return_sfp, BLAST_SCORE_RANGE_MAX, alphabet_size);
}
else {
temp = ((double)(posMatrix[index][inner_index])) * finalLambda;
- returnMatrix[index][inner_index] = BLAST_Nint(temp);
+ returnMatrix[index][inner_index] = (Int4)BLAST_Nint(temp);
}
}
for (; inner_index < BLASTAA_SIZE; inner_index++) {
}
val = (val < 1e-8) ? min_freq : log(val);
- scores[q][s] = BLAST_Nint(val * matrix_scale_factor);
+ scores[q][s] = (Int4)BLAST_Nint(val * matrix_scale_factor);
}
}
}
-/* $Id: blast_traceback.c 638265 2021-09-27 15:55:19Z fongah2 $
+/* $Id: blast_traceback.c 683930 2024-06-10 12:07:59Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
}
// -RMH-: end of change
+ if(hit_params->options->query_cov_hsp_perc > 0 || hit_params->options->max_hsps_per_subject > 0 ||
+ (hit_params->options->hsp_filt_opt != NULL && hit_params->options->hsp_filt_opt->subject_besthit_opts != NULL)) {
+ s_FilterBlastResults(results, hit_params->options, query_info, program_number);
+ }
+
/* Re-sort the hit lists according to their best e-values, because they
could have changed. Only do this for a database search. */
if (BlastSeqSrcGetTotLen(seq_src) > 0) {
Blast_HSPResultsSortByEvalue(results);
}
- if(hit_params->options->query_cov_hsp_perc > 0 || hit_params->options->max_hsps_per_subject > 0 ||
- (hit_params->options->hsp_filt_opt != NULL && hit_params->options->hsp_filt_opt->subject_besthit_opts != NULL)) {
- s_FilterBlastResults(results, hit_params->options, query_info, program_number);
- }
/* Eliminate extra hits from results, if preliminary hit list size is
larger than the final hit list size */
TInterruptFnPtr interrupt_search, SBlastProgress* progress_info,
size_t num_threads)
{
- const int N_T = ((num_threads == 0) ? 1 : num_threads);
+ const int N_T = ((num_threads == 0) ? 1 : (int)num_threads);
Int2 status = 0;
SThreadLocalDataArray* thread_data = SThreadLocalDataArrayNew(N_T);
char * ADAPTIVE_CBS_ENV = getenv("ADAPTIVE_CBS");
-/* $Id: blast_util.c 635339 2021-08-02 13:25:26Z fongah2 $
+/* $Id: blast_util.c 683930 2024-06-10 12:07:59Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
*prot_seq = NULLB;
- return (prot_seq - prot_seq_start);
+ return (Int4)(prot_seq - prot_seq_start);
} /* BlastTranslateUnambiguousSequence */
-/* $Id: jumper.c 597903 2019-12-02 11:11:04Z boratyng $
+/* $Id: jumper.c 683930 2024-06-10 12:07:59Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
/* save the length of the ungapped extension */
if (is_ungapped && jp->dcp != jp->dcq) {
- *ungapped_ext_len = cp - query - 1;
+ *ungapped_ext_len = (Int4)(cp - query - 1);
is_ungapped = FALSE;
}
}
}
- *query_ext_len = cpstop - query;
+ *query_ext_len = (Int4)(cpstop - query);
*subject_ext_len = cqstop;
if (is_ungapped) {
/* save the length of the ungapped extension */
if (is_ungapped && jp->dcp != jp->dcq) {
- *ungapped_ext_len = cp - query - 1;
+ *ungapped_ext_len = (Int4)(cp - query - 1);
is_ungapped = FALSE;
}
s_TrimExtension(edit_script, -mismatch_score, &cp, &cq, num_identical,
TRUE);
- *query_ext_len = cp - query;
+ *query_ext_len = (Int4)(cp - query);
*subject_ext_len = cq;
if (is_ungapped) {
/* save the length of the ungapped extension */
if (is_ungapped && jp->dcp != jp->dcq) {
- *ungapped_ext_len = cp - query - 1;
+ *ungapped_ext_len = (Int4)(cp - query - 1);
is_ungapped = FALSE;
}
*best_num_identical = num_identical;
}
- *query_ext_len = cpstop - query;
+ *query_ext_len = (Int4)(cpstop - query);
*subject_ext_len = cqstop;
edit_script->num_ops = num_ops;
GapPrelimEditBlockAdd(edit_script, eGapAlignSub, new_matches);
}
- *query_ext_len = cp - query;
+ *query_ext_len = (Int4)(cp - query);
*subject_ext_len = cq;
return score;
/* save the length of the ungapped extension */
if (is_ungapped && jp->dcp != jp->dcq) {
- *ungapped_ext_len = cp - query - 1;
+ *ungapped_ext_len = (Int4)(cp - query - 1);
is_ungapped = FALSE;
}
s_TrimExtension(edit_script, -mismatch_score, &cp, &cq, num_identical,
TRUE);
- *query_ext_len = cp - query;
+ *query_ext_len = (Int4)(cp - query);
*subject_ext_len = cq;
if (is_ungapped) {
}
}
- *query_ext_len = query + query_offset - cpstop;
+ *query_ext_len = (Int4)(query + query_offset - cpstop);
*subject_ext_len = subject_offset - cqstop;
return best_score;
s_TrimExtension(edit_script, -mismatch_score, &cp, &cq, num_identical,
FALSE);
- *query_ext_len = query + query_offset - cp;
+ *query_ext_len = (Int4)(query + query_offset - cp);
*subject_ext_len = subject_offset - cq;
/* return extension score */
*best_num_identical = num_identical;
}
- *query_ext_len = query + query_offset - cpstop;
+ *query_ext_len = (Int4)(query + query_offset - cpstop);
*subject_ext_len = subject_offset - cqstop;
edit_script->num_ops = num_ops;
GapPrelimEditBlockAdd(edit_script, eGapAlignSub, new_matches);
}
- *query_ext_len = query + query_offset - cp;
+ *query_ext_len = (int)(query + query_offset - cp);
*subject_ext_len = subject_offset - cq;
return score;
-/* $Id: na_ungapped.c 544985 2017-08-30 14:21:34Z boratyng $
+/* $Id: na_ungapped.c 683930 2024-06-10 12:07:59Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
}
}
- ungapped_data->q_start = q_beg - query->sequence;
+ ungapped_data->q_start = (Int4)(q_beg - query->sequence);
ungapped_data->s_start = s_off - (q_off - ungapped_data->q_start);
if (q_avail < s_avail) {
base--;
}
- ungapped_data->length = q_end - q_beg;
+ ungapped_data->length = (Int4)(q_end - q_beg);
ungapped_data->score = score;
}
/* record the start point of the extension */
- ungapped_data->q_start = new_q - q_start;
+ ungapped_data->q_start = (Int4)(new_q - q_start);
ungapped_data->s_start = s_ext - (q_ext - ungapped_data->q_start);
/* the right extension begins at the first bases not examined by the
/* record the length and score of the extension. Make sure the
alignment extends at least to s_match_end */
ungapped_data->score = score;
- ungapped_data->length = MAX(s_match_end - ungapped_data->s_start,
+ ungapped_data->length = (Int4)( MAX(s_match_end - ungapped_data->s_start,
(new_q - q_start) -
- ungapped_data->q_start + 1);
+ ungapped_data->q_start + 1) );
}
}
}
ASSERT(get_results);
- word_size = get_results(/*lookup_wrap->lut, */oid, chunk, init_hitlist);
+ word_size = (Uint4) get_results(/*lookup_wrap->lut, */oid, chunk, init_hitlist);
if( word_size > 0 && word_params->ungapped_extension ) {
hash = ir_hash_create();
}
}
- init_hitlist->total = new_hsp - init_hitlist->init_hsp_array;
+ init_hitlist->total = (Int4)(new_hsp - init_hitlist->init_hsp_array);
hash = ir_hash_destroy( hash );
}
}
ASSERT(get_results);
- word_size = get_results(oid, chunk, init_hitlist);
+ word_size = (Uint4)get_results(oid, chunk, init_hitlist);
if (*hsp_list == NULL) {
*hsp_list = Blast_HSPListNew(BlastHspNumMax(TRUE,
-/* $Id: phi_lookup.c 668432 2023-06-05 16:30:10Z fongah2 $
+/* $Id: phi_lookup.c 683930 2024-06-10 12:07:59Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
currentWildcardProduct = 1;
currentSetMask = 0;
- pattern_length = strlen(pattern_in);
+ pattern_length = (int)strlen(pattern_in);
if (pattern_length >= PHI_MAX_PATTERN_LENGTH) {
if (error_msg)
{
-/* $Id: dbindex_factory.cpp 621859 2020-12-17 15:26:54Z grichenk $
+/* $Id: dbindex_factory.cpp 683928 2024-06-10 12:07:11Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
/** Get the total memory usage by the subject map in bytes.
@return memory usage by this instance
*/
- TWord total() const { return seq_store_.size(); }
+ TWord total() const { return static_cast<TWord>(seq_store_.size()); }
/** Append the next chunk of the input sequence currently being
processed to the subject map.
objects::CBioseq_Handle bsh = seh.GetSeq();
c_seq_ = bsh.GetSeqVector( objects::CBioseq_Handle::eCoding_Iupac );
string idstr = objects::sequence::GetTitle( bsh );
- Uint4 pos = idstr.find_first_of( " \t" );
+ Uint4 pos = static_cast<Uint4>(idstr.find_first_of( " \t" ));
idstr = idstr.substr( 0, pos );
return idstr;
}
//-------------------------------------------------------------------------
void CSubjectMap_Factory_TBase::Save( CNcbiOstream & os ) const
{
- TWord tmp = subjects_.size();
- TWord subject_map_size =
+ TWord tmp = static_cast<TWord>(subjects_.size());
+ TWord subject_map_size = static_cast<TWord>(
tmp*sizeof( TWord ) +
- chunks_.size()*sizeof( TWord );
+ chunks_.size()*sizeof( TWord ));
WriteWord( os, subject_map_size );
for( TSubjects::const_iterator cit = subjects_.begin();
bool CSubjectMap_Factory_TBase::AddSequenceChunk(
TSeqStore::size_type seq_off )
{
- TSeqPos chunk_start = (chunk_size_ - chunk_overlap_)*(c_chunk_++);
+ TSeqPos chunk_start = static_cast<TSeqPos>((chunk_size_ - chunk_overlap_)*(c_chunk_++));
if( chunk_start >= c_seq_.size() ) {
--c_chunk_;
}
chunks_.push_back(
- TSeqInfo( seq_off, c_seq_.size(), segs ) );
+ TSeqInfo( static_cast<TWord>(seq_off), c_seq_.size(), segs ) );
if( *subjects_.rbegin() == 0 ) {
- *subjects_.rbegin() = chunks_.size();
+ *subjects_.rbegin() = static_cast<unsigned int>(chunks_.size());
}
- last_chunk_ = chunks_.size();
+ last_chunk_ = static_cast<TSeqNum>(chunks_.size());
return true;
}
{
overflow = false;
bool starting = (this->c_chunk_ == 0);
- TSeqPos chunk_start =
- (this->chunk_size_ - this->chunk_overlap_)*this->c_chunk_;
+ TSeqPos chunk_start =static_cast<TSeqPos>(
+ (this->chunk_size_ - this->chunk_overlap_)*this->c_chunk_);
TBase::TSeqStore::size_type seq_off =
starting ? this->seq_store_.size() :
this->chunks_.rbegin()->seq_start_
if( lid_map_.empty() || cur_lid_len_ + chunk_len > length_limit ) {
Uint1 lid_bits = 8*sizeof( TWord ) - offset_bits_;
- TSeqNum lid_limit = (1UL<<lid_bits);
+ TSeqNum lid_limit = static_cast<TSeqNum>((1UL<<lid_bits));
if( lid_map_.size() >= lid_limit ) {
overflow = true;
cur_lid_len_ = 0;
}
- lid_map_.rbegin()->end_ = this->chunks_.size();
+ lid_map_.rbegin()->end_ = static_cast<TSeqNum>(this->chunks_.size());
cur_lid_len_ += chunk_len;
lid_map_.rbegin()->seq_end_ =
lid_map_.rbegin()->seq_start_ + cur_lid_len_;
inline bool CSubjectMap_Factory::CheckOffset(
const Uint1 * seq, TSeqPos off ) const
{
- TSeqPos soff = seq - &(this->seq_store_[0]);
+ TSeqPos soff = static_cast<TSeqPos>(seq - &(this->seq_store_[0]));
TLIdMap::const_reverse_iterator iter = lid_map_.rbegin();
while( iter != lid_map_.rend() && iter->seq_start_ > soff ) ++iter;
ASSERT( iter->seq_start_ <= soff );
inline TWord CSubjectMap_Factory::MakeOffset(
const Uint1 * seq, TSeqPos off ) const
{
- TSeqPos soff = seq - &(this->seq_store_[0]);
+ TSeqPos soff = static_cast<TSeqPos>(seq - &(this->seq_store_[0]));
TLIdMap::const_reverse_iterator iter = lid_map_.rbegin();
while( iter != lid_map_.rend() && iter->seq_start_ > soff ) ++iter;
ASSERT( iter->seq_start_ <= soff );
off += (soff - iter->seq_start_)*CR;
off /= stride_;
off += min_offset_;
- TWord result = ((lid_map_.rend() - iter - 1)<<offset_bits_) + off;
+ TWord result = static_cast<TWord>( ((lid_map_.rend() - iter - 1)<<offset_bits_) + off);
return result;
}
//-------------------------------------------------------------------------
void CSubjectMap_Factory::Save( CNcbiOstream & os ) const
{
- TWord sz = sizeof( TWord )*lengths_.size();
+ TWord sz = static_cast<TWord>(sizeof( TWord )*lengths_.size());
WriteWord( os, sz );
WriteWord( os, (TWord)offset_bits_ );
WriteWord( os, (TWord)(*it) );
}
- sz = 4*sizeof( TWord )*lid_map_.size();
+ sz = static_cast<TWord>(4*sizeof( TWord )*lid_map_.size());
WriteWord( os, sz );
for( TLIdMap::const_iterator it = lid_map_.begin();
TWord nmer, TSeqPos start, TSeqPos stop,
TSeqPos curr, TWord offset )
{
- TSeqPos start_diff = curr + 2 - hkey_width_ - start;
+ TSeqPos start_diff = curr + 2 - static_cast<TSeqPos>(hkey_width_) - start;
TSeqPos end_diff = stop - curr;
if( start_diff <= options_.stride || end_diff <= options_.stride ) {
-/* $Id: dbindex_search.cpp 171056 2009-09-21 13:50:13Z morgulis $
+/* $Id: dbindex_search.cpp 683928 2024-06-10 12:07:11Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
qstart += qstart_;
nmax = nmax < options_.word_size - hkey_width ?
- nmax : options_.word_size - hkey_width;
+ nmax : static_cast<TSeqPos>(options_.word_size - hkey_width);
while( nmax > 0 && incomplete > 0 && qpos > qstart ) {
Uint1 sbyte = (((*spos)>>(2*(CR - incomplete--)))&0x3);
}
nmax = (nmax < (TSeqPos)(qpos - qstart))
- ? nmax : qpos - qstart;
+ ? nmax : (TSeqPos)(qpos - qstart);
nmax = (nmax < (TSeqPos)(CR*(spos - sstart)))
- ? nmax : CR*(spos - sstart);
+ ? nmax : (TSeqPos)(CR*(spos - sstart));
--spos;
while( nmax >= CR ) {
nmax = (nmax < (TSeqPos)(qend - qpos)) ?
nmax : (TSeqPos)(qend - qpos);
nmax = (nmax <= (send - spos)*CR) ?
- nmax : (send - spos)*CR;
+ nmax : (TSeqPos)((send - spos)*CR);
while( nmax >= CR ) {
Uint1 sbyte = *spos++;
TSeqPos nmaxleft = (TSeqPos)(bounds>>code_bits_);
TSeqPos nmaxright = (TSeqPos)(bounds&((1<<code_bits_) - 1));
TTrackedSeed seed(
- qoff_, (TSeqPos)offset, index_impl_.hkey_width(), qoff_ );
+ qoff_, (TSeqPos)offset, (TSeqPos)index_impl_.hkey_width(), qoff_ );
TTrackedSeeds & subj_seeds = seeds_[subject_];
subj_seeds.EvalAndUpdate( seed );
void CSearch_Base< LEGACY, NHITS, derived_t >::ProcessOffset( TWord offset )
{
TTrackedSeed seed(
- qoff_, (TSeqPos)offset, index_impl_.hkey_width(), qoff_ );
+ qoff_, (TSeqPos)offset, (TSeqPos)index_impl_.hkey_width(), qoff_ );
TTrackedSeeds & subj_seeds = seeds_[subject_];
if( subj_seeds.EvalAndUpdate( seed ) ) {
if( root->soff_ < min_offset_ ) {
TSeqPos boundary = (root++)->soff_;
- ProcessBoundaryOffset( root->soff_ - min_offset_, boundary );
+ ProcessBoundaryOffset( root->soff_ - static_cast<unsigned int>(min_offset_), boundary );
// root->soff_ - CDbIndex::MIN_OFFSET, boundary );
soff_ = root->soff_;
return 2;
}else {
- ProcessOffset( root->soff_ - min_offset_ );
+ ProcessOffset( root->soff_ - static_cast<unsigned int>(min_offset_) );
soff_ = root->soff_;
return 1;
}
{
BlastSeqSrc* seqsrc = db_adapter.MakeSeqSrc();
num_seqs=BlastSeqSrcGetNumSeqs(seqsrc);
- total_length=BlastSeqSrcGetTotLen(seqsrc);
+ total_length=static_cast<int>(BlastSeqSrcGetTotLen(seqsrc));
}
CBlastFormatUtil::FillScanModeBlastDbInfo(m_DbInfo, m_DbIsAA,
num_seqs, total_length, m_SubjectTag);
report.AddParam(CBlastUsageReport::eNumSubjects, (int) m_SeqInfoSrc->Size());
int total_subj_length = 0;
for (size_t i = 0; i < m_SeqInfoSrc->Size(); i++) {
- total_subj_length += m_SeqInfoSrc->GetLength(i);
+ total_subj_length += (int)m_SeqInfoSrc->GetLength(static_cast<Uint4>(i));
}
report.AddParam(CBlastUsageReport::eSubjectsLength, total_subj_length);
}
-/* $Id: blastfmtutil.cpp 621897 2020-12-17 15:27:43Z grichenk $
+/* $Id: blastfmtutil.cpp 683928 2024-06-10 12:07:11Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
}
vector<CRange<int> > masks_v;
- int aln_stop = query_seq.size() - 1;
+ int aln_stop = static_cast<int>(query_seq.size()) - 1;
ITERATE(ncbi::TMaskedQueryRegions, mask_iter, mask_info) {
if ((*mask_iter)->GetFrame() != query_frame)
continue;
-/* $Id: blastxml_format.cpp 621898 2020-12-17 15:27:43Z grichenk $
+/* $Id: blastxml_format.cpp 683928 2024-06-10 12:07:11Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
// because of a bug, one of the sequence strings may be truncated, hence
// it is necessary to take a minimum here.
// FIXME: Should an exception be thrown instead?
- const unsigned int kMaxOffset = min(query_seq.size(),
- subject_seq.size());
+ const unsigned int kMaxOffset = static_cast<unsigned int>(min(query_seq.size(),
+ subject_seq.size()));
for (unsigned int i = 0; i < kMaxOffset; ++i) {
if (query_seq[i] == subject_seq[i]) {
++num_ident;
-/* $Id: blastkmer.cpp 536161 2017-05-16 14:36:47Z madden $
+/* $Id: blastkmer.cpp 683928 2024-06-10 12:07:11Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
{
TQueryMessages errs;
int numThreads = (int) GetNumberOfThreads();
- int numFiles = m_KmerFiles.size();
+ int numFiles = static_cast<int>( m_KmerFiles.size());
if (numThreads > numQuery)
numThreads = numFiles;
sort(final_results.begin(), final_results.end(), s_SortFinalResults);
if (m_Opts->GetNumTargetSeqs() > 0)
{
- int vec_size = final_results.size();
+ int vec_size = static_cast<int>( final_results.size() );
int num_matches = m_Opts->GetNumTargetSeqs();
if (vec_size > num_matches)
final_results.erase(final_results.begin()+num_matches, final_results.end());
if (kmerVer > 2)
kmerParams.chunkSize = mhfile.GetChunkSize();
- int numQueries = m_QueryVector.size();
+ int numQueries = static_cast<int>(m_QueryVector.size());
CRef<CBlastKmerResultsSet> kmerResultsSet = x_SearchMultipleQueries(0, numQueries, kmerParams, a.data(), b.data(), kValues, badMers);
-/* $Id: blastkmerindex.cpp 556010 2018-01-25 12:50:23Z madden $
+/* $Id: blastkmerindex.cpp 683928 2024-06-10 12:07:11Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
} // end each kmer
if (hash_values.size() < static_cast<size_t>(num_hashes))
{
- int rem = 1 + num_hashes - hash_values.size();
+ int rem = 1 + num_hashes - static_cast<int>(hash_values.size());
uint32_t hashval = 0xffffffff; // Fill in empties
for (int i=0; i<rem; i++)
hash_values.push_back(hashval);
int q_oid, int numBands, int numRows, int& total_chunks, uint8_t* uniqueHash)
{
- int num_chunks = seq_hash[q_oid].size();
+ int num_chunks = static_cast<int>(seq_hash[q_oid].size());
for (int n=0; n<num_chunks; n++)
{
for(int b=0;b<numBands;b++)
int max=4*num_k+1;
vector<unsigned char> key(max);
- int num_chunks=seq_hash[q_oid].size();
+ int num_chunks=static_cast<int>(seq_hash[q_oid].size());
int temp_index=0;
int temp_hash=0;
for (int n=0; n<num_chunks; n++)
int q_oid, int numHashes, int numRows, int& total_chunks, uint8_t* uniqueHash)
{
- int num_chunks = seq_hash[q_oid].size();
+ int num_chunks = static_cast<int>(seq_hash[q_oid].size());
int numHashMax = numHashes - numRows + 1;
uint32_t temp_hash = 0;
for (int n=0; n<num_chunks; n++)
last=oid_offset;
}
- int numVols = paths.size();
+ int numVols = static_cast<int>(paths.size());
#pragma omp parallel for num_threads(numThreads)
for(int index=0; index<numVols; index++)
{
else
{
int i=1; // i must be lower than 2*m_NumHashFct
- int num=badMers.size();
+ int num=static_cast<int>(badMers.size());
if (num > (2*m_NumHashFct-1))
num = 2*m_NumHashFct-1;
index_file.write((char *) &(num), 4);
width = 4;
for(int q_oid=0;q_oid<num_seqs;q_oid++)
{
- int num_chunks = seq_hash[q_oid].size();
+ int num_chunks = static_cast<int>(seq_hash[q_oid].size());
for (int n=0; n<num_chunks; n++)
{
vector<uint32_t> tmp_hash;
-/* $Id: blastkmerutils.cpp 662402 2023-01-30 14:32:39Z madden $
+/* $Id: blastkmerutils.cpp 683928 2024-06-10 12:07:11Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
vector<Uint1> trans_table;
BlastKmerGetCompressedTranslationTable(trans_table, alphabetChoice);
- int seq_length = query_sequence.length();
+ int seq_length = static_cast<int>(query_sequence.length());
const char* query = query_sequence.c_str();
// bail out if the sequence is too short
vector<Uint1> trans_table;
BlastKmerGetCompressedTranslationTable(trans_table, alphabetChoice);
- int seq_length = query_sequence.length();
+ int seq_length = static_cast<int>(query_sequence.length());
const char* query = query_sequence.c_str();
// bail out if the sequence is too short
vector<Uint1> trans_table;
BlastKmerGetCompressedTranslationTable(trans_table, alphabetChoice);
- int seq_length = query_sequence.length();
+ int seq_length = static_cast<int>(query_sequence.length());
const char* query = query_sequence.c_str();
// bail out if the sequence is too short
{
int distance=0;
- int num_hashes = minhash1.size();
+ int num_hashes = static_cast<int>(minhash1.size());
for (int index=0; index<num_hashes; index++)
{
int chunkSize)
{
bool kmersFound=false; // return value;
- int seq_length = query.length();
+ int seq_length = static_cast<int>(query.length());
vector<TSeqRange> range_v;
int chunk_num = BlastKmerBreakUpSequence(seq_length, range_v, chunkSize);
seq_hash.resize(chunk_num);
int chunkSize)
{
bool kmersFound=false; // return value;
- int seq_length = query.length();
+ int seq_length = static_cast<int>(query.length());
vector<TSeqRange> range_v;
int chunk_num = BlastKmerBreakUpSequence(seq_length, range_v, chunkSize);
seq_hash.resize(chunk_num);
if (hash_values.size() < static_cast<size_t>(numHashes))
{
- int rem = 1 + numHashes - hash_values.size();
+ int rem = 1 + numHashes - static_cast<int>(hash_values.size());
uint32_t hashval = 0xffffffff; // Fill in empties
for (int i=0; i<rem; i++)
hash_values.push_back(hashval);
int num_bands,
int rows_per_band)
{
- int num_chunks=query_hash.size();
+ int num_chunks=static_cast<int>(query_hash.size());
uint32_t temp_hash=0;
for (int n=0; n<num_chunks; n++)
{
int numHashes,
int numRows)
{
- int num_chunks=query_hash.size();
+ int num_chunks=static_cast<int>(query_hash.size());
uint32_t temp_hash=0;
int numHashMax = numHashes - numRows + 1;
for (int n=0; n<num_chunks; n++)
{
int max=4*num_k+1;
vector<unsigned char> key(max);
- int num_chunks=query_hash.size();
+ int num_chunks=static_cast<int>(query_hash.size());
uint32_t temp_hash=0;
int temp_index=0;
for (int n=0; n<num_chunks; n++)
vector< set<uint32_t > >& candidates)
{
- int num=query_LSH_hash.size();
+ int num=static_cast<int>(query_LSH_hash.size());
for (int i=0; i<num; i++)
{
for(vector<uint32_t>::const_iterator iter=query_LSH_hash[i].begin(); iter != query_LSH_hash[i].end(); ++iter)
s_HashHashQuery(const vector < vector <uint32_t> > & query_hash, vector < vector <uint32_t> >& query_hash_hash, int compress, int version)
{
int hash_value=0;
- int num_chunks=query_hash.size();
+ int num_chunks=static_cast<int>(query_hash.size());
const uint32_t kBig=0xffffffff;
for (int n=0; n<num_chunks; n++)
{
BlastKmerStats& kmer_stats,
int kmerVer)
{
- int num_chunks=query_hash.size();
+ int num_chunks=static_cast<int>(query_hash.size());
vector< vector<uint32_t> > candidate_oids;
candidate_oids.resize(num_chunks);
int status=0;
vector<string> kmerFiles;
seqdb->FindVolumePaths(kmerFiles, false);
- int numFiles = kmerFiles.size();
+ int numFiles = static_cast<int>(kmerFiles.size());
for (int i=0; i<numFiles; i++)
{
try {
-/* $Id: kblastapi.cpp 555442 2018-01-18 12:23:05Z madden $
+/* $Id: kblastapi.cpp 683928 2024-06-10 12:07:11Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
static void
s_GetSequencesIntoScope(CRef<CBlastKmerResultsSet> resultSet, CRef<CScope> scope, CRef<CSeqDB> seqdb)
{
- int numSearches=resultSet->GetNumQueries();
+ int numSearches=static_cast<int>(resultSet->GetNumQueries());
vector<int> oid_v;
for (int index=0; index<numSearches; index++)
{
res_type = eSequenceComparison;
IBlastSeqInfoSrc * subject_infosrc = dbAdapter->MakeSeqInfoSrc();
if(subject_infosrc != NULL) {
- num_subjects = subject_infosrc->Size();
+ num_subjects = static_cast<unsigned int>(subject_infosrc->Size());
}
}
for (index=0; index<local_query_data->GetNumQueries(); index++)
vector< CRef<CScope> > scope_v = objmgr_qf->ExtractScopes();
s_GetSequencesIntoScope(resultSet, scope_v[0], seqdb);
- int numSearches=resultSet->GetNumQueries();
+ int numSearches=static_cast<int>(resultSet->GetNumQueries());
CRef<CSearchResultSet> search_results(new CSearchResultSet());
for (int index=0; index<numSearches; index++)
{
-# $Id: CMakeLists.blast_unit_test.app.txt 673806 2023-10-10 19:39:05Z ivanov $
+# $Id: CMakeLists.blast_unit_test.app.txt 683530 2024-05-30 12:54:29Z ivanov $
NCBI_begin_app(blast_unit_test)
NCBI_sources(blast_unit_test)
- NCBI_uses_toolkit_libraries(blast xobjmgr)
+ NCBI_uses_toolkit_libraries(xblast xobjmgr xconnect)
NCBI_set_test_assets(blast_unit_test.ini)
NCBI_add_test()
NCBI_project_watchers(boratyng morgulis madden camacho fongah2)
-/* $Id: tracebacksearch_unit_test.cpp 621864 2020-12-17 15:27:06Z grichenk $
+/* $Id: tracebacksearch_unit_test.cpp 679249 2024-02-20 20:56:20Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
CRef< CStructWrapper<BlastHSPStream> >
x_GetSampleHspStream(CRef<CBlastOptions> opts, CSeqDB & db)
{
- CSeq_id sid("XP_558472");
+ CSeq_id sid("EAL40459");
vector<int> OIDS;
db.SeqidToOids(sid, OIDS);
BOOST_REQUIRE_EQUAL((int)use_these.size(), 1);
if ( CSeq_id::PreferAccessionOverGi() ) {
- BOOST_REQUIRE(*(use_these.begin()) == "seqid:XP_558472.3");
+ BOOST_REQUIRE(*(use_these.begin()) == "seqid:EAL40459.3");
}
}
-/* $Id: version_reference_unit_test.cpp 673803 2023-10-10 19:38:36Z ivanov $
+/* $Id: version_reference_unit_test.cpp 683952 2024-06-10 12:29:05Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
BOOST_AUTO_TEST_CASE(testVersion) {
const int kMajor = 2;
- const int kMinor = 15;
+ const int kMinor = 16;
const int kPatch = 0;
blast::CBlastVersion v;
BOOST_REQUIRE_EQUAL(kMajor, v.GetMajor());
-/* $Id: blastn_vdb_args.cpp 664744 2023-03-21 13:02:48Z fongah2 $
+/* $Id: blastn_vdb_args.cpp 676153 2023-12-11 14:53:51Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
USING_SCOPE(objects);
const string kArgSRASearchMode("sra_mode");
+const string kArgIncludeFilteredReads("include_filtered_reads");
void
CBlastVDatabaseArgs::SetArgumentDescriptions(CArgDescriptions& arg_desc)
"2 = both unaligned reads and aligned reference seqs n");
arg_desc.AddDefaultKey(kArgSRASearchMode, "SRA_search_mode", kSRASearchMode,
CArgDescriptions::eInteger, "0");
-}
-
-
+ string kIncludeFilteredReads = string ("Include filtered reads\n");
+ arg_desc.AddFlag(kArgIncludeFilteredReads, kIncludeFilteredReads, true);
+}
CBlastnVdbAppArgs::CBlastnVdbAppArgs()
{
#ifndef SRASRC_COMMON_PRIV__H
#define SRASRC_COMMON_PRIV__H
-/* $Id: common_priv.h 633841 2021-06-28 13:54:08Z fongah2 $
+/* $Id: common_priv.h 683738 2024-06-04 12:01:08Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
#include <algo/blast/core/blast_util.h>
#include <corelib/ncbi_limits.h>
+// System include, explicitly needed on FreeBSD as of VDB 3.1.1.
+#include <time.h>
+
// VDB includes
#include <ncbi/vdb-blast.h>
#include <ncbi/vdb-blast-priv.h>
BlastSeqSrc*
SRABlastSeqSrcInit(const char** vdbRunAccessions, Uint4 numRuns,
Boolean isProtein, Boolean * excluded_runs,
- Uint4* status, Boolean isCSRA)
+ Uint4* status, Boolean isCSRA, Boolean include_filtered_reads)
{
BlastSeqSrcNewInfo bssNewInfo;
BlastSeqSrc* seqSrc = NULL;
vdbArgs.isRunExcluded = excluded_runs;
vdbArgs.status = 0;
vdbArgs.isCSRA = isCSRA;
+ vdbArgs.includeFilteredReads = include_filtered_reads;
bssNewInfo.constructor = &s_VDBSRC_SrcNew;
bssNewInfo.ctor_argument = (void*)&vdbArgs;
-/* $Id: vdb2blast_util.cpp 673574 2023-10-04 13:17:50Z ivanov $
+/* $Id: vdb2blast_util.cpp 676153 2023-12-11 14:53:51Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
Uint4 rc;
// Construct the BlastSeqSrc object
BlastSeqSrc* seqSrc =
- SRABlastSeqSrcInit((const char**)vdbRunAccessions, numRuns, false, isRunExcluded, &rc, m_isCSRAUtil);
+ SRABlastSeqSrcInit((const char**)vdbRunAccessions, numRuns, false, isRunExcluded, &rc, m_isCSRAUtil, m_IncludeFilteredReads);
string excluded_runs= kEmptyStr;
// Clean up
CVDBBlastUtil::CVDBBlastUtil(const string& strAllRuns,
bool bOwnSeqSrc,
- bool bCSRA):
- m_bOwnSeqSrc(bOwnSeqSrc), m_strAllRuns(strAllRuns), m_isCSRAUtil(bCSRA)
+ bool bCSRA,
+ bool bIncludeFilteredReads):
+ m_bOwnSeqSrc(bOwnSeqSrc), m_strAllRuns(strAllRuns), m_isCSRAUtil(bCSRA),
+ m_IncludeFilteredReads(bIncludeFilteredReads)
{
m_seqSrc = x_MakeVDBSeqSrc();
if( VDBSRC_OVERFLOW_RV == BlastSeqSrcGetNumSeqs(m_seqSrc)) {
AutoPtr<Boolean, ArrayDeleter<Boolean> > isRunExcluded(new Boolean[numRuns]);
Uint4 rc;
// Construct the BlastSeqSrc object
- SRABlastSeqSrcInit((const char**)vdbRunAccessions, numRuns, false, isRunExcluded.get(), &rc, false);
+ SRABlastSeqSrcInit((const char**)vdbRunAccessions, numRuns, false, isRunExcluded.get(), &rc, false, false);
// Clean up
string cannot_open= kEmptyStr;
-/* $Id: vdb_priv.c 634347 2021-07-09 11:58:07Z fongah2 $
+/* $Id: vdb_priv.c 676153 2023-12-11 14:53:51Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
return;
}
+ status = VdbBlastRunSetIgnoreReadFilter( vdbData->runSet, vdbArgs->includeFilteredReads);
+
{
char tmp[1];
uint32_t tmp_s = 0;
#ifndef VDBSRC_SRADB_PRIV__H
#define VDBSRC_SRADB_PRIV__H
-/* $Id: vdb_priv.h 633841 2021-06-28 13:54:08Z fongah2 $
+/* $Id: vdb_priv.h 676153 2023-12-11 14:53:51Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
// Make a seqsrc for CSRA if set to true
Boolean isCSRA;
+
+ Boolean includeFilteredReads;
};
typedef struct SVDBSRC_NewArgs TVDBNewArgs;
-/* $Id: vdbblast_local.cpp 673574 2023-10-04 13:17:50Z ivanov $
+/* $Id: vdbblast_local.cpp 676153 2023-12-11 14:53:51Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
CRef<CSearchResultSet> s_RunLocalVDBSearch(const string & dbs,
CRef<IQueryFactory> query_factory,
- CRef<CBlastOptionsHandle> opt_handle, Int4 & num_extensions)
+ CRef<CBlastOptionsHandle> opt_handle, Int4 & num_extensions,
+ bool include_filtered_reads)
{
bool isCSRA = false;
string csras = kEmptyStr;
csras = dbs.substr(k_CSRA_CHUNK.size());
}
- //CRef<CVDBBlastUtil> vdbUtil(new CVDBBlastUtil(isCSRA?csras:dbs, true, isCSRA));
- CVDBBlastUtil vdbUtil(isCSRA?csras:dbs, true, isCSRA);
+ CVDBBlastUtil vdbUtil(isCSRA?csras:dbs, true, isCSRA, include_filtered_reads);
BlastSeqSrc* seqSrc = vdbUtil.GetSRASeqSrc();
CRef<IBlastSeqInfoSrc> seqInfoSrc = vdbUtil.GetSRASeqInfoSrc();
CRef<CSearchResultSet> s_RunPsiVDBSearch(const string & dbs,
CRef<CPssmWithParameters> pssm,
- CRef<CBlastOptionsHandle> opt_handle)
+ CRef<CBlastOptionsHandle> opt_handle,
+ bool include_filtered_reads)
{
bool isCSRA = false;
string csras = kEmptyStr;
csras = dbs.substr(k_CSRA_CHUNK.size());
}
- CRef<CVDBBlastUtil> vdbUtil(new CVDBBlastUtil(isCSRA?csras:dbs, false, isCSRA));
+ CRef<CVDBBlastUtil> vdbUtil(new CVDBBlastUtil(isCSRA?csras:dbs, false, isCSRA, include_filtered_reads));
CRef<CSearchResultSet> results;
BlastSeqSrc* seqSrc = vdbUtil->GetSRASeqSrc();
CRef<IBlastSeqInfoSrc> seqInfoSrc = vdbUtil->GetSRASeqInfoSrc();
public:
CVDBThread(CRef<IQueryFactory> query_factory,
vector<string> & chunks,
- CRef<CBlastOptions> options);
+ CRef<CBlastOptions> options, bool include_filtered_reads);
CVDBThread(CRef<CPssmWithParameters> pssm,
vector<string> & chunks,
- CRef<CBlastOptions> options);
+ CRef<CBlastOptions> options, bool include_filtered_reads);
void * Main(void);
private:
CRef<IQueryFactory> m_query_factory;
vector<string> m_chunks;
CRef<CBlastOptionsHandle> m_opt_handle;
+ bool m_include_filtered_reads;
Int4 m_num_extensions;
CRef<CPssmWithParameters> m_pssm;
};
/* CVDBThread */
CVDBThread::CVDBThread(CRef<CPssmWithParameters> pssm,
vector<string> & chunks,
- CRef<CBlastOptions> options):
- m_chunks(chunks), m_num_extensions(0), m_pssm(pssm)
+ CRef<CBlastOptions> options,
+ bool include_filtered_reads):
+ m_chunks(chunks), m_include_filtered_reads(include_filtered_reads),
+ m_num_extensions(0), m_pssm(pssm)
{
m_opt_handle.Reset(new CPSIBlastOptionsHandle(options));
CVDBThread::CVDBThread(CRef<IQueryFactory> query_factory,
vector<string> & chunks,
- CRef<CBlastOptions> options):
- m_query_factory(query_factory), m_chunks(chunks), m_num_extensions(0)
+ CRef<CBlastOptions> options,
+ bool include_filtered_reads):
+ m_query_factory(query_factory), m_chunks(chunks),
+ m_include_filtered_reads(include_filtered_reads), m_num_extensions(0)
{
if(options->GetProgramType() == eBlastTypeBlastn)
if(m_chunks.size() == 1) {
if(m_pssm.Empty()) {
result->thread_result_set = s_RunLocalVDBSearch(m_chunks[0], m_query_factory,
- m_opt_handle, m_num_extensions);
+ m_opt_handle, m_num_extensions, m_include_filtered_reads);
}
else {
- result->thread_result_set = s_RunPsiVDBSearch(m_chunks[0], m_pssm, m_opt_handle);
+ result->thread_result_set = s_RunPsiVDBSearch(m_chunks[0], m_pssm, m_opt_handle, m_include_filtered_reads);
}
}
else {
Int4 num_exts = 0;
if(m_pssm.Empty()){
results.push_back(s_RunLocalVDBSearch(m_chunks[i], m_query_factory,
- m_opt_handle, num_exts));
+ m_opt_handle, num_exts, m_include_filtered_reads));
}
else {
- results.push_back(s_RunPsiVDBSearch(m_chunks[i], m_pssm, m_opt_handle));
+ results.push_back(s_RunPsiVDBSearch(m_chunks[i], m_pssm, m_opt_handle, m_include_filtered_reads));
}
m_num_extensions +=num_exts;
}
/* CLocalVDBBlast */
CLocalVDBBlast::CLocalVDBBlast(CRef<CBlastQueryVector> query_vector,
CRef<CBlastOptionsHandle> options,
- SLocalVDBStruct & local_vdb):
+ SLocalVDBStruct & local_vdb,
+ bool include_filtered_reads):
m_query_vector(query_vector),
m_opt_handle(options),
m_total_num_seqs(local_vdb.total_num_seqs),
m_total_length(local_vdb.total_length),
m_chunks_for_thread(local_vdb.chunks_for_thread),
m_num_threads(local_vdb.chunks_for_thread.size()),
- m_num_extensions(0)
+ m_num_extensions(0),
+ m_include_filtered_reads(include_filtered_reads)
{
}
/* CLocalVDBBlast */
CLocalVDBBlast::CLocalVDBBlast(CRef<objects::CPssmWithParameters> pssm,
CRef<CBlastOptionsHandle> options,
- SLocalVDBStruct & local_vdb):
+ SLocalVDBStruct & local_vdb,
+ bool include_filtered_reads):
m_opt_handle(options),
m_total_num_seqs(local_vdb.total_num_seqs),
m_total_length(local_vdb.total_length),
m_chunks_for_thread(local_vdb.chunks_for_thread),
m_num_threads(local_vdb.chunks_for_thread.size()),
m_num_extensions(0),
+ m_include_filtered_reads(include_filtered_reads),
m_pssm(pssm)
{
}
CRef<CSearchResultSet> retval;
if(m_pssm.Empty()){
CRef<IQueryFactory> queries(new CObjMgr_QueryFactory(*m_query_vector));
- retval = s_RunLocalVDBSearch(chunks[0], queries, m_opt_handle, m_num_extensions);
+ retval = s_RunLocalVDBSearch(chunks[0], queries, m_opt_handle, m_num_extensions, m_include_filtered_reads);
}
else {
- retval = s_RunPsiVDBSearch(chunks[0], m_pssm, m_opt_handle);
+ retval = s_RunPsiVDBSearch(chunks[0], m_pssm, m_opt_handle, m_include_filtered_reads);
}
m_opt_handle->SetOptions().SetHitlistSize(hls);
s_TrimResults(*retval, hls);
if(m_pssm.Empty()){
Int4 num_exts = 0;
CRef<IQueryFactory> queries(new CObjMgr_QueryFactory(*m_query_vector));
- results.push_back(s_RunLocalVDBSearch(chunks[i], queries, m_opt_handle, num_exts));
+ results.push_back(s_RunLocalVDBSearch(chunks[i], queries, m_opt_handle, num_exts, m_include_filtered_reads));
m_num_extensions += num_exts;
}
else {
- results.push_back(s_RunPsiVDBSearch(chunks[i], m_pssm, m_opt_handle));
+ results.push_back(s_RunPsiVDBSearch(chunks[i], m_pssm, m_opt_handle, m_include_filtered_reads));
}
}
{
// CThread destructor is protected, all threads destory themselves when terminated
if (isPSI) {
- thread[t] = (new CVDBThread(pssm[t], m_chunks_for_thread[t], m_opt_handle->SetOptions().Clone()));
+ thread[t] = (new CVDBThread(pssm[t], m_chunks_for_thread[t], m_opt_handle->SetOptions().Clone(), m_include_filtered_reads));
}
else {
- thread[t] = (new CVDBThread(query_factory[t], m_chunks_for_thread[t], m_opt_handle->SetOptions().Clone()));
+ thread[t] = (new CVDBThread(query_factory[t], m_chunks_for_thread[t], m_opt_handle->SetOptions().Clone(), m_include_filtered_reads));
}
thread[t]->Run();
}
+++ /dev/null
-# $Id: CMakeLists.blast_report.app.txt 622501 2020-12-24 15:12:25Z ivanov $
-
-NCBI_begin_app(blast_report)
- NCBI_sources(blast_report)
- NCBI_uses_toolkit_libraries(blast_app_util)
- NCBI_add_definitions(NCBI_MODULE=BLASTFORMAT)
-NCBI_end_app()
-# $Id: CMakeLists.txt 622501 2020-12-24 15:12:25Z ivanov $
+# $Id: CMakeLists.txt 683932 2024-06-10 12:08:12Z ivanov $
NCBI_add_library(blast_app_util)
NCBI_add_app(
rpsblast
rpstblastn
blast_formatter
- blast_report
deltablast
seedtop
)
+++ /dev/null
-WATCHERS = camacho madden fongah2
-
-APP = blast_report
-SRC = blast_report
-LIB_ = $(BLAST_INPUT_LIBS) $(BLAST_LIBS) xregexp $(PCRE_LIB) $(OBJMGR_LIBS)
-LIB = blast_app_util $(LIB_:%=%$(STATIC))
-
-# De-universalize Mac builds to work around a PPC toolchain limitation
-CFLAGS = $(FAST_CFLAGS:ppc=i386)
-CXXFLAGS = $(FAST_CXXFLAGS:ppc=i386)
-LDFLAGS = $(FAST_LDFLAGS:ppc=i386)
-
-CPPFLAGS = -DNCBI_MODULE=BLASTFORMAT $(ORIG_CPPFLAGS) $(BLAST_THIRD_PARTY_INCLUDE)
-LIBS = $(GENBANK_THIRD_PARTY_LIBS) $(BLAST_THIRD_PARTY_LIBS) $(CMPRS_LIBS) $(DL_LIBS) $(NETWORK_LIBS) $(ORIG_LIBS)
-
-REQUIRES = objects -Cygwin
-# $Id: Makefile.in 590894 2019-08-07 14:59:53Z camacho $
+# $Id: Makefile.in 683932 2024-06-10 12:08:12Z ivanov $
# Meta-makefile("APP" project)
#################################
rpsblast \
rpstblastn \
blast_formatter \
-blast_report \
deltablast \
seedtop
${MAKE} ${MFLAGS} -f Makefile.igblastp_app
blast_formatter: lib
${MAKE} ${MFLAGS} -f Makefile.blast_formatter_app
-blast_report: lib
- ${MAKE} ${MFLAGS} -f Makefile.blast_report_app
seedtop: lib
${MAKE} ${MFLAGS} -f Makefile.seedtop_app
deltablast: lib
-/* $Id: blast_app_util.cpp 673578 2023-10-04 13:18:18Z ivanov $
+/* $Id: blast_app_util.cpp 683535 2024-05-30 12:54:58Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
s_ExtractSeqidsAndRanges(results, ids, ranges);
_TRACE("Prefetching " << ids.size() << " sequence lengths");
LoadSequencesToScope(ids, ranges, scope);
- } catch (CException& e) {
+ }
+ catch(CSeqDBException & ) {
+ throw;
+ }
+ catch (CException& e) {
if(s_IsUsingRemoteBlastDbDataLoader()) {
ERR_POST(Warning << "Error fetching sequence data from BLAST databases at NCBI, "
"please try again later");
-/* $Id: blast_app_util.hpp 673578 2023-10-04 13:18:18Z ivanov $
+/* $Id: blast_app_util.hpp 683535 2024-05-30 12:54:58Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
/// object)
string RegisterOMDataLoader(CRef<CSeqDB> db_handle);
+
+
/// Command line binary exit code: success
#define BLAST_EXIT_SUCCESS 0
/// Command line binary exit code: error in input query/options
exit_code = BLAST_INPUT_ERROR; \
} \
catch (const CSeqDBException& e) { \
- LOG_POST(Error << "BLAST Database error: " << e.GetMsg()); \
- exit_code = BLAST_DATABASE_ERROR; \
+ if (e.GetErrCode() == CSeqDBException::eOpenFileErr) { \
+ string err_msg = \
+ "Too many open files, please raise the open file limit"; \
+ LOG_POST(Error << "BLAST Database error: " << err_msg); \
+ exit_code = BLAST_ENGINE_ERROR; \
+ } \
+ else if (e.GetErrCode() == CSeqDBException::eFileErr){ \
+ string err_msg = "Database memory map file error"; \
+ LOG_POST(Error << "BLAST Database error: " << err_msg); \
+ exit_code = BLAST_ENGINE_ERROR; \
+ } \
+ else { \
+ LOG_POST(Error << "BLAST Database error: " << e.GetMsg()); \
+ exit_code = BLAST_DATABASE_ERROR; \
+ } \
} \
catch (const blastdbindex::CDbIndex_Exception& e) { \
LOG_POST(Error << "Indexed BLAST database error: " << e.GetMsg()); \
+++ /dev/null
-/* $Id: blast_report.cpp 622260 2020-12-22 16:37:19Z grichenk $
- * ===========================================================================
- *
- * PUBLIC DOMAIN NOTICE
- * National Center for Biotechnology Information
- *
- * This software/database is a "United States Government Work" under the
- * terms of the United States Copyright Act. It was written as part of
- * the author's official duties as a United States Government employee and
- * thus cannot be copyrighted. This software/database is freely available
- * to the public for use. The National Library of Medicine and the U.S.
- * Government have not placed any restriction on its use or reproduction.
- *
- * Although all reasonable efforts have been taken to ensure the accuracy
- * and reliability of the software and data, the NLM and the U.S.
- * Government do not and cannot warrant the performance or results that
- * may be obtained by using this software or data. The NLM and the U.S.
- * Government disclaim all warranties, express or implied, including
- * warranties of performance, merchantability or fitness for any particular
- * purpose.
- *
- * Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- * Author: Irena Zaretskaya
- *
- */
-
-/** @file blast_report.cpp
- * Stand-alone command line HTML report for BLAST. Uses tempalates for descriptions and alignments. Outputs metadata as json
- */
-
-#include <ncbi_pch.hpp>
-#include <corelib/ncbiapp.hpp>
-#include <corelib/ncbistre.hpp>
-#include <serial/iterator.hpp>
-#include <algo/blast/api/version.hpp>
-#include <algo/blast/api/remote_blast.hpp>
-#include <algo/blast/blastinput/blast_input_aux.hpp>
-#include <algo/blast/format/blast_format.hpp>
-#include <algo/blast/api/objmgr_query_data.hpp>
-#include "blast_app_util.hpp"
-
-
-#ifndef SKIP_DOXYGEN_PROCESSING
-USING_NCBI_SCOPE;
-USING_SCOPE(blast);
-#endif
-
-
-#define EXIT_CODE__FORMAT_SUCCESS 0
-#define EXIT_CODE__NO_RESULTS_FOUND 1
-#define EXIT_CODE__INVALID_INPUT_FORMAT 2
-#define EXIT_CODE__BLAST_ARCHIVE_ERROR 3
-#define EXIT_CODE__CANNOT_ACCESS_FILE 4
-#define EXIT_CODE__QUERY_INDEX_INVALID 5
-#define EXIT_CODE__NETWORK_CONNECTION_ERROR 5
-
-class CBlastReportApp : public CNcbiApplication
-{
-public:
- /** @inheritDoc */
- CBlastReportApp() {
- CRef<CVersion> version(new CVersion());
- version->SetVersionInfo(new CBlastVersion());
- SetFullVersion(version);
- m_LoadFromArchive = false;
- }
-private:
- /** @inheritDoc */
- virtual void Init();
- /** @inheritDoc */
- virtual int Run();
-
- /// Prints the BLAST formatted output
- int PrintFormattedOutput(void);
-
- /// Extracts the queries to be formatted
- /// @param query_is_protein Are the queries protein sequences? [in]
- CRef<CBlastQueryVector> x_ExtractQueries(bool query_is_protein);
-
- /// Build the query from a PSSM
- /// @param pssm PSSM to inspect [in]
- CRef<CBlastSearchQuery>
- x_BuildQueryFromPssm(const CPssmWithParameters& pssm);
-
- /// Package a scope and Seq-loc into a SSeqLoc from a Bioseq
- /// @param bioseq Bioseq to inspect [in]
- /// @param scope Scope object to add the sequence data to [in|out]
- SSeqLoc x_QueryBioseqToSSeqLoc(const CBioseq& bioseq, CRef<CScope> scope);
-
- /// Our link to the NCBI BLAST service
- CRef<CRemoteBlast> m_RmtBlast;
-
- /// The source of CScope objects for queries
- CRef<CBlastScopeSource> m_QueryScopeSource;
-
- /// Tracks whether results come from an archive file.
- bool m_LoadFromArchive;
-};
-
-void CBlastReportApp::Init()
-{
- HideStdArgs(fHideLogfile | fHideConffile | fHideFullVersion | fHideXmlHelp | fHideDryRun);
-
- unique_ptr<CArgDescriptions> arg_desc(new CArgDescriptions);
-
- arg_desc->SetUsageContext(GetArguments().GetProgramBasename(),
- "Stand-alone BLAST formatter client, version "
- + CBlastVersion().Print());
-
- arg_desc->SetCurrentGroup("Input options");
-
-
- // add input file for seq-align here?
- arg_desc->AddKey(kArgArchive, "ArchiveFile", "File containing BLAST Archive format in ASN.1 (i.e.: output format 11)",
- CArgDescriptions::eInputFile);
-
- arg_desc->AddDefaultKey(kArgAlignSeqList, "alignseqlist", "List of comma separated seqids to display", CArgDescriptions::eString, "");
- arg_desc->AddDefaultKey(kArgMetadata, "searchmetadata", "Search Metadata indicator", CArgDescriptions::eBoolean,"f");
- arg_desc->AddDefaultKey(kArgQueryIndex, "queryindex", "Query Index", CArgDescriptions::eInteger, "0");
-
-
- CFormattingArgs fmt_args;
- fmt_args.SetArgumentDescriptions(*arg_desc);
-
- arg_desc->SetCurrentGroup("Output configuration options");
- arg_desc->AddDefaultKey(kArgOutput, "output_file", "Output file name",
- CArgDescriptions::eOutputFile, "-");
-
- arg_desc->SetCurrentGroup("Miscellaneous options");
- arg_desc->AddFlag(kArgParseDeflines,
- "Should the query and subject defline(s) be parsed?", true);
- arg_desc->SetCurrentGroup("");
-
- CDebugArgs debug_args;
- debug_args.SetArgumentDescriptions(*arg_desc);
-
- SetupArgDescriptions(arg_desc.release());
-}
-
-SSeqLoc
-CBlastReportApp::x_QueryBioseqToSSeqLoc(const CBioseq& bioseq,
- CRef<CScope> scope)
-{
- static bool first_time = true;
- _ASSERT(scope);
-
- if ( !HasRawSequenceData(bioseq) && first_time ) {
- _ASSERT(m_QueryScopeSource);
- m_QueryScopeSource->AddDataLoaders(scope);
- first_time = false;
- }
- else {
- scope->AddBioseq(bioseq);
- }
- CRef<CSeq_loc> seqloc(new CSeq_loc);
- seqloc->SetWhole().Assign(*bioseq.GetFirstId());
- return SSeqLoc(seqloc, scope);
-}
-
-CRef<CBlastSearchQuery>
-CBlastReportApp::x_BuildQueryFromPssm(const CPssmWithParameters& pssm)
-{
- if ( !pssm.HasQuery() ) {
- throw runtime_error("PSSM has no query");
- }
- CRef<CScope> scope(new CScope(*CObjectManager::GetInstance()));
- const CSeq_entry& seq_entry = pssm.GetQuery();
- if ( !seq_entry.IsSeq() ) {
- throw runtime_error("Cannot have multiple queries in a PSSM");
- }
- SSeqLoc ssl = x_QueryBioseqToSSeqLoc(seq_entry.GetSeq(), scope);
- CRef<CBlastSearchQuery> retval;
- retval.Reset(new CBlastSearchQuery(*ssl.seqloc, *ssl.scope));
- _ASSERT(ssl.scope.GetPointer() == scope.GetPointer());
- return retval;
-}
-
-CRef<CBlastQueryVector>
-CBlastReportApp::x_ExtractQueries(bool query_is_protein)
-{
- CRef<CBlast4_queries> b4_queries = m_RmtBlast->GetQueries();
- _ASSERT(b4_queries);
- const size_t kNumQueries = b4_queries->GetNumQueries();
-
- CRef<CBlastQueryVector> retval(new CBlastQueryVector);
-
- SDataLoaderConfig dlconfig(query_is_protein, SDataLoaderConfig::eUseNoDataLoaders);
- dlconfig.OptimizeForWholeLargeSequenceRetrieval(false);
- m_QueryScopeSource.Reset(new CBlastScopeSource(dlconfig));
-
- if (b4_queries->IsPssm()) {
- retval->AddQuery(x_BuildQueryFromPssm(b4_queries->GetPssm()));
- } else if (b4_queries->IsSeq_loc_list()) {
- CRef<CScope> scope = m_QueryScopeSource->NewScope();
- ITERATE(CBlast4_queries::TSeq_loc_list, seqloc,
- b4_queries->GetSeq_loc_list()) {
- _ASSERT( !(*seqloc)->GetId()->IsLocal() );
- CRef<CBlastSearchQuery> query(new CBlastSearchQuery(**seqloc,
- *scope));
- retval->AddQuery(query);
- }
- } else if (b4_queries->IsBioseq_set()) {
- CTypeConstIterator<CBioseq> itr(ConstBegin(b4_queries->GetBioseq_set(),
- eDetectLoops));
- CRef<CScope> scope(new CScope(*CObjectManager::GetInstance()));
- for (; itr; ++itr) {
- SSeqLoc ssl = x_QueryBioseqToSSeqLoc(*itr, scope);
- CRef<CBlastSearchQuery> query(new CBlastSearchQuery(*ssl.seqloc,
- *ssl.scope));
- retval->AddQuery(query);
- }
- }
-
- (void)kNumQueries; // eliminate compiler warning;
- _ASSERT(kNumQueries == retval->size());
- return retval;
-}
-
-static int s_GetError(string errorName, string defaultMessage, int defaultErrCode, string &errorMsg,string blastArchName = "")
-{
- CNcbiApplication* app = CNcbiApplication::Instance();
- string message = defaultMessage;
- int status = 0;
- if (app) {
- const CNcbiRegistry& registry = app->GetConfig();
- string errorCode;
- string errorInfo = registry.Get("Errors", errorName);
- if(!errorInfo.empty()) {
- NStr::SplitInTwo(errorInfo, ":", errorCode, message);
- status = NStr::StringToInt(errorCode,NStr::fConvErr_NoThrow);
- message = NStr::Replace(message,"#filename",blastArchName);
- }
- }
- if(!status || message.empty()) {
- errorMsg = defaultMessage;
- status = defaultErrCode;
- }
- else {
- errorMsg = message;
- }
- return status;
-}
-
-
-
-int CBlastReportApp::PrintFormattedOutput(void)
-{
- int retval = EXIT_CODE__FORMAT_SUCCESS;
- const CArgs& args = GetArgs();
-
-
- CNcbiOstream& out = args[kArgOutput].AsOutputFile();
- CFormattingArgs fmt_args;
-
- string alignSeqList = args[kArgAlignSeqList].HasValue() ? args[kArgAlignSeqList].AsString() : kEmptyStr;
- bool searchMetadata = args[kArgMetadata].HasValue() ? args[kArgMetadata].AsBoolean() : false;
- unsigned int queryIndex = args[kArgQueryIndex].HasValue() ? args[kArgQueryIndex].AsInteger() : 0;
-
-
-
- CRef<CBlastOptionsHandle> opts_handle = m_RmtBlast->GetSearchOptions();
- CBlastOptions& opts = opts_handle->SetOptions();
- fmt_args.ExtractAlgorithmOptions(args, opts);
- {{
- CDebugArgs debug_args;
- debug_args.ExtractAlgorithmOptions(args, opts);
- if (debug_args.ProduceDebugOutput()) {
- opts.DebugDumpText(NcbiCerr, "BLAST options", 1);
- }
- }}
-
-
- const EBlastProgramType p = opts.GetProgramType();
-
- CRef<CBlastQueryVector> queries = x_ExtractQueries(Blast_QueryIsProtein(p)?true:false);
- CRef<CScope> scope = queries->GetScope(0);
- _ASSERT(queries);
-
- CRef<CBlastDatabaseArgs> db_args(new CBlastDatabaseArgs()); // FIXME, what about rpsblast?
- int filtering_algorithm = -1;
- if (m_RmtBlast->IsDbSearch())
- {
- CRef<CBlast4_database> db = m_RmtBlast->GetDatabases();
- _ASSERT(db);
- _TRACE("Fetching results for " + Blast_ProgramNameFromType(p) + " on "
- + db->GetName());
- filtering_algorithm = m_RmtBlast->GetDbFilteringAlgorithmId();
- CRef<CSearchDatabase> search_db(new CSearchDatabase(db->GetName(), db->IsProtein()
- ? CSearchDatabase::eBlastDbIsProtein
- : CSearchDatabase::eBlastDbIsNucleotide));
- db_args->SetSearchDatabase(search_db);
- }
-
- CRef<CLocalDbAdapter> db_adapter;
- InitializeSubject(db_args, opts_handle, true, db_adapter, scope);
-
-
- CBlastFormat formatter(opts, *db_adapter,
- fmt_args.GetFormattedOutputChoice(),
- static_cast<bool>(args[kArgParseDeflines]),
- out,
- fmt_args.GetNumDescriptions(),
- fmt_args.GetNumAlignments(),
- *scope,
- opts.GetMatrixName(),
- fmt_args.ShowGis(),
- fmt_args.DisplayHtmlOutput(),
- opts.GetQueryGeneticCode(),
- opts.GetDbGeneticCode(),
- opts.GetSumStatisticsMode(),
- false,
- filtering_algorithm);
-
- formatter.SetLineLength(fmt_args.GetLineLength());
- formatter.SetAlignSeqList(alignSeqList);
-
- CRef<CSearchResultSet> results = m_RmtBlast->GetResultSet();
-
-
- try {
- if(queryIndex > results->GetNumQueries() - 1) {
- string msg;
- retval = s_GetError("InvalidQueryIndex", "Invalid query index.", EXIT_CODE__QUERY_INDEX_INVALID, msg);
- NCBI_THROW(CInputException, eInvalidInput,msg);
- }
-
- bool hasAlignments = (*results)[queryIndex].HasAlignments();
- //BlastFormatter_PreFetchSequenceData(*results, scope, fmt_args.GetFormattedOutputChoice());//*****Do we need to do this here???
- CBlastFormat::DisplayOption displayOption;
- if(searchMetadata) {
- displayOption = CBlastFormat::eMetadata;
- }
- else if(!alignSeqList.empty()){
- displayOption = CBlastFormat::eAlignments;
- }
- else {
- displayOption = CBlastFormat::eDescriptions;
- }
- if(hasAlignments || displayOption == CBlastFormat::eMetadata) {
- formatter.PrintReport((*results)[queryIndex], displayOption);
- }
- if(!hasAlignments) {
- retval = EXIT_CODE__NO_RESULTS_FOUND;
- }
- }catch (const CException & e) {
- cerr << e.GetMsg() << endl;
- }
-
- return retval;
-}
-
-
-
-int CBlastReportApp::Run(void)
-{
- int status = EXIT_CODE__FORMAT_SUCCESS;
- const CArgs& args = GetArgs();
- string msg;
- try {
- SetDiagPostLevel(eDiag_Warning);
- if (args[kArgArchive].HasValue()) {
- CNcbiIstream& istr = args[kArgArchive].AsInputFile();
- m_RmtBlast.Reset(new CRemoteBlast(istr));
- if (m_RmtBlast->LoadFromArchive()) {
- if(!m_RmtBlast->IsErrMsgArchive()) {
- status = PrintFormattedOutput();
- return status;
- }
- else {
- status = s_GetError("NetConError", "Network connection error", EXIT_CODE__NETWORK_CONNECTION_ERROR, msg);
- }
- }
- }
- }
- catch (const CSerialException&) {
- status = s_GetError("InvailInputFormat", "Invalid input format for BLAST Archive.", EXIT_CODE__INVALID_INPUT_FORMAT, msg);
- }
- catch (const CException& e) {
- if (e.GetErrCode() == CBlastException::eInvalidArgument) {
- status = s_GetError("ErrorBlastArchive", "Error processing BLAST Archive.", EXIT_CODE__BLAST_ARCHIVE_ERROR, msg);
- }
- else {
- status = s_GetError("ErrorAccessingFile", e.GetMsg(), EXIT_CODE__CANNOT_ACCESS_FILE, msg,args[kArgArchive].AsString());
- }
- }
-
- //cerr << "****retval:" << status << endl;
- cerr << msg << endl;
- return status;
-}
-
-
-#ifndef SKIP_DOXYGEN_PROCESSING
-int main(int argc, const char* argv[] /*, const char* envp[]*/)
-{
- return CBlastReportApp().AppMain(argc, argv);
-}
-#endif /* SKIP_DOXYGEN_PROCESSING */
+++ /dev/null
-[Templates]
-DFL_TABLE_ROW = <tr id=\"dtr_<@dflnFrm_id@>\" ind=\"<@dfln_blast_rank@>\" class=\"<@trtp@> dflLnk\" > \
-<td class=\"l c0\"><span class=\"ind\"><@dfln_blast_rank@></span><input type=\"checkbox\" id=\"chk_<@dfln_blast_rank@>\" class=\"cb\" name=\"getSeqGi\" value=\"<@dfln_id@>\" onclick=\"configDescrLinks(event,this)\" /><label for=\"chk_<@dfln_blast_rank@>\" class=\"accsb\">Select seq <@dflnAccs@></label></td> \
-<td class=\"lim l c2\"><div class=\"lim n\"><a title=\"Go to alignment for <@full_dfln_defline@>\" class=\"deflnDesc\" hsp=\"<@dfln_hspnum@>\" len=\"<@dfln_alnLen@>\" ind=\"<@dfln_blast_rank@>\" accs=\"<@dflnAccs@>\" seqFSTA=\"<@dflnFASTA_id@>\" gi=\"<@dfln_id@>\" seqID=\"<@dflnFrm_id@>\" id=\"deflnDesc_<@dfln_blast_rank@>\" onclick=\"DisplayAlignFromDescription(this);\" href=\"#alnHdr_<@dflnFrm_id@>\"><@dfln_defline@></a></div></td> \
-<td class=\"c3\"><@score_info@></td><td class=\"c4\"><@total_bit_string@></td><td class=\"c5\"><@percent_coverage@>%</td><td class=\"c6\"><@evalue_string@></td><td class=\"c7\"><@percent_identity@>%</td> \
-<td class=\"c1 l lim\"><@seq_info@></td></tr>
-DFL_TABLE_SCORE_INFO = <@bit_string@>
-DFL_TABLE_SEQ_INFO = <a href=\"<@dfln_url@>\" class=\"dflSeq\" target=\"lnk<@dfln_rid@>\" title=\"Show report for <@dfln_seqid@>\"><@dfln_gi@><@dfln_seqid@></a>
-
-BLAST_ALIGN_HEADER = \
-<div class=\"alnHdr cnf\" id=\"alnHdr_<@alnSeqGi@>\" seqID=\"<@alnSeqGi@>\" accs=\"<@firstSeqID@>\"> \
-<a name=\"<@alnSeqGi@>\"></a> \
-<a href=\"#dlgDwnl_<@alnSeqGi@>\" data-jig=\"ncbipopper\" class=\"toolsCtr dnld dialog\" data-jigconfig=\"hasArrow:'true',arrowDirection:'top',closeEvent: 'click', openEvent: 'click', destPosition: 'top center', triggerPosition: 'bottom right'\" id=\"alnDwnld_<@alnSeqGi@>\" title=\"Download information for <@firstSeqID@>\"><span>Download</span></a> \
-<div id=\"dlgDwnl_<@alnSeqGi@>\" class=\"popDl\"> \
-<div><input type=\"radio\" name=\"dwn_<@alnSeqGi@>\" checked=\"checked\" id=\"dwFST_<@alnSeqGi@>\" fstaDWType=\"complete\" sbFunc=\"initDownLoadFSTA\" /><label class=\"shownInl\" for=\"dwFST_<@alnSeqGi@>\">FASTA (complete sequence)</label></div> \
-<div><input type=\"radio\" name=\"dwn_<@alnSeqGi@>\" id=\"dwFSTAl_<@alnSeqGi@>\" fstaDWType=\"range\" sbFunc=\"initDownLoadFSTA\" /><label class=\"shownInl\" for=\"dwFSTAl_<@alnSeqGi@>\">FASTA (aligned sequences)</label></div> \
-<div class=\"<@dwGnbn@>\"><input type=\"radio\" name=\"dwn_<@alnSeqGi@>\" id=\"dwGenBank_<@alnSeqGi@>\" getGi=\"<@alnSeqGi@>\" sbName=\"id\" url=\"https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?rettype=gb&retmode=text\" /><label class=\"shownInl\" for=\"dwGenBank_<@alnSeqGi@>\">GenBank (complete sequence)</label></div> \
-<div> \
-<button class=\"cfg\" id=\"dw_cont_<@alnSeqGi@>\">Continue</button> \
-<button class=\"cfg cnc\" >Cancel</button> \
-</div> \
-</div> <!-- dsDownload --> \
-<span class=\"csLinks\" id=\"csLinks_<@alnSeqGi@>\"><@alnCustomLinks@></span> \
-<@sortInfo@> \
-<span class=\"alnSeqLinks\"> \
-<a class=\"gbd toolsCtr navNext\" ref=\"ordinalpos=<@aln_ord_pos@>&currseq=<@alnSeqGi@>\" id=\"alnNxt_<@alnSeqGi@>\" onclick=\"goToNextAlign('dtr_<@alnSeqGi@>',true);\"><span>Next</span></a> \
-<a class=\"gbd toolsCtr navPrev\" ref=\"ordinalpos=<@aln_ord_pos@>&currseq=<@alnSeqGi@>\" id=\"alnPrv_<@alnSeqGi@>\" onclick=\"goToNextAlign('dtr_<@alnSeqGi@>',false);\"><span>Previous</span></a> \
-<a class=\"gbd toolsCtr navBack\" title=\"Go to definition line for <@firstSeqID@>\" id=\"alnDsc_<@alnSeqGi@>\" onclick=\"goToDefLine('dtr_<@alnSeqGi@>');\" href=\"#dtr_<@alnSeqGi@>\"><span>Descriptions</span></a> \
-</span> \
-</div> \
-<div class=\"oneSeqAln\" id=\"aln_<@alnSeqGi@>\"> \
-<div id=\"dln_<@alnSeqGi@>\"> \
-<@aln_deflines@> \
-</div> \
-<div class=\"relInf\" id=\"relInf_<@alnSeqGi@>\"><label>Related Information</label><@alnLinkOutLinks@></div> \
-<div class=\"alnAll\" id=\"alnAll_<@alnSeqGi@>\">
-
-
-BLAST_ALIGN_PARAMS = \
-<div id=\"hd_<@alnSeqGi@>_<@aln_curr_num@>\"> \
-<div class=\"dflLnk hsp\"><span class=\"alnRn\"><label>Range <@aln_curr_num@>: <@fromHSP@> to <@toHSP@></label><span class=\"<@multiHSP@>\" id=\"rng_<@alnSeqGi@>\"><@alnHSPLinks@></span></span> \
-<span id=\"hsp<@alnSeqGi@>_<@aln_curr_num@>\" class=\"alnParLinks\"> \
-<a class=\"gbd toolsCtr navNext\" <@aln_hide_next@> title=\"Go to next match #<@aln_next_num@> for <@firstSeqID@>\" onmouseover=\"scan(this)\" ref=\"ordinalpos=<@aln_curr_num@>&currseq=<@alnSeqGi@>\" onclick=\"goToNextHSP(this,true)\"><span>Next Match</span></a> \
-<a class=\"gbd toolsCtr navPrev\" <@aln_hide_prev@> title=\"Go to previous match #<@aln_prev_num@> for <@firstSeqID@>\" onmouseover=\"scan(this)\" ref=\"ordinalpos=<@aln_curr_num@>&currseq=<@alnSeqGi@>\" onclick=\"goToNextHSP(this,false)\"><span>Previous Match</span></a> \
-<a class=\"gbd toolsCtr navBack <@aln_hide_fst@>\" href=\"#hsp<@alnSeqGi@>_1\" title=\"Go to first match for <@firstSeqID@>\"><span>First Match</span></a> \
-</span> \
-</div> \
-<@align_params@> \
-<div class=\"dflLnk aln_feat <@aln_feat_show@>\"><label>Features:</label><div><@all_aln_features@></div></div> \
-</div>
-
-ALIGN_PARAMS_NUC = \
-<table class=\"alnParams\"> \
-<caption class=\"hdnHeader\">Alignment statistics for match #<@aln_curr_num@></caption> \
-<tr> \
-<th>Score</th><th>Expect</th><th>Identities</th><th>Gaps</th><th>Strand</th><th class=\"aln_frame <@aln_frame_show@>\">Frame</th> \
-</tr> \
-<tr> \
-<td><@aln_score@> bits(<@aln_score_bits@>)</td> \
-<td><@aln_eval@><span class=\"sumN <@sumNshow@>\">(<@aln_sumN@>)</span></td> \
-<td><@aln_match@>(<@aln_ident@>%)</td> \
-<td><@aln_gaps@>(<@aln_gaps_prc@>%)</td> \
-<td><@aln_strand@></td> \
-<td class=\"aln_frame <@aln_frame_show@>\"><@aln_frame@></td> \
-</tr></table>
-
-
-ALIGN_PARAMS_PROT = \
-<table class=\"alnParams\"> \
-<caption class=\"hdnHeader\">Alignment statistics for match #<@aln_curr_num@></caption> \
-<tr> \
-<th>Score</th><th>Expect</th><th class=\"cbs_md <@aln_meth_hide@>\">Method</th><th>Identities</th><th>Positives</th><th>Gaps</th><th class=\"aln_frame <@aln_frame_show@>\">Frame</th> \
-</tr> \
-<tr> \
-<td><@aln_score@> bits(<@aln_score_bits@>)</td> \
-<td><@aln_eval@><span class=\"sumN <@sumNshow@>\">(<@aln_sumN@>)</span></td> \
-<td class=\"<@aln_meth_hide@>\"><@aln_meth@></td> \
-<td><@aln_match@>(<@aln_ident@>%)</td> \
-<td><@aln_pos@>(<@aln_pos_prc@>%)</td> \
-<td><@aln_gaps@>(<@aln_gaps_prc@>%)</td> \
-<td class=\"aln_frame <@aln_frame_show@>\"><@aln_frame@></td> \
-</tr> \
-</table>
-
-
-SORT_ALIGNS_SEQ = \
-<div class=\"seqlinks alnDflLn alnSortSeq\"><label>Sort by:</label> \
-<select id=\"sa_<@alnSeqGi@>\" onchange=\"SortHSPAlnSel(event,this)\"> \
-<option value=\"0\">E value</option> \
-<option value=\"1\"> Score</option> \
-<option value=\"3\">Percent identity</option> \
-<option value=\"2\">Query start position</option> \
-<option value=\"4\">Subject start position</option> \
-</select> \
-</div>
-
-ALN_FEATURES = <@aln_feat_info@>
-
-ALN_FEATURES_LINK = <a href=\"<@aln_feat_url@>\"><@aln_feat@></a>
-
-ALN_DEFLINE_ROW = \
-<div class=\"dlfRow\"> \
-<@alnTitle@> \
-<div><label>Sequence ID: </label><@seq_info@><span class=\"<@frstDfl@> r\"><label>Length: </label><@alnSeqLength@><label>Number of Matches: </label><@alnHspNum@></span></div> \
-</div>
-
-ALN_DEFLINE_TITLES_LNK = <h4><a href=\"#\" class=\"jtg resArrowLinkW ui-ncbitoggler\" data-jig=\"ncbitoggler\" title=\"Sequences identical to <@firstSeqID@>\" >See <@titleNum@> more title(s)</a></h4>
-
-ALN_DEFLINE_TITLES = \
-<div class=\"ui-helper-reset\" aria-live=\"assertive\" > \
-<div class=\"ui-ncbitoggler-slave\"> \
-<@seqTitles@> \
-</div> \
-</div>
-
-ALN_DEFLINE_SEQ_INFO = <a href=\"<@aln_url@>\" target=\"lnk<@aln_rid@>\" title=\"Show report for <@aln_seqid@>\"><@aln_gi@><@aln_seqid@></a>
-
-BLAST_ALIGN_ROWS = \
-<div id=\"ar_<@alnSeqGi@>_<@aln_curr_num@>\"> \
-<pre> \
-<@align_rows@> \
-</pre> \
-</div>
-
-BLAST_ALIGN_ROWS_LST = \
-<div id=\"ar_<@alnSeqGi@>_<@aln_curr_num@>\"> \
-<pre> \
-<@align_rows@> \
-</pre> \
-</div> \
-</div> <!-- alnAll_<@alnSeqGi@> --> \
-</div> <!-- aln_<@alnSeqGi@> -->
-
-[Errors]
-NoResultsFound=1:No results found.
-InvailInputFormat=2:Invalid input format for BLAST Archive.
-ErrorBlastArchive=3:Error processing BLAST Archive.
-ErrorAccessingFile=4:Error accesing blast archive #filename.
-InvalidQueryIndex=5:Invalid query index.
-NetConError=6:Network connection error.
-/* $Id: blastn_app.cpp 673579 2023-10-04 13:18:26Z ivanov $
+/* $Id: blastn_app.cpp 683938 2024-06-10 12:09:24Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
{
int status = BLAST_EXIT_SUCCESS;
const CArgs& args = GetArgs();
+ BLAST_PROF_ADD2( PROGRAM, blastn ) ;
+ BLAST_PROF_ADD( THREADS , (int)m_CmdLineArgs->GetNumThreads() );
+ BLAST_PROF_ADD( MT_MODE , (int)m_CmdLineArgs->GetMTMode() );
//Check to see if search should split by queries
try {
SetDiagPostLevel(eDiag_Warning);
{
BLAST_PROF_START( APP.MAIN );
BLAST_PROF_START( APP.PRE );
- BLAST_PROF_ADD2( PROGRAM, blastn ) ;
int status = BLAST_EXIT_SUCCESS;
int batch_num = 0;
int batch_size = m_CmdLineArgs->GetQueryBatchSize();
if (batch_size) {
input.SetBatchSize(batch_size);
- BLAST_PROF_ADD( BATCH_SIZE, (int)batch_size );
+ //BLAST_PROF_ADD( BATCH_SIZE, (int)batch_size );
} else {
Int8 total_len = formatter.GetDbTotalLength();
if (total_len > 0) {
mixer.SetTargetHits(total_len / 3000);
}
input.SetBatchSize(mixer.GetBatchSize());
- BLAST_PROF_ADD( BATCH_SIZE, (int)mixer.GetBatchSize() );
+ //BLAST_PROF_ADD( BATCH_SIZE, (int)mixer.GetBatchSize() );
}
+ BLAST_PROF_ADD( BATCH_SIZE, (int)input.GetBatchSize() );
BLAST_PROF_STOP( APP.PRE );
for (; !input.End(); formatter.ResetScopeHistory(), QueryBatchCleanup() ) {
BLAST_PROF_START( APP.LOOP.PRE );
m_UsageReport.AddParam(CBlastUsageReport::eNumThreads, (int) m_CmdLineArgs->GetNumThreads());
m_UsageReport.AddParam(CBlastUsageReport::eExitStatus, status);
BLAST_PROF_STOP( APP.MAIN );
- BLAST_PROF_ADD( THREADS , (int)m_CmdLineArgs->GetNumThreads() );
BLAST_PROF_ADD( BATCHES , (int)batch_num );
BLAST_PROF_ADD( EXIT_STATUS , (int)status );
BLAST_PROF_REPORT ;
int CBlastnApp::x_RunMTBySplitQuery()
{
BLAST_PROF_START( APP.MAIN );
- BLAST_PROF_START( APP.PRE );
- BLAST_PROF_ADD2( PROGRAM, blastn ) ;
int status = BLAST_EXIT_SUCCESS;
+ int chunk_num = 0;
try {
const CArgs& args = GetArgs();
LogBlastOptions(m_UsageReport, m_OptsHndl->GetOptions());
LogCmdOptions(m_UsageReport, *m_CmdLineArgs);
- int chunk_num = 0;
int batch_size = GetMTByQueriesBatchSize(m_OptsHndl->GetOptions().GetProgram(), kMaxNumOfThreads);
INFO_POST("Batch Size: " << batch_size);
CBlastNodeInputReader input(m_CmdLineArgs->GetInputStream(), batch_size, 2000);
const CArgs & a = GetArgs();
PrintErrorArchive(a, m_Bah.GetMessages());
}
- BLAST_PROF_STOP( APP.MAIN );
- BLAST_PROF_ADD( THREADS , (int)m_CmdLineArgs->GetNumThreads() );
+ BLAST_PROF_STOP( APP.MAIN );
BLAST_PROF_ADD( EXIT_STATUS , (int)status );
+ BLAST_PROF_ADD( BATCHES , (int)chunk_num );
BLAST_PROF_REPORT ;
m_UsageReport.AddParam(CBlastUsageReport::eTask, m_CmdLineArgs->GetTask());
m_UsageReport.AddParam(CBlastUsageReport::eNumThreads, (int) m_CmdLineArgs->GetNumThreads());
-/* $Id: blastp_app.cpp 673580 2023-10-04 13:18:34Z ivanov $
+/* $Id: blastp_app.cpp 683938 2024-06-10 12:09:24Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
#include <algo/blast/blastinput/blastp_args.hpp>
#include <algo/blast/api/objmgr_query_data.hpp>
#include <algo/blast/format/blast_format.hpp>
+#include <util/profile/rtprofile.hpp>
#include "blast_app_util.hpp"
#include "blastp_node.hpp"
int CBlastpApp::Run(void)
{
int status = BLAST_EXIT_SUCCESS;
+ BLAST_PROF_ADD2( PROGRAM, blastp ) ;
+ BLAST_PROF_ADD( THREADS , (int)m_CmdLineArgs->GetNumThreads() );
+ BLAST_PROF_ADD( MT_MODE , (int)m_CmdLineArgs->GetMTMode() );
const CArgs& args = GetArgs();
//Check to see if search should split by queries
int CBlastpApp::x_RunMTBySplitDB()
{
-
+ BLAST_PROF_START( APP.MAIN );
+ BLAST_PROF_START( APP.PRE );
int status = BLAST_EXIT_SUCCESS;
+ int batch_num = 0;
try {
}
formatter.PrintProlog();
+ BLAST_PROF_ADD( BATCH_SIZE, (int)input.GetBatchSize() );
/*** Process the input ***/
for (; !input.End(); formatter.ResetScopeHistory(), QueryBatchCleanup()) {
-
+ BLAST_PROF_START( APP.LOOP.PRE );
CRef<CBlastQueryVector> query_batch(input.GetNextSeqBatch(*scope));
CRef<IQueryFactory> queries(new CObjMgr_QueryFactory(*query_batch));
SaveSearchStrategy(args, m_CmdLineArgs, queries, m_OptsHndl);
CRef<CSearchResultSet> results;
-
+ BLAST_PROF_STOP( APP.LOOP.PRE );
if (m_CmdLineArgs->ExecuteRemotely()) {
CRef<CRemoteBlast> rmt_blast =
InitializeRemoteBlast(queries, db_args, m_OptsHndl,
m_CmdLineArgs->GetClientId());
results = rmt_blast->GetResultSet();
} else {
+ BLAST_PROF_START( APP.LOOP.BLAST );
CLocalBlast lcl_blast(queries, m_OptsHndl, db_adapter);
lcl_blast.SetNumberOfThreads(m_CmdLineArgs->GetNumThreads());
results = lcl_blast.Run();
+ BLAST_PROF_STOP( APP.LOOP.BLAST );
}
-
+ BLAST_PROF_START( APP.LOOP.FMT );
if (fmt_args->ArchiveFormatRequested(args)) {
formatter.WriteArchive(*queries, *m_OptsHndl, *results, 0, m_Bah.GetMessages());
m_Bah.ResetMessages();
formatter.PrintOneResultSet(**result, query_batch);
}
}
+ BLAST_PROF_STOP( APP.LOOP.FMT );
+ batch_num++;
}
+ BLAST_PROF_START( APP.POST );
formatter.PrintEpilog(opt);
if (m_CmdLineArgs->ProduceDebugOutput()) {
LogQueryInfo(m_UsageReport, input);
formatter.LogBlastSearchInfo(m_UsageReport);
+ BLAST_PROF_STOP( APP.POST );
} CATCH_ALL(status)
if(!m_Bah.GetMessages().empty()) {
const CArgs & a = GetArgs();
m_UsageReport.AddParam(CBlastUsageReport::eTask, m_CmdLineArgs->GetTask());
m_UsageReport.AddParam(CBlastUsageReport::eNumThreads, (int) m_CmdLineArgs->GetNumThreads());
m_UsageReport.AddParam(CBlastUsageReport::eExitStatus, status);
+ BLAST_PROF_STOP( APP.MAIN );
+ BLAST_PROF_ADD( BATCHES , (int)batch_num );
+ BLAST_PROF_ADD( EXIT_STATUS , (int)status );
+ BLAST_PROF_REPORT ;
return status;
}
int CBlastpApp::x_RunMTBySplitQuery()
{
+ BLAST_PROF_START( APP.MAIN );
int status = BLAST_EXIT_SUCCESS;
try {
int chunk_num = 0;
int batch_size = GetMTByQueriesBatchSize(m_OptsHndl->GetOptions().GetProgram(), kMaxNumOfThreads);
INFO_POST("Batch Size: " << batch_size);
+ BLAST_PROF_ADD( BATCH_SIZE, (int)batch_size );
CBlastNodeInputReader input(m_CmdLineArgs->GetInputStream(), batch_size, 2000);
while (master_node.Processing()) {
if (!input.AtEOF()) {
const CArgs & a = GetArgs();
PrintErrorArchive(a, m_Bah.GetMessages());
}
+ BLAST_PROF_STOP( APP.MAIN );
+ BLAST_PROF_ADD( EXIT_STATUS , (int)status );
+ BLAST_PROF_REPORT ;
m_UsageReport.AddParam(CBlastUsageReport::eTask, m_CmdLineArgs->GetTask());
m_UsageReport.AddParam(CBlastUsageReport::eNumThreads, (int) m_CmdLineArgs->GetNumThreads());
m_UsageReport.AddParam(CBlastUsageReport::eExitStatus, status);
-/* $Id: blastx_app.cpp 673581 2023-10-04 13:18:42Z ivanov $
+/* $Id: blastx_app.cpp 683938 2024-06-10 12:09:24Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
#include <algo/blast/blastinput/blastx_args.hpp>
#include <algo/blast/api/objmgr_query_data.hpp>
#include <algo/blast/format/blast_format.hpp>
+#include <util/profile/rtprofile.hpp>
#include "blast_app_util.hpp"
#include "blastx_node.hpp"
int CBlastxApp::Run(void)
{
int status = BLAST_EXIT_SUCCESS;
+ BLAST_PROF_ADD2( PROGRAM, blastx ) ;
+ BLAST_PROF_ADD( THREADS , (int)m_CmdLineArgs->GetNumThreads() );
+ BLAST_PROF_ADD( MT_MODE , (int)m_CmdLineArgs->GetMTMode() );
const CArgs& args = GetArgs();
//Check to see if search should split by queries
try {
if(!m_Bah.GetMessages().empty()) {
PrintErrorArchive(args, m_Bah.GetMessages());
}
+ return status;
}
int CBlastxApp::x_RunMTBySplitDB()
{
-
+ BLAST_PROF_START( APP.MAIN );
+ BLAST_PROF_START( APP.PRE );
int status = BLAST_EXIT_SUCCESS;
+ int batch_num = 0;
try {
}
formatter.PrintProlog();
+ BLAST_PROF_STOP( APP.PRE );
+ BLAST_PROF_ADD( BATCH_SIZE, (int)input.GetBatchSize() );
/*** Process the input ***/
for (; !input.End(); formatter.ResetScopeHistory(), QueryBatchCleanup()) {
-
+ BLAST_PROF_START( APP.LOOP.PRE );
CRef<CBlastQueryVector> query_batch(input.GetNextSeqBatch(*scope));
CRef<IQueryFactory> queries(new CObjMgr_QueryFactory(*query_batch));
SaveSearchStrategy(args, m_CmdLineArgs, queries, m_OptsHndl);
CRef<CSearchResultSet> results;
+ BLAST_PROF_STOP( APP.LOOP.PRE );
if (m_CmdLineArgs->ExecuteRemotely()) {
CRef<CRemoteBlast> rmt_blast =
m_CmdLineArgs->GetClientId());
results = rmt_blast->GetResultSet();
} else {
+ BLAST_PROF_START( APP.LOOP.BLAST );
CLocalBlast lcl_blast(queries, m_OptsHndl, db_adapter);
lcl_blast.SetNumberOfThreads(m_CmdLineArgs->GetNumThreads());
results = lcl_blast.Run();
+ BLAST_PROF_STOP( APP.LOOP.BLAST );
}
-
+ BLAST_PROF_START( APP.LOOP.FMT );
if (fmt_args->ArchiveFormatRequested(args)) {
formatter.WriteArchive(*queries, *m_OptsHndl, *results, 0, m_Bah.GetMessages());
m_Bah.ResetMessages();
formatter.PrintOneResultSet(**result, query_batch);
}
}
+ BLAST_PROF_STOP( APP.LOOP.FMT );
+ batch_num++;
}
-
+ BLAST_PROF_START( APP.POST );
formatter.PrintEpilog(opt);
if (m_CmdLineArgs->ProduceDebugOutput()) {
LogQueryInfo(m_UsageReport, input);
formatter.LogBlastSearchInfo(m_UsageReport);
+ BLAST_PROF_STOP( APP.POST );
} CATCH_ALL(status)
if(!m_Bah.GetMessages().empty()) {
const CArgs & a = GetArgs();
m_UsageReport.AddParam(CBlastUsageReport::eTask, m_CmdLineArgs->GetTask());
m_UsageReport.AddParam(CBlastUsageReport::eNumThreads, (int) m_CmdLineArgs->GetNumThreads());
m_UsageReport.AddParam(CBlastUsageReport::eExitStatus, status);
+ BLAST_PROF_STOP( APP.MAIN );
+ BLAST_PROF_ADD( BATCHES , (int)batch_num );
+ BLAST_PROF_ADD( EXIT_STATUS , (int)status );
+ BLAST_PROF_REPORT ;
return status;
}
int CBlastxApp::x_RunMTBySplitQuery()
{
int status = BLAST_EXIT_SUCCESS;
+ int chunk_num = 0; // logically this is also batch number
+ BLAST_PROF_START( APP.MAIN );
try {
const CArgs& args = GetArgs();
LogBlastOptions(m_UsageReport, m_OptsHndl->GetOptions());
LogCmdOptions(m_UsageReport, *m_CmdLineArgs);
- int chunk_num = 0;
int batch_size = GetMTByQueriesBatchSize(m_OptsHndl->GetOptions().GetProgram(), kMaxNumOfThreads, m_CmdLineArgs->GetTask());
INFO_POST("Batch Size: " << batch_size);
+ BLAST_PROF_ADD( BATCH_SIZE, (int)batch_size );
CBlastNodeInputReader input(m_CmdLineArgs->GetInputStream(), batch_size, 2000);
while (master_node.Processing()) {
if (!input.AtEOF()) {
m_UsageReport.AddParam(CBlastUsageReport::eTask, m_CmdLineArgs->GetTask());
m_UsageReport.AddParam(CBlastUsageReport::eNumThreads, (int) m_CmdLineArgs->GetNumThreads());
m_UsageReport.AddParam(CBlastUsageReport::eExitStatus, status);
-
+ BLAST_PROF_STOP( APP.MAIN );
+ BLAST_PROF_ADD( BATCHES , (int)chunk_num );
+ BLAST_PROF_ADD( EXIT_STATUS , (int)status );
+ BLAST_PROF_REPORT ;
return status;
}
-/* $Id: tblastn_app.cpp 673771 2023-10-10 14:47:13Z ivanov $
+/* $Id: tblastn_app.cpp 676160 2023-12-11 14:55:50Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
if(!m_Bah.GetMessages().empty()) {
PrintErrorArchive(args, m_Bah.GetMessages());
}
+ return status;
}
int CTblastnApp::x_RunMTBySplitDB()
#!/usr/bin/env perl
-# $Id: update_blastdb.pl 672917 2023-09-18 17:55:38Z ivanov $
+# $Id: update_blastdb.pl 681901 2024-04-17 13:16:37Z ivanov $
# ===========================================================================
#
# PUBLIC DOMAIN NOTICE
use constant GCP_URL => "http://metadata.google.internal/computeMetadata/v1/instance/id";
use constant GCP_BUCKET => "blast-db";
-# TODO: deprecate this in the next release 2.14.x
-#use constant BLASTDB_MANIFEST => "blastdb-manifest.json";
-use constant BLASTDB_MANIFEST_VERSION => "1.0";
-
use constant BLASTDB_METADATA => "blastdb-metadata-1-1.json";
use constant BLASTDB_METADATA_VERSION => "1.1";
my $opt_force_download = 0;
my $opt_help = 0;
my $opt_passive = 1;
-my $opt_blastdb_ver = undef;
my $opt_timeout = 120;
my $opt_showall = undef;
my $opt_show_version = 0;
"timeout=i" => \$opt_timeout,
"showall:s" => \$opt_showall,
"version" => \$opt_show_version,
- "blastdb_version:i" => \$opt_blastdb_ver,
"decompress" => \$opt_decompress,
"source=s" => \$opt_source,
"gcp-project=s" => \$opt_gcp_prj,
pod2usage({-exitval => 0, -verbose => 2}) unless (scalar @ARGV or
defined($opt_showall) or
$opt_show_version);
-if (defined $opt_blastdb_ver) {
- pod2usage({-exitval => 1, -verbose => 0,
- -msg => "Invalid BLAST database version: $opt_blastdb_ver. Supported values: 4, 5"})
- unless ($opt_blastdb_ver == 4 or $opt_blastdb_ver == 5);
-}
-
pod2usage({-exitval => 1, -verbose => 0, -msg => "Invalid number of threads"})
if ($opt_nt < 0);
my $max_num_cores = &get_num_cores();
$|++;
if ($opt_show_version) {
- my $revision = '$Revision: 672917 $';
+ my $revision = '$Revision: 681901 $';
$revision =~ s/\$Revision: | \$//g;
print "$0 version $revision\n";
exit($exit_code);
my $url = shift;
my $metadata = decode_json($json);
if (ref($metadata) eq 'HASH') {
+ # This code branch detects the manifest version below
+ # We switched to manifest version 1.1 on 2022-07-28, for the BLAST+ 2.14.0 release
+ use constant BLASTDB_MANIFEST_VERSION => "1.0";
unless (exists($$metadata{version}) and ($$metadata{version} eq BLASTDB_MANIFEST_VERSION)) {
print STDERR "ERROR: Invalid version in manifest file $url, please report to blast-help\@ncbi.nlm.nih.gov\n";
exit(EXIT_FAILURE);
}
if ($location ne "NCBI") {
- die "Only BLASTDB version 5 is supported at GCP and AWS\n" if (defined $opt_blastdb_ver and $opt_blastdb_ver != 5);
my $latest_dir = &get_latest_dir($location);
my ($json, $url) = &get_blastdb_metadata($location, $latest_dir);
unless (length($json)) {
$ftp->login(USER, PASSWORD)
or die "Failed to login to " . NCBI_FTP . ": $!\n";
my $ftp_path = BLAST_DB_DIR;
- $ftp_path .= "/v$opt_blastdb_ver" if (defined $opt_blastdb_ver);
$ftp->cwd($ftp_path);
$ftp->binary();
- if ($opt_verbose) {
- if (defined $opt_blastdb_ver) {
- print "Connected to $location; downloading BLASTDBv$opt_blastdb_ver\n";
- } else {
- print "Connected to $location\n";
- }
- }
+ print "Connected to $location\n" if ($opt_verbose);
return $ftp;
}
use Time::Local;
my %month2int = (Jan=>0, Feb=>1, Mar=>2, Apr=>3, May=>4, Jun=>5,
Jul=>6, Aug=>8, Sep=>8, Oct=>9, Nov=>10, Dec=>11);
- my $cmd = "$curl --user " . USER . ":" . PASSWORD . " -sI $file | grep ^Last-Modified";
- chomp(my $date_str = `$cmd`);
- if ($date_str =~ /Last-Modified:\s+\w+, (\d+) (\w+) (\d+) (\d+):(\d+):(\d+) GMT/) {
- # Sample output: Wed, 07 Dec 2022 10:37:08 GMT
- my $mday = int($1);
- my $mon = $month2int{$2};
- my $year = int($3) - 1900;
- my $hour = int($4);
- my $min = int($5);
- my $sec = int($6);
- $retval = Time::Local::timegm($sec, $min, $hour, $mday, $mon, $year);
- print "$file $retval\n" if DEBUG;
+ my $cmd = "$curl --user " . USER . ":" . PASSWORD . " -sI $file";
+ if (open(my $fh, "-|", $cmd)) {
+ while (<$fh>) {
+ if (/Last-Modified:\s+\w+, (\d+) (\w+) (\d+) (\d+):(\d+):(\d+) GMT/) {
+ # Sample output: Wed, 07 Dec 2022 10:37:08 GMT
+ my $mday = int($1);
+ my $mon = $month2int{$2};
+ my $year = int($3) - 1900;
+ my $hour = int($4);
+ my $min = int($5);
+ my $sec = int($6);
+ $retval = Time::Local::timegm($sec, $min, $hour, $mday, $mon, $year);
+ print "$file $retval\n" if DEBUG;
+ last;
+ }
+ }
+ close($fh);
}
}
return $retval;
download_file:
if ($opt_force_download or $update_available) {
print "Downloading $file..." if $opt_verbose;
+ my $rv = 0;
if (defined($ftp)) {
# Download errors will be checked later when reading checksum files
$ftp->get($file);
my $cmd = "$curl --user " . USER . ":" . PASSWORD . " -sSR ";
$cmd .= "--remote-name-all $file $file.md5";
print "$cmd\n" if $opt_verbose > 3;
- system($cmd);
+ $rv = system($cmd);
+ }
+ my ($rmt_digest, $lcl_digest) = (0)x2;
+ if ($rv == 0) {
+ $rmt_digest = &read_md5_file($checksum_file);
+ $lcl_digest = &compute_md5_checksum($file);
}
- my $rmt_digest = &read_md5_file($checksum_file);
- my $lcl_digest = &compute_md5_checksum($file);
print "\nRMT $file Digest $rmt_digest" if (DEBUG);
print "\nLCL $file Digest $lcl_digest\n" if (DEBUG);
- if ($lcl_digest ne $rmt_digest) {
+ if ($rv != 0 or ($lcl_digest ne $rmt_digest)) {
unlink &rm_protocol($file), &rm_protocol($checksum_file);
if (++$attempts >= MAX_DOWNLOAD_ATTEMPTS) {
- print STDERR "too many failures, aborting download!\n";
- return EXIT_FAILURE;
+ print STDERR "too many failures, aborting download! Please try again later or use the --source aws option\n";
+ unlink $file, "$file.md5";
+ return -1;
} else {
- print "corrupt download, trying again.\n";
+ print "corrupt $file or $file.md5 download, trying again.\n";
+ sleep(exponential_delay($attempts));
goto download_file;
}
}
return undef;
}
+sub exponential_delay {
+ my $attempt = shift;
+ my $delay = 2 ** $attempt;
+ return $delay;
+}
+
__END__
=head1 NAME
-/* $Id: makeblastdb.cpp 665224 2023-03-30 19:46:21Z camacho $
+/* $Id: makeblastdb.cpp 675077 2023-11-14 13:36:01Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
GetEnvironment().Get("NCBI_MAKEBLASTDB_SKIP_UNVERIFIED_BIOSEQS");
m_SkipUnver = (env_skip.empty() == false);
+ const string dont_scan_bioseq =
+ GetEnvironment().Get("NCBI_MAKEBLASTDB_DONT_SCAN_BIOSEQ_FOR_CFASTAREADER_USER_OBJECTS");
+ const bool scan_bioseq_4_cfastareader_usrobj = static_cast<bool>(dont_scan_bioseq.empty());
+
const CArgs & args = GetArgs();
// Get arguments to the CBuildDatabase constructor.
long_seqids,
dbver,
limit_defline,
- oid_masks));
+ oid_masks,
+ scan_bioseq_4_cfastareader_usrobj));
#if _BLAST_DEBUG
if (args["verbose"]) {
-/* $Id: makeprofiledb.cpp 672589 2023-09-11 18:09:51Z ivanov $
+/* $Id: makeprofiledb.cpp 684432 2024-06-24 12:29:18Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
-/* $Id: blast_vdb_cmd.cpp 673575 2023-10-04 13:17:52Z ivanov $
+/* $Id: blast_vdb_cmd.cpp 676156 2023-12-11 14:55:17Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
string m_allDbs;
string m_origDbs;
bool m_isRef;
+ bool m_includeFilteredReads;
CBlastUsageReport m_UsageReport;
CStopWatch m_StopWatch;
};
-CBlastVdbCmdApp::CBlastVdbCmdApp(): m_allDbs(kEmptyStr), m_origDbs(kEmptyStr), m_isRef(false) {
+CBlastVdbCmdApp::CBlastVdbCmdApp(): m_allDbs(kEmptyStr), m_origDbs(kEmptyStr), m_isRef(false), m_includeFilteredReads(false) {
CRef<CVersion> version(new CVersion());
version->SetVersionInfo(new CBlastVersion());
SetFullVersion(version);
else {
m_isRef = false;
}
+
+ if (args["include_filtered_reads"]) {
+ m_includeFilteredReads = true;
+ }
}
void
CStopWatch sw;
sw.Start();
- util.Reset(new CVDBBlastUtil(csra_list, true, true));
+ util.Reset(new CVDBBlastUtil(csra_list, true, true, m_includeFilteredReads));
sw.Stop();
LOG_POST(Info << "PERF: blast_vdb library csra initialization: " << x_FormatRuntime(sw));
}
else {
CStopWatch sw;
sw.Start();
- util.Reset(new CVDBBlastUtil(m_allDbs, true, false));
+ util.Reset(new CVDBBlastUtil(m_allDbs, true, false, m_includeFilteredReads));
sw.Stop();
LOG_POST(Info << "PERF: blast_vdb library initialization: " << x_FormatRuntime(sw));
}
arg_desc->SetConstraint("line_length",
new CArgAllowValuesGreaterThanOrEqual(1));
+ arg_desc->AddFlag("include_filtered_reads", "Include Filtered reads", true);
+ arg_desc->SetDependency("include_filtered_reads", CArgDescriptions::eExcludes, "info");
+
const char* exclusions[] = { "entry", "entry_batch"};
for (size_t i = 0; i < sizeof(exclusions)/sizeof(*exclusions); i++) {
arg_desc->SetDependency(exclusions[i], CArgDescriptions::eExcludes, "info");
"Dump reference seqs", true);
arg_desc->SetDependency("ref", CArgDescriptions::eExcludes, "info");
arg_desc->SetDependency("ref", CArgDescriptions::eExcludes, "entry_batch");
+ arg_desc->SetDependency("ref", CArgDescriptions::eExcludes, "include_filtered_reads");
arg_desc->AddFlag("paths", "Get top level paths", true);
arg_desc->AddFlag("paths_all", "Get all vdb and alias paths", true);
- const char* exclude_paths[] = { "scan_uncompressed", "scan_compressed", "info", "entry", "entry_batch"};
+ const char* exclude_paths[] = { "scan_uncompressed", "scan_compressed", "info", "entry", "entry_batch", "include_filtered_reads"};
for (size_t i = 0; i < sizeof(exclude_paths)/sizeof(*exclude_paths); i++) {
arg_desc->SetDependency("paths", CArgDescriptions::eExcludes, exclude_paths[i]);
arg_desc->SetDependency("paths_all", CArgDescriptions::eExcludes, exclude_paths[i]);
-/* $Id: blastn_vdb.cpp 639448 2021-10-20 14:21:45Z fongah2 $
+/* $Id: blastn_vdb.cpp 676154 2023-12-11 14:54:09Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
}
input.SetBatchSize(mixer.GetBatchSize());
}
+ bool bIncludeFilteredReads = args[kArgIncludeFilteredReads].AsBoolean();
// Process the input
for (; !input.End(); formatter.ResetScopeHistory()) {
// Run local Blast
CRef<CSearchResultSet> results;
- CLocalVDBBlast local_vdb_blast(query_batch, optsHandle, m_localVDBStruct);
+ CLocalVDBBlast local_vdb_blast(query_batch, optsHandle, m_localVDBStruct, bIncludeFilteredReads);
results = local_vdb_blast.Run();
if (!batch_size)
input.SetBatchSize(mixer.GetBatchSize(local_vdb_blast.GetNumExtensions()));
-/* $Id: tblastn_vdb.cpp 641931 2021-12-09 16:48:25Z fongah2 $
+/* $Id: tblastn_vdb.cpp 676154 2023-12-11 14:54:09Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
vector< CBlastFormatUtil::SDbInfo > vecDbInfo(1);
x_FillVDBInfo(vecDbInfo[0]);
+ bool bIncludeFilteredReads = args[kArgIncludeFilteredReads].AsBoolean();
// Get the formatting options and initialize the formatter
CRef<CFormattingArgs> fmt_args(m_CmdLineArgs->GetFormattingArgs());
CBlastFormat formatter(opt, vecDbInfo,
// Run local Blast
CRef<CSearchResultSet> results;
- CLocalVDBBlast local_vdb_blast(query_batch, optsHandle, m_localVDBStruct);
+ CLocalVDBBlast local_vdb_blast(query_batch, optsHandle, m_localVDBStruct, bIncludeFilteredReads);
results = local_vdb_blast.Run();
SaveSearchStrategy(args, m_CmdLineArgs, queries, optsHandle, pssm);
CRef<CSearchResultSet> results;
- CLocalVDBBlast local_vdb_blast(pssm, optsHandle, m_localVDBStruct);
+ CLocalVDBBlast local_vdb_blast(pssm, optsHandle, m_localVDBStruct, bIncludeFilteredReads);
results = local_vdb_blast.Run();
if (fmt_args->ArchiveFormatRequested(args)){
-# $Id: Makefile.xcode.tmpl 613154 2020-08-03 15:33:16Z ucko $
+# $Id: Makefile.xcode.tmpl 676065 2023-12-07 19:04:33Z ivanov $
# Makefile template for Xcode
#######################################################################
include ./Makefile.mk
DEVSDK = /Developer/SDKs
-SDKDIR = /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform
+CDPMP = /Contents/Developer/Platforms/MacOSX.platform
+XCODES = $(wildcard /Applications/Utilities/Xcode* /Applications/Xcode*)
+SDKDIR = $(lastword $(XCODES))$(CDPMP)
# SDK = $(firstword $(wildcard $(DEVSDK)/*.sdk) $(wildcard $(SDKDIR)/*.sdk))
SDK = $(SDKDIR)$(DEVSDK)/MacOSX.sdk
ifneq "" "$(wildcard ${SDK})"
#############################################################################
-# $Id: CMake.NCBIComponentsMSVC.cmake 673293 2023-09-27 13:33:37Z ivanov $
+# $Id: CMake.NCBIComponentsMSVC.cmake 683737 2024-06-04 12:00:41Z ivanov $
#############################################################################
##
set(NCBI_ThirdParty_BZ2 ${NCBI_ThirdPartyBasePath}/bzip2/${NCBI_ThirdPartyCompiler}/1.0.6 CACHE PATH "BZ2 root")
set(NCBI_ThirdParty_LZO ${NCBI_ThirdPartyBasePath}/lzo/${NCBI_ThirdPartyCompiler}/2.10 CACHE PATH "LZO root")
set(NCBI_ThirdParty_ZSTD ${NCBI_ThirdPartyBasePath}/zstd/${NCBI_ThirdPartyCompiler}/1.5.2 CACHE PATH "ZSTD root")
-set(NCBI_ThirdParty_BerkeleyDB ${NCBI_ThirdPartyBasePath}/berkeleydb/${NCBI_ThirdPartyCompiler}/4.6.21.NC CACHE PATH "BerkeleyDB root")
+set(NCBI_ThirdParty_BerkeleyDB ${NCBI_ThirdPartyBasePath}/berkeleydb/${NCBI_ThirdPartyCompiler}/5.3.28-ncbi1 CACHE PATH "BerkeleyDB root")
set(NCBI_ThirdParty_LMDB ${NCBI_ThirdPartyBasePath}/lmdb/${NCBI_ThirdPartyCompiler}/0.9.24 CACHE PATH "LMDB root")
set(NCBI_ThirdParty_JPEG ${NCBI_ThirdPartyBasePath}/jpeg/${NCBI_ThirdPartyCompiler}/9c CACHE PATH "JPEG root")
set(NCBI_ThirdParty_PNG ${NCBI_ThirdPartyBasePath}/png/${NCBI_ThirdPartyCompiler}/1.6.34 CACHE PATH "PNG root")
set(NCBI_ThirdParty_GLEW ${NCBI_ThirdPartyBasePath}/glew/${NCBI_ThirdPartyCompiler}/1.5.8 CACHE PATH "GLEW root")
set(NCBI_ThirdParty_FreeType ${NCBI_ThirdPartyBasePath}/freetype/${NCBI_ThirdPartyCompiler}/2.4.10 CACHE PATH "FreeType root")
if(NOT noUNICODE IN_LIST NCBI_PTBCFG_PROJECT_FEATURES AND NOT -UNICODE IN_LIST NCBI_PTBCFG_PROJECT_FEATURES)
- set(NCBI_ThirdParty_wxWidgets ${NCBI_ThirdPartyBasePath}/wxwidgets/${NCBI_ThirdPartyCompiler}/3.1.3-ncbi1u CACHE PATH "wxWidgets root")
+ set(NCBI_ThirdParty_wxWidgets ${NCBI_ThirdPartyBasePath}/wxwidgets/${NCBI_ThirdPartyCompiler}/3.2.1-ncbi1u CACHE PATH "wxWidgets root")
else()
- set(NCBI_ThirdParty_wxWidgets ${NCBI_ThirdPartyBasePath}/wxwidgets/${NCBI_ThirdPartyCompiler}/3.1.3-ncbi1 CACHE PATH "wxWidgets root")
+ set(NCBI_ThirdParty_wxWidgets ${NCBI_ThirdPartyBasePath}/wxwidgets/${NCBI_ThirdPartyCompiler}/3.2.1-ncbi1 CACHE PATH "wxWidgets root")
endif()
set(NCBI_ThirdParty_NGHTTP2 ${NCBI_ThirdPartyBasePath}/nghttp2/${NCBI_ThirdPartyCompiler}/1.40.0 CACHE PATH "NGHTTP2 root")
set(NCBI_ThirdParty_GL2PS ${NCBI_ThirdPartyBasePath}/gl2ps/${NCBI_ThirdPartyCompiler}/1.4.0 CACHE PATH "GL2PS root")
set(NCBI_ThirdParty_Sybase ${NCBI_ThirdPartyBasePath}/sybase/${NCBI_ThirdPartyCompiler}/15.5 CACHE PATH "Sybase root")
set(NCBI_ThirdParty_SybaseLocalPath "" CACHE PATH "SybaseLocalPath")
-set(NCBI_ThirdParty_VDB ${NCBI_ThirdParty_VDBROOT}/vdb-versions/3.0.7 CACHE PATH "VDB root")
+set(NCBI_ThirdParty_VDB ${NCBI_ThirdParty_VDBROOT}/vdb-versions/3.1.1 CACHE PATH "VDB root")
set(NCBI_ThirdParty_VDB_ARCH_INC x86_64)
if("${NCBI_ThirdPartyCompiler}" STREQUAL "vs2019.64")
set(NCBI_ThirdParty_VDB_ARCH x86_64/v142)
#############################################################################
-# $Id: CMake.NCBIComponentsPackage.cmake 670436 2023-07-25 12:17:17Z ivanov $
+# $Id: CMake.NCBIComponentsPackage.cmake 678115 2024-01-29 16:10:11Z ivanov $
#############################################################################
##
#set(NCBI_TRACE_ALLCOMPONENTS ON)
#set(NCBI_TRACE_COMPONENT_BZ2 ON)
-if(NCBI_PTBCFG_USECONAN AND COMMAND conan_define_targets)
+if(COMMAND conan_define_targets)
set(__silent ${CONAN_CMAKE_SILENT_OUTPUT})
set(CONAN_CMAKE_SILENT_OUTPUT TRUE)
conan_define_targets()
set(CONAN_CMAKE_SILENT_OUTPUT ${__silent})
endif()
list(APPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR})
+list(APPEND CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR})
+if(EXISTS "${CMAKE_BINARY_DIR}/${NCBI_DIRNAME_CONANGEN}")
+ list(APPEND CMAKE_MODULE_PATH "${CMAKE_BINARY_DIR}/${NCBI_DIRNAME_CONANGEN}")
+ list(APPEND CMAKE_PREFIX_PATH "${CMAKE_BINARY_DIR}/${NCBI_DIRNAME_CONANGEN}")
+endif()
include(CheckIncludeFile)
include(CheckSymbolExists)
endif()
endif()
else()
- NCBIcomponent_find_package(${DC_NAME} ${DC_FIND})
+ NCBIcomponent_find_package(${DC_NAME} ${DC_FIND} NO_CMAKE_SYSTEM_PATH)
if(NOT NCBI_COMPONENT_${DC_NAME}_FOUND)
- NCBIcomponent_find_package(${DC_NAME} ${DC_FIND} NO_CMAKE_SYSTEM_PATH)
+ NCBIcomponent_find_package(${DC_NAME} ${DC_FIND})
endif()
endif()
if(NCBI_COMPONENT_${DC_NAME}_FOUND)
set(NCBI_COMPONENT_${DC_NAME}_INCLUDE ${_include} PARENT_SCOPE)
set(NCBI_COMPONENT_${DC_NAME}_LIBS ${_all_libs} PARENT_SCOPE)
set(NCBI_COMPONENT_${DC_NAME}_DEFINES ${NCBI_COMPONENT_${DC_NAME}_DEFINES} PARENT_SCOPE)
+
+ set_property(GLOBAL APPEND PROPERTY NCBI_PTBPROP_ADJUST_PACKAGE_IMPORTS ${_all_libs})
endif()
endif()
endif()
endif()
endfunction()
+#############################################################################
+function(NCBI_map_imported_config)
+ get_property(_all GLOBAL PROPERTY NCBI_PTBPROP_ADJUST_PACKAGE_IMPORTS)
+ list(REMOVE_DUPLICATES _all)
+
+ set(_todo ${_all})
+ set(_done)
+ while(NOT "${_todo}" STREQUAL "")
+ set(_next)
+ foreach(_lib IN LISTS _todo)
+ if(NOT ${_lib} IN_LIST _done)
+ NCBI_map_one_import( ${_lib} INTERFACE_COMPILE_DEFINITIONS _out1)
+ NCBI_map_one_import( ${_lib} INTERFACE_INCLUDE_DIRECTORIES _out2)
+ set(_out3)
+ NCBI_map_one_import( ${_lib} INTERFACE_LINK_LIBRARIES _out3)
+ list(APPEND _next ${_out3})
+ endif()
+ endforeach()
+ list(APPEND _done ${_todo})
+ set(_todo ${_next})
+ list(REMOVE_DUPLICATES _todo)
+ endwhile()
+endfunction()
+
+#############################################################################
+function(NCBI_map_one_import _lib _property _todo)
+ get_property(_props TARGET ${_lib} PROPERTY ${_property})
+ if("${_props}" STREQUAL "")
+ return()
+ endif()
+ set(_other)
+ set(_CONFIG "CONFIG:")
+ set(_LIBS FALSE)
+ if(${_property} STREQUAL INTERFACE_LINK_LIBRARIES)
+ set(_LIBS TRUE)
+ endif()
+ string(FIND "${_props}" ${_CONFIG} _pos)
+ if(${_pos} LESS 0)
+ foreach(_i IN LISTS _props)
+ if(TARGET ${_i})
+ list(APPEND _other ${_i})
+ endif()
+ set(${_todo} ${_other} PARENT_SCOPE)
+ endforeach()
+
+ foreach(_cfg IN LISTS NCBI_CONFIGURATION_TYPES)
+ NCBI_util_Cfg_ToStd(${_cfg} _map_cfg)
+ string(TOUPPER ${_cfg} _cfg)
+ string(TOUPPER ${_map_cfg} _map_cfg)
+ if(NOT "${_cfg}" STREQUAL "${_map_cfg}")
+ get_property(_loc TARGET ${_lib} PROPERTY IMPORTED_LOCATION_${_map_cfg})
+ if(NOT "${_loc}" STREQUAL "")
+ set_property(TARGET ${_lib} PROPERTY IMPORTED_LOCATION_${_cfg} ${_loc})
+ endif()
+ endif()
+ endforeach()
+ return()
+ endif()
+ set(_append)
+ foreach(_cfg IN LISTS NCBI_CONFIGURATION_TYPES)
+ NCBI_util_Cfg_ToStd(${_cfg} _map_cfg)
+ string(FIND "${_props}" ${_CONFIG}${_cfg} _pos)
+ if(${_pos} GREATER 0)
+ continue()
+ endif()
+ list(LENGTH _props _count)
+ set(_index 0)
+ while(TRUE)
+ set(_new)
+ while(${_index} LESS ${_count})
+ list(GET _props ${_index} _i)
+ if(NOT "${_new}" STREQUAL "")
+ string(FIND "${_i}" ${_CONFIG} _pos)
+ if(${_pos} GREATER 0)
+ break()
+ else()
+ list(APPEND _new ${_i})
+ endif()
+ endif()
+ string(FIND "${_i}" ${_CONFIG}${_map_cfg} _pos)
+ if(${_pos} GREATER 0)
+ string(REPLACE ${_CONFIG}${_map_cfg} ${_CONFIG}${_cfg} _new "${_i}")
+ endif()
+ math(EXPR _index "${_index} + 1")
+ endwhile()
+ if("${_new}" STREQUAL "")
+ break()
+ endif()
+ if(NOT _LIBS)
+ list(APPEND _append ${_new})
+ continue()
+ endif()
+ set(_checked)
+ foreach(_i IN LISTS _new)
+ if(TARGET ${_i})
+ list(APPEND _other ${_i})
+ else()
+ string(FIND "${_i}" "${_CONFIG}" _pos)
+ if(${_pos} GREATER 0)
+ string(REPLACE ${_CONFIG}${_cfg} "" _j "${_i}")
+ string(REPLACE "$<$<>:" "" _j "${_j}")
+ else()
+ set(_j ${_i})
+ endif()
+ string(REPLACE ">" "" _j "${_j}")
+ if(TARGET "${_j}")
+ list(APPEND _other ${_j})
+ elseif(NOT "${_j}" STREQUAL "")
+ endif()
+ endif()
+ list(APPEND _checked ${_i})
+ endforeach()
+ list(APPEND _append ${_checked})
+ endwhile()
+ endforeach()
+ if(NOT "${_append}" STREQUAL "")
+ list(APPEND _props ${_append})
+ set_property(TARGET ${_lib} PROPERTY ${_property} ${_props})
+ endif()
+ if (_LIBS AND NOT "${_other}" STREQUAL "")
+ list(REMOVE_DUPLICATES _other)
+ set(${_todo} ${_other} PARENT_SCOPE)
+ endif()
+endfunction()
+
#############################################################################
function(NCBI_verify_targets _file)
if(NOT EXISTS ${_file})
endforeach()
endfunction()
+##############################################################################
+macro(NCBI_util_disable_find_use_path)
+ if(DEFINED CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH)
+ set(NCBI_FIND_USE_SYSTEM_ENVIRONMENT_PATH ${CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH})
+ endif()
+ set(CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH FALSE)
+ if(DEFINED CMAKE_FIND_USE_CMAKE_SYSTEM_PATH)
+ set(NCBI_FIND_USE_CMAKE_SYSTEM_PATH ${CMAKE_FIND_USE_CMAKE_SYSTEM_PATH})
+ endif()
+ set(CMAKE_FIND_USE_CMAKE_SYSTEM_PATH FALSE)
+endmacro()
+
+macro(NCBI_util_enable_find_use_path)
+ if(DEFINED NCBI_FIND_USE_SYSTEM_ENVIRONMENT_PATH)
+ set(CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH ${NCBI_FIND_USE_SYSTEM_ENVIRONMENT_PATH})
+ unset(NCBI_FIND_USE_SYSTEM_ENVIRONMENT_PATH)
+ else()
+ unset(CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH)
+ endif()
+ if(DEFINED NCBI_FIND_USE_CMAKE_SYSTEM_PATH)
+ set(CMAKE_FIND_USE_CMAKE_SYSTEM_PATH ${NCBI_FIND_USE_CMAKE_SYSTEM_PATH})
+ unset(NCBI_FIND_USE_CMAKE_SYSTEM_PATH)
+ else()
+ unset(CMAKE_FIND_USE_CMAKE_SYSTEM_PATH)
+ endif()
+endmacro()
+
#############################################################################
#############################################################################
-if(NCBI_PTBCFG_USECONAN AND NOT COMMAND conan_define_targets)
+if(NOT COMMAND conan_define_targets)
NCBI_define_Pkgcomponent(NAME OpenSSL PACKAGE openssl FIND OpenSSL)
endif()
#############################################################################
# Boost
include(${NCBI_TREE_CMAKECFG}/CMakeChecks.boost.cmake)
+if(NCBI_COMPONENT_Boost_FOUND)
+ set_property(GLOBAL APPEND PROPERTY NCBI_PTBPROP_ADJUST_PACKAGE_IMPORTS ${NCBI_COMPONENT_Boost_LIBS})
+endif()
#############################################################################
# JPEG
#############################################################################
# XSLT
NCBI_define_Pkgcomponent(NAME XSLT PACKAGE libxslt REQUIRES libxml2;zlib;libiconv FIND LibXslt)
-if(NOT DEFINED NCBI_XSLTPROCTOOL AND DEFINED CONAN_BIN_DIRS_LIBXSLT)
- set(NCBI_XSLTPROCTOOL "${CONAN_BIN_DIRS_LIBXSLT}/xsltproc${CMAKE_EXECUTABLE_SUFFIX}")
- set(NCBI_REQUIRE_XSLTPROCTOOL_FOUND YES)
+if(NOT DEFINED NCBI_XSLTPROCTOOL)
+ if(DEFINED CONAN_BIN_DIRS_LIBXSLT)
+ set(NCBI_XSLTPROCTOOL "${CONAN_BIN_DIRS_LIBXSLT}/xsltproc${CMAKE_EXECUTABLE_SUFFIX}")
+ endif()
+ if(EXISTS "${NCBI_XSLTPROCTOOL}")
+ set(NCBI_REQUIRE_XSLTPROCTOOL_FOUND YES)
+ endif()
+endif()
+if(NCBI_TRACE_COMPONENT_XSLT OR NCBI_TRACE_ALLCOMPONENTS)
+ message("NCBI_XSLTPROCTOOL = ${NCBI_XSLTPROCTOOL}")
endif()
#############################################################################
# EXSLT
NCBI_define_Pkgcomponent(NAME EXSLT PACKAGE libxslt REQUIRES libxml2;zlib;libiconv FIND LibXslt)
+if(NCBI_COMPONENT_EXSLT_FOUND AND TARGET LibXslt::LibExslt)
+ set(NCBI_COMPONENT_EXSLT_LIBS LibXslt::LibExslt ${NCBI_COMPONENT_EXSLT_LIBS})
+ set_property(GLOBAL APPEND PROPERTY NCBI_PTBPROP_ADJUST_PACKAGE_IMPORTS LibXslt::LibExslt)
+endif()
#############################################################################
# UV
##############################################################################
# GRPC/PROTOBUF
+NCBI_util_disable_find_use_path()
NCBI_define_Pkgcomponent(NAME PROTOBUF PACKAGE protobuf REQUIRES zlib FIND Protobuf)
if(NOT DEFINED NCBI_PROTOC_APP)
if(DEFINED CONAN_BIN_DIRS_PROTOBUF)
if(NCBI_TRACE_COMPONENT_GRPC OR NCBI_TRACE_ALLCOMPONENTS)
message("NCBI_GRPC_PLUGIN = ${NCBI_GRPC_PLUGIN}")
endif()
+NCBI_util_enable_find_use_path()
#############################################################################
# CASSANDRA
#############################################################################
# JAEGER
NCBI_define_Pkgcomponent(NAME JAEGER PACKAGE jaegertracing FIND jaegertracing)
+
+#############################################################################
+# this must be the last operation in this file
+if(NCBI_PTBCFG_USECONAN OR NCBI_PTBCFG_HASCONAN)
+ NCBI_map_imported_config()
+endif()
#############################################################################
-# $Id: CMake.NCBIComponentsUNIXex.cmake 673307 2023-09-27 18:37:26Z ivanov $
+# $Id: CMake.NCBIComponentsUNIXex.cmake 682842 2024-05-10 11:27:04Z ivanov $
#############################################################################
##
set(NCBI_ThirdParty_FASTCGI_SHLIB ${NCBI_ThirdParty_FASTCGI})
set(NCBI_ThirdParty_FASTCGIPP ${NCBI_TOOLS_ROOT}/fastcgi++-3.1~a1+20210601 CACHE PATH "FASTCGIPP root")
set(NCBI_ThirdParty_SQLITE3 ${NCBI_TOOLS_ROOT}/sqlite-3.26.0-ncbi1 CACHE PATH "SQLITE3 root")
-set(NCBI_ThirdParty_BerkeleyDB ${NCBI_TOOLS_ROOT}/BerkeleyDB-4.6.21.1 CACHE PATH "BerkeleyDB root")
+set(NCBI_ThirdParty_BerkeleyDB ${NCBI_TOOLS_ROOT}/BerkeleyDB-5.3.28-ncbi1 CACHE PATH "BerkeleyDB root")
set(NCBI_ThirdParty_SybaseNetPath "/opt/sybase/clients/16.0-64bit" CACHE PATH "SybaseNetPath")
set(NCBI_ThirdParty_SybaseLocalPath "" CACHE PATH "SybaseLocalPath")
set(NCBI_ThirdParty_PYTHON_VERSION "3.9")
set(NCBI_ThirdParty_GCRYPT ${NCBI_TOOLS_ROOT}/libgcrypt-1.4.3 CACHE PATH "GCRYPT root")
set(NCBI_ThirdParty_MSGSL ${NCBI_TOOLS_ROOT}/msgsl-0.0.20171114-1c95f94 CACHE PATH "MSGSL root")
set(NCBI_ThirdParty_SGE "/netmnt/gridengine/current/drmaa" CACHE PATH "SGE root")
-set(NCBI_ThirdParty_MONGOCXX ${NCBI_TOOLS_ROOT}/mongodb-3.6.3 CACHE PATH "MONGOCXX root")
-set(NCBI_ThirdParty_MONGOC ${NCBI_TOOLS_ROOT}/mongo-c-driver-1.17.5 CACHE PATH "MONGOC root")
+set(NCBI_ThirdParty_MONGOCXX ${NCBI_TOOLS_ROOT}/mongodb-3.7.0 CACHE PATH "MONGOCXX root")
+set(NCBI_ThirdParty_MONGOC ${NCBI_TOOLS_ROOT}/mongo-c-driver-1.23.2 CACHE PATH "MONGOC root")
set(NCBI_ThirdParty_LEVELDB ${NCBI_TOOLS_ROOT}/leveldb-1.21 CACHE PATH "LEVELDB root")
set(NCBI_ThirdParty_ROCKSDB ${NCBI_TOOLS_ROOT}/rocksdb-8.3.2 CACHE PATH "ROCKSDB root")
set(NCBI_ThirdParty_wxWidgets ${NCBI_TOOLS_ROOT}/wxWidgets-3.2.1-ncbi1 CACHE PATH "wxWidgets root")
set(NCBI_ThirdParty_GLPK "/usr/local/glpk/4.45" CACHE PATH "GLPK root")
-set(NCBI_ThirdParty_UV ${NCBI_TOOLS_ROOT}/libuv-1.35.0 CACHE PATH "UV root")
+if(APPLE)
+ set(NCBI_ThirdParty_UV ${NCBI_TOOLS_ROOT}/libuv-1.44.2 CACHE PATH "UV root")
+else()
+ set(NCBI_ThirdParty_UV ${NCBI_TOOLS_ROOT}/libuv-1.35.0 CACHE PATH "UV root")
+endif()
set(NCBI_ThirdParty_NGHTTP2 ${NCBI_TOOLS_ROOT}/nghttp2-1.40.0 CACHE PATH "NGHTTP2 root")
set(NCBI_ThirdParty_GL2PS ${NCBI_TOOLS_ROOT}/gl2ps-1.4.0 CACHE PATH "GL2PS root")
set(NCBI_ThirdParty_GMOCK ${NCBI_TOOLS_ROOT}/googletest-1.8.1 CACHE PATH "GMOCK root")
set(NCBI_ThirdParty_GTEST ${NCBI_TOOLS_ROOT}/googletest-1.8.1 CACHE PATH "GTEST root")
set(NCBI_ThirdParty_CASSANDRA ${NCBI_TOOLS_ROOT}/datastax-cpp-driver-2.15.1 CACHE PATH "CASSANDRA root")
set(NCBI_ThirdParty_H2O ${NCBI_TOOLS_ROOT}/h2o-2.2.6 CACHE PATH "H2O root")
-set(NCBI_ThirdParty_GMP ${NCBI_TOOLS_ROOT}/gmp-6.0.0a CACHE PATH "GMP root")
+if(APPLE)
+ set(NCBI_ThirdParty_GMP ${NCBI_TOOLS_ROOT}/gmp-6.3.0 CACHE PATH "GMP root")
+else()
+ set(NCBI_ThirdParty_GMP ${NCBI_TOOLS_ROOT}/gmp-6.0.0a CACHE PATH "GMP root")
+endif()
set(NCBI_ThirdParty_NETTLE ${NCBI_TOOLS_ROOT}/nettle-3.1.1 CACHE PATH "NETTLE root")
set(NCBI_ThirdParty_GNUTLS ${NCBI_TOOLS_ROOT}/gnutls-3.4.0 CACHE PATH "GNUTLS root")
set(NCBI_ThirdParty_NCBICRYPT ${NCBI_TOOLS_ROOT}/ncbicrypt-20230516 CACHE PATH "NCBICRYPT root")
#############################################################################
# NCBI_C
if(NOT NCBI_COMPONENT_NCBI_C_DISABLED)
- set(NCBI_C_ROOT "${NCBI_TOOLS_ROOT}/ncbi")
+ set(NCBI_C_ROOT "${NCBI_TOOLS_ROOT}/c++.by-date/production/20231209/C_TOOLKIT")
get_directory_property(_foo_defs COMPILE_DEFINITIONS)
if("${_foo_defs}" MATCHES NCBI_INT4_GI)
NCBI_define_Xcomponent(NAME BACKWARD)
if(NCBI_COMPONENT_BACKWARD_FOUND)
set(HAVE_LIBBACKWARD_CPP YES)
- if(NOT NCBI_PTBCFG_USECONAN AND NOT NCBI_PTBCFG_PACKAGING AND NOT NCBI_PTBCFG_PACKAGED)
+ if(NOT NCBI_PTBCFG_USECONAN AND NOT NCBI_PTBCFG_HASCONAN AND NOT NCBI_PTBCFG_PACKAGING AND NOT NCBI_PTBCFG_PACKAGED)
NCBI_find_system_library(LIBDW_LIBS dw)
if (LIBDW_LIBS)
set(HAVE_LIBDW 1)
NCBIcomponent_report(GRPC)
if(NCBI_COMPONENT_GRPC_FOUND)
set(NCBI_COMPONENT_GRPC_LIBS ${NCBI_COMPONENT_GRPC_LIBS} ${NCBI_COMPONENT_Boring_LIBS})
- if(NOT NCBI_PTBCFG_USECONAN AND NOT NCBI_PTBCFG_PACKAGING AND NOT NCBI_PTBCFG_PACKAGED AND
+ if(NOT NCBI_PTBCFG_USECONAN AND NOT NCBI_PTBCFG_HASCONAN AND NOT NCBI_PTBCFG_PACKAGING AND NOT NCBI_PTBCFG_PACKAGED AND
"${NCBI_COMPONENT_GRPC_VERSION}" STRLESS "1.17.0")
NCBI_define_Xcomponent(NAME CGRPC MODULE grpc LIB grpc)
set(NCBI_COMPONENT_GRPC_LIBS ${NCBI_COMPONENT_GRPC_LIBS} ${NCBI_COMPONENT_CGRPC_LIBS})
#############################################################################
-# $Id: CMake.NCBIComponentsXCODE.cmake 673293 2023-09-27 13:33:37Z ivanov $
+# $Id: CMake.NCBIComponentsXCODE.cmake 679530 2024-02-27 18:29:22Z ivanov $
#############################################################################
##
# prebuilt libraries
set(NCBI_ThirdParty_BACKWARD ${NCBI_TOOLS_ROOT}/backward-cpp-1.6-ncbi1 CACHE PATH "BACKWARD root")
-set(NCBI_ThirdParty_LMDB ${NCBI_TOOLS_ROOT}/lmdb-0.9.18 CACHE PATH "LMDB root")
+set(NCBI_ThirdParty_LMDB ${NCBI_TOOLS_ROOT}/lmdb-0.9.24 CACHE PATH "LMDB root")
set(NCBI_ThirdParty_LZO ${NCBI_TOOLS_ROOT}/lzo-2.05 CACHE PATH "LZO root")
set(NCBI_ThirdParty_ZSTD ${NCBI_TOOLS_ROOT}/zstd-1.5.2 CACHE PATH "ZSTD root")
set(NCBI_ThirdParty_SQLITE3 ${NCBI_TOOLS_ROOT}/sqlite-3.26.0-ncbi1 CACHE PATH "SQLITE2 root")
set(NCBI_ThirdParty_Boost_VERSION "1.76.0")
set(NCBI_ThirdParty_Boost ${NCBI_TOOLS_ROOT}/boost-${NCBI_ThirdParty_Boost_VERSION}-ncbi1 CACHE PATH "Boost root")
-set(NCBI_ThirdParty_BerkeleyDB ${NCBI_TOOLS_ROOT}/BerkeleyDB CACHE PATH "BerkeleyDB root")
+set(NCBI_ThirdParty_BerkeleyDB ${NCBI_TOOLS_ROOT}/BerkeleyDB-5.3.28-ncbi1 CACHE PATH "BerkeleyDB root")
set(NCBI_ThirdParty_FASTCGI ${NCBI_TOOLS_ROOT}/fcgi-2.4.0 CACHE PATH "FASTCGI root")
set(NCBI_ThirdParty_FASTCGI_SHLIB ${NCBI_ThirdParty_FASTCGI})
set(NCBI_ThirdParty_PYTHON_VERSION 3.9 CACHE STRING "PYTHON version")
set(NCBI_ThirdParty_Boring ${NCBI_ThirdParty_GRPC})
set(NCBI_ThirdParty_PROTOBUF ${NCBI_TOOLS_ROOT}/grpc-1.36.4-ncbi1 CACHE PATH "PROTOBUF root")
set(NCBI_ThirdParty_wxWidgets ${NCBI_TOOLS_ROOT}/wxWidgets-3.2.1-ncbi1 CACHE PATH "wxWidgets root")
-set(NCBI_ThirdParty_UV ${NCBI_TOOLS_ROOT}/libuv-1.35.0 CACHE PATH "UV root")
+set(NCBI_ThirdParty_UV ${NCBI_TOOLS_ROOT}/libuv-1.44.2 CACHE PATH "UV root")
set(NCBI_ThirdParty_NGHTTP2 ${NCBI_TOOLS_ROOT}/nghttp2-1.40.0 CACHE PATH "NGHTTP2 root")
set(NCBI_ThirdParty_GL2PS ${NCBI_TOOLS_ROOT}/gl2ps-1.4.0 CACHE PATH "GL2PS root")
-set(NCBI_ThirdParty_GMP ${NCBI_TOOLS_ROOT}/gmp-6.0.0a CACHE PATH "GMP root")
+set(NCBI_ThirdParty_GMP ${NCBI_TOOLS_ROOT}/gmp-6.3.0 CACHE PATH "GMP root")
set(NCBI_ThirdParty_NETTLE ${NCBI_TOOLS_ROOT}/nettle-3.1.1 CACHE PATH "NETTLE root")
set(NCBI_ThirdParty_GNUTLS ${NCBI_TOOLS_ROOT}/gnutls-3.4.0 CACHE PATH "GNUTLS root")
set(NCBI_ThirdParty_NCBICRYPT ${NCBI_TOOLS_ROOT}/ncbicrypt-20230516 CACHE PATH "NCBICRYPT root")
#############################################################################
# NCBI_C
if(NOT NCBI_COMPONENT_NCBI_C_DISABLED)
- set(NCBI_C_ROOT "${NCBI_TOOLS_ROOT}/ncbi")
+ set(NCBI_C_ROOT "${NCBI_TOOLS_ROOT}/c++.by-date/production/20231209/C_TOOLKIT")
get_directory_property(_foo_defs COMPILE_DEFINITIONS)
if("${_foo_defs}" MATCHES NCBI_INT4_GI)
NCBI_define_Xcomponent(NAME BACKWARD)
if(NCBI_COMPONENT_BACKWARD_FOUND)
set(HAVE_LIBBACKWARD_CPP YES)
- if(NOT NCBI_PTBCFG_USECONAN AND NOT NCBI_PTBCFG_PACKAGING AND NOT NCBI_PTBCFG_PACKAGED)
+ if(NOT NCBI_PTBCFG_USECONAN AND NOT NCBI_PTBCFG_HASCONAN AND NOT NCBI_PTBCFG_PACKAGING AND NOT NCBI_PTBCFG_PACKAGED)
NCBI_find_system_library(LIBDW_LIBS NAMES dw)
if (LIBDW_LIBS)
set(HAVE_LIBDW 1)
#############################################################################
-# $Id: CMake.NCBIpkg.setup.cmake 659871 2022-12-06 14:41:46Z gouriano $
+# $Id: CMake.NCBIpkg.setup.cmake 678145 2024-01-29 16:14:02Z ivanov $
#############################################################################
#############################################################################
##
if(NCBI_PTBCFG_PACKAGING)
- set(CONAN_CMAKE_CXX_STANDARD 17)
foreach(_sub IN LISTS CMAKE_BINARY_DIR CMAKE_MODULE_PATH)
if (EXISTS "${_sub}/conanbuildinfo.cmake")
include(${_sub}/conanbuildinfo.cmake)
endif()
endforeach()
elseif(NCBI_PTBCFG_USECONAN)
- if(EXISTS "${CMAKE_BINARY_DIR}/conanfile.txt")
- file(REMOVE "${CMAKE_BINARY_DIR}/conanfile.txt")
+ message("#############################################################################")
+ message("Installing Conan packages")
+ find_program(NCBI_CONAN_APP conan${CMAKE_EXECUTABLE_SUFFIX})
+ if(NCBI_CONAN_APP)
+ execute_process(
+ COMMAND ${NCBI_CONAN_APP} version
+ WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
+ RESULT_VARIABLE NCBI_CONAN_VERSION
+ OUTPUT_QUIET ERROR_QUIET
+ )
+ if(NCBI_CONAN_VERSION EQUAL 0)
+ set(NCBI_CONAN_VERSION 2)
+ else()
+ set(NCBI_CONAN_VERSION 1)
+ endif()
+ message("Conan v${NCBI_CONAN_VERSION}.x: ${NCBI_CONAN_APP}")
+ else()
+ message(FATAL_ERROR "Conan not found")
+ endif()
+
+ execute_process(
+ COMMAND ${NCBI_CONAN_APP} remote list
+ WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
+ OUTPUT_VARIABLE _remotes
+ )
+ string(REPLACE "\n" ";" _remotes "${_remotes}")
+ set(_ncbi_found NO)
+ foreach(_rem IN LISTS _remotes)
+ string(FIND "${_rem}" "ncbi.nlm.nih.gov" _pos)
+ if(${_pos} GREATER 0)
+ set(_ncbi_found YES)
+ break()
+ endif()
+ endforeach()
+
+ set(_conanfile "${CMAKE_BINARY_DIR}/conanfile.txt")
+ if(EXISTS ${_conanfile})
+ file(REMOVE ${_conanfile})
endif()
if (MSVC)
file(COPY "${CMAKE_CURRENT_LIST_DIR}/conanfile.MSVC.txt" DESTINATION "${CMAKE_BINARY_DIR}")
- file(RENAME "${CMAKE_BINARY_DIR}/conanfile.MSVC.txt" "${CMAKE_BINARY_DIR}/conanfile.txt")
+ file(RENAME "${CMAKE_BINARY_DIR}/conanfile.MSVC.txt" ${_conanfile})
elseif (APPLE)
file(COPY "${CMAKE_CURRENT_LIST_DIR}/conanfile.XCODE.txt" DESTINATION "${CMAKE_BINARY_DIR}")
- file(RENAME "${CMAKE_BINARY_DIR}/conanfile.XCODE.txt" "${CMAKE_BINARY_DIR}/conanfile.txt")
+ file(RENAME "${CMAKE_BINARY_DIR}/conanfile.XCODE.txt" ${_conanfile})
else()
file(COPY "${CMAKE_CURRENT_LIST_DIR}/conanfile.UNIX.txt" DESTINATION "${CMAKE_BINARY_DIR}")
- file(RENAME "${CMAKE_BINARY_DIR}/conanfile.UNIX.txt" "${CMAKE_BINARY_DIR}/conanfile.txt")
- endif()
- message("#############################################################################")
- message("Installing Conan packages")
- find_program(NCBI_CONAN_APP conan${CMAKE_EXECUTABLE_SUFFIX})
- if(NCBI_CONAN_APP)
- message("Conan: ${NCBI_CONAN_APP}")
- else()
- message(FATAL_ERROR "Conan not found")
+ file(RENAME "${CMAKE_BINARY_DIR}/conanfile.UNIX.txt" ${_conanfile})
endif()
+ file(STRINGS ${_conanfile} _list)
+ set(_requires)
+ set(_ncbi_internal NO)
+ foreach( _item IN LISTS _list)
+ if("${_item}" STREQUAL "#internal{")
+ set(_ncbi_internal YES)
+ continue()
+ endif()
+ if(_ncbi_internal AND "${_item}" STREQUAL "#}")
+ set(_ncbi_internal NO)
+ continue()
+ endif()
+ if(NOT _ncbi_internal OR _ncbi_found)
+ list(APPEND _requires "${_item}\n")
+ endif()
+ endforeach()
+ file(WRITE ${_conanfile} ${_requires})
+
find_program(NCBI_CMAKE_APP cmake${CMAKE_EXECUTABLE_SUFFIX})
message("CMake: ${NCBI_CMAKE_APP}")
- set(_cmd install . --build missing -pr:b default)
+ if(NCBI_CONAN_VERSION EQUAL 1)
+ set(_cmd install ${CMAKE_BINARY_DIR} --build missing -pr:b default -if ${CMAKE_BINARY_DIR}/${NCBI_DIRNAME_CONANGEN})
+ else()
+ set(_cmd install ${CMAKE_BINARY_DIR} --build missing -pr:b default -of ${CMAKE_BINARY_DIR}/${NCBI_DIRNAME_CONANGEN})
+ endif()
if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Intel")
set(_cmd ${_cmd} -s compiler.libcxx=libstdc++11)
endif()
+ if(StaticComponents IN_LIST NCBI_PTBCFG_PROJECT_FEATURES OR (MSVC AND NOT BUILD_SHARED_LIBS))
+ set(_cmd ${_cmd} -o *:shared=False)
+ else()
+ set(_cmd ${_cmd} -o *:shared=True)
+ if(NOT NCBI_CONAN_VERSION EQUAL 1 AND EXISTS ${_conanfile})
+ file(STRINGS ${_conanfile} _options)
+ foreach(_opt IN LISTS _options)
+ string(FIND "${_opt}" "#" _p1)
+ string(FIND "${_opt}" ":shared" _p2)
+ if(${_p2} GREATER 0 AND ${_p1} LESS 0)
+ string(REPLACE " " "" _p2 "${_p2}")
+ set(_cmd ${_cmd} -o ${_opt})
+ endif()
+ endforeach()
+ endif()
+ endif()
+
+ string(REPLACE "," ";" NCBI_PTBCFG_CONAN_ARGS "${NCBI_PTBCFG_CONAN_ARGS}")
+ string(REPLACE " " ";" NCBI_PTBCFG_CONAN_ARGS "${NCBI_PTBCFG_CONAN_ARGS}")
+ set(_cmd ${_cmd} ${NCBI_PTBCFG_CONAN_ARGS})
set(_types)
- if (NOT "${CMAKE_BUILD_TYPE}" STREQUAL "")
+ if (NOT "${NCBI_PTBCFG_CONFIGURATION_TYPES}" STREQUAL "")
+ set(_types ${NCBI_PTBCFG_CONFIGURATION_TYPES})
+ elseif (NOT "${CMAKE_BUILD_TYPE}" STREQUAL "")
set(_types ${CMAKE_BUILD_TYPE})
elseif (NOT "${CMAKE_CONFIGURATION_TYPES}" STREQUAL "")
set(_types ${CMAKE_CONFIGURATION_TYPES})
endif()
- list(LENGTH _types _count)
- if("${_count}" EQUAL 1)
- NCBI_util_Cfg_ToStd(${_types} _type)
- set(_cmd ${_cmd} -s build_type=${_type})
- endif()
+ set(_configs)
+ foreach(_t IN LISTS _types)
+ NCBI_util_Cfg_ToStd(${_t} _cfg)
+ if(NCBI_CONAN_VERSION EQUAL 1 OR NOT MSVC)
+ set(_cmd${_cfg} ${_cmd} -s build_type=${_cfg})
+#invoke Conan install so that it will generate files for the debug configuration, pointing at the release one
+#set(_cmd${_cfg} ${_cmd} -s &:build_type=${_cfg} -s build_type=Release)
+ else()
+ set(_cmd${_cfg} ${_cmd} -s build_type=${_cfg} -s compiler.runtime_type=${_cfg})
+ endif()
+ list(APPEND _configs ${_cfg})
+ endforeach()
+ list(REMOVE_DUPLICATES _configs)
- string(REPLACE "," ";" NCBI_PTBCFG_CONAN_ARGS "${NCBI_PTBCFG_CONAN_ARGS}")
- string(REPLACE " " ";" NCBI_PTBCFG_CONAN_ARGS "${NCBI_PTBCFG_CONAN_ARGS}")
- set(_cmd ${_cmd} ${NCBI_PTBCFG_CONAN_ARGS})
+ foreach(_cfg IN LISTS _configs)
+ execute_process(
+ COMMAND ${NCBI_CONAN_APP} ${_cmd${_cfg}}
+ WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
+ RESULT_VARIABLE CONAN_INSTALL_RESULT
+ )
+ if(NOT CONAN_INSTALL_RESULT EQUAL "0")
+ message(FATAL_ERROR "Conan setup failed: error = ${CONAN_INSTALL_RESULT}")
+ endif()
+ endforeach()
- execute_process(
- COMMAND ${NCBI_CONAN_APP} ${_cmd}
- WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
- RESULT_VARIABLE CONAN_INSTALL_RESULT
- )
- if(NOT CONAN_INSTALL_RESULT EQUAL "0")
- message(FATAL_ERROR "Conan setup failed: error = ${CONAN_INSTALL_RESULT}")
- endif()
message("Done with installing Conan packages")
message("#############################################################################")
#############################################################################
-# $Id: CMake.NCBIptb.cmake 665767 2023-04-13 13:32:21Z gouriano $
+# $Id: CMake.NCBIptb.cmake 675541 2023-11-27 19:51:05Z ivanov $
#############################################################################
#
# PUBLIC DOMAIN NOTICE
## NCBI_add_subdirectory( list of subdirectories)
## NCBI_add_library( list of libraries)
## NCBI_add_app( list of apps)
+## NCBI_module( name) - declare root dir of git submodule
##---------------------------------------------------------------------------
## the following calls in CMakeLists.txt affect all projects in current dir and all subdirs
## NCBI_headers( list of headers)
unset(NCBI_PROJECT_expected)
endfunction()
+#############################################################################
+macro(NCBI_module _name)
+ if(NOT NCBI_PTBMODE_COLLECT_DEPS)
+ set(NCBI_CURRENT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
+ endif()
+ set(NCBI_TREE_ROOT ${CMAKE_CURRENT_LIST_DIR})
+ set(NCBI_SRC_ROOT ${NCBI_TREE_ROOT}/${NCBI_DIRNAME_SRC})
+ set(NCBI_INC_ROOT ${NCBI_TREE_ROOT}/${NCBI_DIRNAME_INCLUDE})
+ if (NOT EXISTS "${NCBI_SRC_ROOT}")
+ message("WARNING: Module ${_name} does not have ${NCBI_DIRNAME_SRC} directory (${NCBI_CURRENT_SOURCE_DIR})")
+ set(NCBI_SRC_ROOT ${NCBI_TREE_ROOT})
+ endif()
+ if (NOT EXISTS "${NCBI_INC_ROOT}")
+ message("WARNING: Module ${_name} does not have ${NCBI_DIRNAME_INCLUDE} directory (${NCBI_CURRENT_SOURCE_DIR})")
+ set(NCBI_INC_ROOT ${NCBI_TREE_ROOT})
+ endif()
+
+ NCBI_declare_module_src_root(${_name} ${NCBI_SRC_ROOT})
+ if(NOT NCBI_PTBMODE_COLLECT_DEPS)
+ include_directories(${NCBI_INC_ROOT})
+ endif()
+endmacro()
+
+function(NCBI_declare_module_src_root _name _dir)
+ get_property(_module_src_roots GLOBAL PROPERTY NCBI_PTBPROP_MODULE_SRC_ROOTS)
+ list(APPEND _module_src_roots ${_dir})
+ list(REMOVE_DUPLICATES _module_src_roots)
+ set_property(GLOBAL PROPERTY NCBI_PTBPROP_MODULE_SRC_ROOTS ${_module_src_roots})
+endfunction()
+
#############################################################################
function(NCBI_add_target)
if(NCBI_PTBMODE_PARTS)
get_property(_allprojects GLOBAL PROPERTY NCBI_PTBPROP_ALL_PROJECTS)
get_property(_allowedprojects GLOBAL PROPERTY NCBI_PTBPROP_ALLOWED_PROJECTS)
+ set_property(GLOBAL PROPERTY NCBI_PTBPROP_INTERFACE_DEPS "")
if(OFF)
message("NCBI_PTBPROP_ALL_PROJECTS: ${_allprojects}")
set(NCBITMP_PROJECT_HEADERS ${NCBITMP_PROJECT_HEADERS} ${_incfiles} PARENT_SCOPE)
source_group("${_prefix}DataSpec Files" FILES ${_specfiles})
set(NCBITMP_PROJECT_DATASPEC ${NCBITMP_PROJECT_DATASPEC} ${_specfiles} PARENT_SCOPE)
+
+ if(NOT NCBI_PTBMODE_COLLECT_DEPS)
+ set(NCBITMP_PROJECT_SPECFILES ${_specfiles})
+ NCBI_internal_add_dataspec()
+ endif()
endfunction()
##############################################################################
function(NCBI_internal_add_dataspec)
- if (NOT DEFINED NCBITMP_PROJECT_DATASPEC)
+ if (NOT DEFINED NCBITMP_PROJECT_SPECFILES)
return()
endif()
- foreach(_dataspec IN LISTS NCBITMP_PROJECT_DATASPEC)
+ foreach(_dataspec IN LISTS NCBITMP_PROJECT_SPECFILES)
get_filename_component(_ext ${_dataspec} EXT)
set(_input GENERATE DATASPEC ${_dataspec} REQUIRES ${NCBITMP_REQUIRE} ${NCBITMP_COMPONENTS} RETURN _output)
string(TOLOWER ${_ext} _ext)
set(_hostproject ${NCBI_PROJECT})
set(_hostdir ${NCBI_CURRENT_SOURCE_DIR})
set(_fnresult ${_result})
+ if(NCBI_VERBOSE_ALLPROJECTS OR NCBI_VERBOSE_PROJECT_${NCBI_PROJECT})
+ message("${NCBI_PROJECT} parts: ${NCBI_${_hostproject}_PARTS}")
+ endif()
# verify that all parts can be found
- foreach(_part IN LISTS NCBI_${_hostproject}_PARTS)
- set(_filepath ${NCBI_SRC_ROOT}/${_part})
- get_filename_component(_path ${_filepath} DIRECTORY)
- if(NOT EXISTS ${_path}/CMakeLists.txt)
- if(NCBI_VERBOSE_ALLPROJECTS OR NCBI_VERBOSE_PROJECT_${NCBI_PROJECT})
- message("WARNING: Project part ${_part} not found: ${NCBI_PROJECT} (${NCBI_CURRENT_SOURCE_DIR}): ")
+ get_property(_module_src_roots GLOBAL PROPERTY NCBI_PTBPROP_MODULE_SRC_ROOTS)
+ set(_all_found FALSE)
+ foreach(_root IN LISTS NCBI_SRC_ROOT _module_src_roots)
+ set(_all_found TRUE)
+ foreach(_part IN LISTS NCBI_${_hostproject}_PARTS)
+ set(_filepath ${_root}/${_part})
+ get_filename_component(_path ${_filepath} DIRECTORY)
+ if(NOT EXISTS ${_path}/CMakeLists.txt)
+ if(NCBI_VERBOSE_ALLPROJECTS OR NCBI_VERBOSE_PROJECT_${NCBI_PROJECT})
+ message("${NCBI_PROJECT}: WARNING: Project part ${_part} not found in ${_path} (${NCBI_CURRENT_SOURCE_DIR})")
+ endif()
+ set(_all_found FALSE)
+ break()
+ else()
+ if(NCBI_VERBOSE_ALLPROJECTS OR NCBI_VERBOSE_PROJECT_${NCBI_PROJECT})
+ message("${NCBI_PROJECT}: Project part ${_part} found in ${_path} (${NCBI_CURRENT_SOURCE_DIR})")
+ endif()
endif()
- set(${_fnresult} FALSE PARENT_SCOPE)
- return()
+ endforeach()
+ if(_all_found)
+ set(NCBI_TREE_ROOT ${_root}/..)
+ set(NCBI_SRC_ROOT ${_root})
+ set(NCBI_INC_ROOT ${_root}/../include)
+ break()
endif()
endforeach()
+ if(NOT _all_found)
+ set(${_fnresult} FALSE PARENT_SCOPE)
+ return()
+ endif()
set(NCBI_PTBMODE_PARTS ON)
- if(NCBI_VERBOSE_ALLPROJECTS OR NCBI_VERBOSE_PROJECT_${NCBI_PROJECT})
- message("${NCBI_PROJECT} parts: ${NCBI_${_hostproject}_PARTS}")
- endif()
foreach(_part IN LISTS NCBI_${_hostproject}_PARTS)
set(_filepath ${NCBI_SRC_ROOT}/${_part})
get_filename_component(_path ${_filepath} DIRECTORY)
file(RELATIVE_PATH _relpath ${NCBI_SRC_ROOT} ${_path})
string(REPLACE "/" ";" _dirlist ${_relpath})
+ if(${NCBI_SRC_ROOT} IN_LIST _module_src_roots)
+ foreach( _dir IN ITEMS ${NCBI_TREE_ROOT} ${NCBI_SRC_ROOT})
+ set(NCBI_CURRENT_SOURCE_DIR ${_dir})
+ if(EXISTS ${NCBI_CURRENT_SOURCE_DIR}/CMakeLists.txt)
+ include(${NCBI_CURRENT_SOURCE_DIR}/CMakeLists.txt)
+ endif()
+ endforeach()
+ endif()
set(NCBI_CURRENT_SOURCE_DIR ${NCBI_SRC_ROOT})
foreach(_dir IN LISTS _dirlist)
set(NCBI_CURRENT_SOURCE_DIR ${NCBI_CURRENT_SOURCE_DIR}/${_dir})
if (NOT TARGET ${_lib})
return()
endif()
+ get_property(_collected GLOBAL PROPERTY NCBI_PTBPROP_INTERFACE_DEPS)
+ if( ${_lib} IN_LIST _collected)
+ return()
+ endif()
+ set_property(GLOBAL PROPERTY NCBI_PTBPROP_INTERFACE_DEPS ${_collected} ${_lib})
get_target_property(_deps ${_lib} INTERFACE_LINK_LIBRARIES)
if ( NOT "${_deps}" STREQUAL "")
set(_value "")
else()
set(_src_root ${NCBI_SRC_ROOT})
endif()
+ get_property(_module_src_roots GLOBAL PROPERTY NCBI_PTBPROP_MODULE_SRC_ROOTS)
foreach(_dir IN LISTS NCBI_PTBCFG_PROJECT_LIST)
if("${_dir}" STREQUAL "")
continue()
continue()
endif()
NCBI_util_parse_sign( ${_dir} _value _negate)
- if(_negate)
- NCBI_util_match_path(${NCBI_CURRENT_SOURCE_DIR} ${_src_root}/${_value} _match)
- if(_match)
- set(${_result} FALSE PARENT_SCOPE)
- return()
- endif()
- else()
- set(_hasp TRUE)
- NCBI_util_match_path(${NCBI_CURRENT_SOURCE_DIR} ${_src_root}/${_value} _match)
- if(_match)
- set(_is_good TRUE)
+ foreach(_root IN LISTS _src_root _module_src_roots)
+ if(_negate)
+ NCBI_util_match_path(${NCBI_CURRENT_SOURCE_DIR} ${_root}/${_value} _match)
+ if(_match)
+ set(${_result} FALSE PARENT_SCOPE)
+ return()
+ endif()
+ else()
+ set(_hasp TRUE)
+ NCBI_util_match_path(${NCBI_CURRENT_SOURCE_DIR} ${_root}/${_value} _match)
+ if(_match)
+ set(_is_good TRUE)
+ break()
+ endif()
endif()
- endif()
+ endforeach()
endforeach()
if (NOT _is_good AND _hasp)
set(${_result} FALSE PARENT_SCOPE)
return()
endif()
NCBI_internal_add_resources()
- NCBI_internal_add_dataspec()
if(NCBI_PTBCFG_CREATE_GENERATESRC)
if ( NOT "${NCBITMP_REQUIRE_NOTFOUND}" STREQUAL "")
if ("${ARGC}" GREATER "0")
#############################################################################
-# $Id: CMake.NCBIptb.datatool.cmake 672354 2023-09-06 13:38:32Z ivanov $
+# $Id: CMake.NCBIptb.datatool.cmake 675541 2023-11-27 19:51:05Z ivanov $
#############################################################################
#############################################################################
##
endif()
endif()
set(_opm)
+ set(_dir)
if(DEFINED NCBI_EXTERNAL_TREE_ROOT)
if(NCBI_PTBCFG_PACKAGED)
- set(_opm -opm "${NCBI_EXTERNAL_TREE_ROOT}/res/specs")
+ set(_dir "${NCBI_EXTERNAL_TREE_ROOT}/res/specs")
else()
- set(_opm -opm "${NCBI_EXTERNAL_TREE_ROOT}/${NCBI_DIRNAME_SRC}")
+ set(_dir "${NCBI_EXTERNAL_TREE_ROOT}/${NCBI_DIRNAME_SRC}")
endif()
else()
- set(_opm -opm "${NCBITK_SRC_ROOT}")
+ set(_dir "${NCBITK_SRC_ROOT}")
endif()
+ if(NOT "${_dir}" STREQUAL "${NCBI_SRC_ROOT}")
+ set(_dir "${NCBI_SRC_ROOT},${_dir}")
+ endif()
+ set(_opm -opm "${_dir}")
NCBI_util_get_value(PCH _fpch)
if (NOT "${_fpch}" STREQUAL "")
#############################################################################
-# $Id: CMake.NCBIptb.definitions.cmake 668418 2023-06-05 14:00:32Z gouriano $
+# $Id: CMake.NCBIptb.definitions.cmake 678115 2024-01-29 16:10:11Z ivanov $
#############################################################################
#############################################################################
##
set(NCBI_DIRNAME_COMMON_SCRIPTS scripts/common)
set(NCBI_DIRNAME_BUILDCFG ${NCBI_DIRNAME_SRC}/build-system)
set(NCBI_DIRNAME_CMAKECFG ${NCBI_DIRNAME_SRC}/build-system/cmake)
+set(NCBI_DIRNAME_CONANGEN generators)
set(NCBI_TREE_ROOT ${CMAKE_SOURCE_DIR})
if(EXISTS "${CMAKE_SOURCE_DIR}/corelib/CMakeLists.corelib.lib.txt")
set(builddir ${CMAKE_BINARY_DIR})
set(includedir0 ${NCBI_INC_ROOT})
set(includedir ${NCBI_INC_ROOT})
-set(incdir ${CMAKE_BINARY_DIR}/${NCBI_DIRNAME_CFGINC})
set(incinternal ${NCBI_INC_ROOT}/${NCBI_DIRNAME_INTERNAL})
set(NCBI_DIRNAME_BUILD build)
#############################################################################
-# $Id: CMake.NCBIptb.grpc.cmake 662255 2023-01-26 16:33:13Z gouriano $
+# $Id: CMake.NCBIptb.grpc.cmake 676274 2023-12-13 15:30:34Z ivanov $
#############################################################################
#############################################################################
##
endif()
endif()
endif()
- NCBI_util_gitignore(${_pb_srcfiles} ${_gr_srcfiles})
- NCBI_util_gitignore(${_pb_incfiles} ${_gr_incfiles})
+ if (NOT "${_pb_srcfiles}" STREQUAL "")
+ NCBI_util_gitignore(${_pb_srcfiles} ${_gr_srcfiles})
+ endif()
+ if (NOT "${_pb_incfiles}" STREQUAL "")
+ NCBI_util_gitignore(${_pb_incfiles} ${_gr_incfiles})
+ endif()
endfunction()
##############################################################################
endif()
endif()
if(NOT Boost_FOUND)
- find_package(Boost OPTIONAL_COMPONENTS ${Boost_REQUESTED_COMPONENTS})
+ find_package(Boost OPTIONAL_COMPONENTS ${Boost_REQUESTED_COMPONENTS} NO_CMAKE_SYSTEM_PATH)
+ if(NOT Boost_FOUND)
+ find_package(Boost OPTIONAL_COMPONENTS ${Boost_REQUESTED_COMPONENTS})
+ endif()
endif()
+foreach(_inc IN ITEMS _RELEASE _DEBUG)
+ if (EXISTS ${Boost_INCLUDE_DIRS${_inc}})
+ set(_boost_inc ${Boost_INCLUDE_DIRS${_inc}})
+ break()
+ endif()
+endforeach()
+
if(OFF AND Boost_FOUND)
add_definitions(-DBOOST_LOG_DYN_LINK)
set(NCBI_COMPONENT_Boost.Test.Included_FOUND YES)
set(NCBI_COMPONENT_Boost.Test.Included_INCLUDE ${Boost_INCLUDE_DIRS})
set(NCBI_COMPONENT_Boost.Test.Included_DEFINES BOOST_TEST_NO_LIB)
+elseif (EXISTS ${_boost_inc})
+ message(STATUS "Found Boost.Test.Included: ${_boost_inc}")
+ set(NCBI_COMPONENT_Boost.Test.Included_FOUND YES)
+ set(NCBI_COMPONENT_Boost.Test.Included_INCLUDE ${_boost_inc})
+ set(NCBI_COMPONENT_Boost.Test.Included_DEFINES BOOST_TEST_NO_LIB)
elseif(EXISTS ${NCBI_ThirdParty_Boost}/include)
message(STATUS "Found Boost.Test.Included: ${NCBI_ThirdParty_Boost}")
set(NCBI_COMPONENT_Boost.Test.Included_FOUND YES)
#!/bin/sh
#############################################################################
-# $Id: cmake-cfg-unix.sh 670429 2023-07-25 12:16:21Z ivanov $
+# $Id: cmake-cfg-unix.sh 681359 2024-04-08 18:49:39Z ivanov $
# Configure NCBI C++ toolkit using CMake build system.
# Author: Andrei Gourianov, gouriano@ncbi
#############################################################################
host_os=`uname`
if test -z "${CMAKE_CMD}" -a $host_os = "Darwin"; then
- for i in /usr/local/bin/cmake /Applications/CMake.app/Contents/bin/cmake \
- /sw/bin/cmake
- do
- if test -x $i; then
- CMAKE_CMD=$i
- break
- fi
- done
+ CMAKE_CMD=`which cmake 2>/dev/null`
+ if test $? -ne 0; then
+ for i in /usr/local/bin/cmake /opt/homebrew/bin/cmake \
+ /Applications/CMake.app/Contents/bin/cmake /sw/bin/cmake
+ do
+ if test -x $i && $i --version >/dev/null 2>&1; then
+ CMAKE_CMD=$i
+ break
+ fi
+ done
+ fi
fi
if [ -z "${CMAKE_CMD}" ]; then
CMAKE_CMD=`which cmake 2>/dev/null`
exit 1
fi
fi
+echo CMake: ${CMAKE_CMD}
+${CMAKE_CMD} --version
#############################################################################
# defaults
@echo off\r
setlocal ENABLEDELAYEDEXPANSION\r
REM #########################################################################\r
-REM $Id: cmake-cfg-vs.bat 665658 2023-04-11 13:43:13Z gouriano $\r
+REM $Id: cmake-cfg-vs.bat 681357 2024-04-08 18:49:00Z ivanov $\r
REM Configure NCBI C++ toolkit for Visual Studio using CMake build system.\r
REM Author: Andrei Gourianov, gouriano@ncbi\r
REM #########################################################################\r
REM #########################################################################\r
set VSWHERE="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere"\r
if "%CMAKE_CMD%"=="" (\r
- for /f "tokens=* USEBACKQ" %%i IN (`%VSWHERE% -latest -property installationPath`) do (\r
- set CMAKE_CMD=%%i\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe\r
+ where cmake >NUL 2>&1\r
+ if errorlevel 1 (\r
+ for /f "tokens=* USEBACKQ" %%i IN (`%VSWHERE% -latest -property installationPath`) do (\r
+ set CMAKE_CMD=%%i\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe\r
+ )\r
+ ) else (\r
+ set CMAKE_CMD=cmake\r
)\r
)\r
-if not exist "%CMAKE_CMD%" (\r
+echo CMake: "%CMAKE_CMD%"\r
+"%CMAKE_CMD%" --version\r
+if errorlevel 1 (\r
echo ERROR: CMake is not found 1>&2\r
exit /b 1\r
)\r
#!/bin/sh
#############################################################################
-# $Id: cmake-cfg-xcode.sh 665969 2023-04-18 15:34:17Z ucko $
+# $Id: cmake-cfg-xcode.sh 681359 2024-04-08 18:49:39Z ivanov $
# Configure NCBI C++ toolkit for XCode using CMake build system.
# Author: Andrei Gourianov, gouriano@ncbi
#############################################################################
#############################################################################
-CMAKE_PREDEFINED_LOC="/usr/local/bin/cmake /Applications/CMake.app/Contents/bin/cmake /sw/bin/cmake"
+CMAKE_PREDEFINED_LOC="/usr/local/bin/cmake /opt/homebrew/bin/cmake"
+CMAKE_PREDEFINED_LOC="$CMAKE_PREDEFINED_LOC /Applications/CMake.app/Contents/bin/cmake"
+CMAKE_PREDEFINED_LOC="$CMAKE_PREDEFINED_LOC /sw/bin/cmake"
if [ -z "${CMAKE_CMD}" ]; then
- for i in $CMAKE_PREDEFINED_LOC
- do
- if test -x $i; then
- CMAKE_CMD=$i
- break
- fi
- done
+ CMAKE_CMD=`which cmake 2>/dev/null`
+ if test $? -ne 0; then
+ for i in $CMAKE_PREDEFINED_LOC
+ do
+ if test -x $i && $i --version >/dev/null 2>&1; then
+ CMAKE_CMD=$i
+ break
+ fi
+ done
+ fi
fi
-if test ! -x $CMAKE_CMD; then
+if test ! -x "${CMAKE_CMD}"; then
CMAKE_CMD=`which cmake 2>/dev/null`
if test $? -ne 0; then
echo ERROR: CMake is not found 1>&2
exit 1
fi
fi
-echo FOUND CMake: $CMAKE_CMD
-$CMAKE_CMD --version
#############################################################################
if [ -z "$BUILD_ROOT" ]; then
if [ -z "$BUILD_TYPE" ]; then
BUILD_ROOT=CMake-${CC_NAME}${CC_VERSION}
- if [ "$BUILD_SHARED_LIBS" == "ON" ]; then
+ if [ "$BUILD_SHARED_LIBS" = "ON" ]; then
BUILD_ROOT="$BUILD_ROOT"-DLL
fi
else
BUILD_ROOT=CMake-${CC_NAME}${CC_VERSION}-${BUILD_TYPE}
- if [ "$BUILD_SHARED_LIBS" == "ON" ]; then
+ if [ "$BUILD_SHARED_LIBS" = "ON" ]; then
BUILD_ROOT="$BUILD_ROOT"DLL
fi
fi
-# $Id: conanfile.MSVC.txt 672961 2023-09-19 13:00:23Z ivanov $
+# $Id: conanfile.MSVC.txt 680579 2024-03-21 18:00:09Z ivanov $
# NCBI C++ Toolkit requirements for Conan/MSVC
[requires]
-libdb/5.3.28
boost/1.82.0
bzip2/1.0.8
#cassandra-cpp-driver/2.15.3
#protobuf/3.21.4
sqlite3/3.42.0
libtiff/4.5.0
-libxml2/2.11.4
+libxml2/2.11.6
libxslt/1.1.34
-libuv/1.45.0
+libuv/1.46.0
zlib/1.2.13
zstd/1.5.5
openssl/1.1.1s
-ncbi-vdb/3.0.7
+#internal{
+libdb/5.3.28
+ncbi-vdb/3.1.0
ncbicrypt/20230516
+#}
[options]
-#ncbi-vdb:shared = True
+abseil/*:shared=False
+grpc/*:shared=False
+protobuf/*:shared=False
+boost/*:shared=False
+libxml2/*:shared=False
+pcre/*:shared=False
+ncbicrypt/*:shared=False
#
-grpc:cpp_plugin = True
-grpc:csharp_plugin = False
-grpc:node_plugin = False
-grpc:objective_c_plugin = False
-grpc:php_plugin = False
-grpc:python_plugin = False
-grpc:ruby_plugin = False
+grpc/*:cpp_plugin = True
+grpc/*:csharp_plugin = False
+grpc/*:node_plugin = False
+grpc/*:objective_c_plugin = False
+grpc/*:php_plugin = False
+grpc/*:python_plugin = False
+grpc/*:ruby_plugin = False
#
-#boost:header_only = True
-boost:header_only = False
-#boost:without_atomic = True
-#boost:without_chrono = True
-#boost:without_container = True
-#boost:without_context = True
-boost:without_contract = True
-boost:without_coroutine = True
-#boost:without_date_time = True
-#boost:without_exception = True
-boost:without_fiber = True
-#boost:without_filesystem = True
-boost:without_graph = True
-boost:without_graph_parallel = True
-#boost:without_iostreams = True
-boost:without_json = True
-boost:without_locale = True
-boost:without_log = True
-boost:without_math = True
-boost:without_mpi = True
-boost:without_nowide = True
-boost:without_program_options = True
-boost:without_python = True
-#boost:without_random = True
-#boost:without_regex = True
-#boost:without_serialization = True
-boost:without_stacktrace = True
-#boost:without_system = True
-#boost:without_test = True
-#boost:without_thread = True
-#boost:without_timer = True
-boost:without_type_erasure = True
-boost:without_wave = True
+#boost/*:header_only = True
+boost/*:header_only = False
+#boost/*:without_atomic = True
+#boost/*:without_chrono = True
+#boost/*:without_container = True
+#boost/*:without_context = True
+boost/*:without_contract = True
+boost/*:without_coroutine = True
+#boost/*:without_date_time = True
+#boost/*:without_exception = True
+boost/*:without_fiber = True
+#boost/*:without_filesystem = True
+boost/*:without_graph = True
+boost/*:without_graph_parallel = True
+#boost/*:without_iostreams = True
+boost/*:without_json = True
+boost/*:without_locale = True
+boost/*:without_log = True
+boost/*:without_math = True
+boost/*:without_mpi = True
+boost/*:without_nowide = True
+boost/*:without_program_options = True
+boost/*:without_python = True
+#boost/*:without_random = True
+#boost/*:without_regex = True
+#boost/*:without_serialization = True
+boost/*:without_stacktrace = True
+#boost/*:without_system = True
+#boost/*:without_test = True
+#boost/*:without_thread = True
+#boost/*:without_timer = True
+boost/*:without_type_erasure = True
+boost/*:without_wave = True
[generators]
-#cmake
-cmake_find_package
-#cmake_find_package_multi
+CMakeDeps
-# $Id: conanfile.UNIX.txt 672961 2023-09-19 13:00:23Z ivanov $
+# $Id: conanfile.UNIX.txt 680579 2024-03-21 18:00:09Z ivanov $
# NCBI C++ Toolkit requirements for Conan/UNIX
[requires]
#protobuf/3.21.4
sqlite3/3.42.0
libtiff/4.5.0
-libxml2/2.11.4
+libxml2/2.11.6
libxslt/1.1.34
-libuv/1.45.0
+libuv/1.46.0
zlib/1.2.13
zstd/1.5.5
openssl/1.1.1s
-xz_utils/5.4.2
+#internal{
ncbi-fastcgi/2.4.2
-ncbi-vdb/3.0.7
+ncbi-vdb/3.1.0
ncbicrypt/20230516
+#}
[options]
-libunwind:minidebuginfo=False
+libunwind/*:minidebuginfo=False
+abseil/*:shared=False
+grpc/*:shared=False
+protobuf/*:shared=False
+ncbicrypt/*:shared=False
#
-grpc:cpp_plugin = True
-grpc:csharp_plugin = False
-grpc:node_plugin = False
-grpc:objective_c_plugin = False
-grpc:php_plugin = False
-grpc:python_plugin = False
-grpc:ruby_plugin = False
+grpc/*:cpp_plugin = True
+grpc/*:csharp_plugin = False
+grpc/*:node_plugin = False
+grpc/*:objective_c_plugin = False
+grpc/*:php_plugin = False
+grpc/*:python_plugin = False
+grpc/*:ruby_plugin = False
#
-#boost:header_only = True
-boost:header_only = False
-#boost:without_atomic = True
-#boost:without_chrono = True
-#boost:without_container = True
-#boost:without_context = True
-boost:without_contract = True
-boost:without_coroutine = True
-#boost:without_date_time = True
-#boost:without_exception = True
-boost:without_fiber = True
-#boost:without_filesystem = True
-boost:without_graph = True
-boost:without_graph_parallel = True
-#boost:without_iostreams = True
-boost:without_json = True
-boost:without_locale = True
-boost:without_log = True
-boost:without_math = True
-boost:without_mpi = True
-boost:without_nowide = True
-boost:without_program_options = True
-boost:without_python = True
-#boost:without_random = True
-#boost:without_regex = True
-#boost:without_serialization = True
-boost:without_stacktrace = True
-#boost:without_system = True
-#boost:without_test = True
-#boost:without_thread = True
-#boost:without_timer = True
-boost:without_type_erasure = True
-boost:without_wave = True
+#boost/*:header_only = True
+boost/*:header_only = False
+#boost/*:without_atomic = True
+#boost/*:without_chrono = True
+#boost/*:without_container = True
+#boost/*:without_context = True
+boost/*:without_contract = True
+boost/*:without_coroutine = True
+#boost/*:without_date_time = True
+#boost/*:without_exception = True
+boost/*:without_fiber = True
+#boost/*:without_filesystem = True
+boost/*:without_graph = True
+boost/*:without_graph_parallel = True
+#boost/*:without_iostreams = True
+boost/*:without_json = True
+boost/*:without_locale = True
+boost/*:without_log = True
+boost/*:without_math = True
+boost/*:without_mpi = True
+boost/*:without_nowide = True
+boost/*:without_program_options = True
+boost/*:without_python = True
+#boost/*:without_random = True
+#boost/*:without_regex = True
+#boost/*:without_serialization = True
+boost/*:without_stacktrace = True
+#boost/*:without_system = True
+#boost/*:without_test = True
+#boost/*:without_thread = True
+#boost/*:without_timer = True
+boost/*:without_type_erasure = True
+boost/*:without_wave = True
[generators]
-#cmake
-cmake_find_package
+CMakeDeps
+#cmake_find_package
+
-# $Id: conanfile.XCODE.txt 672961 2023-09-19 13:00:23Z ivanov $
+# $Id: conanfile.XCODE.txt 680579 2024-03-21 18:00:09Z ivanov $
# NCBI C++ Toolkit requirements for Conan/MacOS
[requires]
#protobuf/3.21.4
sqlite3/3.42.0
libtiff/4.5.0
-libxml2/2.11.4
+libxml2/2.11.6
libxslt/1.1.34
-libuv/1.45.0
+libuv/1.46.0
zlib/1.2.13
zstd/1.5.5
openssl/1.1.1s
-ncbi-vdb/3.0.7
+#internal{
+ncbi-vdb/3.1.0
ncbicrypt/20230516
+#}
[options]
+abseil/*:shared=False
+grpc/*:shared=False
+protobuf/*:shared=False
+ncbicrypt/*:shared=False
#
-grpc:cpp_plugin = True
-grpc:csharp_plugin = False
-grpc:node_plugin = False
-grpc:objective_c_plugin = False
-grpc:php_plugin = False
-grpc:python_plugin = False
-grpc:ruby_plugin = False
+grpc/*:cpp_plugin = True
+grpc/*:csharp_plugin = False
+grpc/*:node_plugin = False
+grpc/*:objective_c_plugin = False
+grpc/*:php_plugin = False
+grpc/*:python_plugin = False
+grpc/*:ruby_plugin = False
#
-#boost:header_only = True
-boost:header_only = False
-#boost:without_atomic = True
-#boost:without_chrono = True
-#boost:without_container = True
-#boost:without_context = True
-boost:without_contract = True
-boost:without_coroutine = True
-#boost:without_date_time = True
-#boost:without_exception = True
-boost:without_fiber = True
-#boost:without_filesystem = True
-boost:without_graph = True
-boost:without_graph_parallel = True
-#boost:without_iostreams = True
-boost:without_json = True
-boost:without_locale = True
-boost:without_log = True
-boost:without_math = True
-boost:without_mpi = True
-boost:without_nowide = True
-boost:without_program_options = True
-boost:without_python = True
-#boost:without_random = True
-#boost:without_regex = True
-#boost:without_serialization = True
-boost:without_stacktrace = True
-#boost:without_system = True
-#boost:without_test = True
-#boost:without_thread = True
-#boost:without_timer = True
-boost:without_type_erasure = True
-boost:without_wave = True
+#boost/*:header_only = True
+boost/*:header_only = False
+#boost/*:without_atomic = True
+#boost/*:without_chrono = True
+#boost/*:without_container = True
+#boost/*:without_context = True
+boost/*:without_contract = True
+boost/*:without_coroutine = True
+#boost/*:without_date_time = True
+#boost/*:without_exception = True
+boost/*:without_fiber = True
+#boost/*:without_filesystem = True
+boost/*:without_graph = True
+boost/*:without_graph_parallel = True
+#boost/*:without_iostreams = True
+boost/*:without_json = True
+boost/*:without_locale = True
+boost/*:without_log = True
+boost/*:without_math = True
+boost/*:without_mpi = True
+boost/*:without_nowide = True
+boost/*:without_program_options = True
+boost/*:without_python = True
+#boost/*:without_random = True
+#boost/*:without_regex = True
+#boost/*:without_serialization = True
+boost/*:without_stacktrace = True
+#boost/*:without_system = True
+#boost/*:without_test = True
+#boost/*:without_thread = True
+#boost/*:without_timer = True
+boost/*:without_type_erasure = True
+boost/*:without_wave = True
[generators]
-#cmake
-cmake_find_package
+CMakeDeps
+#cmake_find_package
--- /dev/null
+from conan import ConanFile
+from conan.errors import ConanInvalidConfiguration, ConanException
+from conan.tools.build import check_min_cppstd
+import subprocess
+
+class NCBIToolkitWithConanRecipe(ConanFile):
+ settings = "os", "compiler", "build_type", "arch"
+ generators = "CMakeDeps"
+
+ @property
+ def _min_cppstd(self):
+ return 17
+
+ def configure(self):
+ self.options["abseil/*"].shared = False
+ self.options["grpc/*"].shared = False
+ self.options["protobuf/*"].shared = False
+ self.options["boost/*"].shared = False
+ self.options["libxml2/*"].shared = False
+ self.options["pcre/*"].shared = False
+ self.options["ncbicrypt/*"].shared = False
+#
+ self.options["grpc/*"].cpp_plugin = True
+ self.options["grpc/*"].csharp_plugin = False
+ self.options["grpc/*"].node_plugin = False
+ self.options["grpc/*"].objective_c_plugin = False
+ self.options["grpc/*"].php_plugin = False
+ self.options["grpc/*"].python_plugin = False
+ self.options["grpc/*"].ruby_plugin = False
+#
+#boost/*:header_only = True
+ self.options["boost/*"].header_only = False
+#boost/*:without_atomic = True
+#boost/*:without_chrono = True
+#boost/*:without_container = True
+#boost/*:without_context = True
+ self.options["boost/*"].without_contract = True
+ self.options["boost/*"].without_coroutine = True
+#boost/*:without_date_time = True
+#boost/*:without_exception = True
+ self.options["boost/*"].without_fiber = True
+#boost/*:without_filesystem = True
+ self.options["boost/*"].without_graph = True
+ self.options["boost/*"].without_graph_parallel = True
+#boost/*:without_iostreams = True
+ self.options["boost/*"].without_json = True
+ self.options["boost/*"].without_locale = True
+ self.options["boost/*"].without_log = True
+ self.options["boost/*"].without_math = True
+ self.options["boost/*"].without_mpi = True
+ self.options["boost/*"].without_nowide = True
+ self.options["boost/*"].without_program_options = True
+ self.options["boost/*"].without_python = True
+#boost/*:without_random = True
+#boost/*:without_regex = True
+#boost/*:without_serialization = True
+ self.options["boost/*"].without_stacktrace = True
+#boost/*:without_system = True
+#boost/*:without_test = True
+#boost/*:without_thread = True
+#boost/*:without_timer = True
+ self.options["boost/*"].without_type_erasure = True
+ self.options["boost/*"].without_wave = True
+
+ def requirements(self):
+ res = subprocess.run(["conan", "remote", "list"],
+ stdout = subprocess.PIPE, universal_newlines = True, encoding="utf-8")
+ pos = res.stdout.find("ncbi.nlm.nih.gov")
+ NCBIfound = pos > 0
+ if NCBIfound:
+ print("NCBI artifactory is found")
+ else:
+ print("NCBI artifactory is not found")
+
+ if self.settings.os == "Linux":
+ self.requires("backward-cpp/1.6")
+ self.requires("boost/1.82.0")
+ self.requires("bzip2/1.0.8")
+ if self.settings.os == "Linux":
+ self.requires("cassandra-cpp-driver/2.15.3")
+ self.requires("giflib/5.2.1")
+ self.requires("grpc/1.50.1")
+ if self.settings.os == "Linux" or NCBIfound:
+ self.requires("libdb/5.3.28")
+ self.requires("libjpeg/9e")
+ self.requires("libnghttp2/1.54.0")
+ self.requires("libpng/1.6.39")
+ self.requires("libtiff/4.5.0")
+ if self.settings.os == "Linux":
+ self.requires("libunwind/1.8.0")
+ self.requires("libuv/1.46.0")
+ self.requires("libxml2/2.11.6")
+ self.requires("libxslt/1.1.34")
+ self.requires("lmdb/0.9.29")
+ self.requires("lzo/2.10")
+ self.requires("openssl/1.1.1s")
+ self.requires("pcre/8.45")
+ self.requires("sqlite3/3.42.0")
+ self.requires("zlib/[>=1.2.11 <2]")
+ self.requires("zstd/1.5.5")
+
+ if NCBIfound:
+ self.requires("ncbicrypt/20230516")
+ if self.settings.os == "Linux":
+ self.requires("ncbi-fastcgi/2.4.2")
+ self.requires("ncbi-vdb/3.1.0")
+
+ def validate(self):
+ if self.settings.compiler.cppstd:
+ check_min_cppstd(self, self._min_cppstd)
+ if self.settings.os not in ["Linux", "Macos", "Windows"]:
+ raise ConanInvalidConfiguration("This operating system is not supported")
+
--- /dev/null
+#############################################################################
+# $Id: x86_64-linux-gcc-1320.cmake 676943 2023-12-29 20:11:12Z sadyrovr $
+#############################################################################
+#############################################################################
+##
+## NCBI CMake wrapper
+## GCC 13.2.0 toolchain
+
+set(NCBI_PTBCFG_FLAGS_DEFINED YES)
+include_guard(GLOBAL)
+
+set(CMAKE_C_COMPILER "/opt/ncbi/gcc/13.2.0/bin/gcc")
+set(CMAKE_CXX_COMPILER "/opt/ncbi/gcc/13.2.0/bin/g++")
+
+set(CMAKE_C_FLAGS_INIT "-gdwarf-4 -Wall -Wno-format-y2k")
+set(CMAKE_C_FLAGS_DEBUG "-ggdb3 -O0")
+set(CMAKE_C_FLAGS_RELEASE "-ggdb1 -O3")
+set(CMAKE_C_FLAGS_RELWITHDEBINFO "-ggdb3 -O3")
+
+set(CMAKE_CXX_FLAGS_INIT "-gdwarf-4 -Wall -Wno-format-y2k")
+set(CMAKE_CXX_FLAGS_DEBUG "-ggdb3 -O0")
+set(CMAKE_CXX_FLAGS_RELEASE "-ggdb1 -O3")
+set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-ggdb3 -O3")
+
+set(CMAKE_EXE_LINKER_FLAGS_INIT "-Wl,--enable-new-dtags -Wl,--as-needed")
+set(CMAKE_SHARED_LINKER_FLAGS_INIT "-Wl,--no-undefined -Wl,--as-needed")
+
+#----------------------------------------------------------------------------
+set(NCBI_COMPILER_FLAGS_SSE "-msse4.2")
+
+set(NCBI_COMPILER_FLAGS_COVERAGE "--coverage")
+set(NCBI_LINKER_FLAGS_COVERAGE "--coverage")
+
+set(NCBI_COMPILER_FLAGS_MAXDEBUG "-fsanitize=address -fstack-check")
+set(NCBI_LINKER_FLAGS_MAXDEBUG "-fsanitize=address")
+
+set(NCBI_LINKER_FLAGS_STATICCOMPONENTS "-static-libgcc -static-libstdc++")
#!/bin/sh
-# $Id: config.site.ncbi 672960 2023-09-19 12:44:45Z ivanov $
+# $Id: config.site.ncbi 683737 2024-06-04 12:00:41Z ivanov $
# Note default paths to third-party libraries, whose location and even
# presence varies somewhat from platform to platform.
: ${BACKWARD_CPP_PATH=$NCBI/backward-cpp-1.6-ncbi1}
-case "$ncbi_platform" in
- FreeBSD* ) : ${BERKELEYDB_PATH=$NCBI/BerkeleyDB-4.6.21.1} ;;
- Linux* ) : ${BERKELEYDB_PATH=$NCBI/BerkeleyDB-4.6.21.1} ;;
- *MAC ) : ${BERKELEYDB_PATH=$NCBI/BerkeleyDB-4.5.20} ;;
-esac
+: ${BERKELEYDB_PATH=$NCBI/BerkeleyDB-5.3.28-ncbi1}
: ${BOOST_PATH=$NCBI/boost-1.76.0-ncbi1}
: ${CEREAL_PATH=$NCBI/cereal-1.3.0}
-: ${CPPKAFKA_PATH=$NCBI/cppkafka-0.3.1+boost-1.76}
+: ${CPPKAFKA_PATH=$NCBI/cppkafka-0.3.1+rdkafka-2.3.0}
: ${CRC32C_PATH=$NCBI/crc32c-1.1.2}
case "$ncbi_platform" in
Linux64 ) : ${GMP_PATH=$NCBI/gmp-6.0.0a} ;;
- *MAC ) : ${GMP_PATH=$NCBI/gmp-6.0.0a} ;;
+ *MAC ) : ${GMP_PATH=$NCBI/gmp-6.3.0} ;;
esac
# NB: now used only when explicitly configured --with-gnutls
: ${LEVELDB_PATH=$NCBI/leveldb-1.21}
-: ${LIBRDKAFKA_PATH=$NCBI/librdkafka-1.5.0}
+: ${LIBRDKAFKA_PATH=$NCBI/librdkafka-2.3.0}
: ${LIBSSH2_PATH=$NCBI/libssh2-1.7.0}
* ) : ${LZO_PATH=$NCBI/lzo-2.05} ;;
esac
-: ${MBEDTLS_PATH=$NCBI/mbedtls-2.28.3}
+: ${MBEDTLS_PATH=$NCBI/mbedtls-2.28.8}
: ${MIMETIC_PATH=$NCBI/mimetic-0.9.8-ncbi1}
: ${MONGODB_PATH=$NCBI/mongodb-1.1.2}
-: ${MONGODB3_PATH=$NCBI/mongodb-3.6.3}
+: ${MONGODB3_PATH=$NCBI/mongodb-3.7.0}
: ${MSGSL_PATH=$NCBI/msgsl-0.0.20171114-1c95f94}
esac
# C Toolkit (path overridden in stable components to avoid version skew)
-: ${NCBI_C_PATH=$NCBI}
+: ${NCBI_C_PATH=$NCBI/c++.by-date/production/20231209/C_TOOLKIT}
: ${NCBICRYPT_PATH=$NCBI/ncbicrypt-20230516}
: ${NGHTTP2_PATH=$NCBI/nghttp2-1.40.0}
net_ngs_base=/net/snowman/vol/projects/trace_software/ngs/ngs-versions
-: ${NGS_PATH=$net_ngs_base/3.0.7}
+: ${NGS_PATH=$net_ngs_base/3.1.1}
: ${NLOHMANN_JSON_PATH=$NCBI/nlohmann-json-3.9.1}
# with_vdb=$local_vdb_base/cxx_toolkit/3
with_vdb=$net_vdb_base/cxx_toolkit/3-rc
else
- : ${VDB_PATH=$local_vdb_base/3.0.7}
+ : ${VDB_PATH=$local_vdb_base/3.1.1}
fi
: ${with_downloaded_vdb=no}
;;
- IntelMAC )
+ *MAC )
if [ "x$with_vdb" = 'xrc' ]; then
with_vdb=$net_vdb_base/cxx_toolkit/3-rc
else
- : ${VDB_PATH=$net_vdb_base/3.0.7}
+ : ${VDB_PATH=$net_vdb_base/3.1.1}
fi
: ${with_downloaded_vdb=no}
;;
case "$host_os:$host_cpu:$bit64_sfx" in
darwin*:*86*:64 ) vdb_libpath=mac/$vdb_mode/x86_64/lib ;;
darwin*:*86*:* ) vdb_libpath=mac/$vdb_mode/fat86/lib ;;
- darwin*:arm* ) vdb_libpath=mac/$vdb_mode/aarch64/lib ;;
+ darwin*:arm* ) vdb_libpath=mac/$vdb_mode/arm64/lib ;;
linux*:*86*:64 ) vdb_libpath=linux/$vdb_mode/x86_64/lib ;;
- linux*:aarch64* ) vdb_libpath=linux/$vdb_mode/aarch64/lib ;;
+ linux*:aarch64* ) vdb_libpath=linux/$vdb_mode/arm64/lib ;;
* )
if test -n "$with_vdb"; then
as_fn_error $? "--with-vdb explicitly specified,
case "$host_cpu:$bit64_sfx" in
*86*:64 ) extra_inc="-I$NGS_PATH/include/ngs/unix/x86_64" ;;
*86*:* ) extra_inc="-I$NGS_PATH/include/ngs/unix/fat86" ;;
+ a*:64 ) extra_inc="-I$NGS_PATH/include/ngs/unix/arm64" ;;
* ) extra_inc='' ;;
esac
NGS_INCLUDE="$NGS_INCLUDE $extra_inc"
if ls $PROTOBUF_PATH/lib*/libprotobuf$D_SFX.* >/dev/null 2>&1; then
PROTOBUF_SFX=$D_SFX
else
- for ext in .a .so .dylib; do
+ for ext in a so dylib; do
path=`$CXX -B$PROTOBUF_PATH/ -print-file-name=libprotobuf$D_SFX.$ext \
2>/dev/null`
case "$path" in
done
fi
fi
+pb_pc=pkg-config
+if test -n "$PROTOBUF_PATH"; then
+ for d in "$PROTOBUF_PATH/lib$bit64_sfx" "$PROTOBUF_PATH/lib"; do
+ if test -d "$d/pkgconfig"; then
+ pb_pc="env PKG_CONFIG_PATH=$d/pkgconfig pkg-config"
+ break
+ fi
+ done
+fi
+if $pb_pc protobuf --modversion 2>/dev/null; then
+ # Avoid a hang observed with pkg-config 0.27.1 (as on CentOS 7)
+ # and post-2022 Abseil versions.
+ case "`$pb_pc --version`:`$pb_pc protobuf --modversion`" in
+ 0.2[89]* | 0.[3-9][0-9]* | 0.[1-9][0-9][0-9]* | [1-9]* \
+ | *:20[01]* | *:202[0-2]* )
+ pb_sed="s/\$/ /; s/\(-lprotobuf\) /\1$PROTOBUF_SFX /; s/ \$//"
+ PROTOBUF_CONFIG_LIBS="`$pb_pc protobuf --libs | sed -e \"$pb_sed\"`"
+ ;;
+ * )
+ pb_pc=
+ ;;
+ esac
+else
+ pb_pc=
+fi
+if test -z "$pb_pc"; then
+ PROTOBUF_CONFIG_LIBS=-lprotobuf$PROTOBUF_SFX
+ for l in absl_log_internal_check_op absl_leak_check absl_die_if_null \
+ absl_log_internal_conditions absl_log_internal_message \
+ absl_examine_stack absl_log_internal_format \
+ absl_log_internal_proto absl_log_internal_nullguard \
+ absl_log_internal_log_sink_set absl_log_sink absl_log_entry \
+ absl_flags absl_flags_internal absl_flags_marshalling \
+ absl_flags_reflection absl_flags_private_handle_accessor \
+ absl_flags_commandlineflag absl_flags_commandlineflag_internal \
+ absl_flags_config absl_flags_program_name absl_log_initialize \
+ absl_log_globals absl_log_internal_globals absl_raw_hash_set \
+ absl_hash absl_city absl_low_level_hash absl_hashtablez_sampler \
+ absl_statusor absl_status absl_cord absl_cordz_info \
+ absl_cord_internal absl_cordz_functions absl_exponential_biased \
+ absl_cordz_handle absl_crc_cord_state absl_crc32c \
+ absl_crc_internal absl_crc_cpu_detect absl_bad_optional_access \
+ absl_str_format_internal absl_strerror absl_synchronization \
+ absl_graphcycles_internal absl_kernel_timeout_internal \
+ absl_stacktrace absl_symbolize absl_debugging_internal \
+ absl_demangle_internal absl_malloc_internal absl_time \
+ absl_civil_time absl_time_zone absl_bad_variant_access \
+ utf8_validity utf8_range absl_strings absl_string_view \
+ absl_strings_internal absl_base absl_spinlock_wait absl_int128 \
+ absl_throw_delegate absl_raw_logging_internal absl_log_severity
+ do
+ if test -f $PROTOBUF_PATH/lib${bit64_sfx}/lib$l.a \
+ -o -f $PROTOBUF_PATH/lib/lib$l.a; then
+ PROTOBUF_CONFIG_LIBS="$PROTOBUF_CONFIG_LIBS -l$l"
+ fi
+ done
+fi
+
if test "$with_protobuf" != "no"; then
case "$PROTOBUF_PATH:$with_protobuf" in
*:yes | *: | $with_protobuf* ) ;;
PROTOBUF_LIBPATH="${ncbi_rp_L_flags}${ncbi_rp_R_flags}"
fi
fi
- PROTOBUF_LIBS="$PROTOBUF_LIBPATH -lprotobuf$PROTOBUF_SFX "
+ PROTOBUF_LIBS="$PROTOBUF_LIBPATH -lprotobuf$PROTOBUF_SFX $PROTOBUF_CONFIG_LIBS"
else
PROTOBUF_INCLUDE=""
- PROTOBUF_LIBS="-lprotobuf$PROTOBUF_SFX "
+ PROTOBUF_LIBS="-lprotobuf$PROTOBUF_SFX $PROTOBUF_CONFIG_LIBS"
in_path=
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libprotobuf$PROTOBUF_SFX$in_path" >&5
if test -n "$GRPC_PATH"; then
for d in "$GRPC_PATH/lib$bit64_sfx" "$GRPC_PATH/lib"; do
if test -d "$d/pkgconfig"; then
- grpc_pc="env PKG_CONFIG_PATH=$d/pkgconfig pkg-config"
+ if test -n "$pb_pc" -a "$GRPC_PATH" != "$PROTOBUF_PATH"; then
+ grpc_pc="`echo $pb_pc | sed -e \"s,=,=$d:,\"`"
+ else
+ grpc_pc="env PKG_CONFIG_PATH=$d/pkgconfig pkg-config"
+ fi
break
fi
done
fi
-if $grpc_pc grpc++ --exists 2>/dev/null; then
- GRPC_SED=sed
+if test -n "$pb_pc" && $grpc_pc grpc++ --exists 2>/dev/null; then
+ grpc_b_flags=`$grpc_pc grpc++ --libs-only-L | sed -e 's/^/ /; s/ -L/ -B/'`
+ if test \! -f "`$CXX $grpc_b_flags -print-file-name=libgrpc++.so \
+ 2>/dev/null`" \
+ -a \! -f "`$CXX $grpc_b_flags -print-file-name=libgrpc++.dylib \
+ 2>/dev/null`"; then
+ grpc_pc="$grpc_pc --static"
+ fi
+ GRPC_SED="sed -e \"$pb_sed\""
if test -f "$GRPC_PATH/lib/libboringssl.a"; then
- GRPC_SED="sed -e s/-lssl/-lboringssl/g -e s/-lcrypto/-lboringcrypto/g"
+ GRPC_SED="$GRPC_SED -e s/-lssl/-lboringssl/g"
+ GRPC_SED="$GRPC_SED -e s/-lcrypto/-lboringcrypto/g"
fi
if test -f /usr/lib/libssl.dylib -a \
x"`$grpc_pc grpc++ --variable=prefix`" != x/sw; then
GRPC_SED="$GRPC_SED -e s,-L/sw/lib,,"
fi
- if test "$GRPC_SED" = sed; then
- GRPC_SED=cat
- fi
- GRPC_CONFIG_LIBS="`$grpc_pc grpc++ grpc --libs | $GRPC_SED`"
-else
- GRPC_CONFIG_LIBS=
+ GRPC_CONFIG_LIBS="`$grpc_pc grpc++ grpc protobuf --libs | eval $GRPC_SED`"
+else
+ grpc_pc=
+ GRPC_CONFIG_LIBS="-lgrpc -lgpr"
+ if test "$PROTOBUF_PATH" != "$GRPC_PATH"; then
+ GRPC_CONFIG_LIBS="$GRPC_CONFIG_LIBS $PROTOBUF_LIBPATH"
+ fi
+ for l in address_sorting upb upb_textformat_lib upb_json_lib \
+ upb_collections_lib utf8_range_lib absl_random_distributions \
+ absl_random_seed_sequences absl_random_internal_pool_urbg \
+ absl_random_internal_randen absl_random_internal_randen_hwaes \
+ absl_random_internal_randen_hwaes_impl \
+ absl_random_internal_randen_slow absl_random_internal_platform \
+ absl_random_internal_seed_material absl_random_seed_gen_exception
+ do
+ if test -f $GRPC_PATH/lib${bit64_sfx}/lib$l.a \
+ -o -f $GRPC_PATH/lib/lib$l.a \
+ -o -f $PROTOBUF_PATH/lib${bit64_sfx}/lib$l.a \
+ -o -f $PROTOBUF_PATH/lib/lib$l.a; then
+ GRPC_CONFIG_LIBS="$GRPC_CONFIG_LIBS -l$l"
+ fi
+ done
+ GRPC_CONFIG_LIBS="$GRPC_CONFIG_LIBS $PROTOBUF_CONFIG_LIBS"
+
if test -n "$GRPC_PATH"; then
in_path=" in $GRPC_PATH"
CPPFLAGS="-I$GRPC_PATH/include $orig_CPPFLAGS"
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
+ if test -n "$GRPC_PATH"; then
+ LIBS="$PROTOBUF_LIBPATH -L$GRPC_PATH/lib$bit64_sfx -L$GRPC_PATH/lib -lre2"
+ LIBS="$LIBS $orig_LIBS"
+ else
+ LIBS="-lre2 $orig_LIBS"
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libre2$in_path" >&5
+$as_echo_n "checking for libre2$in_path... " >&6; }
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <re2/re2.h>
+int
+main ()
+{
+re2::RE2 rx("foo");
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+ RE2_LIBS=-lre2; { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+ RE2_LIBS=; { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+
+ GRPC_CONFIG_LIBS="$GRPC_CONFIG_LIBS $CARES_LIBS $RE2_LIBS"
+
if test -f "$GRPC_PATH/lib/libboringssl.a"; then
GRPC_LDEP="-lboringssl -lboringcrypto"
else
if test -n "$GRPC_LIBS"; then
- if test -n "$GRPC_CONFIG_LIBS"; then
- GRPC_LIBS="$GRPC_CONFIG_LIBS $PROTOBUF_LIBS $GRPC_LDEP"
- GRPC_UNSECURE_LIBS="`$grpc_pc grpc++_unsecure grpc_unsecure --libs`"
- for x in address_sorting upb cares; do
- case " $GRPC_LIBS ::: $GRPC_UNSECURE_LIBS " in
- *:::*" -l$x "* ) ;;
- *" -l$x "* ) GRPC_UNSECURE_LIBS="$GRPC_UNSECURE_LIBS -l$x" ;;
+ if test -n "$grpc_pc"; then
+ GRPC_UNSECURE_LIBS="`$grpc_pc grpc++_unsecure grpc_unsecure protobuf \
+ --libs`"
+ else
+ GRPC_LIBS="$GRPC_LIBPATH -lgrpc++ $GRPC_CONFIG_LIBS $GRPC_LDEP"
+ GRPC_UNSECURE_LIBS=
+ sep=
+ for x in $GRPC_LIBS; do
+ case "$x" in
+ -lgrpc* )
+ GRPC_UNSECURE_LIBS="$GRPC_UNSECURE_LIBS$sep${x}_unsecure"
+ sep=' '
+ ;;
+ -lboring* | -lssl | -lcrypto )
+ ;;
+ * )
+ GRPC_UNSECURE_LIBS="$GRPC_UNSECURE_LIBS $x"
+ sep=' '
+ ;;
esac
done
- GRPC_UNSECURE_LIBS="$GRPC_UNSECURE_LIBS $PROTOBUF_LIBS $GRPC_LDEP"
- else
- LDFLAGS="$orig_LDFLAGS $GRPC_LIBPATH"
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for address_sorting_rfc_6724_sort in -laddress_sorting" >&5
-$as_echo_n "checking for address_sorting_rfc_6724_sort in -laddress_sorting... " >&6; }
-if ${ac_cv_lib_address_sorting_address_sorting_rfc_6724_sort+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-laddress_sorting $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char address_sorting_rfc_6724_sort ();
-int
-main ()
-{
-return address_sorting_rfc_6724_sort ();
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_cxx_try_link "$LINENO"; then :
- ac_cv_lib_address_sorting_address_sorting_rfc_6724_sort=yes
-else
- ac_cv_lib_address_sorting_address_sorting_rfc_6724_sort=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_address_sorting_address_sorting_rfc_6724_sort" >&5
-$as_echo "$ac_cv_lib_address_sorting_address_sorting_rfc_6724_sort" >&6; }
-if test "x$ac_cv_lib_address_sorting_address_sorting_rfc_6724_sort" = x""yes; then :
- GRPC_LIBS="$GRPC_LIBS -laddress_sorting"
-fi
-
- LDFLAGS=$orig_LDFLAGS
- GRPC_UNSECURE_LIBS=`echo $GRPC_LIBS \
- | sed -e 's/\(-lgrpc+*\)/\1_unsecure/g'`
- GRPC_LIBS="$GRPC_LIBS $GRPC_LDEP"
fi
GRPC_REFLECTION_LIBS="$WHOLE_ARCHIVE $NO_AS_NEEDED $GRPC_LIBPATH"
GRPC_REFLECTION_LIBS="$GRPC_REFLECTION_LIBS -lgrpc++_reflection"
#############################################################################
-# $Id: configure.ac 671133 2023-08-08 19:52:02Z ivanov $
+# $Id: configure.ac 679451 2024-02-26 14:44:28Z ivanov $
# Derived from configure.in version 1.173.
# ==========================================================================
#
case "$host_os:$host_cpu:$bit64_sfx" in
darwin*:*86*:64 ) vdb_libpath=mac/$vdb_mode/x86_64/lib ;;
darwin*:*86*:* ) vdb_libpath=mac/$vdb_mode/fat86/lib ;;
- darwin*:arm* ) vdb_libpath=mac/$vdb_mode/aarch64/lib ;;
+ darwin*:arm* ) vdb_libpath=mac/$vdb_mode/arm64/lib ;;
linux*:*86*:64 ) vdb_libpath=linux/$vdb_mode/x86_64/lib ;;
- linux*:aarch64* ) vdb_libpath=linux/$vdb_mode/aarch64/lib ;;
+ linux*:aarch64* ) vdb_libpath=linux/$vdb_mode/arm64/lib ;;
* )
if test -n "$with_vdb"; then
AC_MSG_ERROR([--with-vdb explicitly specified,
case "$host_cpu:$bit64_sfx" in
*86*:64 ) extra_inc="-I$NGS_PATH/include/ngs/unix/x86_64" ;;
*86*:* ) extra_inc="-I$NGS_PATH/include/ngs/unix/fat86" ;;
+ a*:64 ) extra_inc="-I$NGS_PATH/include/ngs/unix/arm64" ;;
* ) extra_inc='' ;;
esac
NGS_INCLUDE="$NGS_INCLUDE $extra_inc"
if ls $PROTOBUF_PATH/lib*/libprotobuf$D_SFX.* >/dev/null 2>&1; then
PROTOBUF_SFX=$D_SFX
else
- for ext in .a .so .dylib; do
+ for ext in a so dylib; do
path=`$CXX -B$PROTOBUF_PATH/ -print-file-name=libprotobuf$D_SFX.$ext \
2>/dev/null`
case "$path" in
done
fi
fi
+pb_pc=pkg-config
+if test -n "$PROTOBUF_PATH"; then
+ for d in "$PROTOBUF_PATH/lib$bit64_sfx" "$PROTOBUF_PATH/lib"; do
+ if test -d "$d/pkgconfig"; then
+ pb_pc="env PKG_CONFIG_PATH=$d/pkgconfig pkg-config"
+ break
+ fi
+ done
+fi
+if $pb_pc protobuf --modversion 2>/dev/null; then
+ # Avoid a hang observed with pkg-config 0.27.1 (as on CentOS 7)
+ # and post-2022 Abseil versions.
+ case "`$pb_pc --version`:`$pb_pc protobuf --modversion`" in
+ 0.2[[89]]* | 0.[[3-9]][[0-9]]* | 0.[[1-9]][[0-9]][[0-9]]* | [[1-9]]* \
+ | *:20[[01]]* | *:202[[0-2]]* )
+ pb_sed="s/\$/ /; s/\(-lprotobuf\) /\1$PROTOBUF_SFX /; s/ \$//"
+ PROTOBUF_CONFIG_LIBS="`$pb_pc protobuf --libs | sed -e \"$pb_sed\"`"
+ ;;
+ * )
+ pb_pc=
+ ;;
+ esac
+else
+ pb_pc=
+fi
+if test -z "$pb_pc"; then
+ PROTOBUF_CONFIG_LIBS=-lprotobuf$PROTOBUF_SFX
+ for l in absl_log_internal_check_op absl_leak_check absl_die_if_null \
+ absl_log_internal_conditions absl_log_internal_message \
+ absl_examine_stack absl_log_internal_format \
+ absl_log_internal_proto absl_log_internal_nullguard \
+ absl_log_internal_log_sink_set absl_log_sink absl_log_entry \
+ absl_flags absl_flags_internal absl_flags_marshalling \
+ absl_flags_reflection absl_flags_private_handle_accessor \
+ absl_flags_commandlineflag absl_flags_commandlineflag_internal \
+ absl_flags_config absl_flags_program_name absl_log_initialize \
+ absl_log_globals absl_log_internal_globals absl_raw_hash_set \
+ absl_hash absl_city absl_low_level_hash absl_hashtablez_sampler \
+ absl_statusor absl_status absl_cord absl_cordz_info \
+ absl_cord_internal absl_cordz_functions absl_exponential_biased \
+ absl_cordz_handle absl_crc_cord_state absl_crc32c \
+ absl_crc_internal absl_crc_cpu_detect absl_bad_optional_access \
+ absl_str_format_internal absl_strerror absl_synchronization \
+ absl_graphcycles_internal absl_kernel_timeout_internal \
+ absl_stacktrace absl_symbolize absl_debugging_internal \
+ absl_demangle_internal absl_malloc_internal absl_time \
+ absl_civil_time absl_time_zone absl_bad_variant_access \
+ utf8_validity utf8_range absl_strings absl_string_view \
+ absl_strings_internal absl_base absl_spinlock_wait absl_int128 \
+ absl_throw_delegate absl_raw_logging_internal absl_log_severity
+ do
+ if test -f $PROTOBUF_PATH/lib${bit64_sfx}/lib$l.a \
+ -o -f $PROTOBUF_PATH/lib/lib$l.a; then
+ PROTOBUF_CONFIG_LIBS="$PROTOBUF_CONFIG_LIBS -l$l"
+ fi
+ done
+fi
+
NCBI_CHECK_THIRD_PARTY_LIB_EX(protobuf, PROTOBUF, [protobuf$PROTOBUF_SFX],
[AC_LANG_PROGRAM([[@%:@include <google/protobuf/type.pb.h>]],
[[google::protobuf::Type t;]])],
- [], [$Z_LIBS])
+ [$PROTOBUF_CONFIG_LIBS], [$Z_LIBS])
if test -n "$PROTOBUF_LIBS"; then
AC_PATH_PROG(PROTOC, protoc, [], [$PROTOBUF_PATH/bin:$PATH])
if test ! -x "$PROTOC"; then
if test -n "$GRPC_PATH"; then
for d in "$GRPC_PATH/lib$bit64_sfx" "$GRPC_PATH/lib"; do
if test -d "$d/pkgconfig"; then
- grpc_pc="env PKG_CONFIG_PATH=$d/pkgconfig pkg-config"
+ if test -n "$pb_pc" -a "$GRPC_PATH" != "$PROTOBUF_PATH"; then
+ grpc_pc="`echo $pb_pc | sed -e \"s,=,=$d:,\"`"
+ else
+ grpc_pc="env PKG_CONFIG_PATH=$d/pkgconfig pkg-config"
+ fi
break
fi
done
fi
-if $grpc_pc grpc++ --exists 2>/dev/null; then
- GRPC_SED=sed
+if test -n "$pb_pc" && $grpc_pc grpc++ --exists 2>/dev/null; then
+ grpc_b_flags=`$grpc_pc grpc++ --libs-only-L | sed -e 's/^/ /; s/ -L/ -B/'`
+ if test \! -f "`$CXX $grpc_b_flags -print-file-name=libgrpc++.so \
+ 2>/dev/null`" \
+ -a \! -f "`$CXX $grpc_b_flags -print-file-name=libgrpc++.dylib \
+ 2>/dev/null`"; then
+ grpc_pc="$grpc_pc --static"
+ fi
+ GRPC_SED="sed -e \"$pb_sed\""
if test -f "$GRPC_PATH/lib/libboringssl.a"; then
- GRPC_SED="sed -e s/-lssl/-lboringssl/g -e s/-lcrypto/-lboringcrypto/g"
+ GRPC_SED="$GRPC_SED -e s/-lssl/-lboringssl/g"
+ GRPC_SED="$GRPC_SED -e s/-lcrypto/-lboringcrypto/g"
fi
if test -f /usr/lib/libssl.dylib -a \
x"`$grpc_pc grpc++ --variable=prefix`" != x/sw; then
GRPC_SED="$GRPC_SED -e s,-L/sw/lib,,"
fi
- if test "$GRPC_SED" = sed; then
- GRPC_SED=cat
- fi
- GRPC_CONFIG_LIBS="`$grpc_pc grpc++ grpc --libs | $GRPC_SED`"
+ GRPC_CONFIG_LIBS="`$grpc_pc grpc++ grpc protobuf --libs | eval $GRPC_SED`"
else
- GRPC_CONFIG_LIBS=
+ grpc_pc=
+ GRPC_CONFIG_LIBS="-lgrpc -lgpr"
+ if test "$PROTOBUF_PATH" != "$GRPC_PATH"; then
+ GRPC_CONFIG_LIBS="$GRPC_CONFIG_LIBS $PROTOBUF_LIBPATH"
+ fi
+ for l in address_sorting upb upb_textformat_lib upb_json_lib \
+ upb_collections_lib utf8_range_lib absl_random_distributions \
+ absl_random_seed_sequences absl_random_internal_pool_urbg \
+ absl_random_internal_randen absl_random_internal_randen_hwaes \
+ absl_random_internal_randen_hwaes_impl \
+ absl_random_internal_randen_slow absl_random_internal_platform \
+ absl_random_internal_seed_material absl_random_seed_gen_exception
+ do
+ if test -f $GRPC_PATH/lib${bit64_sfx}/lib$l.a \
+ -o -f $GRPC_PATH/lib/lib$l.a \
+ -o -f $PROTOBUF_PATH/lib${bit64_sfx}/lib$l.a \
+ -o -f $PROTOBUF_PATH/lib/lib$l.a; then
+ GRPC_CONFIG_LIBS="$GRPC_CONFIG_LIBS -l$l"
+ fi
+ done
+ GRPC_CONFIG_LIBS="$GRPC_CONFIG_LIBS $PROTOBUF_CONFIG_LIBS"
+
if test -n "$GRPC_PATH"; then
in_path=" in $GRPC_PATH"
CPPFLAGS="-I$GRPC_PATH/include $orig_CPPFLAGS"
[AC_LANG_PROGRAM([@%:@include <ares.h>], [ares_library_init(0);])],
[CARES_LIBS=-lcares; AC_MSG_RESULT([yes])],
[CARES_LIBS=; AC_MSG_RESULT([no])])
-
+
+ if test -n "$GRPC_PATH"; then
+ LIBS="$PROTOBUF_LIBPATH -L$GRPC_PATH/lib$bit64_sfx -L$GRPC_PATH/lib -lre2"
+ LIBS="$LIBS $orig_LIBS"
+ else
+ LIBS="-lre2 $orig_LIBS"
+ fi
+ AC_MSG_CHECKING([for libre2$in_path])
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM([@%:@include <re2/re2.h>], [re2::RE2 rx("foo");])],
+ [RE2_LIBS=-lre2; AC_MSG_RESULT([yes])],
+ [RE2_LIBS=; AC_MSG_RESULT([no])])
+
+ GRPC_CONFIG_LIBS="$GRPC_CONFIG_LIBS $CARES_LIBS $RE2_LIBS"
+
if test -f "$GRPC_PATH/lib/libboringssl.a"; then
GRPC_LDEP="-lboringssl -lboringcrypto"
else
[${GRPC_CONFIG_LIBS--lgrpc -lgpr $CARES_LIBS $GRPC_LDEP}],
[$PROTOBUF_LIBS $Z_LIBS], [$PROTOBUF_INCLUDE])
if test -n "$GRPC_LIBS"; then
- if test -n "$GRPC_CONFIG_LIBS"; then
- GRPC_LIBS="$GRPC_CONFIG_LIBS $PROTOBUF_LIBS $GRPC_LDEP"
- GRPC_UNSECURE_LIBS="`$grpc_pc grpc++_unsecure grpc_unsecure --libs`"
- for x in address_sorting upb cares; do
- case " $GRPC_LIBS ::: $GRPC_UNSECURE_LIBS " in
- *:::*" -l$x "* ) ;;
- *" -l$x "* ) GRPC_UNSECURE_LIBS="$GRPC_UNSECURE_LIBS -l$x" ;;
+ if test -n "$grpc_pc"; then
+ GRPC_UNSECURE_LIBS="`$grpc_pc grpc++_unsecure grpc_unsecure protobuf \
+ --libs`"
+ else
+ GRPC_LIBS="$GRPC_LIBPATH -lgrpc++ $GRPC_CONFIG_LIBS $GRPC_LDEP"
+ GRPC_UNSECURE_LIBS=
+ sep=
+ for x in $GRPC_LIBS; do
+ case "$x" in
+ -lgrpc* )
+ GRPC_UNSECURE_LIBS="$GRPC_UNSECURE_LIBS$sep${x}_unsecure"
+ sep=' '
+ ;;
+ -lboring* | -lssl | -lcrypto )
+ ;;
+ * )
+ GRPC_UNSECURE_LIBS="$GRPC_UNSECURE_LIBS $x"
+ sep=' '
+ ;;
esac
done
- GRPC_UNSECURE_LIBS="$GRPC_UNSECURE_LIBS $PROTOBUF_LIBS $GRPC_LDEP"
- else
- LDFLAGS="$orig_LDFLAGS $GRPC_LIBPATH"
- AC_CHECK_LIB(address_sorting, address_sorting_rfc_6724_sort,
- [GRPC_LIBS="$GRPC_LIBS -laddress_sorting"], [])
- LDFLAGS=$orig_LDFLAGS
- GRPC_UNSECURE_LIBS=`echo $GRPC_LIBS \
- | sed -e 's/\(-lgrpc+*\)/\1_unsecure/g'`
- GRPC_LIBS="$GRPC_LIBS $GRPC_LDEP"
- fi
+ fi
GRPC_REFLECTION_LIBS="$WHOLE_ARCHIVE $NO_AS_NEEDED $GRPC_LIBPATH"
GRPC_REFLECTION_LIBS="$GRPC_REFLECTION_LIBS -lgrpc++_reflection"
GRPC_REFLECTION_LIBS="$GRPC_REFLECTION_LIBS $NO_WHOLE_ARCHIVE $AS_NEEDED"
echo "[`date`]"
-svn_location=`echo '$HeadURL: https://svn.ncbi.nlm.nih.gov/repos/toolkit/release/blast/2.15.0/c++/src/build-system/install.sh.in $' | sed "s%\\$[H]eadURL: *\\([^$][^$]*\\) \\$.*%\\1%"`
+svn_location=`echo '$HeadURL: https://svn.ncbi.nlm.nih.gov/repos/toolkit/release/blast/2.16.0/c++/src/build-system/install.sh.in $' | sed "s%\\$[H]eadURL: *\\([^$][^$]*\\) \\$.*%\\1%"`
svn_revision=`echo '$Revision: 541872 $' | sed "s%\\$[R]evision: *\\([^$][^$]*\\) \\$.*%\\1%"`
script_name=`basename $0`
-# $Id: project_tree_builder.ini 673725 2023-10-06 19:33:24Z ivanov $
+# $Id: project_tree_builder.ini 683737 2024-06-04 12:00:41Z ivanov $
###############################################################################
# Macros
# Macros used here should be defined either in this section, or in compiler specific section.
-ThirdParty_BerkeleyDB = $(ThirdPartyBasePath)\\berkeleydb\\$(msvc_3rd)\\4.6.21.NC
+ThirdParty_BerkeleyDB = $(ThirdPartyBasePath)\\berkeleydb\\$(msvc_3rd)\\5.3.28-ncbi1
ThirdParty_Boost = $(ThirdPartyBasePath)\\boost\\$(msvc_3rd)\\1.76.0-ncbi1
ThirdParty_BZ2 = $(ThirdPartyBasePath)\\bzip2\\$(msvc_3rd)\\1.0.6
ThirdParty_fastcgi = $(ThirdPartyBasePath)\\fastcgi\\$(msvc_3rd)\\2.4.1
ThirdParty_Z = $(ThirdPartyBasePath)\\z\\$(msvc_3rd)\\1.2.11
ThirdParty_ZSTD = $(ThirdPartyBasePath)\\zstd\\$(msvc_3rd)\\1.5.2
ThirdParty_SQLServer = C:\\Program Files\\Microsoft SQL Server\\Client SDK\\ODBC\\180\\SDK
-ThirdParty_VDB = $(ThirdPartyVDBBasePath)\\vdb\\vdb-versions\\3.0.7
+ThirdParty_VDB = $(ThirdPartyVDBBasePath)\\vdb\\vdb-versions\\3.1.1
PYTHON_PATH = $(ThirdPartyAppsBasePath)\\Python_3.11\\$(msvc_3rd)
DefinesPath = common/config/ncbiconf_xcode_site.h
-ThirdParty_BerkeleyDB = $(XCode_ThirdPartyBasePath)/BerkeleyDB
+ThirdParty_BerkeleyDB = $(XCode_ThirdPartyBasePath)/BerkeleyDB-5.3.28-ncbi1
ThirdParty_Boost = $(XCode_ThirdPartyBasePath)/boost-1.76.0-ncbi1
ThirdParty_JPEG = $(XCode_ThirdPartyBasePath)/safe-sw
ThirdParty_PNG = /opt/X11
ThirdParty_wxWidgets = $(XCode_ThirdPartyBasePath)/wxWidgets-3.2.1-ncbi1
ThirdParty_FreeType = /opt/X11
ThirdParty_FTGL = $(XCode_ThirdPartyBasePath)/ftgl-2.1.3-rc5
-ThirdParty_VDB = $(XCode_ThirdPartyVDBBasePath)/vdb/vdb-versions/3.0.7
-ThirdParty_GMP = $(Xcode_ThirdPartyBasePath)/gmp-6.0.0a
+ThirdParty_VDB = $(XCode_ThirdPartyVDBBasePath)/vdb/vdb-versions/3.1.1
+ThirdParty_GMP = $(Xcode_ThirdPartyBasePath)/gmp-6.3.0
ThirdParty_Nettle = $(Xcode_ThirdPartyBasePath)/nettle-3.1.1
ThirdParty_GNUTLS = $(Xcode_ThirdPartyBasePath)/gnutls-3.4.0
ThirdParty_LMDB = $(Xcode_ThirdPartyBasePath)/lmdb-0.9.24
ThirdParty_GRPC = $(Xcode_ThirdPartyBasePath)/grpc-1.36.4-ncbi1
ThirdParty_NGHTTP2 = $(Xcode_ThirdPartyBasePath)/nghttp2-1.40.0
-ThirdParty_UV = $(Xcode_ThirdPartyBasePath)/libuv-1.35.0
+ThirdParty_UV = $(Xcode_ThirdPartyBasePath)/libuv-1.44.2
ThirdParty_ncbicrypt = $(Xcode_ThirdPartyBasePath)/ncbicrypt-20230516
# LIBXML_INCLUDE = /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/libxml2
DllConfigurations = DebugDLL ReleaseDLL
DllBuildDefine = NCBI_DLL_BUILD
msvc_prj = xcode30_prj
+sfx64 = 64
vdb_arch = arm64
vdb_arch_inc = arm64
x86_only = /x86_only
[wxWidgets.xcode]
LIB = -lwx_osx_cocoa_gl-3.2 -lwx_osx_cocoa_richtext-3.2 -lwx_osx_cocoa_aui-3.2 -lwx_osx_cocoa_propgrid-3.2 -lwx_osx_cocoa_xrc-3.2 -lwx_osx_cocoa_qa-3.2 -lwx_osx_cocoa_html-3.2 -lwx_osx_cocoa_adv-3.2 -lwx_osx_cocoa_core-3.2 -lwx_base_xml-3.2 -lwx_base_net-3.2 -lwx_base-3.2 -framework Cocoa
[wxWidgets.xcode.debug.DebugMT]
-INCLUDE = $(x86_only)$(ThirdParty_wxWidgets)/Clang-Debug$(sfx64)MT/lib/wx/include/osx_cocoa-ansi-3.2 $(x86_only)$(ThirdParty_wxWidgets)/include/wx-3.2
-LIBPATH = $(x86_only)$(ThirdParty_wxWidgets)/Clang-Debug$(sfx64)MT/lib
+INCLUDE = $(ThirdParty_wxWidgets)/Clang-Debug$(sfx64)MT/lib/wx/include/osx_cocoa-ansi-3.2 $(ThirdParty_wxWidgets)/include/wx-3.2
+LIBPATH = $(ThirdParty_wxWidgets)/Clang-Debug$(sfx64)MT/lib
[wxWidgets.xcode.debug.DebugDLL]
-INCLUDE = $(x86_only)$(ThirdParty_wxWidgets)/Clang-Debug$(sfx64)/lib/wx/include/osx_cocoa-ansi-3.2 $(x86_only)$(ThirdParty_wxWidgets)/include/wx-3.2
-LIBPATH = $(x86_only)$(ThirdParty_wxWidgets)/Clang-Debug$(sfx64)/lib
+INCLUDE = $(ThirdParty_wxWidgets)/Clang-Debug$(sfx64)/lib/wx/include/osx_cocoa-ansi-3.2 $(ThirdParty_wxWidgets)/include/wx-3.2
+LIBPATH = $(ThirdParty_wxWidgets)/Clang-Debug$(sfx64)/lib
[wxWidgets.xcode.release.ReleaseMT]
-INCLUDE = $(x86_only)$(ThirdParty_wxWidgets)/Clang-Release$(sfx64)MT/lib/wx/include/osx_cocoa-ansi-3.2 $(x86_only)$(ThirdParty_wxWidgets)/include/wx-3.2
-LIBPATH = $(x86_only)$(ThirdParty_wxWidgets)/Clang-Release$(sfx64)MT/lib
+INCLUDE = $(ThirdParty_wxWidgets)/Clang-Release$(sfx64)MT/lib/wx/include/osx_cocoa-ansi-3.2 $(ThirdParty_wxWidgets)/include/wx-3.2
+LIBPATH = $(ThirdParty_wxWidgets)/Clang-Release$(sfx64)MT/lib
[wxWidgets.xcode.release.ReleaseDLL]
-INCLUDE = $(x86_only)$(ThirdParty_wxWidgets)/Clang-Release$(sfx64)/lib/wx/include/osx_cocoa-ansi-3.2 $(x86_only)$(ThirdParty_wxWidgets)/include/wx-3.2
-LIBPATH = $(x86_only)$(ThirdParty_wxWidgets)/Clang-Release$(sfx64)/lib
+INCLUDE = $(ThirdParty_wxWidgets)/Clang-Release$(sfx64)/lib/wx/include/osx_cocoa-ansi-3.2 $(ThirdParty_wxWidgets)/include/wx-3.2
+LIBPATH = $(ThirdParty_wxWidgets)/Clang-Release$(sfx64)/lib
[wxWidgets.xcode.debug]
DEFINES = __WXDEBUG__,__WXMAC__,__WXOSX__,__WXOSX_COCOA__
DEFINES = GLEW_MX
[GLEW.xcode]
-INCLUDE = $(x86_only)$(ThirdParty_GLEW)/include
+INCLUDE = $(ThirdParty_GLEW)/include
LIB = -lGLEW
-LIBPATH = $(x86_only)$(ThirdParty_GLEW)/lib$(sfx64)
+LIBPATH = $(ThirdParty_GLEW)/lib$(sfx64)
DEFINES = GLEW_MX
[HAVE_LIBGLEW]
#[GNUTLS.xcode]
#Component = Nettle
-#INCLUDE = $(x86_only)$(ThirdParty_GNUTLS)/include
+#INCLUDE = $(ThirdParty_GNUTLS)/include
#LIB = -lgnutls
-#LIBPATH = $(x86_only)$(ThirdParty_GNUTLS)/lib$(sfx64)
+#LIBPATH = $(ThirdParty_GNUTLS)/lib$(sfx64)
[Nettle.xcode]
Component = GMP
-INCLUDE = $(x86_only)$(ThirdParty_Nettle)/include
+INCLUDE = $(ThirdParty_Nettle)/include
LIB = -lnettle -lhogweed
-LIBPATH = $(x86_only)$(ThirdParty_Nettle)/lib$(sfx64)
+LIBPATH = $(ThirdParty_Nettle)/lib$(sfx64)
[GMP.xcode]
-INCLUDE = $(x86_only)$(ThirdParty_GMP)/Release$(sfx64)/include
+INCLUDE = $(ThirdParty_GMP)/Release$(sfx64)/include
LIB = -lgmp
-LIBPATH = $(x86_only)$(ThirdParty_GMP)/lib$(sfx64)
+LIBPATH = $(ThirdParty_GMP)/lib$(sfx64)
[HAVE_LIBGNUTLS]
Component=GNUTLS
LIBPATH = $(ThirdParty_LZO)\\lib_static\\releasedll
[LZO.xcode]
-INCLUDE = $(x86_only)$(ThirdParty_LZO)/include
+INCLUDE = $(ThirdParty_LZO)/include
LIB = -llzo2
-LIBPATH = $(x86_only)$(ThirdParty_LZO)/lib$(sfx64)
+LIBPATH = $(ThirdParty_LZO)/lib$(sfx64)
[HAVE_LIBLZO]
Component=LZO
LIBPATH = $(ThirdParty_LMDB)\\lib_static\\releasedll
[LMDB.xcode]
-INCLUDE = $(x86_only)$(ThirdParty_LMDB)/include
+INCLUDE = $(ThirdParty_LMDB)/include
LIB = -llmdb
-LIBPATH = $(x86_only)$(ThirdParty_LMDB)/lib$(sfx64)
+LIBPATH = $(ThirdParty_LMDB)/lib$(sfx64)
MACRO = LMDB_INCLUDE LMDB_STATIC_LIBS LMDB_LIBS
[HAVE_LIBLMDB]
[NCBICRYPT.release.ReleaseDLL]
LIBPATH = $(ThirdParty_ncbicrypt)\\lib_static\\releasedll
[NCBICRYPT.xcode]
-INCLUDE = $(x86_only)$(ThirdParty_ncbicrypt)/include
+INCLUDE = $(ThirdParty_ncbicrypt)/include
LIB = -lncbicrypt
[NCBICRYPT.xcode.debug]
-LIBPATH = $(x86_only)$(ThirdParty_ncbicrypt)/Debug64/lib
+LIBPATH = $(ThirdParty_ncbicrypt)/Debug64/lib
[NCBICRYPT.xcode.release]
-LIBPATH = $(x86_only)$(ThirdParty_ncbicrypt)/Release64/lib
+LIBPATH = $(ThirdParty_ncbicrypt)/Release64/lib
[HAVE_LIBNCBICRYPT]
Component=NCBICRYPT
LIBPATH = $(ThirdParty_NGHTTP2)\\lib_dll\\releasedll
[NGHTTP2.xcode]
-INCLUDE = $(x86_only)$(ThirdParty_NGHTTP2)/include
-LIBPATH = $(x86_only)$(ThirdParty_NGHTTP2)/lib
+INCLUDE = $(ThirdParty_NGHTTP2)/include
+LIBPATH = $(ThirdParty_NGHTTP2)/lib
LIB = -lnghttp2
[HAVE_LIBNGHTTP2]
[BerkeleyDB]
INCLUDE = $(ThirdParty_BerkeleyDB)\\include
LIB = libdb.lib
-CONFS = DebugMT DebugDLL ReleaseMT ReleaseDLL
+CONFS = DebugDLL ReleaseDLL
MACRO = BERKELEYDB_INCLUDE BERKELEYDB_STATIC_LIBS BERKELEYDB_LIBS
-[BerkeleyDB.debug.DebugMT]
-LIBPATH = $(ThirdParty_BerkeleyDB)\\lib_static\\debugmt
[BerkeleyDB.static.debug.DebugDLL]
LIBPATH = $(ThirdParty_BerkeleyDB)\\lib_static\\debugdll
-[BerkeleyDB.release.ReleaseMT]
-LIBPATH = $(ThirdParty_BerkeleyDB)\\lib_static\\releasemt
[BerkeleyDB.static.release.ReleaseDLL]
LIBPATH = $(ThirdParty_BerkeleyDB)\\lib_static\\releasedll
[BerkeleyDB.dll.debug.DebugDLL]
LIBPATH = $(ThirdParty_BerkeleyDB)\\lib_dll\\releasedll
[BerkeleyDB.xcode]
-INCLUDE = $(x86_only)$(ThirdParty_BerkeleyDB)/include
+INCLUDE = $(ThirdParty_BerkeleyDB)/include
LIB = -ldb
CONFS = Debug DebugMT DebugDLL Release ReleaseMT ReleaseDLL
MACRO = BERKELEYDB_INCLUDE BERKELEYDB_STATIC_LIBS BERKELEYDB_LIBS
-LIBPATH = $(x86_only)$(ThirdParty_BerkeleyDB)/lib$(sfx64)
+LIBPATH = $(ThirdParty_BerkeleyDB)/lib$(sfx64)
#----------------------------------------------------------------------------
LIBPATH = $(ThirdParty_UV)\\lib_dll\\releasedll
[LIBUV.xcode]
-INCLUDE = $(x86_only)$(ThirdParty_UV)/include
-LIBPATH = $(x86_only)$(ThirdParty_UV)/lib
+INCLUDE = $(ThirdParty_UV)/include
+LIBPATH = $(ThirdParty_UV)/lib
LIB = -luv
[HAVE_LIBUV]
LIBPATH = $(ThirdParty_Boost)\\lib_static\\releasedll
[Boost.Test.xcode]
-INCLUDE = $(x86_only)$(ThirdParty_Boost)/include
+INCLUDE = $(ThirdParty_Boost)/include
LIB = -lboost_unit_test_framework-clang-darwin
CONFS = Debug DebugMT DebugDLL Release ReleaseMT ReleaseDLL
LIBPATH = $(ThirdParty_Boost)/lib
LIBPATH = $(ThirdParty_Boost)\\lib_static\\releasedll
[Boost.Thread.xcode]
-INCLUDE = $(x86_only)$(ThirdParty_Boost)/include
+INCLUDE = $(ThirdParty_Boost)/include
CONFS = DebugMT DebugDLL ReleaseMT ReleaseDLL
LIBPATH = $(ThirdParty_FTGL)\\lib_static\\releasedll
[FTGL.xcode]
-INCLUDE = $(x86_only)$(ThirdParty_FTGL)/include
+INCLUDE = $(ThirdParty_FTGL)/include
LIB = -lftgl
[FTGL.xcode.debug]
-LIBPATH = $(x86_only)$(ThirdParty_FTGL)/Debug$(sfx64)/lib
+LIBPATH = $(ThirdParty_FTGL)/Debug$(sfx64)/lib
[FTGL.xcode.release]
-LIBPATH = $(x86_only)$(ThirdParty_FTGL)/Release$(sfx64)/lib
+LIBPATH = $(ThirdParty_FTGL)/Release$(sfx64)/lib
[HAVE_LIBFTGL]
Component=FTGL
LIBPATH = $(ThirdParty_GRPC)\\lib\\ReleaseDLL
LIB = libprotobuf.lib
[PROTOBUF.xcode]
-INCLUDE = $(x86_only)$(ThirdParty_GRPC)/include
+INCLUDE = $(ThirdParty_GRPC)/include
[PROTOBUF.xcode.debug]
-INCLUDE = $(x86_only)$(ThirdParty_GRPC)/Debug/include
-LIBPATH = $(x86_only)$(ThirdParty_GRPC)/Debug/lib
+INCLUDE = $(ThirdParty_GRPC)/Debug/include
+LIBPATH = $(ThirdParty_GRPC)/Debug/lib
LIB = -lprotobufd
[PROTOBUF.xcode.release]
-INCLUDE = $(x86_only)$(ThirdParty_GRPC)/Release/include
-LIBPATH = $(x86_only)$(ThirdParty_GRPC)/Release/lib
+INCLUDE = $(ThirdParty_GRPC)/Release/include
+LIBPATH = $(ThirdParty_GRPC)/Release/lib
LIB = -lprotobuf
[HAVE_LIBPROTOBUF]
LIBPATH = $(ThirdParty_GRPC)\\lib\\ReleaseDLL
LIB = grpc++.lib grpc.lib gpr.lib address_sorting.lib cares.lib libprotobuf.lib libprotoc.lib upb.lib boringcrypto.lib boringssl.lib re2.lib absl_bad_any_cast_impl.lib absl_bad_optional_access.lib absl_bad_variant_access.lib absl_base.lib absl_city.lib absl_civil_time.lib absl_cord.lib absl_debugging_internal.lib absl_demangle_internal.lib absl_examine_stack.lib absl_exponential_biased.lib absl_failure_signal_handler.lib absl_flags.lib absl_flags_commandlineflag.lib absl_flags_commandlineflag_internal.lib absl_flags_config.lib absl_flags_internal.lib absl_flags_marshalling.lib absl_flags_parse.lib absl_flags_private_handle_accessor.lib absl_flags_program_name.lib absl_flags_reflection.lib absl_flags_usage.lib absl_flags_usage_internal.lib absl_graphcycles_internal.lib absl_hash.lib absl_hashtablez_sampler.lib absl_int128.lib absl_leak_check.lib absl_leak_check_disable.lib absl_log_severity.lib absl_malloc_internal.lib absl_periodic_sampler.lib absl_random_distributions.lib absl_random_internal_distribution_test_util.lib absl_random_internal_platform.lib absl_random_internal_pool_urbg.lib absl_random_internal_randen.lib absl_random_internal_randen_hwaes.lib absl_random_internal_randen_hwaes_impl.lib absl_random_internal_randen_slow.lib absl_random_internal_seed_material.lib absl_random_seed_gen_exception.lib absl_random_seed_sequences.lib absl_raw_hash_set.lib absl_raw_logging_internal.lib absl_scoped_set_env.lib absl_spinlock_wait.lib absl_stacktrace.lib absl_status.lib absl_statusor.lib absl_str_format_internal.lib absl_strerror.lib absl_strings.lib absl_strings_internal.lib absl_symbolize.lib absl_synchronization.lib absl_throw_delegate.lib absl_time.lib absl_time_zone.lib
[GRPC.xcode]
-INCLUDE = $(x86_only)$(ThirdParty_GRPC)/include
+INCLUDE = $(ThirdParty_GRPC)/include
[GRPC.xcode.debug]
-INCLUDE = $(x86_only)$(ThirdParty_GRPC)/Debug/include
-LIBPATH = $(x86_only)$(ThirdParty_GRPC)/Debug/lib
+INCLUDE = $(ThirdParty_GRPC)/Debug/include
+LIBPATH = $(ThirdParty_GRPC)/Debug/lib
LIB = -lgrpc++ -lgrpc -lgpr -laddress_sorting -lupb -lcares -lprotobufd -labsl_raw_hash_set -labsl_hashtablez_sampler -labsl_exponential_biased -labsl_hash -labsl_city -labsl_statusor -labsl_bad_variant_access -labsl_status -labsl_cord -labsl_str_format_internal -labsl_synchronization -labsl_graphcycles_internal -labsl_symbolize -labsl_demangle_internal -labsl_stacktrace -labsl_debugging_internal -labsl_malloc_internal -labsl_time -labsl_time_zone -labsl_civil_time -labsl_strings -labsl_strings_internal -labsl_throw_delegate -labsl_int128 -labsl_base -labsl_spinlock_wait -labsl_bad_optional_access -labsl_raw_logging_internal -labsl_log_severity -lre2 -lboringssl -lboringcrypto -lz
[GRPC.xcode.release]
-INCLUDE = $(x86_only)$(ThirdParty_GRPC)/Release/include
-LIBPATH = $(x86_only)$(ThirdParty_GRPC)/Release/lib
+INCLUDE = $(ThirdParty_GRPC)/Release/include
+LIBPATH = $(ThirdParty_GRPC)/Release/lib
LIB = -lgrpc++ -lgrpc -lgpr -laddress_sorting -lupb -lcares -lprotobuf -labsl_raw_hash_set -labsl_hashtablez_sampler -labsl_exponential_biased -labsl_hash -labsl_city -labsl_statusor -labsl_bad_variant_access -labsl_status -labsl_cord -labsl_str_format_internal -labsl_synchronization -labsl_graphcycles_internal -labsl_symbolize -labsl_demangle_internal -labsl_stacktrace -labsl_debugging_internal -labsl_malloc_internal -labsl_time -labsl_time_zone -labsl_civil_time -labsl_strings -labsl_strings_internal -labsl_throw_delegate -labsl_int128 -labsl_base -labsl_spinlock_wait -labsl_bad_optional_access -labsl_raw_logging_internal -labsl_log_severity -lre2 -lboringssl -lboringcrypto -lz
[HAVE_LIBGRPC]
@script_shell@
-# $Id: relocate.sh.in 674173 2023-10-19 17:21:40Z blastadm $
+# $Id: relocate.sh.in 684490 2024-06-25 12:36:54Z blastadm $
# Author: Denis Vakatov, NCBI
#
# Adjust paths to this build tree and the relevant source tree
-/* $Id: fcgi_run.cpp 668162 2023-05-30 19:17:34Z sadyrovr $
+/* $Id: fcgi_run.cpp 675130 2023-11-15 13:51:04Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
}
+struct SEnvSetter : private CNcbiEnvironment
+{
+ SEnvSetter()
+ {
+ Unset("HTTP_COOKIE");
+ }
+
+ void operator()(const string& name, const string& value)
+ {
+ if (name == "HTTP_COOKIE") {
+ Set(name, value);
+ }
+ }
+};
+
+
bool CCgiApplication::x_RunFastCGI(int* result, unsigned int def_iter)
{
// Reset the result (which is in fact an error counter here)
CRequestContext& rctx = CDiagContext::GetRequestContext();
list<string> names;
env.Enumerate(names);
+ SEnvSetter env_setter;
ITERATE(list<string>, it, names) {
rctx.AddPassThroughProperty(*it, env.Get(*it));
+ env_setter(*it, env.Get(*it));
}
PushDiagPostPrefix(env.Get(m_DiagPrefixEnv).c_str());
-/* $Id: connect_misc.cpp 651028 2022-06-08 15:27:50Z sadyrovr $
+/* $Id: connect_misc.cpp 675422 2023-11-21 19:49:15Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
map<unsigned, string> m_Data;
};
-SSocketAddress::SHost::SHost(const string& h) :
+SSocketAddress::SHost::SHost(const string& h, EName n) :
+ name(n == EName::eOriginal ? h : std::optional<string>()),
host(SSocketAddressImpl::GetInstance().GetHost(h))
{
}
string SSocketAddress::GetHostName() const
{
- return SSocketAddressImpl::GetInstance().GetName(host);
+ return m_Name ? m_Name.value() : SSocketAddressImpl::GetInstance().GetName(host);
}
-SSocketAddress SSocketAddress::Parse(const string& address)
+SSocketAddress SSocketAddress::Parse(const string& address, SHost::EName name)
{
string host, port;
if (NStr::SplitInTwo(address, ":", host, port)) {
- return { host, port };
+ return { { host, name }, port };
}
return { 0, 0 };
struct SServiceDiscoveryImpl : protected CConnIniter
{
// Do not make static (see above)
- shared_ptr<void> GetSingleServer(const string& service_name) const
+ shared_ptr<void> GetSingleServer(const string& service_name, SSocketAddress::SHost::EName name) const
{
- if (auto address = SSocketAddress::Parse(service_name)) {
+ if (auto address = SSocketAddress::Parse(service_name, name)) {
CServiceDiscovery::TServer server(move(address), 1.0);
return make_shared<CServiceDiscovery::TServers>(1, move(server));
}
}
};
-CServiceDiscovery::CServiceDiscovery(const string& service_name) :
+CServiceDiscovery::CServiceDiscovery(const string& service_name, SSocketAddress::SHost::EName name) :
m_ServiceName(service_name),
- m_Data(SServiceDiscoveryImpl().GetSingleServer(m_ServiceName)),
+ m_Data(SServiceDiscoveryImpl().GetSingleServer(m_ServiceName, name)),
m_IsSingleServer(m_Data)
{
}
* FIPS-197 compliant AES implementation
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
/*
* The AES block cipher was designed by Vincent Rijmen and Joan Daemen.
*
- * http://csrc.nist.gov/encryption/aes/rijndael/Rijndael.pdf
+ * https://csrc.nist.gov/csrc/media/projects/cryptographic-standards-and-guidelines/documents/aes-development/rijndael-ammended.pdf
* http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf
*/
#define AES_VALIDATE(cond) \
MBEDTLS_INTERNAL_VALIDATE(cond)
-#if defined(MBEDTLS_PADLOCK_C) && defined(MBEDTLS_HAVE_X86)
+#if defined(MBEDTLS_VIA_PADLOCK_HAVE_CODE)
static int aes_padlock_ace = -1;
#endif
/*
* Forward S-box
*/
+#if !defined(MBEDTLS_AES_ENCRYPT_ALT) || !defined(MBEDTLS_AES_SETKEY_ENC_ALT) || \
+ !defined(MBEDTLS_AES_SETKEY_DEC_ALT)
static const unsigned char FSb[256] =
{
0x63, 0x7C, 0x77, 0x7B, 0xF2, 0x6B, 0x6F, 0xC5,
0x8C, 0xA1, 0x89, 0x0D, 0xBF, 0xE6, 0x42, 0x68,
0x41, 0x99, 0x2D, 0x0F, 0xB0, 0x54, 0xBB, 0x16
};
+#endif /* !defined(MBEDTLS_AES_ENCRYPT_ALT) || !defined(MBEDTLS_AES_SETKEY_ENC_ALT) || \
+ !defined(MBEDTLS_AES_SETKEY_DEC_ALT) */
/*
* Forward tables
V(C3, 41, 41, 82), V(B0, 99, 99, 29), V(77, 2D, 2D, 5A), V(11, 0F, 0F, 1E), \
V(CB, B0, B0, 7B), V(FC, 54, 54, A8), V(D6, BB, BB, 6D), V(3A, 16, 16, 2C)
+#if !defined(MBEDTLS_AES_ENCRYPT_ALT)
#define V(a, b, c, d) 0x##a##b##c##d
static const uint32_t FT0[256] = { FT };
#undef V
#endif /* !MBEDTLS_AES_FEWER_TABLES */
+#endif /* !defined(MBEDTLS_AES_ENCRYPT_ALT) */
+
#undef FT
+#if !defined(MBEDTLS_AES_DECRYPT_ALT)
/*
* Reverse S-box
*/
0x17, 0x2B, 0x04, 0x7E, 0xBA, 0x77, 0xD6, 0x26,
0xE1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0C, 0x7D
};
+#endif /* defined(MBEDTLS_AES_DECRYPT_ALT)) */
/*
* Reverse tables
V(71, 01, A8, 39), V(DE, B3, 0C, 08), V(9C, E4, B4, D8), V(90, C1, 56, 64), \
V(61, 84, CB, 7B), V(70, B6, 32, D5), V(74, 5C, 6C, 48), V(42, 57, B8, D0)
+#if !defined(MBEDTLS_AES_DECRYPT_ALT) || !defined(MBEDTLS_AES_SETKEY_DEC_ALT)
+
#define V(a, b, c, d) 0x##a##b##c##d
static const uint32_t RT0[256] = { RT };
#undef V
#endif /* !MBEDTLS_AES_FEWER_TABLES */
+#endif /* !defined(MBEDTLS_AES_DECRYPT_ALT) || !defined(MBEDTLS_AES_SETKEY_DEC_ALT) */
+
#undef RT
+#if !defined(MBEDTLS_AES_SETKEY_ENC_ALT)
/*
* Round constants
*/
-static const uint32_t RCON[10] =
+static const uint32_t round_constants[10] =
{
0x00000001, 0x00000002, 0x00000004, 0x00000008,
0x00000010, 0x00000020, 0x00000040, 0x00000080,
0x0000001B, 0x00000036
};
+#endif /* !defined(MBEDTLS_AES_SETKEY_ENC_ALT) */
#else /* MBEDTLS_AES_ROM_TABLES */
/*
* Forward S-box & tables
*/
+#if !defined(MBEDTLS_AES_ENCRYPT_ALT) || !defined(MBEDTLS_AES_SETKEY_ENC_ALT) || \
+ !defined(MBEDTLS_AES_SETKEY_DEC_ALT)
static unsigned char FSb[256];
+#endif /* !defined(MBEDTLS_AES_ENCRYPT_ALT) || !defined(MBEDTLS_AES_SETKEY_ENC_ALT) || \
+ !defined(MBEDTLS_AES_SETKEY_DEC_ALT) */
+#if !defined(MBEDTLS_AES_ENCRYPT_ALT) || !defined(MBEDTLS_AES_SETKEY_ENC_ALT)
static uint32_t FT0[256];
#if !defined(MBEDTLS_AES_FEWER_TABLES)
static uint32_t FT1[256];
static uint32_t FT2[256];
static uint32_t FT3[256];
#endif /* !MBEDTLS_AES_FEWER_TABLES */
+#endif /* !defined(MBEDTLS_AES_ENCRYPT_ALT) || !defined(MBEDTLS_AES_SETKEY_ENC_ALT) */
/*
* Reverse S-box & tables
*/
+#if !(defined(MBEDTLS_AES_SETKEY_ENC_ALT) && defined(MBEDTLS_AES_DECRYPT_ALT))
static unsigned char RSb[256];
+#endif /* !(defined(MBEDTLS_AES_SETKEY_ENC_ALT) && defined(MBEDTLS_AES_DECRYPT_ALT)) */
+
+#if !defined(MBEDTLS_AES_DECRYPT_ALT) || !defined(MBEDTLS_AES_SETKEY_DEC_ALT)
static uint32_t RT0[256];
#if !defined(MBEDTLS_AES_FEWER_TABLES)
static uint32_t RT1[256];
static uint32_t RT2[256];
static uint32_t RT3[256];
#endif /* !MBEDTLS_AES_FEWER_TABLES */
+#endif /* !defined(MBEDTLS_AES_DECRYPT_ALT) || !defined(MBEDTLS_AES_SETKEY_DEC_ALT) */
+#if !defined(MBEDTLS_AES_SETKEY_ENC_ALT)
/*
* Round constants
*/
-static uint32_t RCON[10];
+static uint32_t round_constants[10];
/*
* Tables generation code
* calculate the round constants
*/
for (i = 0, x = 1; i < 10; i++) {
- RCON[i] = (uint32_t) x;
+ round_constants[i] = (uint32_t) x;
x = MBEDTLS_BYTE_0(XTIME(x));
}
x = RSb[i];
+#if !defined(MBEDTLS_AES_DECRYPT_ALT) || !defined(MBEDTLS_AES_SETKEY_DEC_ALT)
RT0[i] = ((uint32_t) MUL(0x0E, x)) ^
((uint32_t) MUL(0x09, x) << 8) ^
((uint32_t) MUL(0x0D, x) << 16) ^
RT2[i] = ROTL8(RT1[i]);
RT3[i] = ROTL8(RT2[i]);
#endif /* !MBEDTLS_AES_FEWER_TABLES */
+#endif /* !defined(MBEDTLS_AES_DECRYPT_ALT) || !defined(MBEDTLS_AES_SETKEY_DEC_ALT) */
}
}
+#endif /* !defined(MBEDTLS_AES_SETKEY_ENC_ALT) */
+
#undef ROTL8
#endif /* MBEDTLS_AES_ROM_TABLES */
* Note that the offset is in units of elements of buf, i.e. 32-bit words,
* i.e. an offset of 1 means 4 bytes and so on.
*/
-#if (defined(MBEDTLS_PADLOCK_C) && defined(MBEDTLS_HAVE_X86)) || \
+#if defined(MBEDTLS_VIA_PADLOCK_HAVE_CODE) || \
(defined(MBEDTLS_AESNI_C) && MBEDTLS_AESNI_HAVE_CODE == 2)
#define MAY_NEED_TO_ALIGN
#endif
+
+#if defined(MAY_NEED_TO_ALIGN) || !defined(MBEDTLS_AES_SETKEY_DEC_ALT) || \
+ !defined(MBEDTLS_AES_SETKEY_ENC_ALT)
static unsigned mbedtls_aes_rk_offset(uint32_t *buf)
{
#if defined(MAY_NEED_TO_ALIGN)
int align_16_bytes = 0;
-#if defined(MBEDTLS_PADLOCK_C) && defined(MBEDTLS_HAVE_X86)
+#if defined(MBEDTLS_VIA_PADLOCK_HAVE_CODE)
if (aes_padlock_ace == -1) {
aes_padlock_ace = mbedtls_padlock_has_support(MBEDTLS_PADLOCK_ACE);
}
return 0;
}
+#endif /* defined(MAY_NEED_TO_ALIGN) || !defined(MBEDTLS_AES_SETKEY_DEC_ALT) || \
+ !defined(MBEDTLS_AES_SETKEY_ENC_ALT) */
/*
* AES key schedule (encryption)
case 10:
for (i = 0; i < 10; i++, RK += 4) {
- RK[4] = RK[0] ^ RCON[i] ^
+ RK[4] = RK[0] ^ round_constants[i] ^
((uint32_t) FSb[MBEDTLS_BYTE_1(RK[3])]) ^
((uint32_t) FSb[MBEDTLS_BYTE_2(RK[3])] << 8) ^
((uint32_t) FSb[MBEDTLS_BYTE_3(RK[3])] << 16) ^
case 12:
for (i = 0; i < 8; i++, RK += 6) {
- RK[6] = RK[0] ^ RCON[i] ^
+ RK[6] = RK[0] ^ round_constants[i] ^
((uint32_t) FSb[MBEDTLS_BYTE_1(RK[5])]) ^
((uint32_t) FSb[MBEDTLS_BYTE_2(RK[5])] << 8) ^
((uint32_t) FSb[MBEDTLS_BYTE_3(RK[5])] << 16) ^
case 14:
for (i = 0; i < 7; i++, RK += 8) {
- RK[8] = RK[0] ^ RCON[i] ^
+ RK[8] = RK[0] ^ round_constants[i] ^
((uint32_t) FSb[MBEDTLS_BYTE_1(RK[7])]) ^
((uint32_t) FSb[MBEDTLS_BYTE_2(RK[7])] << 8) ^
((uint32_t) FSb[MBEDTLS_BYTE_3(RK[7])] << 16) ^
}
#endif
-#if defined(MBEDTLS_PADLOCK_C) && defined(MBEDTLS_HAVE_X86)
+#if defined(MBEDTLS_VIA_PADLOCK_HAVE_CODE)
if (aes_padlock_ace) {
return mbedtls_padlock_xcryptecb(ctx, mode, input, output);
}
return MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH;
}
-#if defined(MBEDTLS_PADLOCK_C) && defined(MBEDTLS_HAVE_X86)
+#if defined(MBEDTLS_VIA_PADLOCK_HAVE_CODE)
if (aes_padlock_ace) {
if (mbedtls_padlock_xcryptcbc(ctx, mode, length, iv, input, output) == 0) {
return 0;
#if defined(MBEDTLS_AES_ALT)
mbedtls_printf(" AES note: alternative implementation.\n");
#else /* MBEDTLS_AES_ALT */
-#if defined(MBEDTLS_PADLOCK_C) && defined(MBEDTLS_HAVE_X86)
+#if defined(MBEDTLS_VIA_PADLOCK_HAVE_CODE)
if (mbedtls_padlock_has_support(MBEDTLS_PADLOCK_ACE)) {
mbedtls_printf(" AES note: using VIA Padlock.\n");
} else
* AES-NI support functions
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
/*
#if defined(MBEDTLS_AESNI_HAVE_CODE)
#if MBEDTLS_AESNI_HAVE_CODE == 2
-#if !defined(_WIN32)
+#if defined(__GNUC__)
#include <cpuid.h>
+#elif defined(_MSC_VER)
+#include <intrin.h>
+#else
+#error "`__cpuid` required by MBEDTLS_AESNI_C is not supported by the compiler"
#endif
#include <immintrin.h>
#endif
if (!done) {
#if MBEDTLS_AESNI_HAVE_CODE == 2
- static unsigned info[4] = { 0, 0, 0, 0 };
+ static int info[4] = { 0, 0, 0, 0 };
#if defined(_MSC_VER)
__cpuid(info, 1);
#else
const unsigned char a[16],
const unsigned char b[16])
{
- __m128i aa, bb, cc, dd;
+ __m128i aa = { 0 }, bb = { 0 }, cc, dd;
/* The inputs are in big-endian order, so byte-reverse them */
for (size_t i = 0; i < 16; i++) {
* An implementation of the ARCFOUR algorithm
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
/*
* The ARCFOUR algorithm was publicly disclosed on 94/09.
* ARIA implementation
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
/*
* Generic ASN.1 parsing
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#include "common.h"
* ASN.1 buffer writing functionality
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#include "common.h"
int mbedtls_asn1_write_algorithm_identifier(unsigned char **p, unsigned char *start,
const char *oid, size_t oid_len,
size_t par_len)
+{
+ return mbedtls_asn1_write_algorithm_identifier_ext(p, start, oid, oid_len, par_len, 1);
+}
+
+int mbedtls_asn1_write_algorithm_identifier_ext(unsigned char **p, unsigned char *start,
+ const char *oid, size_t oid_len,
+ size_t par_len, int has_par)
{
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
size_t len = 0;
- if (par_len == 0) {
- MBEDTLS_ASN1_CHK_ADD(len, mbedtls_asn1_write_null(p, start));
- } else {
- len += par_len;
+ if (has_par) {
+ if (par_len == 0) {
+ MBEDTLS_ASN1_CHK_ADD(len, mbedtls_asn1_write_null(p, start));
+ } else {
+ len += par_len;
+ }
}
MBEDTLS_ASN1_CHK_ADD(len, mbedtls_asn1_write_oid(p, start, oid, oid_len));
* RFC 1521 base64 encoding/decoding
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#include "common.h"
* Multi-precision integer library
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
/*
#include "mbedtls/platform_util.h"
#include "mbedtls/error.h"
#include "constant_time_internal.h"
+#include "bignum_internal.h"
#include <limits.h>
#include <string.h>
/*
* Fast Montgomery initialization (thanks to Tom St Denis)
*/
-static void mpi_montg_init(mbedtls_mpi_uint *mm, const mbedtls_mpi *N)
+mbedtls_mpi_uint mbedtls_mpi_montmul_init(const mbedtls_mpi_uint *N)
{
- mbedtls_mpi_uint x, m0 = N->p[0];
- unsigned int i;
+ mbedtls_mpi_uint x = N[0];
- x = m0;
- x += ((m0 + 2) & 4) << 1;
+ x += ((N[0] + 2) & 4) << 1;
- for (i = biL; i >= 8; i /= 2) {
- x *= (2 - (m0 * x));
+ for (unsigned int i = biL; i >= 8; i /= 2) {
+ x *= (2 - (N[0] * x));
}
- *mm = ~x + 1;
+ return ~x + 1;
}
-/** Montgomery multiplication: A = A * B * R^-1 mod N (HAC 14.36)
- *
- * \param[in,out] A One of the numbers to multiply.
- * It must have at least as many limbs as N
- * (A->n >= N->n), and any limbs beyond n are ignored.
- * On successful completion, A contains the result of
- * the multiplication A * B * R^-1 mod N where
- * R = (2^ciL)^n.
- * \param[in] B One of the numbers to multiply.
- * It must be nonzero and must not have more limbs than N
- * (B->n <= N->n).
- * \param[in] N The modulo. N must be odd.
- * \param mm The value calculated by `mpi_montg_init(&mm, N)`.
- * This is -N^-1 mod 2^ciL.
- * \param[in,out] T A bignum for temporary storage.
- * It must be at least twice the limb size of N plus 2
- * (T->n >= 2 * (N->n + 1)).
- * Its initial content is unused and
- * its final content is indeterminate.
- * Note that unlike the usual convention in the library
- * for `const mbedtls_mpi*`, the content of T can change.
- */
-static void mpi_montmul(mbedtls_mpi *A,
- const mbedtls_mpi *B,
- const mbedtls_mpi *N,
- mbedtls_mpi_uint mm,
- const mbedtls_mpi *T)
+void mbedtls_mpi_montmul(mbedtls_mpi *A,
+ const mbedtls_mpi *B,
+ const mbedtls_mpi *N,
+ mbedtls_mpi_uint mm,
+ const mbedtls_mpi *T)
{
size_t i, n, m;
mbedtls_mpi_uint u0, u1, *d;
/*
* Montgomery reduction: A = A * R^-1 mod N
*
- * See mpi_montmul() regarding constraints and guarantees on the parameters.
+ * See mbedtls_mpi_montmul() regarding constraints and guarantees on the
+ * parameters.
*/
static void mpi_montred(mbedtls_mpi *A, const mbedtls_mpi *N,
mbedtls_mpi_uint mm, const mbedtls_mpi *T)
U.n = U.s = (int) z;
U.p = &z;
- mpi_montmul(A, &U, N, mm, T);
+ mbedtls_mpi_montmul(A, &U, N, mm, T);
}
/**
return ret;
}
+int mbedtls_mpi_get_mont_r2_unsafe(mbedtls_mpi *X,
+ const mbedtls_mpi *N)
+{
+ int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
+
+ MBEDTLS_MPI_CHK(mbedtls_mpi_lset(X, 1));
+ MBEDTLS_MPI_CHK(mbedtls_mpi_shift_l(X, N->n * 2 * biL));
+ MBEDTLS_MPI_CHK(mbedtls_mpi_mod_mpi(X, X, N));
+ MBEDTLS_MPI_CHK(mbedtls_mpi_shrink(X, N->n));
+
+cleanup:
+ return ret;
+}
+
/*
* Sliding-window exponentiation: X = A^E mod N (HAC 14.85)
*/
/*
* Init temps and window size
*/
- mpi_montg_init(&mm, N);
+ mm = mbedtls_mpi_montmul_init(N->p);
mbedtls_mpi_init(&RR); mbedtls_mpi_init(&T);
mbedtls_mpi_init(&Apos);
mbedtls_mpi_init(&WW);
* and squarings. Firstly, when multiplying by an element of the window
* W[i], we do a constant-trace table lookup to obfuscate i. This leaves
* squarings as having a different memory access patterns from other
- * multiplications. So secondly, we put the accumulator X in the table as
- * well, and also do a constant-trace table lookup to multiply by X.
+ * multiplications. So secondly, we put the accumulator in the table as
+ * well, and also do a constant-trace table lookup to multiply by the
+ * accumulator which is W[x_index].
*
* This way, all multiplications take the form of a lookup-and-multiply.
* The number of lookup-and-multiply operations inside each iteration of
* observe both memory accesses and branches. However, branch prediction
* exploitation typically requires many traces of execution over the same
* data, which is defeated by randomized blinding.
- *
- * To achieve this, we make a copy of X and we use the table entry in each
- * calculation from this point on.
*/
const size_t x_index = 0;
mbedtls_mpi_init(&W[x_index]);
- mbedtls_mpi_copy(&W[x_index], X);
j = N->n + 1;
- /* All W[i] and X must have at least N->n limbs for the mpi_montmul()
- * and mpi_montred() calls later. Here we ensure that W[1] and X are
- * large enough, and later we'll grow other W[i] to the same length.
- * They must not be shrunk midway through this function!
+ /* All W[i] including the accumulator must have at least N->n limbs for
+ * the mbedtls_mpi_montmul() and mpi_montred() calls later. Here we ensure
+ * that W[1] and the accumulator W[x_index] are large enough. later we'll
+ * grow other W[i] to the same length. They must not be shrunk midway
+ * through this function!
*/
MBEDTLS_MPI_CHK(mbedtls_mpi_grow(&W[x_index], j));
MBEDTLS_MPI_CHK(mbedtls_mpi_grow(&W[1], j));
* If 1st call, pre-compute R^2 mod N
*/
if (prec_RR == NULL || prec_RR->p == NULL) {
- MBEDTLS_MPI_CHK(mbedtls_mpi_lset(&RR, 1));
- MBEDTLS_MPI_CHK(mbedtls_mpi_shift_l(&RR, N->n * 2 * biL));
- MBEDTLS_MPI_CHK(mbedtls_mpi_mod_mpi(&RR, &RR, N));
+ mbedtls_mpi_get_mont_r2_unsafe(&RR, N);
if (prec_RR != NULL) {
memcpy(prec_RR, &RR, sizeof(mbedtls_mpi));
MBEDTLS_MPI_CHK(mbedtls_mpi_mod_mpi(&W[1], A, N));
/* This should be a no-op because W[1] is already that large before
* mbedtls_mpi_mod_mpi(), but it's necessary to avoid an overflow
- * in mpi_montmul() below, so let's make sure. */
+ * in mbedtls_mpi_montmul() below, so let's make sure. */
MBEDTLS_MPI_CHK(mbedtls_mpi_grow(&W[1], N->n + 1));
} else {
MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&W[1], A));
/* Note that this is safe because W[1] always has at least N->n limbs
* (it grew above and was preserved by mbedtls_mpi_copy()). */
- mpi_montmul(&W[1], &RR, N, mm, &T);
+ mbedtls_mpi_montmul(&W[1], &RR, N, mm, &T);
/*
* W[x_index] = R^2 * R^-1 mod N = R mod N
MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&W[j], &W[1]));
for (i = 0; i < window_bitsize - 1; i++) {
- mpi_montmul(&W[j], &W[j], N, mm, &T);
+ mbedtls_mpi_montmul(&W[j], &W[j], N, mm, &T);
}
/*
MBEDTLS_MPI_CHK(mbedtls_mpi_grow(&W[i], N->n + 1));
MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&W[i], &W[i - 1]));
- mpi_montmul(&W[i], &W[1], N, mm, &T);
+ mbedtls_mpi_montmul(&W[i], &W[1], N, mm, &T);
}
}
* out of window, square W[x_index]
*/
MBEDTLS_MPI_CHK(mpi_select(&WW, W, w_table_used_size, x_index));
- mpi_montmul(&W[x_index], &WW, N, mm, &T);
+ mbedtls_mpi_montmul(&W[x_index], &WW, N, mm, &T);
continue;
}
for (i = 0; i < window_bitsize; i++) {
MBEDTLS_MPI_CHK(mpi_select(&WW, W, w_table_used_size,
x_index));
- mpi_montmul(&W[x_index], &WW, N, mm, &T);
+ mbedtls_mpi_montmul(&W[x_index], &WW, N, mm, &T);
}
/*
*/
MBEDTLS_MPI_CHK(mpi_select(&WW, W, w_table_used_size,
exponent_bits_in_window));
- mpi_montmul(&W[x_index], &WW, N, mm, &T);
+ mbedtls_mpi_montmul(&W[x_index], &WW, N, mm, &T);
state--;
nbits = 0;
*/
for (i = 0; i < nbits; i++) {
MBEDTLS_MPI_CHK(mpi_select(&WW, W, w_table_used_size, x_index));
- mpi_montmul(&W[x_index], &WW, N, mm, &T);
+ mbedtls_mpi_montmul(&W[x_index], &WW, N, mm, &T);
exponent_bits_in_window <<= 1;
if ((exponent_bits_in_window & ((size_t) 1 << window_bitsize)) != 0) {
MBEDTLS_MPI_CHK(mpi_select(&WW, W, w_table_used_size, 1));
- mpi_montmul(&W[x_index], &WW, N, mm, &T);
+ mbedtls_mpi_montmul(&W[x_index], &WW, N, mm, &T);
}
}
/*
* Load the result in the output variable.
*/
- mbedtls_mpi_copy(X, &W[x_index]);
+ MBEDTLS_MPI_CHK(mbedtls_mpi_copy(X, &W[x_index]));
cleanup:
--- /dev/null
+/**
+ * Low level bignum functions
+ *
+ * Copyright The Mbed TLS Contributors
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
+ */
+
+#ifndef MBEDTLS_BIGNUM_INTERNAL_H
+#define MBEDTLS_BIGNUM_INTERNAL_H
+
+#include "mbedtls/bignum.h"
+
+/**
+ * \brief Calculate the square of the Montgomery constant. (Needed
+ * for conversion and operations in Montgomery form.)
+ *
+ * \param[out] X A pointer to the result of the calculation of
+ * the square of the Montgomery constant:
+ * 2^{2*n*biL} mod N.
+ * \param[in] N Little-endian presentation of the modulus, which must be odd.
+ *
+ * \return 0 if successful.
+ * \return #MBEDTLS_ERR_MPI_ALLOC_FAILED if there is not enough space
+ * to store the value of Montgomery constant squared.
+ * \return #MBEDTLS_ERR_MPI_DIVISION_BY_ZERO if \p N modulus is zero.
+ * \return #MBEDTLS_ERR_MPI_NEGATIVE_VALUE if \p N modulus is negative.
+ */
+int mbedtls_mpi_get_mont_r2_unsafe(mbedtls_mpi *X,
+ const mbedtls_mpi *N);
+
+/**
+ * \brief Calculate initialisation value for fast Montgomery modular
+ * multiplication
+ *
+ * \param[in] N Little-endian presentation of the modulus. This must have
+ * at least one limb.
+ *
+ * \return The initialisation value for fast Montgomery modular multiplication
+ */
+mbedtls_mpi_uint mbedtls_mpi_montmul_init(const mbedtls_mpi_uint *N);
+
+/** Montgomery multiplication: A = A * B * R^-1 mod N (HAC 14.36)
+ *
+ * \param[in,out] A One of the numbers to multiply.
+ * It must have at least as many limbs as N
+ * (A->n >= N->n), and any limbs beyond n are ignored.
+ * On successful completion, A contains the result of
+ * the multiplication A * B * R^-1 mod N where
+ * R = (2^ciL)^n.
+ * \param[in] B One of the numbers to multiply.
+ * It must be nonzero and must not have more limbs than N
+ * (B->n <= N->n).
+ * \param[in] N The modulo. N must be odd.
+ * \param mm The value calculated by
+ * `mbedtls_mpi_montg_init(&mm, N)`.
+ * This is -N^-1 mod 2^ciL.
+ * \param[in,out] T A bignum for temporary storage.
+ * It must be at least twice the limb size of N plus 2
+ * (T->n >= 2 * (N->n + 1)).
+ * Its initial content is unused and
+ * its final content is indeterminate.
+ * Note that unlike the usual convention in the library
+ * for `const mbedtls_mpi*`, the content of T can change.
+ */
+void mbedtls_mpi_montmul(mbedtls_mpi *A,
+ const mbedtls_mpi *B,
+ const mbedtls_mpi *N,
+ mbedtls_mpi_uint mm,
+ const mbedtls_mpi *T);
+
+#endif /* MBEDTLS_BIGNUM_INTERNAL_H */
* Blowfish implementation
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
/*
* The Blowfish block cipher was designed by Bruce Schneier in 1993.
* Camellia implementation
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
/*
* The Camellia block cipher was designed by NTT and Mitsubishi Electric
* NIST SP800-38C compliant CCM implementation
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
/*
#include "mbedtls/ccm.h"
#include "mbedtls/platform_util.h"
#include "mbedtls/error.h"
+#include "mbedtls/constant_time.h"
#include <string.h>
{
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
unsigned char check_tag[16];
- unsigned char i;
int diff;
CCM_VALIDATE_RET(ctx != NULL);
}
/* Check tag in "constant-time" */
- for (diff = 0, i = 0; i < tag_len; i++) {
- diff |= tag[i] ^ check_tag[i];
- }
+ diff = mbedtls_ct_memcmp(tag, check_tag, tag_len);
if (diff != 0) {
mbedtls_platform_zeroize(output, length);
* X.509 test certificates
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#include "common.h"
/* This is taken from tests/data_files/test-ca2.crt */
/* BEGIN FILE string macro TEST_CA_CRT_EC_PEM tests/data_files/test-ca2.crt */
-#define TEST_CA_CRT_EC_PEM \
- "-----BEGIN CERTIFICATE-----\r\n" \
- "MIICBDCCAYigAwIBAgIJAMFD4n5iQ8zoMAwGCCqGSM49BAMCBQAwPjELMAkGA1UE\r\n" \
- "BhMCTkwxETAPBgNVBAoMCFBvbGFyU1NMMRwwGgYDVQQDDBNQb2xhcnNzbCBUZXN0\r\n" \
- "IEVDIENBMB4XDTE5MDIxMDE0NDQwMFoXDTI5MDIxMDE0NDQwMFowPjELMAkGA1UE\r\n" \
- "BhMCTkwxETAPBgNVBAoMCFBvbGFyU1NMMRwwGgYDVQQDDBNQb2xhcnNzbCBUZXN0\r\n" \
- "IEVDIENBMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEw9orNEE3WC+HVv78ibopQ0tO\r\n" \
- "4G7DDldTMzlY1FK0kZU5CyPfXxckYkj8GpUpziwth8KIUoCv1mqrId240xxuWLjK\r\n" \
- "6LJpjvNBrSnDtF91p0dv1RkpVWmaUzsgtGYWYDMeo1AwTjAMBgNVHRMEBTADAQH/\r\n" \
- "MB0GA1UdDgQWBBSdbSAkSQE/K8t4tRm8fiTJ2/s2fDAfBgNVHSMEGDAWgBSdbSAk\r\n" \
- "SQE/K8t4tRm8fiTJ2/s2fDAMBggqhkjOPQQDAgUAA2gAMGUCMFHKrjAPpHB0BN1a\r\n" \
- "LH8TwcJ3vh0AxeKZj30mRdOKBmg/jLS3rU3g8VQBHpn8sOTTBwIxANxPO5AerimZ\r\n" \
- "hCjMe0d4CTHf1gFZMF70+IqEP+o5VHsIp2Cqvflb0VGWFC5l9a4cQg==\r\n" \
+#define TEST_CA_CRT_EC_PEM \
+ "-----BEGIN CERTIFICATE-----\r\n" \
+ "MIICBDCCAYigAwIBAgIJAMFD4n5iQ8zoMAwGCCqGSM49BAMCBQAwPjELMAkGA1UE\r\n" \
+ "BhMCTkwxETAPBgNVBAoMCFBvbGFyU1NMMRwwGgYDVQQDDBNQb2xhcnNzbCBUZXN0\r\n" \
+ "IEVDIENBMB4XDTE5MDIxMDE0NDQwMFoXDTI5MDIxMDE0NDQwMFowPjELMAkGA1UE\r\n" \
+ "BhMCTkwxETAPBgNVBAoMCFBvbGFyU1NMMRwwGgYDVQQDDBNQb2xhcnNzbCBUZXN0\r\n" \
+ "IEVDIENBMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEw9orNEE3WC+HVv78ibopQ0tO\r\n" \
+ "4G7DDldTMzlY1FK0kZU5CyPfXxckYkj8GpUpziwth8KIUoCv1mqrId240xxuWLjK\r\n" \
+ "6LJpjvNBrSnDtF91p0dv1RkpVWmaUzsgtGYWYDMeo1AwTjAMBgNVHRMEBTADAQH/\r\n" \
+ "MB0GA1UdDgQWBBSdbSAkSQE/K8t4tRm8fiTJ2/s2fDAfBgNVHSMEGDAWgBSdbSAk\r\n" \
+ "SQE/K8t4tRm8fiTJ2/s2fDAMBggqhkjOPQQDAgUAA2gAMGUCMFHKrjAPpHB0BN1a\r\n" \
+ "LH8TwcJ3vh0AxeKZj30mRdOKBmg/jLS3rU3g8VQBHpn8sOTTBwIxANxPO5AerimZ\r\n" \
+ "hCjMe0d4CTHf1gFZMF70+IqEP+o5VHsIp2Cqvflb0VGWFC5l9a4cQg==\r\n" \
"-----END CERTIFICATE-----\r\n"
/* END FILE */
/* This is generated from tests/data_files/test-ca2.crt.der using `xxd -i`. */
/* BEGIN FILE binary macro TEST_CA_CRT_EC_DER tests/data_files/test-ca2.crt.der */
-#define TEST_CA_CRT_EC_DER { \
- 0x30, 0x82, 0x02, 0x04, 0x30, 0x82, 0x01, 0x88, 0xa0, 0x03, 0x02, 0x01, \
- 0x02, 0x02, 0x09, 0x00, 0xc1, 0x43, 0xe2, 0x7e, 0x62, 0x43, 0xcc, 0xe8, \
- 0x30, 0x0c, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, \
- 0x05, 0x00, 0x30, 0x3e, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, \
- 0x06, 0x13, 0x02, 0x4e, 0x4c, 0x31, 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, \
- 0x04, 0x0a, 0x0c, 0x08, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x53, 0x53, 0x4c, \
- 0x31, 0x1c, 0x30, 0x1a, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x13, 0x50, \
- 0x6f, 0x6c, 0x61, 0x72, 0x73, 0x73, 0x6c, 0x20, 0x54, 0x65, 0x73, 0x74, \
- 0x20, 0x45, 0x43, 0x20, 0x43, 0x41, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x39, \
- 0x30, 0x32, 0x31, 0x30, 0x31, 0x34, 0x34, 0x34, 0x30, 0x30, 0x5a, 0x17, \
- 0x0d, 0x32, 0x39, 0x30, 0x32, 0x31, 0x30, 0x31, 0x34, 0x34, 0x34, 0x30, \
- 0x30, 0x5a, 0x30, 0x3e, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, \
- 0x06, 0x13, 0x02, 0x4e, 0x4c, 0x31, 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, \
- 0x04, 0x0a, 0x0c, 0x08, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x53, 0x53, 0x4c, \
- 0x31, 0x1c, 0x30, 0x1a, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x13, 0x50, \
- 0x6f, 0x6c, 0x61, 0x72, 0x73, 0x73, 0x6c, 0x20, 0x54, 0x65, 0x73, 0x74, \
- 0x20, 0x45, 0x43, 0x20, 0x43, 0x41, 0x30, 0x76, 0x30, 0x10, 0x06, 0x07, \
- 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x05, 0x2b, 0x81, 0x04, \
- 0x00, 0x22, 0x03, 0x62, 0x00, 0x04, 0xc3, 0xda, 0x2b, 0x34, 0x41, 0x37, \
- 0x58, 0x2f, 0x87, 0x56, 0xfe, 0xfc, 0x89, 0xba, 0x29, 0x43, 0x4b, 0x4e, \
- 0xe0, 0x6e, 0xc3, 0x0e, 0x57, 0x53, 0x33, 0x39, 0x58, 0xd4, 0x52, 0xb4, \
- 0x91, 0x95, 0x39, 0x0b, 0x23, 0xdf, 0x5f, 0x17, 0x24, 0x62, 0x48, 0xfc, \
- 0x1a, 0x95, 0x29, 0xce, 0x2c, 0x2d, 0x87, 0xc2, 0x88, 0x52, 0x80, 0xaf, \
- 0xd6, 0x6a, 0xab, 0x21, 0xdd, 0xb8, 0xd3, 0x1c, 0x6e, 0x58, 0xb8, 0xca, \
- 0xe8, 0xb2, 0x69, 0x8e, 0xf3, 0x41, 0xad, 0x29, 0xc3, 0xb4, 0x5f, 0x75, \
- 0xa7, 0x47, 0x6f, 0xd5, 0x19, 0x29, 0x55, 0x69, 0x9a, 0x53, 0x3b, 0x20, \
- 0xb4, 0x66, 0x16, 0x60, 0x33, 0x1e, 0xa3, 0x50, 0x30, 0x4e, 0x30, 0x0c, \
- 0x06, 0x03, 0x55, 0x1d, 0x13, 0x04, 0x05, 0x30, 0x03, 0x01, 0x01, 0xff, \
- 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0x9d, \
- 0x6d, 0x20, 0x24, 0x49, 0x01, 0x3f, 0x2b, 0xcb, 0x78, 0xb5, 0x19, 0xbc, \
- 0x7e, 0x24, 0xc9, 0xdb, 0xfb, 0x36, 0x7c, 0x30, 0x1f, 0x06, 0x03, 0x55, \
- 0x1d, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14, 0x9d, 0x6d, 0x20, 0x24, \
- 0x49, 0x01, 0x3f, 0x2b, 0xcb, 0x78, 0xb5, 0x19, 0xbc, 0x7e, 0x24, 0xc9, \
- 0xdb, 0xfb, 0x36, 0x7c, 0x30, 0x0c, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, \
- 0x3d, 0x04, 0x03, 0x02, 0x05, 0x00, 0x03, 0x68, 0x00, 0x30, 0x65, 0x02, \
- 0x30, 0x51, 0xca, 0xae, 0x30, 0x0f, 0xa4, 0x70, 0x74, 0x04, 0xdd, 0x5a, \
- 0x2c, 0x7f, 0x13, 0xc1, 0xc2, 0x77, 0xbe, 0x1d, 0x00, 0xc5, 0xe2, 0x99, \
- 0x8f, 0x7d, 0x26, 0x45, 0xd3, 0x8a, 0x06, 0x68, 0x3f, 0x8c, 0xb4, 0xb7, \
- 0xad, 0x4d, 0xe0, 0xf1, 0x54, 0x01, 0x1e, 0x99, 0xfc, 0xb0, 0xe4, 0xd3, \
- 0x07, 0x02, 0x31, 0x00, 0xdc, 0x4f, 0x3b, 0x90, 0x1e, 0xae, 0x29, 0x99, \
- 0x84, 0x28, 0xcc, 0x7b, 0x47, 0x78, 0x09, 0x31, 0xdf, 0xd6, 0x01, 0x59, \
- 0x30, 0x5e, 0xf4, 0xf8, 0x8a, 0x84, 0x3f, 0xea, 0x39, 0x54, 0x7b, 0x08, \
- 0xa7, 0x60, 0xaa, 0xbd, 0xf9, 0x5b, 0xd1, 0x51, 0x96, 0x14, 0x2e, 0x65, \
- 0xf5, 0xae, 0x1c, 0x42 \
+#define TEST_CA_CRT_EC_DER { \
+ 0x30, 0x82, 0x02, 0x04, 0x30, 0x82, 0x01, 0x88, 0xa0, 0x03, 0x02, 0x01, \
+ 0x02, 0x02, 0x09, 0x00, 0xc1, 0x43, 0xe2, 0x7e, 0x62, 0x43, 0xcc, 0xe8, \
+ 0x30, 0x0c, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, \
+ 0x05, 0x00, 0x30, 0x3e, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, \
+ 0x06, 0x13, 0x02, 0x4e, 0x4c, 0x31, 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, \
+ 0x04, 0x0a, 0x0c, 0x08, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x53, 0x53, 0x4c, \
+ 0x31, 0x1c, 0x30, 0x1a, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x13, 0x50, \
+ 0x6f, 0x6c, 0x61, 0x72, 0x73, 0x73, 0x6c, 0x20, 0x54, 0x65, 0x73, 0x74, \
+ 0x20, 0x45, 0x43, 0x20, 0x43, 0x41, 0x30, 0x1e, 0x17, 0x0d, 0x31, 0x39, \
+ 0x30, 0x32, 0x31, 0x30, 0x31, 0x34, 0x34, 0x34, 0x30, 0x30, 0x5a, 0x17, \
+ 0x0d, 0x32, 0x39, 0x30, 0x32, 0x31, 0x30, 0x31, 0x34, 0x34, 0x34, 0x30, \
+ 0x30, 0x5a, 0x30, 0x3e, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, \
+ 0x06, 0x13, 0x02, 0x4e, 0x4c, 0x31, 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, \
+ 0x04, 0x0a, 0x0c, 0x08, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x53, 0x53, 0x4c, \
+ 0x31, 0x1c, 0x30, 0x1a, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x13, 0x50, \
+ 0x6f, 0x6c, 0x61, 0x72, 0x73, 0x73, 0x6c, 0x20, 0x54, 0x65, 0x73, 0x74, \
+ 0x20, 0x45, 0x43, 0x20, 0x43, 0x41, 0x30, 0x76, 0x30, 0x10, 0x06, 0x07, \
+ 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x05, 0x2b, 0x81, 0x04, \
+ 0x00, 0x22, 0x03, 0x62, 0x00, 0x04, 0xc3, 0xda, 0x2b, 0x34, 0x41, 0x37, \
+ 0x58, 0x2f, 0x87, 0x56, 0xfe, 0xfc, 0x89, 0xba, 0x29, 0x43, 0x4b, 0x4e, \
+ 0xe0, 0x6e, 0xc3, 0x0e, 0x57, 0x53, 0x33, 0x39, 0x58, 0xd4, 0x52, 0xb4, \
+ 0x91, 0x95, 0x39, 0x0b, 0x23, 0xdf, 0x5f, 0x17, 0x24, 0x62, 0x48, 0xfc, \
+ 0x1a, 0x95, 0x29, 0xce, 0x2c, 0x2d, 0x87, 0xc2, 0x88, 0x52, 0x80, 0xaf, \
+ 0xd6, 0x6a, 0xab, 0x21, 0xdd, 0xb8, 0xd3, 0x1c, 0x6e, 0x58, 0xb8, 0xca, \
+ 0xe8, 0xb2, 0x69, 0x8e, 0xf3, 0x41, 0xad, 0x29, 0xc3, 0xb4, 0x5f, 0x75, \
+ 0xa7, 0x47, 0x6f, 0xd5, 0x19, 0x29, 0x55, 0x69, 0x9a, 0x53, 0x3b, 0x20, \
+ 0xb4, 0x66, 0x16, 0x60, 0x33, 0x1e, 0xa3, 0x50, 0x30, 0x4e, 0x30, 0x0c, \
+ 0x06, 0x03, 0x55, 0x1d, 0x13, 0x04, 0x05, 0x30, 0x03, 0x01, 0x01, 0xff, \
+ 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0x9d, \
+ 0x6d, 0x20, 0x24, 0x49, 0x01, 0x3f, 0x2b, 0xcb, 0x78, 0xb5, 0x19, 0xbc, \
+ 0x7e, 0x24, 0xc9, 0xdb, 0xfb, 0x36, 0x7c, 0x30, 0x1f, 0x06, 0x03, 0x55, \
+ 0x1d, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14, 0x9d, 0x6d, 0x20, 0x24, \
+ 0x49, 0x01, 0x3f, 0x2b, 0xcb, 0x78, 0xb5, 0x19, 0xbc, 0x7e, 0x24, 0xc9, \
+ 0xdb, 0xfb, 0x36, 0x7c, 0x30, 0x0c, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, \
+ 0x3d, 0x04, 0x03, 0x02, 0x05, 0x00, 0x03, 0x68, 0x00, 0x30, 0x65, 0x02, \
+ 0x30, 0x51, 0xca, 0xae, 0x30, 0x0f, 0xa4, 0x70, 0x74, 0x04, 0xdd, 0x5a, \
+ 0x2c, 0x7f, 0x13, 0xc1, 0xc2, 0x77, 0xbe, 0x1d, 0x00, 0xc5, 0xe2, 0x99, \
+ 0x8f, 0x7d, 0x26, 0x45, 0xd3, 0x8a, 0x06, 0x68, 0x3f, 0x8c, 0xb4, 0xb7, \
+ 0xad, 0x4d, 0xe0, 0xf1, 0x54, 0x01, 0x1e, 0x99, 0xfc, 0xb0, 0xe4, 0xd3, \
+ 0x07, 0x02, 0x31, 0x00, 0xdc, 0x4f, 0x3b, 0x90, 0x1e, 0xae, 0x29, 0x99, \
+ 0x84, 0x28, 0xcc, 0x7b, 0x47, 0x78, 0x09, 0x31, 0xdf, 0xd6, 0x01, 0x59, \
+ 0x30, 0x5e, 0xf4, 0xf8, 0x8a, 0x84, 0x3f, 0xea, 0x39, 0x54, 0x7b, 0x08, \
+ 0xa7, 0x60, 0xaa, 0xbd, 0xf9, 0x5b, 0xd1, 0x51, 0x96, 0x14, 0x2e, 0x65, \
+ 0xf5, 0xae, 0x1c, 0x42 \
}
/* END FILE */
#define TEST_CA_KEY_RSA_PEM \
"-----BEGIN RSA PRIVATE KEY-----\r\n" \
"Proc-Type: 4,ENCRYPTED\r\n" \
- "DEK-Info: DES-EDE3-CBC,A8A95B05D5B7206B\r\n" \
+ "AES-128-CBC,781840E6B804AE83D2AF71127C4CE314\r\n" \
"\r\n" \
- "9Qd9GeArejl1GDVh2lLV1bHt0cPtfbh5h/5zVpAVaFpqtSPMrElp50Rntn9et+JA\r\n" \
- "7VOyboR+Iy2t/HU4WvA687k3Bppe9GwKHjHhtl//8xFKwZr3Xb5yO5JUP8AUctQq\r\n" \
- "Nb8CLlZyuUC+52REAAthdWgsX+7dJO4yabzUcQ22Tp9JSD0hiL43BlkWYUNK3dAo\r\n" \
- "PZlmiptjnzVTjg1MxsBSydZinWOLBV8/JQgxSPo2yD4uEfig28qbvQ2wNIn0pnAb\r\n" \
- "GxnSAOazkongEGfvcjIIs+LZN9gXFhxcOh6kc4Q/c99B7QWETwLLkYgZ+z1a9VY9\r\n" \
- "gEU7CwCxYCD+h9hY6FPmsK0/lC4O7aeRKpYq00rPPxs6i7phiexg6ax6yTMmArQq\r\n" \
- "QmK3TAsJm8V/J5AWpLEV6jAFgRGymGGHnof0DXzVWZidrcZJWTNuGEX90nB3ee2w\r\n" \
- "PXJEFWKoD3K3aFcSLdHYr3mLGxP7H9ThQai9VsycxZKS5kwvBKQ//YMrmFfwPk8x\r\n" \
- "vTeY4KZMaUrveEel5tWZC94RSMKgxR6cyE1nBXyTQnDOGbfpNNgBKxyKbINWoOJU\r\n" \
- "WJZAwlsQn+QzCDwpri7+sV1mS3gBE6UY7aQmnmiiaC2V3Hbphxct/en5QsfDOt1X\r\n" \
- "JczSfpRWLlbPznZg8OQh/VgCMA58N5DjOzTIK7sJJ5r+94ZBTCpgAMbF588f0NTR\r\n" \
- "KCe4yrxGJR7X02M4nvD4IwOlpsQ8xQxZtOSgXv4LkxvdU9XJJKWZ/XNKJeWztxSe\r\n" \
- "Z1vdTc2YfsDBA2SEv33vxHx2g1vqtw8SjDRT2RaQSS0QuSaMJimdOX6mTOCBKk1J\r\n" \
- "9Q5mXTrER+/LnK0jEmXsBXWA5bqqVZIyahXSx4VYZ7l7w/PHiUDtDgyRhMMKi4n2\r\n" \
- "iQvQcWSQTjrpnlJbca1/DkpRt3YwrvJwdqb8asZU2VrNETh5x0QVefDRLFiVpif/\r\n" \
- "tUaeAe/P1F8OkS7OIZDs1SUbv/sD2vMbhNkUoCms3/PvNtdnvgL4F0zhaDpKCmlT\r\n" \
- "P8vx49E7v5CyRNmED9zZg4o3wmMqrQO93PtTug3Eu9oVx1zPQM1NVMyBa2+f29DL\r\n" \
- "1nuTCeXdo9+ni45xx+jAI4DCwrRdhJ9uzZyC6962H37H6D+5naNvClFR1s6li1Gb\r\n" \
- "nqPoiy/OBsEx9CaDGcqQBp5Wme/3XW+6z1ISOx+igwNTVCT14mHdBMbya0eIKft5\r\n" \
- "X+GnwtgEMyCYyyWuUct8g4RzErcY9+yW9Om5Hzpx4zOuW4NPZgPDTgK+t2RSL/Yq\r\n" \
- "rE1njrgeGYcVeG3f+OftH4s6fPbq7t1A5ZgUscbLMBqr9tK+OqygR4EgKBPsH6Cz\r\n" \
- "L6zlv/2RV0qAHvVuDJcIDIgwY5rJtINEm32rhOeFNJwZS5MNIC1czXZx5//ugX7l\r\n" \
- "I4sy5nbVhwSjtAk8Xg5dZbdTZ6mIrb7xqH+fdakZor1khG7bC2uIwibD3cSl2XkR\r\n" \
- "wN48lslbHnqqagr6Xm1nNOSVl8C/6kbJEsMpLhAezfRtGwvOucoaE+WbeUNolGde\r\n" \
- "P/eQiddSf0brnpiLJRh7qZrl9XuqYdpUqnoEdMAfotDOID8OtV7gt8a48ad8VPW2\r\n" \
+ "etQ3xgGLbuYF9vR1km03TH5fwfly1hOlix0PtfQ+t9HG065vTtSEHYc/OyHwdy79\r\n" \
+ "NCLX5RUrPh06E/XlKzMNVHAXqkwFnIwNzRLsOozeP1L7iZEZb9QMeiN5Org+btCO\r\n" \
+ "bylXPB4YirfuE7GSJalWY/pq3FQtD33zTIKmNhXfVj3sbwGI/8D9XjaKUb8PODOB\r\n" \
+ "skOalmx6RvYRvg0lmRxB3+T3wejIsrrDPweYqte9B6dVHIVG1ZmvoA6/wnKZZZeV\r\n" \
+ "sjj8OpL3OwUBrjuGSknE9Rs6kCuSCbHOYVK8VzcZmCYpie0TFnb3Sk8M6vjfW+45\r\n" \
+ "U7WUMlSAPxKH6lJDzWdwHqLvsVJwuNnaAaBXg9/8U/rzQEWuq8Ar3s8fw2Jg3F1G\r\n" \
+ "L6N5ZAEfCz3Sa0N9WKafR/RSQj+rq8Z3w4POAafhbzk249uo5K8B1Z3cQwLxeXIl\r\n" \
+ "UbRQz1TZy4oNTfQzCahYruPNyvwgTkfwAFFvbLAdaiJd2ZtLBoqYE64TYakYnvcC\r\n" \
+ "itim1bmySIKoxlMfBGFmMuF03epT0pSx701jlGzGi0l0m16NEjoVxDwo5j93SmiM\r\n" \
+ "sQdjC1lOGk2iCLkphIQqHFjFJYWjvh1UUIqWZf+ZWOOxlf4x9a1pUVj6FvtECxNB\r\n" \
+ "/mA/m4Iq4LAuVXHE1MpHeq067lJ6wWlrsb2WVmiNGfQ2AC7fMtpcPuunBVT9NV1m\r\n" \
+ "1rbDzIgLIWAzqz/cy3N8Q8vfxnrFtmNUyM191Zyq+YF14hIKWX9J1qR4LXwWAzVV\r\n" \
+ "UrC8IL4pA2mtRkW4qFsB0EmHAxO/cedDTPjVFty5WSzhNuvYZxX45HAkGIfK6d21\r\n" \
+ "7WHPhHG+zaaUTWMUVixB0IcKp6RecjYPFzBHS0YeX88Ue2cyT/90jMiQ9ssOgRrG\r\n" \
+ "ZJRJvZAc3TSCnY9sNPYoGrJPiZuCnlUj3ENNurYVy12ai0WFxwnNUZjRUhDS6hjm\r\n" \
+ "cDHD5TlI9MZ6M+Mb/Bw4Ig8HuTHOtQBYD9vhtXsG+B7H/j6cS+1umaKjrnG/kK4W\r\n" \
+ "R6YXwM2faAi+DwgjjoMXSzRqSTF8PdTIWbAXo3bc2qsXPTMBA8PEp4nb5scHZ4Ts\r\n" \
+ "EcBNp2jv0j4gBkRmGIab17cWMrlagjFy89DhqZUFwKdeZs+yJ92A5xstWxOUfpEP\r\n" \
+ "90T/bsp1G5d7WW5fl2TRJvYJNDM+djkKIh0zCkduiZ36oVM6nDdbjmXqjQXopeSD\r\n" \
+ "gtOourBRF8g99W0fW8QT+yPhP0Pkyz6EG8eQO6Zwh439xdoVwu9jUzQAPmZ0uNeR\r\n" \
+ "xTXXihYyv72z27rInjLiIPXL25K9eDVLlcSR3RyG7YYgjdQAL2VJDLcBz5jox1uQ\r\n" \
+ "0guoD5wmfu2FWLqYE7HeTYntdY53lCflwq0GHRMjrrsVpx+5VDQ6Yi47Ny9SWLcp\r\n" \
+ "fPI3iBkXuGRWupzs6N4pQdSO0dU28KfpMM5QvFoLIn67brCHEQij4dgFrCTYEyBX\r\n" \
+ "9+jiNImUFYUhAFuxvUbfZt4O/ABLIElvHLfJs1oYCmI/nWpvLFqXB5rnzPNfEi0H\r\n" \
+ "PGGe1Hj/t+CJIp/6ios3yNy2QtXO754TZH2UVu51Ykyig5PFjZVoUkbRvHQYcWfU\r\n" \
"-----END RSA PRIVATE KEY-----\r\n"
/* END FILE */
/* This is taken from tests/data_files/server5.crt. */
/* BEGIN FILE string macro TEST_SRV_CRT_EC_PEM tests/data_files/server5.crt */
-#define TEST_SRV_CRT_EC_PEM \
- "-----BEGIN CERTIFICATE-----\r\n" \
- "MIICHzCCAaWgAwIBAgIBCTAKBggqhkjOPQQDAjA+MQswCQYDVQQGEwJOTDERMA8G\r\n" \
- "A1UEChMIUG9sYXJTU0wxHDAaBgNVBAMTE1BvbGFyc3NsIFRlc3QgRUMgQ0EwHhcN\r\n" \
- "MTMwOTI0MTU1MjA0WhcNMjMwOTIyMTU1MjA0WjA0MQswCQYDVQQGEwJOTDERMA8G\r\n" \
- "A1UEChMIUG9sYXJTU0wxEjAQBgNVBAMTCWxvY2FsaG9zdDBZMBMGByqGSM49AgEG\r\n" \
- "CCqGSM49AwEHA0IABDfMVtl2CR5acj7HWS3/IG7ufPkGkXTQrRS192giWWKSTuUA\r\n" \
- "2CMR/+ov0jRdXRa9iojCa3cNVc2KKg76Aci07f+jgZ0wgZowCQYDVR0TBAIwADAd\r\n" \
- "BgNVHQ4EFgQUUGGlj9QH2deCAQzlZX+MY0anE74wbgYDVR0jBGcwZYAUnW0gJEkB\r\n" \
- "PyvLeLUZvH4kydv7NnyhQqRAMD4xCzAJBgNVBAYTAk5MMREwDwYDVQQKEwhQb2xh\r\n" \
- "clNTTDEcMBoGA1UEAxMTUG9sYXJzc2wgVGVzdCBFQyBDQYIJAMFD4n5iQ8zoMAoG\r\n" \
- "CCqGSM49BAMCA2gAMGUCMQCaLFzXptui5WQN8LlO3ddh1hMxx6tzgLvT03MTVK2S\r\n" \
- "C12r0Lz3ri/moSEpNZWqPjkCMCE2f53GXcYLqyfyJR078c/xNSUU5+Xxl7VZ414V\r\n" \
- "fGa5kHvHARBPc8YAIVIqDvHH1Q==\r\n" \
+#define TEST_SRV_CRT_EC_PEM \
+ "-----BEGIN CERTIFICATE-----\r\n" \
+ "MIICHzCCAaWgAwIBAgIBCTAKBggqhkjOPQQDAjA+MQswCQYDVQQGEwJOTDERMA8G\r\n" \
+ "A1UECgwIUG9sYXJTU0wxHDAaBgNVBAMME1BvbGFyc3NsIFRlc3QgRUMgQ0EwHhcN\r\n" \
+ "MjMwNjE1MDMzNDE4WhcNMzMwNjEyMDMzNDE4WjA0MQswCQYDVQQGEwJOTDERMA8G\r\n" \
+ "A1UECgwIUG9sYXJTU0wxEjAQBgNVBAMMCWxvY2FsaG9zdDBZMBMGByqGSM49AgEG\r\n" \
+ "CCqGSM49AwEHA0IABDfMVtl2CR5acj7HWS3/IG7ufPkGkXTQrRS192giWWKSTuUA\r\n" \
+ "2CMR/+ov0jRdXRa9iojCa3cNVc2KKg76Aci07f+jgZ0wgZowCQYDVR0TBAIwADAd\r\n" \
+ "BgNVHQ4EFgQUUGGlj9QH2deCAQzlZX+MY0anE74wbgYDVR0jBGcwZYAUnW0gJEkB\r\n" \
+ "PyvLeLUZvH4kydv7NnyhQqRAMD4xCzAJBgNVBAYTAk5MMREwDwYDVQQKDAhQb2xh\r\n" \
+ "clNTTDEcMBoGA1UEAwwTUG9sYXJzc2wgVGVzdCBFQyBDQYIJAMFD4n5iQ8zoMAoG\r\n" \
+ "CCqGSM49BAMCA2gAMGUCMAHFbGEzx8dZaUlIltT5s1QO9FvKmvFer4uRY3ntEy9S\r\n" \
+ "k7DCCozM86WWLjfzbJ78bwIxAJYRPF1CzNEiXPHb9O46ZPHKo2S5x//g/54RowAK\r\n" \
+ "uZz+hKPuMi6YY6cIm81jfeaSZQ==\r\n" \
"-----END CERTIFICATE-----\r\n"
/* END FILE */
/* This is generated from tests/data_files/server5.crt.der using `xxd -i`. */
/* BEGIN FILE binary macro TEST_SRV_CRT_EC_DER tests/data_files/server5.crt.der */
-#define TEST_SRV_CRT_EC_DER { \
- 0x30, 0x82, 0x02, 0x1f, 0x30, 0x82, 0x01, 0xa5, 0xa0, 0x03, 0x02, 0x01, \
- 0x02, 0x02, 0x01, 0x09, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, \
- 0x3d, 0x04, 0x03, 0x02, 0x30, 0x3e, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, \
- 0x55, 0x04, 0x06, 0x13, 0x02, 0x4e, 0x4c, 0x31, 0x11, 0x30, 0x0f, 0x06, \
- 0x03, 0x55, 0x04, 0x0a, 0x13, 0x08, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x53, \
- 0x53, 0x4c, 0x31, 0x1c, 0x30, 0x1a, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, \
- 0x13, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x73, 0x73, 0x6c, 0x20, 0x54, 0x65, \
- 0x73, 0x74, 0x20, 0x45, 0x43, 0x20, 0x43, 0x41, 0x30, 0x1e, 0x17, 0x0d, \
- 0x31, 0x33, 0x30, 0x39, 0x32, 0x34, 0x31, 0x35, 0x35, 0x32, 0x30, 0x34, \
- 0x5a, 0x17, 0x0d, 0x32, 0x33, 0x30, 0x39, 0x32, 0x32, 0x31, 0x35, 0x35, \
- 0x32, 0x30, 0x34, 0x5a, 0x30, 0x34, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, \
- 0x55, 0x04, 0x06, 0x13, 0x02, 0x4e, 0x4c, 0x31, 0x11, 0x30, 0x0f, 0x06, \
- 0x03, 0x55, 0x04, 0x0a, 0x13, 0x08, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x53, \
- 0x53, 0x4c, 0x31, 0x12, 0x30, 0x10, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, \
- 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x68, 0x6f, 0x73, 0x74, 0x30, 0x59, \
- 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, \
- 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0x03, 0x42, 0x00, \
- 0x04, 0x37, 0xcc, 0x56, 0xd9, 0x76, 0x09, 0x1e, 0x5a, 0x72, 0x3e, 0xc7, \
- 0x59, 0x2d, 0xff, 0x20, 0x6e, 0xee, 0x7c, 0xf9, 0x06, 0x91, 0x74, 0xd0, \
- 0xad, 0x14, 0xb5, 0xf7, 0x68, 0x22, 0x59, 0x62, 0x92, 0x4e, 0xe5, 0x00, \
- 0xd8, 0x23, 0x11, 0xff, 0xea, 0x2f, 0xd2, 0x34, 0x5d, 0x5d, 0x16, 0xbd, \
- 0x8a, 0x88, 0xc2, 0x6b, 0x77, 0x0d, 0x55, 0xcd, 0x8a, 0x2a, 0x0e, 0xfa, \
- 0x01, 0xc8, 0xb4, 0xed, 0xff, 0xa3, 0x81, 0x9d, 0x30, 0x81, 0x9a, 0x30, \
- 0x09, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x04, 0x02, 0x30, 0x00, 0x30, 0x1d, \
- 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0x50, 0x61, 0xa5, \
- 0x8f, 0xd4, 0x07, 0xd9, 0xd7, 0x82, 0x01, 0x0c, 0xe5, 0x65, 0x7f, 0x8c, \
- 0x63, 0x46, 0xa7, 0x13, 0xbe, 0x30, 0x6e, 0x06, 0x03, 0x55, 0x1d, 0x23, \
- 0x04, 0x67, 0x30, 0x65, 0x80, 0x14, 0x9d, 0x6d, 0x20, 0x24, 0x49, 0x01, \
- 0x3f, 0x2b, 0xcb, 0x78, 0xb5, 0x19, 0xbc, 0x7e, 0x24, 0xc9, 0xdb, 0xfb, \
- 0x36, 0x7c, 0xa1, 0x42, 0xa4, 0x40, 0x30, 0x3e, 0x31, 0x0b, 0x30, 0x09, \
- 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x4e, 0x4c, 0x31, 0x11, 0x30, \
- 0x0f, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x08, 0x50, 0x6f, 0x6c, 0x61, \
- 0x72, 0x53, 0x53, 0x4c, 0x31, 0x1c, 0x30, 0x1a, 0x06, 0x03, 0x55, 0x04, \
- 0x03, 0x13, 0x13, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x73, 0x73, 0x6c, 0x20, \
- 0x54, 0x65, 0x73, 0x74, 0x20, 0x45, 0x43, 0x20, 0x43, 0x41, 0x82, 0x09, \
- 0x00, 0xc1, 0x43, 0xe2, 0x7e, 0x62, 0x43, 0xcc, 0xe8, 0x30, 0x0a, 0x06, \
- 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x03, 0x68, 0x00, \
- 0x30, 0x65, 0x02, 0x31, 0x00, 0x9a, 0x2c, 0x5c, 0xd7, 0xa6, 0xdb, 0xa2, \
- 0xe5, 0x64, 0x0d, 0xf0, 0xb9, 0x4e, 0xdd, 0xd7, 0x61, 0xd6, 0x13, 0x31, \
- 0xc7, 0xab, 0x73, 0x80, 0xbb, 0xd3, 0xd3, 0x73, 0x13, 0x54, 0xad, 0x92, \
- 0x0b, 0x5d, 0xab, 0xd0, 0xbc, 0xf7, 0xae, 0x2f, 0xe6, 0xa1, 0x21, 0x29, \
- 0x35, 0x95, 0xaa, 0x3e, 0x39, 0x02, 0x30, 0x21, 0x36, 0x7f, 0x9d, 0xc6, \
- 0x5d, 0xc6, 0x0b, 0xab, 0x27, 0xf2, 0x25, 0x1d, 0x3b, 0xf1, 0xcf, 0xf1, \
- 0x35, 0x25, 0x14, 0xe7, 0xe5, 0xf1, 0x97, 0xb5, 0x59, 0xe3, 0x5e, 0x15, \
- 0x7c, 0x66, 0xb9, 0x90, 0x7b, 0xc7, 0x01, 0x10, 0x4f, 0x73, 0xc6, 0x00, \
- 0x21, 0x52, 0x2a, 0x0e, 0xf1, 0xc7, 0xd5 \
+#define TEST_SRV_CRT_EC_DER { \
+ 0x30, 0x82, 0x02, 0x1f, 0x30, 0x82, 0x01, 0xa5, 0xa0, 0x03, 0x02, 0x01, \
+ 0x02, 0x02, 0x01, 0x09, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, \
+ 0x3d, 0x04, 0x03, 0x02, 0x30, 0x3e, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, \
+ 0x55, 0x04, 0x06, 0x13, 0x02, 0x4e, 0x4c, 0x31, 0x11, 0x30, 0x0f, 0x06, \
+ 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x08, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x53, \
+ 0x53, 0x4c, 0x31, 0x1c, 0x30, 0x1a, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, \
+ 0x13, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x73, 0x73, 0x6c, 0x20, 0x54, 0x65, \
+ 0x73, 0x74, 0x20, 0x45, 0x43, 0x20, 0x43, 0x41, 0x30, 0x1e, 0x17, 0x0d, \
+ 0x32, 0x33, 0x30, 0x36, 0x31, 0x35, 0x30, 0x33, 0x33, 0x34, 0x31, 0x38, \
+ 0x5a, 0x17, 0x0d, 0x33, 0x33, 0x30, 0x36, 0x31, 0x32, 0x30, 0x33, 0x33, \
+ 0x34, 0x31, 0x38, 0x5a, 0x30, 0x34, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, \
+ 0x55, 0x04, 0x06, 0x13, 0x02, 0x4e, 0x4c, 0x31, 0x11, 0x30, 0x0f, 0x06, \
+ 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x08, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x53, \
+ 0x53, 0x4c, 0x31, 0x12, 0x30, 0x10, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, \
+ 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x68, 0x6f, 0x73, 0x74, 0x30, 0x59, \
+ 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, \
+ 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0x03, 0x42, 0x00, \
+ 0x04, 0x37, 0xcc, 0x56, 0xd9, 0x76, 0x09, 0x1e, 0x5a, 0x72, 0x3e, 0xc7, \
+ 0x59, 0x2d, 0xff, 0x20, 0x6e, 0xee, 0x7c, 0xf9, 0x06, 0x91, 0x74, 0xd0, \
+ 0xad, 0x14, 0xb5, 0xf7, 0x68, 0x22, 0x59, 0x62, 0x92, 0x4e, 0xe5, 0x00, \
+ 0xd8, 0x23, 0x11, 0xff, 0xea, 0x2f, 0xd2, 0x34, 0x5d, 0x5d, 0x16, 0xbd, \
+ 0x8a, 0x88, 0xc2, 0x6b, 0x77, 0x0d, 0x55, 0xcd, 0x8a, 0x2a, 0x0e, 0xfa, \
+ 0x01, 0xc8, 0xb4, 0xed, 0xff, 0xa3, 0x81, 0x9d, 0x30, 0x81, 0x9a, 0x30, \
+ 0x09, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x04, 0x02, 0x30, 0x00, 0x30, 0x1d, \
+ 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0x50, 0x61, 0xa5, \
+ 0x8f, 0xd4, 0x07, 0xd9, 0xd7, 0x82, 0x01, 0x0c, 0xe5, 0x65, 0x7f, 0x8c, \
+ 0x63, 0x46, 0xa7, 0x13, 0xbe, 0x30, 0x6e, 0x06, 0x03, 0x55, 0x1d, 0x23, \
+ 0x04, 0x67, 0x30, 0x65, 0x80, 0x14, 0x9d, 0x6d, 0x20, 0x24, 0x49, 0x01, \
+ 0x3f, 0x2b, 0xcb, 0x78, 0xb5, 0x19, 0xbc, 0x7e, 0x24, 0xc9, 0xdb, 0xfb, \
+ 0x36, 0x7c, 0xa1, 0x42, 0xa4, 0x40, 0x30, 0x3e, 0x31, 0x0b, 0x30, 0x09, \
+ 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x4e, 0x4c, 0x31, 0x11, 0x30, \
+ 0x0f, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x08, 0x50, 0x6f, 0x6c, 0x61, \
+ 0x72, 0x53, 0x53, 0x4c, 0x31, 0x1c, 0x30, 0x1a, 0x06, 0x03, 0x55, 0x04, \
+ 0x03, 0x0c, 0x13, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x73, 0x73, 0x6c, 0x20, \
+ 0x54, 0x65, 0x73, 0x74, 0x20, 0x45, 0x43, 0x20, 0x43, 0x41, 0x82, 0x09, \
+ 0x00, 0xc1, 0x43, 0xe2, 0x7e, 0x62, 0x43, 0xcc, 0xe8, 0x30, 0x0a, 0x06, \
+ 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x03, 0x68, 0x00, \
+ 0x30, 0x65, 0x02, 0x30, 0x01, 0xc5, 0x6c, 0x61, 0x33, 0xc7, 0xc7, 0x59, \
+ 0x69, 0x49, 0x48, 0x96, 0xd4, 0xf9, 0xb3, 0x54, 0x0e, 0xf4, 0x5b, 0xca, \
+ 0x9a, 0xf1, 0x5e, 0xaf, 0x8b, 0x91, 0x63, 0x79, 0xed, 0x13, 0x2f, 0x52, \
+ 0x93, 0xb0, 0xc2, 0x0a, 0x8c, 0xcc, 0xf3, 0xa5, 0x96, 0x2e, 0x37, 0xf3, \
+ 0x6c, 0x9e, 0xfc, 0x6f, 0x02, 0x31, 0x00, 0x96, 0x11, 0x3c, 0x5d, 0x42, \
+ 0xcc, 0xd1, 0x22, 0x5c, 0xf1, 0xdb, 0xf4, 0xee, 0x3a, 0x64, 0xf1, 0xca, \
+ 0xa3, 0x64, 0xb9, 0xc7, 0xff, 0xe0, 0xff, 0x9e, 0x11, 0xa3, 0x00, 0x0a, \
+ 0xb9, 0x9c, 0xfe, 0x84, 0xa3, 0xee, 0x32, 0x2e, 0x98, 0x63, 0xa7, 0x08, \
+ 0x9b, 0xcd, 0x63, 0x7d, 0xe6, 0x92, 0x65 \
}
/* END FILE */
* \author Daniel King <damaki.gh@gmail.com>
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#include "common.h"
* \brief ChaCha20-Poly1305 AEAD construction based on RFC 7539.
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#include "common.h"
#include "mbedtls/chachapoly.h"
#include "mbedtls/platform_util.h"
#include "mbedtls/error.h"
+#include "mbedtls/constant_time.h"
#include <string.h>
{
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
unsigned char check_tag[16];
- size_t i;
int diff;
CHACHAPOLY_VALIDATE_RET(ctx != NULL);
CHACHAPOLY_VALIDATE_RET(nonce != NULL);
}
/* Check tag in "constant-time" */
- for (diff = 0, i = 0; i < sizeof(check_tag); i++) {
- diff |= tag[i] ^ check_tag[i];
- }
+ diff = mbedtls_ct_memcmp(tag, check_tag, sizeof(check_tag));
if (diff != 0) {
mbedtls_platform_zeroize(output, length);
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
/*
/**
* \file cipher.c
*
- * \brief Generic cipher wrapper for mbed TLS
+ * \brief Generic cipher wrapper for Mbed TLS
*
* \author Adriaan de Jong <dejong@fox-it.com>
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#include "common.h"
#include "mbedtls/platform_util.h"
#include "mbedtls/error.h"
#include "mbedtls/constant_time.h"
+#include "constant_time_internal.h"
#include <stdlib.h>
#include <string.h>
*data_len = input_len - padding_len;
/* Avoid logical || since it results in a branch */
- bad |= padding_len > input_len;
- bad |= padding_len == 0;
+ bad |= ~mbedtls_ct_size_mask_ge(input_len, padding_len);
+ bad |= mbedtls_ct_size_bool_eq(padding_len, 0);
/* The number of bytes checked must be independent of padding_len,
* so pick input_len, which is usually 8 or 16 (one block) */
pad_idx = input_len - padding_len;
for (i = 0; i < input_len; i++) {
- bad |= (input[i] ^ padding_len) * (i >= pad_idx);
+ size_t mask = mbedtls_ct_size_mask_ge(i, pad_idx);
+ bad |= (input[i] ^ padding_len) & mask;
}
-
- return MBEDTLS_ERR_CIPHER_INVALID_PADDING * (bad != 0);
+ return -(int) mbedtls_ct_uint_if(bad, -MBEDTLS_ERR_CIPHER_INVALID_PADDING, 0);
}
#endif /* MBEDTLS_CIPHER_PADDING_PKCS7 */
static int get_one_and_zeros_padding(unsigned char *input, size_t input_len,
size_t *data_len)
{
- size_t i;
- unsigned char done = 0, prev_done, bad;
+ unsigned int bad = 1;
if (NULL == input || NULL == data_len) {
return MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA;
}
- bad = 0x80;
*data_len = 0;
- for (i = input_len; i > 0; i--) {
- prev_done = done;
- done |= (input[i - 1] != 0);
- *data_len |= (i - 1) * (done != prev_done);
- bad ^= input[i - 1] * (done != prev_done);
- }
+ size_t in_padding = ~0;
+
+ for (ptrdiff_t i = (ptrdiff_t) (input_len) - 1; i >= 0; i--) {
+ size_t is_nonzero = mbedtls_ct_uint_mask(input[i]);
+
+ size_t hit_first_nonzero = is_nonzero & in_padding;
- return MBEDTLS_ERR_CIPHER_INVALID_PADDING * (bad != 0);
+ *data_len = (*data_len & ~hit_first_nonzero) | ((size_t) i & hit_first_nonzero);
+
+ bad = mbedtls_ct_uint_if((unsigned int) hit_first_nonzero,
+ !mbedtls_ct_size_bool_eq(input[i], 0x80), bad);
+
+ in_padding = in_padding & ~is_nonzero;
+ }
+ return -(int) mbedtls_ct_uint_if(bad, -MBEDTLS_ERR_CIPHER_INVALID_PADDING, 0);
}
#endif /* MBEDTLS_CIPHER_PADDING_ONE_AND_ZEROS */
*data_len = input_len - padding_len;
/* Avoid logical || since it results in a branch */
- bad |= padding_len > input_len;
- bad |= padding_len == 0;
+ bad |= mbedtls_ct_size_mask_ge(padding_len, input_len + 1);
+ bad |= mbedtls_ct_size_bool_eq(padding_len, 0);
/* The number of bytes checked must be independent of padding_len */
pad_idx = input_len - padding_len;
for (i = 0; i < input_len - 1; i++) {
- bad |= input[i] * (i >= pad_idx);
+ size_t mask = mbedtls_ct_size_mask_ge(i, pad_idx);
+ bad |= input[i] & mask;
}
- return MBEDTLS_ERR_CIPHER_INVALID_PADDING * (bad != 0);
+ return -(int) mbedtls_ct_uint_if(bad, -MBEDTLS_ERR_CIPHER_INVALID_PADDING, 0);
}
#endif /* MBEDTLS_CIPHER_PADDING_ZEROS_AND_LEN */
*data_len = 0;
for (i = input_len; i > 0; i--) {
prev_done = done;
- done |= (input[i-1] != 0);
- *data_len |= i * (done != prev_done);
+ done |= !mbedtls_ct_size_bool_eq(input[i-1], 0);
+ size_t mask = mbedtls_ct_size_mask(done ^ prev_done);
+ *data_len |= i & mask;
}
return 0;
/**
* \file cipher_wrap.c
*
- * \brief Generic cipher wrapper for mbed TLS
+ * \brief Generic cipher wrapper for Mbed TLS
*
* \author Adriaan de Jong <dejong@fox-it.com>
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#include "common.h"
* \brief NIST SP800-38B compliant CMAC implementation for AES and 3DES
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
/*
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_LIBRARY_COMMON_H
#define MBEDTLS_STATIC_ASSERT(expr, msg)
#endif
+/* Suppress compiler warnings for unused functions and variables. */
+#if !defined(MBEDTLS_MAYBE_UNUSED) && defined(__has_attribute)
+# if __has_attribute(unused)
+# define MBEDTLS_MAYBE_UNUSED __attribute__((unused))
+# endif
+#endif
+#if !defined(MBEDTLS_MAYBE_UNUSED) && defined(__GNUC__)
+# define MBEDTLS_MAYBE_UNUSED __attribute__((unused))
+#endif
+#if !defined(MBEDTLS_MAYBE_UNUSED) && defined(__IAR_SYSTEMS_ICC__) && defined(__VER__)
+/* IAR does support __attribute__((unused)), but only if the -e flag (extended language support)
+ * is given; the pragma always works.
+ * Unfortunately the pragma affects the rest of the file where it is used, but this is harmless.
+ * Check for version 5.2 or later - this pragma may be supported by earlier versions, but I wasn't
+ * able to find documentation).
+ */
+# if (__VER__ >= 5020000)
+# define MBEDTLS_MAYBE_UNUSED _Pragma("diag_suppress=Pe177")
+# endif
+#endif
+#if !defined(MBEDTLS_MAYBE_UNUSED) && defined(_MSC_VER)
+# define MBEDTLS_MAYBE_UNUSED __pragma(warning(suppress:4189))
+#endif
+#if !defined(MBEDTLS_MAYBE_UNUSED)
+# define MBEDTLS_MAYBE_UNUSED
+#endif
+
#endif /* MBEDTLS_LIBRARY_COMMON_H */
* Constant-time functions
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
/*
#endif
}
-#if defined(MBEDTLS_SSL_SOME_MODES_USE_MAC)
+#if defined(MBEDTLS_SSL_SOME_MODES_USE_MAC) || defined(MBEDTLS_SSL_SOME_SUITES_USE_TLS_CBC) || \
+ defined(MBEDTLS_NIST_KW_C) || defined(MBEDTLS_CIPHER_MODE_CBC)
size_t mbedtls_ct_size_mask(size_t value)
{
#endif
}
-#endif /* MBEDTLS_SSL_SOME_MODES_USE_MAC */
+#endif /* defined(MBEDTLS_SSL_SOME_MODES_USE_MAC) || defined(MBEDTLS_SSL_SOME_SUITES_USE_TLS_CBC) ||
+ defined(MBEDTLS_NIST_KW_C) || defined(MBEDTLS_CIPHER_MODE_CBC) */
#if defined(MBEDTLS_BIGNUM_C)
#endif /* MBEDTLS_BIGNUM_C */
-#if defined(MBEDTLS_SSL_SOME_SUITES_USE_TLS_CBC)
+#if defined(MBEDTLS_SSL_SOME_SUITES_USE_TLS_CBC) || defined(MBEDTLS_NIST_KW_C) || \
+ defined(MBEDTLS_CIPHER_MODE_CBC)
/** Constant-flow mask generation for "less than" comparison:
* - if \p x < \p y, return all-bits 1, that is (size_t) -1
return ~mbedtls_ct_size_mask_lt(x, y);
}
-#endif /* MBEDTLS_SSL_SOME_SUITES_USE_TLS_CBC */
+#endif /* defined(MBEDTLS_SSL_SOME_SUITES_USE_TLS_CBC) || defined(MBEDTLS_NIST_KW_C) ||
+ defined(MBEDTLS_CIPHER_MODE_CBC) */
#if defined(MBEDTLS_BASE64_C)
#if defined(MBEDTLS_BIGNUM_C)
-/** Select between two sign values without branches.
- *
- * This is functionally equivalent to `condition ? if1 : if0` but uses only bit
- * operations in order to avoid branches.
- *
- * \note if1 and if0 must be either 1 or -1, otherwise the result
- * is undefined.
- *
- * \param condition Condition to test; must be either 0 or 1.
- * \param if1 The first sign; must be either +1 or -1.
- * \param if0 The second sign; must be either +1 or -1.
- *
- * \return \c if1 if \p condition is nonzero, otherwise \c if0.
- * */
-static int mbedtls_ct_cond_select_sign(unsigned char condition,
- int if1,
- int if0)
-{
- /* In order to avoid questions about what we can reasonably assume about
- * the representations of signed integers, move everything to unsigned
- * by taking advantage of the fact that if1 and if0 are either +1 or -1. */
- unsigned uif1 = if1 + 1;
- unsigned uif0 = if0 + 1;
-
- /* condition was 0 or 1, mask is 0 or 2 as are uif1 and uif0 */
- const unsigned mask = condition << 1;
-
- /* select uif1 or uif0 */
- unsigned ur = (uif0 & ~mask) | (uif1 & mask);
-
- /* ur is now 0 or 2, convert back to -1 or +1 */
- return (int) ur - 1;
-}
-
void mbedtls_ct_mpi_uint_cond_assign(size_t n,
mbedtls_mpi_uint *dest,
const mbedtls_mpi_uint *src,
MBEDTLS_MPI_CHK(mbedtls_mpi_grow(X, Y->n));
- X->s = mbedtls_ct_cond_select_sign(assign, Y->s, X->s);
+ X->s = (int) mbedtls_ct_uint_if(assign, Y->s, X->s);
mbedtls_ct_mpi_uint_cond_assign(Y->n, X->p, Y->p, assign);
MBEDTLS_MPI_CHK(mbedtls_mpi_grow(Y, X->n));
s = X->s;
- X->s = mbedtls_ct_cond_select_sign(swap, Y->s, X->s);
- Y->s = mbedtls_ct_cond_select_sign(swap, s, Y->s);
+ X->s = (int) mbedtls_ct_uint_if(swap, Y->s, X->s);
+ Y->s = (int) mbedtls_ct_uint_if(swap, s, Y->s);
for (i = 0; i < X->n; i++) {
* Constant-time functions
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_CONSTANT_TIME_INTERNAL_H
*/
unsigned mbedtls_ct_uint_mask(unsigned value);
-#if defined(MBEDTLS_SSL_SOME_MODES_USE_MAC)
+#if defined(MBEDTLS_SSL_SOME_MODES_USE_MAC) || defined(MBEDTLS_SSL_SOME_SUITES_USE_TLS_CBC) || \
+ defined(MBEDTLS_NIST_KW_C) || defined(MBEDTLS_CIPHER_MODE_CBC)
/** Turn a value into a mask:
* - if \p value == 0, return the all-bits 0 mask, aka 0
*/
size_t mbedtls_ct_size_mask(size_t value);
-#endif /* MBEDTLS_SSL_SOME_MODES_USE_MAC */
+#endif /* defined(MBEDTLS_SSL_SOME_MODES_USE_MAC) || defined(MBEDTLS_SSL_SOME_SUITES_USE_TLS_CBC) ||
+ defined(MBEDTLS_NIST_KW_C) || defined(MBEDTLS_CIPHER_MODE_CBC) */
#if defined(MBEDTLS_BIGNUM_C)
#endif /* MBEDTLS_BIGNUM_C */
-#if defined(MBEDTLS_SSL_SOME_SUITES_USE_TLS_CBC)
+#if defined(MBEDTLS_SSL_SOME_SUITES_USE_TLS_CBC) || defined(MBEDTLS_NIST_KW_C) || \
+ defined(MBEDTLS_CIPHER_MODE_CBC)
/** Constant-flow mask generation for "greater or equal" comparison:
* - if \p x >= \p y, return all-bits 1, that is (size_t) -1
size_t mbedtls_ct_size_mask_ge(size_t x,
size_t y);
-#endif /* MBEDTLS_SSL_SOME_SUITES_USE_TLS_CBC */
+#endif /* defined(MBEDTLS_SSL_SOME_SUITES_USE_TLS_CBC) || defined(MBEDTLS_NIST_KW_C) ||
+ defined(MBEDTLS_CIPHER_MODE_CBC) */
/** Constant-flow boolean "equal" comparison:
* return x == y
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_CONSTANT_TIME_INVASIVE_H
* CTR_DRBG implementation based on AES-256 (NIST SP 800-90)
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
/*
* The NIST SP 800-90 DRBGs are described in the following publication.
*
- * http://csrc.nist.gov/publications/nistpubs/800-90/SP800-90revised_March2007.pdf
+ * https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-90r.pdf
*/
#include "common.h"
#include "mbedtls/platform_util.h"
#include "mbedtls/error.h"
+#include <limits.h>
#include <string.h>
#if defined(MBEDTLS_FS_IO)
* Debugging routines
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#include "common.h"
#include <stdio.h>
#include <string.h>
+/* DEBUG_BUF_SIZE must be at least 2 */
#define DEBUG_BUF_SIZE 512
static int debug_threshold = 0;
char str[DEBUG_BUF_SIZE];
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
+ MBEDTLS_STATIC_ASSERT(DEBUG_BUF_SIZE >= 2, "DEBUG_BUF_SIZE too small");
+
if (NULL == ssl ||
NULL == ssl->conf ||
NULL == ssl->conf->f_dbg ||
ret = mbedtls_vsnprintf(str, DEBUG_BUF_SIZE, format, argp);
va_end(argp);
- if (ret >= 0 && ret < DEBUG_BUF_SIZE - 1) {
- str[ret] = '\n';
- str[ret + 1] = '\0';
+ if (ret < 0) {
+ ret = 0;
+ } else {
+ if (ret >= DEBUG_BUF_SIZE - 1) {
+ ret = DEBUG_BUF_SIZE - 2;
+ }
}
+ str[ret] = '\n';
+ str[ret + 1] = '\0';
debug_send_line(ssl, level, file, line, str);
}
* FIPS-46-3 compliant Triple-DES implementation
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
/*
* DES, on which TDES is based, was originally designed by Horst Feistel
* Diffie-Hellman-Merkle key exchange
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
/*
* The following sources were referenced in the design of this implementation
* Elliptic curve Diffie-Hellman
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
/*
* References:
*
- * SEC1 http://www.secg.org/index.php?action=secg,docs_secg
+ * SEC1 https://www.secg.org/sec1-v2.pdf
* RFC 4492
*/
* Elliptic curve DSA
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
/*
* References:
*
- * SEC1 http://www.secg.org/index.php?action=secg,docs_secg
+ * SEC1 https://www.secg.org/sec1-v2.pdf
*/
#include "common.h"
}
#endif /* ECDSA_DETERMINISTIC || !ECDSA_SIGN_ALT || !ECDSA_VERIFY_ALT */
+int mbedtls_ecdsa_can_do(mbedtls_ecp_group_id gid)
+{
+ switch (gid) {
+#ifdef MBEDTLS_ECP_DP_CURVE25519_ENABLED
+ case MBEDTLS_ECP_DP_CURVE25519: return 0;
+#endif
+#ifdef MBEDTLS_ECP_DP_CURVE448_ENABLED
+ case MBEDTLS_ECP_DP_CURVE448: return 0;
+#endif
+ default: return 1;
+ }
+}
+
#if !defined(MBEDTLS_ECDSA_SIGN_ALT)
/*
* Compute ECDSA signature of a hashed message (SEC1 4.1.3)
#if defined(MBEDTLS_ECP_RESTARTABLE)
if (rs_ctx != NULL && rs_ctx->sig != NULL) {
- mbedtls_mpi_copy(r, pr);
+ MBEDTLS_MPI_CHK(mbedtls_mpi_copy(r, pr));
}
#endif
return ret;
}
-int mbedtls_ecdsa_can_do(mbedtls_ecp_group_id gid)
-{
- switch (gid) {
-#ifdef MBEDTLS_ECP_DP_CURVE25519_ENABLED
- case MBEDTLS_ECP_DP_CURVE25519: return 0;
-#endif
-#ifdef MBEDTLS_ECP_DP_CURVE448_ENABLED
- case MBEDTLS_ECP_DP_CURVE448: return 0;
-#endif
- default: return 1;
- }
-}
-
/*
* Compute ECDSA signature of a hashed message
*/
MBEDTLS_MPI_CHK(mbedtls_mpi_write_binary(d, data, grp_len));
MBEDTLS_MPI_CHK(derive_mpi(grp, &h, buf, blen));
MBEDTLS_MPI_CHK(mbedtls_mpi_write_binary(&h, data + grp_len, grp_len));
- mbedtls_hmac_drbg_seed_buf(p_rng, md_info, data, 2 * grp_len);
+ MBEDTLS_MPI_CHK(mbedtls_hmac_drbg_seed_buf(p_rng, md_info, data, 2 * grp_len));
#if defined(MBEDTLS_ECP_RESTARTABLE)
if (rs_ctx != NULL && rs_ctx->det != NULL) {
* Elliptic curve J-PAKE
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
/*
#if !defined(MBEDTLS_ECJPAKE_ALT)
/* 'reference handshake' tests can only be run against implementations
* for which we have 100% control over how the random ephemeral keys
- * are generated. This is only the case for the internal mbed TLS
+ * are generated. This is only the case for the internal Mbed TLS
* implementation, so these tests are skipped in case the internal
* implementation is swapped out for an alternative one. */
if (verbose != 0) {
* Elliptic curves over GF(p): generic functions
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
/*
* References:
*
- * SEC1 http://www.secg.org/index.php?action=secg,docs_secg
+ * SEC1 https://www.secg.org/sec1-v2.pdf
* GECC = Guide to Elliptic Curve Cryptography - Hankerson, Menezes, Vanstone
* FIPS 186-3 http://csrc.nist.gov/publications/fips/fips186-3/fips_186-3.pdf
* RFC 4492 for the related TLS structures and constants
+ * - https://www.rfc-editor.org/rfc/rfc4492
* RFC 7748 for the Curve448 and Curve25519 curve definitions
+ * - https://www.rfc-editor.org/rfc/rfc7748
*
- * [Curve25519] http://cr.yp.to/ecdh/curve25519-20060209.pdf
+ * [Curve25519] https://cr.yp.to/ecdh/curve25519-20060209.pdf
*
* [2] CORON, Jean-S'ebastien. Resistance against differential power analysis
* for elliptic curve cryptosystems. In : Cryptographic Hardware and
unsigned char secret_bytes[MBEDTLS_ECP_MAX_BYTES];
/* The list starts with strong hashes */
const mbedtls_md_type_t md_type =
- (const mbedtls_md_type_t) (mbedtls_md_list()[0]);
+ (mbedtls_md_type_t) (mbedtls_md_list()[0]);
const mbedtls_md_info_t *md_info = mbedtls_md_info_from_type(md_type);
if (secret_len > MBEDTLS_ECP_MAX_BYTES) {
size_t plen;
ECP_VALIDATE_RET(grp != NULL);
ECP_VALIDATE_RET(pt != NULL);
- ECP_VALIDATE_RET(buf != NULL);
+ ECP_VALIDATE_RET(ilen == 0 || buf != NULL);
if (ilen < 1) {
return MBEDTLS_ERR_ECP_BAD_INPUT_DATA;
ECP_VALIDATE_RET(grp != NULL);
ECP_VALIDATE_RET(pt != NULL);
ECP_VALIDATE_RET(buf != NULL);
- ECP_VALIDATE_RET(*buf != NULL);
+ ECP_VALIDATE_RET(buf_len == 0 || *buf != NULL);
/*
* We must have at least two bytes (1 for length, at least one for data)
mbedtls_ecp_group_id grp_id;
ECP_VALIDATE_RET(grp != NULL);
ECP_VALIDATE_RET(buf != NULL);
- ECP_VALIDATE_RET(*buf != NULL);
+ ECP_VALIDATE_RET(len == 0 || *buf != NULL);
if ((ret = mbedtls_ecp_tls_read_group_id(&grp_id, buf, len)) != 0) {
return ret;
const mbedtls_ecp_curve_info *curve_info;
ECP_VALIDATE_RET(grp != NULL);
ECP_VALIDATE_RET(buf != NULL);
- ECP_VALIDATE_RET(*buf != NULL);
+ ECP_VALIDATE_RET(len == 0 || *buf != NULL);
/*
* We expect at least three bytes (see below)
void *p_rng)
{
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
+ int have_rng = 1;
size_t i;
unsigned char b;
mbedtls_ecp_point RP;
MOD_ADD(RP.X);
/* Randomize coordinates of the starting point */
- int have_rng = 1;
#if defined(MBEDTLS_ECP_NO_INTERNAL_RNG)
if (f_rng == NULL) {
have_rng = 0;
int mbedtls_ecp_write_key(mbedtls_ecp_keypair *key,
unsigned char *buf, size_t buflen)
{
- int ret = MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE;
+ int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
ECP_VALIDATE_RET(key != NULL);
- ECP_VALIDATE_RET(buf != NULL);
+ ECP_VALIDATE_RET(buflen == 0 || buf != NULL);
#if defined(MBEDTLS_ECP_MONTGOMERY_ENABLED)
if (mbedtls_ecp_get_type(&key->grp) == MBEDTLS_ECP_TYPE_MONTGOMERY) {
* Elliptic curves over GF(p): curve-specific data and functions
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#include "common.h"
*/
static inline void ecp_mpi_set1(mbedtls_mpi *X)
{
- static mbedtls_mpi_uint one[] = { 1 };
+ static const mbedtls_mpi_uint one[] = { 1 };
X->s = 1;
X->n = 1;
- X->p = one;
+ X->p = (mbedtls_mpi_uint *) one; /* X->p will not be modified so the cast is safe */
}
/*
*/
#define P_KOBLITZ_MAX (256 / 8 / sizeof(mbedtls_mpi_uint)) // Max limbs in P
#define P_KOBLITZ_R (8 / sizeof(mbedtls_mpi_uint)) // Limbs in R
-static inline int ecp_mod_koblitz(mbedtls_mpi *N, mbedtls_mpi_uint *Rp, size_t p_limbs,
+static inline int ecp_mod_koblitz(mbedtls_mpi *N, const mbedtls_mpi_uint *Rp, size_t p_limbs,
size_t adjust, size_t shift, mbedtls_mpi_uint mask)
{
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
/* Init R */
R.s = 1;
- R.p = Rp;
+ R.p = (mbedtls_mpi_uint *) Rp; /* R.p will not be modified so the cast is safe */
R.n = P_KOBLITZ_R;
/* Common setup for M */
*/
static int ecp_mod_p192k1(mbedtls_mpi *N)
{
- static mbedtls_mpi_uint Rp[] = {
+ static const mbedtls_mpi_uint Rp[] = {
MBEDTLS_BYTES_TO_T_UINT_8(0xC9, 0x11, 0x00, 0x00, 0x01, 0x00, 0x00,
0x00)
};
*/
static int ecp_mod_p224k1(mbedtls_mpi *N)
{
- static mbedtls_mpi_uint Rp[] = {
+ static const mbedtls_mpi_uint Rp[] = {
MBEDTLS_BYTES_TO_T_UINT_8(0x93, 0x1A, 0x00, 0x00, 0x01, 0x00, 0x00,
0x00)
};
*/
static int ecp_mod_p256k1(mbedtls_mpi *N)
{
- static mbedtls_mpi_uint Rp[] = {
+ static const mbedtls_mpi_uint Rp[] = {
MBEDTLS_BYTES_TO_T_UINT_8(0xD1, 0x03, 0x00, 0x00, 0x01, 0x00, 0x00,
0x00)
};
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_ECP_INVASIVE_H
#define MBEDTLS_ECP_INVASIVE_H
* This is the bit-size of the key minus 1:
* 254 for Curve25519 or 447 for Curve448.
* \param d The randomly generated key. This is a number of size
- * exactly \p n_bits + 1 bits, with the least significant bits
+ * exactly \p high_bit + 1 bits, with the least significant bits
* masked as specified in [Curve25519] and in [RFC7748] §5.
* \param f_rng The RNG function.
* \param p_rng The RNG context to be passed to \p f_rng.
* \return \c 0 on success.
* \return \c MBEDTLS_ERR_ECP_xxx or MBEDTLS_ERR_MPI_xxx on failure.
*/
-int mbedtls_ecp_gen_privkey_mx(size_t n_bits,
+int mbedtls_ecp_gen_privkey_mx(size_t high_bit,
mbedtls_mpi *d,
int (*f_rng)(void *, unsigned char *, size_t),
void *p_rng);
* Entropy accumulator implementation
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#include "common.h"
#include "mbedtls/entropy_poll.h"
#include "mbedtls/platform_util.h"
#include "mbedtls/error.h"
+#include "mbedtls/sha256.h"
+#include "mbedtls/sha512.h"
#include <string.h>
* Platform-specific and custom entropy polling functions
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
-#if defined(__linux__) && !defined(_GNU_SOURCE)
+#if defined(__linux__) || defined(__midipix__) && !defined(_GNU_SOURCE)
/* Ensure that syscall() is available even when compiling with -std=c99 */
#define _GNU_SOURCE
#endif
* Error message information
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#include "common.h"
return( "SSL - A cryptographic operation is in progress. Try again later" );
case -(MBEDTLS_ERR_SSL_BAD_CONFIG):
return( "SSL - Invalid value in SSL config" );
+ case -(MBEDTLS_ERR_SSL_CACHE_ENTRY_NOT_FOUND):
+ return( "SSL - Cache entry not found" );
#endif /* MBEDTLS_SSL_TLS_C */
#if defined(MBEDTLS_X509_USE_C) || defined(MBEDTLS_X509_CREATE_C)
* NIST SP800-38D compliant GCM implementation
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
/*
#include "mbedtls/platform.h"
#include "mbedtls/platform_util.h"
#include "mbedtls/error.h"
+#include "mbedtls/constant_time.h"
#include <string.h>
uint64_t iv_bits;
GCM_VALIDATE_RET(ctx != NULL);
- GCM_VALIDATE_RET(iv != NULL);
+ GCM_VALIDATE_RET(iv_len == 0 || iv != NULL);
GCM_VALIDATE_RET(add_len == 0 || add != NULL);
/* IV and AD are limited to 2^64 bits, so 2^61 bytes */
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
GCM_VALIDATE_RET(ctx != NULL);
- GCM_VALIDATE_RET(iv != NULL);
+ GCM_VALIDATE_RET(iv_len == 0 || iv != NULL);
GCM_VALIDATE_RET(add_len == 0 || add != NULL);
GCM_VALIDATE_RET(length == 0 || input != NULL);
GCM_VALIDATE_RET(length == 0 || output != NULL);
{
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
unsigned char check_tag[16];
- size_t i;
int diff;
GCM_VALIDATE_RET(ctx != NULL);
- GCM_VALIDATE_RET(iv != NULL);
+ GCM_VALIDATE_RET(iv_len == 0 || iv != NULL);
GCM_VALIDATE_RET(add_len == 0 || add != NULL);
GCM_VALIDATE_RET(tag != NULL);
GCM_VALIDATE_RET(length == 0 || input != NULL);
}
/* Check tag in "constant-time" */
- for (diff = 0, i = 0; i < tag_len; i++) {
- diff |= tag[i] ^ check_tag[i];
- }
+ diff = mbedtls_ct_memcmp(tag, check_tag, tag_len);
if (diff != 0) {
mbedtls_platform_zeroize(output, length);
* \brief HAVEGE: HArdware Volatile Entropy Gathering and Expansion
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
/*
* The HAVEGE RNG was designed by Andre Seznec in 2002.
* HKDF implementation -- RFC 5869
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#include "common.h"
* HMAC_DRBG implementation (NIST SP 800-90)
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
/*
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_AES_H
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_AESNI_H
#define MBEDTLS_AESNI_H
#define MBEDTLS_AESNI_AES 0x02000000u
#define MBEDTLS_AESNI_CLMUL 0x00000002u
-/* Can we do AESNI with inline assembly?
- * (Only implemented with gas syntax, only for 64-bit.)
- */
-#if defined(MBEDTLS_HAVE_ASM) && defined(__GNUC__) && \
- (defined(__amd64__) || defined(__x86_64__)) && \
- !defined(MBEDTLS_HAVE_X86_64)
+#if !defined(MBEDTLS_HAVE_X86_64) && \
+ (defined(__amd64__) || defined(__x86_64__) || \
+ defined(_M_X64) || defined(_M_AMD64)) && \
+ !defined(_M_ARM64EC)
#define MBEDTLS_HAVE_X86_64
#endif
-#if defined(MBEDTLS_AESNI_C)
+#if !defined(MBEDTLS_HAVE_X86) && \
+ (defined(__i386__) || defined(_M_IX86))
+#define MBEDTLS_HAVE_X86
+#endif
+
+#if defined(MBEDTLS_AESNI_C) && \
+ (defined(MBEDTLS_HAVE_X86_64) || defined(MBEDTLS_HAVE_X86))
/* Can we do AESNI with intrinsics?
* (Only implemented with certain compilers, only for certain targets.)
* macros that may change in future releases.
*/
#undef MBEDTLS_AESNI_HAVE_INTRINSICS
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) && !defined(__clang__)
/* Visual Studio supports AESNI intrinsics since VS 2008 SP1. We only support
* VS 2013 and up for other reasons anyway, so no need to check the version. */
#define MBEDTLS_AESNI_HAVE_INTRINSICS
/* GCC-like compilers: currently, we only support intrinsics if the requisite
* target flag is enabled when building the library (e.g. `gcc -mpclmul -msse2`
* or `clang -maes -mpclmul`). */
-#if defined(__GNUC__) && defined(__AES__) && defined(__PCLMUL__)
+#if (defined(__GNUC__) || defined(__clang__)) && defined(__AES__) && defined(__PCLMUL__)
#define MBEDTLS_AESNI_HAVE_INTRINSICS
#endif
* favor the assembly-based implementation if it's available. We intend to
* revise this in a later release of Mbed TLS 3.x. In the long run, we will
* likely remove the assembly implementation. */
-#if defined(MBEDTLS_HAVE_X86_64)
+#if defined(MBEDTLS_HAVE_ASM) && \
+ defined(__GNUC__) && defined(MBEDTLS_HAVE_X86_64)
+/* Can we do AESNI with inline assembly?
+ * (Only implemented with gas syntax, only for 64-bit.)
+ */
#define MBEDTLS_AESNI_HAVE_CODE 1 // via assembly
#elif defined(MBEDTLS_AESNI_HAVE_INTRINSICS)
#define MBEDTLS_AESNI_HAVE_CODE 2 // via intrinsics
#endif
#endif /* MBEDTLS_AESNI_HAVE_CODE */
-#endif /* MBEDTLS_AESNI_C */
+#endif /* MBEDTLS_AESNI_C && (MBEDTLS_HAVE_X86_64 || MBEDTLS_HAVE_X86) */
#endif /* MBEDTLS_AESNI_H */
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*
*/
#ifndef MBEDTLS_ARC4_H
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_ARIA_H
* \brief This function performs an ARIA-CTR encryption or decryption
* operation.
*
- * This function performs the operation defined in the \p mode
- * parameter (encrypt/decrypt), on the input data buffer
- * defined in the \p input parameter.
- *
* Due to the nature of CTR, you must use the same key schedule
* for both encryption and decryption operations. Therefore, you
* must use the context initialized with mbedtls_aria_setkey_enc()
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_ASN1_H
#define MBEDTLS_ASN1_H
* on a successful invocation.
* \param end The end of the ASN.1 SEQUENCE container.
* \param tag_must_mask A mask to be applied to the ASN.1 tags found within
- * the SEQUENCE before comparing to \p tag_must_value.
+ * the SEQUENCE before comparing to \p tag_must_val.
* \param tag_must_val The required value of each ASN.1 tag found in the
* SEQUENCE, after masking with \p tag_must_mask.
* Mismatching tags lead to an error.
* while a value of \c 0xFF for \p tag_must_mask means
* that \p tag_must_val is the only allowed tag.
* \param tag_may_mask A mask to be applied to the ASN.1 tags found within
- * the SEQUENCE before comparing to \p tag_may_value.
+ * the SEQUENCE before comparing to \p tag_may_val.
* \param tag_may_val The desired value of each ASN.1 tag found in the
* SEQUENCE, after masking with \p tag_may_mask.
* Mismatching tags will be silently ignored.
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_ASN1_WRITE_H
#define MBEDTLS_ASN1_WRITE_H
const char *oid, size_t oid_len,
size_t par_len);
+/**
+ * \brief Write an AlgorithmIdentifier sequence in ASN.1 format.
+ *
+ * \note This function works backwards in data buffer.
+ *
+ * \param p The reference to the current position pointer.
+ * \param start The start of the buffer, for bounds-checking.
+ * \param oid The OID of the algorithm to write.
+ * \param oid_len The length of the algorithm's OID.
+ * \param par_len The length of the parameters, which must be already written.
+ * \param has_par If there are any parameters. If 0, par_len must be 0. If 1
+ * and \p par_len is 0, NULL parameters are added.
+ *
+ * \return The number of bytes written to \p p on success.
+ * \return A negative \c MBEDTLS_ERR_ASN1_XXX error code on failure.
+ */
+int mbedtls_asn1_write_algorithm_identifier_ext(unsigned char **p,
+ unsigned char *start,
+ const char *oid, size_t oid_len,
+ size_t par_len, int has_par);
+
/**
* \brief Write a boolean tag (#MBEDTLS_ASN1_BOOLEAN) and value
* in ASN.1 format.
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_BASE64_H
#define MBEDTLS_BASE64_H
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_BIGNUM_H
#define MBEDTLS_BIGNUM_H
* \param X The destination MPI. This must point to an initialized MPI.
* \param buf The input buffer. This must be a readable buffer of length
* \p buflen Bytes.
- * \param buflen The length of the input buffer \p p in Bytes.
+ * \param buflen The length of the input buffer \p buf in Bytes.
*
* \return \c 0 if successful.
* \return #MBEDTLS_ERR_MPI_ALLOC_FAILED if memory allocation failed.
* \param X The destination MPI. This must point to an initialized MPI.
* \param buf The input buffer. This must be a readable buffer of length
* \p buflen Bytes.
- * \param buflen The length of the input buffer \p p in Bytes.
+ * \param buflen The length of the input buffer \p buf in Bytes.
*
* \return \c 0 if successful.
* \return #MBEDTLS_ERR_MPI_ALLOC_FAILED if memory allocation failed.
* \return #MBEDTLS_ERR_MPI_ALLOC_FAILED if a memory allocation failed.
* \return #MBEDTLS_ERR_MPI_BAD_INPUT_DATA if \p N is less than
* or equal to one.
- * \return #MBEDTLS_ERR_MPI_NOT_ACCEPTABLE if \p has no modular inverse
- * with respect to \p N.
+ * \return #MBEDTLS_ERR_MPI_NOT_ACCEPTABLE if \p A has no modular
+ * inverse with respect to \p N.
*/
int mbedtls_mpi_inv_mod(mbedtls_mpi *X, const mbedtls_mpi *A,
const mbedtls_mpi *N);
* This must point to an initialized MPI.
* \param rounds The number of bases to perform the Miller-Rabin primality
* test for. The probability of returning 0 on a composite is
- * at most 2<sup>-2*\p rounds</sup>.
+ * at most 2<sup>-2*\p rounds </sup>.
* \param f_rng The RNG function to use. This must not be \c NULL.
* \param p_rng The RNG parameter to be passed to \p f_rng.
* This may be \c NULL if \p f_rng doesn't use
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_BLOWFISH_H
#define MBEDTLS_BLOWFISH_H
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
/*
* Multiply source vector [s] with b, add result
#if defined(__arm__) && !defined(MULADDC_CANNOT_USE_R7)
#if defined(__thumb__) && !defined(__thumb2__)
+#if !defined(__ARMCC_VERSION) && !defined(__clang__) \
+ && !defined(__llvm__) && !defined(__INTEL_COMPILER)
+/*
+ * Thumb 1 ISA. This code path has only been tested successfully on gcc;
+ * it does not compile on clang or armclang.
+ *
+ * Other compilers which define __GNUC__ may not work. The above macro
+ * attempts to exclude these untested compilers.
+ */
#define MULADDC_INIT \
asm( \
"r6", "r7", "r8", "r9", "cc" \
);
+#endif /* Compiler is gcc */
+
#elif (__ARM_ARCH >= 6) && \
defined (__ARM_FEATURE_DSP) && (__ARM_FEATURE_DSP == 1)
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_CAMELLIA_H
#define MBEDTLS_CAMELLIA_H
* *note Due to the nature of CTR mode, you should use the same
* key for both encryption and decryption. In particular, calls
* to this function should be preceded by a key-schedule via
- * mbedtls_camellia_setkey_enc() regardless of whether \p mode
+ * mbedtls_camellia_setkey_enc() regardless of whether the mode
* is #MBEDTLS_CAMELLIA_ENCRYPT or #MBEDTLS_CAMELLIA_DECRYPT.
*
* \warning You must never reuse a nonce value with the same key. Doing so
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_CCM_H
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_CERTS_H
#define MBEDTLS_CERTS_H
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_CHACHA20_H
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_CHACHAPOLY_H
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
/*
*/
#include <limits.h>
#if CHAR_BIT != 8
-#error "mbed TLS requires a platform with 8-bit chars"
+#error "Mbed TLS requires a platform with 8-bit chars"
#endif
#if defined(_WIN32)
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_CIPHER_H
const mbedtls_cipher_mode_t mode);
/**
- * \brief This function initializes a \p cipher_context as NONE.
+ * \brief This function initializes a \p ctx as NONE.
*
* \param ctx The context to be initialized. This must not be \c NULL.
*/
/**
- * \brief This function initializes a cipher context for
+ * \brief This function prepares a cipher context for
* use with the given cipher primitive.
*
- * \param ctx The context to initialize. This must be initialized.
+ * \warning In CBC mode, if mbedtls_cipher_set_padding_mode() is not called:
+ * - If MBEDTLS_CIPHER_PADDING_PKCS7 is enabled, the
+ * context will use PKCS7 padding.
+ * - Otherwise the context uses no padding and the input
+ * must be a whole number of blocks.
+ *
+ * \note After calling this function, you should call
+ * mbedtls_cipher_setkey() and, if the mode uses padding,
+ * mbedtls_cipher_set_padding_mode(), then for each
+ * message to encrypt or decrypt with this key, either:
+ * - mbedtls_cipher_crypt() for one-shot processing with
+ * non-AEAD modes;
+ * - mbedtls_cipher_auth_encrypt_ext() or
+ * mbedtls_cipher_auth_decrypt_ext() for one-shot
+ * processing with AEAD modes or NIST_KW;
+ * - for multi-part processing, see the documentation of
+ * mbedtls_cipher_reset().
+ *
+ * \param ctx The context to prepare. This must be initialized by
+ * a call to mbedtls_cipher_init() first.
* \param cipher_info The cipher to use.
*
* \return \c 0 on success.
* \param ctx The context of the cipher. This must be initialized.
*
* \return The key length of the cipher in bits.
- * \return #MBEDTLS_KEY_LENGTH_NONE if ctx \p has not been
+ * \return #MBEDTLS_KEY_LENGTH_NONE if \p ctx has not been
* initialized.
*/
static inline int mbedtls_cipher_get_key_bitlen(
* \brief This function sets the padding mode, for cipher modes
* that use padding.
*
- * The default passing mode is PKCS7 padding.
- *
* \param ctx The generic cipher context. This must be initialized and
* bound to a cipher information structure.
* \param mode The padding mode.
/**
* \brief This function resets the cipher state.
*
- * \param ctx The generic cipher context. This must be initialized.
+ * \note With non-AEAD ciphers, the order of calls for each message
+ * is as follows:
+ * 1. mbedtls_cipher_set_iv() if the mode uses an IV/nonce.
+ * 2. mbedtls_cipher_reset()
+ * 3. mbedtls_cipher_update() one or more times
+ * 4. mbedtls_cipher_finish()
+ * .
+ * This sequence can be repeated to encrypt or decrypt multiple
+ * messages with the same key.
+ *
+ * \note With AEAD ciphers, the order of calls for each message
+ * is as follows:
+ * 1. mbedtls_cipher_set_iv() if the mode uses an IV/nonce.
+ * 2. mbedtls_cipher_reset()
+ * 3. mbedtls_cipher_update_ad()
+ * 4. mbedtls_cipher_update() one or more times
+ * 5. mbedtls_cipher_check_tag() (for decryption) or
+ * mbedtls_cipher_write_tag() (for encryption).
+ * .
+ * This sequence can be repeated to encrypt or decrypt multiple
+ * messages with the same key.
+ *
+ * \param ctx The generic cipher context. This must be bound to a key.
*
* \return \c 0 on success.
* \return #MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA on
* \param ctx The generic cipher context. This must be initialized and
* bound to a key.
* \param output The buffer to write data to. This needs to be a writable
- * buffer of at least \p block_size Bytes.
+ * buffer of at least block_size Bytes.
* \param olen The length of the data written to the \p output buffer.
* This may not be \c NULL.
*
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_CIPHER_WRAP_H
#define MBEDTLS_CIPHER_WRAP_H
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_CMAC_H
#define MBEDTLS_AES_BLOCK_SIZE 16
#define MBEDTLS_DES3_BLOCK_SIZE 8
-#if defined(MBEDTLS_AES_C)
+
+/* Although the CMAC module does not support ARIA or CAMELLIA, we adjust the value of
+ * MBEDTLS_CIPHER_BLKSIZE_MAX to reflect these ciphers.
+ * This is done to avoid confusion, given the general-purpose name of the macro. */
+#if defined(MBEDTLS_AES_C) || defined(MBEDTLS_ARIA_C) || defined(MBEDTLS_CAMELLIA_C)
#define MBEDTLS_CIPHER_BLKSIZE_MAX 16 /**< The longest block used by CMAC is that of AES. */
#else
#define MBEDTLS_CIPHER_BLKSIZE_MAX 8 /**< The longest block used by CMAC is that of 3DES. */
/**
* \file compat-1.3.h
*
- * \brief Compatibility definitions for using mbed TLS with client code written
+ * \brief Compatibility definitions for using Mbed TLS with client code written
* for the PolarSSL naming conventions.
*
* \deprecated Use the new names directly instead
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#if !defined(MBEDTLS_CONFIG_FILE)
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_CONFIG_H
*
* Enable the memory allocation layer.
*
- * By default mbed TLS uses the system-provided calloc() and free().
+ * By default Mbed TLS uses the system-provided calloc() and free().
* This allows different allocators (self-implemented or provided) to be
* provided to the platform abstraction layer.
*
- * Enabling MBEDTLS_PLATFORM_MEMORY without the
+ * Enabling #MBEDTLS_PLATFORM_MEMORY without the
* MBEDTLS_PLATFORM_{FREE,CALLOC}_MACROs will provide
* "mbedtls_platform_set_calloc_free()" allowing you to set an alternative calloc() and
* free() function pointer at runtime.
*
- * Enabling MBEDTLS_PLATFORM_MEMORY and specifying
+ * Enabling #MBEDTLS_PLATFORM_MEMORY and specifying
* MBEDTLS_PLATFORM_{CALLOC,FREE}_MACROs will allow you to specify the
* alternate function at compile time.
*
+ * An overview of how the value of mbedtls_calloc is determined:
+ *
+ * - if !MBEDTLS_PLATFORM_MEMORY
+ * - mbedtls_calloc = calloc
+ * - if MBEDTLS_PLATFORM_MEMORY
+ * - if (MBEDTLS_PLATFORM_CALLOC_MACRO && MBEDTLS_PLATFORM_FREE_MACRO):
+ * - mbedtls_calloc = MBEDTLS_PLATFORM_CALLOC_MACRO
+ * - if !(MBEDTLS_PLATFORM_CALLOC_MACRO && MBEDTLS_PLATFORM_FREE_MACRO):
+ * - Dynamic setup via mbedtls_platform_set_calloc_free is now possible with a default value MBEDTLS_PLATFORM_STD_CALLOC.
+ * - How is MBEDTLS_PLATFORM_STD_CALLOC handled?
+ * - if MBEDTLS_PLATFORM_NO_STD_FUNCTIONS:
+ * - MBEDTLS_PLATFORM_STD_CALLOC is not set to anything;
+ * - MBEDTLS_PLATFORM_STD_MEM_HDR can be included if present;
+ * - if !MBEDTLS_PLATFORM_NO_STD_FUNCTIONS:
+ * - if MBEDTLS_PLATFORM_STD_CALLOC is present:
+ * - User-defined MBEDTLS_PLATFORM_STD_CALLOC is respected;
+ * - if !MBEDTLS_PLATFORM_STD_CALLOC:
+ * - MBEDTLS_PLATFORM_STD_CALLOC = calloc
+ *
+ * - At this point the presence of MBEDTLS_PLATFORM_STD_CALLOC is checked.
+ * - if !MBEDTLS_PLATFORM_STD_CALLOC
+ * - MBEDTLS_PLATFORM_STD_CALLOC = uninitialized_calloc
+ *
+ * - mbedtls_calloc = MBEDTLS_PLATFORM_STD_CALLOC.
+ *
+ * Defining MBEDTLS_PLATFORM_CALLOC_MACRO and #MBEDTLS_PLATFORM_STD_CALLOC at the same time is not possible.
+ * MBEDTLS_PLATFORM_CALLOC_MACRO and MBEDTLS_PLATFORM_FREE_MACRO must both be defined or undefined at the same time.
+ * #MBEDTLS_PLATFORM_STD_CALLOC and #MBEDTLS_PLATFORM_STD_FREE do not have to be defined at the same time, as, if they are used,
+ * dynamic setup of these functions is possible. See the tree above to see how are they handled in all cases.
+ * An uninitialized #MBEDTLS_PLATFORM_STD_CALLOC always fails, returning a null pointer.
+ * An uninitialized #MBEDTLS_PLATFORM_STD_FREE does not do anything.
+ *
* Requires: MBEDTLS_PLATFORM_C
*
* Enable this layer to allow use of alternative memory allocators.
/**
* \def MBEDTLS_PLATFORM_EXIT_ALT
*
- * MBEDTLS_PLATFORM_XXX_ALT: Uncomment a macro to let mbed TLS support the
+ * MBEDTLS_PLATFORM_XXX_ALT: Uncomment a macro to let Mbed TLS support the
* function in the platform abstraction layer.
*
- * Example: In case you uncomment MBEDTLS_PLATFORM_PRINTF_ALT, mbed TLS will
+ * Example: In case you uncomment MBEDTLS_PLATFORM_PRINTF_ALT, Mbed TLS will
* provide a function "mbedtls_platform_set_printf()" that allows you to set an
* alternative printf function pointer.
*
//#define MBEDTLS_PLATFORM_NV_SEED_ALT
//#define MBEDTLS_PLATFORM_SETUP_TEARDOWN_ALT
+/**
+ * Uncomment the macro to let Mbed TLS use your alternate implementation of
+ * mbedtls_platform_gmtime_r(). This replaces the default implementation in
+ * platform_util.c.
+ *
+ * gmtime() is not a thread-safe function as defined in the C standard. The
+ * library will try to use safer implementations of this function, such as
+ * gmtime_r() when available. However, if Mbed TLS cannot identify the target
+ * system, the implementation of mbedtls_platform_gmtime_r() will default to
+ * using the standard gmtime(). In this case, calls from the library to
+ * gmtime() will be guarded by the global mutex mbedtls_threading_gmtime_mutex
+ * if MBEDTLS_THREADING_C is enabled. We recommend that calls from outside the
+ * library are also guarded with this mutex to avoid race conditions. However,
+ * if the macro MBEDTLS_PLATFORM_GMTIME_R_ALT is defined, Mbed TLS will
+ * unconditionally use the implementation for mbedtls_platform_gmtime_r()
+ * supplied at compile time.
+ */
+//#define MBEDTLS_PLATFORM_GMTIME_R_ALT
+
+/**
+ * Uncomment the macro to let Mbed TLS use your alternate implementation of
+ * mbedtls_platform_zeroize(). This replaces the default implementation in
+ * platform_util.c.
+ *
+ * mbedtls_platform_zeroize() is a widely used function across the library to
+ * zero a block of memory. The implementation is expected to be secure in the
+ * sense that it has been written to prevent the compiler from removing calls
+ * to mbedtls_platform_zeroize() as part of redundant code elimination
+ * optimizations. However, it is difficult to guarantee that calls to
+ * mbedtls_platform_zeroize() will not be optimized by the compiler as older
+ * versions of the C language standards do not provide a secure implementation
+ * of memset(). Therefore, MBEDTLS_PLATFORM_ZEROIZE_ALT enables users to
+ * configure their own implementation of mbedtls_platform_zeroize(), for
+ * example by using directives specific to their compiler, features from newer
+ * C standards (e.g using memset_s() in C11) or calling a secure memset() from
+ * their system (e.g explicit_bzero() in BSD).
+ */
+//#define MBEDTLS_PLATFORM_ZEROIZE_ALT
+
/**
* \def MBEDTLS_DEPRECATED_WARNING
*
/** \} name SECTION: System support */
/**
- * \name SECTION: mbed TLS feature support
+ * \name SECTION: Mbed TLS feature support
*
* This section sets support for features that are or are not needed
* within the modules that are enabled.
/**
* \def MBEDTLS_AES_ALT
*
- * MBEDTLS__MODULE_NAME__ALT: Uncomment a macro to let mbed TLS use your
+ * MBEDTLS__MODULE_NAME__ALT: Uncomment a macro to let Mbed TLS use your
* alternate core implementation of a symmetric crypto, an arithmetic or hash
* module (e.g. platform specific assembly optimized implementations). Keep
* in mind that the function prototypes should remain the same.
* This replaces the whole module. If you only want to replace one of the
* functions, use one of the MBEDTLS__FUNCTION_NAME__ALT flags.
*
- * Example: In case you uncomment MBEDTLS_AES_ALT, mbed TLS will no longer
+ * Example: In case you uncomment MBEDTLS_AES_ALT, Mbed TLS will no longer
* provide the "struct mbedtls_aes_context" definition and omit the base
* function declarations and implementations. "aes_alt.h" will be included from
* "aes.h" to include the new function definitions.
/**
* \def MBEDTLS_MD2_PROCESS_ALT
*
- * MBEDTLS__FUNCTION_NAME__ALT: Uncomment a macro to let mbed TLS use you
+ * MBEDTLS__FUNCTION_NAME__ALT: Uncomment a macro to let Mbed TLS use you
* alternate core implementation of symmetric crypto or hash function. Keep in
* mind that function prototypes should remain the same.
*
- * This replaces only one function. The header file from mbed TLS is still
+ * This replaces only one function. The header file from Mbed TLS is still
* used, in contrast to the MBEDTLS__MODULE_NAME__ALT flags.
*
- * Example: In case you uncomment MBEDTLS_SHA256_PROCESS_ALT, mbed TLS will
+ * Example: In case you uncomment MBEDTLS_SHA256_PROCESS_ALT, Mbed TLS will
* no longer provide the mbedtls_sha1_process() function, but it will still provide
* the other function (using your mbedtls_sha1_process() function) and the definition
* of mbedtls_sha1_context, so your implementation of mbedtls_sha1_process must be compatible
*
* Expose a part of the internal interface of the Elliptic Curve Point module.
*
- * MBEDTLS_ECP__FUNCTION_NAME__ALT: Uncomment a macro to let mbed TLS use your
+ * MBEDTLS_ECP__FUNCTION_NAME__ALT: Uncomment a macro to let Mbed TLS use your
* alternative core implementation of elliptic curve arithmetic. Keep in mind
* that function prototypes should remain the same.
*
- * This partially replaces one function. The header file from mbed TLS is still
+ * This partially replaces one function. The header file from Mbed TLS is still
* used, in contrast to the MBEDTLS_ECP_ALT flag. The original implementation
* is still present and it is used for group structures not supported by the
* alternative.
* implement optimized set up and tear down instructions.
*
* Example: In case you set MBEDTLS_ECP_INTERNAL_ALT and
- * MBEDTLS_ECP_DOUBLE_JAC_ALT, mbed TLS will still provide the ecp_double_jac()
+ * MBEDTLS_ECP_DOUBLE_JAC_ALT, Mbed TLS will still provide the ecp_double_jac()
* function, but will use your mbedtls_internal_ecp_double_jac() if the group
* for the operation is supported by your implementation (i.e. your
* mbedtls_internal_ecp_grp_capable() function returns 1 for this group). If the
- * group is not supported by your implementation, then the original mbed TLS
+ * group is not supported by your implementation, then the original Mbed TLS
* implementation of ecp_double_jac() is used instead, unless this fallback
* behaviour is disabled by setting MBEDTLS_ECP_NO_FALLBACK (in which case
* ecp_double_jac() will return MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE).
/**
* \def MBEDTLS_TEST_NULL_ENTROPY
*
- * Enables testing and use of mbed TLS without any configured entropy sources.
+ * Enables testing and use of Mbed TLS without any configured entropy sources.
* This permits use of the library on platforms before an entropy source has
* been integrated (see for example the MBEDTLS_ENTROPY_HARDWARE_ALT or the
* MBEDTLS_ENTROPY_NV_SEED switches).
/**
* \def MBEDTLS_ENTROPY_HARDWARE_ALT
*
- * Uncomment this macro to let mbed TLS use your own implementation of a
+ * Uncomment this macro to let Mbed TLS use your own implementation of a
* hardware entropy collector.
*
* Your function must be called \c mbedtls_hardware_poll(), have the same
*/
#define MBEDTLS_REMOVE_3DES_CIPHERSUITES
+/**
+ * Enable the verified implementations of ECDH primitives from Project Everest
+ * (currently only Curve25519). This feature changes the layout of ECDH
+ * contexts and therefore is a compatibility break for applications that access
+ * fields of a mbedtls_ecdh_context structure directly. See also
+ * MBEDTLS_ECDH_LEGACY_CONTEXT in include/mbedtls/ecdh.h.
+ *
+ * The Everest code is provided under the Apache 2.0 license only; therefore enabling this
+ * option is not compatible with taking the library under the GPL v2.0-or-later license.
+ */
+//#define MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED
+
/**
* \def MBEDTLS_ECP_DP_SECP192R1_ENABLED
*
* );
* ```
* The \c context value is initialized to 0 before the first call.
- * The function must fill the \c output buffer with \p output_size bytes
- * of random data and set \c *output_length to \p output_size.
+ * The function must fill the \c output buffer with \c output_size bytes
+ * of random data and set \c *output_length to \c output_size.
*
* Requires: MBEDTLS_PSA_CRYPTO_C
*
*/
//#define MBEDTLS_PSA_INJECT_ENTROPY
+/**
+ * \def MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS
+ *
+ * Assume all buffers passed to PSA functions are owned exclusively by the
+ * PSA function and are not stored in shared memory.
+ *
+ * This option may be enabled if all buffers passed to any PSA function reside
+ * in memory that is accessible only to the PSA function during its execution.
+ *
+ * This option MUST be disabled whenever buffer arguments are in memory shared
+ * with an untrusted party, for example where arguments to PSA calls are passed
+ * across a trust boundary.
+ *
+ * \note Enabling this option reduces memory usage and code size.
+ *
+ * \note Enabling this option causes overlap of input and output buffers
+ * not to be supported by PSA functions.
+ */
+//#define MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS
+
/**
* \def MBEDTLS_RSA_NO_CRT
*
* \def MBEDTLS_SSL_ALL_ALERT_MESSAGES
*
* Enable sending of alert messages in case of encountered errors as per RFC.
- * If you choose not to send the alert messages, mbed TLS can still communicate
+ * If you choose not to send the alert messages, Mbed TLS can still communicate
* with other servers, only debugging of failures is harder.
*
* The advantage of not sending alert messages, is that no information is given
*/
//#define MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH
+/**
+ * Allow SHA-1 in the default TLS configuration for TLS 1.2 handshake
+ * signature and ciphersuite selection. Without this build-time option, SHA-1
+ * support must be activated explicitly through mbedtls_ssl_conf_sig_hashes.
+ * The use of SHA-1 in TLS <= 1.1 and in HMAC-SHA-1 is always allowed by
+ * default. At the time of writing, there is no practical attack on the use
+ * of SHA-1 in handshake signatures, hence this option is turned on by default
+ * to preserve compatibility with existing peers, but the general
+ * warning applies nonetheless:
+ *
+ * \warning SHA-1 is considered a weak message digest and its use constitutes
+ * a security risk. If possible, we recommend avoiding dependencies
+ * on it, and considering stronger message digests instead.
+ *
+ */
+//#define MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_KEY_EXCHANGE
+
/**
* \def MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN
*
#if defined(HAVE_LIBZ) && 0
# define MBEDTLS_ZLIB_SUPPORT
#endif
-/** \} name SECTION: mbed TLS feature support */
+/** \} name SECTION: Mbed TLS feature support */
/**
- * \name SECTION: mbed TLS modules
+ * \name SECTION: Mbed TLS modules
*
- * This section enables or disables entire modules in mbed TLS
+ * This section enables or disables entire modules in Mbed TLS
* \{
*/
* Module: library/memory_buffer_alloc.c
*
* Requires: MBEDTLS_PLATFORM_C
- * MBEDTLS_PLATFORM_MEMORY (to use it within mbed TLS)
+ * MBEDTLS_PLATFORM_MEMORY (to use it within Mbed TLS)
*
* Enable this module to enable the buffer memory allocator.
*/
* \def MBEDTLS_THREADING_C
*
* Enable the threading abstraction layer.
- * By default mbed TLS assumes it is used in a non-threaded environment or that
+ * By default Mbed TLS assumes it is used in a non-threaded environment or that
* contexts are not shared between threads. If you do intend to use contexts
* between threads, you will need to enable this layer to prevent race
* conditions. See also our Knowledge Base article about threading:
* You will have to enable either MBEDTLS_THREADING_ALT or
* MBEDTLS_THREADING_PTHREAD.
*
- * Enable this layer to allow use of mutexes within mbed TLS
+ * Enable this layer to allow use of mutexes within Mbed TLS
*/
#if defined(MBEDTLS_THREADING_ALT) || defined(MBEDTLS_THREADING_PTHREAD)
# define MBEDTLS_THREADING_C
*/
#define MBEDTLS_XTEA_C
-/** \} name SECTION: mbed TLS modules */
+/** \} name SECTION: Mbed TLS modules */
/**
* \name SECTION: General configuration options
/* Platform options */
//#define MBEDTLS_PLATFORM_STD_MEM_HDR <stdlib.h> /**< Header to include if MBEDTLS_PLATFORM_NO_STD_FUNCTIONS is defined. Don't define if no header is needed. */
-//#define MBEDTLS_PLATFORM_STD_CALLOC calloc /**< Default allocator to use, can be undefined */
-//#define MBEDTLS_PLATFORM_STD_FREE free /**< Default free to use, can be undefined */
+
+/** \def MBEDTLS_PLATFORM_STD_CALLOC
+ *
+ * Default allocator to use, can be undefined.
+ * It must initialize the allocated buffer memory to zeroes.
+ * The size of the buffer is the product of the two parameters.
+ * The calloc function returns either a null pointer or a pointer to the allocated space.
+ * If the product is 0, the function may either return NULL or a valid pointer to an array of size 0 which is a valid input to the deallocation function.
+ * An uninitialized #MBEDTLS_PLATFORM_STD_CALLOC always fails, returning a null pointer.
+ * See the description of #MBEDTLS_PLATFORM_MEMORY for more details.
+ * The corresponding deallocation function is #MBEDTLS_PLATFORM_STD_FREE.
+ */
+//#define MBEDTLS_PLATFORM_STD_CALLOC calloc
+
+/** \def MBEDTLS_PLATFORM_STD_FREE
+ *
+ * Default free to use, can be undefined.
+ * NULL is a valid parameter, and the function must do nothing.
+ * A non-null parameter will always be a pointer previously returned by #MBEDTLS_PLATFORM_STD_CALLOC and not yet freed.
+ * An uninitialized #MBEDTLS_PLATFORM_STD_FREE does not do anything.
+ * See the description of #MBEDTLS_PLATFORM_MEMORY for more details (same principles as for MBEDTLS_PLATFORM_STD_CALLOC apply).
+ */
+//#define MBEDTLS_PLATFORM_STD_FREE free
//#define MBEDTLS_PLATFORM_STD_EXIT exit /**< Default exit to use, can be undefined */
//#define MBEDTLS_PLATFORM_STD_TIME time /**< Default time to use, can be undefined. MBEDTLS_HAVE_TIME must be enabled */
//#define MBEDTLS_PLATFORM_STD_FPRINTF fprintf /**< Default fprintf to use, can be undefined */
//#define MBEDTLS_PLATFORM_STD_NV_SEED_WRITE mbedtls_platform_std_nv_seed_write /**< Default nv_seed_write function to use, can be undefined */
//#define MBEDTLS_PLATFORM_STD_NV_SEED_FILE "seedfile" /**< Seed file to read/write with default implementation */
-/* To Use Function Macros MBEDTLS_PLATFORM_C must be enabled */
+/* To use the following function macros, MBEDTLS_PLATFORM_C must be enabled. */
/* MBEDTLS_PLATFORM_XXX_MACRO and MBEDTLS_PLATFORM_XXX_ALT cannot both be defined */
-//#define MBEDTLS_PLATFORM_CALLOC_MACRO calloc /**< Default allocator macro to use, can be undefined */
-//#define MBEDTLS_PLATFORM_FREE_MACRO free /**< Default free macro to use, can be undefined */
+//#define MBEDTLS_PLATFORM_CALLOC_MACRO calloc /**< Default allocator macro to use, can be undefined. See MBEDTLS_PLATFORM_STD_CALLOC for requirements. */
+//#define MBEDTLS_PLATFORM_FREE_MACRO free /**< Default free macro to use, can be undefined. See MBEDTLS_PLATFORM_STD_FREE for requirements. */
//#define MBEDTLS_PLATFORM_EXIT_MACRO exit /**< Default exit macro to use, can be undefined */
//#define MBEDTLS_PLATFORM_TIME_MACRO time /**< Default time macro to use, can be undefined. MBEDTLS_HAVE_TIME must be enabled */
//#define MBEDTLS_PLATFORM_TIME_TYPE_MACRO time_t /**< Default time macro to use, can be undefined. MBEDTLS_HAVE_TIME must be enabled */
//#define MBEDTLS_X509_MAX_INTERMEDIATE_CA 8 /**< Maximum number of intermediate CAs in a verification chain. */
//#define MBEDTLS_X509_MAX_FILE_PATH_LEN 512 /**< Maximum length of a path/filename string in bytes including the null terminator character ('\0'). */
-/**
- * Allow SHA-1 in the default TLS configuration for TLS 1.2 handshake
- * signature and ciphersuite selection. Without this build-time option, SHA-1
- * support must be activated explicitly through mbedtls_ssl_conf_sig_hashes.
- * The use of SHA-1 in TLS <= 1.1 and in HMAC-SHA-1 is always allowed by
- * default. At the time of writing, there is no practical attack on the use
- * of SHA-1 in handshake signatures, hence this option is turned on by default
- * to preserve compatibility with existing peers, but the general
- * warning applies nonetheless:
- *
- * \warning SHA-1 is considered a weak message digest and its use constitutes
- * a security risk. If possible, we recommend avoiding dependencies
- * on it, and considering stronger message digests instead.
- *
- */
-//#define MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_KEY_EXCHANGE
-
-/**
- * Uncomment the macro to let mbed TLS use your alternate implementation of
- * mbedtls_platform_zeroize(). This replaces the default implementation in
- * platform_util.c.
- *
- * mbedtls_platform_zeroize() is a widely used function across the library to
- * zero a block of memory. The implementation is expected to be secure in the
- * sense that it has been written to prevent the compiler from removing calls
- * to mbedtls_platform_zeroize() as part of redundant code elimination
- * optimizations. However, it is difficult to guarantee that calls to
- * mbedtls_platform_zeroize() will not be optimized by the compiler as older
- * versions of the C language standards do not provide a secure implementation
- * of memset(). Therefore, MBEDTLS_PLATFORM_ZEROIZE_ALT enables users to
- * configure their own implementation of mbedtls_platform_zeroize(), for
- * example by using directives specific to their compiler, features from newer
- * C standards (e.g using memset_s() in C11) or calling a secure memset() from
- * their system (e.g explicit_bzero() in BSD).
- */
-//#define MBEDTLS_PLATFORM_ZEROIZE_ALT
-
-/**
- * Uncomment the macro to let Mbed TLS use your alternate implementation of
- * mbedtls_platform_gmtime_r(). This replaces the default implementation in
- * platform_util.c.
- *
- * gmtime() is not a thread-safe function as defined in the C standard. The
- * library will try to use safer implementations of this function, such as
- * gmtime_r() when available. However, if Mbed TLS cannot identify the target
- * system, the implementation of mbedtls_platform_gmtime_r() will default to
- * using the standard gmtime(). In this case, calls from the library to
- * gmtime() will be guarded by the global mutex mbedtls_threading_gmtime_mutex
- * if MBEDTLS_THREADING_C is enabled. We recommend that calls from outside the
- * library are also guarded with this mutex to avoid race conditions. However,
- * if the macro MBEDTLS_PLATFORM_GMTIME_R_ALT is defined, Mbed TLS will
- * unconditionally use the implementation for mbedtls_platform_gmtime_r()
- * supplied at compile time.
- */
-//#define MBEDTLS_PLATFORM_GMTIME_R_ALT
-
-/**
- * Enable the verified implementations of ECDH primitives from Project Everest
- * (currently only Curve25519). This feature changes the layout of ECDH
- * contexts and therefore is a compatibility break for applications that access
- * fields of a mbedtls_ecdh_context structure directly. See also
- * MBEDTLS_ECDH_LEGACY_CONTEXT in include/mbedtls/ecdh.h.
- */
-//#define MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED
-
/** \} name SECTION: Module configuration options */
/* Target and application specific configurations
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_CONFIG_PSA_H
#if defined(PSA_WANT_ALG_HKDF)
#if !defined(MBEDTLS_PSA_ACCEL_ALG_HKDF)
+/*
+ * The PSA implementation has its own implementation of HKDF, separate from
+ * hkdf.c. No need to enable MBEDTLS_HKDF_C here.
+ */
#define MBEDTLS_PSA_BUILTIN_ALG_HMAC 1
#define MBEDTLS_PSA_BUILTIN_ALG_HKDF 1
#endif /* !MBEDTLS_PSA_ACCEL_ALG_HKDF */
#if defined(MBEDTLS_MD_C)
#define MBEDTLS_PSA_BUILTIN_ALG_HMAC 1
#define PSA_WANT_ALG_HMAC 1
-#define PSA_WANT_KEY_TYPE_HMAC
+#define PSA_WANT_KEY_TYPE_HMAC 1
#define MBEDTLS_PSA_BUILTIN_ALG_TLS12_PRF 1
#define PSA_WANT_ALG_TLS12_PRF 1
#define MBEDTLS_PSA_BUILTIN_ALG_TLS12_PSK_TO_MS 1
#if defined(MBEDTLS_ECP_DP_BP256R1_ENABLED)
#define MBEDTLS_PSA_BUILTIN_ECC_BRAINPOOL_P_R1_256 1
-#define PSA_WANT_ECC_BRAINPOOL_P_R1_256
+#define PSA_WANT_ECC_BRAINPOOL_P_R1_256 1
#endif
#if defined(MBEDTLS_ECP_DP_BP384R1_ENABLED)
#define MBEDTLS_PSA_BUILTIN_ECC_BRAINPOOL_P_R1_384 1
-#define PSA_WANT_ECC_BRAINPOOL_P_R1_384
+#define PSA_WANT_ECC_BRAINPOOL_P_R1_384 1
#endif
#if defined(MBEDTLS_ECP_DP_BP512R1_ENABLED)
#define MBEDTLS_PSA_BUILTIN_ECC_BRAINPOOL_P_R1_512 1
-#define PSA_WANT_ECC_BRAINPOOL_P_R1_512
+#define PSA_WANT_ECC_BRAINPOOL_P_R1_512 1
#endif
#if defined(MBEDTLS_ECP_DP_CURVE25519_ENABLED)
#define MBEDTLS_PSA_BUILTIN_ECC_MONTGOMERY_255 1
-#define PSA_WANT_ECC_MONTGOMERY_255
+#define PSA_WANT_ECC_MONTGOMERY_255 1
#endif
/* Curve448 is not yet supported via the PSA API (https://github.com/Mbed-TLS/mbedtls/issues/4249) */
#if 0 && defined(MBEDTLS_ECP_DP_CURVE448_ENABLED)
#define MBEDTLS_PSA_BUILTIN_ECC_MONTGOMERY_448 1
-#define PSA_WANT_ECC_MONTGOMERY_448
+#define PSA_WANT_ECC_MONTGOMERY_448 1
#endif
#if defined(MBEDTLS_ECP_DP_SECP192R1_ENABLED)
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_192 1
-#define PSA_WANT_ECC_SECP_R1_192
+#define PSA_WANT_ECC_SECP_R1_192 1
#endif
#if defined(MBEDTLS_ECP_DP_SECP224R1_ENABLED)
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_224 1
-#define PSA_WANT_ECC_SECP_R1_224
+#define PSA_WANT_ECC_SECP_R1_224 1
#endif
#if defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED)
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_256 1
-#define PSA_WANT_ECC_SECP_R1_256
+#define PSA_WANT_ECC_SECP_R1_256 1
#endif
#if defined(MBEDTLS_ECP_DP_SECP384R1_ENABLED)
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_384 1
-#define PSA_WANT_ECC_SECP_R1_384
+#define PSA_WANT_ECC_SECP_R1_384 1
#endif
#if defined(MBEDTLS_ECP_DP_SECP521R1_ENABLED)
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_R1_521 1
-#define PSA_WANT_ECC_SECP_R1_521
+#define PSA_WANT_ECC_SECP_R1_521 1
#endif
#if defined(MBEDTLS_ECP_DP_SECP192K1_ENABLED)
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_K1_192 1
-#define PSA_WANT_ECC_SECP_K1_192
+#define PSA_WANT_ECC_SECP_K1_192 1
#endif
/* SECP224K1 is buggy via the PSA API (https://github.com/Mbed-TLS/mbedtls/issues/3541) */
#if 0 && defined(MBEDTLS_ECP_DP_SECP224K1_ENABLED)
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_K1_224 1
-#define PSA_WANT_ECC_SECP_K1_224
+#define PSA_WANT_ECC_SECP_K1_224 1
#endif
#if defined(MBEDTLS_ECP_DP_SECP256K1_ENABLED)
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_K1_256 1
-#define PSA_WANT_ECC_SECP_K1_256
+#define PSA_WANT_ECC_SECP_K1_256 1
#endif
#endif /* MBEDTLS_PSA_CRYPTO_CONFIG */
* Constant-time functions
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_CONSTANT_TIME_H
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_CTR_DRBG_H
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_DEBUG_H
#define MBEDTLS_DEBUG_H
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*
*/
#ifndef MBEDTLS_DES_H
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_DHM_H
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_ECDH_H
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_ECDSA_H
* \param md_alg The hash algorithm used to hash the original data.
* \param f_rng_blind The RNG function used for blinding. This must not be
* \c NULL.
- * \param p_rng_blind The RNG context to be passed to \p f_rng. This may be
- * \c NULL if \p f_rng doesn't need a context parameter.
+ * \param p_rng_blind The RNG context to be passed to \p f_rng_blind. This
+ * may be \c NULL if \p f_rng_blind doesn't need
+ * a context parameter.
*
* \return \c 0 on success.
* \return An \c MBEDTLS_ERR_ECP_XXX or \c MBEDTLS_MPI_XXX
* via mbedtls_ecdsa_genkey() or mbedtls_ecdsa_from_keypair().
* \param md_alg The message digest that was used to hash the message.
* \param hash The message hash to be signed. This must be a readable
- * buffer of length \p blen Bytes.
+ * buffer of length \p hlen Bytes.
* \param hlen The length of the hash \p hash in Bytes.
* \param sig The buffer to which to write the signature. This must be a
* writable buffer of length at least twice as large as the
* via mbedtls_ecdsa_genkey() or mbedtls_ecdsa_from_keypair().
* \param md_alg The message digest that was used to hash the message.
* \param hash The message hash to be signed. This must be a readable
- * buffer of length \p blen Bytes.
+ * buffer of length \p hlen Bytes.
* \param hlen The length of the hash \p hash in Bytes.
* \param sig The buffer to which to write the signature. This must be a
* writable buffer of length at least twice as large as the
* and have a group and private key bound to it, for example
* via mbedtls_ecdsa_genkey() or mbedtls_ecdsa_from_keypair().
* \param hash The message hash to be signed. This must be a readable
- * buffer of length \p blen Bytes.
+ * buffer of length \p hlen Bytes.
* \param hlen The length of the hash \p hash in Bytes.
* \param sig The buffer to which to write the signature. This must be a
* writable buffer of length at least twice as large as the
* \param ctx The ECDSA context to use. This must be initialized
* and have a group and public key bound to it.
* \param hash The message hash that was signed. This must be a readable
- * buffer of length \p size Bytes.
+ * buffer of length \p hlen Bytes.
* \param hlen The size of the hash \p hash.
* \param sig The signature to read and verify. This must be a readable
* buffer of length \p slen Bytes.
* \param ctx The ECDSA context to use. This must be initialized
* and have a group and public key bound to it.
* \param hash The message hash that was signed. This must be a readable
- * buffer of length \p size Bytes.
+ * buffer of length \p hlen Bytes.
* \param hlen The size of the hash \p hash.
* \param sig The signature to read and verify. This must be a readable
* buffer of length \p slen Bytes.
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_ECJPAKE_H
#define MBEDTLS_ECJPAKE_H
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_ECP_H
#include "mbedtls/bignum.h"
+#if (defined(__ARMCC_VERSION) || defined(_MSC_VER)) && \
+ !defined(inline) && !defined(__cplusplus)
+#define inline __inline
+#endif
+
/*
* ECP error codes
*/
#if !defined(MBEDTLS_ECP_ALT)
/*
- * default mbed TLS elliptic curve arithmetic implementation
+ * default Mbed TLS elliptic curve arithmetic implementation
*
* (in case MBEDTLS_ECP_ALT is defined then the developer has to provide an
* alternative implementation for the whole module and it will replace this
* odd prime as mbedtls_ecp_mul() requires an odd number, and
* mbedtls_ecdsa_sign() requires that it is prime for blinding purposes.
*
+ * The default implementation only initializes \p A without setting it to the
+ * authentic value for curves with <code>A = -3</code>(SECP256R1, etc), in which
+ * case you need to load \p A by yourself when using domain parameters directly,
+ * for example:
+ * \code
+ * mbedtls_mpi_init(&A);
+ * mbedtls_ecp_group_init(&grp);
+ * CHECK_RETURN(mbedtls_ecp_group_load(&grp, grp_id));
+ * if (mbedtls_ecp_group_a_is_minus_3(&grp)) {
+ * CHECK_RETURN(mbedtls_mpi_sub_int(&A, &grp.P, 3));
+ * } else {
+ * CHECK_RETURN(mbedtls_mpi_copy(&A, &grp.A));
+ * }
+ *
+ * do_something_with_a(&A);
+ *
+ * cleanup:
+ * mbedtls_mpi_free(&A);
+ * mbedtls_ecp_group_free(&grp);
+ * \endcode
+ *
* For Montgomery curves, we do not store \p A, but <code>(A + 2) / 4</code>,
* which is the quantity used in the formulas. Additionally, \p nbits is
* not the size of \p N but the required size for private keys.
typedef struct mbedtls_ecp_group {
mbedtls_ecp_group_id id; /*!< An internal group identifier. */
mbedtls_mpi P; /*!< The prime modulus of the base field. */
- mbedtls_mpi A; /*!< For Short Weierstrass: \p A in the equation. For
- Montgomery curves: <code>(A + 2) / 4</code>. */
+ mbedtls_mpi A; /*!< For Short Weierstrass: \p A in the equation. Note that
+ \p A is not set to the authentic value in some cases.
+ Refer to detailed description of ::mbedtls_ecp_group if
+ using domain parameters in the structure.
+ For Montgomery curves: <code>(A + 2) / 4</code>. */
mbedtls_mpi B; /*!< For Short Weierstrass: \p B in the equation.
For Montgomery curves: unused. */
mbedtls_ecp_point G; /*!< The generator of the subgroup used. */
mbedtls_ecp_restart_ctx *rs_ctx);
#if defined(MBEDTLS_ECP_SHORT_WEIERSTRASS_ENABLED)
+/**
+ * \brief This function checks if domain parameter A of the curve is
+ * \c -3.
+ *
+ * \note This function is only defined for short Weierstrass curves.
+ * It may not be included in builds without any short
+ * Weierstrass curve.
+ *
+ * \param grp The ECP group to use.
+ * This must be initialized and have group parameters
+ * set, for example through mbedtls_ecp_group_load().
+ *
+ * \return \c 1 if <code>A = -3</code>.
+ * \return \c 0 Otherwise.
+ */
+static inline int mbedtls_ecp_group_a_is_minus_3(const mbedtls_ecp_group *grp)
+{
+ return grp->A.p == NULL;
+}
+
/**
* \brief This function performs multiplication and addition of two
* points by integers: \p R = \p m * \p P + \p n * \p Q
*
* It only checks that the point is non-zero, has
* valid coordinates and lies on the curve. It does not verify
- * that it is indeed a multiple of \p G. This additional
+ * that it is indeed a multiple of \c G. This additional
* check is computationally more expensive, is not required
* by standards, and should not be necessary if the group
* used has a small cofactor. In particular, it is useless for
const mbedtls_ecp_point *pt);
/**
- * \brief This function checks that an \p mbedtls_mpi is a
+ * \brief This function checks that an \c mbedtls_mpi is a
* valid private key for this curve.
*
* \note This function uses bare components rather than an
/**
* \brief This function reads an elliptic curve private key.
*
+ * \note This function does not support Curve448 yet.
+ *
* \param grp_id The ECP group identifier.
* \param key The destination key.
* \param buf The buffer containing the binary representation of the
/**
* \brief This function exports an elliptic curve private key.
*
+ * \note Note that although this function accepts an output
+ * buffer that is smaller or larger than the key, most key
+ * import interfaces require the output to have exactly
+ * key's nominal length. It is generally simplest to
+ * pass the key's nominal length as \c buflen, after
+ * checking that the output buffer is large enough.
+ * See the description of the \p buflen parameter for
+ * how to calculate the nominal length.
+ *
+ * \note If the private key was not set in \p key,
+ * the output is unspecified. Future versions
+ * may return an error in that case.
+ *
+ * \note This function does not support Curve448 yet.
+ *
* \param key The private key.
* \param buf The output buffer for containing the binary representation
- * of the key. (Big endian integer for Weierstrass curves, byte
- * string for Montgomery curves.)
+ * of the key.
+ * For Weierstrass curves, this is the big-endian
+ * representation, padded with null bytes at the beginning
+ * to reach \p buflen bytes.
+ * For Montgomery curves, this is the standard byte string
+ * representation (which is little-endian), padded with
+ * null bytes at the end to reach \p buflen bytes.
* \param buflen The total length of the buffer in bytes.
+ * The length of the output is
+ * (`grp->nbits` + 7) / 8 bytes
+ * where `grp->nbits` is the private key size in bits.
+ * For Weierstrass keys, if the output buffer is smaller,
+ * leading zeros are trimmed to fit if possible. For
+ * Montgomery keys, the output buffer must always be large
+ * enough for the nominal length.
*
* \return \c 0 on success.
- * \return #MBEDTLS_ERR_ECP_BUFFER_TOO_SMALL if the \p key
- representation is larger than the available space in \p buf.
- * \return #MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE if the operation for
- * the group is not implemented.
+ * \return #MBEDTLS_ERR_ECP_BUFFER_TOO_SMALL or
+ * #MBEDTLS_ERR_MPI_BUFFER_TOO_SMALL if the \p key
+ * representation is larger than the available space in \p buf.
* \return Another negative error code on different kinds of failure.
*/
int mbedtls_ecp_write_key(mbedtls_ecp_keypair *key,
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
/*
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_ENTROPY_H
#define MBEDTLS_ENTROPY_H
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_ENTROPY_POLL_H
#define MBEDTLS_ENTROPY_POLL_H
/**
* \brief Entropy poll callback for a hardware source
*
- * \warning This is not provided by mbed TLS!
+ * \warning This is not provided by Mbed TLS!
* See \c MBEDTLS_ENTROPY_HARDWARE_ALT in config.h.
*
* \note This must accept NULL as its first argument.
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_ERROR_H
#define MBEDTLS_ERROR_H
}
/**
- * \brief Translate a mbed TLS error code into a string representation,
- * Result is truncated if necessary and always includes a terminating
- * null byte.
+ * \brief Translate an Mbed TLS error code into a string representation.
+ * The result is truncated if necessary and always includes a
+ * terminating null byte.
*
* \param errnum error code
* \param buffer buffer to place representation in
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_GCM_H
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_HAVEGE_H
#define MBEDTLS_HAVEGE_H
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_HKDF_H
#define MBEDTLS_HKDF_H
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_HMAC_DRBG_H
#define MBEDTLS_HMAC_DRBG_H
* \param len The length of the personalization string.
* This must be at most #MBEDTLS_HMAC_DRBG_MAX_INPUT
* and also at most
- * #MBEDTLS_HMAC_DRBG_MAX_SEED_INPUT - \p entropy_len * 3 / 2
- * where \p entropy_len is the entropy length
+ * #MBEDTLS_HMAC_DRBG_MAX_SEED_INPUT - \c entropy_len * 3 / 2
+ * where \c entropy_len is the entropy length
* described above.
*
* \return \c 0 if successful.
* \param len The length of the additional data.
* This must be at most #MBEDTLS_HMAC_DRBG_MAX_INPUT
* and also at most
- * #MBEDTLS_HMAC_DRBG_MAX_SEED_INPUT - \p entropy_len
- * where \p entropy_len is the entropy length
+ * #MBEDTLS_HMAC_DRBG_MAX_SEED_INPUT - \c entropy_len
+ * where \c entropy_len is the entropy length
* (see mbedtls_hmac_drbg_set_entropy_len()).
*
* \return \c 0 if successful.
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_MD_H
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*
*/
#ifndef MBEDTLS_MD2_H
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*
*/
#ifndef MBEDTLS_MD4_H
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_MD5_H
#define MBEDTLS_MD5_H
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_MD_WRAP_H
#define MBEDTLS_MD_WRAP_H
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_MEMORY_BUFFER_ALLOC_H
#define MBEDTLS_MEMORY_BUFFER_ALLOC_H
for x in connect/mbedtls/?*.o; do echo ${x##*mbedtls?} $x; done | sort | \
while read _ x; do nm -g --defined-only $x | sed -e 's,_ncbicxx_.*,,' | \
sort -k3; done | \
- awk '/ / { s=substr($3, 1); print "#define", s " \\\n " s "_ncbicxx_2_28_3" }'
+ awk '/ / { s=substr($3, 1); print "#define", s " \\\n " s "_ncbicxx_2_28_8" }'
*/
#define mbedtls_aes_crypt_cbc \
- mbedtls_aes_crypt_cbc_ncbicxx_2_28_3
+ mbedtls_aes_crypt_cbc_ncbicxx_2_28_8
#define mbedtls_aes_crypt_cfb128 \
- mbedtls_aes_crypt_cfb128_ncbicxx_2_28_3
+ mbedtls_aes_crypt_cfb128_ncbicxx_2_28_8
#define mbedtls_aes_crypt_cfb8 \
- mbedtls_aes_crypt_cfb8_ncbicxx_2_28_3
+ mbedtls_aes_crypt_cfb8_ncbicxx_2_28_8
#define mbedtls_aes_crypt_ctr \
- mbedtls_aes_crypt_ctr_ncbicxx_2_28_3
+ mbedtls_aes_crypt_ctr_ncbicxx_2_28_8
#define mbedtls_aes_crypt_ecb \
- mbedtls_aes_crypt_ecb_ncbicxx_2_28_3
+ mbedtls_aes_crypt_ecb_ncbicxx_2_28_8
#define mbedtls_aes_crypt_ofb \
- mbedtls_aes_crypt_ofb_ncbicxx_2_28_3
+ mbedtls_aes_crypt_ofb_ncbicxx_2_28_8
#define mbedtls_aes_crypt_xts \
- mbedtls_aes_crypt_xts_ncbicxx_2_28_3
+ mbedtls_aes_crypt_xts_ncbicxx_2_28_8
#define mbedtls_aes_decrypt \
- mbedtls_aes_decrypt_ncbicxx_2_28_3
+ mbedtls_aes_decrypt_ncbicxx_2_28_8
#define mbedtls_aes_encrypt \
- mbedtls_aes_encrypt_ncbicxx_2_28_3
+ mbedtls_aes_encrypt_ncbicxx_2_28_8
#define mbedtls_aes_free \
- mbedtls_aes_free_ncbicxx_2_28_3
+ mbedtls_aes_free_ncbicxx_2_28_8
#define mbedtls_aes_init \
- mbedtls_aes_init_ncbicxx_2_28_3
+ mbedtls_aes_init_ncbicxx_2_28_8
#define mbedtls_aes_setkey_dec \
- mbedtls_aes_setkey_dec_ncbicxx_2_28_3
+ mbedtls_aes_setkey_dec_ncbicxx_2_28_8
#define mbedtls_aes_setkey_enc \
- mbedtls_aes_setkey_enc_ncbicxx_2_28_3
+ mbedtls_aes_setkey_enc_ncbicxx_2_28_8
#define mbedtls_aes_xts_free \
- mbedtls_aes_xts_free_ncbicxx_2_28_3
+ mbedtls_aes_xts_free_ncbicxx_2_28_8
#define mbedtls_aes_xts_init \
- mbedtls_aes_xts_init_ncbicxx_2_28_3
+ mbedtls_aes_xts_init_ncbicxx_2_28_8
#define mbedtls_aes_xts_setkey_dec \
- mbedtls_aes_xts_setkey_dec_ncbicxx_2_28_3
+ mbedtls_aes_xts_setkey_dec_ncbicxx_2_28_8
#define mbedtls_aes_xts_setkey_enc \
- mbedtls_aes_xts_setkey_enc_ncbicxx_2_28_3
+ mbedtls_aes_xts_setkey_enc_ncbicxx_2_28_8
#define mbedtls_internal_aes_decrypt \
- mbedtls_internal_aes_decrypt_ncbicxx_2_28_3
+ mbedtls_internal_aes_decrypt_ncbicxx_2_28_8
#define mbedtls_internal_aes_encrypt \
- mbedtls_internal_aes_encrypt_ncbicxx_2_28_3
+ mbedtls_internal_aes_encrypt_ncbicxx_2_28_8
#define mbedtls_aesni_crypt_ecb \
- mbedtls_aesni_crypt_ecb_ncbicxx_2_28_3
+ mbedtls_aesni_crypt_ecb_ncbicxx_2_28_8
#define mbedtls_aesni_gcm_mult \
- mbedtls_aesni_gcm_mult_ncbicxx_2_28_3
+ mbedtls_aesni_gcm_mult_ncbicxx_2_28_8
#define mbedtls_aesni_has_support \
- mbedtls_aesni_has_support_ncbicxx_2_28_3
+ mbedtls_aesni_has_support_ncbicxx_2_28_8
#define mbedtls_aesni_inverse_key \
- mbedtls_aesni_inverse_key_ncbicxx_2_28_3
+ mbedtls_aesni_inverse_key_ncbicxx_2_28_8
#define mbedtls_aesni_setkey_enc \
- mbedtls_aesni_setkey_enc_ncbicxx_2_28_3
+ mbedtls_aesni_setkey_enc_ncbicxx_2_28_8
#define mbedtls_arc4_crypt \
- mbedtls_arc4_crypt_ncbicxx_2_28_3
+ mbedtls_arc4_crypt_ncbicxx_2_28_8
#define mbedtls_arc4_free \
- mbedtls_arc4_free_ncbicxx_2_28_3
+ mbedtls_arc4_free_ncbicxx_2_28_8
#define mbedtls_arc4_init \
- mbedtls_arc4_init_ncbicxx_2_28_3
+ mbedtls_arc4_init_ncbicxx_2_28_8
#define mbedtls_arc4_setup \
- mbedtls_arc4_setup_ncbicxx_2_28_3
+ mbedtls_arc4_setup_ncbicxx_2_28_8
#define mbedtls_asn1_find_named_data \
- mbedtls_asn1_find_named_data_ncbicxx_2_28_3
+ mbedtls_asn1_find_named_data_ncbicxx_2_28_8
#define mbedtls_asn1_free_named_data \
- mbedtls_asn1_free_named_data_ncbicxx_2_28_3
+ mbedtls_asn1_free_named_data_ncbicxx_2_28_8
#define mbedtls_asn1_free_named_data_list \
- mbedtls_asn1_free_named_data_list_ncbicxx_2_28_3
+ mbedtls_asn1_free_named_data_list_ncbicxx_2_28_8
#define mbedtls_asn1_get_alg \
- mbedtls_asn1_get_alg_ncbicxx_2_28_3
+ mbedtls_asn1_get_alg_ncbicxx_2_28_8
#define mbedtls_asn1_get_alg_null \
- mbedtls_asn1_get_alg_null_ncbicxx_2_28_3
+ mbedtls_asn1_get_alg_null_ncbicxx_2_28_8
#define mbedtls_asn1_get_bitstring \
- mbedtls_asn1_get_bitstring_ncbicxx_2_28_3
+ mbedtls_asn1_get_bitstring_ncbicxx_2_28_8
#define mbedtls_asn1_get_bitstring_null \
- mbedtls_asn1_get_bitstring_null_ncbicxx_2_28_3
+ mbedtls_asn1_get_bitstring_null_ncbicxx_2_28_8
#define mbedtls_asn1_get_bool \
- mbedtls_asn1_get_bool_ncbicxx_2_28_3
+ mbedtls_asn1_get_bool_ncbicxx_2_28_8
#define mbedtls_asn1_get_enum \
- mbedtls_asn1_get_enum_ncbicxx_2_28_3
+ mbedtls_asn1_get_enum_ncbicxx_2_28_8
#define mbedtls_asn1_get_int \
- mbedtls_asn1_get_int_ncbicxx_2_28_3
+ mbedtls_asn1_get_int_ncbicxx_2_28_8
#define mbedtls_asn1_get_len \
- mbedtls_asn1_get_len_ncbicxx_2_28_3
+ mbedtls_asn1_get_len_ncbicxx_2_28_8
#define mbedtls_asn1_get_mpi \
- mbedtls_asn1_get_mpi_ncbicxx_2_28_3
+ mbedtls_asn1_get_mpi_ncbicxx_2_28_8
#define mbedtls_asn1_get_sequence_of \
- mbedtls_asn1_get_sequence_of_ncbicxx_2_28_3
+ mbedtls_asn1_get_sequence_of_ncbicxx_2_28_8
#define mbedtls_asn1_get_tag \
- mbedtls_asn1_get_tag_ncbicxx_2_28_3
+ mbedtls_asn1_get_tag_ncbicxx_2_28_8
#define mbedtls_asn1_sequence_free \
- mbedtls_asn1_sequence_free_ncbicxx_2_28_3
+ mbedtls_asn1_sequence_free_ncbicxx_2_28_8
#define mbedtls_asn1_traverse_sequence_of \
- mbedtls_asn1_traverse_sequence_of_ncbicxx_2_28_3
+ mbedtls_asn1_traverse_sequence_of_ncbicxx_2_28_8
#define mbedtls_asn1_store_named_data \
- mbedtls_asn1_store_named_data_ncbicxx_2_28_3
+ mbedtls_asn1_store_named_data_ncbicxx_2_28_8
#define mbedtls_asn1_write_algorithm_identifier \
- mbedtls_asn1_write_algorithm_identifier_ncbicxx_2_28_3
+ mbedtls_asn1_write_algorithm_identifier_ncbicxx_2_28_8
+#define mbedtls_asn1_write_algorithm_identifier_ext \
+ mbedtls_asn1_write_algorithm_identifier_ext_ncbicxx_2_28_8
#define mbedtls_asn1_write_bitstring \
- mbedtls_asn1_write_bitstring_ncbicxx_2_28_3
+ mbedtls_asn1_write_bitstring_ncbicxx_2_28_8
#define mbedtls_asn1_write_bool \
- mbedtls_asn1_write_bool_ncbicxx_2_28_3
+ mbedtls_asn1_write_bool_ncbicxx_2_28_8
#define mbedtls_asn1_write_enum \
- mbedtls_asn1_write_enum_ncbicxx_2_28_3
+ mbedtls_asn1_write_enum_ncbicxx_2_28_8
#define mbedtls_asn1_write_ia5_string \
- mbedtls_asn1_write_ia5_string_ncbicxx_2_28_3
+ mbedtls_asn1_write_ia5_string_ncbicxx_2_28_8
#define mbedtls_asn1_write_int \
- mbedtls_asn1_write_int_ncbicxx_2_28_3
+ mbedtls_asn1_write_int_ncbicxx_2_28_8
#define mbedtls_asn1_write_len \
- mbedtls_asn1_write_len_ncbicxx_2_28_3
+ mbedtls_asn1_write_len_ncbicxx_2_28_8
#define mbedtls_asn1_write_mpi \
- mbedtls_asn1_write_mpi_ncbicxx_2_28_3
+ mbedtls_asn1_write_mpi_ncbicxx_2_28_8
#define mbedtls_asn1_write_named_bitstring \
- mbedtls_asn1_write_named_bitstring_ncbicxx_2_28_3
+ mbedtls_asn1_write_named_bitstring_ncbicxx_2_28_8
#define mbedtls_asn1_write_null \
- mbedtls_asn1_write_null_ncbicxx_2_28_3
+ mbedtls_asn1_write_null_ncbicxx_2_28_8
#define mbedtls_asn1_write_octet_string \
- mbedtls_asn1_write_octet_string_ncbicxx_2_28_3
+ mbedtls_asn1_write_octet_string_ncbicxx_2_28_8
#define mbedtls_asn1_write_oid \
- mbedtls_asn1_write_oid_ncbicxx_2_28_3
+ mbedtls_asn1_write_oid_ncbicxx_2_28_8
#define mbedtls_asn1_write_printable_string \
- mbedtls_asn1_write_printable_string_ncbicxx_2_28_3
+ mbedtls_asn1_write_printable_string_ncbicxx_2_28_8
#define mbedtls_asn1_write_raw_buffer \
- mbedtls_asn1_write_raw_buffer_ncbicxx_2_28_3
+ mbedtls_asn1_write_raw_buffer_ncbicxx_2_28_8
#define mbedtls_asn1_write_tag \
- mbedtls_asn1_write_tag_ncbicxx_2_28_3
+ mbedtls_asn1_write_tag_ncbicxx_2_28_8
#define mbedtls_asn1_write_tagged_string \
- mbedtls_asn1_write_tagged_string_ncbicxx_2_28_3
+ mbedtls_asn1_write_tagged_string_ncbicxx_2_28_8
#define mbedtls_asn1_write_utf8_string \
- mbedtls_asn1_write_utf8_string_ncbicxx_2_28_3
+ mbedtls_asn1_write_utf8_string_ncbicxx_2_28_8
#define mbedtls_base64_decode \
- mbedtls_base64_decode_ncbicxx_2_28_3
+ mbedtls_base64_decode_ncbicxx_2_28_8
#define mbedtls_base64_encode \
- mbedtls_base64_encode_ncbicxx_2_28_3
+ mbedtls_base64_encode_ncbicxx_2_28_8
#define mbedtls_mpi_add_abs \
- mbedtls_mpi_add_abs_ncbicxx_2_28_3
+ mbedtls_mpi_add_abs_ncbicxx_2_28_8
#define mbedtls_mpi_add_int \
- mbedtls_mpi_add_int_ncbicxx_2_28_3
+ mbedtls_mpi_add_int_ncbicxx_2_28_8
#define mbedtls_mpi_add_mpi \
- mbedtls_mpi_add_mpi_ncbicxx_2_28_3
+ mbedtls_mpi_add_mpi_ncbicxx_2_28_8
#define mbedtls_mpi_bitlen \
- mbedtls_mpi_bitlen_ncbicxx_2_28_3
+ mbedtls_mpi_bitlen_ncbicxx_2_28_8
#define mbedtls_mpi_cmp_abs \
- mbedtls_mpi_cmp_abs_ncbicxx_2_28_3
+ mbedtls_mpi_cmp_abs_ncbicxx_2_28_8
#define mbedtls_mpi_cmp_int \
- mbedtls_mpi_cmp_int_ncbicxx_2_28_3
+ mbedtls_mpi_cmp_int_ncbicxx_2_28_8
#define mbedtls_mpi_cmp_mpi \
- mbedtls_mpi_cmp_mpi_ncbicxx_2_28_3
+ mbedtls_mpi_cmp_mpi_ncbicxx_2_28_8
#define mbedtls_mpi_copy \
- mbedtls_mpi_copy_ncbicxx_2_28_3
+ mbedtls_mpi_copy_ncbicxx_2_28_8
#define mbedtls_mpi_div_int \
- mbedtls_mpi_div_int_ncbicxx_2_28_3
+ mbedtls_mpi_div_int_ncbicxx_2_28_8
#define mbedtls_mpi_div_mpi \
- mbedtls_mpi_div_mpi_ncbicxx_2_28_3
+ mbedtls_mpi_div_mpi_ncbicxx_2_28_8
#define mbedtls_mpi_exp_mod \
- mbedtls_mpi_exp_mod_ncbicxx_2_28_3
+ mbedtls_mpi_exp_mod_ncbicxx_2_28_8
#define mbedtls_mpi_fill_random \
- mbedtls_mpi_fill_random_ncbicxx_2_28_3
+ mbedtls_mpi_fill_random_ncbicxx_2_28_8
#define mbedtls_mpi_free \
- mbedtls_mpi_free_ncbicxx_2_28_3
+ mbedtls_mpi_free_ncbicxx_2_28_8
#define mbedtls_mpi_gcd \
- mbedtls_mpi_gcd_ncbicxx_2_28_3
+ mbedtls_mpi_gcd_ncbicxx_2_28_8
#define mbedtls_mpi_gen_prime \
- mbedtls_mpi_gen_prime_ncbicxx_2_28_3
+ mbedtls_mpi_gen_prime_ncbicxx_2_28_8
#define mbedtls_mpi_get_bit \
- mbedtls_mpi_get_bit_ncbicxx_2_28_3
+ mbedtls_mpi_get_bit_ncbicxx_2_28_8
+#define mbedtls_mpi_get_mont_r2_unsafe \
+ mbedtls_mpi_get_mont_r2_unsafe_ncbicxx_2_28_8
#define mbedtls_mpi_grow \
- mbedtls_mpi_grow_ncbicxx_2_28_3
+ mbedtls_mpi_grow_ncbicxx_2_28_8
#define mbedtls_mpi_init \
- mbedtls_mpi_init_ncbicxx_2_28_3
+ mbedtls_mpi_init_ncbicxx_2_28_8
#define mbedtls_mpi_inv_mod \
- mbedtls_mpi_inv_mod_ncbicxx_2_28_3
+ mbedtls_mpi_inv_mod_ncbicxx_2_28_8
#define mbedtls_mpi_is_prime \
- mbedtls_mpi_is_prime_ncbicxx_2_28_3
+ mbedtls_mpi_is_prime_ncbicxx_2_28_8
#define mbedtls_mpi_is_prime_ext \
- mbedtls_mpi_is_prime_ext_ncbicxx_2_28_3
+ mbedtls_mpi_is_prime_ext_ncbicxx_2_28_8
#define mbedtls_mpi_lsb \
- mbedtls_mpi_lsb_ncbicxx_2_28_3
+ mbedtls_mpi_lsb_ncbicxx_2_28_8
#define mbedtls_mpi_lset \
- mbedtls_mpi_lset_ncbicxx_2_28_3
+ mbedtls_mpi_lset_ncbicxx_2_28_8
#define mbedtls_mpi_mod_int \
- mbedtls_mpi_mod_int_ncbicxx_2_28_3
+ mbedtls_mpi_mod_int_ncbicxx_2_28_8
#define mbedtls_mpi_mod_mpi \
- mbedtls_mpi_mod_mpi_ncbicxx_2_28_3
+ mbedtls_mpi_mod_mpi_ncbicxx_2_28_8
+#define mbedtls_mpi_montmul \
+ mbedtls_mpi_montmul_ncbicxx_2_28_8
+#define mbedtls_mpi_montmul_init \
+ mbedtls_mpi_montmul_init_ncbicxx_2_28_8
#define mbedtls_mpi_mul_int \
- mbedtls_mpi_mul_int_ncbicxx_2_28_3
+ mbedtls_mpi_mul_int_ncbicxx_2_28_8
#define mbedtls_mpi_mul_mpi \
- mbedtls_mpi_mul_mpi_ncbicxx_2_28_3
+ mbedtls_mpi_mul_mpi_ncbicxx_2_28_8
#define mbedtls_mpi_random \
- mbedtls_mpi_random_ncbicxx_2_28_3
+ mbedtls_mpi_random_ncbicxx_2_28_8
#define mbedtls_mpi_read_binary \
- mbedtls_mpi_read_binary_ncbicxx_2_28_3
+ mbedtls_mpi_read_binary_ncbicxx_2_28_8
#define mbedtls_mpi_read_binary_le \
- mbedtls_mpi_read_binary_le_ncbicxx_2_28_3
+ mbedtls_mpi_read_binary_le_ncbicxx_2_28_8
#define mbedtls_mpi_read_file \
- mbedtls_mpi_read_file_ncbicxx_2_28_3
+ mbedtls_mpi_read_file_ncbicxx_2_28_8
#define mbedtls_mpi_read_string \
- mbedtls_mpi_read_string_ncbicxx_2_28_3
+ mbedtls_mpi_read_string_ncbicxx_2_28_8
#define mbedtls_mpi_set_bit \
- mbedtls_mpi_set_bit_ncbicxx_2_28_3
+ mbedtls_mpi_set_bit_ncbicxx_2_28_8
#define mbedtls_mpi_shift_l \
- mbedtls_mpi_shift_l_ncbicxx_2_28_3
+ mbedtls_mpi_shift_l_ncbicxx_2_28_8
#define mbedtls_mpi_shift_r \
- mbedtls_mpi_shift_r_ncbicxx_2_28_3
+ mbedtls_mpi_shift_r_ncbicxx_2_28_8
#define mbedtls_mpi_shrink \
- mbedtls_mpi_shrink_ncbicxx_2_28_3
+ mbedtls_mpi_shrink_ncbicxx_2_28_8
#define mbedtls_mpi_size \
- mbedtls_mpi_size_ncbicxx_2_28_3
+ mbedtls_mpi_size_ncbicxx_2_28_8
#define mbedtls_mpi_sub_abs \
- mbedtls_mpi_sub_abs_ncbicxx_2_28_3
+ mbedtls_mpi_sub_abs_ncbicxx_2_28_8
#define mbedtls_mpi_sub_int \
- mbedtls_mpi_sub_int_ncbicxx_2_28_3
+ mbedtls_mpi_sub_int_ncbicxx_2_28_8
#define mbedtls_mpi_sub_mpi \
- mbedtls_mpi_sub_mpi_ncbicxx_2_28_3
+ mbedtls_mpi_sub_mpi_ncbicxx_2_28_8
#define mbedtls_mpi_swap \
- mbedtls_mpi_swap_ncbicxx_2_28_3
+ mbedtls_mpi_swap_ncbicxx_2_28_8
#define mbedtls_mpi_write_binary \
- mbedtls_mpi_write_binary_ncbicxx_2_28_3
+ mbedtls_mpi_write_binary_ncbicxx_2_28_8
#define mbedtls_mpi_write_binary_le \
- mbedtls_mpi_write_binary_le_ncbicxx_2_28_3
+ mbedtls_mpi_write_binary_le_ncbicxx_2_28_8
#define mbedtls_mpi_write_file \
- mbedtls_mpi_write_file_ncbicxx_2_28_3
+ mbedtls_mpi_write_file_ncbicxx_2_28_8
#define mbedtls_mpi_write_string \
- mbedtls_mpi_write_string_ncbicxx_2_28_3
+ mbedtls_mpi_write_string_ncbicxx_2_28_8
#define mbedtls_blowfish_crypt_cbc \
- mbedtls_blowfish_crypt_cbc_ncbicxx_2_28_3
+ mbedtls_blowfish_crypt_cbc_ncbicxx_2_28_8
#define mbedtls_blowfish_crypt_cfb64 \
- mbedtls_blowfish_crypt_cfb64_ncbicxx_2_28_3
+ mbedtls_blowfish_crypt_cfb64_ncbicxx_2_28_8
#define mbedtls_blowfish_crypt_ctr \
- mbedtls_blowfish_crypt_ctr_ncbicxx_2_28_3
+ mbedtls_blowfish_crypt_ctr_ncbicxx_2_28_8
#define mbedtls_blowfish_crypt_ecb \
- mbedtls_blowfish_crypt_ecb_ncbicxx_2_28_3
+ mbedtls_blowfish_crypt_ecb_ncbicxx_2_28_8
#define mbedtls_blowfish_free \
- mbedtls_blowfish_free_ncbicxx_2_28_3
+ mbedtls_blowfish_free_ncbicxx_2_28_8
#define mbedtls_blowfish_init \
- mbedtls_blowfish_init_ncbicxx_2_28_3
+ mbedtls_blowfish_init_ncbicxx_2_28_8
#define mbedtls_blowfish_setkey \
- mbedtls_blowfish_setkey_ncbicxx_2_28_3
+ mbedtls_blowfish_setkey_ncbicxx_2_28_8
#define mbedtls_camellia_crypt_cbc \
- mbedtls_camellia_crypt_cbc_ncbicxx_2_28_3
+ mbedtls_camellia_crypt_cbc_ncbicxx_2_28_8
#define mbedtls_camellia_crypt_cfb128 \
- mbedtls_camellia_crypt_cfb128_ncbicxx_2_28_3
+ mbedtls_camellia_crypt_cfb128_ncbicxx_2_28_8
#define mbedtls_camellia_crypt_ctr \
- mbedtls_camellia_crypt_ctr_ncbicxx_2_28_3
+ mbedtls_camellia_crypt_ctr_ncbicxx_2_28_8
#define mbedtls_camellia_crypt_ecb \
- mbedtls_camellia_crypt_ecb_ncbicxx_2_28_3
+ mbedtls_camellia_crypt_ecb_ncbicxx_2_28_8
#define mbedtls_camellia_free \
- mbedtls_camellia_free_ncbicxx_2_28_3
+ mbedtls_camellia_free_ncbicxx_2_28_8
#define mbedtls_camellia_init \
- mbedtls_camellia_init_ncbicxx_2_28_3
+ mbedtls_camellia_init_ncbicxx_2_28_8
#define mbedtls_camellia_setkey_dec \
- mbedtls_camellia_setkey_dec_ncbicxx_2_28_3
+ mbedtls_camellia_setkey_dec_ncbicxx_2_28_8
#define mbedtls_camellia_setkey_enc \
- mbedtls_camellia_setkey_enc_ncbicxx_2_28_3
+ mbedtls_camellia_setkey_enc_ncbicxx_2_28_8
#define mbedtls_ccm_auth_decrypt \
- mbedtls_ccm_auth_decrypt_ncbicxx_2_28_3
+ mbedtls_ccm_auth_decrypt_ncbicxx_2_28_8
#define mbedtls_ccm_encrypt_and_tag \
- mbedtls_ccm_encrypt_and_tag_ncbicxx_2_28_3
+ mbedtls_ccm_encrypt_and_tag_ncbicxx_2_28_8
#define mbedtls_ccm_free \
- mbedtls_ccm_free_ncbicxx_2_28_3
+ mbedtls_ccm_free_ncbicxx_2_28_8
#define mbedtls_ccm_init \
- mbedtls_ccm_init_ncbicxx_2_28_3
+ mbedtls_ccm_init_ncbicxx_2_28_8
#define mbedtls_ccm_setkey \
- mbedtls_ccm_setkey_ncbicxx_2_28_3
+ mbedtls_ccm_setkey_ncbicxx_2_28_8
#define mbedtls_ccm_star_auth_decrypt \
- mbedtls_ccm_star_auth_decrypt_ncbicxx_2_28_3
+ mbedtls_ccm_star_auth_decrypt_ncbicxx_2_28_8
#define mbedtls_ccm_star_encrypt_and_tag \
- mbedtls_ccm_star_encrypt_and_tag_ncbicxx_2_28_3
+ mbedtls_ccm_star_encrypt_and_tag_ncbicxx_2_28_8
#define mbedtls_test_ca_crt \
- mbedtls_test_ca_crt_ncbicxx_2_28_3
+ mbedtls_test_ca_crt_ncbicxx_2_28_8
#define mbedtls_test_ca_crt_ec \
- mbedtls_test_ca_crt_ec_ncbicxx_2_28_3
+ mbedtls_test_ca_crt_ec_ncbicxx_2_28_8
#define mbedtls_test_ca_crt_ec_der \
- mbedtls_test_ca_crt_ec_der_ncbicxx_2_28_3
+ mbedtls_test_ca_crt_ec_der_ncbicxx_2_28_8
#define mbedtls_test_ca_crt_ec_der_len \
- mbedtls_test_ca_crt_ec_der_len_ncbicxx_2_28_3
+ mbedtls_test_ca_crt_ec_der_len_ncbicxx_2_28_8
#define mbedtls_test_ca_crt_ec_len \
- mbedtls_test_ca_crt_ec_len_ncbicxx_2_28_3
+ mbedtls_test_ca_crt_ec_len_ncbicxx_2_28_8
#define mbedtls_test_ca_crt_ec_pem \
- mbedtls_test_ca_crt_ec_pem_ncbicxx_2_28_3
+ mbedtls_test_ca_crt_ec_pem_ncbicxx_2_28_8
#define mbedtls_test_ca_crt_ec_pem_len \
- mbedtls_test_ca_crt_ec_pem_len_ncbicxx_2_28_3
+ mbedtls_test_ca_crt_ec_pem_len_ncbicxx_2_28_8
#define mbedtls_test_ca_crt_len \
- mbedtls_test_ca_crt_len_ncbicxx_2_28_3
+ mbedtls_test_ca_crt_len_ncbicxx_2_28_8
#define mbedtls_test_ca_crt_rsa \
- mbedtls_test_ca_crt_rsa_ncbicxx_2_28_3
+ mbedtls_test_ca_crt_rsa_ncbicxx_2_28_8
#define mbedtls_test_ca_crt_rsa_len \
- mbedtls_test_ca_crt_rsa_len_ncbicxx_2_28_3
+ mbedtls_test_ca_crt_rsa_len_ncbicxx_2_28_8
#define mbedtls_test_ca_crt_rsa_sha1 \
- mbedtls_test_ca_crt_rsa_sha1_ncbicxx_2_28_3
+ mbedtls_test_ca_crt_rsa_sha1_ncbicxx_2_28_8
#define mbedtls_test_ca_crt_rsa_sha1_der \
- mbedtls_test_ca_crt_rsa_sha1_der_ncbicxx_2_28_3
+ mbedtls_test_ca_crt_rsa_sha1_der_ncbicxx_2_28_8
#define mbedtls_test_ca_crt_rsa_sha1_der_len \
- mbedtls_test_ca_crt_rsa_sha1_der_len_ncbicxx_2_28_3
+ mbedtls_test_ca_crt_rsa_sha1_der_len_ncbicxx_2_28_8
#define mbedtls_test_ca_crt_rsa_sha1_len \
- mbedtls_test_ca_crt_rsa_sha1_len_ncbicxx_2_28_3
+ mbedtls_test_ca_crt_rsa_sha1_len_ncbicxx_2_28_8
#define mbedtls_test_ca_crt_rsa_sha1_pem \
- mbedtls_test_ca_crt_rsa_sha1_pem_ncbicxx_2_28_3
+ mbedtls_test_ca_crt_rsa_sha1_pem_ncbicxx_2_28_8
#define mbedtls_test_ca_crt_rsa_sha1_pem_len \
- mbedtls_test_ca_crt_rsa_sha1_pem_len_ncbicxx_2_28_3
+ mbedtls_test_ca_crt_rsa_sha1_pem_len_ncbicxx_2_28_8
#define mbedtls_test_ca_crt_rsa_sha256 \
- mbedtls_test_ca_crt_rsa_sha256_ncbicxx_2_28_3
+ mbedtls_test_ca_crt_rsa_sha256_ncbicxx_2_28_8
#define mbedtls_test_ca_crt_rsa_sha256_der \
- mbedtls_test_ca_crt_rsa_sha256_der_ncbicxx_2_28_3
+ mbedtls_test_ca_crt_rsa_sha256_der_ncbicxx_2_28_8
#define mbedtls_test_ca_crt_rsa_sha256_der_len \
- mbedtls_test_ca_crt_rsa_sha256_der_len_ncbicxx_2_28_3
+ mbedtls_test_ca_crt_rsa_sha256_der_len_ncbicxx_2_28_8
#define mbedtls_test_ca_crt_rsa_sha256_len \
- mbedtls_test_ca_crt_rsa_sha256_len_ncbicxx_2_28_3
+ mbedtls_test_ca_crt_rsa_sha256_len_ncbicxx_2_28_8
#define mbedtls_test_ca_crt_rsa_sha256_pem \
- mbedtls_test_ca_crt_rsa_sha256_pem_ncbicxx_2_28_3
+ mbedtls_test_ca_crt_rsa_sha256_pem_ncbicxx_2_28_8
#define mbedtls_test_ca_crt_rsa_sha256_pem_len \
- mbedtls_test_ca_crt_rsa_sha256_pem_len_ncbicxx_2_28_3
+ mbedtls_test_ca_crt_rsa_sha256_pem_len_ncbicxx_2_28_8
#define mbedtls_test_ca_key \
- mbedtls_test_ca_key_ncbicxx_2_28_3
+ mbedtls_test_ca_key_ncbicxx_2_28_8
#define mbedtls_test_ca_key_ec \
- mbedtls_test_ca_key_ec_ncbicxx_2_28_3
+ mbedtls_test_ca_key_ec_ncbicxx_2_28_8
#define mbedtls_test_ca_key_ec_der \
- mbedtls_test_ca_key_ec_der_ncbicxx_2_28_3
+ mbedtls_test_ca_key_ec_der_ncbicxx_2_28_8
#define mbedtls_test_ca_key_ec_der_len \
- mbedtls_test_ca_key_ec_der_len_ncbicxx_2_28_3
+ mbedtls_test_ca_key_ec_der_len_ncbicxx_2_28_8
#define mbedtls_test_ca_key_ec_len \
- mbedtls_test_ca_key_ec_len_ncbicxx_2_28_3
+ mbedtls_test_ca_key_ec_len_ncbicxx_2_28_8
#define mbedtls_test_ca_key_ec_pem \
- mbedtls_test_ca_key_ec_pem_ncbicxx_2_28_3
+ mbedtls_test_ca_key_ec_pem_ncbicxx_2_28_8
#define mbedtls_test_ca_key_ec_pem_len \
- mbedtls_test_ca_key_ec_pem_len_ncbicxx_2_28_3
+ mbedtls_test_ca_key_ec_pem_len_ncbicxx_2_28_8
#define mbedtls_test_ca_key_len \
- mbedtls_test_ca_key_len_ncbicxx_2_28_3
+ mbedtls_test_ca_key_len_ncbicxx_2_28_8
#define mbedtls_test_ca_key_rsa \
- mbedtls_test_ca_key_rsa_ncbicxx_2_28_3
+ mbedtls_test_ca_key_rsa_ncbicxx_2_28_8
#define mbedtls_test_ca_key_rsa_der \
- mbedtls_test_ca_key_rsa_der_ncbicxx_2_28_3
+ mbedtls_test_ca_key_rsa_der_ncbicxx_2_28_8
#define mbedtls_test_ca_key_rsa_der_len \
- mbedtls_test_ca_key_rsa_der_len_ncbicxx_2_28_3
+ mbedtls_test_ca_key_rsa_der_len_ncbicxx_2_28_8
#define mbedtls_test_ca_key_rsa_len \
- mbedtls_test_ca_key_rsa_len_ncbicxx_2_28_3
+ mbedtls_test_ca_key_rsa_len_ncbicxx_2_28_8
#define mbedtls_test_ca_key_rsa_pem \
- mbedtls_test_ca_key_rsa_pem_ncbicxx_2_28_3
+ mbedtls_test_ca_key_rsa_pem_ncbicxx_2_28_8
#define mbedtls_test_ca_key_rsa_pem_len \
- mbedtls_test_ca_key_rsa_pem_len_ncbicxx_2_28_3
+ mbedtls_test_ca_key_rsa_pem_len_ncbicxx_2_28_8
#define mbedtls_test_ca_pwd \
- mbedtls_test_ca_pwd_ncbicxx_2_28_3
+ mbedtls_test_ca_pwd_ncbicxx_2_28_8
#define mbedtls_test_ca_pwd_ec \
- mbedtls_test_ca_pwd_ec_ncbicxx_2_28_3
+ mbedtls_test_ca_pwd_ec_ncbicxx_2_28_8
#define mbedtls_test_ca_pwd_ec_der_len \
- mbedtls_test_ca_pwd_ec_der_len_ncbicxx_2_28_3
+ mbedtls_test_ca_pwd_ec_der_len_ncbicxx_2_28_8
#define mbedtls_test_ca_pwd_ec_len \
- mbedtls_test_ca_pwd_ec_len_ncbicxx_2_28_3
+ mbedtls_test_ca_pwd_ec_len_ncbicxx_2_28_8
#define mbedtls_test_ca_pwd_ec_pem \
- mbedtls_test_ca_pwd_ec_pem_ncbicxx_2_28_3
+ mbedtls_test_ca_pwd_ec_pem_ncbicxx_2_28_8
#define mbedtls_test_ca_pwd_ec_pem_len \
- mbedtls_test_ca_pwd_ec_pem_len_ncbicxx_2_28_3
+ mbedtls_test_ca_pwd_ec_pem_len_ncbicxx_2_28_8
#define mbedtls_test_ca_pwd_len \
- mbedtls_test_ca_pwd_len_ncbicxx_2_28_3
+ mbedtls_test_ca_pwd_len_ncbicxx_2_28_8
#define mbedtls_test_ca_pwd_rsa \
- mbedtls_test_ca_pwd_rsa_ncbicxx_2_28_3
+ mbedtls_test_ca_pwd_rsa_ncbicxx_2_28_8
#define mbedtls_test_ca_pwd_rsa_der_len \
- mbedtls_test_ca_pwd_rsa_der_len_ncbicxx_2_28_3
+ mbedtls_test_ca_pwd_rsa_der_len_ncbicxx_2_28_8
#define mbedtls_test_ca_pwd_rsa_len \
- mbedtls_test_ca_pwd_rsa_len_ncbicxx_2_28_3
+ mbedtls_test_ca_pwd_rsa_len_ncbicxx_2_28_8
#define mbedtls_test_ca_pwd_rsa_pem \
- mbedtls_test_ca_pwd_rsa_pem_ncbicxx_2_28_3
+ mbedtls_test_ca_pwd_rsa_pem_ncbicxx_2_28_8
#define mbedtls_test_ca_pwd_rsa_pem_len \
- mbedtls_test_ca_pwd_rsa_pem_len_ncbicxx_2_28_3
+ mbedtls_test_ca_pwd_rsa_pem_len_ncbicxx_2_28_8
#define mbedtls_test_cas \
- mbedtls_test_cas_ncbicxx_2_28_3
+ mbedtls_test_cas_ncbicxx_2_28_8
#define mbedtls_test_cas_der \
- mbedtls_test_cas_der_ncbicxx_2_28_3
+ mbedtls_test_cas_der_ncbicxx_2_28_8
#define mbedtls_test_cas_der_len \
- mbedtls_test_cas_der_len_ncbicxx_2_28_3
+ mbedtls_test_cas_der_len_ncbicxx_2_28_8
#define mbedtls_test_cas_len \
- mbedtls_test_cas_len_ncbicxx_2_28_3
+ mbedtls_test_cas_len_ncbicxx_2_28_8
#define mbedtls_test_cas_pem \
- mbedtls_test_cas_pem_ncbicxx_2_28_3
+ mbedtls_test_cas_pem_ncbicxx_2_28_8
#define mbedtls_test_cas_pem_len \
- mbedtls_test_cas_pem_len_ncbicxx_2_28_3
+ mbedtls_test_cas_pem_len_ncbicxx_2_28_8
#define mbedtls_test_cli_crt \
- mbedtls_test_cli_crt_ncbicxx_2_28_3
+ mbedtls_test_cli_crt_ncbicxx_2_28_8
#define mbedtls_test_cli_crt_ec \
- mbedtls_test_cli_crt_ec_ncbicxx_2_28_3
+ mbedtls_test_cli_crt_ec_ncbicxx_2_28_8
#define mbedtls_test_cli_crt_ec_der \
- mbedtls_test_cli_crt_ec_der_ncbicxx_2_28_3
+ mbedtls_test_cli_crt_ec_der_ncbicxx_2_28_8
#define mbedtls_test_cli_crt_ec_der_len \
- mbedtls_test_cli_crt_ec_der_len_ncbicxx_2_28_3
+ mbedtls_test_cli_crt_ec_der_len_ncbicxx_2_28_8
#define mbedtls_test_cli_crt_ec_len \
- mbedtls_test_cli_crt_ec_len_ncbicxx_2_28_3
+ mbedtls_test_cli_crt_ec_len_ncbicxx_2_28_8
#define mbedtls_test_cli_crt_ec_pem \
- mbedtls_test_cli_crt_ec_pem_ncbicxx_2_28_3
+ mbedtls_test_cli_crt_ec_pem_ncbicxx_2_28_8
#define mbedtls_test_cli_crt_ec_pem_len \
- mbedtls_test_cli_crt_ec_pem_len_ncbicxx_2_28_3
+ mbedtls_test_cli_crt_ec_pem_len_ncbicxx_2_28_8
#define mbedtls_test_cli_crt_len \
- mbedtls_test_cli_crt_len_ncbicxx_2_28_3
+ mbedtls_test_cli_crt_len_ncbicxx_2_28_8
#define mbedtls_test_cli_crt_rsa \
- mbedtls_test_cli_crt_rsa_ncbicxx_2_28_3
+ mbedtls_test_cli_crt_rsa_ncbicxx_2_28_8
#define mbedtls_test_cli_crt_rsa_der \
- mbedtls_test_cli_crt_rsa_der_ncbicxx_2_28_3
+ mbedtls_test_cli_crt_rsa_der_ncbicxx_2_28_8
#define mbedtls_test_cli_crt_rsa_der_len \
- mbedtls_test_cli_crt_rsa_der_len_ncbicxx_2_28_3
+ mbedtls_test_cli_crt_rsa_der_len_ncbicxx_2_28_8
#define mbedtls_test_cli_crt_rsa_len \
- mbedtls_test_cli_crt_rsa_len_ncbicxx_2_28_3
+ mbedtls_test_cli_crt_rsa_len_ncbicxx_2_28_8
#define mbedtls_test_cli_crt_rsa_pem \
- mbedtls_test_cli_crt_rsa_pem_ncbicxx_2_28_3
+ mbedtls_test_cli_crt_rsa_pem_ncbicxx_2_28_8
#define mbedtls_test_cli_crt_rsa_pem_len \
- mbedtls_test_cli_crt_rsa_pem_len_ncbicxx_2_28_3
+ mbedtls_test_cli_crt_rsa_pem_len_ncbicxx_2_28_8
#define mbedtls_test_cli_key \
- mbedtls_test_cli_key_ncbicxx_2_28_3
+ mbedtls_test_cli_key_ncbicxx_2_28_8
#define mbedtls_test_cli_key_ec \
- mbedtls_test_cli_key_ec_ncbicxx_2_28_3
+ mbedtls_test_cli_key_ec_ncbicxx_2_28_8
#define mbedtls_test_cli_key_ec_der \
- mbedtls_test_cli_key_ec_der_ncbicxx_2_28_3
+ mbedtls_test_cli_key_ec_der_ncbicxx_2_28_8
#define mbedtls_test_cli_key_ec_der_len \
- mbedtls_test_cli_key_ec_der_len_ncbicxx_2_28_3
+ mbedtls_test_cli_key_ec_der_len_ncbicxx_2_28_8
#define mbedtls_test_cli_key_ec_len \
- mbedtls_test_cli_key_ec_len_ncbicxx_2_28_3
+ mbedtls_test_cli_key_ec_len_ncbicxx_2_28_8
#define mbedtls_test_cli_key_ec_pem \
- mbedtls_test_cli_key_ec_pem_ncbicxx_2_28_3
+ mbedtls_test_cli_key_ec_pem_ncbicxx_2_28_8
#define mbedtls_test_cli_key_ec_pem_len \
- mbedtls_test_cli_key_ec_pem_len_ncbicxx_2_28_3
+ mbedtls_test_cli_key_ec_pem_len_ncbicxx_2_28_8
#define mbedtls_test_cli_key_len \
- mbedtls_test_cli_key_len_ncbicxx_2_28_3
+ mbedtls_test_cli_key_len_ncbicxx_2_28_8
#define mbedtls_test_cli_key_rsa \
- mbedtls_test_cli_key_rsa_ncbicxx_2_28_3
+ mbedtls_test_cli_key_rsa_ncbicxx_2_28_8
#define mbedtls_test_cli_key_rsa_der \
- mbedtls_test_cli_key_rsa_der_ncbicxx_2_28_3
+ mbedtls_test_cli_key_rsa_der_ncbicxx_2_28_8
#define mbedtls_test_cli_key_rsa_der_len \
- mbedtls_test_cli_key_rsa_der_len_ncbicxx_2_28_3
+ mbedtls_test_cli_key_rsa_der_len_ncbicxx_2_28_8
#define mbedtls_test_cli_key_rsa_len \
- mbedtls_test_cli_key_rsa_len_ncbicxx_2_28_3
+ mbedtls_test_cli_key_rsa_len_ncbicxx_2_28_8
#define mbedtls_test_cli_key_rsa_pem \
- mbedtls_test_cli_key_rsa_pem_ncbicxx_2_28_3
+ mbedtls_test_cli_key_rsa_pem_ncbicxx_2_28_8
#define mbedtls_test_cli_key_rsa_pem_len \
- mbedtls_test_cli_key_rsa_pem_len_ncbicxx_2_28_3
+ mbedtls_test_cli_key_rsa_pem_len_ncbicxx_2_28_8
#define mbedtls_test_cli_pwd \
- mbedtls_test_cli_pwd_ncbicxx_2_28_3
+ mbedtls_test_cli_pwd_ncbicxx_2_28_8
#define mbedtls_test_cli_pwd_ec \
- mbedtls_test_cli_pwd_ec_ncbicxx_2_28_3
+ mbedtls_test_cli_pwd_ec_ncbicxx_2_28_8
#define mbedtls_test_cli_pwd_ec_len \
- mbedtls_test_cli_pwd_ec_len_ncbicxx_2_28_3
+ mbedtls_test_cli_pwd_ec_len_ncbicxx_2_28_8
#define mbedtls_test_cli_pwd_ec_pem \
- mbedtls_test_cli_pwd_ec_pem_ncbicxx_2_28_3
+ mbedtls_test_cli_pwd_ec_pem_ncbicxx_2_28_8
#define mbedtls_test_cli_pwd_ec_pem_len \
- mbedtls_test_cli_pwd_ec_pem_len_ncbicxx_2_28_3
+ mbedtls_test_cli_pwd_ec_pem_len_ncbicxx_2_28_8
#define mbedtls_test_cli_pwd_len \
- mbedtls_test_cli_pwd_len_ncbicxx_2_28_3
+ mbedtls_test_cli_pwd_len_ncbicxx_2_28_8
#define mbedtls_test_cli_pwd_rsa \
- mbedtls_test_cli_pwd_rsa_ncbicxx_2_28_3
+ mbedtls_test_cli_pwd_rsa_ncbicxx_2_28_8
#define mbedtls_test_cli_pwd_rsa_len \
- mbedtls_test_cli_pwd_rsa_len_ncbicxx_2_28_3
+ mbedtls_test_cli_pwd_rsa_len_ncbicxx_2_28_8
#define mbedtls_test_cli_pwd_rsa_pem \
- mbedtls_test_cli_pwd_rsa_pem_ncbicxx_2_28_3
+ mbedtls_test_cli_pwd_rsa_pem_ncbicxx_2_28_8
#define mbedtls_test_cli_pwd_rsa_pem_len \
- mbedtls_test_cli_pwd_rsa_pem_len_ncbicxx_2_28_3
+ mbedtls_test_cli_pwd_rsa_pem_len_ncbicxx_2_28_8
#define mbedtls_test_srv_crt \
- mbedtls_test_srv_crt_ncbicxx_2_28_3
+ mbedtls_test_srv_crt_ncbicxx_2_28_8
#define mbedtls_test_srv_crt_ec \
- mbedtls_test_srv_crt_ec_ncbicxx_2_28_3
+ mbedtls_test_srv_crt_ec_ncbicxx_2_28_8
#define mbedtls_test_srv_crt_ec_der \
- mbedtls_test_srv_crt_ec_der_ncbicxx_2_28_3
+ mbedtls_test_srv_crt_ec_der_ncbicxx_2_28_8
#define mbedtls_test_srv_crt_ec_der_len \
- mbedtls_test_srv_crt_ec_der_len_ncbicxx_2_28_3
+ mbedtls_test_srv_crt_ec_der_len_ncbicxx_2_28_8
#define mbedtls_test_srv_crt_ec_len \
- mbedtls_test_srv_crt_ec_len_ncbicxx_2_28_3
+ mbedtls_test_srv_crt_ec_len_ncbicxx_2_28_8
#define mbedtls_test_srv_crt_ec_pem \
- mbedtls_test_srv_crt_ec_pem_ncbicxx_2_28_3
+ mbedtls_test_srv_crt_ec_pem_ncbicxx_2_28_8
#define mbedtls_test_srv_crt_ec_pem_len \
- mbedtls_test_srv_crt_ec_pem_len_ncbicxx_2_28_3
+ mbedtls_test_srv_crt_ec_pem_len_ncbicxx_2_28_8
#define mbedtls_test_srv_crt_len \
- mbedtls_test_srv_crt_len_ncbicxx_2_28_3
+ mbedtls_test_srv_crt_len_ncbicxx_2_28_8
#define mbedtls_test_srv_crt_rsa \
- mbedtls_test_srv_crt_rsa_ncbicxx_2_28_3
+ mbedtls_test_srv_crt_rsa_ncbicxx_2_28_8
#define mbedtls_test_srv_crt_rsa_len \
- mbedtls_test_srv_crt_rsa_len_ncbicxx_2_28_3
+ mbedtls_test_srv_crt_rsa_len_ncbicxx_2_28_8
#define mbedtls_test_srv_crt_rsa_sha1 \
- mbedtls_test_srv_crt_rsa_sha1_ncbicxx_2_28_3
+ mbedtls_test_srv_crt_rsa_sha1_ncbicxx_2_28_8
#define mbedtls_test_srv_crt_rsa_sha1_der \
- mbedtls_test_srv_crt_rsa_sha1_der_ncbicxx_2_28_3
+ mbedtls_test_srv_crt_rsa_sha1_der_ncbicxx_2_28_8
#define mbedtls_test_srv_crt_rsa_sha1_der_len \
- mbedtls_test_srv_crt_rsa_sha1_der_len_ncbicxx_2_28_3
+ mbedtls_test_srv_crt_rsa_sha1_der_len_ncbicxx_2_28_8
#define mbedtls_test_srv_crt_rsa_sha1_len \
- mbedtls_test_srv_crt_rsa_sha1_len_ncbicxx_2_28_3
+ mbedtls_test_srv_crt_rsa_sha1_len_ncbicxx_2_28_8
#define mbedtls_test_srv_crt_rsa_sha1_pem \
- mbedtls_test_srv_crt_rsa_sha1_pem_ncbicxx_2_28_3
+ mbedtls_test_srv_crt_rsa_sha1_pem_ncbicxx_2_28_8
#define mbedtls_test_srv_crt_rsa_sha1_pem_len \
- mbedtls_test_srv_crt_rsa_sha1_pem_len_ncbicxx_2_28_3
+ mbedtls_test_srv_crt_rsa_sha1_pem_len_ncbicxx_2_28_8
#define mbedtls_test_srv_crt_rsa_sha256 \
- mbedtls_test_srv_crt_rsa_sha256_ncbicxx_2_28_3
+ mbedtls_test_srv_crt_rsa_sha256_ncbicxx_2_28_8
#define mbedtls_test_srv_crt_rsa_sha256_der \
- mbedtls_test_srv_crt_rsa_sha256_der_ncbicxx_2_28_3
+ mbedtls_test_srv_crt_rsa_sha256_der_ncbicxx_2_28_8
#define mbedtls_test_srv_crt_rsa_sha256_der_len \
- mbedtls_test_srv_crt_rsa_sha256_der_len_ncbicxx_2_28_3
+ mbedtls_test_srv_crt_rsa_sha256_der_len_ncbicxx_2_28_8
#define mbedtls_test_srv_crt_rsa_sha256_len \
- mbedtls_test_srv_crt_rsa_sha256_len_ncbicxx_2_28_3
+ mbedtls_test_srv_crt_rsa_sha256_len_ncbicxx_2_28_8
#define mbedtls_test_srv_crt_rsa_sha256_pem \
- mbedtls_test_srv_crt_rsa_sha256_pem_ncbicxx_2_28_3
+ mbedtls_test_srv_crt_rsa_sha256_pem_ncbicxx_2_28_8
#define mbedtls_test_srv_crt_rsa_sha256_pem_len \
- mbedtls_test_srv_crt_rsa_sha256_pem_len_ncbicxx_2_28_3
+ mbedtls_test_srv_crt_rsa_sha256_pem_len_ncbicxx_2_28_8
#define mbedtls_test_srv_key \
- mbedtls_test_srv_key_ncbicxx_2_28_3
+ mbedtls_test_srv_key_ncbicxx_2_28_8
#define mbedtls_test_srv_key_ec \
- mbedtls_test_srv_key_ec_ncbicxx_2_28_3
+ mbedtls_test_srv_key_ec_ncbicxx_2_28_8
#define mbedtls_test_srv_key_ec_der \
- mbedtls_test_srv_key_ec_der_ncbicxx_2_28_3
+ mbedtls_test_srv_key_ec_der_ncbicxx_2_28_8
#define mbedtls_test_srv_key_ec_der_len \
- mbedtls_test_srv_key_ec_der_len_ncbicxx_2_28_3
+ mbedtls_test_srv_key_ec_der_len_ncbicxx_2_28_8
#define mbedtls_test_srv_key_ec_len \
- mbedtls_test_srv_key_ec_len_ncbicxx_2_28_3
+ mbedtls_test_srv_key_ec_len_ncbicxx_2_28_8
#define mbedtls_test_srv_key_ec_pem \
- mbedtls_test_srv_key_ec_pem_ncbicxx_2_28_3
+ mbedtls_test_srv_key_ec_pem_ncbicxx_2_28_8
#define mbedtls_test_srv_key_ec_pem_len \
- mbedtls_test_srv_key_ec_pem_len_ncbicxx_2_28_3
+ mbedtls_test_srv_key_ec_pem_len_ncbicxx_2_28_8
#define mbedtls_test_srv_key_len \
- mbedtls_test_srv_key_len_ncbicxx_2_28_3
+ mbedtls_test_srv_key_len_ncbicxx_2_28_8
#define mbedtls_test_srv_key_rsa \
- mbedtls_test_srv_key_rsa_ncbicxx_2_28_3
+ mbedtls_test_srv_key_rsa_ncbicxx_2_28_8
#define mbedtls_test_srv_key_rsa_der \
- mbedtls_test_srv_key_rsa_der_ncbicxx_2_28_3
+ mbedtls_test_srv_key_rsa_der_ncbicxx_2_28_8
#define mbedtls_test_srv_key_rsa_der_len \
- mbedtls_test_srv_key_rsa_der_len_ncbicxx_2_28_3
+ mbedtls_test_srv_key_rsa_der_len_ncbicxx_2_28_8
#define mbedtls_test_srv_key_rsa_len \
- mbedtls_test_srv_key_rsa_len_ncbicxx_2_28_3
+ mbedtls_test_srv_key_rsa_len_ncbicxx_2_28_8
#define mbedtls_test_srv_key_rsa_pem \
- mbedtls_test_srv_key_rsa_pem_ncbicxx_2_28_3
+ mbedtls_test_srv_key_rsa_pem_ncbicxx_2_28_8
#define mbedtls_test_srv_key_rsa_pem_len \
- mbedtls_test_srv_key_rsa_pem_len_ncbicxx_2_28_3
+ mbedtls_test_srv_key_rsa_pem_len_ncbicxx_2_28_8
#define mbedtls_test_srv_pwd \
- mbedtls_test_srv_pwd_ncbicxx_2_28_3
+ mbedtls_test_srv_pwd_ncbicxx_2_28_8
#define mbedtls_test_srv_pwd_ec \
- mbedtls_test_srv_pwd_ec_ncbicxx_2_28_3
+ mbedtls_test_srv_pwd_ec_ncbicxx_2_28_8
#define mbedtls_test_srv_pwd_ec_der_len \
- mbedtls_test_srv_pwd_ec_der_len_ncbicxx_2_28_3
+ mbedtls_test_srv_pwd_ec_der_len_ncbicxx_2_28_8
#define mbedtls_test_srv_pwd_ec_len \
- mbedtls_test_srv_pwd_ec_len_ncbicxx_2_28_3
+ mbedtls_test_srv_pwd_ec_len_ncbicxx_2_28_8
#define mbedtls_test_srv_pwd_ec_pem \
- mbedtls_test_srv_pwd_ec_pem_ncbicxx_2_28_3
+ mbedtls_test_srv_pwd_ec_pem_ncbicxx_2_28_8
#define mbedtls_test_srv_pwd_ec_pem_len \
- mbedtls_test_srv_pwd_ec_pem_len_ncbicxx_2_28_3
+ mbedtls_test_srv_pwd_ec_pem_len_ncbicxx_2_28_8
#define mbedtls_test_srv_pwd_len \
- mbedtls_test_srv_pwd_len_ncbicxx_2_28_3
+ mbedtls_test_srv_pwd_len_ncbicxx_2_28_8
#define mbedtls_test_srv_pwd_rsa \
- mbedtls_test_srv_pwd_rsa_ncbicxx_2_28_3
+ mbedtls_test_srv_pwd_rsa_ncbicxx_2_28_8
#define mbedtls_test_srv_pwd_rsa_der_len \
- mbedtls_test_srv_pwd_rsa_der_len_ncbicxx_2_28_3
+ mbedtls_test_srv_pwd_rsa_der_len_ncbicxx_2_28_8
#define mbedtls_test_srv_pwd_rsa_len \
- mbedtls_test_srv_pwd_rsa_len_ncbicxx_2_28_3
+ mbedtls_test_srv_pwd_rsa_len_ncbicxx_2_28_8
#define mbedtls_test_srv_pwd_rsa_pem \
- mbedtls_test_srv_pwd_rsa_pem_ncbicxx_2_28_3
+ mbedtls_test_srv_pwd_rsa_pem_ncbicxx_2_28_8
#define mbedtls_test_srv_pwd_rsa_pem_len \
- mbedtls_test_srv_pwd_rsa_pem_len_ncbicxx_2_28_3
+ mbedtls_test_srv_pwd_rsa_pem_len_ncbicxx_2_28_8
#define mbedtls_chacha20_crypt \
- mbedtls_chacha20_crypt_ncbicxx_2_28_3
+ mbedtls_chacha20_crypt_ncbicxx_2_28_8
#define mbedtls_chacha20_free \
- mbedtls_chacha20_free_ncbicxx_2_28_3
+ mbedtls_chacha20_free_ncbicxx_2_28_8
#define mbedtls_chacha20_init \
- mbedtls_chacha20_init_ncbicxx_2_28_3
+ mbedtls_chacha20_init_ncbicxx_2_28_8
#define mbedtls_chacha20_setkey \
- mbedtls_chacha20_setkey_ncbicxx_2_28_3
+ mbedtls_chacha20_setkey_ncbicxx_2_28_8
#define mbedtls_chacha20_starts \
- mbedtls_chacha20_starts_ncbicxx_2_28_3
+ mbedtls_chacha20_starts_ncbicxx_2_28_8
#define mbedtls_chacha20_update \
- mbedtls_chacha20_update_ncbicxx_2_28_3
+ mbedtls_chacha20_update_ncbicxx_2_28_8
#define mbedtls_chachapoly_auth_decrypt \
- mbedtls_chachapoly_auth_decrypt_ncbicxx_2_28_3
+ mbedtls_chachapoly_auth_decrypt_ncbicxx_2_28_8
#define mbedtls_chachapoly_encrypt_and_tag \
- mbedtls_chachapoly_encrypt_and_tag_ncbicxx_2_28_3
+ mbedtls_chachapoly_encrypt_and_tag_ncbicxx_2_28_8
#define mbedtls_chachapoly_finish \
- mbedtls_chachapoly_finish_ncbicxx_2_28_3
+ mbedtls_chachapoly_finish_ncbicxx_2_28_8
#define mbedtls_chachapoly_free \
- mbedtls_chachapoly_free_ncbicxx_2_28_3
+ mbedtls_chachapoly_free_ncbicxx_2_28_8
#define mbedtls_chachapoly_init \
- mbedtls_chachapoly_init_ncbicxx_2_28_3
+ mbedtls_chachapoly_init_ncbicxx_2_28_8
#define mbedtls_chachapoly_setkey \
- mbedtls_chachapoly_setkey_ncbicxx_2_28_3
+ mbedtls_chachapoly_setkey_ncbicxx_2_28_8
#define mbedtls_chachapoly_starts \
- mbedtls_chachapoly_starts_ncbicxx_2_28_3
+ mbedtls_chachapoly_starts_ncbicxx_2_28_8
#define mbedtls_chachapoly_update \
- mbedtls_chachapoly_update_ncbicxx_2_28_3
+ mbedtls_chachapoly_update_ncbicxx_2_28_8
#define mbedtls_chachapoly_update_aad \
- mbedtls_chachapoly_update_aad_ncbicxx_2_28_3
+ mbedtls_chachapoly_update_aad_ncbicxx_2_28_8
#define mbedtls_cipher_auth_decrypt \
- mbedtls_cipher_auth_decrypt_ncbicxx_2_28_3
+ mbedtls_cipher_auth_decrypt_ncbicxx_2_28_8
#define mbedtls_cipher_auth_decrypt_ext \
- mbedtls_cipher_auth_decrypt_ext_ncbicxx_2_28_3
+ mbedtls_cipher_auth_decrypt_ext_ncbicxx_2_28_8
#define mbedtls_cipher_auth_encrypt \
- mbedtls_cipher_auth_encrypt_ncbicxx_2_28_3
+ mbedtls_cipher_auth_encrypt_ncbicxx_2_28_8
#define mbedtls_cipher_auth_encrypt_ext \
- mbedtls_cipher_auth_encrypt_ext_ncbicxx_2_28_3
+ mbedtls_cipher_auth_encrypt_ext_ncbicxx_2_28_8
#define mbedtls_cipher_check_tag \
- mbedtls_cipher_check_tag_ncbicxx_2_28_3
+ mbedtls_cipher_check_tag_ncbicxx_2_28_8
#define mbedtls_cipher_crypt \
- mbedtls_cipher_crypt_ncbicxx_2_28_3
+ mbedtls_cipher_crypt_ncbicxx_2_28_8
#define mbedtls_cipher_finish \
- mbedtls_cipher_finish_ncbicxx_2_28_3
+ mbedtls_cipher_finish_ncbicxx_2_28_8
#define mbedtls_cipher_free \
- mbedtls_cipher_free_ncbicxx_2_28_3
+ mbedtls_cipher_free_ncbicxx_2_28_8
#define mbedtls_cipher_info_from_string \
- mbedtls_cipher_info_from_string_ncbicxx_2_28_3
+ mbedtls_cipher_info_from_string_ncbicxx_2_28_8
#define mbedtls_cipher_info_from_type \
- mbedtls_cipher_info_from_type_ncbicxx_2_28_3
+ mbedtls_cipher_info_from_type_ncbicxx_2_28_8
#define mbedtls_cipher_info_from_values \
- mbedtls_cipher_info_from_values_ncbicxx_2_28_3
+ mbedtls_cipher_info_from_values_ncbicxx_2_28_8
#define mbedtls_cipher_init \
- mbedtls_cipher_init_ncbicxx_2_28_3
+ mbedtls_cipher_init_ncbicxx_2_28_8
#define mbedtls_cipher_list \
- mbedtls_cipher_list_ncbicxx_2_28_3
+ mbedtls_cipher_list_ncbicxx_2_28_8
#define mbedtls_cipher_reset \
- mbedtls_cipher_reset_ncbicxx_2_28_3
+ mbedtls_cipher_reset_ncbicxx_2_28_8
#define mbedtls_cipher_set_iv \
- mbedtls_cipher_set_iv_ncbicxx_2_28_3
+ mbedtls_cipher_set_iv_ncbicxx_2_28_8
#define mbedtls_cipher_set_padding_mode \
- mbedtls_cipher_set_padding_mode_ncbicxx_2_28_3
+ mbedtls_cipher_set_padding_mode_ncbicxx_2_28_8
#define mbedtls_cipher_setkey \
- mbedtls_cipher_setkey_ncbicxx_2_28_3
+ mbedtls_cipher_setkey_ncbicxx_2_28_8
#define mbedtls_cipher_setup \
- mbedtls_cipher_setup_ncbicxx_2_28_3
+ mbedtls_cipher_setup_ncbicxx_2_28_8
#define mbedtls_cipher_update \
- mbedtls_cipher_update_ncbicxx_2_28_3
+ mbedtls_cipher_update_ncbicxx_2_28_8
#define mbedtls_cipher_update_ad \
- mbedtls_cipher_update_ad_ncbicxx_2_28_3
+ mbedtls_cipher_update_ad_ncbicxx_2_28_8
#define mbedtls_cipher_write_tag \
- mbedtls_cipher_write_tag_ncbicxx_2_28_3
+ mbedtls_cipher_write_tag_ncbicxx_2_28_8
#define mbedtls_cipher_definitions \
- mbedtls_cipher_definitions_ncbicxx_2_28_3
+ mbedtls_cipher_definitions_ncbicxx_2_28_8
#define mbedtls_cipher_supported \
- mbedtls_cipher_supported_ncbicxx_2_28_3
+ mbedtls_cipher_supported_ncbicxx_2_28_8
#define mbedtls_ct_base64_dec_value \
- mbedtls_ct_base64_dec_value_ncbicxx_2_28_3
+ mbedtls_ct_base64_dec_value_ncbicxx_2_28_8
#define mbedtls_ct_base64_enc_char \
- mbedtls_ct_base64_enc_char_ncbicxx_2_28_3
+ mbedtls_ct_base64_enc_char_ncbicxx_2_28_8
#define mbedtls_ct_hmac \
- mbedtls_ct_hmac_ncbicxx_2_28_3
+ mbedtls_ct_hmac_ncbicxx_2_28_8
#define mbedtls_ct_memcmp \
- mbedtls_ct_memcmp_ncbicxx_2_28_3
+ mbedtls_ct_memcmp_ncbicxx_2_28_8
#define mbedtls_ct_memcpy_if_eq \
- mbedtls_ct_memcpy_if_eq_ncbicxx_2_28_3
+ mbedtls_ct_memcpy_if_eq_ncbicxx_2_28_8
#define mbedtls_ct_memcpy_offset \
- mbedtls_ct_memcpy_offset_ncbicxx_2_28_3
+ mbedtls_ct_memcpy_offset_ncbicxx_2_28_8
#define mbedtls_ct_mpi_uint_cond_assign \
- mbedtls_ct_mpi_uint_cond_assign_ncbicxx_2_28_3
+ mbedtls_ct_mpi_uint_cond_assign_ncbicxx_2_28_8
#define mbedtls_ct_mpi_uint_lt \
- mbedtls_ct_mpi_uint_lt_ncbicxx_2_28_3
+ mbedtls_ct_mpi_uint_lt_ncbicxx_2_28_8
#define mbedtls_ct_mpi_uint_mask \
- mbedtls_ct_mpi_uint_mask_ncbicxx_2_28_3
+ mbedtls_ct_mpi_uint_mask_ncbicxx_2_28_8
#define mbedtls_ct_rsaes_pkcs1_v15_unpadding \
- mbedtls_ct_rsaes_pkcs1_v15_unpadding_ncbicxx_2_28_3
+ mbedtls_ct_rsaes_pkcs1_v15_unpadding_ncbicxx_2_28_8
#define mbedtls_ct_size_bool_eq \
- mbedtls_ct_size_bool_eq_ncbicxx_2_28_3
+ mbedtls_ct_size_bool_eq_ncbicxx_2_28_8
#define mbedtls_ct_size_mask \
- mbedtls_ct_size_mask_ncbicxx_2_28_3
+ mbedtls_ct_size_mask_ncbicxx_2_28_8
#define mbedtls_ct_size_mask_ge \
- mbedtls_ct_size_mask_ge_ncbicxx_2_28_3
+ mbedtls_ct_size_mask_ge_ncbicxx_2_28_8
#define mbedtls_ct_uint_if \
- mbedtls_ct_uint_if_ncbicxx_2_28_3
+ mbedtls_ct_uint_if_ncbicxx_2_28_8
#define mbedtls_ct_uint_mask \
- mbedtls_ct_uint_mask_ncbicxx_2_28_3
+ mbedtls_ct_uint_mask_ncbicxx_2_28_8
#define mbedtls_mpi_lt_mpi_ct \
- mbedtls_mpi_lt_mpi_ct_ncbicxx_2_28_3
+ mbedtls_mpi_lt_mpi_ct_ncbicxx_2_28_8
#define mbedtls_mpi_safe_cond_assign \
- mbedtls_mpi_safe_cond_assign_ncbicxx_2_28_3
+ mbedtls_mpi_safe_cond_assign_ncbicxx_2_28_8
#define mbedtls_mpi_safe_cond_swap \
- mbedtls_mpi_safe_cond_swap_ncbicxx_2_28_3
+ mbedtls_mpi_safe_cond_swap_ncbicxx_2_28_8
#define mbedtls_ctr_drbg_free \
- mbedtls_ctr_drbg_free_ncbicxx_2_28_3
+ mbedtls_ctr_drbg_free_ncbicxx_2_28_8
#define mbedtls_ctr_drbg_init \
- mbedtls_ctr_drbg_init_ncbicxx_2_28_3
+ mbedtls_ctr_drbg_init_ncbicxx_2_28_8
#define mbedtls_ctr_drbg_random \
- mbedtls_ctr_drbg_random_ncbicxx_2_28_3
+ mbedtls_ctr_drbg_random_ncbicxx_2_28_8
#define mbedtls_ctr_drbg_random_with_add \
- mbedtls_ctr_drbg_random_with_add_ncbicxx_2_28_3
+ mbedtls_ctr_drbg_random_with_add_ncbicxx_2_28_8
#define mbedtls_ctr_drbg_reseed \
- mbedtls_ctr_drbg_reseed_ncbicxx_2_28_3
+ mbedtls_ctr_drbg_reseed_ncbicxx_2_28_8
#define mbedtls_ctr_drbg_seed \
- mbedtls_ctr_drbg_seed_ncbicxx_2_28_3
+ mbedtls_ctr_drbg_seed_ncbicxx_2_28_8
#define mbedtls_ctr_drbg_set_entropy_len \
- mbedtls_ctr_drbg_set_entropy_len_ncbicxx_2_28_3
+ mbedtls_ctr_drbg_set_entropy_len_ncbicxx_2_28_8
#define mbedtls_ctr_drbg_set_nonce_len \
- mbedtls_ctr_drbg_set_nonce_len_ncbicxx_2_28_3
+ mbedtls_ctr_drbg_set_nonce_len_ncbicxx_2_28_8
#define mbedtls_ctr_drbg_set_prediction_resistance \
- mbedtls_ctr_drbg_set_prediction_resistance_ncbicxx_2_28_3
+ mbedtls_ctr_drbg_set_prediction_resistance_ncbicxx_2_28_8
#define mbedtls_ctr_drbg_set_reseed_interval \
- mbedtls_ctr_drbg_set_reseed_interval_ncbicxx_2_28_3
+ mbedtls_ctr_drbg_set_reseed_interval_ncbicxx_2_28_8
#define mbedtls_ctr_drbg_update \
- mbedtls_ctr_drbg_update_ncbicxx_2_28_3
+ mbedtls_ctr_drbg_update_ncbicxx_2_28_8
#define mbedtls_ctr_drbg_update_ret \
- mbedtls_ctr_drbg_update_ret_ncbicxx_2_28_3
+ mbedtls_ctr_drbg_update_ret_ncbicxx_2_28_8
#define mbedtls_ctr_drbg_update_seed_file \
- mbedtls_ctr_drbg_update_seed_file_ncbicxx_2_28_3
+ mbedtls_ctr_drbg_update_seed_file_ncbicxx_2_28_8
#define mbedtls_ctr_drbg_write_seed_file \
- mbedtls_ctr_drbg_write_seed_file_ncbicxx_2_28_3
+ mbedtls_ctr_drbg_write_seed_file_ncbicxx_2_28_8
#define mbedtls_debug_print_buf \
- mbedtls_debug_print_buf_ncbicxx_2_28_3
+ mbedtls_debug_print_buf_ncbicxx_2_28_8
#define mbedtls_debug_print_crt \
- mbedtls_debug_print_crt_ncbicxx_2_28_3
+ mbedtls_debug_print_crt_ncbicxx_2_28_8
#define mbedtls_debug_print_ecp \
- mbedtls_debug_print_ecp_ncbicxx_2_28_3
+ mbedtls_debug_print_ecp_ncbicxx_2_28_8
#define mbedtls_debug_print_mpi \
- mbedtls_debug_print_mpi_ncbicxx_2_28_3
+ mbedtls_debug_print_mpi_ncbicxx_2_28_8
#define mbedtls_debug_print_msg \
- mbedtls_debug_print_msg_ncbicxx_2_28_3
+ mbedtls_debug_print_msg_ncbicxx_2_28_8
#define mbedtls_debug_print_ret \
- mbedtls_debug_print_ret_ncbicxx_2_28_3
+ mbedtls_debug_print_ret_ncbicxx_2_28_8
#define mbedtls_debug_printf_ecdh \
- mbedtls_debug_printf_ecdh_ncbicxx_2_28_3
+ mbedtls_debug_printf_ecdh_ncbicxx_2_28_8
#define mbedtls_debug_set_threshold \
- mbedtls_debug_set_threshold_ncbicxx_2_28_3
+ mbedtls_debug_set_threshold_ncbicxx_2_28_8
#define mbedtls_des3_crypt_cbc \
- mbedtls_des3_crypt_cbc_ncbicxx_2_28_3
+ mbedtls_des3_crypt_cbc_ncbicxx_2_28_8
#define mbedtls_des3_crypt_ecb \
- mbedtls_des3_crypt_ecb_ncbicxx_2_28_3
+ mbedtls_des3_crypt_ecb_ncbicxx_2_28_8
#define mbedtls_des3_free \
- mbedtls_des3_free_ncbicxx_2_28_3
+ mbedtls_des3_free_ncbicxx_2_28_8
#define mbedtls_des3_init \
- mbedtls_des3_init_ncbicxx_2_28_3
+ mbedtls_des3_init_ncbicxx_2_28_8
#define mbedtls_des3_set2key_dec \
- mbedtls_des3_set2key_dec_ncbicxx_2_28_3
+ mbedtls_des3_set2key_dec_ncbicxx_2_28_8
#define mbedtls_des3_set2key_enc \
- mbedtls_des3_set2key_enc_ncbicxx_2_28_3
+ mbedtls_des3_set2key_enc_ncbicxx_2_28_8
#define mbedtls_des3_set3key_dec \
- mbedtls_des3_set3key_dec_ncbicxx_2_28_3
+ mbedtls_des3_set3key_dec_ncbicxx_2_28_8
#define mbedtls_des3_set3key_enc \
- mbedtls_des3_set3key_enc_ncbicxx_2_28_3
+ mbedtls_des3_set3key_enc_ncbicxx_2_28_8
#define mbedtls_des_crypt_cbc \
- mbedtls_des_crypt_cbc_ncbicxx_2_28_3
+ mbedtls_des_crypt_cbc_ncbicxx_2_28_8
#define mbedtls_des_crypt_ecb \
- mbedtls_des_crypt_ecb_ncbicxx_2_28_3
+ mbedtls_des_crypt_ecb_ncbicxx_2_28_8
#define mbedtls_des_free \
- mbedtls_des_free_ncbicxx_2_28_3
+ mbedtls_des_free_ncbicxx_2_28_8
#define mbedtls_des_init \
- mbedtls_des_init_ncbicxx_2_28_3
+ mbedtls_des_init_ncbicxx_2_28_8
#define mbedtls_des_key_check_key_parity \
- mbedtls_des_key_check_key_parity_ncbicxx_2_28_3
+ mbedtls_des_key_check_key_parity_ncbicxx_2_28_8
#define mbedtls_des_key_check_weak \
- mbedtls_des_key_check_weak_ncbicxx_2_28_3
+ mbedtls_des_key_check_weak_ncbicxx_2_28_8
#define mbedtls_des_key_set_parity \
- mbedtls_des_key_set_parity_ncbicxx_2_28_3
+ mbedtls_des_key_set_parity_ncbicxx_2_28_8
#define mbedtls_des_setkey \
- mbedtls_des_setkey_ncbicxx_2_28_3
+ mbedtls_des_setkey_ncbicxx_2_28_8
#define mbedtls_des_setkey_dec \
- mbedtls_des_setkey_dec_ncbicxx_2_28_3
+ mbedtls_des_setkey_dec_ncbicxx_2_28_8
#define mbedtls_des_setkey_enc \
- mbedtls_des_setkey_enc_ncbicxx_2_28_3
+ mbedtls_des_setkey_enc_ncbicxx_2_28_8
#define mbedtls_dhm_calc_secret \
- mbedtls_dhm_calc_secret_ncbicxx_2_28_3
+ mbedtls_dhm_calc_secret_ncbicxx_2_28_8
#define mbedtls_dhm_free \
- mbedtls_dhm_free_ncbicxx_2_28_3
+ mbedtls_dhm_free_ncbicxx_2_28_8
#define mbedtls_dhm_init \
- mbedtls_dhm_init_ncbicxx_2_28_3
+ mbedtls_dhm_init_ncbicxx_2_28_8
#define mbedtls_dhm_make_params \
- mbedtls_dhm_make_params_ncbicxx_2_28_3
+ mbedtls_dhm_make_params_ncbicxx_2_28_8
#define mbedtls_dhm_make_public \
- mbedtls_dhm_make_public_ncbicxx_2_28_3
+ mbedtls_dhm_make_public_ncbicxx_2_28_8
#define mbedtls_dhm_parse_dhm \
- mbedtls_dhm_parse_dhm_ncbicxx_2_28_3
+ mbedtls_dhm_parse_dhm_ncbicxx_2_28_8
#define mbedtls_dhm_parse_dhmfile \
- mbedtls_dhm_parse_dhmfile_ncbicxx_2_28_3
+ mbedtls_dhm_parse_dhmfile_ncbicxx_2_28_8
#define mbedtls_dhm_read_params \
- mbedtls_dhm_read_params_ncbicxx_2_28_3
+ mbedtls_dhm_read_params_ncbicxx_2_28_8
#define mbedtls_dhm_read_public \
- mbedtls_dhm_read_public_ncbicxx_2_28_3
+ mbedtls_dhm_read_public_ncbicxx_2_28_8
#define mbedtls_dhm_set_group \
- mbedtls_dhm_set_group_ncbicxx_2_28_3
+ mbedtls_dhm_set_group_ncbicxx_2_28_8
#define mbedtls_ecdh_calc_secret \
- mbedtls_ecdh_calc_secret_ncbicxx_2_28_3
+ mbedtls_ecdh_calc_secret_ncbicxx_2_28_8
#define mbedtls_ecdh_can_do \
- mbedtls_ecdh_can_do_ncbicxx_2_28_3
+ mbedtls_ecdh_can_do_ncbicxx_2_28_8
#define mbedtls_ecdh_compute_shared \
- mbedtls_ecdh_compute_shared_ncbicxx_2_28_3
+ mbedtls_ecdh_compute_shared_ncbicxx_2_28_8
#define mbedtls_ecdh_free \
- mbedtls_ecdh_free_ncbicxx_2_28_3
+ mbedtls_ecdh_free_ncbicxx_2_28_8
#define mbedtls_ecdh_gen_public \
- mbedtls_ecdh_gen_public_ncbicxx_2_28_3
+ mbedtls_ecdh_gen_public_ncbicxx_2_28_8
#define mbedtls_ecdh_get_params \
- mbedtls_ecdh_get_params_ncbicxx_2_28_3
+ mbedtls_ecdh_get_params_ncbicxx_2_28_8
#define mbedtls_ecdh_init \
- mbedtls_ecdh_init_ncbicxx_2_28_3
+ mbedtls_ecdh_init_ncbicxx_2_28_8
#define mbedtls_ecdh_make_params \
- mbedtls_ecdh_make_params_ncbicxx_2_28_3
+ mbedtls_ecdh_make_params_ncbicxx_2_28_8
#define mbedtls_ecdh_make_public \
- mbedtls_ecdh_make_public_ncbicxx_2_28_3
+ mbedtls_ecdh_make_public_ncbicxx_2_28_8
#define mbedtls_ecdh_read_params \
- mbedtls_ecdh_read_params_ncbicxx_2_28_3
+ mbedtls_ecdh_read_params_ncbicxx_2_28_8
#define mbedtls_ecdh_read_public \
- mbedtls_ecdh_read_public_ncbicxx_2_28_3
+ mbedtls_ecdh_read_public_ncbicxx_2_28_8
#define mbedtls_ecdh_setup \
- mbedtls_ecdh_setup_ncbicxx_2_28_3
+ mbedtls_ecdh_setup_ncbicxx_2_28_8
#define mbedtls_ecdsa_can_do \
- mbedtls_ecdsa_can_do_ncbicxx_2_28_3
+ mbedtls_ecdsa_can_do_ncbicxx_2_28_8
#define mbedtls_ecdsa_free \
- mbedtls_ecdsa_free_ncbicxx_2_28_3
+ mbedtls_ecdsa_free_ncbicxx_2_28_8
#define mbedtls_ecdsa_from_keypair \
- mbedtls_ecdsa_from_keypair_ncbicxx_2_28_3
+ mbedtls_ecdsa_from_keypair_ncbicxx_2_28_8
#define mbedtls_ecdsa_genkey \
- mbedtls_ecdsa_genkey_ncbicxx_2_28_3
+ mbedtls_ecdsa_genkey_ncbicxx_2_28_8
#define mbedtls_ecdsa_init \
- mbedtls_ecdsa_init_ncbicxx_2_28_3
+ mbedtls_ecdsa_init_ncbicxx_2_28_8
#define mbedtls_ecdsa_read_signature \
- mbedtls_ecdsa_read_signature_ncbicxx_2_28_3
+ mbedtls_ecdsa_read_signature_ncbicxx_2_28_8
#define mbedtls_ecdsa_read_signature_restartable \
- mbedtls_ecdsa_read_signature_restartable_ncbicxx_2_28_3
+ mbedtls_ecdsa_read_signature_restartable_ncbicxx_2_28_8
#define mbedtls_ecdsa_sign \
- mbedtls_ecdsa_sign_ncbicxx_2_28_3
+ mbedtls_ecdsa_sign_ncbicxx_2_28_8
#define mbedtls_ecdsa_sign_det \
- mbedtls_ecdsa_sign_det_ncbicxx_2_28_3
+ mbedtls_ecdsa_sign_det_ncbicxx_2_28_8
#define mbedtls_ecdsa_sign_det_ext \
- mbedtls_ecdsa_sign_det_ext_ncbicxx_2_28_3
+ mbedtls_ecdsa_sign_det_ext_ncbicxx_2_28_8
#define mbedtls_ecdsa_verify \
- mbedtls_ecdsa_verify_ncbicxx_2_28_3
+ mbedtls_ecdsa_verify_ncbicxx_2_28_8
#define mbedtls_ecdsa_write_signature \
- mbedtls_ecdsa_write_signature_ncbicxx_2_28_3
+ mbedtls_ecdsa_write_signature_ncbicxx_2_28_8
#define mbedtls_ecdsa_write_signature_det \
- mbedtls_ecdsa_write_signature_det_ncbicxx_2_28_3
+ mbedtls_ecdsa_write_signature_det_ncbicxx_2_28_8
#define mbedtls_ecdsa_write_signature_restartable \
- mbedtls_ecdsa_write_signature_restartable_ncbicxx_2_28_3
+ mbedtls_ecdsa_write_signature_restartable_ncbicxx_2_28_8
#define mbedtls_ecp_check_privkey \
- mbedtls_ecp_check_privkey_ncbicxx_2_28_3
+ mbedtls_ecp_check_privkey_ncbicxx_2_28_8
#define mbedtls_ecp_check_pub_priv \
- mbedtls_ecp_check_pub_priv_ncbicxx_2_28_3
+ mbedtls_ecp_check_pub_priv_ncbicxx_2_28_8
#define mbedtls_ecp_check_pubkey \
- mbedtls_ecp_check_pubkey_ncbicxx_2_28_3
+ mbedtls_ecp_check_pubkey_ncbicxx_2_28_8
#define mbedtls_ecp_copy \
- mbedtls_ecp_copy_ncbicxx_2_28_3
+ mbedtls_ecp_copy_ncbicxx_2_28_8
#define mbedtls_ecp_curve_info_from_grp_id \
- mbedtls_ecp_curve_info_from_grp_id_ncbicxx_2_28_3
+ mbedtls_ecp_curve_info_from_grp_id_ncbicxx_2_28_8
#define mbedtls_ecp_curve_info_from_name \
- mbedtls_ecp_curve_info_from_name_ncbicxx_2_28_3
+ mbedtls_ecp_curve_info_from_name_ncbicxx_2_28_8
#define mbedtls_ecp_curve_info_from_tls_id \
- mbedtls_ecp_curve_info_from_tls_id_ncbicxx_2_28_3
+ mbedtls_ecp_curve_info_from_tls_id_ncbicxx_2_28_8
#define mbedtls_ecp_curve_list \
- mbedtls_ecp_curve_list_ncbicxx_2_28_3
+ mbedtls_ecp_curve_list_ncbicxx_2_28_8
#define mbedtls_ecp_gen_key \
- mbedtls_ecp_gen_key_ncbicxx_2_28_3
+ mbedtls_ecp_gen_key_ncbicxx_2_28_8
#define mbedtls_ecp_gen_keypair \
- mbedtls_ecp_gen_keypair_ncbicxx_2_28_3
+ mbedtls_ecp_gen_keypair_ncbicxx_2_28_8
#define mbedtls_ecp_gen_keypair_base \
- mbedtls_ecp_gen_keypair_base_ncbicxx_2_28_3
+ mbedtls_ecp_gen_keypair_base_ncbicxx_2_28_8
#define mbedtls_ecp_gen_privkey \
- mbedtls_ecp_gen_privkey_ncbicxx_2_28_3
+ mbedtls_ecp_gen_privkey_ncbicxx_2_28_8
#define mbedtls_ecp_get_type \
- mbedtls_ecp_get_type_ncbicxx_2_28_3
+ mbedtls_ecp_get_type_ncbicxx_2_28_8
#define mbedtls_ecp_group_copy \
- mbedtls_ecp_group_copy_ncbicxx_2_28_3
+ mbedtls_ecp_group_copy_ncbicxx_2_28_8
#define mbedtls_ecp_group_free \
- mbedtls_ecp_group_free_ncbicxx_2_28_3
+ mbedtls_ecp_group_free_ncbicxx_2_28_8
#define mbedtls_ecp_group_init \
- mbedtls_ecp_group_init_ncbicxx_2_28_3
+ mbedtls_ecp_group_init_ncbicxx_2_28_8
#define mbedtls_ecp_grp_id_list \
- mbedtls_ecp_grp_id_list_ncbicxx_2_28_3
+ mbedtls_ecp_grp_id_list_ncbicxx_2_28_8
#define mbedtls_ecp_is_zero \
- mbedtls_ecp_is_zero_ncbicxx_2_28_3
+ mbedtls_ecp_is_zero_ncbicxx_2_28_8
#define mbedtls_ecp_keypair_free \
- mbedtls_ecp_keypair_free_ncbicxx_2_28_3
+ mbedtls_ecp_keypair_free_ncbicxx_2_28_8
#define mbedtls_ecp_keypair_init \
- mbedtls_ecp_keypair_init_ncbicxx_2_28_3
+ mbedtls_ecp_keypair_init_ncbicxx_2_28_8
#define mbedtls_ecp_mul \
- mbedtls_ecp_mul_ncbicxx_2_28_3
+ mbedtls_ecp_mul_ncbicxx_2_28_8
#define mbedtls_ecp_mul_restartable \
- mbedtls_ecp_mul_restartable_ncbicxx_2_28_3
+ mbedtls_ecp_mul_restartable_ncbicxx_2_28_8
#define mbedtls_ecp_muladd \
- mbedtls_ecp_muladd_ncbicxx_2_28_3
+ mbedtls_ecp_muladd_ncbicxx_2_28_8
#define mbedtls_ecp_muladd_restartable \
- mbedtls_ecp_muladd_restartable_ncbicxx_2_28_3
+ mbedtls_ecp_muladd_restartable_ncbicxx_2_28_8
#define mbedtls_ecp_point_cmp \
- mbedtls_ecp_point_cmp_ncbicxx_2_28_3
+ mbedtls_ecp_point_cmp_ncbicxx_2_28_8
#define mbedtls_ecp_point_free \
- mbedtls_ecp_point_free_ncbicxx_2_28_3
+ mbedtls_ecp_point_free_ncbicxx_2_28_8
#define mbedtls_ecp_point_init \
- mbedtls_ecp_point_init_ncbicxx_2_28_3
+ mbedtls_ecp_point_init_ncbicxx_2_28_8
#define mbedtls_ecp_point_read_binary \
- mbedtls_ecp_point_read_binary_ncbicxx_2_28_3
+ mbedtls_ecp_point_read_binary_ncbicxx_2_28_8
#define mbedtls_ecp_point_read_string \
- mbedtls_ecp_point_read_string_ncbicxx_2_28_3
+ mbedtls_ecp_point_read_string_ncbicxx_2_28_8
#define mbedtls_ecp_point_write_binary \
- mbedtls_ecp_point_write_binary_ncbicxx_2_28_3
+ mbedtls_ecp_point_write_binary_ncbicxx_2_28_8
#define mbedtls_ecp_read_key \
- mbedtls_ecp_read_key_ncbicxx_2_28_3
+ mbedtls_ecp_read_key_ncbicxx_2_28_8
#define mbedtls_ecp_set_zero \
- mbedtls_ecp_set_zero_ncbicxx_2_28_3
+ mbedtls_ecp_set_zero_ncbicxx_2_28_8
#define mbedtls_ecp_tls_read_group \
- mbedtls_ecp_tls_read_group_ncbicxx_2_28_3
+ mbedtls_ecp_tls_read_group_ncbicxx_2_28_8
#define mbedtls_ecp_tls_read_group_id \
- mbedtls_ecp_tls_read_group_id_ncbicxx_2_28_3
+ mbedtls_ecp_tls_read_group_id_ncbicxx_2_28_8
#define mbedtls_ecp_tls_read_point \
- mbedtls_ecp_tls_read_point_ncbicxx_2_28_3
+ mbedtls_ecp_tls_read_point_ncbicxx_2_28_8
#define mbedtls_ecp_tls_write_group \
- mbedtls_ecp_tls_write_group_ncbicxx_2_28_3
+ mbedtls_ecp_tls_write_group_ncbicxx_2_28_8
#define mbedtls_ecp_tls_write_point \
- mbedtls_ecp_tls_write_point_ncbicxx_2_28_3
+ mbedtls_ecp_tls_write_point_ncbicxx_2_28_8
#define mbedtls_ecp_write_key \
- mbedtls_ecp_write_key_ncbicxx_2_28_3
+ mbedtls_ecp_write_key_ncbicxx_2_28_8
#define mbedtls_ecp_group_load \
- mbedtls_ecp_group_load_ncbicxx_2_28_3
+ mbedtls_ecp_group_load_ncbicxx_2_28_8
#define mbedtls_entropy_add_source \
- mbedtls_entropy_add_source_ncbicxx_2_28_3
+ mbedtls_entropy_add_source_ncbicxx_2_28_8
#define mbedtls_entropy_free \
- mbedtls_entropy_free_ncbicxx_2_28_3
+ mbedtls_entropy_free_ncbicxx_2_28_8
#define mbedtls_entropy_func \
- mbedtls_entropy_func_ncbicxx_2_28_3
+ mbedtls_entropy_func_ncbicxx_2_28_8
#define mbedtls_entropy_gather \
- mbedtls_entropy_gather_ncbicxx_2_28_3
+ mbedtls_entropy_gather_ncbicxx_2_28_8
#define mbedtls_entropy_init \
- mbedtls_entropy_init_ncbicxx_2_28_3
+ mbedtls_entropy_init_ncbicxx_2_28_8
#define mbedtls_entropy_update_manual \
- mbedtls_entropy_update_manual_ncbicxx_2_28_3
+ mbedtls_entropy_update_manual_ncbicxx_2_28_8
#define mbedtls_entropy_update_seed_file \
- mbedtls_entropy_update_seed_file_ncbicxx_2_28_3
+ mbedtls_entropy_update_seed_file_ncbicxx_2_28_8
#define mbedtls_entropy_write_seed_file \
- mbedtls_entropy_write_seed_file_ncbicxx_2_28_3
+ mbedtls_entropy_write_seed_file_ncbicxx_2_28_8
#define mbedtls_hardclock_poll \
- mbedtls_hardclock_poll_ncbicxx_2_28_3
+ mbedtls_hardclock_poll_ncbicxx_2_28_8
#define mbedtls_platform_entropy_poll \
- mbedtls_platform_entropy_poll_ncbicxx_2_28_3
+ mbedtls_platform_entropy_poll_ncbicxx_2_28_8
#define mbedtls_high_level_strerr \
- mbedtls_high_level_strerr_ncbicxx_2_28_3
+ mbedtls_high_level_strerr_ncbicxx_2_28_8
#define mbedtls_low_level_strerr \
- mbedtls_low_level_strerr_ncbicxx_2_28_3
+ mbedtls_low_level_strerr_ncbicxx_2_28_8
#define mbedtls_strerror \
- mbedtls_strerror_ncbicxx_2_28_3
+ mbedtls_strerror_ncbicxx_2_28_8
#define mbedtls_gcm_auth_decrypt \
- mbedtls_gcm_auth_decrypt_ncbicxx_2_28_3
+ mbedtls_gcm_auth_decrypt_ncbicxx_2_28_8
#define mbedtls_gcm_crypt_and_tag \
- mbedtls_gcm_crypt_and_tag_ncbicxx_2_28_3
+ mbedtls_gcm_crypt_and_tag_ncbicxx_2_28_8
#define mbedtls_gcm_finish \
- mbedtls_gcm_finish_ncbicxx_2_28_3
+ mbedtls_gcm_finish_ncbicxx_2_28_8
#define mbedtls_gcm_free \
- mbedtls_gcm_free_ncbicxx_2_28_3
+ mbedtls_gcm_free_ncbicxx_2_28_8
#define mbedtls_gcm_init \
- mbedtls_gcm_init_ncbicxx_2_28_3
+ mbedtls_gcm_init_ncbicxx_2_28_8
#define mbedtls_gcm_setkey \
- mbedtls_gcm_setkey_ncbicxx_2_28_3
+ mbedtls_gcm_setkey_ncbicxx_2_28_8
#define mbedtls_gcm_starts \
- mbedtls_gcm_starts_ncbicxx_2_28_3
+ mbedtls_gcm_starts_ncbicxx_2_28_8
#define mbedtls_gcm_update \
- mbedtls_gcm_update_ncbicxx_2_28_3
+ mbedtls_gcm_update_ncbicxx_2_28_8
#define mbedtls_hkdf \
- mbedtls_hkdf_ncbicxx_2_28_3
+ mbedtls_hkdf_ncbicxx_2_28_8
#define mbedtls_hkdf_expand \
- mbedtls_hkdf_expand_ncbicxx_2_28_3
+ mbedtls_hkdf_expand_ncbicxx_2_28_8
#define mbedtls_hkdf_extract \
- mbedtls_hkdf_extract_ncbicxx_2_28_3
+ mbedtls_hkdf_extract_ncbicxx_2_28_8
#define mbedtls_hmac_drbg_free \
- mbedtls_hmac_drbg_free_ncbicxx_2_28_3
+ mbedtls_hmac_drbg_free_ncbicxx_2_28_8
#define mbedtls_hmac_drbg_init \
- mbedtls_hmac_drbg_init_ncbicxx_2_28_3
+ mbedtls_hmac_drbg_init_ncbicxx_2_28_8
#define mbedtls_hmac_drbg_random \
- mbedtls_hmac_drbg_random_ncbicxx_2_28_3
+ mbedtls_hmac_drbg_random_ncbicxx_2_28_8
#define mbedtls_hmac_drbg_random_with_add \
- mbedtls_hmac_drbg_random_with_add_ncbicxx_2_28_3
+ mbedtls_hmac_drbg_random_with_add_ncbicxx_2_28_8
#define mbedtls_hmac_drbg_reseed \
- mbedtls_hmac_drbg_reseed_ncbicxx_2_28_3
+ mbedtls_hmac_drbg_reseed_ncbicxx_2_28_8
#define mbedtls_hmac_drbg_seed \
- mbedtls_hmac_drbg_seed_ncbicxx_2_28_3
+ mbedtls_hmac_drbg_seed_ncbicxx_2_28_8
#define mbedtls_hmac_drbg_seed_buf \
- mbedtls_hmac_drbg_seed_buf_ncbicxx_2_28_3
+ mbedtls_hmac_drbg_seed_buf_ncbicxx_2_28_8
#define mbedtls_hmac_drbg_set_entropy_len \
- mbedtls_hmac_drbg_set_entropy_len_ncbicxx_2_28_3
+ mbedtls_hmac_drbg_set_entropy_len_ncbicxx_2_28_8
#define mbedtls_hmac_drbg_set_prediction_resistance \
- mbedtls_hmac_drbg_set_prediction_resistance_ncbicxx_2_28_3
+ mbedtls_hmac_drbg_set_prediction_resistance_ncbicxx_2_28_8
#define mbedtls_hmac_drbg_set_reseed_interval \
- mbedtls_hmac_drbg_set_reseed_interval_ncbicxx_2_28_3
+ mbedtls_hmac_drbg_set_reseed_interval_ncbicxx_2_28_8
#define mbedtls_hmac_drbg_update \
- mbedtls_hmac_drbg_update_ncbicxx_2_28_3
+ mbedtls_hmac_drbg_update_ncbicxx_2_28_8
#define mbedtls_hmac_drbg_update_ret \
- mbedtls_hmac_drbg_update_ret_ncbicxx_2_28_3
+ mbedtls_hmac_drbg_update_ret_ncbicxx_2_28_8
#define mbedtls_hmac_drbg_update_seed_file \
- mbedtls_hmac_drbg_update_seed_file_ncbicxx_2_28_3
+ mbedtls_hmac_drbg_update_seed_file_ncbicxx_2_28_8
#define mbedtls_hmac_drbg_write_seed_file \
- mbedtls_hmac_drbg_write_seed_file_ncbicxx_2_28_3
+ mbedtls_hmac_drbg_write_seed_file_ncbicxx_2_28_8
#define mbedtls_md \
- mbedtls_md_ncbicxx_2_28_3
+ mbedtls_md_ncbicxx_2_28_8
#define mbedtls_md5_info \
- mbedtls_md5_info_ncbicxx_2_28_3
+ mbedtls_md5_info_ncbicxx_2_28_8
#define mbedtls_md_clone \
- mbedtls_md_clone_ncbicxx_2_28_3
+ mbedtls_md_clone_ncbicxx_2_28_8
#define mbedtls_md_file \
- mbedtls_md_file_ncbicxx_2_28_3
+ mbedtls_md_file_ncbicxx_2_28_8
#define mbedtls_md_finish \
- mbedtls_md_finish_ncbicxx_2_28_3
+ mbedtls_md_finish_ncbicxx_2_28_8
#define mbedtls_md_free \
- mbedtls_md_free_ncbicxx_2_28_3
+ mbedtls_md_free_ncbicxx_2_28_8
#define mbedtls_md_get_name \
- mbedtls_md_get_name_ncbicxx_2_28_3
+ mbedtls_md_get_name_ncbicxx_2_28_8
#define mbedtls_md_get_size \
- mbedtls_md_get_size_ncbicxx_2_28_3
+ mbedtls_md_get_size_ncbicxx_2_28_8
#define mbedtls_md_get_type \
- mbedtls_md_get_type_ncbicxx_2_28_3
+ mbedtls_md_get_type_ncbicxx_2_28_8
#define mbedtls_md_hmac \
- mbedtls_md_hmac_ncbicxx_2_28_3
+ mbedtls_md_hmac_ncbicxx_2_28_8
#define mbedtls_md_hmac_finish \
- mbedtls_md_hmac_finish_ncbicxx_2_28_3
+ mbedtls_md_hmac_finish_ncbicxx_2_28_8
#define mbedtls_md_hmac_reset \
- mbedtls_md_hmac_reset_ncbicxx_2_28_3
+ mbedtls_md_hmac_reset_ncbicxx_2_28_8
#define mbedtls_md_hmac_starts \
- mbedtls_md_hmac_starts_ncbicxx_2_28_3
+ mbedtls_md_hmac_starts_ncbicxx_2_28_8
#define mbedtls_md_hmac_update \
- mbedtls_md_hmac_update_ncbicxx_2_28_3
+ mbedtls_md_hmac_update_ncbicxx_2_28_8
#define mbedtls_md_info_from_string \
- mbedtls_md_info_from_string_ncbicxx_2_28_3
+ mbedtls_md_info_from_string_ncbicxx_2_28_8
#define mbedtls_md_info_from_type \
- mbedtls_md_info_from_type_ncbicxx_2_28_3
+ mbedtls_md_info_from_type_ncbicxx_2_28_8
#define mbedtls_md_init \
- mbedtls_md_init_ncbicxx_2_28_3
+ mbedtls_md_init_ncbicxx_2_28_8
#define mbedtls_md_init_ctx \
- mbedtls_md_init_ctx_ncbicxx_2_28_3
+ mbedtls_md_init_ctx_ncbicxx_2_28_8
#define mbedtls_md_list \
- mbedtls_md_list_ncbicxx_2_28_3
+ mbedtls_md_list_ncbicxx_2_28_8
#define mbedtls_md_process \
- mbedtls_md_process_ncbicxx_2_28_3
+ mbedtls_md_process_ncbicxx_2_28_8
#define mbedtls_md_setup \
- mbedtls_md_setup_ncbicxx_2_28_3
+ mbedtls_md_setup_ncbicxx_2_28_8
#define mbedtls_md_starts \
- mbedtls_md_starts_ncbicxx_2_28_3
+ mbedtls_md_starts_ncbicxx_2_28_8
#define mbedtls_md_update \
- mbedtls_md_update_ncbicxx_2_28_3
+ mbedtls_md_update_ncbicxx_2_28_8
#define mbedtls_ripemd160_info \
- mbedtls_ripemd160_info_ncbicxx_2_28_3
+ mbedtls_ripemd160_info_ncbicxx_2_28_8
#define mbedtls_sha1_info \
- mbedtls_sha1_info_ncbicxx_2_28_3
+ mbedtls_sha1_info_ncbicxx_2_28_8
#define mbedtls_sha224_info \
- mbedtls_sha224_info_ncbicxx_2_28_3
+ mbedtls_sha224_info_ncbicxx_2_28_8
#define mbedtls_sha256_info \
- mbedtls_sha256_info_ncbicxx_2_28_3
+ mbedtls_sha256_info_ncbicxx_2_28_8
#define mbedtls_sha384_info \
- mbedtls_sha384_info_ncbicxx_2_28_3
+ mbedtls_sha384_info_ncbicxx_2_28_8
#define mbedtls_sha512_info \
- mbedtls_sha512_info_ncbicxx_2_28_3
+ mbedtls_sha512_info_ncbicxx_2_28_8
#define mbedtls_internal_md5_process \
- mbedtls_internal_md5_process_ncbicxx_2_28_3
+ mbedtls_internal_md5_process_ncbicxx_2_28_8
#define mbedtls_md5 \
- mbedtls_md5_ncbicxx_2_28_3
+ mbedtls_md5_ncbicxx_2_28_8
#define mbedtls_md5_clone \
- mbedtls_md5_clone_ncbicxx_2_28_3
+ mbedtls_md5_clone_ncbicxx_2_28_8
#define mbedtls_md5_finish \
- mbedtls_md5_finish_ncbicxx_2_28_3
+ mbedtls_md5_finish_ncbicxx_2_28_8
#define mbedtls_md5_finish_ret \
- mbedtls_md5_finish_ret_ncbicxx_2_28_3
+ mbedtls_md5_finish_ret_ncbicxx_2_28_8
#define mbedtls_md5_free \
- mbedtls_md5_free_ncbicxx_2_28_3
+ mbedtls_md5_free_ncbicxx_2_28_8
#define mbedtls_md5_init \
- mbedtls_md5_init_ncbicxx_2_28_3
+ mbedtls_md5_init_ncbicxx_2_28_8
#define mbedtls_md5_process \
- mbedtls_md5_process_ncbicxx_2_28_3
+ mbedtls_md5_process_ncbicxx_2_28_8
#define mbedtls_md5_ret \
- mbedtls_md5_ret_ncbicxx_2_28_3
+ mbedtls_md5_ret_ncbicxx_2_28_8
#define mbedtls_md5_starts \
- mbedtls_md5_starts_ncbicxx_2_28_3
+ mbedtls_md5_starts_ncbicxx_2_28_8
#define mbedtls_md5_starts_ret \
- mbedtls_md5_starts_ret_ncbicxx_2_28_3
+ mbedtls_md5_starts_ret_ncbicxx_2_28_8
#define mbedtls_md5_update \
- mbedtls_md5_update_ncbicxx_2_28_3
+ mbedtls_md5_update_ncbicxx_2_28_8
#define mbedtls_md5_update_ret \
- mbedtls_md5_update_ret_ncbicxx_2_28_3
+ mbedtls_md5_update_ret_ncbicxx_2_28_8
#define mbedtls_net_accept \
- mbedtls_net_accept_ncbicxx_2_28_3
+ mbedtls_net_accept_ncbicxx_2_28_8
#define mbedtls_net_bind \
- mbedtls_net_bind_ncbicxx_2_28_3
+ mbedtls_net_bind_ncbicxx_2_28_8
#define mbedtls_net_close \
- mbedtls_net_close_ncbicxx_2_28_3
+ mbedtls_net_close_ncbicxx_2_28_8
#define mbedtls_net_connect \
- mbedtls_net_connect_ncbicxx_2_28_3
+ mbedtls_net_connect_ncbicxx_2_28_8
#define mbedtls_net_free \
- mbedtls_net_free_ncbicxx_2_28_3
+ mbedtls_net_free_ncbicxx_2_28_8
#define mbedtls_net_init \
- mbedtls_net_init_ncbicxx_2_28_3
+ mbedtls_net_init_ncbicxx_2_28_8
#define mbedtls_net_poll \
- mbedtls_net_poll_ncbicxx_2_28_3
+ mbedtls_net_poll_ncbicxx_2_28_8
#define mbedtls_net_recv \
- mbedtls_net_recv_ncbicxx_2_28_3
+ mbedtls_net_recv_ncbicxx_2_28_8
#define mbedtls_net_recv_timeout \
- mbedtls_net_recv_timeout_ncbicxx_2_28_3
+ mbedtls_net_recv_timeout_ncbicxx_2_28_8
#define mbedtls_net_send \
- mbedtls_net_send_ncbicxx_2_28_3
+ mbedtls_net_send_ncbicxx_2_28_8
#define mbedtls_net_set_block \
- mbedtls_net_set_block_ncbicxx_2_28_3
+ mbedtls_net_set_block_ncbicxx_2_28_8
#define mbedtls_net_set_nonblock \
- mbedtls_net_set_nonblock_ncbicxx_2_28_3
+ mbedtls_net_set_nonblock_ncbicxx_2_28_8
#define mbedtls_net_usleep \
- mbedtls_net_usleep_ncbicxx_2_28_3
+ mbedtls_net_usleep_ncbicxx_2_28_8
#define mbedtls_oid_get_attr_short_name \
- mbedtls_oid_get_attr_short_name_ncbicxx_2_28_3
+ mbedtls_oid_get_attr_short_name_ncbicxx_2_28_8
#define mbedtls_oid_get_certificate_policies \
- mbedtls_oid_get_certificate_policies_ncbicxx_2_28_3
+ mbedtls_oid_get_certificate_policies_ncbicxx_2_28_8
#define mbedtls_oid_get_cipher_alg \
- mbedtls_oid_get_cipher_alg_ncbicxx_2_28_3
+ mbedtls_oid_get_cipher_alg_ncbicxx_2_28_8
#define mbedtls_oid_get_ec_grp \
- mbedtls_oid_get_ec_grp_ncbicxx_2_28_3
+ mbedtls_oid_get_ec_grp_ncbicxx_2_28_8
#define mbedtls_oid_get_extended_key_usage \
- mbedtls_oid_get_extended_key_usage_ncbicxx_2_28_3
+ mbedtls_oid_get_extended_key_usage_ncbicxx_2_28_8
#define mbedtls_oid_get_md_alg \
- mbedtls_oid_get_md_alg_ncbicxx_2_28_3
+ mbedtls_oid_get_md_alg_ncbicxx_2_28_8
#define mbedtls_oid_get_md_hmac \
- mbedtls_oid_get_md_hmac_ncbicxx_2_28_3
+ mbedtls_oid_get_md_hmac_ncbicxx_2_28_8
#define mbedtls_oid_get_numeric_string \
- mbedtls_oid_get_numeric_string_ncbicxx_2_28_3
+ mbedtls_oid_get_numeric_string_ncbicxx_2_28_8
#define mbedtls_oid_get_oid_by_ec_grp \
- mbedtls_oid_get_oid_by_ec_grp_ncbicxx_2_28_3
+ mbedtls_oid_get_oid_by_ec_grp_ncbicxx_2_28_8
#define mbedtls_oid_get_oid_by_md \
- mbedtls_oid_get_oid_by_md_ncbicxx_2_28_3
+ mbedtls_oid_get_oid_by_md_ncbicxx_2_28_8
#define mbedtls_oid_get_oid_by_pk_alg \
- mbedtls_oid_get_oid_by_pk_alg_ncbicxx_2_28_3
+ mbedtls_oid_get_oid_by_pk_alg_ncbicxx_2_28_8
#define mbedtls_oid_get_oid_by_sig_alg \
- mbedtls_oid_get_oid_by_sig_alg_ncbicxx_2_28_3
+ mbedtls_oid_get_oid_by_sig_alg_ncbicxx_2_28_8
#define mbedtls_oid_get_pk_alg \
- mbedtls_oid_get_pk_alg_ncbicxx_2_28_3
+ mbedtls_oid_get_pk_alg_ncbicxx_2_28_8
#define mbedtls_oid_get_pkcs12_pbe_alg \
- mbedtls_oid_get_pkcs12_pbe_alg_ncbicxx_2_28_3
+ mbedtls_oid_get_pkcs12_pbe_alg_ncbicxx_2_28_8
#define mbedtls_oid_get_sig_alg \
- mbedtls_oid_get_sig_alg_ncbicxx_2_28_3
+ mbedtls_oid_get_sig_alg_ncbicxx_2_28_8
#define mbedtls_oid_get_sig_alg_desc \
- mbedtls_oid_get_sig_alg_desc_ncbicxx_2_28_3
+ mbedtls_oid_get_sig_alg_desc_ncbicxx_2_28_8
#define mbedtls_oid_get_x509_ext_type \
- mbedtls_oid_get_x509_ext_type_ncbicxx_2_28_3
+ mbedtls_oid_get_x509_ext_type_ncbicxx_2_28_8
#define mbedtls_pem_free \
- mbedtls_pem_free_ncbicxx_2_28_3
+ mbedtls_pem_free_ncbicxx_2_28_8
#define mbedtls_pem_init \
- mbedtls_pem_init_ncbicxx_2_28_3
+ mbedtls_pem_init_ncbicxx_2_28_8
#define mbedtls_pem_read_buffer \
- mbedtls_pem_read_buffer_ncbicxx_2_28_3
+ mbedtls_pem_read_buffer_ncbicxx_2_28_8
#define mbedtls_pem_write_buffer \
- mbedtls_pem_write_buffer_ncbicxx_2_28_3
+ mbedtls_pem_write_buffer_ncbicxx_2_28_8
#define mbedtls_pk_can_do \
- mbedtls_pk_can_do_ncbicxx_2_28_3
+ mbedtls_pk_can_do_ncbicxx_2_28_8
#define mbedtls_pk_check_pair \
- mbedtls_pk_check_pair_ncbicxx_2_28_3
+ mbedtls_pk_check_pair_ncbicxx_2_28_8
#define mbedtls_pk_debug \
- mbedtls_pk_debug_ncbicxx_2_28_3
+ mbedtls_pk_debug_ncbicxx_2_28_8
#define mbedtls_pk_decrypt \
- mbedtls_pk_decrypt_ncbicxx_2_28_3
+ mbedtls_pk_decrypt_ncbicxx_2_28_8
#define mbedtls_pk_encrypt \
- mbedtls_pk_encrypt_ncbicxx_2_28_3
+ mbedtls_pk_encrypt_ncbicxx_2_28_8
#define mbedtls_pk_free \
- mbedtls_pk_free_ncbicxx_2_28_3
+ mbedtls_pk_free_ncbicxx_2_28_8
#define mbedtls_pk_get_bitlen \
- mbedtls_pk_get_bitlen_ncbicxx_2_28_3
+ mbedtls_pk_get_bitlen_ncbicxx_2_28_8
#define mbedtls_pk_get_name \
- mbedtls_pk_get_name_ncbicxx_2_28_3
+ mbedtls_pk_get_name_ncbicxx_2_28_8
#define mbedtls_pk_get_type \
- mbedtls_pk_get_type_ncbicxx_2_28_3
+ mbedtls_pk_get_type_ncbicxx_2_28_8
#define mbedtls_pk_info_from_type \
- mbedtls_pk_info_from_type_ncbicxx_2_28_3
+ mbedtls_pk_info_from_type_ncbicxx_2_28_8
#define mbedtls_pk_init \
- mbedtls_pk_init_ncbicxx_2_28_3
+ mbedtls_pk_init_ncbicxx_2_28_8
#define mbedtls_pk_setup \
- mbedtls_pk_setup_ncbicxx_2_28_3
+ mbedtls_pk_setup_ncbicxx_2_28_8
#define mbedtls_pk_setup_rsa_alt \
- mbedtls_pk_setup_rsa_alt_ncbicxx_2_28_3
+ mbedtls_pk_setup_rsa_alt_ncbicxx_2_28_8
#define mbedtls_pk_sign \
- mbedtls_pk_sign_ncbicxx_2_28_3
+ mbedtls_pk_sign_ncbicxx_2_28_8
#define mbedtls_pk_sign_restartable \
- mbedtls_pk_sign_restartable_ncbicxx_2_28_3
+ mbedtls_pk_sign_restartable_ncbicxx_2_28_8
#define mbedtls_pk_verify \
- mbedtls_pk_verify_ncbicxx_2_28_3
+ mbedtls_pk_verify_ncbicxx_2_28_8
#define mbedtls_pk_verify_ext \
- mbedtls_pk_verify_ext_ncbicxx_2_28_3
+ mbedtls_pk_verify_ext_ncbicxx_2_28_8
#define mbedtls_pk_verify_restartable \
- mbedtls_pk_verify_restartable_ncbicxx_2_28_3
+ mbedtls_pk_verify_restartable_ncbicxx_2_28_8
#define mbedtls_ecdsa_info \
- mbedtls_ecdsa_info_ncbicxx_2_28_3
+ mbedtls_ecdsa_info_ncbicxx_2_28_8
#define mbedtls_eckey_info \
- mbedtls_eckey_info_ncbicxx_2_28_3
+ mbedtls_eckey_info_ncbicxx_2_28_8
#define mbedtls_eckeydh_info \
- mbedtls_eckeydh_info_ncbicxx_2_28_3
+ mbedtls_eckeydh_info_ncbicxx_2_28_8
#define mbedtls_rsa_alt_info \
- mbedtls_rsa_alt_info_ncbicxx_2_28_3
+ mbedtls_rsa_alt_info_ncbicxx_2_28_8
#define mbedtls_rsa_info \
- mbedtls_rsa_info_ncbicxx_2_28_3
+ mbedtls_rsa_info_ncbicxx_2_28_8
#define mbedtls_pkcs12_derivation \
- mbedtls_pkcs12_derivation_ncbicxx_2_28_3
+ mbedtls_pkcs12_derivation_ncbicxx_2_28_8
#define mbedtls_pkcs12_pbe \
- mbedtls_pkcs12_pbe_ncbicxx_2_28_3
+ mbedtls_pkcs12_pbe_ncbicxx_2_28_8
+#define mbedtls_pkcs12_pbe_ext \
+ mbedtls_pkcs12_pbe_ext_ncbicxx_2_28_8
#define mbedtls_pkcs12_pbe_sha1_rc4_128 \
- mbedtls_pkcs12_pbe_sha1_rc4_128_ncbicxx_2_28_3
+ mbedtls_pkcs12_pbe_sha1_rc4_128_ncbicxx_2_28_8
#define mbedtls_pkcs5_pbes2 \
- mbedtls_pkcs5_pbes2_ncbicxx_2_28_3
+ mbedtls_pkcs5_pbes2_ncbicxx_2_28_8
+#define mbedtls_pkcs5_pbes2_ext \
+ mbedtls_pkcs5_pbes2_ext_ncbicxx_2_28_8
#define mbedtls_pkcs5_pbkdf2_hmac \
- mbedtls_pkcs5_pbkdf2_hmac_ncbicxx_2_28_3
+ mbedtls_pkcs5_pbkdf2_hmac_ncbicxx_2_28_8
#define mbedtls_pk_load_file \
- mbedtls_pk_load_file_ncbicxx_2_28_3
+ mbedtls_pk_load_file_ncbicxx_2_28_8
#define mbedtls_pk_parse_key \
- mbedtls_pk_parse_key_ncbicxx_2_28_3
+ mbedtls_pk_parse_key_ncbicxx_2_28_8
#define mbedtls_pk_parse_keyfile \
- mbedtls_pk_parse_keyfile_ncbicxx_2_28_3
+ mbedtls_pk_parse_keyfile_ncbicxx_2_28_8
#define mbedtls_pk_parse_public_key \
- mbedtls_pk_parse_public_key_ncbicxx_2_28_3
+ mbedtls_pk_parse_public_key_ncbicxx_2_28_8
#define mbedtls_pk_parse_public_keyfile \
- mbedtls_pk_parse_public_keyfile_ncbicxx_2_28_3
+ mbedtls_pk_parse_public_keyfile_ncbicxx_2_28_8
#define mbedtls_pk_parse_subpubkey \
- mbedtls_pk_parse_subpubkey_ncbicxx_2_28_3
+ mbedtls_pk_parse_subpubkey_ncbicxx_2_28_8
#define mbedtls_pk_write_key_der \
- mbedtls_pk_write_key_der_ncbicxx_2_28_3
+ mbedtls_pk_write_key_der_ncbicxx_2_28_8
#define mbedtls_pk_write_key_pem \
- mbedtls_pk_write_key_pem_ncbicxx_2_28_3
+ mbedtls_pk_write_key_pem_ncbicxx_2_28_8
#define mbedtls_pk_write_pubkey \
- mbedtls_pk_write_pubkey_ncbicxx_2_28_3
+ mbedtls_pk_write_pubkey_ncbicxx_2_28_8
#define mbedtls_pk_write_pubkey_der \
- mbedtls_pk_write_pubkey_der_ncbicxx_2_28_3
+ mbedtls_pk_write_pubkey_der_ncbicxx_2_28_8
#define mbedtls_pk_write_pubkey_pem \
- mbedtls_pk_write_pubkey_pem_ncbicxx_2_28_3
+ mbedtls_pk_write_pubkey_pem_ncbicxx_2_28_8
#define mbedtls_platform_setup \
- mbedtls_platform_setup_ncbicxx_2_28_3
+ mbedtls_platform_setup_ncbicxx_2_28_8
#define mbedtls_platform_set_snprintf \
- mbedtls_platform_set_snprintf_ncbicxx_2_28_3
+ mbedtls_platform_set_snprintf_ncbicxx_2_28_8
#define mbedtls_platform_set_vsnprintf \
- mbedtls_platform_set_vsnprintf_ncbicxx_2_28_3
+ mbedtls_platform_set_vsnprintf_ncbicxx_2_28_8
#define mbedtls_platform_teardown \
- mbedtls_platform_teardown_ncbicxx_2_28_3
+ mbedtls_platform_teardown_ncbicxx_2_28_8
#define mbedtls_snprintf \
- mbedtls_snprintf_ncbicxx_2_28_3
+ mbedtls_snprintf_ncbicxx_2_28_8
#define mbedtls_vsnprintf \
- mbedtls_vsnprintf_ncbicxx_2_28_3
+ mbedtls_vsnprintf_ncbicxx_2_28_8
#define mbedtls_platform_gmtime_r \
- mbedtls_platform_gmtime_r_ncbicxx_2_28_3
+ mbedtls_platform_gmtime_r_ncbicxx_2_28_8
#define mbedtls_platform_zeroize \
- mbedtls_platform_zeroize_ncbicxx_2_28_3
+ mbedtls_platform_zeroize_ncbicxx_2_28_8
#define mbedtls_poly1305_finish \
- mbedtls_poly1305_finish_ncbicxx_2_28_3
+ mbedtls_poly1305_finish_ncbicxx_2_28_8
#define mbedtls_poly1305_free \
- mbedtls_poly1305_free_ncbicxx_2_28_3
+ mbedtls_poly1305_free_ncbicxx_2_28_8
#define mbedtls_poly1305_init \
- mbedtls_poly1305_init_ncbicxx_2_28_3
+ mbedtls_poly1305_init_ncbicxx_2_28_8
#define mbedtls_poly1305_mac \
- mbedtls_poly1305_mac_ncbicxx_2_28_3
+ mbedtls_poly1305_mac_ncbicxx_2_28_8
#define mbedtls_poly1305_starts \
- mbedtls_poly1305_starts_ncbicxx_2_28_3
+ mbedtls_poly1305_starts_ncbicxx_2_28_8
#define mbedtls_poly1305_update \
- mbedtls_poly1305_update_ncbicxx_2_28_3
+ mbedtls_poly1305_update_ncbicxx_2_28_8
#define mbedtls_ecc_group_of_psa \
- mbedtls_ecc_group_of_psa_ncbicxx_2_28_3
+ mbedtls_ecc_group_of_psa_ncbicxx_2_28_8
#define mbedtls_psa_crypto_configure_entropy_sources \
- mbedtls_psa_crypto_configure_entropy_sources_ncbicxx_2_28_3
+ mbedtls_psa_crypto_configure_entropy_sources_ncbicxx_2_28_8
#define mbedtls_psa_crypto_free \
- mbedtls_psa_crypto_free_ncbicxx_2_28_3
+ mbedtls_psa_crypto_free_ncbicxx_2_28_8
#define mbedtls_psa_random_state \
- mbedtls_psa_random_state_ncbicxx_2_28_3
+ mbedtls_psa_random_state_ncbicxx_2_28_8
#define mbedtls_to_psa_error \
- mbedtls_to_psa_error_ncbicxx_2_28_3
+ mbedtls_to_psa_error_ncbicxx_2_28_8
#define psa_aead_decrypt \
- psa_aead_decrypt_ncbicxx_2_28_3
+ psa_aead_decrypt_ncbicxx_2_28_8
#define psa_aead_encrypt \
- psa_aead_encrypt_ncbicxx_2_28_3
+ psa_aead_encrypt_ncbicxx_2_28_8
#define psa_allocate_buffer_to_slot \
- psa_allocate_buffer_to_slot_ncbicxx_2_28_3
+ psa_allocate_buffer_to_slot_ncbicxx_2_28_8
#define psa_asymmetric_decrypt \
- psa_asymmetric_decrypt_ncbicxx_2_28_3
+ psa_asymmetric_decrypt_ncbicxx_2_28_8
#define psa_asymmetric_encrypt \
- psa_asymmetric_encrypt_ncbicxx_2_28_3
+ psa_asymmetric_encrypt_ncbicxx_2_28_8
#define psa_cipher_abort \
- psa_cipher_abort_ncbicxx_2_28_3
+ psa_cipher_abort_ncbicxx_2_28_8
#define psa_cipher_decrypt \
- psa_cipher_decrypt_ncbicxx_2_28_3
+ psa_cipher_decrypt_ncbicxx_2_28_8
#define psa_cipher_decrypt_setup \
- psa_cipher_decrypt_setup_ncbicxx_2_28_3
+ psa_cipher_decrypt_setup_ncbicxx_2_28_8
#define psa_cipher_encrypt \
- psa_cipher_encrypt_ncbicxx_2_28_3
+ psa_cipher_encrypt_ncbicxx_2_28_8
#define psa_cipher_encrypt_setup \
- psa_cipher_encrypt_setup_ncbicxx_2_28_3
+ psa_cipher_encrypt_setup_ncbicxx_2_28_8
#define psa_cipher_finish \
- psa_cipher_finish_ncbicxx_2_28_3
+ psa_cipher_finish_ncbicxx_2_28_8
#define psa_cipher_generate_iv \
- psa_cipher_generate_iv_ncbicxx_2_28_3
+ psa_cipher_generate_iv_ncbicxx_2_28_8
#define psa_cipher_set_iv \
- psa_cipher_set_iv_ncbicxx_2_28_3
+ psa_cipher_set_iv_ncbicxx_2_28_8
#define psa_cipher_update \
- psa_cipher_update_ncbicxx_2_28_3
+ psa_cipher_update_ncbicxx_2_28_8
#define psa_copy_key \
- psa_copy_key_ncbicxx_2_28_3
+ psa_copy_key_ncbicxx_2_28_8
#define psa_copy_key_material_into_slot \
- psa_copy_key_material_into_slot_ncbicxx_2_28_3
+ psa_copy_key_material_into_slot_ncbicxx_2_28_8
#define psa_crypto_init \
- psa_crypto_init_ncbicxx_2_28_3
+ psa_crypto_init_ncbicxx_2_28_8
+#define psa_crypto_local_input_alloc \
+ psa_crypto_local_input_alloc_ncbicxx_2_28_8
+#define psa_crypto_local_input_free \
+ psa_crypto_local_input_free_ncbicxx_2_28_8
+#define psa_crypto_local_output_alloc \
+ psa_crypto_local_output_alloc_ncbicxx_2_28_8
+#define psa_crypto_local_output_free \
+ psa_crypto_local_output_free_ncbicxx_2_28_8
#define psa_destroy_key \
- psa_destroy_key_ncbicxx_2_28_3
+ psa_destroy_key_ncbicxx_2_28_8
#define psa_export_key \
- psa_export_key_ncbicxx_2_28_3
+ psa_export_key_ncbicxx_2_28_8
#define psa_export_key_internal \
- psa_export_key_internal_ncbicxx_2_28_3
+ psa_export_key_internal_ncbicxx_2_28_8
#define psa_export_public_key \
- psa_export_public_key_ncbicxx_2_28_3
+ psa_export_public_key_ncbicxx_2_28_8
#define psa_export_public_key_internal \
- psa_export_public_key_internal_ncbicxx_2_28_3
+ psa_export_public_key_internal_ncbicxx_2_28_8
#define psa_generate_key \
- psa_generate_key_ncbicxx_2_28_3
+ psa_generate_key_ncbicxx_2_28_8
#define psa_generate_key_internal \
- psa_generate_key_internal_ncbicxx_2_28_3
+ psa_generate_key_internal_ncbicxx_2_28_8
#define psa_generate_random \
- psa_generate_random_ncbicxx_2_28_3
+ psa_generate_random_ncbicxx_2_28_8
#define psa_get_key_attributes \
- psa_get_key_attributes_ncbicxx_2_28_3
+ psa_get_key_attributes_ncbicxx_2_28_8
#define psa_hash_abort \
- psa_hash_abort_ncbicxx_2_28_3
+ psa_hash_abort_ncbicxx_2_28_8
#define psa_hash_clone \
- psa_hash_clone_ncbicxx_2_28_3
+ psa_hash_clone_ncbicxx_2_28_8
#define psa_hash_compare \
- psa_hash_compare_ncbicxx_2_28_3
+ psa_hash_compare_ncbicxx_2_28_8
#define psa_hash_compute \
- psa_hash_compute_ncbicxx_2_28_3
+ psa_hash_compute_ncbicxx_2_28_8
#define psa_hash_finish \
- psa_hash_finish_ncbicxx_2_28_3
+ psa_hash_finish_ncbicxx_2_28_8
#define psa_hash_setup \
- psa_hash_setup_ncbicxx_2_28_3
+ psa_hash_setup_ncbicxx_2_28_8
#define psa_hash_update \
- psa_hash_update_ncbicxx_2_28_3
+ psa_hash_update_ncbicxx_2_28_8
#define psa_hash_verify \
- psa_hash_verify_ncbicxx_2_28_3
+ psa_hash_verify_ncbicxx_2_28_8
#define psa_import_key \
- psa_import_key_ncbicxx_2_28_3
+ psa_import_key_ncbicxx_2_28_8
#define psa_import_key_into_slot \
- psa_import_key_into_slot_ncbicxx_2_28_3
+ psa_import_key_into_slot_ncbicxx_2_28_8
#define psa_key_derivation_abort \
- psa_key_derivation_abort_ncbicxx_2_28_3
+ psa_key_derivation_abort_ncbicxx_2_28_8
#define psa_key_derivation_get_capacity \
- psa_key_derivation_get_capacity_ncbicxx_2_28_3
+ psa_key_derivation_get_capacity_ncbicxx_2_28_8
#define psa_key_derivation_input_bytes \
- psa_key_derivation_input_bytes_ncbicxx_2_28_3
+ psa_key_derivation_input_bytes_ncbicxx_2_28_8
#define psa_key_derivation_input_key \
- psa_key_derivation_input_key_ncbicxx_2_28_3
+ psa_key_derivation_input_key_ncbicxx_2_28_8
#define psa_key_derivation_key_agreement \
- psa_key_derivation_key_agreement_ncbicxx_2_28_3
+ psa_key_derivation_key_agreement_ncbicxx_2_28_8
#define psa_key_derivation_output_bytes \
- psa_key_derivation_output_bytes_ncbicxx_2_28_3
+ psa_key_derivation_output_bytes_ncbicxx_2_28_8
#define psa_key_derivation_output_key \
- psa_key_derivation_output_key_ncbicxx_2_28_3
+ psa_key_derivation_output_key_ncbicxx_2_28_8
#define psa_key_derivation_set_capacity \
- psa_key_derivation_set_capacity_ncbicxx_2_28_3
+ psa_key_derivation_set_capacity_ncbicxx_2_28_8
#define psa_key_derivation_setup \
- psa_key_derivation_setup_ncbicxx_2_28_3
+ psa_key_derivation_setup_ncbicxx_2_28_8
#define psa_mac_abort \
- psa_mac_abort_ncbicxx_2_28_3
+ psa_mac_abort_ncbicxx_2_28_8
#define psa_mac_compute \
- psa_mac_compute_ncbicxx_2_28_3
+ psa_mac_compute_ncbicxx_2_28_8
#define psa_mac_sign_finish \
- psa_mac_sign_finish_ncbicxx_2_28_3
+ psa_mac_sign_finish_ncbicxx_2_28_8
#define psa_mac_sign_setup \
- psa_mac_sign_setup_ncbicxx_2_28_3
+ psa_mac_sign_setup_ncbicxx_2_28_8
#define psa_mac_update \
- psa_mac_update_ncbicxx_2_28_3
+ psa_mac_update_ncbicxx_2_28_8
#define psa_mac_verify \
- psa_mac_verify_ncbicxx_2_28_3
+ psa_mac_verify_ncbicxx_2_28_8
#define psa_mac_verify_finish \
- psa_mac_verify_finish_ncbicxx_2_28_3
+ psa_mac_verify_finish_ncbicxx_2_28_8
#define psa_mac_verify_setup \
- psa_mac_verify_setup_ncbicxx_2_28_3
+ psa_mac_verify_setup_ncbicxx_2_28_8
#define psa_raw_key_agreement \
- psa_raw_key_agreement_ncbicxx_2_28_3
+ psa_raw_key_agreement_ncbicxx_2_28_8
#define psa_remove_key_data_from_memory \
- psa_remove_key_data_from_memory_ncbicxx_2_28_3
+ psa_remove_key_data_from_memory_ncbicxx_2_28_8
#define psa_sign_hash \
- psa_sign_hash_ncbicxx_2_28_3
+ psa_sign_hash_ncbicxx_2_28_8
#define psa_sign_hash_builtin \
- psa_sign_hash_builtin_ncbicxx_2_28_3
+ psa_sign_hash_builtin_ncbicxx_2_28_8
#define psa_sign_message \
- psa_sign_message_ncbicxx_2_28_3
+ psa_sign_message_ncbicxx_2_28_8
#define psa_sign_message_builtin \
- psa_sign_message_builtin_ncbicxx_2_28_3
+ psa_sign_message_builtin_ncbicxx_2_28_8
#define psa_verify_hash \
- psa_verify_hash_ncbicxx_2_28_3
+ psa_verify_hash_ncbicxx_2_28_8
#define psa_verify_hash_builtin \
- psa_verify_hash_builtin_ncbicxx_2_28_3
+ psa_verify_hash_builtin_ncbicxx_2_28_8
#define psa_verify_message \
- psa_verify_message_ncbicxx_2_28_3
+ psa_verify_message_ncbicxx_2_28_8
#define psa_verify_message_builtin \
- psa_verify_message_builtin_ncbicxx_2_28_3
+ psa_verify_message_builtin_ncbicxx_2_28_8
#define psa_wipe_key_slot \
- psa_wipe_key_slot_ncbicxx_2_28_3
+ psa_wipe_key_slot_ncbicxx_2_28_8
#define mbedtls_psa_aead_decrypt \
- mbedtls_psa_aead_decrypt_ncbicxx_2_28_3
+ mbedtls_psa_aead_decrypt_ncbicxx_2_28_8
#define mbedtls_psa_aead_encrypt \
- mbedtls_psa_aead_encrypt_ncbicxx_2_28_3
+ mbedtls_psa_aead_encrypt_ncbicxx_2_28_8
#define mbedtls_cipher_info_from_psa \
- mbedtls_cipher_info_from_psa_ncbicxx_2_28_3
+ mbedtls_cipher_info_from_psa_ncbicxx_2_28_8
#define mbedtls_psa_cipher_abort \
- mbedtls_psa_cipher_abort_ncbicxx_2_28_3
+ mbedtls_psa_cipher_abort_ncbicxx_2_28_8
#define mbedtls_psa_cipher_decrypt \
- mbedtls_psa_cipher_decrypt_ncbicxx_2_28_3
+ mbedtls_psa_cipher_decrypt_ncbicxx_2_28_8
#define mbedtls_psa_cipher_decrypt_setup \
- mbedtls_psa_cipher_decrypt_setup_ncbicxx_2_28_3
+ mbedtls_psa_cipher_decrypt_setup_ncbicxx_2_28_8
#define mbedtls_psa_cipher_encrypt \
- mbedtls_psa_cipher_encrypt_ncbicxx_2_28_3
+ mbedtls_psa_cipher_encrypt_ncbicxx_2_28_8
#define mbedtls_psa_cipher_encrypt_setup \
- mbedtls_psa_cipher_encrypt_setup_ncbicxx_2_28_3
+ mbedtls_psa_cipher_encrypt_setup_ncbicxx_2_28_8
#define mbedtls_psa_cipher_finish \
- mbedtls_psa_cipher_finish_ncbicxx_2_28_3
+ mbedtls_psa_cipher_finish_ncbicxx_2_28_8
#define mbedtls_psa_cipher_set_iv \
- mbedtls_psa_cipher_set_iv_ncbicxx_2_28_3
+ mbedtls_psa_cipher_set_iv_ncbicxx_2_28_8
#define mbedtls_psa_cipher_update \
- mbedtls_psa_cipher_update_ncbicxx_2_28_3
+ mbedtls_psa_cipher_update_ncbicxx_2_28_8
#define psa_get_key_domain_parameters \
- psa_get_key_domain_parameters_ncbicxx_2_28_3
+ psa_get_key_domain_parameters_ncbicxx_2_28_8
#define psa_reset_key_attributes \
- psa_reset_key_attributes_ncbicxx_2_28_3
+ psa_reset_key_attributes_ncbicxx_2_28_8
#define psa_set_key_domain_parameters \
- psa_set_key_domain_parameters_ncbicxx_2_28_3
+ psa_set_key_domain_parameters_ncbicxx_2_28_8
#define psa_driver_wrapper_aead_decrypt \
- psa_driver_wrapper_aead_decrypt_ncbicxx_2_28_3
+ psa_driver_wrapper_aead_decrypt_ncbicxx_2_28_8
#define psa_driver_wrapper_aead_encrypt \
- psa_driver_wrapper_aead_encrypt_ncbicxx_2_28_3
+ psa_driver_wrapper_aead_encrypt_ncbicxx_2_28_8
#define psa_driver_wrapper_cipher_abort \
- psa_driver_wrapper_cipher_abort_ncbicxx_2_28_3
+ psa_driver_wrapper_cipher_abort_ncbicxx_2_28_8
#define psa_driver_wrapper_cipher_decrypt \
- psa_driver_wrapper_cipher_decrypt_ncbicxx_2_28_3
+ psa_driver_wrapper_cipher_decrypt_ncbicxx_2_28_8
#define psa_driver_wrapper_cipher_decrypt_setup \
- psa_driver_wrapper_cipher_decrypt_setup_ncbicxx_2_28_3
+ psa_driver_wrapper_cipher_decrypt_setup_ncbicxx_2_28_8
#define psa_driver_wrapper_cipher_encrypt \
- psa_driver_wrapper_cipher_encrypt_ncbicxx_2_28_3
+ psa_driver_wrapper_cipher_encrypt_ncbicxx_2_28_8
#define psa_driver_wrapper_cipher_encrypt_setup \
- psa_driver_wrapper_cipher_encrypt_setup_ncbicxx_2_28_3
+ psa_driver_wrapper_cipher_encrypt_setup_ncbicxx_2_28_8
#define psa_driver_wrapper_cipher_finish \
- psa_driver_wrapper_cipher_finish_ncbicxx_2_28_3
+ psa_driver_wrapper_cipher_finish_ncbicxx_2_28_8
#define psa_driver_wrapper_cipher_set_iv \
- psa_driver_wrapper_cipher_set_iv_ncbicxx_2_28_3
+ psa_driver_wrapper_cipher_set_iv_ncbicxx_2_28_8
#define psa_driver_wrapper_cipher_update \
- psa_driver_wrapper_cipher_update_ncbicxx_2_28_3
+ psa_driver_wrapper_cipher_update_ncbicxx_2_28_8
#define psa_driver_wrapper_export_key \
- psa_driver_wrapper_export_key_ncbicxx_2_28_3
+ psa_driver_wrapper_export_key_ncbicxx_2_28_8
#define psa_driver_wrapper_export_public_key \
- psa_driver_wrapper_export_public_key_ncbicxx_2_28_3
+ psa_driver_wrapper_export_public_key_ncbicxx_2_28_8
#define psa_driver_wrapper_free \
- psa_driver_wrapper_free_ncbicxx_2_28_3
+ psa_driver_wrapper_free_ncbicxx_2_28_8
#define psa_driver_wrapper_generate_key \
- psa_driver_wrapper_generate_key_ncbicxx_2_28_3
+ psa_driver_wrapper_generate_key_ncbicxx_2_28_8
#define psa_driver_wrapper_get_builtin_key \
- psa_driver_wrapper_get_builtin_key_ncbicxx_2_28_3
+ psa_driver_wrapper_get_builtin_key_ncbicxx_2_28_8
#define psa_driver_wrapper_get_key_buffer_size \
- psa_driver_wrapper_get_key_buffer_size_ncbicxx_2_28_3
+ psa_driver_wrapper_get_key_buffer_size_ncbicxx_2_28_8
#define psa_driver_wrapper_hash_abort \
- psa_driver_wrapper_hash_abort_ncbicxx_2_28_3
+ psa_driver_wrapper_hash_abort_ncbicxx_2_28_8
#define psa_driver_wrapper_hash_clone \
- psa_driver_wrapper_hash_clone_ncbicxx_2_28_3
+ psa_driver_wrapper_hash_clone_ncbicxx_2_28_8
#define psa_driver_wrapper_hash_compute \
- psa_driver_wrapper_hash_compute_ncbicxx_2_28_3
+ psa_driver_wrapper_hash_compute_ncbicxx_2_28_8
#define psa_driver_wrapper_hash_finish \
- psa_driver_wrapper_hash_finish_ncbicxx_2_28_3
+ psa_driver_wrapper_hash_finish_ncbicxx_2_28_8
#define psa_driver_wrapper_hash_setup \
- psa_driver_wrapper_hash_setup_ncbicxx_2_28_3
+ psa_driver_wrapper_hash_setup_ncbicxx_2_28_8
#define psa_driver_wrapper_hash_update \
- psa_driver_wrapper_hash_update_ncbicxx_2_28_3
+ psa_driver_wrapper_hash_update_ncbicxx_2_28_8
#define psa_driver_wrapper_import_key \
- psa_driver_wrapper_import_key_ncbicxx_2_28_3
+ psa_driver_wrapper_import_key_ncbicxx_2_28_8
#define psa_driver_wrapper_init \
- psa_driver_wrapper_init_ncbicxx_2_28_3
+ psa_driver_wrapper_init_ncbicxx_2_28_8
#define psa_driver_wrapper_mac_abort \
- psa_driver_wrapper_mac_abort_ncbicxx_2_28_3
+ psa_driver_wrapper_mac_abort_ncbicxx_2_28_8
#define psa_driver_wrapper_mac_compute \
- psa_driver_wrapper_mac_compute_ncbicxx_2_28_3
+ psa_driver_wrapper_mac_compute_ncbicxx_2_28_8
#define psa_driver_wrapper_mac_sign_finish \
- psa_driver_wrapper_mac_sign_finish_ncbicxx_2_28_3
+ psa_driver_wrapper_mac_sign_finish_ncbicxx_2_28_8
#define psa_driver_wrapper_mac_sign_setup \
- psa_driver_wrapper_mac_sign_setup_ncbicxx_2_28_3
+ psa_driver_wrapper_mac_sign_setup_ncbicxx_2_28_8
#define psa_driver_wrapper_mac_update \
- psa_driver_wrapper_mac_update_ncbicxx_2_28_3
+ psa_driver_wrapper_mac_update_ncbicxx_2_28_8
#define psa_driver_wrapper_mac_verify_finish \
- psa_driver_wrapper_mac_verify_finish_ncbicxx_2_28_3
+ psa_driver_wrapper_mac_verify_finish_ncbicxx_2_28_8
#define psa_driver_wrapper_mac_verify_setup \
- psa_driver_wrapper_mac_verify_setup_ncbicxx_2_28_3
+ psa_driver_wrapper_mac_verify_setup_ncbicxx_2_28_8
#define psa_driver_wrapper_sign_hash \
- psa_driver_wrapper_sign_hash_ncbicxx_2_28_3
+ psa_driver_wrapper_sign_hash_ncbicxx_2_28_8
#define psa_driver_wrapper_sign_message \
- psa_driver_wrapper_sign_message_ncbicxx_2_28_3
+ psa_driver_wrapper_sign_message_ncbicxx_2_28_8
#define psa_driver_wrapper_verify_hash \
- psa_driver_wrapper_verify_hash_ncbicxx_2_28_3
+ psa_driver_wrapper_verify_hash_ncbicxx_2_28_8
#define psa_driver_wrapper_verify_message \
- psa_driver_wrapper_verify_message_ncbicxx_2_28_3
+ psa_driver_wrapper_verify_message_ncbicxx_2_28_8
#define mbedtls_psa_ecdsa_sign_hash \
- mbedtls_psa_ecdsa_sign_hash_ncbicxx_2_28_3
+ mbedtls_psa_ecdsa_sign_hash_ncbicxx_2_28_8
#define mbedtls_psa_ecdsa_verify_hash \
- mbedtls_psa_ecdsa_verify_hash_ncbicxx_2_28_3
+ mbedtls_psa_ecdsa_verify_hash_ncbicxx_2_28_8
#define mbedtls_psa_ecp_export_key \
- mbedtls_psa_ecp_export_key_ncbicxx_2_28_3
+ mbedtls_psa_ecp_export_key_ncbicxx_2_28_8
#define mbedtls_psa_ecp_export_public_key \
- mbedtls_psa_ecp_export_public_key_ncbicxx_2_28_3
+ mbedtls_psa_ecp_export_public_key_ncbicxx_2_28_8
#define mbedtls_psa_ecp_generate_key \
- mbedtls_psa_ecp_generate_key_ncbicxx_2_28_3
+ mbedtls_psa_ecp_generate_key_ncbicxx_2_28_8
#define mbedtls_psa_ecp_import_key \
- mbedtls_psa_ecp_import_key_ncbicxx_2_28_3
+ mbedtls_psa_ecp_import_key_ncbicxx_2_28_8
#define mbedtls_psa_ecp_load_representation \
- mbedtls_psa_ecp_load_representation_ncbicxx_2_28_3
+ mbedtls_psa_ecp_load_representation_ncbicxx_2_28_8
#define mbedtls_md_info_from_psa \
- mbedtls_md_info_from_psa_ncbicxx_2_28_3
+ mbedtls_md_info_from_psa_ncbicxx_2_28_8
#define mbedtls_psa_hash_abort \
- mbedtls_psa_hash_abort_ncbicxx_2_28_3
+ mbedtls_psa_hash_abort_ncbicxx_2_28_8
#define mbedtls_psa_hash_clone \
- mbedtls_psa_hash_clone_ncbicxx_2_28_3
+ mbedtls_psa_hash_clone_ncbicxx_2_28_8
#define mbedtls_psa_hash_compute \
- mbedtls_psa_hash_compute_ncbicxx_2_28_3
+ mbedtls_psa_hash_compute_ncbicxx_2_28_8
#define mbedtls_psa_hash_finish \
- mbedtls_psa_hash_finish_ncbicxx_2_28_3
+ mbedtls_psa_hash_finish_ncbicxx_2_28_8
#define mbedtls_psa_hash_setup \
- mbedtls_psa_hash_setup_ncbicxx_2_28_3
+ mbedtls_psa_hash_setup_ncbicxx_2_28_8
#define mbedtls_psa_hash_update \
- mbedtls_psa_hash_update_ncbicxx_2_28_3
+ mbedtls_psa_hash_update_ncbicxx_2_28_8
#define mbedtls_psa_mac_abort \
- mbedtls_psa_mac_abort_ncbicxx_2_28_3
+ mbedtls_psa_mac_abort_ncbicxx_2_28_8
#define mbedtls_psa_mac_compute \
- mbedtls_psa_mac_compute_ncbicxx_2_28_3
+ mbedtls_psa_mac_compute_ncbicxx_2_28_8
#define mbedtls_psa_mac_sign_finish \
- mbedtls_psa_mac_sign_finish_ncbicxx_2_28_3
+ mbedtls_psa_mac_sign_finish_ncbicxx_2_28_8
#define mbedtls_psa_mac_sign_setup \
- mbedtls_psa_mac_sign_setup_ncbicxx_2_28_3
+ mbedtls_psa_mac_sign_setup_ncbicxx_2_28_8
#define mbedtls_psa_mac_update \
- mbedtls_psa_mac_update_ncbicxx_2_28_3
+ mbedtls_psa_mac_update_ncbicxx_2_28_8
#define mbedtls_psa_mac_verify_finish \
- mbedtls_psa_mac_verify_finish_ncbicxx_2_28_3
+ mbedtls_psa_mac_verify_finish_ncbicxx_2_28_8
#define mbedtls_psa_mac_verify_setup \
- mbedtls_psa_mac_verify_setup_ncbicxx_2_28_3
+ mbedtls_psa_mac_verify_setup_ncbicxx_2_28_8
#define mbedtls_psa_rsa_export_key \
- mbedtls_psa_rsa_export_key_ncbicxx_2_28_3
+ mbedtls_psa_rsa_export_key_ncbicxx_2_28_8
#define mbedtls_psa_rsa_export_public_key \
- mbedtls_psa_rsa_export_public_key_ncbicxx_2_28_3
+ mbedtls_psa_rsa_export_public_key_ncbicxx_2_28_8
#define mbedtls_psa_rsa_generate_key \
- mbedtls_psa_rsa_generate_key_ncbicxx_2_28_3
+ mbedtls_psa_rsa_generate_key_ncbicxx_2_28_8
#define mbedtls_psa_rsa_import_key \
- mbedtls_psa_rsa_import_key_ncbicxx_2_28_3
+ mbedtls_psa_rsa_import_key_ncbicxx_2_28_8
#define mbedtls_psa_rsa_load_representation \
- mbedtls_psa_rsa_load_representation_ncbicxx_2_28_3
+ mbedtls_psa_rsa_load_representation_ncbicxx_2_28_8
#define mbedtls_psa_rsa_sign_hash \
- mbedtls_psa_rsa_sign_hash_ncbicxx_2_28_3
+ mbedtls_psa_rsa_sign_hash_ncbicxx_2_28_8
#define mbedtls_psa_rsa_verify_hash \
- mbedtls_psa_rsa_verify_hash_ncbicxx_2_28_3
+ mbedtls_psa_rsa_verify_hash_ncbicxx_2_28_8
#define mbedtls_psa_get_stats \
- mbedtls_psa_get_stats_ncbicxx_2_28_3
+ mbedtls_psa_get_stats_ncbicxx_2_28_8
#define psa_close_key \
- psa_close_key_ncbicxx_2_28_3
+ psa_close_key_ncbicxx_2_28_8
#define psa_get_and_lock_key_slot \
- psa_get_and_lock_key_slot_ncbicxx_2_28_3
+ psa_get_and_lock_key_slot_ncbicxx_2_28_8
#define psa_get_empty_key_slot \
- psa_get_empty_key_slot_ncbicxx_2_28_3
+ psa_get_empty_key_slot_ncbicxx_2_28_8
#define psa_initialize_key_slots \
- psa_initialize_key_slots_ncbicxx_2_28_3
+ psa_initialize_key_slots_ncbicxx_2_28_8
#define psa_is_valid_key_id \
- psa_is_valid_key_id_ncbicxx_2_28_3
+ psa_is_valid_key_id_ncbicxx_2_28_8
#define psa_open_key \
- psa_open_key_ncbicxx_2_28_3
+ psa_open_key_ncbicxx_2_28_8
#define psa_purge_key \
- psa_purge_key_ncbicxx_2_28_3
+ psa_purge_key_ncbicxx_2_28_8
#define psa_unlock_key_slot \
- psa_unlock_key_slot_ncbicxx_2_28_3
+ psa_unlock_key_slot_ncbicxx_2_28_8
#define psa_validate_key_location \
- psa_validate_key_location_ncbicxx_2_28_3
+ psa_validate_key_location_ncbicxx_2_28_8
#define psa_validate_key_persistence \
- psa_validate_key_persistence_ncbicxx_2_28_3
+ psa_validate_key_persistence_ncbicxx_2_28_8
#define psa_wipe_all_key_slots \
- psa_wipe_all_key_slots_ncbicxx_2_28_3
+ psa_wipe_all_key_slots_ncbicxx_2_28_8
#define psa_destroy_persistent_key \
- psa_destroy_persistent_key_ncbicxx_2_28_3
+ psa_destroy_persistent_key_ncbicxx_2_28_8
#define psa_format_key_data_for_storage \
- psa_format_key_data_for_storage_ncbicxx_2_28_3
+ psa_format_key_data_for_storage_ncbicxx_2_28_8
#define psa_free_persistent_key_data \
- psa_free_persistent_key_data_ncbicxx_2_28_3
+ psa_free_persistent_key_data_ncbicxx_2_28_8
#define psa_is_key_present_in_storage \
- psa_is_key_present_in_storage_ncbicxx_2_28_3
+ psa_is_key_present_in_storage_ncbicxx_2_28_8
#define psa_load_persistent_key \
- psa_load_persistent_key_ncbicxx_2_28_3
+ psa_load_persistent_key_ncbicxx_2_28_8
#define psa_parse_key_data_from_storage \
- psa_parse_key_data_from_storage_ncbicxx_2_28_3
+ psa_parse_key_data_from_storage_ncbicxx_2_28_8
#define psa_save_persistent_key \
- psa_save_persistent_key_ncbicxx_2_28_3
+ psa_save_persistent_key_ncbicxx_2_28_8
#define psa_its_get \
- psa_its_get_ncbicxx_2_28_3
+ psa_its_get_ncbicxx_2_28_8
#define psa_its_get_info \
- psa_its_get_info_ncbicxx_2_28_3
+ psa_its_get_info_ncbicxx_2_28_8
#define psa_its_remove \
- psa_its_remove_ncbicxx_2_28_3
+ psa_its_remove_ncbicxx_2_28_8
#define psa_its_set \
- psa_its_set_ncbicxx_2_28_3
+ psa_its_set_ncbicxx_2_28_8
#define mbedtls_internal_ripemd160_process \
- mbedtls_internal_ripemd160_process_ncbicxx_2_28_3
+ mbedtls_internal_ripemd160_process_ncbicxx_2_28_8
#define mbedtls_ripemd160 \
- mbedtls_ripemd160_ncbicxx_2_28_3
+ mbedtls_ripemd160_ncbicxx_2_28_8
#define mbedtls_ripemd160_clone \
- mbedtls_ripemd160_clone_ncbicxx_2_28_3
+ mbedtls_ripemd160_clone_ncbicxx_2_28_8
#define mbedtls_ripemd160_finish \
- mbedtls_ripemd160_finish_ncbicxx_2_28_3
+ mbedtls_ripemd160_finish_ncbicxx_2_28_8
#define mbedtls_ripemd160_finish_ret \
- mbedtls_ripemd160_finish_ret_ncbicxx_2_28_3
+ mbedtls_ripemd160_finish_ret_ncbicxx_2_28_8
#define mbedtls_ripemd160_free \
- mbedtls_ripemd160_free_ncbicxx_2_28_3
+ mbedtls_ripemd160_free_ncbicxx_2_28_8
#define mbedtls_ripemd160_init \
- mbedtls_ripemd160_init_ncbicxx_2_28_3
+ mbedtls_ripemd160_init_ncbicxx_2_28_8
#define mbedtls_ripemd160_process \
- mbedtls_ripemd160_process_ncbicxx_2_28_3
+ mbedtls_ripemd160_process_ncbicxx_2_28_8
#define mbedtls_ripemd160_ret \
- mbedtls_ripemd160_ret_ncbicxx_2_28_3
+ mbedtls_ripemd160_ret_ncbicxx_2_28_8
#define mbedtls_ripemd160_starts \
- mbedtls_ripemd160_starts_ncbicxx_2_28_3
+ mbedtls_ripemd160_starts_ncbicxx_2_28_8
#define mbedtls_ripemd160_starts_ret \
- mbedtls_ripemd160_starts_ret_ncbicxx_2_28_3
+ mbedtls_ripemd160_starts_ret_ncbicxx_2_28_8
#define mbedtls_ripemd160_update \
- mbedtls_ripemd160_update_ncbicxx_2_28_3
+ mbedtls_ripemd160_update_ncbicxx_2_28_8
#define mbedtls_ripemd160_update_ret \
- mbedtls_ripemd160_update_ret_ncbicxx_2_28_3
+ mbedtls_ripemd160_update_ret_ncbicxx_2_28_8
#define mbedtls_rsa_check_privkey \
- mbedtls_rsa_check_privkey_ncbicxx_2_28_3
+ mbedtls_rsa_check_privkey_ncbicxx_2_28_8
#define mbedtls_rsa_check_pub_priv \
- mbedtls_rsa_check_pub_priv_ncbicxx_2_28_3
+ mbedtls_rsa_check_pub_priv_ncbicxx_2_28_8
#define mbedtls_rsa_check_pubkey \
- mbedtls_rsa_check_pubkey_ncbicxx_2_28_3
+ mbedtls_rsa_check_pubkey_ncbicxx_2_28_8
#define mbedtls_rsa_complete \
- mbedtls_rsa_complete_ncbicxx_2_28_3
+ mbedtls_rsa_complete_ncbicxx_2_28_8
#define mbedtls_rsa_copy \
- mbedtls_rsa_copy_ncbicxx_2_28_3
+ mbedtls_rsa_copy_ncbicxx_2_28_8
#define mbedtls_rsa_export \
- mbedtls_rsa_export_ncbicxx_2_28_3
+ mbedtls_rsa_export_ncbicxx_2_28_8
#define mbedtls_rsa_export_crt \
- mbedtls_rsa_export_crt_ncbicxx_2_28_3
+ mbedtls_rsa_export_crt_ncbicxx_2_28_8
#define mbedtls_rsa_export_raw \
- mbedtls_rsa_export_raw_ncbicxx_2_28_3
+ mbedtls_rsa_export_raw_ncbicxx_2_28_8
#define mbedtls_rsa_free \
- mbedtls_rsa_free_ncbicxx_2_28_3
+ mbedtls_rsa_free_ncbicxx_2_28_8
#define mbedtls_rsa_gen_key \
- mbedtls_rsa_gen_key_ncbicxx_2_28_3
+ mbedtls_rsa_gen_key_ncbicxx_2_28_8
#define mbedtls_rsa_get_len \
- mbedtls_rsa_get_len_ncbicxx_2_28_3
+ mbedtls_rsa_get_len_ncbicxx_2_28_8
#define mbedtls_rsa_import \
- mbedtls_rsa_import_ncbicxx_2_28_3
+ mbedtls_rsa_import_ncbicxx_2_28_8
#define mbedtls_rsa_import_raw \
- mbedtls_rsa_import_raw_ncbicxx_2_28_3
+ mbedtls_rsa_import_raw_ncbicxx_2_28_8
#define mbedtls_rsa_init \
- mbedtls_rsa_init_ncbicxx_2_28_3
+ mbedtls_rsa_init_ncbicxx_2_28_8
#define mbedtls_rsa_pkcs1_decrypt \
- mbedtls_rsa_pkcs1_decrypt_ncbicxx_2_28_3
+ mbedtls_rsa_pkcs1_decrypt_ncbicxx_2_28_8
#define mbedtls_rsa_pkcs1_encrypt \
- mbedtls_rsa_pkcs1_encrypt_ncbicxx_2_28_3
+ mbedtls_rsa_pkcs1_encrypt_ncbicxx_2_28_8
#define mbedtls_rsa_pkcs1_sign \
- mbedtls_rsa_pkcs1_sign_ncbicxx_2_28_3
+ mbedtls_rsa_pkcs1_sign_ncbicxx_2_28_8
#define mbedtls_rsa_pkcs1_verify \
- mbedtls_rsa_pkcs1_verify_ncbicxx_2_28_3
+ mbedtls_rsa_pkcs1_verify_ncbicxx_2_28_8
#define mbedtls_rsa_private \
- mbedtls_rsa_private_ncbicxx_2_28_3
+ mbedtls_rsa_private_ncbicxx_2_28_8
#define mbedtls_rsa_public \
- mbedtls_rsa_public_ncbicxx_2_28_3
+ mbedtls_rsa_public_ncbicxx_2_28_8
#define mbedtls_rsa_rsaes_oaep_decrypt \
- mbedtls_rsa_rsaes_oaep_decrypt_ncbicxx_2_28_3
+ mbedtls_rsa_rsaes_oaep_decrypt_ncbicxx_2_28_8
#define mbedtls_rsa_rsaes_oaep_encrypt \
- mbedtls_rsa_rsaes_oaep_encrypt_ncbicxx_2_28_3
+ mbedtls_rsa_rsaes_oaep_encrypt_ncbicxx_2_28_8
#define mbedtls_rsa_rsaes_pkcs1_v15_decrypt \
- mbedtls_rsa_rsaes_pkcs1_v15_decrypt_ncbicxx_2_28_3
+ mbedtls_rsa_rsaes_pkcs1_v15_decrypt_ncbicxx_2_28_8
#define mbedtls_rsa_rsaes_pkcs1_v15_encrypt \
- mbedtls_rsa_rsaes_pkcs1_v15_encrypt_ncbicxx_2_28_3
+ mbedtls_rsa_rsaes_pkcs1_v15_encrypt_ncbicxx_2_28_8
#define mbedtls_rsa_rsassa_pkcs1_v15_sign \
- mbedtls_rsa_rsassa_pkcs1_v15_sign_ncbicxx_2_28_3
+ mbedtls_rsa_rsassa_pkcs1_v15_sign_ncbicxx_2_28_8
#define mbedtls_rsa_rsassa_pkcs1_v15_verify \
- mbedtls_rsa_rsassa_pkcs1_v15_verify_ncbicxx_2_28_3
+ mbedtls_rsa_rsassa_pkcs1_v15_verify_ncbicxx_2_28_8
#define mbedtls_rsa_rsassa_pss_sign \
- mbedtls_rsa_rsassa_pss_sign_ncbicxx_2_28_3
+ mbedtls_rsa_rsassa_pss_sign_ncbicxx_2_28_8
#define mbedtls_rsa_rsassa_pss_sign_ext \
- mbedtls_rsa_rsassa_pss_sign_ext_ncbicxx_2_28_3
+ mbedtls_rsa_rsassa_pss_sign_ext_ncbicxx_2_28_8
#define mbedtls_rsa_rsassa_pss_verify \
- mbedtls_rsa_rsassa_pss_verify_ncbicxx_2_28_3
+ mbedtls_rsa_rsassa_pss_verify_ncbicxx_2_28_8
#define mbedtls_rsa_rsassa_pss_verify_ext \
- mbedtls_rsa_rsassa_pss_verify_ext_ncbicxx_2_28_3
+ mbedtls_rsa_rsassa_pss_verify_ext_ncbicxx_2_28_8
#define mbedtls_rsa_set_padding \
- mbedtls_rsa_set_padding_ncbicxx_2_28_3
+ mbedtls_rsa_set_padding_ncbicxx_2_28_8
#define mbedtls_rsa_deduce_crt \
- mbedtls_rsa_deduce_crt_ncbicxx_2_28_3
+ mbedtls_rsa_deduce_crt_ncbicxx_2_28_8
#define mbedtls_rsa_deduce_primes \
- mbedtls_rsa_deduce_primes_ncbicxx_2_28_3
+ mbedtls_rsa_deduce_primes_ncbicxx_2_28_8
#define mbedtls_rsa_deduce_private_exponent \
- mbedtls_rsa_deduce_private_exponent_ncbicxx_2_28_3
+ mbedtls_rsa_deduce_private_exponent_ncbicxx_2_28_8
#define mbedtls_rsa_validate_crt \
- mbedtls_rsa_validate_crt_ncbicxx_2_28_3
+ mbedtls_rsa_validate_crt_ncbicxx_2_28_8
#define mbedtls_rsa_validate_params \
- mbedtls_rsa_validate_params_ncbicxx_2_28_3
+ mbedtls_rsa_validate_params_ncbicxx_2_28_8
#define mbedtls_internal_sha1_process \
- mbedtls_internal_sha1_process_ncbicxx_2_28_3
+ mbedtls_internal_sha1_process_ncbicxx_2_28_8
#define mbedtls_sha1 \
- mbedtls_sha1_ncbicxx_2_28_3
+ mbedtls_sha1_ncbicxx_2_28_8
#define mbedtls_sha1_clone \
- mbedtls_sha1_clone_ncbicxx_2_28_3
+ mbedtls_sha1_clone_ncbicxx_2_28_8
#define mbedtls_sha1_finish \
- mbedtls_sha1_finish_ncbicxx_2_28_3
+ mbedtls_sha1_finish_ncbicxx_2_28_8
#define mbedtls_sha1_finish_ret \
- mbedtls_sha1_finish_ret_ncbicxx_2_28_3
+ mbedtls_sha1_finish_ret_ncbicxx_2_28_8
#define mbedtls_sha1_free \
- mbedtls_sha1_free_ncbicxx_2_28_3
+ mbedtls_sha1_free_ncbicxx_2_28_8
#define mbedtls_sha1_init \
- mbedtls_sha1_init_ncbicxx_2_28_3
+ mbedtls_sha1_init_ncbicxx_2_28_8
#define mbedtls_sha1_process \
- mbedtls_sha1_process_ncbicxx_2_28_3
+ mbedtls_sha1_process_ncbicxx_2_28_8
#define mbedtls_sha1_ret \
- mbedtls_sha1_ret_ncbicxx_2_28_3
+ mbedtls_sha1_ret_ncbicxx_2_28_8
#define mbedtls_sha1_starts \
- mbedtls_sha1_starts_ncbicxx_2_28_3
+ mbedtls_sha1_starts_ncbicxx_2_28_8
#define mbedtls_sha1_starts_ret \
- mbedtls_sha1_starts_ret_ncbicxx_2_28_3
+ mbedtls_sha1_starts_ret_ncbicxx_2_28_8
#define mbedtls_sha1_update \
- mbedtls_sha1_update_ncbicxx_2_28_3
+ mbedtls_sha1_update_ncbicxx_2_28_8
#define mbedtls_sha1_update_ret \
- mbedtls_sha1_update_ret_ncbicxx_2_28_3
+ mbedtls_sha1_update_ret_ncbicxx_2_28_8
#define mbedtls_internal_sha256_process \
- mbedtls_internal_sha256_process_ncbicxx_2_28_3
+ mbedtls_internal_sha256_process_ncbicxx_2_28_8
#define mbedtls_sha256 \
- mbedtls_sha256_ncbicxx_2_28_3
+ mbedtls_sha256_ncbicxx_2_28_8
#define mbedtls_sha256_clone \
- mbedtls_sha256_clone_ncbicxx_2_28_3
+ mbedtls_sha256_clone_ncbicxx_2_28_8
#define mbedtls_sha256_finish \
- mbedtls_sha256_finish_ncbicxx_2_28_3
+ mbedtls_sha256_finish_ncbicxx_2_28_8
#define mbedtls_sha256_finish_ret \
- mbedtls_sha256_finish_ret_ncbicxx_2_28_3
+ mbedtls_sha256_finish_ret_ncbicxx_2_28_8
#define mbedtls_sha256_free \
- mbedtls_sha256_free_ncbicxx_2_28_3
+ mbedtls_sha256_free_ncbicxx_2_28_8
#define mbedtls_sha256_init \
- mbedtls_sha256_init_ncbicxx_2_28_3
+ mbedtls_sha256_init_ncbicxx_2_28_8
#define mbedtls_sha256_process \
- mbedtls_sha256_process_ncbicxx_2_28_3
+ mbedtls_sha256_process_ncbicxx_2_28_8
#define mbedtls_sha256_ret \
- mbedtls_sha256_ret_ncbicxx_2_28_3
+ mbedtls_sha256_ret_ncbicxx_2_28_8
#define mbedtls_sha256_starts \
- mbedtls_sha256_starts_ncbicxx_2_28_3
+ mbedtls_sha256_starts_ncbicxx_2_28_8
#define mbedtls_sha256_starts_ret \
- mbedtls_sha256_starts_ret_ncbicxx_2_28_3
+ mbedtls_sha256_starts_ret_ncbicxx_2_28_8
#define mbedtls_sha256_update \
- mbedtls_sha256_update_ncbicxx_2_28_3
+ mbedtls_sha256_update_ncbicxx_2_28_8
#define mbedtls_sha256_update_ret \
- mbedtls_sha256_update_ret_ncbicxx_2_28_3
+ mbedtls_sha256_update_ret_ncbicxx_2_28_8
#define mbedtls_internal_sha512_process \
- mbedtls_internal_sha512_process_ncbicxx_2_28_3
+ mbedtls_internal_sha512_process_ncbicxx_2_28_8
#define mbedtls_sha512 \
- mbedtls_sha512_ncbicxx_2_28_3
+ mbedtls_sha512_ncbicxx_2_28_8
#define mbedtls_sha512_clone \
- mbedtls_sha512_clone_ncbicxx_2_28_3
+ mbedtls_sha512_clone_ncbicxx_2_28_8
#define mbedtls_sha512_finish \
- mbedtls_sha512_finish_ncbicxx_2_28_3
+ mbedtls_sha512_finish_ncbicxx_2_28_8
#define mbedtls_sha512_finish_ret \
- mbedtls_sha512_finish_ret_ncbicxx_2_28_3
+ mbedtls_sha512_finish_ret_ncbicxx_2_28_8
#define mbedtls_sha512_free \
- mbedtls_sha512_free_ncbicxx_2_28_3
+ mbedtls_sha512_free_ncbicxx_2_28_8
#define mbedtls_sha512_init \
- mbedtls_sha512_init_ncbicxx_2_28_3
+ mbedtls_sha512_init_ncbicxx_2_28_8
#define mbedtls_sha512_process \
- mbedtls_sha512_process_ncbicxx_2_28_3
+ mbedtls_sha512_process_ncbicxx_2_28_8
#define mbedtls_sha512_ret \
- mbedtls_sha512_ret_ncbicxx_2_28_3
+ mbedtls_sha512_ret_ncbicxx_2_28_8
#define mbedtls_sha512_starts \
- mbedtls_sha512_starts_ncbicxx_2_28_3
+ mbedtls_sha512_starts_ncbicxx_2_28_8
#define mbedtls_sha512_starts_ret \
- mbedtls_sha512_starts_ret_ncbicxx_2_28_3
+ mbedtls_sha512_starts_ret_ncbicxx_2_28_8
#define mbedtls_sha512_update \
- mbedtls_sha512_update_ncbicxx_2_28_3
+ mbedtls_sha512_update_ncbicxx_2_28_8
#define mbedtls_sha512_update_ret \
- mbedtls_sha512_update_ret_ncbicxx_2_28_3
+ mbedtls_sha512_update_ret_ncbicxx_2_28_8
#define mbedtls_ssl_cache_free \
- mbedtls_ssl_cache_free_ncbicxx_2_28_3
+ mbedtls_ssl_cache_free_ncbicxx_2_28_8
#define mbedtls_ssl_cache_get \
- mbedtls_ssl_cache_get_ncbicxx_2_28_3
+ mbedtls_ssl_cache_get_ncbicxx_2_28_8
#define mbedtls_ssl_cache_init \
- mbedtls_ssl_cache_init_ncbicxx_2_28_3
+ mbedtls_ssl_cache_init_ncbicxx_2_28_8
#define mbedtls_ssl_cache_set \
- mbedtls_ssl_cache_set_ncbicxx_2_28_3
+ mbedtls_ssl_cache_set_ncbicxx_2_28_8
#define mbedtls_ssl_cache_set_max_entries \
- mbedtls_ssl_cache_set_max_entries_ncbicxx_2_28_3
+ mbedtls_ssl_cache_set_max_entries_ncbicxx_2_28_8
#define mbedtls_ssl_cache_set_timeout \
- mbedtls_ssl_cache_set_timeout_ncbicxx_2_28_3
+ mbedtls_ssl_cache_set_timeout_ncbicxx_2_28_8
#define mbedtls_ssl_ciphersuite_from_id \
- mbedtls_ssl_ciphersuite_from_id_ncbicxx_2_28_3
+ mbedtls_ssl_ciphersuite_from_id_ncbicxx_2_28_8
#define mbedtls_ssl_ciphersuite_from_string \
- mbedtls_ssl_ciphersuite_from_string_ncbicxx_2_28_3
+ mbedtls_ssl_ciphersuite_from_string_ncbicxx_2_28_8
#define mbedtls_ssl_ciphersuite_uses_ec \
- mbedtls_ssl_ciphersuite_uses_ec_ncbicxx_2_28_3
+ mbedtls_ssl_ciphersuite_uses_ec_ncbicxx_2_28_8
#define mbedtls_ssl_ciphersuite_uses_psk \
- mbedtls_ssl_ciphersuite_uses_psk_ncbicxx_2_28_3
+ mbedtls_ssl_ciphersuite_uses_psk_ncbicxx_2_28_8
#define mbedtls_ssl_get_ciphersuite_id \
- mbedtls_ssl_get_ciphersuite_id_ncbicxx_2_28_3
+ mbedtls_ssl_get_ciphersuite_id_ncbicxx_2_28_8
#define mbedtls_ssl_get_ciphersuite_name \
- mbedtls_ssl_get_ciphersuite_name_ncbicxx_2_28_3
+ mbedtls_ssl_get_ciphersuite_name_ncbicxx_2_28_8
#define mbedtls_ssl_get_ciphersuite_sig_alg \
- mbedtls_ssl_get_ciphersuite_sig_alg_ncbicxx_2_28_3
+ mbedtls_ssl_get_ciphersuite_sig_alg_ncbicxx_2_28_8
#define mbedtls_ssl_get_ciphersuite_sig_pk_alg \
- mbedtls_ssl_get_ciphersuite_sig_pk_alg_ncbicxx_2_28_3
+ mbedtls_ssl_get_ciphersuite_sig_pk_alg_ncbicxx_2_28_8
#define mbedtls_ssl_list_ciphersuites \
- mbedtls_ssl_list_ciphersuites_ncbicxx_2_28_3
+ mbedtls_ssl_list_ciphersuites_ncbicxx_2_28_8
#define mbedtls_ssl_handshake_client_step \
- mbedtls_ssl_handshake_client_step_ncbicxx_2_28_3
+ mbedtls_ssl_handshake_client_step_ncbicxx_2_28_8
#define mbedtls_ssl_cookie_check \
- mbedtls_ssl_cookie_check_ncbicxx_2_28_3
+ mbedtls_ssl_cookie_check_ncbicxx_2_28_8
#define mbedtls_ssl_cookie_free \
- mbedtls_ssl_cookie_free_ncbicxx_2_28_3
+ mbedtls_ssl_cookie_free_ncbicxx_2_28_8
#define mbedtls_ssl_cookie_init \
- mbedtls_ssl_cookie_init_ncbicxx_2_28_3
+ mbedtls_ssl_cookie_init_ncbicxx_2_28_8
#define mbedtls_ssl_cookie_set_timeout \
- mbedtls_ssl_cookie_set_timeout_ncbicxx_2_28_3
+ mbedtls_ssl_cookie_set_timeout_ncbicxx_2_28_8
#define mbedtls_ssl_cookie_setup \
- mbedtls_ssl_cookie_setup_ncbicxx_2_28_3
+ mbedtls_ssl_cookie_setup_ncbicxx_2_28_8
#define mbedtls_ssl_cookie_write \
- mbedtls_ssl_cookie_write_ncbicxx_2_28_3
+ mbedtls_ssl_cookie_write_ncbicxx_2_28_8
#define mbedtls_ssl_buffering_free \
- mbedtls_ssl_buffering_free_ncbicxx_2_28_3
+ mbedtls_ssl_buffering_free_ncbicxx_2_28_8
#define mbedtls_ssl_check_pending \
- mbedtls_ssl_check_pending_ncbicxx_2_28_3
+ mbedtls_ssl_check_pending_ncbicxx_2_28_8
#define mbedtls_ssl_check_record \
- mbedtls_ssl_check_record_ncbicxx_2_28_3
+ mbedtls_ssl_check_record_ncbicxx_2_28_8
#define mbedtls_ssl_check_timer \
- mbedtls_ssl_check_timer_ncbicxx_2_28_3
+ mbedtls_ssl_check_timer_ncbicxx_2_28_8
#define mbedtls_ssl_close_notify \
- mbedtls_ssl_close_notify_ncbicxx_2_28_3
+ mbedtls_ssl_close_notify_ncbicxx_2_28_8
#define mbedtls_ssl_decrypt_buf \
- mbedtls_ssl_decrypt_buf_ncbicxx_2_28_3
+ mbedtls_ssl_decrypt_buf_ncbicxx_2_28_8
#define mbedtls_ssl_dtls_replay_check \
- mbedtls_ssl_dtls_replay_check_ncbicxx_2_28_3
+ mbedtls_ssl_dtls_replay_check_ncbicxx_2_28_8
#define mbedtls_ssl_dtls_replay_reset \
- mbedtls_ssl_dtls_replay_reset_ncbicxx_2_28_3
+ mbedtls_ssl_dtls_replay_reset_ncbicxx_2_28_8
#define mbedtls_ssl_dtls_replay_update \
- mbedtls_ssl_dtls_replay_update_ncbicxx_2_28_3
+ mbedtls_ssl_dtls_replay_update_ncbicxx_2_28_8
#define mbedtls_ssl_encrypt_buf \
- mbedtls_ssl_encrypt_buf_ncbicxx_2_28_3
+ mbedtls_ssl_encrypt_buf_ncbicxx_2_28_8
#define mbedtls_ssl_fetch_input \
- mbedtls_ssl_fetch_input_ncbicxx_2_28_3
+ mbedtls_ssl_fetch_input_ncbicxx_2_28_8
#define mbedtls_ssl_flight_free \
- mbedtls_ssl_flight_free_ncbicxx_2_28_3
+ mbedtls_ssl_flight_free_ncbicxx_2_28_8
#define mbedtls_ssl_flight_transmit \
- mbedtls_ssl_flight_transmit_ncbicxx_2_28_3
+ mbedtls_ssl_flight_transmit_ncbicxx_2_28_8
#define mbedtls_ssl_flush_output \
- mbedtls_ssl_flush_output_ncbicxx_2_28_3
+ mbedtls_ssl_flush_output_ncbicxx_2_28_8
#define mbedtls_ssl_get_bytes_avail \
- mbedtls_ssl_get_bytes_avail_ncbicxx_2_28_3
+ mbedtls_ssl_get_bytes_avail_ncbicxx_2_28_8
#define mbedtls_ssl_get_record_expansion \
- mbedtls_ssl_get_record_expansion_ncbicxx_2_28_3
+ mbedtls_ssl_get_record_expansion_ncbicxx_2_28_8
#define mbedtls_ssl_handle_message_type \
- mbedtls_ssl_handle_message_type_ncbicxx_2_28_3
+ mbedtls_ssl_handle_message_type_ncbicxx_2_28_8
#define mbedtls_ssl_parse_change_cipher_spec \
- mbedtls_ssl_parse_change_cipher_spec_ncbicxx_2_28_3
+ mbedtls_ssl_parse_change_cipher_spec_ncbicxx_2_28_8
#define mbedtls_ssl_prepare_handshake_record \
- mbedtls_ssl_prepare_handshake_record_ncbicxx_2_28_3
+ mbedtls_ssl_prepare_handshake_record_ncbicxx_2_28_8
#define mbedtls_ssl_read \
- mbedtls_ssl_read_ncbicxx_2_28_3
+ mbedtls_ssl_read_ncbicxx_2_28_8
#define mbedtls_ssl_read_record \
- mbedtls_ssl_read_record_ncbicxx_2_28_3
+ mbedtls_ssl_read_record_ncbicxx_2_28_8
#define mbedtls_ssl_read_version \
- mbedtls_ssl_read_version_ncbicxx_2_28_3
+ mbedtls_ssl_read_version_ncbicxx_2_28_8
#define mbedtls_ssl_recv_flight_completed \
- mbedtls_ssl_recv_flight_completed_ncbicxx_2_28_3
+ mbedtls_ssl_recv_flight_completed_ncbicxx_2_28_8
#define mbedtls_ssl_resend \
- mbedtls_ssl_resend_ncbicxx_2_28_3
+ mbedtls_ssl_resend_ncbicxx_2_28_8
#define mbedtls_ssl_reset_in_out_pointers \
- mbedtls_ssl_reset_in_out_pointers_ncbicxx_2_28_3
+ mbedtls_ssl_reset_in_out_pointers_ncbicxx_2_28_8
#define mbedtls_ssl_send_alert_message \
- mbedtls_ssl_send_alert_message_ncbicxx_2_28_3
+ mbedtls_ssl_send_alert_message_ncbicxx_2_28_8
#define mbedtls_ssl_send_fatal_handshake_failure \
- mbedtls_ssl_send_fatal_handshake_failure_ncbicxx_2_28_3
+ mbedtls_ssl_send_fatal_handshake_failure_ncbicxx_2_28_8
#define mbedtls_ssl_send_flight_completed \
- mbedtls_ssl_send_flight_completed_ncbicxx_2_28_3
+ mbedtls_ssl_send_flight_completed_ncbicxx_2_28_8
#define mbedtls_ssl_set_timer \
- mbedtls_ssl_set_timer_ncbicxx_2_28_3
+ mbedtls_ssl_set_timer_ncbicxx_2_28_8
#define mbedtls_ssl_transform_free \
- mbedtls_ssl_transform_free_ncbicxx_2_28_3
+ mbedtls_ssl_transform_free_ncbicxx_2_28_8
#define mbedtls_ssl_update_handshake_status \
- mbedtls_ssl_update_handshake_status_ncbicxx_2_28_3
+ mbedtls_ssl_update_handshake_status_ncbicxx_2_28_8
#define mbedtls_ssl_update_in_pointers \
- mbedtls_ssl_update_in_pointers_ncbicxx_2_28_3
+ mbedtls_ssl_update_in_pointers_ncbicxx_2_28_8
#define mbedtls_ssl_update_out_pointers \
- mbedtls_ssl_update_out_pointers_ncbicxx_2_28_3
+ mbedtls_ssl_update_out_pointers_ncbicxx_2_28_8
#define mbedtls_ssl_write \
- mbedtls_ssl_write_ncbicxx_2_28_3
+ mbedtls_ssl_write_ncbicxx_2_28_8
#define mbedtls_ssl_write_change_cipher_spec \
- mbedtls_ssl_write_change_cipher_spec_ncbicxx_2_28_3
+ mbedtls_ssl_write_change_cipher_spec_ncbicxx_2_28_8
#define mbedtls_ssl_write_handshake_msg \
- mbedtls_ssl_write_handshake_msg_ncbicxx_2_28_3
+ mbedtls_ssl_write_handshake_msg_ncbicxx_2_28_8
#define mbedtls_ssl_write_record \
- mbedtls_ssl_write_record_ncbicxx_2_28_3
+ mbedtls_ssl_write_record_ncbicxx_2_28_8
#define mbedtls_ssl_write_version \
- mbedtls_ssl_write_version_ncbicxx_2_28_3
+ mbedtls_ssl_write_version_ncbicxx_2_28_8
#define mbedtls_ssl_conf_dtls_cookies \
- mbedtls_ssl_conf_dtls_cookies_ncbicxx_2_28_3
+ mbedtls_ssl_conf_dtls_cookies_ncbicxx_2_28_8
#define mbedtls_ssl_handshake_server_step \
- mbedtls_ssl_handshake_server_step_ncbicxx_2_28_3
+ mbedtls_ssl_handshake_server_step_ncbicxx_2_28_8
#define mbedtls_ssl_set_client_transport_id \
- mbedtls_ssl_set_client_transport_id_ncbicxx_2_28_3
+ mbedtls_ssl_set_client_transport_id_ncbicxx_2_28_8
#define mbedtls_ssl_ticket_free \
- mbedtls_ssl_ticket_free_ncbicxx_2_28_3
+ mbedtls_ssl_ticket_free_ncbicxx_2_28_8
#define mbedtls_ssl_ticket_init \
- mbedtls_ssl_ticket_init_ncbicxx_2_28_3
+ mbedtls_ssl_ticket_init_ncbicxx_2_28_8
#define mbedtls_ssl_ticket_parse \
- mbedtls_ssl_ticket_parse_ncbicxx_2_28_3
+ mbedtls_ssl_ticket_parse_ncbicxx_2_28_8
#define mbedtls_ssl_ticket_setup \
- mbedtls_ssl_ticket_setup_ncbicxx_2_28_3
+ mbedtls_ssl_ticket_setup_ncbicxx_2_28_8
#define mbedtls_ssl_ticket_write \
- mbedtls_ssl_ticket_write_ncbicxx_2_28_3
+ mbedtls_ssl_ticket_write_ncbicxx_2_28_8
#define mbedtls_ssl_check_cert_usage \
- mbedtls_ssl_check_cert_usage_ncbicxx_2_28_3
+ mbedtls_ssl_check_cert_usage_ncbicxx_2_28_8
#define mbedtls_ssl_check_curve \
- mbedtls_ssl_check_curve_ncbicxx_2_28_3
+ mbedtls_ssl_check_curve_ncbicxx_2_28_8
#define mbedtls_ssl_check_curve_tls_id \
- mbedtls_ssl_check_curve_tls_id_ncbicxx_2_28_3
+ mbedtls_ssl_check_curve_tls_id_ncbicxx_2_28_8
#define mbedtls_ssl_check_sig_hash \
- mbedtls_ssl_check_sig_hash_ncbicxx_2_28_3
+ mbedtls_ssl_check_sig_hash_ncbicxx_2_28_8
#define mbedtls_ssl_conf_alpn_protocols \
- mbedtls_ssl_conf_alpn_protocols_ncbicxx_2_28_3
+ mbedtls_ssl_conf_alpn_protocols_ncbicxx_2_28_8
#define mbedtls_ssl_conf_arc4_support \
- mbedtls_ssl_conf_arc4_support_ncbicxx_2_28_3
+ mbedtls_ssl_conf_arc4_support_ncbicxx_2_28_8
#define mbedtls_ssl_conf_authmode \
- mbedtls_ssl_conf_authmode_ncbicxx_2_28_3
+ mbedtls_ssl_conf_authmode_ncbicxx_2_28_8
#define mbedtls_ssl_conf_ca_chain \
- mbedtls_ssl_conf_ca_chain_ncbicxx_2_28_3
+ mbedtls_ssl_conf_ca_chain_ncbicxx_2_28_8
#define mbedtls_ssl_conf_cert_profile \
- mbedtls_ssl_conf_cert_profile_ncbicxx_2_28_3
+ mbedtls_ssl_conf_cert_profile_ncbicxx_2_28_8
#define mbedtls_ssl_conf_cert_req_ca_list \
- mbedtls_ssl_conf_cert_req_ca_list_ncbicxx_2_28_3
+ mbedtls_ssl_conf_cert_req_ca_list_ncbicxx_2_28_8
#define mbedtls_ssl_conf_ciphersuites \
- mbedtls_ssl_conf_ciphersuites_ncbicxx_2_28_3
+ mbedtls_ssl_conf_ciphersuites_ncbicxx_2_28_8
#define mbedtls_ssl_conf_ciphersuites_for_version \
- mbedtls_ssl_conf_ciphersuites_for_version_ncbicxx_2_28_3
+ mbedtls_ssl_conf_ciphersuites_for_version_ncbicxx_2_28_8
#define mbedtls_ssl_conf_curves \
- mbedtls_ssl_conf_curves_ncbicxx_2_28_3
+ mbedtls_ssl_conf_curves_ncbicxx_2_28_8
#define mbedtls_ssl_conf_dbg \
- mbedtls_ssl_conf_dbg_ncbicxx_2_28_3
+ mbedtls_ssl_conf_dbg_ncbicxx_2_28_8
#define mbedtls_ssl_conf_dh_param \
- mbedtls_ssl_conf_dh_param_ncbicxx_2_28_3
+ mbedtls_ssl_conf_dh_param_ncbicxx_2_28_8
#define mbedtls_ssl_conf_dh_param_bin \
- mbedtls_ssl_conf_dh_param_bin_ncbicxx_2_28_3
+ mbedtls_ssl_conf_dh_param_bin_ncbicxx_2_28_8
#define mbedtls_ssl_conf_dh_param_ctx \
- mbedtls_ssl_conf_dh_param_ctx_ncbicxx_2_28_3
+ mbedtls_ssl_conf_dh_param_ctx_ncbicxx_2_28_8
#define mbedtls_ssl_conf_dhm_min_bitlen \
- mbedtls_ssl_conf_dhm_min_bitlen_ncbicxx_2_28_3
+ mbedtls_ssl_conf_dhm_min_bitlen_ncbicxx_2_28_8
#define mbedtls_ssl_conf_dtls_anti_replay \
- mbedtls_ssl_conf_dtls_anti_replay_ncbicxx_2_28_3
+ mbedtls_ssl_conf_dtls_anti_replay_ncbicxx_2_28_8
#define mbedtls_ssl_conf_dtls_badmac_limit \
- mbedtls_ssl_conf_dtls_badmac_limit_ncbicxx_2_28_3
+ mbedtls_ssl_conf_dtls_badmac_limit_ncbicxx_2_28_8
#define mbedtls_ssl_conf_encrypt_then_mac \
- mbedtls_ssl_conf_encrypt_then_mac_ncbicxx_2_28_3
+ mbedtls_ssl_conf_encrypt_then_mac_ncbicxx_2_28_8
#define mbedtls_ssl_conf_endpoint \
- mbedtls_ssl_conf_endpoint_ncbicxx_2_28_3
+ mbedtls_ssl_conf_endpoint_ncbicxx_2_28_8
#define mbedtls_ssl_conf_export_keys_cb \
- mbedtls_ssl_conf_export_keys_cb_ncbicxx_2_28_3
+ mbedtls_ssl_conf_export_keys_cb_ncbicxx_2_28_8
#define mbedtls_ssl_conf_export_keys_ext_cb \
- mbedtls_ssl_conf_export_keys_ext_cb_ncbicxx_2_28_3
+ mbedtls_ssl_conf_export_keys_ext_cb_ncbicxx_2_28_8
#define mbedtls_ssl_conf_extended_master_secret \
- mbedtls_ssl_conf_extended_master_secret_ncbicxx_2_28_3
+ mbedtls_ssl_conf_extended_master_secret_ncbicxx_2_28_8
#define mbedtls_ssl_conf_fallback \
- mbedtls_ssl_conf_fallback_ncbicxx_2_28_3
+ mbedtls_ssl_conf_fallback_ncbicxx_2_28_8
#define mbedtls_ssl_conf_handshake_timeout \
- mbedtls_ssl_conf_handshake_timeout_ncbicxx_2_28_3
+ mbedtls_ssl_conf_handshake_timeout_ncbicxx_2_28_8
#define mbedtls_ssl_conf_legacy_renegotiation \
- mbedtls_ssl_conf_legacy_renegotiation_ncbicxx_2_28_3
+ mbedtls_ssl_conf_legacy_renegotiation_ncbicxx_2_28_8
#define mbedtls_ssl_conf_max_frag_len \
- mbedtls_ssl_conf_max_frag_len_ncbicxx_2_28_3
+ mbedtls_ssl_conf_max_frag_len_ncbicxx_2_28_8
#define mbedtls_ssl_conf_max_version \
- mbedtls_ssl_conf_max_version_ncbicxx_2_28_3
+ mbedtls_ssl_conf_max_version_ncbicxx_2_28_8
#define mbedtls_ssl_conf_min_version \
- mbedtls_ssl_conf_min_version_ncbicxx_2_28_3
+ mbedtls_ssl_conf_min_version_ncbicxx_2_28_8
#define mbedtls_ssl_conf_own_cert \
- mbedtls_ssl_conf_own_cert_ncbicxx_2_28_3
+ mbedtls_ssl_conf_own_cert_ncbicxx_2_28_8
#define mbedtls_ssl_conf_psk \
- mbedtls_ssl_conf_psk_ncbicxx_2_28_3
+ mbedtls_ssl_conf_psk_ncbicxx_2_28_8
#define mbedtls_ssl_conf_psk_cb \
- mbedtls_ssl_conf_psk_cb_ncbicxx_2_28_3
+ mbedtls_ssl_conf_psk_cb_ncbicxx_2_28_8
#define mbedtls_ssl_conf_read_timeout \
- mbedtls_ssl_conf_read_timeout_ncbicxx_2_28_3
+ mbedtls_ssl_conf_read_timeout_ncbicxx_2_28_8
#define mbedtls_ssl_conf_renegotiation \
- mbedtls_ssl_conf_renegotiation_ncbicxx_2_28_3
+ mbedtls_ssl_conf_renegotiation_ncbicxx_2_28_8
#define mbedtls_ssl_conf_renegotiation_enforced \
- mbedtls_ssl_conf_renegotiation_enforced_ncbicxx_2_28_3
+ mbedtls_ssl_conf_renegotiation_enforced_ncbicxx_2_28_8
#define mbedtls_ssl_conf_renegotiation_period \
- mbedtls_ssl_conf_renegotiation_period_ncbicxx_2_28_3
+ mbedtls_ssl_conf_renegotiation_period_ncbicxx_2_28_8
#define mbedtls_ssl_conf_rng \
- mbedtls_ssl_conf_rng_ncbicxx_2_28_3
+ mbedtls_ssl_conf_rng_ncbicxx_2_28_8
#define mbedtls_ssl_conf_session_cache \
- mbedtls_ssl_conf_session_cache_ncbicxx_2_28_3
+ mbedtls_ssl_conf_session_cache_ncbicxx_2_28_8
#define mbedtls_ssl_conf_session_tickets \
- mbedtls_ssl_conf_session_tickets_ncbicxx_2_28_3
+ mbedtls_ssl_conf_session_tickets_ncbicxx_2_28_8
#define mbedtls_ssl_conf_session_tickets_cb \
- mbedtls_ssl_conf_session_tickets_cb_ncbicxx_2_28_3
+ mbedtls_ssl_conf_session_tickets_cb_ncbicxx_2_28_8
#define mbedtls_ssl_conf_sig_hashes \
- mbedtls_ssl_conf_sig_hashes_ncbicxx_2_28_3
+ mbedtls_ssl_conf_sig_hashes_ncbicxx_2_28_8
#define mbedtls_ssl_conf_sni \
- mbedtls_ssl_conf_sni_ncbicxx_2_28_3
+ mbedtls_ssl_conf_sni_ncbicxx_2_28_8
#define mbedtls_ssl_conf_transport \
- mbedtls_ssl_conf_transport_ncbicxx_2_28_3
+ mbedtls_ssl_conf_transport_ncbicxx_2_28_8
#define mbedtls_ssl_conf_truncated_hmac \
- mbedtls_ssl_conf_truncated_hmac_ncbicxx_2_28_3
+ mbedtls_ssl_conf_truncated_hmac_ncbicxx_2_28_8
#define mbedtls_ssl_conf_verify \
- mbedtls_ssl_conf_verify_ncbicxx_2_28_3
+ mbedtls_ssl_conf_verify_ncbicxx_2_28_8
#define mbedtls_ssl_config_defaults \
- mbedtls_ssl_config_defaults_ncbicxx_2_28_3
+ mbedtls_ssl_config_defaults_ncbicxx_2_28_8
#define mbedtls_ssl_config_free \
- mbedtls_ssl_config_free_ncbicxx_2_28_3
+ mbedtls_ssl_config_free_ncbicxx_2_28_8
#define mbedtls_ssl_config_init \
- mbedtls_ssl_config_init_ncbicxx_2_28_3
+ mbedtls_ssl_config_init_ncbicxx_2_28_8
#define mbedtls_ssl_context_load \
- mbedtls_ssl_context_load_ncbicxx_2_28_3
+ mbedtls_ssl_context_load_ncbicxx_2_28_8
#define mbedtls_ssl_context_save \
- mbedtls_ssl_context_save_ncbicxx_2_28_3
+ mbedtls_ssl_context_save_ncbicxx_2_28_8
#define mbedtls_ssl_derive_keys \
- mbedtls_ssl_derive_keys_ncbicxx_2_28_3
+ mbedtls_ssl_derive_keys_ncbicxx_2_28_8
#define mbedtls_ssl_free \
- mbedtls_ssl_free_ncbicxx_2_28_3
+ mbedtls_ssl_free_ncbicxx_2_28_8
#define mbedtls_ssl_get_alpn_protocol \
- mbedtls_ssl_get_alpn_protocol_ncbicxx_2_28_3
+ mbedtls_ssl_get_alpn_protocol_ncbicxx_2_28_8
#define mbedtls_ssl_get_ciphersuite \
- mbedtls_ssl_get_ciphersuite_ncbicxx_2_28_3
+ mbedtls_ssl_get_ciphersuite_ncbicxx_2_28_8
#define mbedtls_ssl_get_current_mtu \
- mbedtls_ssl_get_current_mtu_ncbicxx_2_28_3
+ mbedtls_ssl_get_current_mtu_ncbicxx_2_28_8
#define mbedtls_ssl_get_input_max_frag_len \
- mbedtls_ssl_get_input_max_frag_len_ncbicxx_2_28_3
+ mbedtls_ssl_get_input_max_frag_len_ncbicxx_2_28_8
#define mbedtls_ssl_get_key_exchange_md_ssl_tls \
- mbedtls_ssl_get_key_exchange_md_ssl_tls_ncbicxx_2_28_3
+ mbedtls_ssl_get_key_exchange_md_ssl_tls_ncbicxx_2_28_8
#define mbedtls_ssl_get_key_exchange_md_tls1_2 \
- mbedtls_ssl_get_key_exchange_md_tls1_2_ncbicxx_2_28_3
+ mbedtls_ssl_get_key_exchange_md_tls1_2_ncbicxx_2_28_8
#define mbedtls_ssl_get_max_frag_len \
- mbedtls_ssl_get_max_frag_len_ncbicxx_2_28_3
+ mbedtls_ssl_get_max_frag_len_ncbicxx_2_28_8
#define mbedtls_ssl_get_max_out_record_payload \
- mbedtls_ssl_get_max_out_record_payload_ncbicxx_2_28_3
+ mbedtls_ssl_get_max_out_record_payload_ncbicxx_2_28_8
#define mbedtls_ssl_get_output_max_frag_len \
- mbedtls_ssl_get_output_max_frag_len_ncbicxx_2_28_3
+ mbedtls_ssl_get_output_max_frag_len_ncbicxx_2_28_8
#define mbedtls_ssl_get_peer_cert \
- mbedtls_ssl_get_peer_cert_ncbicxx_2_28_3
+ mbedtls_ssl_get_peer_cert_ncbicxx_2_28_8
#define mbedtls_ssl_get_session \
- mbedtls_ssl_get_session_ncbicxx_2_28_3
+ mbedtls_ssl_get_session_ncbicxx_2_28_8
#define mbedtls_ssl_get_session_pointer \
- mbedtls_ssl_get_session_pointer_ncbicxx_2_28_3
+ mbedtls_ssl_get_session_pointer_ncbicxx_2_28_8
#define mbedtls_ssl_get_verify_result \
- mbedtls_ssl_get_verify_result_ncbicxx_2_28_3
+ mbedtls_ssl_get_verify_result_ncbicxx_2_28_8
#define mbedtls_ssl_get_version \
- mbedtls_ssl_get_version_ncbicxx_2_28_3
+ mbedtls_ssl_get_version_ncbicxx_2_28_8
#define mbedtls_ssl_handshake \
- mbedtls_ssl_handshake_ncbicxx_2_28_3
+ mbedtls_ssl_handshake_ncbicxx_2_28_8
#define mbedtls_ssl_handshake_free \
- mbedtls_ssl_handshake_free_ncbicxx_2_28_3
+ mbedtls_ssl_handshake_free_ncbicxx_2_28_8
#define mbedtls_ssl_handshake_step \
- mbedtls_ssl_handshake_step_ncbicxx_2_28_3
+ mbedtls_ssl_handshake_step_ncbicxx_2_28_8
#define mbedtls_ssl_handshake_wrapup \
- mbedtls_ssl_handshake_wrapup_ncbicxx_2_28_3
+ mbedtls_ssl_handshake_wrapup_ncbicxx_2_28_8
#define mbedtls_ssl_handshake_wrapup_free_hs_transform \
- mbedtls_ssl_handshake_wrapup_free_hs_transform_ncbicxx_2_28_3
+ mbedtls_ssl_handshake_wrapup_free_hs_transform_ncbicxx_2_28_8
#define mbedtls_ssl_hash_from_md_alg \
- mbedtls_ssl_hash_from_md_alg_ncbicxx_2_28_3
+ mbedtls_ssl_hash_from_md_alg_ncbicxx_2_28_8
#define mbedtls_ssl_init \
- mbedtls_ssl_init_ncbicxx_2_28_3
+ mbedtls_ssl_init_ncbicxx_2_28_8
#define mbedtls_ssl_md_alg_from_hash \
- mbedtls_ssl_md_alg_from_hash_ncbicxx_2_28_3
+ mbedtls_ssl_md_alg_from_hash_ncbicxx_2_28_8
#define mbedtls_ssl_optimize_checksum \
- mbedtls_ssl_optimize_checksum_ncbicxx_2_28_3
+ mbedtls_ssl_optimize_checksum_ncbicxx_2_28_8
#define mbedtls_ssl_parse_certificate \
- mbedtls_ssl_parse_certificate_ncbicxx_2_28_3
+ mbedtls_ssl_parse_certificate_ncbicxx_2_28_8
#define mbedtls_ssl_parse_finished \
- mbedtls_ssl_parse_finished_ncbicxx_2_28_3
+ mbedtls_ssl_parse_finished_ncbicxx_2_28_8
#define mbedtls_ssl_pk_alg_from_sig \
- mbedtls_ssl_pk_alg_from_sig_ncbicxx_2_28_3
+ mbedtls_ssl_pk_alg_from_sig_ncbicxx_2_28_8
#define mbedtls_ssl_psk_derive_premaster \
- mbedtls_ssl_psk_derive_premaster_ncbicxx_2_28_3
+ mbedtls_ssl_psk_derive_premaster_ncbicxx_2_28_8
#define mbedtls_ssl_renegotiate \
- mbedtls_ssl_renegotiate_ncbicxx_2_28_3
+ mbedtls_ssl_renegotiate_ncbicxx_2_28_8
#define mbedtls_ssl_resend_hello_request \
- mbedtls_ssl_resend_hello_request_ncbicxx_2_28_3
+ mbedtls_ssl_resend_hello_request_ncbicxx_2_28_8
#define mbedtls_ssl_reset_checksum \
- mbedtls_ssl_reset_checksum_ncbicxx_2_28_3
+ mbedtls_ssl_reset_checksum_ncbicxx_2_28_8
#define mbedtls_ssl_session_copy \
- mbedtls_ssl_session_copy_ncbicxx_2_28_3
+ mbedtls_ssl_session_copy_ncbicxx_2_28_8
#define mbedtls_ssl_session_free \
- mbedtls_ssl_session_free_ncbicxx_2_28_3
+ mbedtls_ssl_session_free_ncbicxx_2_28_8
#define mbedtls_ssl_session_init \
- mbedtls_ssl_session_init_ncbicxx_2_28_3
+ mbedtls_ssl_session_init_ncbicxx_2_28_8
#define mbedtls_ssl_session_load \
- mbedtls_ssl_session_load_ncbicxx_2_28_3
+ mbedtls_ssl_session_load_ncbicxx_2_28_8
#define mbedtls_ssl_session_reset \
- mbedtls_ssl_session_reset_ncbicxx_2_28_3
+ mbedtls_ssl_session_reset_ncbicxx_2_28_8
#define mbedtls_ssl_session_reset_int \
- mbedtls_ssl_session_reset_int_ncbicxx_2_28_3
+ mbedtls_ssl_session_reset_int_ncbicxx_2_28_8
#define mbedtls_ssl_session_save \
- mbedtls_ssl_session_save_ncbicxx_2_28_3
+ mbedtls_ssl_session_save_ncbicxx_2_28_8
#define mbedtls_ssl_set_bio \
- mbedtls_ssl_set_bio_ncbicxx_2_28_3
+ mbedtls_ssl_set_bio_ncbicxx_2_28_8
#define mbedtls_ssl_set_calc_verify_md \
- mbedtls_ssl_set_calc_verify_md_ncbicxx_2_28_3
+ mbedtls_ssl_set_calc_verify_md_ncbicxx_2_28_8
#define mbedtls_ssl_set_datagram_packing \
- mbedtls_ssl_set_datagram_packing_ncbicxx_2_28_3
+ mbedtls_ssl_set_datagram_packing_ncbicxx_2_28_8
#define mbedtls_ssl_set_hostname \
- mbedtls_ssl_set_hostname_ncbicxx_2_28_3
+ mbedtls_ssl_set_hostname_ncbicxx_2_28_8
#define mbedtls_ssl_set_hs_authmode \
- mbedtls_ssl_set_hs_authmode_ncbicxx_2_28_3
+ mbedtls_ssl_set_hs_authmode_ncbicxx_2_28_8
#define mbedtls_ssl_set_hs_ca_chain \
- mbedtls_ssl_set_hs_ca_chain_ncbicxx_2_28_3
+ mbedtls_ssl_set_hs_ca_chain_ncbicxx_2_28_8
#define mbedtls_ssl_set_hs_own_cert \
- mbedtls_ssl_set_hs_own_cert_ncbicxx_2_28_3
+ mbedtls_ssl_set_hs_own_cert_ncbicxx_2_28_8
#define mbedtls_ssl_set_hs_psk \
- mbedtls_ssl_set_hs_psk_ncbicxx_2_28_3
+ mbedtls_ssl_set_hs_psk_ncbicxx_2_28_8
#define mbedtls_ssl_set_mtu \
- mbedtls_ssl_set_mtu_ncbicxx_2_28_3
+ mbedtls_ssl_set_mtu_ncbicxx_2_28_8
#define mbedtls_ssl_set_session \
- mbedtls_ssl_set_session_ncbicxx_2_28_3
+ mbedtls_ssl_set_session_ncbicxx_2_28_8
#define mbedtls_ssl_set_timer_cb \
- mbedtls_ssl_set_timer_cb_ncbicxx_2_28_3
+ mbedtls_ssl_set_timer_cb_ncbicxx_2_28_8
#define mbedtls_ssl_set_verify \
- mbedtls_ssl_set_verify_ncbicxx_2_28_3
+ mbedtls_ssl_set_verify_ncbicxx_2_28_8
#define mbedtls_ssl_setup \
- mbedtls_ssl_setup_ncbicxx_2_28_3
+ mbedtls_ssl_setup_ncbicxx_2_28_8
#define mbedtls_ssl_sig_from_pk \
- mbedtls_ssl_sig_from_pk_ncbicxx_2_28_3
+ mbedtls_ssl_sig_from_pk_ncbicxx_2_28_8
#define mbedtls_ssl_sig_from_pk_alg \
- mbedtls_ssl_sig_from_pk_alg_ncbicxx_2_28_3
+ mbedtls_ssl_sig_from_pk_alg_ncbicxx_2_28_8
#define mbedtls_ssl_sig_hash_set_add \
- mbedtls_ssl_sig_hash_set_add_ncbicxx_2_28_3
+ mbedtls_ssl_sig_hash_set_add_ncbicxx_2_28_8
#define mbedtls_ssl_sig_hash_set_const_hash \
- mbedtls_ssl_sig_hash_set_const_hash_ncbicxx_2_28_3
+ mbedtls_ssl_sig_hash_set_const_hash_ncbicxx_2_28_8
#define mbedtls_ssl_sig_hash_set_find \
- mbedtls_ssl_sig_hash_set_find_ncbicxx_2_28_3
+ mbedtls_ssl_sig_hash_set_find_ncbicxx_2_28_8
#define mbedtls_ssl_start_renegotiation \
- mbedtls_ssl_start_renegotiation_ncbicxx_2_28_3
+ mbedtls_ssl_start_renegotiation_ncbicxx_2_28_8
#define mbedtls_ssl_tls_prf \
- mbedtls_ssl_tls_prf_ncbicxx_2_28_3
+ mbedtls_ssl_tls_prf_ncbicxx_2_28_8
#define mbedtls_ssl_transform_init \
- mbedtls_ssl_transform_init_ncbicxx_2_28_3
+ mbedtls_ssl_transform_init_ncbicxx_2_28_8
#define mbedtls_ssl_write_certificate \
- mbedtls_ssl_write_certificate_ncbicxx_2_28_3
+ mbedtls_ssl_write_certificate_ncbicxx_2_28_8
#define mbedtls_ssl_write_finished \
- mbedtls_ssl_write_finished_ncbicxx_2_28_3
+ mbedtls_ssl_write_finished_ncbicxx_2_28_8
#define mbedtls_mutex_free \
- mbedtls_mutex_free_ncbicxx_2_28_3
+ mbedtls_mutex_free_ncbicxx_2_28_8
#define mbedtls_mutex_init \
- mbedtls_mutex_init_ncbicxx_2_28_3
+ mbedtls_mutex_init_ncbicxx_2_28_8
#define mbedtls_mutex_lock \
- mbedtls_mutex_lock_ncbicxx_2_28_3
+ mbedtls_mutex_lock_ncbicxx_2_28_8
#define mbedtls_mutex_unlock \
- mbedtls_mutex_unlock_ncbicxx_2_28_3
+ mbedtls_mutex_unlock_ncbicxx_2_28_8
#define mbedtls_threading_free_alt \
- mbedtls_threading_free_alt_ncbicxx_2_28_3
+ mbedtls_threading_free_alt_ncbicxx_2_28_8
#define mbedtls_threading_readdir_mutex \
- mbedtls_threading_readdir_mutex_ncbicxx_2_28_3
+ mbedtls_threading_readdir_mutex_ncbicxx_2_28_8
#define mbedtls_threading_set_alt \
- mbedtls_threading_set_alt_ncbicxx_2_28_3
+ mbedtls_threading_set_alt_ncbicxx_2_28_8
#define mbedtls_set_alarm \
- mbedtls_set_alarm_ncbicxx_2_28_3
+ mbedtls_set_alarm_ncbicxx_2_28_8
#define mbedtls_timing_alarmed \
- mbedtls_timing_alarmed_ncbicxx_2_28_3
+ mbedtls_timing_alarmed_ncbicxx_2_28_8
#define mbedtls_timing_get_delay \
- mbedtls_timing_get_delay_ncbicxx_2_28_3
+ mbedtls_timing_get_delay_ncbicxx_2_28_8
#define mbedtls_timing_get_timer \
- mbedtls_timing_get_timer_ncbicxx_2_28_3
+ mbedtls_timing_get_timer_ncbicxx_2_28_8
#define mbedtls_timing_hardclock \
- mbedtls_timing_hardclock_ncbicxx_2_28_3
+ mbedtls_timing_hardclock_ncbicxx_2_28_8
#define mbedtls_timing_set_delay \
- mbedtls_timing_set_delay_ncbicxx_2_28_3
+ mbedtls_timing_set_delay_ncbicxx_2_28_8
#define mbedtls_version_get_number \
- mbedtls_version_get_number_ncbicxx_2_28_3
+ mbedtls_version_get_number_ncbicxx_2_28_8
#define mbedtls_version_get_string \
- mbedtls_version_get_string_ncbicxx_2_28_3
+ mbedtls_version_get_string_ncbicxx_2_28_8
#define mbedtls_version_get_string_full \
- mbedtls_version_get_string_full_ncbicxx_2_28_3
+ mbedtls_version_get_string_full_ncbicxx_2_28_8
#define mbedtls_version_check_feature \
- mbedtls_version_check_feature_ncbicxx_2_28_3
+ mbedtls_version_check_feature_ncbicxx_2_28_8
#define mbedtls_x509_dn_gets \
- mbedtls_x509_dn_gets_ncbicxx_2_28_3
+ mbedtls_x509_dn_gets_ncbicxx_2_28_8
#define mbedtls_x509_get_alg \
- mbedtls_x509_get_alg_ncbicxx_2_28_3
+ mbedtls_x509_get_alg_ncbicxx_2_28_8
#define mbedtls_x509_get_alg_null \
- mbedtls_x509_get_alg_null_ncbicxx_2_28_3
+ mbedtls_x509_get_alg_null_ncbicxx_2_28_8
#define mbedtls_x509_get_ext \
- mbedtls_x509_get_ext_ncbicxx_2_28_3
+ mbedtls_x509_get_ext_ncbicxx_2_28_8
#define mbedtls_x509_get_name \
- mbedtls_x509_get_name_ncbicxx_2_28_3
+ mbedtls_x509_get_name_ncbicxx_2_28_8
#define mbedtls_x509_get_rsassa_pss_params \
- mbedtls_x509_get_rsassa_pss_params_ncbicxx_2_28_3
+ mbedtls_x509_get_rsassa_pss_params_ncbicxx_2_28_8
#define mbedtls_x509_get_serial \
- mbedtls_x509_get_serial_ncbicxx_2_28_3
+ mbedtls_x509_get_serial_ncbicxx_2_28_8
#define mbedtls_x509_get_sig \
- mbedtls_x509_get_sig_ncbicxx_2_28_3
+ mbedtls_x509_get_sig_ncbicxx_2_28_8
#define mbedtls_x509_get_sig_alg \
- mbedtls_x509_get_sig_alg_ncbicxx_2_28_3
+ mbedtls_x509_get_sig_alg_ncbicxx_2_28_8
#define mbedtls_x509_get_time \
- mbedtls_x509_get_time_ncbicxx_2_28_3
+ mbedtls_x509_get_time_ncbicxx_2_28_8
#define mbedtls_x509_key_size_helper \
- mbedtls_x509_key_size_helper_ncbicxx_2_28_3
+ mbedtls_x509_key_size_helper_ncbicxx_2_28_8
#define mbedtls_x509_serial_gets \
- mbedtls_x509_serial_gets_ncbicxx_2_28_3
+ mbedtls_x509_serial_gets_ncbicxx_2_28_8
#define mbedtls_x509_sig_alg_gets \
- mbedtls_x509_sig_alg_gets_ncbicxx_2_28_3
+ mbedtls_x509_sig_alg_gets_ncbicxx_2_28_8
#define mbedtls_x509_time_is_future \
- mbedtls_x509_time_is_future_ncbicxx_2_28_3
+ mbedtls_x509_time_is_future_ncbicxx_2_28_8
#define mbedtls_x509_time_is_past \
- mbedtls_x509_time_is_past_ncbicxx_2_28_3
+ mbedtls_x509_time_is_past_ncbicxx_2_28_8
#define mbedtls_x509_set_extension \
- mbedtls_x509_set_extension_ncbicxx_2_28_3
+ mbedtls_x509_set_extension_ncbicxx_2_28_8
#define mbedtls_x509_string_to_names \
- mbedtls_x509_string_to_names_ncbicxx_2_28_3
+ mbedtls_x509_string_to_names_ncbicxx_2_28_8
#define mbedtls_x509_write_extensions \
- mbedtls_x509_write_extensions_ncbicxx_2_28_3
+ mbedtls_x509_write_extensions_ncbicxx_2_28_8
#define mbedtls_x509_write_names \
- mbedtls_x509_write_names_ncbicxx_2_28_3
+ mbedtls_x509_write_names_ncbicxx_2_28_8
#define mbedtls_x509_write_sig \
- mbedtls_x509_write_sig_ncbicxx_2_28_3
+ mbedtls_x509_write_sig_ncbicxx_2_28_8
#define mbedtls_x509_crl_free \
- mbedtls_x509_crl_free_ncbicxx_2_28_3
+ mbedtls_x509_crl_free_ncbicxx_2_28_8
#define mbedtls_x509_crl_info \
- mbedtls_x509_crl_info_ncbicxx_2_28_3
+ mbedtls_x509_crl_info_ncbicxx_2_28_8
#define mbedtls_x509_crl_init \
- mbedtls_x509_crl_init_ncbicxx_2_28_3
+ mbedtls_x509_crl_init_ncbicxx_2_28_8
#define mbedtls_x509_crl_parse \
- mbedtls_x509_crl_parse_ncbicxx_2_28_3
+ mbedtls_x509_crl_parse_ncbicxx_2_28_8
#define mbedtls_x509_crl_parse_der \
- mbedtls_x509_crl_parse_der_ncbicxx_2_28_3
+ mbedtls_x509_crl_parse_der_ncbicxx_2_28_8
#define mbedtls_x509_crl_parse_file \
- mbedtls_x509_crl_parse_file_ncbicxx_2_28_3
+ mbedtls_x509_crl_parse_file_ncbicxx_2_28_8
#define mbedtls_x509_crt_check_extended_key_usage \
- mbedtls_x509_crt_check_extended_key_usage_ncbicxx_2_28_3
+ mbedtls_x509_crt_check_extended_key_usage_ncbicxx_2_28_8
#define mbedtls_x509_crt_check_key_usage \
- mbedtls_x509_crt_check_key_usage_ncbicxx_2_28_3
+ mbedtls_x509_crt_check_key_usage_ncbicxx_2_28_8
#define mbedtls_x509_crt_free \
- mbedtls_x509_crt_free_ncbicxx_2_28_3
+ mbedtls_x509_crt_free_ncbicxx_2_28_8
#define mbedtls_x509_crt_info \
- mbedtls_x509_crt_info_ncbicxx_2_28_3
+ mbedtls_x509_crt_info_ncbicxx_2_28_8
#define mbedtls_x509_crt_init \
- mbedtls_x509_crt_init_ncbicxx_2_28_3
+ mbedtls_x509_crt_init_ncbicxx_2_28_8
#define mbedtls_x509_crt_is_revoked \
- mbedtls_x509_crt_is_revoked_ncbicxx_2_28_3
+ mbedtls_x509_crt_is_revoked_ncbicxx_2_28_8
#define mbedtls_x509_crt_parse \
- mbedtls_x509_crt_parse_ncbicxx_2_28_3
+ mbedtls_x509_crt_parse_ncbicxx_2_28_8
#define mbedtls_x509_crt_parse_der \
- mbedtls_x509_crt_parse_der_ncbicxx_2_28_3
+ mbedtls_x509_crt_parse_der_ncbicxx_2_28_8
#define mbedtls_x509_crt_parse_der_nocopy \
- mbedtls_x509_crt_parse_der_nocopy_ncbicxx_2_28_3
+ mbedtls_x509_crt_parse_der_nocopy_ncbicxx_2_28_8
#define mbedtls_x509_crt_parse_der_with_ext_cb \
- mbedtls_x509_crt_parse_der_with_ext_cb_ncbicxx_2_28_3
+ mbedtls_x509_crt_parse_der_with_ext_cb_ncbicxx_2_28_8
#define mbedtls_x509_crt_parse_file \
- mbedtls_x509_crt_parse_file_ncbicxx_2_28_3
+ mbedtls_x509_crt_parse_file_ncbicxx_2_28_8
#define mbedtls_x509_crt_parse_path \
- mbedtls_x509_crt_parse_path_ncbicxx_2_28_3
+ mbedtls_x509_crt_parse_path_ncbicxx_2_28_8
#define mbedtls_x509_crt_profile_default \
- mbedtls_x509_crt_profile_default_ncbicxx_2_28_3
+ mbedtls_x509_crt_profile_default_ncbicxx_2_28_8
#define mbedtls_x509_crt_profile_next \
- mbedtls_x509_crt_profile_next_ncbicxx_2_28_3
+ mbedtls_x509_crt_profile_next_ncbicxx_2_28_8
#define mbedtls_x509_crt_profile_suiteb \
- mbedtls_x509_crt_profile_suiteb_ncbicxx_2_28_3
+ mbedtls_x509_crt_profile_suiteb_ncbicxx_2_28_8
#define mbedtls_x509_crt_verify \
- mbedtls_x509_crt_verify_ncbicxx_2_28_3
+ mbedtls_x509_crt_verify_ncbicxx_2_28_8
#define mbedtls_x509_crt_verify_info \
- mbedtls_x509_crt_verify_info_ncbicxx_2_28_3
+ mbedtls_x509_crt_verify_info_ncbicxx_2_28_8
#define mbedtls_x509_crt_verify_restartable \
- mbedtls_x509_crt_verify_restartable_ncbicxx_2_28_3
+ mbedtls_x509_crt_verify_restartable_ncbicxx_2_28_8
#define mbedtls_x509_crt_verify_with_profile \
- mbedtls_x509_crt_verify_with_profile_ncbicxx_2_28_3
+ mbedtls_x509_crt_verify_with_profile_ncbicxx_2_28_8
#define mbedtls_x509_parse_subject_alt_name \
- mbedtls_x509_parse_subject_alt_name_ncbicxx_2_28_3
+ mbedtls_x509_parse_subject_alt_name_ncbicxx_2_28_8
#define mbedtls_x509_csr_free \
- mbedtls_x509_csr_free_ncbicxx_2_28_3
+ mbedtls_x509_csr_free_ncbicxx_2_28_8
#define mbedtls_x509_csr_info \
- mbedtls_x509_csr_info_ncbicxx_2_28_3
+ mbedtls_x509_csr_info_ncbicxx_2_28_8
#define mbedtls_x509_csr_init \
- mbedtls_x509_csr_init_ncbicxx_2_28_3
+ mbedtls_x509_csr_init_ncbicxx_2_28_8
#define mbedtls_x509_csr_parse \
- mbedtls_x509_csr_parse_ncbicxx_2_28_3
+ mbedtls_x509_csr_parse_ncbicxx_2_28_8
#define mbedtls_x509_csr_parse_der \
- mbedtls_x509_csr_parse_der_ncbicxx_2_28_3
+ mbedtls_x509_csr_parse_der_ncbicxx_2_28_8
#define mbedtls_x509_csr_parse_file \
- mbedtls_x509_csr_parse_file_ncbicxx_2_28_3
+ mbedtls_x509_csr_parse_file_ncbicxx_2_28_8
#define mbedtls_x509write_crt_der \
- mbedtls_x509write_crt_der_ncbicxx_2_28_3
+ mbedtls_x509write_crt_der_ncbicxx_2_28_8
#define mbedtls_x509write_crt_free \
- mbedtls_x509write_crt_free_ncbicxx_2_28_3
+ mbedtls_x509write_crt_free_ncbicxx_2_28_8
#define mbedtls_x509write_crt_init \
- mbedtls_x509write_crt_init_ncbicxx_2_28_3
+ mbedtls_x509write_crt_init_ncbicxx_2_28_8
#define mbedtls_x509write_crt_pem \
- mbedtls_x509write_crt_pem_ncbicxx_2_28_3
+ mbedtls_x509write_crt_pem_ncbicxx_2_28_8
#define mbedtls_x509write_crt_set_authority_key_identifier \
- mbedtls_x509write_crt_set_authority_key_identifier_ncbicxx_2_28_3
+ mbedtls_x509write_crt_set_authority_key_identifier_ncbicxx_2_28_8
#define mbedtls_x509write_crt_set_basic_constraints \
- mbedtls_x509write_crt_set_basic_constraints_ncbicxx_2_28_3
+ mbedtls_x509write_crt_set_basic_constraints_ncbicxx_2_28_8
#define mbedtls_x509write_crt_set_extension \
- mbedtls_x509write_crt_set_extension_ncbicxx_2_28_3
+ mbedtls_x509write_crt_set_extension_ncbicxx_2_28_8
#define mbedtls_x509write_crt_set_issuer_key \
- mbedtls_x509write_crt_set_issuer_key_ncbicxx_2_28_3
+ mbedtls_x509write_crt_set_issuer_key_ncbicxx_2_28_8
#define mbedtls_x509write_crt_set_issuer_name \
- mbedtls_x509write_crt_set_issuer_name_ncbicxx_2_28_3
+ mbedtls_x509write_crt_set_issuer_name_ncbicxx_2_28_8
#define mbedtls_x509write_crt_set_key_usage \
- mbedtls_x509write_crt_set_key_usage_ncbicxx_2_28_3
+ mbedtls_x509write_crt_set_key_usage_ncbicxx_2_28_8
#define mbedtls_x509write_crt_set_md_alg \
- mbedtls_x509write_crt_set_md_alg_ncbicxx_2_28_3
+ mbedtls_x509write_crt_set_md_alg_ncbicxx_2_28_8
#define mbedtls_x509write_crt_set_ns_cert_type \
- mbedtls_x509write_crt_set_ns_cert_type_ncbicxx_2_28_3
+ mbedtls_x509write_crt_set_ns_cert_type_ncbicxx_2_28_8
#define mbedtls_x509write_crt_set_serial \
- mbedtls_x509write_crt_set_serial_ncbicxx_2_28_3
+ mbedtls_x509write_crt_set_serial_ncbicxx_2_28_8
#define mbedtls_x509write_crt_set_subject_key \
- mbedtls_x509write_crt_set_subject_key_ncbicxx_2_28_3
+ mbedtls_x509write_crt_set_subject_key_ncbicxx_2_28_8
#define mbedtls_x509write_crt_set_subject_key_identifier \
- mbedtls_x509write_crt_set_subject_key_identifier_ncbicxx_2_28_3
+ mbedtls_x509write_crt_set_subject_key_identifier_ncbicxx_2_28_8
#define mbedtls_x509write_crt_set_subject_name \
- mbedtls_x509write_crt_set_subject_name_ncbicxx_2_28_3
+ mbedtls_x509write_crt_set_subject_name_ncbicxx_2_28_8
#define mbedtls_x509write_crt_set_validity \
- mbedtls_x509write_crt_set_validity_ncbicxx_2_28_3
+ mbedtls_x509write_crt_set_validity_ncbicxx_2_28_8
#define mbedtls_x509write_crt_set_version \
- mbedtls_x509write_crt_set_version_ncbicxx_2_28_3
+ mbedtls_x509write_crt_set_version_ncbicxx_2_28_8
#define mbedtls_x509write_csr_der \
- mbedtls_x509write_csr_der_ncbicxx_2_28_3
+ mbedtls_x509write_csr_der_ncbicxx_2_28_8
#define mbedtls_x509write_csr_free \
- mbedtls_x509write_csr_free_ncbicxx_2_28_3
+ mbedtls_x509write_csr_free_ncbicxx_2_28_8
#define mbedtls_x509write_csr_init \
- mbedtls_x509write_csr_init_ncbicxx_2_28_3
+ mbedtls_x509write_csr_init_ncbicxx_2_28_8
#define mbedtls_x509write_csr_pem \
- mbedtls_x509write_csr_pem_ncbicxx_2_28_3
+ mbedtls_x509write_csr_pem_ncbicxx_2_28_8
#define mbedtls_x509write_csr_set_extension \
- mbedtls_x509write_csr_set_extension_ncbicxx_2_28_3
+ mbedtls_x509write_csr_set_extension_ncbicxx_2_28_8
#define mbedtls_x509write_csr_set_key \
- mbedtls_x509write_csr_set_key_ncbicxx_2_28_3
+ mbedtls_x509write_csr_set_key_ncbicxx_2_28_8
#define mbedtls_x509write_csr_set_key_usage \
- mbedtls_x509write_csr_set_key_usage_ncbicxx_2_28_3
+ mbedtls_x509write_csr_set_key_usage_ncbicxx_2_28_8
#define mbedtls_x509write_csr_set_md_alg \
- mbedtls_x509write_csr_set_md_alg_ncbicxx_2_28_3
+ mbedtls_x509write_csr_set_md_alg_ncbicxx_2_28_8
#define mbedtls_x509write_csr_set_ns_cert_type \
- mbedtls_x509write_csr_set_ns_cert_type_ncbicxx_2_28_3
+ mbedtls_x509write_csr_set_ns_cert_type_ncbicxx_2_28_8
#define mbedtls_x509write_csr_set_subject_name \
- mbedtls_x509write_csr_set_subject_name_ncbicxx_2_28_3
+ mbedtls_x509write_csr_set_subject_name_ncbicxx_2_28_8
#define mbedtls_xtea_crypt_cbc \
- mbedtls_xtea_crypt_cbc_ncbicxx_2_28_3
+ mbedtls_xtea_crypt_cbc_ncbicxx_2_28_8
#define mbedtls_xtea_crypt_ecb \
- mbedtls_xtea_crypt_ecb_ncbicxx_2_28_3
+ mbedtls_xtea_crypt_ecb_ncbicxx_2_28_8
#define mbedtls_xtea_free \
- mbedtls_xtea_free_ncbicxx_2_28_3
+ mbedtls_xtea_free_ncbicxx_2_28_8
#define mbedtls_xtea_init \
- mbedtls_xtea_init_ncbicxx_2_28_3
+ mbedtls_xtea_init_ncbicxx_2_28_8
#define mbedtls_xtea_setup \
- mbedtls_xtea_setup_ncbicxx_2_28_3
+ mbedtls_xtea_setup_ncbicxx_2_28_8
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#if !defined(MBEDTLS_CONFIG_FILE)
#include "mbedtls/config.h"
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_NET_SOCKETS_H
#define MBEDTLS_NET_SOCKETS_H
* \param client_ctx Will contain the connected client socket
* \param client_ip Will contain the client IP address, can be NULL
* \param buf_size Size of the client_ip buffer
- * \param ip_len Will receive the size of the client IP written,
+ * \param cip_len Will receive the size of the client IP written,
* can be NULL if client_ip is null
*
* \return 0 if successful, or
*/
int mbedtls_net_accept(mbedtls_net_context *bind_ctx,
mbedtls_net_context *client_ctx,
- void *client_ip, size_t buf_size, size_t *ip_len);
+ void *client_ip, size_t buf_size, size_t *cip_len);
/**
* \brief Check and wait for the context to be ready for read/write
* \brief Closes down the connection and free associated data
*
* \param ctx The context to close
+ *
+ * \note This function frees and clears data associated with the
+ * context but does not free the memory pointed to by \p ctx.
+ * This memory is the responsibility of the caller.
*/
void mbedtls_net_close(mbedtls_net_context *ctx);
* \brief Gracefully shutdown the connection and free associated data
*
* \param ctx The context to free
+ *
+ * \note This function frees and clears data associated with the
+ * context but does not free the memory pointed to by \p ctx.
+ * This memory is the responsibility of the caller.
*/
void mbedtls_net_free(mbedtls_net_context *ctx);
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_NIST_KW_H
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_OID_H
#define MBEDTLS_OID_H
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_PADLOCK_H
#define MBEDTLS_PADLOCK_H
#endif
/* Some versions of ASan result in errors about not enough registers */
-#if defined(MBEDTLS_HAVE_ASM) && defined(__GNUC__) && defined(__i386__) && \
+#if defined(MBEDTLS_PADLOCK_C) && defined(MBEDTLS_HAVE_ASM) && \
+ defined(__GNUC__) && defined(__i386__) && \
!defined(MBEDTLS_HAVE_ASAN)
+#define MBEDTLS_VIA_PADLOCK_HAVE_CODE
+
#ifndef MBEDTLS_HAVE_X86
#define MBEDTLS_HAVE_X86
#endif
}
#endif
-#endif /* HAVE_X86 */
+#endif /* MBEDTLS_PADLOCK_C && MBEDTLS_HAVE_ASM &&
+ __GNUC__ && __i386__ && !MBEDTLS_HAVE_ASAN */
#endif /* padlock.h */
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_PEM_H
#define MBEDTLS_PEM_H
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_PK_H
*
* \return 0 on success (signature is valid),
* #MBEDTLS_ERR_PK_SIG_LEN_MISMATCH if there is a valid
- * signature in sig but its length is less than \p siglen,
+ * signature in \p sig but its length is less than \p sig_len,
* or a specific error code.
*
* \note For RSA keys, the default padding type is PKCS#1 v1.5.
* #MBEDTLS_ERR_PK_TYPE_MISMATCH if the PK context can't be
* used for this type of signatures,
* #MBEDTLS_ERR_PK_SIG_LEN_MISMATCH if there is a valid
- * signature in sig but its length is less than \p siglen,
+ * signature in \p sig but its length is less than \p sig_len,
* or a specific error code.
*
* \note If hash_len is 0, then the length associated with md_alg
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_PK_WRAP_H
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_PKCS11_H
#define MBEDTLS_PKCS11_H
MBEDTLS_DEPRECATED void mbedtls_pkcs11_init(mbedtls_pkcs11_context *ctx);
/**
- * Fill in a mbed TLS certificate, based on the given PKCS11 helper certificate.
+ * Fill in a Mbed TLS certificate, based on the given PKCS11 helper certificate.
*
* \deprecated This function is deprecated and will be removed in a
* future version of the library.
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_PKCS12_H
#define MBEDTLS_PKCS12_H
* \brief PKCS12 Password Based function (encryption / decryption)
* for cipher-based and mbedtls_md-based PBE's
*
+ * \note When encrypting, #MBEDTLS_CIPHER_PADDING_PKCS7 must
+ * be enabled at compile time.
+ *
+ * \warning When decrypting:
+ * - if #MBEDTLS_CIPHER_PADDING_PKCS7 is enabled at compile
+ * time, this function validates the CBC padding and returns
+ * #MBEDTLS_ERR_PKCS12_PASSWORD_MISMATCH if the padding is
+ * invalid. Note that this can help active adversaries
+ * attempting to brute-forcing the password. Note also that
+ * there is no guarantee that an invalid password will be
+ * detected (the chances of a valid padding with a random
+ * password are about 1/255).
+ * - if #MBEDTLS_CIPHER_PADDING_PKCS7 is disabled at compile
+ * time, this function does not validate the CBC padding.
+ *
* \param pbe_params an ASN1 buffer containing the pkcs-12 PbeParams structure
* \param mode either #MBEDTLS_PKCS12_PBE_ENCRYPT or
* #MBEDTLS_PKCS12_PBE_DECRYPT
* \param pwd Latin1-encoded password used. This may only be \c NULL when
* \p pwdlen is 0. No null terminator should be used.
* \param pwdlen length of the password (may be 0)
- * \param input the input data
+ * \param data the input data
* \param len data length
- * \param output the output buffer
+ * \param output Output buffer.
+ * On success, it contains the encrypted or decrypted data,
+ * possibly followed by the CBC padding.
+ * On failure, the content is indeterminate.
+ * For decryption, there must be enough room for \p len
+ * bytes.
+ * For encryption, there must be enough room for
+ * \p len + 1 bytes, rounded up to the block size of
+ * the block cipher identified by \p pbe_params.
*
* \return 0 if successful, or a MBEDTLS_ERR_XXX code
*/
int mbedtls_pkcs12_pbe(mbedtls_asn1_buf *pbe_params, int mode,
mbedtls_cipher_type_t cipher_type, mbedtls_md_type_t md_type,
const unsigned char *pwd, size_t pwdlen,
- const unsigned char *input, size_t len,
+ const unsigned char *data, size_t len,
unsigned char *output);
+#if defined(MBEDTLS_CIPHER_PADDING_PKCS7)
+
+/**
+ * \brief PKCS12 Password Based function (encryption / decryption)
+ * for cipher-based and mbedtls_md-based PBE's
+ *
+ *
+ * \warning When decrypting:
+ * - This function validates the CBC padding and returns
+ * #MBEDTLS_ERR_PKCS12_PASSWORD_MISMATCH if the padding is
+ * invalid. Note that this can help active adversaries
+ * attempting to brute-forcing the password. Note also that
+ * there is no guarantee that an invalid password will be
+ * detected (the chances of a valid padding with a random
+ * password are about 1/255).
+ *
+ * \param pbe_params an ASN1 buffer containing the pkcs-12 PbeParams structure
+ * \param mode either #MBEDTLS_PKCS12_PBE_ENCRYPT or
+ * #MBEDTLS_PKCS12_PBE_DECRYPT
+ * \param cipher_type the cipher used
+ * \param md_type the mbedtls_md used
+ * \param pwd Latin1-encoded password used. This may only be \c NULL when
+ * \p pwdlen is 0. No null terminator should be used.
+ * \param pwdlen length of the password (may be 0)
+ * \param data the input data
+ * \param len data length
+ * \param output Output buffer.
+ * On success, it contains the encrypted or decrypted data,
+ * possibly followed by the CBC padding.
+ * On failure, the content is indeterminate.
+ * For decryption, there must be enough room for \p len
+ * bytes.
+ * For encryption, there must be enough room for
+ * \p len + 1 bytes, rounded up to the block size of
+ * the block cipher identified by \p pbe_params.
+ * \param output_size size of output buffer.
+ * This must be big enough to accommodate for output plus
+ * padding data.
+ * \param output_len On success, length of actual data written to the output buffer.
+ *
+ * \return 0 if successful, or a MBEDTLS_ERR_XXX code
+ */
+int mbedtls_pkcs12_pbe_ext(mbedtls_asn1_buf *pbe_params, int mode,
+ mbedtls_cipher_type_t cipher_type, mbedtls_md_type_t md_type,
+ const unsigned char *pwd, size_t pwdlen,
+ const unsigned char *data, size_t len,
+ unsigned char *output, size_t output_size,
+ size_t *output_len);
+
+#endif /* MBEDTLS_CIPHER_PADDING_PKCS7 */
+
#endif /* MBEDTLS_ASN1_PARSE_C */
/**
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_PKCS5_H
#define MBEDTLS_PKCS5_H
/**
* \brief PKCS#5 PBES2 function
*
+ * \note When encrypting, #MBEDTLS_CIPHER_PADDING_PKCS7 must
+ * be enabled at compile time.
+ *
+ * \warning When decrypting:
+ * - if #MBEDTLS_CIPHER_PADDING_PKCS7 is enabled at compile
+ * time, this function validates the CBC padding and returns
+ * #MBEDTLS_ERR_PKCS5_PASSWORD_MISMATCH if the padding is
+ * invalid. Note that this can help active adversaries
+ * attempting to brute-forcing the password. Note also that
+ * there is no guarantee that an invalid password will be
+ * detected (the chances of a valid padding with a random
+ * password are about 1/255).
+ * - if #MBEDTLS_CIPHER_PADDING_PKCS7 is disabled at compile
+ * time, this function does not validate the CBC padding.
+ *
* \param pbe_params the ASN.1 algorithm parameters
- * \param mode either MBEDTLS_PKCS5_DECRYPT or MBEDTLS_PKCS5_ENCRYPT
+ * \param mode either #MBEDTLS_PKCS5_DECRYPT or #MBEDTLS_PKCS5_ENCRYPT
* \param pwd password to use when generating key
* \param pwdlen length of password
* \param data data to process
* \param datalen length of data
- * \param output output buffer
+ * \param output Output buffer.
+ * On success, it contains the encrypted or decrypted data,
+ * possibly followed by the CBC padding.
+ * On failure, the content is indeterminate.
+ * For decryption, there must be enough room for \p datalen
+ * bytes.
+ * For encryption, there must be enough room for
+ * \p datalen + 1 bytes, rounded up to the block size of
+ * the block cipher identified by \p pbe_params.
*
* \returns 0 on success, or a MBEDTLS_ERR_XXX code if verification fails.
*/
const unsigned char *data, size_t datalen,
unsigned char *output);
+#if defined(MBEDTLS_CIPHER_PADDING_PKCS7)
+
+/**
+ * \brief PKCS#5 PBES2 function
+ *
+ * \warning When decrypting:
+ * - This function validates the CBC padding and returns
+ * #MBEDTLS_ERR_PKCS5_PASSWORD_MISMATCH if the padding is
+ * invalid. Note that this can help active adversaries
+ * attempting to brute-forcing the password. Note also that
+ * there is no guarantee that an invalid password will be
+ * detected (the chances of a valid padding with a random
+ * password are about 1/255).
+ *
+ * \param pbe_params the ASN.1 algorithm parameters
+ * \param mode either #MBEDTLS_PKCS5_DECRYPT or #MBEDTLS_PKCS5_ENCRYPT
+ * \param pwd password to use when generating key
+ * \param pwdlen length of password
+ * \param data data to process
+ * \param datalen length of data
+ * \param output Output buffer.
+ * On success, it contains the decrypted data.
+ * On failure, the content is indetermidate.
+ * For decryption, there must be enough room for \p datalen
+ * bytes.
+ * For encryption, there must be enough room for
+ * \p datalen + 1 bytes, rounded up to the block size of
+ * the block cipher identified by \p pbe_params.
+ * \param output_size size of output buffer.
+ * This must be big enough to accommodate for output plus
+ * padding data.
+ * \param output_len On success, length of actual data written to the output buffer.
+ *
+ * \returns 0 on success, or a MBEDTLS_ERR_XXX code if parsing or decryption fails.
+ */
+int mbedtls_pkcs5_pbes2_ext(const mbedtls_asn1_buf *pbe_params, int mode,
+ const unsigned char *pwd, size_t pwdlen,
+ const unsigned char *data, size_t datalen,
+ unsigned char *output, size_t output_size,
+ size_t *output_len);
+
+#endif /* MBEDTLS_CIPHER_PADDING_PKCS7 */
+
#endif /* MBEDTLS_ASN1_PARSE_C */
/**
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_PLATFORM_H
#define MBEDTLS_PLATFORM_H
#endif
#endif /* MBEDTLS_PLATFORM_NO_STD_FUNCTIONS */
+/* Enable certain documented defines only when generating doxygen to avoid
+ * an "unrecognized define" error. */
+#if defined(__DOXYGEN__) && !defined(MBEDTLS_PLATFORM_STD_CALLOC)
+#define MBEDTLS_PLATFORM_STD_CALLOC
+#endif
+
+#if defined(__DOXYGEN__) && !defined(MBEDTLS_PLATFORM_STD_FREE)
+#define MBEDTLS_PLATFORM_STD_FREE
+#endif
/** \} name SECTION: Module settings */
/*
* The function pointers for calloc and free.
+ * Please see MBEDTLS_PLATFORM_STD_CALLOC and MBEDTLS_PLATFORM_STD_FREE
+ * in mbedtls_config.h for more information about behaviour and requirements.
*/
#if defined(MBEDTLS_PLATFORM_MEMORY)
#if defined(MBEDTLS_PLATFORM_FREE_MACRO) && \
defined(MBEDTLS_PLATFORM_CALLOC_MACRO)
+#undef mbedtls_free
+#undef mbedtls_calloc
#define mbedtls_free MBEDTLS_PLATFORM_FREE_MACRO
#define mbedtls_calloc MBEDTLS_PLATFORM_CALLOC_MACRO
#else
void (*free_func)(void *));
#endif /* MBEDTLS_PLATFORM_FREE_MACRO && MBEDTLS_PLATFORM_CALLOC_MACRO */
#else /* !MBEDTLS_PLATFORM_MEMORY */
+#undef mbedtls_free
+#undef mbedtls_calloc
#define mbedtls_free free
#define mbedtls_calloc calloc
#endif /* MBEDTLS_PLATFORM_MEMORY && !MBEDTLS_PLATFORM_{FREE,CALLOC}_MACRO */
int mbedtls_platform_set_fprintf(int (*fprintf_func)(FILE *stream, const char *,
...));
#else
+#undef mbedtls_fprintf
#if defined(MBEDTLS_PLATFORM_FPRINTF_MACRO)
#define mbedtls_fprintf MBEDTLS_PLATFORM_FPRINTF_MACRO
#else
*/
int mbedtls_platform_set_printf(int (*printf_func)(const char *, ...));
#else /* !MBEDTLS_PLATFORM_PRINTF_ALT */
+#undef mbedtls_printf
#if defined(MBEDTLS_PLATFORM_PRINTF_MACRO)
#define mbedtls_printf MBEDTLS_PLATFORM_PRINTF_MACRO
#else
int mbedtls_platform_set_snprintf(int (*snprintf_func)(char *s, size_t n,
const char *format, ...));
#else /* MBEDTLS_PLATFORM_SNPRINTF_ALT */
-#if defined(mbedtls_snprintf)
#undef mbedtls_snprintf
-#endif
#if defined(MBEDTLS_PLATFORM_SNPRINTF_MACRO)
#define mbedtls_snprintf MBEDTLS_PLATFORM_SNPRINTF_MACRO
#else
int mbedtls_platform_set_vsnprintf(int (*vsnprintf_func)(char *s, size_t n,
const char *format, va_list arg));
#else /* MBEDTLS_PLATFORM_VSNPRINTF_ALT */
-#if defined(mbedtls_vsnprintf)
#undef mbedtls_vsnprintf
-#endif
#if defined(MBEDTLS_PLATFORM_VSNPRINTF_MACRO)
#define mbedtls_vsnprintf MBEDTLS_PLATFORM_VSNPRINTF_MACRO
#else
*/
int mbedtls_platform_set_exit(void (*exit_func)(int status));
#else
+#undef mbedtls_exit
#if defined(MBEDTLS_PLATFORM_EXIT_MACRO)
#define mbedtls_exit MBEDTLS_PLATFORM_EXIT_MACRO
#else
int (*nv_seed_write_func)(unsigned char *buf, size_t buf_len)
);
#else
+#undef mbedtls_nv_seed_read
+#undef mbedtls_nv_seed_write
#if defined(MBEDTLS_PLATFORM_NV_SEED_READ_MACRO) && \
defined(MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO)
#define mbedtls_nv_seed_read MBEDTLS_PLATFORM_NV_SEED_READ_MACRO
/**
* \file platform_time.h
*
- * \brief mbed TLS Platform time abstraction
+ * \brief Mbed TLS Platform time abstraction
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_PLATFORM_TIME_H
#define MBEDTLS_PLATFORM_TIME_H
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_PLATFORM_UTIL_H
#define MBEDTLS_PLATFORM_UTIL_H
#define MBEDTLS_IGNORE_RETURN(result) ((void) !(result))
#endif
+/* If the following macro is defined, the library is being built by the test
+ * framework, and the framework is going to provide a replacement
+ * mbedtls_platform_zeroize() using a preprocessor macro, so the function
+ * declaration should be omitted. */
+#if !defined(MBEDTLS_TEST_DEFINES_ZEROIZE) //no-check-names
/**
* \brief Securely zeroize a buffer
*
*
*/
void mbedtls_platform_zeroize(void *buf, size_t len);
+#endif
#if defined(MBEDTLS_HAVE_TIME_DATE)
/**
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_POLY1305_H
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_PSA_UTIL_H
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_RIPEMD160_H
#define MBEDTLS_RIPEMD160_H
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_RSA_H
#define MBEDTLS_RSA_H
* \brief This function completes an RSA context from
* a set of imported core parameters.
*
- * To setup an RSA public key, precisely \p N and \p E
+ * To setup an RSA public key, precisely \c N and \c E
* must have been imported.
*
* To setup an RSA private key, sufficient information must
* be present for the other parameters to be derivable.
*
* The default implementation supports the following:
- * <ul><li>Derive \p P, \p Q from \p N, \p D, \p E.</li>
- * <li>Derive \p N, \p D from \p P, \p Q, \p E.</li></ul>
+ * <ul><li>Derive \c P, \c Q from \c N, \c D, \c E.</li>
+ * <li>Derive \c N, \c D from \c P, \c Q, \c E.</li></ul>
* Alternative implementations need not support these.
*
* If this function runs successfully, it guarantees that
* \note This function does not handle message padding.
*
* \note Make sure to set \p input[0] = 0 or ensure that
- * input is smaller than \p N.
+ * input is smaller than \c N.
*
* \return \c 0 on success.
* \return An \c MBEDTLS_ERR_RSA_XXX error code on failure.
* It is the generic wrapper for performing a PKCS#1 decryption
* operation using the \p mode from the context.
*
+ * \warning When \p ctx->padding is set to #MBEDTLS_RSA_PKCS_V15,
+ * mbedtls_rsa_rsaes_pkcs1_v15_decrypt() is called, which is an
+ * inherently dangerous function (CWE-242).
+ *
* \note The output buffer length \c output_max_len should be
* as large as the size \p ctx->len of \p ctx->N (for example,
* 128 Bytes if RSA-1024 is used) to be able to hold an
* \brief This function performs a PKCS#1 v1.5 decryption
* operation (RSAES-PKCS1-v1_5-DECRYPT).
*
+ * \warning This is an inherently dangerous function (CWE-242). Unless
+ * it is used in a side channel free and safe way (eg.
+ * implementing the TLS protocol as per 7.4.7.1 of RFC 5246),
+ * the calling code is vulnerable.
+ *
* \note The output buffer length \c output_max_len should be
* as large as the size \p ctx->len of \p ctx->N, for example,
* 128 Bytes if RSA-1024 is used, to be able to hold an
* verification using the mode from the context.
*
* \note For PKCS#1 v2.1 encoding, see comments on
- * mbedtls_rsa_rsassa_pss_verify() about \p md_alg and
- * \p hash_id.
+ * mbedtls_rsa_rsassa_pss_verify() about \c md_alg and
+ * \c hash_id.
*
* \deprecated It is deprecated and discouraged to call this function
* in #MBEDTLS_RSA_PRIVATE mode. Future versions of the library
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*
*/
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_SHA1_H
#define MBEDTLS_SHA1_H
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_SHA256_H
#define MBEDTLS_SHA256_H
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_SHA512_H
#define MBEDTLS_SHA512_H
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_SSL_H
#define MBEDTLS_SSL_H
#define MBEDTLS_ERR_SSL_CRYPTO_IN_PROGRESS -0x7000
/** Invalid value in SSL config */
#define MBEDTLS_ERR_SSL_BAD_CONFIG -0x5E80
+/** Cache entry not found */
+#define MBEDTLS_ERR_SSL_CACHE_ENTRY_NOT_FOUND -0x5E00
/*
* Various constants
/* Dummy type used only for its size */
union mbedtls_ssl_premaster_secret {
+ unsigned char dummy; /* Make the union non-empty even with SSL disabled */
#if defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED)
unsigned char _pms_rsa[48]; /* RFC 5246 8.1.1 */
#endif
* \param own_cid The address of the readable buffer holding the CID we want
* the peer to use when sending encrypted messages to us.
* This may be \c NULL if \p own_cid_len is \c 0.
- * This parameter is unused if \p enabled is set to
+ * This parameter is unused if \p enable is set to
* MBEDTLS_SSL_CID_DISABLED.
* \param own_cid_len The length of \p own_cid.
- * This parameter is unused if \p enabled is set to
+ * This parameter is unused if \p enable is set to
* MBEDTLS_SSL_CID_DISABLED.
*
* \note The value of \p own_cid_len must match the value of the
*
* \param session The session structure to be saved.
* \param buf The buffer to write the serialized data to. It must be a
- * writeable buffer of at least \p len bytes, or may be \c
- * NULL if \p len is \c 0.
+ * writeable buffer of at least \p buf_len bytes, or may be \c
+ * NULL if \p buf_len is \c 0.
* \param buf_len The number of bytes available for writing in \p buf.
* \param olen The size in bytes of the data that has been or would have
* been written. It must point to a valid \c size_t.
* record headers.
*
* \return \c 0 on success.
- * \return #MBEDTLS_ERR_SSL_BAD_INPUT_DATA if \p own_cid_len
+ * \return #MBEDTLS_ERR_SSL_BAD_INPUT_DATA if \p len
* is too large.
*/
int mbedtls_ssl_conf_cid(mbedtls_ssl_config *conf, size_t len,
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_SSL_CACHE_H
#define MBEDTLS_SSL_CACHE_H
*
* \param data SSL cache context
* \param session session to retrieve entry for
+ *
+ * \return \c 0 on success.
+ * \return #MBEDTLS_ERR_SSL_CACHE_ENTRY_NOT_FOUND if there is
+ * no cache entry with specified session ID found, or
+ * any other negative error code for other failures.
*/
int mbedtls_ssl_cache_get(void *data, mbedtls_ssl_session *session);
*
* \param data SSL cache context
* \param session session to store entry for
+ *
+ * \return \c 0 on success.
+ * \return A negative error code on failure.
*/
int mbedtls_ssl_cache_set(void *data, const mbedtls_ssl_session *session);
/**
* \file ssl_ciphersuites.h
*
- * \brief SSL Ciphersuites for mbed TLS
+ * \brief SSL Ciphersuites for Mbed TLS
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_SSL_CIPHERSUITES_H
#define MBEDTLS_SSL_CIPHERSUITES_H
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_SSL_COOKIE_H
#define MBEDTLS_SSL_COOKIE_H
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_SSL_INTERNAL_H
#define MBEDTLS_SSL_INTERNAL_H
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_SSL_TICKET_H
#define MBEDTLS_SSL_TICKET_H
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_THREADING_H
#define MBEDTLS_THREADING_H
* \brief Set your alternate threading implementation function
* pointers and initialize global mutexes. If used, this
* function must be called once in the main thread before any
- * other mbed TLS function is called, and
+ * other Mbed TLS function is called, and
* mbedtls_threading_free_alt() must be called once in the main
- * thread after all other mbed TLS functions.
+ * thread after all other Mbed TLS functions.
*
* \note mutex_init() and mutex_free() don't return a status code.
* If mutex_init() fails, it should leave its argument (the
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_TIMING_H
#define MBEDTLS_TIMING_H
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
/*
* This set of compile-time defines and run-time variables can be used to
- * determine the version number of the mbed TLS library used.
+ * determine the version number of the Mbed TLS library used.
*/
#ifndef MBEDTLS_VERSION_H
#define MBEDTLS_VERSION_H
*/
#define MBEDTLS_VERSION_MAJOR 2
#define MBEDTLS_VERSION_MINOR 28
-#define MBEDTLS_VERSION_PATCH 3
+#define MBEDTLS_VERSION_PATCH 8
/**
* The single version number has the following structure:
* MMNNPP00
* Major version | Minor version | Patch version
*/
-#define MBEDTLS_VERSION_NUMBER 0x021C0300
-#define MBEDTLS_VERSION_STRING "2.28.3"
-#define MBEDTLS_VERSION_STRING_FULL "mbed TLS 2.28.3"
+#define MBEDTLS_VERSION_NUMBER 0x021C0800
+#define MBEDTLS_VERSION_STRING "2.28.8"
+#define MBEDTLS_VERSION_STRING_FULL "Mbed TLS 2.28.8"
#if defined(MBEDTLS_VERSION_C)
void mbedtls_version_get_string(char *string);
/**
- * Get the full version string ("mbed TLS x.y.z").
+ * Get the full version string ("Mbed TLS x.y.z").
*
- * \param string The string that will receive the value. The mbed TLS version
+ * \param string The string that will receive the value. The Mbed TLS version
* string will use 18 bytes AT MOST including a terminating
* null byte.
* (So the buffer should be at least 18 bytes to receive this
/**
* \brief Check if support for a feature was compiled into this
- * mbed TLS binary. This allows you to see at runtime if the
+ * Mbed TLS binary. This allows you to see at runtime if the
* library was for instance compiled with or without
* Multi-threading support.
*
* \note only checks against defines in the sections "System
- * support", "mbed TLS modules" and "mbed TLS feature
+ * support", "Mbed TLS modules" and "Mbed TLS feature
* support" in config.h
*
* \param feature The string for the define to check (e.g. "MBEDTLS_AES_C")
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_X509_H
#define MBEDTLS_X509_H
mbedtls_asn1_named_data *first);
int mbedtls_x509_write_sig(unsigned char **p, unsigned char *start,
const char *oid, size_t oid_len,
- unsigned char *sig, size_t size);
+ unsigned char *sig, size_t size,
+ mbedtls_pk_type_t pk_alg);
#define MBEDTLS_X509_SAFE_SNPRINTF \
do { \
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_X509_CRL_H
#define MBEDTLS_X509_CRL_H
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_X509_CRT_H
#define MBEDTLS_X509_CRT_H
* \param san_buf The buffer holding the raw data item of the subject
* alternative name.
* \param san The target structure to populate with the parsed presentation
- * of the subject alternative name encoded in \p san_raw.
+ * of the subject alternative name encoded in \p san_buf.
*
* \note Only "dnsName" and "otherName" of type hardware_module_name
* as defined in RFC 4180 is supported.
* \note This function should be called on a single raw data of
* subject alternative name. For example, after successful
* certificate parsing, one must iterate on every item in the
- * \p crt->subject_alt_names sequence, and pass it to
+ * \c crt->subject_alt_names sequence, and pass it to
* this function.
*
* \warning The target structure contains pointers to the raw data of the
* \brief Set the issuer name for a Certificate
* Issuer names should contain a comma-separated list
* of OID types and values:
- * e.g. "C=UK,O=ARM,CN=mbed TLS CA"
+ * e.g. "C=UK,O=ARM,CN=Mbed TLS CA"
*
* \param ctx CRT context to use
* \param issuer_name issuer name to set
* \brief Set the subject name for a Certificate
* Subject names should contain a comma-separated list
* of OID types and values:
- * e.g. "C=UK,O=ARM,CN=mbed TLS Server 1"
+ * e.g. "C=UK,O=ARM,CN=Mbed TLS Server 1"
*
* \param ctx CRT context to use
* \param subject_name subject name to set
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_X509_CSR_H
#define MBEDTLS_X509_CSR_H
* \brief Set the subject name for a CSR
* Subject names should contain a comma-separated list
* of OID types and values:
- * e.g. "C=UK,O=ARM,CN=mbed TLS Server 1"
+ * e.g. "C=UK,O=ARM,CN=Mbed TLS Server 1"
*
* \param ctx CSR context to use
* \param subject_name subject name to set
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef MBEDTLS_XTEA_H
#define MBEDTLS_XTEA_H
* RFC 1321 compliant MD5 implementation
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
/*
* The MD5 algorithm was designed by Ron Rivest in 1991.
* Version information
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#include "common.h"
/**
* \file md.c
*
- * \brief Generic message digest wrapper for mbed TLS
+ * \brief Generic message digest wrapper for Mbed TLS
*
* \author Adriaan de Jong <dejong@fox-it.com>
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#include "common.h"
* RFC 1115/1319 compliant MD2 implementation
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
/*
* The MD2 algorithm was designed by Ron Rivest in 1989.
* RFC 1186/1320 compliant MD4 implementation
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
/*
* The MD4 algorithm was designed by Ron Rivest in 1990.
* Buffer-based memory allocator
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#include "common.h"
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * This file is part of mbed TLS (https://tls.mbed.org)
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
/**
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * This file is part of mbed TLS (https://tls.mbed.org)
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
/**
* Message Processing Stack, Reader implementation
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * This file is part of Mbed TLS (https://tls.mbed.org)
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#include "common.h"
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * This file is part of mbed TLS (https://tls.mbed.org)
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
/**
* Message Processing Stack, Trace module
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * This file is part of Mbed TLS (https://tls.mbed.org)
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#include "common.h"
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * This file is part of mbed TLS (https://tls.mbed.org)
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
/**
* TCP/IP or UDP/IP networking functions
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
/* Enable definition of getaddrinfo() even when compiling with -std=c99. Must
#include <errno.h>
#define IS_EINTR(ret) ((ret) == EINTR)
+#define SOCKET int
#endif /* ( _WIN32 || _WIN32_WCE ) && !EFIX64 && !EFI32 */
*/
int mbedtls_net_accept(mbedtls_net_context *bind_ctx,
mbedtls_net_context *client_ctx,
- void *client_ip, size_t buf_size, size_t *ip_len)
+ void *client_ip, size_t buf_size, size_t *cip_len)
{
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
int type;
if (client_ip != NULL) {
if (client_addr.ss_family == AF_INET) {
struct sockaddr_in *addr4 = (struct sockaddr_in *) &client_addr;
- *ip_len = sizeof(addr4->sin_addr.s_addr);
+ *cip_len = sizeof(addr4->sin_addr.s_addr);
- if (buf_size < *ip_len) {
+ if (buf_size < *cip_len) {
return MBEDTLS_ERR_NET_BUFFER_TOO_SMALL;
}
- memcpy(client_ip, &addr4->sin_addr.s_addr, *ip_len);
+ memcpy(client_ip, &addr4->sin_addr.s_addr, *cip_len);
} else {
struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *) &client_addr;
- *ip_len = sizeof(addr6->sin6_addr.s6_addr);
+ *cip_len = sizeof(addr6->sin6_addr.s6_addr);
- if (buf_size < *ip_len) {
+ if (buf_size < *cip_len) {
return MBEDTLS_ERR_NET_BUFFER_TOO_SMALL;
}
- memcpy(client_ip, &addr6->sin6_addr.s6_addr, *ip_len);
+ memcpy(client_ip, &addr6->sin6_addr.s6_addr, *cip_len);
}
}
FD_ZERO(&read_fds);
if (rw & MBEDTLS_NET_POLL_READ) {
rw &= ~MBEDTLS_NET_POLL_READ;
- FD_SET(fd, &read_fds);
+ FD_SET((SOCKET) fd, &read_fds);
}
FD_ZERO(&write_fds);
if (rw & MBEDTLS_NET_POLL_WRITE) {
rw &= ~MBEDTLS_NET_POLL_WRITE;
- FD_SET(fd, &write_fds);
+ FD_SET((SOCKET) fd, &write_fds);
}
if (rw != 0) {
}
FD_ZERO(&read_fds);
- FD_SET(fd, &read_fds);
+ FD_SET((SOCKET) fd, &read_fds);
tv.tv_sec = timeout / 1000;
tv.tv_usec = (timeout % 1000) * 1000;
* only
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
/*
* Definition of Key Wrapping:
#include "mbedtls/platform_util.h"
#include "mbedtls/error.h"
#include "mbedtls/constant_time.h"
+#include "constant_time_internal.h"
#include <stdint.h>
#include <string.h>
int ret = 0;
size_t i, olen;
unsigned char A[KW_SEMIBLOCK_LENGTH];
- unsigned char diff, bad_padding = 0;
+ unsigned char diff;
*out_len = 0;
if (out_size < in_len - KW_SEMIBLOCK_LENGTH) {
* larger than 8, because of the type wrap around.
*/
padlen = in_len - KW_SEMIBLOCK_LENGTH - Plen;
- if (padlen > 7) {
- padlen &= 7;
- ret = MBEDTLS_ERR_CIPHER_AUTH_FAILED;
- }
+ ret = -(int) mbedtls_ct_uint_if(padlen & ~7, -MBEDTLS_ERR_CIPHER_AUTH_FAILED, -ret);
+ padlen &= 7;
/* Check padding in "constant-time" */
for (diff = 0, i = 0; i < KW_SEMIBLOCK_LENGTH; i++) {
- if (i >= KW_SEMIBLOCK_LENGTH - padlen) {
- diff |= output[*out_len - KW_SEMIBLOCK_LENGTH + i];
- } else {
- bad_padding |= output[*out_len - KW_SEMIBLOCK_LENGTH + i];
- }
+ size_t mask = mbedtls_ct_size_mask_ge(i, KW_SEMIBLOCK_LENGTH - padlen);
+ diff |= (unsigned char) (mask & output[*out_len - KW_SEMIBLOCK_LENGTH + i]);
}
if (diff != 0) {
*out_len = 0;
}
- mbedtls_platform_zeroize(&bad_padding, sizeof(bad_padding));
mbedtls_platform_zeroize(&diff, sizeof(diff));
mbedtls_platform_zeroize(A, sizeof(A));
* \brief Object Identifier (OID) database
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#include "common.h"
* VIA PadLock support functions
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
/*
* This implementation is based on the VIA PadLock Programming Guide:
#endif
/* *INDENT-ON* */
-#if defined(MBEDTLS_HAVE_X86)
+#if defined(MBEDTLS_VIA_PADLOCK_HAVE_CODE)
/*
* PadLock detection routine
return 0;
}
-#endif /* MBEDTLS_HAVE_X86 */
+#endif /* MBEDTLS_VIA_PADLOCK_HAVE_CODE */
#endif /* MBEDTLS_PADLOCK_C */
* Privacy Enhanced Mail (PEM) decoding
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#include "common.h"
* Public Key abstraction layer
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#include "common.h"
psa_key_type_t key_type;
size_t bits;
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
+ psa_status_t status;
/* export the private key material in the format PSA wants */
if (mbedtls_pk_get_type(pk) != MBEDTLS_PK_ECKEY) {
psa_set_key_algorithm(&attributes, PSA_ALG_ECDSA(hash_alg));
/* import private key into PSA */
- if (PSA_SUCCESS != psa_import_key(&attributes, d, d_len, key)) {
+ status = psa_import_key(&attributes, d, d_len, key);
+ mbedtls_platform_zeroize(d, sizeof(d));
+ if (status != PSA_SUCCESS) {
return MBEDTLS_ERR_PK_HW_ACCEL_FAILED;
}
* Public Key abstraction layer: wrapper functions
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#include "common.h"
static size_t rsa_get_bitlen(const void *ctx)
{
const mbedtls_rsa_context *rsa = (const mbedtls_rsa_context *) ctx;
- return 8 * mbedtls_rsa_get_len(rsa);
+ /* Unfortunately, the rsa.h interface does not have a direct way
+ * to access the bit-length that works with MBEDTLS_RSA_ALT.
+ * So we have to do a little work here.
+ */
+ mbedtls_mpi N;
+ mbedtls_mpi_init(&N);
+ int ret = mbedtls_rsa_export(rsa, &N, NULL, NULL, NULL, NULL);
+ /* If the export fails for some reason (e.g. the RSA_ALT implementation
+ * does not support export, or there is not enough memory),
+ * we have no way of returning an error from this function.
+ * As a fallback, return the byte-length converted in bits, which is
+ * the correct value if the modulus size is a multiple of 8 bits, which
+ * is very often the case in practice. */
+ size_t bitlen = (ret == 0 ? mbedtls_mpi_bitlen(&N) :
+ 8 * mbedtls_rsa_get_len(rsa));
+ mbedtls_mpi_free(&N);
+ return bitlen;
}
static int rsa_verify_wrap(void *ctx, mbedtls_md_type_t md_alg,
* \author Adriaan de Jong <dejong@fox-it.com>
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#include "mbedtls/pkcs11.h"
* PKCS#12 Personal Information Exchange Syntax
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
/*
* The PKCS #12 Personal Information Exchange Syntax Standard v1.1
#endif /* MBEDTLS_ARC4_C */
}
+#if !defined(MBEDTLS_CIPHER_PADDING_PKCS7)
+int mbedtls_pkcs12_pbe_ext(mbedtls_asn1_buf *pbe_params, int mode,
+ mbedtls_cipher_type_t cipher_type, mbedtls_md_type_t md_type,
+ const unsigned char *pwd, size_t pwdlen,
+ const unsigned char *data, size_t len,
+ unsigned char *output, size_t output_size,
+ size_t *output_len);
+#endif
+
int mbedtls_pkcs12_pbe(mbedtls_asn1_buf *pbe_params, int mode,
mbedtls_cipher_type_t cipher_type, mbedtls_md_type_t md_type,
const unsigned char *pwd, size_t pwdlen,
const unsigned char *data, size_t len,
unsigned char *output)
+{
+ size_t output_len = 0;
+
+ /* We assume caller of the function is providing a big enough output buffer
+ * so we pass output_size as SIZE_MAX to pass checks, However, no guarantees
+ * for the output size actually being correct.
+ */
+ return mbedtls_pkcs12_pbe_ext(pbe_params, mode, cipher_type, md_type,
+ pwd, pwdlen, data, len, output, SIZE_MAX,
+ &output_len);
+}
+
+int mbedtls_pkcs12_pbe_ext(mbedtls_asn1_buf *pbe_params, int mode,
+ mbedtls_cipher_type_t cipher_type, mbedtls_md_type_t md_type,
+ const unsigned char *pwd, size_t pwdlen,
+ const unsigned char *data, size_t len,
+ unsigned char *output, size_t output_size,
+ size_t *output_len)
{
int ret, keylen = 0;
unsigned char key[32];
unsigned char iv[16];
const mbedtls_cipher_info_t *cipher_info;
mbedtls_cipher_context_t cipher_ctx;
- size_t olen = 0;
+ size_t finish_olen = 0;
+ unsigned int padlen = 0;
if (pwd == NULL && pwdlen != 0) {
return MBEDTLS_ERR_PKCS12_BAD_INPUT_DATA;
keylen = cipher_info->key_bitlen / 8;
+ if (mode == MBEDTLS_PKCS12_PBE_DECRYPT) {
+ if (output_size < len) {
+ return MBEDTLS_ERR_ASN1_BUF_TOO_SMALL;
+ }
+ }
+
+ if (mode == MBEDTLS_PKCS12_PBE_ENCRYPT) {
+ padlen = cipher_info->block_size - (len % cipher_info->block_size);
+ if (output_size < (len + padlen)) {
+ return MBEDTLS_ERR_ASN1_BUF_TOO_SMALL;
+ }
+ }
+
if ((ret = pkcs12_pbe_derive_key_iv(pbe_params, md_type, pwd, pwdlen,
key, keylen,
iv, cipher_info->iv_size)) != 0) {
goto exit;
}
+#if defined(MBEDTLS_CIPHER_MODE_WITH_PADDING)
+ {
+ /* PKCS12 uses CBC with PKCS7 padding */
+ mbedtls_cipher_padding_t padding = MBEDTLS_PADDING_PKCS7;
+#if !defined(MBEDTLS_CIPHER_PADDING_PKCS7)
+ /* For historical reasons, when decrypting, this function works when
+ * decrypting even when support for PKCS7 padding is disabled. In this
+ * case, it ignores the padding, and so will never report a
+ * password mismatch.
+ */
+ if (mode == MBEDTLS_PKCS12_PBE_DECRYPT) {
+ padding = MBEDTLS_PADDING_NONE;
+ }
+#endif
+ if ((ret = mbedtls_cipher_set_padding_mode(&cipher_ctx, padding)) != 0) {
+ goto exit;
+ }
+ }
+#endif /* MBEDTLS_CIPHER_MODE_WITH_PADDING */
+
if ((ret = mbedtls_cipher_set_iv(&cipher_ctx, iv, cipher_info->iv_size)) != 0) {
goto exit;
}
}
if ((ret = mbedtls_cipher_update(&cipher_ctx, data, len,
- output, &olen)) != 0) {
+ output, output_len)) != 0) {
goto exit;
}
- if ((ret = mbedtls_cipher_finish(&cipher_ctx, output + olen, &olen)) != 0) {
+ if ((ret = mbedtls_cipher_finish(&cipher_ctx, output + (*output_len), &finish_olen)) != 0) {
ret = MBEDTLS_ERR_PKCS12_PASSWORD_MISMATCH;
}
+ *output_len += finish_olen;
+
exit:
mbedtls_platform_zeroize(key, sizeof(key));
mbedtls_platform_zeroize(iv, sizeof(iv));
* \author Mathias Olsson <mathias@kompetensum.com>
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
/*
* PKCS#5 includes PBKDF2 and more
#include "mbedtls/platform.h"
+
#if defined(MBEDTLS_ASN1_PARSE_C)
static int pkcs5_parse_pbkdf2_params(const mbedtls_asn1_buf *params,
mbedtls_asn1_buf *salt, int *iterations,
return 0;
}
+#if !defined(MBEDTLS_CIPHER_PADDING_PKCS7)
+int mbedtls_pkcs5_pbes2_ext(const mbedtls_asn1_buf *pbe_params, int mode,
+ const unsigned char *pwd, size_t pwdlen,
+ const unsigned char *data, size_t datalen,
+ unsigned char *output, size_t output_size,
+ size_t *output_len);
+#endif
+
int mbedtls_pkcs5_pbes2(const mbedtls_asn1_buf *pbe_params, int mode,
const unsigned char *pwd, size_t pwdlen,
const unsigned char *data, size_t datalen,
unsigned char *output)
+{
+ size_t output_len = 0;
+
+ /* We assume caller of the function is providing a big enough output buffer
+ * so we pass output_size as SIZE_MAX to pass checks, However, no guarantees
+ * for the output size actually being correct.
+ */
+ return mbedtls_pkcs5_pbes2_ext(pbe_params, mode, pwd, pwdlen, data,
+ datalen, output, SIZE_MAX, &output_len);
+}
+
+int mbedtls_pkcs5_pbes2_ext(const mbedtls_asn1_buf *pbe_params, int mode,
+ const unsigned char *pwd, size_t pwdlen,
+ const unsigned char *data, size_t datalen,
+ unsigned char *output, size_t output_size,
+ size_t *output_len)
{
int ret, iterations = 0, keylen = 0;
unsigned char *p, *end;
mbedtls_asn1_buf salt;
mbedtls_md_type_t md_type = MBEDTLS_MD_SHA1;
unsigned char key[32], iv[32];
- size_t olen = 0;
const mbedtls_md_info_t *md_info;
const mbedtls_cipher_info_t *cipher_info;
mbedtls_md_context_t md_ctx;
mbedtls_cipher_type_t cipher_alg;
mbedtls_cipher_context_t cipher_ctx;
+ unsigned int padlen = 0;
p = pbe_params->p;
end = p + pbe_params->len;
return MBEDTLS_ERR_PKCS5_INVALID_FORMAT;
}
+ if (mode == MBEDTLS_PKCS5_DECRYPT) {
+ if (output_size < datalen) {
+ return MBEDTLS_ERR_ASN1_BUF_TOO_SMALL;
+ }
+ }
+
+ if (mode == MBEDTLS_PKCS5_ENCRYPT) {
+ padlen = cipher_info->block_size - (datalen % cipher_info->block_size);
+ if (output_size < (datalen + padlen)) {
+ return MBEDTLS_ERR_ASN1_BUF_TOO_SMALL;
+ }
+ }
+
mbedtls_md_init(&md_ctx);
+
mbedtls_cipher_init(&cipher_ctx);
memcpy(iv, enc_scheme_params.p, enc_scheme_params.len);
goto exit;
}
+#if defined(MBEDTLS_CIPHER_MODE_WITH_PADDING)
+ {
+ /* PKCS5 uses CBC with PKCS7 padding (which is the same as
+ * "PKCS5 padding" except that it's typically only called PKCS5
+ * with 64-bit-block ciphers).
+ */
+ mbedtls_cipher_padding_t padding = MBEDTLS_PADDING_PKCS7;
+#if !defined(MBEDTLS_CIPHER_PADDING_PKCS7)
+ /* For historical reasons, when decrypting, this function works when
+ * decrypting even when support for PKCS7 padding is disabled. In this
+ * case, it ignores the padding, and so will never report a
+ * password mismatch.
+ */
+ if (mode == MBEDTLS_DECRYPT) {
+ padding = MBEDTLS_PADDING_NONE;
+ }
+#endif
+ if ((ret = mbedtls_cipher_set_padding_mode(&cipher_ctx, padding)) != 0) {
+ goto exit;
+ }
+ }
+#endif /* MBEDTLS_CIPHER_MODE_WITH_PADDING */
if ((ret = mbedtls_cipher_crypt(&cipher_ctx, iv, enc_scheme_params.len,
- data, datalen, output, &olen)) != 0) {
+ data, datalen, output, output_len)) != 0) {
ret = MBEDTLS_ERR_PKCS5_PASSWORD_MISMATCH;
}
* Public Key layer for parsing key files and structures
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#include "common.h"
mbedtls_pem_context pem;
#endif
+ (void) pk_info;
+
PK_VALIDATE_RET(pk != NULL);
if (keylen == 0) {
return MBEDTLS_ERR_PK_KEY_INVALID_FORMAT;
* Public Key layer for writing key files and structures
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#include "common.h"
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
size_t len = 0;
+ (void) p;
+ (void) start;
+ (void) key;
+ (void) ret;
+
PK_VALIDATE_RET(p != NULL);
PK_VALIDATE_RET(*p != NULL);
PK_VALIDATE_RET(start != NULL);
unsigned char *c;
size_t len = 0;
+ (void) ret;
+ (void) c;
+ (void) key;
+
PK_VALIDATE_RET(key != NULL);
if (size == 0) {
return MBEDTLS_ERR_ASN1_BUF_TOO_SMALL;
int mbedtls_pk_write_pubkey_pem(mbedtls_pk_context *key, unsigned char *buf, size_t size)
{
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
- unsigned char output_buf[PUB_DER_MAX_BYTES];
+ unsigned char *output_buf = NULL;
+ output_buf = mbedtls_calloc(1, PUB_DER_MAX_BYTES);
+ if (output_buf == NULL) {
+ return MBEDTLS_ERR_PK_ALLOC_FAILED;
+ }
size_t olen = 0;
PK_VALIDATE_RET(key != NULL);
PK_VALIDATE_RET(buf != NULL || size == 0);
if ((ret = mbedtls_pk_write_pubkey_der(key, output_buf,
- sizeof(output_buf))) < 0) {
- return ret;
+ PUB_DER_MAX_BYTES)) < 0) {
+ goto cleanup;
}
if ((ret = mbedtls_pem_write_buffer(PEM_BEGIN_PUBLIC_KEY, PEM_END_PUBLIC_KEY,
- output_buf + sizeof(output_buf) - ret,
+ output_buf + PUB_DER_MAX_BYTES - ret,
ret, buf, size, &olen)) != 0) {
- return ret;
+ goto cleanup;
}
- return 0;
+ ret = 0;
+cleanup:
+ mbedtls_free(output_buf);
+ return ret;
}
int mbedtls_pk_write_key_pem(mbedtls_pk_context *key, unsigned char *buf, size_t size)
{
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
- unsigned char output_buf[PRV_DER_MAX_BYTES];
+ unsigned char *output_buf = NULL;
+ output_buf = mbedtls_calloc(1, PRV_DER_MAX_BYTES);
+ if (output_buf == NULL) {
+ return MBEDTLS_ERR_PK_ALLOC_FAILED;
+ }
const char *begin, *end;
size_t olen = 0;
PK_VALIDATE_RET(key != NULL);
PK_VALIDATE_RET(buf != NULL || size == 0);
- if ((ret = mbedtls_pk_write_key_der(key, output_buf, sizeof(output_buf))) < 0) {
- return ret;
+ if ((ret = mbedtls_pk_write_key_der(key, output_buf, PRV_DER_MAX_BYTES)) < 0) {
+ goto cleanup;
}
#if defined(MBEDTLS_RSA_C)
end = PEM_END_PRIVATE_KEY_EC;
} else
#endif
- return MBEDTLS_ERR_PK_FEATURE_UNAVAILABLE;
+ {
+ ret = MBEDTLS_ERR_PK_FEATURE_UNAVAILABLE;
+ goto cleanup;
+ }
if ((ret = mbedtls_pem_write_buffer(begin, end,
- output_buf + sizeof(output_buf) - ret,
+ output_buf + PRV_DER_MAX_BYTES - ret,
ret, buf, size, &olen)) != 0) {
- return ret;
+ goto cleanup;
}
- return 0;
+ ret = 0;
+cleanup:
+ mbedtls_platform_zeroize(output_buf, PRV_DER_MAX_BYTES);
+ mbedtls_free(output_buf);
+ return ret;
}
#endif /* MBEDTLS_PEM_WRITE_C */
* Platform abstraction layer
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#include "common.h"
* library.
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
/*
#include <time.h>
#if !defined(_WIN32) && (defined(unix) || \
defined(__unix) || defined(__unix__) || (defined(__APPLE__) && \
- defined(__MACH__)))
+ defined(__MACH__)) || defined(__midipix__))
#include <unistd.h>
#endif /* !_WIN32 && (unix || __unix || __unix__ ||
- * (__APPLE__ && __MACH__)) */
+ * (__APPLE__ && __MACH__)) || __midipix__ */
#if !((defined(_POSIX_VERSION) && _POSIX_VERSION >= 200809L) || \
(defined(_POSIX_THREAD_SAFE_FUNCTIONS) && \
* \brief Poly1305 authentication algorithm.
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#include "common.h"
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef PSA_CRYPTO_H
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef PSA_CRYPTO_BUILTIN_COMPOSITES_H
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef PSA_CRYPTO_BUILTIN_PRIMITIVES_H
*
* This header declares alternative names for macro and functions.
* New application code should not use these names.
- * These names may be removed in a future version of Mbed Crypto.
+ * These names may be removed in a future version of Mbed TLS.
*
* \note This file may not be included directly. Applications must
* include psa/crypto.h.
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef PSA_CRYPTO_COMPAT_H
#endif
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef PSA_CRYPTO_CONFIG_H
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef PSA_CRYPTO_DRIVER_COMMON_H
#define PSA_CRYPTO_DRIVER_COMMON_H
* to define the implementation-defined types of PSA multi-part state objects.
*/
/* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef PSA_CRYPTO_DRIVER_CONTEXTS_COMPOSITES_H
* to define the implementation-defined types of PSA multi-part state objects.
*/
/* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef PSA_CRYPTO_DRIVER_CONTEXTS_PRIMITIVES_H
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef PSA_CRYPTO_EXTRA_H
* indicates the slot number that contains it.
* \retval #PSA_ERROR_NOT_PERMITTED
* The caller is not permitted to query the slot number.
- * Mbed Crypto currently does not return this error.
+ * Mbed TLS currently does not return this error.
* \retval #PSA_ERROR_INVALID_ARGUMENT
* The key is not located in a secure element.
*/
* resource consumption related to the PSA keystore.
*
* \note The content of this structure is not part of the stable API and ABI
- * of Mbed Crypto and may change arbitrarily from version to version.
+ * of Mbed TLS and may change arbitrarily from version to version.
*/
typedef struct mbedtls_psa_stats_s {
/** Number of slots containing key material for a volatile key. */
/** \brief Get statistics about
* resource consumption related to the PSA keystore.
*
- * \note When Mbed Crypto is built as part of a service, with isolation
+ * \note When Mbed TLS is built as part of a service, with isolation
* between the application and the keystore, the service may or
* may not expose this function.
*/
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef PSA_CRYPTO_PLATFORM_H
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef PSA_CRYPTO_SE_DRIVER_H
#define PSA_CRYPTO_SE_DRIVER_H
psa_key_location_t location);
#if defined(__DOXYGEN_ONLY__) || !defined(MBEDTLS_PSA_CRYPTO_SE_C)
-/* Mbed Crypto with secure element support enabled defines this type in
+/* Mbed TLS with secure element support enabled defines this type in
* crypto_types.h because it is also visible to applications through an
* implementation-specific extension.
* For the PSA Cryptography specification, this type is only visible
* and #PSA_ERROR_DOES_NOT_EXIST if the driver can determine that there
* is no key with the specified slot number.
*
- * This is an Mbed Crypto extension.
+ * This is an Mbed TLS extension.
*/
PSA_KEY_CREATION_REGISTER,
#endif
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef PSA_CRYPTO_SIZES_H
* GCC and Clang initialize the whole structure to 0 (at the time of writing),
* but MSVC and CompCert don't.
*
- * In Mbed Crypto, multipart operation structures live independently from
- * the key. This allows Mbed Crypto to free the key objects when destroying
+ * In Mbed TLS, multipart operation structures live independently from
+ * the key. This allows Mbed TLS to free the key objects when destroying
* a key slot. If a multipart operation needs to remember the key after
* the setup function returns, the operation structure needs to contain a
* copy of the key.
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef PSA_CRYPTO_STRUCT_H
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef PSA_CRYPTO_TYPES_H
typedef psa_key_id_t mbedtls_svc_key_id_t;
#else /* MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER */
-/* Implementation-specific: The Mbed Cryptography library can be built as
+/* Implementation-specific: The Mbed TLS library can be built as
* part of a multi-client service that exposes the PSA Cryptography API in each
* client and encodes the client identity in the key identifier argument of
* functions such as psa_open_key().
#ifndef __DOXYGEN_ONLY__
#if defined(MBEDTLS_PSA_CRYPTO_SE_C)
-/* Mbed Crypto defines this type in crypto_types.h because it is also
+/* Mbed TLS defines this type in crypto_types.h because it is also
* visible to applications through an implementation-specific extension.
* For the PSA Cryptography specification, this type is only visible
* via crypto_se_driver.h. */
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef PSA_CRYPTO_VALUES_H
((type) | PSA_KEY_TYPE_CATEGORY_FLAG_PAIR)
/** The public key type corresponding to a key pair type.
*
- * You may also pass a key pair type as \p type, it will be left unchanged.
+ * You may also pass a public key type as \p type, it will be left unchanged.
*
* \param type A public key type or key pair type.
*
* They are defined in _Standards for Efficient Cryptography_,
* _SEC 2: Recommended Elliptic Curve Domain Parameters_.
* https://www.secg.org/sec2-v2.pdf
+ *
+ * \note For secp224k1, the bit-size is 225 (size of a private value).
+ *
+ * \note Mbed TLS only supports secp192k1 and secp256k1.
*/
#define PSA_ECC_FAMILY_SECP_K1 ((psa_ecc_family_t) 0x17)
/** SEC random curves over prime fields.
*
* This family comprises the following curves:
- * secp192k1, secp224r1, secp256r1, secp384r1, secp521r1.
+ * secp192r1, secp224r1, secp256r1, secp384r1, secp521r1.
* They are defined in _Standards for Efficient Cryptography_,
* _SEC 2: Recommended Elliptic Curve Domain Parameters_.
* https://www.secg.org/sec2-v2.pdf
*/
#define PSA_ECC_FAMILY_SECP_R1 ((psa_ecc_family_t) 0x12)
-/* SECP160R2 (SEC2 v1, obsolete) */
+/* SECP160R2 (SEC2 v1, obsolete, not supported in Mbed TLS) */
#define PSA_ECC_FAMILY_SECP_R2 ((psa_ecc_family_t) 0x1b)
/** SEC Koblitz curves over binary fields.
* They are defined in _Standards for Efficient Cryptography_,
* _SEC 2: Recommended Elliptic Curve Domain Parameters_.
* https://www.secg.org/sec2-v2.pdf
+ *
+ * \note Mbed TLS does not support any curve in this family.
*/
#define PSA_ECC_FAMILY_SECT_K1 ((psa_ecc_family_t) 0x27)
* They are defined in _Standards for Efficient Cryptography_,
* _SEC 2: Recommended Elliptic Curve Domain Parameters_.
* https://www.secg.org/sec2-v2.pdf
+ *
+ * \note Mbed TLS does not support any curve in this family.
*/
#define PSA_ECC_FAMILY_SECT_R1 ((psa_ecc_family_t) 0x22)
* It is defined in _Standards for Efficient Cryptography_,
* _SEC 2: Recommended Elliptic Curve Domain Parameters_.
* https://www.secg.org/sec2-v2.pdf
+ *
+ * \note Mbed TLS does not support any curve in this family.
*/
#define PSA_ECC_FAMILY_SECT_R2 ((psa_ecc_family_t) 0x2b)
* brainpoolP160r1, brainpoolP192r1, brainpoolP224r1, brainpoolP256r1,
* brainpoolP320r1, brainpoolP384r1, brainpoolP512r1.
* It is defined in RFC 5639.
+ *
+ * \note Mbed TLS only supports the 256-bit, 384-bit and 512-bit curves
+ * in this family.
*/
#define PSA_ECC_FAMILY_BRAINPOOL_P_R1 ((psa_ecc_family_t) 0x30)
* - 448-bit: Edwards448, the twisted Edwards curve birationally equivalent
* to Curve448.
* Hamburg, _Ed448-Goldilocks, a new elliptic curve_, NIST ECC Workshop, 2015.
+ *
+ * \note Mbed TLS does not support Edwards curves yet.
*/
#define PSA_ECC_FAMILY_TWISTED_EDWARDS ((psa_ecc_family_t) 0x42)
0)
/** RSA PKCS#1 v1.5 encryption.
+ *
+ * \warning Calling psa_asymmetric_decrypt() with this algorithm as a
+ * parameter is considered an inherently dangerous function
+ * (CWE-242). Unless it is used in a side channel free and safe
+ * way (eg. implementing the TLS protocol as per 7.4.7.1 of
+ * RFC 5246), the calling code is vulnerable.
+ *
*/
#define PSA_ALG_RSA_PKCS1V15_CRYPT ((psa_algorithm_t) 0x07000200)
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#include "common.h"
if (global_data.initialized == 0) \
return PSA_ERROR_BAD_STATE;
+#if !defined(MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS)
+
+/* Declare a local copy of an input buffer and a variable that will be used
+ * to store a pointer to the start of the buffer.
+ *
+ * Note: This macro must be called before any operations which may jump to
+ * the exit label, so that the local input copy object is safe to be freed.
+ *
+ * Assumptions:
+ * - input is the name of a pointer to the buffer to be copied
+ * - The name LOCAL_INPUT_COPY_OF_input is unused in the current scope
+ * - input_copy_name is a name that is unused in the current scope
+ */
+#define LOCAL_INPUT_DECLARE(input, input_copy_name) \
+ psa_crypto_local_input_t LOCAL_INPUT_COPY_OF_##input = PSA_CRYPTO_LOCAL_INPUT_INIT; \
+ const uint8_t *input_copy_name = NULL;
+
+/* Allocate a copy of the buffer input and set the pointer input_copy to
+ * point to the start of the copy.
+ *
+ * Assumptions:
+ * - psa_status_t status exists
+ * - An exit label is declared
+ * - input is the name of a pointer to the buffer to be copied
+ * - LOCAL_INPUT_DECLARE(input, input_copy) has previously been called
+ */
+#define LOCAL_INPUT_ALLOC(input, length, input_copy) \
+ status = psa_crypto_local_input_alloc(input, length, \
+ &LOCAL_INPUT_COPY_OF_##input); \
+ if (status != PSA_SUCCESS) { \
+ goto exit; \
+ } \
+ input_copy = LOCAL_INPUT_COPY_OF_##input.buffer;
+
+/* Free the local input copy allocated previously by LOCAL_INPUT_ALLOC()
+ *
+ * Assumptions:
+ * - input_copy is the name of the input copy pointer set by LOCAL_INPUT_ALLOC()
+ * - input is the name of the original buffer that was copied
+ */
+#define LOCAL_INPUT_FREE(input, input_copy) \
+ input_copy = NULL; \
+ psa_crypto_local_input_free(&LOCAL_INPUT_COPY_OF_##input);
+
+/* Declare a local copy of an output buffer and a variable that will be used
+ * to store a pointer to the start of the buffer.
+ *
+ * Note: This macro must be called before any operations which may jump to
+ * the exit label, so that the local output copy object is safe to be freed.
+ *
+ * Assumptions:
+ * - output is the name of a pointer to the buffer to be copied
+ * - The name LOCAL_OUTPUT_COPY_OF_output is unused in the current scope
+ * - output_copy_name is a name that is unused in the current scope
+ */
+#define LOCAL_OUTPUT_DECLARE(output, output_copy_name) \
+ psa_crypto_local_output_t LOCAL_OUTPUT_COPY_OF_##output = PSA_CRYPTO_LOCAL_OUTPUT_INIT; \
+ uint8_t *output_copy_name = NULL;
+
+/* Allocate a copy of the buffer output and set the pointer output_copy to
+ * point to the start of the copy.
+ *
+ * Assumptions:
+ * - psa_status_t status exists
+ * - An exit label is declared
+ * - output is the name of a pointer to the buffer to be copied
+ * - LOCAL_OUTPUT_DECLARE(output, output_copy) has previously been called
+ */
+#define LOCAL_OUTPUT_ALLOC(output, length, output_copy) \
+ status = psa_crypto_local_output_alloc(output, length, \
+ &LOCAL_OUTPUT_COPY_OF_##output); \
+ if (status != PSA_SUCCESS) { \
+ goto exit; \
+ } \
+ output_copy = LOCAL_OUTPUT_COPY_OF_##output.buffer;
+
+/* Free the local output copy allocated previously by LOCAL_OUTPUT_ALLOC()
+ * after first copying back its contents to the original buffer.
+ *
+ * Assumptions:
+ * - psa_status_t status exists
+ * - output_copy is the name of the output copy pointer set by LOCAL_OUTPUT_ALLOC()
+ * - output is the name of the original buffer that was copied
+ */
+#define LOCAL_OUTPUT_FREE(output, output_copy) \
+ output_copy = NULL; \
+ do { \
+ psa_status_t local_output_status; \
+ local_output_status = psa_crypto_local_output_free(&LOCAL_OUTPUT_COPY_OF_##output); \
+ if (local_output_status != PSA_SUCCESS) { \
+ /* Since this error case is an internal error, it's more serious than \
+ * any existing error code and so it's fine to overwrite the existing \
+ * status. */ \
+ status = local_output_status; \
+ } \
+ } while (0)
+#else /* !MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS */
+#define LOCAL_INPUT_DECLARE(input, input_copy_name) \
+ const uint8_t *input_copy_name = NULL;
+#define LOCAL_INPUT_ALLOC(input, length, input_copy) \
+ input_copy = input;
+#define LOCAL_INPUT_FREE(input, input_copy) \
+ input_copy = NULL;
+#define LOCAL_OUTPUT_DECLARE(output, output_copy_name) \
+ uint8_t *output_copy_name = NULL;
+#define LOCAL_OUTPUT_ALLOC(output, length, output_copy) \
+ output_copy = output;
+#define LOCAL_OUTPUT_FREE(output, output_copy) \
+ output_copy = NULL;
+#endif /* !MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS */
+
psa_status_t mbedtls_to_psa_error(int ret)
{
/* Mbed TLS error codes can combine a high-level error code and a
}
psa_status_t psa_export_key(mbedtls_svc_key_id_t key,
- uint8_t *data,
+ uint8_t *data_external,
size_t data_size,
size_t *data_length)
{
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
psa_status_t unlock_status = PSA_ERROR_CORRUPTION_DETECTED;
psa_key_slot_t *slot;
-
+ LOCAL_OUTPUT_DECLARE(data_external, data);
/* Reject a zero-length output buffer now, since this can never be a
* valid key representation. This way we know that data must be a valid
* pointer and we can do things like memset(data, ..., data_size). */
return status;
}
+ LOCAL_OUTPUT_ALLOC(data_external, data_size, data);
+
psa_key_attributes_t attributes = {
.core = slot->attr
};
slot->key.data, slot->key.bytes,
data, data_size, data_length);
+#if !defined(MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS)
+exit:
+#endif
unlock_status = psa_unlock_key_slot(slot);
+ LOCAL_OUTPUT_FREE(data_external, data);
return (status == PSA_SUCCESS) ? unlock_status : status;
}
}
psa_status_t psa_export_public_key(mbedtls_svc_key_id_t key,
- uint8_t *data,
+ uint8_t *data_external,
size_t data_size,
size_t *data_length)
{
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
psa_status_t unlock_status = PSA_ERROR_CORRUPTION_DETECTED;
+ psa_key_attributes_t attributes;
psa_key_slot_t *slot;
+ LOCAL_OUTPUT_DECLARE(data_external, data);
/* Reject a zero-length output buffer now, since this can never be a
* valid key representation. This way we know that data must be a valid
return status;
}
+ LOCAL_OUTPUT_ALLOC(data_external, data_size, data);
+
if (!PSA_KEY_TYPE_IS_ASYMMETRIC(slot->attr.type)) {
status = PSA_ERROR_INVALID_ARGUMENT;
goto exit;
}
- psa_key_attributes_t attributes = {
+ attributes = (psa_key_attributes_t) {
.core = slot->attr
};
status = psa_driver_wrapper_export_public_key(
exit:
unlock_status = psa_unlock_key_slot(slot);
+ LOCAL_OUTPUT_FREE(data_external, data);
return (status == PSA_SUCCESS) ? unlock_status : status;
}
}
psa_status_t psa_import_key(const psa_key_attributes_t *attributes,
- const uint8_t *data,
+ const uint8_t *data_external,
size_t data_length,
mbedtls_svc_key_id_t *key)
{
psa_status_t status;
+ LOCAL_INPUT_DECLARE(data_external, data);
psa_key_slot_t *slot = NULL;
psa_se_drv_table_entry_t *driver = NULL;
size_t bits;
return PSA_ERROR_INVALID_ARGUMENT;
}
+ LOCAL_INPUT_ALLOC(data_external, data_length, data);
+
status = psa_start_key_creation(PSA_KEY_CREATION_IMPORT, attributes,
&slot, &driver);
if (status != PSA_SUCCESS) {
status = psa_finish_key_creation(slot, driver, key);
exit:
+ LOCAL_INPUT_FREE(data_external, data);
if (status != PSA_SUCCESS) {
psa_fail_key_creation(slot, driver);
}
}
psa_status_t psa_hash_update(psa_hash_operation_t *operation,
- const uint8_t *input,
+ const uint8_t *input_external,
size_t input_length)
{
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
+ LOCAL_INPUT_DECLARE(input_external, input);
if (operation->id == 0) {
status = PSA_ERROR_BAD_STATE;
return PSA_SUCCESS;
}
+ LOCAL_INPUT_ALLOC(input_external, input_length, input);
status = psa_driver_wrapper_hash_update(operation, input, input_length);
exit:
psa_hash_abort(operation);
}
+ LOCAL_INPUT_FREE(input_external, input);
return status;
}
-psa_status_t psa_hash_finish(psa_hash_operation_t *operation,
- uint8_t *hash,
- size_t hash_size,
- size_t *hash_length)
+static psa_status_t psa_hash_finish_internal(psa_hash_operation_t *operation,
+ uint8_t *hash,
+ size_t hash_size,
+ size_t *hash_length)
{
+ psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
+
*hash_length = 0;
if (operation->id == 0) {
return PSA_ERROR_BAD_STATE;
}
- psa_status_t status = psa_driver_wrapper_hash_finish(
+ status = psa_driver_wrapper_hash_finish(
operation, hash, hash_size, hash_length);
psa_hash_abort(operation);
+
+ return status;
+}
+
+psa_status_t psa_hash_finish(psa_hash_operation_t *operation,
+ uint8_t *hash_external,
+ size_t hash_size,
+ size_t *hash_length)
+{
+ psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
+ LOCAL_OUTPUT_DECLARE(hash_external, hash);
+
+ LOCAL_OUTPUT_ALLOC(hash_external, hash_size, hash);
+ status = psa_hash_finish_internal(operation, hash, hash_size, hash_length);
+
+#if !defined(MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS)
+exit:
+#endif
+ LOCAL_OUTPUT_FREE(hash_external, hash);
return status;
}
psa_status_t psa_hash_verify(psa_hash_operation_t *operation,
- const uint8_t *hash,
+ const uint8_t *hash_external,
size_t hash_length)
{
uint8_t actual_hash[PSA_HASH_MAX_SIZE];
size_t actual_hash_length;
- psa_status_t status = psa_hash_finish(
+ psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
+ LOCAL_INPUT_DECLARE(hash_external, hash);
+
+ status = psa_hash_finish_internal(
operation,
actual_hash, sizeof(actual_hash),
&actual_hash_length);
goto exit;
}
+ LOCAL_INPUT_ALLOC(hash_external, hash_length, hash);
if (mbedtls_psa_safer_memcmp(hash, actual_hash, actual_hash_length) != 0) {
status = PSA_ERROR_INVALID_SIGNATURE;
}
if (status != PSA_SUCCESS) {
psa_hash_abort(operation);
}
-
+ LOCAL_INPUT_FREE(hash_external, hash);
return status;
}
psa_status_t psa_hash_compute(psa_algorithm_t alg,
- const uint8_t *input, size_t input_length,
- uint8_t *hash, size_t hash_size,
+ const uint8_t *input_external, size_t input_length,
+ uint8_t *hash_external, size_t hash_size,
size_t *hash_length)
{
+ psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
+ LOCAL_INPUT_DECLARE(input_external, input);
+ LOCAL_OUTPUT_DECLARE(hash_external, hash);
+
*hash_length = 0;
if (!PSA_ALG_IS_HASH(alg)) {
return PSA_ERROR_INVALID_ARGUMENT;
}
- return psa_driver_wrapper_hash_compute(alg, input, input_length,
- hash, hash_size, hash_length);
+ LOCAL_INPUT_ALLOC(input_external, input_length, input);
+ LOCAL_OUTPUT_ALLOC(hash_external, hash_size, hash);
+ status = psa_driver_wrapper_hash_compute(alg, input, input_length,
+ hash, hash_size, hash_length);
+
+#if !defined(MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS)
+exit:
+#endif
+ LOCAL_INPUT_FREE(input_external, input);
+ LOCAL_OUTPUT_FREE(hash_external, hash);
+ return status;
}
psa_status_t psa_hash_compare(psa_algorithm_t alg,
- const uint8_t *input, size_t input_length,
- const uint8_t *hash, size_t hash_length)
+ const uint8_t *input_external, size_t input_length,
+ const uint8_t *hash_external, size_t hash_length)
{
uint8_t actual_hash[PSA_HASH_MAX_SIZE];
size_t actual_hash_length;
+ psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
+
+ LOCAL_INPUT_DECLARE(input_external, input);
+ LOCAL_INPUT_DECLARE(hash_external, hash);
if (!PSA_ALG_IS_HASH(alg)) {
- return PSA_ERROR_INVALID_ARGUMENT;
+ status = PSA_ERROR_INVALID_ARGUMENT;
+ return status;
}
- psa_status_t status = psa_driver_wrapper_hash_compute(
+ LOCAL_INPUT_ALLOC(input_external, input_length, input);
+ status = psa_driver_wrapper_hash_compute(
alg, input, input_length,
actual_hash, sizeof(actual_hash),
&actual_hash_length);
status = PSA_ERROR_INVALID_SIGNATURE;
goto exit;
}
+
+ LOCAL_INPUT_ALLOC(hash_external, hash_length, hash);
if (mbedtls_psa_safer_memcmp(hash, actual_hash, actual_hash_length) != 0) {
status = PSA_ERROR_INVALID_SIGNATURE;
}
exit:
mbedtls_platform_zeroize(actual_hash, sizeof(actual_hash));
+
+ LOCAL_INPUT_FREE(input_external, input);
+ LOCAL_INPUT_FREE(hash_external, hash);
+
return status;
}
{
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
psa_status_t unlock_status = PSA_ERROR_CORRUPTION_DETECTED;
+ psa_key_attributes_t attributes;
psa_key_slot_t *slot = NULL;
/* A context must be freshly initialized before it can be set up. */
goto exit;
}
- psa_key_attributes_t attributes = {
+ attributes = (psa_key_attributes_t) {
.core = slot->attr
};
}
psa_status_t psa_mac_update(psa_mac_operation_t *operation,
- const uint8_t *input,
+ const uint8_t *input_external,
size_t input_length)
{
+ psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
+ LOCAL_INPUT_DECLARE(input_external, input);
+
if (operation->id == 0) {
- return PSA_ERROR_BAD_STATE;
+ status = PSA_ERROR_BAD_STATE;
+ return status;
}
/* Don't require hash implementations to behave correctly on a
* zero-length input, which may have an invalid pointer. */
if (input_length == 0) {
- return PSA_SUCCESS;
+ status = PSA_SUCCESS;
+ return status;
}
- psa_status_t status = psa_driver_wrapper_mac_update(operation,
- input, input_length);
+ LOCAL_INPUT_ALLOC(input_external, input_length, input);
+ status = psa_driver_wrapper_mac_update(operation, input, input_length);
+
if (status != PSA_SUCCESS) {
psa_mac_abort(operation);
}
+#if !defined(MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS)
+exit:
+#endif
+ LOCAL_INPUT_FREE(input_external, input);
+
return status;
}
psa_status_t psa_mac_sign_finish(psa_mac_operation_t *operation,
- uint8_t *mac,
+ uint8_t *mac_external,
size_t mac_size,
size_t *mac_length)
{
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
psa_status_t abort_status = PSA_ERROR_CORRUPTION_DETECTED;
+ LOCAL_OUTPUT_DECLARE(mac_external, mac);
+ LOCAL_OUTPUT_ALLOC(mac_external, mac_size, mac);
if (operation->id == 0) {
status = PSA_ERROR_BAD_STATE;
operation->mac_size = 0;
}
- if (mac_size > operation->mac_size) {
+ if ((mac != NULL) && (mac_size > operation->mac_size)) {
memset(&mac[operation->mac_size], '!',
mac_size - operation->mac_size);
}
abort_status = psa_mac_abort(operation);
+ LOCAL_OUTPUT_FREE(mac_external, mac);
return status == PSA_SUCCESS ? abort_status : status;
}
psa_status_t psa_mac_verify_finish(psa_mac_operation_t *operation,
- const uint8_t *mac,
+ const uint8_t *mac_external,
size_t mac_length)
{
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
psa_status_t abort_status = PSA_ERROR_CORRUPTION_DETECTED;
+ LOCAL_INPUT_DECLARE(mac_external, mac);
if (operation->id == 0) {
status = PSA_ERROR_BAD_STATE;
goto exit;
}
+ LOCAL_INPUT_ALLOC(mac_external, mac_length, mac);
status = psa_driver_wrapper_mac_verify_finish(operation,
mac, mac_length);
exit:
abort_status = psa_mac_abort(operation);
+ LOCAL_INPUT_FREE(mac_external, mac);
return status == PSA_SUCCESS ? abort_status : status;
}
{
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
psa_status_t unlock_status = PSA_ERROR_CORRUPTION_DETECTED;
+ psa_key_attributes_t attributes;
psa_key_slot_t *slot;
uint8_t operation_mac_size = 0;
goto exit;
}
- psa_key_attributes_t attributes = {
+ attributes = (psa_key_attributes_t) {
.core = slot->attr
};
psa_status_t psa_mac_compute(mbedtls_svc_key_id_t key,
psa_algorithm_t alg,
- const uint8_t *input,
+ const uint8_t *input_external,
size_t input_length,
- uint8_t *mac,
+ uint8_t *mac_external,
size_t mac_size,
size_t *mac_length)
{
- return psa_mac_compute_internal(key, alg,
- input, input_length,
- mac, mac_size, mac_length, 1);
+ psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
+ LOCAL_INPUT_DECLARE(input_external, input);
+ LOCAL_OUTPUT_DECLARE(mac_external, mac);
+
+ LOCAL_INPUT_ALLOC(input_external, input_length, input);
+ LOCAL_OUTPUT_ALLOC(mac_external, mac_size, mac);
+ status = psa_mac_compute_internal(key, alg,
+ input, input_length,
+ mac, mac_size, mac_length, 1);
+
+#if !defined(MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS)
+exit:
+#endif
+ LOCAL_INPUT_FREE(input_external, input);
+ LOCAL_OUTPUT_FREE(mac_external, mac);
+
+ return status;
}
psa_status_t psa_mac_verify(mbedtls_svc_key_id_t key,
psa_algorithm_t alg,
- const uint8_t *input,
+ const uint8_t *input_external,
size_t input_length,
- const uint8_t *mac,
+ const uint8_t *mac_external,
size_t mac_length)
{
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
uint8_t actual_mac[PSA_MAC_MAX_SIZE];
size_t actual_mac_length;
+ LOCAL_INPUT_DECLARE(input_external, input);
+ LOCAL_INPUT_DECLARE(mac_external, mac);
+ LOCAL_INPUT_ALLOC(input_external, input_length, input);
status = psa_mac_compute_internal(key, alg,
input, input_length,
actual_mac, sizeof(actual_mac),
status = PSA_ERROR_INVALID_SIGNATURE;
goto exit;
}
+
+ LOCAL_INPUT_ALLOC(mac_external, mac_length, mac);
if (mbedtls_psa_safer_memcmp(mac, actual_mac, actual_mac_length) != 0) {
status = PSA_ERROR_INVALID_SIGNATURE;
goto exit;
exit:
mbedtls_platform_zeroize(actual_mac, sizeof(actual_mac));
+ LOCAL_INPUT_FREE(input_external, input);
+ LOCAL_INPUT_FREE(mac_external, mac);
return status;
}
{
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
psa_status_t unlock_status = PSA_ERROR_CORRUPTION_DETECTED;
+ psa_key_attributes_t attributes;
psa_key_slot_t *slot;
*signature_length = 0;
goto exit;
}
- psa_key_attributes_t attributes = {
+ attributes = (psa_key_attributes_t) {
.core = slot->attr
};
psa_status_t psa_sign_message(mbedtls_svc_key_id_t key,
psa_algorithm_t alg,
- const uint8_t *input,
+ const uint8_t *input_external,
size_t input_length,
- uint8_t *signature,
+ uint8_t *signature_external,
size_t signature_size,
size_t *signature_length)
{
- return psa_sign_internal(
- key, 1, alg, input, input_length,
- signature, signature_size, signature_length);
+ psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
+ LOCAL_INPUT_DECLARE(input_external, input);
+ LOCAL_OUTPUT_DECLARE(signature_external, signature);
+
+ LOCAL_INPUT_ALLOC(input_external, input_length, input);
+ LOCAL_OUTPUT_ALLOC(signature_external, signature_size, signature);
+ status = psa_sign_internal(key, 1, alg, input, input_length, signature,
+ signature_size, signature_length);
+
+#if !defined(MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS)
+exit:
+#endif
+ LOCAL_INPUT_FREE(input_external, input);
+ LOCAL_OUTPUT_FREE(signature_external, signature);
+ return status;
}
psa_status_t psa_verify_message_builtin(
psa_status_t psa_verify_message(mbedtls_svc_key_id_t key,
psa_algorithm_t alg,
- const uint8_t *input,
+ const uint8_t *input_external,
size_t input_length,
- const uint8_t *signature,
+ const uint8_t *signature_external,
size_t signature_length)
{
- return psa_verify_internal(
- key, 1, alg, input, input_length,
- signature, signature_length);
+ psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
+ LOCAL_INPUT_DECLARE(input_external, input);
+ LOCAL_INPUT_DECLARE(signature_external, signature);
+
+ LOCAL_INPUT_ALLOC(input_external, input_length, input);
+ LOCAL_INPUT_ALLOC(signature_external, signature_length, signature);
+ status = psa_verify_internal(key, 1, alg, input, input_length, signature,
+ signature_length);
+
+#if !defined(MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS)
+exit:
+#endif
+ LOCAL_INPUT_FREE(input_external, input);
+ LOCAL_INPUT_FREE(signature_external, signature);
+
+ return status;
}
psa_status_t psa_sign_hash_builtin(
psa_status_t psa_sign_hash(mbedtls_svc_key_id_t key,
psa_algorithm_t alg,
- const uint8_t *hash,
+ const uint8_t *hash_external,
size_t hash_length,
- uint8_t *signature,
+ uint8_t *signature_external,
size_t signature_size,
size_t *signature_length)
{
- return psa_sign_internal(
- key, 0, alg, hash, hash_length,
- signature, signature_size, signature_length);
+ psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
+ LOCAL_INPUT_DECLARE(hash_external, hash);
+ LOCAL_OUTPUT_DECLARE(signature_external, signature);
+
+ LOCAL_INPUT_ALLOC(hash_external, hash_length, hash);
+ LOCAL_OUTPUT_ALLOC(signature_external, signature_size, signature);
+ status = psa_sign_internal(key, 0, alg, hash, hash_length, signature,
+ signature_size, signature_length);
+
+#if !defined(MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS)
+exit:
+#endif
+ LOCAL_INPUT_FREE(hash_external, hash);
+ LOCAL_OUTPUT_FREE(signature_external, signature);
+
+ return status;
}
psa_status_t psa_verify_hash_builtin(
psa_status_t psa_verify_hash(mbedtls_svc_key_id_t key,
psa_algorithm_t alg,
- const uint8_t *hash,
+ const uint8_t *hash_external,
size_t hash_length,
- const uint8_t *signature,
+ const uint8_t *signature_external,
size_t signature_length)
{
- return psa_verify_internal(
- key, 0, alg, hash, hash_length,
- signature, signature_length);
+ psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
+ LOCAL_INPUT_DECLARE(hash_external, hash);
+ LOCAL_INPUT_DECLARE(signature_external, signature);
+
+ LOCAL_INPUT_ALLOC(hash_external, hash_length, hash);
+ LOCAL_INPUT_ALLOC(signature_external, signature_length, signature);
+ status = psa_verify_internal(key, 0, alg, hash, hash_length, signature,
+ signature_length);
+
+#if !defined(MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS)
+exit:
+#endif
+ LOCAL_INPUT_FREE(hash_external, hash);
+ LOCAL_INPUT_FREE(signature_external, signature);
+
+ return status;
}
#if defined(MBEDTLS_PSA_BUILTIN_ALG_RSA_OAEP)
psa_status_t psa_asymmetric_encrypt(mbedtls_svc_key_id_t key,
psa_algorithm_t alg,
- const uint8_t *input,
+ const uint8_t *input_external,
size_t input_length,
- const uint8_t *salt,
+ const uint8_t *salt_external,
size_t salt_length,
- uint8_t *output,
+ uint8_t *output_external,
size_t output_size,
size_t *output_length)
{
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
psa_status_t unlock_status = PSA_ERROR_CORRUPTION_DETECTED;
psa_key_slot_t *slot;
+ LOCAL_INPUT_DECLARE(input_external, input);
+ LOCAL_INPUT_DECLARE(salt_external, salt);
+ LOCAL_OUTPUT_DECLARE(output_external, output);
(void) input;
(void) input_length;
}
#endif /* defined(MBEDTLS_PSA_BUILTIN_ALG_RSA_PKCS1V15_CRYPT) ||
* defined(MBEDTLS_PSA_BUILTIN_ALG_RSA_OAEP) */
+ LOCAL_INPUT_ALLOC(input_external, input_length, input);
+ LOCAL_INPUT_ALLOC(salt_external, salt_length, salt);
+ LOCAL_OUTPUT_ALLOC(output_external, output_size, output);
if (alg == PSA_ALG_RSA_PKCS1V15_CRYPT) {
#if defined(MBEDTLS_PSA_BUILTIN_ALG_RSA_PKCS1V15_CRYPT)
status = mbedtls_to_psa_error(
exit:
unlock_status = psa_unlock_key_slot(slot);
+ LOCAL_INPUT_FREE(input_external, input);
+ LOCAL_INPUT_FREE(salt_external, salt);
+ LOCAL_OUTPUT_FREE(output_external, output);
+
return (status == PSA_SUCCESS) ? unlock_status : status;
}
psa_status_t psa_asymmetric_decrypt(mbedtls_svc_key_id_t key,
psa_algorithm_t alg,
- const uint8_t *input,
+ const uint8_t *input_external,
size_t input_length,
- const uint8_t *salt,
+ const uint8_t *salt_external,
size_t salt_length,
- uint8_t *output,
+ uint8_t *output_external,
size_t output_size,
size_t *output_length)
{
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
psa_status_t unlock_status = PSA_ERROR_CORRUPTION_DETECTED;
psa_key_slot_t *slot;
+ LOCAL_INPUT_DECLARE(input_external, input);
+ LOCAL_INPUT_DECLARE(salt_external, salt);
+ LOCAL_OUTPUT_DECLARE(output_external, output);
(void) input;
(void) input_length;
}
#endif /* defined(MBEDTLS_PSA_BUILTIN_ALG_RSA_PKCS1V15_CRYPT) ||
* defined(MBEDTLS_PSA_BUILTIN_ALG_RSA_OAEP) */
-
+ LOCAL_INPUT_ALLOC(input_external, input_length, input);
+ LOCAL_INPUT_ALLOC(salt_external, salt_length, salt);
+ LOCAL_OUTPUT_ALLOC(output_external, output_size, output);
if (alg == PSA_ALG_RSA_PKCS1V15_CRYPT) {
#if defined(MBEDTLS_PSA_BUILTIN_ALG_RSA_PKCS1V15_CRYPT)
status = mbedtls_to_psa_error(
exit:
unlock_status = psa_unlock_key_slot(slot);
+ LOCAL_INPUT_FREE(input_external, input);
+ LOCAL_INPUT_FREE(salt_external, salt);
+ LOCAL_OUTPUT_FREE(output_external, output);
+
return (status == PSA_SUCCESS) ? unlock_status : status;
}
+static psa_status_t psa_generate_random_internal(uint8_t *output,
+ size_t output_size)
+{
+ GUARD_MODULE_INITIALIZED;
+
+ psa_status_t status;
+
+#if defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG)
+
+ size_t output_length = 0;
+ status = mbedtls_psa_external_get_random(&global_data.rng,
+ output, output_size,
+ &output_length);
+ if (status != PSA_SUCCESS) {
+ goto exit;
+ }
+ /* Breaking up a request into smaller chunks is currently not supported
+ * for the external RNG interface. */
+ if (output_length != output_size) {
+ status = PSA_ERROR_INSUFFICIENT_ENTROPY;
+ goto exit;
+ }
+ status = PSA_SUCCESS;
+
+#else /* MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG */
+
+ while (output_size > 0) {
+ size_t request_size =
+ (output_size > MBEDTLS_PSA_RANDOM_MAX_REQUEST ?
+ MBEDTLS_PSA_RANDOM_MAX_REQUEST :
+ output_size);
+ int ret = mbedtls_psa_get_random(MBEDTLS_PSA_RANDOM_STATE,
+ output, request_size);
+ if (ret != 0) {
+ status = mbedtls_to_psa_error(ret);
+ goto exit;
+ }
+ output_size -= request_size;
+ output += request_size;
+ }
+ status = PSA_SUCCESS;
+#endif /* MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG */
+
+exit:
+ return status;
+}
/****************************************************************/
{
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
psa_status_t unlock_status = PSA_ERROR_CORRUPTION_DETECTED;
+ psa_key_attributes_t attributes;
psa_key_slot_t *slot = NULL;
psa_key_usage_t usage = (cipher_operation == MBEDTLS_ENCRYPT ?
PSA_KEY_USAGE_ENCRYPT :
}
operation->default_iv_length = PSA_CIPHER_IV_LENGTH(slot->attr.type, alg);
- psa_key_attributes_t attributes = {
+ attributes = (psa_key_attributes_t) {
.core = slot->attr
};
}
psa_status_t psa_cipher_generate_iv(psa_cipher_operation_t *operation,
- uint8_t *iv,
+ uint8_t *iv_external,
size_t iv_size,
size_t *iv_length)
{
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
- uint8_t local_iv[PSA_CIPHER_IV_MAX_SIZE];
- size_t default_iv_length;
+ size_t default_iv_length = 0;
+
+ LOCAL_OUTPUT_DECLARE(iv_external, iv);
if (operation->id == 0) {
status = PSA_ERROR_BAD_STATE;
goto exit;
}
- status = psa_generate_random(local_iv, default_iv_length);
+ LOCAL_OUTPUT_ALLOC(iv_external, default_iv_length, iv);
+
+ status = psa_generate_random_internal(iv, default_iv_length);
if (status != PSA_SUCCESS) {
goto exit;
}
status = psa_driver_wrapper_cipher_set_iv(operation,
- local_iv, default_iv_length);
+ iv, default_iv_length);
exit:
if (status == PSA_SUCCESS) {
- memcpy(iv, local_iv, default_iv_length);
*iv_length = default_iv_length;
operation->iv_set = 1;
} else {
*iv_length = 0;
psa_cipher_abort(operation);
+ if (iv != NULL) {
+ mbedtls_platform_zeroize(iv, default_iv_length);
+ }
}
+ LOCAL_OUTPUT_FREE(iv_external, iv);
return status;
}
psa_status_t psa_cipher_set_iv(psa_cipher_operation_t *operation,
- const uint8_t *iv,
+ const uint8_t *iv_external,
size_t iv_length)
{
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
+ LOCAL_INPUT_DECLARE(iv_external, iv);
+
if (operation->id == 0) {
status = PSA_ERROR_BAD_STATE;
goto exit;
goto exit;
}
+ LOCAL_INPUT_ALLOC(iv_external, iv_length, iv);
+
status = psa_driver_wrapper_cipher_set_iv(operation,
iv,
iv_length);
} else {
psa_cipher_abort(operation);
}
+
+ LOCAL_INPUT_FREE(iv_external, iv);
+
return status;
}
psa_status_t psa_cipher_update(psa_cipher_operation_t *operation,
- const uint8_t *input,
+ const uint8_t *input_external,
size_t input_length,
- uint8_t *output,
+ uint8_t *output_external,
size_t output_size,
size_t *output_length)
{
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
+ LOCAL_INPUT_DECLARE(input_external, input);
+ LOCAL_OUTPUT_DECLARE(output_external, output);
+
if (operation->id == 0) {
status = PSA_ERROR_BAD_STATE;
goto exit;
goto exit;
}
+ LOCAL_INPUT_ALLOC(input_external, input_length, input);
+ LOCAL_OUTPUT_ALLOC(output_external, output_size, output);
+
status = psa_driver_wrapper_cipher_update(operation,
input,
input_length,
psa_cipher_abort(operation);
}
+ LOCAL_INPUT_FREE(input_external, input);
+ LOCAL_OUTPUT_FREE(output_external, output);
+
return status;
}
psa_status_t psa_cipher_finish(psa_cipher_operation_t *operation,
- uint8_t *output,
+ uint8_t *output_external,
size_t output_size,
size_t *output_length)
{
psa_status_t status = PSA_ERROR_GENERIC_ERROR;
+ LOCAL_OUTPUT_DECLARE(output_external, output);
+
if (operation->id == 0) {
status = PSA_ERROR_BAD_STATE;
goto exit;
goto exit;
}
+ LOCAL_OUTPUT_ALLOC(output_external, output_size, output);
+
status = psa_driver_wrapper_cipher_finish(operation,
output,
output_size,
exit:
if (status == PSA_SUCCESS) {
- return psa_cipher_abort(operation);
+ status = psa_cipher_abort(operation);
} else {
*output_length = 0;
(void) psa_cipher_abort(operation);
-
- return status;
}
+
+ LOCAL_OUTPUT_FREE(output_external, output);
+
+ return status;
}
psa_status_t psa_cipher_abort(psa_cipher_operation_t *operation)
psa_status_t psa_cipher_encrypt(mbedtls_svc_key_id_t key,
psa_algorithm_t alg,
- const uint8_t *input,
+ const uint8_t *input_external,
size_t input_length,
- uint8_t *output,
+ uint8_t *output_external,
size_t output_size,
size_t *output_length)
{
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
psa_status_t unlock_status = PSA_ERROR_CORRUPTION_DETECTED;
+ psa_key_attributes_t attributes;
psa_key_slot_t *slot = NULL;
uint8_t local_iv[PSA_CIPHER_IV_MAX_SIZE];
size_t default_iv_length = 0;
+ LOCAL_INPUT_DECLARE(input_external, input);
+ LOCAL_OUTPUT_DECLARE(output_external, output);
+
if (!PSA_ALG_IS_CIPHER(alg)) {
status = PSA_ERROR_INVALID_ARGUMENT;
goto exit;
goto exit;
}
- psa_key_attributes_t attributes = {
+ attributes = (psa_key_attributes_t) {
.core = slot->attr
};
goto exit;
}
- status = psa_generate_random(local_iv, default_iv_length);
+ status = psa_generate_random_internal(local_iv, default_iv_length);
if (status != PSA_SUCCESS) {
goto exit;
}
}
+ LOCAL_INPUT_ALLOC(input_external, input_length, input);
+ LOCAL_OUTPUT_ALLOC(output_external, output_size, output);
+
status = psa_driver_wrapper_cipher_encrypt(
&attributes, slot->key.data, slot->key.bytes,
alg, local_iv, default_iv_length, input, input_length,
*output_length = 0;
}
+ LOCAL_INPUT_FREE(input_external, input);
+ LOCAL_OUTPUT_FREE(output_external, output);
+
return status;
}
psa_status_t psa_cipher_decrypt(mbedtls_svc_key_id_t key,
psa_algorithm_t alg,
- const uint8_t *input,
+ const uint8_t *input_external,
size_t input_length,
- uint8_t *output,
+ uint8_t *output_external,
size_t output_size,
size_t *output_length)
{
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
psa_status_t unlock_status = PSA_ERROR_CORRUPTION_DETECTED;
+ psa_key_attributes_t attributes;
psa_key_slot_t *slot = NULL;
+ LOCAL_INPUT_DECLARE(input_external, input);
+ LOCAL_OUTPUT_DECLARE(output_external, output);
+
if (!PSA_ALG_IS_CIPHER(alg)) {
status = PSA_ERROR_INVALID_ARGUMENT;
goto exit;
goto exit;
}
- psa_key_attributes_t attributes = {
+ attributes = (psa_key_attributes_t) {
.core = slot->attr
};
goto exit;
}
+ LOCAL_INPUT_ALLOC(input_external, input_length, input);
+ LOCAL_OUTPUT_ALLOC(output_external, output_size, output);
+
status = psa_driver_wrapper_cipher_decrypt(
&attributes, slot->key.data, slot->key.bytes,
alg, input, input_length,
*output_length = 0;
}
+ LOCAL_INPUT_FREE(input_external, input);
+ LOCAL_OUTPUT_FREE(output_external, output);
+
return status;
}
psa_status_t psa_aead_encrypt(mbedtls_svc_key_id_t key,
psa_algorithm_t alg,
- const uint8_t *nonce,
+ const uint8_t *nonce_external,
size_t nonce_length,
- const uint8_t *additional_data,
+ const uint8_t *additional_data_external,
size_t additional_data_length,
- const uint8_t *plaintext,
+ const uint8_t *plaintext_external,
size_t plaintext_length,
- uint8_t *ciphertext,
+ uint8_t *ciphertext_external,
size_t ciphertext_size,
size_t *ciphertext_length)
{
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
psa_key_slot_t *slot;
+ LOCAL_INPUT_DECLARE(nonce_external, nonce);
+ LOCAL_INPUT_DECLARE(additional_data_external, additional_data);
+ LOCAL_INPUT_DECLARE(plaintext_external, plaintext);
+ LOCAL_OUTPUT_DECLARE(ciphertext_external, ciphertext);
+
*ciphertext_length = 0;
if (!PSA_ALG_IS_AEAD(alg) || PSA_ALG_IS_WILDCARD(alg)) {
.core = slot->attr
};
+ LOCAL_INPUT_ALLOC(nonce_external, nonce_length, nonce);
+ LOCAL_INPUT_ALLOC(additional_data_external, additional_data_length, additional_data);
+ LOCAL_INPUT_ALLOC(plaintext_external, plaintext_length, plaintext);
+ LOCAL_OUTPUT_ALLOC(ciphertext_external, ciphertext_size, ciphertext);
+
status = psa_driver_wrapper_aead_encrypt(
&attributes, slot->key.data, slot->key.bytes,
alg,
memset(ciphertext, 0, ciphertext_size);
}
+/* Exit label is only used for buffer copying, prevent unused warnings. */
+#if !defined(MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS)
+exit:
+#endif
+ LOCAL_INPUT_FREE(nonce_external, nonce);
+ LOCAL_INPUT_FREE(additional_data_external, additional_data);
+ LOCAL_INPUT_FREE(plaintext_external, plaintext);
+ LOCAL_OUTPUT_FREE(ciphertext_external, ciphertext);
+
psa_unlock_key_slot(slot);
return status;
psa_status_t psa_aead_decrypt(mbedtls_svc_key_id_t key,
psa_algorithm_t alg,
- const uint8_t *nonce,
+ const uint8_t *nonce_external,
size_t nonce_length,
- const uint8_t *additional_data,
+ const uint8_t *additional_data_external,
size_t additional_data_length,
- const uint8_t *ciphertext,
+ const uint8_t *ciphertext_external,
size_t ciphertext_length,
- uint8_t *plaintext,
+ uint8_t *plaintext_external,
size_t plaintext_size,
size_t *plaintext_length)
{
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
psa_key_slot_t *slot;
+ LOCAL_INPUT_DECLARE(nonce_external, nonce);
+ LOCAL_INPUT_DECLARE(additional_data_external, additional_data);
+ LOCAL_INPUT_DECLARE(ciphertext_external, ciphertext);
+ LOCAL_OUTPUT_DECLARE(plaintext_external, plaintext);
+
*plaintext_length = 0;
if (!PSA_ALG_IS_AEAD(alg) || PSA_ALG_IS_WILDCARD(alg)) {
.core = slot->attr
};
+ LOCAL_INPUT_ALLOC(nonce_external, nonce_length, nonce);
+ LOCAL_INPUT_ALLOC(additional_data_external, additional_data_length,
+ additional_data);
+ LOCAL_INPUT_ALLOC(ciphertext_external, ciphertext_length, ciphertext);
+ LOCAL_OUTPUT_ALLOC(plaintext_external, plaintext_size, plaintext);
+
status = psa_driver_wrapper_aead_decrypt(
&attributes, slot->key.data, slot->key.bytes,
alg,
memset(plaintext, 0, plaintext_size);
}
+/* Exit label is only used for buffer copying, prevent unused warnings. */
+#if !defined(MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS)
+exit:
+#endif
+ LOCAL_INPUT_FREE(nonce_external, nonce);
+ LOCAL_INPUT_FREE(additional_data_external, additional_data);
+ LOCAL_INPUT_FREE(ciphertext_external, ciphertext);
+ LOCAL_OUTPUT_FREE(plaintext_external, plaintext);
+
psa_unlock_key_slot(slot);
return status;
psa_status_t psa_key_derivation_output_bytes(
psa_key_derivation_operation_t *operation,
- uint8_t *output,
+ uint8_t *output_external,
size_t output_length)
{
psa_status_t status;
+ LOCAL_OUTPUT_DECLARE(output_external, output);
+
psa_algorithm_t kdf_alg = psa_key_derivation_get_kdf_alg(operation);
if (operation->alg == 0) {
return PSA_ERROR_BAD_STATE;
}
- if (output_length > operation->capacity) {
- operation->capacity = 0;
- /* Go through the error path to wipe all confidential data now
- * that the operation object is useless. */
- status = PSA_ERROR_INSUFFICIENT_DATA;
- goto exit;
- }
if (output_length == 0 && operation->capacity == 0) {
/* Edge case: this is a finished operation, and 0 bytes
* were requested. The right error in this case could
* output_length > 0. */
return PSA_ERROR_INSUFFICIENT_DATA;
}
+
+ LOCAL_OUTPUT_ALLOC(output_external, output_length, output);
+ if (output_length > operation->capacity) {
+ operation->capacity = 0;
+ /* Go through the error path to wipe all confidential data now
+ * that the operation object is useless. */
+ status = PSA_ERROR_INSUFFICIENT_DATA;
+ goto exit;
+ }
operation->capacity -= output_length;
#if defined(MBEDTLS_PSA_BUILTIN_ALG_HKDF)
* MBEDTLS_PSA_BUILTIN_ALG_TLS12_PSK_TO_MS */
{
(void) kdf_alg;
- return PSA_ERROR_BAD_STATE;
+ status = PSA_ERROR_BAD_STATE;
+ LOCAL_OUTPUT_FREE(output_external, output);
+
+ return status;
}
exit:
psa_algorithm_t alg = operation->alg;
psa_key_derivation_abort(operation);
operation->alg = alg;
- memset(output, '!', output_length);
+ if (output != NULL) {
+ memset(output, '!', output_length);
+ }
}
+
+ LOCAL_OUTPUT_FREE(output_external, output);
return status;
}
uint8_t *data = NULL;
size_t bytes = PSA_BITS_TO_BYTES(bits);
psa_status_t status;
+ psa_key_attributes_t attributes;
if (!key_type_is_raw_bytes(slot->attr.type)) {
return PSA_ERROR_INVALID_ARGUMENT;
}
slot->attr.bits = (psa_key_bits_t) bits;
- psa_key_attributes_t attributes = {
+ attributes = (psa_key_attributes_t) {
.core = slot->attr
};
return status;
}
-static psa_status_t psa_key_derivation_setup_kdf(
+static psa_status_t psa_key_derivation_set_maximum_capacity(
psa_key_derivation_operation_t *operation,
psa_algorithm_t kdf_alg)
{
- /* Make sure that operation->ctx is properly zero-initialised. (Macro
- * initialisers for this union leave some bytes unspecified.) */
- memset(&operation->ctx, 0, sizeof(operation->ctx));
-
- /* Make sure that kdf_alg is a supported key derivation algorithm. */
- if (!is_kdf_alg_supported(kdf_alg)) {
- return PSA_ERROR_NOT_SUPPORTED;
- }
-
- /* All currently supported key derivation algorithms are based on a
- * hash algorithm. */
psa_algorithm_t hash_alg = PSA_ALG_HKDF_GET_HASH(kdf_alg);
size_t hash_size = PSA_HASH_LENGTH(hash_alg);
if (hash_size == 0) {
return status;
}
- if ((PSA_ALG_IS_TLS12_PRF(kdf_alg) ||
- PSA_ALG_IS_TLS12_PSK_TO_MS(kdf_alg)) &&
- !(hash_alg == PSA_ALG_SHA_256 || hash_alg == PSA_ALG_SHA_384)) {
+#if defined(PSA_WANT_ALG_HKDF)
+ if (PSA_ALG_IS_HKDF(kdf_alg)) {
+ operation->capacity = 255 * hash_size;
+ } else
+#endif
+#if defined(PSA_WANT_ALG_TLS12_PRF)
+ if (PSA_ALG_IS_TLS12_PRF(kdf_alg) &&
+ (hash_alg == PSA_ALG_SHA_256 || hash_alg == PSA_ALG_SHA_384)) {
+ operation->capacity = SIZE_MAX;
+ } else
+#endif
+#if defined(PSA_WANT_ALG_TLS12_PSK_TO_MS)
+ if (PSA_ALG_IS_TLS12_PSK_TO_MS(kdf_alg) &&
+ (hash_alg == PSA_ALG_SHA_256 || hash_alg == PSA_ALG_SHA_384)) {
+ /* Master Secret is always 48 bytes
+ * https://datatracker.ietf.org/doc/html/rfc5246.html#section-8.1 */
+ operation->capacity = 48U;
+ } else
+#endif
+ {
+ (void) hash_size;
+ status = PSA_ERROR_NOT_SUPPORTED;
+ }
+ return status;
+}
+
+
+static psa_status_t psa_key_derivation_setup_kdf(
+ psa_key_derivation_operation_t *operation,
+ psa_algorithm_t kdf_alg)
+{
+ /* Make sure that operation->ctx is properly zero-initialised. (Macro
+ * initialisers for this union leave some bytes unspecified.) */
+ memset(&operation->ctx, 0, sizeof(operation->ctx));
+ /* Make sure that kdf_alg is a supported key derivation algorithm. */
+ if (!is_kdf_alg_supported(kdf_alg)) {
return PSA_ERROR_NOT_SUPPORTED;
}
- operation->capacity = 255 * hash_size;
- return PSA_SUCCESS;
+ psa_status_t status = psa_key_derivation_set_maximum_capacity(operation,
+ kdf_alg);
+ return status;
}
static psa_status_t psa_key_agreement_try_support(psa_algorithm_t alg)
psa_status_t psa_key_derivation_input_bytes(
psa_key_derivation_operation_t *operation,
psa_key_derivation_step_t step,
- const uint8_t *data,
+ const uint8_t *data_external,
size_t data_length)
{
- return psa_key_derivation_input_internal(operation, step,
- PSA_KEY_TYPE_NONE,
- data, data_length);
+ psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
+ LOCAL_INPUT_DECLARE(data_external, data);
+
+ LOCAL_INPUT_ALLOC(data_external, data_length, data);
+
+ status = psa_key_derivation_input_internal(operation, step,
+ PSA_KEY_TYPE_NONE,
+ data, data_length);
+#if !defined(MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS)
+exit:
+#endif
+ LOCAL_INPUT_FREE(data_external, data);
+ return status;
}
psa_status_t psa_key_derivation_input_key(
size_t shared_secret_size,
size_t *shared_secret_length)
{
+ mbedtls_ecp_keypair *ecp = NULL;
+ psa_status_t status;
+
switch (alg) {
#if defined(MBEDTLS_PSA_BUILTIN_ALG_ECDH)
case PSA_ALG_ECDH:
if (!PSA_KEY_TYPE_IS_ECC_KEY_PAIR(private_key->attr.type)) {
return PSA_ERROR_INVALID_ARGUMENT;
}
- mbedtls_ecp_keypair *ecp = NULL;
- psa_status_t status = mbedtls_psa_ecp_load_representation(
+ status = mbedtls_psa_ecp_load_representation(
private_key->attr.type,
private_key->attr.bits,
private_key->key.data,
return status;
#endif /* MBEDTLS_PSA_BUILTIN_ALG_ECDH */
default:
+ (void) ecp;
+ (void) status;
(void) private_key;
(void) peer_key;
(void) peer_key_length;
psa_status_t psa_key_derivation_key_agreement(psa_key_derivation_operation_t *operation,
psa_key_derivation_step_t step,
mbedtls_svc_key_id_t private_key,
- const uint8_t *peer_key,
+ const uint8_t *peer_key_external,
size_t peer_key_length)
{
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
psa_status_t unlock_status = PSA_ERROR_CORRUPTION_DETECTED;
psa_key_slot_t *slot;
+ LOCAL_INPUT_DECLARE(peer_key_external, peer_key);
if (!PSA_ALG_IS_KEY_AGREEMENT(operation->alg)) {
return PSA_ERROR_INVALID_ARGUMENT;
if (status != PSA_SUCCESS) {
return status;
}
+
+ LOCAL_INPUT_ALLOC(peer_key_external, peer_key_length, peer_key);
status = psa_key_agreement_internal(operation, step,
slot,
peer_key, peer_key_length);
+
+#if !defined(MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS)
+exit:
+#endif
if (status != PSA_SUCCESS) {
psa_key_derivation_abort(operation);
} else {
unlock_status = psa_unlock_key_slot(slot);
+ LOCAL_INPUT_FREE(peer_key_external, peer_key);
return (status == PSA_SUCCESS) ? unlock_status : status;
}
psa_status_t psa_raw_key_agreement(psa_algorithm_t alg,
mbedtls_svc_key_id_t private_key,
- const uint8_t *peer_key,
+ const uint8_t *peer_key_external,
size_t peer_key_length,
- uint8_t *output,
+ uint8_t *output_external,
size_t output_size,
size_t *output_length)
{
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
psa_status_t unlock_status = PSA_ERROR_CORRUPTION_DETECTED;
psa_key_slot_t *slot = NULL;
+ size_t expected_length;
+ LOCAL_INPUT_DECLARE(peer_key_external, peer_key);
+ LOCAL_OUTPUT_DECLARE(output_external, output);
+ LOCAL_OUTPUT_ALLOC(output_external, output_size, output);
if (!PSA_ALG_IS_KEY_AGREEMENT(alg)) {
status = PSA_ERROR_INVALID_ARGUMENT;
* PSA_RAW_KEY_AGREEMENT_OUTPUT_SIZE() is exact so the point is moot.
* If FFDH is implemented, PSA_RAW_KEY_AGREEMENT_OUTPUT_SIZE() can easily
* be exact for it as well. */
- size_t expected_length =
+ expected_length =
PSA_RAW_KEY_AGREEMENT_OUTPUT_SIZE(slot->attr.type, slot->attr.bits);
if (output_size < expected_length) {
status = PSA_ERROR_BUFFER_TOO_SMALL;
goto exit;
}
+ LOCAL_INPUT_ALLOC(peer_key_external, peer_key_length, peer_key);
status = psa_key_agreement_raw_internal(alg, slot,
peer_key, peer_key_length,
output, output_size,
output_length);
exit:
- if (status != PSA_SUCCESS) {
+ /* Check for successful allocation of output,
+ * with an unsuccessful status. */
+ if (output != NULL && status != PSA_SUCCESS) {
/* If an error happens and is not handled properly, the output
* may be used as a key to protect sensitive data. Arrange for such
* a key to be random, which is likely to result in decryption or
* some constant data such as zeros, which would result in the data
* being protected with a reproducible, easily knowable key.
*/
- psa_generate_random(output, output_size);
+ psa_generate_random_internal(output, output_size);
*output_length = output_size;
}
+ if (output == NULL) {
+ /* output allocation failed. */
+ *output_length = 0;
+ }
+
unlock_status = psa_unlock_key_slot(slot);
+ LOCAL_INPUT_FREE(peer_key_external, peer_key);
+ LOCAL_OUTPUT_FREE(output_external, output);
return (status == PSA_SUCCESS) ? unlock_status : status;
}
-
/****************************************************************/
/* Random generation */
/****************************************************************/
+#if defined(MBEDTLS_PSA_INJECT_ENTROPY)
+#include "mbedtls/entropy_poll.h"
+#endif
+
/** Initialize the PSA random generator.
*/
static void mbedtls_psa_random_init(mbedtls_psa_random_context_t *rng)
#endif /* MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG */
}
-psa_status_t psa_generate_random(uint8_t *output,
+psa_status_t psa_generate_random(uint8_t *output_external,
size_t output_size)
{
- GUARD_MODULE_INITIALIZED;
-
-#if defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG)
+ psa_status_t status;
- size_t output_length = 0;
- psa_status_t status = mbedtls_psa_external_get_random(&global_data.rng,
- output, output_size,
- &output_length);
- if (status != PSA_SUCCESS) {
- return status;
- }
- /* Breaking up a request into smaller chunks is currently not supported
- * for the external RNG interface. */
- if (output_length != output_size) {
- return PSA_ERROR_INSUFFICIENT_ENTROPY;
- }
- return PSA_SUCCESS;
+ LOCAL_OUTPUT_DECLARE(output_external, output);
+ LOCAL_OUTPUT_ALLOC(output_external, output_size, output);
-#else /* MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG */
+ status = psa_generate_random_internal(output, output_size);
- while (output_size > 0) {
- size_t request_size =
- (output_size > MBEDTLS_PSA_RANDOM_MAX_REQUEST ?
- MBEDTLS_PSA_RANDOM_MAX_REQUEST :
- output_size);
- int ret = mbedtls_psa_get_random(MBEDTLS_PSA_RANDOM_STATE,
- output, request_size);
- if (ret != 0) {
- return mbedtls_to_psa_error(ret);
- }
- output_size -= request_size;
- output += request_size;
- }
- return PSA_SUCCESS;
-#endif /* MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG */
+#if !defined(MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS)
+exit:
+#endif
+ LOCAL_OUTPUT_FREE(output_external, output);
+ return status;
}
/* Wrapper function allowing the classic API to use the PSA RNG.
#endif /* MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG */
#if defined(MBEDTLS_PSA_INJECT_ENTROPY)
-#include "mbedtls/entropy_poll.h"
-
psa_status_t mbedtls_psa_inject_entropy(const uint8_t *seed,
size_t seed_size)
{
return status;
}
+/* Memory copying test hooks. These are called before input copy, after input
+ * copy, before output copy and after output copy, respectively.
+ * They are used by memory-poisoning tests to temporarily unpoison buffers
+ * while they are copied. */
+#if defined(MBEDTLS_TEST_HOOKS)
+void (*psa_input_pre_copy_hook)(const uint8_t *input, size_t input_len) = NULL;
+void (*psa_input_post_copy_hook)(const uint8_t *input, size_t input_len) = NULL;
+void (*psa_output_pre_copy_hook)(const uint8_t *output, size_t output_len) = NULL;
+void (*psa_output_post_copy_hook)(const uint8_t *output, size_t output_len) = NULL;
+#endif
+
+/** Copy from an input buffer to a local copy.
+ *
+ * \param[in] input Pointer to input buffer.
+ * \param[in] input_len Length of the input buffer.
+ * \param[out] input_copy Pointer to a local copy in which to store the input data.
+ * \param[out] input_copy_len Length of the local copy buffer.
+ * \return #PSA_SUCCESS, if the buffer was successfully
+ * copied.
+ * \return #PSA_ERROR_CORRUPTION_DETECTED, if the local
+ * copy is too small to hold contents of the
+ * input buffer.
+ */
+MBEDTLS_STATIC_TESTABLE
+psa_status_t psa_crypto_copy_input(const uint8_t *input, size_t input_len,
+ uint8_t *input_copy, size_t input_copy_len)
+{
+ if (input_len > input_copy_len) {
+ return PSA_ERROR_CORRUPTION_DETECTED;
+ }
+
+#if defined(MBEDTLS_TEST_HOOKS)
+ if (psa_input_pre_copy_hook != NULL) {
+ psa_input_pre_copy_hook(input, input_len);
+ }
+#endif
+
+ if (input_len > 0) {
+ memcpy(input_copy, input, input_len);
+ }
+
+#if defined(MBEDTLS_TEST_HOOKS)
+ if (psa_input_post_copy_hook != NULL) {
+ psa_input_post_copy_hook(input, input_len);
+ }
+#endif
+
+ return PSA_SUCCESS;
+}
+
+/** Copy from a local output buffer into a user-supplied one.
+ *
+ * \param[in] output_copy Pointer to a local buffer containing the output.
+ * \param[in] output_copy_len Length of the local buffer.
+ * \param[out] output Pointer to user-supplied output buffer.
+ * \param[out] output_len Length of the user-supplied output buffer.
+ * \return #PSA_SUCCESS, if the buffer was successfully
+ * copied.
+ * \return #PSA_ERROR_BUFFER_TOO_SMALL, if the
+ * user-supplied output buffer is too small to
+ * hold the contents of the local buffer.
+ */
+MBEDTLS_STATIC_TESTABLE
+psa_status_t psa_crypto_copy_output(const uint8_t *output_copy, size_t output_copy_len,
+ uint8_t *output, size_t output_len)
+{
+ if (output_len < output_copy_len) {
+ return PSA_ERROR_BUFFER_TOO_SMALL;
+ }
+
+#if defined(MBEDTLS_TEST_HOOKS)
+ if (psa_output_pre_copy_hook != NULL) {
+ psa_output_pre_copy_hook(output, output_len);
+ }
+#endif
+
+ if (output_copy_len > 0) {
+ memcpy(output, output_copy, output_copy_len);
+ }
+
+#if defined(MBEDTLS_TEST_HOOKS)
+ if (psa_output_post_copy_hook != NULL) {
+ psa_output_post_copy_hook(output, output_len);
+ }
+#endif
+
+ return PSA_SUCCESS;
+}
+
+psa_status_t psa_crypto_local_input_alloc(const uint8_t *input, size_t input_len,
+ psa_crypto_local_input_t *local_input)
+{
+ psa_status_t status;
+
+ *local_input = PSA_CRYPTO_LOCAL_INPUT_INIT;
+
+ if (input_len == 0) {
+ return PSA_SUCCESS;
+ }
+
+ local_input->buffer = mbedtls_calloc(input_len, 1);
+ if (local_input->buffer == NULL) {
+ /* Since we dealt with the zero-length case above, we know that
+ * a NULL return value means a failure of allocation. */
+ return PSA_ERROR_INSUFFICIENT_MEMORY;
+ }
+ /* From now on, we must free local_input->buffer on error. */
+
+ local_input->length = input_len;
+
+ status = psa_crypto_copy_input(input, input_len,
+ local_input->buffer, local_input->length);
+ if (status != PSA_SUCCESS) {
+ goto error;
+ }
+
+ return PSA_SUCCESS;
+
+error:
+ mbedtls_free(local_input->buffer);
+ local_input->buffer = NULL;
+ local_input->length = 0;
+ return status;
+}
+
+void psa_crypto_local_input_free(psa_crypto_local_input_t *local_input)
+{
+ mbedtls_free(local_input->buffer);
+ local_input->buffer = NULL;
+ local_input->length = 0;
+}
+
+psa_status_t psa_crypto_local_output_alloc(uint8_t *output, size_t output_len,
+ psa_crypto_local_output_t *local_output)
+{
+ *local_output = PSA_CRYPTO_LOCAL_OUTPUT_INIT;
+
+ if (output_len == 0) {
+ return PSA_SUCCESS;
+ }
+ local_output->buffer = mbedtls_calloc(output_len, 1);
+ if (local_output->buffer == NULL) {
+ /* Since we dealt with the zero-length case above, we know that
+ * a NULL return value means a failure of allocation. */
+ return PSA_ERROR_INSUFFICIENT_MEMORY;
+ }
+ local_output->length = output_len;
+ local_output->original = output;
+
+ return PSA_SUCCESS;
+}
+
+psa_status_t psa_crypto_local_output_free(psa_crypto_local_output_t *local_output)
+{
+ psa_status_t status;
+
+ if (local_output->buffer == NULL) {
+ local_output->length = 0;
+ return PSA_SUCCESS;
+ }
+ if (local_output->original == NULL) {
+ /* We have an internal copy but nothing to copy back to. */
+ return PSA_ERROR_CORRUPTION_DETECTED;
+ }
+
+ status = psa_crypto_copy_output(local_output->buffer, local_output->length,
+ local_output->original, local_output->length);
+ if (status != PSA_SUCCESS) {
+ return status;
+ }
+
+ mbedtls_free(local_output->buffer);
+ local_output->buffer = NULL;
+ local_output->length = 0;
+
+ return PSA_SUCCESS;
+}
+
#endif /* MBEDTLS_PSA_CRYPTO_C */
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#include "common.h"
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef PSA_CRYPTO_AEAD_H
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#include "common.h"
output_length);
} else
#endif /* MBEDTLS_PSA_BUILTIN_ALG_ECB_NO_PADDING */
- {
+ if (input_length == 0) {
+ /* There is no input, nothing to be done */
+ *output_length = 0;
+ status = PSA_SUCCESS;
+ } else {
status = mbedtls_to_psa_error(
mbedtls_cipher_update(&operation->ctx.cipher, input,
input_length, output, output_length));
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef PSA_CRYPTO_CIPHER_H
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#include "common.h"
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef PSA_CRYPTO_CORE_H
const uint8_t *data,
size_t data_length);
-/** Convert an mbed TLS error code to a PSA error code
+/** Convert an Mbed TLS error code to a PSA error code
*
* \note This function is provided solely for the convenience of
* Mbed TLS and may be removed at any time without notice.
*
- * \param ret An mbed TLS-thrown error code
+ * \param ret An Mbed TLS-thrown error code
*
* \return The corresponding PSA error code
*/
psa_algorithm_t alg, const uint8_t *hash, size_t hash_length,
const uint8_t *signature, size_t signature_length);
+typedef struct psa_crypto_local_input_s {
+ uint8_t *buffer;
+ size_t length;
+} psa_crypto_local_input_t;
+
+#define PSA_CRYPTO_LOCAL_INPUT_INIT ((psa_crypto_local_input_t) { NULL, 0 })
+
+/** Allocate a local copy of an input buffer and copy the contents into it.
+ *
+ * \param[in] input Pointer to input buffer.
+ * \param[in] input_len Length of the input buffer.
+ * \param[out] local_input Pointer to a psa_crypto_local_input_t struct
+ * containing a local input copy.
+ * \return #PSA_SUCCESS, if the buffer was successfully
+ * copied.
+ * \return #PSA_ERROR_INSUFFICIENT_MEMORY, if a copy of
+ * the buffer cannot be allocated.
+ */
+psa_status_t psa_crypto_local_input_alloc(const uint8_t *input, size_t input_len,
+ psa_crypto_local_input_t *local_input);
+
+/** Free a local copy of an input buffer.
+ *
+ * \param[in] local_input Pointer to a psa_crypto_local_input_t struct
+ * populated by a previous call to
+ * psa_crypto_local_input_alloc().
+ */
+void psa_crypto_local_input_free(psa_crypto_local_input_t *local_input);
+
+typedef struct psa_crypto_local_output_s {
+ uint8_t *original;
+ uint8_t *buffer;
+ size_t length;
+} psa_crypto_local_output_t;
+
+#define PSA_CRYPTO_LOCAL_OUTPUT_INIT ((psa_crypto_local_output_t) { NULL, NULL, 0 })
+
+/** Allocate a local copy of an output buffer.
+ *
+ * \note This does not copy any data from the original
+ * output buffer but only allocates a buffer
+ * whose contents will be copied back to the
+ * original in a future call to
+ * psa_crypto_local_output_free().
+ *
+ * \param[in] output Pointer to output buffer.
+ * \param[in] output_len Length of the output buffer.
+ * \param[out] local_output Pointer to a psa_crypto_local_output_t struct to
+ * populate with the local output copy.
+ * \return #PSA_SUCCESS, if the buffer was successfully
+ * copied.
+ * \return #PSA_ERROR_INSUFFICIENT_MEMORY, if a copy of
+ * the buffer cannot be allocated.
+ */
+psa_status_t psa_crypto_local_output_alloc(uint8_t *output, size_t output_len,
+ psa_crypto_local_output_t *local_output);
+
+/** Copy from a local copy of an output buffer back to the original, then
+ * free the local copy.
+ *
+ * \param[in] local_output Pointer to a psa_crypto_local_output_t struct
+ * populated by a previous call to
+ * psa_crypto_local_output_alloc().
+ * \return #PSA_SUCCESS, if the local output was
+ * successfully copied back to the original.
+ * \return #PSA_ERROR_CORRUPTION_DETECTED, if the output
+ * could not be copied back to the original.
+ */
+psa_status_t psa_crypto_local_output_free(psa_crypto_local_output_t *local_output);
+
#endif /* PSA_CRYPTO_CORE_H */
* Warning: This file will be auto-generated in the future.
*/
/* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#include "psa_crypto_aead.h"
* Warning: This file will be auto-generated in the future.
*/
/* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef PSA_CRYPTO_DRIVER_WRAPPERS_H
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#include "common.h"
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef PSA_CRYPTO_ECP_H
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#include "common.h"
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef PSA_CRYPTO_HASH_H
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef PSA_CRYPTO_INVASIVE_H
psa_status_t psa_mac_key_can_do(
psa_algorithm_t algorithm,
psa_key_type_t key_type);
+
+psa_status_t psa_crypto_copy_input(const uint8_t *input, size_t input_len,
+ uint8_t *input_copy, size_t input_copy_len);
+
+psa_status_t psa_crypto_copy_output(const uint8_t *output_copy, size_t output_copy_len,
+ uint8_t *output, size_t output_len);
+
+/*
+ * Test hooks to use for memory unpoisoning/poisoning in copy functions.
+ */
+extern void (*psa_input_pre_copy_hook)(const uint8_t *input, size_t input_len);
+extern void (*psa_input_post_copy_hook)(const uint8_t *input, size_t input_len);
+extern void (*psa_output_pre_copy_hook)(const uint8_t *output, size_t output_len);
+extern void (*psa_output_post_copy_hook)(const uint8_t *output, size_t output_len);
+
#endif /* MBEDTLS_TEST_HOOKS && MBEDTLS_PSA_CRYPTO_C */
#endif /* PSA_CRYPTO_INVASIVE_H */
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef PSA_CRYPTO_ITS_H
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#include "common.h"
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef PSA_CRYPTO_MAC_H
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef PSA_CRYPTO_RANDOM_IMPL_H
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#include "common.h"
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef PSA_CRYPTO_RSA_H
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#include "common.h"
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef PSA_CRYPTO_SE_H
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#include "common.h"
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef PSA_CRYPTO_SLOT_MANAGEMENT_H
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#include "common.h"
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#ifndef PSA_CRYPTO_STORAGE_H
/* Sanity check: a file size must fit in 32 bits. Allow a generous
* 64kB of metadata. */
#if PSA_CRYPTO_MAX_STORAGE_SIZE > 0xffff0000
-#error PSA_CRYPTO_MAX_STORAGE_SIZE > 0xffff0000
+#error "PSA_CRYPTO_MAX_STORAGE_SIZE > 0xffff0000"
#endif
/** The maximum permitted persistent slot number.
#if defined(MBEDTLS_PSA_CRYPTO_SE_C)
/** This symbol is defined if transaction support is required. */
-#define PSA_CRYPTO_STORAGE_HAS_TRANSACTIONS
+#define PSA_CRYPTO_STORAGE_HAS_TRANSACTIONS 1
#endif
#if defined(PSA_CRYPTO_STORAGE_HAS_TRANSACTIONS)
*/
/*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#include "common.h"
* RIPE MD-160 implementation
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
/*
* The RSA public-key cryptosystem
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
/*
#include "mbedtls/error.h"
#include "constant_time_internal.h"
#include "mbedtls/constant_time.h"
+#include "bignum_internal.h"
#include <string.h>
return ret;
}
+/*
+ * Unblind
+ * T = T * Vf mod N
+ */
+static int rsa_unblind(mbedtls_mpi *T, mbedtls_mpi *Vf, const mbedtls_mpi *N)
+{
+ int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
+ const size_t nlimbs = N->n;
+ const size_t tlimbs = 2 * (nlimbs + 1);
+
+ mbedtls_mpi_uint mm = mbedtls_mpi_montmul_init(N->p);
+
+ mbedtls_mpi RR, M_T;
+
+ mbedtls_mpi_init(&RR);
+ mbedtls_mpi_init(&M_T);
+
+ MBEDTLS_MPI_CHK(mbedtls_mpi_get_mont_r2_unsafe(&RR, N));
+ MBEDTLS_MPI_CHK(mbedtls_mpi_grow(&M_T, tlimbs));
+
+ MBEDTLS_MPI_CHK(mbedtls_mpi_grow(T, nlimbs));
+ MBEDTLS_MPI_CHK(mbedtls_mpi_grow(Vf, nlimbs));
+
+ /* T = T * Vf mod N
+ * Reminder: montmul(A, B, N) = A * B * R^-1 mod N
+ * Usually both operands are multiplied by R mod N beforehand, yielding a
+ * result that's also * R mod N (aka "in the Montgomery domain"). Here we
+ * only multiply one operand by R mod N, so the result is directly what we
+ * want - no need to call `mpi_montred()` on it. */
+ mbedtls_mpi_montmul(T, &RR, N, mm, &M_T);
+ mbedtls_mpi_montmul(T, Vf, N, mm, &M_T);
+
+cleanup:
+
+ mbedtls_mpi_free(&RR);
+ mbedtls_mpi_free(&M_T);
+
+ return ret;
+}
+
/*
* Exponent blinding supposed to prevent side-channel attacks using multiple
* traces of measurements to recover the RSA key. The more collisions are there,
/* Temporaries holding the initial input and the double
* checked result; should be the same in the end. */
- mbedtls_mpi I, C;
+ mbedtls_mpi input_blinded, check_result_blinded;
RSA_VALIDATE_RET(ctx != NULL);
RSA_VALIDATE_RET(input != NULL);
mbedtls_mpi_init(&TP); mbedtls_mpi_init(&TQ);
#endif
- mbedtls_mpi_init(&I);
- mbedtls_mpi_init(&C);
+ mbedtls_mpi_init(&input_blinded);
+ mbedtls_mpi_init(&check_result_blinded);
/* End of MPI initialization */
goto cleanup;
}
- MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&I, &T));
-
if (f_rng != NULL) {
/*
* Blinding
#endif /* MBEDTLS_RSA_NO_CRT */
}
+ /* Make a copy of the input (after blinding if there was any) */
+ MBEDTLS_MPI_CHK(mbedtls_mpi_copy(&input_blinded, &T));
+
#if defined(MBEDTLS_RSA_NO_CRT)
MBEDTLS_MPI_CHK(mbedtls_mpi_exp_mod(&T, &T, D, &ctx->N, &ctx->RN));
#else
MBEDTLS_MPI_CHK(mbedtls_mpi_add_mpi(&T, &TQ, &TP));
#endif /* MBEDTLS_RSA_NO_CRT */
+ /* Verify the result to prevent glitching attacks. */
+ MBEDTLS_MPI_CHK(mbedtls_mpi_exp_mod(&check_result_blinded, &T, &ctx->E,
+ &ctx->N, &ctx->RN));
+ if (mbedtls_mpi_cmp_mpi(&check_result_blinded, &input_blinded) != 0) {
+ ret = MBEDTLS_ERR_RSA_VERIFY_FAILED;
+ goto cleanup;
+ }
+
if (f_rng != NULL) {
/*
* Unblind
* T = T * Vf mod N
*/
- MBEDTLS_MPI_CHK(mbedtls_mpi_mul_mpi(&T, &T, &ctx->Vf));
- MBEDTLS_MPI_CHK(mbedtls_mpi_mod_mpi(&T, &T, &ctx->N));
- }
-
- /* Verify the result to prevent glitching attacks. */
- MBEDTLS_MPI_CHK(mbedtls_mpi_exp_mod(&C, &T, &ctx->E,
- &ctx->N, &ctx->RN));
- if (mbedtls_mpi_cmp_mpi(&C, &I) != 0) {
- ret = MBEDTLS_ERR_RSA_VERIFY_FAILED;
- goto cleanup;
+ MBEDTLS_MPI_CHK(rsa_unblind(&T, &ctx->Vf, &ctx->N));
}
olen = ctx->len;
mbedtls_mpi_free(&TP); mbedtls_mpi_free(&TQ);
#endif
- mbedtls_mpi_free(&C);
- mbedtls_mpi_free(&I);
+ mbedtls_mpi_free(&check_result_blinded);
+ mbedtls_mpi_free(&input_blinded);
if (ret != 0 && ret >= -0x007f) {
return MBEDTLS_ERROR_ADD(MBEDTLS_ERR_RSA_PRIVATE_FAILED, ret);
{
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
size_t ilen, i, pad_len;
- unsigned char *p, bad, pad_done;
+ unsigned char *p, pad_done;
+ int bad;
unsigned char buf[MBEDTLS_MPI_MAX_SIZE];
unsigned char lhash[MBEDTLS_MD_MAX_SIZE];
unsigned int hlen;
p += hlen; /* Skip seed */
/* Check lHash */
- for (i = 0; i < hlen; i++) {
- bad |= lhash[i] ^ *p++;
- }
+ bad |= mbedtls_ct_memcmp(lhash, p, hlen);
+ p += hlen;
/* Get zero-padding len, but always read till end of buffer
* (minus one, for the 01 byte) */
* Helper functions for the RSA module
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*
*/
}
for (; attempt < num_primes; ++attempt) {
- mbedtls_mpi_lset(&K, primes[attempt]);
+ MBEDTLS_MPI_CHK(mbedtls_mpi_lset(&K, primes[attempt]));
/* Check if gcd(K,N) = 1 */
MBEDTLS_MPI_CHK(mbedtls_mpi_gcd(P, &K, N));
* FIPS-180-1 compliant SHA-1 implementation
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
/*
* The SHA-1 standard was published by NIST in 1993.
* FIPS-180-2 compliant SHA-256 implementation
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
/*
* The SHA-256 Secure Hash Standard was published by NIST in 2002.
* FIPS-180-2 compliant SHA-384/512 implementation
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
/*
* The SHA-512 Secure Hash Standard was published by NIST in 2002.
* SSL session cache implementation
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
/*
* These session callbacks use a simple chained list
#if defined(MBEDTLS_SSL_CACHE_C)
#include "mbedtls/platform.h"
+#include "mbedtls/error.h"
#include "mbedtls/ssl_cache.h"
#include "mbedtls/ssl_internal.h"
int mbedtls_ssl_cache_get(void *data, mbedtls_ssl_session *session)
{
- int ret = 1;
+ int ret = MBEDTLS_ERR_SSL_CACHE_ENTRY_NOT_FOUND;
#if defined(MBEDTLS_HAVE_TIME)
mbedtls_time_t t = mbedtls_time(NULL);
#endif
mbedtls_ssl_cache_entry *cur, *entry;
#if defined(MBEDTLS_THREADING_C)
- if (mbedtls_mutex_lock(&cache->mutex) != 0) {
- return 1;
+ if ((ret = mbedtls_mutex_lock(&cache->mutex)) != 0) {
+ return ret;
}
#endif
ret = mbedtls_ssl_session_copy(session, &entry->session);
if (ret != 0) {
- ret = 1;
goto exit;
}
if ((session->peer_cert = mbedtls_calloc(1,
sizeof(mbedtls_x509_crt))) == NULL) {
- ret = 1;
+ ret = MBEDTLS_ERR_SSL_ALLOC_FAILED;
goto exit;
}
mbedtls_x509_crt_init(session->peer_cert);
- if (mbedtls_x509_crt_parse(session->peer_cert, entry->peer_cert.p,
- entry->peer_cert.len) != 0) {
+ if ((ret = mbedtls_x509_crt_parse(session->peer_cert, entry->peer_cert.p,
+ entry->peer_cert.len)) != 0) {
mbedtls_free(session->peer_cert);
session->peer_cert = NULL;
- ret = 1;
goto exit;
}
}
exit:
#if defined(MBEDTLS_THREADING_C)
if (mbedtls_mutex_unlock(&cache->mutex) != 0) {
- ret = 1;
+ ret = MBEDTLS_ERR_THREADING_MUTEX_ERROR;
}
#endif
int mbedtls_ssl_cache_set(void *data, const mbedtls_ssl_session *session)
{
- int ret = 1;
+ int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
#if defined(MBEDTLS_HAVE_TIME)
mbedtls_time_t t = mbedtls_time(NULL), oldest = 0;
mbedtls_ssl_cache_entry *old = NULL;
*/
if (count >= cache->max_entries) {
if (old == NULL) {
- ret = 1;
+ /* This should only happen on an ill-configured cache
+ * with max_entries == 0. */
+ ret = MBEDTLS_ERR_SSL_INTERNAL_ERROR;
goto exit;
}
*/
if (count >= cache->max_entries) {
if (cache->chain == NULL) {
- ret = 1;
+ ret = MBEDTLS_ERR_SSL_INTERNAL_ERROR;
goto exit;
}
*/
cur = mbedtls_calloc(1, sizeof(mbedtls_ssl_cache_entry));
if (cur == NULL) {
- ret = 1;
+ ret = MBEDTLS_ERR_SSL_ALLOC_FAILED;
goto exit;
}
* field anymore in the first place, and we're done after this call. */
ret = mbedtls_ssl_session_copy(&cur->session, session);
if (ret != 0) {
- ret = 1;
goto exit;
}
cur->peer_cert.p =
mbedtls_calloc(1, cur->session.peer_cert->raw.len);
if (cur->peer_cert.p == NULL) {
- ret = 1;
+ ret = MBEDTLS_ERR_SSL_ALLOC_FAILED;
goto exit;
}
exit:
#if defined(MBEDTLS_THREADING_C)
if (mbedtls_mutex_unlock(&cache->mutex) != 0) {
- ret = 1;
+ ret = MBEDTLS_ERR_THREADING_MUTEX_ERROR;
}
#endif
/**
* \file ssl_ciphersuites.c
*
- * \brief SSL ciphersuites for mbed TLS
+ * \brief SSL ciphersuites for Mbed TLS
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#include "common.h"
* SSLv3/TLSv1 client-side functions
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#include "common.h"
* DTLS cookie callbacks implementation
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
/*
* These session callbacks use a simple chained list
* (record layer + retransmission state machine)
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
/*
* The SSL 3.0 specification was drafted by Netscape in 1996,
#if defined(MBEDTLS_ARC4_C) || defined(MBEDTLS_CIPHER_NULL_CIPHER)
if (mode == MBEDTLS_MODE_STREAM) {
+ if (rec->data_len < transform->maclen) {
+ MBEDTLS_SSL_DEBUG_MSG(1,
+ ("Record too short for MAC:"
+ " %" MBEDTLS_PRINTF_SIZET " < %" MBEDTLS_PRINTF_SIZET,
+ rec->data_len, transform->maclen));
+ return MBEDTLS_ERR_SSL_INVALID_MAC;
+ }
+
padlen = 0;
if ((ret = mbedtls_cipher_crypt(&transform->cipher_ctx_dec,
transform->iv_dec,
unsigned char mac_expect[MBEDTLS_SSL_MAC_ADD] = { 0 };
unsigned char mac_peer[MBEDTLS_SSL_MAC_ADD] = { 0 };
- /* If the initial value of padlen was such that
+ /* For CBC+MAC, If the initial value of padlen was such that
* data_len < maclen + padlen + 1, then padlen
* got reset to 1, and the initial check
* data_len >= minlen + maclen + 1
* subtracted either padlen + 1 (if the padding was correct)
* or 0 (if the padding was incorrect) since then,
* hence data_len >= maclen in any case.
+ *
+ * For stream ciphers, we checked above that
+ * data_len >= maclen.
*/
rec->data_len -= transform->maclen;
ssl_extract_add_data_from_record(add_data, &add_data_len, rec,
* SSLv3/TLSv1 server-side functions
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#include "common.h"
* TLS server tickets callbacks implementation
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#include "common.h"
* SSLv3/TLSv1 shared functions
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
/*
* The SSL 3.0 specification was drafted by Netscape in 1996,
!defined(MBEDTLS_SSL_EXPORT_KEYS) && \
!defined(MBEDTLS_SSL_DTLS_CONNECTION_ID) && \
!defined(MBEDTLS_DEBUG_C)
- ssl = NULL; /* make sure we don't use it except for those cases */
- (void) ssl;
+ (void) ssl; /* ssl is unused except for those cases */
#endif
/*
#define SSL_SERIALIZED_SESSION_CONFIG_CRT 0
#endif /* MBEDTLS_X509_CRT_PARSE_C */
+#if defined(MBEDTLS_SSL_KEEP_PEER_CERTIFICATE)
+#define SSL_SERIALIZED_SESSION_CONFIG_KEEP_PEER_CRT 1
+#else
+#define SSL_SERIALIZED_SESSION_CONFIG_KEEP_PEER_CRT 0
+#endif /* MBEDTLS_SSL_SESSION_TICKETS */
+
#if defined(MBEDTLS_SSL_CLI_C) && defined(MBEDTLS_SSL_SESSION_TICKETS)
#define SSL_SERIALIZED_SESSION_CONFIG_CLIENT_TICKET 1
#else
#define SSL_SERIALIZED_SESSION_CONFIG_TRUNC_HMAC_BIT 4
#define SSL_SERIALIZED_SESSION_CONFIG_ETM_BIT 5
#define SSL_SERIALIZED_SESSION_CONFIG_TICKET_BIT 6
+#define SSL_SERIALIZED_SESSION_CONFIG_KEEP_PEER_CRT_BIT 7
#define SSL_SERIALIZED_SESSION_CONFIG_BITFLAG \
((uint16_t) ( \
(SSL_SERIALIZED_SESSION_CONFIG_TRUNC_HMAC << \
SSL_SERIALIZED_SESSION_CONFIG_TRUNC_HMAC_BIT) | \
(SSL_SERIALIZED_SESSION_CONFIG_ETM << SSL_SERIALIZED_SESSION_CONFIG_ETM_BIT) | \
- (SSL_SERIALIZED_SESSION_CONFIG_TICKET << SSL_SERIALIZED_SESSION_CONFIG_TICKET_BIT)))
+ (SSL_SERIALIZED_SESSION_CONFIG_TICKET << SSL_SERIALIZED_SESSION_CONFIG_TICKET_BIT) | \
+ (SSL_SERIALIZED_SESSION_CONFIG_KEEP_PEER_CRT << \
+ SSL_SERIALIZED_SESSION_CONFIG_KEEP_PEER_CRT_BIT)))
-static unsigned char ssl_serialized_session_header[] = {
+static const unsigned char ssl_serialized_session_header[] = {
MBEDTLS_VERSION_MAJOR,
MBEDTLS_VERSION_MINOR,
MBEDTLS_VERSION_PATCH,
* // the setting of those compile-time
* // configuration options which influence
* // the structure of mbedtls_ssl_session.
- * uint64 start_time;
- * uint8 ciphersuite[2]; // defined by the standard
- * uint8 compression; // 0 or 1
- * uint8 session_id_len; // at most 32
- * opaque session_id[32];
- * opaque master[48]; // fixed length in the standard
- * uint32 verify_result;
- * opaque peer_cert<0..2^24-1>; // length 0 means no peer cert
- * opaque ticket<0..2^24-1>; // length 0 means no ticket
- * uint32 ticket_lifetime;
- * uint8 mfl_code; // up to 255 according to standard
- * uint8 trunc_hmac; // 0 or 1
- * uint8 encrypt_then_mac; // 0 or 1
+ * #if defined(MBEDTLS_HAVE_TIME)
+ * uint64 start_time;
+ * #endif
+ * uint8 ciphersuite[2]; // defined by the standard
+ * uint8 compression; // 0 or 1
+ * uint8 session_id_len; // at most 32
+ * opaque session_id[32];
+ * opaque master[48]; // fixed length in the standard
+ * uint32 verify_result;
+ * #if defined(MBEDTLS_X509_CRT_PARSE_C)
+ * #if defined(MBEDTLS_SSL_KEEP_PEER_CERTIFICATE)
+ * opaque peer_cert<0..2^24-1>; // length 0 means no peer cert
+ * #else
+ * uint8 peer_cert_digest_type;
+ * opaque peer_cert_digest<0..2^8-1>
+ * #endif
+ * #endif
+ * #if defined(MBEDTLS_SSL_SESSION_TICKETS) && defined(MBEDTLS_SSL_CLI_C)
+ * opaque ticket<0..2^24-1>; // length 0 means no ticket
+ * uint32 ticket_lifetime;
+ * #endif
+ * #if defined(MBEDTLS_SSL_MAX_FRAGMENT_LENGTH)
+ * uint8 mfl_code; // up to 255 according to standard
+ * #endif
+ * #if defined(MBEDTLS_SSL_TRUNCATED_HMAC)
+ * uint8 trunc_hmac; // 0 or 1
+ * #endif
+ * #if defined(MBEDTLS_SSL_ENCRYPT_THEN_MAC)
+ * uint8 encrypt_then_mac; // 0 or 1
+ * #endif
*
* The order is the same as in the definition of the structure, except
* verify_result is put before peer_cert so that all mandatory fields come
(SSL_SERIALIZED_CONTEXT_CONFIG_ALPN << SSL_SERIALIZED_CONTEXT_CONFIG_ALPN_BIT) | \
0u))
-static unsigned char ssl_serialized_context_header[] = {
+static const unsigned char ssl_serialized_context_header[] = {
MBEDTLS_VERSION_MAJOR,
MBEDTLS_VERSION_MINOR,
MBEDTLS_VERSION_PATCH,
/* alpn_chosen should point to an item in the configured list */
for (cur = ssl->conf->alpn_list; *cur != NULL; cur++) {
if (strlen(*cur) == alpn_len &&
- memcmp(p, cur, alpn_len) == 0) {
+ memcmp(p, *cur, alpn_len) == 0) {
ssl->alpn_chosen = *cur;
break;
}
}
#if defined(MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED)
-static int ssl_preset_default_hashes[] = {
+static const int ssl_preset_default_hashes[] = {
#if defined(MBEDTLS_SHA512_C)
MBEDTLS_MD_SHA512,
#endif
};
#endif
-static int ssl_preset_suiteb_ciphersuites[] = {
+static const int ssl_preset_suiteb_ciphersuites[] = {
MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
0
};
#if defined(MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED)
-static int ssl_preset_suiteb_hashes[] = {
+static const int ssl_preset_suiteb_hashes[] = {
MBEDTLS_MD_SHA256,
MBEDTLS_MD_SHA384,
MBEDTLS_MD_NONE
#endif
#if defined(MBEDTLS_ECP_C)
-static mbedtls_ecp_group_id ssl_preset_suiteb_curves[] = {
+static const mbedtls_ecp_group_id ssl_preset_suiteb_curves[] = {
#if defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED)
MBEDTLS_ECP_DP_SECP256R1,
#endif
* TLS 1.3 key schedule
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 ( the "License" ); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#include "common.h"
* TLS 1.3 key schedule
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 ( the "License" ); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#if !defined(MBEDTLS_SSL_TLS1_3_KEYS_H)
#define MBEDTLS_SSL_TLS1_3_KEYS_H
* Threading abstraction layer
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
/*
* Portable interface to the CPU cycle counter
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
+#include <string.h>
+
#include "common.h"
#include "mbedtls/platform.h"
unsigned long mbedtls_timing_get_timer(struct mbedtls_timing_hr_time *val, int reset)
{
- struct _hr_time *t = (struct _hr_time *) val;
+ struct _hr_time t;
if (reset) {
- QueryPerformanceCounter(&t->start);
+ QueryPerformanceCounter(&t.start);
+ memcpy(val, &t, sizeof(struct _hr_time));
return 0;
} else {
unsigned long delta;
LARGE_INTEGER now, hfreq;
+ /* We can't safely cast val because it may not be aligned, so use memcpy */
+ memcpy(&t, val, sizeof(struct _hr_time));
QueryPerformanceCounter(&now);
QueryPerformanceFrequency(&hfreq);
- delta = (unsigned long) ((now.QuadPart - t->start.QuadPart) * 1000ul
+ delta = (unsigned long) ((now.QuadPart - t.start.QuadPart) * 1000ul
/ hfreq.QuadPart);
return delta;
}
unsigned long mbedtls_timing_get_timer(struct mbedtls_timing_hr_time *val, int reset)
{
- struct _hr_time *t = (struct _hr_time *) val;
+ struct _hr_time t;
if (reset) {
- gettimeofday(&t->start, NULL);
+ gettimeofday(&t.start, NULL);
+ memcpy(val, &t, sizeof(struct _hr_time));
return 0;
} else {
unsigned long delta;
struct timeval now;
+ /* We can't safely cast val because it may not be aligned, so use memcpy */
+ memcpy(&t, val, sizeof(struct _hr_time));
gettimeofday(&now, NULL);
- delta = (now.tv_sec - t->start.tv_sec) * 1000ul
- + (now.tv_usec - t->start.tv_usec) / 1000;
+ delta = (now.tv_sec - t.start.tv_sec) * 1000ul
+ + (now.tv_usec - t.start.tv_usec) / 1000;
return delta;
}
}
uint32_t a = 0, b = 0;
mbedtls_timing_delay_context ctx;
+ memset(&ctx, 0, sizeof(ctx));
if (verbose != 0) {
mbedtls_printf(" TIMING tests note: will take some time!\n");
}
* Version feature information
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#include "common.h"
#if defined(MBEDTLS_PLATFORM_SETUP_TEARDOWN_ALT)
"MBEDTLS_PLATFORM_SETUP_TEARDOWN_ALT",
#endif /* MBEDTLS_PLATFORM_SETUP_TEARDOWN_ALT */
+#if defined(MBEDTLS_PLATFORM_GMTIME_R_ALT)
+ "MBEDTLS_PLATFORM_GMTIME_R_ALT",
+#endif /* MBEDTLS_PLATFORM_GMTIME_R_ALT */
+#if defined(MBEDTLS_PLATFORM_ZEROIZE_ALT)
+ "MBEDTLS_PLATFORM_ZEROIZE_ALT",
+#endif /* MBEDTLS_PLATFORM_ZEROIZE_ALT */
#if defined(MBEDTLS_DEPRECATED_WARNING)
"MBEDTLS_DEPRECATED_WARNING",
#endif /* MBEDTLS_DEPRECATED_WARNING */
#if defined(MBEDTLS_REMOVE_3DES_CIPHERSUITES)
"MBEDTLS_REMOVE_3DES_CIPHERSUITES",
#endif /* MBEDTLS_REMOVE_3DES_CIPHERSUITES */
+#if defined(MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED)
+ "MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED",
+#endif /* MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED */
#if defined(MBEDTLS_ECP_DP_SECP192R1_ENABLED)
"MBEDTLS_ECP_DP_SECP192R1_ENABLED",
#endif /* MBEDTLS_ECP_DP_SECP192R1_ENABLED */
#if defined(MBEDTLS_PSA_INJECT_ENTROPY)
"MBEDTLS_PSA_INJECT_ENTROPY",
#endif /* MBEDTLS_PSA_INJECT_ENTROPY */
+#if defined(MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS)
+ "MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS",
+#endif /* MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS */
#if defined(MBEDTLS_RSA_NO_CRT)
"MBEDTLS_RSA_NO_CRT",
#endif /* MBEDTLS_RSA_NO_CRT */
#if defined(MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH)
"MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH",
#endif /* MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH */
+#if defined(MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_KEY_EXCHANGE)
+ "MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_KEY_EXCHANGE",
+#endif /* MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_KEY_EXCHANGE */
#if defined(MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN)
"MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN",
#endif /* MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN */
* X.509 common functions for parsing and verification
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
/*
* The ITU-T X.509 standard defines a certificate format for PKI.
#include <time.h>
#endif
-#define CHECK(code) if ((ret = (code)) != 0) { return ret; }
+#define CHECK(code) \
+ do { \
+ if ((ret = (code)) != 0) { \
+ return ret; \
+ } \
+ } while (0)
+
#define CHECK_RANGE(min, max, val) \
- do \
- { \
- if ((val) < (min) || (val) > (max)) \
- { \
- return ret; \
+ do { \
+ if ((val) < (min) || (val) > (max)) { \
+ return ret; \
} \
} while (0)
* X.509 base functions for creating certificates / CSRs
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#include "common.h"
int mbedtls_x509_string_to_names(mbedtls_asn1_named_data **head, const char *name)
{
- int ret = 0;
+ int ret = MBEDTLS_ERR_X509_INVALID_NAME;
const char *s = name, *c = s;
const char *end = s + strlen(s);
const char *oid = NULL;
s = c + 1;
in_tag = 1;
+
+ /* Successfully parsed one name, update ret to success */
+ ret = 0;
}
if (!in_tag && s != c + 1) {
{
mbedtls_asn1_named_data *cur;
+ if (val_len > (SIZE_MAX - 1)) {
+ return MBEDTLS_ERR_X509_BAD_INPUT_DATA;
+ }
+
if ((cur = mbedtls_asn1_store_named_data(head, oid, oid_len,
NULL, val_len + 1)) == NULL) {
return MBEDTLS_ERR_X509_ALLOC_FAILED;
int mbedtls_x509_write_sig(unsigned char **p, unsigned char *start,
const char *oid, size_t oid_len,
- unsigned char *sig, size_t size)
+ unsigned char *sig, size_t size,
+ mbedtls_pk_type_t pk_alg)
{
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
+ int write_null_par;
size_t len = 0;
if (*p < start || (size_t) (*p - start) < size) {
// Write OID
//
- MBEDTLS_ASN1_CHK_ADD(len, mbedtls_asn1_write_algorithm_identifier(p, start, oid,
- oid_len, 0));
+ if (pk_alg == MBEDTLS_PK_ECDSA) {
+ /*
+ * The AlgorithmIdentifier's parameters field must be absent for DSA/ECDSA signature
+ * algorithms, see https://www.rfc-editor.org/rfc/rfc5480#page-17 and
+ * https://www.rfc-editor.org/rfc/rfc5758#section-3.
+ */
+ write_null_par = 0;
+ } else {
+ write_null_par = 1;
+ }
+ MBEDTLS_ASN1_CHK_ADD(len,
+ mbedtls_asn1_write_algorithm_identifier_ext(p, start, oid, oid_len,
+ 0, write_null_par));
return (int) len;
}
* X.509 Certificate Revocation List (CRL) parsing
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
/*
* The ITU-T X.509 standard defines a certificate format for PKI.
* X.509 certificate parsing and verification
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
/*
* The ITU-T X.509 standard defines a certificate format for PKI.
if (MBEDTLS_OID_CMP(MBEDTLS_OID_ON_HW_MODULE_NAME, &cur_oid) != 0) {
return MBEDTLS_ERR_X509_FEATURE_UNAVAILABLE;
}
+ other_name->type_id = cur_oid;
p += len;
if ((ret = mbedtls_asn1_get_tag(&p, end, &len,
MBEDTLS_X509_SAFE_SNPRINTF;
if (MBEDTLS_OID_CMP(MBEDTLS_OID_ON_HW_MODULE_NAME,
- &other_name->value.hardware_module_name.oid) != 0) {
+ &other_name->type_id) == 0) {
ret = mbedtls_snprintf(p, n, "\n%s hardware module name :", prefix);
MBEDTLS_X509_SAFE_SNPRINTF;
ret =
return 0;
}
-#define PRINT_ITEM(i) \
- { \
- ret = mbedtls_snprintf(p, n, "%s" i, sep); \
- MBEDTLS_X509_SAFE_SNPRINTF; \
- sep = ", "; \
- }
+#define PRINT_ITEM(i) \
+ do { \
+ ret = mbedtls_snprintf(p, n, "%s" i, sep); \
+ MBEDTLS_X509_SAFE_SNPRINTF; \
+ sep = ", "; \
+ } while (0)
-#define CERT_TYPE(type, name) \
- if (ns_cert_type & (type)) \
- PRINT_ITEM(name);
+#define CERT_TYPE(type, name) \
+ do { \
+ if (ns_cert_type & (type)) { \
+ PRINT_ITEM(name); \
+ } \
+ } while (0)
static int x509_info_cert_type(char **buf, size_t *size,
unsigned char ns_cert_type)
return 0;
}
-#define KEY_USAGE(code, name) \
- if (key_usage & (code)) \
- PRINT_ITEM(name);
+#define KEY_USAGE(code, name) \
+ do { \
+ if (key_usage & (code)) { \
+ PRINT_ITEM(name); \
+ } \
+ } while (0)
static int x509_info_key_usage(char **buf, size_t *size,
unsigned int key_usage)
* X.509 Certificate Signing Request (CSR) parsing
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
/*
* The ITU-T X.509 standard defines a certificate format for PKI.
* X.509 certificate writing
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
/*
* References:
size_t sub_len = 0, pub_len = 0, sig_and_oid_len = 0, sig_len;
size_t len = 0;
mbedtls_pk_type_t pk_alg;
+ int write_sig_null_par;
/*
* Prepare data to be signed at the end of the target buffer
/*
* Signature ::= AlgorithmIdentifier
*/
+ if (pk_alg == MBEDTLS_PK_ECDSA) {
+ /*
+ * The AlgorithmIdentifier's parameters field must be absent for DSA/ECDSA signature
+ * algorithms, see https://www.rfc-editor.org/rfc/rfc5480#page-17 and
+ * https://www.rfc-editor.org/rfc/rfc5758#section-3.
+ */
+ write_sig_null_par = 0;
+ } else {
+ write_sig_null_par = 1;
+ }
MBEDTLS_ASN1_CHK_ADD(len,
- mbedtls_asn1_write_algorithm_identifier(&c, buf,
- sig_oid, strlen(sig_oid), 0));
+ mbedtls_asn1_write_algorithm_identifier_ext(&c, buf,
+ sig_oid, strlen(sig_oid),
+ 0, write_sig_null_par));
/*
* Serial ::= INTEGER
* into the CRT buffer. */
c2 = buf + size;
MBEDTLS_ASN1_CHK_ADD(sig_and_oid_len, mbedtls_x509_write_sig(&c2, c,
- sig_oid, sig_oid_len, sig,
- sig_len));
+ sig_oid, sig_oid_len,
+ sig, sig_len, pk_alg));
/*
* Memory layout after this step:
* X.509 Certificate Signing Request writing
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
/*
* References:
c2 = buf + size;
MBEDTLS_ASN1_CHK_ADD(sig_and_oid_len,
mbedtls_x509_write_sig(&c2, buf + len, sig_oid, sig_oid_len,
- sig, sig_len));
+ sig, sig_len, pk_alg));
/*
* Compact the space between the CSR data and signature by moving the
* A 32-bit implementation of the XTEA algorithm
*
* Copyright The Mbed TLS Contributors
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
*/
#include "common.h"
-/* $Id: ncbi_http2_session.cpp 658918 2022-11-10 20:03:42Z sadyrovr $
+/* $Id: ncbi_http2_session.cpp 674396 2023-10-25 18:31:34Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
void SH2S_IoCoordinator::Process(TH2S_RequestQueue& request_queue)
{
+ m_Loop.Run(UV_RUN_NOWAIT);
+
// Retrieve all events from the queue
for (;;) {
auto queue_locked = request_queue.GetLock();
}
}
- SH2S_Session::TAddrNCred addr_n_cred(SSocketAddress(url.GetHost(), port), request.cred);
+ SSocketAddress::SHost host(url.GetHost(), SSocketAddress::SHost::EName::eOriginal);
+ SH2S_Session::TAddrNCred addr_n_cred(SSocketAddress(move(host), port), request.cred);
auto https = scheme == "https" || (scheme.empty() && (port == "443"));
auto range = m_Sessions.equal_range(addr_n_cred);
-/* $Id: ncbi_sendmail.c 630439 2021-05-03 16:17:14Z lavr $
+/* $Id: ncbi_sendmail.c 681783 2024-04-15 14:14:32Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
if ((status = SOCK_CreateEx(info->mx_host, info->mx_port,
&info->mx_timeout, &sock,
0, 0, log)) != eIO_Success) {
- sprintf(buffer, "%s:%hu (%s)", info->mx_host, info->mx_port,
+ sprintf(buffer, "%.512s:%hu (%s)", info->mx_host, info->mx_port,
IO_StatusStr(status));
SENDMAIL_RETURN2(8, "Cannot connect to sendmail", buffer);
}
-/* $Id: ncbi_socket.c 662580 2023-02-02 16:22:28Z lavr $
+/* $Id: ncbi_socket.c 681785 2024-04-15 14:15:09Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
if ((fd = sock->sock) == SOCK_INVALID) {
polls[i].revent = eIO_Close;
++ready;
+ continue;
}
# if !defined(NCBI_OS_MSWIN) && defined(FD_SETSIZE)
assert(fd < FD_SETSIZE);
if (err) {
CORE_LOGF_ERRNO_X(143, eLOG_Warning, err,
("TRIGGER#%u[?]: [TRIGGER::Create] "
- " Failed to dup(%d) to higher fd(%d+))",
+ " Failed to dup(%d) to higher fd(%d+)",
x_id, fd[1], FD_SETSIZE));
err = 0;
}
if (!s_SetCloexec(fd[1], 1/*true*/))
err = errno;
# endif /*!FD_SETSIZE*/
+# endif /*!HAVE_PIPE2*/
+
if (err && err != -1) {
CORE_LOGF_ERRNO_X(30, eLOG_Warning, err,
("TRIGGER#%u[?]: [TRIGGER::Create] "
" Failed to set close-on-exec", x_id));
}
-# endif /*!HAVE_PIPE2*/
if (!(*trigger = (TRIGGER) calloc(1, sizeof(**trigger)))) {
close(fd[0]);
-/* $Id: ncbi_uv_nghttp2.cpp 663964 2023-03-03 20:32:27Z ucko $
+/* $Id: ncbi_uv_nghttp2.cpp 674396 2023-10-25 18:31:34Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
break;
}
- m_WriteBuffer.clear();
auto rv = mbedtls_ssl_session_reset(&m_Ssl);
if (rv < 0) {
case eReady: break;
}
+ m_WriteBuffer.clear();
m_State = eClosed;
return mbedtls_ssl_close_notify(&m_Ssl);
}
-/* $Id: ncbi_cookies.cpp 620642 2020-11-25 17:54:32Z lavr $
+/* $Id: ncbi_cookies.cpp 675127 2023-11-15 13:50:38Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
return false;
}
m_Value = NStr::TruncateSpaces(nv.substr(pos + 1));
- if ( !IsValidValue(m_Value, eField_Value, &err_msg) ) {
- ERR_POST_X(3, Info << err_msg);
- return false;
- }
// Remove dquotes if any.
if (m_Value.size() > 2 && m_Value[0] == '"' && m_Value[m_Value.size() - 1] == '"') {
m_Value = m_Value.substr(1, m_Value.size() - 2);
}
+ if ( !IsValidValue(m_Value, eField_Value, &err_msg) ) {
+ ERR_POST_X(3, Info << err_msg);
+ return false;
+ }
if ( attr_str.empty() ) {
return true;
-/* $Id: ncbi_system.cpp 671042 2023-08-07 17:29:25Z ivanov $
+/* $Id: ncbi_system.cpp 681784 2024-04-15 14:14:58Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
static void s_NewHandler(void)
{
s_ExitCode = eLEC_Memory;
- exit(-1);
+ // _exit() does not go over atexit() chain, so just call registered
+ // handler directly.
+ if (s_ExitHandlerIsSet) {
+ s_ExitHandler();
+ }
+ _exit(-1);
}
-/* $Id: request_status.cpp 597623 2019-11-25 15:06:05Z grichenk $
+/* $Id: request_status.cpp 674533 2023-10-30 13:23:10Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
case e416_RangeNotSatisfiable: return "Requested Range Not Satisfiable";
case e417_ExpectationFailed: return "Expectation Failed";
case e422_UnprocessableEntity: return "Unprocessable Entity";
+ case e451_Unavailable_For_Legal_Reasons: return "Unavailable For Legal Reasons";
case e499_BrokenConnection: return "Broken Connection";
case e500_InternalServerError: return "Internal Server Error";
case e501_NotImplemented: return "Not Implemented";
-/* $Id: dbapi_conn_factory.cpp 673289 2023-09-27 13:33:09Z ivanov $
+/* $Id: dbapi_conn_factory.cpp 682489 2024-05-01 12:40:05Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
Uint2 cur_port = 0;
// Try to connect up to a given number of alternative servers ...
- unsigned int alternatives = GetMaxNumOfServerAlternatives();
+ unsigned int max_alternatives = GetMaxNumOfServerAlternatives();
list<TSvrRef> tried_servers;
bool full_retry_made = false;
CRef<CDBPoolBalancer> balancer;
CServiceInfo& service_info = ctx.service_info;
+ unsigned int alternatives
+ = static_cast<unsigned int>(service_info.GetOptions().size());
+ if (alternatives < 1) {
+ alternatives = min(2U, max_alternatives);
+ } else {
+ alternatives = min(alternatives * 2U, max_alternatives);
+ }
if ( !do_not_dispatch && !service_name.empty() ) {
balancer.Reset(new CDBPoolBalancer
const string& server)
{
CRuntimeData& rt_data = GetRuntimeData(validator_name);
- TSvrRef svr(new CDBServer(server, 0, 0, numeric_limits<unsigned int>::max()));
+ TSvrRef svr;
+ if ( !server.empty() ) {
+ svr.Reset(new CDBServer(server, 0, 0, kMax_UInt));
+ }
auto& service_info = rt_data.GetServiceInfo(service_name);
IDBServiceInfo::TGuard guard(service_info);
service_info.SetDispatchedServer(svr);
-/* $Id: ProjectItem.cpp 431215 2014-04-02 14:55:10Z katargir $
+/* $Id: ProjectItem.cpp 682696 2024-05-07 12:38:17Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
void CProjectItem::SetObject(CSerialObject& object)
{
- if (object.GetThisTypeInfo() == CSeq_id::GetTypeInfo()) {
+ const auto type_info = object.GetThisTypeInfo();
+ if (type_info == CSeq_id::GetTypeInfo()) {
SetItem().SetId(dynamic_cast<CSeq_id&>(object));
- } else if (object.GetThisTypeInfo() == CSeq_entry::GetTypeInfo()) {
+ } else if (type_info == CSeq_entry::GetTypeInfo()) {
SetItem().SetEntry(dynamic_cast<CSeq_entry&>(object));
- } else if (object.GetThisTypeInfo() == CSeq_annot::GetTypeInfo()) {
+ } else if (type_info == CSeq_annot::GetTypeInfo()) {
SetItem().SetAnnot(dynamic_cast<CSeq_annot&>(object));
- } else if (object.GetThisTypeInfo() == CSeq_submit::GetTypeInfo()) {
+ } else if (type_info == CSeq_submit::GetTypeInfo()) {
SetItem().SetSubmit(dynamic_cast<CSeq_submit&>(object));
- } else if (object.GetThisTypeInfo() == CSeq_align::GetTypeInfo()) {
+ } else if (type_info == CSeq_align::GetTypeInfo()) {
SetItem().SetSeq_align(dynamic_cast<CSeq_align&>(object));
- } else if (object.GetThisTypeInfo() == CSeq_align_set::GetTypeInfo()) {
+ } else if (type_info == CSeq_align_set::GetTypeInfo()) {
SetItem().SetSeq_align_set(dynamic_cast<CSeq_align_set&>(object));
+ } else if (type_info == CHugeFileProjectItem::GetTypeInfo()) {
+ SetItem().SetHuge_file(dynamic_cast<CHugeFileProjectItem&>(object));
} else {
SetItem().SetOther().Set(object);
}
case TItem::e_Seq_align_set:
return &GetItem().GetSeq_align_set();
+ case TItem::e_Huge_file:
+ return &GetItem().GetHuge_file();
+
//TODO ePlugin, ePmid and eTaxid are not supported
case TItem::e_Other:
return GetItem().GetOther().GetObject();
-- This is deprecated. DO NOT USE THIS FIELD.
-- The original spec is: orig-message PluginMessage OPTIONAL.
-- It is intended to be removed, but a complete
- -- removal will cause order shift for the rest of
+ -- removal will cause order shift for the rest of
-- fields in this choice, and cause deserialization
-- failure for existing ASN file since this filed is
-- in the middle of the spec.
-- arbitrary annotations
annot SET OF ProjectAnnot OPTIONAL,
-
+
-- a set of data sources including data loader and data
loaders SET OF LoaderDescriptor OPTIONAL,
--- set of views, associated with project
views SET OF ViewDescriptor OPTIONAL,
-
+
-- set of view-specific settings
view-settings SET OF User-object OPTIONAL
}
--- if both are absent - link goes to project
--- if both present - fingerprinted object inside project item
--- if only project-item-id present - link goes to project item
-
+
--- project item id
project-item-id INTEGER OPTIONAL,
-
+
--- fingerprint of object to show in view
fingerprint CHOICE {
crc32 INTEGER,
md5 OCTET STRING
} OPTIONAL,
-
+
type VisibleString
}
--- data for view opening
data CHOICE {
--- link to retrieve data
- link ViewDataLink,
-
+ link ViewDataLink,
+
--- virtual project item, if link cannot be created
item ProjectItem
- },
-
+ },
+
--- plugin name of saved view
view-plugin VisibleString,
-
+
--- view id
view-id INTEGER,
-
+
--- optional settings, requered to open view
view-memento ViewMemento OPTIONAL
}
-- This is deprecated. DO NOT USE THIS FIELD.
-- The original spec is: plugin PluginMessage.
-- It is intended to be removed, but a complete
- -- removal will cause order shift for the rest of
+ -- removal will cause order shift for the rest of
-- fields in this choice, and cause deserialization
-- failure for existing ASN files since this filed is
-- in the middle of the spec.
-- arbitrary object (use with care!)
other AbstractProjectItem,
-
+
-- PubMed ID
pmid SET OF INTEGER,
-- Taxonomy ID
- taxid SET OF INTEGER
+ taxid SET OF INTEGER,
+
+ -- Huge File Item
+ huge-file HugeFileProjectItem
},
--name of the plugin that can handle External Data for the project
data OCTET STRING
}
+HugeFileProjectItem ::= SEQUENCE {
+ -- absolute path to the input file
+ file VisibleString,
+
+ -- absolute path to the temporary output file
+ tmp-file VisibleString,
+
+ -- loader id to register in OM
+ loader-id VisibleString
+}
+
ProjectHistoryItem ::= SEQUENCE {
-- ID of ProjectItem referenced
LoaderDescriptor ::= SEQUENCE {
- -- data loader label
+ -- data loader label
label VisibleString,
-- loader data source type
-- data, depends on loader type
data User-object,
-
+
-- flag: is this data loader enabled?
enabled BOOLEAN DEFAULT TRUE,
END
-
-/* $Id: Dbtag.cpp 670946 2023-08-04 12:25:02Z ivanov $
+/* $Id: Dbtag.cpp 683247 2024-05-21 12:43:30Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
{ CDbtag::eDbtagType_UniSTS, "https://www.ncbi.nlm.nih.gov/probe?term=" },
{ CDbtag::eDbtagType_VBASE2, "http://www.vbase2.org/vgene.php?id=" }, // https not available tested 7/13/2016
{ CDbtag::eDbtagType_VBRC, "http://vbrc.org/query.asp?web_view=curation&web_id=" }, // https not available tested 7/13/2016
- { CDbtag::eDbtagType_VectorBase, "https://www.vectorbase.org/Genome/BRCGene/?feature=" },
+ { CDbtag::eDbtagType_VectorBase, "https://vectorbase.org/gene/" },
{ CDbtag::eDbtagType_Vega, "http://vega.archive.ensembl.org/id/" },
{ CDbtag::eDbtagType_WorfDB, "http://worfdb.dfci.harvard.edu/search.pl?form=1&search=" },
{ CDbtag::eDbtagType_WormBase, "https://www.wormbase.org/search/gene/" },
{ CDbtag::eDbtagType_Ensembl, "https://www.ensembl.org/id/" }, // url seems incorrect, includes msg user has been redirected and "Error 404 Page not found" tested 7/13/2016
{ CDbtag::eDbtagType_PseudoCAP, "http://www.pseudomonas.com/primarySequenceFeature/list?c1=name&e1=1&v1=" }, // url not found tested 7/13/2016
{ CDbtag::eDbtagType_PseudoCap, "http://www.pseudomonas.com/primarySequenceFeature/list?c1=name&e1=1&v1=" }, // url not found tested 7/13/2016
+
+ { CDbtag::eDbtagType_AmoebaDB, "https://amoebadb.org/amoeba/app/record/gene/" },
+ { CDbtag::eDbtagType_CryptoDB, "https://cryptodb.org/cryptodb/app/record/gene/" },
+ { CDbtag::eDbtagType_FungiDB, "https://fungidb.org/fungidb/app/record/gene/" },
+ { CDbtag::eDbtagType_GiardiaDB, "https://giardiadb.org/giardiadb/app/record/gene/" },
+ { CDbtag::eDbtagType_MicrosporidiaDB, "https://microsporidiadb.org/micro/app/record/gene/" },
+ { CDbtag::eDbtagType_PiroplasmaDB, "https://piroplasmadb.org/piro/app/record/gene/" },
+ { CDbtag::eDbtagType_PlasmoDB, "https://plasmodb.org/plasmo/app/record/gene/" },
+ { CDbtag::eDbtagType_ToxoDB, "https://toxodb.org/toxo/app/record/gene/" },
+ { CDbtag::eDbtagType_TrichDB, "https://trichdb.org/trichdb/app/record/gene/" },
+ { CDbtag::eDbtagType_TriTrypDB, "https://tritrypdb.org/tritrypdb/app/record/gene/" },
+ { CDbtag::eDbtagType_VEuPathDB, "https://veupathdb.org/gene/" },
})
string CDbtag::GetUrl(void) const
{ "SRA", { CDbtag::fProbe, CDbtag::eDbtagType_SRA } },
{ "Trace", { CDbtag::fProbe, CDbtag::eDbtagType_Trace } },
+ { "AmoebaDB", { CDbtag::fGenBank, CDbtag::eDbtagType_AmoebaDB } },
+ { "CryptoDB", { CDbtag::fGenBank, CDbtag::eDbtagType_CryptoDB } },
+ { "FungiDB", { CDbtag::fGenBank, CDbtag::eDbtagType_FungiDB } },
+ { "GiardiaDB", { CDbtag::fGenBank, CDbtag::eDbtagType_GiardiaDB } },
+ { "MicrosporidiaDB", { CDbtag::fGenBank, CDbtag::eDbtagType_MicrosporidiaDB } },
+ { "PiroplasmaDB", { CDbtag::fGenBank, CDbtag::eDbtagType_PiroplasmaDB } },
+ { "PlasmoDB", { CDbtag::fGenBank, CDbtag::eDbtagType_PlasmoDB } },
+ { "ToxoDB", { CDbtag::fGenBank, CDbtag::eDbtagType_ToxoDB } },
+ { "TrichDB", { CDbtag::fGenBank, CDbtag::eDbtagType_TrichDB } },
+ { "TriTrypDB", { CDbtag::fGenBank, CDbtag::eDbtagType_TriTrypDB } },
+ { "VEuPathDB", { CDbtag::fGenBank, CDbtag::eDbtagType_VEuPathDB } },
+
// Note from RW-1843: INSDC documentation contains outdated information
// It requires ENSEMBL and PseudoCap, but actially Ensembl and PseudoCAP are correct
// https://www.insdc.org/submitting-standards/dbxref-qualifier-vocabulary/
-# $Id: CMakeLists.macro.asn.txt 662048 2023-01-24 18:45:51Z gotvyans $
+# $Id: CMakeLists.macro.asn.txt 680773 2024-03-27 13:51:41Z ivanov $
NCBI_begin_lib(macro)
NCBI_dataspecs(macro.asn)
NCBI_uses_toolkit_libraries(seq)
NCBI_project_watchers(stakhovv kans)
- if (NOT CMAKE_CROSSCOMPILING AND NCBI_FSM_COMPILER_ENABLED AND NCBI_PYTHON_EXECUTABLE)
+ if (NCBI_FSM_COMPILER_ENABLED)
NCBI_custom_target_dependencies(macro_fsm_files)
endif()
NCBI_end_lib()
-if (NOT CMAKE_CROSSCOMPILING AND NCBI_FSM_COMPILER_ENABLED AND NCBI_PYTHON_EXECUTABLE)
+if (NCBI_FSM_COMPILER_ENABLED)
NCBI_begin_custom_target(macro_fsm_files)
NCBI_custom_target_definition(define_macro_fsm_files_target)
- NCBI_custom_target_dependencies(multipattern)
+ if (TARGET host.multipattern)
+ NCBI_custom_target_dependencies(host.multipattern)
+ else()
+ NCBI_custom_target_dependencies(multipattern)
+ endif()
NCBI_end_custom_target()
endif()
cmake_path(GET current_list_file PARENT_PATH _source_dir)
- set (_compiler ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${compiler}${CMAKE_EXECUTABLE_SUFFIX})
+ if (TARGET host.${compiler})
+ set (_compiler "$<TARGET_PROPERTY:host.${compiler},LOCATION>")
+ else()
+ set (_compiler ${compiler})
+ endif()
set(_target_dir ${_source_dir})
- set(_make_fsm_file ${NCBI_SRC_ROOT}/objects/macro/make_fsm_file.py)
- #set(_make_fsm_file ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/make_fsm_file.py)
+ file(RELATIVE_PATH _rel_path ${NCBI_SRC_ROOT} ${_source_dir})
+ # intermediate location at inc folder
+ set(_target_dir_int ${NCBI_CFGINC_ROOT}/${_rel_path})
add_custom_target(${up_target}
COMMENT "Generate FSM files"
- SOURCES ${_make_fsm_file}
+ SOURCES ${current_list_file} ${CMAKE_CURRENT_FUNCTION_LIST_FILE}
)
foreach(_module ${modules})
add_custom_command(
OUTPUT ${_target_dir}/${_inc_file}
- COMMAND ${NCBI_PYTHON_EXECUTABLE} ${_make_fsm_file} ${_inc_file} ${_compiler} -i ${_prt_file} ${more_args}
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${_target_dir_int}
+ COMMAND ${_compiler} -o ${_target_dir_int}/${_inc_file} -i ${_prt_file} ${more_args}
WORKING_DIRECTORY ${_source_dir}
- COMMENT "Running make_fsm_file.py for ${_prt_file}"
- DEPENDS ${current_list_file} ${_source_dir}/${_prt_file} ${_make_fsm_file} ${_compiler}
- # ${CMAKE_CURRENT_FUNCTION_LIST_FILE}
+ COMMENT "Running ${compiler} for ${_prt_file}"
+ DEPENDS ${current_list_file} ${_source_dir}/${_prt_file} ${_compiler} ${CMAKE_CURRENT_FUNCTION_LIST_FILE}
)
add_custom_target(
add_dependencies(${up_target} ${_target})
endforeach()
- unset(_inc_file)
- unset(_prt_file)
- unset(_target)
- unset(_target_dir)
- unset(_source_dir)
- unset(_compiler)
endfunction()
+++ /dev/null
-import os
-import sys
-import re
-import subprocess
-from subprocess import Popen, PIPE
-
-def MakeIncFile(outfile, cmd_args):
-
- returncode=1
- _produced=None
- _original=None
- if os.path.exists(outfile):
- with open(outfile, "rb") as _outfile:
- _original=_outfile.read()
-
- proc = subprocess.run(cmd_args, stdout=PIPE)
- returncode = proc.returncode
-
- if returncode == 0:
- _produced = proc.stdout
- if _original != _produced:
- with open(outfile, "wb") as _outfile:
- _outfile.write(_produced)
-
- return returncode
-
-if __name__ == "__main__":
- returncode = MakeIncFile(sys.argv[1], sys.argv[2:])
- sys.exit(returncode)
-/* $Id: Pub.cpp 607097 2020-04-30 12:32:13Z grichenk $
+/* $Id: Pub.cpp 677027 2024-01-03 14:07:59Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
}
-bool CPub::IsSetAuthors(void) const
+bool CPub::IsSetAuthors() const
{
switch (Which()) {
case CPub::e_Gen :
return (GetGen().IsSetAuthors());
case CPub::e_Sub :
return (GetSub().IsSetAuthors());
+ case CPub::e_Medline :
+ return (GetMedline().IsSetCit() && GetMedline().GetCit().IsSetAuthors());
case CPub::e_Article :
return (GetArticle().IsSetAuthors());
case CPub::e_Book :
return (GetMan().IsSetCit() && GetMan().GetCit().IsSetAuthors());
default :
break;
- }
-
- return false;
+ }
+
+ return false;
}
-const CAuth_list& CPub::GetAuthors (void) const
+const CAuth_list& CPub::GetAuthors() const
{
- switch (Which()) {
+ switch (Which()) {
case CPub::e_Gen :
return (GetGen().GetAuthors());
case CPub::e_Sub :
return (GetSub().GetAuthors());
+ case CPub::e_Medline :
+ return (GetMedline().GetCit().GetAuthors());
case CPub::e_Article :
return (GetArticle().GetAuthors());
case CPub::e_Book :
NCBI_THROW(CSerialException, eNotImplemented,
"CPub::GetAuthors: unsupported entry type "
+ SelectionName(Which()));
- }
+ }
}
-CAuth_list& CPub::SetAuthors (void)
+CAuth_list& CPub::SetAuthors()
{
- switch (Which()) {
+ switch (Which()) {
case CPub::e_Gen :
return (SetGen().SetAuthors());
case CPub::e_Sub :
return (SetSub().SetAuthors());
+ case CPub::e_Medline :
+ return (SetMedline().SetCit().SetAuthors());
case CPub::e_Article :
return (SetArticle().SetAuthors());
case CPub::e_Book :
NCBI_THROW(CSerialException, eNotImplemented,
"CPub::SetAuthors: unsupported entry type "
+ SelectionName(Which()));
- }
+ }
}
void CPub::GetTitles(
} SPubMatchInfo;
-string s_GetTitleString(const CTitle::C_E& title)
+string s_GetTitleString(const CTitle::C_E& title)
{
- string str = "";
+ string str;
switch (title.Which()) {
case CTitle::C_E::e_Name:
bool s_TitleMatch(const CTitle& title1, const CTitle& title2, CTitle::C_E::E_Choice title_type)
{
- string compare1 = "";
- string compare2 = "";
+ string compare1;
+ string compare2;
ITERATE(CTitle::Tdata, it, title1.Get()) {
if ((*it)->Which() == title_type) {
-/* $Id: remap_client.cpp 369026 2012-07-16 12:24:38Z ivanov $
+/* $Id: remap_client.cpp 677880 2024-01-24 19:07:34Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
BEGIN_objects_SCOPE // namespace ncbi::objects::
-const char* CRemapClient::kDefaultUrl =
- "http://intrawebdev.be-md.ncbi.nlm.nih.gov:6224/"
- "staff/jcherry/remap/remap_server.cgi";
+const char* CRemapClient::kDefaultUrl = "http://intrawebdev8/staff/jcherry/remap/remap_server.cgi";
// destructor
-/* $Id: OrgMod.cpp 664355 2023-03-13 16:05:25Z foleyjp $
+/* $Id: OrgMod.cpp 684486 2024-06-25 12:34:24Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
"yes",
"no",
"-",
+ "bacteria",
+ "sp.",
+ "sp",
+ "strain",
+ "environmental",
+ "soil",
+ "clinical isolate",
+ "NA",
+ "whole organism",
"microbial"
};
}
+static bool s_init_LookForMultipleIsolates(void)
+{
+ if (! CNcbiApplication::Instance()) {
+ return false;
+ }
+
+ const CNcbiEnvironment& env = CNcbiApplication::Instance()->GetEnvironment();
+ string fromEnv = env.Get("NCBI_VALIDATE_FOR_MULTIPLE_ISOLATES");
+ NStr::ToLower(fromEnv);
+ if (fromEnv == "true") {
+ return true;
+ } else if (fromEnv == "false") {
+ return false;
+ }
+
+ const CNcbiRegistry& reg = CNcbiApplication::Instance()->GetConfig();
+ string fromConfig = reg.GetString("OrgMod", "ValidateForMultipleIsolates", "off");
+ NStr::ToLower(fromConfig);
+ if (fromConfig == "1" || fromConfig == "on" || fromConfig == "true" || fromConfig == "yes") {
+ return true;
+ }
+
+ // RW-2259 enable by default
+ return true;
+}
+
+
+bool COrgMod::NCBI_ValidateForMultipleIsolates(void)
+{
+ static bool value = s_init_LookForMultipleIsolates();
+ return value;
+}
+
+
END_objects_SCOPE // namespace ncbi::objects::
-/* $Id: SubSource.cpp 665075 2023-03-27 19:11:29Z kans $
+/* $Id: SubSource.cpp 684484 2024-06-25 12:34:14Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
{
}
+
+static bool s_init_UseGeoLocNameForCountry(void)
+{
+ if (! CNcbiApplication::Instance()) {
+ return false;
+ }
+
+ const CNcbiEnvironment& env = CNcbiApplication::Instance()->GetEnvironment();
+ string fromEnv = env.Get("NCBI_GEO_LOC_NAME_FOR_COUNTRY");
+ NStr::ToLower(fromEnv);
+ if (fromEnv == "true") {
+ return true;
+ } else if (fromEnv == "false") {
+ return false;
+ }
+
+ const CNcbiRegistry& reg = CNcbiApplication::Instance()->GetConfig();
+ string fromConfig = reg.GetString("OrgSubSource", "UseGeoLocNameForCountry", "off");
+ NStr::ToLower(fromConfig);
+ if (fromConfig == "1" || fromConfig == "on" || fromConfig == "true" || fromConfig == "yes") {
+ return true;
+ }
+
+ return false;
+}
+
+
+bool CSubSource::NCBI_UseGeoLocNameForCountry(void)
+{
+ static bool value = s_init_UseGeoLocNameForCountry();
+ return value;
+}
+
+
void CSubSource::GetLabel(string* str) const
{
*str += '/';
}
+// RW-2286
+static string RepairSingleDigitMonth (const string& orig_date)
+{
+ if (orig_date.find_first_not_of(" ,-/=_.0123456789") != NPOS) {
+ return orig_date;
+ }
+
+ // multi-delimiter extraction logic adapted from example in:
+ // https://stackoverflow.com/questions/7621727/split-a-string-into-words-by-multiple-delimiters
+
+ string delims = " ,-/=_.";
+ size_t prev = 0;
+ size_t next = orig_date.find_first_of(delims, prev);
+ vector<string> tokens;
+
+ while (next != string::npos) {
+ if (next > prev) {
+ string str = orig_date.substr(prev, next - prev);
+ if (str.length() == 1) {
+ // pad single digit with leading zero
+ str = "0" + str;
+ }
+ tokens.push_back(str);
+ }
+ prev = next + 1;
+ next = orig_date.find_first_of(delims, prev);
+ }
+
+ if (prev < orig_date.length()) {
+ string str = orig_date.substr(prev, string::npos);
+ if (str.length() == 1) {
+ // pad last component single digit with leading zero
+ str = "0" + str;
+ }
+ tokens.push_back(str);
+ }
+
+ string result = NStr::Join(tokens, "-");
+
+ return result;
+}
+
+
string CSubSource::FixDateFormat (const string& test, bool month_first, bool& month_ambiguous)
{
string orig_date = test;
NStr::TruncateSpacesInPlace(orig_date);
+ orig_date = RepairSingleDigitMonth(orig_date);
+
if (IsISOFormatDate(orig_date)) {
return orig_date;
} else if (x_IsFixableIsoDate(orig_date)) {
"Cuba",
"Curacao",
"Cyprus",
- "Czech Republic",
+ "Czechia",
"Democratic Republic of the Congo",
"Denmark",
"Djibouti",
"Belgian Congo",
"British Guiana",
"Burma",
+ "Czech Republic",
"Czechoslovakia",
"East Timor",
"Korea",
{"CXR", "Christmas Island"},
{"CYM", "Cayman Islands"},
{"CYP", "Cyprus"},
-{"CZE", "Czech Republic"},
+{"CZE", "Czechia"},
{"Cape Verde Islands", "Cape Verde"},
{"DEU", "Germany"},
{"DJI", "Djibouti"},
// has multiple components
// int max = components.size() - 1;
- for ( int j = 0; j < components.size(); j++ ) {
+ for ( size_t j = 0; j < components.size(); j++ ) {
bool modified = false;
if ( s_IsState ( components[j], modified )) {
/*
}
}
+ // JIRA:RW-2243 Micronesia is the only entry with a comma, special case test here
+ string micronesia = "Micronesia, Federated States of";
+ if (NStr::EqualNocase(test, micronesia)) {
+ if (! NStr::EqualCase(test, micronesia)) {
+ return micronesia;
+ }
+ }
+ // JIRA:RW-2243 also special case to convert old Micronesia name to new name
+ if (NStr::EqualNocase(test, "Micronesia")) {
+ return micronesia;
+ }
+
string input = test;
if (NStr::StartsWith(input, "\"") && NStr::EndsWith(input, "\"")) {
input = input.substr(1, input.length() - 2);
-/* $Id: ecnum_ambiguous.inc 672959 2023-09-19 12:44:26Z ivanov $
+/* $Id: ecnum_ambiguous.inc 683836 2024-06-06 12:08:40Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
*
*/
-/* time_t value corresponding to Thu Sep 14 15:30:29 EDT 2023
-; formally
+/* time_t value corresponding to Sat Jun 1 12:48:23 EDT 2024; formally
* expressed as unsigned long so output can stand fully on its own. */
-static const unsigned long kECNum_ambiguous_Timestamp = 1694719829UL;
+static const unsigned long kECNum_ambiguous_Timestamp = 1717260503UL;
static const char* const kECNum_ambiguous[] = {
"1.-.-.-\tOxidoreductases",
"1.n.n.n\tOxidoreductases",
"3.4.24.n\tMetalloendopeptidases",
"3.4.25.-\tThreonine endopeptidases",
"3.4.25.n\tThreonine endopeptidases",
+ "3.4.26.-\tGlutamic endopeptidases",
+ "3.4.26.n\tGlutamic endopeptidases",
"3.4.99.-\tEndopeptidases of unknown catalytic mechanism",
"3.4.99.n\tEndopeptidases of unknown catalytic mechanism",
"3.5.-.-\tActing on carbon-nitrogen bonds, other than peptide bonds",
3.4.24.n Metalloendopeptidases
3.4.25.- Threonine endopeptidases
3.4.25.n Threonine endopeptidases
+3.4.26.- Glutamic endopeptidases
+3.4.26.n Glutamic endopeptidases
3.4.99.- Endopeptidases of unknown catalytic mechanism
3.4.99.n Endopeptidases of unknown catalytic mechanism
3.5.-.- Acting on carbon-nitrogen bonds, other than peptide bonds
-/* $Id: ecnum_deleted.inc 672959 2023-09-19 12:44:26Z ivanov $
+/* $Id: ecnum_deleted.inc 683836 2024-06-06 12:08:40Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
*
*/
-/* time_t value corresponding to Thu Sep 14 15:30:29 EDT 2023
-; formally
+/* time_t value corresponding to Sat Jun 1 12:48:23 EDT 2024; formally
* expressed as unsigned long so output can stand fully on its own. */
-static const unsigned long kECNum_deleted_Timestamp = 1694719829UL;
+static const unsigned long kECNum_deleted_Timestamp = 1717260503UL;
static const char* const kECNum_deleted[] = {
"1.1.1.74",
"1.1.1.128",
-/* $Id: ecnum_replaced.inc 672959 2023-09-19 12:44:26Z ivanov $
+/* $Id: ecnum_replaced.inc 683836 2024-06-06 12:08:40Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
*
*/
-/* time_t value corresponding to Thu Sep 14 15:30:29 EDT 2023
-; formally
+/* time_t value corresponding to Sat Jun 1 12:48:23 EDT 2024; formally
* expressed as unsigned long so output can stand fully on its own. */
-static const unsigned long kECNum_replaced_Timestamp = 1694719829UL;
+static const unsigned long kECNum_replaced_Timestamp = 1717260503UL;
static const char* const kECNum_replaced[] = {
"1.1.1.5\t1.1.1.303\t1.1.1.304",
+ "1.1.1.32\t1.1.1.1",
+ "1.1.1.33\t1.1.1.2",
"1.1.1.63\t1.1.1.239",
"1.1.1.68\t1.5.1.20",
"1.1.1.70\t1.2.1.3",
"1.5.99.9\t1.5.98.1",
"1.5.99.10\t1.5.8.1",
"1.5.99.11\t1.5.98.2",
+ "1.6.1.2\t7.1.1.1",
"1.6.1.5\t7.1.1.1",
"1.6.2.1\t1.6.99.3",
"1.6.4.1\t1.8.1.6",
"1.8.6.1\t2.5.1.18",
"1.8.99.3\t1.8.99.5",
"1.8.99.4\t1.8.4.8",
+ "1.8.99.5\t1.8.1.22",
"1.9.3.1\t7.1.1.9",
"1.9.3.2\t1.7.2.1",
"1.9.99.1\t1.9.98.1",
"1.14.14.4\t1.14.15.7",
"1.14.14.6\t1.14.13.111",
"1.14.14.7\t1.14.19.9",
+ "1.14.14.140\t1.14.14.162",
"1.14.14.n1\t1.14.99.46",
"1.14.15.2\t1.14.14.108",
"1.14.15.12\t1.14.14.46",
"2.4.1.112\t2.4.1.186",
"2.4.1.119\t2.4.99.18",
"2.4.1.124\t2.4.1.87",
+ "2.4.1.129\t2.4.99.28",
"2.4.1.130\t2.4.1.258\t2.4.1.259\t2.4.1.260\t2.4.1.261",
"2.4.1.151\t2.4.1.87",
"2.4.1.157\t2.4.1.336\t2.4.1.337",
"2.7.8.n1\t2.4.2.53",
"2.7.8.n2\t2.7.8.33",
"2.7.8.n3\t2.7.8.48",
+ "2.7.11.27\t2.7.11.31",
"2.7.11.n1\t2.7.11.32",
"2.7.11.n2\t2.7.11.33",
"2.8.1.n1\t2.8.1.11",
"3.1.7.4\t4.2.1.133\t4.2.3.141",
"3.1.7.7\t4.2.3.194",
"3.1.7.8\t2.5.1.153",
+ "3.1.8.2\t3.8.2.2",
"3.1.11.7\t3.6.1.71",
"3.1.11.8\t3.6.1.70",
"3.1.12.2\t3.6.1.72",
1.1.1.5 1.1.1.303 1.1.1.304
+1.1.1.32 1.1.1.1
+1.1.1.33 1.1.1.2
1.1.1.63 1.1.1.239
1.1.1.68 1.5.1.20
1.1.1.70 1.2.1.3
1.5.99.9 1.5.98.1
1.5.99.10 1.5.8.1
1.5.99.11 1.5.98.2
+1.6.1.2 7.1.1.1
1.6.1.5 7.1.1.1
1.6.2.1 1.6.99.3
1.6.4.1 1.8.1.6
1.8.6.1 2.5.1.18
1.8.99.3 1.8.99.5
1.8.99.4 1.8.4.8
+1.8.99.5 1.8.1.22
1.9.3.1 7.1.1.9
1.9.3.2 1.7.2.1
1.9.99.1 1.9.98.1
1.14.14.4 1.14.15.7
1.14.14.6 1.14.13.111
1.14.14.7 1.14.19.9
+1.14.14.140 1.14.14.162
1.14.14.n1 1.14.99.46
1.14.15.2 1.14.14.108
1.14.15.12 1.14.14.46
2.4.1.112 2.4.1.186
2.4.1.119 2.4.99.18
2.4.1.124 2.4.1.87
+2.4.1.129 2.4.99.28
2.4.1.130 2.4.1.258 2.4.1.259 2.4.1.260 2.4.1.261
2.4.1.151 2.4.1.87
2.4.1.157 2.4.1.336 2.4.1.337
2.7.8.n1 2.4.2.53
2.7.8.n2 2.7.8.33
2.7.8.n3 2.7.8.48
+2.7.11.27 2.7.11.31
2.7.11.n1 2.7.11.32
2.7.11.n2 2.7.11.33
2.8.1.n1 2.8.1.11
3.1.7.4 4.2.1.133 4.2.3.141
3.1.7.7 4.2.3.194
3.1.7.8 2.5.1.153
+3.1.8.2 3.8.2.2
3.1.11.7 3.6.1.71
3.1.11.8 3.6.1.70
3.1.12.2 3.6.1.72
-/* $Id: ecnum_specific.inc 672959 2023-09-19 12:44:26Z ivanov $
+/* $Id: ecnum_specific.inc 683836 2024-06-06 12:08:40Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
*
*/
-/* time_t value corresponding to Thu Sep 14 15:30:29 EDT 2023
-; formally
+/* time_t value corresponding to Sat Jun 1 12:48:23 EDT 2024; formally
* expressed as unsigned long so output can stand fully on its own. */
-static const unsigned long kECNum_specific_Timestamp = 1694719829UL;
+static const unsigned long kECNum_specific_Timestamp = 1717260503UL;
static const char* const kECNum_specific[] = {
"1.1.1.1\talcohol dehydrogenase",
"1.1.1.2\talcohol dehydrogenase (NADP(+))",
"1.1.1.29\tglycerate dehydrogenase",
"1.1.1.30\t3-hydroxybutyrate dehydrogenase",
"1.1.1.31\t3-hydroxyisobutyrate dehydrogenase",
- "1.1.1.32\tmevaldate reductase",
- "1.1.1.33\tmevaldate reductase (NADPH)",
"1.1.1.34\thydroxymethylglutaryl-CoA reductase (NADPH)",
"1.1.1.35\t3-hydroxyacyl-CoA dehydrogenase",
"1.1.1.36\tacetoacetyl-CoA reductase",
"1.1.1.223\tisopiperitenol dehydrogenase",
"1.1.1.224\tmannose-6-phosphate 6-reductase",
"1.1.1.225\tchlordecone reductase",
- "1.1.1.226\t4-hydroxycyclohexanecarboxylate dehydrogenase",
+ "1.1.1.226\ttrans-4-hydroxycyclohexanecarboxylate dehydrogenase",
"1.1.1.227\t(-)-borneol dehydrogenase",
"1.1.1.228\t(+)-sabinol dehydrogenase",
"1.1.1.229\tdiethyl 2-methyl-3-oxosuccinate reductase",
"1.2.1.79\tsuccinate-semialdehyde dehydrogenase (NADP(+))",
"1.2.1.80\tlong-chain acyl-[acyl-carrier-protein] reductase",
"1.2.1.81\tsulfoacetaldehyde dehydrogenase (acylating)",
- "1.2.1.82\tbeta-apo-4'-carotenal oxygenase",
+ "1.2.1.82\tbeta-apo-4'-carotenal dehydrogenase",
"1.2.1.83\t3-succinoylsemialdehyde-pyridine dehydrogenase",
"1.2.1.84\talcohol-forming fatty acyl-CoA reductase",
"1.2.1.85\t2-hydroxymuconate-6-semialdehyde dehydrogenase",
"1.3.1.123\t7-epi-iridoid synthase",
"1.3.1.124\t2,4-dienoyl-CoA reductase [(3E)-enoyl-CoA-producing]",
"1.3.1.125\tacrylate reductase",
+ "1.3.1.126\t2-epi-5-epi-valiolone dehydrogenase",
"1.3.1.n3\tcurcumin reductase",
"1.3.2.3\tL-galactonolactone dehydrogenase",
"1.3.2.4\tfumarate reductase (cytochrome)",
"1.4.1.28\tsecondary-alkyl amine dehydrogenase [NAD(P)(+)]",
"1.4.2.1\tglycine dehydrogenase (cytochrome)",
"1.4.2.2\tnicotine dehydrogenase",
- "1.4.2.3\tTEMPLATE: pseudooxynicotine oxidase",
+ "1.4.2.3\tpseudooxynicotine oxidase",
"1.4.3.1\tD-aspartate oxidase",
"1.4.3.2\tL-amino-acid oxidase",
"1.4.3.3\tD-amino-acid oxidase",
"1.5.98.2\t5,10-methylenetetrahydromethanopterin reductase",
"1.5.98.3\tcoenzyme F420:methanophenazine dehydrogenase",
"1.5.99.3\tL-pipecolate dehydrogenase",
- "1.5.99.4\tnicotine hydroxylase",
+ "1.5.99.4\tnicotine 6-hydroxylase",
"1.5.99.5\tmethylglutamate dehydrogenase",
"1.5.99.6\tspermidine dehydrogenase",
"1.5.99.12\tcytokinin dehydrogenase",
"1.5.99.14\t6-hydroxypseudooxynicotine dehydrogenase",
"1.5.99.15\tdihydromethanopterin reductase (acceptor)",
"1.6.1.1\tNAD(P)(+) transhydrogenase (Si-specific)",
- "1.6.1.2\tNAD(P)(+) transhydrogenase (Re/Si-specific)",
"1.6.1.3\tNAD(P)(+) transhydrogenase",
"1.6.1.4\tNAD(P)(+) transhydrogenase (ferredoxin)",
"1.6.2.2\tcytochrome-b5 reductase",
"1.8.1.19\tsulfide dehydrogenase",
"1.8.1.20\t4,4'-dithiodibutanoate disulfide reductase",
"1.8.1.21\tdissimilatory dimethyldisulfide reductase",
+ "1.8.1.22\tTEMPLATE: dissimilatory sulfite reductase",
"1.8.2.1\tsulfite dehydrogenase (cytochrome)",
"1.8.2.2\tthiosulfate dehydrogenase",
"1.8.2.3\tsulfide-cytochrome-c reductase (flavocytochrome c)",
"1.8.5.7\tglutathionyl-hydroquinone reductase",
"1.8.5.8\teukaryotic sulfide quinone oxidoreductase",
"1.8.5.9\tprotein dithiol:quinone oxidoreductase DsbB",
+ "1.8.5.10\t[DsrC]-trisulfide reductase",
"1.8.7.1\tassimilatory sulfite reductase (ferredoxin)",
"1.8.7.2\tferredoxin:thioredoxin reductase",
"1.8.7.3\tferredoxin:CoB-CoM heterodisulfide reductase",
"1.8.98.6\tformate:CoB-CoM heterodisulfide,ferredoxin reductase",
"1.8.98.7\tcysteine-type anaerobic sulfatase-maturating enzyme",
"1.8.99.2\tadenylyl-sulfate reductase",
- "1.8.99.5\tdissimilatory sulfite reductase",
"1.9.6.1\tnitrate reductase (cytochrome)",
"1.9.98.1\tiron--cytochrome-c reductase",
"1.10.1.1\ttrans-acenaphthene-1,2-diol dehydrogenase",
"1.14.14.137\t(+)-abscisic acid 8'-hydroxylase",
"1.14.14.138\tlithocholate 6beta-hydroxylase",
"1.14.14.139\t5beta-cholestane-3alpha,7alpha-diol 12alpha-hydroxylase",
- "1.14.14.140\tlicodione synthase",
"1.14.14.141\tpsoralen synthase",
"1.14.14.142\t8-dimethylallylnaringenin 2'-hydroxylase",
"1.14.14.143\t(+)-menthofuran synthase",
"2.1.1.240\ttrans-resveratrol di-O-methyltransferase",
"2.1.1.241\t2,4,7-trihydroxy-1,4-benzoxazin-3-one-glucoside 7-O-methyltransferase",
"2.1.1.242\t16S rRNA (guanine(1516)-N(2))-methyltransferase",
- "2.1.1.243\t2-ketoarginine methyltransferase",
+ "2.1.1.243\t5-guanidino-2-oxopentanoate (3R)-methyltransferase",
"2.1.1.244\tprotein N-terminal methyltransferase",
"2.1.1.245\t5-methyltetrahydrosarcinapterin:corrinoid/iron-sulfur protein Co-methyltransferase",
"2.1.1.246\t[methyl-Co(III) methanol-specific corrinoid protein]:coenzyme M methyltransferase",
"2.1.1.295\t2-methyl-6-phytyl-1,4-hydroquinone methyltransferase",
"2.1.1.296\tmethyltransferase cap2",
"2.1.1.297\tpeptide chain release factor N(5)-glutamine methyltransferase",
- "2.1.1.298\tribosomal protein L3 N(5)-glutamine methyltransferase",
+ "2.1.1.298\tribosomal protein uL3 N(5)-glutamine methyltransferase",
"2.1.1.299\tprotein N-terminal monomethyltransferase",
"2.1.1.300\tpavine N-methyltransferase",
"2.1.1.301\tcypemycin N-terminal methyltransferase",
"2.1.1.385\t[methyl-Co(III) methoxylated-aromatic-compound-specific corrinoid protein]--tetrahydrofolate methyltransferase",
"2.1.1.386\tsmall RNA 2'-O-methyltransferase",
"2.1.1.387\t5-dehydro-6-demethoxy-6-hydroxyfumagillol O-methyltransferase",
+ "2.1.1.388\tproline betaine--corrinoid protein Co-methyltransferase",
+ "2.1.1.389\t[methyl-Co(III) quaternary-amine-specific corrinoid protein]--tetrahydrofolate methyltransferase",
+ "2.1.1.390\tgentamicin X2 methyltransferase",
+ "2.1.1.391\tdemethylgadusol O-methyltransferase",
"2.1.1.n1\tresorcinol O-methyltransferase",
"2.1.1.n4\tthiocyanate methyltransferase",
"2.1.1.n7\t5-pentadecatrienyl resorcinol O-methyltransferase",
"2.3.1.263\t2-amino-4-oxopentanoate thiolase",
"2.3.1.264\tbeta-lysine N(6)-acetyltransferase",
"2.3.1.265\tphosphatidylinositol dimannoside acyltransferase",
- "2.3.1.266\t[ribosomal protein S18]-alanine N-acetyltransferase",
- "2.3.1.267\t[ribosomal protein S5]-alanine N-acetyltransferase",
+ "2.3.1.266\t[ribosomal protein bS18]-alanine N-acetyltransferase",
+ "2.3.1.267\t[ribosomal protein uS5]-alanine N-acetyltransferase",
"2.3.1.268\tethanol O-acetyltransferase",
"2.3.1.269\tapolipoprotein N-acyltransferase",
"2.3.1.270\tlyso-ornithine lipid O-acyltransferase",
"2.3.1.309\t[beta-tubulin]-L-lysine N-acetyltransferase",
"2.3.1.310\tbenzoylsuccinyl-CoA thiolase",
"2.3.1.311\ttRNA carboxymethyluridine synthase",
+ "2.3.1.312\tD-glutamate N-acetyltransferase",
+ "2.3.1.313\tNAD-dependent lipoamidase",
"2.3.1.n4\t1-acyl-sn-glycerol-3-phosphate acyltransferase",
"2.3.1.n5\tglycerol-3-phosphate acyltransferase (acyl-[acyl-carrier-protein]-transferring)",
"2.3.1.n6\t1-acylglycerophosphoserine O-acyltransferase",
"2.3.2.34\tE2 NEDD8-conjugating enzyme",
"2.3.2.35\tcapsaicin synthase",
"2.3.2.36\tRING-type E3 ubiquitin transferase (cysteine targeting)",
+ "2.3.2.37\tergosteryl-3beta-O-L-aspartate synthase",
"2.3.3.1\tcitrate (Si)-synthase",
"2.3.3.2\tdecylcitrate synthase",
"2.3.3.3\tcitrate (Re)-synthase",
"2.3.3.19\t2-phosphonomethylmalate synthase",
"2.3.3.20\tacyl-CoA:acyl-CoA alkyltransferase",
"2.3.3.21\t(R)-citramalate synthase",
+ "2.3.3.22\t3-carboxymethyl-3-hydroxy-acyl-[ACP] synthase",
"2.4.1.1\tglycogen phosphorylase",
"2.4.1.2\tdextrin dextranase",
"2.4.1.4\tamylosucrase",
"2.4.1.126\thydroxycinnamate 4-beta-glucosyltransferase",
"2.4.1.127\tmonoterpenol beta-glucosyltransferase",
"2.4.1.128\tscopoletin glucosyltransferase",
- "2.4.1.129\tpeptidoglycan glycosyltransferase",
"2.4.1.131\tGDP-Man:Man3GlcNAc2-PP-dolichol alpha-1,2-mannosyltransferase",
"2.4.1.132\tGDP-Man:Man1GlcNAc2-PP-dolichol alpha-1,3-mannosyltransferase",
"2.4.1.133\txylosylprotein 4-beta-galactosyltransferase",
"2.4.1.390\t4,3-alpha-glucanotransferase",
"2.4.1.391\tbeta-1,2-glucosyltransferase",
"2.4.1.392\t3-O-beta-D-glucopyranosyl-beta-D-glucuronide phosphorylase",
+ "2.4.1.393\tMMP alpha-(1->4)-mannosyltransferase",
"2.4.1.n2\tloliose synthase",
"2.4.2.1\tpurine-nucleoside phosphorylase",
"2.4.2.2\tpyrimidine-nucleoside phosphorylase",
"2.4.99.23\tlipopolysaccharide heptosyltransferase I",
"2.4.99.24\tlipopolysaccharide heptosyltransferase II",
"2.4.99.25\tlipopolysaccharide heptosyltransferase III",
+ "2.4.99.26\tO-antigen ligase",
+ "2.4.99.27\tO-antigen polymerase Wzy",
+ "2.4.99.28\tpeptidoglycan glycosyltransferase",
"2.5.1.1\tdimethylallyltranstransferase",
"2.5.1.2\tthiamine pyridinylase",
"2.5.1.3\tthiamine phosphate synthase",
"2.5.1.154\tcorrinoid adenosyltransferase EutT",
"2.5.1.155\tphosphoglycerol geranylfarnesyltransferase",
"2.5.1.156\tgeranylfarnesylglycerol-phosphate geranylfarnesyltransferase",
+ "2.5.1.157\trRNA small subunit aminocarboxypropyltransferase",
"2.5.1.n9\theptaprenylglyceryl phosphate synthase",
"2.6.1.1\taspartate transaminase",
"2.6.1.2\talanine transaminase",
"2.7.11.24\tmitogen-activated protein kinase",
"2.7.11.25\tmitogen-activated protein kinase kinase kinase",
"2.7.11.26\t[tau protein] kinase",
- "2.7.11.27\t[acetyl-CoA carboxylase] kinase",
"2.7.11.28\ttropomyosin kinase",
"2.7.11.29\t[low-density-lipoprotein receptor] kinase",
"2.7.11.30\treceptor protein serine/threonine kinase",
"2.7.11.32\t[pyruvate, phosphate dikinase] kinase",
"2.7.11.33\t[pyruvate, water dikinase] kinase",
"2.7.11.34\tNEK6-subfamily protein kinase",
+ "2.7.11.35\tCRIK-subfamily protein kinase",
"2.7.12.1\tdual-specificity kinase",
"2.7.12.2\tmitogen-activated protein kinase kinase",
"2.7.13.1\tprotein-histidine pros-kinase",
"2.8.4.1\tcoenzyme-B sulfoethylthiotransferase",
"2.8.4.2\tarsenate-mycothiol transferase",
"2.8.4.3\ttRNA-2-methylthio-N(6)-dimethylallyladenosine synthase",
- "2.8.4.4\t[ribosomal protein S12] (aspartate(89)-C(3))-methylthiotransferase",
+ "2.8.4.4\t[ribosomal protein uS12] (aspartate(89)-C(3))-methylthiotransferase",
"2.8.4.5\ttRNA (N(6)-L-threonylcarbamoyladenosine(37)-C(2))-methylthiotransferase",
"2.8.4.6\tS-methyl-1-thioxylulose 5-phosphate methylthiotransferase",
"2.8.5.1\tS-sulfo-L-cysteine synthase (3-phospho-L-serine-dependent)",
"3.1.1.117\t(4-O-methyl)-D-glucuronate--lignin esterase",
"3.1.1.118\tphospholipid sn-1 acylhydrolase",
"3.1.1.120\tL-fucono-1,5-lactonase",
+ "3.1.1.121\tergosteryl-3beta-O-L-aspartate hydrolase",
"3.1.1.n2\tprotein-S-isoprenylcysteine alpha-carbonyl methylesterase",
"3.1.2.1\tacetyl-CoA hydrolase",
"3.1.2.2\tpalmitoyl-CoA hydrolase",
"3.1.7.12\t(+)-kolavelool synthase",
"3.1.7.13\tneryl diphosphate diphosphatase",
"3.1.8.1\taryldialkylphosphatase",
- "3.1.8.2\tdiisopropyl-fluorophosphatase",
"3.1.11.1\texodeoxyribonuclease I",
"3.1.11.2\texodeoxyribonuclease III",
"3.1.11.3\texodeoxyribonuclease (lambda-induced)",
"3.2.1.217\texo-acting protein-alpha-N-acetylgalactosaminidase",
"3.2.1.218\talpha-3'-ketoglucosidase",
"3.2.1.219\tpalatinase",
+ "3.2.1.220\tipecoside beta-D-glucosidase",
"3.2.1.n1\tblood group B branched chain alpha-1,3-galactosidase",
"3.2.1.n2\tblood group B linear chain alpha-1,3-galactosidase",
"3.2.1.n3\tDictyostelium lysozyme A",
"3.4.11.24\taminopeptidase S",
"3.4.11.25\tbeta-peptidyl aminopeptidase",
"3.4.11.26\tintermediate cleaving peptidase 55",
+ "3.4.11.27\tarchaeal arginyl aminopeptidase",
"3.4.13.4\tXaa-Arg dipeptidase",
"3.4.13.5\tXaa-methyl-His dipeptidase",
"3.4.13.7\tGlu-Glu dipeptidase",
"3.4.24.89\tPro-Pro endopeptidase",
"3.4.25.1\tproteasome endopeptidase complex",
"3.4.25.2\tHslU--HslV peptidase",
+ "3.4.26.1\tintramembrane prenyl-peptidase Rce1",
"3.5.1.1\tasparaginase",
"3.5.1.2\tglutaminase",
"3.5.1.3\tomega-amidase",
"3.5.1.135\tN(4)-acetylcytidine amidohydrolase",
"3.5.1.136\tN,N'-diacetylchitobiose non-reducing end deacetylase",
"3.5.1.137\tN-methylcarbamate hydrolase",
+ "3.5.1.138\tlipoamidase",
"3.5.1.n3\t4-deoxy-4-formamido-L-arabinose-phosphoundecaprenol deformylase",
"3.5.2.1\tbarbiturase",
"3.5.2.2\tdihydropyrimidinase",
"3.8.1.9\t(R)-2-haloacid dehalogenase",
"3.8.1.10\t2-haloacid dehalogenase (configuration-inverting)",
"3.8.1.11\t2-haloacid dehalogenase (configuration-retaining)",
+ "3.8.2.2\tdiisopropyl-fluorophosphatase",
"3.9.1.1\tphosphoamidase",
"3.9.1.2\tprotein arginine phosphatase",
"3.9.1.3\tphosphohistidine phosphatase",
"4.1.1.121\t3-oxoisoapionate-4-phosphate decarboxylase",
"4.1.1.122\tL-cysteate decarboxylase",
"4.1.1.123\tphenyl-phosphate phosphatase/carboxylase",
+ "4.1.1.124\tmalonyl-[acp] decarboxylase",
+ "4.1.1.125\t4-carboxy-3-alkylbut-2-enoyl-[ACP] decarboxylase",
+ "4.1.1.126\tanhydromevalonate phosphate decarboxylase",
"4.1.2.2\tketotetrose-phosphate aldolase",
"4.1.2.4\tdeoxyribose-phosphate aldolase",
"4.1.2.5\tL-threonine aldolase",
"4.1.2.61\tferuloyl-CoA hydratase/lyase",
"4.1.2.62\t5-deoxyribulose 1-phosphate aldolase",
"4.1.2.63\t2-hydroxyacyl-CoA lyase",
+ "4.1.2.64\t2-dehydro-3-deoxy-L-fuconate aldolase",
"4.1.3.1\tisocitrate lyase",
"4.1.3.3\tN-acetylneuraminate lyase",
"4.1.3.4\thydroxymethylglutaryl-CoA lyase",
"4.1.99.25\tL-tryptophan isonitrile synthase",
"4.1.99.26\t3-amino-5-[(4-hydroxyphenyl)methyl]-4,4-dimethylpyrrolidin-2-one synthase",
"4.1.99.27\tcyclopenase",
+ "4.1.99.28\t3'-dehydrocarminate deglycosidase",
"4.2.1.1\tcarbonic anhydrase",
"4.2.1.2\tfumarate hydratase",
"4.2.1.3\taconitate hydratase",
"4.2.1.178\tdifructose-dianhydride-III synthase",
"4.2.1.179\tdifructose-anhydride-I synthase",
"4.2.1.180\t(E)-benzylidenesuccinyl-CoA hydratase",
+ "4.2.1.181\t3-carboxymethyl-3-hydroxy-acyl-[ACP] dehydratase",
+ "4.2.1.182\tphosphomevalonate dehydratase",
"4.2.2.1\thyaluronate lyase",
"4.2.2.2\tpectate lyase",
"4.2.2.3\tmannuronate-specific alginate lyase",
"4.2.3.209\t(R)-axinyssene synthase",
"4.2.3.210\tlydicene synthase",
"4.2.3.211\t(+)-exo-beta-bergamotene synthase",
+ "4.2.3.212\t(+)-delta-cadinol synthase",
+ "4.2.3.213\tcolleterpenol synthase",
+ "4.2.3.214\tdolasta-1(15),8-diene synthase",
+ "4.2.3.215\tdelta-araneosene synthase",
+ "4.2.3.216\tsomaliensene A synthase",
+ "4.2.3.217\tsomaliensene B synthase",
+ "4.2.3.218\tvariediene synthase",
+ "4.2.3.219\t(2E)-alpha-cericerene synthase",
"4.2.99.12\tcarboxymethyloxysuccinate lyase",
"4.2.99.18\tDNA-(apurinic or apyrimidinic site) lyase",
"4.2.99.20\t2-succinyl-6-hydroxy-2,4-cyclohexadiene-1-carboxylate synthase",
"4.2.99.22\ttuliposide A-converting enzyme",
"4.2.99.23\ttuliposide B-converting enzyme",
"4.2.99.24\tthebaine synthase",
+ "4.2.99.25\tunsaturated pyranuronate lyase",
"4.3.1.1\taspartate ammonia-lyase",
"4.3.1.2\tmethylaspartate ammonia-lyase",
"4.3.1.3\thistidine ammonia-lyase",
"4.3.1.30\tdTDP-4-amino-4,6-dideoxy-D-glucose ammonia-lyase",
"4.3.1.31\tL-tryptophan ammonia lyase",
"4.3.1.32\t7,8-didemethyl-8-hydroxy-5-deazariboflavin synthase",
+ "4.3.1.33\t(R)-1-hydroxy-2-aminoethylphosphonate ammonia-lyase",
"4.3.2.1\targininosuccinate lyase",
"4.3.2.2\tadenylosuccinate lyase",
"4.3.2.3\tureidoglycolate lyase",
"5.1.1.22\t4-hydroxyproline betaine 2-epimerase",
"5.1.1.23\tUDP-N-acetyl-alpha-D-muramoyl-L-alanyl-L-glutamate epimerase",
"5.1.1.24\thistidine racemase",
+ "5.1.1.25\tN-acetyl-D-glutamate racemase",
"5.1.2.1\tlactate racemase",
"5.1.2.2\tmandelate racemase",
"5.1.2.3\t3-hydroxybutyryl-CoA epimerase",
"6.6.1.1\tmagnesium chelatase",
"6.6.1.2\tcobaltochelatase",
"6.7.1.1\t3-amino-2-hydroxy-4-methoxybenzoate diazotase",
+ "6.7.1.2\t3-aminoavenalumate diazotase",
"7.1.1.1\tproton-translocating NAD(P)(+) transhydrogenase",
"7.1.1.2\tNADH:ubiquinone reductase (H(+)-translocating)",
"7.1.1.3\tubiquinol oxidase (H(+)-transporting)",
"7.5.2.11\tABC-type D-galactose transporter",
"7.5.2.12\tABC-type L-arabinose transporter",
"7.5.2.13\tABC-type D-xylose/L-arabinose transporter",
+ "7.5.2.14\tABC-type homopolymeric O-antigen exporter",
"7.6.2.1\tP-type phospholipid transporter",
"7.6.2.2\tABC-type xenobiotic transporter",
"7.6.2.3\tABC-type glutathione-S-conjugate transporter",
1.1.1.29 glycerate dehydrogenase
1.1.1.30 3-hydroxybutyrate dehydrogenase
1.1.1.31 3-hydroxyisobutyrate dehydrogenase
-1.1.1.32 mevaldate reductase
-1.1.1.33 mevaldate reductase (NADPH)
1.1.1.34 hydroxymethylglutaryl-CoA reductase (NADPH)
1.1.1.35 3-hydroxyacyl-CoA dehydrogenase
1.1.1.36 acetoacetyl-CoA reductase
1.1.1.223 isopiperitenol dehydrogenase
1.1.1.224 mannose-6-phosphate 6-reductase
1.1.1.225 chlordecone reductase
-1.1.1.226 4-hydroxycyclohexanecarboxylate dehydrogenase
+1.1.1.226 trans-4-hydroxycyclohexanecarboxylate dehydrogenase
1.1.1.227 (-)-borneol dehydrogenase
1.1.1.228 (+)-sabinol dehydrogenase
1.1.1.229 diethyl 2-methyl-3-oxosuccinate reductase
1.2.1.79 succinate-semialdehyde dehydrogenase (NADP(+))
1.2.1.80 long-chain acyl-[acyl-carrier-protein] reductase
1.2.1.81 sulfoacetaldehyde dehydrogenase (acylating)
-1.2.1.82 beta-apo-4'-carotenal oxygenase
+1.2.1.82 beta-apo-4'-carotenal dehydrogenase
1.2.1.83 3-succinoylsemialdehyde-pyridine dehydrogenase
1.2.1.84 alcohol-forming fatty acyl-CoA reductase
1.2.1.85 2-hydroxymuconate-6-semialdehyde dehydrogenase
1.3.1.123 7-epi-iridoid synthase
1.3.1.124 2,4-dienoyl-CoA reductase [(3E)-enoyl-CoA-producing]
1.3.1.125 acrylate reductase
+1.3.1.126 2-epi-5-epi-valiolone dehydrogenase
1.3.1.n3 curcumin reductase
1.3.2.3 L-galactonolactone dehydrogenase
1.3.2.4 fumarate reductase (cytochrome)
1.4.1.28 secondary-alkyl amine dehydrogenase [NAD(P)(+)]
1.4.2.1 glycine dehydrogenase (cytochrome)
1.4.2.2 nicotine dehydrogenase
-1.4.2.3 TEMPLATE: pseudooxynicotine oxidase
+1.4.2.3 pseudooxynicotine oxidase
1.4.3.1 D-aspartate oxidase
1.4.3.2 L-amino-acid oxidase
1.4.3.3 D-amino-acid oxidase
1.5.98.2 5,10-methylenetetrahydromethanopterin reductase
1.5.98.3 coenzyme F420:methanophenazine dehydrogenase
1.5.99.3 L-pipecolate dehydrogenase
-1.5.99.4 nicotine hydroxylase
+1.5.99.4 nicotine 6-hydroxylase
1.5.99.5 methylglutamate dehydrogenase
1.5.99.6 spermidine dehydrogenase
1.5.99.12 cytokinin dehydrogenase
1.5.99.14 6-hydroxypseudooxynicotine dehydrogenase
1.5.99.15 dihydromethanopterin reductase (acceptor)
1.6.1.1 NAD(P)(+) transhydrogenase (Si-specific)
-1.6.1.2 NAD(P)(+) transhydrogenase (Re/Si-specific)
1.6.1.3 NAD(P)(+) transhydrogenase
1.6.1.4 NAD(P)(+) transhydrogenase (ferredoxin)
1.6.2.2 cytochrome-b5 reductase
1.8.1.19 sulfide dehydrogenase
1.8.1.20 4,4'-dithiodibutanoate disulfide reductase
1.8.1.21 dissimilatory dimethyldisulfide reductase
+1.8.1.22 TEMPLATE: dissimilatory sulfite reductase
1.8.2.1 sulfite dehydrogenase (cytochrome)
1.8.2.2 thiosulfate dehydrogenase
1.8.2.3 sulfide-cytochrome-c reductase (flavocytochrome c)
1.8.5.7 glutathionyl-hydroquinone reductase
1.8.5.8 eukaryotic sulfide quinone oxidoreductase
1.8.5.9 protein dithiol:quinone oxidoreductase DsbB
+1.8.5.10 [DsrC]-trisulfide reductase
1.8.7.1 assimilatory sulfite reductase (ferredoxin)
1.8.7.2 ferredoxin:thioredoxin reductase
1.8.7.3 ferredoxin:CoB-CoM heterodisulfide reductase
1.8.98.6 formate:CoB-CoM heterodisulfide,ferredoxin reductase
1.8.98.7 cysteine-type anaerobic sulfatase-maturating enzyme
1.8.99.2 adenylyl-sulfate reductase
-1.8.99.5 dissimilatory sulfite reductase
1.9.6.1 nitrate reductase (cytochrome)
1.9.98.1 iron--cytochrome-c reductase
1.10.1.1 trans-acenaphthene-1,2-diol dehydrogenase
1.14.14.137 (+)-abscisic acid 8'-hydroxylase
1.14.14.138 lithocholate 6beta-hydroxylase
1.14.14.139 5beta-cholestane-3alpha,7alpha-diol 12alpha-hydroxylase
-1.14.14.140 licodione synthase
1.14.14.141 psoralen synthase
1.14.14.142 8-dimethylallylnaringenin 2'-hydroxylase
1.14.14.143 (+)-menthofuran synthase
2.1.1.240 trans-resveratrol di-O-methyltransferase
2.1.1.241 2,4,7-trihydroxy-1,4-benzoxazin-3-one-glucoside 7-O-methyltransferase
2.1.1.242 16S rRNA (guanine(1516)-N(2))-methyltransferase
-2.1.1.243 2-ketoarginine methyltransferase
+2.1.1.243 5-guanidino-2-oxopentanoate (3R)-methyltransferase
2.1.1.244 protein N-terminal methyltransferase
2.1.1.245 5-methyltetrahydrosarcinapterin:corrinoid/iron-sulfur protein Co-methyltransferase
2.1.1.246 [methyl-Co(III) methanol-specific corrinoid protein]:coenzyme M methyltransferase
2.1.1.295 2-methyl-6-phytyl-1,4-hydroquinone methyltransferase
2.1.1.296 methyltransferase cap2
2.1.1.297 peptide chain release factor N(5)-glutamine methyltransferase
-2.1.1.298 ribosomal protein L3 N(5)-glutamine methyltransferase
+2.1.1.298 ribosomal protein uL3 N(5)-glutamine methyltransferase
2.1.1.299 protein N-terminal monomethyltransferase
2.1.1.300 pavine N-methyltransferase
2.1.1.301 cypemycin N-terminal methyltransferase
2.1.1.385 [methyl-Co(III) methoxylated-aromatic-compound-specific corrinoid protein]--tetrahydrofolate methyltransferase
2.1.1.386 small RNA 2'-O-methyltransferase
2.1.1.387 5-dehydro-6-demethoxy-6-hydroxyfumagillol O-methyltransferase
+2.1.1.388 proline betaine--corrinoid protein Co-methyltransferase
+2.1.1.389 [methyl-Co(III) quaternary-amine-specific corrinoid protein]--tetrahydrofolate methyltransferase
+2.1.1.390 gentamicin X2 methyltransferase
+2.1.1.391 demethylgadusol O-methyltransferase
2.1.1.n1 resorcinol O-methyltransferase
2.1.1.n4 thiocyanate methyltransferase
2.1.1.n7 5-pentadecatrienyl resorcinol O-methyltransferase
2.3.1.263 2-amino-4-oxopentanoate thiolase
2.3.1.264 beta-lysine N(6)-acetyltransferase
2.3.1.265 phosphatidylinositol dimannoside acyltransferase
-2.3.1.266 [ribosomal protein S18]-alanine N-acetyltransferase
-2.3.1.267 [ribosomal protein S5]-alanine N-acetyltransferase
+2.3.1.266 [ribosomal protein bS18]-alanine N-acetyltransferase
+2.3.1.267 [ribosomal protein uS5]-alanine N-acetyltransferase
2.3.1.268 ethanol O-acetyltransferase
2.3.1.269 apolipoprotein N-acyltransferase
2.3.1.270 lyso-ornithine lipid O-acyltransferase
2.3.1.309 [beta-tubulin]-L-lysine N-acetyltransferase
2.3.1.310 benzoylsuccinyl-CoA thiolase
2.3.1.311 tRNA carboxymethyluridine synthase
+2.3.1.312 D-glutamate N-acetyltransferase
+2.3.1.313 NAD-dependent lipoamidase
2.3.1.n4 1-acyl-sn-glycerol-3-phosphate acyltransferase
2.3.1.n5 glycerol-3-phosphate acyltransferase (acyl-[acyl-carrier-protein]-transferring)
2.3.1.n6 1-acylglycerophosphoserine O-acyltransferase
2.3.2.34 E2 NEDD8-conjugating enzyme
2.3.2.35 capsaicin synthase
2.3.2.36 RING-type E3 ubiquitin transferase (cysteine targeting)
+2.3.2.37 ergosteryl-3beta-O-L-aspartate synthase
2.3.3.1 citrate (Si)-synthase
2.3.3.2 decylcitrate synthase
2.3.3.3 citrate (Re)-synthase
2.3.3.19 2-phosphonomethylmalate synthase
2.3.3.20 acyl-CoA:acyl-CoA alkyltransferase
2.3.3.21 (R)-citramalate synthase
+2.3.3.22 3-carboxymethyl-3-hydroxy-acyl-[ACP] synthase
2.4.1.1 glycogen phosphorylase
2.4.1.2 dextrin dextranase
2.4.1.4 amylosucrase
2.4.1.126 hydroxycinnamate 4-beta-glucosyltransferase
2.4.1.127 monoterpenol beta-glucosyltransferase
2.4.1.128 scopoletin glucosyltransferase
-2.4.1.129 peptidoglycan glycosyltransferase
2.4.1.131 GDP-Man:Man3GlcNAc2-PP-dolichol alpha-1,2-mannosyltransferase
2.4.1.132 GDP-Man:Man1GlcNAc2-PP-dolichol alpha-1,3-mannosyltransferase
2.4.1.133 xylosylprotein 4-beta-galactosyltransferase
2.4.1.390 4,3-alpha-glucanotransferase
2.4.1.391 beta-1,2-glucosyltransferase
2.4.1.392 3-O-beta-D-glucopyranosyl-beta-D-glucuronide phosphorylase
+2.4.1.393 MMP alpha-(1->4)-mannosyltransferase
2.4.1.n2 loliose synthase
2.4.2.1 purine-nucleoside phosphorylase
2.4.2.2 pyrimidine-nucleoside phosphorylase
2.4.99.23 lipopolysaccharide heptosyltransferase I
2.4.99.24 lipopolysaccharide heptosyltransferase II
2.4.99.25 lipopolysaccharide heptosyltransferase III
+2.4.99.26 O-antigen ligase
+2.4.99.27 O-antigen polymerase Wzy
+2.4.99.28 peptidoglycan glycosyltransferase
2.5.1.1 dimethylallyltranstransferase
2.5.1.2 thiamine pyridinylase
2.5.1.3 thiamine phosphate synthase
2.5.1.154 corrinoid adenosyltransferase EutT
2.5.1.155 phosphoglycerol geranylfarnesyltransferase
2.5.1.156 geranylfarnesylglycerol-phosphate geranylfarnesyltransferase
+2.5.1.157 rRNA small subunit aminocarboxypropyltransferase
2.5.1.n9 heptaprenylglyceryl phosphate synthase
2.6.1.1 aspartate transaminase
2.6.1.2 alanine transaminase
2.7.11.24 mitogen-activated protein kinase
2.7.11.25 mitogen-activated protein kinase kinase kinase
2.7.11.26 [tau protein] kinase
-2.7.11.27 [acetyl-CoA carboxylase] kinase
2.7.11.28 tropomyosin kinase
2.7.11.29 [low-density-lipoprotein receptor] kinase
2.7.11.30 receptor protein serine/threonine kinase
2.7.11.32 [pyruvate, phosphate dikinase] kinase
2.7.11.33 [pyruvate, water dikinase] kinase
2.7.11.34 NEK6-subfamily protein kinase
+2.7.11.35 CRIK-subfamily protein kinase
2.7.12.1 dual-specificity kinase
2.7.12.2 mitogen-activated protein kinase kinase
2.7.13.1 protein-histidine pros-kinase
2.8.4.1 coenzyme-B sulfoethylthiotransferase
2.8.4.2 arsenate-mycothiol transferase
2.8.4.3 tRNA-2-methylthio-N(6)-dimethylallyladenosine synthase
-2.8.4.4 [ribosomal protein S12] (aspartate(89)-C(3))-methylthiotransferase
+2.8.4.4 [ribosomal protein uS12] (aspartate(89)-C(3))-methylthiotransferase
2.8.4.5 tRNA (N(6)-L-threonylcarbamoyladenosine(37)-C(2))-methylthiotransferase
2.8.4.6 S-methyl-1-thioxylulose 5-phosphate methylthiotransferase
2.8.5.1 S-sulfo-L-cysteine synthase (3-phospho-L-serine-dependent)
3.1.1.117 (4-O-methyl)-D-glucuronate--lignin esterase
3.1.1.118 phospholipid sn-1 acylhydrolase
3.1.1.120 L-fucono-1,5-lactonase
+3.1.1.121 ergosteryl-3beta-O-L-aspartate hydrolase
3.1.1.n2 protein-S-isoprenylcysteine alpha-carbonyl methylesterase
3.1.2.1 acetyl-CoA hydrolase
3.1.2.2 palmitoyl-CoA hydrolase
3.1.7.12 (+)-kolavelool synthase
3.1.7.13 neryl diphosphate diphosphatase
3.1.8.1 aryldialkylphosphatase
-3.1.8.2 diisopropyl-fluorophosphatase
3.1.11.1 exodeoxyribonuclease I
3.1.11.2 exodeoxyribonuclease III
3.1.11.3 exodeoxyribonuclease (lambda-induced)
3.2.1.217 exo-acting protein-alpha-N-acetylgalactosaminidase
3.2.1.218 alpha-3'-ketoglucosidase
3.2.1.219 palatinase
+3.2.1.220 ipecoside beta-D-glucosidase
3.2.1.n1 blood group B branched chain alpha-1,3-galactosidase
3.2.1.n2 blood group B linear chain alpha-1,3-galactosidase
3.2.1.n3 Dictyostelium lysozyme A
3.4.11.24 aminopeptidase S
3.4.11.25 beta-peptidyl aminopeptidase
3.4.11.26 intermediate cleaving peptidase 55
+3.4.11.27 archaeal arginyl aminopeptidase
3.4.13.4 Xaa-Arg dipeptidase
3.4.13.5 Xaa-methyl-His dipeptidase
3.4.13.7 Glu-Glu dipeptidase
3.4.24.89 Pro-Pro endopeptidase
3.4.25.1 proteasome endopeptidase complex
3.4.25.2 HslU--HslV peptidase
+3.4.26.1 intramembrane prenyl-peptidase Rce1
3.5.1.1 asparaginase
3.5.1.2 glutaminase
3.5.1.3 omega-amidase
3.5.1.135 N(4)-acetylcytidine amidohydrolase
3.5.1.136 N,N'-diacetylchitobiose non-reducing end deacetylase
3.5.1.137 N-methylcarbamate hydrolase
+3.5.1.138 lipoamidase
3.5.1.n3 4-deoxy-4-formamido-L-arabinose-phosphoundecaprenol deformylase
3.5.2.1 barbiturase
3.5.2.2 dihydropyrimidinase
3.8.1.9 (R)-2-haloacid dehalogenase
3.8.1.10 2-haloacid dehalogenase (configuration-inverting)
3.8.1.11 2-haloacid dehalogenase (configuration-retaining)
+3.8.2.2 diisopropyl-fluorophosphatase
3.9.1.1 phosphoamidase
3.9.1.2 protein arginine phosphatase
3.9.1.3 phosphohistidine phosphatase
4.1.1.121 3-oxoisoapionate-4-phosphate decarboxylase
4.1.1.122 L-cysteate decarboxylase
4.1.1.123 phenyl-phosphate phosphatase/carboxylase
+4.1.1.124 malonyl-[acp] decarboxylase
+4.1.1.125 4-carboxy-3-alkylbut-2-enoyl-[ACP] decarboxylase
+4.1.1.126 anhydromevalonate phosphate decarboxylase
4.1.2.2 ketotetrose-phosphate aldolase
4.1.2.4 deoxyribose-phosphate aldolase
4.1.2.5 L-threonine aldolase
4.1.2.61 feruloyl-CoA hydratase/lyase
4.1.2.62 5-deoxyribulose 1-phosphate aldolase
4.1.2.63 2-hydroxyacyl-CoA lyase
+4.1.2.64 2-dehydro-3-deoxy-L-fuconate aldolase
4.1.3.1 isocitrate lyase
4.1.3.3 N-acetylneuraminate lyase
4.1.3.4 hydroxymethylglutaryl-CoA lyase
4.1.99.25 L-tryptophan isonitrile synthase
4.1.99.26 3-amino-5-[(4-hydroxyphenyl)methyl]-4,4-dimethylpyrrolidin-2-one synthase
4.1.99.27 cyclopenase
+4.1.99.28 3'-dehydrocarminate deglycosidase
4.2.1.1 carbonic anhydrase
4.2.1.2 fumarate hydratase
4.2.1.3 aconitate hydratase
4.2.1.178 difructose-dianhydride-III synthase
4.2.1.179 difructose-anhydride-I synthase
4.2.1.180 (E)-benzylidenesuccinyl-CoA hydratase
+4.2.1.181 3-carboxymethyl-3-hydroxy-acyl-[ACP] dehydratase
+4.2.1.182 phosphomevalonate dehydratase
4.2.2.1 hyaluronate lyase
4.2.2.2 pectate lyase
4.2.2.3 mannuronate-specific alginate lyase
4.2.3.209 (R)-axinyssene synthase
4.2.3.210 lydicene synthase
4.2.3.211 (+)-exo-beta-bergamotene synthase
+4.2.3.212 (+)-delta-cadinol synthase
+4.2.3.213 colleterpenol synthase
+4.2.3.214 dolasta-1(15),8-diene synthase
+4.2.3.215 delta-araneosene synthase
+4.2.3.216 somaliensene A synthase
+4.2.3.217 somaliensene B synthase
+4.2.3.218 variediene synthase
+4.2.3.219 (2E)-alpha-cericerene synthase
4.2.99.12 carboxymethyloxysuccinate lyase
4.2.99.18 DNA-(apurinic or apyrimidinic site) lyase
4.2.99.20 2-succinyl-6-hydroxy-2,4-cyclohexadiene-1-carboxylate synthase
4.2.99.22 tuliposide A-converting enzyme
4.2.99.23 tuliposide B-converting enzyme
4.2.99.24 thebaine synthase
+4.2.99.25 unsaturated pyranuronate lyase
4.3.1.1 aspartate ammonia-lyase
4.3.1.2 methylaspartate ammonia-lyase
4.3.1.3 histidine ammonia-lyase
4.3.1.30 dTDP-4-amino-4,6-dideoxy-D-glucose ammonia-lyase
4.3.1.31 L-tryptophan ammonia lyase
4.3.1.32 7,8-didemethyl-8-hydroxy-5-deazariboflavin synthase
+4.3.1.33 (R)-1-hydroxy-2-aminoethylphosphonate ammonia-lyase
4.3.2.1 argininosuccinate lyase
4.3.2.2 adenylosuccinate lyase
4.3.2.3 ureidoglycolate lyase
5.1.1.22 4-hydroxyproline betaine 2-epimerase
5.1.1.23 UDP-N-acetyl-alpha-D-muramoyl-L-alanyl-L-glutamate epimerase
5.1.1.24 histidine racemase
+5.1.1.25 N-acetyl-D-glutamate racemase
5.1.2.1 lactate racemase
5.1.2.2 mandelate racemase
5.1.2.3 3-hydroxybutyryl-CoA epimerase
6.6.1.1 magnesium chelatase
6.6.1.2 cobaltochelatase
6.7.1.1 3-amino-2-hydroxy-4-methoxybenzoate diazotase
+6.7.1.2 3-aminoavenalumate diazotase
7.1.1.1 proton-translocating NAD(P)(+) transhydrogenase
7.1.1.2 NADH:ubiquinone reductase (H(+)-translocating)
7.1.1.3 ubiquinol oxidase (H(+)-transporting)
7.5.2.11 ABC-type D-galactose transporter
7.5.2.12 ABC-type L-arabinose transporter
7.5.2.13 ABC-type D-xylose/L-arabinose transporter
+7.5.2.14 ABC-type homopolymeric O-antigen exporter
7.6.2.1 P-type phospholipid transporter
7.6.2.2 ABC-type xenobiotic transporter
7.6.2.3 ABC-type glutathione-S-conjugate transporter
-/* $Id: institution_codes.inc 673294 2023-09-27 13:33:46Z ivanov $
+/* $Id: institution_codes.inc 684362 2024-06-20 19:32:14Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
*
*/
-/* time_t value corresponding to Tue Sep 26 05:12:02 EDT 2023; formally
+/* time_t value corresponding to Thu Jun 13 05:33:04 EDT 2024; formally
* expressed as unsigned long so output can stand fully on its own. */
-static const unsigned long kInstitutionCollectionCodeList_Timestamp = 1695719522UL;
+static const unsigned long kInstitutionCollectionCodeList_Timestamp = 1718271184UL;
static const char* const kInstitutionCollectionCodeList[] = {
-"# $Id: institution_codes.inc 673294 2023-09-27 13:33:46Z ivanov $",
+"# $Id: institution_codes.inc 684362 2024-06-20 19:32:14Z ivanov $",
"A\ts\tArnold Arboretum, Harvard University\t\t\t",
"AA\ts\tMinistry of Science, Academy of Sciences\t\t\t",
"AAAG\ts\tAlan and Anita Gillogly\t\t\t",
"ANWC\ts\tAustralian National Wildlife Collection\t\t\t",
"AO\ts\tMuseo Regionale di Scienze Naturali della Valle d'Aosta\t\t\t",
"AORI\ts\tAtmosphere and Ocean Research Institute\t\t\t",
+"AP\ts\tThe Firefly Museum of Toyota Town\t\t\t",
"APCC\tc\tAntarctic Protistan Culture Collection (Woods Hole Oceanographic Institution)\t\t\t",
"APCR\ts\tArkansas Tech University, Biological Sciences Department\t\t\t",
"APEI\ts\tAgriculture Canada Research Station\t\t\t",
"ASYA\tc\tIstanbul Medeniyet University Antarctic Microalgae Culture Collection\t\t\t",
"ATA\ts\tAtatuerk UEniversitesi\t\t\t",
"ATB\ts\tAging Tissue Bank\t\t\t",
-"ATCC\tcb\tAmerican Type Culture Collection\t\thttps://www.atcc.org/Products/All/&spec;.aspx\t",
+"ATCC\tscb\tAmerican Type Culture Collection\t\thttps://www.atcc.org/Products/All/&spec;.aspx\t",
"ATCH\ts\tChinese Academy of Tropical Agricultural Sciences\t\t\t",
"ATH\ts\tGoulandris Natural History Museum\t\t\t",
"ATHU\ts\tNational and Kapodistrian University of Athens, Biology Department\t\t\t",
"ATHUM\tsc\tATHUM Culture Collection of Fungi\t\t\t",
+"ATSC\tb\tAustralian Tree Seed Centre\t\t\t",
"ATSC\tb\tAustralian Tree Seed Centre\t\thttps://www.csiro.au/en/about/facilities-collections/collections/atsc\t",
-"ATSC<AUS>\tb\tAustralian Tree Seed Centre\t\t\t",
"ATU\tc\tDepartment of of Biotechnology University of Tokyo\t\t\t",
"AU\ts\tXiamen University, Biology Department\t\t\t",
"AUA\ts\tAuburn University, Biological Sciences Department\t\t\t",
"BBS\ts\tUniversity of Suriname\t\t\t",
"BBSL\ts\tBee Biology and Systematics Laboratory\t\t\t",
"BBSUK\ts\tNational Museum and Gallery, Department of Biodiversity and Systematic Biology\t\t\t",
+"BC\ts\tBiospelological Collection\t\t\t",
"BC\ts\tInstitut Botanic de Barcelona\t\t\t",
"BCAC\tsc\tBashkortostan Collection of Algae and Cyanobacteria\t\t\t",
"BCB\ts\tUniversitat Autonoma de Barcelona, Unitat de Botanica\t\t\t",
"BIE\ts\tInstituto di Entomologia\t\t\t",
"BIEL\ts\tUniversitaet Bielefeld, Abteilung OEkologie\t\t\t",
"BIGU\ts\tUniversidad de San Carlos de Guatemala, Departamento de Botanica\t\t\t",
+"BIHM\ts\tBihoro Museum\t\t\t",
"BIL\ts\tForest Research Institute, Natural Forest Department\t\t\t",
"BILAS\ts\tInstitute of Botany\t\t\t",
"BIM\ts\tBirmingham Natural History and Microscopical Society\t\t\t",
"CBRA\ts\tCraveri Civic Museum of Natural History\t\t\t",
"CBS\tsc\tWesterdijk Fungal Biodiversity Institute\t\thttps://wi.knaw.nl/page/fungal_display/name/CBS%20\t",
"CBSIZA\ts\tCaspian Biological Station Institute of Zoology\t\t\t",
+"CBSS\ts\tCroatian Biospeleological Society\t\t\t",
"CBTCCCAS\tc\tThe Cell Bank of Type Culture Collection of Chinese Academy of Sciences\t\t\t",
"CBU<CAN>\ts\tCape Breton University\t\t\t",
"CBU<SKOR>\ts\tChungbuk National University, School of Life Science\t\t\t",
"CMUT\ts\tChiang Mai University\t\t\t",
"CMV\ts\tCentre Marie-Victorin\t\t\t",
"CMW\tc\tForestry and Agricultural Biotechnology Institute, University of Pretoria, Pretoria\t\t\t",
+"CMW-IA\tc\tCulture collection of Innovation Africa at the University of Pretoria\t\t\t",
"CMY\ts\tR. G. Kar Medical College, Botany Department\t\t\t",
"CN<CHN>\tc\tChina Collection of Anaerobic Microorganisms\t\t\t",
"CN<FR>\ts\tUniversite de Caen\t\t\t",
"CRCA\ts\tInstituto dos Cereais\t\t\t",
"CRCM\ts\tWashington State University, Charles R. Conner Museum\t\t\t",
"CRCM:Bird\ts\tWashington State University, Charles R. Conner Museum, bird collection\t\t\t",
-"CRCM:Mammal\ts\tWashington State University, Charles R. Conner Museum, Mammal Collection\t\t\t",
+"CRCM:Fish\ts\tFish collection\t\t\t",
+"CRCM:Herp\ts\tHerpetology Collection\t\t\t",
+"CRCM:Mamm\ts\tWashington State University, Charles R. Conner Museum, Mammal Collection\t\t\t",
+"CRCM:Paleo\ts\tFossil Collection (Misc Vertebrates)\t\t\t",
+"CRCM:Teach\ts\tTeaching Collection (Misc Vertebrates)\t\t\t",
"CRD\ts\tInstituto Politecnico Nacional, Coleccion Cientifica de Fauna Silvestre (Mexico)\t\t\t",
"CRE<USA-CA>\ts\tUniversity of Southern California\t\t\t",
"CREA-AA\tc\tConsiglio per la ricerca in agricoltura e lanalisi delleconomia agraria - Centro di Ricerca Agricoltura e Ambiente\tCRA-CIN\t\t",
"IIES\ts\tInstituto Investigaciones Entomologicas Salta\t\t\t",
"IITA\tb\tInternational Institute of Tropical Agriculture\t\t\t",
"IJ\ts\tInstitute of Jamaica\t\t\t",
-"IJFM\tc\tInstituto ?Jaime Ferran? de Microbiologia Consejo Superior de Investigaciones Cientificas\t\t\t",
+"IJFM\tc\tInstituto 'Jaime Ferran' de Microbiologia Consejo Superior de Investigaciones Cientificas\t\t\t",
"IJSM\ts\tInstitute of Jamaica, Natural History Museum\t\t\t",
"IK\ts\tZoological Institute, Ukrainian Academy of Sciences\t\t\t",
"ILCA\ts\tInternational Livestock Research Institute\t\t\t",
"KUO\ts\tKuopio Natural History Museum\t\t\t",
"KURS\ts\tKursk State University, Department of Botany\t\t\t",
"KUS\ts\tKorea University, Biology Department\t\t\t",
+"KUST\ts\tKohat University of Science and Technology\t\t\t",
"KUU\ts\tUniversity of Science and Technology\t\t\t",
"KUW\ts\tKakatiya University\t\t\t",
+"KUZ\ts\tKuzbas Botanical Garden\t\t\t",
"KUZ<JPN>\ts\tZoological Collection of the Kyoto University\t\t\t",
"KUZC\ts\tKyushu University, Zoological Collection\t\t\t",
"KVCH\ts\tKivach Nature Reserve\t\t\t",
"LGBH\ts\tLoughborough Public Library\t\t\t",
"LGC\ts\tLaboratorio de Genetica da Conservacao\t\t\t",
"LGCC\ts\tLouis G. Gentner [deceased]\t\t\t",
+"LGE\ts\tLaboratorio de Genetica Evolutiva\t\t\t",
"LGEMA<BRA>\ts\tLaboratorio de Genetica e Evolucao Molecular de Aves, Universidade de Sao Paulo\t\t\t",
"LGHF\ts\tUniversite de Liege\t\t\t",
"LGICT\ts\tLaboratoire de Geologie de l'Institut Catholique de Toulouse\t\t\t",
"LSP\ts\tLake Superior Provincial Park\t\t\t",
"LSR\ts\tLeicestershire Museums Service\t\t\t",
"LSRFC\ts\tLeicestershire Flora Committee\t\t\t",
-"LSSC\ts\tLake Superior State College\t\t\t",
+"LSSU\ts\tLake Superior State University\t\t\t",
"LSTM\tc\tDepartment of Parasitology\t\t\t",
"LSU\ts\tLouisiana State University, Biological Sciences Department\tLSUM\t\t",
"LSUA\ts\tLouisiana State University of Alexandria\t\t\t",
"MURU\ts\tMurdoch University\t\t\t",
"MUS\ts\tMuskingum College, Biology Department\t\t\t",
"MUSA\ts\tUniversidad Nacional de San Agustin, Museo de Historia Natural (Peru)\t\t\t",
+"MUSENUV\ts\tMuseum of Entomology of the University of Valle in Cali\t\t\t",
+"MUSENUV:Anopheles\ts\tMuseum of Entomology of the University of Valle in Cali\t\t\t",
"MUSK\ts\tMuskegon Community College, Life Science Department\t\t\t",
"MUSM\ts\tMuseo de Historia Natural de la Universidad Nacional Mayor de San Marcos en Lima\t\t\t",
"MUSN\ts\tMuseo Universitario di Storia Naturale e della Strumentazione Scientifica\t\t\t",
"MZAH\ts\tM.Zaman Aquatic Herbarium Rajshahi University\t\t\t",
"MZB\ts\tMuseum Zoologicum Bogoriense\t\t\t",
"MZB:Amp\ts\tMuseum Zoologicum Bogoriense, Amphibian Collection\t\t\t",
+"MZB:Cru\ts\tMuseum Zoologicum Bogoriense, Crustacean Collection\t\t\t",
"MZB:Lace\ts\tMuseum Zoologicum Bogoriense, Lizard Collection\t\t\t",
"MZB:Ornith\ts\tMuseum Zoologicum Bogoriense, Ornithology Collection\t\t\t",
"MZBL\ts\tMuseo de Zoologica\t\t\t",
"MZH\ts\tZoolgical Museum, Finnish Museum of Natural History\t\t\t",
"MZKI\tc\tMicrobial Culture Collection of National Institute of Chemistry\t\t\t",
"MZL\ts\tMusee cantonal de zoologie\tMZLS\t\t",
+"MZLL\ts\tMuseo di Zoologia \"Lidia Liaci\"\t\t\t",
"MZLU\ts\tLund University Museum\t\t\t",
"MZMU\ts\tDepartmental Museum of Zoology, Mizoram University\t\t\t",
"MZN\ts\tMusee Zoologie\t\t\t",
"NIAID\tc\tNational Institute of Allergy and Infectious Diseases\t\t\t",
"NIAS\tsb\tNational Institute of Agrobiological Sciences\t\t\t",
"NIBH\tc\tNational Institute of Bioscience and Human-Technology\t\t\t",
-"NIBR\tscb\tNational Institute of Biological Resources\tNNIBR\t\t",
+"NIBR\tscb\tNakdonggang National Institute of Biologicul Resources\t\t\t",
"NIBSC\tb\tNational Institute for Biological Standards and Control\t\t\t",
"NICC\ts\tNational Insect Collection\t\t\t",
"NICD\ts\tMalaria Research Center\t\t\t",
"NMTT\ts\tNational Museum and Art Gallery, Port-of-Spain\t\t\t",
"NMU\ts\tNorthern Michigan University Museum of Zoology\t\t\t",
"NMU:Bird\ts\tNorthern Michigan University Museum of Zoology, NMU Bird Collection\t\t\t",
+"NMU:Herb\ts\tNorthern Michigan University Museum of Zoology, NMU Herbarium collection\t\t\t",
+"NMU:Herp\ts\tNorthern Michigan University Museum of Zoology, NMU Herpetology Collection\t\t\t",
"NMU:Mamm\ts\tNorthern Michigan University Museum of Zoology, NMU Mammal Collection\t\t\t",
+"NMU:Para\ts\tNorthern Michigan University Museum of Zoology, NMU Parasite collection\t\t\t",
"NMV<AUS>\ts\tMuseum Victoria\tNMM\t\t",
"NMV<AUS>:A\ts\tMuseum Victoria, Ichthyology\tNMV:A,NMV<AUS>A\t\t",
"NMV<AUS>:AV\ts\tMuseum Victoria, Entomology - Australian Voucher Specimens\tNMV:AV,NMV<AUS>AV\t\t",
"NSWGS\ts\tGeological Survey of New South Wales\t\t\t",
"NSYU\ts\tNational Sun Yat-sen University\t\t\t",
"NT\ts\tDepartment of Natural Resources, Environment and the Arts\tDNA\t\t",
+"NTCC\tc\tNational Type Culture Collection\t\t\t",
"NTCCI\tc\tCulture Collection, Microbiology and Cell Biology Laboratory\t\t\t",
"NTDPIF\ts\tNorthern Territory Department of Primary Industry and Fisheries\t\t\t",
"NTLN\ts\tCounty Record Office, County Archives Department\t\t\t",
"QIMR\ts\tQueensland Institute of Medical Research\t\t\t",
"QK\ts\tFowler Herbarium Queen's University\t\t\t",
"QL\ts\tQinling National Botanical Garden\t\t\t",
-"QM\ts\tQueensland Museum\tQMB\t\t",
-"QM<USA-MA>\ts\tU.S. Army Natick Research and Development Center\t\t\t",
-"QMB\ts\tQueensland Museum, Brisbane\tQM\t\t",
+"QM\ts\tQueensland Museum\t\t\t",
+"QMB\ts\tQueensland Museum, Brisbane\t\t\t",
"QMC\ts\tQueen Mary College\t\t\t",
"QMEX\ts\tUniversidad Autonoma de Queretaro, Centro Universitario\t\t\t",
"QMOR\ts\tCollection Entomologique Ouellet-Robert\t\t\t",
"RIBM\tc\tResearch Institute for Brewing and Malting\t\t\t",
"RICK\ts\tBrigham Young University - Idaho\t\t\t",
"RICP<CZE>\tc\tCrop Research Institute\t\t\t",
+"RIEAFO\ts\tResearch Institute of Environment, Agriculture and Fisheries, Osaka Prefecture\t\t\t",
"RIFAV\tb\tResearch Institute for Fruits and Vegetables\t\t\t",
"RIFFL\ts\tResearch Institute of Freshwater Fisheries\t\t\t",
"RIFY\tc\tInstitute of Enology and Viticulture, Yamanashi University\t\t\t",
"SJFM\ts\tFairbanks Museum and Planetarium\t\t\t",
"SJNM\ts\tSan Juan College\t\t\t",
"SJPC\ts\tSergei J. Paramonov personal collection -- destroyed\t\t\t",
-"SJRP\ts\tUNESP, Campus Sao Jose Rio Preto, Departamento Zoologia e Botanica\t\t\t",
+"SJRP\tsc\tUNESP, Campus Sao Jose Rio Preto, Departamento Zoologia e Botanica\t\t\t",
"SJSC\ts\tSan Jose State University, J. Gordon Edwards Museum of Entomology\t\t\t",
"SJSU\ts\tSan Jose State University, Biological Sciences Department\t\t\t",
"SJUBC\ts\tSaint John's University, Biology Collections\t\t\t",
"THIB\ts\tNicholls State University, Department of Biological Sciences\t\t\t",
"THIM\ts\tNational Biodiversity Centre\t\t\t",
"THL\ts\tGrierson Museum\t\t\t",
+"THM\ts\tToyota Hotaru Museum\t\t\t",
"THO\ts\tRobert Dick Museum Library\t\t\t",
"THRI\ts\tSequoia and Kings Canyon National Parks\t\t\t",
"THS\ts\tTsumura Laboratory\t\t\t",
"TSNIGRI\ts\tTsentralny Nauchno-Issledovatelskii Geolgo-Razvedochni Muzei(Chernyshev?s Central Museum of Geological Exploration)\t\t\t",
"TSSMC\ts\tTeton Science School\t\t\t",
"TSTN\ts\tTroston Hall\t\t\t",
-"TSU\ts\tMiye University\t\t\t",
+"TSU\ts\tMie University\t\t\t",
"TSY\tc\tLaboratory of Mycology, Division of Microbiology\t\t\t",
"TTC\ts\tTexas Tech University, Biological Sciences Department\t\t\t",
"TTCC\ts\tTexas Tech University\t\t\t",
"UABCS\ts\tUniversidad Nacional Autonoma de Baja California Sur (Mexico)\t\t\t",
"UABD\ts\tUniversity of Alabama\t\t\t",
"UAC\ts\tUniversity of Calgary, Department of Biological Sciences\t\t\t",
+"UAC<PRT>\ts\tUniversity of the Azores\t\t\t",
+"UAC<PRT>:DTP\ts\tDalberto Teixeira Pombo Arthropod Collection, University of the Azores\t\t\t",
"UACC\ts\tUniveridad Autonoma de Chapingo\t\t\t",
"UACCC\tc\tUniversity of Alabama Chytrid Culture Collection\tUA-SEC\t\t",
"UADBA\ts\tUniversite d?Antananarivo, Departement de Biologie Animale\t\t\t",
"UFRJ<museum>\ts\tDepartramento de Zoologia, Universidade Federal do Rio de Janeiro\t\t\t",
"UFRJ<museum>:POR\ts\tDepartramento de Zoologia, Universidade Federal do Rio de Janeiro, Porifera collection\tUFRJ:POR,UFRJ<museum>POR\t\t",
"UFRJIM\tc\tDepartamento de Microbiologia Medica\t\t\t",
-"UFRN \ts\tUniversidade Federal do Rio Grande do Norte\tUFRN\t\t",
-"UFRN :Fungos\ts\tUniversidade Federal do Rio Grande do Norte , Fungal collection\tUFRN :FungosFungos\t\t",
+"UFRN \ts\tUniversidade Federal do Rio Grande do Norte\t\t\t",
+"UFRN:Fungos\ts\tUniversidade Federal do Rio Grande do Norte, Fungal collection\tUFRN :FungosFungos\t\t",
"UFROH\ts\tUniversidad de La Frontera\t\t\t",
"UFRPE\ts\tUniversidade Federal Rural de Pernambuco\t\t\t",
"UFRR\ts\tUniversidade Federal de Roraima\t\t\t",
"ULV\ts\tUniversidad Central de Las Villas\t\t\t",
"UM\ts\tUman National University of Horticulture\t\t\t",
"UMA\ts\tUniversity of Massachusetts, Museum of Zoology\t\t\t",
+"UMACI\ts\tUniversidade da Madeira Colecoes de Insectos\t\t\t",
"UMAN\ts\tUniversity of Manitoba, Zoological Collection\t\t\t",
"UMB\ts\tUbersee-Museums\tUMBB\t\t",
"UMBB\ts\tUbersee-Museum, University of Bremen\tUMB\t\t",
"UMNH:Bird\ts\tUtah Museum of Natural History, Birds collection\t\t\t",
"UMNH:HERP\ts\tUtah Museum of Natural History, Herpetology collection\t\t\t",
"UMNH:Mamm\ts\tUtah Museum of Natural History, Mammal collection\t\t\t",
+"UMNH:UT (Botany)\ts\tUtah Natural History Museum\t\t\t",
+"UMNH:UT-M (Mycology)\ts\tUtah Natural History Museum\t\t\t",
"UMO<GBR>\ts\tUniversity Museum of Natural History\t\t\t",
"UMO<USA-ME>\ts\tUniversity of Maine\tUMDE\t\t",
"UMO<USA-MO>\ts\tDunn-Palmer Herbarium, University of Missouri, Museum Support Center\t\t\t",
-# $Id: institution_codes.txt 673294 2023-09-27 13:33:46Z ivanov $
+# $Id: institution_codes.txt 684362 2024-06-20 19:32:14Z ivanov $
A s Arnold Arboretum, Harvard University
AA s Ministry of Science, Academy of Sciences
AAAG s Alan and Anita Gillogly
ANWC s Australian National Wildlife Collection
AO s Museo Regionale di Scienze Naturali della Valle d'Aosta
AORI s Atmosphere and Ocean Research Institute
+AP s The Firefly Museum of Toyota Town
APCC c Antarctic Protistan Culture Collection (Woods Hole Oceanographic Institution)
APCR s Arkansas Tech University, Biological Sciences Department
APEI s Agriculture Canada Research Station
ASYA c Istanbul Medeniyet University Antarctic Microalgae Culture Collection
ATA s Atatuerk UEniversitesi
ATB s Aging Tissue Bank
-ATCC cb American Type Culture Collection https://www.atcc.org/Products/All/&spec;.aspx
+ATCC scb American Type Culture Collection https://www.atcc.org/Products/All/&spec;.aspx
ATCH s Chinese Academy of Tropical Agricultural Sciences
ATH s Goulandris Natural History Museum
ATHU s National and Kapodistrian University of Athens, Biology Department
ATHUM sc ATHUM Culture Collection of Fungi
+ATSC b Australian Tree Seed Centre
ATSC b Australian Tree Seed Centre https://www.csiro.au/en/about/facilities-collections/collections/atsc
-ATSC<AUS> b Australian Tree Seed Centre
ATU c Department of of Biotechnology University of Tokyo
AU s Xiamen University, Biology Department
AUA s Auburn University, Biological Sciences Department
BBS s University of Suriname
BBSL s Bee Biology and Systematics Laboratory
BBSUK s National Museum and Gallery, Department of Biodiversity and Systematic Biology
+BC s Biospelological Collection
BC s Institut Botanic de Barcelona
BCAC sc Bashkortostan Collection of Algae and Cyanobacteria
BCB s Universitat Autonoma de Barcelona, Unitat de Botanica
BIE s Instituto di Entomologia
BIEL s Universitaet Bielefeld, Abteilung OEkologie
BIGU s Universidad de San Carlos de Guatemala, Departamento de Botanica
+BIHM s Bihoro Museum
BIL s Forest Research Institute, Natural Forest Department
BILAS s Institute of Botany
BIM s Birmingham Natural History and Microscopical Society
CBRA s Craveri Civic Museum of Natural History
CBS sc Westerdijk Fungal Biodiversity Institute https://wi.knaw.nl/page/fungal_display/name/CBS%20
CBSIZA s Caspian Biological Station Institute of Zoology
+CBSS s Croatian Biospeleological Society
CBTCCCAS c The Cell Bank of Type Culture Collection of Chinese Academy of Sciences
CBU<CAN> s Cape Breton University
CBU<SKOR> s Chungbuk National University, School of Life Science
CMUT s Chiang Mai University
CMV s Centre Marie-Victorin
CMW c Forestry and Agricultural Biotechnology Institute, University of Pretoria, Pretoria
+CMW-IA c Culture collection of Innovation Africa at the University of Pretoria
CMY s R. G. Kar Medical College, Botany Department
CN<CHN> c China Collection of Anaerobic Microorganisms
CN<FR> s Universite de Caen
CRCA s Instituto dos Cereais
CRCM s Washington State University, Charles R. Conner Museum
CRCM:Bird s Washington State University, Charles R. Conner Museum, bird collection
-CRCM:Mammal s Washington State University, Charles R. Conner Museum, Mammal Collection
+CRCM:Fish s Fish collection
+CRCM:Herp s Herpetology Collection
+CRCM:Mamm s Washington State University, Charles R. Conner Museum, Mammal Collection
+CRCM:Paleo s Fossil Collection (Misc Vertebrates)
+CRCM:Teach s Teaching Collection (Misc Vertebrates)
CRD s Instituto Politecnico Nacional, Coleccion Cientifica de Fauna Silvestre (Mexico)
CRE<USA-CA> s University of Southern California
CREA-AA c Consiglio per la ricerca in agricoltura e lanalisi delleconomia agraria - Centro di Ricerca Agricoltura e Ambiente CRA-CIN
IIES s Instituto Investigaciones Entomologicas Salta
IITA b International Institute of Tropical Agriculture
IJ s Institute of Jamaica
-IJFM c Instituto ?Jaime Ferran? de Microbiologia Consejo Superior de Investigaciones Cientificas
+IJFM c Instituto 'Jaime Ferran' de Microbiologia Consejo Superior de Investigaciones Cientificas
IJSM s Institute of Jamaica, Natural History Museum
IK s Zoological Institute, Ukrainian Academy of Sciences
ILCA s International Livestock Research Institute
KUO s Kuopio Natural History Museum
KURS s Kursk State University, Department of Botany
KUS s Korea University, Biology Department
+KUST s Kohat University of Science and Technology
KUU s University of Science and Technology
KUW s Kakatiya University
+KUZ s Kuzbas Botanical Garden
KUZ<JPN> s Zoological Collection of the Kyoto University
KUZC s Kyushu University, Zoological Collection
KVCH s Kivach Nature Reserve
LGBH s Loughborough Public Library
LGC s Laboratorio de Genetica da Conservacao
LGCC s Louis G. Gentner [deceased]
+LGE s Laboratorio de Genetica Evolutiva
LGEMA<BRA> s Laboratorio de Genetica e Evolucao Molecular de Aves, Universidade de Sao Paulo
LGHF s Universite de Liege
LGICT s Laboratoire de Geologie de l'Institut Catholique de Toulouse
LSP s Lake Superior Provincial Park
LSR s Leicestershire Museums Service
LSRFC s Leicestershire Flora Committee
-LSSC s Lake Superior State College
+LSSU s Lake Superior State University
LSTM c Department of Parasitology
LSU s Louisiana State University, Biological Sciences Department LSUM
LSUA s Louisiana State University of Alexandria
MURU s Murdoch University
MUS s Muskingum College, Biology Department
MUSA s Universidad Nacional de San Agustin, Museo de Historia Natural (Peru)
+MUSENUV s Museum of Entomology of the University of Valle in Cali
+MUSENUV:Anopheles s Museum of Entomology of the University of Valle in Cali
MUSK s Muskegon Community College, Life Science Department
MUSM s Museo de Historia Natural de la Universidad Nacional Mayor de San Marcos en Lima
MUSN s Museo Universitario di Storia Naturale e della Strumentazione Scientifica
MZAH s M.Zaman Aquatic Herbarium Rajshahi University
MZB s Museum Zoologicum Bogoriense
MZB:Amp s Museum Zoologicum Bogoriense, Amphibian Collection
+MZB:Cru s Museum Zoologicum Bogoriense, Crustacean Collection
MZB:Lace s Museum Zoologicum Bogoriense, Lizard Collection
MZB:Ornith s Museum Zoologicum Bogoriense, Ornithology Collection
MZBL s Museo de Zoologica
MZH s Zoolgical Museum, Finnish Museum of Natural History
MZKI c Microbial Culture Collection of National Institute of Chemistry
MZL s Musee cantonal de zoologie MZLS
+MZLL s Museo di Zoologia "Lidia Liaci"
MZLU s Lund University Museum
MZMU s Departmental Museum of Zoology, Mizoram University
MZN s Musee Zoologie
NIAID c National Institute of Allergy and Infectious Diseases
NIAS sb National Institute of Agrobiological Sciences
NIBH c National Institute of Bioscience and Human-Technology
-NIBR scb National Institute of Biological Resources NNIBR
+NIBR scb Nakdonggang National Institute of Biologicul Resources
NIBSC b National Institute for Biological Standards and Control
NICC s National Insect Collection
NICD s Malaria Research Center
NMTT s National Museum and Art Gallery, Port-of-Spain
NMU s Northern Michigan University Museum of Zoology
NMU:Bird s Northern Michigan University Museum of Zoology, NMU Bird Collection
+NMU:Herb s Northern Michigan University Museum of Zoology, NMU Herbarium collection
+NMU:Herp s Northern Michigan University Museum of Zoology, NMU Herpetology Collection
NMU:Mamm s Northern Michigan University Museum of Zoology, NMU Mammal Collection
+NMU:Para s Northern Michigan University Museum of Zoology, NMU Parasite collection
NMV<AUS> s Museum Victoria NMM
NMV<AUS>:A s Museum Victoria, Ichthyology NMV:A,NMV<AUS>A
NMV<AUS>:AV s Museum Victoria, Entomology - Australian Voucher Specimens NMV:AV,NMV<AUS>AV
NSWGS s Geological Survey of New South Wales
NSYU s National Sun Yat-sen University
NT s Department of Natural Resources, Environment and the Arts DNA
+NTCC c National Type Culture Collection
NTCCI c Culture Collection, Microbiology and Cell Biology Laboratory
NTDPIF s Northern Territory Department of Primary Industry and Fisheries
NTLN s County Record Office, County Archives Department
QIMR s Queensland Institute of Medical Research
QK s Fowler Herbarium Queen's University
QL s Qinling National Botanical Garden
-QM s Queensland Museum QMB
-QM<USA-MA> s U.S. Army Natick Research and Development Center
-QMB s Queensland Museum, Brisbane QM
+QM s Queensland Museum
+QMB s Queensland Museum, Brisbane
QMC s Queen Mary College
QMEX s Universidad Autonoma de Queretaro, Centro Universitario
QMOR s Collection Entomologique Ouellet-Robert
RIBM c Research Institute for Brewing and Malting
RICK s Brigham Young University - Idaho
RICP<CZE> c Crop Research Institute
+RIEAFO s Research Institute of Environment, Agriculture and Fisheries, Osaka Prefecture
RIFAV b Research Institute for Fruits and Vegetables
RIFFL s Research Institute of Freshwater Fisheries
RIFY c Institute of Enology and Viticulture, Yamanashi University
SJFM s Fairbanks Museum and Planetarium
SJNM s San Juan College
SJPC s Sergei J. Paramonov personal collection -- destroyed
-SJRP s UNESP, Campus Sao Jose Rio Preto, Departamento Zoologia e Botanica
+SJRP sc UNESP, Campus Sao Jose Rio Preto, Departamento Zoologia e Botanica
SJSC s San Jose State University, J. Gordon Edwards Museum of Entomology
SJSU s San Jose State University, Biological Sciences Department
SJUBC s Saint John's University, Biology Collections
THIB s Nicholls State University, Department of Biological Sciences
THIM s National Biodiversity Centre
THL s Grierson Museum
+THM s Toyota Hotaru Museum
THO s Robert Dick Museum Library
THRI s Sequoia and Kings Canyon National Parks
THS s Tsumura Laboratory
TSNIGRI s Tsentralny Nauchno-Issledovatelskii Geolgo-Razvedochni Muzei(Chernyshev?s Central Museum of Geological Exploration)
TSSMC s Teton Science School
TSTN s Troston Hall
-TSU s Miye University
+TSU s Mie University
TSY c Laboratory of Mycology, Division of Microbiology
TTC s Texas Tech University, Biological Sciences Department
TTCC s Texas Tech University
UABCS s Universidad Nacional Autonoma de Baja California Sur (Mexico)
UABD s University of Alabama
UAC s University of Calgary, Department of Biological Sciences
+UAC<PRT> s University of the Azores
+UAC<PRT>:DTP s Dalberto Teixeira Pombo Arthropod Collection, University of the Azores
UACC s Univeridad Autonoma de Chapingo
UACCC c University of Alabama Chytrid Culture Collection UA-SEC
UADBA s Universite d?Antananarivo, Departement de Biologie Animale
UFRJ<museum> s Departramento de Zoologia, Universidade Federal do Rio de Janeiro
UFRJ<museum>:POR s Departramento de Zoologia, Universidade Federal do Rio de Janeiro, Porifera collection UFRJ:POR,UFRJ<museum>POR
UFRJIM c Departamento de Microbiologia Medica
-UFRN s Universidade Federal do Rio Grande do Norte UFRN
-UFRN :Fungos s Universidade Federal do Rio Grande do Norte , Fungal collection UFRN :FungosFungos
+UFRN s Universidade Federal do Rio Grande do Norte
+UFRN:Fungos s Universidade Federal do Rio Grande do Norte, Fungal collection UFRN :FungosFungos
UFROH s Universidad de La Frontera
UFRPE s Universidade Federal Rural de Pernambuco
UFRR s Universidade Federal de Roraima
ULV s Universidad Central de Las Villas
UM s Uman National University of Horticulture
UMA s University of Massachusetts, Museum of Zoology
+UMACI s Universidade da Madeira Colecoes de Insectos
UMAN s University of Manitoba, Zoological Collection
UMB s Ubersee-Museums UMBB
UMBB s Ubersee-Museum, University of Bremen UMB
UMNH:Bird s Utah Museum of Natural History, Birds collection
UMNH:HERP s Utah Museum of Natural History, Herpetology collection
UMNH:Mamm s Utah Museum of Natural History, Mammal collection
+UMNH:UT (Botany) s Utah Natural History Museum
+UMNH:UT-M (Mycology) s Utah Natural History Museum
UMO<GBR> s University Museum of Natural History
UMO<USA-ME> s University of Maine UMDE
UMO<USA-MO> s Dunn-Palmer Herbarium, University of Missouri, Museum Support Center
-/* $Id: Seq_id.cpp 666463 2023-04-26 15:21:25Z grichenk $
+/* $Id: Seq_id.cpp 681844 2024-04-15 19:26:05Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
E_Choice type = Which();
switch (type) {
case e_Pir: case e_Swissprot: case e_Prf: // but *NOT* e_Pdb
- return (EAccessionInfo)(type | fAcc_prot); // always just protein
+ // always just protein
+ return (EAccessionInfo)((EAccessionInfo)type | fAcc_prot);
case e_Genbank: case e_Embl: case e_Ddbj:
case e_Tpg: case e_Tpe: case e_Tpd:
|| fasta_pieces.front().size() == 3)
&& ((next_type = WhichInverseSeqId(fasta_pieces.front()))
!= e_not_set)) {
- // Likely mid-string optional-field omission;
- // conservatively treat as such only if unable to
- // parse the following piece as an ID type, though.
+ // Likely mid-string optional-field omission; look ahead
+ // more to see whether the piece works better as a field
+ // or a tag.
list<CTempString>::iterator it = fasta_pieces.begin();
++it;
_ASSERT(it != fasta_pieces.end());
if ((it->size() == 2 || it->size() == 3)
&& (next_type_2 = WhichInverseSeqId(*it)) != e_not_set) {
next_type = next_type_2;
+ } else if (it->find_first_not_of(" \t\n") == NPOS
+ && ++it == fasta_pieces.end()) {
+ next_type = e_not_set;
} else {
break;
}
-# $Id: accguide.txt 673909 2023-10-12 19:49:33Z ivanov $
+# $Id: accguide.txt 684361 2024-06-20 19:31:00Z ivanov $
version 1 # of file format
# three-letter-prefix protein accessions (traditionally with five digits)
3+9 H?? gb_tpa_prot
3+11 H?? gb_tpa_prot
3+5 I?? ddbj_tpa_prot # fallback to placate older clients
-3+5 I?? ddbj_tpa_wgs_prot
+3+5 I?? ddbj_tpa_tsa_prot
3+7 I?? ddbj_tpa_prot
3+9 I?? ddbj_tpa_prot
3+11 I?? ddbj_tpa_prot
3+7 W?? gb_prot
3+9 W?? gb_prot
3+11 W?? gb_prot
+3+5 X?? gb_prot
+3+7 X?? gb_prot
+3+9 X?? gb_prot
+3+11 X?? gb_prot
3+5 ??? unreserved_prot
3+7 ??? unreserved_prot
3+9 ??? unreserved_prot
2+6 OS gb_patent
2+8 OS gb_other_nuc
2+10 OS gb_other_nuc
-2+6 OT gb_other_nuc
+2+6 OT gb_patent
2+8 OT gb_other_nuc
2+10 OT gb_other_nuc
2+6 O? embl_other_nuc
2+6 PE ddbj_patent # from Korea
2+8 PE ddbj_other_nuc
2+10 PE ddbj_other_nuc
-2+6 PF ddbj_other_nuc
+2+6 PF ddbj_patent # from Korea
2+8 PF ddbj_other_nuc
2+10 PF ddbj_other_nuc
-2+6 PG ddbj_other_nuc
+2+6 PG ddbj_patent
2+8 PG ddbj_other_nuc
2+10 PG ddbj_other_nuc
-2+6 PH ddbj_other_nuc
+2+6 PH ddbj_patent
2+8 PH ddbj_other_nuc
2+10 PH ddbj_other_nuc
-2+6 PI ddbj_other_nuc
+2+6 PI ddbj_patent
2+8 PI ddbj_other_nuc
2+10 PI ddbj_other_nuc
-2+6 PJ ddbj_other_nuc
+2+6 PJ ddbj_patent
2+8 PJ ddbj_other_nuc
2+10 PJ ddbj_other_nuc
-2+6 PK ddbj_other_nuc
+2+6 PK ddbj_patent
2+8 PK ddbj_other_nuc
2+10 PK ddbj_other_nuc
2+6 PL ddbj_other_nuc
2+6 PO ddbj_other_nuc
2+8 PO ddbj_other_nuc
2+10 PO ddbj_other_nuc
+2+6 PP gb_dirsub
+2+8 PP gb_other_nuc
+2+10 PP gb_other_nuc
+2+6 PQ gb_dirsub
+2+8 PQ gb_other_nuc
+2+10 PQ gb_other_nuc
+2+6 PR gb_patent
+2+8 PR gb_other_nuc
+2+10 PR gb_other_nuc
+2+6 PS gb_con
+2+8 PS gb_other_nuc
+2+10 PS gb_other_nuc
+2+6 PT gb_patent
+2+8 PT gb_other_nuc
+2+10 PT gb_other_nuc
2+6 PW unreserved_nuc # deliberately skipped
2+8 PW unreserved_nuc # deliberately skipped
2+10 PW unreserved_nuc # deliberately skipped
2+6 QJ gb_other_nuc
2+8 QJ gb_other_nuc
2+10 QJ gb_other_nuc
+2+6 QK embl_patent
+2+8 QK embl_other_nuc
+2+10 QK embl_other_nuc
+2+6 QL embl_patent
+2+8 QL embl_other_nuc
+2+10 QL embl_other_nuc
+2+6 QM embl_patent
+2+8 QM embl_other_nuc
+2+10 QM embl_other_nuc
+2+6 QN embl_patent
+2+8 QN embl_other_nuc
+2+10 QN embl_other_nuc
+2+6 QO embl_patent
+2+8 QO embl_other_nuc
+2+10 QO embl_other_nuc
2+6 TI unreserved_nuc # deliberately skipped
2+8 TI unreserved_nuc # deliberately skipped
2+10 TI unreserved_nuc # deliberately skipped
special CAUTMX000000000-CAUTMX999999999 embl_tpa_wgs_nuc # 6+9
special CAUTNA000000000-CAUTOK999999999 embl_tpa_wgs_nuc # 6+9
special CAUTOM000000000-CAUVWA999999999 embl_tpa_wgs_nuc # 6+9
+special CAWVRH000000000-CAWWDE999999999 embl_tpa_wgs_nuc # 6+9
+special CAWZYP000000000-CAWZYZ999999999 embl_tpa_wgs_nuc # 6+9
+special CAXAAG000000000-CAXACN999999999 embl_tpa_wgs_nuc # 6+9
+special CAXAFD000000000-CAXAJU999999999 embl_tpa_wgs_nuc # 6+9
+special CAXASQ000000000-CAXAUW999999999 embl_tpa_wgs_nuc # 6+9
+special CAXAUY000000000-CAXAXI999999999 embl_tpa_wgs_nuc # 6+9
+special CAXAXL000000000-CAXAYR999999999 embl_tpa_wgs_nuc # 6+9
+special CAXAYT000000000-CAXBOQ999999999 embl_tpa_wgs_nuc # 6+9
+special CAXBOS000000000-CAXBSW999999999 embl_tpa_wgs_nuc # 6+9
+special CAXBUO000000000-CAXCFA999999999 embl_tpa_wgs_nuc # 6+9
+special CAXCFC000000000-CAXCFE999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDIY000000000-CAXDKL999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDKN000000000-CAXDLL999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDLN000000000-CAXDMO999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDMQ000000000-CAXDMR999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDMV000000000-CAXDNN999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDNQ000000000-CAXDOD999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDOI000000000-CAXDOJ999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDOL000000000-CAXDOO999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDOT000000000-CAXDPF999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDPH000000000-CAXDPJ999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDPL000000000-CAXDPM999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDPR000000000-CAXDPU999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDPW000000000-CAXDPX999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDPZ000000000-CAXDPZ999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDQB000000000-CAXDQE999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDQG000000000-CAXDQG999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDQJ000000000-CAXDQT999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDQW000000000-CAXDQY999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDRB000000000-CAXDRB999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDRE000000000-CAXDRE999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDRG000000000-CAXDRG999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDRI000000000-CAXDRU999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDRW000000000-CAXDRX999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDRZ000000000-CAXDSE999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDSG000000000-CAXDSK999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDSM000000000-CAXDTH999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDTJ000000000-CAXDTM999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDTO000000000-CAXDTO999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDTW000000000-CAXDTW999999999 embl_tpa_wgs_nuc # 6+9
+special CAXEFG000000000-CAXEFJ999999999 embl_tpa_wgs_nuc # 6+9
+special CAXEGS000000000-CAXEKY999999999 embl_tpa_wgs_nuc # 6+9
+special CAXELA000000000-CAXEMQ999999999 embl_tpa_wgs_nuc # 6+9
+special CAXEMS000000000-CAXENB999999999 embl_tpa_wgs_nuc # 6+9
+special CAXEND000000000-CAXENO999999999 embl_tpa_wgs_nuc # 6+9
+special CAXENQ000000000-CAXEOK999999999 embl_tpa_wgs_nuc # 6+9
+special CAXEOM000000000-CAXEOS999999999 embl_tpa_wgs_nuc # 6+9
+special CAXEOU000000000-CAXEQM999999999 embl_tpa_wgs_nuc # 6+9
+special CAXEQO000000000-CAXEQW999999999 embl_tpa_wgs_nuc # 6+9
+special CAXEQY000000000-CAXERD999999999 embl_tpa_wgs_nuc # 6+9
+special CAXERF000000000-CAXERI999999999 embl_tpa_wgs_nuc # 6+9
+special CAXERK000000000-CAXERM999999999 embl_tpa_wgs_nuc # 6+9
+special CAXERO000000000-CAXERS999999999 embl_tpa_wgs_nuc # 6+9
+special CAXERU000000000-CAXERW999999999 embl_tpa_wgs_nuc # 6+9
+special CAXERY000000000-CAXESF999999999 embl_tpa_wgs_nuc # 6+9
+special CAXESH000000000-CAXESR999999999 embl_tpa_wgs_nuc # 6+9
+special CAXEST000000000-CAXETH999999999 embl_tpa_wgs_nuc # 6+9
+special CAXETJ000000000-CAXETW999999999 embl_tpa_wgs_nuc # 6+9
+special CAXETY000000000-CAXEUB999999999 embl_tpa_wgs_nuc # 6+9
+special CAXEUD000000000-CAXEUI999999999 embl_tpa_wgs_nuc # 6+9
+special CAXEUK000000000-CAXEUM999999999 embl_tpa_wgs_nuc # 6+9
+special CAXEUP000000000-CAXEVZ999999999 embl_tpa_wgs_nuc # 6+9
+special CAXEWB000000000-CAXEWG999999999 embl_tpa_wgs_nuc # 6+9
+special CAXEWI000000000-CAXEWO999999999 embl_tpa_wgs_nuc # 6+9
+special CAXEWQ000000000-CAXEWR999999999 embl_tpa_wgs_nuc # 6+9
+special CAXEWT000000000-CAXEYF999999999 embl_tpa_wgs_nuc # 6+9
+special CAXEYH000000000-CAXEYH999999999 embl_tpa_wgs_nuc # 6+9
+special CAXEYJ000000000-CAXEYL999999999 embl_tpa_wgs_nuc # 6+9
+special CAXEYN000000000-CAXEYQ999999999 embl_tpa_wgs_nuc # 6+9
+special CAXEYS000000000-CAXEYS999999999 embl_tpa_wgs_nuc # 6+9
+special CAXEYU000000000-CAXEYX999999999 embl_tpa_wgs_nuc # 6+9
+special CAXEYZ000000000-CAXEYZ999999999 embl_tpa_wgs_nuc # 6+9
+special CAXEZB000000000-CAXEZC999999999 embl_tpa_wgs_nuc # 6+9
+special CAXEZE000000000-CAXEZM999999999 embl_tpa_wgs_nuc # 6+9
+special CAXEZO000000000-CAXEZW999999999 embl_tpa_wgs_nuc # 6+9
+special CAXEZY000000000-CAXEZY999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFAA000000000-CAXFAB999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFAD000000000-CAXFAF999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFAH000000000-CAXFAM999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFAO000000000-CAXFAV999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFAX000000000-CAXFAX999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFBA000000000-CAXFBA999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFBD000000000-CAXFBD999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFBF000000000-CAXFBG999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFBJ000000000-CAXFBS999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFBU000000000-CAXFBW999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFBZ000000000-CAXFCX999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFCZ000000000-CAXFDS999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFDU000000000-CAXFDX999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFDZ000000000-CAXFEA999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFEO000000000-CAXFEO999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFER000000000-CAXFER999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFEW000000000-CAXFEW999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFEY000000000-CAXFEY999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFFB000000000-CAXFFB999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFFD000000000-CAXFFF999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFFL000000000-CAXFFL999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFFS000000000-CAXFFS999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFFU000000000-CAXFFZ999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFGC000000000-CAXFGE999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFGG000000000-CAXFGG999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFGI000000000-CAXFGK999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFGM000000000-CAXFGM999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFGO000000000-CAXFGT999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFGX000000000-CAXFGY999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFHB000000000-CAXFHC999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFHF000000000-CAXFHF999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFIC000000000-CAXFIC999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFIF000000000-CAXFIH999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFIJ000000000-CAXFIK999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFIQ000000000-CAXFIU999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFIY000000000-CAXFJG999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFJI000000000-CAXFJI999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFJL000000000-CAXFJP999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFJR000000000-CAXFJR999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFJT000000000-CAXFJW999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFJY000000000-CAXFJZ999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFKB000000000-CAXFKB999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFKD000000000-CAXFKE999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFKJ000000000-CAXFKJ999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFKM000000000-CAXFKN999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFKT000000000-CAXFKT999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFKV000000000-CAXFKV999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFKX000000000-CAXFKZ999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFLB000000000-CAXFLC999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFLE000000000-CAXFLI999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFLK000000000-CAXFLK999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFLM000000000-CAXFLM999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFLO000000000-CAXFLQ999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFLS000000000-CAXFLT999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFLV000000000-CAXFLV999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFLY000000000-CAXFLY999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFMB000000000-CAXFMB999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFMD000000000-CAXFMD999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFMI000000000-CAXFMI999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFMN000000000-CAXFMN999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFMP000000000-CAXFMP999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFMS000000000-CAXFMW999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFMY000000000-CAXFNA999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFNC000000000-CAXFND999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFNF000000000-CAXFNM999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFNO000000000-CAXFNO999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFNQ000000000-CAXFNR999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFNT000000000-CAXFNT999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFNW000000000-CAXFNZ999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFOB000000000-CAXFOX999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFOZ000000000-CAXFPB999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFPD000000000-CAXFPD999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFPF000000000-CAXFPG999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFPI000000000-CAXFPM999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFPO000000000-CAXFPW999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFPY000000000-CAXFPY999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFQA000000000-CAXFQA999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFQC000000000-CAXFQE999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFQG000000000-CAXFQN999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFQP000000000-CAXFQP999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFQR000000000-CAXFQR999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFQT000000000-CAXFQT999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFQV000000000-CAXFQV999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFQY000000000-CAXFQY999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFRA000000000-CAXFRA999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFRE000000000-CAXFRG999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFRJ000000000-CAXFRK999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFRQ000000000-CAXFRQ999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFRS000000000-CAXFRS999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFRX000000000-CAXFRY999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFSC000000000-CAXFSD999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFSJ000000000-CAXFSJ999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFSR000000000-CAXFSW999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFSY000000000-CAXFTK999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFTM000000000-CAXFTW999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFZX000000000-CAXFZZ999999999 embl_tpa_wgs_nuc # 6+9
+special CAXGAB000000000-CAXGCZ999999999 embl_tpa_wgs_nuc # 6+9
+special CAXGHC000000000-CAXGYU999999999 embl_tpa_wgs_nuc # 6+9
+special CAXGZH000000000-CAXHBE999999999 embl_tpa_wgs_nuc # 6+9
+special CAXHBG000000000-CAXHHX999999999 embl_tpa_wgs_nuc # 6+9
+special CAXHYR000000000-CAXIDP999999999 embl_tpa_wgs_nuc # 6+9
+special CAXIEU000000000-CAXIEV999999999 embl_tpa_wgs_nuc # 6+9
# Some "EMBL" 8- and 10-character protein accessions are really third-party
# annotations.
-/* $Id: accguide2.inc 673909 2023-10-12 19:49:33Z ivanov $
+/* $Id: accguide2.inc 684361 2024-06-20 19:31:00Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
*
*/
-/* time_t value corresponding to Thu Oct 12 11:42:06 EDT 2023; formally
+/* time_t value corresponding to Wed Jun 12 13:27:59 EDT 2024; formally
* expressed as unsigned long so output can stand fully on its own. */
-static const unsigned long kBuiltInGuide_Timestamp = 1697125326UL;
+static const unsigned long kBuiltInGuide_Timestamp = 1718213279UL;
static const char* const kBuiltInGuide[] = {
- "# $Id: accguide2.inc 673909 2023-10-12 19:49:33Z ivanov $",
+ "# $Id: accguide2.inc 684361 2024-06-20 19:31:00Z ivanov $",
"version 2 # of file format",
"",
"# three-letter-prefix protein accessions (traditionally with five digits)",
"3+7 H?? gb_tpa_wgsv_prot",
"3+9 H?? gb_tpa_prot",
"3+11 H?? gb_tpa_prot",
- "3+5 I?? ddbj_tpa_wgs_prot",
+ "3+5 I?? ddbj_tpa_tsa_prot",
"3+7 I?? ddbj_tpa_prot",
"3+9 I?? ddbj_tpa_prot",
"3+11 I?? ddbj_tpa_prot",
"3+7 W?? gb_prot",
"3+9 W?? gb_prot",
"3+11 W?? gb_prot",
+ "3+5 X?? gb_prot",
+ "3+7 X?? gb_prot",
+ "3+9 X?? gb_prot",
+ "3+11 X?? gb_prot",
"3+5 ??? unreserved_prot",
"3+7 ??? unreserved_prot",
"3+9 ??? unreserved_prot",
"2+6 OS gb_patent",
"2+8 OS gb_other_nuc",
"2+10 OS gb_other_nuc",
- "2+6 OT gb_other_nuc",
+ "2+6 OT gb_patent",
"2+8 OT gb_other_nuc",
"2+10 OT gb_other_nuc",
"2+6 O? embl_other_nuc",
"2+6 PE ddbj_patent # from Korea",
"2+8 PE ddbj_other_nuc",
"2+10 PE ddbj_other_nuc",
- "2+6 PF ddbj_other_nuc",
+ "2+6 PF ddbj_patent # from Korea",
"2+8 PF ddbj_other_nuc",
"2+10 PF ddbj_other_nuc",
- "2+6 PG ddbj_other_nuc",
+ "2+6 PG ddbj_patent",
"2+8 PG ddbj_other_nuc",
"2+10 PG ddbj_other_nuc",
- "2+6 PH ddbj_other_nuc",
+ "2+6 PH ddbj_patent",
"2+8 PH ddbj_other_nuc",
"2+10 PH ddbj_other_nuc",
- "2+6 PI ddbj_other_nuc",
+ "2+6 PI ddbj_patent",
"2+8 PI ddbj_other_nuc",
"2+10 PI ddbj_other_nuc",
- "2+6 PJ ddbj_other_nuc",
+ "2+6 PJ ddbj_patent",
"2+8 PJ ddbj_other_nuc",
"2+10 PJ ddbj_other_nuc",
- "2+6 PK ddbj_other_nuc",
+ "2+6 PK ddbj_patent",
"2+8 PK ddbj_other_nuc",
"2+10 PK ddbj_other_nuc",
"2+6 PL ddbj_other_nuc",
"2+6 PO ddbj_other_nuc",
"2+8 PO ddbj_other_nuc",
"2+10 PO ddbj_other_nuc",
+ "2+6 PP gb_dirsub",
+ "2+8 PP gb_other_nuc",
+ "2+10 PP gb_other_nuc",
+ "2+6 PQ gb_dirsub",
+ "2+8 PQ gb_other_nuc",
+ "2+10 PQ gb_other_nuc",
+ "2+6 PR gb_patent",
+ "2+8 PR gb_other_nuc",
+ "2+10 PR gb_other_nuc",
+ "2+6 PS gb_con",
+ "2+8 PS gb_other_nuc",
+ "2+10 PS gb_other_nuc",
+ "2+6 PT gb_patent",
+ "2+8 PT gb_other_nuc",
+ "2+10 PT gb_other_nuc",
"2+6 PW unreserved_nuc # deliberately skipped",
"2+8 PW unreserved_nuc # deliberately skipped",
"2+10 PW unreserved_nuc # deliberately skipped",
"2+6 QJ gb_other_nuc",
"2+8 QJ gb_other_nuc",
"2+10 QJ gb_other_nuc",
+ "2+6 QK embl_patent",
+ "2+8 QK embl_other_nuc",
+ "2+10 QK embl_other_nuc",
+ "2+6 QL embl_patent",
+ "2+8 QL embl_other_nuc",
+ "2+10 QL embl_other_nuc",
+ "2+6 QM embl_patent",
+ "2+8 QM embl_other_nuc",
+ "2+10 QM embl_other_nuc",
+ "2+6 QN embl_patent",
+ "2+8 QN embl_other_nuc",
+ "2+10 QN embl_other_nuc",
+ "2+6 QO embl_patent",
+ "2+8 QO embl_other_nuc",
+ "2+10 QO embl_other_nuc",
"2+6 TI unreserved_nuc # deliberately skipped",
"2+8 TI unreserved_nuc # deliberately skipped",
"2+10 TI unreserved_nuc # deliberately skipped",
": 000000000-999999999",
"special CAUTNA000000000-CAUTOK999999999 embl_tpa_wgs_nuc # 6+9",
"special CAUTOM000000000-CAUVWA999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAWVRH000000000-CAWWDE999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAWZYP000000000-CAWZYZ999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXAAG000000000-CAXACN999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXAFD000000000-CAXAJU999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXASQ000000000-CAXAUW999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXAUY000000000-CAXAXI999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXAXL000000000-CAXAYR999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXAYT000000000-CAXBOQ999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXBOS000000000-CAXBSW999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXBUO000000000-CAXCFA999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXCFC000000000-CAXCFE999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXDIY000000000-CAXDKL999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXDKN000000000-CAXDLL999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXDLN000000000-CAXDMO999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXDMQ000000000-CAXDMR999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXDMV000000000-CAXDNN999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXDNQ000000000-CAXDOD999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXDOI000000000-CAXDOJ999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXDOL000000000-CAXDOO999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXDOT000000000-CAXDPF999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXDPH000000000-CAXDPJ999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXDPL000000000-CAXDPM999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXDPR000000000-CAXDPU999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXDPW000000000-CAXDPX999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXDPZ000000000-CAXDPZ999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXDQB000000000-CAXDQE999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXDQG000000000-CAXDQG999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXDQJ000000000-CAXDQT999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXDQW000000000-CAXDQY999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXDRB000000000-CAXDRB999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXDRE000000000-CAXDRE999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXDRG000000000-CAXDRG999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXDRI000000000-CAXDRU999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXDRW000000000-CAXDRX999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXDRZ000000000-CAXDSE999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXDSG000000000-CAXDSK999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXDSM000000000-CAXDTH999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXDTJ000000000-CAXDTM999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXDTO000000000-CAXDTO999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXDTW000000000-CAXDTW999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXEFG000000000-CAXEFJ999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXEGS000000000-CAXEKY999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXELA000000000-CAXEMQ999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXEMS000000000-CAXENB999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXEND000000000-CAXENO999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXENQ000000000-CAXEOK999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXEOM000000000-CAXEOS999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXEOU000000000-CAXEQM999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXEQO000000000-CAXEQW999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXEQY000000000-CAXERD999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXERF000000000-CAXERI999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXERK000000000-CAXERM999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXERO000000000-CAXERS999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXERU000000000-CAXERW999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXERY000000000-CAXESF999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXESH000000000-CAXESR999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXEST000000000-CAXETH999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXETJ000000000-CAXETW999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXETY000000000-CAXEUB999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXEUD000000000-CAXEUI999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXEUK000000000-CAXEUM999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXEUP000000000-CAXEVZ999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXEWB000000000-CAXEWG999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXEWI000000000-CAXEWO999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXEWQ000000000-CAXEWR999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXEWT000000000-CAXEYF999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXEYH000000000-CAXEYH999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXEYJ000000000-CAXEYL999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXEYN000000000-CAXEYQ999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXEYS000000000-CAXEYS999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXEYU000000000-CAXEYX999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXEYZ000000000-CAXEYZ999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXEZB000000000-CAXEZC999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXEZE000000000-CAXEZM999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXEZO000000000-CAXEZW999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXEZY000000000-CAXEZY999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFAA000000000-CAXFAB999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFAD000000000-CAXFAF999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFAH000000000-CAXFAM999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFAO000000000-CAXFAV999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFAX000000000-CAXFAX999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFBA000000000-CAXFBA999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFBD000000000-CAXFBD999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFBF000000000-CAXFBG999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFBJ000000000-CAXFBS999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFBU000000000-CAXFBW999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFBZ000000000-CAXFCX999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFCZ000000000-CAXFDS999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFDU000000000-CAXFDX999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFDZ000000000-CAXFEA999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFEO000000000-CAXFEO999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFER000000000-CAXFER999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFEW000000000-CAXFEW999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFEY000000000-CAXFEY999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFFB000000000-CAXFFB999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFFD000000000-CAXFFF999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFFL000000000-CAXFFL999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFFS000000000-CAXFFS999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFFU000000000-CAXFFZ999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFGC000000000-CAXFGE999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFGG000000000-CAXFGG999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFGI000000000-CAXFGK999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFGM000000000-CAXFGM999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFGO000000000-CAXFGT999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFGX000000000-CAXFGY999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFHB000000000-CAXFHC999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFHF000000000-CAXFHF999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFIC000000000-CAXFIC999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFIF000000000-CAXFIH999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFIJ000000000-CAXFIK999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFIQ000000000-CAXFIU999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFIY000000000-CAXFJG999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFJI000000000-CAXFJI999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFJL000000000-CAXFJP999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFJR000000000-CAXFJR999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFJT000000000-CAXFJW999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFJY000000000-CAXFJZ999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFKB000000000-CAXFKB999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFKD000000000-CAXFKE999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFKJ000000000-CAXFKJ999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFKM000000000-CAXFKN999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFKT000000000-CAXFKT999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFKV000000000-CAXFKV999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFKX000000000-CAXFKZ999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFLB000000000-CAXFLC999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFLE000000000-CAXFLI999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFLK000000000-CAXFLK999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFLM000000000-CAXFLM999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFLO000000000-CAXFLQ999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFLS000000000-CAXFLT999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFLV000000000-CAXFLV999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFLY000000000-CAXFLY999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFMB000000000-CAXFMB999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFMD000000000-CAXFMD999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFMI000000000-CAXFMI999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFMN000000000-CAXFMN999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFMP000000000-CAXFMP999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFMS000000000-CAXFMW999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFMY000000000-CAXFNA999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFNC000000000-CAXFND999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFNF000000000-CAXFNM999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFNO000000000-CAXFNO999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFNQ000000000-CAXFNR999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFNT000000000-CAXFNT999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFNW000000000-CAXFNZ999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFOB000000000-CAXFOX999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFOZ000000000-CAXFPB999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFPD000000000-CAXFPD999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFPF000000000-CAXFPG999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFPI000000000-CAXFPM999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFPO000000000-CAXFPW999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFPY000000000-CAXFPY999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFQA000000000-CAXFQA999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFQC000000000-CAXFQE999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFQG000000000-CAXFQN999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFQP000000000-CAXFQP999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFQR000000000-CAXFQR999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFQT000000000-CAXFQT999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFQV000000000-CAXFQV999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFQY000000000-CAXFQY999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFRA000000000-CAXFRA999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFRE000000000-CAXFRG999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFRJ000000000-CAXFRK999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFRQ000000000-CAXFRQ999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFRS000000000-CAXFRS999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFRX000000000-CAXFRY999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFSC000000000-CAXFSD999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFSJ000000000-CAXFSJ999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFSR000000000-CAXFSW999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFSY000000000-CAXFTK999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFTM000000000-CAXFTW999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXFZX000000000-CAXFZZ999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXGAB000000000-CAXGCZ999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXGHC000000000-CAXGYU999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXGZH000000000-CAXHBE999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXHBG000000000-CAXHHX999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXHYR000000000-CAXIDP999999999 embl_tpa_wgs_nuc # 6+9",
+ "special CAXIEU000000000-CAXIEV999999999 embl_tpa_wgs_nuc # 6+9",
"",
"# Some \"EMBL\" TPA nucleotide accessions are really third-party annotations.",
"special2 HBHG+8 embl_tpa_tsa_nuc",
-# $Id: accguide2.txt 673909 2023-10-12 19:49:33Z ivanov $
+# $Id: accguide2.txt 684361 2024-06-20 19:31:00Z ivanov $
version 2 # of file format
# three-letter-prefix protein accessions (traditionally with five digits)
3+7 H?? gb_tpa_wgsv_prot
3+9 H?? gb_tpa_prot
3+11 H?? gb_tpa_prot
-3+5 I?? ddbj_tpa_wgs_prot
+3+5 I?? ddbj_tpa_tsa_prot
3+7 I?? ddbj_tpa_prot
3+9 I?? ddbj_tpa_prot
3+11 I?? ddbj_tpa_prot
3+7 W?? gb_prot
3+9 W?? gb_prot
3+11 W?? gb_prot
+3+5 X?? gb_prot
+3+7 X?? gb_prot
+3+9 X?? gb_prot
+3+11 X?? gb_prot
3+5 ??? unreserved_prot
3+7 ??? unreserved_prot
3+9 ??? unreserved_prot
2+6 OS gb_patent
2+8 OS gb_other_nuc
2+10 OS gb_other_nuc
-2+6 OT gb_other_nuc
+2+6 OT gb_patent
2+8 OT gb_other_nuc
2+10 OT gb_other_nuc
2+6 O? embl_other_nuc
2+6 PE ddbj_patent # from Korea
2+8 PE ddbj_other_nuc
2+10 PE ddbj_other_nuc
-2+6 PF ddbj_other_nuc
+2+6 PF ddbj_patent # from Korea
2+8 PF ddbj_other_nuc
2+10 PF ddbj_other_nuc
-2+6 PG ddbj_other_nuc
+2+6 PG ddbj_patent
2+8 PG ddbj_other_nuc
2+10 PG ddbj_other_nuc
-2+6 PH ddbj_other_nuc
+2+6 PH ddbj_patent
2+8 PH ddbj_other_nuc
2+10 PH ddbj_other_nuc
-2+6 PI ddbj_other_nuc
+2+6 PI ddbj_patent
2+8 PI ddbj_other_nuc
2+10 PI ddbj_other_nuc
-2+6 PJ ddbj_other_nuc
+2+6 PJ ddbj_patent
2+8 PJ ddbj_other_nuc
2+10 PJ ddbj_other_nuc
-2+6 PK ddbj_other_nuc
+2+6 PK ddbj_patent
2+8 PK ddbj_other_nuc
2+10 PK ddbj_other_nuc
2+6 PL ddbj_other_nuc
2+6 PO ddbj_other_nuc
2+8 PO ddbj_other_nuc
2+10 PO ddbj_other_nuc
+2+6 PP gb_dirsub
+2+8 PP gb_other_nuc
+2+10 PP gb_other_nuc
+2+6 PQ gb_dirsub
+2+8 PQ gb_other_nuc
+2+10 PQ gb_other_nuc
+2+6 PR gb_patent
+2+8 PR gb_other_nuc
+2+10 PR gb_other_nuc
+2+6 PS gb_con
+2+8 PS gb_other_nuc
+2+10 PS gb_other_nuc
+2+6 PT gb_patent
+2+8 PT gb_other_nuc
+2+10 PT gb_other_nuc
2+6 PW unreserved_nuc # deliberately skipped
2+8 PW unreserved_nuc # deliberately skipped
2+10 PW unreserved_nuc # deliberately skipped
2+6 QJ gb_other_nuc
2+8 QJ gb_other_nuc
2+10 QJ gb_other_nuc
+2+6 QK embl_patent
+2+8 QK embl_other_nuc
+2+10 QK embl_other_nuc
+2+6 QL embl_patent
+2+8 QL embl_other_nuc
+2+10 QL embl_other_nuc
+2+6 QM embl_patent
+2+8 QM embl_other_nuc
+2+10 QM embl_other_nuc
+2+6 QN embl_patent
+2+8 QN embl_other_nuc
+2+10 QN embl_other_nuc
+2+6 QO embl_patent
+2+8 QO embl_other_nuc
+2+10 QO embl_other_nuc
2+6 TI unreserved_nuc # deliberately skipped
2+8 TI unreserved_nuc # deliberately skipped
2+10 TI unreserved_nuc # deliberately skipped
: 000000000-999999999
special CAUTNA000000000-CAUTOK999999999 embl_tpa_wgs_nuc # 6+9
special CAUTOM000000000-CAUVWA999999999 embl_tpa_wgs_nuc # 6+9
+special CAWVRH000000000-CAWWDE999999999 embl_tpa_wgs_nuc # 6+9
+special CAWZYP000000000-CAWZYZ999999999 embl_tpa_wgs_nuc # 6+9
+special CAXAAG000000000-CAXACN999999999 embl_tpa_wgs_nuc # 6+9
+special CAXAFD000000000-CAXAJU999999999 embl_tpa_wgs_nuc # 6+9
+special CAXASQ000000000-CAXAUW999999999 embl_tpa_wgs_nuc # 6+9
+special CAXAUY000000000-CAXAXI999999999 embl_tpa_wgs_nuc # 6+9
+special CAXAXL000000000-CAXAYR999999999 embl_tpa_wgs_nuc # 6+9
+special CAXAYT000000000-CAXBOQ999999999 embl_tpa_wgs_nuc # 6+9
+special CAXBOS000000000-CAXBSW999999999 embl_tpa_wgs_nuc # 6+9
+special CAXBUO000000000-CAXCFA999999999 embl_tpa_wgs_nuc # 6+9
+special CAXCFC000000000-CAXCFE999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDIY000000000-CAXDKL999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDKN000000000-CAXDLL999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDLN000000000-CAXDMO999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDMQ000000000-CAXDMR999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDMV000000000-CAXDNN999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDNQ000000000-CAXDOD999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDOI000000000-CAXDOJ999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDOL000000000-CAXDOO999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDOT000000000-CAXDPF999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDPH000000000-CAXDPJ999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDPL000000000-CAXDPM999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDPR000000000-CAXDPU999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDPW000000000-CAXDPX999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDPZ000000000-CAXDPZ999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDQB000000000-CAXDQE999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDQG000000000-CAXDQG999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDQJ000000000-CAXDQT999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDQW000000000-CAXDQY999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDRB000000000-CAXDRB999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDRE000000000-CAXDRE999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDRG000000000-CAXDRG999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDRI000000000-CAXDRU999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDRW000000000-CAXDRX999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDRZ000000000-CAXDSE999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDSG000000000-CAXDSK999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDSM000000000-CAXDTH999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDTJ000000000-CAXDTM999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDTO000000000-CAXDTO999999999 embl_tpa_wgs_nuc # 6+9
+special CAXDTW000000000-CAXDTW999999999 embl_tpa_wgs_nuc # 6+9
+special CAXEFG000000000-CAXEFJ999999999 embl_tpa_wgs_nuc # 6+9
+special CAXEGS000000000-CAXEKY999999999 embl_tpa_wgs_nuc # 6+9
+special CAXELA000000000-CAXEMQ999999999 embl_tpa_wgs_nuc # 6+9
+special CAXEMS000000000-CAXENB999999999 embl_tpa_wgs_nuc # 6+9
+special CAXEND000000000-CAXENO999999999 embl_tpa_wgs_nuc # 6+9
+special CAXENQ000000000-CAXEOK999999999 embl_tpa_wgs_nuc # 6+9
+special CAXEOM000000000-CAXEOS999999999 embl_tpa_wgs_nuc # 6+9
+special CAXEOU000000000-CAXEQM999999999 embl_tpa_wgs_nuc # 6+9
+special CAXEQO000000000-CAXEQW999999999 embl_tpa_wgs_nuc # 6+9
+special CAXEQY000000000-CAXERD999999999 embl_tpa_wgs_nuc # 6+9
+special CAXERF000000000-CAXERI999999999 embl_tpa_wgs_nuc # 6+9
+special CAXERK000000000-CAXERM999999999 embl_tpa_wgs_nuc # 6+9
+special CAXERO000000000-CAXERS999999999 embl_tpa_wgs_nuc # 6+9
+special CAXERU000000000-CAXERW999999999 embl_tpa_wgs_nuc # 6+9
+special CAXERY000000000-CAXESF999999999 embl_tpa_wgs_nuc # 6+9
+special CAXESH000000000-CAXESR999999999 embl_tpa_wgs_nuc # 6+9
+special CAXEST000000000-CAXETH999999999 embl_tpa_wgs_nuc # 6+9
+special CAXETJ000000000-CAXETW999999999 embl_tpa_wgs_nuc # 6+9
+special CAXETY000000000-CAXEUB999999999 embl_tpa_wgs_nuc # 6+9
+special CAXEUD000000000-CAXEUI999999999 embl_tpa_wgs_nuc # 6+9
+special CAXEUK000000000-CAXEUM999999999 embl_tpa_wgs_nuc # 6+9
+special CAXEUP000000000-CAXEVZ999999999 embl_tpa_wgs_nuc # 6+9
+special CAXEWB000000000-CAXEWG999999999 embl_tpa_wgs_nuc # 6+9
+special CAXEWI000000000-CAXEWO999999999 embl_tpa_wgs_nuc # 6+9
+special CAXEWQ000000000-CAXEWR999999999 embl_tpa_wgs_nuc # 6+9
+special CAXEWT000000000-CAXEYF999999999 embl_tpa_wgs_nuc # 6+9
+special CAXEYH000000000-CAXEYH999999999 embl_tpa_wgs_nuc # 6+9
+special CAXEYJ000000000-CAXEYL999999999 embl_tpa_wgs_nuc # 6+9
+special CAXEYN000000000-CAXEYQ999999999 embl_tpa_wgs_nuc # 6+9
+special CAXEYS000000000-CAXEYS999999999 embl_tpa_wgs_nuc # 6+9
+special CAXEYU000000000-CAXEYX999999999 embl_tpa_wgs_nuc # 6+9
+special CAXEYZ000000000-CAXEYZ999999999 embl_tpa_wgs_nuc # 6+9
+special CAXEZB000000000-CAXEZC999999999 embl_tpa_wgs_nuc # 6+9
+special CAXEZE000000000-CAXEZM999999999 embl_tpa_wgs_nuc # 6+9
+special CAXEZO000000000-CAXEZW999999999 embl_tpa_wgs_nuc # 6+9
+special CAXEZY000000000-CAXEZY999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFAA000000000-CAXFAB999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFAD000000000-CAXFAF999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFAH000000000-CAXFAM999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFAO000000000-CAXFAV999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFAX000000000-CAXFAX999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFBA000000000-CAXFBA999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFBD000000000-CAXFBD999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFBF000000000-CAXFBG999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFBJ000000000-CAXFBS999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFBU000000000-CAXFBW999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFBZ000000000-CAXFCX999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFCZ000000000-CAXFDS999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFDU000000000-CAXFDX999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFDZ000000000-CAXFEA999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFEO000000000-CAXFEO999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFER000000000-CAXFER999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFEW000000000-CAXFEW999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFEY000000000-CAXFEY999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFFB000000000-CAXFFB999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFFD000000000-CAXFFF999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFFL000000000-CAXFFL999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFFS000000000-CAXFFS999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFFU000000000-CAXFFZ999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFGC000000000-CAXFGE999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFGG000000000-CAXFGG999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFGI000000000-CAXFGK999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFGM000000000-CAXFGM999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFGO000000000-CAXFGT999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFGX000000000-CAXFGY999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFHB000000000-CAXFHC999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFHF000000000-CAXFHF999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFIC000000000-CAXFIC999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFIF000000000-CAXFIH999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFIJ000000000-CAXFIK999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFIQ000000000-CAXFIU999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFIY000000000-CAXFJG999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFJI000000000-CAXFJI999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFJL000000000-CAXFJP999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFJR000000000-CAXFJR999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFJT000000000-CAXFJW999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFJY000000000-CAXFJZ999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFKB000000000-CAXFKB999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFKD000000000-CAXFKE999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFKJ000000000-CAXFKJ999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFKM000000000-CAXFKN999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFKT000000000-CAXFKT999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFKV000000000-CAXFKV999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFKX000000000-CAXFKZ999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFLB000000000-CAXFLC999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFLE000000000-CAXFLI999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFLK000000000-CAXFLK999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFLM000000000-CAXFLM999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFLO000000000-CAXFLQ999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFLS000000000-CAXFLT999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFLV000000000-CAXFLV999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFLY000000000-CAXFLY999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFMB000000000-CAXFMB999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFMD000000000-CAXFMD999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFMI000000000-CAXFMI999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFMN000000000-CAXFMN999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFMP000000000-CAXFMP999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFMS000000000-CAXFMW999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFMY000000000-CAXFNA999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFNC000000000-CAXFND999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFNF000000000-CAXFNM999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFNO000000000-CAXFNO999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFNQ000000000-CAXFNR999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFNT000000000-CAXFNT999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFNW000000000-CAXFNZ999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFOB000000000-CAXFOX999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFOZ000000000-CAXFPB999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFPD000000000-CAXFPD999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFPF000000000-CAXFPG999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFPI000000000-CAXFPM999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFPO000000000-CAXFPW999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFPY000000000-CAXFPY999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFQA000000000-CAXFQA999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFQC000000000-CAXFQE999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFQG000000000-CAXFQN999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFQP000000000-CAXFQP999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFQR000000000-CAXFQR999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFQT000000000-CAXFQT999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFQV000000000-CAXFQV999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFQY000000000-CAXFQY999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFRA000000000-CAXFRA999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFRE000000000-CAXFRG999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFRJ000000000-CAXFRK999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFRQ000000000-CAXFRQ999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFRS000000000-CAXFRS999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFRX000000000-CAXFRY999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFSC000000000-CAXFSD999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFSJ000000000-CAXFSJ999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFSR000000000-CAXFSW999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFSY000000000-CAXFTK999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFTM000000000-CAXFTW999999999 embl_tpa_wgs_nuc # 6+9
+special CAXFZX000000000-CAXFZZ999999999 embl_tpa_wgs_nuc # 6+9
+special CAXGAB000000000-CAXGCZ999999999 embl_tpa_wgs_nuc # 6+9
+special CAXGHC000000000-CAXGYU999999999 embl_tpa_wgs_nuc # 6+9
+special CAXGZH000000000-CAXHBE999999999 embl_tpa_wgs_nuc # 6+9
+special CAXHBG000000000-CAXHHX999999999 embl_tpa_wgs_nuc # 6+9
+special CAXHYR000000000-CAXIDP999999999 embl_tpa_wgs_nuc # 6+9
+special CAXIEU000000000-CAXIEV999999999 embl_tpa_wgs_nuc # 6+9
# Some "EMBL" TPA nucleotide accessions are really third-party annotations.
special2 HBHG+8 embl_tpa_tsa_nuc
-/* $Id: local_taxon.cpp 663139 2023-02-13 20:02:01Z mozese2 $
+/* $Id: local_taxon.cpp 684231 2024-06-17 12:05:48Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
x_Cache(taxid);
return m_Nodes.find(taxid)->second.rank;
} else {
- TTaxRank rank_id = m_TaxonConn->GetTreeIterator(taxid)->GetNode()->GetRank();
string rank_name;
- m_TaxonConn->GetRankName(rank_id, rank_name);
+ auto node = m_TaxonConn->GetTreeIterator(taxid)->GetNode();
+ if (node) {
+ TTaxRank rank_id = node->GetRank();
+ m_TaxonConn->GetRankName(rank_id, rank_name);
+ }
return rank_name;
}
}
}
}
return ZERO_TAX_ID;
- } else {
- return m_TaxonConn->GetAncestorByRank(taxid, rank.c_str());
+ } else if (m_fallback) {
+ if (!m_TaxonConn.get()) {
+ m_TaxonConn.reset(new CTaxon1);
+ m_TaxonConn->Init();
+ }
+ return m_TaxonConn->GetAncestorByRank(taxid, rank.c_str());
}
+NCBI_THROW(CException, eUnknown, "CLocalTaxon: neither local nor remote connections available");
}
CLocalTaxon::TTaxid CLocalTaxon::GetTaxIdByOrgRef(const COrg_ref &inp_orgRef)
TLineage::const_iterator it1 = lineage1.begin(),
it2 = lineage2.begin();
for (; it1 != lineage1.end() && it2 != lineage2.end() && *it1 == *it2;
- ++it1, ++it2);
+ ++it1, ++it2) {
+ }
+ if (it1 == lineage1.end()) {
+ return 0;
+ }
return *--it1;
} else {
return m_TaxonConn->Join(taxid1, taxid2);
-/* $Id: ValidErrItem.cpp 660629 2022-12-20 23:10:05Z kans $
+/* $Id: ValidErrItem.cpp 684486 2024-06-25 12:34:24Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
{ eErr_SEQ_INST_InstantiatedGapMismatch,
{ "InstantiatedGapMismatch",
"Gap misc_feature does not match gap in delta Bioseq" } } ,
+ { eErr_SEQ_INST_BadSeqIdCharacter,
+ { "BadSeqIdCharacter",
+ "An illegal character is present in the sequence identifier." } },
+ { eErr_SEQ_INST_BadSeqIdLength,
+ { "BadSeqIdLength",
+ "A sequence identifier field is longer than the allowed maximum length." } },
/* SEQ_DESCR */
{ eErr_SEQ_DESCR_NonViralSegment,
{ "NonViralSegment",
"Non-viral taxonomy should not have segment qualifier" } },
+ { eErr_SEQ_DESCR_BadGeoLocNameCode,
+ { "BadGeoLocNameCode",
+ "The geo_loc_name code (up to the first colon) is not on the approved list of countries." } },
+ { eErr_SEQ_DESCR_LatLonGeoLocName,
+ { "LatLonGeoLocName",
+ "The lat_lon coordinate does not map to the indicated geo_loc_name." } },
+ { eErr_SEQ_DESCR_ReplacedGeoLocNameCode,
+ { "ReplacedGeoLocNameCode",
+ "The geo_loc_name code (up to the first colon) is no longer on the approved list of countries." } },
+ { eErr_SEQ_DESCR_BadGeoLocNameCapitalization,
+ { "BadGeoLocNameCapitalization",
+ "The geo_loc_name code does not use the correct capitalization." } },
+ { eErr_SEQ_DESCR_BadInstitutionGeoLocName,
+ { "BadInstitutionGeoLocName",
+ "The institution (or institution: collection) code should not have a <geo_loc_name> modifier." } },
+ { eErr_SEQ_DESCR_MultipleIsolates,
+ { "MultipleIsolates",
+ "A Biosource should only have one isolate value" } } ,
/* SEQ_GENERIC */
{ eErr_GENERIC_MissingPubRequirement,
{ "MissingPubRequirement",
"The publication is missing essential information, such as title or authors." } },
+ { eErr_GENERIC_BadSubmissionAuthorName,
+ { "BadSubmissionAuthorName",
+"A submission author name field is invalid." } },
+ { eErr_GENERIC_BarcodeMissingGeoLocName,
+ { "BarcodeMissingGeoLocName",
+ "Barcode sequence is missing geo_loc_name." } },
/* SEQ_PKG */
#undef END
-CValidErrItem::CValidErrItem
-(EDiagSev sev,
- unsigned int ec,
- const string& msg,
- const string& desc,
- const CSerialObject& obj,
- const string& acc,
- const int ver,
- const int seq_offset)
- : m_Object(&obj)
+CValidErrItem::CValidErrItem(
+ EDiagSev sev,
+ unsigned int ec,
+ const string& msg,
+ const string& desc,
+ const CSerialObject* obj,
+ const CSeq_entry* ctx,
+ const string& acc,
+ const int ver,
+ const int seq_offset)
{
SetSev(sev);
SetErrIndex(ec);
SetVersion(ver);
SetErrorName(ConvertErrCode(ec));
SetErrorGroup(ConvertErrGroup(ec));
-}
-
-CValidErrItem::CValidErrItem
-(EDiagSev sev,
- unsigned int ec,
- const string& msg,
- const string& desc,
- const string& acc,
- const int ver,
- const int seq_offset)
-{
- SetSev(sev);
- SetErrIndex(ec);
- SetMsg(msg);
- SetObjDesc(desc);
- SetAccession(acc);
- SetSeqOffset(seq_offset);
- if (ver > 0) {
- SetAccnver(acc + "." + NStr::IntToString(ver));
- } else {
- SetAccnver(acc);
+ if (obj) {
+ SetObject(*obj);
}
- SetVersion(ver);
- SetErrorName(ConvertErrCode(ec));
- SetErrorGroup(ConvertErrGroup(ec));
-}
-
-
-
-
-
-
-CValidErrItem::CValidErrItem
-(EDiagSev sev,
- unsigned int ec,
- const string& msg,
- const string& desc,
- const CSerialObject& obj,
- const string& acc,
- const int ver,
- const string& feature_id,
- const int seq_offset)
- : m_Object(&obj)
-{
- SetSev(sev);
- SetErrIndex(ec);
- SetMsg(msg);
- SetObjDesc(desc);
- SetAccession(acc);
- SetFeatureId(feature_id);
- SetSeqOffset(seq_offset);
- if (ver > 0) {
- SetAccnver(acc + "." + NStr::IntToString(ver));
- } else {
- SetAccnver(acc);
+ if (ctx) {
+ m_Ctx.Reset(ctx);
}
- SetVersion(ver);
- SetErrorName(ConvertErrCode(ec));
- SetErrorGroup(ConvertErrGroup(ec));
-}
-
-CValidErrItem::CValidErrItem
-(EDiagSev sev,
- unsigned int ec,
- const string& msg,
- const string& desc,
- const CSerialObject& obj,
- const CSeq_entry& ctx,
- const string& acc,
- const int ver,
- const int seq_offset)
- : m_Object(&obj),
- m_Ctx(&ctx)
-{
- SetSev(sev);
- SetErrIndex(ec);
- SetMsg(msg);
- SetObjDesc(desc);
- SetAccession(acc);
- SetSeqOffset(seq_offset);
- if (ver > 0) {
- SetAccnver(acc + "." + NStr::IntToString(ver));
- } else {
- SetAccnver(acc);
- }
- SetVersion(ver);
- SetErrorName(ConvertErrCode(ec));
- SetErrorGroup(ConvertErrGroup(ec));
}
// destructor
-CValidErrItem::~CValidErrItem(void)
+CValidErrItem::~CValidErrItem()
{
}
-const string CValidErrItem::GetErrCode(void) const
+const string CValidErrItem::GetErrCode() const
{
return ConvertErrCode(GetErrIndex());
}
-size_t CValidErrItem::GetErrCount(void)
+size_t CValidErrItem::GetErrCount()
{
return sc_ErrStrsMap.size();
}
-const string CValidErrItem::ConvertErrGroup(unsigned int err_int)
+const string& CValidErrItem::ConvertErrGroup(unsigned int err_int)
{
- static const char* kSeqInst = "SEQ_INST";
- static const char* kSeqDescr = "SEQ_DESCR";
- static const char* kGeneric = "GENERIC";
- static const char* kSeqPkg = "SEQ_PKG";
- static const char* kSeqFeat = "SEQ_FEAT";
- static const char* kSeqAlign = "SEQ_ALIGN";
- static const char* kSeqGraph = "SEQ_GRAPH";
- static const char* kSeqAnnot = "SEQ_ANNOT";
- static const char* kInternal = "INTERNAL";
- static const char* kUnknown = "UNKNOWN";
-
- TErrIndex errIndex = static_cast<TErrIndex> (err_int);
-
+ static const string kSeqInst = "SEQ_INST";
+ static const string kSeqDescr = "SEQ_DESCR";
+ static const string kGeneric = "GENERIC";
+ static const string kSeqPkg = "SEQ_PKG";
+ static const string kSeqFeat = "SEQ_FEAT";
+ static const string kSeqAlign = "SEQ_ALIGN";
+ static const string kSeqGraph = "SEQ_GRAPH";
+ static const string kSeqAnnot = "SEQ_ANNOT";
+ static const string kInternal = "INTERNAL";
+ static const string kUnknown = "UNKNOWN";
+
+ TErrIndex errIndex = static_cast<TErrIndex>(err_int);
+
#define IS_IN(x) (errIndex > ERR_CODE_BEGIN(x)) && (errIndex < ERR_CODE_END(x))
if ((errIndex < eErr_MAX) && (errIndex > 0)) {
return kUnknown;
}
-const string CValidErrItem::GetErrGroup(void) const
+const string CValidErrItem::GetErrGroup() const
{
return ConvertErrGroup(GetErrIndex());
}
-const string CValidErrItem::GetVerbose(void) const
+const string CValidErrItem::GetVerbose() const
{
TErrIndex err = GetErrIndex();
if (err <= eErr_MAX) {
return err_it->second.second;
}
}
- return sc_ErrStrsMap.find(eErr_UNKNOWN)->second.second ;
+ return sc_ErrStrsMap.find(eErr_UNKNOWN)->second.second;
}
-const CSerialObject& CValidErrItem::GetObject(void) const
+const CSerialObject& CValidErrItem::GetObject() const
{
return *m_Object;
}
-bool CValidErrItem::IsSetObject(void) const
+bool CValidErrItem::IsSetObject() const
{
- return m_Object.NotEmpty();
+ return m_Object.NotEmpty();
}
}
-const string CValidErrItem::ConvertSeverity(EDiagSev sev)
+const string& CValidErrItem::ConvertSeverity(EDiagSev sev)
{
- static const char* str_sev[] = {
+ static const string str_sev[eDiagSevMax + 1] = {
"Info", "Warning", "Error", "Critical", "Fatal", "Trace"
};
}
-const string CValidErrItem::ConvertErrCode(unsigned int err_int)
+const string& CValidErrItem::ConvertErrCode(unsigned int err_int)
{
- TErrIndex err = static_cast<TErrIndex> (err_int);
+ TErrIndex err = static_cast<TErrIndex>(err_int);
if (err <= eErr_MAX) {
TErrTypeStrsMap::const_iterator err_it = sc_ErrStrsMap.find(err);
if (err_it != sc_ErrStrsMap.end()) {
-/* $Id: ValidError.cpp 657933 2022-10-20 18:09:57Z ludwigf $
+/* $Id: ValidError.cpp 676047 2023-12-07 14:47:50Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
{
}
-void CValidError::AddValidErrItem
-(EDiagSev sev,
- unsigned int ec,
- const string& msg,
- const string& desc,
- const CSerialObject& obj,
- const string& acc,
- const int ver,
- const string& location,
- const int seq_offset)
+void CValidError::AddValidErrItem(
+ EDiagSev sev,
+ unsigned int ec,
+ const string& msg,
+ const string& desc,
+ const CSerialObject& obj,
+ const string& acc,
+ const int ver,
+ const string& location,
+ const int seq_offset)
{
if (ShouldSuppress(ec)) {
return;
}
- CRef<CValidErrItem> item(new CValidErrItem(sev, ec, msg, desc, obj, acc, ver, seq_offset));
+ CRef<CValidErrItem> item(new CValidErrItem(sev, ec, msg, desc, &obj, nullptr, acc, ver, seq_offset));
if (!NStr::IsBlank(location)) {
item->SetLocation(location);
}
m_Stats[item->GetSeverity()]++;
}
-void CValidError::AddValidErrItem
-(EDiagSev sev,
- unsigned int ec,
- const string& msg,
- const string& desc,
- const string& acc,
- const int ver,
- const string& location,
- const int seq_offset)
+void CValidError::AddValidErrItem(
+ EDiagSev sev,
+ unsigned int ec,
+ const string& msg,
+ const string& desc,
+ const string& acc,
+ const int ver,
+ const string& location,
+ const int seq_offset)
{
if (ShouldSuppress(ec)) {
return;
}
- CRef<CValidErrItem> item(new CValidErrItem(sev, ec, msg, desc, acc, ver, seq_offset));
+ CRef<CValidErrItem> item(new CValidErrItem(sev, ec, msg, desc, nullptr, nullptr, acc, ver, seq_offset));
if (!NStr::IsBlank(location)) {
item->SetLocation(location);
}
}
-void CValidError::AddValidErrItem
-(EDiagSev sev,
- unsigned int ec,
- const string& msg,
- const string& desc,
- const CSerialObject& obj,
- const string& acc,
- const int ver,
- const string& feature_id,
- const string& location,
- const int seq_offset)
+void CValidError::AddValidErrItem(
+ EDiagSev sev,
+ unsigned int ec,
+ const string& msg,
+ const string& desc,
+ const CSeqdesc& seqdesc,
+ const CSeq_entry& ctx,
+ const string& acc,
+ const int ver,
+ const int seq_offset)
{
if (ShouldSuppress(ec)) {
return;
}
- CRef<CValidErrItem> item(new CValidErrItem(sev, ec, msg, desc, obj, acc, ver, feature_id, seq_offset));
- if (!NStr::IsBlank(location)) {
- item->SetLocation(location);
- }
- SetErrs().push_back(item);
- m_Stats[item->GetSeverity()]++;
-}
-
-
-void CValidError::AddValidErrItem
-(EDiagSev sev,
- unsigned int ec,
- const string& msg,
- const string& desc,
- const CSeqdesc& seqdesc,
- const CSeq_entry& ctx,
- const string& acc,
- const int ver,
- const int seq_offset)
-{
- if (ShouldSuppress(ec)) {
- return;
- }
- CRef<CValidErrItem> item(new CValidErrItem(sev, ec, msg, desc, seqdesc, ctx, acc, ver, seq_offset));
+ CRef<CValidErrItem> item(new CValidErrItem(sev, ec, msg, desc, &seqdesc, &ctx, acc, ver, seq_offset));
SetErrs().push_back(item);
m_Stats[item->GetSeverity()]++;
}
}
-CValidError_CI::CValidError_CI
-(const CValidError& ve,
- const string& errcode,
- EDiagSev minsev,
- EDiagSev maxsev) :
+CValidError_CI::CValidError_CI(
+ const CValidError& ve,
+ const string& errcode,
+ EDiagSev minsev,
+ EDiagSev maxsev) :
m_Validator(&ve),
m_Current(ve.GetErrs().begin()),
m_ErrCodeFilter(errcode),
m_MinSeverity(minsev),
m_MaxSeverity(maxsev)
{
- if ( IsValid() && !Filter(**m_Current) ) {
+ if (IsValid() && ! Filter(**m_Current)) {
Next();
}
}
-/* $Id: validrules.inc 672959 2023-09-19 12:44:26Z ivanov $
+/* $Id: validrules.inc 679583 2024-02-28 13:21:31Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
/* time_t value corresponding to Tue Feb 14 13:22:03 EST 2023
; formally
* expressed as unsigned long so output can stand fully on its own. */
-static const unsigned long s_Defaultvalidrules_Timestamp = 1694719829UL;
+static const unsigned long s_Defaultvalidrules_Timestamp = 1709047163UL;
static const char* const s_Defaultvalidrules[] = {
"Comment-set ::= {",
" {",
)
{
- unsigned int genes = 0, cdregions = 0, prots = 0;
+ unsigned int genes = 0, cdregions = 0;
CConstRef<CSeq_feat> gene(0);
CConstRef<CSeq_feat> cdregion(0);
SAnnotSelector sel;
sel.SetFeatType(CSeqFeatData::e_Gene);
sel.IncludeFeatType(CSeqFeatData::e_Cdregion);
- sel.IncludeFeatType(CSeqFeatData::e_Prot);
sel.SetResolveTSE();
FOR_SELECTED_SEQFEAT_ON_BIOSEQ_HANDLE (feat_it, bsh, sel) {
++cdregions;
cdregion.Reset(&sft);
break;
- case CSeqFeatData::e_Prot:
- ++prots;
- break;
default:
break;
}
m_MainTitle.erase (pos + 1);
}
- int offset = 0;
- int delta = 0;
+ size_t offset = 0;
+ size_t delta = 0;
string comma;
string isoform;
if (NStr::StartsWith (m_MainTitle, "hypothetical protein")) {
prefix = "TPA_inf: ";
} else if (m_TPAReasm) {
prefix = "TPA_asm: ";
- } else {
+ } else if (m_Idx && m_IsAA) {
+ CRef<CBioseqIndex> bsx = m_Idx->GetBioseqIndex (bsh);
+ if (bsx) {
+ CWeakRef<CBioseqIndex> bsxp = bsx->GetBioseqForProduct();
+ auto nucx = bsxp.Lock();
+ if (nucx) {
+ if (nucx->IsTPAExp()) {
+ prefix = "TPA_exp: ";
+ } else if (nucx->IsTPAInf()) {
+ prefix = "TPA_inf: ";
+ } else if (nucx->IsTPAReasm()) {
+ prefix = "TPA_asm: ";
+ }
+ }
+ }
+ }
+ if (prefix.empty()) {
prefix = "TPA: ";
}
} else if (m_IsTSA) {
)
{
- size_t pos;
- int len1, len2, idx;
+ size_t pos, idx;
+ size_t len1, len2;
- len1 = (int) title.length();
- len2 = (int) taxname.length();
+ len1 = title.length();
+ len2 = taxname.length();
idx = len1 - len2 - 3;
if (len1 > len2 + 4 && title [idx] == ' ' && title [idx + 1] == '[' && title [len1 - 1] == ']') {
"MAG ",
"MAG:",
"MULTISPECIES:",
+ "TLS:",
"TPA:",
"TPA_exp:",
"TPA_inf:",
joiner.Add("plastid_name", subname);
break;
case CSubSource::eSubtype_country:
- joiner.Add("country", subname);
+ if (CSubSource::NCBI_UseGeoLocNameForCountry()) {
+ joiner.Add("geo_loc_name", subname);
+ } else {
+ joiner.Add("country", subname);
+ }
break;
case CSubSource::eSubtype_segment:
joiner.Add("segment", subname);
}
// remove TPA or TSA prefix, will rely on other data in record to set
- for (int i = 0; i < sizeof (s_tpaPrefixList) / sizeof (const char*); i++) {
+ for (size_t i = 0; i < sizeof (s_tpaPrefixList) / sizeof (const char*); i++) {
string str = s_tpaPrefixList [i];
if (NStr::StartsWith (m_MainTitle, str, NStr::eNocase)) {
m_MainTitle.erase (0, str.length());
if ( cddOK ) {
sel.IncludeNamedAnnotAccession("CDD");
} else {
- sel.ExcludeNamedAnnotAccession("CDD");
+ sel.ExcludeNamedAnnotAccession("CDD"); // This does not actually help to stop loading CDDs.
+ sel.ExcludeNamedAnnots("CDD"); // This prevents annot-iterator from loading CDDs.
}
CWeakRef<CSeqMasterIndex> idx = GetSeqMasterIndex();
static int SkipMixedContent ( const char* ptr )
{
- for (int i = 0; i < sizeof (mixedTags); i++) {
+ for (size_t i = 0; i < sizeof (mixedTags); i++) {
const char* tag = mixedTags[i];
const char* tmp = ptr;
int len = 0;
}
// convert non-alphanumeric punctuation to space
- for (int i = 0; i < str.length(); i++) {
+ for (size_t i = 0; i < str.length(); i++) {
char ch = str[i];
if (ch >= 'A' && ch <= 'Z') {
} else if (ch >= 'a' && ch <= 'z') {
-# $Id: CMakeLists.txt 621735 2020-12-16 15:47:41Z ivanov $
+# $Id: CMakeLists.txt 680762 2024-03-27 13:50:01Z ivanov $
NCBI_add_subdirectory(
unit_test_util readers blast lds2 data_loaders simple
- alnmgr cddalignview test manip cleanup format edit validator
+ alnmgr cddalignview test manip cleanup format edit
+ huge_asn validator
asniotest align seqmasks_io eutils
align_format snputil uudutil variation writers pubseq_gateway
logging import flatfile
-# $Id: Makefile.in 623638 2021-01-14 22:08:07Z foleyjp $
+# $Id: Makefile.in 680762 2024-03-27 13:50:01Z ivanov $
# Meta-makefile("objtools" project)
#################################
SUB_PROJ = logging unit_test_util readers blast lds2 pubseq_gateway \
data_loaders simple \
- alnmgr cddalignview test manip eutils edit cleanup format validator \
+ alnmgr cddalignview test manip eutils edit cleanup format \
+ huge_asn validator \
asniotest align seqmasks_io \
align_format snputil uudutil variation writers \
import flatfile
-/* $Id: align_format_util.cpp 672590 2023-09-11 18:10:05Z ivanov $
+/* $Id: align_format_util.cpp 683948 2024-06-10 12:11:11Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
#include <objects/seqloc/Seq_loc.hpp>
#include <objects/seq/Seq_inst.hpp>
#include <objects/seq/Seq_descr.hpp>
-#include <objects/seq/Seqdesc.hpp>
+#include <objects/seq/Seqdesc.hpp>
#include <objmgr/seqdesc_ci.hpp>
#include <objects/blastdb/defline_extra.hpp>
#include <objects/general/User_object.hpp>
unique_ptr<CNcbiRegistry> CAlignFormatUtil::m_Reg;
string CAlignFormatUtil::m_Protocol = "";
bool CAlignFormatUtil::m_geturl_debug_flag = false;
-unique_ptr<CGeneInfoFileReader> CAlignFormatUtil::m_GeneInfoReader;
+
///Get blast score information
///@param scoreList: score container to extract score info from
///@param score: place to extract the raw score to
///@return true if found score, false otherwise
///
template<class container> bool
-s_GetBlastScore(const container& scoreList,
- int& score,
- double& bits,
- double& evalue,
- int& sum_n,
+s_GetBlastScore(const container& scoreList,
+ int& score,
+ double& bits,
+ double& evalue,
+ int& sum_n,
int& num_ident,
list<TGi>& use_this_gi,
int& comp_adj_method)
const string k_GiPrefix = "gi:";
bool hasScore = false;
ITERATE (typename container, iter, scoreList) {
- const CObject_id& id=(*iter)->GetId();
+ const CObject_id& id=(*iter)->GetId();
if (id.IsStr()) {
if (id.GetStr()=="score"){
score = (*iter)->GetValue().GetInt();
Uint4 gi_v = (Uint4)((*iter)->GetValue().GetInt());
use_this_gi.push_back(GI_FROM(Uint4, gi_v));
} else if (id.GetStr()=="sum_n"){
- sum_n = (*iter)->GetValue().GetInt();
+ sum_n = (*iter)->GetValue().GetInt();
} else if (id.GetStr()=="num_ident"){
num_ident = (*iter)->GetValue().GetInt();
} else if (id.GetStr()=="comp_adjustment_method") {
comp_adj_method = (*iter)->GetValue().GetInt();
- }
+ }
else if(NStr::StartsWith(id.GetStr(),k_GiPrefix)) { //will be used when switch to 64bit GIs
string strGi = NStr::Replace(id.GetStr(),k_GiPrefix,"");
TGi gi = NStr::StringToNumeric<TGi>(strGi);
use_this_gi.push_back(gi);
}
- }
+ }
}
return hasScore;
///@param line_len: length of each line desired
///@param out: stream to ouput
///
-void CAlignFormatUtil::x_WrapOutputLine(string str, size_t line_len,
- CNcbiOstream& out, bool html)
+void CAlignFormatUtil::x_WrapOutputLine(string str, size_t line_len,
+ CNcbiOstream& out, bool html)
{
list<string> string_l;
NStr::TWrapFlags flags = NStr::fWrap_FlatFile;
iter++;
}
}
-
-void CAlignFormatUtil::BlastPrintError(list<SBlastError>&
- error_return,
+
+void CAlignFormatUtil::BlastPrintError(list<SBlastError>&
+ error_return,
bool error_post, CNcbiOstream& out)
{
-
+
string errsevmsg[] = { "UNKNOWN","INFO","WARNING","ERROR",
"FATAL"};
-
+
NON_CONST_ITERATE(list<SBlastError>, iter, error_return) {
-
+
if(iter->level > 5){
iter->level = eDiag_Info;
}
-
+
if(iter->level == 4){
iter->level = eDiag_Fatal;
} else{
ERR_POST_EX(iter->level, 0, iter->message);
}
out << errsevmsg[iter->level] << ": " << iter->message << "\n";
-
+
}
}
void CAlignFormatUtil::PrintTildeSepLines(string str, size_t line_len,
CNcbiOstream& out) {
-
+
vector<string> split_line;
NStr::Split(str, "~", split_line);
ITERATE(vector<string>, iter, split_line) {
/// @param info structure to fill [in|out]
/// @return true if successfully filled, false otherwise (and a warning is
/// printed out)
-static bool s_FillDbInfoRemotely(const string& dbname,
+static bool s_FillDbInfoRemotely(const string& dbname,
CAlignFormatUtil::SDbInfo& info)
{
static CBlastServices rmt_blast_services;
blastdb->SetName(dbname);
blastdb->SetType() = info.is_protein
? eBlast4_residue_type_protein : eBlast4_residue_type_nucleotide;
- CRef<CBlast4_database_info> dbinfo =
+ CRef<CBlast4_database_info> dbinfo =
rmt_blast_services.GetDatabaseInfo(blastdb);
info.name = dbname;
/// printed out)
static bool
s_FillDbInfoLocally(const string& dbname,
- CAlignFormatUtil::SDbInfo& info,
+ CAlignFormatUtil::SDbInfo& info,
int dbfilt_algorithm)
{
- CRef<CSeqDB> seqdb(new CSeqDB(dbname, info.is_protein
+ CRef<CSeqDB> seqdb(new CSeqDB(dbname, info.is_protein
? CSeqDB::eProtein : CSeqDB::eNucleotide));
if ( !seqdb ) {
return false;
(!defined(NCBI_COMPILER_MIPSPRO)) )
string filtering_algorithm;
seqdb->GetMaskAlgorithmDetails(dbfilt_algorithm,
- filtering_algorithm,
- info.filt_algorithm_name,
+ filtering_algorithm,
+ info.filt_algorithm_name,
info.filt_algorithm_options);
#endif
return true;
}
-void
+void
CAlignFormatUtil::FillScanModeBlastDbInfo(vector<CAlignFormatUtil::SDbInfo>& retval,
bool is_protein, int numSeqs, Int8 numLetters, string& tag)
{
info.definition = string("User specified sequence set.");
else
{
- info.definition = string("User specified sequence set ") +
+ info.definition = string("User specified sequence set ") +
string("(Input: ") + tag + string(").");
}
info.number_seqs = numSeqs;
for(size_t ndx=0 ; ndx < all_db_info.size(); ndx++){
CAlignFormatUtil::SDbInfo info;
objects::CBlast4_database_info &dbinfo = *all_db_info[ndx];
- info.name = dbinfo.GetDatabase().GetName();
+ info.name = dbinfo.GetDatabase().GetName();
info.definition = dbinfo.GetDescription();
if (info.definition.empty())
info.definition = info.name;
}
retval.push_back(info);
}
- return;
+ return;
}
else{
vector<CTempString> dbs;
}
void CAlignFormatUtil::PrintDbReport(const vector<SDbInfo>& dbinfo_list,
- size_t line_length,
+ size_t line_length,
CNcbiOstream& out,
- bool top)
+ bool top)
{
if (top) {
const CAlignFormatUtil::SDbInfo* dbinfo = &(dbinfo_list.front());
out << endl;
}
CAlignFormatUtil::AddSpace(out, 11);
- out << NStr::Int8ToString(tot_num_seqs, NStr::fWithCommas) <<
+ out << NStr::Int8ToString(tot_num_seqs, NStr::fWithCommas) <<
" sequences; " <<
- NStr::Int8ToString(tot_length, NStr::fWithCommas) <<
+ NStr::Int8ToString(tot_length, NStr::fWithCommas) <<
" total letters\n\n";
return;
}
out << " Posted date: ";
out << dbinfo->date << "\n";
-
- out << " Number of letters in database: ";
- out << NStr::Int8ToString(dbinfo->total_length,
+
+ out << " Number of letters in database: ";
+ out << NStr::Int8ToString(dbinfo->total_length,
NStr::fWithCommas) << "\n";
out << " Number of sequences in database: ";
- out << NStr::IntToString(dbinfo->number_seqs,
+ out << NStr::IntToString(dbinfo->number_seqs,
NStr::fWithCommas) << "\n";
-
+
} else {
out << " Subset of the database(s) listed below" << "\n";
- out << " Number of letters searched: ";
- out << NStr::Int8ToString(dbinfo->total_length,
+ out << " Number of letters searched: ";
+ out << NStr::Int8ToString(dbinfo->total_length,
NStr::fWithCommas) << "\n";
out << " Number of sequences searched: ";
- out << NStr::IntToString(dbinfo->number_seqs,
+ out << NStr::IntToString(dbinfo->number_seqs,
NStr::fWithCommas) << "\n";
}
out << "\n";
}
-void CAlignFormatUtil::PrintKAParameters(double lambda, double k, double h,
- size_t line_len,
- CNcbiOstream& out, bool gapped,
+void CAlignFormatUtil::PrintKAParameters(double lambda, double k, double h,
+ size_t line_len,
+ CNcbiOstream& out, bool gapped,
const Blast_GumbelBlk *gbp)
{
char buffer[256];
- if (gapped) {
+ if (gapped) {
out << "Gapped" << "\n";
}
out << "Lambda K H";
return all_descr_str;
}
-void CAlignFormatUtil::AcknowledgeBlastQuery(const CBioseq& cbs,
+void CAlignFormatUtil::AcknowledgeBlastQuery(const CBioseq& cbs,
size_t line_len,
CNcbiOstream& out,
bool believe_query,
- bool html,
+ bool html,
bool tabular /* = false */,
const string& rid /* = kEmptyStr*/)
{
label, tabular, rid);
}
-void
-CAlignFormatUtil::AcknowledgeBlastSubject(const CBioseq& cbs,
+void
+CAlignFormatUtil::AcknowledgeBlastSubject(const CBioseq& cbs,
size_t line_len,
CNcbiOstream& out,
bool believe_query,
- bool html,
+ bool html,
bool tabular /* = false */)
{
const string label("Subject");
label, tabular, kEmptyStr);
}
-void
-CAlignFormatUtil::x_AcknowledgeBlastSequence(const CBioseq& cbs,
+void
+CAlignFormatUtil::x_AcknowledgeBlastSequence(const CBioseq& cbs,
size_t line_len,
CNcbiOstream& out,
bool believe_query,
- bool html,
+ bool html,
const string& label,
bool tabular /* = false */,
const string& rid /* = kEmptyStr*/)
} else {
out << label << "= ";
}
-
+
string all_id_str = GetSeqIdString(cbs, believe_query);
all_id_str += " ";
all_id_str = NStr::TruncateSpaces(all_id_str + GetSeqDescrString(cbs));
out << "pattern probability=" << prob << "\n";
}
-
+
void CAlignFormatUtil::GetAlnScores(const CSeq_align& aln,
- int& score,
- double& bits,
+ int& score,
+ double& bits,
double& evalue,
int& sum_n,
int& num_ident,
{
int comp_adj_method = 0; // dummy variable
- CAlignFormatUtil::GetAlnScores(aln, score, bits, evalue, sum_n,
+ CAlignFormatUtil::GetAlnScores(aln, score, bits, evalue, sum_n,
num_ident, use_this_gi, comp_adj_method);
}
void CAlignFormatUtil::GetAlnScores(const CSeq_align& aln,
- int& score,
- double& bits,
+ int& score,
+ double& bits,
double& evalue,
int& sum_n,
int& num_ident,
{
int comp_adj_method = 0; // dummy variable
- CAlignFormatUtil::GetAlnScores(aln, score, bits, evalue, sum_n,
+ CAlignFormatUtil::GetAlnScores(aln, score, bits, evalue, sum_n,
num_ident, use_this_seq, comp_adj_method);
}
void CAlignFormatUtil::GetAlnScores(const CSeq_align& aln,
- int& score,
- double& bits,
+ int& score,
+ double& bits,
double& evalue,
int& sum_n,
int& num_ident,
sum_n = -1;
num_ident = -1;
comp_adj_method = 0;
-
+
//look for scores at seqalign level first
- hasScore = s_GetBlastScore(aln.GetScore(), score, bits, evalue,
+ hasScore = s_GetBlastScore(aln.GetScore(), score, bits, evalue,
sum_n, num_ident, use_this_gi, comp_adj_method);
-
+
//look at the seg level
if(!hasScore){
const CSeq_align::TSegs& seg = aln.GetSegs();
if(seg.Which() == CSeq_align::C_Segs::e_Std){
- s_GetBlastScore(seg.GetStd().front()->GetScores(),
+ s_GetBlastScore(seg.GetStd().front()->GetScores(),
score, bits, evalue, sum_n, num_ident, use_this_gi, comp_adj_method);
} else if (seg.Which() == CSeq_align::C_Segs::e_Dendiag){
- s_GetBlastScore(seg.GetDendiag().front()->GetScores(),
+ s_GetBlastScore(seg.GetDendiag().front()->GetScores(),
score, bits, evalue, sum_n, num_ident, use_this_gi, comp_adj_method);
} else if (seg.Which() == CSeq_align::C_Segs::e_Denseg){
- s_GetBlastScore(seg.GetDenseg().GetScores(),
+ s_GetBlastScore(seg.GetDenseg().GetScores(),
score, bits, evalue, sum_n, num_ident, use_this_gi, comp_adj_method);
}
- }
+ }
if(use_this_gi.size() == 0) {
GetUseThisSequence(aln,use_this_gi);
}
{
const string k_GiPrefix = "gi:";
list<string> use_this_seq;
- ITERATE(list<TGi>, iter_gi, use_this_gi){
+ ITERATE(list<TGi>, iter_gi, use_this_gi){
string strSeq = k_GiPrefix + NStr::NumericToString(*iter_gi);
- use_this_seq.push_back(strSeq);
- }
+ use_this_seq.push_back(strSeq);
+ }
return use_this_seq;
}
void CAlignFormatUtil::GetAlnScores(const CSeq_align& aln,
- int& score,
- double& bits,
+ int& score,
+ double& bits,
double& evalue,
int& sum_n,
int& num_ident,
list<TGi> use_this_gi;
//look for scores at seqalign level first
- hasScore = s_GetBlastScore(aln.GetScore(), score, bits, evalue,
+ hasScore = s_GetBlastScore(aln.GetScore(), score, bits, evalue,
sum_n, num_ident, use_this_gi, comp_adj_method);
-
+
//look at the seg level
if(!hasScore){
const CSeq_align::TSegs& seg = aln.GetSegs();
if(seg.Which() == CSeq_align::C_Segs::e_Std){
- s_GetBlastScore(seg.GetStd().front()->GetScores(),
+ s_GetBlastScore(seg.GetStd().front()->GetScores(),
score, bits, evalue, sum_n, num_ident, use_this_gi, comp_adj_method);
} else if (seg.Which() == CSeq_align::C_Segs::e_Dendiag){
- s_GetBlastScore(seg.GetDendiag().front()->GetScores(),
+ s_GetBlastScore(seg.GetDendiag().front()->GetScores(),
score, bits, evalue, sum_n, num_ident, use_this_gi, comp_adj_method);
} else if (seg.Which() == CSeq_align::C_Segs::e_Denseg){
- s_GetBlastScore(seg.GetDenseg().GetScores(),
+ s_GetBlastScore(seg.GetDenseg().GetScores(),
score, bits, evalue, sum_n, num_ident, use_this_gi, comp_adj_method);
}
- }
+ }
if(use_this_gi.size() == 0) {
GetUseThisSequence(aln,use_this_seq);
}
if (id->Which() == CSeq_id::e_General){
const CDbtag& dtg = id->GetGeneral();
retval = CAlignFormatUtil::GetGnlID(dtg);
- }
+ }
if (retval == "")
retval = id->GetSeqIdString(with_version);
return retval;
}
-void CAlignFormatUtil::AddSpace(CNcbiOstream& out, int number)
+void CAlignFormatUtil::AddSpace(CNcbiOstream& out, size_t number)
{
- for(int i=0; i<number; i++){
+ for(auto i=0; i<number; i++){
out<<" ";
}
-
}
-void CAlignFormatUtil::GetScoreString(double evalue,
- double bit_score,
- double total_bit_score,
+void CAlignFormatUtil::GetScoreString(double evalue,
+ double bit_score,
+ double total_bit_score,
int raw_score,
- string& evalue_str,
+ string& evalue_str,
string& bit_score_str,
string& total_bit_score_str,
string& raw_score_str)
value_set = true;
}
#endif /* CTOOLKIT_COMPATIBLE */
-
+
if (evalue < 1.0e-180) {
snprintf(evalue_buf, sizeof(evalue_buf), "0.0");
} else if (evalue < 1.0e-99) {
- snprintf(evalue_buf, sizeof(evalue_buf), "%2.0le", evalue);
+ snprintf(evalue_buf, sizeof(evalue_buf), "%2.0le", evalue);
#ifdef CTOOLKIT_COMPATIBLE
if (ctoolkit_compatible) {
strncpy(evalue_buf, evalue_buf+1, sizeof(evalue_buf-1));
snprintf(evalue_buf, sizeof(evalue_buf), "%3.0le", evalue);
} else if (evalue < 0.1) {
snprintf(evalue_buf, sizeof(evalue_buf), "%4.3lf", evalue);
- } else if (evalue < 1.0) {
+ } else if (evalue < 1.0) {
snprintf(evalue_buf, sizeof(evalue_buf), "%3.2lf", evalue);
} else if (evalue < 10.0) {
snprintf(evalue_buf, sizeof(evalue_buf), "%2.1lf", evalue);
- } else {
+ } else {
snprintf(evalue_buf, sizeof(evalue_buf), "%2.0lf", evalue);
}
-
+
if (bit_score > 99999){
snprintf(bit_score_buf, sizeof(bit_score_buf), "%5.3le", bit_score);
} else if (bit_score > 99.9){
bit_score);
}
if (total_bit_score > 99999){
- snprintf(total_bit_score_buf, sizeof(total_bit_score_buf), "%5.3le",
+ snprintf(total_bit_score_buf, sizeof(total_bit_score_buf), "%5.3le",
total_bit_score);
} else if (total_bit_score > 99.9){
snprintf(total_bit_score_buf, sizeof(total_bit_score_buf), "%3.0ld",
}
-void CAlignFormatUtil::PruneSeqalign(const CSeq_align_set& source_aln,
+void CAlignFormatUtil::PruneSeqalign(const CSeq_align_set& source_aln,
CSeq_align_set& new_aln,
unsigned int number)
{
- CConstRef<CSeq_id> previous_id, subid;
+ CConstRef<CSeq_id> previous_id, subid;
bool is_first_aln = true;
- unsigned int num_align = 0;
- ITERATE(CSeq_align_set::Tdata, iter, source_aln.Get()){
+ unsigned int num_align = 0;
+ ITERATE(CSeq_align_set::Tdata, iter, source_aln.Get()){
if ((*iter)->GetSegs().IsDisc()) {
++num_align;
is_first_aln = false;
previous_id = subid;
}
- new_aln.Set().push_back(*iter);
+ new_aln.Set().push_back(*iter);
}
}
-unsigned int CAlignFormatUtil::GetSubjectsNumber(const CSeq_align_set& source_aln,
+unsigned int CAlignFormatUtil::GetSubjectsNumber(const CSeq_align_set& source_aln,
unsigned int number)
{
- CConstRef<CSeq_id> previous_id, subid;
+ CConstRef<CSeq_id> previous_id, subid;
bool is_first_aln = true;
- unsigned int num_align = 0;
- ITERATE(CSeq_align_set::Tdata, iter, source_aln.Get()){
+ unsigned int num_align = 0;
+ ITERATE(CSeq_align_set::Tdata, iter, source_aln.Get()){
if ((*iter)->GetSegs().IsDisc()) {
++num_align;
is_first_aln = false;
previous_id = subid;
- }
+ }
}
return num_align;
}
-void CAlignFormatUtil::PruneSeqalignAll(const CSeq_align_set& source_aln,
+void CAlignFormatUtil::PruneSeqalignAll(const CSeq_align_set& source_aln,
CSeq_align_set& new_aln,
unsigned int number)
{
- CConstRef<CSeq_id> previous_id, subid;
+ CConstRef<CSeq_id> previous_id, subid;
bool is_first_aln = true;
unsigned int num_align = 0;
bool finishCurrent = false;
- ITERATE(CSeq_align_set::Tdata, iter, source_aln.Get()){
+ ITERATE(CSeq_align_set::Tdata, iter, source_aln.Get()){
if ((*iter)->GetSegs().IsDisc()) {
++num_align;
} else {
}
-void
-CAlignFormatUtil::GetAlignLengths(CAlnVec& salv, int& align_length,
+void
+CAlignFormatUtil::GetAlignLengths(CAlnVec& salv, int& align_length,
int& num_gaps, int& num_gap_opens)
{
num_gaps = num_gap_opens = align_length = 0;
}
}
-void
+void
CAlignFormatUtil::ExtractSeqalignSetFromDiscSegs(CSeq_align_set& target,
const CSeq_align_set& source)
{
if (source.IsSet() && source.CanGet()) {
-
+
for(CSeq_align_set::Tdata::const_iterator iter = source.Get().begin();
iter != source.Get().end(); iter++) {
if((*iter)->IsSetSegs()){
if(seg.IsDisc()){
const CSeq_align_set& set = seg.GetDisc();
for(CSeq_align_set::Tdata::const_iterator iter2 =
- set.Get().begin(); iter2 != set.Get().end();
+ set.Get().begin(); iter2 != set.Get().end();
iter2 ++) {
target.Set().push_back(*iter2);
}
}
}
-CRef<CSeq_align>
-CAlignFormatUtil::CreateDensegFromDendiag(const CSeq_align& aln)
+CRef<CSeq_align>
+CAlignFormatUtil::CreateDensegFromDendiag(const CSeq_align& aln)
{
CRef<CSeq_align> sa(new CSeq_align);
if ( !aln.GetSegs().IsDendiag()) {
NCBI_THROW(CException, eUnknown, "Input Seq-align should be Dendiag!");
}
-
+
if(aln.IsSetType()){
sa->SetType(aln.GetType());
}
if(aln.IsSetBounds()){
sa->SetBounds() = aln.GetBounds();
}
-
+
CDense_seg& ds = sa->SetSegs().SetDenseg();
-
+
int counter = 0;
ds.SetNumseg() = 0;
ITERATE (CSeq_align::C_Segs::TDendiag, iter, aln.GetSegs().GetDendiag()){
-
+
if(counter == 0){//assume all dendiag segments have same dim and ids
if((*iter)->IsSetDim()){
ds.SetDim((*iter)->GetDim());
}
counter ++;
}
-
+
return sa;
}
TTaxId taxid = ZERO_TAX_ID;
try{
const CBioseq_Handle& handle = scope.GetBioseqHandle(id);
- const CRef<CBlast_def_line_set> bdlRef =
+ const CRef<CBlast_def_line_set> bdlRef =
CSeqDB::ExtractBlastDefline(handle);
const list< CRef< CBlast_def_line > > &bdl = (bdlRef.Empty()) ? list< CRef< CBlast_def_line > >() : bdlRef->Get();
ITERATE(list<CRef<CBlast_def_line> >, iter_bdl, bdl) {
- CConstRef<CSeq_id> bdl_id =
+ CConstRef<CSeq_id> bdl_id =
GetSeq_idByType((*iter_bdl)->GetSeqid(), id.Which());
- if(bdl_id && bdl_id->Match(id) &&
+ if(bdl_id && bdl_id->Match(id) &&
(*iter_bdl)->IsSetTaxid() && (*iter_bdl)->CanGetTaxid()){
taxid = (*iter_bdl)->GetTaxid();
break;
}
}
} catch (CException&) {
-
+
}
return taxid;
}
-int CAlignFormatUtil::GetFrame (int start, ENa_strand strand,
- const CBioseq_Handle& handle)
+int CAlignFormatUtil::GetFrame (int start, ENa_strand strand,
+ const CBioseq_Handle& handle)
{
int frame = 0;
if (strand == eNa_strand_plus) {
} else if (strand == eNa_strand_minus) {
frame = -(((int)handle.GetBioseqLength() - start - 1)
% 3 + 1);
-
+
}
return frame;
}
bool CAlignFormatUtil::
SortHspByPercentIdentityDescending(const CRef<CSeq_align>& info1,
- const CRef<CSeq_align>& info2)
+ const CRef<CSeq_align>& info2)
{
-
+
int score1, sum_n1, num_ident1;
double bits1, evalue1;
list<TGi> use_this_gi1;
-
+
int score2, sum_n2, num_ident2;
double bits2, evalue2;
list<TGi> use_this_gi2;
-
-
+
+
GetAlnScores(*info1, score1, bits1, evalue1, sum_n1, num_ident1, use_this_gi1);
GetAlnScores(*info2, score2, bits2, evalue2, sum_n2, num_ident2, use_this_gi2);
int length1 = GetAlignmentLength(*info1, kTranslation);
int length2 = GetAlignmentLength(*info2, kTranslation);
bool retval = false;
-
-
+
+
if(length1 > 0 && length2 > 0 && num_ident1 > 0 &&num_ident2 > 0 ) {
if (((double)num_ident1)/length1 == ((double)num_ident2)/length2) {
-
+
retval = evalue1 < evalue2;
-
+
} else {
retval = ((double)num_ident1)/length1 >= ((double)num_ident2)/length2;
-
+
}
} else {
retval = evalue1 < evalue2;
bool CAlignFormatUtil::
SortHitByScoreDescending(const CRef<CSeq_align_set>& info1,
- const CRef<CSeq_align_set>& info2)
+ const CRef<CSeq_align_set>& info2)
{
CRef<CSeq_align_set> i1(info1), i2(info2);
-
+
i1->Set().sort(SortHspByScoreDescending);
i2->Set().sort(SortHspByScoreDescending);
-
-
+
+
int score1, sum_n1, num_ident1;
double bits1, evalue1;
list<TGi> use_this_gi1;
-
+
int score2, sum_n2, num_ident2;
double bits2, evalue2;
list<TGi> use_this_gi2;
-
+
GetAlnScores(*(info1->Get().front()), score1, bits1, evalue1, sum_n1, num_ident1, use_this_gi1);
GetAlnScores(*(info2->Get().front()), score2, bits2, evalue2, sum_n2, num_ident2, use_this_gi2);
return bits1 > bits2;
bool CAlignFormatUtil::
SortHitByMasterCoverageDescending(CRef<CSeq_align_set> const& info1,
- CRef<CSeq_align_set> const& info2)
+ CRef<CSeq_align_set> const& info2)
{
int cov1 = GetMasterCoverage(*info1);
int cov2 = GetMasterCoverage(*info2);
int score1, sum_n1, num_ident1;
double bits1, evalue1;
list<TGi> use_this_gi1;
-
+
int score2, sum_n2, num_ident2;
double bits2, evalue2;
list<TGi> use_this_gi2;
CRef<CSeq_align_set>& info2)
{
int start1 = 0, start2 = 0;
-
-
+
+
info1->Set().sort(SortHspByMasterStartAscending);
info2->Set().sort(SortHspByMasterStartAscending);
-
-
+
+
start1 = min(info1->Get().front()->GetSeqStart(0),
info1->Get().front()->GetSeqStop(0));
start2 = min(info2->Get().front()->GetSeqStart(0),
info2->Get().front()->GetSeqStop(0));
-
+
if (start1 == start2) {
//same start then arrange by bits score
int score1, sum_n1, num_ident1;
double bits1, evalue1;
list<TGi> use_this_gi1;
-
+
int score2, sum_n2, num_ident2;
double bits2, evalue2;
list<TGi> use_this_gi2;
-
-
+
+
GetAlnScores(*(info1->Get().front()), score1, bits1, evalue1, sum_n1, num_ident1, use_this_gi1);
GetAlnScores(*(info1->Get().front()), score2, bits2, evalue2, sum_n2, num_ident2, use_this_gi2);
return evalue1 < evalue2;
-
+
} else {
- return start1 < start2;
+ return start1 < start2;
}
}
SortHspByScoreDescending(const CRef<CSeq_align>& info1,
const CRef<CSeq_align>& info2)
{
-
+
int score1, sum_n1, num_ident1;
double bits1, evalue1;
list<TGi> use_this_gi1;
-
+
int score2, sum_n2, num_ident2;
double bits2, evalue2;
list<TGi> use_this_gi2;
-
-
+
+
GetAlnScores(*info1, score1, bits1, evalue1, sum_n1, num_ident1, use_this_gi1);
GetAlnScores(*info2, score2, bits2, evalue2, sum_n2, num_ident2, use_this_gi2);
return bits1 > bits2;
-
-}
+
+}
bool CAlignFormatUtil::
SortHspByMasterStartAscending(const CRef<CSeq_align>& info1,
- const CRef<CSeq_align>& info2)
+ const CRef<CSeq_align>& info2)
{
int start1 = 0, start2 = 0;
-
+
start1 = min(info1->GetSeqStart(0), info1->GetSeqStop(0));
start2 = min(info2->GetSeqStart(0), info2->GetSeqStop(0)) ;
-
+
if (start1 == start2) {
//same start then arrange by bits score
int score1, sum_n1, num_ident1;
double bits1, evalue1;
list<TGi> use_this_gi1;
-
+
int score2, sum_n2, num_ident2;
double bits2, evalue2;
list<TGi> use_this_gi2;
-
-
+
+
GetAlnScores(*info1, score1, bits1, evalue1, sum_n1, num_ident1, use_this_gi1);
GetAlnScores(*info2, score2, bits2, evalue2, sum_n2, num_ident2, use_this_gi2);
return evalue1 < evalue2;
-
+
} else {
-
- return start1 < start2;
- }
+
+ return start1 < start2;
+ }
}
bool CAlignFormatUtil::
SortHspBySubjectStartAscending(const CRef<CSeq_align>& info1,
- const CRef<CSeq_align>& info2)
+ const CRef<CSeq_align>& info2)
{
int start1 = 0, start2 = 0;
-
+
start1 = min(info1->GetSeqStart(1), info1->GetSeqStop(1));
start2 = min(info2->GetSeqStart(1), info2->GetSeqStop(1)) ;
-
+
if (start1 == start2) {
//same start then arrange by bits score
int score1, sum_n1, num_ident1;
double bits1, evalue1;
list<TGi> use_this_gi1;
-
+
int score2, sum_n2, num_ident2;
double bits2, evalue2;
list<TGi> use_this_gi2;
-
-
+
+
GetAlnScores(*info1, score1, bits1, evalue1, sum_n1, num_ident1, use_this_gi1);
GetAlnScores(*info2, score2, bits2, evalue2, sum_n2, num_ident2, use_this_gi2);
return evalue1 < evalue2;
-
+
} else {
-
- return start1 < start2;
- }
+
+ return start1 < start2;
+ }
}
int CAlignFormatUtil::GetAlignmentLength(const CSeq_align& aln, bool do_translation)
{
-
+
CRef<CSeq_align> final_aln;
-
+
// Convert Std-seg and Dense-diag alignments to Dense-seg.
- // Std-segs are produced only for translated searches; Dense-diags only for
+ // Std-segs are produced only for translated searches; Dense-diags only for
// ungapped, not translated searches.
if (aln.GetSegs().IsStd()) {
final_aln = denseg_aln->CreateTranslatedDensegFromNADenseg();
} else {
final_aln = denseg_aln;
-
+
}
} else if (aln.GetSegs().IsDendiag()) {
final_aln = CreateDensegFromDendiag(aln);
- }
+ }
const CDense_seg& ds = (final_aln ? final_aln->GetSegs().GetDenseg() :
aln.GetSegs().GetDenseg());
-
+
CAlnMap alnmap(ds);
return alnmap.GetAlnStop() + 1;
}
bool do_translation) {
double identity = 0;
CRef<CSeq_align> final_aln;
-
+
// Convert Std-seg and Dense-diag alignments to Dense-seg.
- // Std-segs are produced only for translated searches; Dense-diags only for
+ // Std-segs are produced only for translated searches; Dense-diags only for
// ungapped, not translated searches.
if (aln.GetSegs().IsStd()) {
final_aln = denseg_aln->CreateTranslatedDensegFromNADenseg();
} else {
final_aln = denseg_aln;
-
+
}
} else if (aln.GetSegs().IsDendiag()) {
final_aln = CreateDensegFromDendiag(aln);
- }
+ }
const CDense_seg& ds = (final_aln ? final_aln->GetSegs().GetDenseg() :
aln.GetSegs().GetDenseg());
-
+
CAlnVec alnvec(ds, scope);
string query, subject;
alnvec.GetWholeAlnSeqString(1, subject);
int num_ident = 0;
- int length = min(query.size(), subject.size());
+ int length = (int)min(query.size(), subject.size());
for (int i = 0; i < length; ++i) {
if (query[i] == subject[i]) {
++num_ident;
}
}
-
+
if (length > 0) {
identity = ((double)num_ident)/length;
}
double &percentIdent1,
double &percentIdent2)
{
-
+
CRef<CSeq_align_set> i1(info1), i2(info2);
percentIdent1 = -1;
percentIdent2 = -1;
i1->Set().sort(CAlignFormatUtil::SortHspByPercentIdentityDescending);
i2->Set().sort(CAlignFormatUtil::SortHspByPercentIdentityDescending);
-
+
percentIdent1 = CAlignFormatUtil::GetSeqAlignSetCalcPercentIdent(*info1, kTranslation);
percentIdent2 = CAlignFormatUtil::GetSeqAlignSetCalcPercentIdent(*info2, kTranslation);
- return;
+ return;
}
SortHitByPercentIdentityDescendingEx(const CRef<CSeq_align_set>& info1,
const CRef<CSeq_align_set>& info2)
{
-
+
CRef<CSeq_align_set> i1(info1), i2(info2);
-
+
//i1->Set().sort(SortHspByPercentIdentityDescending);
//i2->Set().sort(SortHspByPercentIdentityDescending);
double evalue1 = seqSetInfo1->evalue;
double evalue2 = seqSetInfo2->evalue;
double percentIdent1 = seqSetInfo1->percent_identity;
- double percentIdent2 = seqSetInfo2->percent_identity;
-
+ double percentIdent2 = seqSetInfo2->percent_identity;
+
bool retval = false;
if(percentIdent1 < 0 || percentIdent2 < 0) {
s_CalcAlnPercentIdent(info1, info2,percentIdent1,percentIdent2);
}
if(percentIdent1 > 0 &&percentIdent2 > 0) {
- if (percentIdent1 == percentIdent2) {
+ if (percentIdent1 == percentIdent2) {
retval = evalue1 < evalue2;
-
+
} else {
- retval = percentIdent1 >= percentIdent2;
+ retval = percentIdent1 >= percentIdent2;
}
} else {
retval = evalue1 < evalue2;
- }
+ }
return retval;
}
double bits, evalue;
list<TGi> use_this_gi;
double total_bits1 = 0, total_bits2 = 0;
-
- ITERATE(CSeq_align_set::Tdata, iter, info1->Get()) {
+
+ ITERATE(CSeq_align_set::Tdata, iter, info1->Get()) {
CAlignFormatUtil::GetAlnScores(**iter, score1, bits, evalue,
sum_n, num_ident, use_this_gi);
total_bits1 += bits;
}
-
- ITERATE(CSeq_align_set::Tdata, iter, info2->Get()) {
+
+ ITERATE(CSeq_align_set::Tdata, iter, info2->Get()) {
CAlignFormatUtil::GetAlnScores(**iter, score2, bits, evalue,
sum_n, num_ident, use_this_gi);
total_bits2 += bits;
- }
-
-
+ }
+
+
return total_bits1 >= total_bits2;
-
+
}
#ifndef NCBI_COMPILER_WORKSHOP
-/** Class to sort by linkout bit
+/** Class to sort by linkout bit
* @note this code doesn't compile under the Solaris' WorkShop, and because
* this feature is only used inside NCBI (LinkoutDB), we disable this code.
*/
const string& mv_build_name)
: m_LinkoutDB(linkoutdb), m_MapViewerBuildName(mv_build_name) {}
- bool operator() (const CRef<CSeq_align_set>& info1, const CRef<CSeq_align_set>& info2)
+ bool operator() (const CRef<CSeq_align_set>& info1, const CRef<CSeq_align_set>& info2)
{
CConstRef<CSeq_id> id1, id2;
id1 = &(info1->Get().front()->GetSeq_id(1));
id2 = &(info2->Get().front()->GetSeq_id(1));
int linkout1 = 0, linkout2 = 0;
- linkout1 = m_LinkoutDB
- ? m_LinkoutDB->GetLinkout(*id1, m_MapViewerBuildName)
+ linkout1 = m_LinkoutDB
+ ? m_LinkoutDB->GetLinkout(*id1, m_MapViewerBuildName)
: 0;
- linkout2 = m_LinkoutDB
- ? m_LinkoutDB->GetLinkout(*id2, m_MapViewerBuildName)
+ linkout2 = m_LinkoutDB
+ ? m_LinkoutDB->GetLinkout(*id2, m_MapViewerBuildName)
: 0;
return (linkout1 & eGenomicSeq) <= (linkout2 & eGenomicSeq);
void CAlignFormatUtil::SortHit(list< CRef<CSeq_align_set> >& seqalign_hit_list,
bool do_translation, CScope& scope, int
sort_method, ILinkoutDB* linkoutdb,
- const string& mv_build_name)
+ const string& mv_build_name)
{
- kScope = &scope;
+ kScope = &scope;
kTranslation = do_translation;
-
+
if (sort_method == 1) {
#ifndef NCBI_COMPILER_WORKSHOP
seqalign_hit_list.sort(CSortHitByMolecularTypeEx(linkoutdb,
seqalign_hit_list.sort(SortHitByTotalScoreDescending);
} else if (sort_method == 3) {
seqalign_hit_list.sort(SortHitByPercentIdentityDescendingEx);
- }
+ }
}
void CAlignFormatUtil::
-SplitSeqalignByMolecularType(vector< CRef<CSeq_align_set> >&
+SplitSeqalignByMolecularType(vector< CRef<CSeq_align_set> >&
target,
int sort_method,
const CSeq_align_set& source,
CConstRef<CSeq_id> prevSubjectId;
int count = 0;
int linkoutPrev = 0;
- ITERATE(CSeq_align_set::Tdata, iter, source.Get()) {
-
- const CSeq_id& id = (*iter)->GetSeq_id(1);
+ ITERATE(CSeq_align_set::Tdata, iter, source.Get()) {
+
+ const CSeq_id& id = (*iter)->GetSeq_id(1);
try {
- const CBioseq_Handle& handle = scope.GetBioseqHandle(id);
+ const CBioseq_Handle& handle = scope.GetBioseqHandle(id);
if (handle) {
int linkout;
if(prevSubjectId.Empty() || !id.Match(*prevSubjectId)){
}
else {
linkout = linkoutPrev;
- }
+ }
if (linkout & eGenomicSeq) {
if (sort_method == 1) {
target[1]->Set().push_back(*iter);
} else {
target[0]->Set().push_back(*iter);
}
-
+
} catch (const CException&){
target[0]->Set().push_back(*iter); //no bioseq found, leave untouched
- }
- }
+ }
+ }
}
void CAlignFormatUtil::HspListToHitList(list< CRef<CSeq_align_set> >& target,
- const CSeq_align_set& source)
+ const CSeq_align_set& source)
{
CConstRef<CSeq_id> previous_id;
CRef<CSeq_align_set> temp;
- ITERATE(CSeq_align_set::Tdata, iter, source.Get()) {
+ ITERATE(CSeq_align_set::Tdata, iter, source.Get()) {
const CSeq_id& cur_id = (*iter)->GetSeq_id(1);
if(previous_id.Empty()) {
temp = new CSeq_align_set;
target.push_back(temp);
} else if (cur_id.Match(*previous_id)){
temp->Set().push_back(*iter);
-
+
} else {
temp = new CSeq_align_set;
temp->Set().push_back(*iter);
}
previous_id = &cur_id;
}
-
+
}
CRef<CSeq_align_set>
// list<CRef<CSeq_align_set> >::iterator iter;
for (list<CRef<CSeq_align_set> >::iterator iter = source.begin(); iter != source.end(); iter ++) {
- ITERATE(CSeq_align_set::Tdata, iter2, (*iter)->Get()) {
- align_set->Set().push_back(*iter2);
- }
+ ITERATE(CSeq_align_set::Tdata, iter2, (*iter)->Get()) {
+ align_set->Set().push_back(*iter2);
+ }
}
return align_set;
}
map < string, CRef<CSeq_align_set> > CAlignFormatUtil::HspListToHitMap(vector <string> seqIdList,
- const CSeq_align_set& source)
+ const CSeq_align_set& source)
{
CConstRef<CSeq_id> previous_id;
CRef<CSeq_align_set> temp;
map < string, CRef<CSeq_align_set> > hitsMap;
-
+
for(size_t i = 0; i < seqIdList.size();i++) {
- CRef<CSeq_align_set> new_aln(new CSeq_align_set);
+ CRef<CSeq_align_set> new_aln(new CSeq_align_set);
hitsMap.insert(map<string, CRef<CSeq_align_set> >::value_type(seqIdList[i],new_aln));
}
size_t count = 0;
- ITERATE(CSeq_align_set::Tdata, iter, source.Get()) {
+ ITERATE(CSeq_align_set::Tdata, iter, source.Get()) {
const CSeq_id& cur_id = (*iter)->GetSeq_id(1);
if(previous_id.Empty() || !cur_id.Match(*previous_id)) {
- if(count >= seqIdList.size()) {
+ if(count >= seqIdList.size()) {
break;
}
string idString = NStr::TruncateSpaces(cur_id.AsFastaString());
- if(hitsMap.find(idString) != hitsMap.end()) {
+ if(hitsMap.find(idString) != hitsMap.end()) {
temp = new CSeq_align_set;
temp->Set().push_back(*iter);
hitsMap[idString] = temp;
else {
temp.Reset();
}
- }
+ }
else if (cur_id.Match(*previous_id)){
if(!temp.Empty()) {
- temp->Set().push_back(*iter);
+ temp->Set().push_back(*iter);
}
- }
+ }
previous_id = &cur_id;
- }
- return hitsMap;
+ }
+ return hitsMap;
}
void CAlignFormatUtil::ExtractSeqAlignForSeqList(CRef<CSeq_align_set> &all_aln_set, string alignSeqList)
{
vector <string> seqIds;
- NStr::Split(alignSeqList,",",seqIds);
+ NStr::Split(alignSeqList,",",seqIds);
//SEQ_ALN_SET from ALIGNDB contains seq_aligns in random order
//The followimg will create a map that contains seq-aln_set per gi from ALIGN_SEQ_LIST
if(hitsMap.find(seqIds[i]) != hitsMap.end()) {
orderedSet.push_back(hitsMap[seqIds[i]]);
}
- }
+ }
//This should contain seq align set in the order of gis in the list
- all_aln_set = CAlignFormatUtil::HitListToHspList(orderedSet);
-}
+ all_aln_set = CAlignFormatUtil::HitListToHspList(orderedSet);
+}
static bool s_GetSRASeqMetadata(const CBioseq::TId& ids,string &strRun, string &strSpotId,string &strReadIndex)
{
strRun = vecInfo[0];
strSpotId = vecInfo[1];
- strReadIndex = vecInfo[2];
+ strReadIndex = vecInfo[2];
success = true;
}
}
string strRun, strSpotId,strReadIndex;
string link = NcbiEmptyString;
- if(s_GetSRASeqMetadata(ids,strRun,strSpotId,strReadIndex))
+ if(s_GetSRASeqMetadata(ids,strRun,strSpotId,strReadIndex))
{
// Generate the SRA link to the identified spot
link += user_url;
link += "?run=" + strRun;
link += "." + strSpotId;
- link += "." + strReadIndex;
+ link += "." + strReadIndex;
}
return link;
}
if(!id_general.Empty() && id_general->AsFastaString().find("gnl|BL_ORD_ID") != string::npos){
return gnl;
}
-
+
const CSeq_id* bestid = NULL;
if (id_general.Empty()){
bestid = id_other;
} else {
bestid = id_general;
}
-
+
if (bestid && bestid->Which() != CSeq_id::e_Gi){
gnl = NStr::URLEncode(bestid->AsFastaString());
}
string user_url, string database,
bool db_is_na, string rid, int query_number,
bool for_alignment) {
-
- string link = NcbiEmptyString;
+
+ string link = NcbiEmptyString;
CConstRef<CSeq_id> id_general = GetSeq_idByType(ids, CSeq_id::e_General);
-
- if(!id_general.Empty()
+
+ if(!id_general.Empty()
&& id_general->AsFastaString().find("gnl|BL_ORD_ID") != string::npos){
/* We do need to make security protected link to BLAST gnl */
return NcbiEmptyString;
}
- TGi gi = FindGi(ids);
+ TGi gi = FindGi(ids);
string bestID = s_GetBestIDForURL((CBioseq::TId &)ids);
-
+
bool nodb_path = false;
/* dumpgnl.cgi need to use path */
if (user_url.find("dumpgnl.cgi") ==string::npos){
nodb_path = true;
- }
+ }
int length = (int)database.size();
string str;
char *chptr, *dbtmp;
int i, j;
dbtmp = new char[sizeof(char)*length + 2]; /* aditional space and NULL */
memset(dbtmp, '\0', sizeof(char)*length + 2);
- for(i = 0; i < length; i++) {
+ for(i = 0; i < length; i++) {
if(i > 0) {
strcat(dbtmp, " "); //space between db
- }
+ }
if(isspace((unsigned char) dbname[i]) || dbname[i] == ',') {/* Rolling spaces */
continue;
}
j = 0;
- while (!isspace((unsigned char) dbname[i]) && j < 256 && i < length) {
+ while (!isspace((unsigned char) dbname[i]) && j < 256 && i < length) {
tmpbuff[j] = dbname[i];
j++; i++;
if(dbname[i] == ',') { /* Comma is valid delimiter */
}
}
tmpbuff[j] = '\0';
- if((chptr = strrchr(tmpbuff, '/')) != NULL) {
+ if((chptr = strrchr(tmpbuff, '/')) != NULL) {
strcat(dbtmp, (char*)(chptr+1));
} else {
strcat(dbtmp, tmpbuff);
}
-
+
}
} else {
dbtmp = dbname;
}
-
+
char gnl[256];
if (!bestID.empty()){
strcpy(gnl, bestID.c_str());
-
+
} else {
gnl[0] = '\0';
}
-
+
str = NStr::URLEncode(dbtmp == NULL ? (char*) "nr" : dbtmp);
if (user_url.find("?") == string::npos){
}
link += user_url + "db=" + str + "&na=" + (db_is_na? "1" : "0");
}
-
+
if (gnl[0] != '\0'){
str = gnl;
link += "&gnl=";
if (rid != NcbiEmptyString){
link += "&RID=" + rid;
}
-
+
if (query_number > 0){
link += "&QUERY_NUMBER=" + NStr::IntToString(query_number);
}
else
link += "&log$=nucltop";
}
-
+
if(nodb_path){
delete [] dbtmp;
}
return link;
}
void CAlignFormatUtil::
-BuildFormatQueryString (CCgiContext& ctx,
+BuildFormatQueryString (CCgiContext& ctx,
map< string, string>& parameters_to_change,
- string& cgi_query)
+ string& cgi_query)
{
-
+
//add parameters to exclude
parameters_to_change.insert(map<string, string>::
value_type("service", ""));
value_type("client", ""));
parameters_to_change.insert(map<string, string>::
value_type("composition_based_statistics", ""));
-
+
parameters_to_change.insert(map<string, string>::
value_type("auto_format", ""));
cgi_query = NcbiEmptyString;
for(TCgiEntriesI it=cgi_entry.begin(); it!=cgi_entry.end(); ++it) {
string parameter = it->first;
- if (parameter != NcbiEmptyString) {
+ if (parameter != NcbiEmptyString) {
if (parameters_to_change.count(NStr::ToLower(parameter)) > 0 ||
parameters_to_change.count(NStr::ToUpper(parameter)) > 0) {
if(parameters_to_change[NStr::ToLower(parameter)] !=
- NcbiEmptyString &&
+ NcbiEmptyString &&
parameters_to_change[NStr::ToUpper(parameter)] !=
NcbiEmptyString) {
if (!is_first) {
cgi_query += "&";
}
- cgi_query +=
+ cgi_query +=
it->first + "=" + parameters_to_change[it->first];
is_first = false;
}
cgi_query += it->first + "=" + it->second;
is_first = false;
}
-
- }
+
+ }
}
}
void CAlignFormatUtil::BuildFormatQueryString(CCgiContext& ctx, string& cgi_query) {
-
+
string format_type = ctx.GetRequestValue("FORMAT_TYPE").GetValue();
- string ridstr = ctx.GetRequestValue("RID").GetValue();
- string align_view = ctx.GetRequestValue("ALIGNMENT_VIEW").GetValue();
-
+ string ridstr = ctx.GetRequestValue("RID").GetValue();
+ string align_view = ctx.GetRequestValue("ALIGNMENT_VIEW").GetValue();
+
cgi_query += "RID=" + ridstr;
cgi_query += "&FORMAT_TYPE=" + format_type;
cgi_query += "&ALIGNMENT_VIEW=" + align_view;
cgi_query += "&FORMAT_OBJECT=" + ctx.GetRequestValue("FORMAT_OBJECT").GetValue();
cgi_query += "&RUN_PSIBLAST=" + ctx.GetRequestValue("RUN_PSIBLAST").GetValue();
cgi_query += "&I_THRESH=" + ctx.GetRequestValue("I_THRESH").GetValue();
-
+
cgi_query += "&DESCRIPTIONS=" + ctx.GetRequestValue("DESCRIPTIONS").GetValue();
-
+
cgi_query += "&ALIGNMENTS=" + ctx.GetRequestValue("ALIGNMENTS").GetValue();
-
+
cgi_query += "&NUM_OVERVIEW=" + ctx.GetRequestValue("NUM_OVERVIEW").GetValue();
-
+
cgi_query += "&NCBI_GI=" + ctx.GetRequestValue("NCBI_GI").GetValue();
-
+
cgi_query += "&SHOW_OVERVIEW=" + ctx.GetRequestValue("SHOW_OVERVIEW").GetValue();
-
+
cgi_query += "&SHOW_LINKOUT=" + ctx.GetRequestValue("SHOW_LINKOUT").GetValue();
-
+
cgi_query += "&GET_SEQUENCE=" + ctx.GetRequestValue("GET_SEQUENCE").GetValue();
-
+
cgi_query += "&MASK_CHAR=" + ctx.GetRequestValue("MASK_CHAR").GetValue();
cgi_query += "&MASK_COLOR=" + ctx.GetRequestValue("MASK_COLOR").GetValue();
-
+
cgi_query += "&SHOW_CDS_FEATURE=" + ctx.GetRequestValue("SHOW_CDS_FEATURE").GetValue();
if (ctx.GetRequestValue("FORMAT_EQ_TEXT").GetValue() != NcbiEmptyString) {
cgi_query += "&FORMAT_EQ_TEXT=" +
NStr::URLEncode(NStr::TruncateSpaces(ctx.
GetRequestValue("FORMAT_EQ_TEXT").
- GetValue()));
+ GetValue()));
}
if (ctx.GetRequestValue("FORMAT_EQ_OP").GetValue() != NcbiEmptyString) {
cgi_query += "&FORMAT_EQ_OP=" +
NStr::URLEncode(NStr::TruncateSpaces(ctx.
GetRequestValue("FORMAT_EQ_OP").
- GetValue()));
+ GetValue()));
}
if (ctx.GetRequestValue("FORMAT_EQ_MENU").GetValue() != NcbiEmptyString) {
cgi_query += "&FORMAT_EQ_MENU=" +
NStr::URLEncode(NStr::TruncateSpaces(ctx.
GetRequestValue("FORMAT_EQ_MENU").
- GetValue()));
+ GetValue()));
}
cgi_query += "&EXPECT_LOW=" + ctx.GetRequestValue("EXPECT_LOW").GetValue();
cgi_query += "&EXPECT_HIGH=" + ctx.GetRequestValue("EXPECT_HIGH").GetValue();
cgi_query += "&BL2SEQ_LINK=" + ctx.GetRequestValue("BL2SEQ_LINK").GetValue();
-
+
}
-bool CAlignFormatUtil::IsMixedDatabase(const CSeq_align_set& alnset,
+bool CAlignFormatUtil::IsMixedDatabase(const CSeq_align_set& alnset,
CScope& scope, ILinkoutDB* linkoutdb,
- const string& mv_build_name)
+ const string& mv_build_name)
{
bool is_mixed = false;
bool is_first = true;
int prev_database = 0;
- ITERATE(CSeq_align_set::Tdata, iter, alnset.Get()) {
-
+ ITERATE(CSeq_align_set::Tdata, iter, alnset.Get()) {
+
const CSeq_id& id = (*iter)->GetSeq_id(1);
- int linkout = linkoutdb
- ? linkoutdb->GetLinkout(id, mv_build_name)
+ int linkout = linkoutdb
+ ? linkoutdb->GetLinkout(id, mv_build_name)
: 0;
int cur_database = (linkout & eGenomicSeq);
if (!is_first && cur_database != prev_database) {
prev_database = cur_database;
is_first = false;
}
-
+
return is_mixed;
}
{
bool formatAsMixedDbs = false;
string mixedDbs = ctx.GetRequestValue("MIXED_DATABASE").GetValue();
- if(!mixedDbs.empty()) {
+ if(!mixedDbs.empty()) {
mixedDbs = NStr::ToLower(mixedDbs);
formatAsMixedDbs = (mixedDbs == "on" || mixedDbs == "true" || mixedDbs == "yes") ? true : false;
}
}
static string s_MapLinkoutGenParam(string &url_link_tmpl,
- const string& rid,
- string giList,
- bool for_alignment,
+ const string& rid,
+ string giList,
+ bool for_alignment,
int cur_align,
string &label,
string &lnk_displ,
{
const string kLinkTitle=" title=\"View <@lnk_tl_info@> for <@label@>\" ";
const string kLinkTarget="target=\"lnk" + rid + "\"";
- string lnkTitle = (lnk_title.empty()) ? kLinkTitle : lnk_title;
+ string lnkTitle = (lnk_title.empty()) ? kLinkTitle : lnk_title;
string url_link = CAlignFormatUtil::MapTemplate(url_link_tmpl,"gi",giList);
url_link = CAlignFormatUtil::MapTemplate(url_link,"rid",rid);
url_link = CAlignFormatUtil::MapTemplate(url_link,"log",for_alignment? "align" : "top");
url_link = CAlignFormatUtil::MapTemplate(url_link,"blast_rank",NStr::IntToString(cur_align));
- lnkTitle = NStr::StartsWith(lnk_displ,"<img") ? "" : lnkTitle;
+ lnkTitle = NStr::StartsWith(lnk_displ,"<img") ? "" : lnkTitle;
string lnkTarget = NStr::StartsWith(lnk_displ,"<img") ? "" : kLinkTarget;
url_link = CAlignFormatUtil::MapTemplate(url_link,"lnkTitle",lnkTitle);
url_link = CAlignFormatUtil::MapTemplate(url_link,"lnkTarget",lnkTarget);
- url_link = CAlignFormatUtil::MapTemplate(url_link,"lnk_displ",lnk_displ);
- url_link = CAlignFormatUtil::MapTemplate(url_link,"lnk_tl_info",lnk_tl_info);
- url_link = CAlignFormatUtil::MapTemplate(url_link,"label",label);
+ url_link = CAlignFormatUtil::MapTemplate(url_link,"lnk_displ",lnk_displ);
+ url_link = CAlignFormatUtil::MapTemplate(url_link,"lnk_tl_info",lnk_tl_info);
+ url_link = CAlignFormatUtil::MapTemplate(url_link,"label",label);
url_link = CAlignFormatUtil::MapProtocol(url_link);
return url_link;
}
-
+
static list<string> s_GetLinkoutUrl(int linkout,
string giList,
string labelList,
- TGi first_gi,
- CAlignFormatUtil::SLinkoutInfo &linkoutInfo,
+ TGi first_gi,
+ CAlignFormatUtil::SLinkoutInfo &linkoutInfo,
bool textLink = true)
-
+
{
- list<string> linkout_list;
+ list<string> linkout_list;
string url_link,lnk_displ,lnk_title,lnkTitleInfo;
-
+
vector<string> accs;
- NStr::Split(labelList,",",accs);
+ NStr::Split(labelList,",",accs);
string firstAcc = (accs.size() > 0)? accs[0] : labelList;
if (linkout & eUnigene) {
- url_link = CAlignFormatUtil::GetURLFromRegistry("UNIGEN");
+ url_link = CAlignFormatUtil::GetURLFromRegistry("UNIGEN");
lnk_displ = textLink ? "UniGene" : kUnigeneImg;
-
+
string termParam = NStr::Find(labelList,",") == NPOS ? kGeneTerm : ""; //kGeneTerm if only one seqid
url_link = CAlignFormatUtil::MapTemplate(url_link,"termParam",termParam);
- lnkTitleInfo = "UniGene cluster";
+ lnkTitleInfo = "UniGene cluster";
string uid = !linkoutInfo.is_na ? "[Protein Accession]" : "[Nucleotide Accession]";
url_link = CAlignFormatUtil::MapTemplate(url_link,"uid",uid);
url_link = s_MapLinkoutGenParam(url_link,linkoutInfo.rid,giList,linkoutInfo.for_alignment, linkoutInfo.cur_align,labelList,lnk_displ,lnkTitleInfo);
-
+
if(textLink) {
url_link = CAlignFormatUtil::MapTemplate(kUnigeneDispl,"lnk",url_link);
- }
+ }
url_link = CAlignFormatUtil::MapProtocol(url_link);
linkout_list.push_back(url_link);
}
if (linkout & eStructure){
- CSeq_id seqID(firstAcc);
+ CSeq_id seqID(firstAcc);
string struct_link = CAlignFormatUtil::GetURLFromRegistry(
"STRUCTURE_URL");
- url_link = struct_link.empty() ? kStructureUrl : struct_link;
+ url_link = struct_link.empty() ? kStructureUrl : struct_link;
string linkTitle;
if(seqID.Which() == CSeq_id::e_Pdb) {
- lnk_displ = textLink ? "Structure" : kStructureImg;
- linkTitle = " title=\"View 3D structure <@label@>\"";
+ lnk_displ = textLink ? "Structure" : kStructureImg;
+ linkTitle = " title=\"View 3D structure <@label@>\"";
}
else {
url_link = kStructureAlphaFoldUrl;
- lnk_displ = textLink ? "AlphaFold Structure" : kStructureImg;
- linkTitle = " title=\"View AlphaFold 3D structure <@label@>\"";
+ lnk_displ = textLink ? "AlphaFold Structure" : kStructureImg;
+ linkTitle = " title=\"View AlphaFold 3D structure <@label@>\"";
}
-
-
-
+
+
+
string molID,chainID;
NStr::SplitInTwo(firstAcc,"_",molID,chainID);
url_link = CAlignFormatUtil::MapTemplate(url_link,"molid",molID);
url_link = CAlignFormatUtil::MapTemplate(url_link,"queryID",linkoutInfo.queryID);
- url_link = s_MapLinkoutGenParam(url_link,linkoutInfo.rid,giList,linkoutInfo.for_alignment, linkoutInfo.cur_align,firstAcc,lnk_displ,"",linkTitle);
+ url_link = s_MapLinkoutGenParam(url_link,linkoutInfo.rid,giList,linkoutInfo.for_alignment, linkoutInfo.cur_align,firstAcc,lnk_displ,"",linkTitle);
if(textLink) {
url_link = CAlignFormatUtil::MapTemplate(kStructureDispl,"lnk",url_link);
- }
+ }
url_link = CAlignFormatUtil::MapProtocol(url_link);
linkout_list.push_back(url_link);
- }
+ }
if (linkout & eGeo){
- url_link = CAlignFormatUtil::GetURLFromRegistry("GEO");
- lnk_displ = textLink ? "GEO Profiles" : kGeoImg;
-
+ url_link = CAlignFormatUtil::GetURLFromRegistry("GEO");
+ lnk_displ = textLink ? "GEO Profiles" : kGeoImg;
+
lnkTitleInfo = "Expression profiles";
- //gilist contains comma separated gis
+ //gilist contains comma separated gis
url_link = s_MapLinkoutGenParam(url_link,linkoutInfo.rid,giList,linkoutInfo.for_alignment, linkoutInfo.cur_align,labelList,lnk_displ,lnkTitleInfo);
-
-
+
+
if(textLink) {
url_link = CAlignFormatUtil::MapTemplate(kGeoDispl,"lnk",url_link);
- }
+ }
url_link = CAlignFormatUtil::MapProtocol(url_link);
linkout_list.push_back(url_link);
}
if(linkout & eGene){
- url_link = CAlignFormatUtil::GetURLFromRegistry("GENE");
- if(textLink) {
- string geneSym = CAlignFormatUtil::GetGeneInfo(first_gi);
- lnk_displ = "Gene";
- lnkTitleInfo = "gene " + geneSym;
+ url_link = CAlignFormatUtil::GetURLFromRegistry("GENE");
+ if(textLink) {
+ lnk_displ = "Gene";
+ lnkTitleInfo = "gene information";
}
else {
lnk_displ = kGeneImg;
}
string termParam = NStr::Find(labelList,",") == NPOS ? kGeneTerm : ""; //kGeneTerm if only one seqid
url_link = CAlignFormatUtil::MapTemplate(url_link,"termParam",termParam);
-
+
string uid = !linkoutInfo.is_na ? "[Protein Accession]" : "[Nucleotide Accession]";
- url_link = CAlignFormatUtil::MapTemplate(url_link,"uid",uid);
-
+ url_link = CAlignFormatUtil::MapTemplate(url_link,"uid",uid);
+
url_link = s_MapLinkoutGenParam(url_link,linkoutInfo.rid,giList,linkoutInfo.for_alignment, linkoutInfo.cur_align,labelList,lnk_displ,lnkTitleInfo);
-
+
if(textLink) {
url_link = CAlignFormatUtil::MapTemplate(kGeneDispl,"lnk",url_link);
- }
+ }
url_link = CAlignFormatUtil::MapProtocol(url_link);
- linkout_list.push_back(url_link);
+ linkout_list.push_back(url_link);
}
if((linkout & eGenomicSeq) && first_gi != ZERO_GI){ //only for advanced view -> textlink = true
if(textLink) {
- url_link = kMapviewBlastHitParams;
+ url_link = kMapviewBlastHitParams;
lnk_displ = "Map Viewer";
-
+
lnkTitleInfo = "BLAST hits on the " + linkoutInfo.taxName + " genome";
url_link = CAlignFormatUtil::MapTemplate(url_link,"gnl",NStr::URLEncode(linkoutInfo.gnl));
url_link = CAlignFormatUtil::MapTemplate(url_link,"user_url",user_url);
string taxIDStr = (linkoutInfo.taxid > ZERO_TAX_ID) ? NStr::NumericToString(linkoutInfo.taxid) : "";
- url_link = CAlignFormatUtil::MapTemplate(url_link,"taxid",taxIDStr);
-
+ url_link = CAlignFormatUtil::MapTemplate(url_link,"taxid",taxIDStr);
+
string queryNumStr = (linkoutInfo.query_number > 0) ? NStr::IntToString(linkoutInfo.query_number) : "";
url_link = CAlignFormatUtil::MapTemplate(url_link,"query_number",queryNumStr); //gi,term
-
- string giStr = (first_gi > ZERO_GI)? NStr::NumericToString(first_gi) : "";
- url_link = s_MapLinkoutGenParam(url_link,linkoutInfo.rid,giStr,linkoutInfo.for_alignment, linkoutInfo.cur_align,labelList,lnk_displ,lnkTitleInfo);
-
+
+ string giStr = (first_gi > ZERO_GI)? NStr::NumericToString(first_gi) : "";
+ url_link = s_MapLinkoutGenParam(url_link,linkoutInfo.rid,giStr,linkoutInfo.for_alignment, linkoutInfo.cur_align,labelList,lnk_displ,lnkTitleInfo);
+
if(textLink) {
url_link = CAlignFormatUtil::MapTemplate(kMapviwerDispl,"lnk",url_link);
}
linkout_list.push_back(url_link);
}
}
- else if((linkout & eMapviewer) && first_gi != ZERO_GI){
+ else if((linkout & eMapviewer) && first_gi != ZERO_GI){
url_link = kMapviwerUrl;
- lnk_displ = textLink ? "Map Viewer" : kMapviwerImg;
-
- string linkTitle = " title=\"View <@label@> aligned to the " + linkoutInfo.taxName + " genome\"";
+ lnk_displ = textLink ? "Map Viewer" : kMapviwerImg;
+
+ string linkTitle = " title=\"View <@label@> aligned to the " + linkoutInfo.taxName + " genome\"";
url_link = s_MapLinkoutGenParam(url_link,linkoutInfo.rid,giList,linkoutInfo.for_alignment, linkoutInfo.cur_align,labelList,lnk_displ,"",linkTitle);
-
+
if(textLink) {
url_link = CAlignFormatUtil::MapTemplate(kMapviwerDispl,"lnk",url_link);
}
url_link = CAlignFormatUtil::MapProtocol(url_link);
- linkout_list.push_back(url_link);
+ linkout_list.push_back(url_link);
}
//View Bioassays involving <accession
if(linkout & eBioAssay && linkoutInfo.is_na && first_gi != ZERO_GI){
- url_link = CAlignFormatUtil::GetURLFromRegistry("BIOASSAY_NUC");
- lnk_displ = textLink ? "PubChem BioAssay" : kBioAssayNucImg;
-
+ url_link = CAlignFormatUtil::GetURLFromRegistry("BIOASSAY_NUC");
+ lnk_displ = textLink ? "PubChem BioAssay" : kBioAssayNucImg;
+
string linkTitle = " title=\"View Bioassays involving <@label@>\"";
//gilist contains comma separated gis, change it to the following
giList = NStr::Replace(giList,",","[RNATargetGI] OR ");
url_link = s_MapLinkoutGenParam(url_link,linkoutInfo.rid,giList,linkoutInfo.for_alignment, linkoutInfo.cur_align,labelList,lnk_displ,"",linkTitle);
-
+
if(textLink) {
url_link = CAlignFormatUtil::MapTemplate(kBioAssayDispl,"lnk",url_link);
}
url_link = CAlignFormatUtil::MapProtocol(url_link);
- linkout_list.push_back(url_link);
+ linkout_list.push_back(url_link);
}
else if (linkout & eBioAssay && !linkoutInfo.is_na && first_gi != ZERO_GI) {
- url_link = CAlignFormatUtil::GetURLFromRegistry("BIOASSAY_PROT");
+ url_link = CAlignFormatUtil::GetURLFromRegistry("BIOASSAY_PROT");
lnk_displ = textLink ? "PubChem BioAssay" : kBioAssayProtImg;
-
+
lnkTitleInfo ="Bioassay data";
string linkTitle = " title=\"View Bioassays involving <@label@>\"";
//gilist contains comma separated gis, change it to the following
giList = NStr::Replace(giList,",","[PigGI] OR ");
url_link = s_MapLinkoutGenParam(url_link,linkoutInfo.rid,giList,linkoutInfo.for_alignment, linkoutInfo.cur_align,labelList,lnk_displ,"",linkTitle);
-
+
if(textLink) {
url_link = CAlignFormatUtil::MapTemplate(kBioAssayDispl,"lnk",url_link);
}
url_link = CAlignFormatUtil::MapProtocol(url_link);
- linkout_list.push_back(url_link);
+ linkout_list.push_back(url_link);
}
if(linkout & eReprMicrobialGenomes){
- url_link = CAlignFormatUtil::GetURLFromRegistry("REPR_MICROBIAL_GENOMES");
- lnk_displ = textLink ? "Genome" : kReprMicrobialGenomesImg;
-
+ url_link = CAlignFormatUtil::GetURLFromRegistry("REPR_MICROBIAL_GENOMES");
+ lnk_displ = textLink ? "Genome" : kReprMicrobialGenomesImg;
+
lnkTitleInfo = "genomic information";
- //gilist contains comma separated gis
+ //gilist contains comma separated gis
string uid = !linkoutInfo.is_na ? "Protein Accession" : "Nucleotide Accession";
url_link = CAlignFormatUtil::MapTemplate(url_link,"uid",uid);
url_link = s_MapLinkoutGenParam(url_link,linkoutInfo.rid,giList,linkoutInfo.for_alignment, linkoutInfo.cur_align,labelList,lnk_displ,lnkTitleInfo);
-
+
if(textLink) {
url_link = CAlignFormatUtil::MapTemplate(kReprMicrobialGenomesDispl,"lnk",url_link);
}
url_link = CAlignFormatUtil::MapProtocol(url_link);
- linkout_list.push_back(url_link);
- }
+ linkout_list.push_back(url_link);
+ }
if((linkout & eGenomeDataViewer) || (linkout & eTranscript)){
- string urlTag;
+ string urlTag;
lnk_displ = textLink ? "Genome Data Viewer" : kGenomeDataViewerImg;
if(linkout & eTranscript) {
urlTag = "GENOME_DATA_VIEWER_TRANSCR";
}
else {
urlTag = linkoutInfo.is_na ? "GENOME_DATA_VIEWER_NUC" : "GENOME_DATA_VIEWER_PROT";
- lnkTitleInfo = linkoutInfo.is_na ?
+ lnkTitleInfo = linkoutInfo.is_na ?
"title=\"View BLAST hits for <@label@> within a genomic context in NCBI's Genome Data Viewer (GDV)- genome browser for RefSeq annotated assemblies. See other genomic features annotated at the same location as hits and browse to other regions.\""
:
"title=\"View the annotation of the protein <@label@> within a genomic context in NCBI's Genome Data Viewer (GDV)- genome browser for RefSeq annotated assemblies. See other genomic features annotated at the same location as the protein annotation and browse to other regions.\"";
}
url_link = CAlignFormatUtil::GetURLFromRegistry(urlTag);
url_link = s_MapLinkoutGenParam(url_link,linkoutInfo.rid,giList,linkoutInfo.for_alignment, linkoutInfo.cur_align,firstAcc,lnk_displ,"",lnkTitleInfo);
-
+
url_link = CAlignFormatUtil::MapTemplate(url_link,"queryID",linkoutInfo.queryID);
TSeqPos seqFrom = linkoutInfo.subjRange.GetFrom();
if(textLink) {
url_link = CAlignFormatUtil::MapTemplate(kGenomeDataViewerDispl,"lnk",url_link);
}
- url_link = CAlignFormatUtil::MapProtocol(url_link);
- linkout_list.push_back(url_link);
- }
+ url_link = CAlignFormatUtil::MapProtocol(url_link);
+ linkout_list.push_back(url_link);
+ }
return linkout_list;
}
///Get list of linkouts for one sequence
-list<string> CAlignFormatUtil::GetLinkoutUrl(int linkout, const CBioseq::TId& ids,
+list<string> CAlignFormatUtil::GetLinkoutUrl(int linkout, const CBioseq::TId& ids,
const string& rid,
- const string& cdd_rid,
+ const string& cdd_rid,
const string& entrez_term,
- bool is_na,
+ bool is_na,
TGi first_gi,
bool structure_linkout_as_group,
bool for_alignment, int cur_align,
string preComputedResID)
-
+
{
list<string> linkout_list;
TGi gi = FindGi(ids);
CRef<CSeq_id> wid = FindBestChoice(ids, CSeq_id::WorstRank);
string label;
- wid->GetLabel(&label, CSeq_id::eContent);
+ wid->GetLabel(&label, CSeq_id::eContent);
string giString = NStr::NumericToString(gi);
first_gi = (first_gi == ZERO_GI) ? gi : first_gi;
SLinkoutInfo linkoutInfo;
linkoutInfo.Init(rid,
- cdd_rid,
+ cdd_rid,
entrez_term,
- is_na,
+ is_na,
"", //database
0, //query_number
"", //user_url
linkoutInfo.cur_align = cur_align;
linkoutInfo.taxid = ZERO_TAX_ID;
-
- linkout_list = s_GetLinkoutUrl(linkout,
+
+ linkout_list = s_GetLinkoutUrl(linkout,
giString,
- label,
+ label,
first_gi,
linkoutInfo,
- false); //textlink
+ false); //textlink
return linkout_list;
}
int linkType = 0;
if(linkLetter == "U") {
linkType = eUnigene;
- }
+ }
else if(linkLetter == "S") {
linkType = eStructure;
- }
+ }
else if(linkLetter == "E") {
linkType = eGeo;
}
}
else if(linkLetter == "R") {
linkType = eReprMicrobialGenomes;
- }
+ }
else if(linkLetter == "V") {
linkType = eGenomeDataViewer;
- }
+ }
else if(linkLetter == "T") {
linkType = eTranscript;
- }
-
+ }
+
return linkType;
}
static void s_AddLinkoutInfo(map<int, vector < CBioseq::TId > > &linkout_map,int linkout,CBioseq::TId &cur_id)
{
if(linkout_map.count(linkout) > 0){
- linkout_map[linkout].push_back(cur_id);
- }
- else {
+ linkout_map[linkout].push_back(cur_id);
+ }
+ else {
vector <CBioseq::TId > idList;
idList.push_back(cur_id);
linkout_map.insert(map<int, vector <CBioseq::TId > >::value_type(linkout,idList));
}
}
-int CAlignFormatUtil::GetSeqLinkoutInfo(CBioseq::TId& cur_id,
- ILinkoutDB **linkoutdb,
- const string& mv_build_name,
+int CAlignFormatUtil::GetSeqLinkoutInfo(CBioseq::TId& cur_id,
+ ILinkoutDB **linkoutdb,
+ const string& mv_build_name,
TGi gi)
{
int linkout = 0;
if(*linkoutdb) {
if(gi == INVALID_GI) {
- gi = FindGi(cur_id);
- }
- try {
+ gi = FindGi(cur_id);
+ }
+ try {
if(gi > ZERO_GI) {
linkout = (*linkoutdb)->GetLinkout(gi, mv_build_name);
}
else if(GetTextSeqID(cur_id)){
- CRef<CSeq_id> seqID = FindBestChoice(cur_id, CSeq_id::WorstRank);
- linkout = (*linkoutdb)->GetLinkout(*seqID, mv_build_name);
- }
+ CRef<CSeq_id> seqID = FindBestChoice(cur_id, CSeq_id::WorstRank);
+ linkout = (*linkoutdb)->GetLinkout(*seqID, mv_build_name);
+ string str_id = seqID->GetSeqIdString(false);
+ CRef<CSeq_id> seqIDNew(new CSeq_id(str_id));
+ int linkoutWithoutVersion = (*linkoutdb)->GetLinkout(*seqIDNew, mv_build_name);
+ if(linkoutWithoutVersion && (linkoutWithoutVersion | eStructure)) {
+ linkout = linkout | linkoutWithoutVersion;
+ }
+ }
}
- catch (const CException & e) {
- ERR_POST("Problem with linkoutdb: " + e.GetMsg());
+ catch (const CException & e) {
+ ERR_POST("Problem with linkoutdb: " + e.GetMsg());
+ cerr << "[BLAST FORMATTER EXCEPTION] Problem with linkoutdb: " << e.GetMsg() << endl;
*linkoutdb = NULL;
- }
+ }
}
return linkout;
}
-void
+void
CAlignFormatUtil::GetBdlLinkoutInfo(CBioseq::TId& cur_id,
map<int, vector <CBioseq::TId > > &linkout_map,
- ILinkoutDB* linkoutdb,
+ ILinkoutDB* linkoutdb,
const string& mv_build_name)
{
if(!linkoutdb) return;
-
- int linkout = GetSeqLinkoutInfo(cur_id,
- &linkoutdb,
- mv_build_name);
-
+
+ int linkout = GetSeqLinkoutInfo(cur_id,
+ &linkoutdb,
+ mv_build_name);
+
if(linkout & eGene){
- s_AddLinkoutInfo(linkout_map,eGene,cur_id);
+ s_AddLinkoutInfo(linkout_map,eGene,cur_id);
}
if (linkout & eUnigene) {
s_AddLinkoutInfo(linkout_map,eUnigene,cur_id);
}
if (linkout & eGeo){
- s_AddLinkoutInfo(linkout_map,eGeo,cur_id);
- }
+ s_AddLinkoutInfo(linkout_map,eGeo,cur_id);
+ }
if (linkout & eStructure){
- s_AddLinkoutInfo(linkout_map,eStructure,cur_id);
- }
+ s_AddLinkoutInfo(linkout_map,eStructure,cur_id);
+ }
//eGenomicSeq and eMapviewer cannot combine together
- if((linkout & eGenomicSeq) && (linkout & eMapviewer)){
- s_AddLinkoutInfo(linkout_map,eGenomicSeq,cur_id);
- }
- else if(linkout & eMapviewer){
- s_AddLinkoutInfo(linkout_map,eMapviewer,cur_id);
- }
- if(linkout & eBioAssay){
- s_AddLinkoutInfo(linkout_map,eBioAssay,cur_id);
- }
- if(linkout & eReprMicrobialGenomes){
- s_AddLinkoutInfo(linkout_map,eReprMicrobialGenomes,cur_id);
- }
-
- if(linkout & eGenomeDataViewer){
- s_AddLinkoutInfo(linkout_map,eGenomeDataViewer,cur_id);
- }
- if(linkout & eTranscript){
- s_AddLinkoutInfo(linkout_map,eTranscript,cur_id);
- }
-
-}
-
-void
+ if((linkout & eGenomicSeq) && (linkout & eMapviewer)){
+ s_AddLinkoutInfo(linkout_map,eGenomicSeq,cur_id);
+ }
+ else if(linkout & eMapviewer){
+ s_AddLinkoutInfo(linkout_map,eMapviewer,cur_id);
+ }
+ if(linkout & eBioAssay){
+ s_AddLinkoutInfo(linkout_map,eBioAssay,cur_id);
+ }
+ if(linkout & eReprMicrobialGenomes){
+ s_AddLinkoutInfo(linkout_map,eReprMicrobialGenomes,cur_id);
+ }
+
+ if(linkout & eGenomeDataViewer){
+ s_AddLinkoutInfo(linkout_map,eGenomeDataViewer,cur_id);
+ }
+ if(linkout & eTranscript){
+ s_AddLinkoutInfo(linkout_map,eTranscript,cur_id);
+ }
+
+}
+
+void
CAlignFormatUtil::GetBdlLinkoutInfo(const list< CRef< CBlast_def_line > > &bdl,
map<int, vector <CBioseq::TId > > &linkout_map,
- ILinkoutDB* linkoutdb,
+ ILinkoutDB* linkoutdb,
const string& mv_build_name)
{
const int kMaxDeflineNum = 10;
int num = 0;
for(list< CRef< CBlast_def_line > >::const_iterator iter = bdl.begin();
- iter != bdl.end(); iter++){
- CBioseq::TId& cur_id = (CBioseq::TId &)(*iter)->GetSeqid();
+ iter != bdl.end(); iter++){
+ CBioseq::TId& cur_id = (CBioseq::TId &)(*iter)->GetSeqid();
GetBdlLinkoutInfo(cur_id,
linkout_map,
- linkoutdb,
- mv_build_name);
+ linkoutdb,
+ mv_build_name);
num++;
if(num > kMaxDeflineNum) break;
- }
+ }
}
static string s_GetTaxName(TTaxId taxid)
if(taxid != ZERO_TAX_ID) {
SSeqDBTaxInfo info;
CSeqDB::GetTaxInfo(taxid, info);
- taxName = info.common_name;
+ taxName = info.common_name;
}
}
catch (CException&) {
-
+
}
return taxName;
}
-void s_AddOtherRelatedInfoLinks(CBioseq::TId& cur_id,
- const string& rid,
- bool is_na,
- bool for_alignment,
+void s_AddOtherRelatedInfoLinks(CBioseq::TId& cur_id,
+ const string& rid,
+ bool is_na,
+ bool for_alignment,
int cur_align,
list<string> &linkout_list)
-
-{
+
+{
//Identical Proteins
-
- CRef<CSeq_id> wid = FindBestChoice(cur_id, CSeq_id::WorstRank);
- if (CAlignFormatUtil::GetTextSeqID(wid)) {
+
+ CRef<CSeq_id> wid = FindBestChoice(cur_id, CSeq_id::WorstRank);
+ if (CAlignFormatUtil::GetTextSeqID(wid)) {
string label;
- wid->GetLabel(&label, CSeq_id::eContent);
+ wid->GetLabel(&label, CSeq_id::eContent);
string url_link = kIdenticalProteinsUrl;
string lnk_displ = "Identical Proteins";
- url_link = s_MapLinkoutGenParam(url_link,rid,NStr::NumericToString(ZERO_GI),for_alignment, cur_align,label,lnk_displ);
+ url_link = s_MapLinkoutGenParam(url_link,rid,NStr::NumericToString(ZERO_GI),for_alignment, cur_align,label,lnk_displ);
url_link = CAlignFormatUtil::MapTemplate(kIdenticalProteinsDispl,"lnk",url_link);
url_link = CAlignFormatUtil::MapTemplate(url_link,"label",label);
linkout_list.push_back(url_link);
//reset:taxname,gnl
-static list<string> s_GetFullLinkoutUrl(CBioseq::TId& cur_id,
- CAlignFormatUtil::SLinkoutInfo &linkoutInfo,
+static list<string> s_GetFullLinkoutUrl(CBioseq::TId& cur_id,
+ CAlignFormatUtil::SLinkoutInfo &linkoutInfo,
map<int, vector < CBioseq::TId > > &linkout_map,
bool getIdentProteins)
-
+
{
- list<string> linkout_list;
-
+ list<string> linkout_list;
+
vector<string> linkLetters;
- NStr::Split(linkoutInfo.linkoutOrder,",",linkLetters); //linkoutOrder = "G,U,M,V,E,S,B,R,T"
+ NStr::Split(linkoutInfo.linkoutOrder,",",linkLetters); //linkoutOrder = "G,U,M,V,E,S,B,R,T"
for(size_t i = 0; i < linkLetters.size(); i++) {
TGi first_gi = ZERO_GI;
vector < CBioseq::TId > idList;
- int linkout = s_LinkLetterToType(linkLetters[i]);
+ int linkout = s_LinkLetterToType(linkLetters[i]);
linkoutInfo.taxName.clear();
- if(linkout & (eMapviewer | eGenomicSeq)) {
- linkout = (linkout_map[eGenomicSeq].size() != 0) ? eGenomicSeq : eMapviewer;
+ if(linkout & (eMapviewer | eGenomicSeq)) {
+ linkout = (linkout_map[eGenomicSeq].size() != 0) ? eGenomicSeq : eMapviewer;
linkoutInfo.taxName = s_GetTaxName(linkoutInfo.taxid);
}
if(linkout_map.find(linkout) != linkout_map.end()) {
- idList = linkout_map[linkout];
- }
+ idList = linkout_map[linkout];
+ }
bool disableLink = (linkout == 0 || idList.size() == 0 || ( (linkout & eStructure) && (linkoutInfo.cdd_rid == "" || linkoutInfo.cdd_rid == "0")));
- string giList,labelList;
- int seqVersion = ((linkout & eGenomeDataViewer) || (linkout & eTranscript)) ? true : false;
+ string giList,labelList;
+ int seqVersion = ((linkout & eGenomeDataViewer) || (linkout & eTranscript)) ? true : false;
for (size_t i = 0; i < idList.size(); i++) {
const CBioseq::TId& ids = idList[i];
TGi gi = FindGi(ids);
if (first_gi == ZERO_GI) first_gi = gi;
- CRef<CSeq_id> wid = FindBestChoice(ids, CSeq_id::WorstRank);
- string label = CAlignFormatUtil::GetLabel(wid,seqVersion);
+ CRef<CSeq_id> wid = FindBestChoice(ids, CSeq_id::WorstRank);
+ string label = CAlignFormatUtil::GetLabel(wid,seqVersion);
if(!labelList.empty()) labelList += ",";
labelList += label;
}
linkoutInfo.gnl.clear();
- if(!disableLink && linkout == eGenomicSeq) {
+ if(!disableLink && linkout == eGenomicSeq) {
linkoutInfo.gnl = s_GetBestIDForURL(cur_id);
}
-
+
if(!disableLink) {//
//The following list will contain only one entry for single linkout value
- list<string> one_linkout = s_GetLinkoutUrl(linkout,
+ list<string> one_linkout = s_GetLinkoutUrl(linkout,
giList,
- labelList,
+ labelList,
first_gi,
- linkoutInfo);
+ linkoutInfo);
if(one_linkout.size() > 0) {
- list<string>::iterator iter = one_linkout.begin();
+ list<string>::iterator iter = one_linkout.begin();
linkout_list.push_back(*iter);
}
}
}
if(getIdentProteins) {
- s_AddOtherRelatedInfoLinks(cur_id,linkoutInfo.rid,linkoutInfo.is_na,linkoutInfo.for_alignment,linkoutInfo.cur_align,linkout_list);
+ s_AddOtherRelatedInfoLinks(cur_id,linkoutInfo.rid,linkoutInfo.is_na,linkoutInfo.for_alignment,linkoutInfo.cur_align,linkout_list);
}
return linkout_list;
}
-list<string> CAlignFormatUtil::GetFullLinkoutUrl(const list< CRef< CBlast_def_line > > &bdl,
- CAlignFormatUtil::SLinkoutInfo &linkoutInfo)
+list<string> CAlignFormatUtil::GetFullLinkoutUrl(const list< CRef< CBlast_def_line > > &bdl,
+ CAlignFormatUtil::SLinkoutInfo &linkoutInfo)
{
list<string> linkout_list;
map<int, vector < CBioseq::TId > > linkout_map;
- if(bdl.size() > 0) {
+ if(bdl.size() > 0) {
GetBdlLinkoutInfo(bdl,linkout_map, linkoutInfo.linkoutdb, linkoutInfo.mv_build_name);
- list< CRef< CBlast_def_line > >::const_iterator iter = bdl.begin();
- CBioseq::TId& cur_id = (CBioseq::TId &)(*iter)->GetSeqid();
- linkout_list = s_GetFullLinkoutUrl(cur_id,
- linkoutInfo,
+ list< CRef< CBlast_def_line > >::const_iterator iter = bdl.begin();
+ CBioseq::TId& cur_id = (CBioseq::TId &)(*iter)->GetSeqid();
+ linkout_list = s_GetFullLinkoutUrl(cur_id,
+ linkoutInfo,
linkout_map,
- !linkoutInfo.is_na && bdl.size() > 1);
+ !linkoutInfo.is_na && bdl.size() > 1);
}
return linkout_list;
}
-list<string> CAlignFormatUtil::GetFullLinkoutUrl(const list< CRef< CBlast_def_line > > &bdl,
+list<string> CAlignFormatUtil::GetFullLinkoutUrl(const list< CRef< CBlast_def_line > > &bdl,
const string& rid,
- const string& cdd_rid,
+ const string& cdd_rid,
const string& entrez_term,
- bool is_na,
+ bool is_na,
bool structure_linkout_as_group,
- bool for_alignment,
+ bool for_alignment,
int cur_align,
string& linkoutOrder,
TTaxId taxid,
string &database,
- int query_number,
+ int query_number,
string &user_url,
string &preComputedResID,
ILinkoutDB* linkoutdb,
const string& mv_build_name)
-
+
{
list<string> linkout_list;
map<int, vector < CBioseq::TId > > linkout_map;
- if(bdl.size() > 0) {
+ if(bdl.size() > 0) {
GetBdlLinkoutInfo(bdl,linkout_map, linkoutdb, mv_build_name);
- list< CRef< CBlast_def_line > >::const_iterator iter = bdl.begin();
- CBioseq::TId& cur_id = (CBioseq::TId &)(*iter)->GetSeqid();
+ list< CRef< CBlast_def_line > >::const_iterator iter = bdl.begin();
+ CBioseq::TId& cur_id = (CBioseq::TId &)(*iter)->GetSeqid();
SLinkoutInfo linkoutInfo;
linkoutInfo.Init(rid,
- cdd_rid,
+ cdd_rid,
entrez_term,
- is_na,
+ is_na,
database,
- query_number,
+ query_number,
user_url,
preComputedResID,
linkoutOrder,
linkoutInfo.cur_align = cur_align;
linkoutInfo.taxid = taxid;
- linkout_list = s_GetFullLinkoutUrl(cur_id,
- linkoutInfo,
+ linkout_list = s_GetFullLinkoutUrl(cur_id,
+ linkoutInfo,
linkout_map,
!is_na && bdl.size() > 1);
}
}
-list<string> CAlignFormatUtil::GetFullLinkoutUrl(CBioseq::TId& cur_id,
+list<string> CAlignFormatUtil::GetFullLinkoutUrl(CBioseq::TId& cur_id,
CAlignFormatUtil::SLinkoutInfo &linkoutInfo,
- bool getIdentProteins)
+ bool getIdentProteins)
{
list<string> linkout_list;
map<int, vector < CBioseq::TId > > linkout_map;
-
+
GetBdlLinkoutInfo(cur_id,linkout_map, linkoutInfo.linkoutdb, linkoutInfo.mv_build_name);
- linkout_list = s_GetFullLinkoutUrl(cur_id,
- linkoutInfo,
+ linkout_list = s_GetFullLinkoutUrl(cur_id,
+ linkoutInfo,
linkout_map,
- getIdentProteins);
+ getIdentProteins);
return linkout_list;
}
-list<string> CAlignFormatUtil::GetFullLinkoutUrl(CBioseq::TId& cur_id,
+list<string> CAlignFormatUtil::GetFullLinkoutUrl(CBioseq::TId& cur_id,
const string& rid,
- const string& cdd_rid,
+ const string& cdd_rid,
const string& entrez_term,
- bool is_na,
+ bool is_na,
bool structure_linkout_as_group,
- bool for_alignment,
+ bool for_alignment,
int cur_align,
string& linkoutOrder,
TTaxId taxid,
string &database,
- int query_number,
+ int query_number,
string &user_url,
string &preComputedResID,
ILinkoutDB* linkoutdb,
const string& mv_build_name,
bool getIdentProteins)
-
+
{
list<string> linkout_list;
- map<int, vector < CBioseq::TId > > linkout_map;
+ map<int, vector < CBioseq::TId > > linkout_map;
GetBdlLinkoutInfo(cur_id,linkout_map, linkoutdb, mv_build_name);
SLinkoutInfo linkoutInfo;
linkoutInfo.Init(rid,
- cdd_rid,
+ cdd_rid,
entrez_term,
- is_na,
+ is_na,
database,
- query_number,
+ query_number,
user_url,
preComputedResID,
linkoutOrder,
linkoutInfo.cur_align = cur_align;
linkoutInfo.taxid = taxid;
- linkout_list = s_GetFullLinkoutUrl(cur_id,
- linkoutInfo,
+ linkout_list = s_GetFullLinkoutUrl(cur_id,
+ linkoutInfo,
linkout_map,
getIdentProteins);
return linkout_list;
subject_range.Set(subject_range.GetTo(), subject_range.GetFrom());
}
subject_list.push_back(subject_range);
-
+
oppositeStrands = (!isFirst) ? (*iter)->GetSeqStrand(0) != (*iter)->GetSeqStrand(1) : oppositeStrands;
isFirst = true;
}
-
- query_list.sort(FromRangeAscendingSort);
+
+ query_list.sort(FromRangeAscendingSort);
subject_list.sort(FromRangeAscendingSort);
return oppositeStrands;
}
//0 for query, 1 for subject
-static list<CRange<TSeqPos> > s_MergeRangeList(list<CRange<TSeqPos> > &source)
+static list<CRange<TSeqPos> > s_MergeRangeList(list<CRange<TSeqPos> > &source)
{
- list<CRange<TSeqPos> > merge_list;
+ list<CRange<TSeqPos> > merge_list;
bool is_first = true;
CRange<TSeqPos> prev_range (0, 0);
ITERATE(list<CRange<TSeqPos> >, iter, source) {
-
+
if (is_first) {
merge_list.push_back(*iter);
is_first= false;
prev_range = *iter;
}
}
-
+
}
- return merge_list;
+ return merge_list;
}
-int CAlignFormatUtil::GetMasterCoverage(const CSeq_align_set& alnset)
+int CAlignFormatUtil::GetMasterCoverage(const CSeq_align_set& alnset)
{
- list<CRange<TSeqPos> > merge_list;
-
+ list<CRange<TSeqPos> > merge_list;
+
list<CRange<TSeqPos> > temp;
ITERATE(CSeq_align_set::Tdata, iter, alnset.Get()) {
CRange<TSeqPos> seq_range = (*iter)->GetSeqRange(0);
}
temp.push_back(seq_range);
}
-
+
temp.sort(FromRangeAscendingSort);
merge_list = s_MergeRangeList(temp);
return master_covered_lenghth;
}
-
+
CRange<TSeqPos> CAlignFormatUtil::GetSeqAlignCoverageParams(const CSeq_align_set& alnset,int *master_covered_lenghth,bool *flip)
-
+
{
list<CRange<TSeqPos> > query_list;
list<CRange<TSeqPos> > subject_list;
*flip = s_ProcessAlignSet(alnset,query_list,subject_list);
- query_list = s_MergeRangeList(query_list);
- subject_list = s_MergeRangeList(subject_list);
+ query_list = s_MergeRangeList(query_list);
+ subject_list = s_MergeRangeList(subject_list);
+
-
*master_covered_lenghth = 0;
ITERATE(list<CRange<TSeqPos> >, iter, query_list) {
*master_covered_lenghth += iter->GetLength();
}
TSeqPos from = 0,to = 0;
- ITERATE(list<CRange<TSeqPos> >, iter, subject_list) {
+ ITERATE(list<CRange<TSeqPos> >, iter, subject_list) {
from = (from == 0) ? iter->GetFrom() : min(from,iter->GetFrom());
to = max(to,iter->GetTo());
}
int hsp_sort,
ILinkoutDB* linkoutdb,
const string& mv_build_name) {
-
-
+
+
if (db_sort == 0 && hit_sort < 1 && hsp_sort < 1)
return (CRef<CSeq_align_set>) &aln_set;
}else {
seqalign_vec[0] = const_cast<CSeq_align_set*>(&aln_set);
}
-
-
+
+
ITERATE(vector< CRef<CSeq_align_set> >, iter, seqalign_vec){
- list< CRef<CSeq_align_set> > one_seqalign_hit_total_list = SortOneSeqalignForSortableFormat(**iter,
- nuc_to_nuc_translation,
+ list< CRef<CSeq_align_set> > one_seqalign_hit_total_list = SortOneSeqalignForSortableFormat(**iter,
+ nuc_to_nuc_translation,
hit_sort,
hsp_sort);
seqalign_hit_total_list.splice(seqalign_hit_total_list.end(),one_seqalign_hit_total_list);
-
+
}
-
+
return HitListToHspList(seqalign_hit_total_list);
}
list< CRef<CSeq_align_set> >
-CAlignFormatUtil::SortOneSeqalignForSortableFormat(const CSeq_align_set& source,
- bool nuc_to_nuc_translation,
+CAlignFormatUtil::SortOneSeqalignForSortableFormat(const CSeq_align_set& source,
+ bool nuc_to_nuc_translation,
int hit_sort,
- int hsp_sort)
-{
+ int hsp_sort)
+{
list< CRef<CSeq_align_set> > seqalign_hit_total_list;
list< CRef<CSeq_align_set> > seqalign_hit_list;
HspListToHitList(seqalign_hit_list, source);
-
+
if (hit_sort == eTotalScore) {
seqalign_hit_list.sort(SortHitByTotalScoreDescending);
} else if (hit_sort == eHighestScore) {
seqalign_hit_list.sort(CAlignFormatUtil::SortHitByScoreDescending);
- } else if (hit_sort == ePercentIdentity) {
- SortHitByPercentIdentityDescending(seqalign_hit_list,
+ } else if (hit_sort == ePercentIdentity) {
+ SortHitByPercentIdentityDescending(seqalign_hit_list,
nuc_to_nuc_translation);
} else if (hit_sort == eQueryCoverage) {
seqalign_hit_list.sort(SortHitByMasterCoverageDescending);
}
- ITERATE(list< CRef<CSeq_align_set> >, iter2, seqalign_hit_list) {
+ ITERATE(list< CRef<CSeq_align_set> >, iter2, seqalign_hit_list) {
CRef<CSeq_align_set> temp(*iter2);
if (hsp_sort == eQueryStart) {
temp->Set().sort(SortHspByMasterStartAscending);
} else if (hsp_sort == eHspPercentIdentity) {
- temp->Set().sort(SortHspByPercentIdentityDescending);
+ temp->Set().sort(SortHspByPercentIdentityDescending);
} else if (hsp_sort == eScore) {
- temp->Set().sort(SortHspByScoreDescending);
+ temp->Set().sort(SortHspByScoreDescending);
} else if (hsp_sort == eSubjectStart) {
temp->Set().sort(SortHspBySubjectStartAscending);
-
- }
+
+ }
seqalign_hit_total_list.push_back(temp);
}
return seqalign_hit_total_list;
CRef<CSeq_align_set>
CAlignFormatUtil::SortSeqalignForSortableFormat(CSeq_align_set& aln_set,
- bool nuc_to_nuc_translation,
+ bool nuc_to_nuc_translation,
int hit_sort,
int hsp_sort) {
- if (hit_sort <= eEvalue && hsp_sort <= eHspEvalue) {
+ if (hit_sort <= eEvalue && hsp_sort <= eHspEvalue) {
return (CRef<CSeq_align_set>) &aln_set;
}
// seqalign_vec[0] = const_cast<CSeq_align_set*>(&aln_set);
- list< CRef<CSeq_align_set> > seqalign_hit_total_list = SortOneSeqalignForSortableFormat(aln_set,
- nuc_to_nuc_translation,
+ list< CRef<CSeq_align_set> > seqalign_hit_total_list = SortOneSeqalignForSortableFormat(aln_set,
+ nuc_to_nuc_translation,
hit_sort,
hsp_sort);
return HitListToHspList(seqalign_hit_total_list);
list<TGi> use_this_gi;
CRef<CSeq_align_set> new_aln(new CSeq_align_set);
-
- ITERATE(CSeq_align_set::Tdata, iter, source_aln.Get()){
+
+ ITERATE(CSeq_align_set::Tdata, iter, source_aln.Get()){
CAlignFormatUtil::GetAlnScores(**iter, score, bits, evalue,
sum_n, num_ident, use_this_gi);
//Add the next three lines to re-calculte seq align evalue to the obe that is displayed on the screen
//string evalue_buf, bit_score_buf, total_bit_buf, raw_score_buf;
//CAlignFormatUtil::GetScoreString(evalue, bits, 0, 0, evalue_buf, bit_score_buf, total_bit_buf, raw_score_buf);
- //evalue = NStr::StringToDouble(evalue_buf);
- if(evalue >= evalueLow && evalue <= evalueHigh) {
+ //evalue = NStr::StringToDouble(evalue_buf);
+ if(evalue >= evalueLow && evalue <= evalueHigh) {
new_aln->Set().push_back(*iter);
}
- }
+ }
return new_aln;
}
/// Returns percent match for an alignment.
-/// Normally we round up the value, unless that means that an
+/// Normally we round up the value, unless that means that an
/// alignment with mismatches would be 100%. In that case
/// it becomes 99%.
///@param numerator: numerator in percent identity calculation.
if (numerator == denominator)
return 100;
else {
- double retval =100*(double)numerator/(double)denominator;
+ double retval =100*(double)numerator/(double)denominator;
return retval;
}
}
CRef<CSeq_align_set> CAlignFormatUtil::FilterSeqalignByPercentIdent(CSeq_align_set& source_aln,
double percentIdentLow,
- double percentIdentHigh)
+ double percentIdentHigh)
{
int score, sum_n, num_ident;
double bits, evalue;
list<TGi> use_this_gi;
CRef<CSeq_align_set> new_aln(new CSeq_align_set);
-
- ITERATE(CSeq_align_set::Tdata, iter, source_aln.Get()){
+
+ ITERATE(CSeq_align_set::Tdata, iter, source_aln.Get()){
CAlignFormatUtil::GetAlnScores(**iter, score, bits, evalue,
- sum_n, num_ident, use_this_gi);
- int seqAlnLength = GetAlignmentLength(**iter, kTranslation);
+ sum_n, num_ident, use_this_gi);
+ int seqAlnLength = GetAlignmentLength(**iter, kTranslation);
if(seqAlnLength > 0 && num_ident > 0) {
- double alnPercentIdent = GetPercentIdentity(num_ident, seqAlnLength);
- if(alnPercentIdent >= percentIdentLow && alnPercentIdent <= percentIdentHigh) {
+ double alnPercentIdent = GetPercentIdentity(num_ident, seqAlnLength);
+ if(alnPercentIdent >= percentIdentLow && alnPercentIdent <= percentIdentHigh) {
new_aln->Set().push_back(*iter);
- }
+ }
}
- }
+ }
return new_aln;
}
list<TGi> use_this_gi;
CRef<CSeq_align_set> new_aln(new CSeq_align_set);
-
- ITERATE(CSeq_align_set::Tdata, iter, source_aln.Get()){
+
+ ITERATE(CSeq_align_set::Tdata, iter, source_aln.Get()){
CAlignFormatUtil::GetAlnScores(**iter, score, bits, evalue,
sum_n, num_ident, use_this_gi);
//Add the next three lines to re-calculte seq align evalue to the one that is displayed on the screen
new_aln->Set().push_back(*iter);
}
}
- }
+ }
return new_aln;
}
static double adjustPercentIdentToDisplayValue(double value)
{
- char buffer[512];
+ char buffer[512];
sprintf(buffer, "%.*f", 2, value);
double newVal = NStr::StringToDouble(buffer);
return newVal;
int queryCoverLow,
int queryCoverHigh)
{
-
+
bool isInRange = false;
//Adjust percent identity and evalue to display values
}
else if(evalueLow >= 0 && percentIdentLow >= 0) {
isInRange = (evalue >= evalueLow && evalue <= evalueHigh) &&
- (percentIdent >= percentIdentLow && percentIdent <= percentIdentHigh);
+ (percentIdent >= percentIdentLow && percentIdent <= percentIdentHigh);
}
else if(evalueLow >= 0 && queryCoverLow >= 0) {
isInRange = (evalue >= evalueLow && evalue <= evalueHigh) &&
- (queryCover >= queryCoverLow && queryCover <= queryCoverHigh);
+ (queryCover >= queryCoverLow && queryCover <= queryCoverHigh);
}
else if(queryCoverLow >= 0 && percentIdentLow >= 0) {
isInRange = (queryCover >= queryCoverLow && queryCover <= queryCoverHigh) &&
- (percentIdent >= percentIdentLow && percentIdent <= percentIdentHigh);
+ (percentIdent >= percentIdentLow && percentIdent <= percentIdentHigh);
}
else if(evalueLow >= 0) {
- isInRange = (evalue >= evalueLow && evalue <= evalueHigh);
+ isInRange = (evalue >= evalueLow && evalue <= evalueHigh);
}
else if(percentIdentLow >= 0) {
- isInRange = (percentIdent >= percentIdentLow && percentIdent <= percentIdentHigh);
+ isInRange = (percentIdent >= percentIdentLow && percentIdent <= percentIdentHigh);
}
else if(queryCoverLow >= 0) {
- isInRange = (queryCover >= queryCoverLow && queryCover <= queryCoverHigh);
+ isInRange = (queryCover >= queryCoverLow && queryCover <= queryCoverHigh);
}
return isInRange;
}
list< CRef<CSeq_align_set> > seqalign_hit_list;
HspListToHitList(seqalign_hit_list, source_aln);
-
- ITERATE(list< CRef<CSeq_align_set> >, iter, seqalign_hit_list) {
+
+ ITERATE(list< CRef<CSeq_align_set> >, iter, seqalign_hit_list) {
CRef<CSeq_align_set> temp(*iter);
CAlignFormatUtil::SSeqAlignSetCalcParams* seqSetInfo = CAlignFormatUtil::GetSeqAlignSetCalcParamsFromASN(*temp);
-
+
if(s_isAlnInFilteringRange(seqSetInfo->evalue,
seqSetInfo->percent_identity,
seqSetInfo->percent_coverage,
queryCoverLow,
queryCoverHigh)) {
seqalign_hit_total_list.push_back(temp);
- }
+ }
}
- return HitListToHspList(seqalign_hit_total_list);
+ return HitListToHspList(seqalign_hit_total_list);
}
CRef<CSeq_align_set> CAlignFormatUtil::LimitSeqalignByHsps(CSeq_align_set& source_aln,
int maxAligns,
- int maxHsps)
+ int maxHsps)
{
- CRef<CSeq_align_set> new_aln(new CSeq_align_set);
-
+ CRef<CSeq_align_set> new_aln(new CSeq_align_set);
+
CConstRef<CSeq_id> prevQueryId,prevSubjectId;
int alignCount = 0,hspCount = 0;
ITERATE(CSeq_align_set::Tdata, iter, source_aln.Get()){
if (hspCount >= maxHsps) {
break;
}
- alignCount = 0;
- prevQueryId = &newQueryId;
- }
- if (alignCount < maxAligns) {
+ alignCount = 0;
+ prevQueryId = &newQueryId;
+ }
+ if (alignCount < maxAligns) {
const CSeq_id& newSubjectId = (*iter)->GetSeq_id(1);
// Increment alignments count if subject sequence is different
- if(prevSubjectId.Empty() || !newSubjectId.Match(*prevSubjectId)){
+ if(prevSubjectId.Empty() || !newSubjectId.Match(*prevSubjectId)){
++alignCount;
prevSubjectId = &newSubjectId;
}
- // Increment HSP count if the alignments limit is not reached
- ++hspCount;
+ // Increment HSP count if the alignments limit is not reached
+ ++hspCount;
new_aln->Set().push_back(*iter);
}
-
+
}
return new_aln;
}
CRef<CSeq_align_set> CAlignFormatUtil::ExtractQuerySeqAlign(CRef<CSeq_align_set> &source_aln,
- int queryNumber)
+ int queryNumber)
{
if(queryNumber == 0) {
return source_aln;
}
- CRef<CSeq_align_set> new_aln;
-
- CConstRef<CSeq_id> prevQueryId;
+ CRef<CSeq_align_set> new_aln;
+
+ CConstRef<CSeq_id> prevQueryId;
int currQueryNum = 0;
ITERATE(CSeq_align_set::Tdata, iter, source_aln->Get()){
if(prevQueryId.Empty() || !newQueryId.Match(*prevQueryId)){
currQueryNum++;
prevQueryId = &newQueryId;
- }
+ }
//Record seq aligns corresponding to queryNumber
if(currQueryNum == queryNumber) {
if(new_aln.Empty()) {
- new_aln.Reset(new CSeq_align_set);
+ new_aln.Reset(new CSeq_align_set);
}
- new_aln->Set().push_back(*iter);
- }
+ new_aln->Set().push_back(*iter);
+ }
else if(currQueryNum > queryNumber) {
break;
- }
+ }
}
return new_aln;
}
string l_fmtcfg_env;
if( NULL != getenv("NCBI") ) l_ncbi_env = getenv("NCBI");
if( NULL != getenv("FMTCFG") ) l_fmtcfg_env = getenv("FMTCFG");
- // config file name: value of FMTCFG or default ( .ncbirc )
- if( l_fmtcfg_env.empty() )
+ // config file name: value of FMTCFG or default ( .ncbirc )
+ if( l_fmtcfg_env.empty() )
l_cfg_file_name = ".ncbirc";
- else
+ else
l_cfg_file_name = l_fmtcfg_env;
// checkinf existance of configuration file
CFile l_fchecker( l_cfg_file_name );
cfgExists = l_fchecker.Exists();
if( (!cfgExists) && (!l_ncbi_env.empty()) ) {
- if( l_ncbi_env.rfind("/") != (l_ncbi_env.length() -1 ))
+ if( l_ncbi_env.rfind("/") != (l_ncbi_env.length() -1 ))
l_ncbi_env.append("/");
l_cfg_file_name = l_ncbi_env + l_cfg_file_name;
CFile l_fchecker2( l_cfg_file_name );
- cfgExists = l_fchecker2.Exists();
- }
+ cfgExists = l_fchecker2.Exists();
+ }
if(cfgExists) {
CNcbiIfstream l_ConfigFile(l_cfg_file_name.c_str() );
m_Reg.reset(new CNcbiRegistry(l_ConfigFile));
- if( l_dbg ) fprintf(stderr,"REGISTRY: %s\n",l_cfg_file_name.c_str());
+ if( l_dbg ) fprintf(stderr,"REGISTRY: %s\n",l_cfg_file_name.c_str());
}
}
return;
//
// get given url from registry file or return corresponding kNAME
// value as default to preserve compatibility.
-//
+//
// algoritm:
-// 1) config file name is ".ncbirc" unless FMTCFG specifies another name
-// 2) try to read local configuration file before
+// 1) config file name is ".ncbirc" unless FMTCFG specifies another name
+// 2) try to read local configuration file before
// checking location specified by the NCBI environment.
// 3) if index != -1, use it as trailing version number for a key name,
// ABCD_V0. try to read ABCD key if version variant doesn't exist.
// 4) use INCLUDE_BASE_DIR key to specify base for all include files.
// 5) treat "_FORMAT" key as filename first and string in second.
-// in case of existances of filename, read it starting from
+// in case of existances of filename, read it starting from
// location specified by INCLUDE_BASE_DIR key
string CAlignFormatUtil::GetURLFromRegistry( const string url_name, int index){
string result_url;
- string l_key, l_host_port, l_format;
+ string l_key, l_host_port, l_format;
string l_secion_name = "BLASTFMTUTIL";
string l_fmt_suffix = "_FORMAT";
string l_host_port_suffix = "_HOST_PORT";
string l_subst_pattern;
-
+
if( !m_Reg ) {
- InitConfig();
+ InitConfig();
}
if( !m_Reg ) return GetURLDefault(url_name,index); // can't read .ncbrc file
string l_base_dir = m_Reg->Get(l_secion_name, "INCLUDE_BASE_DIR");
if( !l_base_dir.empty() && ( l_base_dir.rfind("/") != (l_base_dir.length()-1)) ) {
l_base_dir.append("/");
}
-
+
string default_host_port;
- string l_key_ndx;
- if( index >=0) {
+ string l_key_ndx;
+ if( index >=0) {
l_key_ndx = url_name + l_host_port_suffix + "_" + NStr::IntToString( index );
- l_subst_pattern="<@"+l_key_ndx+"@>";
+ l_subst_pattern="<@"+l_key_ndx+"@>";
l_host_port = m_Reg->Get(l_secion_name, l_key_ndx); // try indexed
}
// next is initialization for non version/array type of settings
if( l_host_port.empty()){ // not indexed or index wasn't found
- l_key = url_name + l_host_port_suffix; l_subst_pattern="<@"+l_key+"@>";
+ l_key = url_name + l_host_port_suffix; l_subst_pattern="<@"+l_key+"@>";
l_host_port = m_Reg->Get(l_secion_name, l_key);
}
if( l_host_port.empty()) return GetURLDefault(url_name,index);
string l_format_file = l_base_dir + l_format;
CFile l_fchecker( l_format_file );
bool file_name_mode = l_fchecker.Exists();
- if( file_name_mode ) { // read whole content of the file to string buffer
+ if( file_name_mode ) { // read whole content of the file to string buffer
string l_inc_file_name = l_format_file;
- CNcbiIfstream l_file (l_inc_file_name.c_str(), ios::in|ios::binary|ios::ate);
+ CNcbiIfstream l_file (l_inc_file_name.c_str(), ios::in|ios::binary|ios::ate);
CT_POS_TYPE l_inc_size = l_file.tellg();
// size_t l_buf_sz = (size_t) l_inc_size;
char *l_mem = new char [ (size_t) l_inc_size + 1];
l_file.close();
l_format.erase(); l_format.reserve( (size_t)l_inc_size + 1 );
l_format = l_mem;
- delete [] l_mem;
+ delete [] l_mem;
}
result_url = NStr::Replace(l_format,l_subst_pattern,l_host_port);
}
string error_msg = "CAlignFormatUtil::GetURLDefault:no_defualt_for"+url_name;
- if( index != -1 ) error_msg += "_index_"+ NStr::IntToString( index );
+ if( index != -1 ) error_msg += "_index_"+ NStr::IntToString( index );
return error_msg;
}
return;
}
- const SNCBIPackedScoreMatrix* packed_mtx =
+ const SNCBIPackedScoreMatrix* packed_mtx =
NCBISM_GetStandardMatrix(matrix_name);
if (packed_mtx == NULL) {
return;
SNCBIFullScoreMatrix mtx;
NCBISM_Unpack(packed_mtx, &mtx);
-
+
for(int i = 0; i < ePMatrixSize; ++i){
for(int j = 0; j < ePMatrixSize; ++j){
retval((size_t)k_PSymbol[i], (size_t)k_PSymbol[j]) =
for(int i = 0; i < ePMatrixSize; ++i) {
retval((size_t)k_PSymbol[i], '*') = retval('*',(size_t)k_PSymbol[i]) = -4;
}
- retval('*', '*') = 1;
+ retval('*', '*') = 1;
// this is to count Selenocysteine to Cysteine matches as positive
retval('U', 'U') = retval('C', 'C');
retval('U', 'C') = retval('C', 'C');
string CAlignFormatUtil::MapSpaceTemplate(string inpString,string tmplParamName,string templParamVal, unsigned int maxParamValLength, int spacesFormatFlag)
{
templParamVal = AddSpaces(templParamVal, maxParamValLength, spacesFormatFlag);
- string outString = MapTemplate(inpString,tmplParamName,templParamVal);
+ string outString = MapTemplate(inpString,tmplParamName,templParamVal);
return outString;
}
-string CAlignFormatUtil::AddSpaces(string paramVal, unsigned int maxParamValLength, int spacesFormatFlag)
+string CAlignFormatUtil::AddSpaces(string paramVal, size_t maxParamValLength, int spacesFormatFlag)
{
//if(!spacePos.empty()) {
- string spaceString;
+ string spaceString;
if(maxParamValLength >= paramVal.size()) {
- unsigned int numSpaces = maxParamValLength - paramVal.size() + 1;
+ size_t numSpaces = maxParamValLength - paramVal.size() + 1;
if(spacesFormatFlag & eSpacePosToCenter) {
numSpaces = numSpaces/2;
}
- for(size_t i=0; i < numSpaces ; i++){
- spaceString += " ";
- }
+ spaceString.assign(numSpaces,' ');
}
else {
paramVal = paramVal.substr(0, maxParamValLength - 3) + "...";
}
if(spacesFormatFlag & eSpacePosAtLineEnd) {
paramVal = paramVal + spaceString;
- }
+ }
else if(spacesFormatFlag & eSpacePosToCenter) {
paramVal = spaceString + paramVal + spaceString;
}
paramVal = spaceString + paramVal;
}
if(spacesFormatFlag & eAddEOLAtLineStart) paramVal = "\n" + paramVal;
- if(spacesFormatFlag & eAddEOLAtLineEnd) paramVal = paramVal + "\n";
+ if(spacesFormatFlag & eAddEOLAtLineEnd) paramVal = paramVal + "\n";
//}
-
+
return paramVal;
}
if(config_reg.HasEntry("BLASTFMTUTIL","PROTOCOL")) {
httpProt = config_reg.Get("BLASTFMTUTIL","PROTOCOL");
}
- }
+ }
return httpProt;
}
if(m_Protocol.empty()){
if(!m_Reg) {
InitConfig();
- }
- m_Protocol = (m_Reg && m_Reg->HasEntry("BLASTFMTUTIL","PROTOCOL")) ? m_Protocol = m_Reg->Get("BLASTFMTUTIL","PROTOCOL") : "https:";
+ }
+ m_Protocol = (m_Reg && m_Reg->HasEntry("BLASTFMTUTIL","PROTOCOL")) ? m_Protocol = m_Reg->Get("BLASTFMTUTIL","PROTOCOL") : "https:";
}
url_link = CAlignFormatUtil::MapTemplate(url_link,"protocol",m_Protocol);
return url_link;
static string s_MapCommonUrlParams(string urlTemplate, CAlignFormatUtil::SSeqURLInfo *seqUrlInfo)
{
string db,logstr_moltype;
- if(seqUrlInfo->isDbNa) {
+ if(seqUrlInfo->isDbNa) {
db = "nucleotide";
logstr_moltype = "nucl";
- } else {
+ } else {
db = "protein";
logstr_moltype ="prot";
}
url_link = CAlignFormatUtil::MapTemplate(url_link,"gi", GI_TO(TIntId, seqUrlInfo->gi));
url_link = CAlignFormatUtil::MapTemplate(url_link,"log",logstr_moltype + logstr_location);
url_link = CAlignFormatUtil::MapTemplate(url_link,"blast_rank",seqUrlInfo->blast_rank);
- url_link = CAlignFormatUtil::MapTemplate(url_link,"rid",seqUrlInfo->rid);
- url_link = CAlignFormatUtil::MapTemplate(url_link,"acc",seqUrlInfo->accession);
+ url_link = CAlignFormatUtil::MapTemplate(url_link,"rid",seqUrlInfo->rid);
+ url_link = CAlignFormatUtil::MapTemplate(url_link,"acc",seqUrlInfo->accession);
url_link = CAlignFormatUtil::MapProtocol(url_link);
return url_link;
}
string url_link = urlTemplate;
if (seqUrlInfo->user_url.find("sra.cgi") != string::npos) {
string strRun, strSpotId,strReadIndex;
- if(s_GetSRASeqMetadata(ids,strRun,strSpotId,strReadIndex)) {
+ if(s_GetSRASeqMetadata(ids,strRun,strSpotId,strReadIndex)) {
url_link = CAlignFormatUtil::MapTemplate(url_link,"run",strRun);
url_link = CAlignFormatUtil::MapTemplate(url_link,"spotid",strSpotId);
url_link = CAlignFormatUtil::MapTemplate(url_link,"readindex",strReadIndex);
bool CAlignFormatUtil::IsWGSPattern(string &wgsAccession)
{
- //const string kWgsAccessionPattern = "^[A-Z]{4}[0-9]{8,10}(\.[0-9]+){0,1}$"; //example AUXO013124042 or AUXO013124042.1
+ //const string kWgsAccessionPattern = "^[A-Z]{4}[0-9]{8,10}(\.[0-9]+){0,1}$"; //example AUXO013124042 or AUXO013124042.1
const unsigned int kWgsProjLength = 4;
const unsigned int kWgsProjIDLengthMin = 8;
const unsigned int kWgsProjIDLengthMax = 10;
return false;
}
- if(NStr::Find(wgsAccession, ".") != NPOS) { //Accession has version AUXO013124042.1
+ if(NStr::Find(wgsAccession, ".") != NPOS) { //Accession has version AUXO013124042.1
string version;
- NStr::SplitInTwo(wgsAccession,".",wgsAccession,version);
+ NStr::SplitInTwo(wgsAccession,".",wgsAccession,version);
}
- string wgsProj = wgsAccession.substr(0,kWgsProjLength);
+ string wgsProj = wgsAccession.substr(0,kWgsProjLength);
for (size_t i = 0; i < wgsProj.length(); i ++){
if(!isalpha(wgsProj[i]&0xff)) {
isWGS = false;
}
return isWGS;
}
-
+
bool CAlignFormatUtil::IsWGSAccession(string &wgsAccession, string &wgsProjName)
-{
- const unsigned int kWgsProgNameLength = 6;
+{
+ const unsigned int kWgsProgNameLength = 6;
bool isWGS = IsWGSPattern(wgsAccession);
if(isWGS) {
- wgsProjName = wgsAccession.substr(0,kWgsProgNameLength);
+ wgsProjName = wgsAccession.substr(0,kWgsProgNameLength);
}
return isWGS;
}
-
+
string CAlignFormatUtil::GetIDUrlGen(SSeqURLInfo *seqUrlInfo,const CBioseq::TId* ids)
{
string url_link = NcbiEmptyString;
CConstRef<CSeq_id> wid = FindBestChoice(*ids, CSeq_id::WorstRank);
-
+
bool hasTextSeqID = GetTextSeqID(*ids);
string title = "title=\"Show report for " + seqUrlInfo->accession + "\" ";
if (!(wid->Which() == CSeq_id::e_Local || wid->Which() == CSeq_id::e_General)){
isWGS = CAlignFormatUtil::IsWGSAccession(wgsAccession, wgsProj);
}
- if(isWGS && seqUrlInfo->useTemplates) {
- string wgsUrl = CAlignFormatUtil::GetURLFromRegistry("WGS");
+ if(isWGS && seqUrlInfo->useTemplates) {
+ string wgsUrl = CAlignFormatUtil::GetURLFromRegistry("WGS");
url_link = s_MapCommonUrlParams(wgsUrl, seqUrlInfo);
- url_link = CAlignFormatUtil::MapTemplate(url_link,"wgsproj",wgsProj);
- url_link = CAlignFormatUtil::MapTemplate(url_link,"wgsacc", wgsAccession);
- }
- else if (hasTextSeqID) {
+ url_link = CAlignFormatUtil::MapTemplate(url_link,"wgsproj",wgsProj);
+ url_link = CAlignFormatUtil::MapTemplate(url_link,"wgsacc", wgsAccession);
+ }
+ else if (hasTextSeqID) {
string entrezTag = (seqUrlInfo->useTemplates) ? "ENTREZ_TM" : "ENTREZ";
string l_EntrezUrl = CAlignFormatUtil::GetURLFromRegistry(entrezTag);
url_link = s_MapCommonUrlParams(l_EntrezUrl, seqUrlInfo);
-
- if(!seqUrlInfo->useTemplates) {
- url_link = CAlignFormatUtil::MapTemplate(url_link,"acc",seqUrlInfo->accession);
+
+ if(!seqUrlInfo->useTemplates) {
+ url_link = CAlignFormatUtil::MapTemplate(url_link,"acc",seqUrlInfo->accession);
temp_class_info = (!seqUrlInfo->defline.empty())? CAlignFormatUtil::MapTemplate(temp_class_info,"defline",NStr::JavaScriptEncode(seqUrlInfo->defline)):temp_class_info;
url_link = CAlignFormatUtil::MapTemplate(url_link,"cssInf",(seqUrlInfo->addCssInfo) ? temp_class_info.c_str() : "");
- url_link = CAlignFormatUtil::MapTemplate(url_link,"target",seqUrlInfo->new_win ? "TARGET=\"EntrezView\"" : "");
- }
-
- } else {//seqid general, dbtag specified
+ url_link = CAlignFormatUtil::MapTemplate(url_link,"target",seqUrlInfo->new_win ? "TARGET=\"EntrezView\"" : "");
+ }
+
+ } else {//seqid general, dbtag specified
if(wid->Which() == CSeq_id::e_General){
const CDbtag& dtg = wid->GetGeneral();
const string& dbname = dtg.GetDb();
if(NStr::CompareNocase(dbname, "TI") == 0){
- string actual_id = CAlignFormatUtil::GetGnlID(dtg);
+ string actual_id = CAlignFormatUtil::GetGnlID(dtg);
if(seqUrlInfo->useTemplates) {
- string l_TraceUrl = CAlignFormatUtil::GetURLFromRegistry("TRACE_CGI");
+ string l_TraceUrl = CAlignFormatUtil::GetURLFromRegistry("TRACE_CGI");
url_link = l_TraceUrl + (string)"?cmd=retrieve&dopt=fasta&val=" + actual_id + "&RID=" + seqUrlInfo->rid;
}
- else {
- url_link = CAlignFormatUtil::MapTemplate(kTraceUrl,"val",actual_id);
+ else {
+ url_link = CAlignFormatUtil::MapTemplate(kTraceUrl,"val",actual_id);
temp_class_info = (!seqUrlInfo->defline.empty())? CAlignFormatUtil::MapTemplate(temp_class_info,"defline",seqUrlInfo->defline):temp_class_info;
url_link = CAlignFormatUtil::MapTemplate(url_link,"cssInf",(seqUrlInfo->addCssInfo) ? temp_class_info.c_str() : "");
- url_link = CAlignFormatUtil::MapTemplate(url_link,"rid",seqUrlInfo->rid);
- }
+ url_link = CAlignFormatUtil::MapTemplate(url_link,"rid",seqUrlInfo->rid);
+ }
}
} else if (wid->Which() == CSeq_id::e_Local){
-
+
string url_holder = CAlignFormatUtil::GetURLFromRegistry("LOCAL_ID");
-
+
string user_url;
if (m_Reg) {
user_url = (seqUrlInfo->addCssInfo) ? m_Reg->Get("LOCAL_ID","TOOL_URL_ALIGN") : m_Reg->Get("LOCAL_ID","TOOL_URL");
}
string id_string;
wid->GetLabel(&id_string, CSeq_id::eContent);
- url_link = CAlignFormatUtil::MapTemplate(user_url,"seq_id", NStr::URLEncode(id_string));
- url_link = CAlignFormatUtil::MapTemplate(url_link,"db_name", NStr::URLEncode(seqUrlInfo->database));
+ url_link = CAlignFormatUtil::MapTemplate(user_url,"seq_id", NStr::URLEncode(id_string));
+ url_link = CAlignFormatUtil::MapTemplate(url_link,"db_name", NStr::URLEncode(seqUrlInfo->database));
url_link = CAlignFormatUtil::MapTemplate(url_link,"taxid", TAX_ID_TO(int, seqUrlInfo->taxid));
temp_class_info = (!seqUrlInfo->defline.empty())? CAlignFormatUtil::MapTemplate(temp_class_info,"defline",seqUrlInfo->defline):temp_class_info;
url_link = CAlignFormatUtil::MapTemplate(url_link,"cssInf",(seqUrlInfo->addCssInfo) ? temp_class_info.c_str() : "");
{
const CBioseq_Handle& handle = scope.GetBioseqHandle(id);
const CBioseq::TId* ids = &handle.GetBioseqCore()->GetId();
-
+
string url_link = GetIDUrlGen(seqUrlInfo,ids);
return url_link;
}
{
string url_link = NcbiEmptyString;
CConstRef<CSeq_id> wid = FindBestChoice(*ids, CSeq_id::WorstRank);
-
+
string title = "title=\"Show report for " + seqUrlInfo->accession + "\" ";
- if (seqUrlInfo->user_url != NcbiEmptyString &&
- !((seqUrlInfo->user_url.find("dumpgnl.cgi") != string::npos && seqUrlInfo->gi > ZERO_GI) ||
+ if (seqUrlInfo->user_url != NcbiEmptyString &&
+ !((seqUrlInfo->user_url.find("dumpgnl.cgi") != string::npos && seqUrlInfo->gi > ZERO_GI) ||
(seqUrlInfo->user_url.find("maps.cgi") != string::npos))) {
-
+
string url_with_parameters,toolURLParams;
if(m_Reg && !seqUrlInfo->blastType.empty() && seqUrlInfo->blastType != "newblast") {
- toolURLParams = m_Reg->Get(seqUrlInfo->blastType, "TOOL_URL_PARAMS");
- }
- if(!toolURLParams.empty()) {
+ toolURLParams = m_Reg->Get(seqUrlInfo->blastType, "TOOL_URL_PARAMS");
+ }
+ if(!toolURLParams.empty()) {
string urlLinkTemplate = seqUrlInfo->user_url + toolURLParams;
- url_with_parameters = s_MapURLLink(urlLinkTemplate, seqUrlInfo, *ids);
+ url_with_parameters = s_MapURLLink(urlLinkTemplate, seqUrlInfo, *ids);
}
- else {
- if (seqUrlInfo->user_url.find("sra.cgi") != string::npos) {
+ else {
+ if (seqUrlInfo->user_url.find("sra.cgi") != string::npos) {
url_with_parameters = CAlignFormatUtil::BuildSRAUrl(*ids, seqUrlInfo->user_url);
}
else {
seqUrlInfo->queryNumber,
seqUrlInfo->isAlignLink);
}
- }
+ }
if (url_with_parameters != NcbiEmptyString) {
if (!seqUrlInfo->useTemplates) {
string deflineInfo;
if(seqUrlInfo->addCssInfo) {
deflineInfo = (!seqUrlInfo->defline.empty())? CAlignFormatUtil::MapTemplate(kClassInfo,"defline",seqUrlInfo->defline):kClassInfo;
}
- url_link += "<a " + title + deflineInfo + "href=\"";
+ url_link += "<a " + title + deflineInfo + "href=\"";
}
url_link += url_with_parameters;
if (!seqUrlInfo->useTemplates) url_link += "\">";
- }
- }
- else {
- //use entrez or dbtag specified
+ }
+ }
+ else {
+ //use entrez or dbtag specified
url_link = GetIDUrlGen(seqUrlInfo,ids);
}
seqUrlInfo->seqUrl = url_link;
{
const CBioseq_Handle& handle = scope.GetBioseqHandle(id);
const CBioseq::TId* ids = &handle.GetBioseqCore()->GetId();
-
-
+
+
seqUrlInfo->blastType = NStr::TruncateSpaces(NStr::ToLower(seqUrlInfo->blastType));
-
+
if(seqUrlInfo->taxid == INVALID_TAX_ID) { //taxid is not set
seqUrlInfo->taxid = ZERO_TAX_ID;
- if ((seqUrlInfo->advancedView || seqUrlInfo->blastType == "mapview" || seqUrlInfo->blastType == "mapview_prev") ||
+ if ((seqUrlInfo->advancedView || seqUrlInfo->blastType == "mapview" || seqUrlInfo->blastType == "mapview_prev") ||
seqUrlInfo->blastType == "gsfasta" || seqUrlInfo->blastType == "gsfasta_prev") {
- seqUrlInfo->taxid = GetTaxidForSeqid(id, scope);
+ seqUrlInfo->taxid = GetTaxidForSeqid(id, scope);
}
}
string url_link = GetIDUrl(seqUrlInfo,ids);
return url_link;
}
-//static const char kGenericLinkTemplate[] = "<a href=\"<@url@>\" target=\"lnk<@rid@>\" title=\"Show report for <@seqid@>\"><@gi@><@seqid@></a>";
+//static const char kGenericLinkTemplate[] = "<a href=\"<@url@>\" target=\"lnk<@rid@>\" title=\"Show report for <@seqid@>\"><@gi@><@seqid@></a>";
string CAlignFormatUtil::GetFullIDLink(SSeqURLInfo *seqUrlInfo,const CBioseq::TId* ids)
{
string seqLink;
seqLink = CAlignFormatUtil::MapTemplate(seqLink,"rid",seqUrlInfo->rid);
seqLink = CAlignFormatUtil::MapTemplate(seqLink,"seqid",seqUrlInfo->accession);
seqLink = CAlignFormatUtil::MapTemplate(seqLink,"gi", GI_TO(TIntId, seqUrlInfo->gi));
- seqLink = CAlignFormatUtil::MapTemplate(seqLink,"target","EntrezView");
+ seqLink = CAlignFormatUtil::MapTemplate(seqLink,"target","EntrezView");
if(seqUrlInfo->addCssInfo) {
- seqLink = CAlignFormatUtil::MapTemplate(seqLink,"defline",NStr::JavaScriptEncode(seqUrlInfo->defline));
- }
- }
+ seqLink = CAlignFormatUtil::MapTemplate(seqLink,"defline",NStr::JavaScriptEncode(seqUrlInfo->defline));
+ }
+ }
return seqLink;
}
static string s_MapCustomLink(string linkUrl,string reportType,string accession, string linkText, string linktrg, string linkTitle = kCustomLinkTitle,string linkCls = "")
{
- string link = CAlignFormatUtil::MapTemplate(kCustomLinkTemplate,"custom_url",linkUrl);
+ string link = CAlignFormatUtil::MapTemplate(kCustomLinkTemplate,"custom_url",linkUrl);
link = CAlignFormatUtil::MapProtocol(link);
- link = CAlignFormatUtil::MapTemplate(link,"custom_title",linkTitle);
- link = CAlignFormatUtil::MapTemplate(link,"custom_report_type",reportType);
- link = CAlignFormatUtil::MapTemplate(link,"seqid",accession);
- link = CAlignFormatUtil::MapTemplate(link,"custom_lnk_displ",linkText);
+ link = CAlignFormatUtil::MapTemplate(link,"custom_title",linkTitle);
+ link = CAlignFormatUtil::MapTemplate(link,"custom_report_type",reportType);
+ link = CAlignFormatUtil::MapTemplate(link,"seqid",accession);
+ link = CAlignFormatUtil::MapTemplate(link,"custom_lnk_displ",linkText);
link = CAlignFormatUtil::MapTemplate(link,"custom_cls",linkCls);
- link = CAlignFormatUtil::MapTemplate(link,"custom_trg",linktrg);
+ link = CAlignFormatUtil::MapTemplate(link,"custom_trg",linktrg);
return link;
}
list<string> CAlignFormatUtil::GetGiLinksList(SSeqURLInfo *seqUrlInfo,
bool hspRange)
{
- list<string> customLinksList;
- if (seqUrlInfo->hasTextSeqID) {
+ list<string> customLinksList;
+ if (seqUrlInfo->hasTextSeqID) {
//First show links to GenBank and FASTA
string linkUrl,link,linkTiltle = kCustomLinkTitle;
-
+
linkUrl = seqUrlInfo->seqUrl;
if(NStr::Find(linkUrl, "report=genbank") == NPOS) { //Geo case
- linkUrl = s_MapCommonUrlParams(kEntrezTMUrl, seqUrlInfo);
+ linkUrl = s_MapCommonUrlParams(kEntrezTMUrl, seqUrlInfo);
}
string linkText = (seqUrlInfo->isDbNa) ? "GenBank" : "GenPept";
if(hspRange) {
{
//seqviewer
string dbtype = (seqUrlInfo->isDbNa) ? "nuccore" : "protein";
- string seqViewUrl = (seqUrlInfo->gi > ZERO_GI)?kSeqViewerUrl:kSeqViewerUrlNonGi;
+ string seqViewUrl = (seqUrlInfo->gi > ZERO_GI)?kSeqViewerUrl:kSeqViewerUrlNonGi;
string linkUrl = CAlignFormatUtil::MapTemplate(seqViewUrl,"rid",seqUrlInfo->rid);
string seqViewerParams;
if(m_Reg && !seqUrlInfo->blastType.empty() && seqUrlInfo->blastType != "newblast") {
- seqViewerParams = m_Reg->Get(seqUrlInfo->blastType, "SEQVIEW_PARAMS");
+ seqViewerParams = m_Reg->Get(seqUrlInfo->blastType, "SEQVIEW_PARAMS");
}
seqViewerParams = seqViewerParams.empty() ? kSeqViewerParams : seqViewerParams;
linkUrl = CAlignFormatUtil::MapTemplate(linkUrl,"seqViewerParams",seqViewerParams);
-
- linkUrl = CAlignFormatUtil::MapTemplate(linkUrl,"dbtype",dbtype);
+
+ linkUrl = CAlignFormatUtil::MapTemplate(linkUrl,"dbtype",dbtype);
linkUrl = CAlignFormatUtil::MapTemplate(linkUrl,"gi", GI_TO(TIntId, seqUrlInfo->gi));
- string linkTitle = "Show alignment to <@seqid@> in <@custom_report_type@>";
+ string linkTitle = "Show alignment to <@seqid@> in <@custom_report_type@>";
string link_loc;
if(!hspRange) {
int addToRange = (int) ((seqUrlInfo->seqRange.GetTo() - seqUrlInfo->seqRange.GetFrom()) * 0.05);//add 5% to each side
- linkUrl = CAlignFormatUtil::MapTemplate(linkUrl,"from",max(0,(int)seqUrlInfo->seqRange.GetFrom() - addToRange));
- linkUrl = CAlignFormatUtil::MapTemplate(linkUrl,"to",seqUrlInfo->seqRange.GetTo() + addToRange);
+ linkUrl = CAlignFormatUtil::MapTemplate(linkUrl,"from",max(0,(int)seqUrlInfo->seqRange.GetFrom() - addToRange));
+ linkUrl = CAlignFormatUtil::MapTemplate(linkUrl,"to",seqUrlInfo->seqRange.GetTo() + addToRange);
link_loc = "fromSubj";
- //linkUrl = CAlignFormatUtil::MapTemplate(linkUrl,"flip",NStr::BoolToString(seqUrlInfo->flip));
+ //linkUrl = CAlignFormatUtil::MapTemplate(linkUrl,"flip",NStr::BoolToString(seqUrlInfo->flip));
}
else {
link_loc = "fromHSP";
linkTitle += " for <@fromHSP@> to <@toHSP@> range";
- }
+ }
linkUrl = CAlignFormatUtil::MapTemplate(linkUrl,"link_loc",link_loc);
string title = (seqUrlInfo->isDbNa) ? "Nucleotide Graphics" : "Protein Graphics";
-
- string link = s_MapCustomLink(linkUrl,title,seqUrlInfo->accession, "Graphics","lnk" + seqUrlInfo->rid,linkTitle,"spr");
-
+
+ string link = s_MapCustomLink(linkUrl,title,seqUrlInfo->accession, "Graphics","lnk" + seqUrlInfo->rid,linkTitle,"spr");
+
return link;
}
-list<string> CAlignFormatUtil::GetSeqLinksList(SSeqURLInfo *seqUrlInfo,
+list<string> CAlignFormatUtil::GetSeqLinksList(SSeqURLInfo *seqUrlInfo,
bool hspRange)
{
- list<string> customLinksList = GetGiLinksList(seqUrlInfo,hspRange); //ONLY FOR genBank seqUrlInfo->seqUrl has "report=genbank"
+ list<string> customLinksList = GetGiLinksList(seqUrlInfo,hspRange); //ONLY FOR genBank seqUrlInfo->seqUrl has "report=genbank"
string graphicLink = GetGraphiscLink(seqUrlInfo,hspRange);
if(!graphicLink.empty()) {
customLinksList.push_back(graphicLink);
int customLinkTypes = customLinkTypesInp;
if ( seqUrlInfo->gi > ZERO_GI) {
customLinkTypes +=eLinkTypeGenLinks;
- }
+ }
//else if(NStr::StartsWith(seqUrlInfo->accession,"ti:")) {//seqUrlInfo->seqUrl has "trace.cgi"
- else if(NStr::Find(seqUrlInfo->seqUrl,"trace.cgi") != NPOS ){
+ else if(NStr::Find(seqUrlInfo->seqUrl,"trace.cgi") != NPOS ){
customLinkTypes +=eLinkTypeTraceLinks;
- }
- else if(seqUrlInfo->blastType == "sra") {//seqUrlInfo->seqUrl has sra.cgi
- customLinkTypes +=eLinkTypeSRALinks;
- }
- else if(seqUrlInfo->blastType == "snp") {//seqUrlInfo->seqUrl has snp_ref.cgi
- customLinkTypes +=eLinkTypeSNPLinks;
- }
+ }
+ else if(seqUrlInfo->blastType == "sra") {//seqUrlInfo->seqUrl has sra.cgi
+ customLinkTypes +=eLinkTypeSRALinks;
+ }
+ else if(seqUrlInfo->blastType == "snp") {//seqUrlInfo->seqUrl has snp_ref.cgi
+ customLinkTypes +=eLinkTypeSNPLinks;
+ }
else if(seqUrlInfo->blastType == "gsfasta") {//seqUrlInfo->seqUrl has GSfasta.cgi
customLinkTypes +=eLinkTypeGSFastaLinks;
- }
+ }
return customLinkTypes;
}
//<a href="<@custom_url@>" class="<@custom_cls@>" title="Show <@custom_report_type@> report for <@seqid@>"><@custom_lnk_displ@></a>
list<string> CAlignFormatUtil::GetCustomLinksList(SSeqURLInfo *seqUrlInfo,
const CSeq_id& id,
- objects::CScope &scope,
- int customLinkTypes)
-{
+ objects::CScope &scope,
+ int customLinkTypes)
+{
list<string> customLinksList;
string linkUrl,link;
customLinkTypes = SetCustomLinksTypes(seqUrlInfo, customLinkTypes);
- //First show links to GenBank and FASTA, then to Graphics
+ //First show links to GenBank and FASTA, then to Graphics
customLinksList = GetSeqLinksList(seqUrlInfo);
- if(customLinkTypes & eLinkTypeTraceLinks) {
+ if(customLinkTypes & eLinkTypeTraceLinks) {
linkUrl = seqUrlInfo->seqUrl;
link = s_MapCustomLink(linkUrl,"Trace Archive FASTA",seqUrlInfo->accession, "FASTA","lnk" + seqUrlInfo->rid);
customLinksList.push_back(link);
linkUrl = NStr::Replace(seqUrlInfo->seqUrl,"fasta","trace");
- link = s_MapCustomLink(linkUrl,"Trace Archive Trace",seqUrlInfo->accession, "Trace","lnk" + seqUrlInfo->rid);
+ link = s_MapCustomLink(linkUrl,"Trace Archive Trace",seqUrlInfo->accession, "Trace","lnk" + seqUrlInfo->rid);
customLinksList.push_back(link);
linkUrl = NStr::Replace(seqUrlInfo->seqUrl,"fasta","quality");
- link = s_MapCustomLink(linkUrl,"Trace Archive Quality",seqUrlInfo->accession, "Quality","lnk" + seqUrlInfo->rid);
+ link = s_MapCustomLink(linkUrl,"Trace Archive Quality",seqUrlInfo->accession, "Quality","lnk" + seqUrlInfo->rid);
customLinksList.push_back(link);
linkUrl = NStr::Replace(seqUrlInfo->seqUrl,"fasta","info");
- link = s_MapCustomLink(linkUrl,"Trace Archive Info",seqUrlInfo->accession, "Info","lnk" + seqUrlInfo->rid);
+ link = s_MapCustomLink(linkUrl,"Trace Archive Info",seqUrlInfo->accession, "Info","lnk" + seqUrlInfo->rid);
customLinksList.push_back(link);
- }
- else if(customLinkTypes & eLinkTypeSRALinks) {
+ }
+ else if(customLinkTypes & eLinkTypeSRALinks) {
linkUrl = seqUrlInfo->seqUrl;
link = s_MapCustomLink(linkUrl,"SRA",seqUrlInfo->accession, "SRA","lnk" + seqUrlInfo->rid);
customLinksList.push_back(link);
- }
- else if(customLinkTypes & eLinkTypeSNPLinks) {
+ }
+ else if(customLinkTypes & eLinkTypeSNPLinks) {
linkUrl = seqUrlInfo->seqUrl;
link = s_MapCustomLink(linkUrl,"SNP",seqUrlInfo->accession, "SNP","lnk" + seqUrlInfo->rid);
customLinksList.push_back(link);
-
+
//SNP accession=rs35885954
string rs = NStr::Replace(seqUrlInfo->accession,"rs","");
linkUrl = seqUrlInfo->resourcesUrl + rs + "?report=FLT";
-
+
link = s_MapCustomLink(linkUrl,"Flatfile",seqUrlInfo->accession, "Flatfile","lnk" + seqUrlInfo->rid);
customLinksList.push_back(link);
linkUrl = NStr::Replace(linkUrl,"fasta","docsum");
link = s_MapCustomLink(linkUrl,"Graphic summary ",seqUrlInfo->accession, "Graphic summary ","lnk" + seqUrlInfo->rid);
customLinksList.push_back(link);
- }
- else if(customLinkTypes & eLinkTypeGSFastaLinks) {
+ }
+ else if(customLinkTypes & eLinkTypeGSFastaLinks) {
linkUrl = seqUrlInfo->seqUrl;
link = s_MapCustomLink(linkUrl,"GSFASTA",seqUrlInfo->accession, "GSFASTA","lnk" + seqUrlInfo->rid);
customLinksList.push_back(link);
- }
- return customLinksList;
+ }
+ return customLinksList;
}
string CAlignFormatUtil::GetAlignedRegionsURL(SSeqURLInfo *seqUrlInfo,
const CSeq_id& id,
- objects::CScope &scope)
+ objects::CScope &scope)
{
const CBioseq_Handle& handle = scope.GetBioseqHandle(id);
- const CBioseq::TId* ids = &handle.GetBioseqCore()->GetId();
+ const CBioseq::TId* ids = &handle.GetBioseqCore()->GetId();
string linkUrl,link;
-
-
- linkUrl = CAlignFormatUtil::BuildUserUrl(*ids,
+
+
+ linkUrl = CAlignFormatUtil::BuildUserUrl(*ids,
ZERO_TAX_ID,
kDownloadUrl,
seqUrlInfo->database,
- seqUrlInfo->isDbNa,
+ seqUrlInfo->isDbNa,
seqUrlInfo->rid,
seqUrlInfo->queryNumber,
true);
if(!linkUrl.empty()) {
- linkUrl += "&segs="+ seqUrlInfo->segs;
- }
-
- return linkUrl;
+ linkUrl += "&segs="+ seqUrlInfo->segs;
+ }
+
+ return linkUrl;
}
string CAlignFormatUtil::GetFASTALinkURL(SSeqURLInfo *seqUrlInfo,
const CSeq_id& id,
objects::CScope &scope)
-
+
{
string linkUrl;
int customLinkTypes = SetCustomLinksTypes(seqUrlInfo, CAlignFormatUtil::eLinkTypeDefault);
-
+
if( (customLinkTypes & eLinkTypeGenLinks) || (customLinkTypes & eLinkTypeTraceLinks)){
- linkUrl = seqUrlInfo->seqUrl;
+ linkUrl = seqUrlInfo->seqUrl;
linkUrl = NStr::Replace(linkUrl,"genbank","fasta");
- }
- else if(customLinkTypes & eLinkTypeSNPLinks) {
- linkUrl = seqUrlInfo->seqUrl;
+ }
+ else if(customLinkTypes & eLinkTypeSNPLinks) {
+ linkUrl = seqUrlInfo->seqUrl;
vector<string> parts;
//SNP accession=dbSNP:rs35885954
- NStr::Split(seqUrlInfo->accession,":rs",parts,NStr::fSplit_MergeDelimiters);
+ NStr::Split(seqUrlInfo->accession,":rs",parts,NStr::fSplit_MergeDelimiters);
string rs;
if(parts.size() > 1) {
rs = parts[1];
}
- linkUrl = seqUrlInfo->resourcesUrl + rs + "?report=fasta";
- }
- return linkUrl;
-}
-
-string CAlignFormatUtil::GetGeneInfo(TGi giForGeneLookup)
-{
- string geneSym;
- try
- {
- CNcbiEnvironment env;
- if (env.Get(GENE_INFO_PATH_ENV_VARIABLE) != kEmptyStr)
- {
-
- if (m_GeneInfoReader.get() == 0)
- {
- m_GeneInfoReader.reset(new CGeneInfoFileReader(false));
- }
-
-
- CGeneInfoFileReader::TGeneInfoList infoList;
- m_GeneInfoReader->GetGeneInfoForGi(giForGeneLookup,infoList);
-
- CGeneInfoFileReader::TGeneInfoList::const_iterator itInfo = infoList.begin();
- for (; itInfo != infoList.end(); itInfo++)
- {
- CRef<CGeneInfo> info = *itInfo;
- geneSym = info->GetSymbol();
- break;//???
- }
- }
- }
- catch (CException& e)
- {
- geneSym = "(Gene info extraction error: " + e.GetMsg() + ")";
- }
- catch (...)
- {
- geneSym = "(Gene info extraction error)";
+ linkUrl = seqUrlInfo->resourcesUrl + rs + "?report=fasta";
}
- return geneSym;
+ return linkUrl;
}
-
-CAlignFormatUtil::DbType CAlignFormatUtil::GetDbType(const CSeq_align_set& actual_aln_list, CScope & scope)
+
+CAlignFormatUtil::DbType CAlignFormatUtil::GetDbType(const CSeq_align_set& actual_aln_list, CScope & scope)
{
- //determine if the database has gi by looking at the 1st hit.
+ //determine if the database has gi by looking at the 1st hit.
//Could be wrong but simple for now
DbType type = eDbTypeNotSet;
CRef<CSeq_align> first_aln = actual_aln_list.Get().front();
const CSeq_id& subject_id = first_aln->GetSeq_id(1);
-
+
if (subject_id.Which() != CSeq_id::e_Local){
const CBioseq_Handle& handleTemp = scope.GetBioseqHandle(subject_id);
if(handleTemp){
TGi giTemp = FindGi(handleTemp.GetBioseqCore()->GetId());
- if (giTemp > ZERO_GI || GetTextSeqID((CConstRef<CSeq_id>)&subject_id)) {
+ if (giTemp > ZERO_GI || GetTextSeqID((CConstRef<CSeq_id>)&subject_id)) {
type = eDbGi;
} else if (subject_id.Which() == CSeq_id::e_General){
const CDbtag& dtg = subject_id.GetGeneral();
return type;
}
-CAlignFormatUtil::SSeqAlignSetCalcParams*
+CAlignFormatUtil::SSeqAlignSetCalcParams*
CAlignFormatUtil::GetSeqAlignCalcParams(const CSeq_align& aln)
-{
+{
int score = 0;
double bits = 0;
double evalue = 0;
int sum_n = 0;
int num_ident = 0;
- list<TGi> use_this_gi;
+ list<TGi> use_this_gi;
use_this_gi.clear();
- //Gets scores directly from seq align
- GetAlnScores(aln, score, bits, evalue, sum_n,
+ //Gets scores directly from seq align
+ GetAlnScores(aln, score, bits, evalue, sum_n,
num_ident, use_this_gi);
unique_ptr<SSeqAlignSetCalcParams> seqSetInfo(new SSeqAlignSetCalcParams);
seqSetInfo->evalue = evalue;
seqSetInfo->match = num_ident;
seqSetInfo->id = &(aln.GetSeq_id(1));
- seqSetInfo->subjRange = CRange<TSeqPos>(0,0);
+ seqSetInfo->subjRange = CRange<TSeqPos>(0,0);
seqSetInfo->flip = false;
-
+
return seqSetInfo.release();
}
-CAlignFormatUtil::SSeqAlignSetCalcParams*
+CAlignFormatUtil::SSeqAlignSetCalcParams*
CAlignFormatUtil::GetSeqAlignSetCalcParams(const CSeq_align_set& aln,int queryLength, bool do_translation)
{
int score = 0;
if(aln.Get().empty())
return seqSetInfo;
- seqSetInfo = GetSeqAlignCalcParams(*(aln.Get().front()));
+ seqSetInfo = GetSeqAlignCalcParams(*(aln.Get().front()));
double total_bits = 0;
double highest_bits = 0;
int highest_ident = 0;
//int highest_identity = 0;
double totalLen = 0;
-
- list<TGi> use_this_gi; // Not used here, but needed for GetAlnScores.
-
- seqSetInfo->subjRange = CAlignFormatUtil::GetSeqAlignCoverageParams(aln,&seqSetInfo->master_covered_length,&seqSetInfo->flip);
+
+ list<TGi> use_this_gi; // Not used here, but needed for GetAlnScores.
+
+ seqSetInfo->subjRange = CAlignFormatUtil::GetSeqAlignCoverageParams(aln,&seqSetInfo->master_covered_length,&seqSetInfo->flip);
seqSetInfo->percent_coverage = 100*seqSetInfo->master_covered_length/queryLength;
ITERATE(CSeq_align_set::Tdata, iter, aln.Get()) {
int align_length = CAlignFormatUtil::GetAlignmentLength(**iter, do_translation);
totalLen += align_length;
-
- CAlignFormatUtil::GetAlnScores(**iter, score, bits, evalue, sum_n,
- num_ident, use_this_gi);
+
+ CAlignFormatUtil::GetAlnScores(**iter, score, bits, evalue, sum_n,
+ num_ident, use_this_gi);
use_this_gi.clear();
-
+
total_bits += bits;
-
+
/// IMPORTANT: based on WB-1175, the trigger for setting the highest identity
-/// is not the highest identity value, but the identity value of
+/// is not the highest identity value, but the identity value of
/// the alignment with the highest score!
///
/// if (100*num_ident/align_length > highest_identity) { -- this condition is disabled
highest_ident = num_ident;
/// highest_identity = 100*num_ident/align_length;
}
-
+
if (bits > highest_bits) {
highest_bits = bits;
lowest_evalue = evalue;
- }
+ }
}
- seqSetInfo->match = highest_ident;
- seqSetInfo->align_length = highest_length;
+ seqSetInfo->match = highest_ident;
+ seqSetInfo->align_length = highest_length;
seqSetInfo->percent_identity = CAlignFormatUtil::GetPercentIdentity(seqSetInfo->match, seqSetInfo->align_length);
-
+
seqSetInfo->total_bit_score = total_bits;
- seqSetInfo->bit_score = highest_bits;
- seqSetInfo->evalue = lowest_evalue;
- seqSetInfo->hspNum = aln.Size();
+ seqSetInfo->bit_score = highest_bits;
+ seqSetInfo->evalue = lowest_evalue;
+ seqSetInfo->hspNum = static_cast<int>(aln.Size());
seqSetInfo->totalLen = (Int8)totalLen;
return seqSetInfo;
double evalue = 0;
int sum_n = 0;
int num_ident = 0;
-
- if(aln.Get().empty())
+
+ if(aln.Get().empty())
return -1;
double highest_bits = 0;
int highest_length = 1;
int highest_ident = 0;
-
- list<TGi> use_this_gi; // Not used here, but needed for GetAlnScores.
-
+
+ list<TGi> use_this_gi; // Not used here, but needed for GetAlnScores.
+
ITERATE(CSeq_align_set::Tdata, iter, aln.Get()) {
int align_length = CAlignFormatUtil::GetAlignmentLength(**iter, do_translation);
-
- CAlignFormatUtil::GetAlnScores(**iter, score, bits, evalue, sum_n,
- num_ident, use_this_gi);
-
-
+
+ CAlignFormatUtil::GetAlnScores(**iter, score, bits, evalue, sum_n,
+ num_ident, use_this_gi);
+
+
/// IMPORTANT: based on WB-1175, the trigger for setting the highest identity
-/// is not the highest identity value, but the identity value of
+/// is not the highest identity value, but the identity value of
/// the alignment with the highest score!
///
/// if (100*num_ident/align_length > highest_identity) { -- this condition is disabled
highest_ident = num_ident;
/// highest_identity = 100*num_ident/align_length;
highest_bits = bits;
- }
+ }
}
-
- double percent_identity = CAlignFormatUtil::GetPercentIdentity(highest_ident, highest_length);
+
+ double percent_identity = CAlignFormatUtil::GetPercentIdentity(highest_ident, highest_length);
return percent_identity;
}
template<class container> bool
-s_GetBlastScore(const container& scoreList,
+s_GetBlastScore(const container& scoreList,
double& evalue,
- double& bitScore,
- double& totalBitScore,
+ double& bitScore,
+ double& totalBitScore,
int& percentCoverage,
double& percentIdent,
int& hspNum,
double& totalLen,
int &rawScore,
- int& sum_n,
+ int& sum_n,
list<TGi>& use_this_gi)
{
const string k_GiPrefix = "gi:";
bool hasScore = false;
-
+
ITERATE (typename container, iter, scoreList) {
- const CObject_id& id=(*iter)->GetId();
+ const CObject_id& id=(*iter)->GetId();
if (id.IsStr()) {
hasScore = true;
if (id.GetStr()=="seq_evalue") {
evalue = (*iter)->GetValue().GetReal();
} else if (id.GetStr()=="seq_bit_score"){
- bitScore = (*iter)->GetValue().GetReal();
+ bitScore = (*iter)->GetValue().GetReal();
} else if (id.GetStr()=="seq_total_bit_score"){
- totalBitScore = (*iter)->GetValue().GetReal();
+ totalBitScore = (*iter)->GetValue().GetReal();
} else if (id.GetStr()=="seq_percent_coverage"){
- percentCoverage = (*iter)->GetValue().GetInt();
+ percentCoverage = (*iter)->GetValue().GetInt();
} else if (id.GetStr()=="seq_percent_identity" && (*iter)->GetValue().IsInt()){
- percentIdent = (*iter)->GetValue().GetInt();
+ percentIdent = (*iter)->GetValue().GetInt();
} else if (id.GetStr()=="seq_percent_identity" && (*iter)->GetValue().IsReal()){
percentIdent = (*iter)->GetValue().GetReal();
} else if (id.GetStr()=="seq_hspnum"){
- hspNum = (*iter)->GetValue().GetInt();
+ hspNum = (*iter)->GetValue().GetInt();
} else if (id.GetStr()=="seq_align_totlen"){
totalLen = (*iter)->GetValue().GetReal();
} else if (id.GetStr()=="score"){
Uint4 gi_v = (Uint4) ((*iter)->GetValue().GetInt());
use_this_gi.push_back(GI_FROM(Uint4, gi_v));
} else if (id.GetStr()=="sum_n"){
- sum_n = (*iter)->GetValue().GetInt();
+ sum_n = (*iter)->GetValue().GetInt();
}
else if(NStr::StartsWith(id.GetStr(),k_GiPrefix)) { //will be used when switch to 64bit GIs
string strGi = NStr::Replace(id.GetStr(),k_GiPrefix,"");
TGi gi = NStr::StringToNumeric<TGi>(strGi);
use_this_gi.push_back(gi);
}
- }
+ }
}
return hasScore;
}
void CAlignFormatUtil::GetUseThisSequence(const CSeq_align& aln,list<TGi>& use_this_gi)
-
+
{
const string k_GiPrefix = "gi:";
const CUser_object &user = *(aln.GetExt().front());
if (user.IsSetType() && user.GetType().IsStr() && user.GetType().GetStr() == "use_this_seqid" && user.IsSetData()) {
- const CUser_object::TData& fields = user.GetData();
+ const CUser_object::TData& fields = user.GetData();
for (CUser_object::TData::const_iterator fit = fields.begin(); fit != fields.end(); ++fit) {
- const CUser_field& field = **fit;
+ const CUser_field& field = **fit;
- if (field.IsSetLabel() && field.GetLabel().IsStr() && field.GetLabel().GetStr() == "SEQIDS" &&
+ if (field.IsSetLabel() && field.GetLabel().IsStr() && field.GetLabel().GetStr() == "SEQIDS" &&
field.IsSetData() && field.GetData().IsStrs()) {
- const CUser_field::C_Data::TStrs& strs = field.GetData().GetStrs();
+ const CUser_field::C_Data::TStrs& strs = field.GetData().GetStrs();
ITERATE(CUser_field::TData::TStrs, acc_iter, strs) {
if(NStr::StartsWith(*acc_iter,k_GiPrefix)) { //will be used when switch to 64bit GIs
string strGi = NStr::Replace(*acc_iter,k_GiPrefix,"");
TGi gi = NStr::StringToNumeric<TGi>(strGi);
use_this_gi.push_back(gi);
- }
+ }
}
- }
+ }
}
}
}
/*use_this_seq will contain gi:nnnnnn or seqid:ssssss string list*/
void CAlignFormatUtil::GetUseThisSequence(const CSeq_align& aln,list<string>& use_this_seq)
-
+
{
if(!aln.CanGetExt() || aln.GetExt().size() == 0) return;
const CUser_object &user = *(aln.GetExt().front());
if (user.IsSetType() && user.GetType().IsStr() && user.GetType().GetStr() == "use_this_seqid" && user.IsSetData()) {
- const CUser_object::TData& fields = user.GetData();
+ const CUser_object::TData& fields = user.GetData();
for (CUser_object::TData::const_iterator fit = fields.begin(); fit != fields.end(); ++fit) {
- const CUser_field& field = **fit;
+ const CUser_field& field = **fit;
- if (field.IsSetLabel() && field.GetLabel().IsStr() && field.GetLabel().GetStr() == "SEQIDS" &&
+ if (field.IsSetLabel() && field.GetLabel().IsStr() && field.GetLabel().GetStr() == "SEQIDS" &&
field.IsSetData() && field.GetData().IsStrs()) {
- const CUser_field::C_Data::TStrs& strs = field.GetData().GetStrs();
+ const CUser_field::C_Data::TStrs& strs = field.GetData().GetStrs();
ITERATE(CUser_field::TData::TStrs, acc_iter, strs) {
use_this_seq.push_back(*acc_iter);
}
- }
+ }
}
}
}
-CAlignFormatUtil::SSeqAlignSetCalcParams*
+CAlignFormatUtil::SSeqAlignSetCalcParams*
CAlignFormatUtil::GetSeqAlignSetCalcParamsFromASN(const CSeq_align_set& alnSet)
{
- bool hasScore = false;
+ bool hasScore = false;
double evalue = -1;
double bitScore = -1;
double totalBitScore = -1;
int sum_n = -1;
list<TGi> use_this_gi;
list<string> use_this_seq;
-
- const CSeq_align& aln = *(alnSet.Get().front());
- hasScore = s_GetBlastScore(aln.GetScore(),evalue,bitScore, totalBitScore,percentCoverage,percentIdent,hspNum,totalLen,rawScore,sum_n,use_this_gi);
-
+ const CSeq_align& aln = *(alnSet.Get().front());
+
+ hasScore = s_GetBlastScore(aln.GetScore(),evalue,bitScore, totalBitScore,percentCoverage,percentIdent,hspNum,totalLen,rawScore,sum_n,use_this_gi);
+
if(!hasScore){
const CSeq_align::TSegs& seg = aln.GetSegs();
if(seg.Which() == CSeq_align::C_Segs::e_Std){
- s_GetBlastScore(seg.GetStd().front()->GetScores(),
+ s_GetBlastScore(seg.GetStd().front()->GetScores(),
evalue,bitScore, totalBitScore,percentCoverage,percentIdent,hspNum,totalLen,rawScore,sum_n,use_this_gi);
} else if (seg.Which() == CSeq_align::C_Segs::e_Dendiag){
- s_GetBlastScore(seg.GetDendiag().front()->GetScores(),
+ s_GetBlastScore(seg.GetDendiag().front()->GetScores(),
evalue,bitScore, totalBitScore,percentCoverage,percentIdent,hspNum,totalLen,rawScore,sum_n,use_this_gi);
} else if (seg.Which() == CSeq_align::C_Segs::e_Denseg){
- s_GetBlastScore(seg.GetDenseg().GetScores(),
+ s_GetBlastScore(seg.GetDenseg().GetScores(),
evalue,bitScore, totalBitScore,percentCoverage,percentIdent,hspNum,totalLen,rawScore,sum_n,use_this_gi);
}
}
unique_ptr<SSeqAlignSetCalcParams> seqSetInfo(new SSeqAlignSetCalcParams);
- seqSetInfo->evalue = evalue;
- seqSetInfo->bit_score = bitScore;
+ seqSetInfo->evalue = evalue;
+ seqSetInfo->bit_score = bitScore;
seqSetInfo->total_bit_score = totalBitScore;
seqSetInfo->percent_coverage = percentCoverage;
- seqSetInfo->percent_identity = percentIdent;
- seqSetInfo->hspNum = hspNum;
+ seqSetInfo->percent_identity = percentIdent;
+ seqSetInfo->hspNum = hspNum;
seqSetInfo->totalLen = (Int8)totalLen;
seqSetInfo->sum_n = sum_n == -1 ? 1:sum_n ;
seqSetInfo->use_this_seq = use_this_seq;
seqSetInfo->raw_score = rawScore;//not used
- seqSetInfo->subjRange = CRange<TSeqPos>(0,0);
+ seqSetInfo->subjRange = CRange<TSeqPos>(0,0);
seqSetInfo->flip = false;
return seqSetInfo.release();
const CSeq_id& aln_id,
list<TGi>& use_this_gi,
TGi& gi)
-
+
{
TTaxId taxid = ZERO_TAX_ID;
- CRef<CSeq_id> wid = CAlignFormatUtil::GetDisplayIds(handle, aln_id, use_this_gi, gi, taxid);
+ CRef<CSeq_id> wid = CAlignFormatUtil::GetDisplayIds(handle, aln_id, use_this_gi, gi, taxid);
return wid;
}
list<TGi>& use_this_gi,
TGi& gi,
TTaxId& taxid)
-
+
{
const CRef<CBlast_def_line_set> bdlRef = CSeqDB::ExtractBlastDefline(handle);
const list< CRef< CBlast_def_line > > &bdl = (bdlRef.Empty()) ? list< CRef< CBlast_def_line > >() : bdlRef->Get();
-
+
const CBioseq::TId* ids = &handle.GetBioseqCore()->GetId();
- CRef<CSeq_id> wid;
+ CRef<CSeq_id> wid;
gi = ZERO_GI;
taxid = ZERO_TAX_ID;
if(bdl.empty()){
- wid = FindBestChoice(*ids, CSeq_id::WorstRank);
- gi = FindGi(*ids);
- } else {
+ wid = FindBestChoice(*ids, CSeq_id::WorstRank);
+ gi = FindGi(*ids);
+ } else {
bool found = false;
for(list< CRef< CBlast_def_line > >::const_iterator iter = bdl.begin();
iter != bdl.end(); iter++){
const CBioseq::TId* cur_id = &((*iter)->GetSeqid());
- TGi cur_gi = FindGi(*cur_id);
+ TGi cur_gi = FindGi(*cur_id);
wid = FindBestChoice(*cur_id, CSeq_id::WorstRank);
if ((*iter)->IsSetTaxid() && (*iter)->CanGetTaxid()){
taxid = (*iter)->GetTaxid();
}
} else {
ITERATE(CBioseq::TId, iter_id, *cur_id) {
- if ((*iter_id)->Match(aln_id)
- || (aln_id.IsGeneral() && aln_id.GetGeneral().CanGetDb() &&
+ if ((*iter_id)->Match(aln_id)
+ || (aln_id.IsGeneral() && aln_id.GetGeneral().CanGetDb() &&
(*iter_id)->IsGeneral() && (*iter_id)->GetGeneral().CanGetDb() &&
aln_id.GetGeneral().GetDb() == (*iter_id)->GetGeneral().GetDb())) {
found = true;
}
}
}
- if(found){
- gi = cur_gi;
+ if(found){
+ gi = cur_gi;
break;
}
}
- }
+ }
return wid;
}
static string s_UseThisSeqToTextSeqID(string use_this_seqid, bool &isGi)
{
const string k_GiPrefix = "gi:";
- const string k_SeqIDPrefix = "seqid:";
+ const string k_SeqIDPrefix = "seqid:";
isGi = false;
string textSeqid;
- if(NStr::StartsWith(use_this_seqid,k_GiPrefix)) {
+ if(NStr::StartsWith(use_this_seqid,k_GiPrefix)) {
textSeqid = NStr::Replace(use_this_seqid,k_GiPrefix,"");
isGi = true;
}
- else if(NStr::StartsWith(use_this_seqid,k_SeqIDPrefix)) {
- textSeqid = NStr::Replace(use_this_seqid,k_SeqIDPrefix,"");
+ else if(NStr::StartsWith(use_this_seqid,k_SeqIDPrefix)) {
+ textSeqid = NStr::Replace(use_this_seqid,k_SeqIDPrefix,"");
}
- else {//assume no prefix - gi
+ else {//assume no prefix - gi
if(NStr::StringToInt8(use_this_seqid,NStr::fConvErr_NoThrow)) {
isGi = true;
}
bool CAlignFormatUtil::IsGiList(list<string> &use_this_seq)
{
bool isGi = false;
- ITERATE(list<string>, iter_seq, use_this_seq){
+ ITERATE(list<string>, iter_seq, use_this_seq){
s_UseThisSeqToTextSeqID( *iter_seq, isGi);
break;
}
list<TGi> CAlignFormatUtil::StringGiToNumGiList(list<string> &use_this_seq)
{
list<TGi> use_this_gi;
- ITERATE(list<string>, iter_seq, use_this_seq){
+ ITERATE(list<string>, iter_seq, use_this_seq){
bool isGi = false;
string strGI = s_UseThisSeqToTextSeqID( *iter_seq, isGi);
- if(isGi) use_this_gi.push_back(NStr::StringToNumeric<TGi>(strGI));
- }
+ if(isGi) use_this_gi.push_back(NStr::StringToNumeric<TGi>(strGI));
+ }
return use_this_gi;
}
bool CAlignFormatUtil::MatchSeqInSeqList(TGi cur_gi, CRef<CSeq_id> &seqID, list<string> &use_this_seq,bool *isGiList)
{
bool found = false;
- bool isGi = false;
+ bool isGi = false;
string curSeqID = CAlignFormatUtil::GetLabel(seqID,true); //uses GetSeqIdString(true)
- ITERATE(list<string>, iter_seq, use_this_seq){
+ ITERATE(list<string>, iter_seq, use_this_seq){
isGi = false;
string useThisSeq = s_UseThisSeqToTextSeqID(*iter_seq, isGi);
if((isGi && cur_gi == NStr::StringToNumeric<TGi>((useThisSeq))) || (!isGi && curSeqID == useThisSeq)){
- found = true;
+ found = true;
break;
}
}
bool CAlignFormatUtil::MatchSeqInSeqList(CConstRef<CSeq_id> &alnSeqID, list<string> &use_this_seq,vector <string> &seqList)
{
- bool isGi = false;
+ bool isGi = false;
string curSeqID;
if(alnSeqID->IsGi()) {
curSeqID = NStr::NumericToString(alnSeqID->GetGi());
bool found = std::find(seqList.begin(), seqList.end(), curSeqID) != seqList.end();
if(!found) {
//match in use_this_seq list
- ITERATE(list<string>, iter_seq, use_this_seq){
- string useThisSeq = s_UseThisSeqToTextSeqID(*iter_seq, isGi);
+ ITERATE(list<string>, iter_seq, use_this_seq){
+ string useThisSeq = s_UseThisSeqToTextSeqID(*iter_seq, isGi);
found = std::find(seqList.begin(), seqList.end(), useThisSeq) != seqList.end();
- if(found){
+ if(found){
break;
}
}
- }
+ }
return found;
}
bool CAlignFormatUtil::MatchSeqInUseThisSeqList(list<string> &use_this_seq, string textSeqIDToMatch)
{
bool has_match = false;
-
- ITERATE(list<string>, iter_seq, use_this_seq) {
+
+ ITERATE(list<string>, iter_seq, use_this_seq) {
bool isGi;
- string useThisSeq = s_UseThisSeqToTextSeqID(*iter_seq, isGi);
+ string useThisSeq = s_UseThisSeqToTextSeqID(*iter_seq, isGi);
if(useThisSeq == textSeqIDToMatch) {
has_match = true;
break;
bool hasAccType = false;
bool isGI = false;
- ITERATE(list<string>, iter_seq, use_this_seq) {
- string useThisSeq = s_UseThisSeqToTextSeqID(*iter_seq, isGI);
- CSeq_id::EAccessionInfo useThisSeqAccType = CSeq_id::IdentifyAccession (useThisSeq);
- if(useThisSeqAccType != accessionType) {
- new_use_this_seq.push_back(useThisSeq);
- }
+ ITERATE(list<string>, iter_seq, use_this_seq) {
+ string useThisSeq = s_UseThisSeqToTextSeqID(*iter_seq, isGI);
+ CSeq_id::EAccessionInfo useThisSeqAccType = CSeq_id::IdentifyAccession (useThisSeq);
+ if(useThisSeqAccType != accessionType) {
+ new_use_this_seq.push_back(useThisSeq);
+ }
else {
hasAccType = true;
- }
- }
+ }
+ }
use_this_seq = new_use_this_seq;
return hasAccType;
}
CRef<CSeq_id> CAlignFormatUtil::GetDisplayIds(const CBioseq_Handle& handle,
const CSeq_id& aln_id,
list<string>& use_this_seq,
- TGi *gi,
+ TGi *gi,
TTaxId *taxid,
string *textSeqID)
-
+
{
const CRef<CBlast_def_line_set> bdlRef = CSeqDB::ExtractBlastDefline(handle);
const list< CRef< CBlast_def_line > > &bdl = (bdlRef.Empty()) ? list< CRef< CBlast_def_line > >() : bdlRef->Get();
-
+
const CBioseq::TId* ids = &handle.GetBioseqCore()->GetId();
- CRef<CSeq_id> wid;
+ CRef<CSeq_id> wid;
if(gi) *gi = ZERO_GI;
if(taxid) *taxid = ZERO_TAX_ID;
if(bdl.empty()){
- wid = FindBestChoice(*ids, CSeq_id::WorstRank);
- if(gi) *gi = FindGi(*ids);
+ wid = FindBestChoice(*ids, CSeq_id::WorstRank);
+ if(gi) *gi = FindGi(*ids);
if(textSeqID) *textSeqID = GetLabel(wid,true);//uses GetSeqIdString(true)
- } else {
+ } else {
bool found = false;
for(list< CRef< CBlast_def_line > >::const_iterator iter = bdl.begin();
iter != bdl.end(); iter++){
const CBioseq::TId* cur_id = &((*iter)->GetSeqid());
- TGi cur_gi = FindGi(*cur_id);
+ TGi cur_gi = FindGi(*cur_id);
wid = FindBestChoice(*cur_id, CSeq_id::WorstRank);
string curSeqID = GetLabel(wid,true);//uses GetSeqIdString(true)
if (taxid && (*iter)->IsSetTaxid() && (*iter)->CanGetTaxid()){
*taxid = (*iter)->GetTaxid();
}
if (!use_this_seq.empty()) {
- ITERATE(list<string>, iter_seq, use_this_seq){
+ ITERATE(list<string>, iter_seq, use_this_seq){
bool isGi = false;
string useThisSeq = s_UseThisSeqToTextSeqID( *iter_seq, isGi);
if((isGi && cur_gi == NStr::StringToNumeric<TGi>((useThisSeq))) || (!isGi && curSeqID == useThisSeq)){
}
} else {
ITERATE(CBioseq::TId, iter_id, *cur_id) {
- if ((*iter_id)->Match(aln_id)
- || (aln_id.IsGeneral() && aln_id.GetGeneral().CanGetDb() &&
+ if ((*iter_id)->Match(aln_id)
+ || (aln_id.IsGeneral() && aln_id.GetGeneral().CanGetDb() &&
(*iter_id)->IsGeneral() && (*iter_id)->GetGeneral().CanGetDb() &&
aln_id.GetGeneral().GetDb() == (*iter_id)->GetGeneral().GetDb())) {
found = true;
}
}
}
- if(found){
- if(gi) *gi = cur_gi;
+ if(found){
+ if(gi) *gi = cur_gi;
if(textSeqID) *textSeqID = curSeqID;
break;
}
}
}
-
+
return wid;
}
TGi CAlignFormatUtil::GetDisplayIds(const list< CRef< CBlast_def_line > > &bdl,
const CSeq_id& aln_id,
list<TGi>& use_this_gi)
-
-
+
+
{
TGi gi = ZERO_GI;
-
- if(!bdl.empty()){
+
+ if(!bdl.empty()){
bool found = false;
for(list< CRef< CBlast_def_line > >::const_iterator iter = bdl.begin();
iter != bdl.end(); iter++){
const CBioseq::TId* cur_id = &((*iter)->GetSeqid());
- TGi cur_gi = FindGi(*cur_id);
+ TGi cur_gi = FindGi(*cur_id);
if (!use_this_gi.empty()) {
ITERATE(list<TGi>, iter_gi, use_this_gi){
if(cur_gi == *iter_gi){
}
} else {
ITERATE(CBioseq::TId, iter_id, *cur_id) {
- if ((*iter_id)->Match(aln_id)
- || (aln_id.IsGeneral() && aln_id.GetGeneral().CanGetDb() &&
+ if ((*iter_id)->Match(aln_id)
+ || (aln_id.IsGeneral() && aln_id.GetGeneral().CanGetDb() &&
(*iter_id)->IsGeneral() && (*iter_id)->GetGeneral().CanGetDb() &&
aln_id.GetGeneral().GetDb() == (*iter_id)->GetGeneral().GetDb())) {
found = true;
}
}
}
- if(found){
- gi = cur_gi;
+ if(found){
+ gi = cur_gi;
break;
}
}
- }
+ }
return gi;
}
///@param choice: id of choice
///@return: the id with specified type
///
-static CRef<CSeq_id> s_GetSeqIdByType(const list<CRef<CSeq_id> >& ids,
+static CRef<CSeq_id> s_GetSeqIdByType(const list<CRef<CSeq_id> >& ids,
CSeq_id::E_Choice choice)
{
CRef<CSeq_id> cid;
-
- for (CBioseq::TId::const_iterator iter = ids.begin(); iter != ids.end();
+
+ for (CBioseq::TId::const_iterator iter = ids.begin(); iter != ids.end();
iter ++){
if ((*iter)->Which() == choice){
cid = *iter;
break;
}
}
-
+
return cid;
}
string CAlignFormatUtil::GetBareId(const CSeq_id& id)
{
- string retval;
+ string retval;
if (id.IsGi() || id.IsPrf() || id.IsPir()) {
retval = id.AsFastaString();
bool CAlignFormatUtil::GetTextSeqID(CConstRef<CSeq_id> seqID, string *textSeqID)
{
bool hasTextSeqID = true;
-
+
const CTextseq_id* text_id = seqID->GetTextseq_Id();
//returns non zero if e_Genbank,e_Embl,e_Ddbj,e_Pir,e_Swissprot,case e_Other,e_Prf,case e_Tpg,e_Tpe,case e_Tpd,case e_Gpipe, e_Named_annot_track
if(!text_id) { //check for pdb and pat
}
CRef<CSeq_align_set> CAlignFormatUtil::FilterSeqalignBySeqList(CSeq_align_set& source_aln,
- vector <string> &seqList)
+ vector <string> &seqList)
{
- CConstRef<CSeq_id> previous_id, subid;
+ CConstRef<CSeq_id> previous_id, subid;
list<string> use_this_seq;
bool match = false;
CRef<CSeq_align_set> new_aln(new CSeq_align_set);
- ITERATE(CSeq_align_set::Tdata, iter, source_aln.Get()){
+ ITERATE(CSeq_align_set::Tdata, iter, source_aln.Get()){
subid = &((*iter)->GetSeq_id(1));
- if(previous_id.Empty() || !subid->Match(*previous_id)){
+ if(previous_id.Empty() || !subid->Match(*previous_id)){
use_this_seq.clear();
- CAlignFormatUtil::GetUseThisSequence(**iter,use_this_seq);
- match = MatchSeqInSeqList(subid, use_this_seq,seqList);
+ CAlignFormatUtil::GetUseThisSequence(**iter,use_this_seq);
+ match = MatchSeqInSeqList(subid, use_this_seq,seqList);
}
- previous_id = subid;
+ previous_id = subid;
if(match) {
new_aln->Set().push_back(*iter);
}
- }
+ }
return new_aln;
}
-/* $Id: showalign.cpp 664020 2023-03-06 18:09:11Z jianye $
+/* $Id: showalign.cpp 683951 2024-06-10 12:11:41Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
feat_strand)));
}
}
- CGenetic_code gc;
- CRef<CGenetic_code::C_E> ce(new CGenetic_code::C_E);
- ce->Select(CGenetic_code::C_E::e_Id);
- ce->SetId(genetic_code);
- gc.Set().push_back(ce);
- isolated_loc.SetPartialStart(true, eExtreme_Biological);
- isolated_loc.SetPartialStop (true, eExtreme_Biological);
- CSeqTranslator::Translate(isolated_loc, handle.GetScope(),
- raw_cdr_product, &gc);
-
+ if (genetic_code > 0) {
+ CGenetic_code gc;
+ CRef<CGenetic_code::C_E> ce(new CGenetic_code::C_E);
+ ce->Select(CGenetic_code::C_E::e_Id);
+ ce->SetId(genetic_code);
+ gc.Set().push_back(ce);
+ isolated_loc.SetPartialStart(true, eExtreme_Biological);
+ isolated_loc.SetPartialStop (true, eExtreme_Biological);
+ CSeqTranslator::Translate(isolated_loc, handle.GetScope(),
+ raw_cdr_product, &gc);
+ }
}
return raw_cdr_product;
}
x_SetFeatureInfo(master_featInfo, *master_loc, 0, m_AV->GetAlnStop(),
m_AV->GetAlnStop(), ' ',
- " ", master_feat);
+ " ", master_feat, -1);
retval[0].push_back(master_featInfo);
x_SetFeatureInfo(subject_featInfo, *subject_loc, 0, m_AV->GetAlnStop(),
m_AV->GetAlnStop(), ' ',
- " ", subject_feat);
+ " ", subject_feat, -1);
retval[1].push_back(subject_featInfo);
if(m_AlignOption & eShowCdsFeature){
TGi master_gi = FindGi(m_AV->GetBioseqHandle(0).
GetBioseqCore()->GetId());
- x_GetFeatureInfo(bioseqFeature[row], *m_featScope,
+ x_GetFeatureInfo(bioseqFeature[row], -1, *m_featScope,
CSeqFeatData::e_Cdregion, row, sequence[row],
feat_seq_range, feat_seq_strand,
row == 1 && !(master_gi > ZERO_GI) ? true : false);
CRef<CScope> master_scope_with_feat =
s_MakeNewMasterSeq(feat_seq_range, feat_seq_strand,
m_AV->GetBioseqHandle(0));
+ int custom_genetic_code = -1;
+ NON_CONST_ITERATE(CDisplaySeqalign::TSAlnFeatureInfoList, iter_feat, bioseqFeature[1]) {
+ if ((*iter_feat)->genetic_code > 0) {
+ custom_genetic_code = (*iter_feat)->genetic_code;
+ break;
+ }
+ }
+
//make feature string for master bioseq
list<list<CRange<TSeqPos> > > temp_holder;
- x_GetFeatureInfo(bioseqFeature[0], *master_scope_with_feat,
+ x_GetFeatureInfo(bioseqFeature[0], custom_genetic_code, *master_scope_with_feat,
CSeqFeatData::e_Cdregion, 0, sequence[0],
temp_holder, feat_seq_strand, false);
}
}
if(m_AlignOption & eShowGeneFeature){
- x_GetFeatureInfo(bioseqFeature[row], *m_featScope,
+ x_GetFeatureInfo(bioseqFeature[row], -1, *m_featScope,
CSeqFeatData::e_Gene, row, sequence[row],
feat_seq_range, feat_seq_strand, false);
}
}
catch (const CException & e) {
ERR_POST("Problem with linkoutdb: " + e.GetMsg());
+ cerr << "[BLAST FORMATTER EXCEPTION] Problem with linkoutdb: " << e.GetMsg() << endl;
m_AlignOption &= ~eLinkout; //Remove linkout bit for the rest of sequences
linkout = 0;
}
}
}
-
int CDisplaySeqalign::x_GetNumGaps()
{
int gap = 0;
- for (int row=0; row<m_AV->GetNumRows(); row++) {
- CRef<CAlnMap::CAlnChunkVec> chunk_vec
- = m_AV->GetAlnChunks(row, m_AV->GetSeqAlnRange(0));
- for (int i=0; i<chunk_vec->size(); i++) {
- CConstRef<CAlnMap::CAlnChunk> chunk = (*chunk_vec)[i];
- if (chunk->IsGap()) {
- gap += (chunk->GetAlnRange().GetTo()
+ if (m_SeqalignSetRef->Get().front()->CanGetType() &&
+ m_SeqalignSetRef->Get().front()->GetType() == CSeq_align_Base::eType_global)
+ {
+ for (int row=0; row<m_AV->GetNumRows(); row++) {
+ // The row/antirow dance makes sure that we count gaps at the end of a global alignment.
+ // Only two rows for a global (NW) alignment
+ int antirow=1;
+ if (row == 1)
+ antirow = 0;
+ CRef<CAlnMap::CAlnChunkVec> chunk_vec
+ = m_AV->GetAlnChunks(row, m_AV->GetSeqAlnRange(antirow));
+ for (int i=0; i<chunk_vec->size(); i++) {
+ CConstRef<CAlnMap::CAlnChunk> chunk = (*chunk_vec)[i];
+ if (chunk->IsGap()) {
+ gap += (chunk->GetAlnRange().GetTo()
- chunk->GetAlnRange().GetFrom() + 1);
- }
- }
+ }
+ }
+ }
+ }
+ else
+ {
+ for (int row=0; row<m_AV->GetNumRows(); row++) {
+ CRef<CAlnMap::CAlnChunkVec> chunk_vec
+ = m_AV->GetAlnChunks(row, m_AV->GetSeqAlnRange(0));
+ for (int i=0; i<chunk_vec->size(); i++) {
+ CConstRef<CAlnMap::CAlnChunk> chunk = (*chunk_vec)[i];
+ if (chunk->IsGap()) {
+ gap += (chunk->GetAlnRange().GetTo()
+ - chunk->GetAlnRange().GetFrom() + 1);
+ }
+ }
+ }
}
return gap;
}
-
void CDisplaySeqalign::x_GetFeatureInfo(TSAlnFeatureInfoList& feature,
+ int custom_genetic_code,
CScope& scope,
CSeqFeatData::E_Choice choice,
int row, string& sequence,
actual_feat_seq_stop =
max(feat_seq_range.GetFrom(), seq_stop);
}
+ int genetic_code = -1;
//the feature alignment positions
feat_aln_from =
m_AV->GetAlnPosFromSeqPos(row, actual_feat_seq_start);
} else if(choice == CSeqFeatData::e_Cdregion){
string raw_cdr_product =
- s_GetCdsSequence(m_SlaveGeneticCode, feat, scope,
+ s_GetCdsSequence(custom_genetic_code > 0? custom_genetic_code:m_SlaveGeneticCode, feat, scope,
isolated_range, handle, feat_strand,
featId, other_seqloc_length%3 == 0 ?
0 : 3 - other_seqloc_length%3,
mix_loc);
+ if (feat->IsSetData() && feat->GetData().IsCdregion() && feat->GetData().GetCdregion().IsSetCode()) {
+ genetic_code = feat->GetData().GetCdregion().GetCode().GetId();
+ }
if(raw_cdr_product == NcbiEmptyString){
continue;
}
if(featInfo){
x_SetFeatureInfo(featInfo, *loc_ref,
feat_aln_from, feat_aln_to, aln_stop,
- feat_char, featId, alternativeFeatStr);
+ feat_char, featId, alternativeFeatStr, genetic_code);
feature.push_back(featInfo);
}
}
const CSeq_loc& seqloc, int aln_from,
int aln_to, int aln_stop,
char pattern_char, string pattern_id,
- string& alternative_feat_str) const
+ string& alternative_feat_str,
+ int genetic_code) const
{
CRef<FeatureInfo> feat(new FeatureInfo);
feat->seqloc = &seqloc;
feat->feature_char = pattern_char;
feat->feature_id = pattern_id;
-
+
if(alternative_feat_str != NcbiEmptyString){
feat_info->feature_string = alternative_feat_str;
} else {
}
feat_info->feature_string = line;
}
-
+ feat_info->genetic_code = genetic_code;
feat_info->aln_range.Set(aln_from, aln_to);
feat_info->feature = feat;
}
}
-bool CDisplaySeqalign::x_IsGeneInfoAvailable(SAlnInfo* aln_vec_info)
-{
- const CBioseq_Handle& bsp_handle =
- aln_vec_info->alnvec->GetBioseqHandle(1);
- if (bsp_handle &&
- (m_AlignOption&eHtml) &&
- (m_AlignOption&eLinkout) &&
- (m_AlignOption&eShowGeneInfo))
- {
- CNcbiEnvironment env;
- if (env.Get(GENE_INFO_PATH_ENV_VARIABLE) == kEmptyStr)
- {
- return false;
- }
-
- const CRef<CBlast_def_line_set> bdlRef
- = CSeqDB::ExtractBlastDefline(bsp_handle);
- const list< CRef< CBlast_def_line > > &bdl = (bdlRef.Empty()) ? list< CRef< CBlast_def_line > >() : bdlRef->Get();
-
- ITERATE(CBlast_def_line_set::Tdata, iter, bdl)
- {
- int linkout = x_GetLinkout(*(*iter)->GetSeqid().front());
- if (linkout & eGene)
- {
- return true;
- }
- }
- }
- return false;
-}
-
string CDisplaySeqalign::x_GetGeneLinkUrl(int gene_id)
{
-string CDisplaySeqalign::x_DisplayGeneInfo(const CBioseq_Handle& bsp_handle,SAlnInfo* aln_vec_info)
-{
- CNcbiOstrstream out;
- try
- {
- if (x_IsGeneInfoAvailable(aln_vec_info))
- {
- if (m_GeneInfoReader.get() == 0)
- {
- m_GeneInfoReader.reset(new CGeneInfoFileReader(false));
- }
-
- TGi giForGeneLookup = FindGi(bsp_handle.GetBioseqCore()->GetId());
-
- CGeneInfoFileReader::TGeneInfoList infoList;
- m_GeneInfoReader->GetGeneInfoForGi(giForGeneLookup,infoList);
-
- CGeneInfoFileReader::TGeneInfoList::const_iterator
- itInfo = infoList.begin();
- if (itInfo != infoList.end())
- out << "\n";
- for (; itInfo != infoList.end(); itInfo++)
- {
- CRef<CGeneInfo> info = *itInfo;
- string strUrl = x_GetGeneLinkUrl(info->GetGeneId());
- string strInfo;
- info->ToString(strInfo, true, strUrl);
- out << strInfo << "\n";
- }
- }
- }
- catch (CException& e)
- {
- out << "(Gene info extraction error: "
- << e.GetMsg() << ")" << "\n";
- }
- catch (...)
- {
- out << "(Gene info extraction error)" << "\n";
- }
- string formattedString = CNcbiOstrstreamToString(out);
- return formattedString;
-}
void CDisplaySeqalign::x_DisplayAlignSortInfo(CNcbiOstream& out,string id_label)
{
if(!(m_AlignOption & eShowNoDeflineInfo)){
//1. Display defline(s),Gene info
string deflines = x_PrintDefLine(bsp_handle, aln_vec_info);
- out<< deflines;
- //2. Format Gene info
- string geneInfo = x_DisplayGeneInfo(bsp_handle,aln_vec_info);
- out<< geneInfo;
+ out<< deflines;
}
if((m_AlignOption&eHtml) && (m_AlignOption&eShowBlastInfo)
if(show_defline) {
const CBioseq_Handle& bsp_handle=m_AV->GetBioseqHandle(1);
//1. Display defline(s),Gene info
- string alignHeader = x_FormatDefLinesHeader(bsp_handle, aln_vec_info);
- /**2. Format Gene info
- string geneInfo = x_DisplayGeneInfo(bsp_handle,aln_vec_info);
- alignHeader = CAlignFormatUtil::MapTemplate(alignHeader,"aln_gene_info",geneInfo); **/
+ string alignHeader = x_FormatDefLinesHeader(bsp_handle, aln_vec_info);
if(sortOneAln.empty()) {
out<< alignHeader;
if (alnTo - alnFrom >= 0){
x_SetFeatureInfo(featInfo, *((*iter)->seqloc), alnFrom,
alnTo, aln_stop, (*iter)->feature_char,
- (*iter)->feature_id, tempFeat);
+ (*iter)->feature_id, tempFeat, -1);
retval[i].push_back(featInfo);
}
}
(CSeq_loc::TPoint) aln_stop));
x_SetFeatureInfo(featInfo, *(seqloc), 0,
aln_stop, aln_stop, ' ',
- " ", final_domain);
+ " ", final_domain, -1);
retval[0].push_back(featInfo);
}
}
|| (m_AlignOption & eHtml && m_AlignOption & eShowBlastInfo)))) {
/*need to construct segs for dumpgnl and
get sub-sequence for long sequences*/
-
+
+ string idString, prevIdString,prevIdStringWithVersion,idStringWithVersion;
for (CSeq_align_set::Tdata::const_iterator
iter = actual_aln_list.Get().begin();
iter != actual_aln_list.Get().end()
CConstRef<CSeq_id> subid;
subid = &((*iter)->GetSeq_id(1));
- string idString = subid->GetSeqIdString();
-
- x_CalcUrlLinksParams(**iter,idString,toolUrl);//sets m_AlnLinksParams->segs,hspNum, subjRange
- }
+
+ idString = subid->GetSeqIdString();
+ idStringWithVersion = subid->GetSeqIdString(true);
+ if(!prevIdString.empty() && !prevIdStringWithVersion.empty() && prevIdString == idString && prevIdStringWithVersion != idStringWithVersion) {
+ continue;
+ }
+ x_CalcUrlLinksParams(**iter,idString,toolUrl);//sets m_AlnLinksParams->segs,hspNum, subjRange
+ prevIdStringWithVersion = idStringWithVersion;
+ prevIdString = idString;
+ }
}
}
-/* $Id: showdefline.cpp 648700 2022-04-20 14:14:52Z zaretska $
+/* $Id: showdefline.cpp 683931 2024-06-10 12:08:07Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
}
subid = &((*iter)->GetSeq_id(1));
if(is_first_aln || (!is_first_aln && !subid->Match(*previous_id))) {
- SScoreInfo* sci = x_GetScoreInfo(**iter, num_align);
+ SScoreInfo* sci = x_GetScoreInfo(**iter, static_cast<int>(num_align));
if(sci){
m_ScoreList.push_back(sci);
if(m_MaxScoreLen < sci->bit_string.size()){
--- /dev/null
+{
+ "version": "1.2",
+ "dbname": "tabular_db",
+ "dbtype": "Protein",
+ "db-version": 5,
+ "description": "All non-redundant GenBank CDS translations+PDB+SwissProt+PIR+PRF excluding environmental samples from WGS projects",
+ "number-of-letters": 1344,
+ "number-of-sequences": 10,
+ "last-updated": "2023-12-05T16:42:00",
+ "number-of-volumes": 1,
+ "number-of-taxids": 15,
+ "bytes-total": 56641,
+ "bytes-to-cache": 1635,
+ "files": [
+ "tabular_db.pdb",
+ "tabular_db.phr",
+ "tabular_db.pin",
+ "tabular_db.pog",
+ "tabular_db.pos",
+ "tabular_db.pot",
+ "tabular_db.ppd",
+ "tabular_db.ppi",
+ "tabular_db.psq",
+ "tabular_db.ptf",
+ "tabular_db.pto"
+ ]
+}
-/* $Id: tabularinof_unit_test.cpp 672591 2023-09-11 18:10:14Z ivanov $
+/* $Id: tabularinof_unit_test.cpp 676159 2023-12-11 14:55:46Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
const list<CRef<CSeq_align> > & seqalign_list = sa->Get();
- const string kDbName("nr");
+ const string kDbName("data/tabular_db");
const CBlastDbDataLoader::EDbType kDbType(CBlastDbDataLoader::eProtein);
TestUtil::CBlastOM tmp_data_loader(kDbName, kDbType, CBlastOM::eLocal);
CRef<CScope> scope = tmp_data_loader.NewScope();
const list<CRef<CSeq_align> > & seqalign_list = sa->Get();
- const string kDbName("nr");
+ const string kDbName("data/tabular_db");
const CBlastDbDataLoader::EDbType kDbType(CBlastDbDataLoader::eProtein);
TestUtil::CBlastOM tmp_data_loader(kDbName, kDbType, CBlastOM::eLocal);
CRef<CScope> scope = tmp_data_loader.NewScope();
const string ref[5] = {
"O19910,NP_045082,phycocyanin alpha subunit [Cyanidium caldarium]<>RecName: Full=C-phycocyanin alpha subunit [Cyanidium caldarium]",
"O19910,AAB01593,cpcA [Cyanidium caldarium]",
- "O19910,P00306,RecName: Full=C-phycocyanin alpha chain [Galdieria sulphuraria]<>C-phycocyanin alpha chain [validated] - red alga (Cyanidium caldarium) [Cyanidium caldarium]<>phycocyanin alpha subunits [Cyanidium caldarium]<>Structure Of Phycocyanin From Cyanidium Caldarium At 1.65a Resolution [Cyanidium caldarium]",
+ "O19910,P00306,RecName: Full=C-phycocyanin alpha chain [Galdieria sulphuraria]<>C-phycocyanin alpha chain [validated] - red alga (Cyanidium caldarium) [Cyanidium caldarium]<>phycocyanin alpha subunits [Cyanidium caldarium]<>Chain A, Phycocyanin [Cyanidium caldarium]",
"O19910,YP_009051179,phycocyanin alpha subunit [Galdieria sulphuraria]<>[pt] C-phycocyanin alpha chain [Galdieria sulphuraria]<>Chain A, C-phycocyanin alpha chain [unidentified]<>Chain A, C-phycocyanin alpha chain [Galdieria sulphuraria]<>phycocyanin alpha subunit [Galdieria sulphuraria]<>[pt] C-phycocyanin alpha chain [Galdieria sulphuraria]",
"O19910,YP_009297463,phycocyanin alpha subunit [Erythrotrichia carnea]<>phycocyanin alpha subunit [Erythrotrichia carnea]"};
for(unsigned int i=0; i < 5; i++) {
-/* $Id: blastdb_dataextract.cpp 636490 2021-08-25 14:16:34Z fongah2 $
+/* $Id: blastdb_dataextract.cpp 683929 2024-06-10 12:07:52Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
}
if (m_Strand == eNa_strand_minus) {
CSeqManip::ReverseComplement(seq, CSeqUtil::e_Iupacna,
- 0, seq.size());
+ 0, static_cast<ncbi::TSeqPos>(seq.size()));
}
} catch (CSeqDBException& e) {
//FIXME: change the enumeration when it's availble
string CBlastDBExtractor::ExtractHash() {
string seq;
m_BlastDb.GetSequenceAsString(m_Oid, seq);
- return NStr::IntToString(CBlastSeqUtil::GetSeqHash(seq.c_str(), seq.size()));
+ return NStr::IntToString(CBlastSeqUtil::GetSeqHash(seq.c_str(), static_cast<ncbi::TSeqPos>(seq.size())));
}
#define CTRL_A "\001"
void CBlastSeqUtil::GetReverseStrandSeq(string & seq)
{
- CSeqManip::ReverseComplement(seq, CSeqUtil::e_Iupacna, 0, seq.size());
+ CSeqManip::ReverseComplement(seq, CSeqUtil::e_Iupacna, 0, static_cast<ncbi::TSeqPos>(seq.size()));
}
string CBlastSeqUtil::GetMasksString(const CSeqDB::TSequenceRanges & masks)
-/* $Id: gene_info.cpp 523368 2017-01-03 13:12:11Z madden $
+/* $Id: gene_info.cpp 683929 2024-06-10 12:07:52Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
strGeneIdSection += "</a>";
}
- unsigned int nGeneIdSectionLength = k_strGeneIdBegin.length() +
+ unsigned int nGeneIdSectionLength = static_cast<unsigned int>(k_strGeneIdBegin.length() +
strGeneId.length() + 1 +
- strGeneSymbol.length();
+ strGeneSymbol.length());
x_Append(strGeneInfo, nCurLineEffLength,
strGeneIdSection, nGeneIdSectionLength,
nMaxLineLength);
string strSeparator = "|";
x_Append(strGeneInfo, nCurLineEffLength,
- strSeparator, strSeparator.length(),
+ strSeparator, static_cast<unsigned int>(strSeparator.length()),
nMaxLineLength);
// Append Gene description. It can be pretty long, split it into
{
string strCurWord = strDescrWords[iWord];
x_Append(strGeneInfo, nCurLineEffLength,
- strCurWord, strCurWord.length(),
+ strCurWord, static_cast<unsigned int>(strCurWord.length()),
nMaxLineLength);
}
string strOrgName = "[" + GetOrganismName() + "]";
x_Append(strGeneInfo, nCurLineEffLength,
- strOrgName, strOrgName.length(),
+ strOrgName, static_cast<unsigned int>(strOrgName.length()),
nMaxLineLength);
// Append the estimated number of pubmed links (if requested)
}
}
- int nPMEffLength = strNumPubMedLinks.length();
+ int nPMEffLength = static_cast<int>(strNumPubMedLinks.length());
if (nPMEffLength > 0)
{
if (bFormatAsHTML)
-/* $Id: gene_info_reader.cpp 628650 2021-04-05 12:32:17Z grichenk $
+/* $Id: gene_info_reader.cpp 683929 2024-06-10 12:07:52Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
{
if (pMemFile != 0)
{
- nRecs = pMemFile->GetSize() / (sizeof(TRecordType));
+ nRecs = static_cast<int>(pMemFile->GetSize() / (sizeof(TRecordType)));
if (nRecs > 0)
{
pRecs = (TRecordType*)(pMemFile->GetPtr());
-/* $Id: seqdb.cpp 654652 2022-08-18 16:44:30Z fongah2 $
+/* $Id: seqdb.cpp 683929 2024-06-10 12:07:52Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
vector<string> extn;
const bool is_protein(GetSequenceType() == CSeqDB::eProtein);
SeqDB_GetFileExtensions(is_protein, extn, GetBlastDbVersion());
+ string blastdb_dirname;
ITERATE(vector<string>, path, paths) {
ITERATE(vector<string>, ext, extn) {
Int8 length = file.GetLength();
if (length != -1) {
retval += length;
+ LOG_POST(Trace << "File " << file.GetPath() << " " << length << " bytes");
+ blastdb_dirname = file.GetDir();
+ } else {
+ ERR_POST(Error << "Error retrieving file size for "
+ << file.GetPath());
+ }
+ }
+ }
+ }
+ // For multi-volume databases, take into account files that apply to the
+ // entire BLASTDB
+ if (paths.size() > 1) {
+ _ASSERT( !blastdb_dirname.empty() );
+ auto dbname = GetDBNameList();
+ vector<string> dblist;
+ NStr::Split(dbname, " ", dblist, NStr::fSplit_Tokenize);
+ if (dblist.size() > 1) {
+ CNcbiOstrstream oss;
+ oss << "Cannot compute disk usage for multiple BLASTDBs (i.e.: '"
+ << dbname << "') at once. Please try again using one BLASTDB "
+ << "at a time.";
+ NCBI_THROW(CSeqDBException, eArgErr, CNcbiOstrstreamToString(oss));
+ }
+
+ for (const auto& ext: extn) {
+ CFile file(CDirEntry::MakePath(blastdb_dirname, dbname, ext));
+ if (file.Exists()) {
+ Int8 length = file.GetLength();
+ if (length != -1) {
+ retval += length;
+ LOG_POST(Trace << "File " << file.GetPath() << " " << length << " bytes");
} else {
ERR_POST(Error << "Error retrieving file size for "
<< file.GetPath());
vector<string> dblist;
NStr::Split(GetDBNameList(), " ", dblist, NStr::fSplit_Tokenize);
NON_CONST_ITERATE(vector<string>, itr, dblist) {
- int off = (*itr).find_last_of(CFile::GetPathSeparator());
- if (off != -1) {
+ size_t off = (*itr).find_last_of(CFile::GetPathSeparator());
+ if (off != string::npos ) {
(*itr).erase(0, off+1);
}
}
set<TTaxId> tax_ids;
GetDBTaxIds(tax_ids);
if((tax_ids.size() > 1) || ((tax_ids.size() == 1) && (0 != *tax_ids.begin()))){
- m->SetNumber_of_taxids(tax_ids.size());
+ m->SetNumber_of_taxids(static_cast<int>(tax_ids.size()));
}
}
return m;
-/* $Id: seqdbblob.cpp 500404 2016-05-04 14:59:01Z camacho $
+/* $Id: seqdbblob.cpp 683929 2024-06-10 12:07:52Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
} else {
// end
rv = (rv << 6) | (ch & 0x3F);
- *offsetp = i+1;
+ *offsetp = static_cast<int>(i+1);
return (ch & 0x40) ? -rv : rv;
}
if (fmt == eSize4) {
sz = x_ReadIntFixed<int,4>(offsetp);
} else if (fmt == eSizeVar) {
- sz = x_ReadVarInt(offsetp);
+ sz = static_cast<int>( x_ReadVarInt(offsetp));
}
const char * datap = "";
for(size_t i = *offsetp; i < ts.size(); i++) {
if (ts[i] == (char)0) {
- zoffset = i;
+ zoffset = static_cast<int>(i);
break;
}
}
int start_off = offsetp ? *offsetp : m_WriteOffset;
if (fmt == eSize4) {
- x_WriteIntFixed<int,4>(str.size(), offsetp);
+ x_WriteIntFixed<int,4>(static_cast<int>(str.size()), offsetp);
} else if (fmt == eSizeVar) {
x_WriteVarInt(str.size(), offsetp);
}
- x_WriteRaw(str.data(), str.size(), offsetp);
+ x_WriteRaw(str.data(),static_cast<int>( str.size()), offsetp);
if (fmt == eNUL) {
char buf = 0;
_ASSERT(! m_DataHere.size());
if (total < (int)m_DataRef.size()) {
- total = m_DataRef.size();
+ total = static_cast<int>(m_DataRef.size());
}
m_Owner = true;
if (! m_Owner) {
x_Copy(need);
} else {
- int cur_cap = m_DataHere.capacity();
+ int cur_cap = static_cast<int>(m_DataHere.capacity());
if (cur_cap < need) {
// Skip the first few reallocations.
int CBlastDbBlob::Size() const
{
if (m_Owner) {
- return m_DataHere.size();
+ return static_cast<int>(m_DataHere.size());
}
- return m_DataRef.size();
+ return static_cast<int>(m_DataRef.size());
}
CTempString CBlastDbBlob::Str() const
-/* $Id: seqdbimpl.cpp 654652 2022-08-18 16:44:30Z fongah2 $
+/* $Id: seqdbimpl.cpp 683929 2024-06-10 12:07:52Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
if (m_NumThreads) {
SSeqResBuffer * buffer = m_CachedSeqs[cacheID];
x_FillSeqBuffer(buffer, begin_chunk);
- end_chunk = begin_chunk + buffer->results.size();
+ end_chunk = begin_chunk + static_cast<int>(buffer->results.size());
} else {
end_chunk = begin_chunk + oid_size;
}
if (found) {
CRef<CSeqDB_ColumnEntry> obj(new CSeqDB_ColumnEntry(vol_ids));
- col_id = m_ColumnInfo.size();
+ col_id = static_cast<int>(m_ColumnInfo.size());
m_ColumnInfo.push_back(obj);
} else {
col_id = kColumnNotFound;
m_CachedSeqs.push_back(new SSeqResBuffer());
}
- for(int vol_idx = 0; vol_idx < m_VolSet.GetNumVols(); vol_idx++) {
- m_VolSet.GetVol(vol_idx)->OpenSeqFile(locked);
- }
- //m_Atlas.SetSliceSize();
-
} else if (num_threads < m_NumThreads) {
for (int thread = num_threads; thread < m_NumThreads; ++thread) {
-/* $Id: seqdbisam.cpp 626985 2021-03-08 13:57:13Z fongah2 $
+/* $Id: seqdbisam.cpp 683929 2024-06-10 12:07:52Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
bool is_version = false;
if (pos != string::npos) {
- int ver_len = acc.size() - pos - 1;
+ int ver_len = static_cast<int>(acc.size() - pos) - 1;
is_version = (ver_len <= 3 && ver_len >= 1);
*
*/
#include <ncbi_pch.hpp>
+#include <corelib/ncbifile.hpp>
#include "seqdblmdbset.hpp"
}
}
if(rv.size() == 0) {
- NCBI_THROW(CSeqDBException, eTaxidErr, "Taxonomy ID(s) not found. This could be because the ID(s) provided are not at or below the species level. Please use get_species_taxids.sh to get taxids for nodes higher than species (see https://www.ncbi.nlm.nih.gov/books/NBK546209/).");
+ NCBI_THROW(CSeqDBException, eTaxidErr, "Taxonomy ID(s) not found in the " + GetDBFileNames() + " database" + (m_LMDBEntrySet.size()>1?"s":"")+ ".");
}
tax_ids.swap(rv_tax_ids);
}
}
}
if(rv.size() == 0) {
- NCBI_THROW(CSeqDBException, eTaxidErr, "Taxonomy ID(s) not found.Taxonomy ID(s) not found. This could be because the ID(s) provided are not at or below the species level. Please use get_species_taxids.sh to get taxids for nodes higher than species (see https://www.ncbi.nlm.nih.gov/books/NBK546209/).");
+ LOG_POST(Warning << "Taxonomy ID(s) not found in the " + GetDBFileNames() + " database" + (m_LMDBEntrySet.size()>1?"s":"")+ ".");
}
tax_ids.swap(rv_tax_ids);
lmdb_list.push_back(m_LMDBEntrySet[i]->GetLMDBFileName());
}
}
+// get list of LMDB files for each BLAST DB w/o extentions.
+// This is basically approximation for a list of opened databases after resolving aliases.
+// default: with_dir_path == false. return w/o leading pathes.
+string CSeqDBLMDBSet::GetDBFileNames( bool with_dir_path ) const
+{
+ string actual_db_list;
+ for(unsigned int i=0; i < m_LMDBEntrySet.size(); i++) {
+ string full_name = m_LMDBEntrySet[i]->GetLMDBFileName();
+ string short_name , dir_part, out_name;
+ CDirEntry::SplitPath( full_name, &dir_part , &short_name , 0 );
+ //
+ if( with_dir_path ) {
+ out_name = dir_part + short_name ;
+ }
+ else {
+ out_name = short_name;
+ }
+ if( !actual_db_list.empty() ) actual_db_list.append(" ");
+ actual_db_list.append( out_name ) ;
+ }
+ return actual_db_list ;
+}
END_NCBI_SCOPE
void GetLMDBFileNames(vector<string> & lmdb_list) const;
+ std::string GetDBFileNames(bool with_dir_path = false ) const;
+
private:
vector<CRef<CSeqDBLMDBEntry> > m_LMDBEntrySet;
-/* $Id: seqdboidlist.cpp 651939 2022-06-28 12:33:29Z fongah2 $
+/* $Id: seqdboidlist.cpp 683929 2024-06-10 12:07:52Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
// Step 1: Compute the bitmap representing the filtering done by
// all subnodes. This is a "union".
- int vols = ft->GetVolumes().size();
+ int vols = static_cast<int>(ft->GetVolumes().size());
_ASSERT(vols || ft->GetNodes().size());
#ifndef OBJTOOLS_READERS_SEQDB__SEQDBOIDLIST_HPP
#define OBJTOOLS_READERS_SEQDB__SEQDBOIDLIST_HPP
-/* $Id: seqdboidlist.hpp 578711 2019-01-24 15:40:06Z fongah2 $
+/* $Id: seqdboidlist.hpp 683929 2024-06-10 12:07:52Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
size_t bit = next_oid;
bool found = m_AllBits->CheckOrFindBit(bit);
- next_oid = bit;
+ next_oid = static_cast<int>(bit);
_ASSERT(size_t(next_oid) == bit);
return found;
-/* $Id: seqdbtax.cpp 621548 2020-12-14 18:07:01Z grichenk $
+/* $Id: seqdbtax.cpp 683533 2024-05-30 12:54:51Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
m_DataFileSize(0),
m_MissingDB(false)
{
+ try {
// It is reasonable for this database to not exist.
m_IndexFN = SeqDB_ResolveDbPath("taxdb.bti");
m_DataPtr = (char *) (m_DataFileMap->GetPtr());
m_DataFileSize = m_DataFileMap->GetSize();
m_IndexPtr = (CSeqDBTaxId*) magic_num_ptr;
-
+ }
+ catch (const std::exception& e) {
+ string err_msg = e.what();
+ if (err_msg.find("Too many open files") == std::string::npos ) {
+ NCBI_THROW(CSeqDBException, eFileErr, e.what());
+ }
+ else {
+ NCBI_THROW(CSeqDBException, eOpenFileErr, e.what());
+ }
+ }
}
CTaxDBFileInfo::~CTaxDBFileInfo()
-/* $Id: seqdbvol.cpp 651939 2022-06-28 12:33:29Z fongah2 $
+/* $Id: seqdbvol.cpp 683929 2024-06-10 12:07:52Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
{
if (user_list) {
m_UserGiList.Reset(user_list);
- m_OidMaskType = m_UserGiList->GetMaskOpts();
+ m_OidMaskType = static_cast<int>(m_UserGiList->GetMaskOpts());
}
if (neg_list) {
m_NegativeList.Reset(neg_list);
}
- int num_ranges = partial_ranges->size();
+ int num_ranges = static_cast<int>(partial_ranges->size());
if ((*partial_ranges)[num_ranges - 1].second > base_length) {
NCBI_THROW(CSeqDBException, eFileErr, "Error: region beyond sequence range.");
}
const char * seq_buffer = sequence.data();
- int whole_bytes = sequence.length() - 1;
+ int whole_bytes = static_cast<int>(sequence.length()) - 1;
int remainder = sequence[whole_bytes] & 3;
int base_length = (whole_bytes * 4) + remainder;
for(size_t i = 0; i < m_Columns.size(); i++) {
if (m_Columns[i]->GetTitle() == title) {
- return i;
+ return static_cast<int>(i);
}
}
CMemoryFile in(file);
CSeqidlistRead list(in);
list.GetListInfo(list_info);
- return list_info.num_ids;
+ return static_cast<int>(list_info.num_ids);
}
-/* $Id: tax4blastsqlite.cpp 673642 2023-10-05 19:23:19Z ivanov $
+/* $Id: tax4blastsqlite.cpp 683950 2024-06-10 12:11:31Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
/// @author Christiam Camacho
/// Implementation for the CTaxonomy4BlastSQLite class
-#ifndef SKIP_DOXYGEN_PROCESSING
-static char const rcsid[] = "$Id: tax4blastsqlite.cpp 673642 2023-10-05 19:23:19Z ivanov $";
-#endif /* SKIP_DOXYGEN_PROCESSING */
-
#include <ncbi_pch.hpp>
#include <corelib/ncbitime.hpp>
#include <objtools/blast/seqdb_reader/seqdbcommon.hpp>
# subdirectory
# Author: Kevin Bealer
# Original date: 10/21/2005
-# $URL: https://svn.ncbi.nlm.nih.gov/repos/toolkit/release/blast/2.15.0/c++/src/objtools/blast/seqdb_writer/build-alias-index $
+# $URL: https://svn.ncbi.nlm.nih.gov/repos/toolkit/release/blast/2.16.0/c++/src/objtools/blast/seqdb_writer/build-alias-index $
INDEX_NAME=index.alx
OUTNAME=index.alx.new
-/* $Id: build_db.cpp 662402 2023-01-30 14:32:39Z madden $
+/* $Id: build_db.cpp 675078 2023-11-14 13:36:47Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
bool add_pig)
{
CRef<CBlast_def_line_set> headers =
- CWriteDB::ExtractBioseqDeflines(*bs, m_ParseIDs, m_LongIDs);
+ CWriteDB::ExtractBioseqDeflines(*bs, m_ParseIDs, m_LongIDs,
+ m_ScanBioseq4CFastaReaderUsrObjct);
x_EditHeaders(headers);
bool long_seqids,
EBlastDbVersion dbver,
bool limit_defline,
- Uint8 oid_masks)
+ Uint8 oid_masks,
+ bool scan_bioseq_4_cfastareader_usrobj)
: m_IsProtein (is_protein),
m_KeepLinks (false),
m_KeepMbits (false),
m_FoundMatchingMasks(false),
m_SkipCopyingGis(false),
m_SkipLargeGis(true),
- m_OutputDbName(kEmptyStr)
+ m_OutputDbName(kEmptyStr),
+ m_ScanBioseq4CFastaReaderUsrObjct(scan_bioseq_4_cfastareader_usrobj)
{
CreateDirectories(dbname);
const string output_dbname = CDirEntry::CreateAbsolutePath(dbname);
bool long_seqids,
EBlastDbVersion dbver,
bool limit_defline,
- Uint8 oid_masks)
+ Uint8 oid_masks,
+ bool scan_bioseq_4_cfastareader_usrobj)
: m_IsProtein (is_protein),
m_KeepLinks (false),
m_KeepMbits (false),
m_LongIDs (long_seqids),
m_FoundMatchingMasks(false),
m_SkipCopyingGis(false),
- m_SkipLargeGis(true)
+ m_SkipLargeGis(true),
+ m_ScanBioseq4CFastaReaderUsrObjct(scan_bioseq_4_cfastareader_usrobj)
{
CreateDirectories(dbname);
const string output_dbname = CDirEntry::CreateAbsolutePath(dbname);
use_gi_mask,
dbver,
limit_defline,
- oid_masks));
+ oid_masks,
+ scan_bioseq_4_cfastareader_usrobj));
// Standard 1 GB limit
-/* $Id: writedb_unit_test.cpp 627687 2021-03-17 14:25:53Z fongah2 $
+/* $Id: writedb_unit_test.cpp 675078 2023-11-14 13:36:47Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
// Prefer BOOST_REQUIRE_EQUAL(a, b) over BOOST_REQUIRE(a == b).
// The former will print the non-equal values for you, the latter
// does not.
- BOOST_REQUIRE_EQUAL(bdls->Get().size(), 2);
+ BOOST_REQUIRE_EQUAL(bdls->Get().size(), 1);
BOOST_REQUIRE_EQUAL(bdls->Get().front()->GetTitle(), T1);
BOOST_REQUIRE_EQUAL(bdls->Get().front()->GetSeqid().size(), 1);
BOOST_REQUIRE_EQUAL(bdls->Get().front()->GetSeqid().front()->AsFastaString(), I1);
-
- BOOST_REQUIRE_EQUAL(bdls->Get().back()->GetTitle(), T2);
- BOOST_REQUIRE_EQUAL(bdls->Get().back()->GetSeqid().size(), 1);
- BOOST_REQUIRE_EQUAL(bdls->Get().back()->GetSeqid().front()->AsFastaString(), I2);
}
s_WrapUpFiles(files);
-/* $Id: writedb.cpp 651876 2022-06-27 15:12:50Z fongah2 $
+/* $Id: writedb.cpp 683943 2024-06-10 12:10:21Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
bool use_gi_mask,
EBlastDbVersion dbver,
bool limit_defline,
- Uint8 oid_masks)
+ Uint8 oid_masks,
+ bool scan_bioseq_4_cfastareader_usrobj)
: m_Impl(0)
{
m_Impl = new CWriteDB_Impl(dbname,
CRef<CBlast_def_line_set>
CWriteDB::ExtractBioseqDeflines(const CBioseq & bs, bool parse_ids,
- bool long_ids)
+ bool long_ids,
+ bool scan_bioseq_4_cfastareader_usrobj)
{
- return CWriteDB_Impl::ExtractBioseqDeflines(bs, parse_ids, long_ids);
+ return CWriteDB_Impl::ExtractBioseqDeflines(bs, parse_ids, long_ids, scan_bioseq_4_cfastareader_usrobj);
}
void CWriteDB::SetMaskedLetters(const string & masked)
const string& title,
EAliasFileFilterType alias_type /*= eGiList*/)
{
- vector<string> db(1, db_name);
+ vector<string> db;
+ NStr::Split(db_name," ",db);
CWriteDB_CreateAliasFile(file_name, db, seq_type, gi_file_name, title,
alias_type);
}
-/* $Id: writedb_impl.cpp 649164 2022-04-28 11:08:55Z fongah2 $
+/* $Id: writedb_impl.cpp 675078 2023-11-14 13:36:47Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
bool use_gi_mask,
EBlastDbVersion dbver,
bool limit_defline,
- Uint8 oid_masks)
+ Uint8 oid_masks,
+ bool scan_bioseq_4_cfastareader_usrobj)
: m_Dbname (dbname),
m_Protein (protein),
m_Title (title),
m_LongSeqId (long_ids),
m_LmdbOid (0),
m_limitDefline (protein? limit_defline: false),
- m_OidMasks (oid_masks)
+ m_OidMasks (oid_masks),
+ m_ScanBioseq4CFastaReaderUsrObjct(scan_bioseq_4_cfastareader_usrobj)
{
CTime now(CTime::eCurrent);
int OID,
bool parse_ids,
bool long_ids,
- bool limit_defline)
+ bool limit_defline,
+ bool scan_bioseq_4_cfastareader_usrobj)
{
bool use_bin = (deflines.Empty() && pig == 0);
pig,
false,
parse_ids,
- long_ids);
+ long_ids,
+ scan_bioseq_4_cfastareader_usrobj);
} catch ( const CSeqIdException&e ) {
//LOG_POST(Info << "x_GetFastaReaderDeflines " << e.GetMsg() );
}
OID,
m_ParseIDs,
m_LongSeqId,
- m_limitDefline);
+ m_limitDefline,
+ m_ScanBioseq4CFastaReaderUsrObjct);
x_CookIds();
}
CRef<CBlast_def_line_set>
CWriteDB_Impl::ExtractBioseqDeflines(const CBioseq & bs, bool parse_ids,
- bool long_seqids)
+ bool long_seqids,
+ bool scan_bioseq_4_cfastareader_usrobj)
{
// Get information
string binary_header;
vector< vector<int> > v1, v2;
set<TTaxId> t;
+ const bool kLimitDefline = false;
CConstRef<CBioseq> bsref(& bs);
x_ExtractDeflines(bsref, deflines, binary_header, v2, v2, 0, t, -1, parse_ids,
- long_seqids);
+ long_seqids, kLimitDefline, scan_bioseq_4_cfastareader_usrobj);
// Convert to return type
int pig,
bool accept_gt,
bool parse_ids,
- bool long_seqids)
+ bool long_seqids,
+ bool scan_bioseq_4_cfastareader_usrobj)
{
if (! bioseq.CanGetDescr()) {
return;
// Scan the CBioseq for the CFastaReader user object.
- ITERATE(list< CRef< CSeqdesc > >, iter, bioseq.GetDescr().Get()) {
- const CSeqdesc & desc = **iter;
+ if (scan_bioseq_4_cfastareader_usrobj) {
+ ITERATE(list< CRef< CSeqdesc > >, iter, bioseq.GetDescr().Get()) {
+ const CSeqdesc & desc = **iter;
+
+ if (desc.IsUser() &&
+ desc.GetUser().CanGetType() &&
+ desc.GetUser().GetType().IsStr() &&
+ desc.GetUser().GetType().GetStr() == "CFastaReader" &&
+ desc.GetUser().CanGetData()) {
+
+ const vector< CRef< CUser_field > > & D = desc.GetUser().GetData();
+
+ ITERATE(vector< CRef< CUser_field > >, iter, D) {
+ const CUser_field & f = **iter;
- if (desc.IsUser() &&
- desc.GetUser().CanGetType() &&
- desc.GetUser().GetType().IsStr() &&
- desc.GetUser().GetType().GetStr() == "CFastaReader" &&
- desc.GetUser().CanGetData()) {
-
- const vector< CRef< CUser_field > > & D = desc.GetUser().GetData();
-
- ITERATE(vector< CRef< CUser_field > >, iter, D) {
- const CUser_field & f = **iter;
-
- if (f.CanGetLabel() &&
- f.GetLabel().IsStr() &&
- f.GetLabel().GetStr() == "DefLine" &&
- f.CanGetData() &&
- f.GetData().IsStr()) {
- fasta = NStr::Replace(f.GetData().GetStr(), "\\t", TAB_REPLACEMENT);
- fasta = NStr::ParseEscapes(fasta);
- break;
+ if (f.CanGetLabel() &&
+ f.GetLabel().IsStr() &&
+ f.GetLabel().GetStr() == "DefLine" &&
+ f.CanGetData() &&
+ f.GetData().IsStr()) {
+ fasta = NStr::Replace(f.GetData().GetStr(), "\\t", TAB_REPLACEMENT);
+ fasta = NStr::ParseEscapes(fasta);
+ break;
+ }
}
}
}
- }
+ }
if (fasta.empty())
return;
#ifndef OBJTOOLS_WRITERS_WRITEDB__WRITEDB_IMPL_HPP
#define OBJTOOLS_WRITERS_WRITEDB__WRITEDB_IMPL_HPP
-/* $Id: writedb_impl.hpp 649924 2022-05-12 15:50:24Z fongah2 $
+/* $Id: writedb_impl.hpp 675078 2023-11-14 13:36:47Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
/// @param long_ids If true, assume long sequence ids (database|accession)
/// when parsing strings ids
/// @param use_gi_mask If true generate GI-based mask files.
+ /// @param scan_bioseq_4_cfastareader_usrobj [in]
+ /// If true, scan the Bioseq objects for a CFastaReader-created User-object
+ /// containing a defline
CWriteDB_Impl(const string & dbname,
bool protein,
const string & title,
bool use_gi_mask,
EBlastDbVersion dbver = eBDB_Version4,
bool limit_defline = false,
- Uint8 oid_masks = EOidMaskType::fNone);
+ Uint8 oid_masks = EOidMaskType::fNone,
+ bool scan_bioseq_4_cfastareader_usrobj = false);
/// Destructor.
~CWriteDB_Impl();
/// @param bs Bioseq from which to construct the defline set.
/// @param parse_ids If we should parse seq_ids.
/// @param long_seqids If true use long sequence ids (database|accession)
+ /// @param scan_bioseq_4_cfastareader_usrobj [in]
+ /// If true, scan the Bioseq objects for a CFastaReader-created User-object
+ /// containing a defline
/// @return The blast defline set.
static CRef<CBlast_def_line_set>
- ExtractBioseqDeflines(const CBioseq & bs, bool parse_ids, bool long_seqids);
+ ExtractBioseqDeflines(const CBioseq & bs, bool parse_ids, bool long_seqids,
+ bool scan_bioseq_4_cfastareader_usrobj = false);
/// Set bases that should not be used in sequences.
///
/// @param parse_ids Whether seq_id should not be parsed. [in]
/// @param long_seqids If true, use long sequence ids (database|accession)
/// [in]
+ /// @param scan_bioseq_4_cfastareader_usrobj if true, scan the Bioseq objects for a [in]
static void
x_GetFastaReaderDeflines(const CBioseq & bioseq,
CConstRef<CBlast_def_line_set> & deflines,
int pig,
bool accept_gt,
bool parse_ids,
- bool long_seqids);
+ bool long_seqids,
+ bool scan_bioseq_4_cfastareader_usrobj = false);
/// Returns true if we have unwritten sequence data.
bool x_HaveSequence() const;
int OID=-1,
bool parse_ids=true,
bool long_seqid=false,
- bool limit_defline = false);
+ bool limit_defline = false,
+ bool scan_bioseq_4_cfastareader_usrobj = false);
/// Compute the hash of a (raw) sequence.
///
bool m_limitDefline;
Uint8 m_OidMasks;
+
+ bool m_ScanBioseq4CFastaReaderUsrObjct;
};
END_NCBI_SCOPE
-# $Id: CMakeLists.cleanup.lib.txt 660856 2022-12-28 16:24:42Z foleyjp $
+# $Id: CMakeLists.cleanup.lib.txt 680750 2024-03-27 13:48:22Z ivanov $
NCBI_begin_lib(xcleanup)
NCBI_sources(
autogenerated_cleanup autogenerated_extended_cleanup cleanup
cleanup_utils gene_qual_normalization cleanup_user_object cleanup_author
cleanup_pub newcleanupp capitalization_string fix_feature_id
- cleanup_message huge_file_cleanup influenza_set
+ cleanup_message influenza_set
)
NCBI_uses_toolkit_libraries(xobjedit)
NCBI_project_watchers(stakhovv kans)
-# $Id: Makefile.cleanup.lib 660856 2022-12-28 16:24:42Z foleyjp $
+# $Id: Makefile.cleanup.lib 680750 2024-03-27 13:48:22Z ivanov $
# Build library "xcleanup"
###############################
SRC = autogenerated_cleanup autogenerated_extended_cleanup cleanup \
cleanup_utils gene_qual_normalization cleanup_user_object cleanup_author \
cleanup_pub newcleanupp capitalization_string fix_feature_id \
- cleanup_message huge_file_cleanup influenza_set
+ cleanup_message influenza_set
DLL_LIB = $(OBJEDIT_LIBS) xregexp $(PCRE_LIB)
LIB = xcleanup
-/* $Id: autogenerated_cleanup.cpp 671826 2023-08-24 19:41:26Z ivanov $
+/* $Id: autogenerated_cleanup.cpp 675103 2023-11-14 19:31:19Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
m_NewCleanup.x_DecodeXMLMarkChanged( arg0 );
m_NewCleanup.x_CleanupStringJunkMarkChanged( arg0 );
m_NewCleanup.x_RemoveSpacesBetweenTildesMarkChanged( arg0 );
- m_NewCleanup.X_CommentTildeFixes( arg0 );
} // end of x_BasicCleanupDescComment
void CAutogeneratedCleanup::x_BasicCleanupEMBLBlock( CEMBL_block & arg0 )
-/* $Id: autogenerated_extended_cleanup.cpp 671840 2023-08-24 20:00:40Z ivanov $
+/* $Id: autogenerated_extended_cleanup.cpp 675103 2023-11-14 19:31:19Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
m_NewCleanup.CdRegionEC( arg0 );
m_NewCleanup.MoveDbxrefs( arg0 );
m_NewCleanup.MoveStandardName( arg0 );
- m_NewCleanup.CreatePubFromFeat( arg0 );
m_NewCleanup.ResynchProteinPartials( arg0 );
m_NewCleanup.x_MoveSeqfeatOrgToSourceOrg( arg0 );
if( arg0.IsSetData() ) {
-/* $Id: capitalization_string.cpp 663485 2023-02-22 15:30:43Z asztalos $
+/* $Id: capitalization_string.cpp 681619 2024-04-11 12:27:56Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
typedef CStaticPairArrayMap<const char*, const char*, PCase_CStr> TCStringPairsMap;
DEFINE_STATIC_ARRAY_MAP(TCStringPairsMap,k_state_abbrev, map_state_to_abbrev);
+MAKE_CONST_MAP(Canada_map_state_to_abbrev, ct::tagStrNocase, ct::tagStrNocase,
+{
+ { "alberta", "AB"},
+ { "british columbia", "BC"},
+ { "manitoba", "MB"},
+ { "new brunswick", "NB"},
+ { "newfoundland and labrador", "NL"},
+ { "northwest territories", "NT"},
+ { "nova scotia", "NS"},
+ { "nunavut", "NU"},
+ { "ontario", "ON"},
+ { "prince edward island", "PE"},
+ { "quebec", "QC"},
+ { "saskatchewan", "SK"},
+ { "yukon", "YT"}
+});
+
+
static const SStaticPair<const char*, const char*> set_short_words[] =
{
{"\\bA\\b", "a" },
NStr::ToUpper(state);
}
+void GetCanadaStateAbbreviation(string& state)
+{
+ NStr::ReplaceInPlace(state, " ", " ");
+ NStr::TruncateSpacesInPlace(state);
+ auto found = Canada_map_state_to_abbrev.find(state);
+ if (found != Canada_map_state_to_abbrev.end())
+ state = found->second;
+ else
+ NStr::ToUpper(state);
+}
+
bool FixStateAbbreviationsInCitSub(CCit_sub& sub)
{
bool modified = false;
-/* $Id: cleanup.cpp 671837 2023-08-24 19:42:54Z ivanov $
+/* $Id: cleanup.cpp 681442 2024-04-09 14:53:56Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
#include <objtools/logging/listener.hpp>
-#include "influenza_set.hpp"
+#include <objtools/cleanup/influenza_set.hpp>
BEGIN_NCBI_SCOPE
BEGIN_SCOPE(objects)
return m_Changes;
}
-
-vector<string> CCleanupChangeCore::GetAllDescriptions() const
-{
- vector<string> result;
- result.reserve(m_Changes.size());
- for (auto it: m_Changes) {
- result.push_back( string( GetDescription(it) ) );
- }
- return result;
-}
-
vector<string_view> CCleanupChangeCore::GetDescriptions() const
{
- vector<string_view> result;
+ vector<string_view> result;
result.reserve(m_Changes.size());
- for (auto it: m_Changes) {
- result.push_back( GetDescription(it) );
+ for (auto it : m_Changes) {
+ result.push_back(GetDescription(it));
}
return result;
}
}
-const string& CCleanup::GetProteinName(const CSeq_feat& cds, CScope& scope)
-{
- if (cds.IsSetProduct()) {
- CBioseq_Handle prot = scope.GetBioseqHandle(cds.GetProduct());
- if (prot) {
- CFeat_CI f(prot, CSeqFeatData::eSubtype_prot);
- if (f) {
- return GetProteinName(f->GetData().GetProt());
- }
- }
- }
-
- return s_GetProteinNameFromXrefOrQual(cds);
-}
-
-
bool CCleanup::SetCDSPartialsByFrameAndTranslation(CSeq_feat& cds, CScope& scope)
{
bool any_change = false;
}
if (need_label && NStr::IsBlank(label)) {
// create unique label
- (*it)->GetLabel(&label, CPub::eContent, true);
+ (*it)->GetLabel(&label, CPub::eContent, CPub::fLabel_Unique);
string auth_str;
s_GetAuthorsString(&auth_str, pd);
label += "; ";
{ "#8710", "delta" },
{ "#64257", "fi" },
{ "#64258", "fl" },
- { "#65292", "," }
+ { "#65292", "," },
};
// Collisions should be rare enough that the CFastMutex is
// the searcher at the same time.
static CFastMutex searcher_mtx;
CFastMutexGuard searcher_mtx_guard( searcher_mtx );
- if( ! searcher.IsPrimed() ) {
- for( int idx = 0;
- idx < sizeof(transformations)/sizeof(transformations[0]);
- ++idx )
- {
+ if (! searcher.IsPrimed()) {
+ for (unsigned idx = 0; idx < ArraySize(transformations); ++idx) {
// match type is index into transformations array
- searcher.AddWord( transformations[idx].src_word, idx );
+ searcher.AddWord(transformations[idx].src_word, idx);
}
searcher.Prime();
}
len++;
}
if (len != 0) {
- protein_letter = ValidAminoAcid(str.substr(aa_pos, len));
+ protein_letter = x_ValidAminoAcid(str.substr(aa_pos, len));
}
}
CAutoDef::RegenerateSequenceDefLines(seh);
}
+
+char CCleanup::ValidAminoAcid(string_view abbrev)
+{
+ return x_ValidAminoAcid(abbrev);
+}
+
END_SCOPE(objects)
END_NCBI_SCOPE
-/* $Id: cleanup_utils.cpp 642578 2021-12-22 19:48:06Z stakhovv $
+/* $Id: cleanup_utils.cpp 681442 2024-04-09 14:53:56Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
// while we're at it, also check if the junk contains a tilde and/or period
bool isPeriod = false;
bool isTilde = false;
- int start_of_junk_pos = str.length() - 1;
+ int start_of_junk_pos = (int)str.length() - 1;
for( ; start_of_junk_pos >= 0 ; --start_of_junk_pos ) {
const char ch = str[start_of_junk_pos];
if (ch <= ' ' || ch == '.' || ch == ',' || ch == '~' || ch == ';') {
// holds the suffix to add after we remove the junk
const char * suffix = ""; // by default, just remove junk
- const int chars_in_junk = ( str.length() - start_of_junk_pos );
+ const int chars_in_junk = ( (int)str.length() - start_of_junk_pos );
_ASSERT( chars_in_junk >= 1 );
// allow one period at end
if (isPeriod) {
curr = *in;
in++;
- next = 0;
two_chars = curr;
while (curr != '\0') {
// or three-letter abbreviation.
// Use X if the abbreviation is not found.
-char ValidAminoAcid (const string& abbrev)
+char x_ValidAminoAcid(string_view abbrev)
{
- char ch = 'X';
-
- for (unsigned int k = 0; k < sizeof(abbreviation_list) / sizeof (ProteinAbbrevData); k++) {
- if (NStr::EqualNocase (abbrev, abbreviation_list[k].abbreviation)) {
- ch = abbreviation_list[k].letter;
- break;
+ if (abbrev.length() >= 3) {
+ for (unsigned k = 0; k < ArraySize(abbreviation_list); ++k) {
+ if (NStr::EqualNocase(abbrev, abbreviation_list[k].abbreviation)) {
+ return abbreviation_list[k].letter;
+ }
}
}
if (abbrev.length() == 1) {
- for (unsigned int k = 0; k < sizeof(abbreviation_list) / sizeof (ProteinAbbrevData); k++) {
- if (abbrev.c_str()[0] == abbreviation_list[k].letter) {
- ch = abbreviation_list[k].letter;
- break;
+ for (unsigned k = 0; k < ArraySize(abbreviation_list); ++k) {
+ if (abbrev[0] == abbreviation_list[k].letter) {
+ return abbreviation_list[k].letter;
}
}
}
- return ch;
+ return 'X';
}
#ifndef OBJECTS_GENERAL___CLEANUP_UTILS__HPP
#define OBJECTS_GENERAL___CLEANUP_UTILS__HPP
-/* $Id: cleanup_utils.hpp 630406 2021-05-02 16:29:58Z stakhovv $
+/* $Id: cleanup_utils.hpp 681442 2024-04-09 14:53:56Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
CRef<CSeq_loc> ReadLocFromText(const string& text, const CSeq_id *id, CScope *scope);
// for finding the correct amino acid letter given an abbreviation
-char NCBI_CLEANUP_EXPORT ValidAminoAcid (const string& abbrev);
+char x_ValidAminoAcid(string_view abbrev);
// for sorting and uniquing dbtags
bool s_DbtagCompare (const CRef<CDbtag>& dbt1, const CRef<CDbtag>& dbt2);
+++ /dev/null
-/* $Id: huge_file_cleanup.cpp 664176 2023-03-08 20:23:24Z foleyjp $
-* ===========================================================================
-*
-* PUBLIC DOMAIN NOTICE
-* National Center for Biotechnology Information
-*
-* This software/database is a "United States Government Work" under the
-* terms of the United States Copyright Act. It was written as part of
-* the author's official duties as a United States Government employee and
-* thus cannot be copyrighted. This software/database is freely available
-* to the public for use. The National Library of Medicine and the U.S.
-* Government have not placed any restriction on its use or reproduction.
-*
-* Although all reasonable efforts have been taken to ensure the accuracy
-* and reliability of the software and data, the NLM and the U.S.
-* Government do not and cannot warrant the performance or results that
-* may be obtained by using this software or data. The NLM and the U.S.
-* Government disclaim all warranties, express or implied, including
-* warranties of performance, merchantability or fitness for any particular
-* purpose.
-*
-* Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-* Author: Justin Foley
-* File Description:
-*
-*/
-#include <ncbi_pch.hpp>
-
-#include <objtools/edit/huge_file_process.hpp>
-#include <objtools/cleanup/huge_file_cleanup.hpp>
-#include <objtools/cleanup/cleanup_change.hpp>
-#include <objtools/cleanup/cleanup.hpp>
-#include <objtools/cleanup/fix_feature_id.hpp>
-#include <objmgr/seq_entry_handle.hpp>
-#include <objects/seqfeat/BioSource.hpp>
-#include <objects/seqfeat/Feat_id.hpp>
-#include <objects/general/Object_id.hpp>
-#include <objtools/readers/objhook_lambdas.hpp>
-#include <serial/objistr.hpp>
-#include <serial/streamiter.hpp>
-
-#include "newcleanupp.hpp"
-#include "influenza_set.hpp"
-
-BEGIN_NCBI_SCOPE
-
-BEGIN_SCOPE(objects)
-USING_SCOPE(edit);
-
-
-CCleanupHugeAsnReader::CCleanupHugeAsnReader(TOptions options)
-: m_CleanupOptions(options) {}
-
-
-const CCleanupChangeCore& CCleanupHugeAsnReader::GetChanges() const
-{
- return m_Changes;
-}
-
-
-void CCleanupHugeAsnReader::FlattenGenbankSet()
-{
- auto& biosets = m_bioseq_set_list;
- if (biosets.size()>1) {
- auto firstTrueBioset = next(biosets.begin());
- if (firstTrueBioset->m_class == CBioseq_set::eClass_not_set) {
- if (x_LooksLikeNucProtSet()) {
- firstTrueBioset->m_class = CBioseq_set::eClass_nuc_prot;
- }
- else {
- firstTrueBioset->m_class = CBioseq_set::eClass_genbank;
- }
- m_Changes.SetChanged(CCleanupChange::eChangeBioseqSetClass);
- }
- }
- TParent::FlattenGenbankSet();
- x_CleanupTopLevelDescriptors();
-
- if (m_CleanupOptions & eEnableSmallGenomeSets) {
- x_CreateSmallGenomeSets();
- x_PruneAndReorderTopIds();
- }
-}
-
-void CCleanupHugeAsnReader::x_PruneAndReorderTopIds()
-{ // Needed when wrapping influenza sequences in small-genome sets
- map<string, CConstRef<CSeq_id>> smallGenomeLabelToId;
-
- auto it = m_top_ids.begin();
- while (it != m_top_ids.end()) {
- if (auto mit = x_GetFluLabel(*it);
- mit != m_IdToFluLabel.end()) {
- if (smallGenomeLabelToId.find(mit->second)
- == smallGenomeLabelToId.end()) {
- smallGenomeLabelToId.emplace(mit->second, *it);
- }
- it = m_top_ids.erase(it);
- continue;
- }
- ++it;
- }
-
- for (auto entry : smallGenomeLabelToId) {
- m_top_ids.push_back(entry.second);
- }
-}
-
-
-bool CCleanupHugeAsnReader::x_LooksLikeNucProtSet() const
-{
- int numNucs{0};
- int numProts{0};
- for (const auto& bioseq : GetBioseqs()) {
- if (CSeq_inst::IsNa(bioseq.m_mol)) {
- ++numNucs;
- if (numNucs>1) {
- return false;
- }
- }
- else if (CSeq_inst::IsAa(bioseq.m_mol)) {
- ++numProts;
- }
- }
- if (numProts==0) {
- return false;
- }
-
- _ASSERT(m_bioseq_set_list.size()>1);
- // check for invalid subsets
- auto it = next(m_bioseq_set_list.begin(),2);
- while (it != m_bioseq_set_list.end()) {
- if (it->m_class != CBioseq_set::eClass_segset &&
- it->m_class != CBioseq_set::eClass_parts) {
- return false;
- }
- ++it;
- }
- return true;
-}
-
-
-bool CCleanupHugeAsnReader::x_IsExtendedCleanup() const
-{
- return (m_CleanupOptions & eExtendedCleanup);
-}
-
-
-void CCleanupHugeAsnReader::x_CleanupTopLevelDescriptors()
-{
-
- m_TopLevelBiosources.clear();
- m_pTopLevelMolInfo.Reset();
-
-
- if (!m_top_entry ||
- !m_top_entry->IsSetDescr() ||
- !m_top_entry->GetDescr().IsSet()) {
- return;
- }
-
- CCleanup cleanup;
- m_Changes += *cleanup.BasicCleanup(m_top_entry->SetDescr());
-
- if (!x_IsExtendedCleanup()) {
- return;
- }
-
- auto& descriptors = m_top_entry->SetDescr().Set();
- auto it = descriptors.begin();
- while (it != descriptors.end()) {
- if (it->Empty()) {
- it = descriptors.erase(it);
- }
- else if ((*it)->IsSource()) {
- m_TopLevelBiosources.push_back(*it);
- it = descriptors.erase(it);
- m_Changes.SetChanged(CCleanupChange::eAddDescriptor);
- m_Changes.SetChanged(CCleanupChange::eRemoveDescriptor);
- }
- else if ((*it)->IsMolinfo()) {
- if (!m_pTopLevelMolInfo) {
- m_pTopLevelMolInfo.Reset(&(**it));
- }
- it = descriptors.erase(it);
- m_Changes.SetChanged(CCleanupChange::eRemoveDescriptor);
- } else {
- ++it;
- }
- }
-
- if (!(m_CleanupOptions & eNoNcbiUserObjects)) {
- CNewCleanup_imp::AddNcbiCleanupObject(m_top_entry->SetDescr());
- m_Changes.SetChanged(CCleanupChange::eAddNcbiCleanupObject);
- }
-
-
- if (descriptors.empty()) {
- m_top_entry->SetSet().ResetDescr();
- }
- else if (CCleanup::NormalizeDescriptorOrder(m_top_entry->SetDescr())) {
- m_Changes.SetChanged(CCleanupChange::eMoveDescriptor);
- }
-}
-
-
-void CCleanupHugeAsnReader::x_AddTopLevelDescriptors(CSeq_entry& entry) const
-{
- if ((!x_IsExtendedCleanup()) ||
- (m_TopLevelBiosources.empty() && m_pTopLevelMolInfo.Empty())) {
- return;
- }
-
- bool addMolInfo = false;
- if (m_pTopLevelMolInfo &&
- entry.IsSetDescr() &&
- entry.GetDescr().IsSet()) {
- const auto& descriptors = entry.GetDescr().Get();
- auto it = find_if(descriptors.begin(), descriptors.end(),
- [](const CRef<CSeqdesc>& pDesc) {
- return (pDesc && pDesc->IsMolinfo());
- });
- if (it == descriptors.end()) {
- addMolInfo = true;
- }
- }
-
- for (auto pSource : m_TopLevelBiosources) {
- entry.SetDescr().Set().push_back(pSource);
- }
-
- if (addMolInfo) {
- entry.SetDescr().Set().push_back(m_pTopLevelMolInfo);
- m_Changes.SetChanged(CCleanupChange::eAddDescriptor);
- }
-}
-
-
-using TFeatIdMap = map<CCleanupHugeAsnReader::TFeatId,CCleanupHugeAsnReader::TFeatId>;
-
-
-static void s_UpdateFeatureId(CFeat_id& featId, const TFeatIdMap& idMap)
-{
- if (!featId.IsLocal() || !featId.GetLocal().IsId()) {
- return;
- }
- const auto id = featId.GetLocal().GetId();
- if (auto it=idMap.find(id); it != idMap.end()) {
- featId.SetLocal().SetId() = it->second;
- }
-}
-
-
-static void s_UpdateFeatureIds(CSeq_feat& feat, const TFeatIdMap& idMap)
-{
- if (feat.IsSetId()) {
- s_UpdateFeatureId(feat.SetId(), idMap);
- }
-
- if (feat.IsSetIds()) {
- for (auto pFeatId : feat.SetIds()) {
- if (pFeatId) {
- s_UpdateFeatureId(*pFeatId, idMap);
- }
- }
- }
-
- if (feat.IsSetXref()) {
- for (auto pXref : feat.SetXref()) {
- if (pXref && pXref->IsSetId()) {
- s_UpdateFeatureId(pXref->SetId(), idMap);
- }
- }
- }
-}
-
-
-static void s_UpdateFeatureIds(CSeq_annot& annot, const TFeatIdMap& idMap)
-{
- if (!annot.IsFtable()) {
- return;
- }
-
- for (auto pSeqFeat : annot.SetData().SetFtable()) {
- if (pSeqFeat) {
- s_UpdateFeatureIds(*pSeqFeat, idMap);
- }
- }
-}
-
-
-static void s_UpdateFeatureIds(CBioseq& bioseq, const TFeatIdMap& idMap) {
- if (!bioseq.IsSetAnnot()) {
- return;
- }
-
- for (auto pAnnot : bioseq.SetAnnot()) {
- if (pAnnot) {
- s_UpdateFeatureIds(*pAnnot, idMap);
- }
- }
-}
-
-
-static void s_UpdateFeatureIds(CBioseq_set& bioseqSet, const TFeatIdMap& idMap)
-{
- if (bioseqSet.IsSetAnnot()) {
- for (auto pAnnot : bioseqSet.SetAnnot()) {
- if (pAnnot) {
- s_UpdateFeatureIds(*pAnnot, idMap);
- }
- }
- }
-
- if (bioseqSet.IsSetSeq_set()) {
- for (auto pSubEntry : bioseqSet.SetSeq_set()) {
- if (pSubEntry) {
- if (pSubEntry->IsSeq()) {
- s_UpdateFeatureIds(pSubEntry->SetSeq(), idMap);
- }
- else {
- s_UpdateFeatureIds(pSubEntry->SetSet(), idMap);
- }
- }
- }
- }
-}
-
-
-
-static void s_UpdateFeatureIds(CSeq_entry& entry, const TFeatIdMap& idMap)
-{
- if (entry.IsSeq()) {
- s_UpdateFeatureIds(entry.SetSeq(), idMap);
- }
- else {
- s_UpdateFeatureIds(entry.SetSet(), idMap);
- }
-}
-
-
-CRef<CSeq_entry> CCleanupHugeAsnReader::LoadSeqEntry(
- const TBioseqSetInfo& info,
- eAddTopEntry add_top_entry) const
-{
- if (m_CleanupOptions & eEnableSmallGenomeSets) {
- auto it = m_SetPosToFluLabel.find(info.m_pos);
- if (it != m_SetPosToFluLabel.end()) {
- auto pSmallGenomeEntry = Ref(new CSeq_entry());
- pSmallGenomeEntry->SetSet().SetClass() = CBioseq_set::eClass_small_genome_set;
- for (const auto& setInfo : m_FluLabelToSetInfo.at(it->second)) {
- auto pSubEntry = TParent::LoadSeqEntry(setInfo, eAddTopEntry::no);
-
- if (x_IsExtendedCleanup()) {
- if (auto posIt = m_FeatIdInfo.PosToIdMap.find(setInfo.m_pos);
- posIt != m_FeatIdInfo.PosToIdMap.end()) {
- s_UpdateFeatureIds(*pSubEntry, posIt->second);
- }
- }
- pSmallGenomeEntry->SetSet().SetSeq_set().push_back(pSubEntry);
- }
- if (add_top_entry == eAddTopEntry::yes) {
- x_AddTopLevelDescriptors(*pSmallGenomeEntry);
- }
- return pSmallGenomeEntry;
- }
- }
-
- auto pEntry = TParent::LoadSeqEntry(info, eAddTopEntry::no);
- if (add_top_entry == eAddTopEntry::yes) {
- x_AddTopLevelDescriptors(*pEntry);
- }
-
- if (x_IsExtendedCleanup()) {
- if (auto posIt = m_FeatIdInfo.PosToIdMap.find(info.m_pos);
- posIt != m_FeatIdInfo.PosToIdMap.end()) {
- s_UpdateFeatureIds(*pEntry, posIt->second);
- }
- }
-
-
- return pEntry;
-}
-
-
-static string s_GetInfluenzaLabel(const CSeq_descr& descr)
-{
- if (descr.IsSet()) {
- for (const auto& pDesc : descr.Get()) {
- if (pDesc->IsSource()) {
- const auto& source = pDesc->GetSource();
- if (source.IsSetOrg()) {
- auto key = CInfluenzaSet::GetKey(source.GetOrg());
- if (!NStr::IsBlank(key)) {
- return key;
- }
- }
- }
- }
- }
- return "";
-}
-
-
-template<typename TMap>
-static void s_RemoveEntriesWithVal(const string& val, TMap& mapToVal)
-{
- if (mapToVal.empty()) {
- return;
- }
-
- auto it = mapToVal.begin();
- while (it != mapToVal.end()) {
- if (it->second == val) {
- it = mapToVal.erase(it);
- } else {
- ++it;
- }
- }
-}
-
-
-static bool s_CheckForSegments(CConstRef<CSeq_descr> seqDescrs,
- CConstRef<CSeq_descr> setDescrs,
- const string& fluLabel,
- set<size_t>& segments)
-{
- if (NStr::IsBlank(fluLabel)) {
- return false;
- }
- auto fluType = CInfluenzaSet::GetInfluenzaType(fluLabel);
- if (fluType == CInfluenzaSet::eNotInfluenza) {
- return false;
- }
-
- auto numRequired = CInfluenzaSet::GetNumRequired(fluType);
-
- if (seqDescrs && seqDescrs->IsSet()) {
- for (auto pDesc : seqDescrs->Get()) {
- if (pDesc->IsSource()) {
- return g_FindSegs(pDesc->GetSource(), numRequired, segments);
- }
- }
- }
-
- if (setDescrs && setDescrs->IsSet()) {
- for (auto pDesc : setDescrs->Get()) {
- if (pDesc->IsSource()) {
- return g_FindSegs(pDesc->GetSource(), numRequired, segments);
- }
- }
- }
- return false;
-}
-
-
-static bool s_IdInSet(const CConstRef<CSeq_id>& pId,
- const set<CConstRef<CSeq_id>, CHugeAsnReader::CRefLess>& idSet)
-{
- auto it = idSet.lower_bound(pId);
- if (it != idSet.end()) {
- if ((*it)->CompareOrdered(*pId) == 0 ||
- (*it)->Compare(*pId) == CSeq_id::E_SIC::e_YES) {
- return true;
- }
- }
- return false;
-}
-
-
-void CCleanupHugeAsnReader::x_CreateSmallGenomeSets()
-{
- map<string, set<size_t>> fluLabelToSegs;
- CConstRef<CSeq_descr> pNpSetDescr;
- for (const auto& bioseqInfo : GetBioseqs()) {
- if (!CSeq_inst::IsNa(bioseqInfo.m_mol)) {
- continue;
- }
- auto parent = bioseqInfo.m_parent_set;
- if (parent->m_class == CBioseq_set::eClass_nuc_prot) {
- pNpSetDescr = parent->m_descr;
- parent = parent->m_parent_set;
- }
- if (!IsHugeSet(parent->m_class)) {
- continue;
- }
- string fluLabel;
- if (bioseqInfo.m_descr) {
- fluLabel = s_GetInfluenzaLabel(*(bioseqInfo.m_descr));
- if (NStr::IsBlank(fluLabel) && pNpSetDescr) {
- fluLabel = s_GetInfluenzaLabel(*pNpSetDescr);
- }
- }
- if (!NStr::IsBlank(fluLabel)) {
- bool makeSmallGenomeSet =
- s_CheckForSegments(bioseqInfo.m_descr, pNpSetDescr, fluLabel, fluLabelToSegs[fluLabel]);
-
- if (makeSmallGenomeSet) {
- const auto& setInfo = *FindTopObject(bioseqInfo.m_ids.front());
- m_FluLabelToSetInfo[fluLabel].push_back(setInfo);
- m_SetPosToFluLabel[setInfo.m_pos] = fluLabel;
- for (auto pId : bioseqInfo.m_ids) {
- m_IdToFluLabel[pId] = fluLabel;
- }
- }
- }
- }
-
- // Prune if there are missing segments
- for (const auto& entry : fluLabelToSegs) {
- const auto& fluLabel = entry.first;
- const auto& segsFound = entry.second;
- x_PruneIfSegsMissing(fluLabel, segsFound);
- };
- x_PruneIfFeatsIncomplete();
-}
-
-
-
-void CCleanupHugeAsnReader::x_PruneIfSegsMissing(const string& fluLabel, const set<size_t>& segsFound)
-{
- if (auto it = m_FluLabelToSetInfo.find(fluLabel); it != m_FluLabelToSetInfo.end()) {
- auto fluType = CInfluenzaSet::GetInfluenzaType(fluLabel);
- auto numRequired = CInfluenzaSet::GetNumRequired(fluType);
- if (segsFound.size() != numRequired) {
- m_FluLabelToSetInfo.erase(it);
- s_RemoveEntriesWithVal(fluLabel, m_SetPosToFluLabel);
- s_RemoveEntriesWithVal(fluLabel, m_IdToFluLabel);
- }
- }
-}
-
-
-void CCleanupHugeAsnReader::x_PruneIfFeatsIncomplete()
-{
- // Prune if any of the sequences has incomplete cdregion or gene feats
- auto it = m_IdToFluLabel.begin();
- set<string> fluLabelsToRemove;
- while (it != m_IdToFluLabel.end()) {
- if (s_IdInSet(it->first, m_HasIncompleteFeats)) {
- auto fluLabel = it->second;
- fluLabelsToRemove.insert(fluLabel);
- s_RemoveEntriesWithVal(fluLabel, m_SetPosToFluLabel);
- if (auto fluLabelIt = m_FluLabelToSetInfo.find(fluLabel); fluLabelIt != m_FluLabelToSetInfo.end()) {
- m_FluLabelToSetInfo.erase(fluLabelIt);
- }
- it = m_IdToFluLabel.erase(it);
- }
- else {
- ++it;
- }
- }
-
- for (const auto& fluLabel : fluLabelsToRemove) {
- s_RemoveEntriesWithVal(fluLabel, m_IdToFluLabel);
- }
-}
-
-
-
-CCleanupHugeAsnReader::TIdToFluLabel::iterator
-CCleanupHugeAsnReader::x_GetFluLabel(const CConstRef<CSeq_id>& pId)
-{
- auto it = m_IdToFluLabel.lower_bound(pId);
- if (it != m_IdToFluLabel.end()) {
- if (it->first->CompareOrdered(*pId) == 0 ||
- it->first->Compare(*pId) == CSeq_id::E_SIC::e_YES) {
- return it;
- }
- }
- return m_IdToFluLabel.end();
-}
-
-
-using TFeatIdSet = set<CCleanupHugeAsnReader::TFeatId>;
-
-
-static void s_FindNextOffset(const TFeatIdSet &existing_ids,
- const TFeatIdSet &new_existing_ids,
- const TFeatIdSet ¤t_ids,
- CCleanupHugeAsnReader::TFeatId &offset)
-{
- do
- {
- ++offset;
- } while(existing_ids.find(offset) != existing_ids.end() ||
- new_existing_ids.find(offset) != new_existing_ids.end() ||
- current_ids.find(offset) != current_ids.end());
-}
-
-
-void CCleanupHugeAsnReader::x_RecordFeatureId(const CFeat_id& featId)
-{
- if (!featId.IsLocal() || !featId.GetLocal().IsId()) {
- return;
- }
-
- const auto id = featId.GetLocal().GetId();
-
- if (m_FeatIdInfo.ExistingIds.find(id) != m_FeatIdInfo.ExistingIds.end() ||
- m_FeatIdInfo.NewIds.find(id) != m_FeatIdInfo.NewIds.end()) {
- auto it = m_FeatIdInfo.RemappedIds.find(id);
- if (it != m_FeatIdInfo.RemappedIds.end()) {
- m_FeatIdInfo.IdOffset = it->second;
- }
- else {
- s_FindNextOffset(m_FeatIdInfo.ExistingIds, m_FeatIdInfo.NewExistingIds, m_FeatIdInfo.NewIds, m_FeatIdInfo.IdOffset);
- m_FeatIdInfo.RemappedIds.emplace(id, m_FeatIdInfo.IdOffset);
- }
- m_FeatIdInfo.NewIds.insert(m_FeatIdInfo.IdOffset);
- }
- else {
- m_FeatIdInfo.NewExistingIds.insert(id);
- }
-}
-
-
-void CCleanupHugeAsnReader::x_SetBioseqHooks(CObjectIStream& objStream, TContext& context)
-{
- CObjectTypeInfo bioseq_info = CType<CBioseq>();
-
- SetLocalSkipHook(bioseq_info, objStream,
- [this, &context](CObjectIStream& in, const CObjectTypeInfo& type)
- {
- auto pos = in.GetStreamPos() + m_next_pos;
- context.bioseq_stack.push_back({});
-
- auto parent = context.bioseq_set_stack.back();
- const bool hasGenbankParent = (parent->m_class == CBioseq_set::eClass_genbank);
- if (hasGenbankParent) {
- m_FeatIdInfo.NewIds.clear();
- m_FeatIdInfo.NewExistingIds.clear();
- m_FeatIdInfo.RemappedIds.clear();
- }
-
- type.GetTypeInfo()->DefaultSkipData(in);
-
- auto& bioseqinfo = context.bioseq_stack.back();
- m_bioseq_list.push_back({pos, parent, bioseqinfo.m_length, bioseqinfo.m_descr, bioseqinfo.m_ids, bioseqinfo.m_mol, bioseqinfo.m_repr});
- context.bioseq_stack.pop_back();
-
- if (x_IsExtendedCleanup() && hasGenbankParent) {
- m_FeatIdInfo.ExistingIds.insert(m_FeatIdInfo.NewExistingIds.begin(), m_FeatIdInfo.NewExistingIds.end());
- m_FeatIdInfo.ExistingIds.insert(m_FeatIdInfo.NewIds.begin(), m_FeatIdInfo.NewIds.end());
- if (!m_FeatIdInfo.RemappedIds.empty()) {
- m_FeatIdInfo.PosToIdMap.emplace(pos, m_FeatIdInfo.RemappedIds);
- }
- }
-
- });
-}
-
-
-void CCleanupHugeAsnReader::x_SetBioseqSetHooks(CObjectIStream& objStream, TContext& context)
-{
- CObjectTypeInfo bioseq_set_info = CType<CBioseq_set>();
-
- SetLocalSkipHook(bioseq_set_info, objStream,
- [this, &context](CObjectIStream& in, const CObjectTypeInfo& type)
- {
- auto pos = in.GetStreamPos() + m_next_pos;
- auto parent = context.bioseq_set_stack.back();
- const bool hasGenbankParent = (parent->m_class == CBioseq_set::eClass_genbank);
- if (hasGenbankParent) {
- m_FeatIdInfo.NewIds.clear();
- m_FeatIdInfo.NewExistingIds.clear();
- m_FeatIdInfo.RemappedIds.clear();
- }
-
- m_bioseq_set_list.push_back({pos, parent});
-
- auto last = prev(m_bioseq_set_list.end());
-
- context.bioseq_set_stack.push_back(last);
-
- CObjectInfo objectInfo(type.GetTypeInfo());
- for (CIStreamClassMemberIterator it(in, type.GetTypeInfo()); it; ++it) {
- it.ReadClassMember(objectInfo);
- if ((*it).GetAlias() == "class") {
- auto memIdx = (*it).GetMemberIndex();
- CObjectInfo memberInfo = CObjectInfoMI(objectInfo, memIdx).GetMember();
- last->m_class = *CTypeConverter<CBioseq_set::EClass>::SafeCast(memberInfo.GetObjectPtr());
- }
- }
-
- auto* pBioseqSet = CTypeConverter<CBioseq_set>::SafeCast(objectInfo.GetObjectPtr());
-
- if (pBioseqSet->IsSetLevel()) {
- last->m_Level = pBioseqSet->GetLevel();
- }
-
- if (pBioseqSet->IsSetDescr()) {
- last->m_descr.Reset(&(pBioseqSet->GetDescr()));
- }
-
- if (IsHugeSet(last->m_class) &&
- last->m_HasAnnot) {
- m_HasHugeSetAnnot = true;
- }
-
- context.bioseq_set_stack.pop_back();
-
- if (x_IsExtendedCleanup() && hasGenbankParent) {
- m_FeatIdInfo.ExistingIds.insert(m_FeatIdInfo.NewExistingIds.begin(), m_FeatIdInfo.NewExistingIds.end());
- m_FeatIdInfo.ExistingIds.insert(m_FeatIdInfo.NewIds.begin(), m_FeatIdInfo.NewIds.end());
- if (!m_FeatIdInfo.RemappedIds.empty()) {
- m_FeatIdInfo.PosToIdMap.emplace(pos, m_FeatIdInfo.RemappedIds);
- }
- }
- });
-}
-
-
-void CCleanupHugeAsnReader::x_SetSeqFeatHooks(CObjectIStream& objStream, TContext& context)
-{
-
- SetLocalReadHook(CType<CSeq_feat>(), objStream,
- [this](CObjectIStream& in, const CObjectInfo& object)
- {
- auto* pObject = object.GetObjectPtr();
- object.GetTypeInfo()->DefaultReadData(in, pObject);
-
- if (!x_IsExtendedCleanup()) {
- return;
- }
-
- auto* pSeqFeat = CTypeConverter<CSeq_feat>::SafeCast(pObject);
-
- if (pSeqFeat->IsSetId()) {
- x_RecordFeatureId(pSeqFeat->GetId());
- }
-
- if (pSeqFeat->IsSetIds()) {
- for (auto pFeatId : pSeqFeat->GetIds()) {
- if (pFeatId) {
- x_RecordFeatureId(*pFeatId);
- }
- }
- }
- });
-
-
- SetLocalSkipHook(CType<CSeq_feat>(), objStream,
- [this](CObjectIStream& in, const CObjectTypeInfo& type)
- {
- auto pSeqFeat = Ref(new CSeq_feat());
- type.GetTypeInfo()->DefaultReadData(in, pSeqFeat);
-
- if (x_IsExtendedCleanup()) {
- if (pSeqFeat->IsSetId()) {
- x_RecordFeatureId(pSeqFeat->GetId());
- }
-
- if (pSeqFeat->IsSetIds()) {
- for (auto pFeatId : pSeqFeat->GetIds()) {
- if (pFeatId) {
- x_RecordFeatureId(*pFeatId);
- }
- }
- }
- }
-
-
- if (!(m_CleanupOptions & eEnableSmallGenomeSets)) {
- return;
- }
-
- if (pSeqFeat->IsSetData() &&
- (pSeqFeat->GetData().IsCdregion() ||
- pSeqFeat->GetData().IsGene())) {
- if (pSeqFeat->GetLocation().IsPartialStart(eExtreme_Biological) ||
- pSeqFeat->GetLocation().IsPartialStop(eExtreme_Biological)) {
- const auto* pSeqId = pSeqFeat->GetLocation().GetId();
- if (pSeqId) {
- CConstRef<CSeq_id> pConstId(pSeqId);
- m_HasIncompleteFeats.insert(pConstId);
- }
- }
- }
- });
-
-
-}
-
-
-
-
-void CCleanupHugeAsnReader::x_SetHooks(CObjectIStream& objStream, TContext& context)
-{
- TParent::x_SetHooks(objStream, context);
-
- x_SetSeqFeatHooks(objStream, context);
-}
-
-
-END_SCOPE(objects)
-END_NCBI_SCOPE
-/* $Id: influenza_set.cpp 661577 2023-01-13 18:43:15Z foleyjp $
+/* $Id: influenza_set.cpp 680750 2024-03-27 13:48:22Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
*/
#include <ncbi_pch.hpp>
#include <corelib/ncbistd.hpp>
-#include "influenza_set.hpp"
+#include <objtools/cleanup/influenza_set.hpp>
#include <objects/seqfeat/Org_ref.hpp>
#include <objects/seqfeat/OrgName.hpp>
+++ /dev/null
-#ifndef _INFLUENZA_SET_HPP_
-#define _INFLUENZA_SET_HPP_
-
-/* $Id: influenza_set.hpp 661173 2023-01-05 16:38:02Z foleyjp $
- * ===========================================================================
- *
- * PUBLIC DOMAIN NOTICE
- * National Center for Biotechnology Information
- *
- * This software/database is a "United States Government Work" under the
- * terms of the United States Copyright Act. It was written as part of
- * the author's official duties as a United States Government employee and
- * thus cannot be copyrighted. This software/database is freely available
- * to the public for use. The National Library of Medicine and the U.S.
- * Government have not placed any restriction on its use or reproduction.
- *
- * Although all reasonable efforts have been taken to ensure the accuracy
- * and reliability of the software and data, the NLM and the U.S.
- * Government do not and cannot warrant the performance or results that
- * may be obtained by using this software or data. The NLM and the U.S.
- * Government disclaim all warranties, express or implied, including
- * warranties of performance, merchantability or fitness for any particular
- * purpose.
- *
- * Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- * Author:
- *
- * File Description:
- *
- * ===========================================================================
- */
-
-#include <corelib/ncbistd.hpp>
-#include <objmgr/bioseq_handle.hpp>
-
-BEGIN_NCBI_SCOPE
-BEGIN_SCOPE(objects)
-
-class CInfluenzaSet : public CObject {
-public:
- CInfluenzaSet(const string& key);
- ~CInfluenzaSet() {}
-
- static string GetKey(const COrg_ref& org);
- bool OkToMakeSet() const;
- void MakeSet();
-
- typedef enum {
- eNotInfluenza = 0,
- eInfluenzaA,
- eInfluenzaB,
- eInfluenzaC,
- eInfluenzaD
- } EInfluenzaType;
-
- static EInfluenzaType GetInfluenzaType(const string& taxname);
- static size_t GetNumRequired(EInfluenzaType fluType);
-
- void AddBioseq(CBioseq_Handle bsh);
-
-protected:
- typedef vector<CBioseq_Handle> TMembers;
- TMembers m_Members;
- const string m_Key;
- EInfluenzaType m_FluType;
- size_t m_Required;
-};
-
-bool g_FindSegs(const CBioSource& src, size_t numRequired, set<size_t>& segsFound);
-
-END_SCOPE(objects)
-END_NCBI_SCOPE
-
-#endif // _INFLUENZA_SET_HPP_
/*
-* ===========================================================================
-*
-* PUBLIC DOMAIN NOTICE
-* National Center for Biotechnology Information
-*
-* This software/database is a "United States Government Work" under the
-* terms of the United States Copyright Act. It was written as part of
-* the author's official duties as a United States Government employee and
-* thus cannot be copyrighted. This software/database is freely available
-* to the public for use. The National Library of Medicine and the U.S.
-* Government have not placed any restriction on its use or reproduction.
-*
-* Although all reasonable efforts have been taken to ensure the accuracy
-* and reliability of the software and data, the NLM and the U.S.
-* Government do not and cannot warrant the performance or results that
-* may be obtained by using this software or data. The NLM and the U.S.
-* Government disclaim all warranties, express or implied, including
-* warranties of performance, merchantability or fitness for any particular
-* purpose.
-*
-* Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-* Author: Robert Smith, Jonathan Kans, Michael Kornbluh
-*
-* File Description:
-* Basic and Extended Cleanup of CSeq_entries, etc.
-*
-* ===========================================================================
-*/
+ * ===========================================================================
+ *
+ * PUBLIC DOMAIN NOTICE
+ * National Center for Biotechnology Information
+ *
+ * This software/database is a "United States Government Work" under the
+ * terms of the United States Copyright Act. It was written as part of
+ * the author's official duties as a United States Government employee and
+ * thus cannot be copyrighted. This software/database is freely available
+ * to the public for use. The National Library of Medicine and the U.S.
+ * Government have not placed any restriction on its use or reproduction.
+ *
+ * Although all reasonable efforts have been taken to ensure the accuracy
+ * and reliability of the software and data, the NLM and the U.S.
+ * Government do not and cannot warrant the performance or results that
+ * may be obtained by using this software or data. The NLM and the U.S.
+ * Government disclaim all warranties, express or implied, including
+ * warranties of performance, merchantability or fitness for any particular
+ * purpose.
+ *
+ * Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ * Author: Robert Smith, Jonathan Kans, Michael Kornbluh
+ *
+ * File Description:
+ * Basic and Extended Cleanup of CSeq_entries, etc.
+ *
+ * ===========================================================================
+ */
// All this functionality is packed into this one file for ease of
// searching. If it gets big enough, it will be broken up in the future.
// we prefer our own version
#define CompressSpaces x_CompressSpaces
-namespace {
-
+namespace
+{
// a CRegexp that has lock and unlock methods,
// and also inherits from CObject
class CRegexpWithLock : public CObject, public CRegexp {
}
-
-
// Implementation methods
void CNewCleanup_imp::SetGeneticCode (
// for cleanup Seq-entry and Seq-submit, set scope and parentize.
// We use exceptions for AddTopLevelSeqEntry because we need to detect
// if we've already processed the given Seq-entry.
- {{
- CSeq_entry_Handle seh =
- m_Scope->GetSeq_entryHandle(se, CScope::eMissing_Null);
- if (seh) {
+ {
+ CSeq_entry_Handle seh =
+ m_Scope->GetSeq_entryHandle(se, CScope::eMissing_Null);
+ if (seh) {
#if 0
- // all code paths in this function must result
- // in m_SeqEntryInfoStack getting a "push"
- m_SeqEntryInfoStack.push( m_SeqEntryInfoStack.top() );
+ // all code paths in this function must result
+ // in m_SeqEntryInfoStack getting a "push"
+ m_SeqEntryInfoStack.push( m_SeqEntryInfoStack.top() );
#endif
- return;
- }
+ return;
+ }
- m_Scope->AddTopLevelSeqEntry (se);
- se.Parentize();
- }}
+ m_Scope->AddTopLevelSeqEntry(se);
+ se.Parentize();
+ }
#if 0
// a few differences based on sequence identifier type
FOR_EACH_SEQID_ON_BIOSEQ (sid_itr, bs) {
const CSeq_id& sid = **sid_itr;
SWITCH_ON_SEQID_CHOICE (sid) {
- case NCBI_SEQID(Genbank):
- case NCBI_SEQID(Tpg):
- {
- const CTextseq_id& tsid = *GET_FIELD (sid, Textseq_Id);
- if (FIELD_IS_SET (tsid, Accession)) {
- const string& acc = GET_FIELD (tsid, Accession);
- if (acc.length() == 6) {
- seqEntryInfo.m_StripSerial = false;
- }
+ case NCBI_SEQID(Genbank):
+ case NCBI_SEQID(Tpg):
+ {
+ const CTextseq_id& tsid = *GET_FIELD (sid, Textseq_Id);
+ if (FIELD_IS_SET (tsid, Accession)) {
+ const string& acc = GET_FIELD (tsid, Accession);
+ if (acc.length() == 6) {
+ seqEntryInfo.m_StripSerial = false;
}
}
- break;
- case NCBI_SEQID(Embl):
- case NCBI_SEQID(Ddbj):
- seqEntryInfo.m_StripSerial = false;
- seqEntryInfo.m_IsEmblOrDdbj = true;
- break;
- case NCBI_SEQID(not_set):
- case NCBI_SEQID(Local):
- case NCBI_SEQID(Other):
- case NCBI_SEQID(General):
- break;
- case NCBI_SEQID(Gibbsq):
- case NCBI_SEQID(Gibbmt):
- case NCBI_SEQID(Pir):
- case NCBI_SEQID(Swissprot):
- case NCBI_SEQID(Patent):
- case NCBI_SEQID(Prf):
- case NCBI_SEQID(Pdb):
- case NCBI_SEQID(Gpipe):
- case NCBI_SEQID(Tpe):
- case NCBI_SEQID(Tpd):
- seqEntryInfo.m_StripSerial = false;
- break;
- default:
- break;
+ }
+ break;
+ case NCBI_SEQID(Embl):
+ case NCBI_SEQID(Ddbj):
+ seqEntryInfo.m_StripSerial = false;
+ seqEntryInfo.m_IsEmblOrDdbj = true;
+ break;
+ case NCBI_SEQID(not_set):
+ case NCBI_SEQID(Local):
+ case NCBI_SEQID(Other):
+ case NCBI_SEQID(General):
+ break;
+ case NCBI_SEQID(Gibbsq):
+ case NCBI_SEQID(Gibbmt):
+ case NCBI_SEQID(Pir):
+ case NCBI_SEQID(Swissprot):
+ case NCBI_SEQID(Patent):
+ case NCBI_SEQID(Prf):
+ case NCBI_SEQID(Pdb):
+ case NCBI_SEQID(Gpipe):
+ case NCBI_SEQID(Tpe):
+ case NCBI_SEQID(Tpd):
+ seqEntryInfo.m_StripSerial = false;
+ break;
+ default:
+ break;
}
}
}
#endif
}
-void CNewCleanup_imp::LeavingEntry (
- CSeq_entry& se
-)
-
+void CNewCleanup_imp::LeavingEntry(CSeq_entry&)
{
#if 0
m_SeqEntryInfoStack.pop();
}
}
-void CNewCleanup_imp::X_CommentTildeFixes(std::string & str)
-{
-/*
-#ifndef NCBI_OS_MSWIN
- string orig = str;
- NStr::ReplaceInPlace(str, "based on SOLiD3 (Applied Biosystems)~~", "based on SOLiD3 (Applied Biosystems)", false, false);
- NStr::ReplaceInPlace(str, "Biological resourse center, NITE (NRBC)~~", "Biological resourse center, NITE (NRBC)", false, false);
- NStr::ReplaceInPlace(str, "developmental01.html~~", "developmental01.html", false, false);
- NStr::ReplaceInPlace(str, "http://bionano.toyo.ac.jp/~~", "http://bionano.toyo.ac.jp/", false, false);
- NStr::ReplaceInPlace(str, "http://dictycdb1.biol.tsukuba.ac.jp/acytodb/~~", "http://dictycdb1.biol.tsukuba.ac.jp/acytodb/", false, false);
- NStr::ReplaceInPlace(str, "http://egg.umh.es~~", "http://egg.umh.es", false, false);
- NStr::ReplaceInPlace(str, "http://www.aist.go.jp/~~", "http://www.aist.go.jp/", false, false);
- NStr::ReplaceInPlace(str, "http://www.bio.nite.go.jp/~~", "http://www.bio.nite.go.jp/", false, false);
- NStr::ReplaceInPlace(str, "http://www.bio.nite.go.jp/ngac/e/~~", "http://www.bio.nite.go.jp/ngac/e/", false, false);
- NStr::ReplaceInPlace(str, "http://www.brs.kyushu-u.ac.jp/~fcmic/~~", "http://www.brs.kyushu-u.ac.jp/~fcmic/", false, false);
- NStr::ReplaceInPlace(str, "http://www.miyazaki-u.ac.jp/ir/english/index.html~~", "http://www.miyazaki-u.ac.jp/ir/english/index.html", false, false);
- NStr::ReplaceInPlace(str, "URL:http://www.bio.nite.go.jp/ngac/e/~~", "URL:http://www.bio.nite.go.jp/ngac/e/", false, false);
- if (!NStr::Equal(orig, str)) {
- ChangeMade(CCleanupChange::eTrimSpaces);
- }
-#endif //NCBI_OS_MSWIN
-*/
-}
-
void CNewCleanup_imp::x_TruncateSpacesMarkChanged( std::string & str )
{
const size_t old_str_size = str.length();
if (pSubEntry->IsSeq()) {
s_IncrementSeqCount(pSubEntry->GetSeq(), num_nucs, num_prots);
} else {
- const auto& bioseqSet = pSubEntry->GetSet();
- if (!s_IsValidNPSubset(bioseqSet)) {
+ const auto& bioseqSet2 = pSubEntry->GetSet();
+ if (! s_IsValidNPSubset(bioseqSet2)) {
hasInvalidSubset = true;
return;
}
- s_ScanWhilePossibleNPSet(bioseqSet, num_nucs, num_prots, hasInvalidSubset);
+ s_ScanWhilePossibleNPSet(bioseqSet2, num_nucs, num_prots, hasInvalidSubset);
}
if (num_nucs > 1) {
return;
{
SWITCH_ON_BIOSOURCE_GENOME (biosrc) {
case NCBI_GENOME(apicoplast):
- {
- const static string apicoplast("apicoplast");
- return apicoplast;
- }
+ {
+ const static string apicoplast("apicoplast");
+ return apicoplast;
+ }
break;
case NCBI_GENOME(chloroplast):
- {
- const static string chloroplast("chloroplast");
- return chloroplast;
- }
+ {
+ const static string chloroplast("chloroplast");
+ return chloroplast;
+ }
break;
case NCBI_GENOME(chromoplast):
- {
- const static string chromoplast("chromoplast");
- return chromoplast;
- }
+ {
+ const static string chromoplast("chromoplast");
+ return chromoplast;
+ }
break;
case NCBI_GENOME(kinetoplast):
- {
- const static string kinetoplast("kinetoplast");
- return kinetoplast;
- }
+ {
+ const static string kinetoplast("kinetoplast");
+ return kinetoplast;
+ }
break;
case NCBI_GENOME(leucoplast):
- {
- const static string leucoplast("leucoplast");
- return leucoplast;
- }
+ {
+ const static string leucoplast("leucoplast");
+ return leucoplast;
+ }
break;
case NCBI_GENOME(plastid):
- {
- const static string plastid("plastid");
- return plastid;
- }
+ {
+ const static string plastid("plastid");
+ return plastid;
+ }
break;
case NCBI_GENOME(proplastid):
- {
- const static string proplastid("proplastid");
- return proplastid;
- }
+ {
+ const static string proplastid("proplastid");
+ return proplastid;
+ }
break;
default:
return kEmptyStr;
SIZE_TYPE pos = open_paren_pos + 1;
for( ; pos < str.length(); ++pos ) {
switch( str[pos] ) {
- case '(':
- // nesting deeper
- ++level;
- break;
- case ')':
- // closed a level of nesting
- --level;
- if( 0 == level ) {
- // reached the top: we're closing the initial paren,
- // so we return our position
- return pos;
- }
- break;
- default:
- // ignore other characters.
- // maybe in the future we'll handle ignoring parens in quotes or
- // things like that.
- break;
+ case '(':
+ // nesting deeper
+ ++level;
+ break;
+ case ')':
+ // closed a level of nesting
+ --level;
+ if( 0 == level ) {
+ // reached the top: we're closing the initial paren,
+ // so we return our position
+ return pos;
+ }
+ break;
+ default:
+ // ignore other characters.
+ // maybe in the future we'll handle ignoring parens in quotes or
+ // things like that.
+ break;
}
}
return NPOS;
}
-
-
static bool s_DbtagIsBad (
CDbtag& dbt
)
CObject_id& oid = GET_MUTABLE (dbtag, Tag);
if (FIELD_IS (oid, Id)) {
- const string& db = dbtag.GetDb();
- if (NStr::EqualNocase (db, "HGNC") || NStr::EqualNocase (db, "VGNC") || NStr::EqualNocase (db, "MGI") ) {
+ const string& db2 = dbtag.GetDb();
+ if (NStr::EqualNocase(db2, "HGNC") || NStr::EqualNocase(db2, "VGNC") || NStr::EqualNocase(db2, "MGI") ) {
int val = dbtag.GetTag().GetId();
- string str = db + ":" + NStr::IntToString(val);
+ string str = db2 + ":" + NStr::IntToString(val);
dbtag.SetTag().SetStr(str);
ChangeMade(CCleanupChange::eChangeDbxrefs);
}
if (pubdesc.IsSetPub()) {
for (auto p : pubdesc.SetPub().Set()) {
string new_label;
- p->GetLabel(&new_label, CPub::eContent, true);
+ p->GetLabel(&new_label, CPub::eContent, CPub::fLabel_Unique);
m_PubToNewPubLabelMap[p] = new_label;
}
}
TCitSet cit_set;
for (auto cit_it : pub_set.GetPub()) {
string label;
- cit_it->GetLabel(&label, CPub::eContent, CPub::fLabel_Unique, CPub::eLabel_V1 );
+ cit_it->GetLabel(&label, CPub::eContent, CPub::fLabel_Unique, CPub::eLabel_V1);
// the following line may fail due to dups
// (that's okay; it lets us automatically remove dups)
cit_set.insert( TCit(label, cit_it) );
case CSeq_loc::e_Int :
x_SeqIntervalBC( GET_MUTABLE(loc, Int) );
break;
- case CSeq_loc::e_Packed_int :
- {
- CSeq_loc::TPacked_int::Tdata& ints = loc.SetPacked_int().Set();
- NON_CONST_ITERATE(CSeq_loc::TPacked_int::Tdata, interval_it, ints) {
- x_SeqIntervalBC(**interval_it);
- }
- if (ints.size() == 1) {
- CRef<CSeq_interval> int_ref = ints.front();
- loc.SetInt(*int_ref);
- ChangeMade(CCleanupChange::eChangeSeqloc);
- }
- }
- break;
- case CSeq_loc::e_Pnt :
- {
- CSeq_loc::TPnt& pnt = loc.SetPnt();
-
- if (pnt.IsSetStrand()) {
- if (pnt.GetStrand() == eNa_strand_unknown) {
- pnt.SetStrand(eNa_strand_plus);
- ChangeMade(CCleanupChange::eChangeStrand);
- }
- }
- else {
+ case CSeq_loc::e_Packed_int: {
+ CSeq_loc::TPacked_int::Tdata& ints = loc.SetPacked_int().Set();
+ NON_CONST_ITERATE(CSeq_loc::TPacked_int::Tdata, interval_it, ints) {
+ x_SeqIntervalBC(**interval_it);
+ }
+ if (ints.size() == 1) {
+ CRef<CSeq_interval> int_ref = ints.front();
+ loc.SetInt(*int_ref);
+ ChangeMade(CCleanupChange::eChangeSeqloc);
+ }
+ } break;
+ case CSeq_loc::e_Pnt: {
+ CSeq_loc::TPnt& pnt = loc.SetPnt();
+
+ if (pnt.IsSetStrand()) {
+ if (pnt.GetStrand() == eNa_strand_unknown) {
pnt.SetStrand(eNa_strand_plus);
ChangeMade(CCleanupChange::eChangeStrand);
}
+ }
+ else {
+ pnt.SetStrand(eNa_strand_plus);
+ ChangeMade(CCleanupChange::eChangeStrand);
+ }
- // normalize Seq-point fuzz tl to tr and decrement position
- if (pnt.IsSetFuzz() && pnt.GetFuzz().IsLim() &&
- pnt.GetFuzz().GetLim() == CInt_fuzz::eLim_tl) {
- TSeqPos pos = pnt.GetPoint();
- if (pos > 0) {
- pnt.SetFuzz().SetLim(CInt_fuzz::eLim_tr);
- pnt.SetPoint(pos - 1);
- ChangeMade(CCleanupChange::eChangeSeqloc);
- }
+ // normalize Seq-point fuzz tl to tr and decrement position
+ if (pnt.IsSetFuzz() && pnt.GetFuzz().IsLim() &&
+ pnt.GetFuzz().GetLim() == CInt_fuzz::eLim_tl) {
+ TSeqPos pos = pnt.GetPoint();
+ if (pos > 0) {
+ pnt.SetFuzz().SetLim(CInt_fuzz::eLim_tr);
+ pnt.SetPoint(pos - 1);
+ ChangeMade(CCleanupChange::eChangeSeqloc);
}
}
- break;
- case CSeq_loc::e_Mix :
- {
- typedef CSeq_loc::TMix::Tdata TMixList;
- // delete Null type Seq-locs from beginning and end of Mix list.
-
- // deleting from beginning:
- TMixList& sl_list = loc.SetMix().Set();
- TMixList::iterator sl_it = sl_list.begin();
- while (sl_it != sl_list.end()) {
- if ((*sl_it)->IsNull()) {
- sl_it = sl_list.erase(sl_it);
- ChangeMade(CCleanupChange::eChangeSeqloc);
- } else {
- break;
- }
+ } break;
+ case CSeq_loc::e_Mix: {
+ typedef CSeq_loc::TMix::Tdata TMixList;
+ // delete Null type Seq-locs from beginning and end of Mix list.
+
+ // deleting from beginning:
+ TMixList& sl_list = loc.SetMix().Set();
+ TMixList::iterator sl_it = sl_list.begin();
+ while (sl_it != sl_list.end()) {
+ if ((*sl_it)->IsNull()) {
+ sl_it = sl_list.erase(sl_it);
+ ChangeMade(CCleanupChange::eChangeSeqloc);
+ } else {
+ break;
}
+ }
- // deleting from end:
- if( sl_list.size() > 0 ) {
- sl_it = sl_list.end();
- while (sl_it != sl_list.begin()) {
- --sl_it;
- if ( ! (*sl_it)->IsNull()) {
- break;
- }
- }
- ++sl_it;
- if (sl_it != sl_list.end()) {
- sl_list.erase(sl_it, sl_list.end());
- ChangeMade(CCleanupChange::eChangeSeqloc);
+ // deleting from end:
+ if( sl_list.size() > 0 ) {
+ sl_it = sl_list.end();
+ while (sl_it != sl_list.begin()) {
+ --sl_it;
+ if ( ! (*sl_it)->IsNull()) {
+ break;
}
}
-
- if (sl_list.size() == 0) {
- loc.SetNull();
- ChangeMade(CCleanupChange::eChangeSeqloc);
- } else if (sl_list.size() == 1) {
- CRef<CSeq_loc> only_sl = sl_list.front();
- loc.Assign(*only_sl);
+ ++sl_it;
+ if (sl_it != sl_list.end()) {
+ sl_list.erase(sl_it, sl_list.end());
ChangeMade(CCleanupChange::eChangeSeqloc);
}
}
- break;
+
+ if (sl_list.size() == 0) {
+ loc.SetNull();
+ ChangeMade(CCleanupChange::eChangeSeqloc);
+ } else if (sl_list.size() == 1) {
+ CRef<CSeq_loc> only_sl = sl_list.front();
+ loc.Assign(*only_sl);
+ ChangeMade(CCleanupChange::eChangeSeqloc);
+ }
+ } break;
default:
break;
}
ChangeMade(CCleanupChange::eChangeStrand);
}
}
-
}
void CNewCleanup_imp::ConvertSeqLocWholeToInt( CSeq_loc &loc )
const CSeqFeatData& fdata = feat.GetData();
switch (fdata.Which()) {
- case NCBI_SEQFEAT(Gene):
- return "Gene";
- case NCBI_SEQFEAT(Org):
- return "Org";
- case NCBI_SEQFEAT(Cdregion):
- return "CDS";
- case NCBI_SEQFEAT(Prot):
- if(fdata.GetProt().IsSetProcessed() ) {
- switch( feat.GetData().GetProt().GetProcessed() ) {
- case NCBI_PROTREF(not_set):
- return "Protein";
- case NCBI_PROTREF(preprotein):
- return "proprotein";
- case NCBI_PROTREF(mature):
- return "mat_peptide";
- case NCBI_PROTREF(signal_peptide):
- return "sig_peptide";
- case NCBI_PROTREF(transit_peptide):
- return "transit_peptide";
- case NCBI_PROTREF(propeptide):
- return "propeptide";
- default:
- return kFeatBad;
- }
+ case NCBI_SEQFEAT(Gene):
+ return "Gene";
+ case NCBI_SEQFEAT(Org):
+ return "Org";
+ case NCBI_SEQFEAT(Cdregion):
+ return "CDS";
+ case NCBI_SEQFEAT(Prot):
+ if(fdata.GetProt().IsSetProcessed() ) {
+ switch( feat.GetData().GetProt().GetProcessed() ) {
+ case NCBI_PROTREF(not_set):
+ return "Protein";
+ case NCBI_PROTREF(preprotein):
+ return "proprotein";
+ case NCBI_PROTREF(mature):
+ return "mat_peptide";
+ case NCBI_PROTREF(signal_peptide):
+ return "sig_peptide";
+ case NCBI_PROTREF(transit_peptide):
+ return "transit_peptide";
+ case NCBI_PROTREF(propeptide):
+ return "propeptide";
+ default:
+ return kFeatBad;
}
- return "Protein";
- case NCBI_SEQFEAT(Rna):
- if(fdata.GetRna().IsSetType() ) {
- const auto& rna = fdata.GetRna();
- switch (rna.GetType() )
- {
- case NCBI_RNAREF(unknown):
- return "misc_RNA"; // unknownrna mapped to otherrna
- case NCBI_RNAREF(premsg):
- return "precursor_RNA";
- case NCBI_RNAREF(mRNA):
- return "mRNA";
- case NCBI_RNAREF(tRNA):
- return "tRNA";
- case NCBI_RNAREF(rRNA):
- return "rRNA";
- case NCBI_RNAREF(snRNA):
- return "snRNA";
- case NCBI_RNAREF(scRNA):
- return "scRNA";
- case NCBI_RNAREF(snoRNA):
- return "snoRNA";
- case NCBI_RNAREF(ncRNA):
- return "ncRNA";
- case NCBI_RNAREF(tmRNA):
- return "tmRNA";
- case NCBI_RNAREF(miscRNA):
- return "misc_RNA";
- case NCBI_RNAREF(other):
- if ( FIELD_IS_SET_AND_IS(rna, Ext, Name) ) {
- const string &name = rna.GetExt().GetName();
- if ( NStr::EqualNocase(name, "misc_RNA")) return "misc_RNA";
- if ( NStr::EqualNocase(name, "ncRNA") ) return "ncRNA";
- if ( NStr::EqualNocase(name, "tmRNA") ) return "tmRNA";
- }
- return "misc_RNA";
- default:
- return kFeatBad;
- }
- }
- return kFeatBad;
- case NCBI_SEQFEAT(Pub):
- return "Cit";
- case NCBI_SEQFEAT(Seq):
- return "Xref";
- case NCBI_SEQFEAT(Imp):
- return s_FindImpFeatType( fdata.GetImp() );
- case NCBI_SEQFEAT(Region):
- return "Region";
- case NCBI_SEQFEAT(Comment):
- return "Comment";
- case NCBI_SEQFEAT(Bond):
- return "Bond";
- case NCBI_SEQFEAT(Site):
- return "Site";
- case NCBI_SEQFEAT(Rsite):
- return "Rsite";
- case NCBI_SEQFEAT(User):
- return "User";
- case NCBI_SEQFEAT(Txinit):
- return "TxInit";
- case NCBI_SEQFEAT(Num):
- return "Num";
- case NCBI_SEQFEAT(Psec_str):
- return "SecStr";
- case NCBI_SEQFEAT(Non_std_residue):
- return "NonStdRes";
- case NCBI_SEQFEAT(Het):
- return "Het";
- case NCBI_SEQFEAT(Biosrc):
- return "Src";
- case NCBI_SEQFEAT(Clone):
- return "CloneRef";
- case NCBI_SEQFEAT(Variation):
- return "VariationRef";
- default:
- return kFeatBad;
+ }
+ return "Protein";
+ case NCBI_SEQFEAT(Rna):
+ if(fdata.GetRna().IsSetType() ) {
+ const auto& rna = fdata.GetRna();
+ switch (rna.GetType() )
+ {
+ case NCBI_RNAREF(unknown):
+ return "misc_RNA"; // unknownrna mapped to otherrna
+ case NCBI_RNAREF(premsg):
+ return "precursor_RNA";
+ case NCBI_RNAREF(mRNA):
+ return "mRNA";
+ case NCBI_RNAREF(tRNA):
+ return "tRNA";
+ case NCBI_RNAREF(rRNA):
+ return "rRNA";
+ case NCBI_RNAREF(snRNA):
+ return "snRNA";
+ case NCBI_RNAREF(scRNA):
+ return "scRNA";
+ case NCBI_RNAREF(snoRNA):
+ return "snoRNA";
+ case NCBI_RNAREF(ncRNA):
+ return "ncRNA";
+ case NCBI_RNAREF(tmRNA):
+ return "tmRNA";
+ case NCBI_RNAREF(miscRNA):
+ return "misc_RNA";
+ case NCBI_RNAREF(other):
+ if ( FIELD_IS_SET_AND_IS(rna, Ext, Name) ) {
+ const string &name = rna.GetExt().GetName();
+ if ( NStr::EqualNocase(name, "misc_RNA")) return "misc_RNA";
+ if ( NStr::EqualNocase(name, "ncRNA") ) return "ncRNA";
+ if ( NStr::EqualNocase(name, "tmRNA") ) return "tmRNA";
+ }
+ return "misc_RNA";
+ default:
+ return kFeatBad;
+ }
+ }
+ return kFeatBad;
+ case NCBI_SEQFEAT(Pub):
+ return "Cit";
+ case NCBI_SEQFEAT(Seq):
+ return "Xref";
+ case NCBI_SEQFEAT(Imp):
+ return s_FindImpFeatType( fdata.GetImp() );
+ case NCBI_SEQFEAT(Region):
+ return "Region";
+ case NCBI_SEQFEAT(Comment):
+ return "Comment";
+ case NCBI_SEQFEAT(Bond):
+ return "Bond";
+ case NCBI_SEQFEAT(Site):
+ return "Site";
+ case NCBI_SEQFEAT(Rsite):
+ return "Rsite";
+ case NCBI_SEQFEAT(User):
+ return "User";
+ case NCBI_SEQFEAT(Txinit):
+ return "TxInit";
+ case NCBI_SEQFEAT(Num):
+ return "Num";
+ case NCBI_SEQFEAT(Psec_str):
+ return "SecStr";
+ case NCBI_SEQFEAT(Non_std_residue):
+ return "NonStdRes";
+ case NCBI_SEQFEAT(Het):
+ return "Het";
+ case NCBI_SEQFEAT(Biosrc):
+ return "Src";
+ case NCBI_SEQFEAT(Clone):
+ return "CloneRef";
+ case NCBI_SEQFEAT(Variation):
+ return "VariationRef";
+ default:
+ return kFeatBad;
}
return kFeatBad;
}
return eAction_Erase; // mark qual for deletion
} else if (NStr::EqualNocase(qual, "gene")) {
if (!NStr::IsBlank(val)) {
- CRef<CSeqFeatXref> xref(new CSeqFeatXref);
- xref->SetData().SetGene().SetLocus(val);
- feat.SetXref().insert(feat.SetXref().begin(), xref);
- ChangeMade(CCleanupChange::eCopyGeneXref);
+ if (!data.IsGene()) {
+ CRef<CSeqFeatXref> xref(new CSeqFeatXref);
+ xref->SetData().SetGene().SetLocus(val);
+ feat.SetXref().insert(feat.SetXref().begin(), xref);
+ ChangeMade(CCleanupChange::eCopyGeneXref);
+ } else {
+ auto& gene = data.SetGene();
+ if (gene.IsSetDesc() && !NStr::IsBlank(gene.GetDesc())) {
+ gene.SetDesc() += "; ";
+ } else {
+ gene.SetDesc(kEmptyStr);
+ }
+ gene.SetDesc() += "gene=" + val;
+ ChangeMade(CCleanupChange::eChangeQualifiers);
+ }
return eAction_Erase; // mark qual for deletion
}
} else if (NStr::EqualNocase(qual, "codon_start")) {
static
void s_ExpandThisQual(
- CSeq_feat::TQual& quals, // the list of CGb_qual's.
+ CSeq_feat::TQual& /*quals*/, // the list of CGb_qual's.
CSeq_feat::TQual::iterator& it, // points to the one qual we might expand.
- CSeq_feat::TQual& new_quals ) // new quals that will need to be inserted
+ CSeq_feat::TQual& new_quals) // new quals that will need to be inserted
//
// Rules for "rpt_type" qualifiers (as of 2006-03-07):
//
}
bool change_made = false;
- if (NStr::EqualNocase(qual, "map")) {
+ if (NStr::EqualNocase(qual, "gene")) {
+ if (!gene.IsSetLocus()) {
+ change_made = true;
+ gene.SetLocus(val);
+ }
+ }
+ else if (NStr::EqualNocase(qual, "map")) {
if (! gene.IsSetMaploc() ) {
change_made = true;
gene.SetMaploc(val);
change_made = true;
gene.SetSyn().push_back(val);
}
+
if (change_made) {
ChangeMade(CCleanupChange::eChangeQualifiers);
+ return eAction_Erase;
}
- return ( change_made ? eAction_Erase : eAction_Nothing );
+ return eAction_Nothing;
}
CNewCleanup_imp::EAction
}
-CNewCleanup_imp::EAction CNewCleanup_imp::x_HandleStandardNameRnaGBQual(CSeq_feat& feat, CRNA_ref& rna, const string& standard_name)
+CNewCleanup_imp::EAction CNewCleanup_imp::x_HandleStandardNameRnaGBQual(CSeq_feat&, CRNA_ref&, const string&)
{
return eAction_Nothing;
}
case CSeq_loc::e_Int :
x_BothStrandBC( GET_MUTABLE(loc, Int) );
break;
- case CSeq_loc::e_Packed_int :
- {
- CSeq_loc::TPacked_int::Tdata& ints = loc.SetPacked_int().Set();
- NON_CONST_ITERATE(CSeq_loc::TPacked_int::Tdata, interval_it, ints) {
- x_BothStrandBC(**interval_it);
- }
- }
- break;
- case CSeq_loc::e_Pnt :
- {
- CSeq_loc::TPnt& pnt = loc.SetPnt();
-
- // change both and both-rev to plus and minus, respectively
- if (pnt.CanGetStrand()) {
- ENa_strand strand = pnt.GetStrand();
- if (strand == eNa_strand_both) {
- pnt.SetStrand(eNa_strand_plus);
- ChangeMade(CCleanupChange::eChangeStrand);
- } else if (strand == eNa_strand_both_rev) {
- pnt.SetStrand(eNa_strand_minus);
- ChangeMade(CCleanupChange::eChangeStrand);
- }
+ case CSeq_loc::e_Packed_int: {
+ CSeq_loc::TPacked_int::Tdata& ints = loc.SetPacked_int().Set();
+ NON_CONST_ITERATE(CSeq_loc::TPacked_int::Tdata, interval_it, ints) {
+ x_BothStrandBC(**interval_it);
+ }
+ } break;
+ case CSeq_loc::e_Pnt: {
+ CSeq_loc::TPnt& pnt = loc.SetPnt();
+
+ // change both and both-rev to plus and minus, respectively
+ if (pnt.CanGetStrand()) {
+ ENa_strand strand = pnt.GetStrand();
+ if (strand == eNa_strand_both) {
+ pnt.SetStrand(eNa_strand_plus);
+ ChangeMade(CCleanupChange::eChangeStrand);
+ } else if (strand == eNa_strand_both_rev) {
+ pnt.SetStrand(eNa_strand_minus);
+ ChangeMade(CCleanupChange::eChangeStrand);
}
}
- break;
-
+ } break;
default:
break;
}
}
// holds the first and last pos that we will keep
// (have to use "ints" since might be negative)
- int first_pos = 0;
+ size_t first_pos = 0;
size_t last_pos = ( val.length() - 1 );
// move inwards until there are no more quotes to trim
{
if( FIELD_IS_SET(field, Data) ) {
switch( GET_FIELD(field, Data).Which() ) {
- case CUser_field::C_Data::e_Object:
- return s_FindUserObjectTypeRecursive( GET_FIELD(field, Data).GetObject(), sought_type_label );
- break;
- case CUser_field::C_Data::e_Fields:
- ITERATE( CUser_field::C_Data::TFields, field_iter, GET_FIELD(field, Data).GetFields() ) {
- CConstRef<CUser_object> result = s_FindUserObjectTypeRecursive_helper( **field_iter, sought_type_label );
- if( result ) {
- return result;
- }
+ case CUser_field::C_Data::e_Object:
+ return s_FindUserObjectTypeRecursive( GET_FIELD(field, Data).GetObject(), sought_type_label );
+ break;
+ case CUser_field::C_Data::e_Fields:
+ ITERATE( CUser_field::C_Data::TFields, field_iter, GET_FIELD(field, Data).GetFields() ) {
+ CConstRef<CUser_object> result = s_FindUserObjectTypeRecursive_helper( **field_iter, sought_type_label );
+ if( result ) {
+ return result;
}
- break;
- case CUser_field::C_Data::e_Objects:
- ITERATE( CUser_field::C_Data::TObjects, obj_iter, GET_FIELD(field, Data).GetObjects() ) {
- CConstRef<CUser_object> result = s_FindUserObjectTypeRecursive( **obj_iter, sought_type_label );
- if( result ) {
- return result;
- }
+ }
+ break;
+ case CUser_field::C_Data::e_Objects:
+ ITERATE( CUser_field::C_Data::TObjects, obj_iter, GET_FIELD(field, Data).GetObjects() ) {
+ CConstRef<CUser_object> result = s_FindUserObjectTypeRecursive( **obj_iter, sought_type_label );
+ if( result ) {
+ return result;
}
- break;
- default:
- break;
+ }
+ break;
+ default:
+ break;
}
}
while (xr_itr != seq_feat.SetXref().end()) {
CSeqFeatXref& sfx = **xr_itr;
if (sfx.IsSetData() && sfx.GetData().IsGene()) {
- CGene_ref& gene_ref = sfx.SetData().SetGene();
- if (s_CopyDbToFeat(gene_ref, seq_feat)) {
+ CGene_ref& gene_ref2 = sfx.SetData().SetGene();
+ if (s_CopyDbToFeat(gene_ref2, seq_feat)) {
ChangeMade(CCleanupChange::eChangeDbxrefs);
}
-
- if (s_IsEmptyGeneRef(gene_ref)) {
+ if (s_IsEmptyGeneRef(gene_ref2)) {
xr_itr = seq_feat.SetXref().erase(xr_itr);
ChangeMade(CCleanupChange::eChangeDbxrefs);
continue;
CRNA_ref::C_Ext& ext = GET_MUTABLE (rr, Ext);
const TRNAREF_EXT chs = ext.Which();
switch (chs) {
- case NCBI_RNAEXT(Name):
- {
- string& name = GET_MUTABLE (ext, Name);
- if (NStr::IsBlank (name)) {
- RESET_FIELD (rr, Ext);
- ChangeMade(CCleanupChange::eChangeRNAref);
- break;
- }
-
- static const string rRNA = " rRNA";
- static const string rRNA2 = "_rRNA";
- static const string kRibosomal_Rna = " ribosomal RNA";
- static const string kRibosomal_r_Rna = " ribosomal rRNA";
-
- if (rr.IsSetType()) {
- switch (rr.GetType()) {
- case CRNA_ref::eType_rRNA:
- {{
- size_t len = name.length();
- if (len >= rRNA.length() ) {
- if( NStr::EndsWith(name, rRNA, NStr::eNocase) || NStr::EndsWith(name, rRNA2, NStr::eNocase) ) {
- if( NStr::EndsWith(name, kRibosomal_r_Rna, NStr::eNocase) ) {
- name.replace(len - kRibosomal_r_Rna.length(), name.size(), kRibosomal_Rna);
- } else {
- name.replace(len - rRNA.length(), name.size(), kRibosomal_Rna);
- }
- ChangeMade(CCleanupChange::eChangeQualifiers);
- }
- }
+ case NCBI_RNAEXT(Name): {
+ string& name = GET_MUTABLE (ext, Name);
+ if (NStr::IsBlank (name)) {
+ RESET_FIELD (rr, Ext);
+ ChangeMade(CCleanupChange::eChangeRNAref);
+ break;
+ }
- x_RRNANameBC( name );
+ static const string rRNA = " rRNA";
+ static const string rRNA2 = "_rRNA";
+ static const string kRibosomal_Rna = " ribosomal RNA";
+ static const string kRibosomal_r_Rna = " ribosomal rRNA";
- break;
- }}
- case CRNA_ref::eType_other:
- case CRNA_ref::eType_miscRNA:
- {{
- x_TranslateITSNameAndFlag(name);
-
- // convert to RNA-gen
- string name_copy; // copy because name is about to be destroyed
- name_copy.swap( name );
- ext.SetGen().SetProduct( name_copy );
- ChangeMade(CCleanupChange::eChangeRNAref);
- }}
- break;
- default:
- break;
+ if (rr.IsSetType()) {
+ switch (rr.GetType()) {
+ case CRNA_ref::eType_rRNA:
+ {
+ size_t len = name.length();
+ if (len >= rRNA.length() ) {
+ if( NStr::EndsWith(name, rRNA, NStr::eNocase) || NStr::EndsWith(name, rRNA2, NStr::eNocase) ) {
+ if( NStr::EndsWith(name, kRibosomal_r_Rna, NStr::eNocase) ) {
+ name.replace(len - kRibosomal_r_Rna.length(), name.size(), kRibosomal_Rna);
+ } else {
+ name.replace(len - rRNA.length(), name.size(), kRibosomal_Rna);
+ }
+ ChangeMade(CCleanupChange::eChangeQualifiers);
}
}
+
+ x_RRNANameBC( name );
}
- break;
- case NCBI_RNAEXT(TRNA):
+ break;
+ case CRNA_ref::eType_other:
+ case CRNA_ref::eType_miscRNA:
{
- CTrna_ext& tRNA = GET_MUTABLE (ext, TRNA);
- if (FIELD_IS_SET (tRNA, Aa)) {
- const CTrna_ext::C_Aa& aa = GET_FIELD (tRNA, Aa);
- if (aa.Which() == CTrna_ext::C_Aa::e_not_set) {
- RESET_FIELD (tRNA, Aa);
- ChangeMade(CCleanupChange::eChangeRNAref);
- }
- }
+ x_TranslateITSNameAndFlag(name);
- if (! CODON_ON_TRNAEXT_IS_SORTED(tRNA, s_CodonCompare)) {
- SORT_CODON_ON_TRNAEXT(tRNA, s_CodonCompare);
- ChangeMade(CCleanupChange::eChange_tRna);
- }
+ // convert to RNA-gen
+ string name_copy; // copy because name is about to be destroyed
+ name_copy.swap( name );
+ ext.SetGen().SetProduct( name_copy );
+ ChangeMade(CCleanupChange::eChangeRNAref);
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ } break;
+ case NCBI_RNAEXT(TRNA): {
+ CTrna_ext& tRNA = GET_MUTABLE (ext, TRNA);
+ if (FIELD_IS_SET (tRNA, Aa)) {
+ const CTrna_ext::C_Aa& aa = GET_FIELD (tRNA, Aa);
+ if (aa.Which() == CTrna_ext::C_Aa::e_not_set) {
+ RESET_FIELD (tRNA, Aa);
+ ChangeMade(CCleanupChange::eChangeRNAref);
+ }
+ }
- if( ! CODON_ON_TRNAEXT_IS_UNIQUE(tRNA, s_CodonEqual) ) {
- UNIQUE_CODON_ON_TRNAEXT(tRNA, s_CodonEqual);
- ChangeMade(CCleanupChange::eChange_tRna);
- }
+ if (! CODON_ON_TRNAEXT_IS_SORTED(tRNA, s_CodonCompare)) {
+ SORT_CODON_ON_TRNAEXT(tRNA, s_CodonCompare);
+ ChangeMade(CCleanupChange::eChange_tRna);
+ }
- REMOVE_IF_EMPTY_CODON_ON_TRNAEXT(tRNA);
+ if( ! CODON_ON_TRNAEXT_IS_UNIQUE(tRNA, s_CodonEqual) ) {
+ UNIQUE_CODON_ON_TRNAEXT(tRNA, s_CodonEqual);
+ ChangeMade(CCleanupChange::eChange_tRna);
+ }
- }
- break;
- case NCBI_RNAEXT(Gen):
- {
- RnarefGenBC(rr);
- }
- break;
- default:
- break;
+ REMOVE_IF_EMPTY_CODON_ON_TRNAEXT(tRNA);
+ } break;
+ case NCBI_RNAEXT(Gen): {
+ RnarefGenBC(rr);
+ } break;
+ default:
+ break;
}
}
if (FIELD_IS_SET (rr, Type)) {
TRNAREF_TYPE typ = GET_FIELD (rr, Type);
switch (typ) {
- case NCBI_RNAREF(mRNA):
- {
- }
- break;
- case NCBI_RNAREF(tRNA):
- {
- }
- break;
- case NCBI_RNAREF(rRNA):
- {
- }
- break;
- case NCBI_RNAREF(other):
- {
- if (FIELD_IS_SET (rr, Ext)) {
- CRNA_ref::C_Ext& ext = GET_MUTABLE (rr, Ext);
- const TRNAREF_EXT chs = ext.Which();
- if (chs == NCBI_RNAEXT(Name)) {
- string& str = GET_MUTABLE (ext, Name);
- if ( str.empty() || NStr::EqualNocase (str, "misc_RNA")) {
- SET_FIELD( rr, Type, NCBI_RNAREF(miscRNA) );
- RESET_FIELD(rr, Ext);
- ChangeMade(CCleanupChange::eChangeRNAref);
- } else if (NStr::EqualNocase (str, "ncRNA")) {
- SET_FIELD( rr, Type, NCBI_RNAREF(ncRNA) );
- RESET_FIELD(rr, Ext);
- ChangeMade(CCleanupChange::eChangeRNAref);
- } else if (NStr::EqualNocase (str, "tmRNA")) {
- SET_FIELD( rr, Type, NCBI_RNAREF(tmRNA) );
- RESET_FIELD(rr, Ext);
- ChangeMade(CCleanupChange::eChangeRNAref);
- } else if (s_IsNcrnaName (str)) {
- SET_FIELD( rr, Type, NCBI_RNAREF(ncRNA) );
- const string new_class = str;
- SET_FIELD( rr.SetExt().SetGen(), Class, new_class );
- ChangeMade(CCleanupChange::eChangeRNAref);
- } else {
- SET_FIELD( rr, Type, NCBI_RNAREF(miscRNA) );
- const string new_product = str;
- SET_FIELD( rr.SetExt().SetGen(), Product, new_product );
- ChangeMade(CCleanupChange::eChangeRNAref);
- }
- }
+ case NCBI_RNAREF(mRNA):
+ break;
+ case NCBI_RNAREF(tRNA):
+ break;
+ case NCBI_RNAREF(rRNA):
+ break;
+ case NCBI_RNAREF(other): {
+ if (FIELD_IS_SET (rr, Ext)) {
+ CRNA_ref::C_Ext& ext = GET_MUTABLE (rr, Ext);
+ const TRNAREF_EXT chs = ext.Which();
+ if (chs == NCBI_RNAEXT(Name)) {
+ string& str = GET_MUTABLE (ext, Name);
+ if ( str.empty() || NStr::EqualNocase (str, "misc_RNA")) {
+ SET_FIELD( rr, Type, NCBI_RNAREF(miscRNA) );
+ RESET_FIELD(rr, Ext);
+ ChangeMade(CCleanupChange::eChangeRNAref);
+ } else if (NStr::EqualNocase (str, "ncRNA")) {
+ SET_FIELD( rr, Type, NCBI_RNAREF(ncRNA) );
+ RESET_FIELD(rr, Ext);
+ ChangeMade(CCleanupChange::eChangeRNAref);
+ } else if (NStr::EqualNocase (str, "tmRNA")) {
+ SET_FIELD( rr, Type, NCBI_RNAREF(tmRNA) );
+ RESET_FIELD(rr, Ext);
+ ChangeMade(CCleanupChange::eChangeRNAref);
+ } else if (s_IsNcrnaName (str)) {
+ SET_FIELD( rr, Type, NCBI_RNAREF(ncRNA) );
+ const string new_class = str;
+ SET_FIELD( rr.SetExt().SetGen(), Class, new_class );
+ ChangeMade(CCleanupChange::eChangeRNAref);
} else {
SET_FIELD( rr, Type, NCBI_RNAREF(miscRNA) );
+ const string new_product = str;
+ SET_FIELD( rr.SetExt().SetGen(), Product, new_product );
ChangeMade(CCleanupChange::eChangeRNAref);
}
}
- break;
- default:
- break;
+ } else {
+ SET_FIELD( rr, Type, NCBI_RNAREF(miscRNA) );
+ ChangeMade(CCleanupChange::eChangeRNAref);
+ }
+ } break;
+ default:
+ break;
}
}
}
switch (rna_type) {
case CRNA_ref::eType_snRNA:
case CRNA_ref::eType_scRNA:
- case CRNA_ref::eType_snoRNA:
- {{
-
+ case CRNA_ref::eType_snoRNA: {
string rna_type_name = CRNA_ref::GetRnaTypeName(rna_type);
if (rna.IsSetExt() && rna.GetExt().IsName() &&
!NStr::EqualNocase(rna.GetExt().GetName(), rna_type_name))
rna.SetType(CRNA_ref::eType_ncRNA);
rna.SetExt().SetGen().SetClass(rna_type_name);
any_change = true;
- break;
- }}
+ } break;
default:
break;
}
}
}
-void CNewCleanup_imp::x_MoveCdregionXrefsToProt (CCdregion& cds, CSeq_feat& seqfeat)
+void CNewCleanup_imp::x_MoveCdregionXrefsToProt (CCdregion&, CSeq_feat& seqfeat)
{
if( !seqfeat.IsSetXref() || ! seqfeat.IsSetProduct() ) {
return;
case NCBI_PUB(Pmid):
pmid = ENTREZ_ID_TO(int, pub.GetPmid().Get());
break;
- case NCBI_PUB(Gen):
- {
- const CCit_gen &gen = pub.GetGen();
- if( gen.IsSetCit() || gen.IsSetJournal() || gen.IsSetDate() || gen.IsSetSerial_number() ) {
- m_PubdescCitGenLabelVec.push_back( kEmptyStr );
- string &label = m_PubdescCitGenLabelVec.back();
- pub.GetLabel( &label, CPub::eContent, true );
- }
- }
- break;
+ case NCBI_PUB(Gen): {
+ const CCit_gen &gen = pub.GetGen();
+ if( gen.IsSetCit() || gen.IsSetJournal() || gen.IsSetDate() || gen.IsSetSerial_number() ) {
+ m_PubdescCitGenLabelVec.push_back( kEmptyStr );
+ string& label = m_PubdescCitGenLabelVec.back();
+ pub.GetLabel(&label, CPub::eContent, CPub::fLabel_Unique);
+ }
+ } break;
case NCBI_PUB(Equiv):
x_NotePubdescOrAnnotPubs_RecursionHelper( pub.GetEquiv(), muid, pmid );
break;
void CNewCleanup_imp::x_RememberPubOldLabel( CPub &pub )
{
string old_label;
- pub.GetLabel( &old_label, CPub::eContent, true);
+ pub.GetLabel(&old_label, CPub::eContent, CPub::fLabel_Unique);
m_OldLabelToPubMap.insert( TOldLabelToPubMap::value_type(old_label, CRef<CPub>(&pub)) );
}
CMolInfo::TBiomol s_BiomolFromGIBBMolType(EGIBB_mol mol)
{
switch (mol) {
- case eGIBB_mol_genomic:
- return CMolInfo::eBiomol_genomic;
- break;
- case eGIBB_mol_genomic_mRNA:
- return CMolInfo::eBiomol_genomic_mRNA;
- break;
- case eGIBB_mol_mRNA:
- return CMolInfo::eBiomol_mRNA;
- break;
- case eGIBB_mol_other:
- return CMolInfo::eBiomol_other;
- break;
- case eGIBB_mol_other_genetic:
- return CMolInfo::eBiomol_other_genetic;
- break;
- case eGIBB_mol_peptide:
- return CMolInfo::eBiomol_peptide;
- break;
- case eGIBB_mol_pre_mRNA:
- return CMolInfo::eBiomol_pre_RNA;
- break;
- case eGIBB_mol_rRNA:
- return CMolInfo::eBiomol_rRNA;
- break;
- case eGIBB_mol_scRNA:
- return CMolInfo::eBiomol_scRNA;
- break;
- case eGIBB_mol_snRNA:
- return CMolInfo::eBiomol_snRNA;
- break;
- case eGIBB_mol_tRNA:
- return CMolInfo::eBiomol_tmRNA;
- break;
- case eGIBB_mol_unknown:
- return CMolInfo::eBiomol_unknown;
- break;
+ case eGIBB_mol_genomic:
+ return CMolInfo::eBiomol_genomic;
+ break;
+ case eGIBB_mol_genomic_mRNA:
+ return CMolInfo::eBiomol_genomic_mRNA;
+ break;
+ case eGIBB_mol_mRNA:
+ return CMolInfo::eBiomol_mRNA;
+ break;
+ case eGIBB_mol_other:
+ return CMolInfo::eBiomol_other;
+ break;
+ case eGIBB_mol_other_genetic:
+ return CMolInfo::eBiomol_other_genetic;
+ break;
+ case eGIBB_mol_peptide:
+ return CMolInfo::eBiomol_peptide;
+ break;
+ case eGIBB_mol_pre_mRNA:
+ return CMolInfo::eBiomol_pre_RNA;
+ break;
+ case eGIBB_mol_rRNA:
+ return CMolInfo::eBiomol_rRNA;
+ break;
+ case eGIBB_mol_scRNA:
+ return CMolInfo::eBiomol_scRNA;
+ break;
+ case eGIBB_mol_snRNA:
+ return CMolInfo::eBiomol_snRNA;
+ break;
+ case eGIBB_mol_tRNA:
+ return CMolInfo::eBiomol_tmRNA;
+ break;
+ case eGIBB_mol_unknown:
+ return CMolInfo::eBiomol_unknown;
+ break;
}
return CMolInfo::eBiomol_unknown;
}
{
switch (method)
{
- case eGIBB_method_concept_trans:
- return CMolInfo::eTech_concept_trans;
- break;
- case eGIBB_method_seq_pept:
- return CMolInfo::eTech_seq_pept;
- break;
- case eGIBB_method_both:
- return CMolInfo::eTech_both;
- break;
- case eGIBB_method_seq_pept_overlap:
- return CMolInfo::eTech_seq_pept_overlap;
- break;
- case eGIBB_method_seq_pept_homol:
- return CMolInfo::eTech_seq_pept;
- break;
- case eGIBB_method_concept_trans_a:
- return CMolInfo::eTech_concept_trans_a;
- break;
- case eGIBB_method_other:
- return CMolInfo::eTech_other;
- break;
-
+ case eGIBB_method_concept_trans:
+ return CMolInfo::eTech_concept_trans;
+ break;
+ case eGIBB_method_seq_pept:
+ return CMolInfo::eTech_seq_pept;
+ break;
+ case eGIBB_method_both:
+ return CMolInfo::eTech_both;
+ break;
+ case eGIBB_method_seq_pept_overlap:
+ return CMolInfo::eTech_seq_pept_overlap;
+ break;
+ case eGIBB_method_seq_pept_homol:
+ return CMolInfo::eTech_seq_pept;
+ break;
+ case eGIBB_method_concept_trans_a:
+ return CMolInfo::eTech_concept_trans_a;
+ break;
+ case eGIBB_method_other:
+ return CMolInfo::eTech_other;
+ break;
}
return CMolInfo::eTech_other;
}
{
bool changed = false;
switch (mod) {
- case eGIBB_mod_partial:
- mi.SetCompleteness(CMolInfo::eCompleteness_partial);
- changed = true;
- break;
- case eGIBB_mod_complete:
- mi.SetCompleteness(CMolInfo::eCompleteness_complete);
- changed = true;
- break;
- case eGIBB_mod_no_left:
- mi.SetCompleteness(CMolInfo::eCompleteness_no_left);
- changed = true;
- break;
- case eGIBB_mod_no_right:
- mi.SetCompleteness(CMolInfo::eCompleteness_no_right);
- changed = true;
- break;
- case eGIBB_mod_est:
- mi.SetTech(CMolInfo::eTech_est);
- changed = true;
- break;
- case eGIBB_mod_sts:
- mi.SetCompleteness(CMolInfo::eTech_sts);
- changed = true;
- break;
- case eGIBB_mod_survey:
- mi.SetCompleteness(CMolInfo::eTech_survey);
- changed = true;
- break;
- default:
- break;
+ case eGIBB_mod_partial:
+ mi.SetCompleteness(CMolInfo::eCompleteness_partial);
+ changed = true;
+ break;
+ case eGIBB_mod_complete:
+ mi.SetCompleteness(CMolInfo::eCompleteness_complete);
+ changed = true;
+ break;
+ case eGIBB_mod_no_left:
+ mi.SetCompleteness(CMolInfo::eCompleteness_no_left);
+ changed = true;
+ break;
+ case eGIBB_mod_no_right:
+ mi.SetCompleteness(CMolInfo::eCompleteness_no_right);
+ changed = true;
+ break;
+ case eGIBB_mod_est:
+ mi.SetTech(CMolInfo::eTech_est);
+ changed = true;
+ break;
+ case eGIBB_mod_sts:
+ mi.SetCompleteness(CMolInfo::eTech_sts);
+ changed = true;
+ break;
+ case eGIBB_mod_survey:
+ mi.SetCompleteness(CMolInfo::eTech_survey);
+ changed = true;
+ break;
+ default:
+ break;
}
return changed;
}
{
EDIT_EACH_SEQDESC_ON_SEQDESCR( d, seq_descr ) {
switch ((*d)->Which()) {
- case CSeqdesc::e_Mol_type:
- case CSeqdesc::e_Method:
- case CSeqdesc::e_Org:
- ERASE_SEQDESC_ON_SEQDESCR(d, seq_descr);
-ChangeMade(CCleanupChange::eRemoveDescriptor);
-break;
- default:
- break;
+ case CSeqdesc::e_Mol_type:
+ case CSeqdesc::e_Method:
+ case CSeqdesc::e_Org:
+ ERASE_SEQDESC_ON_SEQDESCR(d, seq_descr);
+ ChangeMade(CCleanupChange::eRemoveDescriptor);
+ break;
+ default:
+ break;
}
}
}
const auto& titles = jour.GetTitle().Get();
for (auto title : titles) {
switch (title->Which()) {
- CHECK_TITLE(Name)
- CHECK_TITLE(Tsub)
- CHECK_TITLE(Trans)
- CHECK_TITLE(Jta)
- CHECK_TITLE(Iso_jta)
- CHECK_TITLE(Ml_jta)
- CHECK_TITLE(Coden)
- CHECK_TITLE(Issn)
- CHECK_TITLE(Abr)
- CHECK_TITLE(Isbn)
- default:
- break;
+ CHECK_TITLE(Name)
+ CHECK_TITLE(Tsub)
+ CHECK_TITLE(Trans)
+ CHECK_TITLE(Jta)
+ CHECK_TITLE(Iso_jta)
+ CHECK_TITLE(Ml_jta)
+ CHECK_TITLE(Coden)
+ CHECK_TITLE(Issn)
+ CHECK_TITLE(Abr)
+ CHECK_TITLE(Isbn)
+ default:
+ break;
}
}
}
return false;
}
switch (feat.GetData().Which()) {
- case CSeqFeatData::e_Gene:
- is_empty = x_ShouldRemoveEmptyGene(feat.GetData().GetGene(), feat);
- break;
- case CSeqFeatData::e_Prot:
- is_empty = x_ShouldRemoveEmptyProt(feat.GetData().GetProt());
- break;
- case CSeqFeatData::e_Pub:
- is_empty = x_ShouldRemoveEmptyPub(feat.GetData().GetPub());
- break;
- case CSeqFeatData::e_Comment:
- if (!feat.IsSetComment() || NStr::IsBlank(feat.GetComment())) {
- is_empty = true;
- }
- break;
- default:
- break;
+ case CSeqFeatData::e_Gene:
+ is_empty = x_ShouldRemoveEmptyGene(feat.GetData().GetGene(), feat);
+ break;
+ case CSeqFeatData::e_Prot:
+ is_empty = x_ShouldRemoveEmptyProt(feat.GetData().GetProt());
+ break;
+ case CSeqFeatData::e_Pub:
+ is_empty = x_ShouldRemoveEmptyPub(feat.GetData().GetPub());
+ break;
+ case CSeqFeatData::e_Comment:
+ if (!feat.IsSetComment() || NStr::IsBlank(feat.GetComment())) {
+ is_empty = true;
+ }
+ break;
+ default:
+ break;
}
return is_empty;
}
switch( GET_FIELD_OR_DEFAULT(
bioseq_set, Class, NCBI_BIOSEQSETCLASS(not_set)) )
{
- case CBioseq_set::eClass_nuc_prot:
- x_BioseqSetNucProtEC( bioseq_set );
- break;
- case CBioseq_set::eClass_genbank:
- x_BioseqSetGenBankEC(bioseq_set);
- x_RemovePopPhyMolInfo(bioseq_set);
- break;
- case CBioseq_set::eClass_mut_set:
- case CBioseq_set::eClass_pop_set:
- case CBioseq_set::eClass_phy_set:
- case CBioseq_set::eClass_eco_set:
- case CBioseq_set::eClass_wgs_set:
- case CBioseq_set::eClass_small_genome_set:
- x_RemovePopPhyBioSource(bioseq_set);
- x_RemovePopPhyMolInfo(bioseq_set);
- break;
- default:
- // no special logic for other bioseq-set classes
- break;
+ case CBioseq_set::eClass_nuc_prot:
+ x_BioseqSetNucProtEC( bioseq_set );
+ break;
+ case CBioseq_set::eClass_genbank:
+ x_BioseqSetGenBankEC(bioseq_set);
+ x_RemovePopPhyMolInfo(bioseq_set);
+ break;
+ case CBioseq_set::eClass_mut_set:
+ case CBioseq_set::eClass_pop_set:
+ case CBioseq_set::eClass_phy_set:
+ case CBioseq_set::eClass_eco_set:
+ case CBioseq_set::eClass_wgs_set:
+ case CBioseq_set::eClass_small_genome_set:
+ x_RemovePopPhyBioSource(bioseq_set);
+ x_RemovePopPhyMolInfo(bioseq_set);
+ break;
+ default:
+ // no special logic for other bioseq-set classes
+ break;
}
}
if (seh && s_HasRefSeqPGAPStructuredComment(seh)) {
continue;
}
- auto& set = (*it)->SetSet();
- auto& dset = set.SetDescr();
- x_MoveNpPub(set, dset);
+ auto& set2 = (*it)->SetSet();
+ auto& dset = set2.SetDescr();
+ x_MoveNpPub(set2, dset);
if (dset.Set().empty()) {
- set.ResetDescr();
+ set2.ResetDescr();
}
}
}
}
-void CNewCleanup_imp::CreatePubFromFeat(CSeq_feat& feat)
-{
-}
-
-
void CNewCleanup_imp::ResynchProteinPartials ( CSeq_feat& feat )
{
if (!feat.IsSetData()) {
//LCOV_EXCL_STOP
-
-
void CNewCleanup_imp::SetGlobalFlags(const CSeq_entry& se, bool reset)
{
if (reset) {
ITERATE(CBioseq::TId, id, bs.GetId()) {
const CSeq_id& sid = **id;
switch (sid.Which()) {
- case NCBI_SEQID(Embl):
- case NCBI_SEQID(Ddbj):
- m_IsEmblOrDdbj = true;
- break;
- default:
- break;
+ case NCBI_SEQID(Embl):
+ case NCBI_SEQID(Ddbj):
+ m_IsEmblOrDdbj = true;
+ break;
+ default:
+ break;
}
}
}
void MoveDbxrefs(CSeq_feat& sf);
void MoveStandardName(CSeq_feat& sf);
- void CreatePubFromFeat(CSeq_feat& sf);
void ResynchProteinPartials ( CSeq_feat& feat );
void ResynchPeptidePartials( CBioseq& seq );
void x_SetPartialsForProtein(CBioseq& prot, bool partial5, bool partial3, bool feat_partial);
// string cleanup funcs
void x_CleanupStringMarkChanged( std::string &str );
void x_CleanupStringJunkMarkChanged( std::string &str );
- void x_CleanupVisStringMarkChanged( std::string &str );
void x_ConvertDoubleQuotesMarkChanged( std::string &str );
bool x_CompressSpaces( string &str );
void x_CompressStringSpacesMarkChanged( std::string &str );
void x_StripSpacesMarkChanged( std::string& str );
void x_RemoveSpacesBetweenTildesMarkChanged( std::string & str );
- void X_CommentTildeFixes( std::string & str );
void x_TruncateSpacesMarkChanged( std::string & str );
void x_TrimInternalSemicolonsMarkChanged( std::string & str );
#ifndef OBJTOOLS_DATA_LOADERS_BLASTDB___REMOTE_BLASTDB_ADAPTER__HPP
#define OBJTOOLS_DATA_LOADERS_BLASTDB___REMOTE_BLASTDB_ADAPTER__HPP
-/* $Id: remote_blastdb_adapter.hpp 468783 2015-05-28 13:00:08Z vasilche $
+/* $Id: remote_blastdb_adapter.hpp 683929 2024-06-10 12:07:52Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
if (((end-begin) % kRmtSequenceSliceSize) == 0) {
idx = ilog2( (end-begin)/kRmtSequenceSliceSize );
} else {
- idx = m_SeqDataVector.size() - 1;
+ idx = static_cast<unsigned int>(m_SeqDataVector.size() - 1);
}
_ASSERT((end == (begin + (int)(0x1<<idx)*kRmtSequenceSliceSize)) ||
((idx+1) == m_SeqDataVector.size()));
-/* $Id: dispatcher.cpp 668141 2023-05-30 15:50:28Z grichenk $
+/* $Id: dispatcher.cpp 675188 2023-11-16 13:46:47Z ivanov $
* ===========================================================================
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
}
+bool CReadDispatcher::HasReaderWithHUPIncluded() const
+{
+ for ( auto& rd : m_Readers ) {
+ if ( rd.second->HasHUPIncluded() ) {
+ return true;
+ }
+ }
+ return false;
+}
+
+
void CReadDispatcher::ResetCaches(void)
{
NON_CONST_ITERATE(TReaders, rd, m_Readers) {
-/* $Id: gbloader.cpp 674108 2023-10-18 18:11:17Z ivanov $
+/* $Id: gbloader.cpp 676925 2023-12-28 20:33:26Z sadyrovr $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
#include <corelib/plugin_manager_impl.hpp>
#include <corelib/plugin_manager_store.hpp>
+#include <util/md5.hpp>
+
#include <algorithm>
: m_ReaderPtr(0),
m_ParamTree(0),
m_Preopen(ePreopenByConfig),
- m_HasHUPIncluded(false),
+ m_UsePSGInitialized(false),
+ m_UsePSG(false),
m_PSGNoSplit(false),
- m_ReaderParams(new CReaderParams)
-
+ m_HasHUPIncluded(false)
{
}
CGBLoaderParams::CGBLoaderParams(const string& reader_name)
- : m_ReaderName(reader_name),
- m_ReaderPtr(0),
- m_ParamTree(0),
- m_Preopen(ePreopenByConfig),
- m_HasHUPIncluded(false),
- m_PSGNoSplit(false),
- m_ReaderParams(new CReaderParams)
+ : CGBLoaderParams()
{
+ m_ReaderName = reader_name;
}
CGBLoaderParams::CGBLoaderParams(CReader* reader_ptr)
- : m_ReaderPtr(reader_ptr),
- m_ParamTree(0),
- m_Preopen(ePreopenByConfig),
- m_HasHUPIncluded(false),
- m_PSGNoSplit(false),
- m_ReaderParams(new CReaderParams)
+ : CGBLoaderParams()
{
+ m_ReaderPtr = reader_ptr;
}
CGBLoaderParams::CGBLoaderParams(const TParamTree* param_tree)
- : m_ReaderPtr(0),
- m_ParamTree(param_tree),
- m_Preopen(ePreopenByConfig),
- m_HasHUPIncluded(false),
- m_PSGNoSplit(false),
- m_ReaderParams(new CReaderParams)
+ : CGBLoaderParams()
{
+ m_ParamTree = param_tree;
}
CGBLoaderParams::CGBLoaderParams(EPreopenConnection preopen)
- : m_ReaderPtr(0),
- m_ParamTree(0),
- m_Preopen(preopen),
- m_HasHUPIncluded(false),
- m_PSGNoSplit(false),
- m_ReaderParams(new CReaderParams)
+ : CGBLoaderParams()
{
+ m_Preopen = preopen;
}
-CGBLoaderParams::~CGBLoaderParams(void)
-{
-}
+CGBLoaderParams::~CGBLoaderParams(void) = default;
-
-CGBLoaderParams::CGBLoaderParams(const CGBLoaderParams& params)
- : m_ReaderName(params.m_ReaderName),
- m_WriterName(params.m_WriterName),
- m_LoaderMethod(params.m_LoaderMethod),
- m_ReaderPtr(params.m_ReaderPtr),
- m_ParamTree(params.m_ParamTree),
- m_Preopen(params.m_Preopen),
- m_HasHUPIncluded(params.m_HasHUPIncluded),
- m_WebCookie(params.m_WebCookie),
- m_LoaderName(params.m_LoaderName),
- m_PSGServiceName(params.m_PSGServiceName),
- m_PSGNoSplit(params.m_PSGNoSplit),
- m_ReaderParams(new CReaderParams(*params.m_ReaderParams))
-{
-}
-
-
-CGBLoaderParams& CGBLoaderParams::operator=(const CGBLoaderParams& params)
-{
- if ( this != ¶ms ) {
- m_ReaderName = params.m_ReaderName;
- m_WriterName = params.m_WriterName;
- m_LoaderMethod = params.m_LoaderMethod;
- m_ReaderPtr = params.m_ReaderPtr;
- m_ParamTree = params.m_ParamTree;
- m_Preopen = params.m_Preopen;
- m_HasHUPIncluded = params.m_HasHUPIncluded;
- m_WebCookie = params.m_WebCookie;
- m_LoaderName = params.m_LoaderName;
- m_PSGServiceName = params.m_PSGServiceName;
- m_PSGNoSplit = params.m_PSGNoSplit;
- m_ReaderParams.reset(new CReaderParams(*params.m_ReaderParams));
- }
- return *this;
-}
+CGBLoaderParams::CGBLoaderParams(const CGBLoaderParams&) = default;
+CGBLoaderParams& CGBLoaderParams::operator=(const CGBLoaderParams&) = default;
void CGBLoaderParams::SetReaderPtr(CReader* reader_ptr)
bool CGBLoaderParams::IsSetEnableSNP(void) const
{
- return m_ReaderParams->IsSetEnableSNP();
+ return !m_EnableSNP.IsNull();
}
bool CGBLoaderParams::GetEnableSNP(void) const
{
- return m_ReaderParams->GetEnableSNP();
+ return m_EnableSNP.GetValue();
}
void CGBLoaderParams::SetEnableSNP(bool enable)
{
- m_ReaderParams->SetEnableSNP(enable);
+ m_EnableSNP = enable;
}
bool CGBLoaderParams::IsSetEnableWGS(void) const
{
- return m_ReaderParams->IsSetEnableWGS();
+ return !m_EnableWGS.IsNull();
}
bool CGBLoaderParams::GetEnableWGS(void) const
{
- return m_ReaderParams->GetEnableWGS();
+ return m_EnableWGS.GetValue();
}
void CGBLoaderParams::SetEnableWGS(bool enable)
{
- m_ReaderParams->SetEnableWGS(enable);
+ m_EnableWGS = enable;
}
bool CGBLoaderParams::IsSetEnableCDD(void) const
{
- return m_ReaderParams->IsSetEnableCDD();
+ return !m_EnableCDD.IsNull();
}
bool CGBLoaderParams::GetEnableCDD(void) const
{
- return m_ReaderParams->GetEnableCDD();
+ return m_EnableCDD.GetValue();
}
void CGBLoaderParams::SetEnableCDD(bool enable)
{
- m_ReaderParams->SetEnableCDD(enable);
+ m_EnableCDD = enable;
}
eParam_NoThread, GENBANK_LOADER_METHOD);
typedef NCBI_PARAM_TYPE(GENBANK, LOADER_METHOD) TGenbankLoaderMethod;
+#define NCBI_GBLOADER_PARAM_LOADER_PSG = "loader_psg"
+#define NCBI_PSG_READER_NAME "psg"
+
+
+string CGBDataLoader::x_GetLoaderMethod(const TParamTree* params)
+{
+ string method = GetParam(params, NCBI_GBLOADER_PARAM_LOADER_METHOD);
+ if ( method.empty() ) {
+ // try config first
+ method = TGenbankLoaderMethod::GetDefault();
+ }
+ return method;
+}
+
+
+static bool s_CheckPSGMethod(const string& loader_method)
+{
+ bool use_psg = false;
+ if ( NStr::FindNoCase(loader_method, NCBI_PSG_READER_NAME) != NPOS ) {
+ vector<string> str_list;
+ NStr::Split(loader_method, ";", str_list);
+ for (auto s : str_list) {
+ if ( NStr::EqualNocase(s, NCBI_PSG_READER_NAME) ) {
+#ifdef HAVE_PSG_LOADER
+ if (str_list.size() == 1) {
+ use_psg = true;
+ break;
+ }
+ // PSG method can not be combined with any other methods.
+ NCBI_THROW(CLoaderException, eBadConfig,
+ "'PSG' loader method can not be combined with other methods: '" + loader_method + "'");
+#else
+ // PSG method is not available
+ NCBI_THROW(CLoaderException, eBadConfig,
+ "'PSG' loader method is not available: '" + loader_method + "'");
+#endif
+ }
+ }
+ }
+ return use_psg;
+}
+
+
+static bool s_GetDefaultUsePSG()
+{
+ static atomic<bool> initialized;
+ static atomic<bool> loader_psg;
+ if ( !initialized.load(memory_order_acquire) ) {
+ bool new_value = false;
+#ifdef HAVE_PSG_LOADER
+ if ( TGenbankLoaderPsg::GetDefault() ) {
+ new_value = true;
+ }
+#endif
+ if ( !new_value ) {
+ new_value = s_CheckPSGMethod(TGenbankLoaderMethod::GetDefault());
+ }
+ loader_psg.store(new_value, memory_order_relaxed);
+ initialized.store(true, memory_order_release);
+ }
+ return loader_psg.load(memory_order_relaxed);
+}
+
+
+static bool s_GetDefaultUsePSG(const CGBLoaderParams::TParamTree* param_tree)
+{
+ if ( param_tree ) {
+ if ( const CGBLoaderParams::TParamTree* gb_params = CGBDataLoader::GetLoaderParams(param_tree) ) {
+#ifdef HAVE_LOADER_PSG
+ auto loader_psg_param = CGBDataLoader::GetParam(gb_params, NCBI_GBLOADER_PARAM_LOADER_PSG);
+ if ( !loader_psg_param.empty() ) {
+ try {
+ return NStr::StringToBool(loader_psg_param);
+ }
+ catch (CStringException& ex) {
+ NCBI_THROW_FMT(CConfigException, eInvalidParameter,
+ "Cannot init GenBank loader, incorrect parameter format: "
+ << NCBI_GBLOADER_PARAM_LOADER_PSG << " : " << loader_psg_param
+ << ". " << ex.what());
+ }
+ }
+#endif
+ string loader_method = CGBDataLoader::GetParam(gb_params, NCBI_GBLOADER_PARAM_LOADER_METHOD);
+ if ( !loader_method.empty() ) {
+ return s_CheckPSGMethod(loader_method);
+ }
+ }
+ }
+ return s_GetDefaultUsePSG();
+}
+
+
+bool CGBLoaderParams::GetUsePSG() const
+{
+ if ( m_UsePSGInitialized ) {
+ return m_UsePSG;
+ }
+
+ string loader_method = GetLoaderMethod();
+ if (loader_method.empty()) {
+ loader_method = GetReaderName();
+ }
+ if (loader_method.empty()) {
+ // use default settings from config
+ m_UsePSG = s_GetDefaultUsePSG(GetParamTree());
+ }
+ else {
+ m_UsePSG = s_CheckPSGMethod(loader_method);
+ }
+ m_UsePSGInitialized = true;
+ return m_UsePSG;
+}
+
+/*
void CGBDataLoader::SetLoaderMethod(CGBLoaderParams& params)
{
string loader_method = params.GetLoaderMethod();
"'PSG' loader method can not be combined with other methods: '" + loader_method + "'");
}
}
-
+*/
CGBDataLoader::TRegisterLoaderInfo CGBDataLoader::RegisterInObjectManager(
CObjectManager& om,
CObjectManager::TPriority priority)
{
CGBLoaderParams params(reader_ptr);
- SetLoaderMethod(params);
-
- if (TGenbankLoaderPsg::GetDefault()) {
-#if defined(HAVE_PSG_LOADER)
- return CPSGDataLoader::RegisterInObjectManager(om, params, is_default, priority);
-#else
- ERR_POST_X(3, Critical << "PSG Loader is requested but not available");
- TRegisterLoaderInfo info;
- info.Set(nullptr, false);
- return info;
-#endif
- }
- return CGBDataLoader_Native::RegisterInObjectManager(om, params, is_default, priority);
+ return RegisterInObjectManager(om, params, is_default, priority);
}
CObjectManager::TPriority priority)
{
CGBLoaderParams params(reader_name);
- SetLoaderMethod(params);
-
- if (TGenbankLoaderPsg::GetDefault()) {
-#if defined(HAVE_PSG_LOADER)
- return CPSGDataLoader::RegisterInObjectManager(om, params, is_default, priority);
-#else
- ERR_POST_X(3, Critical << "PSG Loader is requested but not available");
- TRegisterLoaderInfo info;
- info.Set(nullptr, false);
- return info;
-#endif
- }
- return CGBDataLoader_Native::RegisterInObjectManager(om, params, is_default, priority);
+ return RegisterInObjectManager(om, params, is_default, priority);
}
priority);
}
+string CGBDataLoader::GetLoaderNameFromArgs(EIncludeHUP include_hup)
+{
+ return GBLOADER_HUP_NAME;
+}
CGBDataLoader::TRegisterLoaderInfo CGBDataLoader::RegisterInObjectManager(
CObjectManager& om,
CObjectManager::EIsDefault is_default,
CObjectManager::TPriority priority)
{
- CGBLoaderParams params("PUBSEQOS2:PUBSEQOS");
+ CGBLoaderParams params;
params.SetHUPIncluded(true, web_cookie);
- SetLoaderMethod(params);
-
- if (TGenbankLoaderPsg::GetDefault()) {
-#if defined(HAVE_PSG_LOADER)
- return CPSGDataLoader::RegisterInObjectManager(om, params, is_default, priority);
-#else
- ERR_POST_X(3, Critical << "PSG Loader is requested but not available");
- TRegisterLoaderInfo info;
- info.Set(nullptr, false);
- return info;
-#endif
- }
- return CGBDataLoader_Native::RegisterInObjectManager(om, params, is_default, priority);
+ return RegisterInObjectManager(om, params, is_default, priority);
}
-string CGBDataLoader::GetLoaderNameFromArgs(EIncludeHUP /*include_hup*/)
+string CGBDataLoader::GetLoaderNameFromArgs(EIncludeHUP include_hup,
+ const string& web_cookie)
{
- return GBLOADER_HUP_NAME;
+ CGBLoaderParams params;
+ params.SetHUPIncluded(true, web_cookie);
+ return GetLoaderNameFromArgs(params);
}
CGBDataLoader::TRegisterLoaderInfo CGBDataLoader::RegisterInObjectManager(
is_default, priority);
}
+string CGBDataLoader::GetLoaderNameFromArgs(const string& reader_name,
+ EIncludeHUP include_hup)
+{
+ return GBLOADER_HUP_NAME;
+}
+
+
CGBDataLoader::TRegisterLoaderInfo CGBDataLoader::RegisterInObjectManager(
CObjectManager& om,
const string& reader_name,
{
CGBLoaderParams params(reader_name);
params.SetHUPIncluded(true, web_cookie);
- SetLoaderMethod(params);
-
- if (TGenbankLoaderPsg::GetDefault()) {
-#if defined(HAVE_PSG_LOADER)
- return CPSGDataLoader::RegisterInObjectManager(om, params, is_default, priority);
-#else
- ERR_POST_X(3, Critical << "PSG Loader is requested but not available");
- TRegisterLoaderInfo info;
- info.Set(nullptr, false);
- return info;
-#endif
- }
- return CGBDataLoader_Native::RegisterInObjectManager(om, params, is_default, priority);
+ return RegisterInObjectManager(om, params, is_default, priority);
}
-string CGBDataLoader::GetLoaderNameFromArgs(const string& /*reader_name*/,
- EIncludeHUP /*include_hup*/)
+string CGBDataLoader::GetLoaderNameFromArgs(const string& reader_name,
+ EIncludeHUP include_hup,
+ const string& web_cookie)
{
- return GBLOADER_HUP_NAME;
+ CGBLoaderParams params(reader_name);
+ params.SetHUPIncluded(true, web_cookie);
+ return GetLoaderNameFromArgs(params);
}
CObjectManager::TPriority priority)
{
CGBLoaderParams params(¶m_tree);
- SetLoaderMethod(params);
-
- if (TGenbankLoaderPsg::GetDefault()) {
-#if defined(HAVE_PSG_LOADER)
- return CPSGDataLoader::RegisterInObjectManager(om, params, is_default, priority);
-#else
- ERR_POST_X(3, Critical << "PSG Loader is requested but not available");
- TRegisterLoaderInfo info;
- info.Set(nullptr, false);
- return info;
-#endif
- }
- return CGBDataLoader_Native::RegisterInObjectManager(om, params, is_default, priority);
+ return RegisterInObjectManager(om, params, is_default, priority);
}
-string CGBDataLoader::GetLoaderNameFromArgs(const TParamTree& /* params */)
+string CGBDataLoader::GetLoaderNameFromArgs(const TParamTree& param_tree)
{
return GBLOADER_NAME;
}
CObjectManager::EIsDefault is_default,
CObjectManager::TPriority priority)
{
- CGBLoaderParams params_nc(params);
- SetLoaderMethod(params_nc);
-
- if (TGenbankLoaderPsg::GetDefault()) {
+ if ( params.GetUsePSG() ) {
#if defined(HAVE_PSG_LOADER)
- return CPSGDataLoader::RegisterInObjectManager(om, params_nc, is_default, priority);
+ return CPSGDataLoader::RegisterInObjectManager(om, params, is_default, priority);
#else
ERR_POST_X(3, Critical << "PSG Loader is requested but not available");
TRegisterLoaderInfo info;
return info;
#endif
}
- return CGBDataLoader_Native::RegisterInObjectManager(om, params_nc, is_default, priority);
+ return CGBDataLoader_Native::RegisterInObjectManager(om, params, is_default, priority);
}
}
if (params.HasHUPIncluded()) {
const string& web_cookie = params.GetWebCookie();
- if (web_cookie.empty())
+ if (web_cookie.empty()) {
return GBLOADER_HUP_NAME;
- else
- return GBLOADER_HUP_NAME + string("-") + web_cookie;
+ }
+ else {
+ CMD5 md5;
+ md5.Update(web_cookie.data(), web_cookie.size());
+ return GBLOADER_HUP_NAME + string("-") + md5.GetHexSum();
+ }
} else {
return GBLOADER_NAME;
}
CGBDataLoader::CGBDataLoader(const string& loader_name,
const CGBLoaderParams& params)
: CDataLoader(loader_name),
- m_HasHUPIncluded(params.HasHUPIncluded())
+ m_HasHUPIncluded(params.HasHUPIncluded()),
+ m_WebCookie(params.GetWebCookie())
{
}
int sub_sat) const
{
#if defined(HAVE_PSG_LOADER)
- if (TGenbankLoaderPsg::GetDefault()) {
+ if ( IsUsingPSGLoader() ) {
string str = NStr::NumericToString(sat)+'.'+NStr::NumericToString(sat_key);
if ( sub_sat != CSeqref::eSubSat_main ) {
str += '.'+NStr::NumericToString(sub_sat);
bool CGBDataLoader::IsUsingPSGLoader(void)
{
-#if defined(HAVE_PSG_LOADER)
- return TGenbankLoaderPsg::GetDefault();
-#else
- return false;
-#endif
+ return s_GetDefaultUsePSG();
}
-/* $Id: gbnative.cpp 673835 2023-10-11 14:57:07Z ivanov $
+/* $Id: gbnative.cpp 675419 2023-11-21 19:45:39Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
#else
static const char* const DEFAULT_DRV_ORDER = "id2";
#endif
+static const char* const DEFAULT_HUP_DRV_ORDER = "pubseqos2:pubseqos";
#define GBLOADER_NAME "GBLOADER"
#define GBLOADER_HUP_NAME "GBLOADER-HUP"
};
-CGBDataLoader::TRegisterLoaderInfo CGBDataLoader_Native::ConvertRegInfo(const TGBMaker::TRegisterInfo& info)
-{
- TRegisterLoaderInfo ret;
- ret.Set(info.GetLoader(), info.IsCreated());
- return ret;
-}
-
-
CGBDataLoader::TRegisterLoaderInfo CGBDataLoader_Native::RegisterInObjectManager(
CObjectManager& om,
const CGBLoaderParams& params,
CObjectManager::EIsDefault is_default,
CObjectManager::TPriority priority)
{
- TGBMaker maker(params);
+ CGBLoaderMaker<CGBDataLoader_Native> maker(params);
CDataLoader::RegisterInObjectManager(om, maker, is_default, priority);
- return ConvertRegInfo(maker.GetRegisterInfo());
+ return maker.GetRegisterInfo();
}
if ( NStr::StartsWith(reader_name, "pubseqos") )
m_WebCookie = params.GetWebCookie();
- if ( x_CreateReaders(reader_name, gb_params, *params.m_ReaderParams, preopen) ) {
+ if ( x_CreateReaders(reader_name, gb_params, params, preopen) ) {
if ( reader_name == "cache" ||
NStr::StartsWith(reader_name, "cache;") ) {
x_CreateWriters("cache", gb_params);
}
else {
pair<string, string> rw_name = GetReaderWriterName(gb_params, params);
- if ( x_CreateReaders(rw_name.first, gb_params, *params.m_ReaderParams, preopen) ) {
+ if ( x_CreateReaders(rw_name.first, gb_params, params, preopen) ) {
x_CreateWriters(rw_name.second, gb_params);
}
}
CGBDataLoader_Native::GetReaderWriterName(const TParamTree* params, const CGBLoaderParams& loader_params) const
{
pair<string, string> ret;
+ if ( HasHUPIncluded() ) {
+ // use default HUP readers
+ ret.first = DEFAULT_HUP_DRV_ORDER;
+ return ret;
+ }
ret.first = GetParam(params, NCBI_GBLOADER_PARAM_READER_NAME);
if ( ret.first.empty() ) {
ret.first = TGenbankReaderName::GetDefault();
}
if ( ret.first.empty() || ret.second.empty() ) {
string method = loader_params.GetLoaderMethod();
+ if ( method.empty() ) {
+ method = x_GetLoaderMethod(params);
+ }
if ( method.empty() ) {
// fall back default reader list
method = DEFAULT_DRV_ORDER;
bool CGBDataLoader_Native::x_CreateReaders(const string& str,
const TParamTree* params,
- const CReaderParams& reader_params,
+ const CGBLoaderParams& gb_params,
CGBLoaderParams::EPreopenConnection preopen)
{
vector<string> str_list;
NStr::Split(str, ";", str_list);
size_t reader_count = 0;
for ( size_t i = 0; i < str_list.size(); ++i ) {
- CRef<CReader> reader(x_CreateReader(str_list[i], reader_params, params));
+ CRef<CReader> reader(x_CreateReader(str_list[i], gb_params, params));
if( reader ) {
if ( HasHUPIncluded() ) {
reader->SetIncludeHUP(true, m_WebCookie);
vector<string> str_list;
NStr::Split(str, ";", str_list);
for ( size_t i = 0; i < str_list.size(); ++i ) {
- if ( HasHUPIncluded() ) {
+ if ( HasHUPIncluded() || m_Dispatcher->HasReaderWithHUPIncluded() ) {
NCBI_THROW(CObjMgrException, eRegisterError,
"HUP GBLoader cannot have cache");
}
CReader* CGBDataLoader_Native::x_CreateReader(const string& name,
- const CReaderParams& reader_params,
+ const CGBLoaderParams& gb_params,
const TParamTree* params)
{
CRef<TReaderManager> manager = x_GetReaderManager();
}
}
else {
+ CReaderParams reader_params;
+ reader_params.SetEnableWGS(gb_params.m_EnableWGS);
+ reader_params.SetEnableSNP(gb_params.m_EnableSNP);
+ reader_params.SetEnableCDD(gb_params.m_EnableCDD);
ret->SetParams(reader_params);
ret->InitializeCache(m_CacheManager, params);
}
-/* $Id: psg_loader.cpp 673827 2023-10-11 14:56:08Z ivanov $
+/* $Id: psg_loader.cpp 675419 2023-11-21 19:45:39Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
CObjectManager::EIsDefault is_default,
CObjectManager::TPriority priority)
{
- CGBLoaderParams params;
- TMaker maker(params);
- CDataLoader::RegisterInObjectManager(om, maker, is_default, priority);
- return ConvertRegInfo(maker.GetRegisterInfo());
+ return RegisterInObjectManager(om, CGBLoaderParams(), is_default, priority);
}
CObjectManager::EIsDefault is_default,
CObjectManager::TPriority priority)
{
- TMaker maker(params);
+ CGBLoaderMaker<CPSGDataLoader> maker(params);
CDataLoader::RegisterInObjectManager(om, maker, is_default, priority);
- return ConvertRegInfo(maker.GetRegisterInfo());
+ return maker.GetRegisterInfo();
}
}
-CGBDataLoader::TRegisterLoaderInfo CPSGDataLoader::ConvertRegInfo(const TMaker::TRegisterInfo& info)
-{
- TRegisterLoaderInfo ret;
- ret.Set(info.GetLoader(), info.IsCreated());
- return ret;
-}
-
-
END_SCOPE(objects)
// ===========================================================================
-/* $Id: psg_loader_impl.cpp 673835 2023-10-11 14:57:07Z ivanov $
+/* $Id: psg_loader_impl.cpp 681383 2024-04-09 12:29:10Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
m_Status = eCompleted;
return false;
}
+ if ( status == EPSG_Status::eForbidden ) {
+ m_GotForbidden = true;
+ m_Status = eCompleted;
+ return false;
+ }
m_Status = eFailed;
return false;
}
m_BioseqCache.reset(new CPSGBioseqCache(m_CacheLifespan, cache_max_size));
m_AnnotCache.reset(new CPSGAnnotCache(m_CacheLifespan, cache_max_size));
m_BlobMap.reset(new CPSGBlobMap(m_CacheLifespan, cache_max_size));
- m_Queue = make_shared<CPSG_Queue>(service_name);
+ {{
+ m_Queue = make_shared<CPSG_Queue>(service_name);
+ m_Queue->SetRequestFlags(params.HasHUPIncluded()? CPSG_Request::fIncludeHUP: CPSG_Request::fExcludeHUP);
+ if ( !params.GetWebCookie().empty() ) {
+ m_RequestContext = new CRequestContext();
+ m_RequestContext->SetProperty("auth_token", params.GetWebCookie());
+ }
+ }}
+
+ m_CDDInfoCache.reset(new CPSGCDDInfoCache(m_CacheLifespan, cache_max_size));
if (TPSG_PrefetchCDD::GetDefault()) {
- m_CDDInfoCache.reset(new CPSGCDDInfoCache(m_CacheLifespan, cache_max_size));
m_CDDPrefetchTask.Reset(new CPSG_PrefetchCDD_Task(*this));
m_ThreadPool->AddTask(m_CDDPrefetchTask);
}
if (m_CDDPrefetchTask) {
m_CDDPrefetchTask->Cancel();
}
+ // Make sure thread pool is destroyed before any tasks (e.g. CDD prefetch)
+ // and stops them all before the loader is destroyed.
+ m_ThreadPool.reset();
}
else {
locks.insert(tse_lock);
if (m_CDDPrefetchTask) {
- _ASSERT(m_CDDInfoCache);
auto bioseq_info = m_BioseqCache->Get(idh);
if (bioseq_info) {
auto cdd_ids = x_GetCDDIds(bioseq_info->ids);
const CPsgBlobId& blob_id = dynamic_cast<const CPsgBlobId&>(*chunk->GetBlobId());
_ASSERT(x_IsLocalCDDEntryId(blob_id));
_ASSERT(!chunk->IsLoaded());
-
bool failed = false;
shared_ptr<CPSG_NamedAnnotInfo> cdd_info;
shared_ptr<CPSG_NamedAnnotStatus> cdd_status;
const CPsgBlobId& blob_id = dynamic_cast<const CPsgBlobId&>(*chunk.GetBlobId());
shared_ptr<CPSG_Request_Blob> request;
if ( x_IsLocalCDDEntryId(blob_id) ) {
- if (m_CDDInfoCache && m_CDDInfoCache->Find(blob_id.ToPsgId())) {
+ if (m_CDDInfoCache->Find(blob_id.ToPsgId())) {
x_CreateEmptyLocalCDDEntry(data_source, *it);
continue;
}
void CPSGDataLoader_Impl::PrefetchCDD(const TIds& ids)
{
if (ids.empty()) return;
- _ASSERT(m_CDDInfoCache);
_ASSERT(m_CDDPrefetchTask);
SCDDIds cdd_ids = x_GetCDDIds(ids);
const TIds& ids = id_sets[i];
cdd_ids[i] = x_GetCDDIds(ids);
// Skip if it's known that the bioseq has no CDDs.
- if (m_CDDInfoCache) {
- if (cdd_ids[i].gi && m_CDDInfoCache->Find(x_MakeLocalCDDEntryId(cdd_ids[i]))) {
- // no CDDs for this Seq-id
- loaded[i] = true;
- continue;
- }
+ if (cdd_ids[i].gi && m_CDDInfoCache->Find(x_MakeLocalCDDEntryId(cdd_ids[i]))) {
+ // no CDDs for this Seq-id
+ loaded[i] = true;
+ continue;
}
// Check if there's a loaded CDD blob.
for (auto& id : ids) {
auto idx = task->m_Idx;
if (!task->m_AnnotInfo || !task->m_BlobInfo || !task->m_BlobData) {
// no CDDs
+ m_CDDInfoCache->Add(x_MakeLocalCDDEntryId(cdd_ids[idx]), true);
loaded[idx] = true;
continue;
}
shared_ptr<CPSG_Reply> CPSGDataLoader_Impl::x_SendRequest(shared_ptr<CPSG_Request> request)
{
+ if ( m_RequestContext ) {
+ request->SetRequestContext(m_RequestContext);
+ }
return m_Queue->SendRequestAndGetReply(request, DEFAULT_DEADLINE);
}
-/* $Id: reader.cpp 673828 2023-10-11 14:56:18Z ivanov $
+/* $Id: reader.cpp 675188 2023-11-16 13:46:47Z ivanov $
* ===========================================================================
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
: m_Dispatcher(0),
m_MaxConnections(0),
m_PreopenConnection(DEFAULT_PREOPEN),
+ m_IncludeHUP(false),
m_NextNewConnection(0),
m_NumFreeConnections(0, 1000),
m_MaximumRetryCount(3),
-/* $Id: reader_id2_base.cpp 673828 2023-10-11 14:56:18Z ivanov $
+/* $Id: reader_id2_base.cpp 675193 2023-11-16 13:47:29Z ivanov $
* ===========================================================================
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
error_flags |= fError_no_data;
break;
case CID2_Error::eSeverity_restricted_data:
- error_flags |= fError_no_data;
+ error_flags |= fError_restricted | fError_no_data;
break;
case CID2_Error::eSeverity_unsupported_command:
m_AvoidRequest |= fAvoidRequest_nested_get_blob_info;
fError_suppressed_perm, "superceded"); // temp?
sx_CheckErrorFlag(error, error_flags,
fError_suppressed_temp, "superseded"); // perm?
+ sx_CheckErrorFlag(error, error_flags,
+ fError_restricted,
+ "Unknown satellite number 20 for bioseq info");
+ if ( error_flags & fError_restricted ) {
+ error_flags |= fError_no_data;
+ }
}
break;
case CID2_Error::eSeverity_failed_command:
-# $Id: CMakeLists.edit.lib.txt 672328 2023-09-05 18:18:13Z ivanov $
+# $Id: CMakeLists.edit.lib.txt 680757 2024-03-27 13:49:14Z ivanov $
NCBI_begin_lib(xobjedit)
NCBI_sources(
parse_text_options publication_edit gap_trim
external_annots feature_propagate text_object_description
seq_edit pub_fix
- huge_asn_reader huge_file huge_file_process huge_asn_loader
- huge_asn_macro_reader
)
NCBI_uses_toolkit_libraries(eutils efetch esearch esummary taxon3 valid xobjread xobjutil xlogging)
NCBI_project_watchers(stakhovv gotvyans foleyjp choi)
-# $Id: Makefile.edit.lib 672330 2023-09-05 18:18:28Z ivanov $
+# $Id: Makefile.edit.lib 680757 2024-03-27 13:49:14Z ivanov $
# Build library "xobjedit"
###############################
parse_text_options publication_edit gap_trim \
external_annots feature_propagate text_object_description \
seq_edit pub_fix \
- huge_asn_reader huge_file huge_file_process huge_asn_loader \
- huge_asn_macro_reader
LIB = xobjedit
-/* $Id: eutils_updater.cpp 672327 2023-09-05 18:18:06Z ivanov $
+/* $Id: eutils_updater.cpp 676570 2023-12-18 19:55:37Z sadyrovr $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
}
-class CECitMatch_Request : public CESearch_Request
+static string GetFirstAuthor(const CAuth_list& authors)
{
-public:
- CECitMatch_Request(CRef<CEUtils_ConnContext>& ctx) :
- CESearch_Request("pubmed", ctx)
- {
- }
-
- static string GetFirstAuthor(const CAuth_list& authors)
- {
- if (authors.IsSetNames()) {
- const auto& N(authors.GetNames());
- if (N.IsMl()) {
- if (! N.GetMl().empty()) {
- return N.GetMl().front();
- }
- } else if (N.IsStd()) {
- // convert to ML
- if (! N.GetStd().empty()) {
- const CAuthor& first_author(*N.GetStd().front());
- if (first_author.IsSetName()) {
- const CPerson_id& person(first_author.GetName());
- if (person.IsName()) {
- const CName_std& name_std(person.GetName());
- if (name_std.IsSetLast()) {
- string name(name_std.GetLast());
- if (name_std.IsSetInitials()) {
- name += ' ';
- for (char c : name_std.GetInitials()) {
- if (isalpha(c)) {
- if (islower(c)) {
- c = toupper(c);
- }
- name += c;
+ if (authors.IsSetNames()) {
+ const auto& N(authors.GetNames());
+ if (N.IsMl()) {
+ if (! N.GetMl().empty()) {
+ return N.GetMl().front();
+ }
+ } else if (N.IsStd()) {
+ // convert to ML
+ if (! N.GetStd().empty()) {
+ const CAuthor& first_author(*N.GetStd().front());
+ if (first_author.IsSetName()) {
+ const CPerson_id& person(first_author.GetName());
+ if (person.IsName()) {
+ const CName_std& name_std(person.GetName());
+ if (name_std.IsSetLast()) {
+ string name(name_std.GetLast());
+ if (name_std.IsSetInitials()) {
+ name += ' ';
+ for (char c : name_std.GetInitials()) {
+ if (isalpha(c)) {
+ if (islower(c)) {
+ c = toupper(c);
}
+ name += c;
}
}
- return name;
}
+ return name;
}
}
}
}
}
-
- return {};
}
- static void FillFromArticle(SCitMatch& cm, const CCit_art& A)
- {
- if (A.IsSetAuthors()) {
- cm.Author = GetFirstAuthor(A.GetAuthors());
- }
+ return {};
+}
- if (A.IsSetFrom() && A.GetFrom().IsJournal()) {
- const CCit_jour& J = A.GetFrom().GetJournal();
- if (J.IsSetTitle()) {
- const CTitle& T = J.GetTitle();
- if (T.IsSet() && ! T.Get().empty()) {
- cm.Journal = T.GetTitle();
- }
+void SCitMatch::FillFromArticle(const CCit_art& A)
+{
+ if (A.IsSetAuthors()) {
+ this->Author = GetFirstAuthor(A.GetAuthors());
+ }
+
+ if (A.IsSetFrom() && A.GetFrom().IsJournal()) {
+ const CCit_jour& J = A.GetFrom().GetJournal();
+ if (J.IsSetTitle()) {
+ const CTitle& T = J.GetTitle();
+ if (T.IsSet() && ! T.Get().empty()) {
+ this->Journal = T.GetTitle();
}
- if (J.IsSetImp()) {
- const CImprint& I = J.GetImp();
- if (I.IsSetDate()) {
- const CDate& D = I.GetDate();
- if (D.IsStd()) {
- auto year = D.GetStd().GetYear();
- if (year > 0) {
- cm.Year = to_string(year);
- }
- }
- }
- if (I.IsSetVolume()) {
- cm.Volume = I.GetVolume();
- }
- if (I.IsSetPages()) {
- cm.Page = I.GetPages();
- auto pos = cm.Page.find('-');
- if (pos != string::npos) {
- cm.Page.resize(pos);
+ }
+ if (J.IsSetImp()) {
+ const CImprint& I = J.GetImp();
+ if (I.IsSetDate()) {
+ const CDate& D = I.GetDate();
+ if (D.IsStd()) {
+ auto year = D.GetStd().GetYear();
+ if (year > 0) {
+ this->Year = to_string(year);
}
}
- if (I.IsSetIssue()) {
- cm.Issue = I.GetIssue();
- }
- if (I.IsSetPrepub()) {
- cm.InPress = (I.GetPrepub() == CImprint::ePrepub_in_press);
+ }
+ if (I.IsSetVolume()) {
+ this->Volume = I.GetVolume();
+ }
+ if (I.IsSetPages()) {
+ this->Page = I.GetPages();
+ auto pos = this->Page.find('-');
+ if (pos != string::npos) {
+ this->Page.resize(pos);
}
}
+ if (I.IsSetIssue()) {
+ this->Issue = I.GetIssue();
+ }
+ if (I.IsSetPrepub()) {
+ this->InPress = (I.GetPrepub() == CImprint::ePrepub_in_press);
+ }
}
+ }
- if (A.IsSetTitle()) {
- const CTitle& T = A.GetTitle();
- if (T.IsSet() && ! T.Get().empty()) {
- cm.Title = T.GetTitle();
- }
+ if (A.IsSetTitle()) {
+ const CTitle& T = A.GetTitle();
+ if (T.IsSet() && ! T.Get().empty()) {
+ this->Title = T.GetTitle();
}
}
+}
+
+class CECitMatch_Request : public CESearch_Request
+{
+public:
+ CECitMatch_Request(CRef<CEUtils_ConnContext>& ctx) :
+ CESearch_Request("pubmed", ctx)
+ {
+ }
static void NormalizeJournal(string& s)
{
};
-CEUtilsUpdaterBase::CEUtilsUpdaterBase(bool bNorm) :
- m_Ctx(new CEUtils_ConnContext), m_bNorm(bNorm)
+CEUtilsUpdater::CEUtilsUpdater(ENormalize norm) :
+ m_Ctx(new CEUtils_ConnContext), m_Norm(norm)
{
}
-TEntrezId CEUtilsUpdaterBase::CitMatch(const CPub& pub, EPubmedError* perr)
+TEntrezId CEUtilsUpdater::CitMatch(const CPub& pub, EPubmedError* perr)
{
if (pub.IsArticle()) {
SCitMatch cm;
- CECitMatch_Request::FillFromArticle(cm, pub.GetArticle());
+ cm.FillFromArticle(pub.GetArticle());
return CitMatch(cm, perr);
} else {
if (perr) {
}
}
-TEntrezId CEUtilsUpdaterBase::CitMatch(const SCitMatch& cm, EPubmedError* perr)
+TEntrezId CEUtilsUpdater::CitMatch(const SCitMatch& cm, EPubmedError* perr)
{
unique_ptr<CECitMatch_Request> req(new CECitMatch_Request(m_Ctx));
req->SetField("title");
}
-void IPubmedUpdater::Normalize(CPub& pub)
+static void Normalize(CPub& pub)
{
- if (pub.IsArticle()) {
- CCit_art& A = pub.SetArticle();
+ if (pub.IsMedline() && pub.GetMedline().IsSetCit()) {
+ CCit_art& A = pub.SetMedline().SetCit();
#if 0
// Ensure period at title end; RW-1946
if (A.IsSetTitle() && ! A.GetTitle().Get().empty()) {
}
}
-CRef<CPub> CEUtilsUpdaterBase::x_GetPub(TEntrezId pmid, EPubmedError* perr)
+CRef<CPubmed_entry> CEUtilsUpdater::x_GetPubmedEntry(TEntrezId pmid, EPubmedError* perr)
{
unique_ptr<CEFetch_Request> req(
new CEFetch_Literature_Request(CEFetch_Literature_Request::eDB_pubmed, m_Ctx)
req->Read(&content);
try {
CNcbiIstrstream(content) >> MSerial_Xml >> pas;
+ } catch (const CSerialException&) {
+ if (perr) {
+ *perr = EPubmedError::operational_error;
+ }
+ return {};
} catch (...) {
if (perr) {
*perr = EPubmedError::citation_not_found;
const eutils::CPubmedBookArticle& article = ppf.GetPubmedBookArticle();
pme.Reset(article.ToPubmed_entry());
}
-
- if (pme && pme->IsSetMedent()) {
- const CMedline_entry& mle = pme->GetMedent();
- if (mle.IsSetCit()) {
- CRef<CPub> pub(new CPub);
- pub->SetArticle().Assign(mle.GetCit());
- if (m_bNorm)
- Normalize(*pub);
- if (m_pub_interceptor)
- m_pub_interceptor(pub);
- return pub;
- }
- }
+ return pme;
}
if (perr) {
return {};
}
+CRef<CPub> CEUtilsUpdater::x_GetPub(TEntrezId pmid, EPubmedError* perr)
+{
+ CRef<CPubmed_entry> pme = x_GetPubmedEntry(pmid, perr);
+ if (pme && pme->IsSetMedent()) {
+ CRef<CPub> pub(new CPub);
+ pub->SetMedline().Assign(pme->GetMedent());
+ if (m_Norm == ENormalize::On) {
+ Normalize(*pub);
+ }
+ if (m_pub_interceptor) {
+ m_pub_interceptor(pub);
+ }
+ return pub;
+ }
+ return {};
+}
CRef<CPub> CEUtilsUpdater::GetPub(TEntrezId pmid, EPubmedError* perr)
+{
+ CConstRef<CPub> pub = GetPubmedEntry(pmid, perr);
+ if (pub && pub->IsMedline() && pub->GetMedline().IsSetCit()) {
+ CRef<CPub> ret(new CPub);
+ ret->SetArticle().Assign(pub->GetMedline().GetCit());
+ return ret;
+ }
+ return {};
+}
+
+CRef<CPub> CEUtilsUpdater::GetPubmedEntry(TEntrezId pmid, EPubmedError* perr)
{
return x_GetPub(pmid, perr);
}
-CRef<CPub> CEUtilsUpdaterWithCache::GetPub(TEntrezId pmid, EPubmedError* perr)
+CRef<CPub> CEUtilsUpdaterWithCache::GetPubmedEntry(TEntrezId pmid, EPubmedError* perr)
{
m_num_requests++;
CConstRef<CPub> pub;
return true;
}
-bool CEUtilsUpdaterBase::DoPubSearch(const vector<string>& query, vector<TEntrezId>& pmids)
+bool CEUtilsUpdater::DoPubSearch(const vector<string>& query, vector<TEntrezId>& pmids)
{
static const string hostname = "pubmed.ncbi.nlm.nih.gov";
static const string path = "/api/citmatch";
-/* $Id: feattable_edit.cpp 645555 2022-02-17 15:02:17Z ludwigf $
+/* $Id: feattable_edit.cpp 677913 2024-01-25 14:13:17Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
sel.IncludeFeatSubtype(CSeqFeatData::eSubtype_cdregion);
CFeat_CI it(mHandle, sel);
for (; it; ++it) {
- const CSeq_feat& cds = it->GetOriginalFeature();
- CConstRef<CSeq_feat> pOverlappingRna =
- sequence::GetBestOverlappingFeat(
- cds.GetLocation(),
- CSeqFeatData::e_Rna,
- sequence::eOverlap_CheckIntRev,
- *mpScope);
- if (pOverlappingRna) {
- continue;
- }
- CRef<CSeq_feat> pRna(new CSeq_feat);
- pRna->SetData().SetRna().SetType(CRNA_ref::eType_mRNA);
- pRna->SetLocation().Assign(cds.GetLocation());
- pRna->SetLocation().SetPartialStart(false, eExtreme_Positional);
- pRna->SetLocation().SetPartialStop(false, eExtreme_Positional);
- pRna->ResetPartial();
- //product name
- pRna->SetData().SetRna().SetExt().SetName(
- sGetCdsProductName(cds, *mpScope));
-
- //find proper name for rna
- string rnaId(xNextFeatId());
- pRna->SetId().SetLocal().SetStr(rnaId);
-
- //add rna xref to cds
- CSeq_feat_EditHandle feh(mpScope->GetObjectHandle(cds));
- feh.AddFeatXref(rnaId);
-
- //add cds xref to rna
- CRef<CFeat_id> pFeatId(new CFeat_id);
- pFeatId->Assign(cds.GetId());
- CRef<CSeqFeatXref> pRnaXref(new CSeqFeatXref);
- pRnaXref->SetId(*pFeatId);
- pRna->SetXref().push_back(pRnaXref);
+ xGenerateMissingMrnaForCds(*it);
+ }
+}
- CMappedFeat parentGene = feature::GetBestGeneForFeat(*it, &mTree);
- if (parentGene) {
- //if gene exists, add gene xref to rna
- CSeq_feat_EditHandle geh(mpScope->GetObjectHandle(
- parentGene.GetOriginalFeature()));
- geh.AddFeatXref(rnaId);
- //if gene exists, add rna xref to gene
- CRef<CFeat_id> pGeneId(new CFeat_id);
- pGeneId->Assign(parentGene.GetId());
- CRef<CSeqFeatXref> pRnaXref(new CSeqFeatXref);
- pRnaXref->SetId(*pGeneId);
- pRna->SetXref().push_back(pRnaXref);
- }
- //add new rna to feature table
- mEditHandle.AddFeat(*pRna);
- mTree.AddFeature(mpScope->GetObjectHandle(*pRna));
+// -------------------------------------------------------------------------
+void CFeatTableEdit::xGenerateMissingMrnaForCds(const CMappedFeat& mappedCds)
+// -------------------------------------------------------------------------
+{
+
+ const CSeq_feat& cds = mappedCds.GetOriginalFeature();
+ CConstRef<CSeq_feat> pOverlappingRna =
+ sequence::GetBestOverlappingFeat(
+ cds.GetLocation(),
+ CSeqFeatData::e_Rna,
+ sequence::eOverlap_CheckIntRev,
+ *mpScope);
+
+ if (pOverlappingRna) {
+ return;
+ }
+
+ CRef<CSeq_feat> pRna(new CSeq_feat);
+ pRna->SetData().SetRna().SetType(CRNA_ref::eType_mRNA);
+ pRna->SetLocation().Assign(cds.GetLocation());
+ pRna->SetLocation().SetPartialStart(false, eExtreme_Positional);
+ pRna->SetLocation().SetPartialStop(false, eExtreme_Positional);
+ pRna->ResetPartial();
+
+ //product name
+ pRna->SetData().SetRna().SetExt().SetName(
+ sGetCdsProductName(cds, *mpScope));
+
+ //find proper name for rna
+ string rnaId(xNextFeatId());
+ pRna->SetId().SetLocal().SetStr(rnaId);
+
+ //add rna xref to cds
+ CSeq_feat_EditHandle feh(mpScope->GetObjectHandle(cds));
+ feh.AddFeatXref(rnaId);
+
+ //add cds xref to rna
+ CRef<CFeat_id> pFeatId(new CFeat_id);
+ pFeatId->Assign(cds.GetId());
+ CRef<CSeqFeatXref> pRnaXref(new CSeqFeatXref);
+ pRnaXref->SetId(*pFeatId);
+ pRna->SetXref().push_back(pRnaXref);
+
+ CMappedFeat parentGene = feature::GetBestGeneForFeat(mappedCds, &mTree);
+ if (parentGene) {
+ //if gene exists, add gene xref to rna
+ CSeq_feat_EditHandle geh(mpScope->GetObjectHandle(
+ parentGene.GetOriginalFeature()));
+ geh.AddFeatXref(rnaId);
+ //if gene exists, add rna xref to gene
+ CRef<CFeat_id> pGeneId(new CFeat_id);
+ pGeneId->Assign(parentGene.GetId());
+ CRef<CSeqFeatXref> pRnaXref(new CSeqFeatXref);
+ pRnaXref->SetId(*pGeneId);
+ pRna->SetXref().push_back(pRnaXref);
}
+
+ //add new rna to feature table
+ mEditHandle.AddFeat(*pRna);
+ mTree.AddFeature(mpScope->GetObjectHandle(*pRna));
}
// -------------------------------------------------------------------------
return transcript_id;
}
+static bool s_IsGenbankId(const string& id)
+{
+ return NStr::StartsWith(id, "gb|");
+}
+
+static bool s_IsGeneralId(const string& id)
+{
+ return NStr::StartsWith(id, "gnl|");
+}
// ---------------------------------------------------------------------------
void CFeatTableEdit::xAddTranscriptAndProteinIdsToCdsAndParentMrna(CMappedFeat& cds)
// ---------------------------------------------------------------------------
{
CMappedFeat mrna = feature::GetBestMrnaForCds(cds, &mTree);
- string protein_id = cds.GetNamedQual("protein_id");
- const bool no_protein_id_qual = NStr::IsBlank(protein_id);
- if (no_protein_id_qual) { // no protein_id qual on CDS - check mRNA and ID qual
+
+ string proteinId = cds.GetNamedQual("protein_id");
+ const bool noProteinIdQual = NStr::IsBlank(proteinId);
+ if (noProteinIdQual) { // no protein_id qual on CDS - check mRNA and ID qual
if (mrna) {
- protein_id = mrna.GetNamedQual("protein_id");
+ proteinId = mrna.GetNamedQual("protein_id");
}
- if (NStr::IsBlank(protein_id)) {
- protein_id = cds.GetNamedQual("ID");
+ if (NStr::IsBlank(proteinId)) {
+ proteinId = cds.GetNamedQual("ID");
}
}
- bool is_genbank_protein = NStr::StartsWith(protein_id, "gb|");
- string transcript_id = cds.GetNamedQual("transcript_id");
- const bool no_transcript_id_qual = NStr::IsBlank(transcript_id);
- if (no_transcript_id_qual) { // no transcript_id qual on CDS - check mRNA
- if (mrna) {
- transcript_id = s_GetTranscriptIdFromMrna(mrna);
- }
+ const bool isGenbankProtein = s_IsGenbankId(proteinId);
+
+ string transcriptId = cds.GetNamedQual("transcript_id");
+ const bool noTranscriptIdQual = NStr::IsBlank(transcriptId);
+ if (noTranscriptIdQual && mrna) { // no transcript_id qual on CDS - check mRNA
+ transcriptId = s_GetTranscriptIdFromMrna(mrna);
}
- bool is_genbank_transcript = NStr::StartsWith(transcript_id, "gb|");
+
+ const bool isGenbankTranscript = s_IsGenbankId(transcriptId);
- if ((is_genbank_protein || NStr::StartsWith(protein_id, "gnl|")) &&
- (is_genbank_transcript || NStr::StartsWith(transcript_id, "gnl|"))) {
+ if ((isGenbankProtein || s_IsGeneralId(proteinId)) &&
+ (isGenbankTranscript || s_IsGeneralId(transcriptId))) {
// No further processing of ids is required - simply assign to features
- if (no_protein_id_qual) {
- // protein_id from ID qualifier or mRNA => need to add protein_id qual to CDS
- xFeatureSetQualifier(cds, "protein_id", protein_id);
- }
-
- if (no_transcript_id_qual) {
- // transcript_id from mRNA => need to add transcript_id qual to CDS
- xFeatureSetQualifier(cds, "transcript_id", transcript_id);
+ if (noProteinIdQual) {
+ // proteinId from ID qualifier or mRNA => need to add protein_id qual to CDS
+ xFeatureSetQualifier(cds, "protein_id", proteinId);
}
if (mrna) {
- xAddTranscriptAndProteinIdsToMrna(transcript_id, protein_id, mrna);
+ if (noTranscriptIdQual) {
+ // transcript_id from mRNA => need to add transcript_id qual to CDS
+ xFeatureSetQualifier(cds, "transcript_id", transcriptId);
+ }
+ xAddTranscriptAndProteinIdsToMrna(transcriptId, proteinId, mrna);
}
return;
}
// else need to generate and/or process ids before we add them to features
- bool has_protein_id = !NStr::IsBlank(protein_id);
- bool has_transcript_id = !NStr::IsBlank(transcript_id);
+ bool hasProteinId = !NStr::IsBlank(proteinId);
+ bool hasTranscriptId = !NStr::IsBlank(transcriptId);
- if (has_protein_id && has_transcript_id) {
- if (!is_genbank_protein && (transcript_id == protein_id)) {
- protein_id = "cds." + protein_id;
+ if (hasProteinId && hasTranscriptId) {
+ if (!isGenbankProtein && (transcriptId == proteinId)) {
+ proteinId = "cds." + proteinId;
}
}
else {
- if (has_protein_id && !is_genbank_protein) {
- transcript_id = "mrna." + protein_id;
- has_transcript_id = true;
+ if (hasProteinId && !isGenbankProtein) {
+ transcriptId = "mrna." + proteinId;
+ hasTranscriptId = true;
}
- else if (has_transcript_id && !is_genbank_transcript) {
- protein_id = "cds." + transcript_id;
- has_protein_id = true;
+ else if (hasTranscriptId && !isGenbankTranscript) {
+ proteinId = "cds." + transcriptId;
+ hasProteinId = true;
}
- // Generate new transcript_id and protein_id if necessary
- if (!has_transcript_id) {
- transcript_id = xNextTranscriptId(cds);
+ // Generate new transcriptId and proteinId if necessary
+ if (!hasTranscriptId && mrna) {
+ transcriptId = xNextTranscriptId(cds);
}
- if (!has_protein_id) {
- protein_id = xNextProteinId(cds);
+ if (!hasProteinId) {
+ proteinId = xNextProteinId(cds);
}
}
- xConvertToGeneralIds(cds, transcript_id, protein_id);
+ xConvertToGeneralIds(cds, transcriptId, proteinId);
if (mrna) {
- xAddTranscriptAndProteinIdsToMrna(transcript_id, protein_id, mrna);
+ xAddTranscriptAndProteinIdsToMrna(transcriptId, proteinId, mrna);
+ xFeatureSetQualifier(cds, "transcript_id", transcriptId);
}
-
- xFeatureSetQualifier(cds, "transcript_id", transcript_id);
- xFeatureSetQualifier(cds, "protein_id", protein_id);
+ xFeatureSetQualifier(cds, "protein_id", proteinId);
}
return;
}
- string transcript_id = mrna.GetNamedQual("transcript_id");
- bool no_transcript_id_qual = NStr::IsBlank(transcript_id);
- if (no_transcript_id_qual) {
- transcript_id = mrna.GetNamedQual("ID");
+ string transcriptId = mrna.GetNamedQual("transcript_id");
+ bool noTranscriptIdQual = NStr::IsBlank(transcriptId);
+ if (noTranscriptIdQual) {
+ transcriptId = mrna.GetNamedQual("ID");
}
- const bool is_genbank_transcript = NStr::StartsWith(transcript_id, "gb|");
+ const bool isGenbankTranscript = s_IsGenbankId(transcriptId);
- string protein_id = mrna.GetNamedQual("protein_id");
- const bool is_genbank_protein = NStr::StartsWith(protein_id, "gb|");
+ string proteinId = mrna.GetNamedQual("protein_id");
+ const bool isGenbankProtein = s_IsGenbankId(proteinId);
- if ((is_genbank_protein ||
- NStr::StartsWith(protein_id, "gnl|")) &&
- (is_genbank_transcript ||
- NStr::StartsWith(transcript_id, "gnl|"))) {
- if (no_transcript_id_qual) {
- xFeatureSetQualifier(mrna, "transcript_id", transcript_id);
+ if ((isGenbankProtein || s_IsGeneralId(proteinId)) &&
+ (isGenbankTranscript || s_IsGeneralId(transcriptId))) {
+ if (noTranscriptIdQual) {
+ xFeatureSetQualifier(mrna, "transcript_id", transcriptId);
}
return;
}
- if (!NStr::IsBlank(protein_id) &&
- !NStr::IsBlank(transcript_id)) {
- if ((transcript_id == protein_id) &&
- !is_genbank_transcript) {
- protein_id = "cds." + protein_id;
+ if (!NStr::IsBlank(proteinId) &&
+ !NStr::IsBlank(transcriptId)) {
+ if ((transcriptId == proteinId) &&
+ !isGenbankTranscript) {
+ proteinId = "cds." + proteinId;
}
}
- else
- if (!is_genbank_protein && !NStr::IsBlank(protein_id)) {
- transcript_id = "mrna." + protein_id;
+ else { // Empty proteinId and/or transcriptId
+ if (!isGenbankProtein && !NStr::IsBlank(proteinId)) {
+ transcriptId = "mrna." + proteinId;
}
- else
- if (!is_genbank_transcript && !NStr::IsBlank(transcript_id)) {
- protein_id = "cds." + transcript_id;
- }
+ else if (!isGenbankTranscript && !NStr::IsBlank(transcriptId)) {
+ proteinId = "cds." + transcriptId;
+ }
+ }
- if (NStr::IsBlank(protein_id)) {
- protein_id = xNextProteinId(mrna);
+ if (NStr::IsBlank(proteinId)) {
+ proteinId = xNextProteinId(mrna);
}
- if (NStr::IsBlank(transcript_id)) {
- transcript_id = xNextTranscriptId(mrna);
+ if (NStr::IsBlank(transcriptId)) {
+ transcriptId = xNextTranscriptId(mrna);
}
- xConvertToGeneralIds(mrna, transcript_id, protein_id);
+ xConvertToGeneralIds(mrna, transcriptId, proteinId);
- xFeatureSetQualifier(mrna, "transcript_id", transcript_id);
- xFeatureSetQualifier(mrna, "protein_id", protein_id);
+ xFeatureSetQualifier(mrna, "transcript_id", transcriptId);
+ xFeatureSetQualifier(mrna, "protein_id", proteinId);
mProcessedMrnas.insert(mrna);
}
{
SAnnotSelector sel;
sel.IncludeFeatType(choice);
+ xGenerateMissingGeneForFeats(sel, pMerger);
+}
+
+
+// ---------------------------------------------------------------------------
+void CFeatTableEdit::xGenerateMissingGeneForFeats(
+ const SAnnotSelector& sel,
+ const CGff3LocationMerger* pMerger)
+// ---------------------------------------------------------------------------
+{
CFeat_CI it(mHandle, sel);
for (; it; ++it) {
CMappedFeat mf = *it;
}
+// ---------------------------------------------------------------------------
+void CFeatTableEdit::xGenerateMissingGeneForFeat(
+ const CMappedFeat& feat)
+// ---------------------------------------------------------------------------
+{
+ if (xCreateMissingParentGene(feat, mSequenceSize)) {
+ xAdjustExistingParentGene(feat);
+ }
+}
+
+
// ---------------------------------------------------------------------------
void CFeatTableEdit::xGenerateMissingGeneForSubtype(
CSeqFeatData::ESubtype subType,
const CGff3LocationMerger* pMerger)
- // ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
{
SAnnotSelector sel;
sel.IncludeFeatSubtype(subType);
- CFeat_CI it(mHandle, sel);
- for (; it; ++it) {
- CMappedFeat mf = *it;
- auto seqId = mf.GetLocationId().AsString();
- auto sequenceSize =
- (pMerger ? pMerger->GetSequenceSize(seqId) : mSequenceSize);
- if (xCreateMissingParentGene(mf, sequenceSize)) {
- xAdjustExistingParentGene(mf);
- }
- }
+ xGenerateMissingGeneForFeats(sel, pMerger);
}
// ----------------------------------------------------------------------------
if (forEukaryote) {
GenerateMissingParentFeaturesForEukaryote(pMerger);
}
- else {
+ else {
GenerateMissingParentFeaturesForProkaryote(pMerger);
}
mTree = feature::CFeatTree(mHandle);
// ----------------------------------------------------------------------------
void CFeatTableEdit::GenerateMissingParentFeaturesForEukaryote(
const CGff3LocationMerger* pMerger)
- // ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
{
- GenerateMissingMrnaForCds();
- xGenerateMissingGeneForChoice(
- CSeqFeatData::e_Rna, nullptr); //sequence not circular for eukaryote
+ {
+ SAnnotSelector sel;
+ sel.IncludeFeatSubtype(CSeqFeatData::eSubtype_cdregion);
+ for (CFeat_CI it(mHandle, sel); it; ++it) {
+ if (auto parent = mTree.GetParent(*it); parent) {
+ auto subtype = parent.GetOriginalFeature().GetData().GetSubtype();
+ if (subtype == CSeqFeatData::eSubtype_mRNA ||
+ subtype == CSeqFeatData::eSubtype_V_segment ||
+ subtype == CSeqFeatData::eSubtype_D_segment ||
+ subtype == CSeqFeatData::eSubtype_J_segment ||
+ subtype == CSeqFeatData::eSubtype_C_region) {
+ continue;
+ }
+ }
+ xGenerateMissingMrnaForCds(*it);
+ }
+ }
+
+ {
+ SAnnotSelector sel;
+ sel.IncludeFeatType(CSeqFeatData::e_Rna);
+ sel.IncludeFeatSubtype(CSeqFeatData::eSubtype_V_segment);
+ sel.IncludeFeatSubtype(CSeqFeatData::eSubtype_D_segment);
+ sel.IncludeFeatSubtype(CSeqFeatData::eSubtype_J_segment);
+ sel.IncludeFeatSubtype(CSeqFeatData::eSubtype_C_region);
+ xGenerateMissingGeneForFeats(sel, nullptr); //sequence not circular for eukaryote
+ }
}
+++ /dev/null
-/* $Id: huge_asn_loader.cpp 651793 2022-06-24 19:29:43Z gotvyans $
-* ===========================================================================
-*
-* PUBLIC DOMAIN NOTICE
-* National Center for Biotechnology Information
-*
-* This software/database is a "United States Government Work" under the
-* terms of the United States Copyright Act. It was written as part of
-* the author's official duties as a United States Government employee and
-* thus cannot be copyrighted. This software/database is freely available
-* to the public for use. The National Library of Medicine and the U.S.
-* Government have not placed any restriction on its use or reproduction.
-*
-* Although all reasonable efforts have been taken to ensure the accuracy
-* and reliability of the software and data, the NLM and the U.S.
-* Government do not and cannot warrant the performance or results that
-* may be obtained by using this software or data. The NLM and the U.S.
-* Government disclaim all warranties, express or implied, including
-* warranties of performance, merchantability or fitness for any particular
-* purpose.
-*
-* Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-* Authors: Sergiy Gotvyanskyy
-*
-* File Description:
-*
-*
-*/
-
-#include <ncbi_pch.hpp>
-
-#include <objtools/edit/huge_asn_loader.hpp>
-#include <objtools/edit/huge_asn_reader.hpp>
-#include <objmgr/impl/tse_loadlock.hpp>
-
-#include <objects/submit/Submit_block.hpp>
-#include <objects/seqfeat/BioSource.hpp>
-#include <objects/seqfeat/Org_ref.hpp>
-
-BEGIN_NCBI_SCOPE
-BEGIN_SCOPE(objects)
-BEGIN_SCOPE(edit)
-
-namespace
-{
-
-class CLoaderMakerWithReader : public CLoaderMaker_Base
-{
-public:
- CLoaderMakerWithReader(const string& name, CHugeAsnReader* reader):
- m_reader(reader)
- {
- m_Name = name;
- }
-
- virtual CDataLoader* CreateLoader(void) const
- {
- return new CHugeAsnDataLoader(m_Name, m_reader);
- }
-
- typedef CHugeAsnDataLoader::TRegisterLoaderInfo TRegisterInfo;
- TRegisterInfo GetRegisterInfo(void)
- {
- TRegisterInfo info;
- info.Set(m_RegisterInfo.GetLoader(), m_RegisterInfo.IsCreated());
- return info;
- }
-private:
- CHugeAsnReader* m_reader = nullptr;
-};
-
-} // anonymous namespace
-
-CHugeAsnDataLoader::CHugeAsnDataLoader(const string& name, CHugeAsnReader* reader):
- CDataLoader(name),
- m_reader{reader}
-{
-}
-
-
-CHugeAsnDataLoader::~CHugeAsnDataLoader()
-{
- if (m_owning)
- {
- delete m_reader;
- }
-}
-
-#ifdef _DEBUG
-//#define DEBUG_HUGE_ASN_LOADER
-#endif
-
-#ifdef DEBUG_HUGE_ASN_LOADER
-static thread_local std::string loading_ids;
-#endif
-
-CDataLoader::TBlobId CHugeAsnDataLoader::GetBlobId(const CSeq_id_Handle& idh)
-{
-#ifdef DEBUG_HUGE_ASN_LOADER
- loading_ids = idh.AsString();
-#endif
- auto info = m_reader->FindTopObject(idh.GetSeqId());
- if (info) {
- TBlobId blob_id = new CBlobIdPtr(info);
- return blob_id;
- }
-#ifdef DEBUG_HUGE_ASN_LOADER
- cerr << MSerial_AsnText << "Seq id not found: " << loading_ids << "\n";
-#endif
- return {};
-}
-
-CDataLoader::TTSE_Lock CHugeAsnDataLoader::GetBlobById(const TBlobId& blob_id)
-{
- // Load data, get the lock
- CTSE_LoadLock lock = GetDataSource()->GetTSE_LoadLock(blob_id);
- if ( !lock.IsLoaded() ) {
- auto id = (const CBlobIdPtr*)&*blob_id;
- auto info_ptr = id->GetValue();
- const CHugeAsnReader::TBioseqSetInfo* info = (const CHugeAsnReader::TBioseqSetInfo*)info_ptr;
- auto entry = m_reader->LoadSeqEntry(*info);
-#ifdef DEBUG_HUGE_ASN_LOADER
- cerr << MSerial_AsnText << "Loaded: " << loading_ids << "\n";
-#endif
- CTSE_Info& tse_info = *lock;
- tse_info.SetSeq_entry(*entry);
- lock.SetLoaded();
- }
- return lock;
-}
-
-CDataLoader::TTSE_LockSet
-CHugeAsnDataLoader::GetRecords(const CSeq_id_Handle& idh, EChoice /*choice*/)
-{
- TTSE_LockSet locks;
- TBlobId blob_id = GetBlobId(idh);
- if ( blob_id ) {
- TTSE_Lock lock = GetBlobById(blob_id);
- if ( lock ) {
- locks.insert(lock);
- }
- }
- return locks;
-}
-
-CHugeAsnDataLoader::TRegisterLoaderInfo CHugeAsnDataLoader::RegisterInObjectManager(
- CObjectManager& om,
- const string& loader_name,
- CHugeAsnReader* reader,
- CObjectManager::EIsDefault is_default,
- CObjectManager::TPriority priority)
-{
- CLoaderMakerWithReader maker(loader_name, reader);
- CDataLoader::RegisterInObjectManager(om, maker, is_default, priority);
- return maker.GetRegisterInfo();
-}
-
-TSeqPos CHugeAsnDataLoader::GetSequenceLength(const CSeq_id_Handle& idh)
-{
- auto info = m_reader->FindBioseq(idh.GetSeqId());
- return info? info->m_length : kInvalidSeqPos;
-}
-
-CSeq_inst::TMol CHugeAsnDataLoader::GetSequenceType(const CSeq_id_Handle& idh)
-{
- auto info = m_reader->FindBioseq(idh.GetSeqId());
- if (info == nullptr)
- NCBI_THROW(CLoaderException, eNotFound,
- "CHugeAsnDataLoader::GetSequenceType() sequence not found");
-
- if (info->m_mol == CSeq_inst::eMol_not_set)
- NCBI_THROW(CLoaderException, eNoData,
- "CHugeAsnDataLoader::GetSequenceType() type not set");
-
- return info->m_mol;
-}
-
-CDataLoader::STypeFound CHugeAsnDataLoader::GetSequenceTypeFound(const CSeq_id_Handle& idh)
-{
- auto info = m_reader->FindBioseq(idh.GetSeqId());
- STypeFound ret;
- if (info) {
- ret.sequence_found = true;
- ret.type = info->m_mol;
- }
- return ret;
-}
-
-void CHugeAsnDataLoader::GetIds(const CSeq_id_Handle& idh, CDataLoader::TIds& ids)
-{
- //cerr << "CHugeAsnDataLoader::GetIds invoked\n";
- auto info = m_reader->FindBioseq(idh.GetSeqId());
- if (info)
- {
- for (auto id: info->m_ids)
- {
- auto newidh = CSeq_id_Handle::GetHandle(*id);
- if (std::find(begin(ids), end(ids), newidh) == ids.end())
- {
- ids.push_back(newidh);
- }
- }
- }
-}
-
-namespace
-{
- TTaxId x_FindTaxId(const CHugeAsnReader::TBioseqSetList& cont, CHugeAsnReader::TBioseqSetList::const_iterator parent, CConstRef<CSeq_descr> descr)
- {
- if (descr)
- {
- for (auto d: descr->Get())
- {
- const COrg_ref* org_ref = nullptr;
- switch(d->Which())
- {
- case CSeqdesc::e_Source:
- if (d->GetSource().IsSetOrg())
- org_ref = &d->GetSource().GetOrg();
- break;
- case CSeqdesc::e_Org:
- org_ref = &d->GetOrg();
- break;
- default:
- break;
- }
- if (org_ref)
- return org_ref->GetTaxId();
- }
- }
- if (parent != cont.end())
- return x_FindTaxId(cont, parent->m_parent_set, parent->m_descr);
-
- return ZERO_TAX_ID;
- }
-}
-
-TTaxId CHugeAsnDataLoader::GetTaxId(const CSeq_id_Handle& idh)
-{
- auto info = m_reader->FindBioseq(idh.GetSeqId());
- if (info)
- {
- auto taxid = x_FindTaxId(m_reader->GetBiosets(), info->m_parent_set, info->m_descr);
- return taxid;
- }
- return INVALID_TAX_ID;
-}
-
-END_SCOPE(edit)
-END_SCOPE(objects)
-END_NCBI_SCOPE
+++ /dev/null
-/* $Id: huge_asn_macro_reader.cpp 658723 2022-11-07 18:22:37Z asztalos $
-* ===========================================================================
-*
-* PUBLIC DOMAIN NOTICE
-* National Center for Biotechnology Information
-*
-* This software/database is a "United States Government Work" under the
-* terms of the United States Copyright Act. It was written as part of
-* the author's official duties as a United States Government employee and
-* thus cannot be copyrighted. This software/database is freely available
-* to the public for use. The National Library of Medicine and the U.S.
-* Government have not placed any restriction on its use or reproduction.
-*
-* Although all reasonable efforts have been taken to ensure the accuracy
-* and reliability of the software and data, the NLM and the U.S.
-* Government do not and cannot warrant the performance or results that
-* may be obtained by using this software or data. The NLM and the U.S.
-* Government disclaim all warranties, express or implied, including
-* warranties of performance, merchantability or fitness for any particular
-* purpose.
-*
-* Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-* Authors: Sergiy Gotvyanskyy, Andrea Asztalos
-*
-* File Description:
-*
-*
-*/
-
-#include <ncbi_pch.hpp>
-#include <objtools/edit/huge_asn_macro_reader.hpp>
-
-BEGIN_NCBI_SCOPE
-BEGIN_SCOPE(objects)
-BEGIN_SCOPE(edit)
-
-void CMacroHugeAsnReader::ResetTopEntry()
-{
- x_ResetTopEntry();
-}
-
-
-END_SCOPE(edit)
-END_SCOPE(objects)
-END_NCBI_SCOPE
+++ /dev/null
-/* $Id: huge_asn_reader.cpp 663836 2023-03-01 16:53:54Z foleyjp $
-* ===========================================================================
-*
-* PUBLIC DOMAIN NOTICE
-* National Center for Biotechnology Information
-*
-* This software/database is a "United States Government Work" under the
-* terms of the United States Copyright Act. It was written as part of
-* the author's official duties as a United States Government employee and
-* thus cannot be copyrighted. This software/database is freely available
-* to the public for use. The National Library of Medicine and the U.S.
-* Government have not placed any restriction on its use or reproduction.
-*
-* Although all reasonable efforts have been taken to ensure the accuracy
-* and reliability of the software and data, the NLM and the U.S.
-* Government do not and cannot warrant the performance or results that
-* may be obtained by using this software or data. The NLM and the U.S.
-* Government disclaim all warranties, express or implied, including
-* warranties of performance, merchantability or fitness for any particular
-* purpose.
-*
-* Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-* Authors: Sergiy Gotvyanskyy
-*
-* File Description:
-*
-*
-*/
-
-#include <ncbi_pch.hpp>
-
-#include <objects/seq/Bioseq.hpp>
-#include <objects/submit/Seq_submit.hpp>
-#include <objects/seqloc/Seq_id.hpp>
-#include <objects/seq/seq_id_handle.hpp>
-#include <objects/seq/Seq_inst.hpp>
-
-#include <serial/objistr.hpp>
-#include <corelib/ncbifile.hpp>
-
-#include <objtools/edit/huge_asn_reader.hpp>
-#include <objtools/readers/objhook_lambdas.hpp>
-#include <objects/seqfeat/Feat_id.hpp>
-#include <objects/general/Object_id.hpp>
-
-BEGIN_NCBI_SCOPE
-BEGIN_SCOPE(objects)
-BEGIN_SCOPE(edit)
-
-
-CHugeAsnReader::~CHugeAsnReader()
-{
-}
-
-CHugeAsnReader::CHugeAsnReader()
-{
-}
-
-CHugeAsnReader::CHugeAsnReader(CHugeFile* file, ILineErrorListener * pMessageListener)
-{
- Open(file, pMessageListener);
-}
-
-void CHugeAsnReader::x_ResetIndex()
-{
- m_max_local_id = 0;
- m_bioseq_list.clear();
- m_bioseq_set_list.clear();
- m_submit_block.Reset();
-
-// flattenization structures, readonly after flattenization, accept m_Current
- m_bioseq_index.clear();
- m_FlattenedIndex.clear();
- m_FlattenedSets.clear();
- m_top_ids.clear();
- m_top_entry.Reset();
- m_Current = m_FlattenedSets.end();
-
-}
-
-
-bool CHugeAsnReader::IsHugeSet(CBioseq_set::TClass setClass)
-{
- return (setClass == CBioseq_set::eClass_genbank ||
- // setClass == CBioseq_set::eClass_wgs_set ||
- setClass == CBioseq_set::eClass_not_set);
-}
-
-
-void CHugeAsnReader::Open(CHugeFile* file, ILineErrorListener * pMessageListener)
-{
- x_ResetIndex();
-
- m_file = file;
- mp_MessageListener = pMessageListener;
-}
-
-bool CHugeAsnReader::IsMultiSequence() const
-{
- return m_FlattenedSets.size()>1;
- //return m_bioseq_index.size()>1;
-}
-
-const CHugeAsnReader::TBioseqSetInfo* CHugeAsnReader::FindTopObject(CConstRef<CSeq_id> seqid) const
-{
- auto it = m_FlattenedIndex.lower_bound(seqid);
- if (it == m_FlattenedIndex.end())
- return nullptr;
- if (it->first->CompareOrdered(*seqid) == 0)
- return &*it->second;
- if (it->first->Compare(*seqid) != CSeq_id::E_SIC::e_YES)
- return nullptr;
-
- return &*it->second;
-}
-
-const CHugeAsnReader::TBioseqInfo* CHugeAsnReader::FindBioseq(CConstRef<CSeq_id> seqid) const
-{
- auto it = m_bioseq_index.lower_bound(seqid);
- if (it == m_bioseq_index.end())
- return nullptr;
- if (it->first->CompareOrdered(*seqid) == 0)
- return &*it->second;
- if (it->first->Compare(*seqid) != CSeq_id::E_SIC::e_YES)
- return nullptr;
-
- return &*it->second;
-}
-
-
-
-static CConstRef<CSeqdesc> s_GetDescriptor(const CSeq_descr& descr, CSeqdesc::E_Choice choice)
-{
- if (descr.IsSet()) {
- for (auto pDesc : descr.Get()) {
- if (pDesc && (pDesc->Which() == choice)) {
- return pDesc;
- }
- }
- }
-
- return {};
-}
-
-
-CConstRef<CSeqdesc> CHugeAsnReader::GetClosestDescriptor(const TBioseqInfo& info, CSeqdesc::E_Choice choice) const
-{
- CConstRef<CSeqdesc> result;
-
- if (info.m_descr) {
- result = s_GetDescriptor(*info.m_descr, choice);
- if (result) {
- return result;
- }
- }
-
- auto parentSet = info.m_parent_set;
- while (parentSet != end(m_bioseq_set_list)) {
- if (parentSet->m_descr) {
- result = s_GetDescriptor(*parentSet->m_descr, choice);
- if (result) {
- return result;
- }
- }
- parentSet = parentSet->m_parent_set;
- }
-
- return result;
-}
-
-
-CConstRef<CSeqdesc> CHugeAsnReader::GetClosestDescriptor(const CSeq_id& id, CSeqdesc::E_Choice choice) const
-{
- CConstRef<CSeq_id> pId(&id);
- const auto* pInfo = FindBioseq(pId);
- if (!pInfo) {
- return {};
- }
- return GetClosestDescriptor(*pInfo, choice);
-}
-
-
-CRef<CSeq_entry> CHugeAsnReader::LoadSeqEntry(CConstRef<CSeq_id> seqid) const
-{
- auto info = FindTopObject(seqid);
- if (info)
- return LoadSeqEntry(*info);
- else
- return {};
-}
-
-CRef<CSeq_entry> CHugeAsnReader::LoadSeqEntry(const TBioseqSetInfo& info, eAddTopEntry add_top_entry) const
-{
- auto entry = Ref(new CSeq_entry);
- auto obj_stream = m_file->MakeObjStream(info.m_pos);
- if (info.m_class == CBioseq_set::eClass_not_set)
- {
- obj_stream->Read(&entry->SetSeq(), CBioseq::GetTypeInfo(), CObjectIStream::eNoFileHeader);
- } else {
- obj_stream->Read(&entry->SetSet(), CBioseq_set::GetTypeInfo(), CObjectIStream::eNoFileHeader);
- }
-
- if (add_top_entry == eAddTopEntry::yes && m_top_entry) {
- auto pNewEntry = Ref(new CSeq_entry());
- pNewEntry->Assign(*m_top_entry);
- pNewEntry->SetSet().SetSeq_set().push_back(entry);
- return pNewEntry;
- }
-
- return entry;
-}
-
-CRef<CBioseq> CHugeAsnReader::LoadBioseq(CConstRef<CSeq_id> seqid) const
-{
- auto it = m_bioseq_index.lower_bound(seqid);
- if (it == m_bioseq_index.end())
- return {};
- if (it->first->Compare(*seqid) != CSeq_id::E_SIC::e_YES)
- return {};
-
- auto obj_stream = m_file->MakeObjStream(it->second->m_pos);
- auto bioseq = Ref(new CBioseq);
- obj_stream->Read(bioseq, CBioseq::GetTypeInfo(), CObjectIStream::eNoFileHeader);
- return bioseq;
-}
-
-unique_ptr<CObjectIStream> CHugeAsnReader::MakeObjStream(TFileSize pos) const
-{
- return m_file->MakeObjStream(pos);
-}
-
-bool CHugeAsnReader::GetNextBlob()
-{
- if (m_next_pos >= m_file->m_filesize)
- return false;
-
- x_IndexNextAsn1();
- return true;
-}
-
-void CHugeAsnReader::x_SetHooks(CObjectIStream& objStream, CHugeAsnReader::TContext& context)
-{
- CObjectTypeInfo bioseq_info = CType<CBioseq>();
- CObjectTypeInfo bioseq_set_info = CType<CBioseq_set>();
- CObjectTypeInfo seqinst_info = CType<CSeq_inst>();
-
- auto bioseq_id_mi = bioseq_info.FindMember("id");
- //auto bioseqset_class_mi = bioseq_set_info.FindMember("class");
- //auto bioseqset_descr_mi = bioseq_set_info.FindMember("descr");
- auto bioseqset_seqset_mi = bioseq_set_info.FindMember("seq-set");
- auto bioseqset_annot_mi = bioseq_set_info.FindMember("annot");
- auto seqinst_len_mi = seqinst_info.FindMember("length");
- auto seqinst_mol_mi = seqinst_info.FindMember("mol");
- auto seqinst_repr_mi = seqinst_info.FindMember("repr");
- auto bioseq_descr_mi = bioseq_info.FindMember("descr");
-
-
- SetLocalSkipHook(bioseq_id_mi, objStream,
- [&context](CObjectIStream& in, const CObjectTypeInfoMI& member)
- {
- in.ReadObject(&context.bioseq_stack.back().m_ids, (*member).GetTypeInfo());
- });
-
- SetLocalSkipHook(bioseq_descr_mi, objStream,
- [&context](CObjectIStream& in, const CObjectTypeInfoMI& member)
- {
- auto descr = Ref(new CSeq_descr);
- in.ReadObject(&descr, (*member).GetTypeInfo());
- context.bioseq_stack.back().m_descr = descr;
- });
-
- SetLocalSkipHook(seqinst_len_mi, objStream,
- [&context](CObjectIStream& in, const CObjectTypeInfoMI& member)
- {
- in.ReadObject(&context.bioseq_stack.back().m_length, (*member).GetTypeInfo());
- });
-
- SetLocalSkipHook(seqinst_mol_mi, objStream,
- [&context](CObjectIStream& in, const CObjectTypeInfoMI& member)
- {
- in.ReadObject(&context.bioseq_stack.back().m_mol, (*member).GetTypeInfo());
- });
-
-
- SetLocalSkipHook(seqinst_repr_mi, objStream,
- [&context](CObjectIStream& in, const CObjectTypeInfoMI& member)
- {
- in.ReadObject(&context.bioseq_stack.back().m_repr, (*member).GetTypeInfo());
- });
-
-
- x_SetFeatIdHooks(objStream, context);
-
- SetLocalReadHook(bioseqset_seqset_mi, objStream,
- [](CObjectIStream& in, const CObjectInfoMI& member)
- {
- (*member).GetTypeInfo()->DefaultSkipData(in);
- });
-
-
- SetLocalReadHook(bioseqset_annot_mi, objStream,
- [&context](CObjectIStream& in, const CObjectInfoMI& member)
- {
- context.bioseq_set_stack.back()->m_HasAnnot = true;
- (*member).GetTypeInfo()->DefaultSkipData(in);
- });
-
- x_SetBioseqSetHooks(objStream, context);
-
- x_SetBioseqHooks(objStream, context);
-
- SetLocalSkipHook(CType<CSubmit_block>(), objStream,
- [this](CObjectIStream& in, const CObjectTypeInfo& /*type*/)
- {
- auto submit_block = Ref(new CSubmit_block);
- in.Read(submit_block, CSubmit_block::GetTypeInfo(), CObjectIStream::eNoFileHeader);
- m_submit_block = submit_block;
- });
-
-}
-
-void CHugeAsnReader::x_SetBioseqHooks(CObjectIStream& objStream, CHugeAsnReader::TContext& context)
-{
- CObjectTypeInfo bioseq_info = CType<CBioseq>();
-
- SetLocalSkipHook(bioseq_info, objStream,
- [this, &context](CObjectIStream& in, const CObjectTypeInfo& type)
- {
- auto pos = in.GetStreamPos() + m_next_pos;
-
- context.bioseq_stack.push_back({});
- auto parent = context.bioseq_set_stack.back();
-
- type.GetTypeInfo()->DefaultSkipData(in);
-
- auto& bioseqinfo = context.bioseq_stack.back();
- m_bioseq_list.push_back({pos, parent, bioseqinfo.m_length, bioseqinfo.m_descr, bioseqinfo.m_ids, bioseqinfo.m_mol, bioseqinfo.m_repr});
- context.bioseq_stack.pop_back();
- });
-}
-
-
-void CHugeAsnReader::x_SetBioseqSetHooks(CObjectIStream& objStream, CHugeAsnReader::TContext& context)
-{
- CObjectTypeInfo bioseq_set_info = CType<CBioseq_set>();
-
- SetLocalSkipHook(bioseq_set_info, objStream,
- [this, &context](CObjectIStream& in, const CObjectTypeInfo& type)
- {
- auto pos = in.GetStreamPos() + m_next_pos;
- auto parent = context.bioseq_set_stack.back();
- m_bioseq_set_list.push_back({pos, parent});
-
- auto last = prev(m_bioseq_set_list.end());
-
- context.bioseq_set_stack.push_back(last);
- auto pBioseqSet = Ref(new CBioseq_set());
- type.GetTypeInfo()->DefaultReadData(in, pBioseqSet);
-
- if (pBioseqSet->IsSetLevel()) {
- last->m_Level = pBioseqSet->GetLevel();
- }
-
- last->m_class = pBioseqSet->GetClass();
- if (pBioseqSet->IsSetDescr()) {
- last->m_descr.Reset(&(pBioseqSet->GetDescr()));
- }
-
- if (IsHugeSet(last->m_class) &&
- last->m_HasAnnot) {
- m_HasHugeSetAnnot = true;
- }
-
- context.bioseq_set_stack.pop_back();
- });
-}
-
-
-void CHugeAsnReader::x_SetFeatIdHooks(CObjectIStream& objStream, CHugeAsnReader::TContext& context)
-{
- SetLocalSkipHook(CType<CFeat_id>(), objStream,
- [this, &context](CObjectIStream& in, const CObjectTypeInfo& type)
- {
- auto pFeatId = Ref(new CFeat_id());
- type.GetTypeInfo()->DefaultReadData(in, pFeatId);
- if (pFeatId->IsLocal() && pFeatId->GetLocal().IsId())
- {
- m_max_local_id = std::max(m_max_local_id, pFeatId->GetLocal().GetId());
- }
- });
-
- SetLocalReadHook(CType<CFeat_id>(), objStream,
- [this](CObjectIStream& in, const CObjectInfo& object)
- {
- auto* pObject = object.GetObjectPtr();
- object.GetTypeInfo()->DefaultReadData(in, pObject);
- auto* pFeatId = CTypeConverter<CFeat_id>::SafeCast(pObject);
- if (pFeatId->IsLocal() && pFeatId->GetLocal().IsId())
- {
- m_max_local_id = std::max(m_max_local_id, pFeatId->GetLocal().GetId());
- }
- });
-}
-
-void CHugeAsnReader::x_ResetTopEntry()
-{
- m_top_entry.Reset();
-}
-
-void CHugeAsnReader::x_IndexNextAsn1()
-{
- x_ResetIndex();
- m_current_pos = m_next_pos;
- auto object_type = m_file->RecognizeContent(m_current_pos);
-
- auto obj_stream = m_file->MakeObjStream(m_current_pos);
-
- TContext context;
- x_SetHooks(*obj_stream, context);
-
- m_HasHugeSetAnnot = false;
- // Ensure there is at least one bioseq_set_info object exists
- obj_stream->SkipFileHeader(object_type);
- m_bioseq_set_list.push_back({ 0, m_bioseq_set_list.end() });
- context.bioseq_set_stack.push_back(m_bioseq_set_list.begin());
- obj_stream->Skip(object_type, CObjectIStream::eNoFileHeader);
- obj_stream->EndOfData(); // force to SkipWhiteSpace
- m_next_pos += obj_stream->GetStreamPos();
-}
-
-CRef<CSerialObject> CHugeAsnReader::ReadAny()
-{
- if (m_current_pos >= m_file->m_filesize)
- return {};
-
- x_ResetIndex();
- auto object_type = m_file->RecognizeContent(m_current_pos);
- if (object_type == nullptr || !object_type->IsCObject())
- return {};
-
- auto obj_stream = m_file->MakeObjStream(m_current_pos);
-
- auto obj_info = obj_stream->Read(object_type);
- CRef<CSerialObject> serial(static_cast<CSerialObject*>(obj_info.GetObjectPtr()));
- obj_stream->EndOfData(); // force to SkipWhiteSpace
- m_current_pos += obj_stream->GetStreamPos();
- //_ASSERT(m_current_pos == m_next_pos);
-
- return serial;
-}
-
-
-CHugeAsnReader::TStreamPos CHugeAsnReader::GetCurrentPos() const
-{
- return m_current_pos;
-}
-
-
-void CHugeAsnReader::x_ThrowDuplicateId(
- const TBioseqSetInfo& existingInfo,
- const TBioseqSetInfo& newInfo,
- const CSeq_id& duplicateId)
-{
- auto filename = m_file->m_filename;
- auto existingPos = existingInfo.m_pos;
- auto newPos = newInfo.m_pos;
-
- auto existingFilePos = NStr::UInt8ToString(existingPos);
- auto newFilePos = NStr::UInt8ToString(newPos);
- if (!filename.empty()) {
- existingFilePos = filename + ":" + existingFilePos;
- newFilePos = filename + ":" + newFilePos;
- }
- string msg = "duplicate Bioseq id " + objects::GetLabel(duplicateId) +
- " present in the set starting at " + existingFilePos;
- if (newPos != existingPos) {
- msg += " and the set starting at " + newFilePos;
- }
- NCBI_THROW(CHugeFileException, eDuplicateSeqIds, msg);
-}
-
-
-const CBioseq_set::TClass* CHugeAsnReader::GetTopLevelClass() const
-{
- return m_pTopLevelClass;
-}
-
-CRef<CSeq_descr> CHugeAsnReader::x_GetTopLevelDescriptors() const
-{
- CRef<CSeq_descr> pDescriptors;
- if (GetBiosets().size() < 2) {
- return pDescriptors;
- }
-
- auto top = next(GetBiosets().begin());
- if (top->m_descr) {
- pDescriptors = Ref(new CSeq_descr());
- pDescriptors->Assign(*top->m_descr);
- }
-
- for (auto it = next(top); it != end(GetBiosets()); ++it) {
- if (!IsHugeSet(it->m_class)) {
- break;
- }
-
- if (it->m_descr) {
- if (!pDescriptors) {
- pDescriptors = Ref(new CSeq_descr());
- pDescriptors->Assign(*it->m_descr);
- }
- else {
- for (auto pDesc : it->m_descr->Get()) {
- pDescriptors->Set().push_back(pDesc);
- }
- }
- }
- }
- return pDescriptors;
-}
-
-bool CHugeAsnReader::x_HasNestedGenbankSets() const
-{
- if (GetBiosets().size() <= 2) {
- return false;
- }
- auto it = next(GetBiosets().begin());
- return (it->m_class == CBioseq_set::eClass_genbank &&
- next(it)->m_class == CBioseq_set::eClass_genbank);
-}
-
-void CHugeAsnReader::FlattenGenbankSet()
-{
- m_pTopLevelClass = nullptr;
- m_FlattenedSets.clear();
- m_top_ids.clear();
- m_FlattenedIndex.clear();
-
- // single bioseq not contained in set
- if (m_bioseq_list.size() == 1 && m_bioseq_set_list.size() == 1) {
- m_bioseq_set_list.begin()->m_pos = m_bioseq_list.begin()->m_pos;
- }
-
-
- for (auto it = m_bioseq_list.begin(); it!= m_bioseq_list.end(); ++it)
- {
- auto rec = *it;
- auto parent = rec.m_parent_set;
-
- if (auto _class = parent->m_class; IsHugeSet(_class))
- { // create fake bioseq_set
- m_FlattenedSets.push_back({rec.m_pos, m_bioseq_set_list.cend(), objects::CBioseq_set::eClass_not_set});
- m_top_ids.push_back(rec.m_ids.front());
- } else {
-
- auto grandParent = parent->m_parent_set;
- while (!IsHugeSet(grandParent->m_class)) {
- parent = grandParent;
- grandParent = grandParent->m_parent_set;
- }
- if (m_FlattenedSets.empty() || (m_FlattenedSets.back().m_pos != parent->m_pos)) {
- m_FlattenedSets.push_back(*parent);
- m_top_ids.push_back(rec.m_ids.front());
- }
- }
- auto last = --m_FlattenedSets.end();
- for (auto id: rec.m_ids) {
- auto existingIndex = m_FlattenedIndex.find(id);
- if (existingIndex != m_FlattenedIndex.end()) {
- x_ThrowDuplicateId(*(existingIndex->second), *last, *id);
- }
- m_FlattenedIndex[id] = last;
- m_bioseq_index[id] = it;
- }
- }
-
- if (GetBiosets().size()>1)
- {
- auto top = next(GetBiosets().begin());
- if (m_FlattenedSets.size() == 1) {
- // exposing the whole top entry
- if (x_HasNestedGenbankSets()) {
- auto pDescriptors = x_GetTopLevelDescriptors();
- auto pTopEntry = Ref(new CSeq_entry());
- if (top->m_Level) {
- pTopEntry->SetSet().SetLevel() = top->m_Level.value();
- }
- pTopEntry->SetSet().SetClass() = top->m_class;
- if (pDescriptors) {
- pTopEntry->SetSet().SetDescr().Assign(*pDescriptors);
- }
- m_top_entry = pTopEntry;
- }
- else if (GetSubmitBlock() ||
- top->m_Level ||
- top->m_descr ||
- !IsHugeSet(top->m_class)) {
- m_FlattenedSets.clear();
- m_FlattenedSets.push_back(*top);
- for (auto& it : m_FlattenedIndex) {
- it.second = m_FlattenedSets.begin();
- }
- }
- }
- else { // m_FlattenedSets.size() > 1)
- auto pDescriptors = x_GetTopLevelDescriptors();
- if (pDescriptors || top->m_Level) {
- auto top_entry = Ref(new CSeq_entry());
- if (top->m_Level) {
- top_entry->SetSet().SetLevel() = top->m_Level.value();
- }
- top_entry->SetSet().SetClass() = top->m_class;
- if (pDescriptors) {
- top_entry->SetSet().SetDescr().Assign(*pDescriptors);
- }
- m_top_entry = top_entry;
- }
- }
-
- m_pTopLevelClass = &(next(GetBiosets().begin())->m_class);
- }
-
- m_Current = m_FlattenedSets.begin();
-}
-
-CConstRef<CSubmit_block> CHugeAsnReader::GetSubmitBlock() const
-{
- return m_submit_block;
-}
-
-CRef<CSeq_entry> CHugeAsnReader::GetNextSeqEntry()
-{
- if (m_Current == end(m_FlattenedSets)) {
- m_FlattenedSets.clear();
- m_Current = m_FlattenedSets.end();
- return {};
- }
-
- const auto addTopEntry =
- (m_FlattenedSets.size() == 1 &&
- x_HasNestedGenbankSets()) ?
- eAddTopEntry::yes :
- eAddTopEntry::no;
-
- return LoadSeqEntry(*m_Current++, addTopEntry);
-}
-
-END_SCOPE(edit)
-END_SCOPE(objects)
-END_NCBI_SCOPE
+++ /dev/null
-/* $Id: huge_file.cpp 671844 2023-08-24 20:01:10Z ivanov $
-* ===========================================================================
-*
-* PUBLIC DOMAIN NOTICE
-* National Center for Biotechnology Information
-*
-* This software/database is a "United States Government Work" under the
-* terms of the United States Copyright Act. It was written as part of
-* the author's official duties as a United States Government employee and
-* thus cannot be copyrighted. This software/database is freely available
-* to the public for use. The National Library of Medicine and the U.S.
-* Government have not placed any restriction on its use or reproduction.
-*
-* Although all reasonable efforts have been taken to ensure the accuracy
-* and reliability of the software and data, the NLM and the U.S.
-* Government do not and cannot warrant the performance or results that
-* may be obtained by using this software or data. The NLM and the U.S.
-* Government disclaim all warranties, express or implied, including
-* warranties of performance, merchantability or fitness for any particular
-* purpose.
-*
-* Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-* Authors: Sergiy Gotvyanskyy
-*
-* File Description:
-*
-*
-*/
-
-#include <ncbi_pch.hpp>
-
-#include <objtools/edit/huge_file.hpp>
-#include <objtools/readers/format_guess_ex.hpp>
-#include <corelib/ncbifile.hpp>
-#include <objtools/readers/reader_exception.hpp>
-
-#include <serial/objistr.hpp>
-
-BEGIN_NCBI_SCOPE
-BEGIN_SCOPE(objects)
-BEGIN_SCOPE(edit)
-
-CHugeFile::CHugeFile(){}
-CHugeFile::~CHugeFile(){}
-
-void CHugeFile::Open(const std::string& filename, const set<TTypeInfo>* supported_types)
-{
- auto filesize = CFile(filename).GetLength();
- if (filesize > 0) {
- if (x_TryOpenMemoryFile(filename, filesize) ||
- x_TryOpenStreamFile(filename, filesize)) {
- m_supported_types = supported_types;
- m_content = RecognizeContent(*m_stream);
- }
- }
- if (m_filesize <= 0)
- NCBI_THROW(CFileException, eNotExists, "Cannot open " + filename);
-}
-
-bool CHugeFile::x_TryOpenMemoryFile(const string& filename, std::streampos filesize)
-{
- try
- {
- auto memfile = std::make_unique<CMemoryFile>(filename,
- CMemoryFile_Base::eMMP_Read,
- CMemoryFile_Base::eMMS_Private);
-
- m_filesize = memfile->GetFileSize();
- m_filename = filename;
- m_memory = (const char*)memfile->Map(0, 0);
-
- if (m_filesize == 0 || m_memory == 0)
- return false;
-
- m_memfile = std::move(memfile);
-
- m_streambuf.reset(new CMemoryStreamBuf(m_memory, m_filesize));
- m_stream.reset(new std::istream(m_streambuf.get()));
-
- return true;
- }
- catch(const CFileException& e)
- {
- if (e.GetErrCode() == CFileException::eMemoryMap &&
- NStr::StartsWith(e.GetMsg(), "To be memory mapped the file must exist"))
- return false;
- else
- throw;
- }
-
-}
-
-bool CHugeFile::x_TryOpenStreamFile(const string& filename, std::streampos filesize)
-{
- std::unique_ptr<std::ifstream> stream{new std::ifstream(filename, ios::binary)};
- if (!stream->is_open())
- return false;
-
- m_filesize = filesize;
-
- //stream->seekg(m_filesize-1);
- //stream->seekg(0);
-
- m_stream = std::move(stream);
- m_filename = filename;
- return true;
-}
-
-TTypeInfo CHugeFile::RecognizeContent(std::streampos pos)
-{
- if (!m_memory && !m_stream) {
- return nullptr;
- }
- if (m_memory) {
- CMemoryStreamBuf strbuf(m_memory + pos, m_filesize - pos);
- std::istream istr(&strbuf);
- return RecognizeContent(istr);
- }
- m_stream->seekg(pos);
- return RecognizeContent(*m_stream);
-}
-
-TTypeInfo CHugeFile::RecognizeContent(std::istream& istr)
-{
- CFileContentInfo content_info;
-
- CFormatGuessEx FG(istr);
- FG.GetFormatHints().AddPreferredFormat(CFormatGuess::eBinaryASN);
- FG.GetFormatHints().AddPreferredFormat(CFormatGuess::eTextASN);
- FG.GetFormatHints().AddPreferredFormat(CFormatGuess::eFasta);
- FG.GetFormatHints().AddPreferredFormat(CFormatGuess::eGff3);
-
- // See RW-1892, sometimes compressed files are wrongly
- // guessed as binary ASN.1
- FG.GetFormatHints().AddPreferredFormat(CFormatGuess::eZip);
- FG.GetFormatHints().AddPreferredFormat(CFormatGuess::eGZip);
- FG.GetFormatHints().AddPreferredFormat(CFormatGuess::eBZip2);
- FG.GetFormatHints().AddPreferredFormat(CFormatGuess::eLzo);
- FG.GetFormatHints().AddPreferredFormat(CFormatGuess::eZstd);
-
- FG.GetFormatHints().DisableAllNonpreferred();
- if (m_supported_types)
- FG.SetRecognizedGenbankTypes(*m_supported_types);
-
- m_format = FG.GuessFormatAndContent(content_info);
-
- switch (m_format)
- {
- case CFormatGuess::eBinaryASN:
- m_serial_format = eSerial_AsnBinary;
- break;
- case CFormatGuess::eTextASN:
- m_serial_format = eSerial_AsnText;
- break;
- case CFormatGuess::eFasta:
- case CFormatGuess::eGff3:
- case CFormatGuess::eZip:
- case CFormatGuess::eGZip:
- case CFormatGuess::eBZip2:
- case CFormatGuess::eLzo:
- case CFormatGuess::eZstd:
- return nullptr;
- break;
- default:
- NCBI_THROW2(CObjReaderParseException, eFormat, "File format not supported", 0);
- }
-
- TTypeInfo object_type = nullptr;
-
- if (m_supported_types)
- if (m_supported_types->find(content_info.mInfoGenbank.mTypeInfo) != m_supported_types->end())
- object_type = content_info.mInfoGenbank.mTypeInfo;
-
- if (object_type == nullptr)
- NCBI_THROW2(CObjReaderParseException, eFormat, "Object type not supported", 0);
-
- return object_type;
-}
-
-unique_ptr<CObjectIStream> CHugeFile::MakeObjStream(std::streampos pos) const
-{
- unique_ptr<CObjectIStream> str;
-
- if (m_memory) {
- auto chunk = Ref(new CMemoryChunk(m_memory+pos, m_filesize-pos, {}, CMemoryChunk::eNoCopyData));
- CMemoryByteSource source(chunk);
- str.reset(CObjectIStream::Create( m_serial_format, source ));
- //str->SetDelayBufferParsingPolicy(CObjectIStream::eDelayBufferPolicyNeverParse);
- str->SetDelayBufferParsingPolicy(CObjectIStream::eDelayBufferPolicyAlwaysParse);
- } else {
- std::unique_ptr<std::ifstream> stream{new std::ifstream(m_filename, ios::binary)};
- stream->seekg(pos);
- str.reset(CObjectIStream::Open(m_serial_format, *stream.release(), eTakeOwnership));
- }
-
- str->UseMemoryPool();
-
- return str;
-}
-
-
-END_SCOPE(edit)
-END_SCOPE(objects)
-END_NCBI_SCOPE
+++ /dev/null
-/* $Id: huge_file_process.cpp 661267 2023-01-07 17:40:49Z gotvyans $
-* ===========================================================================
-*
-* PUBLIC DOMAIN NOTICE
-* National Center for Biotechnology Information
-*
-* This software/database is a "United States Government Work" under the
-* terms of the United States Copyright Act. It was written as part of
-* the author's official duties as a United States Government employee and
-* thus cannot be copyrighted. This software/database is freely available
-* to the public for use. The National Library of Medicine and the U.S.
-* Government have not placed any restriction on its use or reproduction.
-*
-* Although all reasonable efforts have been taken to ensure the accuracy
-* and reliability of the software and data, the NLM and the U.S.
-* Government do not and cannot warrant the performance or results that
-* may be obtained by using this software or data. The NLM and the U.S.
-* Government disclaim all warranties, express or implied, including
-* warranties of performance, merchantability or fitness for any particular
-* purpose.
-*
-* Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-* Author: Sergiy Gotvyanskyy
-* File Description:
-* Utility class for processing ASN.1 files using Huge Files approach
-*
-*/
-#include <ncbi_pch.hpp>
-
-#include <objects/seq/Seqdesc.hpp>
-#include <objects/seq/Seq_descr.hpp>
-#include <objects/submit/Seq_submit.hpp>
-#include <objects/submit/Submit_block.hpp>
-#include <objects/seqloc/Seq_id.hpp>
-
-#include <objtools/edit/huge_file.hpp>
-#include <objtools/edit/huge_asn_reader.hpp>
-#include <objtools/edit/huge_file_process.hpp>
-
-#include <objects/submit/Submit_block.hpp>
-
-#include <objects/seqset/Bioseq_set.hpp>
-#include <objects/seq/Bioseq.hpp>
-#include <objects/seqset/Seq_entry.hpp>
-
-#include <objmgr/object_manager.hpp>
-#include <objmgr/scope.hpp>
-#include <objtools/edit/huge_asn_loader.hpp>
-
-BEGIN_NCBI_SCOPE
-
-BEGIN_SCOPE(objects)
-BEGIN_SCOPE(edit)
-
-namespace
-{
-
- class CAutoRevoker
- {
- public:
- template<class TLoader>
- CAutoRevoker(struct SRegisterLoaderInfo<TLoader>& info)
- : m_loader{ info.GetLoader() } {}
- ~CAutoRevoker()
- {
- CObjectManager::GetInstance()->RevokeDataLoader(*m_loader);
- }
- private:
- CDataLoader* m_loader = nullptr;
- };
-
-}
-
-
-const set<TTypeInfo> CHugeFileProcess::g_supported_types =
-{
- CBioseq_set::GetTypeInfo(),
- CBioseq::GetTypeInfo(),
- CSeq_entry::GetTypeInfo(),
- CSeq_submit::GetTypeInfo(),
-};
-
-
-CHugeFileProcess::CHugeFileProcess():
- m_pHugeFile { new CHugeFile },
- m_pReader{ new CHugeAsnReader }
-{}
-
-
-CHugeFileProcess::CHugeFileProcess(CHugeAsnReader* pReader):
- m_pHugeFile { new CHugeFile },
- m_pReader { pReader }
-{}
-
-CHugeFileProcess::CHugeFileProcess(const string& file_name, const set<TTypeInfo>* types)
-: CHugeFileProcess()
-{
- Open(file_name, types);
-}
-
-bool CHugeFileProcess::IsSupported(TTypeInfo info)
-{
- return g_supported_types.find(info) != g_supported_types.end();
-}
-
-void CHugeFileProcess::Open(const string& file_name, const set<TTypeInfo>* types)
-{
- OpenFile(file_name, types);
- OpenReader();
-}
-
-void CHugeFileProcess::OpenFile(const string& file_name)
-{
- m_pHugeFile->Open(file_name, &g_supported_types);
-}
-
-void CHugeFileProcess::OpenFile(const string& file_name, const set<TTypeInfo>* types)
-{
- m_pHugeFile->Open(file_name, types);
-}
-
-void CHugeFileProcess::OpenReader()
-{
- m_pReader->Open(m_pHugeFile.get(), nullptr);
-}
-
-CHugeFileProcess::~CHugeFileProcess()
-{
-}
-
-bool CHugeFileProcess::Read(THandler handler, CRef<CSeq_id> seqid)
-{
- if (!m_pReader->GetNextBlob()) {
- return false;
- }
-
- do
- {
- m_pReader->FlattenGenbankSet();
- CRef<CSeq_entry> entry;
- do
- {
- entry.Reset();
-
- if (seqid.Empty())
- entry = m_pReader->GetNextSeqEntry();
- else
- {
- auto seq = m_pReader->LoadBioseq(seqid);
- if (seq.NotEmpty())
- {
- entry = Ref(new CSeq_entry);
- entry->SetSeq(*seq);
- if (auto pTopEntry = m_pReader->GetTopEntry(); pTopEntry) {
- auto pNewEntry = Ref(new CSeq_entry());
- pNewEntry->Assign(*pTopEntry);
- pNewEntry->SetSet().SetSeq_set().push_back(entry);
- entry = pNewEntry;
- }
- }
- }
-
- if (entry)
- {
- handler(m_pReader->GetSubmitBlock(), entry);
- }
- }
- while ( entry && seqid.Empty());
- } while (m_pReader->GetNextBlob());
-
- return true;
-}
-
-bool CHugeFileProcess::Read(THandlerIds handler)
-{
- while (m_pReader->GetNextBlob()) {
- m_pReader->FlattenGenbankSet();
- bool processed = handler(m_pReader.get(), m_pReader->GetTopIds());
- if (!processed)
- return false;
- }
-
- return true;
-}
-
-bool CHugeFileProcess::ReadNextBlob()
-{
- if (m_pReader->GetNextBlob()) {
- m_pReader->FlattenGenbankSet();
- return true;
- }
-
- return false;
-}
-
-
-bool CHugeFileProcess::ForEachBlob(THandlerBlobs handler)
-{
- while (m_pReader->GetNextBlob()) {
- m_pReader->FlattenGenbankSet();
- bool processed = handler(*this);
- if (!processed)
- return false;
- }
-
- return true;
-}
-
-bool CHugeFileProcess::ForEachEntry(CRef<CScope> scope, THandlerEntries handler)
-{
- if (!handler)
- return false;
-
- string loader_name = CDirEntry::CreateAbsolutePath(GetFile().m_filename);
- auto info = CHugeAsnDataLoader::RegisterInObjectManager(
- *CObjectManager::GetInstance(), loader_name, &GetReader(), CObjectManager::eNonDefault, 1); //CObjectManager::kPriority_Local);
-
- CAutoRevoker autorevoker(info);
-
- if (!scope)
- scope = Ref(new CScope(*CObjectManager::GetInstance()));
-
- scope->AddDataLoader(loader_name);
-
- try
- {
- for (auto id: GetReader().GetTopIds())
- {
- {
- auto beh = scope->GetBioseqHandle(*id);
- auto parent = beh.GetTopLevelEntry();
- handler(parent);
- }
- scope->ResetHistory();
- }
- }
- catch(const std::exception& e)
- {
- scope->RemoveDataLoader(loader_name);
- throw;
- }
- scope->RemoveDataLoader(loader_name);
-
- return true;
-}
-
-
-CSeq_entry_Handle CHugeFileProcess::GetTopLevelEntry(CBioseq_Handle beh)
-{
- CSeq_entry_Handle parent = beh.GetParentEntry();
- while(parent)
- {
- if (parent.IsTopLevelEntry())
- break;
-
- if (auto temp = parent.GetParentEntry(); temp) {
- if (temp.IsSet() && temp.GetSet().IsSetClass() &&
- CHugeAsnReader::IsHugeSet(temp.GetSet().GetClass())) {
- break;
- }
-
- parent = temp;
- }
- else
- break;
- }
-
- return parent;
-}
-
-END_SCOPE(edit)
-END_SCOPE(objects)
-END_NCBI_SCOPE
-/* $Id: pub_fix.cpp 670328 2023-07-21 18:17:03Z sadyrovr $
+/* $Id: pub_fix.cpp 676568 2023-12-18 19:55:19Z sadyrovr $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
// MedlineToISO(tmp)
// converts a MEDLINE citation to ISO/GenBank style
-void MedlineToISO(CCit_art& cit_art, IPubmedUpdater* upd)
+void MedlineToISO(CCit_art& cit_art)
{
if (cit_art.IsSetAuthors()) {
cit_art.SetAuthors().ConvertMlToStd(true);
// from a journal - get iso_jta
CCit_jour& journal = cit_art.SetFrom().SetJournal();
-
-#if 0
- if (journal.IsSetTitle() && journal.GetTitle().IsSet() && upd) {
- auto& titles = journal.SetTitle().Set();
- auto is_jta = [](const CRef<CTitle::C_E>& title) -> bool { return title->IsIso_jta(); };
- if (find_if(titles.begin(), titles.end(), is_jta) == titles.end()) {
- // no iso_jta
- CTitle::C_E& first_title = *titles.front();
- const string& title_str = journal.SetTitle().GetTitle(first_title);
- const string new_title = upd->GetTitle(title_str);
- if (!new_title.empty()) {
- first_title.SetIso_jta(new_title);
- }
- }
- }
-#endif
-
if (journal.IsSetImp()) {
// remove Eng language
if (journal.GetImp().IsSetLanguage() && journal.GetImp().GetLanguage() == "Eng")
// splits a medline entry into 2 pubs (1 muid, 1 Cit-art)
// converts Cit-art to ISO/GenBank style
// deletes original medline entry
-void SplitMedlineEntry(CPub_equiv::Tdata& medlines, IPubmedUpdater* upd)
+void SplitMedlineEntry(CPub_equiv::Tdata& medlines)
{
if (medlines.size() != 1) {
return;
if (medline.IsSetCit()) {
cit_art.Reset(new CPub);
cit_art->SetArticle(medline.SetCit());
- MedlineToISO(cit_art->SetArticle(), upd);
+ MedlineToISO(cit_art->SetArticle());
}
medlines.clear();
medlines.resize(1);
}
- SplitMedlineEntry(medlines, m_upd);
+ SplitMedlineEntry(medlines);
pub_list.splice(pub_list.end(), medlines);
}
pmids.front()->SetPmid().Set(pmid);
pub_list.splice(pub_list.end(), pmids);
- MedlineToISO(*cit_art, m_upd);
+ MedlineToISO(*cit_art);
pub_list.splice(pub_list.end(), cit_arts);
}
pub_list.splice(pub_list.end(), pmids);
if (m_replace_cit) {
- MedlineToISO(*new_cit_art, m_upd);
+ MedlineToISO(*new_cit_art);
CRef<CPub> cit_pub(new CPub);
cit_pub->SetArticle(*new_cit_art);
pub_list.push_back(cit_pub);
pub_equiv->Set().push_back(CRef<CPub>(new CPub));
pub_equiv->Set().front()->Assign(pub);
- SplitMedlineEntry(pub_equiv->Set(), m_upd);
+ SplitMedlineEntry(pub_equiv->Set());
pub.SetEquiv().Assign(*pub_equiv);
}
break;
}
else {
PrintPub(cit_art, false, true, ENTREZ_ID_TO(long, pmid), m_err_log);
- MedlineToISO(cit_art, m_upd);
+ MedlineToISO(cit_art);
}
}
}
else {
PrintPub(cit_art, false, false, ENTREZ_ID_TO(long, pmid), m_err_log);
- MedlineToISO(cit_art, m_upd);
+ MedlineToISO(cit_art);
}
}
}
}
}
-CRef<CCit_art> CPubFix::FetchPubPmId(TEntrezId pmid, IPubmedUpdater* upd)
+CRef<CCit_art> CPubFix::FetchPubPmId(TEntrezId pmid, CEUtilsUpdater* upd)
{
CRef<CCit_art> cit_art;
if (!upd || pmid < ZERO_ENTREZ_ID) {
cit_art.Reset(new CCit_art);
cit_art->Assign(pub->GetArticle());
- MedlineToISO(*cit_art, upd);
+ MedlineToISO(*cit_art);
}
return cit_art;
#ifndef OBJECTS_GENERAL___CLEANUP_FIX_PUB_AUX__HPP
#define OBJECTS_GENERAL___CLEANUP_FIX_PUB_AUX__HPP
-/* $Id: pub_fix_aux.hpp 644476 2022-01-27 13:49:04Z stakhovv $
+/* $Id: pub_fix_aux.hpp 676324 2023-12-14 14:04:33Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
BEGIN_SCOPE(edit)
-class IPubmedUpdater;
-
namespace fix_pub
{
};
-NCBI_XOBJEDIT_EXPORT void MedlineToISO(CCit_art& cit_art, IPubmedUpdater* = nullptr);
-NCBI_XOBJEDIT_EXPORT void SplitMedlineEntry(CPub_equiv::Tdata& medlines, IPubmedUpdater* = nullptr);
+NCBI_XOBJEDIT_EXPORT void MedlineToISO(CCit_art& cit_art);
+NCBI_DEPRECATED inline void MedlineToISO(CCit_art& cit_art, void*) { MedlineToISO(cit_art); }
+NCBI_XOBJEDIT_EXPORT void SplitMedlineEntry(CPub_equiv::Tdata& medlines);
+NCBI_DEPRECATED inline void SplitMedlineEntry(CPub_equiv::Tdata& medlines, void*) { SplitMedlineEntry(medlines); }
NCBI_XOBJEDIT_EXPORT bool IsInpress(const CCit_art& cit_art);
NCBI_XOBJEDIT_EXPORT bool NeedToPropagateInJournal(const CCit_art& cit_art);
NCBI_XOBJEDIT_EXPORT bool MULooksLikeISSN(const string& str);
-/* $Id: remote_updater.cpp 672327 2023-09-05 18:18:06Z ivanov $
-* ===========================================================================
-*
-* PUBLIC DOMAIN NOTICE
-* National Center for Biotechnology Information
-*
-* This software/database is a "United States Government Work" under the
-* terms of the United States Copyright Act. It was written as part of
-* the author's official duties as a United States Government employee and
-* thus cannot be copyrighted. This software/database is freely available
-* to the public for use. The National Library of Medicine and the U.S.
-* Government have not placed any restriction on its use or reproduction.
-*
-* Although all reasonable efforts have been taken to ensure the accuracy
-* and reliability of the software and data, the NLM and the U.S.
-* Government do not and cannot warrant the performance or results that
-* may be obtained by using this software or data. The NLM and the U.S.
-* Government disclaim all warranties, express or implied, including
-* warranties of performance, merchantability or fitness for any particular
-* purpose.
-*
-* Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-* Authors: Sergiy Gotvyanskyy, NCBI
-* Colleen Bolin, NCBI
-*
-* File Description:
-* Front-end class for making remote request to MLA and taxon
-*
-* ===========================================================================
-*/
+/* $Id: remote_updater.cpp 677028 2024-01-03 14:08:01Z ivanov $
+ * ===========================================================================
+ *
+ * PUBLIC DOMAIN NOTICE
+ * National Center for Biotechnology Information
+ *
+ * This software/database is a "United States Government Work" under the
+ * terms of the United States Copyright Act. It was written as part of
+ * the author's official duties as a United States Government employee and
+ * thus cannot be copyrighted. This software/database is freely available
+ * to the public for use. The National Library of Medicine and the U.S.
+ * Government have not placed any restriction on its use or reproduction.
+ *
+ * Although all reasonable efforts have been taken to ensure the accuracy
+ * and reliability of the software and data, the NLM and the U.S.
+ * Government do not and cannot warrant the performance or results that
+ * may be obtained by using this software or data. The NLM and the U.S.
+ * Government disclaim all warranties, express or implied, including
+ * warranties of performance, merchantability or fitness for any particular
+ * purpose.
+ *
+ * Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ * Authors: Sergiy Gotvyanskyy, NCBI
+ * Colleen Bolin, NCBI
+ *
+ * File Description:
+ * Front-end class for making remote request to MLA and taxon
+ *
+ * ===========================================================================
+ */
#include <ncbi_pch.hpp>
#include <objects/taxon3/taxon3.hpp>
#include <objects/pub/Pub_equiv.hpp>
-#include <objects/pub/Pub.hpp>
#include <objects/seq/Pubdesc.hpp>
+#include <objects/medline/Medline_entry.hpp>
#include <objects/seqfeat/Org_ref.hpp>
#include <objects/submit/Seq_submit.hpp>
// new
#include <objects/biblio/Auth_list.hpp>
#include <objects/biblio/Author.hpp>
+#include <objects/biblio/Cit_art.hpp>
#include <objects/general/Person_id.hpp>
#include <objects/general/Name_std.hpp>
return false;
}
-CRef<CPub> s_GetPubFrompmid(IPubmedUpdater* upd, TEntrezId id, int maxAttempts, IObjtoolsListener* pMessageListener)
+static
+CRef<CPub> s_GetPubFrompmid(CEUtilsUpdater* upd, TEntrezId id, int maxAttempts, IObjtoolsListener* pMessageListener)
{
CRef<CPub> result;
int maxCount = max(1, maxAttempts);
for (int count = 0; count < maxCount; ++count) {
EPubmedError errorVal;
- result = upd->GetPub(id, &errorVal);
+ result = upd->GetPubmedEntry(id, &errorVal);
if (result) {
return result;
}
bool CRemoteUpdater::xUpdatePubPMID(list<CRef<CPub>>& arr, TEntrezId id)
{
- auto new_pub = s_GetPubFrompmid(m_pubmed.get(), id, m_MaxMlaAttempts, m_pMessageListener);
- if (! new_pub) {
+ auto pub = s_GetPubFrompmid(m_pubmed.get(), id, m_MaxMlaAttempts, m_pMessageListener);
+ if (! (pub && pub->IsMedline())) {
+ return false;
+ }
+
+ CRef<CPub> new_pub(new CPub);
+ switch (m_pm_pub_type) {
+ case CPub::e_Article:
+ if (! pub->GetMedline().IsSetCit()) {
+ return false;
+ }
+ new_pub->SetArticle().Assign(pub->GetMedline().GetCit());
+ break;
+ case CPub::e_Medline:
+ new_pub->SetMedline().Assign(pub->GetMedline());
+ break;
+ default:
return false;
}
if (cfg.HasEntry("RemotePubmedUpdate")) {
const string sect = "RemotePubmedUpdate";
- string s = cfg.Get(sect, "Source");
- NStr::ToLower(s);
- if (s == "eutils") {
- m_pm_source = EPubmedSource::eEUtils;
- } else if (s == "none") {
- m_pm_source = EPubmedSource::eNone;
- }
if (cfg.HasEntry(sect, "URL")) {
m_pm_url = cfg.GetString(sect, "URL", {});
return false;
}
-void CRemoteUpdater::UpdateOrgFromTaxon(FLogger logger, CSeqdesc& desc)
+void CRemoteUpdater::UpdateOrgFromTaxon(CSeqdesc& desc)
{
if (desc.IsOrg()) {
- xUpdateOrgTaxname(desc.SetOrg(), logger);
+ xUpdateOrgTaxname(desc.SetOrg());
} else if (desc.IsSource() && desc.GetSource().IsSetOrg()) {
- xUpdateOrgTaxname(desc.SetSource().SetOrg(), logger);
+ xUpdateOrgTaxname(desc.SetSource().SetOrg());
}
}
}
}
-void CRemoteUpdater::xUpdateOrgTaxname(COrg_ref& org, FLogger logger)
-{ // logger parameter is deprecated and should be removed soon
+void CRemoteUpdater::xUpdateOrgTaxname(COrg_ref& org)
+{
std::lock_guard<std::mutex> guard(m_Mutex);
TTaxId taxid = org.GetTaxId();
xInitTaxCache();
- CRef<COrg_ref> new_org = m_taxClient->GetOrg(org, logger);
+ CRef<COrg_ref> new_org = m_taxClient->GetOrg(org, m_logger);
if (new_org.NotEmpty()) {
org.Assign(*new_org);
}
}
-void CRemoteUpdater::UpdateOrgFromTaxon(CSeqdesc& desc)
-{
- UpdateOrgFromTaxon(m_logger, desc);
-}
-
CRemoteUpdater& CRemoteUpdater::GetInstance()
{
static CRemoteUpdater instance{ (IObjtoolsListener*)nullptr };
return instance;
}
-CRemoteUpdater::CRemoteUpdater(FLogger logger, EPubmedSource pms, bool bNormalize) :
- m_logger{ logger }, m_pm_source(pms), m_pm_normalize(bNormalize)
+CRemoteUpdater::CRemoteUpdater(FLogger logger, CEUtilsUpdater::ENormalize norm) :
+ m_logger{ logger }, m_pm_normalize(norm)
{
xSetFromConfig();
}
-CRemoteUpdater::CRemoteUpdater(IObjtoolsListener* pMessageListener, EPubmedSource pms, bool bNormalize) :
- m_pMessageListener(pMessageListener), m_pm_source(pms), m_pm_normalize(bNormalize)
+CRemoteUpdater::CRemoteUpdater(IObjtoolsListener* pMessageListener, CEUtilsUpdater::ENormalize norm) :
+ m_pMessageListener(pMessageListener), m_pm_normalize(norm)
{
if (m_pMessageListener) {
m_logger = [this](const string& error_message) {
}
if (m_pm_use_cache && m_pubmed) {
- switch (m_pm_source) {
- case EPubmedSource::eMLA:
- case EPubmedSource::eEUtils: {
- auto* upd = dynamic_cast<CEUtilsUpdaterWithCache*>(m_pubmed.get());
- if (upd) {
- upd->ClearCache();
- }
- break;
- }
- default:
- break;
+ auto* upd = dynamic_cast<CEUtilsUpdaterWithCache*>(m_pubmed.get());
+ if (upd) {
+ upd->ClearCache();
}
}
}
auto& arr = pDesc->SetPub().SetPub().Set();
if (! m_pubmed) {
- switch (m_pm_source) {
- case EPubmedSource::eNone:
- break;
- default:
- case EPubmedSource::eEUtils:
- if (m_pm_use_cache) {
- m_pubmed.reset(new CEUtilsUpdaterWithCache(m_pm_normalize));
- } else {
- m_pubmed.reset(new CEUtilsUpdater(m_pm_normalize));
- }
- if (! m_pm_url.empty()) {
- CEUtils_Request::SetBaseURL(m_pm_url);
- }
- if (m_pm_interceptor)
- m_pubmed->SetPubInterceptor(m_pm_interceptor);
- break;
+ if (m_pm_use_cache) {
+ m_pubmed.reset(new CEUtilsUpdaterWithCache(m_pm_normalize));
+ } else {
+ m_pubmed.reset(new CEUtilsUpdater(m_pm_normalize));
+ }
+ if (! m_pm_url.empty()) {
+ CEUtils_Request::SetBaseURL(m_pm_url);
+ }
+ if (m_pm_interceptor) {
+ m_pubmed->SetPubInterceptor(m_pm_interceptor);
}
}
continue;
}
- for (const auto& pPubEquiv : arr) {
- if (pPubEquiv->IsArticle()) {
- id = m_pubmed->CitMatch(*pPubEquiv);
+ for (const auto& pPub : arr) {
+ if (pPub->IsArticle()) {
+ id = m_pubmed->CitMatch(*pPub);
if (id > ZERO_ENTREZ_ID && xUpdatePubPMID(arr, id)) {
break;
}
}
}
-void CRemoteUpdater::UpdateOrgFromTaxon(FLogger logger, CSeq_entry& entry)
+void CRemoteUpdater::UpdateOrgFromTaxon(CSeq_entry& entry)
{
TOrgMap org_to_update;
for (auto& it : org_to_update) {
vector<CRef<COrg_ref>> reflist;
reflist.push_back(it.second.org_ref);
- CRef<CTaxon3_reply> reply = m_taxClient->SendOrgRefList(reflist, logger);
+ CRef<CTaxon3_reply> reply = m_taxClient->SendOrgRefList(reflist, m_logger);
if (reply.NotNull()) {
auto& reply_it = reply->SetReply().front();
}
}
-void CRemoteUpdater::UpdateOrgFromTaxon(CSeq_entry& entry)
-{
- UpdateOrgFromTaxon(m_logger, entry);
-}
-
-void CRemoteUpdater::UpdateOrgFromTaxon(FLogger logger, CSeq_entry_EditHandle& obj)
-{
- for (CBioseq_CI bioseq_it(obj); bioseq_it; ++bioseq_it) {
- for (CSeqdesc_CI desc_it(bioseq_it->GetEditHandle()); desc_it; ++desc_it) {
- UpdateOrgFromTaxon(logger, (CSeqdesc&)*desc_it);
- }
- }
-}
-
void CRemoteUpdater::ConvertToStandardAuthors(CAuth_list& auth_list)
{
}
}
-void CRemoteUpdater::SetPubmedClient(IPubmedUpdater* pubmedUpdater)
+void CRemoteUpdater::SetPubmedClient(CEUtilsUpdater* pubmedUpdater)
{
m_pubmed.reset(pubmedUpdater);
}
}
if (m_pm_use_cache && m_pubmed) {
- switch (m_pm_source) {
- case EPubmedSource::eMLA:
- case EPubmedSource::eEUtils: {
- auto* upd = dynamic_cast<CEUtilsUpdaterWithCache*>(m_pubmed.get());
- if (upd && ! dynamic_cast<CEUtilsUpdater*>(m_pubmed.get())) {
- upd->ReportStats(os);
- }
- break;
- }
- default:
- break;
+ auto* upd = dynamic_cast<CEUtilsUpdaterWithCache*>(m_pubmed.get());
+ if (upd) {
+ upd->ReportStats(os);
}
}
}
-/* $Id: seq_entry_edit.cpp 664960 2023-03-24 14:16:03Z stakhovv $
+/* $Id: seq_entry_edit.cpp 675913 2023-12-05 13:22:18Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
return CConstRef <CDelta_seq>();
}
- size_t offset = 0;
+ unsigned offset = 0;
int len = 0;
ITERATE (list <CRef <CDelta_seq> >, it, seq_hl.GetInst_Ext().GetDelta().Get()) {
// figure out what input entry each row belongs to
const CDense_seg::TIds & ids = align.GetSegs().GetDenseg().GetIds();
- for( size_t iRow = 0; iRow < ids.size(); ++iRow ) {
+ for(unsigned iRow = 0; iRow < ids.size(); ++iRow) {
CBioseq_Handle id_bioseq = scope.GetBioseqHandle(*ids[iRow]);
CSeq_entry_Handle id_bioseq_entry =
( id_bioseq ?
{
CRef<CDelta_seq> ds(new CDelta_seq());
ds->SetLiteral().SetSeq_data().SetIupacna().Set(element);
- ds->SetLiteral().SetLength(element.length());
+ ds->SetLiteral().SetLength(TSeqPos(element.length()));
inst.SetExt().SetDelta().Set().push_back(ds);
}
// Modify the copy of the feature
bool isPartialStart = false;
bool isPartialStop = false;
- auto cds_range = copy_feat->GetLocation().GetTotalRange();
TrimSeqFeat(copy_feat, sorted_cuts, bFeatureDeleted, bFeatureTrimmed, isPartialStart, isPartialStop);
if (bFeatureDeleted) {
TSignedSeqPos seg_start = denseg.GetStarts()[index];
if (seg_start < 0) {
// This indicates a gap, no change needed
- }
- else if (seg_start < cut_from) {
+ } else if (TSeqPos(seg_start) < cut_from) {
// This is before the cut, no change needed
- }
- else if (seg_start >= cut_from &&
- seg_start + denseg.GetLens()[curseg] <= cut_from + cut_len) {
+ } else if (TSeqPos(seg_start) >= cut_from &&
+ TSeqPos(seg_start) + denseg.GetLens()[curseg] <= cut_from + cut_len) {
// This is in the gap, indicate it with a -1
align->SetSegs().SetDenseg().SetStarts()[index] = -1;
- }
- else {
+ } else {
// This is after the cut - subtract the cut_len
align->SetSegs().SetDenseg().SetStarts()[index] -= cut_len;
}
// Get partialness and strand of location before cutting
bool bIsPartialStart = false;
CSeq_loc::TStrand eStrand = eNa_strand_unknown;
- TRange cds_range;
if (cds->CanGetLocation()) {
bIsPartialStart = cds->GetLocation().IsPartialStart(eExtreme_Biological);
eStrand = cds->GetLocation().GetStrand();
- cds_range = cds->GetLocation().GetTotalRange();
}
for (TCuts::size_type ii = 0; ii < sorted_cuts.size(); ++ii) {
-/* $Id: PubmedArticle.cpp 668898 2023-06-14 17:38:50Z ivanov $
+/* $Id: PubmedArticle.cpp 680684 2024-03-25 17:18:44Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
}
-static int s_GetPublicationStatusId(const string& publication_status)
+static EPubStatus s_GetPublicationStatusId(const string& publication_status)
{
- static const unordered_map<string, int> s_PubStatusId {
+ static const unordered_map<string, EPubStatus> s_PubStatusId {
{ "received", ePubStatus_received },
{ "accepted", ePubStatus_accepted },
{ "epublish", ePubStatus_epublish },
{
CRef<CPubStatusDateSet> date_set(new CPubStatusDateSet());
for (auto pub_date : pubmed_data.GetHistory().GetPubMedPubDate()) {
- CRef<CPubStatusDate> pub_stat_date(new CPubStatusDate());
string pub_status = CPubMedPubDate::C_Attlist::GetTypeInfo_enum_EAttlist_PubStatus()->
FindName(pub_date->GetAttlist().GetPubStatus(), false);
- pub_stat_date->SetPubstatus(s_GetPublicationStatusId(pub_status));
- pub_stat_date->SetDate(*s_GetDateFromPubMedPubDate(*pub_date));
- date_set->Set().push_back(pub_stat_date);
+ EPubStatus eps = s_GetPublicationStatusId(pub_status);
+ if (eps != ePubStatus_other) {
+ CRef<CPubStatusDate> pub_stat_date(new CPubStatusDate());
+ pub_stat_date->SetPubstatus(eps);
+ pub_stat_date->SetDate(*s_GetDateFromPubMedPubDate(*pub_date));
+ date_set->Set().push_back(pub_stat_date);
+ }
}
imprint->SetHistory(*date_set);
}
for (auto article_id_it : article_id_list.GetArticleId()) {
CRef<objects::CArticleId> id(new objects::CArticleId());
try {
- const string& str_id = article_id_it->GetArticleId();
+ const string& str_id = utf8_to_string(article_id_it->GetArticleId());
switch (s_GetArticleIdTypeId(*article_id_it)) {
case objects::CArticleId::e_Pubmed:
id->SetPubmed(CPubMedId(NStr::StringToNumeric<TEntrezId>(str_id)));
-# $Id: CMakeLists.txt 621735 2020-12-16 15:47:41Z ivanov $
+# $Id: CMakeLists.txt 676228 2023-12-12 19:07:25Z ivanov $
NCBI_add_library(xformat)
+NCBI_add_subdirectory(test)
-# $Id: Makefile.in 31805 2003-12-17 20:00:52Z shomrat $
+# $Id: Makefile.in 676228 2023-12-12 19:07:25Z ivanov $
# Meta-makefile (flat-file generator)
##################################
LIB_PROJ = xformat
+SUB_PROJ = test
+
srcdir = @srcdir@
include @builddir@/Makefile.meta
-/* $Id: comment_item.cpp 671848 2023-08-24 20:01:29Z ivanov $
+/* $Id: comment_item.cpp 675914 2023-12-05 13:22:31Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
return retval;
}
-
string CCommentItem::GetStringForRefTrack(const CBioseqContext& ctx, const CUser_object& uo,
const CBioseq_Handle& bsh,
EGenomeBuildComment eGenomeBuildComment )
return CNcbiOstrstreamToString(oss);
}
+// LCOV_EXCL_START
string CCommentItem::GetStringForRefSeqGenome(const CUser_object& uo)
{
if ( ! FIELD_IS_SET_AND_IS(uo, Type, Str) ||
return CNcbiOstrstreamToString(result_oss);
}
+// LCOV_EXCL_STOP
string CCommentItem::GetStringForWGS(CBioseqContext& ctx)
-/* $Id: dbsource_item.cpp 665431 2023-04-04 17:43:43Z stakhovv $
+/* $Id: dbsource_item.cpp 675915 2023-12-05 13:22:40Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
}
switch (idh.Which()) {
+// LCOV_EXCL_START
case CSeq_id::e_Pir:
m_DBSource.push_back(x_FormatDBSourceID(idh));
x_AddPIRBlock(ctx);
break;
+// LCOV_EXCL_STOP
case CSeq_id::e_Swissprot:
m_DBSource.push_back(x_FormatDBSourceID(idh));
x_AddSPBlock(ctx);
break;
-
+// LCOV_EXCL_START
case CSeq_id::e_Prf:
m_DBSource.push_back(x_FormatDBSourceID(idh));
x_AddPRFBlock(ctx);
break;
+// LCOV_EXCL_STOP
case CSeq_id::e_Pdb:
m_DBSource.push_back(x_FormatDBSourceID(idh));
}
}
+// LCOV_EXCL_START
void CDBSourceItem::x_AddPIRBlock(CBioseqContext& ctx)
{
// In this function, the newlines seem weird because the C toolkit
m_DBSource.front() += "\n";
}
}
+// LCOV_EXCL_STOP
static void s_FormatDate(const CDate& date, string& str)
{
}
}
-
+// LCOV_EXCL_START
void CDBSourceItem::x_AddPRFBlock(CBioseqContext& ctx)
{
CSeqdesc_CI dsc(ctx.GetHandle(), CSeqdesc::e_Prf);
*it += (&*it == &m_DBSource.back() ? '.' : ';');
}
}
+// LCOV_EXCL_STOP
void CDBSourceItem::x_AddPDBBlock(CBioseqContext& ctx)
-/* $Id: feature_item.cpp 670941 2023-08-04 12:24:26Z ivanov $
+/* $Id: feature_item.cpp 679820 2024-03-04 18:32:45Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
return sc_LegalRefSeqExceptText.find(text.c_str()) != sc_LegalRefSeqExceptText.end();
}
-bool s_GetGbValue( CConstRef<CSeq_feat> feat, const string& key, string& value )
-{
- if ( ! feat->IsSetQual() ) {
- return false;
- }
- const CSeq_feat_Base::TQual & qual = feat->GetQual(); // must store reference since ITERATE macro evaluates 3rd arg multiple times
- ITERATE( CSeq_feat::TQual, it, qual ) {
- if (!(*it)->IsSetQual() || !(*it)->IsSetVal()) {
- continue;
- }
- if ( (*it)->GetQual() != key ) {
- continue;
- }
- value = (*it)->GetVal();
- return true;
- }
- return false;
-}
-
-
// -- FeatureItemBase
CFeatureItemBase::CFeatureItemBase
CSeqFeatData_Base::TPsec_str sec_str_type = data.GetPsec_str();
- string sec_str_as_str = CSeqFeatData_Base::GetTypeInfo_enum_EPsec_str()->FindName( sec_str_type, true );
+ string sec_str_as_str = CSeqFeatData_Base::ENUM_METHOD_NAME(EPsec_str)()->FindName(sec_str_type, true);
x_AddQual( eFQ_sec_str_type, new CFlatStringQVal( sec_str_as_str ) );
}
}
}
-
void CSourceFeatureItem::x_FormatQuals(CFlatFeature& ff) const
{
ff.SetQuals().reserve(m_Quals.Size());
DO_QUAL(transposon_name);
DO_QUAL(insertion_seq_name);
- DO_QUAL(country);
+ if ( GetContext()->Config().GeoLocNameCountry() || CSubSource::NCBI_UseGeoLocNameForCountry() ) {
+ x_FormatQual(eSQ_country, "geo_loc_name", qvec);
+ } else {
+ DO_QUAL(country);
+ }
DO_QUAL(focus);
-/* $Id: flat_file_config.cpp 672289 2023-09-04 17:05:57Z sadyrovr $
+/* $Id: flat_file_config.cpp 677118 2024-01-04 20:46:50Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
DENT "ShowDeflineModifiers (131072) - show definition line modifiers\n"
DENT "DoNotUseAutoDef (262144) - suppress automatic defline generator\n"
DENT "OldTpaDisplay (542288) - old TPA display with PRIMARY block\n"
- DENT "DisableDefaultIndex (1048576) - disable SeqEntry indexer",
+ DENT "DisableDefaultIndex (1048576) - disable SeqEntry indexer\n"
+ DENT "GeoLocNameCountry (2097152) - use geo_loc_name instead of country",
CArgDescriptions::eString, "");
#undef DENT
DOFLG(ShowDeflineModifiers),
DOFLG(DoNotUseAutoDef),
DOFLG(DisableDefaultIndex),
+ DOFLG(GeoLocNameCountry),
#undef DOFLG
};
DOFLG(ShowDeflineModifiers),
DOFLG(DoNotUseAutoDef),
DOFLG(DisableDefaultIndex),
+ DOFLG(GeoLocNameCountry),
#undef DOFLG
};
static const size_t kArraySize = ArraySize(kDescrTable);
-/* $Id: gather_items.cpp 672583 2023-09-11 17:39:40Z ivanov $
+/* $Id: gather_items.cpp 681899 2024-04-17 12:39:26Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
( !cfg.IsFormatFTable() || cfg.ShowFtablePeptides() ) ) {
x_DoMultipleSections(seq);
} else {
-
// display as a single bioseq (single section)
- m_Current.Reset(new CBioseqContext(prev_seq, seq, next_seq, *m_Context, 0,
+ m_Current.Reset(new CBioseqContext(prev_seq, seq, next_seq, *m_Context, nullptr,
(topLevelSeqEntryContext ? &*topLevelSeqEntryContext : nullptr)));
- if ( m_Context->UsingSeqEntryIndex() && ! cfg.DisableReferenceCache() ) {
+ if (m_Context->UsingSeqEntryIndex() && ! cfg.DisableReferenceCache()) {
CRef<CSeqEntryIndex> idx = m_Context->GetSeqEntryIndex();
if (idx) {
if (! idx->DistributedReferences()) {
*/
x_HistoryComments(ctx);
+// LCOV_EXCL_START
x_RefSeqGenomeComments(ctx);
+// LCOV_EXCL_STOP
x_WGSComment(ctx);
x_TSAComment(ctx);
x_TLSComment(ctx);
}
}
+// LCOV_EXCL_START
void CFlatGatherer::x_RefSeqGenomeComments(CBioseqContext& ctx) const
{
for (CSeqdesc_CI it(ctx.GetHandle(), CSeqdesc::e_User); it; ++it) {
}
}
}
+// LCOV_EXCL_STOP
void CFlatGatherer::x_WGSComment(CBioseqContext& ctx) const
}
-void CFlatGatherer::x_CollectSourceFeatures
-(const CBioseq_Handle& bh,
- const TRange& range,
- CBioseqContext& ctx,
- TSourceFeatSet& srcs) const
-{
- SAnnotSelector as;
- as.SetFeatType(CSeqFeatData::e_Biosrc)
- .SetOverlapIntervals()
- .SetResolveDepth(1) // in case segmented
- .SetNoMapping(false)
- .SetLimitTSE(ctx.GetHandle().GetTopLevelEntry());
-
- for ( CFeat_CI fi(bh, range, as); fi; ++fi ) {
- TSeqPos start = fi->GetLocation().GetTotalRange().GetFrom();
- TSeqPos stop = fi->GetLocation().GetTotalRange().GetTo();
- if ( start >= range.GetFrom() && stop <= range.GetTo() ) {
- CRef<CSourceFeatureItem> sf(new CSourceFeatureItem(*fi, ctx, m_Feat_Tree));
- srcs.push_back(sf);
- }
- }
-}
-
/* moved to sequence:: (RW-1446)
static CConstRef<CSeq_feat> x_GetSourceFeatFromCDS (
const CBioseq_Handle& bsh
s_SetGapIdxData (gap_data, gaps);
}
+ CScope::TBioseqHandles cdd_handles;
+ CScope::TCDD_Entries cdd_entries;
+ bool load_cdd = false;
+ if (!ctx.Config().HideCDDFeatures()) {
+ switch (ctx.Config().GetPolicy()) {
+ case CFlatFileConfig::ePolicy_External:
+ load_cdd = true;
+ break;
+ case CFlatFileConfig::ePolicy_Adaptive:
+ load_cdd = ctx.Config().ShowCDDFeatures();
+ break;
+ case CFlatFileConfig::ePolicy_Web:
+ load_cdd = hdl.GetBioseqLength() <= 1000000 && ctx.Config().ShowCDDFeatures();
+ break;
+ default:
+ load_cdd = false;
+ break;
+ }
+ }
+ if (load_cdd) {
+ SAnnotSelector sel;
+ sel.SetFeatType(CSeqFeatData::e_Cdregion);
+ CScope::TIds cdd_ids;
+ for (CFeat_CI cds_it(hdl, sel); cds_it; ++cds_it) {
+ cdd_ids.push_back(cds_it->GetProductId());
+ }
+ cdd_handles = hdl.GetScope().GetBioseqHandles(cdd_ids);
+ cdd_entries = hdl.GetScope().GetCDDAnnots(cdd_handles);
+ }
+
bsx->IterateFeatures([this, &ctx, &prev_feat, &loc_len, &item, &out, &slice_mapper,
gaps, &gap_data, showGapsOfSizeZero, bsx](CFeatureIndex& sfx) {
try {
}
+void CFlatGatherer::x_CollectSourceFeatures
+(const CBioseq_Handle& bh,
+ const TRange& range,
+ CBioseqContext& ctx,
+ TSourceFeatSet& srcs) const
+{
+ SAnnotSelector as;
+ as.SetFeatType(CSeqFeatData::e_Biosrc)
+ .SetOverlapIntervals()
+ .SetResolveDepth(1) // in case segmented
+ .SetNoMapping(false)
+ .SetLimitTSE(ctx.GetHandle().GetTopLevelEntry());
+
+ bool isWhole = ctx.GetLocation().IsWhole();
+
+ CSeq_loc loc;
+ if (ctx.GetMasterLocation()) {
+ loc.Assign(*ctx.GetMasterLocation());
+ } else {
+ loc.Assign(*ctx.GetHandle().GetRangeSeq_loc(0, 0));
+ }
+ CScope& scope = ctx.GetScope();
+ CRef<CSeq_loc_Mapper> slice_mapper = s_MakeSliceMapper(loc, ctx);
+
+ for ( CFeat_CI fi(bh, range, as); fi; ++fi ) {
+ TSeqPos start = fi->GetLocation().GetTotalRange().GetFrom();
+ TSeqPos stop = fi->GetLocation().GetTotalRange().GetTo();
+ TSeqPos from = range.GetFrom();
+ TSeqPos to = range.GetTo();
+ if ( to >= start && from <= stop ) {
+ if (isWhole) {
+ CRef<CSourceFeatureItem> sf(new CSourceFeatureItem(*fi, ctx, m_Feat_Tree));
+ srcs.push_back(sf);
+ continue;
+ }
+ CConstRef<CSeq_loc> feat_loc(&fi->GetLocation());
+ // Map the feat_loc if we're using a slice (the "-from" and "-to" command-line options)
+ CRange<TSeqPos> range = loc.GetTotalRange();
+ const CSeq_feat& ft = fi->GetMappedFeature();
+ CMappedFeat mapped_feat = s_GetTrimmedMappedFeat(ft, range, scope);
+ feat_loc.Reset( slice_mapper->Map( mapped_feat.GetLocation() ) );
+ feat_loc = s_NormalizeNullsBetween( feat_loc );
+ CRef<CSourceFeatureItem> sf(new CSourceFeatureItem(*fi, ctx, m_Feat_Tree, feat_loc.GetPointer()));
+ srcs.push_back(sf);
+ }
+ }
+}
+
void CFlatGatherer::x_GatherFeaturesOnRangeIdx
(const CSeq_loc& loc,
SAnnotSelector& sel,
-/* $Id: gbseq_formatter.cpp 670941 2023-08-04 12:24:26Z ivanov $
+/* $Id: gbseq_formatter.cpp 679820 2024-03-04 18:32:45Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
// it's text name gives us something to work with
const CEnumeratedTypeValues * pBiomolEnumInfo =
- CMolInfo::GetTypeInfo_enum_EBiomol();
+ CMolInfo::ENUM_METHOD_NAME(EBiomol)();
if( pBiomolEnumInfo ) {
CEnumeratedTypeValues::TValueToName::const_iterator find_iter =
pBiomolEnumInfo->ValueToName().find(eBiomol);
// For the remaining cases, if the biomol string contains "RNA",
// return "RNA", otherwise return "DNA".
string biomol_str =
- CMolInfo::GetTypeInfo_enum_EBiomol()->FindName(biomol,true);
+ CMolInfo::ENUM_METHOD_NAME(EBiomol)()->FindName(biomol, true);
if (biomol_str.find("RNA") != NPOS)
return "RNA";
else
-/* $Id: genbank_formatter.cpp 673822 2023-10-11 13:08:55Z ivanov $
+/* $Id: genbank_formatter.cpp 683835 2024-06-06 12:08:29Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
else {
l.push_back("//");
}
- text_os.AddParagraph(l, nullptr);
+ text_os.AddParagraph(l);
if( bHtml && cfg.IsModeEntrez() ) {
text_os.AddLine(
s_get_anchor_html("slash", end_item.GetContext()),
- 0, IFlatTextOStream::eAddNewline_No );
+ nullptr, IFlatTextOStream::eAddNewline_No);
}
text_os.Flush();
CRef<IFlatTextOStream> p_text_os;
IFlatTextOStream& text_os = s_WrapOstreamIfCallbackExists(p_text_os, html_anchor, orig_text_os);
- text_os.AddLine( s_get_anchor_html(html_anchor.GetLabelCore(), html_anchor.GetContext()),
- 0, IFlatTextOStream::eAddNewline_No );
+ text_os.AddLine(s_get_anchor_html(html_anchor.GetLabelCore(), html_anchor.GetContext()),
+ nullptr, IFlatTextOStream::eAddNewline_No);
}
///////////////////////////////////////////////////////////////////////////
pre_feature_html << ");</script>";
string temp = CNcbiOstrstreamToString(pre_feature_html);
- text_os.AddLine(temp, 0, IFlatTextOStream::eAddNewline_No);
+ text_os.AddLine(temp, nullptr, IFlatTextOStream::eAddNewline_No);
}
///////////////////////////////////////////////////////////////////////////
Wrap(l, "FEATURES", "Location/Qualifiers", eFeatHead);
- text_os.AddParagraph(l, nullptr);
+ text_os.AddParagraph(l);
text_os.Flush();
}
x_SmartWrapQuals(f, *feat, *text_os);
- if( bHtml && f.GetContext()->Config().IsModeEntrez() && f.GetContext()->Config().ShowSeqSpans() ) {
+ if (bHtml && f.GetContext()->Config().IsModeEntrez() && f.GetContext()->Config().ShowSeqSpans()) {
// close the <span...>, without an endline
- text_os->AddLine("</span>", 0, IFlatTextOStream::eAddNewline_No );
+ text_os->AddLine("</span>", nullptr, IFlatTextOStream::eAddNewline_No);
}
text_os->Flush();
// normal case: print entire sequence, including all the N's in any gap.
try {
s_FormatRegularSequencePiece( seq, text_os, iter, total, base_count );
- } catch (CSeqVectorException) {
+ } catch (CSeqVectorException&) {
}
} else {
// special case: instead of showing the N's in a gap right away, we have the
TSeqPos fake_total = distance_until_next_significant_gap;
try {
s_FormatRegularSequencePiece( seq, text_os, iter, fake_total, base_count);
- } catch (CSeqVectorException) {
+ } catch (CSeqVectorException&) {
}
const TSeqPos amount_to_subtract_from_total =
( distance_until_next_significant_gap - fake_total );
-/* $Id: genbank_gather.cpp 642614 2021-12-23 15:35:42Z stakhovv $
+/* $Id: genbank_gather.cpp 678686 2024-02-08 19:25:16Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
{
CBioseqContext& ctx = *m_Current;
- const string* first = 0;
- const string* last = 0;
+ const string* first = nullptr;
+ const string* last = nullptr;
bool bFirstWgsItem = true;
for (CSeqdesc_CI desc(ctx.GetHandle(), CSeqdesc::e_User); desc; ++desc) {
}
}
- if ( (first != 0) && (last != 0) ) {
+ if (first && last) {
if( bFirstWgsItem ) {
CConstRef<IFlatItem> anchor_item( new CHtmlAnchorItem(ctx, "wgs" ) );
ItemOS() << anchor_item;
{
CBioseqContext& ctx = *m_Current;
- const string* first = 0;
- const string* last = 0;
+ const string* first = nullptr;
+ const string* last = nullptr;
for (CSeqdesc_CI desc(ctx.GetHandle(), CSeqdesc::e_User); desc; ++desc) {
const CUser_object& uo = desc->GetUser();
}
}
- if ( (first != 0) && (last != 0) ) {
+ if (first && last) {
CConstRef<IFlatItem> item( new CTSAItem(tsa_type, *first, *last, uo, ctx) );
ItemOS() << item;
}
{
CBioseqContext& ctx = *m_Current;
- const string* first = 0;
- const string* last = 0;
+ const string* first = nullptr;
+ const string* last = nullptr;
for (CSeqdesc_CI desc(ctx.GetHandle(), CSeqdesc::e_User); desc; ++desc) {
const CUser_object& uo = desc->GetUser();
}
}
- if ( (first != 0) && (last != 0) ) {
+ if (first && last) {
CConstRef<IFlatItem> item( new CTSAItem(CTSAItem::eTLS_Projects, *first, *last, uo, ctx) );
ItemOS() << item;
}
-/* $Id: gene_finder.cpp 642614 2021-12-23 15:35:42Z stakhovv $
+/* $Id: gene_finder.cpp 678686 2024-02-08 19:25:16Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
{
ITERATE( CSeq_loc, loc_iter, location ) {
const CSeq_id *seq_id = loc_iter.GetRangeAsSeq_loc()->GetId();
- if( seq_id != NULL ) {
+ if (seq_id) {
m_BioseqHandle = m_Scope->GetBioseqHandle( *seq_id );
if( m_BioseqHandle ) {
break;
SAnnotSelector::EOverlapType annot_overlap_type )
{
// check if given candidate feat matches the filter
- if( m_Filtering_gene_xref != NULL &&
+ if (m_Filtering_gene_xref &&
feat.GetOriginalFeature().IsSetData() &&
- feat.GetOriginalFeature().GetData().IsGene() )
+ feat.GetOriginalFeature().GetData().IsGene())
{
if( ! GeneMatchesXref( &feat.GetOriginalFeature().GetData().GetGene(), &*m_Filtering_gene_xref ) ) {
shouldContinueToNextIteration = true;
// ----------------------------------------------------------------------------
{
out_s_feat.Reset();
- out_g_ref = NULL;
+ out_g_ref = nullptr;
// guard against suppressed gene xrefs
out_suppression_check_gene_ref = GetSuppressionCheckGeneRef(in_feat);
}
if( xref_label.empty() ) {
- xref_g_ref = NULL;
+ xref_g_ref = nullptr;
}
bool also_look_at_parent_CDS = false;
}
// always use xref_g_ref directly if it's set, but CDS's xref isn't (e.g. NP_041400)
- if( also_look_at_parent_CDS && NULL != xref_g_ref ) {
+ if (also_look_at_parent_CDS && xref_g_ref) {
out_g_ref = xref_g_ref;
out_s_feat.ReleaseOrNull();
return;
out_s_feat.Reset();
if( ! pParentDecidingGeneRef->IsSuppressed() ) {
out_g_ref = pParentDecidingGeneRef;
- xref_g_ref = NULL; // TODO: is it right to ignore mat_peptide gene xrefs?
+ xref_g_ref = nullptr; // TODO: is it right to ignore mat_peptide gene xrefs?
}
} else if( ownGeneIsOkay ) {
// do nothing; it's already set
} // end: if( also_look_at_parent_CDS )
}
- if ( in_feat && NULL == xref_g_ref ) {
+ if (in_feat && ! xref_g_ref) {
if (out_s_feat) {
out_g_ref = &( out_s_feat->GetData().GetGene() );
}
}
// find a gene match using the xref (e.g. match by locus or whatever)
- if( NULL != xref_g_ref && ! GeneMatchesXref( out_g_ref, xref_g_ref ) )
- {
- out_g_ref = NULL;
+ if (xref_g_ref && ! GeneMatchesXref(out_g_ref, xref_g_ref)) {
+ out_g_ref = nullptr;
out_s_feat.Reset();
CSeq_feat_Handle feat = ResolveGeneXref( xref_g_ref, ctx.GetTopLevelEntry() );
// we found no match for the gene, but we can fall back on the xref
// itself (e.g. K03223.1)
- if( NULL == out_g_ref ) {
+ if (! out_g_ref) {
out_g_ref = xref_g_ref;
}
}
};
CSeq_feat_Handle feat;
- if( xref_g_ref == NULL ) {
+ if (! xref_g_ref) {
return feat;
}
needToAddGbLoaderBack = true;
} catch(...) {
// we couldn't remove the GBLOADER temporarily, so we make a temporary substitute CScope
- scope = NULL;
+ scope = nullptr;
}
}
- if (scope == NULL) {
+ if (! scope) {
// TODO: check if this call is fast
temp_scope.Reset(new CScope(*CObjectManager::GetInstance()));
temp_scope->AddDefaults();
const CGene_ref * other_ref,
const CGene_ref * xref )
{
- if( NULL == other_ref || NULL == xref ) {
+ if (! other_ref || ! xref) {
return false;
}
-/* $Id: genome_project_item.cpp 642614 2021-12-23 15:35:42Z stakhovv $
+/* $Id: genome_project_item.cpp 678686 2024-02-08 19:25:16Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
{
const bool bHtml = ctx.Config().DoHTML();
- const CUser_object *genome_projects_user_obje = NULL;
- const CUser_object *dblink_user_obj = NULL;
+ const CUser_object* genome_projects_user_obje = nullptr;
+ const CUser_object* dblink_user_obj = nullptr;
// extract all the useful user objects
for (CSeqdesc_CI desc(ctx.GetHandle(), CSeqdesc::e_User); desc; ++desc) {
}
// process GenomeProjectsDB
- if( genome_projects_user_obje != NULL ) {
+ if (genome_projects_user_obje) {
ITERATE (CUser_object::TData, uf_it, genome_projects_user_obje->GetData()) {
const CUser_field& field = **uf_it;
if ( field.IsSetLabel() && field.GetLabel().IsStr() ) {
// ( we have these temporary vectors because we can't push straight to m_DBLinkLines
// because we have to sort them in case they're out of order in the ASN.1 )
vector<string> dblinkLines;
- if( dblink_user_obj != NULL ) {
+ if (dblink_user_obj) {
ITERATE (CUser_object::TData, uf_it, dblink_user_obj->GetData()) {
const CUser_field& field = **uf_it;
if ( field.IsSetLabel() && field.GetLabel().IsStr() && field.CanGetData() ) {
if( dbLinkLabelInfo.allow_text &&
(field_data.IsStrs() || field_data.IsStr()) )
{
- const TFieldData::TStrs * pStrs = NULL;
+ const TFieldData::TStrs* pStrs = nullptr;
// unique_ptr just used to destroy the pStrs if it's
// dynamically created.
(field_data.IsInts() || field_data.IsInt()) )
{
- const TFieldData::TInts * pInts = NULL;
+ const TFieldData::TInts* pInts = nullptr;
// destroys pInts if it's dynamically created
unique_ptr<TFieldData::TInts> pIntsDestroyer;
-/* $Id: item_formatter.cpp 665414 2023-04-04 12:08:46Z stakhovv $
+/* $Id: item_formatter.cpp 678686 2024-02-08 19:25:16Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
"This format is currently not supported");
}
- return 0;
+ return nullptr;
}
void CFlatItemFormatter::SetContext(CFlatFileContext& ctx)
typedef vector<string> TAccBin;
typedef vector <TAccBin> TAccBins;
TAccBins bins;
- TAccBin* curr_bin = NULL;
+ TAccBin* curr_bin = nullptr;
// populate the bins
CAccessionItem::TExtra_accessions::const_iterator prev = xtra.begin();
-/* $Id: keywords_item.cpp 665431 2023-04-04 17:43:43Z stakhovv $
+/* $Id: keywords_item.cpp 683835 2024-06-06 12:08:29Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
FOR_EACH_STRING_IN_LIST ( s_itr, keywords ) {
x_AddKeyword(*s_itr);
}
- } catch (CException) {
+ } catch (CException&) {
}
}
-/* $Id: qualifiers.cpp 670941 2023-08-04 12:24:26Z ivanov $
+/* $Id: qualifiers.cpp 679820 2024-03-04 18:32:45Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
CBioseqContext&, IFlatQVal::TFlags) const
{
const string& organelle
- = CBioSource::GetTypeInfo_enum_EGenome()->FindName(m_Value, true);
+ = CBioSource::ENUM_METHOD_NAME(EGenome)()->FindName(m_Value, true);
switch (m_Value) {
case CBioSource::eGenome_chloroplast:
-/* $Id: source_item.cpp 665431 2023-04-04 17:43:43Z stakhovv $
+/* $Id: source_item.cpp 680678 2024-03-25 17:17:55Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
}
*/
+/*
static const char * legal_organelles[] = {
"chloroplast",
"chromoplast",
"hydrogenosome",
"chromatophore"
};
-
-void CSourceItem::x_GatherInfoIdx(CBioseqContext& ctx)
-{
- CRef<CSeqEntryIndex> idx = ctx.GetSeqEntryIndex();
- if (! idx) return;
- const CBioseq_Handle& bsh = ctx.GetHandle();
- CRef<CBioseqIndex> bsx = idx->GetBioseqIndex (bsh);
- if (! bsx) return;
-
- m_Taxname = &bsx->GetTaxname();
- m_Common = &bsx->GetCommon();
- m_Taxid = bsx->GetTaxid();
- m_UsingAnamorph = bsx->IsUsingAnamorph();
-
- const string& lineage = bsx->GetLineage();
- if (lineage.empty()) {
- m_Lineage = scm_Unclassified;
- } else {
- m_Lineage = bsx->GetLineage();
- }
-
- const string* orgnlle = &bsx->GetOrganelle();
- for (int i = 0; i < sizeof (legal_organelles) / sizeof (const char*); i++) {
- CTempString str = legal_organelles [i];
- if (NStr::CompareNocase (*orgnlle, str) == 0) {
- m_Organelle = orgnlle;
- return;
- }
- }
-}
+*/
void CSourceItem::x_GatherInfo(CBioseqContext& ctx)
{
CConstRef<CBioSource> src_ref;
CConstRef<CSeq_feat> src_feat;
- /*
- if (ctx.UsingSeqEntryIndex()) {
- x_GatherInfoIdx(ctx);
- return;
- }
- */
-
if (ctx.IsProt()) {
const CBioseq_Handle& bsh = ctx.GetHandle();
src_feat = sequence::GetSourceFeatForProduct(bsh);
CConstRef<CBioSource> src_ref;
CConstRef<CSeq_feat> src_feat;
- /*
- if (ctx.UsingSeqEntryIndex()) {
- x_GatherInfoIdx(ctx);
- return;
- }
- */
-
if (ctx.IsProt()) {
const CBioseq_Handle& bsh = ctx.GetHandle();
src_feat = sequence::GetSourceFeatForProduct(bsh);
-/* $Id: psg_client.cpp 666909 2023-05-03 21:33:24Z sadyrovr $
+/* $Id: psg_client.cpp 677218 2024-01-08 18:27:46Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
if (progress == "canceled") return CPSG_Processor::eCanceled;
if (progress == "timeout") return CPSG_Processor::eTimeout;
if (progress == "error") return CPSG_Processor::eError;
+ if (progress == "unauthorized") return CPSG_Processor::eUnauthorized;
// Should not happen, new server?
return CPSG_Processor::eUnknown;
CPSG_Queue::SImpl::SImpl(const string& service) :
queue(make_shared<TPSG_Queue>()),
- m_Service(service)
+ m_Service(service.empty() ? TPSG_Service::GetDefault() : service)
{
}
}
-template <typename TIterator, class TGet>
-void s_DelimitedOutput(TIterator from, TIterator to, ostream& os, const char* prefix, char delimiter, TGet get)
+template <typename TIterator, class TDelimiter, class TGet>
+void s_DelimitedOutput(TIterator from, TIterator to, ostream& os, const char* prefix, TDelimiter delimiter, TGet get)
{
if (from != to) {
os << prefix << get(*from++);
os << "/ID/get_na?" << *bio_id++;
- s_DelimitedOutput(bio_id, m_BioIds.end(), os, "&seq_ids=", ' ', s_GetFastaString);
- s_DelimitedOutput(m_AnnotNames, os, "&names=", ',', [](const auto& name) { return name; });
+ s_DelimitedOutput(bio_id, m_BioIds.end(), os, "&seq_ids=", "%20", s_GetFastaString);
+ s_DelimitedOutput(m_AnnotNames, os, "&names=", ',', [](const auto& name) { return NStr::URLEncode(name, NStr::eUrlEnc_URIQueryValue); });
if (const auto tse = s_GetTSE(m_IncludeData)) os << "&tse=" << tse;
const auto request_id = user_context ? *user_context : ioc.GetNewRequestId();
auto reply = make_shared<SPSG_Reply>(move(request_id), params, queue, stats);
auto abs_path_ref = x_GetAbsPathRef(user_request);
+ const auto request_flags = r->m_Flags.IsNull() ? m_RequestFlags : r->m_Flags.GetValue();
const auto& request_context = user_request->m_RequestContext;
_ASSERT(request_context);
- auto request = make_shared<SPSG_Request>(move(abs_path_ref), reply, request_context->Clone(), params);
+ auto request = make_shared<SPSG_Request>(move(abs_path_ref), request_flags, reply, request_context->Clone(), params);
if (ioc.AddRequest(request, queue->Stopped(), deadline)) {
if (stats) stats->IncCounter(SPSG_Stats::eRequest, user_request->GetType());
}
+void CPSG_Queue::SetRequestFlags(CPSG_Request::TFlags request_flags)
+{
+ _ASSERT(m_Impl);
+ m_Impl->SetRequestFlags(request_flags);
+}
+
+
void CPSG_Queue::SetUserArgs(SPSG_UserArgs user_args)
{
m_Impl->SetUserArgs(move(user_args));
#ifndef OBJTOOLS__PUBSEQ_GATEWAY__PSG_CLIENT_IMPL_HPP
#define OBJTOOLS__PUBSEQ_GATEWAY__PSG_CLIENT_IMPL_HPP
-/* $Id: psg_client_impl.hpp 643926 2022-01-19 20:28:40Z sadyrovr $
+/* $Id: psg_client_impl.hpp 675129 2023-11-15 13:50:52Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
bool WaitForEvents(CDeadline deadline);
bool RejectsRequests() const { return m_Service.ioc.RejectsRequests(); }
+ void SetRequestFlags(CPSG_Request::TFlags request_flags) { m_RequestFlags = request_flags; }
void SetUserArgs(SPSG_UserArgs user_args) { m_UserArgsBuilder.GetLock()->SetQueueArgs(move(user_args)); }
static TApiLock GetApiLock() { return CService::GetMap(); }
string x_GetAbsPathRef(shared_ptr<const CPSG_Request> user_request);
CService m_Service;
+ CPSG_Request::TFlags m_RequestFlags = CPSG_Request::eDefaultFlags;
SThreadSafe<SPSG_UserArgsBuilder> m_UserArgsBuilder;
};
-/* $Id: psg_client_transport.cpp 672389 2023-09-06 18:54:00Z ivanov $
+/* $Id: psg_client_transport.cpp 684281 2024-06-18 13:28:36Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
#define __STDC_FORMAT_MACROS
#include <corelib/request_status.hpp>
+#include <corelib/ncbi_cookies.hpp>
#include "psg_client_transport.hpp"
NCBI_PARAM_DEF(double, PSG, no_servers_retry_delay, 1.0);
NCBI_PARAM_DEF(bool, PSG, stats, false);
NCBI_PARAM_DEF(double, PSG, stats_period, 0.0);
+NCBI_PARAM_DEF_EX(string, PSG, service, "PSG2", eParam_Default, NCBI_PSG_SERVICE);
NCBI_PARAM_DEF_EX(string, PSG, auth_token_name, "WebCubbyUser", eParam_Default, NCBI_PSG_AUTH_TOKEN_NAME);
NCBI_PARAM_DEF_EX(string, PSG, auth_token, "", eParam_Default, NCBI_PSG_AUTH_TOKEN);
return static_cast<unsigned>(timeout / io_timer_period);
}
+string SPSG_Params::GetAuthToken()
+{
+ string rv = TPSG_AuthToken(TPSG_AuthToken::eGetDefault);
+
+ if (rv.empty()) {
+ CHttpCookies cookies;
+ cookies.Add(CHttpCookies::eHeader_Cookie, CNcbiEnvironment().Get("HTTP_COOKIE"), nullptr);
+
+ for (const auto& cookie : cookies) {
+ if (cookie.GetName() == auth_token_name.Get()) {
+ return NStr::URLDecode(cookie.GetValue());
+ }
+ }
+ }
+
+ return rv;
+}
+
void SDebugPrintout::Print(SSocketAddress address, const string& path, const string& sid, const string& phid, const string& ip, SUv_Tcp::TPort port)
{
ostringstream os;
switch (status) {
case CRequestStatus::e200_Ok: return EPSG_Status::eSuccess;
case CRequestStatus::e202_Accepted: return EPSG_Status::eSuccess;
+ case CRequestStatus::e401_Unauthorized: return EPSG_Status::eForbidden;
case CRequestStatus::e403_Forbidden: return EPSG_Status::eForbidden;
+ case CRequestStatus::e407_ProxyAuthRequired: return EPSG_Status::eForbidden;
+ case CRequestStatus::e451_Unavailable_For_Legal_Reasons: return EPSG_Status::eForbidden;
case CRequestStatus::e404_NotFound: return EPSG_Status::eNotFound;
default: return EPSG_Status::eError;
}
return guard;
}
-SPSG_Request::SPSG_Request(string p, shared_ptr<SPSG_Reply> r, CRef<CRequestContext> c, const SPSG_Params& params) :
+SPSG_Request::SPSG_Request(string p, CPSG_Request::TFlags f, shared_ptr<SPSG_Reply> r, CRef<CRequestContext> c, const SPSG_Params& params) :
full_path(move(p)),
+ flags(f),
reply(r),
context(c),
m_State(&SPSG_Request::StatePrefix),
{ "cookie" },
{ "x-forwarded-for" }
}},
- m_Queue(queue)
+ m_Queue(queue),
+ m_Requests(*this)
{
}
{
PSG_IO_SESSION_TRACE(this << '/' << stream_id << " closed: " << error_code);
- if (!server.available_streams++) {
- PSG_IO_TRACE("Server '" << server.address << "' became available");
- m_Queue.SignalAll();
- }
-
if (auto it = m_Requests.find(stream_id); it != m_Requests.end()) {
if (auto [processor_id, req] = it->second.Get(); req) {
auto context_guard = req->context.Set();
}
}
- EraseAndMoveToNext(it);
+ m_Requests.erase(it);
}
return 0;
const auto& path = req->full_path;
const auto& session_id = context.GetSessionID();
const auto& sub_hit_id = context.GetNextSubHitID();
- const auto& cookie = m_Params.GetCookie([&]() { return context.GetProperty("auth_token"); });
+ const auto& cookie = m_Params.GetCookie(req->flags, [&]() { return context.GetProperty("auth_token"); });
const auto& client_ip = context.GetClientIP();
auto headers_size = m_Headers.size();
return false;
}
- if (!--server.available_streams) {
- PSG_IO_TRACE("Server '" << server.address << "' reached request limit");
- }
-
req->submitted_by.Set(GetInternalId());
req->reply->debug_printout << server.address << path << session_id << sub_hit_id << client_ip << m_Tcp.GetLocalPort() << endl;
PSG_IO_SESSION_TRACE(this << '/' << stream_id << " submitted");
return Send();
}
-void SPSG_IoSession::EraseAndMoveToNext(TRequests::iterator& it)
-{
- if (IsFull()) {
- // Continue processing of requests in the IO thread queue on next UV loop iteration
- m_Queue.Signal();
- }
-
- it = m_Requests.erase(it);
-}
-
template <class TOnRetry, class TOnFail>
bool SPSG_TimedRequest::CheckExpiration(const SPSG_Params& params, const SUvNgHttp2_Error& error, TOnRetry on_retry, TOnFail on_fail)
{
for (auto it = m_Requests.begin(); it != m_Requests.end(); ) {
if (it->second.CheckExpiration(m_Params, error, on_retry, on_fail)) {
- EraseAndMoveToNext(it);
+ it = m_Requests.erase(it);
} else {
++it;
}
const auto io_timer_period = SecondsToMs(params.io_timer_period);
for (unsigned i = 0; i < TPSG_NumIo::GetDefault(); i++) {
- // This timing cannot be changed without changes in SPSG_IoSession::CheckRequestExpiration
- m_Io.emplace_back(new SPSG_Thread<SPSG_IoImpl>(m_StartBarrier, m_StopBarrier, io_timer_period, io_timer_period, params, m_Servers, m_Queues.emplace_back(m_Queues)));
+ try {
+ // This timing cannot be changed without changes in SPSG_IoSession::CheckRequestExpiration
+ m_Io.emplace_back(new SPSG_Thread<SPSG_IoImpl>(m_StartBarrier, m_StopBarrier, io_timer_period, io_timer_period, params, m_Servers, m_Queues.emplace_back(m_Queues)));
+ } catch (const std::system_error& e) {
+ ERR_POST(Fatal << "Failed to create I/O threads: " << e.what());
+ }
}
m_StartBarrier.Wait();
#ifndef OBJTOOLS__PUBSEQ_GATEWAY__PSG_CLIENT_TRANSPORT__HPP
#define OBJTOOLS__PUBSEQ_GATEWAY__PSG_CLIENT_TRANSPORT__HPP
-/* $Id: psg_client_transport.hpp 673212 2023-09-25 19:39:06Z ivanov $
+/* $Id: psg_client_transport.hpp 676359 2023-12-14 18:25:59Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
TPSG_RefusedStreamRetries refused_stream_retries;
TPSG_UserRequestIds user_request_ids;
TPSG_AuthTokenName auth_token_name;
- TPSG_AuthToken auth_token;
+ string auth_token;
TPSG_PsgClientMode client_mode;
SPSG_Params() :
refused_stream_retries(TPSG_RefusedStreamRetries::eGetDefault),
user_request_ids(TPSG_UserRequestIds::eGetDefault),
auth_token_name(TPSG_AuthTokenName::eGetDefault),
- auth_token(TPSG_AuthToken::eGetDefault),
+ auth_token(GetAuthToken()),
client_mode(TPSG_PsgClientMode::eGetDefault)
{}
template <class TGet>
- string GetCookie(TGet get)
+ string GetCookie(const CPSG_Request::TFlags& request_flags, TGet get)
{
- auto rv = auth_token.Get().empty() ? get() : auth_token.Get();
- return rv.empty() ? rv : auth_token_name.Get() + '=' + NStr::Quote(rv);
+ if (auto include_hup = request_flags & CPSG_Request::fIncludeHUP; !include_hup) return {};
+ auto rv = auth_token.empty() ? get() : auth_token;
+ return rv.empty() ? rv : auth_token_name.Get() + '=' + NStr::URLEncode(rv);
}
private:
static unsigned s_GetRequestTimeout(double io_timer_period);
static unsigned s_GetCompetitiveAfter(double io_timer_period, double timeout);
+
+ string GetAuthToken();
};
struct SDebugPrintout
};
const string full_path;
+ CPSG_Request::TFlags flags;
shared_ptr<SPSG_Reply> reply;
SContext context;
SPSG_Submitter submitted_by;
SPSG_Processor processed_by;
- SPSG_Request(string p, shared_ptr<SPSG_Reply> r, CRef<CRequestContext> c, const SPSG_Params& params);
+ SPSG_Request(string p, CPSG_Request::TFlags f, shared_ptr<SPSG_Reply> r, CRef<CRequestContext> c, const SPSG_Params& params);
enum EStateResult { eContinue, eStop, eRetry };
EStateResult OnReplyData(SPSG_Processor::TId processor_id, const char* data, size_t len)
{}
};
+template <class TSession>
+struct SPSG_Requests : private unordered_map<int32_t, SPSG_TimedRequest>
+{
+ SPSG_Requests(TSession& session) : m_Session(session) {}
+
+ using unordered_map::begin;
+ using unordered_map::end;
+ using unordered_map::size;
+ using unordered_map::find;
+
+ template <class... TArgs>
+ auto emplace(TArgs&&... args)
+ {
+ m_Session.RemoveStream();
+ return unordered_map::emplace(std::forward<TArgs>(args)...);
+ }
+
+ auto erase(iterator it)
+ {
+ m_Session.AddStreams(1);
+ return unordered_map::erase(it);
+ }
+
+ auto clear()
+ {
+ m_Session.AddStreams(static_cast<int>(size()));
+ return unordered_map::clear();
+ }
+
+private:
+ TSession& m_Session;
+};
+
struct SPSG_IoSession : SUvNgHttp2_SessionBase
{
SPSG_Server& server;
void CheckRequestExpiration();
bool IsFull() const { return m_Session.GetMaxStreams() <= m_Requests.size(); }
+ void RemoveStream()
+ {
+ if (!--server.available_streams) {
+ PSG_IO_TRACE("Server '" << server.address << "' reached request limit");
+ }
+ }
+
+ void AddStreams(int v)
+ {
+ if (auto before = server.available_streams.fetch_add(v); (before <= 0) && (before + v > 0) ) {
+ PSG_IO_TRACE("Server '" << server.address << "' became available");
+ m_Queue.SignalAll();
+
+ } else if (IsFull()) {
+ m_Queue.Signal();
+ }
+ }
+
protected:
int OnData(nghttp2_session* session, uint8_t flags, int32_t stream_id, const uint8_t* data, size_t len);
int OnStreamClose(nghttp2_session* session, int32_t stream_id, uint32_t error_code);
private:
enum EHeaders { eMethod, eScheme, eAuthority, ePath, eUserAgent, eSessionID, eSubHitID, eCookie, eClientIP, eSize };
- using TRequests = unordered_map<int32_t, SPSG_TimedRequest>;
-
SPSG_Submitter::TId GetInternalId() const { return this; }
bool Fail(SPSG_Processor::TId processor_id, shared_ptr<SPSG_Request> req, const SUvNgHttp2_Error& error, bool refused_stream = false);
return Fail(processor_id, req, error, refused_stream);
}
- void EraseAndMoveToNext(TRequests::iterator& it);
-
void OnReset(SUvNgHttp2_Error error) override;
SPSG_Params m_Params;
array<SNgHttp2_Header<NGHTTP2_NV_FLAG_NO_COPY_NAME>, eSize> m_Headers;
SPSG_AsyncQueue& m_Queue;
- TRequests m_Requests;
+ SPSG_Requests<SPSG_IoSession> m_Requests;
};
template <class TImpl>
-/* $Id: test_psg_client_impl.cpp 666067 2023-04-19 19:01:05Z sadyrovr $
+/* $Id: test_psg_client_impl.cpp 675129 2023-11-15 13:50:52Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
void SFixture::Receive(const SPSG_Params& params, shared_ptr<SPSG_Reply>& reply, bool sleep)
{
- auto request = make_shared<SPSG_Request>(string(), reply, CDiagContext::GetRequestContext().Clone(), params);
+ auto request = make_shared<SPSG_Request>(string(), CPSG_Request::eDefaultFlags, reply, CDiagContext::GetRequestContext().Clone(), params);
vector<unique_ptr<SReceiver>> receivers;
auto receive_impl = [&]() {
-/* $Id: agp_util.cpp 671757 2023-08-23 17:41:37Z ivanov $
+/* $Id: agp_util.cpp 678856 2024-02-12 19:15:03Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
"centromere",
"short_arm",
"heterochromatin",
- "telomere"
+ "telomere",
+ "unknown"
};
CSafeStatic<CAgpRow::TMapStrEGap> CAgpRow::gap_type_codes(
gap_type != eGapRepeat &&
gap_type != eGapFragment &&
gap_type != eGapScaffold &&
- gap_type != eGapContamination
+ gap_type != eGapContamination &&
+ gap_type != eGapUnknown
)
{
if(log_errors) m_AgpErr->Msg(CAgpErr::E_InvalidLinkage, " \"yes\" for gap_type "+GetGapType() );
-/* $Id: fasta.cpp 673190 2023-09-25 14:08:51Z ivanov $
+/* $Id: fasta.cpp 680777 2024-03-27 13:52:05Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
line = strmodified;
}
ParseDataLine(line, pMessageListener);
- } catch(CBadResiduesException & e) {
+ } catch(const CBadResiduesException & e) {
// we have to catch this exception so we can build up
// information on all lines, not just the first line
// with a bad residue
}
if (entry2.NotEmpty())
entry->SetSet().SetSeq_set().push_back(entry2);
- } catch (CObjReaderParseException& e) {
+ } catch (const CObjReaderParseException& e) {
if (e.GetErrCode() == CObjReaderParseException::eEOF) {
break;
} else {
if( ! bad_pos_vec.empty() ) {
if (TestFlag(fValidate)) {
- NCBI_THROW2(CBadResiduesException, eBadResidues,
+ NCBI_THROW2(CBadResiduesException, eBadResidues,
"CFastaReader: There are invalid " + x_NucOrProt() + "residue(s) in input sequence",
CBadResiduesException::SBadResiduePositions( m_BestID, bad_pos_vec, bad_pos_line_num ) );
} else {
// string to value maps
const CEnumeratedTypeValues::TNameToValue & linkage_evidence_to_value_map =
- CLinkage_evidence::GetTypeInfo_enum_EType()->NameToValue();
+ CLinkage_evidence::ENUM_METHOD_NAME(EType)()->NameToValue();
// remember if there is a gap-type conflict
bool bConflictingGapTypes = false;
_ASSERT(lengths.size() == size_t(m_Row) + 1);
// redundant if there was a trailing gap, but that should be okay
m_Starts[lengths[m_Row]][m_Row] = CFastaAlignmentBuilder::kNoPos;
- } catch (CObjReaderParseException&) {
+ } catch (const CObjReaderParseException&) {
if (GetLineReader().AtEOF()) {
break;
} else {
if (se->IsSeq()) {
scanner->EntryFound(se, pos);
}
- } catch (CObjReaderParseException&) {
+ } catch (const CObjReaderParseException&) {
if ( !lr->AtEOF() ) {
throw;
}
}
-const CFastaReader::TPostponedModMap&
+const CFastaReader::TPostponedModMap&
CFastaReader::GetPostponedModMap() const
{
return m_PostponedModMap;
void CFastaReader::x_AddMods(
TSeqPos line_number,
- CBioseq& bioseq,
+ CBioseq& bioseq,
string& processed_title,
ILineErrorListener* pMessageListener)
{
const auto* pFirstID = bioseq.GetFirstId();
_ASSERT(pFirstID);
const auto idString = pFirstID->AsFastaString();
-
+
x_CheckForPostponedMods(idString, line_number, mods);
if (mods.empty()) {
return;
}
-
+
CDefaultModErrorReporter
errorReporter(idString, line_number, pMessageListener);
}
-void CFastaReader::x_CheckForPostponedMods(const string& idString,
+void CFastaReader::x_CheckForPostponedMods(const string& idString,
TSeqPos line_number,
- CModHandler::TModList& mods)
+ CModHandler::TModList& mods)
{
if (mods.empty() || m_PostponedMods.empty()) {
return;
if (m_PostponedMods.find(CModHandler::GetCanonicalName(it->GetName()))
!= m_PostponedMods.end()) {
- if (auto mit = m_PostponedModMap.find(idString);
+ if (auto mit = m_PostponedModMap.find(idString);
mit != m_PostponedModMap.end()) {
- mit->second.second.push_back(*it);
- }
+ mit->second.second.push_back(*it);
+ }
else {
m_PostponedModMap[idString] = {line_number, {*it}};
}
- it = mods.erase(it);
+ it = mods.erase(it);
} else {
++it;
}
-/* $Id: gff3_reader.cpp 671730 2023-08-23 12:19:53Z ivanov $
+/* $Id: gff3_reader.cpp 681542 2024-04-10 12:47:48Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
return;
}
+ /*
for (const auto& it: mPendingExons) {
CReaderMessage warning(
eDiag_Warning,
"Bad data line: Record references non-existent Parent=" + it.first);
m_pMessageHandler->Report(warning);
}
+ */
//location fixup:
for (auto itLocation: mpLocations->LocationMap()) {
/*
- * $Id: gtf_location_merger.cpp 633918 2021-06-29 11:52:57Z ludwigf $
+ * $Id: gtf_location_merger.cpp 674645 2023-11-01 12:38:20Z ivanov $
*
* ===========================================================================
*
return ((mStart <= other.mStart) && (mStop >= other.mStop));
}
-// ----------------------------------------------------------------------------
-bool
-CGtfLocationRecord::IsContainedBy(
- const CGtfLocationRecord& other) const
-// ----------------------------------------------------------------------------
-{
- return other.Contains(*this);
-}
// ----------------------------------------------------------------------------
CRef<CSeq_loc>
AddRecordForId(GetFeatureIdFor(record), record);
}
+static bool s_IsTranscriptType(int recType)
+{
+ switch (recType) {
+ case CGtfLocationRecord::TYPE_5utr:
+ case CGtfLocationRecord::TYPE_initial:
+ case CGtfLocationRecord::TYPE_exon:
+ case CGtfLocationRecord::TYPE_terminal:
+ case CGtfLocationRecord::TYPE_3utr:
+ return true;
+ }
+ return false;
+}
+
+
// ============================================================================
void
CGtfLocationMerger::AddRecordForId(
}
CGtfLocationRecord location(record, mFlags, mIdResolver);
- auto& existingRecords = existingEntry->second;
- for (auto& record: existingRecords) {
- if (record.Contains(location)) {
- if (location.mType == CGtfLocationRecord::TYPE_start_codon) {
- record.mType = CGtfLocationRecord::TYPE_start_codon;
- record.mPartNum = location.mPartNum;
+
+ for (auto& existingRecord: existingEntry->second) {
+ if (existingRecord.Contains(location)) {
+ if (!s_IsTranscriptType(existingRecord.mType)) {
+ if (location.mType == CGtfLocationRecord::TYPE_start_codon ||
+ s_IsTranscriptType(location.mType)) {
+ existingRecord.mType = location.mType;
+ existingRecord.mPartNum = location.mPartNum;
+ }
}
return;
}
- if (record.IsContainedBy(location)) {
- if (record.mType == CGtfLocationRecord::TYPE_start_codon) {
+ if (location.Contains(existingRecord)) {
+ if (!s_IsTranscriptType(location.mType) &&
+ existingRecord.mType == CGtfLocationRecord::TYPE_start_codon) {
location.mType = CGtfLocationRecord::TYPE_start_codon;
- location.mPartNum = record.mPartNum;
+ location.mPartNum = existingRecord.mPartNum;
}
- record = location;
+ existingRecord = location;
return;
}
}
/*
- * $Id: gtf_location_merger.hpp 630386 2021-05-01 20:54:52Z stakhovv $
+ * $Id: gtf_location_merger.hpp 674645 2023-11-01 12:38:20Z ivanov $
*
* ===========================================================================
*
bool
Contains(
const CGtfLocationRecord&) const;
- bool
- IsContainedBy(
- const CGtfLocationRecord&) const;
using TYPEORDER_MAP = map<string, RecordType>;
static TYPEORDER_MAP msTypeOrder;
-/* $Id: gtf_reader.cpp 631353 2021-05-17 14:36:08Z ludwigf $
+/* $Id: gtf_reader.cpp 675533 2023-11-27 18:59:21Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
}
}
+
+static bool s_IsTranscriptType(const string& recType)
+{
+ return (recType == "exon" || recType == "5utr" || recType == "3utr");
+}
+
+static bool s_IsCDSType(const string& recType)
+{
+ return (recType == "cds" || recType == "start_codon" || recType == "stop_codon");
+}
+
+
// ----------------------------------------------------------------------------
bool CGtfReader::xUpdateAnnotFeature(
const CGff2Record& record,
const CGtfReadRecord& gff = dynamic_cast<const CGtfReadRecord&>(record);
auto recType = gff.NormalizedType();
- using TYPEHANDLER = bool (CGtfReader::*)(const CGtfReadRecord&, CSeq_annot&);
- using HANDLERMAP = map<string, TYPEHANDLER>;
-
- HANDLERMAP typeHandlers = {
- {"cds", &CGtfReader::xUpdateAnnotCds},
- {"start_codon", &CGtfReader::xUpdateAnnotCds},
- {"stop_codon", &CGtfReader::xUpdateAnnotCds},
- {"5utr", &CGtfReader::xUpdateAnnotTranscript},
- {"3utr", &CGtfReader::xUpdateAnnotTranscript},
- {"exon", &CGtfReader::xUpdateAnnotTranscript},
- {"initial", &CGtfReader::xUpdateAnnotTranscript},
- {"internal", &CGtfReader::xUpdateAnnotTranscript},
- {"terminal", &CGtfReader::xUpdateAnnotTranscript},
- {"single", &CGtfReader::xUpdateAnnotTranscript},
- };
- //
- // Handle officially recognized GTF types:
- //
- HANDLERMAP::iterator it = typeHandlers.find(recType);
- if (it != typeHandlers.end()) {
- TYPEHANDLER handler = it->second;
- return (this->*handler)(gff, annot);
+ if (s_IsCDSType(recType)) { // Only attempt to create/update the transcript if xUpdateAnnotCds() succeeds
+ return (xUpdateAnnotCds(gff, annot) &&
+ xUpdateAnnotTranscript(gff, annot));
+ }
+
+ if (s_IsTranscriptType(recType))
+ {
+ return xUpdateAnnotTranscript(gff, annot);
}
- //
// Every other type is not officially sanctioned GTF, and per spec we are
// supposed to ignore it. In the spirit of being lenient on input we may
// try to salvage some of it anyway.
return true;
}
+
+CGtfAttributes g_GetIntersection(const CGtfAttributes& x, const CGtfAttributes& y)
+{
+ CGtfAttributes result;
+ const auto& xAttributes = x.Get();
+ const auto& yAttributes = y.Get();
+
+ auto xit = xAttributes.begin();
+ auto yit = yAttributes.begin();
+ while (xit != xAttributes.end() && yit != yAttributes.end()) {
+ if (xit->first < yit->first) {
+ ++xit;
+ } else if (yit->first < xit->first) {
+ ++yit;
+ }
+ else { // xit->first == yit->first
+ const set<string>& xVals = xit->second;
+ if (xVals.empty()) {
+ result.AddValue(xit->first, "");
+ }
+ else {
+ const set<string>& yVals = yit->second;
+ set<string> commonVals;
+ set_intersection(begin(xVals), end(xVals),
+ begin(yVals), end(yVals),
+ inserter(commonVals, commonVals.begin()));
+ if (!commonVals.empty()) {
+ for (const auto& val : commonVals) {
+ result.AddValue(xit->first, val);
+ }
+ }
+ }
+ ++xit;
+ ++yit;
+ }
+
+ }
+
+
+ return result;
+}
+
+
// ----------------------------------------------------------------------------
bool CGtfReader::xUpdateAnnotCds(
const CGtfReadRecord& gff,
auto featId = mpLocations->GetFeatureIdFor(gff, "cds");
mpLocations->AddRecordForId(featId, gff) ;
return (xFindFeatById(featId) || xCreateParentCds(gff, annot));
- }
+}
+
// ----------------------------------------------------------------------------
-bool CGtfReader::xUpdateAnnotTranscript(
- const CGtfReadRecord& gff,
- CSeq_annot& annot )
+void CGtfReader::xPropagateQualToParent(
+ const CGtfReadRecord& record,
+ const string& qualName,
+ CSeq_feat& parent)
+// ----------------------------------------------------------------------------
+{
+ CGtfAttributes::MultiValue values;
+ record.GtfAttributes().GetValues(qualName, values);
+ if (!values.empty()) {
+ xFeatureAddQualifiers(qualName, values, parent);
+ }
+}
+
+
+// ----------------------------------------------------------------------------
+bool CGtfReader::xUpdateAnnotParent(
+ const CGtfReadRecord& record,
+ const string& parentType,
+ CSeq_annot& annot)
// ----------------------------------------------------------------------------
{
+
+ auto recType = record.NormalizedType();
//
// If there is no gene feature to go with this CDS then make one. Otherwise,
// make sure the existing gene feature includes the location of the CDS.
//
- auto geneFeatId = mpLocations->GetFeatureIdFor(gff, "gene");
- CRef< CSeq_feat > pGene = xFindFeatById(geneFeatId);
- if (!pGene) {
- if (!xCreateParentGene(gff, annot)) {
- return false;
+ auto parentFeatId = mpLocations->GetFeatureIdFor(record, parentType);
+ auto pParent = xFindFeatById(parentFeatId);
+ if (!pParent) {
+ if (parentType == "gene") {
+ if (!xCreateParentGene(record, annot)) {
+ return false;
+ }
+ }
+ else {
+ if (!xCreateParentMrna(record, annot)) {
+ return false;
+ }
}
- mpLocations->AddRecordForId(geneFeatId, gff);
+
+ m_ParentChildQualMap[parentFeatId].emplace(recType, record.GtfAttributes());
+ mpLocations->AddRecordForId(parentFeatId, record);
}
else {
- mpLocations->AddRecordForId(geneFeatId, gff);
- if (!xFeatureTrimQualifiers(gff, *pGene)) {
- return false;
- }
- }
+ mpLocations->AddRecordForId(parentFeatId, record);
- //
- // If there is no mRNA feature with this gene_id|transcript_id then make one.
- // Otherwise, fix up the location of the existing one.
- //
- auto transcriptFeatId = mpLocations->GetFeatureIdFor(gff, "transcript");
- CRef<CSeq_feat> pMrna = xFindFeatById(transcriptFeatId);
- if (!pMrna) {
- //
- // Create a brand new CDS feature:
- //
- if (!xCreateParentMrna(gff, annot)) {
- return false;
- }
- mpLocations->AddRecordForId(transcriptFeatId, gff);
- }
- else {
- //
- // Update an already existing CDS features:
- //
- mpLocations->AddRecordForId(transcriptFeatId, gff);
- if (!xFeatureTrimQualifiers(gff, *pMrna)) {
- return false;
- }
+ if (auto parentIt = m_ParentChildQualMap.find(parentFeatId);
+ parentIt != m_ParentChildQualMap.end()) {
+ if (auto childIt = parentIt->second.find(recType);
+ childIt != parentIt->second.end()) {
+
+ auto& childAttributes = childIt->second;
+ if (!xFeatureTrimQualifiers(childAttributes, record.GtfAttributes(), *pParent)) {
+ return false;
+ }
+ auto accumulatedAttributes = g_GetIntersection(childAttributes, record.GtfAttributes());
+ childAttributes = accumulatedAttributes;
+ } else { // First feature
+ parentIt->second.emplace(recType, record.GtfAttributes());
+
+ if (parentType == "gene") {
+ if (s_IsCDSType(recType)) {
+ xPropagateQualToParent(record, "gene_id", *pParent);
+ } else if (!xFeatureSetQualifiersGene(record, *pParent)) {
+ return false;
+ }
+ } else {
+ if (s_IsCDSType(recType)) {
+ xPropagateQualToParent(record, "gene_id", *pParent);
+ xPropagateQualToParent(record, "transcript_id", *pParent);
+ } else if (!xFeatureSetQualifiersRna(record, *pParent)) {
+ return false;
+ }
+ }
+ }
+ }
}
return true;
}
+// ----------------------------------------------------------------------------
+bool CGtfReader::xUpdateAnnotTranscript(
+ const CGtfReadRecord& gff,
+ CSeq_annot& annot )
+// ----------------------------------------------------------------------------
+{
+ if (!xUpdateAnnotParent(gff, "gene", annot)) {
+ return false;
+ }
+ return xUpdateAnnotParent(gff, "transcript", annot);
+}
+
// ----------------------------------------------------------------------------
bool CGtfReader::xCreateFeatureId(
const CGtfReadRecord& record,
if (!xCreateFeatureId(gff, "gene", *pFeature)) {
return false;
}
- if ( !xFeatureSetQualifiersGene(gff, *pFeature)) {
+ if (gff.NormalizedType() == "cds") {
+ xPropagateQualToParent(gff, "gene_id", *pFeature);
+ } else if (!xFeatureSetQualifiersGene(gff, *pFeature)) {
return false;
}
return true;
}
+
// ----------------------------------------------------------------------------
bool CGtfReader::xFeatureSetQualifiersGene(
const CGtfReadRecord& record,
CSeq_feat& feature )
// ----------------------------------------------------------------------------
{
- list<string> ignoredAttrs = {
- "locus_tag", "transcript_id"
+ set<string> ignoredAttrs = {
+ "locus_tag", "transcript_id", "gene"
};
- //
- // Create GB qualifiers for the record attributes:
- //
-
- const auto& attrs = record.GtfAttributes().Get();
- auto it = attrs.begin();
- for (/*NOOP*/; it != attrs.end(); ++it) {
- auto cit = std::find(ignoredAttrs.begin(), ignoredAttrs.end(), it->first);
- if (cit != ignoredAttrs.end()) {
- continue;
- }
- // special case some well-known attributes
- if (xProcessQualifierSpecialCase(it->first, it->second, feature)) {
- continue;
- }
-
- // turn everything else into a qualifier
- xFeatureAddQualifiers(it->first, it->second, feature);
- }
- return true;
+ return xFeatureSetQualifiers(record, ignoredAttrs, feature);
}
+
// ----------------------------------------------------------------------------
bool CGtfReader::xFeatureSetQualifiersRna(
const CGtfReadRecord& record,
CSeq_feat& feature )
// ----------------------------------------------------------------------------
{
- list<string> ignoredAttrs = {
+ set<string> ignoredAttrs = {
"locus_tag"
};
- const auto& attrs = record.GtfAttributes().Get();
- auto it = attrs.begin();
- for (/*NOOP*/; it != attrs.end(); ++it) {
- auto cit = std::find(ignoredAttrs.begin(), ignoredAttrs.end(), it->first);
- if (cit != ignoredAttrs.end()) {
- continue;
- }
- // special case some well-known attributes
- if (xProcessQualifierSpecialCase(it->first, it->second, feature)) {
- continue;
- }
-
- // turn everything else into a qualifier
- xFeatureAddQualifiers(it->first, it->second, feature);
- }
- return true;
+ return xFeatureSetQualifiers(record, ignoredAttrs, feature);
}
+
// ----------------------------------------------------------------------------
bool CGtfReader::xFeatureSetQualifiersCds(
const CGtfReadRecord& record,
CSeq_feat& feature )
// ----------------------------------------------------------------------------
{
- list<string> ignoredAttrs = {
+ set<string> ignoredAttrs = {
"locus_tag"
};
+ return xFeatureSetQualifiers(record, ignoredAttrs, feature);
+}
- const auto& attrs = record.GtfAttributes().Get();
- auto it = attrs.begin();
- for (/*NOOP*/; it != attrs.end(); ++it) {
- auto cit = std::find(ignoredAttrs.begin(), ignoredAttrs.end(), it->first);
- if (cit != ignoredAttrs.end()) {
+
+// ----------------------------------------------------------------------------
+bool CGtfReader::xFeatureSetQualifiers(
+ const CGtfReadRecord& record,
+ const set<string>& ignoredAttrs,
+ CSeq_feat& feature )
+// ----------------------------------------------------------------------------
+{
+ //
+ // Create GB qualifiers for the record attributes:
+ //
+ for (const auto& attribute : record.GtfAttributes().Get()) {
+ const auto& name = attribute.first;
+ if (ignoredAttrs.find(name) != ignoredAttrs.end()) {
continue;
}
+ const auto& vals = attribute.second;
// special case some well-known attributes
- if (xProcessQualifierSpecialCase(it->first, it->second, feature)) {
+ if (xProcessQualifierSpecialCase(name, vals, feature)) {
continue;
}
// turn everything else into a qualifier
- xFeatureAddQualifiers(it->first, it->second, feature);
+ xFeatureAddQualifiers(name, vals, feature);
}
return true;
}
+
// -----------------------------------------------------------------------------
bool CGtfReader::xCreateParentCds(
const CGtfReadRecord& gff,
CSeq_annot& annot )
// -----------------------------------------------------------------------------
{
- auto featId = mpLocations->GetFeatureIdFor(gff, "cds");
- if (m_MapIdToFeature.find(featId) != m_MapIdToFeature.end()) {
- return true;
- }
-
CRef<CSeq_feat> pFeature(new CSeq_feat);
if (!xFeatureSetDataCds(gff, *pFeature)) {
if (!xFeatureSetQualifiersCds(gff, *pFeature)) {
return false;
}
+
+ auto featId = mpLocations->GetFeatureIdFor(gff, "cds");
+
+ xCheckForGeneIdConflict(gff);
+
m_MapIdToFeature[featId] = pFeature;
return xAddFeatureToAnnot(pFeature, annot);
}
+
+void CGtfReader::xCheckForGeneIdConflict(
+ const CGtfReadRecord& gff)
+{
+ auto transcriptId = gff.TranscriptId();
+ if (!transcriptId.empty()) {
+ if (auto geneId = gff.GeneKey(); !geneId.empty()) {
+ if (auto it = m_TranscriptToGeneMap.find(transcriptId); it != m_TranscriptToGeneMap.end()) {
+ if (it->second != geneId) {
+ string msg = "Gene id '" + geneId + "' for transcript '" + transcriptId +
+ "' conflicts with previously-assigned '" + it->second + "'";
+ CReaderMessage error(
+ eDiag_Error,
+ m_uLineNumber,
+ msg);
+ m_pMessageHandler->Report(error);
+ }
+ }
+ else {
+ m_TranscriptToGeneMap.emplace(transcriptId, geneId);
+ }
+ }
+ }
+}
+
+
// -----------------------------------------------------------------------------
bool CGtfReader::xCreateParentMrna(
const CGtfReadRecord& gff,
if (!xCreateFeatureId(gff, "mrna", *pFeature)) {
return false;
}
- if ( ! xFeatureSetQualifiersRna( gff, *pFeature ) ) {
+
+ if (gff.NormalizedType() == "cds") {
+ xPropagateQualToParent(gff, "gene_id", *pFeature);
+ xPropagateQualToParent(gff, "transcript_id", *pFeature);
+ } else if (!xFeatureSetQualifiersRna( gff, *pFeature ) ) {
return false;
}
if (!locusTag.empty()) {
gene.SetLocus_tag(locusTag);
}
+ string locus = attributes.ValueOf("gene");
+
+ if (!locus.empty()) {
+ gene.SetLocus(locus);
+ }
return true;
}
CSeq_feat& feature )
// ----------------------------------------------------------------------------
{
- typedef CSeq_feat::TQual TQual;
+ return xFeatureTrimQualifiers(record.GtfAttributes(), feature);
+}
+
+
+bool CGtfReader::xFeatureTrimQualifiers(
+ const CGtfAttributes& attributes,
+ CSeq_feat& feature )
+ // ----------------------------------------------------------------------------
+{
//task:
// for each attribute of the new piece check if we already got a feature
// qualifier
// if so, and with the same value, then the qualifier is allowed to live
// otherwise it is subfeature specific and hence removed from the feature
- TQual& quals = feature.SetQual();
- for (TQual::iterator it = quals.begin(); it != quals.end(); /**/) {
+ auto& quals = feature.SetQual();
+ for (auto it = quals.begin(); it != quals.end(); /**/) {
const string& qualKey = (*it)->GetQual();
- if (NStr::StartsWith(qualKey, "gff_")) {
- it++;
- continue;
- }
- if (qualKey == "locus_tag") {
- it++;
+
+ if (NStr::StartsWith(qualKey, "gff_") ||
+ qualKey == "locus_tag" ||
+ qualKey == "old_locus_tag" ||
+ qualKey == "product" ||
+ qualKey == "protein_id") {
+ ++it;
continue;
}
- if (qualKey == "old_locus_tag") {
- it++;
+
+ const string& qualVal = (*it)->GetVal();
+ if (!attributes.HasValue(qualKey, qualVal)) {
+ //superfluous qualifier- squish
+ it = quals.erase(it);
continue;
}
- if (qualKey == "product") {
- it++;
+ it++;
+ }
+ return true;
+}
+
+
+bool CGtfReader::xFeatureTrimQualifiers(
+ const CGtfAttributes& prevAttributes,
+ const CGtfAttributes& attributes,
+ CSeq_feat& feature )
+ // ----------------------------------------------------------------------------
+{
+ //task:
+ // for each attribute of the new piece check if we already got a feature
+ // qualifier
+ // if so, and with the same value, then the qualifier is allowed to live
+ // otherwise it is subfeature specific and hence removed from the feature
+ auto& quals = feature.SetQual();
+ for (auto it = quals.begin(); it != quals.end(); /**/) {
+ const string& qualKey = (*it)->GetQual();
+
+ if (NStr::StartsWith(qualKey, "gff_") ||
+ qualKey == "locus_tag" ||
+ qualKey == "old_locus_tag" ||
+ qualKey == "product" ||
+ qualKey == "protein_id") {
+ ++it;
continue;
}
- if (qualKey == "protein_id") {
- it++;
+
+ const string& qualVal = (*it)->GetVal();
+ if (!prevAttributes.HasValue(qualKey, qualVal)) {
+ ++it;
continue;
}
- const string& qualVal = (*it)->GetVal();
- if (!record.GtfAttributes().HasValue(qualKey, qualVal)) {
+
+ if (!attributes.HasValue(qualKey, qualVal)) {
//superfluous qualifier- squish
it = quals.erase(it);
continue;
return true;
}
+
+
// ----------------------------------------------------------------------------
bool CGtfReader::xProcessQualifierSpecialCase(
const string& key,
CSeq_feat& feature)
// ----------------------------------------------------------------------------
{
+ set<string> existingVals;
+ for (const auto& pQual : feature.GetQual()) {
+ if (pQual->GetQual() == key) {
+ existingVals.insert(pQual->GetVal());
+ }
+ }
+
for (auto value: values) {
- feature.AddQualifier(key, value);
+ if (existingVals.find(value) == existingVals.end()) {
+ feature.AddQualifier(key, value);
+ }
}
};
CRef<CSeq_feat> pParentGene;
if (x_GetFeatureById(parentGeneFeatId, pParentGene)) {
xSetAncestorXrefs(*pFeature, *pParentGene);
+
}
break;
}
-/* $Id: line_error.cpp 630386 2021-05-01 20:54:52Z stakhovv $
-* ===========================================================================
-*
-* PUBLIC DOMAIN NOTICE
-* National Center for Biotechnology Information
-*
-* This software/database is a "United States Government Work" under the
-* terms of the United States Copyright Act. It was written as part of
-* the author's official duties as a United States Government employee and
-* thus cannot be copyrighted. This software/database is freely available
-* to the public for use. The National Library of Medicine and the U.S.
-* Government have not placed any restriction on its use or reproduction.
-*
-* Although all reasonable efforts have been taken to ensure the accuracy
-* and reliability of the software and data, the NLM and the U.S.
-* Government do not and cannot warrant the performance or results that
-* may be obtained by using this software or data. The NLM and the U.S.
-* Government disclaim all warranties, express or implied, including
-* warranties of performance, merchantability or fitness for any particular
-* purpose.
-*
-* Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-* Authors: Aaron Ucko, NCBI
-*
-* File Description:
-* Basic reader interface
-*
-* ===========================================================================
-*/
+/* $Id: line_error.cpp 684363 2024-06-20 19:34:09Z ivanov $
+ * ===========================================================================
+ *
+ * PUBLIC DOMAIN NOTICE
+ * National Center for Biotechnology Information
+ *
+ * This software/database is a "United States Government Work" under the
+ * terms of the United States Copyright Act. It was written as part of
+ * the author's official duties as a United States Government employee and
+ * thus cannot be copyrighted. This software/database is freely available
+ * to the public for use. The National Library of Medicine and the U.S.
+ * Government have not placed any restriction on its use or reproduction.
+ *
+ * Although all reasonable efforts have been taken to ensure the accuracy
+ * and reliability of the software and data, the NLM and the U.S.
+ * Government do not and cannot warrant the performance or results that
+ * may be obtained by using this software or data. The NLM and the U.S.
+ * Government disclaim all warranties, express or implied, including
+ * warranties of performance, merchantability or fitness for any particular
+ * purpose.
+ *
+ * Please cite the author in any work or product based on this material.
+ *
+ * ===========================================================================
+ *
+ * Authors: Aaron Ucko, NCBI
+ *
+ * File Description:
+ * Basic reader interface
+ *
+ * ===========================================================================
+ */
#include <ncbi_pch.hpp>
// static
CLineError* CLineError::Create(
- EProblem eProblem,
- EDiagSev eSeverity,
- const std::string& strSeqId,
- unsigned int uLine,
- const std::string & strFeatureName,
- const std::string & strQualifierName,
- const std::string & strQualifierValue,
- const std::string & strErrorMessage,
- const TVecOfLines & vecOfOtherLines)
+ EProblem eProblem,
+ EDiagSev eSeverity,
+ const std::string& strSeqId,
+ unsigned int uLine,
+ const std::string& strFeatureName,
+ const std::string& strQualifierName,
+ const std::string& strQualifierValue,
+ const std::string& strErrorMessage,
+ const TVecOfLines& vecOfOtherLines)
{
// this triggers a deprecated-call warning, which should disappear
// once the constructors become protected instead of deprecated.
return new CLineError(
- eProblem,
- eSeverity,
- strSeqId,
- uLine,
- strFeatureName,
- strQualifierName,
- strQualifierValue,
- strErrorMessage,
- vecOfOtherLines);
+ eProblem,
+ eSeverity,
+ strSeqId,
+ uLine,
+ strFeatureName,
+ strQualifierName,
+ strQualifierValue,
+ strErrorMessage,
+ vecOfOtherLines);
}
-void
-CLineError::Throw(void) const {
+void CLineError::Throw(void) const
+{
// this triggers a deprecated-call warning, which should disappear
// once the constructors become protected instead of deprecated.
throw *this;
}
CLineError::CLineError(
- EProblem eProblem,
- EDiagSev eSeverity,
+ EProblem eProblem,
+ EDiagSev eSeverity,
const std::string& strSeqId,
- unsigned int uLine,
- const std::string & strFeatureName,
- const std::string & strQualifierName,
- const std::string & strQualifierValue,
- const std::string & strErrorMessage,
- const TVecOfLines & vecOfOtherLines )
- : m_eProblem(eProblem), m_eSeverity( eSeverity ), m_strSeqId(strSeqId), m_uLine( uLine ),
- m_strFeatureName(strFeatureName), m_strQualifierName(strQualifierName),
- m_strQualifierValue(strQualifierValue), m_strErrorMessage(strErrorMessage),
+ unsigned int uLine,
+ const std::string& strFeatureName,
+ const std::string& strQualifierName,
+ const std::string& strQualifierValue,
+ const std::string& strErrorMessage,
+ const TVecOfLines& vecOfOtherLines) :
+ m_eProblem(eProblem),
+ m_eSeverity(eSeverity),
+ m_strSeqId(strSeqId),
+ m_uLine(uLine),
+ m_strFeatureName(strFeatureName),
+ m_strQualifierName(strQualifierName),
+ m_strQualifierValue(strQualifierValue),
+ m_strErrorMessage(strErrorMessage),
m_vecOfOtherLines(vecOfOtherLines)
-{ }
+{
+}
-CLineError::CLineError(const CLineError & rhs ) :
-m_eProblem(rhs.m_eProblem), m_eSeverity(rhs.m_eSeverity ), m_strSeqId(rhs.m_strSeqId), m_uLine(rhs.m_uLine ),
- m_strFeatureName(rhs.m_strFeatureName), m_strQualifierName(rhs.m_strQualifierName),
- m_strQualifierValue(rhs.m_strQualifierValue), m_strErrorMessage(rhs.m_strErrorMessage),
+CLineError::CLineError(const CLineError& rhs) :
+ m_eProblem(rhs.m_eProblem),
+ m_eSeverity(rhs.m_eSeverity),
+ m_strSeqId(rhs.m_strSeqId),
+ m_uLine(rhs.m_uLine),
+ m_strFeatureName(rhs.m_strFeatureName),
+ m_strQualifierName(rhs.m_strQualifierName),
+ m_strQualifierValue(rhs.m_strQualifierValue),
+ m_strErrorMessage(rhs.m_strErrorMessage),
m_vecOfOtherLines(rhs.m_vecOfOtherLines)
-{ }
+{
+}
+
-ILineError *CLineError::Clone(void) const
+string ILineError::Message() const
{
- return new CLineError(*this);
+ CNcbiOstrstream result;
+ result << "On SeqId '" << SeqId() << "', line " << Line() << ", severity " << SeverityStr() << ": '"
+ << ProblemStr() << "'";
+ if (! FeatureName().empty()) {
+ result << ", with feature name '" << FeatureName() << "'";
+ }
+ if (! QualifierName().empty()) {
+ result << ", with qualifier name '" << QualifierName() << "'";
+ }
+ if (! QualifierValue().empty()) {
+ result << ", with qualifier value '" << QualifierValue() << "'";
+ }
+ if (! OtherLines().empty()) {
+ result << ", with other possibly relevant line(s):";
+ ITERATE (TVecOfLines, line_it, OtherLines()) {
+ result << ' ' << *line_it;
+ }
+ }
+ return (string)CNcbiOstrstreamToString(result);
+}
+
+
+string ILineError::SeverityStr() const
+{
+ return CNcbiDiag::SeverityName(Severity());
+}
+
+
+const string& ILineError::ErrorMessage() const
+{
+ return kEmptyStr;
+}
+
+
+string ILineError::ProblemStr() const
+{
+ return ProblemStr(Problem());
}
+std::string
+ILineError::ProblemStr(EProblem eProblem)
+{
+ switch (eProblem) {
+ case eProblem_Unset:
+ return "Unset";
+ case eProblem_UnrecognizedFeatureName:
+ return "Unrecognized feature name";
+ case eProblem_UnrecognizedQualifierName:
+ return "Unrecognized qualifier name";
+ case eProblem_NumericQualifierValueHasExtraTrailingCharacters:
+ return "Numeric qualifier value has extra trailing characters after the number";
+ case eProblem_NumericQualifierValueIsNotANumber:
+ return "Numeric qualifier value should be a number";
+ case eProblem_FeatureNameNotAllowed:
+ return "Feature name not allowed";
+ case eProblem_NoFeatureProvidedOnIntervals:
+ return "No feature provided on intervals";
+ case eProblem_QualifierWithoutFeature:
+ return "No feature provided for qualifiers";
+ case eProblem_FeatureBadStartAndOrStop:
+ return "Feature bad start and/or stop";
+ case eProblem_GeneralParsingError:
+ return "General parsing error";
+ case eProblem_BadFeatureInterval:
+ return "Bad feature interval";
+ case eProblem_QualifierBadValue:
+ return "Qualifier had bad value";
+ case eProblem_BadScoreValue:
+ return "Invalid score value";
+ case eProblem_MissingContext:
+ return "Value ignored due to missing context";
+ case eProblem_BadTrackLine:
+ return "Bad track line: Expected \"track key1=value1 key2=value2 ...\"";
+ case eProblem_InternalPartialsInFeatLocation:
+ return "Feature's location has internal partials";
+ case eProblem_FeatMustBeInXrefdGene:
+ return "Feature has xref to a gene, but that gene does NOT contain the feature.";
+ case eProblem_CreatedGeneFromMultipleFeats:
+ return "Feature is trying to create a gene that conflicts with the gene created by another feature.";
+ case eProblem_UnrecognizedSquareBracketCommand:
+ return "Unrecognized square bracket command";
+ case eProblem_TooLong:
+ return "Feature is too long";
+ case eProblem_UnexpectedNucResidues:
+ return "Nucleotide residues unexpectedly found in feature";
+ case eProblem_UnexpectedAminoAcids:
+ return "Amino acid residues unexpectedly found in feature";
+ case eProblem_TooManyAmbiguousResidues:
+ return "Too many ambiguous residues";
+ case eProblem_InvalidResidue:
+ return "Invalid residue(s)";
+ case eProblem_ModifierFoundButNoneExpected:
+ return "Modifiers were found where none were expected";
+ case eProblem_ExtraModifierFound:
+ return "Extraneous modifiers found";
+ case eProblem_ExpectedModifierMissing:
+ return "Expected modifier missing";
+ case eProblem_Missing:
+ return "Feature is missing";
+ case eProblem_NonPositiveLength:
+ return "Feature's length must be greater than zero.";
+ case eProblem_ParsingModifiers:
+ return "Could not parse modifiers.";
+ case eProblem_ContradictoryModifiers:
+ return "Multiple different values for modifier";
+ case eProblem_InvalidLengthAutoCorrected:
+ return "Feature had invalid length, but this was automatically corrected.";
+ case eProblem_IgnoredResidue:
+ return "An invalid residue has been ignored";
+ case eProblem_InvalidQualifier:
+ return "Invalid qualifier for feature";
+
+ case eProblem_BadInfoLine:
+ return "Broken ##INFO line";
+ case eProblem_BadFormatLine:
+ return "Broken ##FORMAT line";
+ case eProblem_BadFilterLine:
+ return "Broken ##FILTER line";
+
+ case eProblem_ProgressInfo:
+ return "Just a progress info message (no error)";
+ default:
+ return "Unknown problem";
+ }
+}
+
+
+void ILineError::Write(
+ CNcbiOstream& out) const
+{
+
+ out << " " << SeverityStr() << ":" << endl;
+ out << "Problem: " << ProblemStr() << endl;
+ if (GetCode()) {
+ out << "Code: " << GetCode();
+ if (GetSubCode()) {
+ out << "." << GetSubCode();
+ }
+ out << endl;
+ }
+ const string& seqid = SeqId();
+ if (! seqid.empty()) {
+ out << "SeqId: " << seqid << endl;
+ }
+ if (Line()) {
+ out << "Line: " << Line() << endl;
+ }
+ const string& feature = FeatureName();
+ if (! feature.empty()) {
+ out << "FeatureName: " << feature << endl;
+ }
+ const string& qualname = QualifierName();
+ if (! qualname.empty()) {
+ out << "QualifierName: " << qualname << endl;
+ }
+ const string& qualval = QualifierValue();
+ if (! qualval.empty()) {
+ out << "QualifierValue: " << qualval << endl;
+ }
+ const TVecOfLines& vecOfLines = OtherLines();
+ if (! vecOfLines.empty()) {
+ out << "OtherLines:";
+ ITERATE (TVecOfLines, line_it, vecOfLines) {
+ out << ' ' << *line_it;
+ }
+ out << endl;
+ }
+ out << endl;
+}
+
+
+void ILineError::WriteAsXML(
+ CNcbiOstream& out) const
+{
+ out << "<message severity=\"" << NStr::XmlEncode(SeverityStr()) << "\" "
+ << "problem=\"" << NStr::XmlEncode(ProblemStr()) << "\" ";
+ if (GetCode()) {
+ string code = NStr::IntToString(GetCode());
+ if (GetSubCode()) {
+ code += "." + NStr::IntToString(GetSubCode());
+ }
+ out << "code=\"" << NStr::XmlEncode(code) << "\" ";
+ }
+ const string& seqid = SeqId();
+ if (! seqid.empty()) {
+ out << "seqid=\"" << NStr::XmlEncode(seqid) << "\" ";
+ }
+ out << "line=\"" << Line() << "\" ";
+ const string& feature = FeatureName();
+ if (! feature.empty()) {
+ out << "feature_name=\"" << NStr::XmlEncode(feature) << "\" ";
+ }
+ const string& qualname = QualifierName();
+ if (! qualname.empty()) {
+ out << "qualifier_name=\"" << NStr::XmlEncode(qualname) << "\" ";
+ }
+ const string& qualval = QualifierValue();
+ if (! qualval.empty()) {
+ out << "qualifier_value=\"" << NStr::XmlEncode(qualval) << "\" ";
+ }
+ out << ">";
+
+ // child nodes
+ ITERATE (TVecOfLines, line_it, OtherLines()) {
+ out << "<other_line>" << *line_it << "</other_line>";
+ }
+
+ out << "</message>" << endl;
+}
+
+
+ILineError* CLineError::Clone() const
+{
+ return new CLineError(*this);
+}
+
CLineErrorEx* CLineErrorEx::Create(
- EProblem eProblem,
- EDiagSev eSeverity,
- int code,
- int subcode,
- const std::string& strSeqId,
- unsigned int uLine,
- const std::string & strErrorMessage,
- const std::string & strFeatureName,
- const std::string & strQualifierName,
- const std::string & strQualifierValue,
- const TVecOfLines & vecOfOtherLines)
+ EProblem eProblem,
+ EDiagSev eSeverity,
+ int code,
+ int subcode,
+ const std::string& strSeqId,
+ unsigned int uLine,
+ const std::string& strErrorMessage,
+ const std::string& strFeatureName,
+ const std::string& strQualifierName,
+ const std::string& strQualifierValue,
+ const TVecOfLines& vecOfOtherLines)
{
// this triggers a deprecated-call warning, which should disappear
// once the constructors become protected instead of deprecated.
return new CLineErrorEx(
- eProblem,
- eSeverity,
- code,
- subcode,
- strSeqId,
- uLine,
- strErrorMessage,
- strFeatureName,
- strQualifierName,
- strQualifierValue,
- vecOfOtherLines);
+ eProblem,
+ eSeverity,
+ code,
+ subcode,
+ strSeqId,
+ uLine,
+ strErrorMessage,
+ strFeatureName,
+ strQualifierName,
+ strQualifierValue,
+ vecOfOtherLines);
}
-void
-CLineErrorEx::Throw(void) const {
+void CLineErrorEx::Throw(void) const
+{
// this triggers a deprecated-call warning, which should disappear
// once the constructors become protected instead of deprecated.
throw *this;
CLineErrorEx::CLineErrorEx(
- EProblem eProblem,
- EDiagSev eSeverity,
- int code,
- int subcode,
+ EProblem eProblem,
+ EDiagSev eSeverity,
+ int code,
+ int subcode,
const std::string& strSeqId,
- unsigned int uLine,
- const std::string & strErrorMessage,
- const std::string & strFeatureName,
- const std::string & strQualifierName,
- const std::string & strQualifierValue,
- const TVecOfLines & vecOfOtherLines )
- : m_eProblem(eProblem), m_eSeverity( eSeverity ),
- m_Code(code), m_Subcode(subcode),
- m_strSeqId(strSeqId), m_uLine( uLine ),
- m_strFeatureName(strFeatureName), m_strQualifierName(strQualifierName),
+ unsigned int uLine,
+ const std::string& strErrorMessage,
+ const std::string& strFeatureName,
+ const std::string& strQualifierName,
+ const std::string& strQualifierValue,
+ const TVecOfLines& vecOfOtherLines) :
+ m_eProblem(eProblem),
+ m_eSeverity(eSeverity),
+ m_Code(code),
+ m_Subcode(subcode),
+ m_strSeqId(strSeqId),
+ m_uLine(uLine),
+ m_strFeatureName(strFeatureName),
+ m_strQualifierName(strQualifierName),
m_strQualifierValue(strQualifierValue),
m_strErrorMessage(strErrorMessage),
m_vecOfOtherLines(vecOfOtherLines)
-{ }
+{
+}
-CLineErrorEx::CLineErrorEx(const CLineErrorEx & rhs ) :
+CLineErrorEx::CLineErrorEx(const CLineErrorEx& rhs) :
CLineErrorEx(rhs.m_eProblem,
rhs.m_eSeverity,
rhs.m_Code,
rhs.m_strQualifierName,
rhs.m_strQualifierValue,
rhs.m_vecOfOtherLines)
-{}
-
-/*
-m_eProblem(rhs.m_eProblem), m_eSeverity(rhs.m_eSeverity ), m_strSeqId(rhs.m_strSeqId), m_uLine(rhs.m_uLine ),
- m_strFeatureName(rhs.m_strFeatureName), m_strQualifierName(rhs.m_strQualifierName),
- m_strQualifierValue(rhs.m_strQualifierValue), m_strErrorMessage(rhs.m_strErrorMessage),
- m_vecOfOtherLines(rhs.m_vecOfOtherLines)
-{ }
+{
+}
-*/
-ILineError *CLineErrorEx::Clone(void) const
+ILineError* CLineErrorEx::Clone(void) const
{
return new CLineErrorEx(*this);
}
-
-CObjReaderLineException *
- CObjReaderLineException::Create(
- EDiagSev eSeverity,
- unsigned int uLine,
- const std::string &strMessage,
- EProblem eProblem,
- const std::string& strSeqId,
- const std::string & strFeatureName,
- const std::string & strQualifierName,
- const std::string & strQualifierValue,
+CObjReaderLineException*
+CObjReaderLineException::Create(
+ EDiagSev eSeverity,
+ unsigned int uLine,
+ const std::string& strMessage,
+ EProblem eProblem,
+ const std::string& strSeqId,
+ const std::string& strFeatureName,
+ const std::string& strQualifierName,
+ const std::string& strQualifierValue,
CObjReaderLineException::EErrCode eErrCode,
- const TVecOfLines & vecOfOtherLines
- )
+ const TVecOfLines& vecOfOtherLines)
{
// this triggers a deprecated-call warning, which should disappear
// once the constructors become protected instead of deprecated.
return new CObjReaderLineException(
- eSeverity, uLine, strMessage, eProblem,
- strSeqId, strFeatureName, strQualifierName, strQualifierValue,
- eErrCode, vecOfOtherLines );
+ eSeverity, uLine, strMessage, eProblem, strSeqId, strFeatureName, strQualifierName, strQualifierValue, eErrCode, vecOfOtherLines);
}
-ILineError *CObjReaderLineException::Clone(void) const
+ILineError* CObjReaderLineException::Clone(void) const
{
return new CObjReaderLineException(*this);
}
-void
-CObjReaderLineException::Throw(void) const {
+void CObjReaderLineException::Throw(void) const
+{
// this triggers a deprecated-call warning, which should disappear
// once the constructors become protected instead of deprecated.
throw *this;
}
CObjReaderLineException::CObjReaderLineException(
- EDiagSev eSeverity,
- unsigned int uLine,
- const std::string &strMessage,
- EProblem eProblem,
- const std::string& strSeqId,
- const std::string & strFeatureName,
- const std::string & strQualifierName,
- const std::string & strQualifierValue,
+ EDiagSev eSeverity,
+ unsigned int uLine,
+ const std::string& strMessage,
+ EProblem eProblem,
+ const std::string& strSeqId,
+ const std::string& strFeatureName,
+ const std::string& strQualifierName,
+ const std::string& strQualifierValue,
CObjReaderLineException::EErrCode eErrCode,
- const TVecOfLines & vecOfOtherLines
- )
- : CObjReaderParseException( DIAG_COMPILE_INFO, 0, static_cast<CObjReaderParseException::EErrCode>(CException::eInvalid), strMessage, uLine,
- eDiag_Info ),
- m_eProblem(eProblem), m_strSeqId(strSeqId), m_uLineNumber(uLine),
- m_strFeatureName(strFeatureName), m_strQualifierName(strQualifierName),
- m_strQualifierValue(strQualifierValue), m_strErrorMessage(strMessage),
+ const TVecOfLines& vecOfOtherLines) :
+ CObjReaderParseException(DIAG_COMPILE_INFO, 0, static_cast<CObjReaderParseException::EErrCode>(CException::eInvalid), strMessage, uLine, eDiag_Info),
+ m_eProblem(eProblem),
+ m_strSeqId(strSeqId),
+ m_uLineNumber(uLine),
+ m_strFeatureName(strFeatureName),
+ m_strQualifierName(strQualifierName),
+ m_strQualifierValue(strQualifierValue),
+ m_strErrorMessage(strMessage),
m_vecOfOtherLines(vecOfOtherLines)
{
- SetSeverity( eSeverity );
+ SetSeverity(eSeverity);
x_InitErrCode(static_cast<CException::EErrCode>(eErrCode));
}
-CObjReaderLineException::CObjReaderLineException(const CObjReaderLineException & rhs ) :
-CObjReaderParseException( rhs ),
- m_eProblem(rhs.Problem()), m_strSeqId(rhs.SeqId()), m_uLineNumber(rhs.Line()),
- m_strFeatureName(rhs.FeatureName()), m_strQualifierName(rhs.QualifierName()),
- m_strQualifierValue(rhs.QualifierValue()), m_strErrorMessage(rhs.ErrorMessage()),
- m_vecOfOtherLines(rhs.m_vecOfOtherLines)
+CObjReaderLineException::CObjReaderLineException(const CObjReaderLineException& rhs) :
+ CObjReaderParseException(rhs),
+ m_eProblem(rhs.Problem()),
+ m_strSeqId(rhs.SeqId()),
+ m_uLineNumber(rhs.Line()),
+ m_strFeatureName(rhs.FeatureName()),
+ m_strQualifierName(rhs.QualifierName()),
+ m_strQualifierValue(rhs.QualifierValue()),
+ m_strErrorMessage(rhs.ErrorMessage()),
+ m_vecOfOtherLines(rhs.m_vecOfOtherLines),
+ m_pObject(rhs.m_pObject)
{
- SetSeverity( rhs.Severity() );
+ SetSeverity(rhs.Severity());
x_InitErrCode(static_cast<CException::EErrCode>(rhs.x_GetErrCode()));
}
std::string
CObjReaderLineException::ProblemStr() const
{
- if (!m_strErrorMessage.empty()) {
+ if (! m_strErrorMessage.empty()) {
return m_strErrorMessage;
}
return ILineError::ProblemStr();
}
+void CObjReaderLineException::SetObject(CRef<CSerialObject> pObject)
+{
+ m_pObject = pObject;
+}
+
+CConstRef<CSerialObject> CObjReaderLineException::GetObject() const
+{
+ return m_pObject;
+}
+
END_SCOPE(objects)
END_NCBI_SCOPE
-
BEGIN_NCBI_SCOPE
BEGIN_SCOPE(objects) // namespace ncbi::objects::
-void
-CMessageListenerBase::PutProgress(
- const string & sMessage,
- const Uint8 iNumDone,
- const Uint8 iNumTotal)
+void CMessageListenerBase::PutProgress(
+ const string& sMessage,
+ const Uint8 iNumDone,
+ const Uint8 iNumTotal)
{
// NB: Some other classes rely on the message fitting in one line.
// NB: New attributes or inner elements could be added to the resulting
// message at any time, so make no assumptions.
- if( ! m_pProgressOstrm ) {
+ if (! m_pProgressOstrm) {
// no stream to write to
return;
}
*m_pProgressOstrm << "<message severity=\"INFO\" ";
- if( iNumDone > 0 ) {
+ if (iNumDone > 0) {
*m_pProgressOstrm << "num_done=\"" << iNumDone << "\" ";
}
- if( iNumTotal > 0 ) {
+ if (iNumTotal > 0) {
*m_pProgressOstrm << "num_total=\"" << iNumTotal << "\" ";
}
- if( sMessage.empty() ) {
- *m_pProgressOstrm << " />";
+ if (sMessage.empty()) {
+ *m_pProgressOstrm << " />";
} else {
- *m_pProgressOstrm << " >";
+ *m_pProgressOstrm << " >";
string sXMLEncodedMessage = NStr::XmlEncode(sMessage);
// some functionality relies on progress messages fitting into
// one line, so we escape newlines (just in case) while
// we write it.
- ITERATE( string, msg_it, sXMLEncodedMessage ) {
+ ITERATE (string, msg_it, sXMLEncodedMessage) {
const char ch = *msg_it;
- switch(ch) {
+ switch (ch) {
case '\r':
*m_pProgressOstrm << "
";
break;
}
-CGPipeMessageListener::CGPipeMessageListener(bool ignoreBadModValue)
- : m_IgnoreBadModValue(ignoreBadModValue) {}
+CGPipeMessageListener::CGPipeMessageListener(bool ignoreBadModValue) :
+ m_IgnoreBadModValue(ignoreBadModValue) {}
-bool CGPipeMessageListener::PutError(const ILineError& error) {
+bool CGPipeMessageListener::PutError(const ILineError& error)
+{
const auto severity = error.GetSeverity();
}
-
END_SCOPE(objects)
END_NCBI_SCOPE
-
-/* $Id: mod_reader.cpp 671755 2023-08-23 17:41:23Z ivanov $
+/* $Id: mod_reader.cpp 676196 2023-12-11 21:07:17Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
{"db-xref", "dbxref"},
{"pubmed", "pmid"},
{"ft-url-mod", "ft-mod"},
- {"ft-url", "ft-map"}
+ {"ft-url", "ft-map"},
+ {"geo-loc-name", "country"}
};
//);
-/* $Id: mod_to_enum.cpp 630386 2021-05-01 20:54:52Z stakhovv $
+/* $Id: mod_to_enum.cpp 679820 2024-03-04 18:32:45Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
{"host",COrgMod::eSubtype_nat_host},
{"specific-host", COrgMod::eSubtype_nat_host}};
return s_InitModStringToEnumMap(
- *COrgMod::GetTypeInfo_enum_ESubtype(),
+ *COrgMod::ENUM_METHOD_NAME(ESubtype)(),
kDeprecatedOrgSubtypes,
extra_smod_to_enum_names
);
{ "note", CSubSource::eSubtype_other },
{ "notes", CSubSource::eSubtype_other }};
return s_InitModStringToEnumMap(
- *CSubSource::GetTypeInfo_enum_ESubtype(),
- skip_enum_names,
- extra_smod_to_enum_names);
+ *CSubSource::ENUM_METHOD_NAME(ESubtype)(),
+ skip_enum_names,
+ extra_smod_to_enum_names);
}
{ "insertion sequence", CBioSource::eGenome_insertion_seq}};
return s_InitModStringToEnumMap(
- *CBioSource::GetTypeInfo_enum_EGenome(),
- skip_enum_names,
- extra_smod_to_enum_names,
- g_GetNormalizedModVal);
+ *CBioSource::ENUM_METHOD_NAME(EGenome)(),
+ skip_enum_names,
+ extra_smod_to_enum_names,
+ g_GetNormalizedModVal);
}
{ "mutant", CBioSource::eOrigin_mut}};
return s_InitModStringToEnumMap(
- *CBioSource::GetTypeInfo_enum_EOrigin(),
- skip_enum_names,
- extra_smod_to_enum_names,
- g_GetNormalizedModVal);
+ *CBioSource::ENUM_METHOD_NAME(EOrigin)(),
+ skip_enum_names,
+ extra_smod_to_enum_names,
+ g_GetNormalizedModVal);
}
-/* $Id: reader_base.cpp 650647 2022-05-31 15:10:29Z ludwigf $
+/* $Id: reader_base.cpp 680777 2024-03-27 13:52:05Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
// ----------------------------------------------------------------------------
void
CReaderBase::xProcessData(
- const TReaderData& readerData,
- CSeq_annot& annot)
+ const TReaderData& /*readerData*/,
+ CSeq_annot& /*annot*/)
// ----------------------------------------------------------------------------
{
}
baseFlags |= flagEntry->second;
}
};
-
-
+
+
// ----------------------------------------------------------------------------
void CReaderBase::xSetBrowserRegion(
const string& strRaw,
// ----------------------------------------------------------------------------
bool CReaderBase::xParseComment(
const CTempString& record,
- CRef<CSeq_annot>& annot )
+ CRef<CSeq_annot>& /*annot*/ )
// ----------------------------------------------------------------------------
{
if (NStr::StartsWith(record, "#")) {
// ----------------------------------------------------------------------------
void CReaderBase::xReportProgress(
- ILineErrorListener* pProgress)
+ ILineErrorListener* /*pProgress*/)
// ----------------------------------------------------------------------------
{
if (!xIsReportingProgress()) { // progress reports disabled
private:
+ unsigned int x_GetLineNumber() const;
+
// Prohibit copy constructor and assignment operator
CFeatureTableReader_Imp(const CFeatureTableReader_Imp& value);
CFeatureTableReader_Imp& operator=(const CFeatureTableReader_Imp& value);
void x_UpdatePointStrand(CSeq_feat& feat, CSeq_interval::TStrand strand) const;
void x_GetPointStrand(const CSeq_feat& feat, CSeq_interval::TStrand& strand) const;
+ CRef<CSeq_feat> m_pCurrentFeat;
bool m_need_check_strand;
string m_real_seqid;
CRef<CSeq_id> m_seq_id;
ILineErrorListener* m_pMessageListener;
unordered_set<string> m_ProcessedTranscriptIds;
unordered_set<string> m_ProcessedProteinIds;
+ TFlags m_Flags{0};
};
{ "fwd_primer_name", CSubSource::eSubtype_fwd_primer_name },
{ "fwd_primer_seq", CSubSource::eSubtype_fwd_primer_seq },
{ "genotype", CSubSource::eSubtype_genotype },
+ { "geo_loc_name", CSubSource::eSubtype_country },
{ "germline", CSubSource::eSubtype_germline },
{ "haplotype", CSubSource::eSubtype_haplotype },
{ "identified_by", CSubSource::eSubtype_identified_by },
return true;
}
-/*
-bool CFeatureTableReader_Imp::x_ParseFeatureTableLine (
- const CTempString& line,
- Int4* startP,
- Int4* stopP,
- bool* partial5P,
- bool* partial3P,
- bool* ispointP,
- bool* isminusP,
- string& featP,
- string& qualP,
- string& valP,
- Int4 offset
-)
-
-{
- SIZE_TYPE numtkns;
- bool isminus = false;
- bool ispoint = false;
- size_t len;
- bool partial5 = false;
- bool partial3 = false;
- Int4 startv = -1;
- Int4 stopv = -1;
- Int4 swp;
- string start, stop, feat, qual, val, stnd;
- vector<string> tkns;
-
-
- if (line.empty ()) return false;
-
- if (NStr::StartsWith (line, '[')) return false;
-
- tkns.clear ();
- x_TokenizeLenient(line, tkns);
- numtkns = tkns.size ();
-
- if (numtkns > 0) {
- start = NStr::TruncateSpaces(tkns[0]);
- }
- if (numtkns > 1) {
- stop = NStr::TruncateSpaces(tkns[1]);
- }
- if (numtkns > 2) {
- feat = NStr::TruncateSpaces(tkns[2]);
- }
- if (numtkns > 3) {
- qual = NStr::TruncateSpaces(tkns[3]);
- }
- if (numtkns > 4) {
- val = NStr::TruncateSpaces(tkns[4]);
- // trim enclosing double-quotes
- if( val.length() >= 2 && val[0] == '"' && val[val.length()-1] == '"' ) {
- val = val.substr(1, val.length() - 2);
- }
- }
- if (numtkns > 5) {
- stnd = NStr::TruncateSpaces(tkns[5]);
- }
-
- bool has_start = false;
- if (! start.empty ()) {
- if (start [0] == '<') {
- partial5 = true;
- start.erase (0, 1);
- }
- len = start.length ();
- if (len > 1 && start [len - 1] == '^') {
- ispoint = true;
- start [len - 1] = '\0';
- }
- startv = x_StringToLongNoThrow(start, feat, qual,
- ILineError::eProblem_BadFeatureInterval);
- has_start = true;
- }
-
- bool has_stop = false;
- if (! stop.empty ()) {
- if (stop [0] == '>') {
- partial3 = true;
- stop.erase (0, 1);
- }
- stopv = x_StringToLongNoThrow (stop, feat, qual,
- ILineError::eProblem_BadFeatureInterval);
- has_stop = true;
- }
-
- if ( startv <= 0 || stopv <= 0 ) {
- startv = -1;
- stopv = -1;
- } else {
- startv--;
- stopv--;
- if (! stnd.empty ()) {
- if (stnd == "minus" || stnd == "-" || stnd == "complement") {
- if (start < stop) {
- swp = startv;
- startv = stopv;
- stopv = swp;
- }
- isminus = true;
- }
- }
- }
-
- if (startv >= 0) {
- startv += offset;
- }
- if (stopv >= 0) {
- stopv += offset;
- }
-
- if ((has_start && startv < 0) || (has_stop && stopv < 0)) {
- x_ProcessMsg(
- ILineError::eProblem_FeatureBadStartAndOrStop,
- eDiag_Error,
- feat);
- }
-
- *startP = ( startv < 0 ? -1 : startv);
- *stopP = ( stopv < 0 ? -1 : stopv);
-
- *partial5P = partial5;
- *partial3P = partial3;
- *ispointP = ispoint;
- *isminusP = isminus;
- featP = feat;
- qualP = qual;
- valP = val;
-
- return true;
-}
-*/
void CFeatureTableReader_Imp::x_TokenizeStrict(
const CTempString &line,
const string& strErrorMessage,
const ILineError::TVecOfLines & vecOfOtherLines)
{
- x_ProcessMsg(m_reader ? static_cast<unsigned>(m_reader->GetLineNumber()) : m_LineNumber,
+ x_ProcessMsg(m_reader ? x_GetLineNumber() : m_LineNumber,
eProblem,
eSeverity,
strFeatureName,
return;
}
- AutoPtr<CObjReaderLineException> pErr (
+ unique_ptr<CObjReaderLineException> pErr (
CObjReaderLineException::Create(
eSeverity, line_num, strErrorMessage, eProblem, m_real_seqid, strFeatureName,
strQualifierName, strQualifierValue));
- ITERATE( ILineError::TVecOfLines, line_it, vecOfOtherLines ) {
- pErr->AddOtherLine(*line_it);
+
+ if (m_pCurrentFeat && (m_Flags & CFeature_table_reader::fIncludeObjectInMsg)) {
+ pErr->SetObject(m_pCurrentFeat);
+ }
+
+ for (auto line : vecOfOtherLines) {
+ pErr->AddOtherLine(line);
}
if (!m_pMessageListener->PutError(*pErr)) {
void CFeatureTableReader_Imp::x_ResetFeat(CRef<CSeq_feat> & sfp, bool & curr_feat_intervals_done)
{
m_need_check_strand = false;
- sfp.Reset(new CSeq_feat);
- //sfp->ResetLocation();
+ sfp.Reset(new CSeq_feat());
curr_feat_intervals_done = false;
}
TFtable& ftable)
{
if ( !feat ||
- feat.Empty() ||
!feat->IsSetData() ||
(feat->GetData().Which() == CSeqFeatData::e_not_set) )
{
}
// Check for missing publication - RW-626
- if (feat->GetData().GetSubtype() == CSeqFeatData::eSubtype_pub &&
- (!feat->SetData().SetPub().IsSetPub() ||
- feat->SetData().SetPub().GetPub().Get().empty())) {
+ const auto& featData = feat->GetData();
+ if (featData.GetSubtype() == CSeqFeatData::eSubtype_pub &&
+ (!featData.GetPub().IsSetPub() ||
+ !featData.GetPub().GetPub().IsSet() ||
+ featData.GetPub().GetPub().Get().empty())) {
+
const int line_number = m_reader->AtEOF() ?
- static_cast<unsigned>(m_reader->GetLineNumber()) :
- static_cast<unsigned>(m_reader->GetLineNumber())-1;
+ x_GetLineNumber() :
+ x_GetLineNumber()-1;
string msg = "Reference feature is empty. Skipping feature.";
ITableFilter *filter
)
{
+ m_Flags = flags;
string feat, qual, qual_value;
string curr_feat_name;
// Int4 start, stop;
// map feature types to features
TChoiceToFeatMap choiceToFeatMap;
- CRef<CSeq_feat> sfp;
+ m_pCurrentFeat.Reset();
// This is true once this feature should not
// have any more intervals.
// This allows us to catch errors like the following:
if( m_reader->GetLineNumber() % 10000 == 0 &&
m_reader->GetLineNumber() > 0 )
{
- PutProgress(m_real_seqid, static_cast<unsigned>(m_reader->GetLineNumber()), m_pMessageListener);
+ PutProgress(m_real_seqid, x_GetLineNumber(), m_pMessageListener);
}
// skip empty lines.
} else if ( s_LineIndicatesOrder(line) ) {
+ _ASSERT(m_pCurrentFeat);
+
// put nulls between feature intervals
- CRef<CSeq_loc> loc_with_nulls = s_LocationJoinToOrder( sfp->GetLocation() );
+ CRef<CSeq_loc> loc_with_nulls = s_LocationJoinToOrder( m_pCurrentFeat->GetLocation() );
// loc_with_nulls is unset if no change was needed
if( loc_with_nulls ) {
- sfp->SetLocation( *loc_with_nulls );
+ m_pCurrentFeat->SetLocation( *loc_with_nulls );
}
} else if (x_ParseFeatureTableLine (line, loc_info, feat, qual, qual_value, offset)) {
// process start - stop - feature line
- x_FinishFeature(sfp, ftable);
- x_ResetFeat( sfp, curr_feat_intervals_done );
+ x_FinishFeature(m_pCurrentFeat, ftable);
+ x_ResetFeat(m_pCurrentFeat, curr_feat_intervals_done );
- if (x_SetupSeqFeat (sfp, feat, flags, filter)) {
+ if (x_SetupSeqFeat (m_pCurrentFeat, feat, flags, filter)) {
// figure out type of feat, and store in map for later use
CSeqFeatData::E_Choice eChoice = CSeqFeatData::e_not_set;
- if( sfp->CanGetData() ) {
- eChoice = sfp->GetData().Which();
+ if( m_pCurrentFeat->CanGetData() ) {
+ eChoice = m_pCurrentFeat->GetData().Which();
}
choiceToFeatMap.insert(
TChoiceToFeatMap::value_type(
eChoice,
- SFeatAndLineNum(sfp, static_cast<unsigned>(m_reader->GetLineNumber()))));
+ SFeatAndLineNum(m_pCurrentFeat, x_GetLineNumber())));
// if new feature is a CDS, remember it for later lookups
if( eChoice == CSeqFeatData::e_Cdregion ) {
- best_CDS_finder.AddFeat( *sfp );
+ best_CDS_finder.AddFeat( *m_pCurrentFeat );
}
// and add first interval
- x_AddIntervalToFeature (curr_feat_name, sfp, loc_info);
+ x_AddIntervalToFeature (curr_feat_name, m_pCurrentFeat, loc_info);
ignore_until_next_feature_key = false;
x_ProcessMsg(ILineError::eProblem_NoFeatureProvidedOnIntervals, eDiag_Error);
// this feature is in bad shape, so we ignore the rest of it
ignore_until_next_feature_key = true;
- x_ResetFeat(sfp, curr_feat_intervals_done);
- } else if (sfp && sfp->IsSetLocation() && sfp->GetLocation().IsMix()) {
+ x_ResetFeat(m_pCurrentFeat, curr_feat_intervals_done);
+ } else if (m_pCurrentFeat && m_pCurrentFeat->IsSetLocation() && m_pCurrentFeat->GetLocation().IsMix()) {
// process start - stop multiple interval line
- x_AddIntervalToFeature (curr_feat_name, sfp, loc_info);
+ x_AddIntervalToFeature (curr_feat_name, m_pCurrentFeat, loc_info);
// start, stop, partial5, partial3, ispoint, isminus);
} else {
if (!(flags & CFeature_table_reader::fSuppressBadKeyWarning)) {
} else if (!NStr::IsBlank(qual)) {
curr_feat_intervals_done = true;
- x_ProcessQualifier(qual, qual_value, curr_feat_name, sfp, flags);
+ x_ProcessQualifier(qual, qual_value, curr_feat_name, m_pCurrentFeat, flags);
}
else if (!feat.empty()) {
}
// make sure last feature is finished
- x_FinishFeature(sfp, ftable);
- x_ResetFeat( sfp, curr_feat_intervals_done );
+ x_FinishFeature(m_pCurrentFeat, ftable);
+ x_ResetFeat(m_pCurrentFeat, curr_feat_intervals_done );
if ((flags & CFeature_table_reader::fCreateGenesFromCDSs) != 0 ||
(flags & CFeature_table_reader::fCDSsMustBeInTheirGenes) != 0 )
}
+unsigned int CFeatureTableReader_Imp::x_GetLineNumber() const
+{
+ return m_reader ?
+ static_cast<unsigned int>(m_reader->GetLineNumber()) :
+ 0;
+}
+
+
// public access functions
CFeature_table_reader::CFeature_table_reader(
CFeatureTableReader_Imp ftable_reader(&reader, 0, pMessageListener);
while ( !reader.AtEOF() ) {
auto annot = x_ReadFeatureTable(ftable_reader, flags, filter);
- //CRef<CSeq_annot> annot = ReadSequinFeatureTable(reader, flags, pMessageListener, filter);
if (entry.IsSeq()) { // only one place to go
entry.SetSeq().SetAnnot().push_back(annot);
continue;
-/* $Id: source_mod_parser.cpp 673184 2023-09-25 14:08:03Z ivanov $
+/* $Id: source_mod_parser.cpp 679820 2024-03-04 18:32:45Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
};
return s_InitSmodToEnumMap<COrgMod::ESubtype>(
- COrgMod::GetTypeInfo_enum_ESubtype(),
+ COrgMod::ENUM_METHOD_NAME(ESubtype)(),
kDeprecatedOrgSubtypes,
extra_smod_to_enum_names
);
{ "latitude-longitude", CSubSource::eSubtype_lat_lon },
};
return s_InitSmodToEnumMap<CSubSource::ESubtype>(
- CSubSource::GetTypeInfo_enum_ESubtype(),
+ CSubSource::ENUM_METHOD_NAME(ESubtype)(),
skip_enum_names,
- extra_smod_to_enum_names );
+ extra_smod_to_enum_names);
}
CSafeStatic<TSModSubSrcSubtype> kSModSubSrcSubtypeMap(
bsrc->SetGenome(CBioSource::eGenome_insertion_seq);
} else {
try {
- bsrc->SetGenome(CBioSource::GetTypeInfo_enum_EGenome()
+ bsrc->SetGenome(CBioSource::ENUM_METHOD_NAME(EGenome)()
->FindValue(mod->value));
} catch (CSerialException&) {
x_HandleBadModValue(*mod);
} else if( NStr::EqualNocase(mod->value, "mutant") ) {
bsrc->SetOrigin( CBioSource::eOrigin_mut );
} else {
- bsrc->SetOrigin(CBioSource::GetTypeInfo_enum_EOrigin()
+ bsrc->SetOrigin(CBioSource::ENUM_METHOD_NAME(EOrigin)()
->FindValue(mod->value));
}
} catch (CSerialException&) {
} else if( key_equal(mod, "origin") ) {
set_valid_values.insert("natural mutant");
set_valid_values.insert("mutant");
- ITERATE( CEnumeratedTypeValues::TValues, enum_iter, CBioSource::GetTypeInfo_enum_EOrigin()->GetValues() ) {
+ ITERATE(CEnumeratedTypeValues::TValues, enum_iter, CBioSource::ENUM_METHOD_NAME(EOrigin)()->GetValues()) {
set_valid_values.insert( enum_iter->first );
}
} else if( key_equal(mod, "tech") ) {
-/* $Id: bamloader_impl.cpp 648594 2022-04-18 21:11:33Z vasilche $
+/* $Id: bamloader_impl.cpp 674300 2023-10-23 19:56:38Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
BEGIN_NCBI_SCOPE
#define NCBI_USE_ERRCODE_X BAMLoader
-NCBI_DEFINE_ERR_SUBCODE_X(18);
+NCBI_DEFINE_ERR_SUBCODE_X(30);
BEGIN_SCOPE(objects)
class CDataLoader;
static const int kTSEId = 1;
-static const size_t kChunkSize = 500;
+static const Uint8 kSingleAlignBytes = 60; // estimated size of a single alignment in bytes
//static const size_t kGraphScale = 1000;
//static const size_t kGraphPoints = 20;
-static const size_t kChunkDataSize = 250000;
+static const size_t kChunkDataSize = 250000; // target chunk size in bytes
+static const size_t kChunkSize = kChunkDataSize/kSingleAlignBytes; // target chunk align count
static const int kMainChunkId = CTSE_Chunk_Info::kDelayedMain_ChunkId;
//#define SKIP_TOO_LONG_ALIGNMENTS
}
+NCBI_PARAM_DECL(bool, BAM_LOADER, PREFER_RAW_INDEX_OVER_COVERAGE_GRAPH);
+NCBI_PARAM_DEF_EX(bool, BAM_LOADER, PREFER_RAW_INDEX_OVER_COVERAGE_GRAPH, false,
+ eParam_NoThread, BAM_LOADER_PREFER_RAW_INDEX_OVER_COVERAGE_GRAPH);
+
+static bool GetPreferRawIndexOverCoverageGraphParam(void)
+{
+ return NCBI_PARAM_TYPE(BAM_LOADER, PREFER_RAW_INDEX_OVER_COVERAGE_GRAPH)::GetDefault();
+}
+
+
NCBI_PARAM_DECL(bool, BAM_LOADER, PREOPEN);
NCBI_PARAM_DEF(bool, BAM_LOADER, PREOPEN, false);
}
+static double s_CreateTime = 0;
+static double s_AttachTime = 0;
+
+
CBAMDataLoader_Impl::~CBAMDataLoader_Impl(void)
{
+ if ( GetDebugLevel() >= 4 ) {
+ LOG_POST_X(21, Info<<"CBAMDataLoader: "
+ "Total create time: "<<s_CreateTime);
+ LOG_POST_X(22, Info<<"CBAMDataLoader: "
+ "Total attach time: "<<s_AttachTime);
+ }
}
}
}
if ( GetDebugLevel() >= 1 ) {
- LOG_POST_X(16, "Opened BAM file "<<bam.m_BamName<<" in "<<sw.Elapsed());
+ LOG_POST_X(16, Info<<"CBAMDataLoader: "
+ "Opened BAM file "<<bam.m_BamName<<" in "<<sw.Elapsed());
}
}
if ( m_CovFileName.empty() ) {
return false;
}
+ if ( m_File->GetBamDb().UsesRawIndex() && GetPreferRawIndexOverCoverageGraphParam() ) {
+ // use more precise index information
+ return false;
+ }
try {
CRef<CSeq_entry> entry(new CSeq_entry);
CRef<CSeq_annot> annot;
CConstRef<CUser_field> outliers = params->GetFieldRef("Outliers");
double vmul = graph->GetA();
double vadd = graph->GetB();
+ double outliers_mul = 1./slot;
size_t non_zero_count = 0;
vector<double> cov(cnt);
continue;
}
if ( vg > vmax ) {
- v = GetIdField(*outliers, i).GetData().GetReal();
+ v = GetIdField(*outliers, i).GetData().GetReal()*outliers_mul;
}
else {
v = vmul*vg+vadd;
continue;
}
if ( vg > vmax ) {
- v = GetIdField(*outliers, i).GetData().GetReal();
+ v = GetIdField(*outliers, i).GetData().GetReal()*outliers_mul;
}
else {
v = vmul*vg+vadd;
TSeqPos bin_count = TSeqPos(data_sizes.size());
TSeqPos bin_size = raw_db.GetIndex().GetMinBinSize();
if ( GetDebugLevel() >= 2 ) {
- LOG_POST("Total cov: "<<accumulate(data_sizes.begin(), data_sizes.end(), Uint8(0)));
+ LOG_POST_X(26, Info<<"CBAMDataLoader:"
+ " Total cov: "<<accumulate(data_sizes.begin(), data_sizes.end(), Uint8(0)));
}
static const TSeqPos kZeroBlocks = 8;
static const TSeqPos kMaxChunkLength = 300*1024*1024;
_ASSERT(cur_data_size > 0);
TSeqPos non_zero_end = pos - zero_count*bin_size;
CBamRefSeqChunkInfo info;
- info.m_AlignCount = cur_data_size;
+ if ( GetDebugLevel() >= 3 ) {
+ LOG_POST_X(23, Info << "CBAMDataLoader:"
+ " Chunk "<<m_Chunks.size()<<
+ " Range "<<last_pos<<"-"<<
+ s_GetEnd(over_ends, i-zero_count-1, bin_size)<<
+ " size: "<<cur_data_size);
+ }
+ info.m_DataSize = cur_data_size;
info.m_RefSeqRange.SetFrom(last_pos);
info.m_RefSeqRange.SetTo(s_GetEnd(over_ends, i-zero_count-1, bin_size));
_ASSERT(info.m_RefSeqRange.GetLength() > 0);
_ASSERT(last_pos == pos-zero_count*bin_size);
_ASSERT(cur_data_size == 0);
CBamRefSeqChunkInfo info;
- info.m_AlignCount = 0;
+ info.m_DataSize = 0;
+ if ( GetDebugLevel() >= 3 ) {
+ LOG_POST_X(24, Info << "CBAMDataLoader:"
+ " Chunk "<<m_Chunks.size()<<
+ " Range "<<last_pos<<"-"<<
+ s_GetEnd(over_ends, i-zero_count, bin_size)<<
+ " size: "<<0);
+ }
info.m_RefSeqRange.SetFrom(last_pos);
info.m_RefSeqRange.SetTo(s_GetEnd(over_ends, i-zero_count, bin_size));
_ASSERT(info.m_RefSeqRange.GetLength() > 0);
{
_ASSERT(last_pos <= pos);
_ASSERT(cur_data_size > 0);
+ if ( GetDebugLevel() >= 3 ) {
+ LOG_POST_X(25, Info << "CBAMDataLoader:"
+ " Chunk "<<m_Chunks.size()<<
+ " Range "<<last_pos<<"-"<<
+ s_GetEnd(over_ends, i, bin_size)<<
+ " size: "<<cur_data_size);
+ }
CBamRefSeqChunkInfo info;
- info.m_AlignCount = cur_data_size;
+ info.m_DataSize = cur_data_size;
info.m_RefSeqRange.SetFrom(last_pos);
info.m_RefSeqRange.SetTo(s_GetEnd(over_ends, i, bin_size));
_ASSERT(info.m_RefSeqRange.GetLength() > 0);
whole_range);
split_info.AddChunk(*chunk);
if ( GetDebugLevel() >= 1 ) {
- LOG_POST_X(17, "Initialized BAM refseq "<<GetRefSeq_id()<<" in "<<sw.Elapsed());
+ LOG_POST_X(17, Info<<"CBAMDataLoader: "
+ "Initialized BAM refseq "<<GetRefSeq_id()<<" in "<<sw.Elapsed());
}
}
static const double k_make_graph_seconds = 7.5e-9; // 133 MB/s
-static const double k_make_align_seconds = 80e-9; // 12 MB/s
+static const double k_make_align_seconds = 250e-9; // 4 MB/s
static const double k_make_read_seconds = 80e-9; // 12 MB/s
CRange<TSeqPos> wide_range = m_Chunks[range_id].GetAlignRange();
int base_id = int(range_id*kChunkIdMul);
- if ( m_Chunks[range_id].GetAlignCount() ) {
+ auto align_count = m_Chunks[range_id].GetAlignCount();
+ auto data_size = m_Chunks[range_id].m_DataSize;
+ if ( align_count == 0 && data_size != 0 ) {
+ align_count = data_size / kSingleAlignBytes + 1;
+ }
+ else if ( data_size == 0 && align_count != 0 ) {
+ data_size = align_count * kSingleAlignBytes;
+ }
+ if ( align_count ) {
if ( raw_db ) {
- if ( m_Chunks[range_id].GetAlignCount() < 2*kChunkDataSize ) {
+ if ( align_count < 2*kChunkDataSize ) {
// add single chunk for in-range and overlapping aligns
- Uint8 bytes = m_Chunks[range_id].GetAlignCount();
+ Uint8 bytes = CBamFileRangeSet(raw_db->GetIndex(), refseq_index, range,
+ CBamIndex::kLevel0, CBamIndex::kMaxLevel,
+ CBamIndex::eSearchByStart).GetFileSize();
CRef<CTSE_Chunk_Info> chunk(new CTSE_Chunk_Info(base_id+eChunk_align));
chunk->x_SetLoadBytes(Uint4(min<size_t>(bytes, kMax_UI4)));
//chunk->x_SetLoadSeconds(bytes*align_seconds);
if ( GetDebugLevel() >= 2 ) {
LOG_POST_X(12, Info << "CBAMDataLoader: "<<GetRefSeq_id()<<": "
"Align Chunk "<<chunk->GetChunkId()<<": "<<wide_range<<
- " with "<<m_Chunks[range_id].GetAlignCount()<<" aligns");
+ " with "<<align_count<<" aligns");
}
}
}
if ( has_pileup ) {
CRef<CTSE_Chunk_Info> chunk(new CTSE_Chunk_Info(base_id+eChunk_pileup_graph));
if ( raw_db ) {
- Uint8 bytes = m_Chunks[range_id].GetAlignCount();
+ Uint8 bytes = data_size;
if ( !bytes ) {
// empty sequence span might load tails of previous alignmnets
// get actual data size of the tails
void CBamRefSeqInfo::LoadAlignChunk(CTSE_Chunk_Info& chunk_info)
{
CStopWatch sw;
+ CStopWatch sw1;
if ( GetDebugLevel() >= 3 ) {
sw.Start();
}
annot = ait.GetSeq_annot(m_File->GetAnnotName());
align_list = &annot->SetData().SetAlign();
}
+ if ( GetDebugLevel() >= 4 ) {
+ sw1.Start();
+ }
align_list->push_back(ait.GetMatchAlign());
short_ids.push_back(CSeq_id_Handle::GetHandle(*ait.GetShortSeq_id()));
+ if ( GetDebugLevel() >= 4 ) {
+ sw1.Stop();
+ }
}
if ( annot ) {
chunk_info.x_LoadAnnot(place, *annot);
}
{{
CMutexGuard guard(m_Seq2ChunkMutex);
+ if ( GetDebugLevel() >= 4 ) {
+ double time = sw1.Elapsed();
+ LOG_POST_X(19, Info<<"CBAMDataLoader: "
+ "Created alignments "<<GetRefSeqId()<<" @ "<<
+ chunk.GetRefSeqRange()<<": "<<
+ count<<" repl: "<<repl_count<<" fail: "<<fail_count<<
+ " skipped: "<<skipped<<" in "<<time);
+ s_CreateTime += time;
+ sw1.Reset();
+ sw1.Start();
+ }
int seq_chunk_id = range_id*kChunkIdMul+eChunk_short_seq+(sub_chunk-eChunk_align);
CRef<CTSE_Chunk_Info> seq_chunk;
ITERATE ( vector<CSeq_id_Handle>, it, short_ids ) {
seq_chunk->x_AddBioseqPlace(kTSEId);
split_info.AddChunk(*seq_chunk);
}
+ if ( GetDebugLevel() >= 4 ) {
+ double time = sw1.Elapsed();
+ s_AttachTime += time;
+ LOG_POST_X(20, Info<<"CBAMDataLoader: "
+ "Attached alignments "<<GetRefSeqId()<<" @ "<<
+ chunk.GetRefSeqRange()<<": "<<
+ count<<" repl: "<<repl_count<<" fail: "<<fail_count<<
+ " skipped: "<<skipped<<" in "<<time);
+ }
}}
if ( GetDebugLevel() >= 3 ) {
LOG_POST_X(7, Info<<"CBAMDataLoader: "
}
}
if ( seglen == 0 ) {
- ERR_POST_X(4, "Bad CIGAR length: "<<type<<"0 in "<<cigar);
+ ERR_POST_X(4, "CBAMDataLoader: Bad CIGAR length: "<<type<<"0 in "<<cigar);
break;
}
if ( type == '=' ) {
ss_pos += seglen;
}
else if ( type != 'P' ) {
- ERR_POST_X(14, "Bad CIGAR char: "<<type<<" in "<<cigar);
+ ERR_POST_X(14, "CBAMDataLoader: Bad CIGAR char: "<<type<<" in "<<cigar);
break;
}
}
-/* $Id: test_bam_loader.cpp 649787 2022-05-10 18:40:00Z vasilche $
+/* $Id: test_bam_loader.cpp 675189 2023-11-16 13:46:57Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
#define PILEUP_NAME_SUFFIX " pileup graphs"
+#define NCBI_FTP "https://ftp-ext.ncbi.nlm.nih.gov"
+
CRef<CObjectManager> sx_GetOM(void)
{
SetDiagPostLevel(eDiag_Info);
}
// CM000663.2 from
-// https://ftp.ncbi.nlm.nih.gov/toolbox/gbench/samples/udc_seqgraphic_rmt_testing/remote_BAM_remap_UUD-324/human/grch38_wgsim_gb_accs.bam
+// NCBI_FTP /toolbox/gbench/samples/udc_seqgraphic_rmt_testing/remote_BAM_remap_UUD-324/human/grch38_wgsim_gb_accs.bam
// BK006938.2 from
-// https://ftp.ncbi.nlm.nih.gov/toolbox/gbench/samples/udc_seqgraphic_rmt_testing/remote_BAM_remap_UUD-324/yeast/yeast_wgsim_gb_accs.bam
+// NCBI_FTP /toolbox/gbench/samples/udc_seqgraphic_rmt_testing/remote_BAM_remap_UUD-324/yeast/yeast_wgsim_gb_accs.bam
vector<TQuery> s_GetQueries3()
{
vector<TQuery> queries;
const size_t BAM_COUNT = 2;
string bam_name[BAM_COUNT] = {
- "https://ftp.ncbi.nlm.nih.gov/toolbox/gbench/samples/udc_seqgraphic_rmt_testing/remote_BAM_remap_UUD-324/human/grch38_wgsim_gb_accs.bam",
- "https://ftp.ncbi.nlm.nih.gov/toolbox/gbench/samples/udc_seqgraphic_rmt_testing/remote_BAM_remap_UUD-324/yeast/yeast_wgsim_gb_accs.bam"
+ NCBI_FTP "/toolbox/gbench/samples/udc_seqgraphic_rmt_testing/remote_BAM_remap_UUD-324/human/grch38_wgsim_gb_accs.bam",
+ NCBI_FTP "/toolbox/gbench/samples/udc_seqgraphic_rmt_testing/remote_BAM_remap_UUD-324/yeast/yeast_wgsim_gb_accs.bam"
};
string annot_name[BAM_COUNT] = {
"grch38_wgsim_gb_accs",
const size_t BAM_COUNT = 8;
string bam_name[BAM_COUNT] = {
- "https://ftp.ncbi.nlm.nih.gov/toolbox/gbench/samples/udc_seqgraphic_rmt_testing/remote_BAM_remap_UUD-324/human/grch38_wgsim_gb_accs.bam",
- "https://ftp.ncbi.nlm.nih.gov/toolbox/gbench/samples/udc_seqgraphic_rmt_testing/remote_BAM_remap_UUD-324/human/grch38_wgsim_mixed.bam",
- "https://ftp.ncbi.nlm.nih.gov/toolbox/gbench/samples/udc_seqgraphic_rmt_testing/remote_BAM_remap_UUD-324/human/grch38_wgsim_rs_accs.bam",
- "https://ftp.ncbi.nlm.nih.gov/toolbox/gbench/samples/udc_seqgraphic_rmt_testing/remote_BAM_remap_UUD-324/human/grch38_wgsim_short.bam",
- "https://ftp.ncbi.nlm.nih.gov/toolbox/gbench/samples/udc_seqgraphic_rmt_testing/remote_BAM_remap_UUD-324/yeast/yeast_wgsim_gb_accs.bam",
- "https://ftp.ncbi.nlm.nih.gov/toolbox/gbench/samples/udc_seqgraphic_rmt_testing/remote_BAM_remap_UUD-324/yeast/yeast_wgsim_mixed.bam",
- "https://ftp.ncbi.nlm.nih.gov/toolbox/gbench/samples/udc_seqgraphic_rmt_testing/remote_BAM_remap_UUD-324/yeast/yeast_wgsim_rs_accs.bam",
- "https://ftp.ncbi.nlm.nih.gov/toolbox/gbench/samples/udc_seqgraphic_rmt_testing/remote_BAM_remap_UUD-324/yeast/yeast_wgsim_short.bam"
+ NCBI_FTP "/toolbox/gbench/samples/udc_seqgraphic_rmt_testing/remote_BAM_remap_UUD-324/human/grch38_wgsim_gb_accs.bam",
+ NCBI_FTP "/toolbox/gbench/samples/udc_seqgraphic_rmt_testing/remote_BAM_remap_UUD-324/human/grch38_wgsim_mixed.bam",
+ NCBI_FTP "/toolbox/gbench/samples/udc_seqgraphic_rmt_testing/remote_BAM_remap_UUD-324/human/grch38_wgsim_rs_accs.bam",
+ NCBI_FTP "/toolbox/gbench/samples/udc_seqgraphic_rmt_testing/remote_BAM_remap_UUD-324/human/grch38_wgsim_short.bam",
+ NCBI_FTP "/toolbox/gbench/samples/udc_seqgraphic_rmt_testing/remote_BAM_remap_UUD-324/yeast/yeast_wgsim_gb_accs.bam",
+ NCBI_FTP "/toolbox/gbench/samples/udc_seqgraphic_rmt_testing/remote_BAM_remap_UUD-324/yeast/yeast_wgsim_mixed.bam",
+ NCBI_FTP "/toolbox/gbench/samples/udc_seqgraphic_rmt_testing/remote_BAM_remap_UUD-324/yeast/yeast_wgsim_rs_accs.bam",
+ NCBI_FTP "/toolbox/gbench/samples/udc_seqgraphic_rmt_testing/remote_BAM_remap_UUD-324/yeast/yeast_wgsim_short.bam"
};
string annot_name[BAM_COUNT] = {
"grch38_wgsim_gb_accs",
+++ /dev/null
-# $Id: CMakeLists.test_snp_loader.app.txt 621843 2020-12-17 14:02:27Z ivanov $
-
-NCBI_begin_app(test_snp_loader)
- NCBI_sources(test_snp_loader)
- NCBI_requires(Boost.Test.Included)
- NCBI_uses_toolkit_libraries(ncbi_xloader_snp ncbi_xloader_genbank)
-
- NCBI_set_test_requires(in-house-resources)
- NCBI_set_test_assets(test_snp_loader.ini)
- NCBI_add_test()
-
- NCBI_project_watchers(vasilche)
-
-NCBI_end_app()
-
+++ /dev/null
-# $Id: CMakeLists.txt 621843 2020-12-17 14:02:27Z ivanov $
-
-NCBI_add_app(test_snp_loader)
-
+++ /dev/null
-# $Id: Makefile.in 502540 2016-05-25 15:49:46Z vasilche $
-
-# Example meta-makefile; uncomment and fill out whichever of these
-# apply. (Built in the following order.)
-
-## User projects (totally custom makefiles). *USR_PROJ settings are for
-## internal tasks such as source generation, whereas *UNIX_PROJ are for
-## targets that are interesting enough in their own right to warrant
-## explicit coverage in Makefile.flat.
-# USR_PROJ =
-# UNIX_USR_PROJ =
-# UNIX_PROJ =
-# EXPENDABLE_USR_PROJ =
-# EXPENDABLE_UNIX_PROJ =
-
-## Libraries to be built as usual.
-# ASN_PROJ =
-# DTD_PROJ =
-# XSD_PROJ =
-# LIB_PROJ =
-# WSDL_PROJ =
-# EXPENDABLE_LIB_PROJ =
-
-## Applications to be built as usual.
-APP_PROJ = test_snp_loader
-# EXPENDABLE_APP_PROJ =
-
-## Subdirectories to traverse.
-# SUB_PROJ =
-# POTENTIAL_SUB_PROJ =
-# EXPENDABLE_SUB_PROJ =
-
-srcdir = @srcdir@
-include @builddir@/Makefile.meta
+++ /dev/null
-# $Id: Makefile.test_snp_loader.app 625148 2021-02-09 14:54:06Z ucko $
-
-
-APP = test_snp_loader
-SRC = test_snp_loader
-
-REQUIRES = Boost.Test.Included $(GRPC_OPT)
-
-CPPFLAGS = $(ORIG_CPPFLAGS) $(BOOST_INCLUDE)
-
-LIB = ncbi_xloader_snp $(SRAREAD_LIBS) dbsnp_ptis grpc_integration test_boost $(OBJMGR_LIBS) $(CMPRS_LIB)
-
-LIBS = $(GENBANK_THIRD_PARTY_LIBS) $(SRA_SDK_SYSLIBS) $(GRPC_LIBS) \
- $(CMPRS_LIBS) $(NETWORK_LIBS) $(ORIG_LIBS)
-
-POST_LINK = $(VDB_POST_LINK)
-
-CHECK_COPY = test_snp_loader.ini
-CHECK_CMD = test_snp_loader
-CHECK_REQUIRES = in-house-resources
-
-WATCHERS = vasilche
+++ /dev/null
-/* $Id: test_snp_loader.cpp 649791 2022-05-10 18:53:18Z vasilche $
-* ===========================================================================
-*
-* PUBLIC DOMAIN NOTICE
-* National Center for Biotechnology Information
-*
-* This software/database is a "United States Government Work" under the
-* terms of the United States Copyright Act. It was written as part of
-* the author's official duties as a United States Government employee and
-* thus cannot be copyrighted. This software/database is freely available
-* to the public for use. The National Library of Medicine and the U.S.
-* Government have not placed any restriction on its use or reproduction.
-*
-* Although all reasonable efforts have been taken to ensure the accuracy
-* and reliability of the software and data, the NLM and the U.S.
-* Government do not and cannot warrant the performance or results that
-* may be obtained by using this software or data. The NLM and the U.S.
-* Government disclaim all warranties, express or implied, including
-* warranties of performance, merchantability or fitness for any particular
-* purpose.
-*
-* Please cite the author in any work or product based on this material.
-*
-* ===========================================================================
-*
-* Author: Eugene Vasilchenko
-*
-* File Description:
-* Unit tests for SNP data loader
-*
-* ===========================================================================
-*/
-
-#include <ncbi_pch.hpp>
-#include <sra/data_loaders/snp/snploader.hpp>
-#include <objmgr/scope.hpp>
-#include <objmgr/bioseq_handle.hpp>
-#include <objmgr/graph_ci.hpp>
-#include <objmgr/feat_ci.hpp>
-#include <objmgr/seq_table_ci.hpp>
-#include <objects/seqtable/seqtable__.hpp>
-#include <objtools/data_loaders/genbank/gbloader.hpp>
-#include <sra/readers/ncbi_traces_path.hpp>
-
-#include <corelib/test_boost.hpp>
-
-#include <common/test_assert.h> /* This header must go last */
-
-USING_NCBI_SCOPE;
-USING_SCOPE(objects);
-
-static string s_LoaderName;
-
-enum ESNPSource {
- eFromGB,
- eFromSNP
-};
-
-static
-CRef<CScope> s_MakeScope0()
-{
- CRef<CObjectManager> om = CObjectManager::GetInstance();
- CGBDataLoader::RegisterInObjectManager(*om);
- CRef<CScope> scope(new CScope(*om));
- scope->AddDefaults();
- return scope;
-}
-
-
-static
-CRef<CScope> s_MakeScope(const string& file_name = kEmptyStr)
-{
- CRef<CObjectManager> om = CObjectManager::GetInstance();
- CGBDataLoader::RegisterInObjectManager(*om);
- if ( !s_LoaderName.empty() ) {
- om->RevokeDataLoader(s_LoaderName);
- s_LoaderName.erase();
- }
- if ( file_name.empty() ) {
- s_LoaderName =
- CSNPDataLoader::RegisterInObjectManager(*om)
- .GetLoader()->GetName();
- BOOST_CHECK_EQUAL(s_LoaderName, CSNPDataLoader::GetLoaderNameFromArgs());
- }
- else {
- s_LoaderName =
- CSNPDataLoader::RegisterInObjectManager(*om, file_name)
- .GetLoader()->GetName();
- BOOST_CHECK_EQUAL(s_LoaderName, CSNPDataLoader::GetLoaderNameFromArgs(file_name));
- }
- CRef<CScope> scope(new CScope(*om));
- scope->AddDefaults();
- scope->AddDataLoader(s_LoaderName);
- return scope;
-}
-
-
-static
-void s_CheckSource(const string& descr,
- ESNPSource source,
- const set<CTSE_Handle>& tse_set)
-{
- BOOST_CHECK_EQUAL(tse_set.size(), 1u);
- for ( auto& tse : tse_set ) {
- LOG_POST(descr<<": blob id: "<<tse.GetBlobId());
- if ( source == eFromGB ) {
- BOOST_CHECK(dynamic_cast<CGBDataLoader*>(tse.GetDataLoader()));
- }
- else {
- BOOST_CHECK(dynamic_cast<CSNPDataLoader*>(tse.GetDataLoader()));
- }
- }
-}
-
-
-static
-void s_CheckSource(const string& descr,
- ESNPSource source,
- CFeat_CI feat_it)
-{
- set<CTSE_Handle> tse_set;
- for ( ; feat_it; ++feat_it ) {
- tse_set.insert(feat_it.GetAnnot().GetTSE_Handle());
- }
- s_CheckSource(descr, source, tse_set);
-}
-
-
-static
-void s_CheckSource(const string& descr,
- ESNPSource source,
- CGraph_CI graph_it)
-{
- set<CTSE_Handle> tse_set;
- for ( ; graph_it; ++graph_it ) {
- tse_set.insert(graph_it.GetAnnot().GetTSE_Handle());
- }
- s_CheckSource(descr, source, tse_set);
-}
-
-
-static
-size_t s_CheckFeat(CRef<CScope> scope,
- const SAnnotSelector& sel,
- const string& str_id,
- CRange<TSeqPos> range = CRange<TSeqPos>::GetWhole())
-{
- size_t ret = 0;
- CRef<CSeq_id> seq_id(new CSeq_id(str_id));
- CRef<CSeq_loc> loc(new CSeq_loc);
- if ( range == CRange<TSeqPos>::GetWhole() ) {
- loc->SetWhole(*seq_id);
- }
- else {
- CSeq_interval& interval = loc->SetInt();
- interval.SetId(*seq_id);
- interval.SetFrom(range.GetFrom());
- interval.SetTo(range.GetTo());
- }
- {
- CFeat_CI it(*scope, *loc, sel);
- ret += it.GetSize();
- BOOST_CHECK(it);
- }
-
- CBioseq_Handle bh = scope->GetBioseqHandle(*seq_id);
- BOOST_REQUIRE(bh);
- {
- CFeat_CI it(bh, range, sel);
- ret += it.GetSize();
- BOOST_CHECK(it);
- }
- return ret;
-}
-
-
-static
-void s_CheckNoFeat(CRef<CScope> scope,
- const SAnnotSelector& sel,
- const string& str_id,
- CRange<TSeqPos> range = CRange<TSeqPos>::GetWhole())
-{
- CRef<CSeq_id> seq_id(new CSeq_id(str_id));
- CRef<CSeq_loc> loc(new CSeq_loc);
- if ( range == CRange<TSeqPos>::GetWhole() ) {
- loc->SetWhole(*seq_id);
- }
- else {
- CSeq_interval& interval = loc->SetInt();
- interval.SetId(*seq_id);
- interval.SetFrom(range.GetFrom());
- interval.SetTo(range.GetTo());
- }
- {
- CFeat_CI it(*scope, *loc, sel);
- BOOST_CHECK(!it);
- }
-
- CBioseq_Handle bh = scope->GetBioseqHandle(*seq_id);
- BOOST_REQUIRE(bh);
- {
- CFeat_CI it(bh, range, sel);
- BOOST_CHECK(!it);
- }
-}
-
-
-static
-void s_TestNoNA(const string& descr,
- const string& na_acc,
- CBioseq_Handle bh, TSeqPos range_from, TSeqPos range_to)
-{
- if ( 1 ) {
- SAnnotSelector sel(CSeqFeatData::eSubtype_variation);
- sel.AddNamedAnnots(na_acc);
- sel.IncludeNamedAnnotAccession(na_acc);
- CFeat_CI feat_it(bh, CRange<TSeqPos>(range_from, range_to), sel);
- if ( feat_it ) {
- s_CheckSource(descr, eFromGB, feat_it);
- }
- }
- if ( 1 ) {
- SAnnotSelector sel;
- sel.AddNamedAnnots(na_acc);
- sel.IncludeNamedAnnotAccession(na_acc);
- CGraph_CI graph_it(bh, CRange<TSeqPos>(range_from, range_to), sel);
- if ( graph_it ) {
- s_CheckSource(descr, eFromGB, graph_it);
- }
- }
-}
-
-
-static
-void s_TestNA(const string& descr,
- ESNPSource source,
- const string& na_acc,
- CBioseq_Handle bh, TSeqPos range_from, TSeqPos range_to,
- size_t snp_count)
-{
- if ( 1 ) { // check features
- SAnnotSelector sel(CSeqFeatData::eSubtype_variation);
- sel.AddNamedAnnots(na_acc);
- sel.IncludeNamedAnnotAccession(na_acc);
- CFeat_CI feat_it(bh, CRange<TSeqPos>(range_from, range_to), sel);
- BOOST_CHECK(feat_it);
- BOOST_CHECK_EQUAL(feat_it.GetSize(), snp_count);
- s_CheckSource(descr, source, feat_it);
- }
- if ( 1 ) { // check coverage graphs
- SAnnotSelector sel;
- string graph_na_acc = CombineWithZoomLevel(na_acc, 100);
- sel.AddNamedAnnots(graph_na_acc);
- sel.IncludeNamedAnnotAccession(graph_na_acc);
- CGraph_CI graph_it(bh, CRange<TSeqPos>(range_from, range_to), sel);
- BOOST_CHECK(graph_it);
- s_CheckSource(descr, source, graph_it);
- }
- if ( 1 ) { // check overview graphs
- SAnnotSelector sel;
- string graph_na_acc = CombineWithZoomLevel(na_acc, 5000);
- sel.AddNamedAnnots(graph_na_acc);
- sel.IncludeNamedAnnotAccession(graph_na_acc);
- CGraph_CI graph_it(bh, CRange<TSeqPos>(range_from, range_to), sel);
- BOOST_CHECK(graph_it);
- s_CheckSource(descr, source, graph_it);
- }
-}
-
-
-static
-void s_TestPTIS(const string& descr,
- ESNPSource source,
- CBioseq_Handle bh, TSeqPos range_from, TSeqPos range_to,
- size_t snp_count)
-{
- if ( 1 ) { // check features
- SAnnotSelector sel(CSeqFeatData::eSubtype_variation);
- sel.IncludeNamedAnnotAccession("SNP");
- sel.AddNamedAnnots("SNP");
- CFeat_CI feat_it(bh, CRange<TSeqPos>(range_from, range_to), sel);
- BOOST_CHECK(feat_it);
- BOOST_CHECK_GE(feat_it.GetSize(), snp_count);
- BOOST_CHECK_LT(feat_it.GetSize(), snp_count*2);
- s_CheckSource(descr, source, feat_it);
- }
- if ( 1 ) { // check coverage graphs
- SAnnotSelector sel;
- string graph_na_acc = CombineWithZoomLevel("SNP", 100);
- sel.AddNamedAnnots(graph_na_acc);
- sel.IncludeNamedAnnotAccession(graph_na_acc);
- CGraph_CI graph_it(bh, CRange<TSeqPos>(range_from, range_to), sel);
- BOOST_CHECK(graph_it);
- s_CheckSource(descr, source, graph_it);
- }
- if ( 1 ) { // check overview graphs
- SAnnotSelector sel;
- sel.AddNamedAnnots("SNP");
- sel.IncludeNamedAnnotAccession("SNP");
- CGraph_CI graph_it(bh, CRange<TSeqPos>(range_from, range_to), sel);
- BOOST_CHECK(graph_it);
- s_CheckSource(descr, source, graph_it);
- }
-}
-
-
-BOOST_AUTO_TEST_CASE(GBImplicitNA)
-{
- CRef<CScope> scope = s_MakeScope0();
- string na_acc = "NA000124713.8#1";
- string na_acc2 = "NA000193272.4#17";
- string seq_id = "NC_000001.11";
- TSeqPos range_from = 0;
- TSeqPos range_to = 100000;
- size_t snp_count = 8894;
- size_t snp_count2 = 16587;
-
- CBioseq_Handle bh = scope->GetBioseqHandle(CSeq_id_Handle::GetHandle(seq_id));
- BOOST_REQUIRE(bh);
-
- s_TestNA("GBImplicitNA 1", eFromGB, na_acc, bh, range_from, range_to, snp_count);
- s_TestNA("GBImplicitNA 2", eFromGB, na_acc2, bh, range_from, range_to, snp_count2);
-}
-
-
-BOOST_AUTO_TEST_CASE(GBImplicitSNP)
-{
- CRef<CScope> scope = s_MakeScope0();
- string seq_id = "NC_000001.11";
- TSeqPos range_from = 0;
- TSeqPos range_to = 100000;
- size_t snp_count = 17889;
-
- string seq_id2 = "NC_000007";
- TSeqPos range_from2 = 1000000;
- TSeqPos range_to2 = 1100000;
- size_t snp_count2 = 34431;
-
- CBioseq_Handle bh = scope->GetBioseqHandle(CSeq_id_Handle::GetHandle(seq_id));
- BOOST_REQUIRE(bh);
- CBioseq_Handle bh2 = scope->GetBioseqHandle(CSeq_id_Handle::GetHandle(seq_id2));
- BOOST_REQUIRE(bh2);
-
- s_TestPTIS("GBImplicitSNP 1", eFromGB, bh, range_from, range_to, snp_count);
- s_TestPTIS("GBImplicitSNP 2", eFromGB, bh2, range_from2, range_to2, snp_count2);
-}
-
-
-BOOST_AUTO_TEST_CASE(SNPExplicitNA)
-{
- string na_acc = "NA000124713.8#1";
- string na_acc2 = "NA000193272.4#17";
- CRef<CScope> scope = s_MakeScope(na_acc);
- string seq_id = "NC_000001.11";
- TSeqPos range_from = 0;
- TSeqPos range_to = 100000;
- size_t snp_count = 8894;
-
- CBioseq_Handle bh = scope->GetBioseqHandle(CSeq_id_Handle::GetHandle(seq_id));
- BOOST_REQUIRE(bh);
-
- s_TestNA("SNPExplicitNA 1", eFromSNP, na_acc, bh, range_from, range_to, snp_count);
- s_TestNoNA("SNPExplicitNA 2", na_acc2, bh, range_from, range_to);
-}
-
-
-BOOST_AUTO_TEST_CASE(SNPImplicitNA)
-{
- CRef<CScope> scope = s_MakeScope();
- string na_acc = "NA000124713.8#1";
- string na_acc2 = "NA000193272.4#17";
- string seq_id = "NC_000001.11";
- TSeqPos range_from = 0;
- TSeqPos range_to = 100000;
- size_t snp_count = 8894;
- size_t snp_count2 = 16587;
-
- CBioseq_Handle bh = scope->GetBioseqHandle(CSeq_id_Handle::GetHandle(seq_id));
- BOOST_REQUIRE(bh);
-
- s_TestNA("SNPImplicitNA 1", eFromSNP, na_acc, bh, range_from, range_to, snp_count);
- s_TestNA("SNPImplicitNA 2", eFromSNP, na_acc2, bh, range_from, range_to, snp_count2);
-}
-
-
-BOOST_AUTO_TEST_CASE(SNPImplicitSNP)
-{
- CRef<CScope> scope = s_MakeScope();
- string seq_id = "NC_000001.11";
- TSeqPos range_from = 0;
- TSeqPos range_to = 100000;
- size_t snp_count = 29766; // new PTIS version - NA000305581.1#17
- // old was NA000193272.8#17 and had 23474 SNPs in this case
- // old was NA000193272.7#17 and had 17889 SNPs in this case
-
- string seq_id2 = "NC_000007";
- TSeqPos range_from2 = 1000000;
- TSeqPos range_to2 = 1100000;
- size_t snp_count2 = 49002; // new PTIS version - NA000305581.1#17
- // old was NA000193272.8#17 and had 44657 SNPs in this case
- // old was NA000193272.7#17 and had 34431 SNPs in this case
-
- CBioseq_Handle bh = scope->GetBioseqHandle(CSeq_id_Handle::GetHandle(seq_id));
- BOOST_REQUIRE(bh);
- CBioseq_Handle bh2 = scope->GetBioseqHandle(CSeq_id_Handle::GetHandle(seq_id2));
- BOOST_REQUIRE(bh2);
-
- s_TestPTIS("SNPImplicitSNP 1", eFromSNP, bh, range_from, range_to, snp_count);
- s_TestPTIS("SNPImplicitSNP 2", eFromSNP, bh2, range_from2, range_to2, snp_count2);
-}
-
-
-BOOST_AUTO_TEST_CASE(CheckExtSNPEditChangeId)
-{
- LOG_POST("Checking ExtAnnot SNP for sequence with changed ids");
- string id = "NM_004006.2";
- string dummy_id = "lcl|dummy";
-
- SAnnotSelector sel(CSeqFeatData::eSubtype_variation);
- sel.SetResolveAll().SetAdaptiveDepth();
- sel.IncludeNamedAnnotAccession("SNP");
- sel.AddNamedAnnots("SNP");
- CRef<CScope> scope = s_MakeScope();
- scope->SetKeepExternalAnnotsForEdit();
- CBioseq_Handle bh = scope->GetBioseqHandle(CSeq_id_Handle::GetHandle(id));
- BOOST_REQUIRE(bh);
- CBioseq_EditHandle bhe = bh.GetEditHandle();
- BOOST_REQUIRE(bh);
- BOOST_REQUIRE(bhe);
- size_t count = s_CheckFeat(scope, sel, id);
- vector<CSeq_id_Handle> ids = bhe.GetId();
- bhe.ResetId();
- bhe.AddId(CSeq_id_Handle::GetHandle(dummy_id));
- s_CheckNoFeat(scope, sel, dummy_id);
- for ( auto idh : ids ) {
- bhe.AddId(idh);
- }
- BOOST_CHECK_EQUAL(s_CheckFeat(scope, sel, dummy_id), count);
-}
-
-
-BOOST_AUTO_TEST_CASE(GBImplicitNA64)
-{
- CRef<CScope> scope = s_MakeScope0();
- string na_acc = "NA000306983.1#1";
- string seq_id = "2500000194";
- TSeqPos range_from = 0;
- TSeqPos range_to = 100000;
- size_t snp_count = 1;
-
- CBioseq_Handle bh = scope->GetBioseqHandle(CSeq_id_Handle::GetHandle(seq_id));
- BOOST_REQUIRE(bh);
-
- s_TestNA("GBImplicitNA 1", eFromGB, na_acc, bh, range_from, range_to, snp_count);
-}
-
-
-BOOST_AUTO_TEST_CASE(GBImplicitSNP64)
-{
- CRef<CScope> scope = s_MakeScope0();
- string seq_id = "2500000194";
- TSeqPos range_from = 0;
- TSeqPos range_to = 100000;
- size_t snp_count = 1;
-
- string seq_id2 = "CM029356.1";
- TSeqPos range_from2 = 0;
- TSeqPos range_to2 = 100000;
- size_t snp_count2 = 1;
-
- CBioseq_Handle bh = scope->GetBioseqHandle(CSeq_id_Handle::GetHandle(seq_id));
- BOOST_REQUIRE(bh);
- CBioseq_Handle bh2 = scope->GetBioseqHandle(CSeq_id_Handle::GetHandle(seq_id2));
- BOOST_REQUIRE(bh2);
-
- s_TestPTIS("GBImplicitSNP 1", eFromGB, bh, range_from, range_to, snp_count);
- s_TestPTIS("GBImplicitSNP 2", eFromGB, bh2, range_from2, range_to2, snp_count2);
-}
-
-
-BOOST_AUTO_TEST_CASE(SNPExplicitNA64)
-{
- string na_acc = "NA000306983.1#1";
- string na_acc2 = "NA000306983.1#3";
- CRef<CScope> scope = s_MakeScope(na_acc);
- string seq_id = "2500000194";
- TSeqPos range_from = 0;
- TSeqPos range_to = 100000;
- size_t snp_count = 1;
-
- CBioseq_Handle bh = scope->GetBioseqHandle(CSeq_id_Handle::GetHandle(seq_id));
- BOOST_REQUIRE(bh);
-
- s_TestNA("SNPExplicitNA 1", eFromSNP, na_acc, bh, range_from, range_to, snp_count);
- s_TestNoNA("SNPExplicitNA 2", na_acc2, bh, range_from, range_to);
-}
-
-
-BOOST_AUTO_TEST_CASE(SNPImplicitNA64)
-{
- CRef<CScope> scope = s_MakeScope();
- string na_acc = "NA000306983.1#1";
- string na_acc2 = "NA000306983.1#3";
- string seq_id = "2500000194";
- TSeqPos range_from = 0;
- TSeqPos range_to = 100000;
- size_t snp_count = 1;
-
- CBioseq_Handle bh = scope->GetBioseqHandle(CSeq_id_Handle::GetHandle(seq_id));
- BOOST_REQUIRE(bh);
-
- s_TestNA("SNPImplicitNA 1", eFromSNP, na_acc, bh, range_from, range_to, snp_count);
- s_TestNoNA("SNPImplicitNA 2", na_acc2, bh, range_from, range_to);
-}
-
-
-BOOST_AUTO_TEST_CASE(SNPImplicitSNP64)
-{
- CRef<CScope> scope = s_MakeScope();
- string seq_id = "2500000194";
- TSeqPos range_from = 0;
- TSeqPos range_to = 100000;
- size_t snp_count = 1;
-
- CBioseq_Handle bh = scope->GetBioseqHandle(CSeq_id_Handle::GetHandle(seq_id));
- BOOST_REQUIRE(bh);
-
- s_TestPTIS("SNPImplicitSNP 1", eFromSNP, bh, range_from, range_to, snp_count);
-}
-
-
-NCBITEST_INIT_TREE()
-{
- if ( !CSNPDataLoader::IsUsingPTIS() ) {
- NCBITEST_DISABLE(SNPImplicitSNP);
- NCBITEST_DISABLE(SNPImplicitSNP64);
- }
-#if defined(NCBI_INT4_GI) || 1
- NCBITEST_DISABLE(GBImplicitNA64);
- NCBITEST_DISABLE(GBImplicitSNP64);
- NCBITEST_DISABLE(SNPExplicitNA64);
- NCBITEST_DISABLE(SNPImplicitNA64);
- NCBITEST_DISABLE(SNPImplicitSNP64);
-#endif
-}
+++ /dev/null
-[genbank]
-#vdb_snp=1
-[genbank/id2]
-#service = ID2_SNP2
-/* $Id: bgzf.cpp 668513 2023-06-06 20:11:40Z vasilche $
+/* $Id: bgzf.cpp 674299 2023-10-23 19:56:29Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
CBGZFFile::~CBGZFFile()
{
if ( s_GetDebug() >= 1 ) {
- auto stat = GetReadStatistics();
+ auto stat = GetUncompressStatistics();
if ( stat.first ) {
LOG_POST("BGZF: Total decompressed "<<stat.first/double(1<<20)<<" MB"
" speed: "<<stat.first/(stat.second*(1<<20))<<" MB/s"
-/* $Id: vdbread.cpp 673881 2023-10-12 13:17:17Z ivanov $
+/* $Id: vdbread.cpp 681697 2024-04-12 12:53:38Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
}
+NCBI_PARAM_DECL(bool, VDB, DISABLE_PAGEMAP_THREAD);
+NCBI_PARAM_DEF(bool, VDB, DISABLE_PAGEMAP_THREAD, false);
+
+
DEFINE_SRA_REF_TRAITS(VDBManager, const);
DEFINE_SRA_REF_TRAITS(VDatabase, const);
CVFSManager vfs_mgr(*this);
VFSManagerLogNamesServiceErrors(vfs_mgr, false);
s_InitLocalKNS(CKNSManager(vfs_mgr));
+ if ( NCBI_PARAM_TYPE(VDB, DISABLE_PAGEMAP_THREAD)().Get() ) {
+ VDBManagerDisablePagemapThread(*this);
+ }
}
-/* $Id: wgsread.cpp 669671 2023-07-07 12:52:48Z ivanov $
+/* $Id: wgsread.cpp 682492 2024-05-01 12:45:28Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
return NCBI_gb_state_eWGSGenBankReplaced;
}
CVDBMgr::CRequestContextUpdater ctx_updater;
- return m_Cur->m_GB_STATE? *m_Cur->GB_STATE(m_CurrId): m_Db->GetProjectGBState();
+ NCBI_gb_state state = 0;
+ if ( m_Cur->m_GB_STATE ) {
+ state = *m_Cur->GB_STATE(m_CurrId);
+ }
+ if ( !state ) {
+ state = m_Db->GetProjectGBState();
+ }
+ return state;
}
x_CheckValid("CWGSScaffoldIterator::GetGBState");
CVDBMgr::CRequestContextUpdater ctx_updater;
- return m_Cur->m_GB_STATE? *m_Cur->GB_STATE(m_CurrId): m_Db->GetProjectGBState();
+ NCBI_gb_state state = 0;
+ if ( m_Cur->m_GB_STATE ) {
+ state = *m_Cur->GB_STATE(m_CurrId);
+ }
+ if ( !state ) {
+ state = m_Db->GetProjectGBState();
+ }
+ return state;
}
x_CheckValid("CWGSProteinIterator::GetGBState");
x_Cur();
CVDBMgr::CRequestContextUpdater ctx_updater;
- return m_Cur->m_GB_STATE? *m_Cur->GB_STATE(m_CurrId): m_Db->GetProjectGBState();
+ NCBI_gb_state state = 0;
+ if ( m_Cur->m_GB_STATE ) {
+ state = *m_Cur->GB_STATE(m_CurrId);
+ }
+ if ( !state ) {
+ state = m_Db->GetProjectGBState();
+ }
+ return state;
}
-/* $Id: stream_source.cpp 542800 2017-08-02 18:30:15Z lavr $
+/* $Id: stream_source.cpp 680708 2024-03-26 13:05:01Z ivanov $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
}
-CInputStreamSource& CInputStreamSource::operator++()
+void CInputStreamSource::x_Reset()
{
// The next stream can be held in either of two places. Clear both.
// but someday might apply to others, so clear it here rather than
// inside the above conditionals.
m_CurrFile.erase();
+}
- // Advance to the next stream, if there is any.
+void CInputStreamSource::x_OpenNextFile()
+{
if (m_CurrIndex < m_Files.size()) {
m_CurrFile = m_Files[m_CurrIndex++];
- m_IstrOwned.reset(new CNcbiIfstream(m_CurrFile.c_str()));
- if (m_IstrOwned->fail()) {
- // Do not provide to clients with streams that are already
- // known not to be good (fail, meaning badbit or failbit).
- string msg("CInputStreamSource::operator++(): "
- "File is not accessible: ");
- NCBI_THROW(CException, eUnknown, msg + m_CurrFile);
- }
+ x_OpenOwnedStream(new CNcbiIfstream(m_CurrFile.c_str()));
+ }
+}
+
+void CInputStreamSource::x_OpenOwnedStream(CNcbiIstream *is)
+{
+ if (is->fail()) {
+ // Do not provide to clients with streams that are already
+ // known not to be good (fail, meaning badbit or failbit).
+ string msg("CInputStreamSource: File is not accessible: ");
+ NCBI_THROW(CException, eUnknown, msg + m_CurrFile);
}
+ m_IstrOwned.reset(is);
+}
+
+CInputStreamSource& CInputStreamSource::operator++()
+{
+ x_Reset();
+ x_OpenNextFile();
+ return *this;
+}
+
+CInputStreamSource& CInputStreamSource::JumpToFile(unsigned index)
+{
+ x_Reset();
+
+ m_CurrIndex = index;
+ x_OpenNextFile();
return *this;
}
-/* $Id: unicode.cpp 619576 2020-11-06 16:13:14Z gouriano $
+/* $Id: unicode.cpp 675397 2023-11-20 22:22:17Z ivanov $
* ==========================================================================
*
* PUBLIC DOMAIN NOTICE
if (result) {
*result = eConvertedFine;
}
- if ( !src ) return 0;
+ if ( !src ) return kEmptyStr;
string dst;
size_t srcPos = 0;
size_t srcLen = strlen( src );
-/* $Id: unicode_plans.inl 663165 2023-02-14 15:12:45Z grichenk $
+/* $Id: unicode_plans.inl 677938 2024-01-25 18:09:49Z ivanov $
* ==========================================================================
*
* PUBLIC DOMAIN NOTICE
{ 0, eString }, // U+2040
{ "insertion mark", eString }, // old dictionary U+2041
{ 0, eString }, // U+2042
- { " rectangle", eString }, // old dictionary U+2043
+ { "-", eString }, // old dictionary U+2043
{ 0, eString }, // U+2044
{ 0, eString }, // U+2045
{ 0, eString }, // U+2046
0x2040
0x2041, "insertion mark"
0x2042
-0x2043, " rectangle"
+0x2043, "-"
0x2044
0x2045
0x2046