本文整理匯總了C++中ErrPostEx函數的典型用法代碼示例。如果您正苦於以下問題:C++ ErrPostEx函數的具體用法?C++ ErrPostEx怎麽用?C++ ErrPostEx使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了ErrPostEx函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: Misc_GetAccession
/* returns an accession from Bioseq; allocates memory! */
CharPtr LIBCALL Misc_GetAccession(BioseqPtr pbs)
{
SeqIdPtr psi = NULL;
SeqIdPtr psiThis = NULL;
TextSeqIdPtr ptsi = NULL;
CharPtr pacc = NULL;
/* SK: NULL ptr check */
if (pbs == NULL)
{
ErrPostEx(SEV_ERROR,0,0, "Misc_GetAccession: NULL pbs.");
return NULL;
}
psi = pbs->id;
if (psi == NULL)
{
ErrPostEx(SEV_ERROR,0,0, "Misc_GetAccession: NULL Seq-id pointer.");
return NULL;
}
psiThis = psi;
while (psiThis != NULL)
{
if ((psiThis->choice == SEQID_GENBANK) ||
(psiThis->choice == SEQID_EMBL) ||
(psiThis->choice == SEQID_PIR) ||
(psiThis->choice == SEQID_SWISSPROT) ||
(psiThis->choice == SEQID_OTHER) ||
(psiThis->choice == SEQID_DDBJ) ||
(psiThis->choice == SEQID_PRF))
{
ptsi = psiThis->data.ptrvalue;
if (ptsi == NULL)
{
ErrPostEx(SEV_ERROR,0,0, "Misc_GetAccession: NULL TextSeq-id pointer.");
return FALSE;
}
if (ptsi->accession != NULL)
{
pacc = StrSave(ptsi->accession);
return pacc;
}
else
{
ErrPostEx(SEV_ERROR,0,0, "Misc_GetAccession: NULL pointer to accession.");
return NULL;
}
}
psiThis = psiThis->next;
}
return NULL;
}
示例2: BlastFormattingInfoNew
Int2 BlastFormattingInfoNew(EAlignView align_view,
const SBlastOptions* search_options,
const char* program_name, const char* db_name,
const char* outfile_name,
BlastFormattingInfo* *info_ptr)
{
BlastFormattingInfo* info;
if (!outfile_name || !info_ptr || !search_options ||
align_view >= eAlignViewMax)
return -1;
info = *info_ptr =
(BlastFormattingInfo*) calloc(1, sizeof(BlastFormattingInfo));
s_BlastFormattingOptionsNew(search_options->program, align_view,
&info->format_options);
info->search_options = search_options;
info->program_name = strdup(program_name);
if (db_name)
info->db_name = strdup(db_name);
if (align_view != eAlignViewXml && align_view < eAlignViewAsnText) {
FILE* outfp;
if ((outfp = FileOpen(outfile_name, "w")) == NULL)
{
ErrPostEx(SEV_WARNING, 0, 0, "Unable to open output file %s:", outfile_name);
return -1;
}
info->outfp = outfp;
} else {
char write_mode[3];
/* AsnIoOpen requires a non-const argument, so use a local variable. */
char* filename_copy = strdup(outfile_name);
if (align_view == eAlignViewXml)
strcpy(write_mode, "wx");
else if (align_view == eAlignViewAsnText)
strcpy(write_mode, "w");
else
strcpy(write_mode, "wb");
if ((info->aip = AsnIoOpen(filename_copy, write_mode)) == NULL)
{
ErrPostEx(SEV_WARNING, 0, 0, "Unable to open output file %s:", filename_copy);
return -1;
}
sfree(filename_copy);
}
info->is_seqalign_null = TRUE; /* will be updated in BLAST_FormatResults */
info->head_on_every_query = FALSE; /* One header for a file is the default. */
return 0;
}
示例3: DB_ReplaceTaxRec
/* Replace an SLRI-Taxon record in the database */
Int2 DB_ReplaceTaxRec(SLRITaxonPtr stp)
{
Int4 bsLength=0;
pABL Asnbuflen=NULL;
Int4 taxid;
CharPtr asn1;
SQLHANDLE hstmt;
CharPtr update = "update seqhound.taxdb set asn1=? where taxid = ?";
if(stp == NULL) {
ErrPostEx(SEV_INFO, 3, 0, "DB_WriteTaxRec: Passed ASN.1 pointer is null.");
return(-1);
}
CreateHandle(&hstmt,update,&henv,&hdbc);
/*get the asn1 bioseq into a bytestore pointer so that we can put it into a buffer.*/
Asnbuflen = AssignASNMemChar((Pointer) stp, (AsnWriteFunc) SLRITaxonAsnWrite);
/* SK: NULL ptr check */
if(Asnbuflen == NULL) {
ErrPostEx(SEV_INFO, 3, 0, "DB_ReplaceTaxRec: NULL Asnbuflen.");
return(-1);
}
asn1 = Asnbuflen->buf;
bsLength = Asnbuflen->len;
/*set up the input parameters */
SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_DEFAULT,SQL_BLOB, 0, 0, asn1, 0, (long*)&bsLength);
SQLBindParameter(hstmt, 2, SQL_PARAM_INPUT, SQL_C_LONG,SQL_INTEGER, 0, 0, &taxid, 0, NULL);
taxid = stp->taxId;
/* execute statment */
if (SQLExecute (hstmt) != SQL_SUCCESS){
ErrPostEx(SEV_ERROR,0,0, "DB_ReplaceTax: unable to execute insert statement. ");
print_err(hstmt);
return FALSE;
}
asn1 = MemFree(asn1);
/* pABLtmp->buf = MemFree(pABLtmp->buf);*/
FreeABL(Asnbuflen);
if(SQLFreeStmt(hstmt, SQL_DROP) != SQL_SUCCESS){
print_err(hstmt);
return FALSE;
}
return TRUE;
}
示例4: DB_GetTaxMergedNodeRecNewTIDByOldTID
/* Get a new Tax ID given an old Tax ID from the merged node database */
Int4 DB_GetTaxMergedNodeRecNewTIDByOldTID(Int4 oldTaxId)
{
CharPtr search_mergeddb = "select new_taxid from seqhound.mergedtaxdb where old_taxid=?";
SQLHANDLE hstmt;
Int4 new_value = -1;
Int2 sqlrc=SQL_SUCCESS;
struct{
Int4 len;
Int4 val;
}new_id;
/* search merged db*/
CreateHandle(&hstmt,search_mergeddb,&henv, &hdbc);
SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_LONG,SQL_INTEGER, 0, 0, &oldTaxId, 0, NULL);
/* set auto commit on */
SQLSetConnectAttr( hdbc, SQL_ATTR_AUTOCOMMIT, (SQLPOINTER)SQL_AUTOCOMMIT_ON, SQL_NTS);
/* execute statment */
if (SQLExecute(hstmt) != SQL_SUCCESS){
ErrPostEx(SEV_ERROR,0,0,"DB_GetTaxMergedNodeRecNewTIDByOldTID:unable to execute select statement.");
print_err(hstmt);
SQLFreeStmt(hstmt, SQL_DROP);
return FALSE;
}
SQLBindCol(hstmt,1,SQL_C_LONG,&new_id.val,10,(long*)&new_id.len);
sqlrc = SQLFetch(hstmt);
if(sqlrc == SQL_NO_DATA_FOUND){
ErrPostEx(SEV_INFO, 0, 0, "Old Tax ID: %ld not found in Mergedtaxdb.", oldTaxId);
return(-1);
}
else if(sqlrc == SQL_SUCCESS || sqlrc == SQL_SUCCESS_WITH_INFO){
new_value = new_id.val;
}
else{
print_err(hstmt);
return (-1);
}
/* Free statement handle. */
if(SQLFreeStmt(hstmt, SQL_DROP) != SQL_SUCCESS){
print_err(hstmt);
return (-1);
}
return(new_value);
}
示例5: Misc_GetVersion
/* returns accession version from Bioseq */
Int2 LIBCALL Misc_GetVersion(BioseqPtr pbs)
{
SeqIdPtr psi = NULL;
SeqIdPtr psiThis = NULL;
TextSeqIdPtr ptsi = NULL;
/* SK: NULL ptr check */
if (pbs == NULL)
{
ErrPostEx(SEV_ERROR,0,0, "Misc_GetVersion: NULL pbs.");
return INT2_MIN;
}
psi = pbs->id;
if (psi == NULL)
{
ErrPostEx(SEV_ERROR,0,0, "Misc_GetVersion: NULL Seq-id pointer.");
return INT2_MIN;
}
psiThis = psi;
while (psiThis != NULL)
{
if ((psiThis->choice == SEQID_GENBANK) ||
(psiThis->choice == SEQID_EMBL) ||
(psiThis->choice == SEQID_PIR) ||
(psiThis->choice == SEQID_SWISSPROT) ||
(psiThis->choice == SEQID_OTHER) ||
(psiThis->choice == SEQID_DDBJ) ||
(psiThis->choice == SEQID_PRF))
{
ptsi = psiThis->data.ptrvalue;
if (ptsi == NULL)
{
ErrPostEx(SEV_ERROR,0,0, "Misc_GetVersion: NULL TextSeq-id pointer.");
return FALSE;
}
if (ptsi->version != INT2_MIN)
return ptsi->version;
else
{
ErrPostEx(SEV_ERROR,0,0, "Misc_GetVersion: No version.");
return INT2_MIN;
}
}
psiThis = psiThis->next;
}
return INT2_MIN;
}
示例6: Nlm_GetElapsedTime
NLM_EXTERN Nlm_FloatHi Nlm_GetElapsedTime(Nlm_StopWatchPtr pSW)
{
Nlm_FloatHi res = 0;
#if defined(WIN32)
FILETIME ft;
if (pSW->start.dwLowDateTime > pSW->stop.dwLowDateTime) {
ft.dwLowDateTime = (0xFFFFFFFFL - pSW->start.dwLowDateTime) + 1
+ pSW->stop.dwLowDateTime;
ft.dwHighDateTime =
pSW->stop.dwHighDateTime - pSW->start.dwHighDateTime - 1;
} else {
ft.dwLowDateTime =
pSW->stop.dwLowDateTime - pSW->start.dwLowDateTime;
ft.dwHighDateTime =
pSW->stop.dwHighDateTime - pSW->start.dwHighDateTime;
}
return res = (Nlm_FloatHi)ft.dwHighDateTime/5000000L*0x80000000L +
(Nlm_FloatHi)ft.dwLowDateTime/10000000L;
#elif defined(OS_UNIX)
res = ((Nlm_FloatHi)pSW->stop - pSW->start) / pSW->rate;
#else
ErrPostEx(SEV_WARNING, 0, 0,
"StopWatch is not implemented for this platform");
#endif
return res;
}
示例7: SaveSeqLocEntity
static void SaveSeqLocEntity (Uint2 entityID, SelectedSavePtr ssp)
{
ObjMgrDataPtr omdp;
ObjMgrTypePtr omtp;
if (entityID == 0 || ssp == NULL)
{
return;
}
omdp = ObjMgrGetDataStruct (ssp->omp, entityID);
if (omdp == NULL) return;
if (omdp->choicetype == OBJ_SEQENTRY || omdp->datatype != OBJ_SEQLOC)
{
return; /* not seqloc */
}
omtp = ObjMgrTypeFind(ssp->omp, OBJ_SEQLOC, NULL, NULL);
if (omtp == NULL)
{
ErrPostEx(SEV_ERROR,0,0,"Can't locate type record for [%d]", (int)OBJ_SEQLOC);
return;
}
(*(omtp->asnwrite))(omdp->dataptr, ssp->aip, NULL);
AsnPrintNewLine (ssp->aip);
AsnIoFlush (ssp->aip);
}
示例8: SaveOneSelectedItem
static Boolean SaveOneSelectedItem (GatherObjectPtr gop)
{
SelectedSavePtr ssp;
SelStructPtr sel;
ObjMgrTypePtr omtp;
if (gop == NULL || gop->dataptr == NULL) return TRUE;
ssp = (SelectedSavePtr) gop->userdata;
if (ssp == NULL || ssp->aip == NULL || ssp->ssp == NULL) return TRUE;
sel = ssp->ssp;
while (sel != NULL
&& (sel->entityID != gop->entityID
|| sel->itemtype != gop->itemtype
|| sel->itemID != gop->itemID))
{
sel = sel->next;
}
if (sel == NULL) return TRUE;
omtp = ObjMgrTypeFind(ssp->omp, sel->itemtype, NULL, NULL);
if (omtp == NULL)
{
ErrPostEx(SEV_ERROR,0,0,"Can't locate type record for [%d]", (int)sel->itemtype);
return TRUE;
}
(*(omtp->asnwrite))(gop->dataptr, ssp->aip, NULL);
AsnPrintNewLine (ssp->aip);
AsnIoFlush (ssp->aip);
return TRUE;
}
示例9: SLRI_SSClear
/* Clears all items in StringStack */
Int4
SLRI_SSClear(SLRI_SStackPtr ssp)
{
SLRI_SStackItemPtr ssipCurr = NULL;
SLRI_SStackItemPtr ssipTemp = NULL;
if (ssp == NULL) {
ErrPostEx(SEV_ERROR, 0, 0, "SLRI_SSClear: stack pointer is NULL");
return(-1);
}
ssipCurr = ssp->top;
while (ssipCurr != NULL) {
ssipTemp = ssipCurr->prev;
ssipCurr = MemFree(ssipCurr);
ssipCurr = ssipTemp;
}
/* Re-initialize pointers */
ssp->totalStackSize = 0;
ssp->totalNumItems = 0;
ssp->top = NULL;
ssp->bottom = NULL;
return(0);
}
示例10: SLRI_SSGetWholeString
/* Returns a concatenation of all stack contents */
CharPtr
SLRI_SSGetWholeString(SLRI_SStackPtr ssp)
{
SLRI_SStackItemPtr ssipCurr = NULL;
CharPtr wholeString = NULL;
if (ssp == NULL) {
ErrPostEx(SEV_ERROR, 0, 0, "SLRI_SSGetWholeString: stack pointer is NULL");
return(NULL);
}
if (SLRI_SSIsEmpty(ssp)) {
return(NULL);
}
wholeString = MemNew((ssp->totalStackSize + 1) * sizeof(Char));
/* Initialize wholeString with first item */
StringCpy(wholeString, ssp->bottom->string);
/* Cycle through rest of stack to get remaining items */
ssipCurr = ssp->bottom->next;
while (ssipCurr != NULL) {
StringCat(wholeString, ssipCurr->string);
ssipCurr = ssipCurr->next;
}
return(wholeString);
}
示例11: SLRI_SSPush
/* Pushes a StringStack item onto StringStack */
Int4
SLRI_SSPush(SLRI_SStackPtr ssp, CharPtr string)
{
SLRI_SStackItemPtr newItem = NULL;
if (ssp == NULL) {
ErrPostEx(SEV_ERROR, 0, 0, "SLRI_SSPush: stack pointer is NULL");
return(-1);
}
newItem = MemNew(sizeof(SLRI_SStackItem));
newItem->string = string;
newItem->prev = ssp->top;
newItem->next = NULL;
if (ssp->top != NULL) {
ssp->top->next = newItem;
}
ssp->top = newItem;
ssp->totalStackSize += StringLen(newItem->string);
ssp->totalNumItems++;
/* If first item, set bottom pointer to top */
if (ssp->bottom == NULL) {
ssp->bottom = ssp->top;
}
return(0);
}
示例12: Nlm_CPUTimeMeasure
NLM_EXTERN Nlm_CPUTimePtr Nlm_CPUTimeMeasure(void)
{
#if defined(WIN32) || defined(OS_UNIX)
Nlm_CPUTimePtr pTime = (Nlm_CPUTimePtr) Nlm_MemNew(sizeof(Nlm_CPUTime));
if (pTime != NULL) {
#endif
#if defined(WIN32)
GetProcessTimes(GetCurrentProcess(),
&pTime->crtime,
&pTime->extime,
&pTime->systime,
&pTime->usrtime
);
#elif defined(OS_UNIX)
times(&pTime->times);
pTime->rate = sysconf(_SC_CLK_TCK);
#else
ErrPostEx(SEV_WARNING, 0, 0,
"CPU time measuring is not implemented for this platform");
return NULL;
#endif
#if defined(WIN32) || defined(OS_UNIX)
}
return pTime;
#endif
}
示例13: CkQualEcnum
/***************************************************************************
* CkQualEcnum:
* -- Ec_num has text format,
* but the text only allow digits, period, and hyphen (-)
* 12-10-93
****************************************************************************/
NLM_EXTERN int CkQualEcnum( GBQualPtr PNTR head_gbqp, GBQualPtr gbqp,
GBQualPtr preq,
Boolean error_msgs, Boolean perform_corrections )
{
CharPtr str;
int retval = GB_FEAT_ERR_NONE;
retval = CkQualText(head_gbqp, gbqp, preq, NULL, FALSE,
error_msgs, perform_corrections);
if (retval == GB_FEAT_ERR_NONE){
str = gbqp->val;
/* open double quote */
while (*str != '\0' && (*str == ' ' || *str == '\"'))
str++;
for (; *str != '\0' && *str != '\"'; str++)
if (!IS_DIGIT(*str) && *str != '.' && *str != '-') {
if (error_msgs){
ErrPostEx(SEV_ERROR, ERR_QUALIFIER_BadECnum,
"At <%c>(%d) /%s=%s",
*str, (int) *str, gbqp->qual,gbqp->val);
}
retval = GB_FEAT_ERR_DROP;
if (perform_corrections){
DeleteGBQualFromList(head_gbqp, gbqp, preq);
}
break;
}
}
return retval;
} /* CkQualEcnum */
示例14: Nlm_MonitorIntNewEx
NLM_EXTERN MonitorPtr LIBCALL Nlm_MonitorIntNewEx (Nlm_CharPtr title, Nlm_Int4 n1, Nlm_Int4 n2, Nlm_Boolean hasCancelBtn)
{
AppMsgInfo *info = GetAppMsgInfo();
Monitor *pMon = (Monitor*) MemNew(sizeof(Monitor));
if (pMon != NULL)
{
MON_SET_MAGIC(pMon);
pMon->type = MonType_Int;
pMon->strTitle = title ? StrSave(title) : 0;
pMon->num1 = n1;
pMon->num2 = n2;
pMon->cancel = FALSE;
pMon->hasCancelBtn = (int) hasCancelBtn;
if (!(*info->hookMonitor)(pMon,MonCode_Create))
{
MonitorFree(pMon);
/* only post an information message here; it is expected
that the hook function would report the real reason
that the monitor creation failed. */
ErrPostEx(SEV_INFO,0,0,"Unable to create monitor");
return NULL;
}
}
return pMon;
}
示例15: CkQualPosSeqaa
NLM_EXTERN int CkQualPosSeqaa(GBQualPtr PNTR head_gbqp, GBQualPtr gbqp,
GBQualPtr preq,
Boolean error_msgs, Boolean perform_corrections, CharPtr aa, CharPtr eptr)
{
CharPtr str;
int retval = GB_FEAT_ERR_NONE;
DelTailBlank(aa);
if (ValidAminoAcid(aa) != 255) {
str = eptr;
while (*str != '\0' && (*str == ' ' || *str == ')'))
str++;
if (*str == '\0') {
MemFree(aa);
return retval; /* successful, format ok return */
}
else {
MemFree(aa);
if (error_msgs){
ErrPostEx(SEV_ERROR, ERR_QUALIFIER_AA,
"Extra text after end /%s=%s",gbqp->qual,gbqp->val);
}
retval = GB_FEAT_ERR_DROP;
if (perform_corrections){
DeleteGBQualFromList(head_gbqp, gbqp, preq);
}
}
}
else {
if (error_msgs){
ErrPostEx(SEV_ERROR, ERR_QUALIFIER_AA,
"Bad aa abbreviation<%s>, /%s=%s",
aa, gbqp->qual,gbqp->val);
}
retval = GB_FEAT_ERR_DROP;
if (perform_corrections){
DeleteGBQualFromList(head_gbqp, gbqp, preq);
}
}
return retval;
}