/**************************************************************************** Desc: ****************************************************************************/ void F_IniFile::init( void) { m_pool.poolFree(); m_pool.poolInit( 512); m_pFirstLine = NULL; m_pLastLine = NULL; m_bReady = TRUE; }
/**************************************************************************** Desc : Adds a value to the selection criteria of a given cursor. ****************************************************************************/ FLMEXP RCODE FLMAPI FlmCursorAddValue( HFCURSOR hCursor, QTYPES eValType, void * pVal, FLMUINT uiValLen ) { RCODE rc = FERR_OK; FLMUINT uiVal; void * pTmpVal = pVal; CURSOR * pCursor = (CURSOR *)hCursor; F_Pool pool; FLMBOOL bPoolInitialized = FALSE; if (!pCursor) { flmAssert( 0); rc = RC_SET( FERR_INVALID_PARM); goto Exit; } if (RC_BAD( rc = pCursor->rc)) { goto Exit; } // If a read operation has already been performed on this query, no // selection criteria may be added. if (pCursor->bOptimized) { rc = RC_SET( FERR_ILLEGAL_OP); goto Exit; } if (!( pCursor->QTInfo.uiExpecting & FLM_Q_OPERAND)) { rc = RC_SET( FERR_CURSOR_SYNTAX); goto Exit; } switch (eValType) { // Convert all string types to FLM_TEXT_VALUE // in order to handle pure unicode coming in. case FLM_UNICODE_VAL: case FLM_STRING_VAL: { NODE node; f_memset( &node, 0, sizeof(NODE)); pool.poolInit( 512); bPoolInitialized = TRUE; rc = (eValType == FLM_UNICODE_VAL) ? GedPutUNICODE( &pool, &node, (FLMUNICODE *) pVal) : GedPutNATIVE( &pool, &node, (const char *)pVal); if (RC_BAD( rc)) { goto Exit; } pTmpVal = GedValPtr( &node); uiValLen = GedValLen( &node); eValType = FLM_TEXT_VAL; break; } case FLM_BOOL_VAL: if (!pVal) { uiVal = FLM_UNK; } else { FLMBOOL bTrueFalse = (FLMBOOL)*(FLMBOOL *)pVal; uiVal = (bTrueFalse) ? FLM_TRUE : FLM_FALSE; } pTmpVal = &uiVal; eValType = FLM_BOOL_VAL; break; case FLM_INT32_VAL: case FLM_UINT32_VAL: case FLM_REC_PTR_VAL: case FLM_UINT64_VAL: case FLM_INT64_VAL: case FLM_TEXT_VAL: case FLM_BINARY_VAL: // pTmpVal is already pointing to pVal, and // eValType does not need to be changed. break; default: flmAssert( 0); rc = RC_SET( FERR_CURSOR_SYNTAX); break; } if (RC_OK( rc = flmCurMakeQNode( &pCursor->QueryPool, eValType, pTmpVal, uiValLen, pCursor->QTInfo.uiFlags, &(pCursor->QTInfo.pCurAtomNode)))) { if (pCursor->QTInfo.pCurOpNode) { flmCurLinkLastChild( pCursor->QTInfo.pCurOpNode, pCursor->QTInfo.pCurAtomNode); } pCursor->QTInfo.uiExpecting &= ~FLM_Q_OPERAND; pCursor->QTInfo.uiExpecting |= FLM_Q_OPERATOR; } Exit: if (pCursor) { pCursor->rc = rc; } if (bPoolInitialized) { pool.poolFree(); } return( rc); }
int main( #endif int iArgC, char ** ppszArgV) { int iRetCode = 0; F_Pool LogPool; gv_bBatchMode = FALSE; gv_bRunning = TRUE; if( RC_BAD( FlmStartup())) { iRetCode = -1; goto Exit; } f_conInit( 0xFFFF, 0xFFFF, "FLAIM Database Rebuild"); if( RC_BAD( FlmGetFileSystem( &gv_pFileSystem))) { f_conStrOut( "\nCould not allocate a file system object.\n"); goto Exit; } LogPool.poolInit( 1024); if( RC_BAD( LogPool.poolAlloc( MAX_LOG_BUFF, (void **)&gv_pucLogBuffer))) { goto Exit; } if( bldGetParams( iArgC, (const char **)ppszArgV)) { if (!bldDoRebuild()) { iRetCode = 1; } } Exit: if (gv_bPauseBeforeExiting && !gv_bShutdown) { f_conStrOut( "\nPress any character to exit REBUILD: "); for (;;) { if (gv_bShutdown) { break; } if (f_conHaveKey()) { f_conGetKey(); break; } f_yieldCPU(); } } if (gv_pFileSystem) { gv_pFileSystem->Release(); gv_pFileSystem = NULL; } f_conExit(); FlmShutdown(); gv_bRunning = FALSE; return( iRetCode); }