本文整理汇总了C++中TA_TRACE_RETURN函数的典型用法代码示例。如果您正苦于以下问题:C++ TA_TRACE_RETURN函数的具体用法?C++ TA_TRACE_RETURN怎么用?C++ TA_TRACE_RETURN使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TA_TRACE_RETURN函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getGroupId
static TA_RetCode getGroupId( const char *groupString, unsigned int *groupId )
#endif
{
#ifdef TA_GEN_CODE
TA_PROLOG;
#endif
unsigned int i;
#ifdef TA_GEN_CODE
TA_TRACE_BEGIN( libHandle, getgroupId );
TA_ASSERT( libHandle, groupString != NULL );
TA_ASSERT( libHandle, groupId != NULL );
#endif
for( i=0; i < TA_NB_GROUP_ID; i++ )
{
if( strcmp( TA_GroupString[i], groupString ) == 0 )
{
*groupId = i;
#ifdef TA_GEN_CODE
TA_TRACE_RETURN( TA_SUCCESS );
#else
return TA_SUCCESS;
#endif
}
}
#ifdef TA_GEN_CODE
TA_TRACE_RETURN( TA_GROUP_NOT_FOUND );
#else
return TA_GROUP_NOT_FOUND;
#endif
}
示例2: freeListAndElement
static TA_RetCode freeListAndElement( TA_Libc *libHandle, TA_List *list, TA_RetCode (*freeFunc)( TA_Libc *libHandle, void *toBeFreed ) )
{
TA_PROLOG;
TA_RetCode retCode;
void *node;
TA_TRACE_BEGIN( libHandle, freeListAndElement );
if( list != NULL )
{
while( (node = TA_ListRemoveTail( list )) != NULL )
{
retCode = freeFunc( libHandle, node );
if( retCode != TA_SUCCESS )
{
TA_FATAL( libHandle, NULL, node, retCode );
TA_TRACE_RETURN( TA_ALLOC_ERR );
}
}
retCode = TA_ListFree( list );
if( retCode != TA_SUCCESS )
{
TA_FATAL( libHandle, NULL, list, retCode );
TA_TRACE_RETURN( TA_ALLOC_ERR );
}
}
TA_TRACE_RETURN( TA_SUCCESS );
}
示例3: freeFileIndexPriv
static TA_RetCode freeFileIndexPriv( void *toBeFreed )
{
TA_PROLOG;
TA_FileIndexPriv *asciiFileData;
TA_Libc *libHandle;
TA_StringCache *stringCache;
asciiFileData = (TA_FileIndexPriv *)toBeFreed;
libHandle = asciiFileData->libHandle;
TA_TRACE_BEGIN( libHandle, freeFileIndexPriv );
stringCache = TA_GetGlobalStringCache( libHandle );
if( !asciiFileData )
{
TA_TRACE_RETURN( TA_ALLOC_ERR );
}
if( freeListAndElement( libHandle, asciiFileData->listLocationToken, freeTokenInfo ) != TA_SUCCESS )
{
TA_TRACE_RETURN( TA_ALLOC_ERR );
}
if( freeListAndElement( libHandle, asciiFileData->listCategory, freeCategoryData ) != TA_SUCCESS )
{
TA_TRACE_RETURN( TA_ALLOC_ERR );
}
if( asciiFileData->root )
TA_FileIndexFreeValueTree( libHandle, asciiFileData->root );
if( asciiFileData->scratchPad )
TA_Free( libHandle, asciiFileData->scratchPad );
if( asciiFileData->wildOneChar )
TA_StringFree( stringCache, asciiFileData->wildOneChar );
if( asciiFileData->wildZeroOrMoreChar )
TA_StringFree( stringCache, asciiFileData->wildZeroOrMoreChar );
if( asciiFileData->wildOneOrMoreChar )
TA_StringFree( stringCache, asciiFileData->wildOneOrMoreChar );
if( asciiFileData->initialCategoryString )
TA_StringFree( stringCache, asciiFileData->initialCategoryString );
if( asciiFileData->initialCategoryCountryString )
TA_StringFree( stringCache, asciiFileData->initialCategoryCountryString );
if( asciiFileData->initialCategoryExchangeString )
TA_StringFree( stringCache, asciiFileData->initialCategoryExchangeString );
if( asciiFileData->initialCategoryTypeString )
TA_StringFree( stringCache, asciiFileData->initialCategoryTypeString );
TA_Free( libHandle, asciiFileData );
TA_TRACE_RETURN( TA_SUCCESS );
}
示例4: TA_HistoryCheckInternal
/**** Global functions definitions. ****/
TA_RetCode TA_HistoryCheckInternal( TA_Libc *libHandle,
TA_Period expectedPeriod,
const TA_Timestamp *expectedStart,
const TA_Timestamp *expectedEnd,
TA_Field fieldToCheck,
const TA_History *history,
unsigned int *faultyIndex,
unsigned int *faultyField )
{
TA_PROLOG;
unsigned int allFieldNull;
(void)faultyField;
(void)faultyIndex;
(void)fieldToCheck;
(void)expectedEnd;
(void)expectedStart;
TA_TRACE_BEGIN( libHandle, TA_HistoryCheckInternal );
TA_ASSERT( libHandle, history != NULL );
/* Period shall be always set in the history. */
if( history->period != expectedPeriod )
{
TA_TRACE_RETURN( TA_UNKNOWN_ERR );
}
/* Verify that an empty history is really empty. */
if( (history->open == NULL) &&
(history->high == NULL) &&
(history->low == NULL) &&
(history->close == NULL) &&
(history->volume == NULL) &&
(history->openInterest == NULL) &&
(history->timestamp == NULL) )
{
allFieldNull = 1;
if( history->nbBars != 0 )
{
TA_TRACE_RETURN( TA_UNKNOWN_ERR );
}
}
else
allFieldNull = 0;
if( (history->nbBars == 0) && !allFieldNull )
{
TA_TRACE_RETURN( TA_UNKNOWN_ERR );
}
/* !!! Some more runtime verification could be added here... */
TA_TRACE_RETURN( TA_SUCCESS );
}
示例5: TA_FileIndexMoveToPrevToken
TA_RetCode TA_FileIndexMoveToPrevToken( TA_FileIndexPriv *data )
{
TA_PROLOG;
TA_Libc *libHandle;
TA_RetCode retCode;
if( !data )
return TA_UNKNOWN_ERR;
libHandle = data->libHandle;
TA_TRACE_BEGIN( libHandle, TA_FileIndexMoveToPrevToken );
if( data->curToken == NULL )
{
/* Iterator variable not initialize. Simply position everything on the
* first token.
*/
retCode = TA_FileIndexMoveToNextToken( data );
TA_TRACE_RETURN( retCode );
}
else if( data->prevToken == NULL )
{
/* Can't go further back. Simply return. */
TA_TRACE_RETURN( TA_SUCCESS );
}
else
{
if( data->curDirectionForward == 1 )
{
if( data->nextToken != NULL )
TA_ListAccessPrev( data->listLocationToken );
else
TA_ListAccessTail( data->listLocationToken );
TA_ListAccessPrev( data->listLocationToken );
data->curDirectionForward = 0;
}
data->nextToken = data->curToken;
data->curToken = data->prevToken;
data->prevToken = (TA_TokenInfo *)TA_ListAccessPrev( data->listLocationToken );
/* Parano test: Should never happen since the code assume that
* the 'listLocationToken' is always terminated by TA_END.
*/
if( !data->curToken )
{
TA_FATAL( data->libHandle, NULL, data->curToken->id, data->curTokenDepth );
}
}
data->curTokenDepth--;
TA_TRACE_RETURN( TA_SUCCESS );
}
示例6: TA_FileIndexAddTokenInfo
TA_RetCode TA_FileIndexAddTokenInfo( TA_FileIndexPriv *data,
TA_TokenId id,
TA_String *value,
TA_TokenInfo *optBefore )
{
TA_PROLOG;
TA_RetCode retCode;
TA_TokenInfo *info;
TA_Libc *libHandle;
TA_StringCache *stringCache;
libHandle = data->libHandle;
TA_TRACE_BEGIN( libHandle, TA_FileIndexAddTokenInfo );
stringCache = TA_GetGlobalStringCache( libHandle );
info = TA_Malloc( libHandle, sizeof( TA_TokenInfo ) );
if( !info )
{
TA_TRACE_RETURN( TA_ALLOC_ERR );
}
info->id = id;
if( value == NULL )
info->value = NULL;
else
{
info->value = TA_StringDup( stringCache, value );
if( !info->value )
{
TA_Free( libHandle, info );
TA_TRACE_RETURN( TA_ALLOC_ERR );
}
}
if( optBefore )
retCode = TA_ListAddBefore( data->listLocationToken, optBefore, info );
else
retCode = TA_ListAddTail( data->listLocationToken, info );
if( retCode != TA_SUCCESS )
{
if( info->value )
TA_StringFree( stringCache, info->value );
TA_Free( libHandle, info );
TA_TRACE_RETURN( retCode );
}
TA_TRACE_RETURN( TA_SUCCESS );
}
示例7: TA_FileIndexAddTreeValue
TA_RetCode TA_FileIndexAddTreeValue( TA_FileIndexPriv *data,
TA_String *string,
TA_ValueTreeNode **added )
{
TA_PROLOG;
TA_ValueTreeNode *node;
unsigned int allocateEmptyString;
TA_Libc *libHandle;
TA_StringCache *stringCache;
libHandle = data->libHandle;
TA_TRACE_BEGIN( libHandle, TA_FileIndexAddTreeValue );
stringCache = TA_GetGlobalStringCache( libHandle );
allocateEmptyString = 0;
TA_ASSERT( libHandle, data != NULL );
if( added )
*added = NULL;
if( !string )
{
string = TA_StringAlloc( stringCache, "" );
if( !string )
{
TA_TRACE_RETURN( TA_ALLOC_ERR );
}
allocateEmptyString = 1;
}
/* Alloc the TA_ValueTreeNode */
node = allocTreeNode( libHandle, data->currentNode, string );
if( allocateEmptyString )
TA_StringFree( stringCache, string );
if( !node )
{
TA_TRACE_RETURN( TA_ALLOC_ERR );
}
data->currentNode = node;
if( added )
*added = node;
TA_TRACE_RETURN( TA_SUCCESS );
}
示例8: getFuncNameByIdx
static TA_RetCode getFuncNameByIdx( TA_GroupId groupId,
unsigned int idx,
const char **stringPtr )
#endif
{
#ifdef TA_GEN_CODE
/* Code used only when compiled with gen_code. */
TA_PROLOG;
unsigned int curIdx;
unsigned int i, j, found;
const TA_FuncDef **funcDefTable;
unsigned int tableSize;
const TA_FuncInfo *funcInfo;
TA_TRACE_BEGIN( libHandle, getFuncNameByIdx );
TA_ASSERT( libHandle, stringPtr != NULL );
curIdx = 0;
found = 0;
for( i=0; (i < 26) && !found; i++ )
{
funcDefTable = TA_DEF_Tables[i];
tableSize = *(TA_DEF_TablesSize[i]);
for( j=0; (j < tableSize) && !found; j++ )
{
if( funcDefTable[j]->groupId == groupId )
{
if( idx == curIdx )
{
funcInfo = funcDefTable[j]->funcInfo;
TA_ASSERT( libHandle, funcInfo != NULL );
*stringPtr = funcInfo->name;
found = 1;
}
curIdx++;
}
}
}
TA_ASSERT( libHandle, found == 1 );
TA_ASSERT( libHandle, *stringPtr != NULL );
TA_TRACE_RETURN( TA_SUCCESS );
#else
/* Optimized code in the final library. */
const TA_FuncDef **funcDefTable;
const TA_FuncInfo *funcInfo;
funcDefTable = TA_PerGroupFuncDef[groupId];
funcInfo = funcDefTable[idx]->funcInfo;
*stringPtr = funcInfo->name;
return TA_SUCCESS;
#endif
}
示例9: TA_GroupTableAlloc
/**** Global functions definitions. ****/
TA_RetCode TA_GroupTableAlloc( TA_Libc *libHandle, TA_StringTable **table )
{
TA_PROLOG;
TA_StringTable *stringTable;
TA_StringTableGroupHidden *stringTableHidden;
TA_TRACE_BEGIN( libHandle, TA_GroupTableAlloc );
if( table == NULL )
{
TA_TRACE_RETURN( TA_BAD_PARAM );
}
*table = NULL;
stringTable = (TA_StringTable *)TA_Malloc( libHandle, sizeof(TA_StringTable) );
if( !stringTable )
{
TA_TRACE_RETURN( TA_ALLOC_ERR );
}
stringTableHidden = (TA_StringTableGroupHidden *)TA_Malloc( libHandle, sizeof(TA_StringTableGroupHidden) );
if( !stringTableHidden )
{
TA_Free( libHandle, stringTable );
TA_TRACE_RETURN( TA_ALLOC_ERR );
}
stringTableHidden->libHandle = libHandle;
stringTableHidden->magicNb = TA_STRING_TABLE_GROUP_MAGIC_NB;
stringTable->size = TA_NB_GROUP_ID;
stringTable->string = &TA_GroupString[0];
stringTable->hiddenData = stringTableHidden;
/* From this point, TA_FuncTableFree can be safely called. */
/* Success. Return the table to the caller. */
*table = stringTable;
TA_TRACE_RETURN( TA_SUCCESS );
}