diff --git a/xflaim/util/checkdb.cpp b/xflaim/util/checkdb.cpp index 82f5006..e3f7f19 100644 --- a/xflaim/util/checkdb.cpp +++ b/xflaim/util/checkdb.cpp @@ -24,7 +24,6 @@ //------------------------------------------------------------------------------ #include "flaimsys.h" -#include "ftx.h" #include "sharutil.h" #define UTIL_ID "CHECKDB" @@ -89,10 +88,10 @@ public: m_uiLastRefresh = 0; } - RCODE XFLMAPI reportProgress( + RCODE FLMAPI reportProgress( XFLM_PROGRESS_CHECK_INFO * pProgCheck); - RCODE XFLMAPI reportCheckErr( + RCODE FLMAPI reportCheckErr( XFLM_CORRUPT_INFO * pCorruptInfo, FLMBOOL * pbFix); @@ -234,6 +233,7 @@ static FLMBOOL gv_bRunning; static FLMBOOL gv_bPauseBeforeExiting = FALSE; static FLMBOOL gv_bSkipDomLinkVerify = FALSE; static char gv_szPassword[256]; +static IF_DbSystem * gv_pDbSystem = NULL; #ifdef FLM_WATCOM_NLM #define main nlm_main @@ -243,12 +243,11 @@ static char gv_szPassword[256]; Desc: *********************************************************************/ extern "C" int main( - int iArgC, - char ** ppszArgV) + int iArgC, + char ** ppszArgV) { - int iResCode = 0; - F_Pool LogPool; - F_DbSystem dbSystem; + int iResCode = 0; + IF_Pool * pLogPool = NULL; gv_bBatchMode = FALSE; gv_bShutdown = FALSE; @@ -265,21 +264,28 @@ extern "C" int main( #endif - if( RC_BAD( dbSystem.init())) + if( RC_BAD( FlmAllocDbSystem( &gv_pDbSystem))) { WpsStrOut( "\nCould not initialize FLAIM.\n"); goto Exit; } - + WpsInit( 0xFFFF, 0xFFFF, "FLAIM Database Check"); WpsOptimize(); - WpsScrBackFor( WPS_BLUE, WPS_WHITE); + WpsScrBackFor( FLM_BLUE, FLM_WHITE); WpsDrawBorder(); WpsScrClr( 0, 0); WpsScrSize( NULL, &gv_uiMaxRow); + + if( RC_BAD( FlmAllocPool( &pLogPool))) + { + WpsStrOut( "\nCould not create pool.\n"); + goto Exit; + } - LogPool.poolInit( 1024); - if (RC_BAD( LogPool.poolAlloc( MAX_LOG_BUFF, (void **)&gv_pszLogBuffer))) + pLogPool->poolInit( 1024); + + if (RC_BAD( pLogPool->poolAlloc( MAX_LOG_BUFF, (void **)&gv_pszLogBuffer))) { WpsStrOut( "\nFailed to allocatae memory pool\n"); goto Exit; @@ -292,15 +298,16 @@ extern "C" int main( iResCode = 1; } } - - LogPool.poolFree(); + + pLogPool->Release(); + pLogPool = NULL; if( (gv_bPauseBeforeExiting) && (!gv_bShutdown)) { WpsScrPos( 0, (FLMUINT)(gv_uiMaxRow - 2)); - WpsScrBackFor( WPS_BLUE, WPS_WHITE); + WpsScrBackFor( FLM_BLUE, FLM_WHITE); WpsScrClr( 0, (FLMUINT)(gv_uiMaxRow - 2)); - WpsScrBackFor( WPS_RED, WPS_WHITE); + WpsScrBackFor( FLM_RED, FLM_WHITE); if( gv_szLastError[ 0] != '\0') { WpsStrOut( gv_szLastError); @@ -327,16 +334,18 @@ Exit: { gv_pDbInfo->Release(); } + + if( pLogPool) + { + pLogPool->Release(); + } WpsExit(); - dbSystem.exit(); -#ifdef FLM_NLM - if (!gv_bSynchronized) + + if( gv_pDbSystem) { -// SynchronizeStart(); - gv_bSynchronized = TRUE; + gv_pDbSystem->Release(); } -#endif gv_bRunning = FALSE; return( iResCode); @@ -353,13 +362,12 @@ FSTATIC FLMBOOL CheckDatabase( void) FLMUINT uiCheckFlags; FLMBOOL bOk = TRUE; IF_DbCheckStatus * pDbCheckStatus = NULL; - F_DbSystem dbSystem; // Open the database - so we can have access to its name table if (!gv_pDb) { - if( RC_BAD( rc = dbSystem.dbOpen( + if( RC_BAD( rc = gv_pDbSystem->dbOpen( gv_szDbFileName, gv_szDataDir, gv_szRflDir, gv_szPassword, XFLM_ALLOW_LIMITED_MODE, (IF_Db **)&gv_pDb))) @@ -382,7 +390,7 @@ FSTATIC FLMBOOL CheckDatabase( void) gv_ui64BytesDone = 0; gv_ui64FileSize = 0; gv_uiOldViewCount = 0; - WpsScrBackFor( WPS_BLUE, WPS_WHITE); + WpsScrBackFor( FLM_BLUE, FLM_WHITE); if (gv_bLoggingEnabled) { @@ -580,7 +588,7 @@ FSTATIC FLMBOOL CheckDatabase( void) { F_LocalCheckStatus dbCheckStatus; - rc = dbSystem.dbCheck( gv_szDbFileName, gv_szDataDir, gv_szRflDir, NULL, + rc = gv_pDbSystem->dbCheck( gv_szDbFileName, gv_szDataDir, gv_szRflDir, NULL, uiCheckFlags, &gv_pDbInfo, &dbCheckStatus); } @@ -596,7 +604,7 @@ FSTATIC FLMBOOL CheckDatabase( void) uiStatus = CheckShowError( szTmpBuf, TRUE); - if( ((uiStatus != WPK_ESCAPE) || (gv_bLoggingEnabled)) && + if( ((uiStatus != FKB_ESCAPE) || (gv_bLoggingEnabled)) && (gv_bShowStats) && ((rc == NE_XFLM_OK) || (rc == NE_XFLM_DATA_ERROR) || @@ -637,12 +645,17 @@ Desc: Function to coordinate check of the database. *********************************************************************/ FSTATIC FLMBOOL DoCheck( void) { - FLMBOOL bOk = TRUE; - char szTmpBuf[ 100]; - RCODE rc = NE_XFLM_OK; - F_DbSystem dbSystem; + RCODE rc = NE_XFLM_OK; + FLMBOOL bOk = TRUE; + char szTmpBuf[ 100]; + IF_FileSystem * pFileSystem = NULL; + + if( RC_BAD( rc = FlmGetFileSystem( &pFileSystem))) + { + goto Exit; + } - WpsScrBackFor( WPS_BLUE, WPS_WHITE); + WpsScrBackFor( FLM_BLUE, FLM_WHITE); WpsScrClr( 0, 0); gv_bContinue = TRUE; gv_uiLineCount = 0; @@ -655,9 +668,9 @@ FSTATIC FLMBOOL DoCheck( void) if( gv_szLogFileName[ 0]) { - gv_pFileSystem->Delete( gv_szLogFileName); - if( RC_OK( rc = gv_pFileSystem->Create( gv_szLogFileName, - XFLM_IO_RDWR | XFLM_IO_SH_DENYNONE, &gv_pLogFile))) + pFileSystem->deleteFile( gv_szLogFileName); + if( RC_OK( rc = pFileSystem->createFile( gv_szLogFileName, + FLM_IO_RDWR | FLM_IO_SH_DENYNONE, &gv_pLogFile))) { gv_bLoggingEnabled = TRUE; } @@ -670,7 +683,7 @@ FSTATIC FLMBOOL DoCheck( void) } } - WpsCursorSetType( WPS_CURSOR_INVISIBLE); + WpsCursorSetType( FLM_CURSOR_INVISIBLE); for( ;;) { // Check the database... @@ -685,18 +698,22 @@ FSTATIC FLMBOOL DoCheck( void) break; } } - WpsCursorSetType( WPS_CURSOR_UNDERLINE); + WpsCursorSetType( FLM_CURSOR_UNDERLINE); if( gv_bLoggingEnabled) { LogFlush(); - gv_pLogFile->Close(); gv_pLogFile->Release(); gv_pLogFile = NULL; } Exit: + if( pFileSystem) + { + pFileSystem->Release(); + } + return( bOk); } @@ -848,7 +865,7 @@ FSTATIC FLMBOOL GetParams( { if( CheckShowError( "Log file name not specified in parameter", - FALSE) == WPK_ESCAPE) + FALSE) == FKB_ESCAPE) { return( FALSE); } @@ -865,7 +882,7 @@ FSTATIC FLMBOOL GetParams( { if( CheckShowError( "Temporary directory not specified in parameter", - FALSE) == WPK_ESCAPE) + FALSE) == FKB_ESCAPE) { return( FALSE); } @@ -889,7 +906,7 @@ FSTATIC FLMBOOL GetParams( else { f_sprintf( szTmpBuf, "Invalid option %s", pszTmp - 1); - if( CheckShowError( szTmpBuf, FALSE) == WPK_ESCAPE) + if( CheckShowError( szTmpBuf, FALSE) == FKB_ESCAPE) { return( FALSE); } @@ -950,7 +967,7 @@ FSTATIC FLMBOOL GetParams( else { f_sprintf( szTmpBuf, "Invalid option %s", pszTmp); - if( CheckShowError( szTmpBuf, FALSE) == WPK_ESCAPE) + if( CheckShowError( szTmpBuf, FALSE) == FKB_ESCAPE) { return( FALSE); } @@ -1005,7 +1022,7 @@ FSTATIC void LogFlush( if( gv_uiLogBufferCount) { - gv_pLogFile->Write( XFLM_IO_CURRENT_POS, + gv_pLogFile->write( FLM_IO_CURRENT_POS, gv_uiLogBufferCount, (FLMBYTE *)gv_pszLogBuffer, &uiBytesWritten); gv_uiLogBufferCount = 0; @@ -1067,16 +1084,16 @@ FSTATIC void OutLine( if( gv_uiLineCount == 20) { WpsScrPos( 0, (FLMUINT)(gv_uiMaxRow - 1)); - WpsScrBackFor( WPS_BLUE, WPS_WHITE); + WpsScrBackFor( FLM_BLUE, FLM_WHITE); WpsScrClr( 0, (FLMUINT)(gv_uiMaxRow - 1)); - WpsScrBackFor( WPS_RED, WPS_WHITE); + WpsScrBackFor( FLM_RED, FLM_WHITE); WpsStrOut( "Press: ESC to quit, anything else to continue"); for( ;;) { if( gv_bShutdown) { - uiChar = WPK_ESCAPE; + uiChar = FKB_ESCAPE; break; } else if( WpkTestKB()) @@ -1086,13 +1103,13 @@ FSTATIC void OutLine( } } - if( uiChar == WPK_ESCAPE) + if( uiChar == FKB_ESCAPE) { gv_bContinue = FALSE; } else { - WpsScrBackFor( WPS_BLUE, WPS_WHITE); + WpsScrBackFor( FLM_BLUE, FLM_WHITE); WpsScrClr( 0, 0); } @@ -1193,7 +1210,6 @@ FSTATIC void OutOneBlockStat( FLMUINT64 ui64TotalBytes; FLMUINT uiPercent; FLMUINT uiAvgElementSize; - F_DbSystem dbSystem; ui64TotalBytes = (FLMUINT64)uiBlockCount * (FLMUINT64)uiBlockSize; if( ui64ElementCount) @@ -1261,7 +1277,7 @@ FSTATIC void OutOneBlockStat( { f_strcpy( szTmpBuf, " LAST ERROR: "); f_strcpy( &szTmpBuf[ f_strlen( szTmpBuf)], - dbSystem.checkErrorToStr( iLastError)); + gv_pDbSystem->checkErrorToStr( iLastError)); OutLine( szTmpBuf); f_sprintf( szTmpBuf, " TOTAL ERRORS: %u", (unsigned)uiNumErrors); @@ -1359,7 +1375,7 @@ FSTATIC void PrintInfo( FLMUINT uiNumErrors; const XFLM_DB_HDR * pDbHdr = pDbInfo->getDbHdr(); - WpsScrBackFor( WPS_BLUE, WPS_WHITE); + WpsScrBackFor( FLM_BLUE, FLM_WHITE); WpsScrClr( 0, 0); OutUINT( "Default Language", @@ -1433,9 +1449,9 @@ FSTATIC FLMUINT CheckShowError( else { WpsScrPos( 0, (FLMUINT)(gv_uiMaxRow - 2)); - WpsScrBackFor( WPS_BLUE, WPS_WHITE); + WpsScrBackFor( FLM_BLUE, FLM_WHITE); WpsScrClr( 0, (FLMUINT)(gv_uiMaxRow - 2)); - WpsScrBackFor( WPS_RED, WPS_WHITE); + WpsScrBackFor( FLM_RED, FLM_WHITE); WpsStrOut( pszMessage); WpsScrPos( 0, (FLMUINT)(gv_uiMaxRow - 1)); WpsStrOut( "Press ENTER to continue, ESC to quit"); @@ -1443,20 +1459,20 @@ FSTATIC FLMUINT CheckShowError( { if( gv_bShutdown) { - uiResKey = WPK_ESCAPE; + uiResKey = FKB_ESCAPE; break; } else if( WpkTestKB()) { uiResKey = WpkIncar(); - if( (uiResKey == WPK_ENTER) || (uiResKey == WPK_ESCAPE)) + if( (uiResKey == FKB_ENTER) || (uiResKey == FKB_ESCAPE)) { break; } } } - WpsScrBackFor( WPS_BLUE, WPS_WHITE); + WpsScrBackFor( FLM_BLUE, FLM_WHITE); WpsScrClr( 0, (FLMUINT)(gv_uiMaxRow - 2)); } @@ -1477,12 +1493,12 @@ FSTATIC void OutLabel( char szTmpBuf[ 100]; FLMUINT uiLoop; - WpsScrBackFor( WPS_BLUE, WPS_WHITE); + WpsScrBackFor( FLM_BLUE, FLM_WHITE); WpsStrOutXY( pszLabel, uiCol, uiRow); for( uiLoop = WpsCurrCol(); uiLoop < VALUE_COLUMN - 1; uiLoop++) { - WpsChrOut( '.'); + WpsStrOut( "."); } @@ -1519,7 +1535,7 @@ FSTATIC void DisplayValue( FLMUINT uiRow, const char * pszValue) { - WpsScrBackFor( WPS_BLUE, WPS_WHITE); + WpsScrBackFor( FLM_BLUE, FLM_WHITE); WpsStrOutXY( pszValue, VALUE_COLUMN, uiRow); WpsLineClr( 255, 255); } @@ -1548,16 +1564,16 @@ FSTATIC RCODE GetUserInput( FLMUINT uiChar; WpsScrPos( 0, (FLMUINT)(gv_uiMaxRow - 1)); - WpsScrBackFor( WPS_BLUE, WPS_WHITE); + WpsScrBackFor( FLM_BLUE, FLM_WHITE); WpsScrClr( 0, (FLMUINT)(gv_uiMaxRow - 1)); - WpsScrBackFor( WPS_RED, WPS_WHITE); + WpsScrBackFor( FLM_RED, FLM_WHITE); WpsStrOut( "Q,ESC=Quit, Other=Continue"); for( ;;) { if( gv_bShutdown) { - uiChar = WPK_ESCAPE; + uiChar = FKB_ESCAPE; break; } else if( WpkTestKB()) @@ -1567,14 +1583,14 @@ FSTATIC RCODE GetUserInput( } } - WpsScrBackFor( WPS_BLUE, WPS_WHITE); + WpsScrBackFor( FLM_BLUE, FLM_WHITE); WpsScrClr( 0, (FLMUINT)(gv_uiMaxRow - 1)); switch( uiChar) { case 'q': case 'Q': - case WPK_ESCAPE: + case FKB_ESCAPE: return( RC_SET( NE_XFLM_FAILURE)); default: break; @@ -1593,10 +1609,9 @@ RCODE F_LocalCheckStatus::reportProgress( XFLM_CACHE_INFO cacheInfo; char szWhat[ 256]; char szLfName[ 128]; - F_DbSystem dbSystem; FLMUINT uiCurrentTime; - FLM_TIMER_UNITS_TO_MILLI( FLM_GET_TIMER(), uiCurrentTime); + uiCurrentTime = FLM_TIMER_UNITS_TO_MILLI( FLM_GET_TIMER()); if( (uiCurrentTime - m_uiLastRefresh < SCREEN_REFRESH_RATE) && !pProgCheck->bStartFlag) @@ -1609,7 +1624,7 @@ RCODE F_LocalCheckStatus::reportProgress( m_uiLastRefresh = uiCurrentTime; - dbSystem.getCacheInfo( &cacheInfo); + gv_pDbSystem->getCacheInfo( &cacheInfo); DisplayNumValue( CACHE_USED_ROW, cacheInfo.BlockCache.uiByteCount); DisplayNumValue( ECACHE_USED_ROW, cacheInfo.ECache.ui64TotalBytesAllocated); @@ -1699,19 +1714,19 @@ RCODE F_LocalCheckStatus::reportProgress( } szWhat[ 45] = '\0'; - WpsScrBackFor( WPS_BLUE, WPS_WHITE); + WpsScrBackFor( FLM_BLUE, FLM_WHITE); DisplayValue( DOING_ROW, szWhat); } - else if( (WpkTestKB()) && (WpkIncar() == WPK_ESCAPE)) + else if( (WpkTestKB()) && (WpkIncar() == FKB_ESCAPE)) { - WpsScrBackFor( WPS_BLUE, WPS_WHITE); + WpsScrBackFor( FLM_BLUE, FLM_WHITE); WpsScrPos( 0, (FLMUINT)(gv_uiMaxRow - 2)); WpsScrClr( 0, (FLMUINT)(gv_uiMaxRow - 2)); - WpsScrBackFor( WPS_RED, WPS_WHITE); + WpsScrBackFor( FLM_RED, FLM_WHITE); WpsStrOut( "ESCAPE key pressed.\n"); rc = GetUserInput(); WpsScrClr( 0, (FLMUINT)(gv_uiMaxRow - 2)); - WpsScrBackFor( WPS_BLUE, WPS_WHITE); + WpsScrBackFor( FLM_BLUE, FLM_WHITE); goto Exit; } @@ -1726,9 +1741,8 @@ RCODE F_LocalCheckStatus::reportCheckErr( { RCODE rc = NE_XFLM_OK; XFLM_CACHE_INFO cacheInfo; - F_DbSystem dbSystem; - dbSystem.getCacheInfo( &cacheInfo); + gv_pDbSystem->getCacheInfo( &cacheInfo); DisplayNumValue( CACHE_USED_ROW, cacheInfo.BlockCache.uiByteCount); DisplayNumValue( ECACHE_USED_ROW, cacheInfo.ECache.ui64TotalBytesAllocated); @@ -1739,7 +1753,7 @@ RCODE F_LocalCheckStatus::reportCheckErr( LogCorruptError( pCorruptInfo); } - WpsScrBackFor( WPS_BLUE, WPS_WHITE); + WpsScrBackFor( FLM_BLUE, FLM_WHITE); if( pCorruptInfo->iErrCode == FLM_OLD_VIEW) { gv_uiOldViewCount++; @@ -1791,7 +1805,6 @@ FSTATIC void LogCorruptError( { char szWhat[ 20]; char szTmpBuf[ 100]; - F_DbSystem dbSystem; switch( pCorrupt->uiErrLocale) { @@ -1938,7 +1951,7 @@ FSTATIC void LogCorruptError( LogStr( 2, szTmpBuf); } - f_strcpy( szTmpBuf, dbSystem.checkErrorToStr( pCorrupt->iErrCode)); + f_strcpy( szTmpBuf, gv_pDbSystem->checkErrorToStr( pCorrupt->iErrCode)); f_sprintf( &szTmpBuf[ f_strlen( szTmpBuf)], " (%d)", (int)pCorrupt->iErrCode); LogStr( 2, szTmpBuf); @@ -1946,7 +1959,7 @@ FSTATIC void LogCorruptError( if( gv_bLoggingEnabled) { - gv_pLogFile->Flush(); + gv_pLogFile->flush(); } } @@ -2161,9 +2174,7 @@ FSTATIC FLMBOOL NumToName( /**************************************************************************** Desc: This routine shuts down all threads in the NLM. ****************************************************************************/ -FSTATIC void chkCleanup( - void - ) +FSTATIC void chkCleanup( void) { gv_bShutdown = TRUE; while( gv_bRunning) diff --git a/xflaim/util/domedit.cpp b/xflaim/util/domedit.cpp index 794e7a1..d207684 100644 --- a/xflaim/util/domedit.cpp +++ b/xflaim/util/domedit.cpp @@ -45,7 +45,7 @@ DOMEdit prototypes void UIMain( void * pData); RCODE _domEditBackgroundThread( - F_Thread * pThread); + IF_Thread * pThread); RCODE domEditVerifyRun( void); @@ -63,7 +63,7 @@ Imported global data FTX_INFO * gv_pFtxInfo = NULL; FLMBOOL gv_bShutdown = FALSE; -static F_Thread * gv_pBackgroundThrd = NULL; +static IF_Thread * gv_pBackgroundThrd = NULL; char gv_szDbPath[ F_PATH_MAX_SIZE]; char gv_szRflDir[ F_PATH_MAX_SIZE]; char gv_szPassword[ 128]; @@ -199,8 +199,7 @@ void UIMain( void * pData) "DOMEdit for XFLAIM [DB=%s/BUILD=%s]", XFLM_CURRENT_VER_STR, __DATE__); - if( FTXInit( szTitle, 80, 50, - WPS_BLUE, WPS_WHITE, NULL, NULL, &gv_pFtxInfo) != FTXRC_SUCCESS) + if( RC_BAD( FTXInit( szTitle, 80, 50, WPS_BLUE, WPS_WHITE, NULL, NULL))) { iResCode = 1; goto Exit; @@ -242,7 +241,7 @@ void UIMain( void * pData) } - if( RC_BAD( f_threadCreate( &gv_pBackgroundThrd, + if( RC_BAD( pThreadMgr->createThread( &gv_pBackgroundThrd, _domEditBackgroundThread, "domedit_refresh"))) { iResCode = 1; @@ -341,22 +340,21 @@ Exit: } gv_bShutdown = TRUE; + if (pDb) { pDb->Release(); } - /* - Shut down the display and keyboard - */ - - f_threadDestroy( &gv_pBackgroundThrd); - - /* - Free FTX - */ - - FTXFree( &gv_pFtxInfo); + if( gv_pBackgroundThread) + { + gv_pBackgroundThrd->Release(); + } + + if( pThreadMgr) + { + pThreadMgr->Release(); + } dbSystem.exit(); } diff --git a/xflaim/util/domedit.h b/xflaim/util/domedit.h index 2f700a7..9966957 100644 --- a/xflaim/util/domedit.h +++ b/xflaim/util/domedit.h @@ -94,8 +94,8 @@ typedef struct { char szString[ MAX_DISPLAY_SEGMENT]; FLMUINT uiCol; - FLMUINT uiForeground; - FLMUINT uiBackground; + eColorType uiForeground; + eColorType uiBackground; } DME_DISP_COLUMN; // Structure to hold an entire row @@ -161,10 +161,7 @@ typedef RCODE (* F_DOMEDIT_EVENT_HOOK)( void * EventData, void * UserData); -/* -Class definitions -*/ -class F_DomEditor : public XF_RefCount, public XF_Base +class F_DomEditor : public F_Object { public: @@ -337,22 +334,23 @@ public: char * pszMessage, RCODE rcOfMessage, FLMUINT * puiTermChar, - FLMUINT uiBackground, - FLMUINT uiForeground); + eColorType uiBackground, + eColorType uiForeground); RCODE globalConfig( FLMUINT uiOption); RCODE createStatusWindow( char * pszTitle, - FLMUINT uiBack, - FLMUINT uiFore, + eColorType uiBack, + eColorType uiFore, FLMUINT * puiCols, FLMUINT * puiRows, FTX_WINDOW ** ppWindow); FLMUINT getULX( void); + FLMUINT getULY( void); RCODE openNewDb(); diff --git a/xflaim/util/fdomedt.cpp b/xflaim/util/fdomedt.cpp index 78729c1..fc6b10a 100644 --- a/xflaim/util/fdomedt.cpp +++ b/xflaim/util/fdomedt.cpp @@ -24,14 +24,10 @@ //------------------------------------------------------------------------------ #include "flaimsys.h" -#include "ftx.h" #include "flm_lutl.h" #include "domedit.h" #include "fdynbuf.h" #include "fxpath.h" -#ifdef FLM_UNIX -#include "ctype.h" -#endif static char * pszDomeditMonths [12] = { @@ -197,30 +193,17 @@ FSTATIC RCODE setupIndexRow( FLMUINT uiFlag, DME_ROW_INFO ** ppTmpRow); -/* -DOMEdit prototypes -*/ - RCODE _domEditBackgroundThread( - F_Thread * pThread); + IF_Thread * pThread); RCODE domEditVerifyRun( void); -// Imported global variable(s)... extern FLMBOOL gv_bShutdown; -/* -Local prototypes -*/ - #define FLM_START_STATS #define FLM_STOP_STATS #define FLM_RESET_STATS -/* -Function / Method Implementations -*/ - /**************************************************************************** Desc: Default constructor *****************************************************************************/ @@ -458,9 +441,9 @@ Desc: RCODE F_DomEditor::setTitle( char * pszTitle) { - RCODE rc = NE_XFLM_OK; - FLMUINT uiBack; - FLMUINT uiFore; + RCODE rc = NE_XFLM_OK; + eColorType uiBack; + eColorType uiFore; flmAssert( m_bSetupCalled == TRUE); @@ -471,19 +454,11 @@ RCODE F_DomEditor::setTitle( if (m_pEditWindow) { - uiBack = (FLMUINT)((m_bMonochrome) - ? (FLMUINT)WPS_BLACK - : (FLMUINT)WPS_BLUE); - uiFore = (FLMUINT)WPS_WHITE; - if( FTXWinSetTitle( m_pEditWindow, m_szTitle, - uiBack, uiFore) != FTXRC_SUCCESS) - { - rc = RC_SET( NE_XFLM_MEM); - goto Exit; - } + uiBack = m_bMonochrome ? FLM_BLACK : FLM_BLUE; + uiFore = FLM_WHITE; + FTXWinSetTitle( m_pEditWindow, m_szTitle, uiBack, uiFore); } -Exit: return( rc); } @@ -582,25 +557,25 @@ public: } } - RCODE XFLMAPI queryStatus( + RCODE FLMAPI queryStatus( XFLM_OPT_INFO * pOptInfo); - RCODE XFLMAPI newSource( + RCODE FLMAPI newSource( XFLM_OPT_INFO * pOptInfo); - RCODE XFLMAPI resultSetStatus( + RCODE FLMAPI resultSetStatus( FLMUINT64 ui64TotalDocsRead, FLMUINT64 ui64TotalDocsPassed, FLMBOOL bCanRetrieveDocs); - RCODE XFLMAPI resultSetComplete( + RCODE FLMAPI resultSetComplete( FLMUINT64 ui64TotalDocsRead, FLMUINT64 ui64TotalDocsPassed); void createQueryStatusWindow( FTX_SCREEN * pScreen, - FLMUINT uiBack, - FLMUINT uiFore, + eColorType uiBack, + eColorType uiFore, char * pszQuery); RCODE testEscape( @@ -624,17 +599,17 @@ public: FLMUINT64 ui64TotalDocsPassed, FLMBOOL bCanRetrieveDocs); - FINLINE FLMUINT getRefCount( void) + FINLINE FLMINT FLMAPI getRefCount( void) { return( IF_QueryStatus::getRefCount()); } - virtual FINLINE FLMINT XFLMAPI AddRef( void) + virtual FINLINE FLMINT FLMAPI AddRef( void) { return( IF_QueryStatus::AddRef()); } - virtual FINLINE FLMINT XFLMAPI Release( void) + virtual FINLINE FLMINT FLMAPI Release( void) { return( IF_QueryStatus::Release()); } @@ -682,8 +657,8 @@ Desc: Displays a message window *****************************************************************************/ void EditQueryStatus::createQueryStatusWindow( FTX_SCREEN * pScreen, - FLMUINT uiBack, - FLMUINT uiFore, + eColorType uiBack, + eColorType uiFore, char * pszQuery) { FLMBOOL bOk = FALSE; @@ -691,65 +666,39 @@ void EditQueryStatus::createQueryStatusWindow( FLMUINT uiNumRows; FLMUINT uiQueryStrLen = f_strlen( pszQuery); - if (FTXScreenGetSize( pScreen, &uiNumCols, &uiNumRows) != FTXRC_SUCCESS) - { - goto Exit; - } - + FTXScreenGetSize( pScreen, &uiNumCols, &uiNumRows); m_uiNumCols = uiNumCols - 8; m_uiNumRows = uiNumRows - 4; - if (FTXWinInit( pScreen, m_uiNumCols, m_uiNumRows, - &m_pWindow) != FTXRC_SUCCESS) + if( RC_BAD( FTXWinInit( pScreen, m_uiNumCols, m_uiNumRows, &m_pWindow))) { goto Exit; } - if (FTXWinSetScroll( m_pWindow, FALSE) != FTXRC_SUCCESS) - { - goto Exit; - } + FTXWinSetScroll( m_pWindow, FALSE); + FTXWinSetCursorType( m_pWindow, FLM_CURSOR_INVISIBLE); + FTXWinSetBackFore( m_pWindow, uiBack, uiFore); + FTXWinClear( m_pWindow); + FTXWinDrawBorder( m_pWindow); - FTXWinSetCursorType( m_pWindow, WPS_CURSOR_INVISIBLE); + FTXWinMove( m_pWindow, (FLMUINT)((uiNumCols - m_uiNumCols) / 2), + (FLMUINT)((uiNumRows - m_uiNumRows) / 2)); - if (FTXWinSetBackFore( m_pWindow, uiBack, uiFore) != FTXRC_SUCCESS) - { - goto Exit; - } - - if (FTXWinClear( m_pWindow) != FTXRC_SUCCESS) - { - goto Exit; - } - - if (FTXWinDrawBorder( m_pWindow) != FTXRC_SUCCESS) - { - goto Exit; - } - - if (FTXWinMove( m_pWindow, (FLMUINT)((uiNumCols - m_uiNumCols) / 2), - (FLMUINT)((uiNumRows - m_uiNumRows) / 2)) != FTXRC_SUCCESS) - { - goto Exit; - } - - if (FTXWinOpen( m_pWindow) != FTXRC_SUCCESS) - { - goto Exit; - } + FTXWinOpen( m_pWindow); if (RC_BAD( f_alloc( uiQueryStrLen + 1, &m_pszQuery))) { goto Exit; } + f_memcpy( m_pszQuery, pszQuery, uiQueryStrLen + 1); + if (uiQueryStrLen > m_uiNumCols - 2 - DATA_COLUMN) { m_pszQuery [m_uiNumCols - 2 - DATA_COLUMN] = 0; } - FTXRefresh( pScreen->pFtxInfo); - + FTXRefresh(); bOk = TRUE; Exit: @@ -861,7 +810,7 @@ void EditQueryStatus::refreshStatus( outputLabel( USING_LINE, "Using Index"); if (m_optInfo.szIxName [0]) { - FLMUINT uiStrLen = f_strlen( m_optInfo.szIxName); + FLMUINT uiStrLen = f_strlen( (const char *)m_optInfo.szIxName); if (uiStrLen > m_uiNumCols - 2 - DATA_COLUMN) { m_optInfo.szIxName [m_uiNumCols - 2 - DATA_COLUMN] = 0; @@ -1038,19 +987,19 @@ RCODE EditQueryStatus::testEscape( } FTXWinInputChar( m_pWindow, puiChar); } - else if (FTXWinTestKB( m_pWindow) == FTXRC_SUCCESS) + else if( RC_OK( FTXWinTestKB( m_pWindow))) { FLMUINT uiChar; FTXWinInputChar( m_pWindow, &uiChar); - if (uiChar == WPK_ESCAPE) + if (uiChar == FKB_ESCAPE) { FTXWinSetCursorPos( m_pWindow, LABEL_COLUMN, MESSAGE_LINE); FTXWinPrintf( m_pWindow, "Escape pressed, exit? (Y=Show results, ESC=quit): "); - if (FTXWinInputChar( m_pWindow, &uiChar) == FTXRC_SHUTDOWN || - uiChar == WPK_ESCAPE) + if( RC_BAD( FTXWinInputChar( m_pWindow, &uiChar)) || + uiChar == FKB_ESCAPE) { rc = RC_SET( NE_XFLM_USER_ABORT); m_bKeepResults = FALSE; @@ -1136,7 +1085,7 @@ Exit: /**************************************************************************** Desc: Query status callback *****************************************************************************/ -RCODE XFLMAPI EditQueryStatus::resultSetStatus( +RCODE FLMAPI EditQueryStatus::resultSetStatus( FLMUINT64 ui64TotalDocsRead, FLMUINT64 ui64TotalDocsPassed, FLMBOOL bCanRetrieveDocs) @@ -1164,7 +1113,7 @@ Exit: /**************************************************************************** Desc: Query status callback *****************************************************************************/ -RCODE XFLMAPI EditQueryStatus::resultSetComplete( +RCODE FLMAPI EditQueryStatus::resultSetComplete( FLMUINT64 ui64TotalDocsRead, FLMUINT64 ui64TotalDocsPassed) { @@ -1216,13 +1165,14 @@ RCODE F_DomEditor::interactiveEdit( FLMBOOL bDoneEditing = FALSE; RCODE rc = NE_XFLM_OK; RCODE tmpRc = NE_XFLM_OK; - FLMUINT uiFore; - FLMUINT uiBack; - F_Thread * pIxManagerThrd = NULL; - F_Thread * pMemManagerThrd = NULL; + eColorType uiFore; + eColorType uiBack; + IF_Thread * pIxManagerThrd = NULL; + IF_Thread * pMemManagerThrd = NULL; char * pszQuery = NULL; FLMUINT uiSzQueryBufSize; F_DbSystem dbSystem; + IF_ThreadMgr * pThreadMgr = NULL; flmAssert( m_bSetupCalled == TRUE); flmAssert( m_pScreen != NULL); @@ -1231,11 +1181,18 @@ RCODE F_DomEditor::interactiveEdit( m_pScrFirstRow = NULL; m_uiLastKey = 0; uiSzQueryBufSize = 1024; + if (RC_BAD( rc = f_alloc( uiSzQueryBufSize, &pszQuery))) { goto Exit; } + *pszQuery = 0; + + if( RC_BAD( rc = FlmGetThreadMgr( &pThreadMgr))) + { + goto Exit; + } if( !m_pNameTable) { @@ -1247,12 +1204,7 @@ RCODE F_DomEditor::interactiveEdit( if( !uiLRX && !uiLRY) { - if( FTXScreenGetSize( m_pScreen, - &uiNumCols, &uiNumRows) != FTXRC_SUCCESS) - { - rc = RC_SET( NE_XFLM_MEM); - goto Exit; - } + FTXScreenGetSize( m_pScreen, &uiNumCols, &uiNumRows); uiNumRows -= uiULY; uiNumCols -= uiULX; @@ -1273,114 +1225,49 @@ RCODE F_DomEditor::interactiveEdit( m_uiLRX = uiLRX; m_uiLRY = uiLRY; - if( FTXWinInit( m_pScreen, uiNumCols, - uiNumRows, &m_pEditWindow) != FTXRC_SUCCESS) + if( RC_BAD( rc = FTXWinInit( m_pScreen, uiNumCols, + uiNumRows, &m_pEditWindow))) { - rc = RC_SET( NE_XFLM_MEM); goto Exit; } - if( FTXWinMove( m_pEditWindow, uiStartCol, uiULY) != FTXRC_SUCCESS) - { - rc = RC_SET( NE_XFLM_MEM); - goto Exit; - } + FTXWinMove( m_pEditWindow, uiStartCol, uiULY); + FTXWinSetScroll( m_pEditWindow, FALSE); + FTXWinSetLineWrap( m_pEditWindow, FALSE); + FTXWinSetCursorType( m_pEditWindow, FLM_CURSOR_INVISIBLE); - if( FTXWinSetScroll( m_pEditWindow, FALSE) != FTXRC_SUCCESS) - { - rc = RC_SET( NE_XFLM_MEM); - goto Exit; - } - - if( FTXWinSetLineWrap( m_pEditWindow, FALSE) != FTXRC_SUCCESS) - { - rc = RC_SET( NE_XFLM_MEM); - goto Exit; - } - - FTXWinSetCursorType( m_pEditWindow, WPS_CURSOR_INVISIBLE); - - uiBack = (FLMUINT)((m_bMonochrome) - ? (FLMUINT)WPS_BLACK - : (FLMUINT)WPS_BLUE); - uiFore = (FLMUINT)WPS_WHITE; - if( FTXWinSetBackFore( m_pEditWindow, uiBack, uiFore) != FTXRC_SUCCESS) - { - rc = RC_SET( NE_XFLM_MEM); - goto Exit; - } - - if( FTXWinClear( m_pEditWindow) != FTXRC_SUCCESS) - { - rc = RC_SET( NE_XFLM_MEM); - goto Exit; - } + uiBack = m_bMonochrome ? FLM_BLACK : FLM_BLUE; + uiFore = FLM_WHITE; + + FTXWinSetBackFore( m_pEditWindow, uiBack, uiFore); + FTXWinClear( m_pEditWindow); if( bBorder) { - if( FTXWinDrawBorder( m_pEditWindow) != FTXRC_SUCCESS) - { - rc = RC_SET( NE_XFLM_MEM); - goto Exit; - } + FTXWinDrawBorder( m_pEditWindow); } - if( FTXWinSetTitle( m_pEditWindow, m_szTitle, - uiBack, uiFore) != FTXRC_SUCCESS) - { - rc = RC_SET( NE_XFLM_MEM); - goto Exit; - } + FTXWinSetTitle( m_pEditWindow, m_szTitle, uiBack, uiFore); if( uiStatusLines) { - if( FTXWinInit( m_pScreen, uiNumCols, uiStatusLines, - &m_pEditStatusWin) != FTXRC_SUCCESS) - { - rc = RC_SET( NE_XFLM_MEM); - goto Exit; - } - - if( FTXWinMove( m_pEditStatusWin, uiULX, - uiULY + uiNumRows) != FTXRC_SUCCESS) - { - rc = RC_SET( NE_XFLM_MEM); - goto Exit; - } - - if( FTXWinSetScroll( m_pEditStatusWin, FALSE) != FTXRC_SUCCESS) + if( RC_BAD( rc = FTXWinInit( m_pScreen, uiNumCols, uiStatusLines, + &m_pEditStatusWin))) { goto Exit; } - FTXWinSetCursorType( m_pEditStatusWin, WPS_CURSOR_INVISIBLE); + FTXWinMove( m_pEditStatusWin, uiULX, uiULY + uiNumRows); + FTXWinSetScroll( m_pEditStatusWin, FALSE); + FTXWinSetCursorType( m_pEditStatusWin, FLM_CURSOR_INVISIBLE); + FTXWinSetBackFore( m_pEditStatusWin, + m_bMonochrome ? FLM_BLACK : FLM_GREEN, FLM_WHITE); - if( FTXWinSetBackFore( m_pEditStatusWin, - m_bMonochrome ? WPS_BLACK : WPS_GREEN, - WPS_WHITE) != FTXRC_SUCCESS) - { - rc = RC_SET( NE_XFLM_MEM); - goto Exit; - } - - if( FTXWinClear( m_pEditStatusWin) != FTXRC_SUCCESS) - { - rc = RC_SET( NE_XFLM_MEM); - goto Exit; - } - - if( FTXWinOpen( m_pEditStatusWin) != FTXRC_SUCCESS) - { - rc = RC_SET( NE_XFLM_MEM); - goto Exit; - } + FTXWinClear( m_pEditStatusWin); + FTXWinOpen( m_pEditStatusWin); } - if( FTXWinOpen( m_pEditWindow) != FTXRC_SUCCESS) - { - rc = RC_SET( NE_XFLM_MEM); - goto Exit; - } + FTXWinOpen( m_pEditWindow); FTXWinGetCanvasSize( m_pEditWindow, &uiNumCols, &uiNumRows); m_uiEditCanvasRows = uiNumRows; @@ -1406,7 +1293,7 @@ RCODE F_DomEditor::interactiveEdit( 0, m_EventData); } - FTXRefresh( m_pScreen->pFtxInfo); + FTXRefresh(); while( !bDoneEditing && !isExiting()) { if( bRefreshEditWindow) @@ -1420,12 +1307,8 @@ RCODE F_DomEditor::interactiveEdit( m_bMonochrome = m_pParent->isMonochrome(); } - if( FTXWinPaintBackground( m_pEditWindow, - m_bMonochrome ? WPS_BLACK : WPS_BLUE) != FTXRC_SUCCESS) - { - rc = RC_SET( NE_XFLM_MEM); - goto Exit; - } + FTXWinPaintBackground( m_pEditWindow, + m_bMonochrome ? FLM_BLACK : FLM_BLUE); if( m_pEventHook) { @@ -1448,13 +1331,9 @@ RCODE F_DomEditor::interactiveEdit( Update the status window */ - if( FTXWinSetBackFore( m_pEditStatusWin, - m_bMonochrome ? WPS_LIGHTGRAY : WPS_GREEN, - m_bMonochrome ? WPS_BLACK : WPS_WHITE) != FTXRC_SUCCESS) - { - rc = RC_SET( NE_XFLM_MEM); - goto Exit; - } + FTXWinSetBackFore( m_pEditStatusWin, + m_bMonochrome ? FLM_LIGHTGRAY : FLM_GREEN, + m_bMonochrome ? FLM_BLACK : FLM_WHITE); FTXWinSetCursorPos( m_pEditStatusWin, 0, 0); @@ -1525,11 +1404,11 @@ RCODE F_DomEditor::interactiveEdit( } FTXWinClearToEOL( m_pEditStatusWin); - FTXRefresh( m_pScreen->pFtxInfo); + FTXRefresh(); bRefreshStatusWindow = FALSE; } - if( uiHelpKey || FTXWinTestKB( m_pEditWindow) == FTXRC_SUCCESS) + if( uiHelpKey || RC_OK( FTXWinTestKB( m_pEditWindow))) { FLMUINT uiChar; @@ -1551,13 +1430,13 @@ RCODE F_DomEditor::interactiveEdit( { m_pKeyHook( this, m_pCurRow, uiChar, &uiChar, m_KeyData); } - if (uiChar != WPK_TAB) + if (uiChar != FKB_TAB) { m_uiLastKey = uiChar; } } - if( uiChar == WPK_TAB) + if( uiChar == FKB_TAB) { // Grab the last keystroke that was passed to the editor. // This is needed in environments where the ALT and @@ -1584,7 +1463,7 @@ RCODE F_DomEditor::interactiveEdit( break; } - case WPK_ENTER: + case FKB_ENTER: { if( !m_pCurRow) { @@ -1600,12 +1479,12 @@ RCODE F_DomEditor::interactiveEdit( else if( !canEditRow( m_pCurRow)) { displayMessage( "The row cannot be edited", - RC_SET( NE_XFLM_ILLEGAL_OP), NULL, WPS_RED, WPS_WHITE); + RC_SET( NE_XFLM_ILLEGAL_OP), NULL, FLM_RED, FLM_WHITE); } else if( RC_BAD( tmpRc = editRow( m_uiCurRow, m_pCurRow))) { displayMessage( "The field could not be edited", tmpRc, - NULL, WPS_RED, WPS_WHITE); + NULL, FLM_RED, FLM_WHITE); } bRefreshEditWindow = TRUE; @@ -1631,7 +1510,7 @@ RCODE F_DomEditor::interactiveEdit( if( RC_BAD( tmpRc = editRow( m_uiCurRow, m_pCurRow, TRUE))) { displayMessage( "The field could not be edited", tmpRc, - NULL, WPS_RED, WPS_WHITE); + NULL, FLM_RED, FLM_WHITE); } bRefreshEditWindow = TRUE; @@ -1639,7 +1518,7 @@ RCODE F_DomEditor::interactiveEdit( } // Expand the current row. - case WPK_RIGHT: + case FKB_RIGHT: { DME_ROW_INFO * pLastRow = NULL; if (!m_pCurRow->bExpanded) @@ -1647,7 +1526,7 @@ RCODE F_DomEditor::interactiveEdit( if (RC_BAD( tmpRc = expandRow( m_pCurRow, TRUE, &pLastRow))) { displayMessage( "Error expanding current row", tmpRc, - NULL, WPS_RED, WPS_WHITE); + NULL, FLM_RED, FLM_WHITE); break; } if (m_pCurRow->bExpanded) @@ -1679,7 +1558,7 @@ RCODE F_DomEditor::interactiveEdit( } // Expand the current row. - case WPK_PLUS: + case FKB_PLUS: { DME_ROW_INFO * pLastRow = NULL; if (!m_pCurRow->bExpanded) @@ -1717,15 +1596,15 @@ RCODE F_DomEditor::interactiveEdit( // Collapse the current row. - case WPK_LEFT: - case WPK_MINUS: + case FKB_LEFT: + case FKB_MINUS: { if (m_pCurRow->bExpanded) { if (RC_BAD( tmpRc = collapseRow( &m_pCurRow))) { displayMessage( "Error collapsing current row", tmpRc, - NULL, WPS_RED, WPS_WHITE); + NULL, FLM_RED, FLM_WHITE); break; } bRefreshEditWindow = TRUE; @@ -1735,7 +1614,7 @@ RCODE F_DomEditor::interactiveEdit( // Move field cursor to the next row - case WPK_DOWN: + case FKB_DOWN: { if (RC_BAD( tmpRc = getNextRow( m_pCurRow, &pTmpRow, @@ -1743,7 +1622,7 @@ RCODE F_DomEditor::interactiveEdit( m_pCurRow ? !m_pCurRow->bExpanded : FALSE))) { displayMessage( "Failed to retrieve a new row.", tmpRc, - NULL, WPS_RED, WPS_WHITE); + NULL, FLM_RED, FLM_WHITE); break; } @@ -1768,14 +1647,14 @@ RCODE F_DomEditor::interactiveEdit( // Move field cursor to the prior row - case WPK_UP: + case FKB_UP: { if (RC_BAD( tmpRc = getPrevRow( m_pCurRow, &pTmpRow, TRUE))) { displayMessage( "Failed to retrieve a previous row.", tmpRc, - NULL, WPS_RED, WPS_WHITE); + NULL, FLM_RED, FLM_WHITE); break; } if( pTmpRow != NULL) @@ -1802,7 +1681,7 @@ RCODE F_DomEditor::interactiveEdit( Page up */ - case WPK_PGUP: + case FKB_PGUP: { for( uiLoop = 0; uiLoop < uiNumRows; uiLoop++) { @@ -1812,7 +1691,7 @@ RCODE F_DomEditor::interactiveEdit( TRUE))) { displayMessage( "Failed to retrieve a previous row.", tmpRc, - NULL, WPS_RED, WPS_WHITE); + NULL, FLM_RED, FLM_WHITE); break;; } @@ -1837,7 +1716,7 @@ RCODE F_DomEditor::interactiveEdit( Page down */ - case WPK_PGDN: + case FKB_PGDN: { FLMBOOL bIgnoreAnchor = !m_pCurRow->bExpanded; for( uiLoop = 0; uiLoop < uiNumRows; uiLoop++) @@ -1848,7 +1727,7 @@ RCODE F_DomEditor::interactiveEdit( bIgnoreAnchor))) { displayMessage( "Failed to retrieve a next row.", tmpRc, - NULL, WPS_RED, WPS_WHITE); + NULL, FLM_RED, FLM_WHITE); break; } if (pTmpRow != NULL) @@ -1876,7 +1755,7 @@ RCODE F_DomEditor::interactiveEdit( Go to the top of the buffer */ #if 0 // Removed functionality - case WPK_HOME: + case FKB_HOME: { m_pCurRow = m_pScrFirstRow; m_uiCurRow = 0; @@ -1890,7 +1769,7 @@ RCODE F_DomEditor::interactiveEdit( Jump to the end of the buffer */ - case WPK_END: + case FKB_END: { m_uiCurRow = uiMaxRow; for( ;;) @@ -1916,7 +1795,7 @@ RCODE F_DomEditor::interactiveEdit( } #endif - case WPK_END: + case FKB_END: { if( m_pEditStatusWin) { @@ -1937,7 +1816,7 @@ RCODE F_DomEditor::interactiveEdit( TRUE))) { displayMessage( "Failed to retrieve a next row.", tmpRc, - NULL, WPS_RED, WPS_WHITE); + NULL, FLM_RED, FLM_WHITE); break; } if (pTmpRow != NULL) @@ -1961,7 +1840,7 @@ RCODE F_DomEditor::interactiveEdit( Jump to the top of the buffer */ - case WPK_HOME: + case FKB_HOME: { if( m_pEditStatusWin) { @@ -1982,7 +1861,7 @@ RCODE F_DomEditor::interactiveEdit( TRUE))) { displayMessage( "Failed to retrieve a previous row.", tmpRc, - NULL, WPS_RED, WPS_WHITE); + NULL, FLM_RED, FLM_WHITE); break; } if (pTmpRow != NULL) @@ -2006,12 +1885,12 @@ RCODE F_DomEditor::interactiveEdit( // Add something case 'N': case 'n': - case WPK_ALT_A: + case FKB_ALT_A: { if (RC_BAD( tmpRc = addSomething( &m_pCurRow))) { displayMessage( "Add/Insert operation failed", - RC_SET( tmpRc), NULL, WPS_RED, WPS_WHITE); + RC_SET( tmpRc), NULL, FLM_RED, FLM_WHITE); break; } bRefreshEditWindow = TRUE; @@ -2026,7 +1905,7 @@ RCODE F_DomEditor::interactiveEdit( { displayMessage( "Attributes could not be displayed", - RC_SET( tmpRc), NULL, WPS_RED, WPS_WHITE); + RC_SET( tmpRc), NULL, FLM_RED, FLM_WHITE); } break; } @@ -2039,7 +1918,7 @@ RCODE F_DomEditor::interactiveEdit( { displayMessage( "Node information could not be displayed", - RC_SET( tmpRc), NULL, WPS_RED, WPS_WHITE); + RC_SET( tmpRc), NULL, FLM_RED, FLM_WHITE); } break; } @@ -2051,7 +1930,7 @@ RCODE F_DomEditor::interactiveEdit( { displayMessage( "Node could not be exported", - RC_SET( tmpRc), NULL, WPS_RED, WPS_WHITE); + RC_SET( tmpRc), NULL, FLM_RED, FLM_WHITE); } break; } @@ -2061,7 +1940,7 @@ RCODE F_DomEditor::interactiveEdit( case 'I': case 'i': - case WPK_ALT_I: + case FKB_ALT_I: { if( m_pDb == NULL) { @@ -2073,8 +1952,8 @@ RCODE F_DomEditor::interactiveEdit( displayMessage( "Index List Operation Failed", RC_SET(tmpRc), NULL, - WPS_RED, - WPS_WHITE); + FLM_RED, + FLM_WHITE); break; } bRefreshEditWindow = TRUE; @@ -2086,7 +1965,7 @@ RCODE F_DomEditor::interactiveEdit( */ case 'L': case 'l': - case WPK_ALT_L: + case FKB_ALT_L: { FLMUINT uiCollection = m_uiCollection; @@ -2106,12 +1985,12 @@ RCODE F_DomEditor::interactiveEdit( displayMessage( "Error getting collection", RC_SET(tmpRc), NULL, - WPS_RED, - WPS_WHITE); + FLM_RED, + FLM_WHITE); break; } - if( uiTermChar != WPK_ENTER) + if( uiTermChar != FKB_ENTER) { break; } @@ -2130,12 +2009,12 @@ RCODE F_DomEditor::interactiveEdit( displayMessage( "Unable to retrieve document list", RC_SET(tmpRc), NULL, - WPS_RED, - WPS_WHITE); + FLM_RED, + FLM_WHITE); break; } - if( uiTermChar != WPK_ENTER) + if( uiTermChar != FKB_ENTER) { break; } @@ -2150,8 +2029,8 @@ RCODE F_DomEditor::interactiveEdit( displayMessage( "Document already selected", NE_XFLM_FAILURE, NULL, - WPS_RED, - WPS_WHITE); + FLM_RED, + FLM_WHITE); break; } @@ -2175,8 +2054,8 @@ RCODE F_DomEditor::interactiveEdit( displayMessage( "Unable to retrieve selected document", RC_SET( tmpRc), NULL, - WPS_RED, - WPS_WHITE); + FLM_RED, + FLM_WHITE); break; } @@ -2190,8 +2069,8 @@ RCODE F_DomEditor::interactiveEdit( displayMessage( "Unable to add document to document list", RC_SET(tmpRc), NULL, - WPS_RED, - WPS_WHITE); + FLM_RED, + FLM_WHITE); break; } @@ -2205,7 +2084,7 @@ RCODE F_DomEditor::interactiveEdit( case 'R': case 'r': - case WPK_ALT_R: + case FKB_ALT_R: { FLMUINT uiCollection; char szResponse[ 32]; @@ -2220,7 +2099,7 @@ RCODE F_DomEditor::interactiveEdit( sizeof( szResponse), &uiTermChar); - if( uiTermChar == WPK_ESCAPE) + if( uiTermChar == FKB_ESCAPE) { break; } @@ -2236,8 +2115,8 @@ RCODE F_DomEditor::interactiveEdit( displayMessage( "Invalid node number", RC_SET( tmpRc), NULL, - WPS_RED, - WPS_WHITE); + FLM_RED, + FLM_WHITE); break; } uiNodeId = (FLMUINT)ui64Tmp; @@ -2253,12 +2132,12 @@ RCODE F_DomEditor::interactiveEdit( displayMessage( "Error getting collection", RC_SET(tmpRc), NULL, - WPS_RED, - WPS_WHITE); + FLM_RED, + FLM_WHITE); break; } - if( uiTermChar != WPK_ENTER) + if( uiTermChar != FKB_ENTER) { break; } @@ -2275,8 +2154,8 @@ RCODE F_DomEditor::interactiveEdit( displayMessage( "Unable to retrieve node", RC_SET( tmpRc), NULL, - WPS_RED, - WPS_WHITE); + FLM_RED, + FLM_WHITE); break; } @@ -2292,7 +2171,7 @@ RCODE F_DomEditor::interactiveEdit( case 'F': case 'f': - case WPK_ALT_F: + case FKB_ALT_F: doQuery( pszQuery, uiSzQueryBufSize); break; @@ -2303,7 +2182,7 @@ RCODE F_DomEditor::interactiveEdit( case 'C': case 'c': - case WPK_ALT_C: + case FKB_ALT_C: { char szResponse[ 2]; FLMUINT uiTermChar; @@ -2313,7 +2192,7 @@ RCODE F_DomEditor::interactiveEdit( "Clear buffer and discard modifications? (Y/N)", szResponse, 2, &uiTermChar); - if( uiTermChar == WPK_ESCAPE) + if( uiTermChar == FKB_ESCAPE) { break; } @@ -2342,7 +2221,7 @@ RCODE F_DomEditor::interactiveEdit( "Statistics (b = begin, e = end, r = reset)", szAction, sizeof( szAction), &uiTermChar); - if( uiTermChar == WPK_ESCAPE) + if( uiTermChar == FKB_ESCAPE) { break; } @@ -2367,8 +2246,8 @@ RCODE F_DomEditor::interactiveEdit( displayMessage( "Error Starting Statistics", RC_SET( tmpRc), NULL, - WPS_RED, - WPS_WHITE); + FLM_RED, + FLM_WHITE); break; } } @@ -2387,8 +2266,8 @@ RCODE F_DomEditor::interactiveEdit( displayMessage( "Error Stopping Statistics", RC_SET( tmpRc), NULL, - WPS_RED, - WPS_WHITE); + FLM_RED, + FLM_WHITE); break; } } @@ -2406,8 +2285,8 @@ RCODE F_DomEditor::interactiveEdit( displayMessage( "Error Resetting Statistics", RC_SET( tmpRc), NULL, - WPS_RED, - WPS_WHITE); + FLM_RED, + FLM_WHITE); break; } } @@ -2416,8 +2295,8 @@ RCODE F_DomEditor::interactiveEdit( displayMessage( "Invalid Request", RC_SET( NE_XFLM_FAILURE), NULL, - WPS_RED, - WPS_WHITE); + FLM_RED, + FLM_WHITE); break; } bRefreshStatusWindow = TRUE; @@ -2430,7 +2309,7 @@ RCODE F_DomEditor::interactiveEdit( break; } - case WPK_F10: + case FKB_F10: { if( m_bMonochrome) { @@ -2445,7 +2324,7 @@ RCODE F_DomEditor::interactiveEdit( break; } - case WPK_F8: /* Index Manager */ + case FKB_F8: /* Index Manager */ { char szDbPath [F_PATH_MAX_SIZE]; F_Db * pTmpDb = NULL; @@ -2455,7 +2334,11 @@ RCODE F_DomEditor::interactiveEdit( break; } - f_threadDestroy( &pIxManagerThrd); + if( pIxManagerThrd) + { + pIxManagerThrd->Release(); + pIxManagerThrd = NULL; + } (void)m_pDb->getDbControlFileName( szDbPath, sizeof( szDbPath)); @@ -2464,53 +2347,56 @@ RCODE F_DomEditor::interactiveEdit( NULL, NULL, TRUE, (IF_Db **)&pTmpDb))) { - f_threadCreate( &pIxManagerThrd, - flstIndexManagerThread, - "index_manager", - FLM_DEFAULT_THREAD_GROUP, 0, - (void *)pTmpDb); + pThreadMgr->createThread( &pIxManagerThrd, + flstIndexManagerThread, + "index_manager", 0, 0, (void *)pTmpDb); } else { displayMessage( "Failed to open database", RC_SET( tmpRc), NULL, - WPS_RED, - WPS_WHITE); + FLM_RED, + FLM_WHITE); } break; } - case WPK_F9: /* Memory Manager */ + case FKB_F9: /* Memory Manager */ { - f_threadDestroy( &pMemManagerThrd); - f_threadCreate( &pMemManagerThrd, + if( pMemManagerThrd) + { + pMemManagerThrd->Release(); + pMemManagerThrd = NULL; + } + + pThreadMgr->createThread( &pMemManagerThrd, flstMemoryManagerThread, "memory_manager"); break; } - case WPK_DELETE: + case FKB_DELETE: { if (RC_BAD( tmpRc = deleteRow( &m_pCurRow))) { displayMessage( "Delete operation failed", RC_SET( tmpRc), NULL, - WPS_RED, - WPS_WHITE); + FLM_RED, + FLM_WHITE); break; } bRefreshEditWindow = TRUE; break; } - case WPK_ESCAPE: + case FKB_ESCAPE: case 'Q': case 'q': case 'Z': case 'z': - case WPK_ALT_Q: - case WPK_ALT_Z: + case FKB_ALT_Q: + case FKB_ALT_Z: { bDoneEditing = TRUE; break; @@ -2536,8 +2422,20 @@ Exit: f_free( &pszQuery); - f_threadDestroy( &pIxManagerThrd); - f_threadDestroy( &pMemManagerThrd); + if( pIxManagerThrd) + { + pIxManagerThrd->Release(); + } + + if( pMemManagerThrd) + { + pMemManagerThrd->Release(); + } + + if( pThreadMgr) + { + pThreadMgr->Release(); + } if( m_pEditWindow) { @@ -2636,7 +2534,7 @@ RCODE F_DomEditor::refreshEditWindow( // Turn display refresh off temporarily - FTXSetRefreshState( m_pScreen->pFtxInfo, TRUE); + FTXSetRefreshState( TRUE); // Start a transaction @@ -2681,7 +2579,7 @@ Exit: Re-enable display refresh */ - FTXSetRefreshState( m_pScreen->pFtxInfo, FALSE); + FTXSetRefreshState( FALSE); return( rc); } @@ -2904,8 +2802,9 @@ RCODE F_DomEditor::refreshRow( if( bSelected) { - FLMUINT uiBackground = m_bMonochrome ? WPS_LIGHTGRAY : WPS_CYAN; - FLMUINT uiForeground = m_bMonochrome ? WPS_BLACK : WPS_WHITE; + eColorType uiBackground = m_bMonochrome ? FLM_LIGHTGRAY : FLM_CYAN; + eColorType uiForeground = m_bMonochrome ? FLM_BLACK : FLM_WHITE; + FTXWinPaintRow( m_pEditWindow, &uiBackground, &uiForeground, uiRow); } @@ -2952,8 +2851,8 @@ RCODE F_DomEditor::displayMessage( char * pszMessage, RCODE rcOfMessage, FLMUINT * puiTermChar, - FLMUINT uiBackground, - FLMUINT uiForeground) + eColorType uiBackground, + eColorType uiForeground) { RCODE rc = NE_XFLM_OK; char szErr [20]; @@ -2967,8 +2866,8 @@ RCODE F_DomEditor::displayMessage( *puiTermChar = 0; } - FTXDisplayMessage( m_pScreen, m_bMonochrome ? WPS_LIGHTGRAY : uiBackground, - m_bMonochrome ? WPS_BLACK : uiForeground, szErr, puiTermChar); + FTXDisplayMessage( m_pScreen, m_bMonochrome ? FLM_LIGHTGRAY : uiBackground, + m_bMonochrome ? FLM_BLACK : uiForeground, pszMessage, szErr, puiTermChar); return( rc); } @@ -2994,7 +2893,7 @@ RCODE F_DomEditor::openNewDb( void) goto Exit; } - if (uiChar == WPK_ESCAPE) + if (uiChar == FKB_ESCAPE) { break; } @@ -3002,7 +2901,7 @@ RCODE F_DomEditor::openNewDb( void) (IF_Db **)&m_pDb))) { displayMessage( "Unable to open database", rc, - NULL, WPS_RED, WPS_WHITE); + NULL, FLM_RED, FLM_WHITE); m_pDb = NULL; continue; } @@ -3026,105 +2925,73 @@ RCODE F_DomEditor::requestInput( FLMUINT uiMaxRespLen, FLMUINT * puiTermChar) { - FLMUINT uiNumCols; - FLMUINT uiNumRows; - FLMUINT uiNumWinRows = 3; - FLMUINT uiNumWinCols; - FTX_WINDOW * pWindow = NULL; - IF_FileHdl * pFileHdl = NULL; - RCODE rc = NE_XFLM_OK; + RCODE rc = NE_XFLM_OK; + FLMUINT uiNumCols; + FLMUINT uiNumRows; + FLMUINT uiNumWinRows = 3; + FLMUINT uiNumWinCols; + FTX_WINDOW * pWindow = NULL; + IF_FileHdl * pFileHdl = NULL; + IF_FileSystem * pFileSystem = NULL; flmAssert( m_bSetupCalled == TRUE); - - if( FTXScreenGetSize( m_pScreen, &uiNumCols, &uiNumRows) != FTXRC_SUCCESS) + + if( RC_BAD( rc = FlmGetFileSystem( &pFileSystem))) { - rc = RC_SET( NE_XFLM_MEM); goto Exit; } + FTXScreenGetSize( m_pScreen, &uiNumCols, &uiNumRows); + uiNumWinCols = uiNumCols - 8; - if( FTXWinInit( m_pScreen, uiNumWinCols, - uiNumWinRows, &pWindow) != FTXRC_SUCCESS) - { - rc = RC_SET( NE_XFLM_MEM); - goto Exit; - } - - if( FTXWinSetScroll( pWindow, FALSE) != FTXRC_SUCCESS) + if( RC_BAD( rc = FTXWinInit( m_pScreen, uiNumWinCols, + uiNumWinRows, &pWindow))) { goto Exit; } - FTXWinSetCursorType( pWindow, WPS_CURSOR_UNDERLINE); + FTXWinSetScroll( pWindow, FALSE); + FTXWinSetCursorType( pWindow, FLM_CURSOR_UNDERLINE); - if( FTXWinSetBackFore( pWindow, m_bMonochrome ? WPS_BLACK : WPS_CYAN, - WPS_WHITE) != FTXRC_SUCCESS) - { - rc = RC_SET( NE_XFLM_MEM); - goto Exit; - } + FTXWinSetBackFore( pWindow, m_bMonochrome ? FLM_BLACK : FLM_CYAN, FLM_WHITE); + FTXWinClear( pWindow); + FTXWinDrawBorder( pWindow); - if( FTXWinClear( pWindow) != FTXRC_SUCCESS) - { - rc = RC_SET( NE_XFLM_MEM); - goto Exit; - } + FTXWinMove( pWindow, (uiNumCols - uiNumWinCols) / 2, + (uiNumRows - uiNumWinRows) / 2); - if( FTXWinDrawBorder( pWindow) != FTXRC_SUCCESS) - { - rc = RC_SET( NE_XFLM_MEM); - goto Exit; - } - - if( FTXWinMove( pWindow, (uiNumCols - uiNumWinCols) / 2, - (uiNumRows - uiNumWinRows) / 2) != FTXRC_SUCCESS) - { - rc = RC_SET( NE_XFLM_MEM); - goto Exit; - } - - if( FTXWinOpen( pWindow) != FTXRC_SUCCESS) - { - rc = RC_SET( NE_XFLM_MEM); - goto Exit; - } + FTXWinOpen( pWindow); for( ;;) { - if( FTXWinClear( pWindow) != FTXRC_SUCCESS) - { - rc = RC_SET( NE_XFLM_MEM); - goto Exit; - } - + FTXWinClear( pWindow); FTXWinPrintf( pWindow, "%s: ", pszMessage); - if( FTXLineEdit( pWindow, pszResponse, uiMaxRespLen, uiMaxRespLen, - NULL, puiTermChar) != FTXRC_SUCCESS) + if( RC_BAD( rc = FTXLineEdit( pWindow, pszResponse, + uiMaxRespLen, uiMaxRespLen, NULL, puiTermChar))) { - rc = RC_SET( NE_XFLM_FAILURE); goto Exit; } - if( *puiTermChar == WPK_F1) + if( *puiTermChar == FKB_F1) { FLMUINT uiBytesRead; char * pszSrc; char * pszDest; - if( RC_BAD( rc = gv_pFileSystem->Open( pszResponse, XFLM_IO_RDONLY, + if( RC_BAD( rc = pFileSystem->openFile( pszResponse, FLM_IO_RDONLY, &pFileHdl))) { displayMessage( "Unable to open file", rc, - NULL, WPS_RED, WPS_WHITE); + NULL, FLM_RED, FLM_WHITE); continue; } - if( RC_BAD( rc = pFileHdl->Read( 0, uiMaxRespLen, + if( RC_BAD( rc = pFileHdl->read( 0, uiMaxRespLen, pszResponse, &uiBytesRead))) { - if( rc == NE_XFLM_IO_END_OF_FILE) + if( rc == NE_FLM_IO_END_OF_FILE) { rc = NE_XFLM_OK; } @@ -3178,6 +3045,11 @@ Exit: { pFileHdl->Release(); } + + if( pFileSystem) + { + pFileSystem->Release(); + } if( pWindow) { @@ -5067,7 +4939,7 @@ RCODE F_DomEditor::displayAttributes( { displayMessage( "Node DOM Nodes to display attributes for", - NE_XFLM_FAILURE, NULL, WPS_RED, WPS_WHITE); + NE_XFLM_FAILURE, NULL, FLM_RED, FLM_WHITE); goto Exit; } @@ -5075,7 +4947,7 @@ RCODE F_DomEditor::displayAttributes( { displayMessage( "DOM Node is not an ELEMENT_NODE", - NE_XFLM_FAILURE, NULL, WPS_RED, WPS_WHITE); + NE_XFLM_FAILURE, NULL, FLM_RED, FLM_WHITE); goto Exit; } @@ -5083,7 +4955,7 @@ RCODE F_DomEditor::displayAttributes( { displayMessage( "DOM Node does not have attributes", - NE_XFLM_FAILURE, NULL, WPS_RED, WPS_WHITE); + NE_XFLM_FAILURE, NULL, FLM_RED, FLM_WHITE); goto Exit; } @@ -5252,8 +5124,9 @@ FSTATIC void domGetOutputFileName( *pszOutputFileName = 0; FTXWinPrintf( pWindow, "Enter Output File Name: "); - if (FTXLineEdit( pWindow, pszOutputFileName, uiOutputFileNameBufSize - 1, - uiOutputFileNameBufSize - 1, NULL, &uiChar) != FTXRC_SUCCESS) + if( RC_BAD( FTXLineEdit( pWindow, pszOutputFileName, + uiOutputFileNameBufSize - 1, uiOutputFileNameBufSize - 1, + NULL, &uiChar))) { *pszOutputFileName = 0; } @@ -5275,7 +5148,7 @@ RCODE F_DomEditor::displayNodeInfo( if (RC_BAD( rc = createStatusWindow( "Node Information", - WPS_GREEN, WPS_WHITE, NULL, NULL, &pWindow))) + FLM_GREEN, FLM_WHITE, NULL, NULL, &pWindow))) { goto Exit; } @@ -5306,8 +5179,8 @@ RCODE F_DomEditor::displayNodeInfo( } else { - FTXDisplayMessage( m_pScreen, m_bMonochrome ? WPS_LIGHTGRAY : WPS_RED, - m_bMonochrome ? WPS_BLACK : WPS_WHITE, + FTXDisplayMessage( m_pScreen, m_bMonochrome ? FLM_LIGHTGRAY : FLM_RED, + m_bMonochrome ? FLM_BLACK : FLM_WHITE, "Invalid option", NULL, &uiTermChar); uiChar = 0; } @@ -5319,15 +5192,15 @@ RCODE F_DomEditor::displayNodeInfo( break; case 'N': case 'n': - case WPK_ENTER: + case FKB_ENTER: domGetOutputFileName( pWindow, szOutputFile, sizeof( szOutputFile)); domDisplayNodeInfo( pWindow, szOutputFile, m_pDb, m_uiCollection, pRow->ui64NodeId, FALSE, TRUE); break; - case WPK_ESC: + case FKB_ESC: break; default: - FTXDisplayMessage( m_pScreen, m_bMonochrome ? WPS_LIGHTGRAY : WPS_RED, - m_bMonochrome ? WPS_BLACK : WPS_WHITE, + FTXDisplayMessage( m_pScreen, m_bMonochrome ? FLM_LIGHTGRAY : FLM_RED, + m_bMonochrome ? FLM_BLACK : FLM_WHITE, "Invalid option", NULL, &uiTermChar); uiChar = 0; break; @@ -5368,7 +5241,7 @@ RCODE F_DomEditor::exportNode( if (RC_BAD( rc = createStatusWindow( "Export Node Subtree", - WPS_GREEN, WPS_WHITE, NULL, NULL, &pWindow))) + FLM_GREEN, FLM_WHITE, NULL, NULL, &pWindow))) { goto Exit; } @@ -5381,9 +5254,9 @@ RCODE F_DomEditor::exportNode( FTXWinSetCursorPos( pWindow, 2, 1); FTXWinClearLine( pWindow, 2, 1); FTXWinPrintf( pWindow, "Enter Export File Name: "); - if ((rc = FTXLineEdit( pWindow, szFileName, sizeof( szFileName) - 1, - sizeof( szFileName) - 1, - NULL, &uiChar)) != FTXRC_SUCCESS) + if( RC_BAD( rc = FTXLineEdit( pWindow, szFileName, + sizeof( szFileName) - 1, sizeof( szFileName) - 1, + NULL, &uiChar))) { goto Exit; } @@ -5393,7 +5266,7 @@ RCODE F_DomEditor::exportNode( } if (RC_BAD( rc = dbSystem.openFileOStream( szFileName, TRUE, &pFileOStream))) { - displayMessage( "Error creating export file", rc, NULL, WPS_RED, WPS_WHITE); + displayMessage( "Error creating export file", rc, NULL, FLM_RED, FLM_WHITE); } else { @@ -5413,7 +5286,7 @@ RCODE F_DomEditor::exportNode( { case 'I': case 'i': - case WPK_ENTER: + case FKB_ENTER: eFormat = XFLM_EXPORT_INDENT; FTXWinPrintf( pWindow, "I"); break; @@ -5432,11 +5305,11 @@ RCODE F_DomEditor::exportNode( eFormat = XFLM_EXPORT_NO_FORMAT; FTXWinPrintf( pWindow, "X"); break; - case WPK_ESC: + case FKB_ESC: goto Exit; default: - FTXDisplayMessage( m_pScreen, m_bMonochrome ? WPS_LIGHTGRAY : WPS_RED, - m_bMonochrome ? WPS_BLACK : WPS_WHITE, + FTXDisplayMessage( m_pScreen, m_bMonochrome ? FLM_LIGHTGRAY : FLM_RED, + m_bMonochrome ? FLM_BLACK : FLM_WHITE, "Invalid option", NULL, &uiTermChar); uiChar = 0; break; @@ -5459,12 +5332,12 @@ RCODE F_DomEditor::exportNode( } if (RC_BAD( rc)) { - displayMessage( "Error getting node", rc, NULL, WPS_RED, WPS_WHITE); + displayMessage( "Error getting node", rc, NULL, FLM_RED, FLM_WHITE); goto Exit; } if( RC_BAD( rc = m_pDb->exportXML( pNode, pFileOStream, eFormat))) { - displayMessage( "Error exporting data", rc, NULL, WPS_RED, WPS_WHITE); + displayMessage( "Error exporting data", rc, NULL, FLM_RED, FLM_WHITE); goto Exit; } FTXWinSetCursorPos( pWindow, 2, 3); @@ -6108,7 +5981,7 @@ RCODE F_DomEditor::showHelp( pTmpRow = NULL; asciiToUnicode( "UP Position cursor to the previous field", &uzItemName[0]); - if (RC_BAD( rc = makeNewRow( &pTmpRow, &uzItemName[0], WPK_UP, TRUE))) + if (RC_BAD( rc = makeNewRow( &pTmpRow, &uzItemName[0], FKB_UP, TRUE))) { goto Exit; } @@ -6123,7 +5996,7 @@ RCODE F_DomEditor::showHelp( pTmpRow = NULL; asciiToUnicode( "DOWN Position cursor to the next field", &uzItemName[0]); - if (RC_BAD( rc = makeNewRow( &pTmpRow, &uzItemName[0], WPK_DOWN, TRUE))) + if (RC_BAD( rc = makeNewRow( &pTmpRow, &uzItemName[0], FKB_DOWN, TRUE))) { goto Exit; } @@ -6139,7 +6012,7 @@ RCODE F_DomEditor::showHelp( asciiToUnicode( "PG UP Position cursor to the previous page", &uzItemName[0]); - if (RC_BAD( rc = makeNewRow( &pTmpRow, &uzItemName[0], WPK_PGUP, TRUE))) + if (RC_BAD( rc = makeNewRow( &pTmpRow, &uzItemName[0], FKB_PGUP, TRUE))) { goto Exit; } @@ -6154,7 +6027,7 @@ RCODE F_DomEditor::showHelp( pTmpRow = NULL; asciiToUnicode( "PG DOWN Position cursor to the next page", &uzItemName[0]); - if (RC_BAD( rc = makeNewRow( &pTmpRow, &uzItemName[0], WPK_PGDN, TRUE))) + if (RC_BAD( rc = makeNewRow( &pTmpRow, &uzItemName[0], FKB_PGDN, TRUE))) { goto Exit; } @@ -6169,7 +6042,7 @@ RCODE F_DomEditor::showHelp( pTmpRow = NULL; asciiToUnicode( "HOME Position cursor to the top of the buffer", &uzItemName[0]); - if (RC_BAD( rc = makeNewRow( &pTmpRow, &uzItemName[0], WPK_HOME, TRUE))) + if (RC_BAD( rc = makeNewRow( &pTmpRow, &uzItemName[0], FKB_HOME, TRUE))) { goto Exit; } @@ -6184,7 +6057,7 @@ RCODE F_DomEditor::showHelp( pTmpRow = NULL; asciiToUnicode( "END Position cursor to the bottom of the buffer", &uzItemName[0]); - if (RC_BAD( rc = makeNewRow( &pTmpRow, &uzItemName[0], WPK_END, TRUE))) + if (RC_BAD( rc = makeNewRow( &pTmpRow, &uzItemName[0], FKB_END, TRUE))) { goto Exit; } @@ -6199,7 +6072,7 @@ RCODE F_DomEditor::showHelp( pTmpRow = NULL; asciiToUnicode( "DELETE Delete the current node", &uzItemName[0]); - if (RC_BAD( rc = makeNewRow( &pTmpRow, &uzItemName[0], WPK_DELETE, TRUE))) + if (RC_BAD( rc = makeNewRow( &pTmpRow, &uzItemName[0], FKB_DELETE, TRUE))) { goto Exit; } @@ -6386,7 +6259,7 @@ RCODE F_DomEditor::showHelp( asciiToUnicode( "RIGHT Expand context one level", &uzItemName[0]); - if (RC_BAD( rc = makeNewRow( &pTmpRow, &uzItemName[0], WPK_RIGHT, TRUE))) + if (RC_BAD( rc = makeNewRow( &pTmpRow, &uzItemName[0], FKB_RIGHT, TRUE))) { goto Exit; } @@ -6401,7 +6274,7 @@ RCODE F_DomEditor::showHelp( pTmpRow = NULL; asciiToUnicode( "LEFT Collapse context", &uzItemName[0]); - if (RC_BAD( rc = makeNewRow( &pTmpRow, &uzItemName[0], WPK_LEFT, TRUE))) + if (RC_BAD( rc = makeNewRow( &pTmpRow, &uzItemName[0], FKB_LEFT, TRUE))) { goto Exit; } @@ -6416,7 +6289,7 @@ RCODE F_DomEditor::showHelp( pTmpRow = NULL; asciiToUnicode( "PLUS Expand to full context", &uzItemName[0]); - if (RC_BAD( rc = makeNewRow( &pTmpRow, &uzItemName[0], WPK_PLUS, TRUE))) + if (RC_BAD( rc = makeNewRow( &pTmpRow, &uzItemName[0], FKB_PLUS, TRUE))) { goto Exit; } @@ -6431,7 +6304,7 @@ RCODE F_DomEditor::showHelp( pTmpRow = NULL; asciiToUnicode( "MINUS collapse context", &uzItemName[0]); - if (RC_BAD( rc = makeNewRow( &pTmpRow, &uzItemName[0], WPK_MINUS, TRUE))) + if (RC_BAD( rc = makeNewRow( &pTmpRow, &uzItemName[0], FKB_MINUS, TRUE))) { goto Exit; } @@ -6446,7 +6319,7 @@ RCODE F_DomEditor::showHelp( pTmpRow = NULL; asciiToUnicode( "ENTER Edit the current node's value", &uzItemName[0]); - if (RC_BAD( rc = makeNewRow( &pTmpRow, &uzItemName[0], WPK_ENTER, TRUE))) + if (RC_BAD( rc = makeNewRow( &pTmpRow, &uzItemName[0], FKB_ENTER, TRUE))) { goto Exit; } @@ -6462,7 +6335,7 @@ RCODE F_DomEditor::showHelp( asciiToUnicode( "F8 Index manager", &uzItemName[0]); - if (RC_BAD( rc = makeNewRow( &pTmpRow, &uzItemName[0], WPK_F8, TRUE))) + if (RC_BAD( rc = makeNewRow( &pTmpRow, &uzItemName[0], FKB_F8, TRUE))) { goto Exit; } @@ -6477,7 +6350,7 @@ RCODE F_DomEditor::showHelp( pTmpRow = NULL; asciiToUnicode( "F9 Memory manager", &uzItemName[0]); - if (RC_BAD( rc = makeNewRow( &pTmpRow, &uzItemName[0], WPK_F9, TRUE))) + if (RC_BAD( rc = makeNewRow( &pTmpRow, &uzItemName[0], FKB_F9, TRUE))) { goto Exit; } @@ -6492,7 +6365,7 @@ RCODE F_DomEditor::showHelp( pTmpRow = NULL; asciiToUnicode( "F10 Toggle display colors on/off", &uzItemName[0]); - if (RC_BAD( rc = makeNewRow( &pTmpRow, &uzItemName[0], WPK_F10, TRUE))) + if (RC_BAD( rc = makeNewRow( &pTmpRow, &uzItemName[0], FKB_F10, TRUE))) { goto Exit; } @@ -6543,7 +6416,7 @@ RCODE F_DomEditor::showHelp( goto Exit; } - if( pHelpList->getLastKey() != WPK_ENTER) + if( pHelpList->getLastKey() != FKB_ENTER) { goto Exit; } @@ -6595,8 +6468,8 @@ Desc: Creates a window for displaying an operation's status *****************************************************************************/ RCODE F_DomEditor::createStatusWindow( char * pszTitle, - FLMUINT uiBack, - FLMUINT uiFore, + eColorType uiBack, + eColorType uiFore, FLMUINT * puiCols, FLMUINT * puiRows, FTX_WINDOW ** ppWindow) @@ -6610,16 +6483,7 @@ RCODE F_DomEditor::createStatusWindow( *ppWindow = NULL; - /* - Create a status window - */ - - if( FTXScreenGetSize( m_pScreen, - &uiNumCols, &uiNumRows) != FTXRC_SUCCESS) - { - rc = RC_SET( NE_XFLM_MEM); - goto Exit; - } + FTXScreenGetSize( m_pScreen, &uiNumCols, &uiNumRows); if( puiCols) { @@ -6637,10 +6501,9 @@ RCODE F_DomEditor::createStatusWindow( uiNumWinRows = uiNumRows - 2; } - if( FTXWinInit( m_pScreen, uiNumWinCols, - uiNumWinRows, &pWindow) != FTXRC_SUCCESS) + if( RC_BAD( rc = FTXWinInit( m_pScreen, uiNumWinCols, + uiNumWinRows, &pWindow))) { - rc = RC_SET( NE_XFLM_MEM); goto Exit; } @@ -6654,65 +6517,30 @@ RCODE F_DomEditor::createStatusWindow( *puiRows = uiNumWinRows; } - if( FTXWinMove( pWindow, (FLMUINT)((uiNumCols - uiNumWinCols) / 2), - (FLMUINT)((uiNumRows - uiNumWinRows) / 2)) != FTXRC_SUCCESS) - { - rc = RC_SET( NE_XFLM_MEM); - goto Exit; - } + FTXWinMove( pWindow, (FLMUINT)((uiNumCols - uiNumWinCols) / 2), + (FLMUINT)((uiNumRows - uiNumWinRows) / 2)); - if( FTXWinSetScroll( pWindow, TRUE) != FTXRC_SUCCESS) - { - goto Exit; - } - - if( FTXWinSetLineWrap( pWindow, TRUE) != FTXRC_SUCCESS) - { - goto Exit; - } - - FTXWinSetCursorType( pWindow, WPS_CURSOR_INVISIBLE); + FTXWinSetScroll( pWindow, TRUE); + FTXWinSetLineWrap( pWindow, TRUE); + FTXWinSetCursorType( pWindow, FLM_CURSOR_INVISIBLE); if( m_bMonochrome) { - uiBack = WPS_LIGHTGRAY; - uiFore = WPS_BLACK; - if( FTXWinSetBackFore( pWindow, - uiBack, uiFore) != FTXRC_SUCCESS) - { - rc = RC_SET( NE_XFLM_MEM); - goto Exit; - } + uiBack = FLM_LIGHTGRAY; + uiFore = FLM_BLACK; + FTXWinSetBackFore( pWindow, uiBack, uiFore); } else { - if( FTXWinSetBackFore( pWindow, - uiBack, uiFore) != FTXRC_SUCCESS) - { - rc = RC_SET( NE_XFLM_MEM); - goto Exit; - } + FTXWinSetBackFore( pWindow, uiBack, uiFore); } - if( FTXWinClear( pWindow) != FTXRC_SUCCESS) - { - rc = RC_SET( NE_XFLM_MEM); - goto Exit; - } - - if( FTXWinDrawBorder( pWindow) != FTXRC_SUCCESS) - { - rc = RC_SET( NE_XFLM_MEM); - goto Exit; - } + FTXWinClear( pWindow); + FTXWinDrawBorder( pWindow); if( pszTitle) { - if( FTXWinSetTitle( pWindow, pszTitle, uiBack, uiFore) != FTXRC_SUCCESS) - { - rc = RC_SET( NE_XFLM_MEM); - goto Exit; - } + FTXWinSetTitle( pWindow, pszTitle, uiBack, uiFore); } *ppWindow = pWindow; @@ -6721,7 +6549,6 @@ Exit: return( rc); } - /**************************************************************************** @@ -6739,20 +6566,20 @@ FSTATIC RCODE f_ViewOnlyKeyHook( switch( uiKeyIn) { - case WPK_HOME: - case WPK_END: - case WPK_UP: - case WPK_DOWN: - case WPK_PGUP: - case WPK_PGDN: - case WPK_ESCAPE: + case FKB_HOME: + case FKB_END: + case FKB_UP: + case FKB_DOWN: + case FKB_PGUP: + case FKB_PGDN: + case FKB_ESCAPE: { *puiKeyOut = uiKeyIn; break; } // Special case - case WPK_DELETE: + case FKB_DELETE: { *puiKeyOut = 0; if (pCurRow->uiFlags & F_DOMEDIT_FLAG_COMMENT) @@ -6795,7 +6622,7 @@ FSTATIC RCODE f_KeyEditorKeyHook( switch( uiKeyIn) { - case WPK_UP: + case FKB_UP: { (void)pDomEditor->getCurrentRow( &uiCurRow); if (uiCurRow) @@ -6820,7 +6647,7 @@ FSTATIC RCODE f_KeyEditorKeyHook( *puiKeyOut = 0; break; } - case WPK_DOWN: + case FKB_DOWN: { (void)pDomEditor->getCurrentRow( &uiCurRow); @@ -6841,24 +6668,24 @@ FSTATIC RCODE f_KeyEditorKeyHook( *puiKeyOut = 0; break; } - case WPK_ENTER: + case FKB_ENTER: { if( !pDomEditor->canEditRow( pCurRow)) { pDomEditor->displayMessage( "The row cannot be edited", - RC_SET( NE_XFLM_ILLEGAL_OP), NULL, WPS_RED, WPS_WHITE); + RC_SET( NE_XFLM_ILLEGAL_OP), NULL, FLM_RED, FLM_WHITE); } else if( RC_BAD( rc = pDomEditor->editIndexRow( pCurRow))) { pDomEditor->displayMessage( "The field could not be edited", rc, - NULL, WPS_RED, WPS_WHITE); + NULL, FLM_RED, FLM_WHITE); } *puiKeyOut = 0; break; } - case WPK_ESCAPE: /* Quit key editor */ -// case WPK_ALT_Q: /* Done editing keys */ - case WPK_ALT_Z: /* Done, but don't quit */ + case FKB_ESCAPE: /* Quit key editor */ +// case FKB_ALT_Q: /* Done editing keys */ + case FKB_ALT_Z: /* Done, but don't quit */ { *puiKeyOut = uiKeyIn; break; @@ -6871,12 +6698,12 @@ FSTATIC RCODE f_KeyEditorKeyHook( if( !pDomEditor->canEditRow( pCurRow)) { pDomEditor->displayMessage( "The row cannot be edited", - RC_SET( NE_XFLM_ILLEGAL_OP), NULL, WPS_RED, WPS_WHITE); + RC_SET( NE_XFLM_ILLEGAL_OP), NULL, FLM_RED, FLM_WHITE); } else if( RC_BAD( rc = pDomEditor->editIndexNode( pCurRow))) { pDomEditor->displayMessage( "The field could not be edited", rc, - NULL, WPS_RED, WPS_WHITE); + NULL, FLM_RED, FLM_WHITE); } *puiKeyOut = 0; break; @@ -6909,15 +6736,15 @@ RCODE F_DomEditorSelectionKeyHook( switch( uiKeyIn) { - case WPK_HOME: - case WPK_END: - case WPK_UP: - case WPK_DOWN: - case WPK_PGUP: - case WPK_PGDN: - case WPK_ESCAPE: - case WPK_ENTER: - case WPK_DELETE: + case FKB_HOME: + case FKB_END: + case FKB_UP: + case FKB_DOWN: + case FKB_PGUP: + case FKB_PGDN: + case FKB_ESCAPE: + case FKB_ENTER: + case FKB_DELETE: { *puiKeyOut = uiKeyIn; break; @@ -7604,7 +7431,7 @@ FSTATIC char * domeditSkipChars( Desc: ****************************************************************************/ RCODE _domEditBackgroundThread( - F_Thread * pThread) + IF_Thread * pThread) { FLMUINT uiCount = 0; @@ -8278,17 +8105,17 @@ FSTATIC RCODE formatDocumentNode( F_DOMNode * pAnnotation = NULL; FLMUNICODE * puzAttrValue = NULL; char * pszString = NULL; - FLMUINT uiForeground; + eColorType uiForeground; if (pRow->pDomNode) { uiForeground = pRow->pDomNode->isQuarantined() - ? WPS_LIGHTCYAN - : WPS_YELLOW; + ? FLM_LIGHTCYAN + : FLM_YELLOW; } else { - uiForeground = WPS_YELLOW; + uiForeground = FLM_YELLOW; } @@ -8310,8 +8137,8 @@ FSTATIC RCODE formatDocumentNode( f_sprintf( pDispVals[ *puiNumVals].szString, "%s", pRow->bExpanded ? "-" : pRow->bHasChildren ? "+" : " "); pDispVals[ *puiNumVals].uiCol = uiCol; - pDispVals[ *puiNumVals].uiForeground = WPS_WHITE; - pDispVals[ *puiNumVals].uiBackground = pDomEditor->isMonochrome() ? WPS_BLACK : WPS_BLUE; + pDispVals[ *puiNumVals].uiForeground = FLM_WHITE; + pDispVals[ *puiNumVals].uiBackground = pDomEditor->isMonochrome() ? FLM_BLACK : FLM_BLUE; uiCol += f_strlen( pDispVals[ *puiNumVals].szString) + 2; (*puiNumVals)++; } @@ -8329,8 +8156,8 @@ FSTATIC RCODE formatDocumentNode( f_sprintf( pDispVals[ *puiNumVals].szString, "%u", pRow->uiLevel); pDispVals[ *puiNumVals].uiCol = uiCol; - pDispVals[ *puiNumVals].uiForeground = WPS_WHITE; - pDispVals[ *puiNumVals].uiBackground = pDomEditor->isMonochrome() ? WPS_BLACK : WPS_BLUE; + pDispVals[ *puiNumVals].uiForeground = FLM_WHITE; + pDispVals[ *puiNumVals].uiBackground = pDomEditor->isMonochrome() ? FLM_BLACK : FLM_BLUE; uiCol += f_strlen( pDispVals[ *puiNumVals].szString) + (pRow->uiLevel * 2) + 1; (*puiNumVals)++; } @@ -8354,8 +8181,8 @@ FSTATIC RCODE formatDocumentNode( } pDispVals[ *puiNumVals].uiCol = uiCol; - pDispVals[ *puiNumVals].uiForeground = pDomEditor->isMonochrome() ? WPS_WHITE : uiForeground; - pDispVals[ *puiNumVals].uiBackground = pDomEditor->isMonochrome() ? WPS_BLACK : WPS_BLUE; + pDispVals[ *puiNumVals].uiForeground = pDomEditor->isMonochrome() ? FLM_WHITE : uiForeground; + pDispVals[ *puiNumVals].uiBackground = pDomEditor->isMonochrome() ? FLM_BLACK : FLM_BLUE; uiCol += f_strlen( pDispVals[ *puiNumVals].szString) + (pRow->uiLevel * 2) + 1; (*puiNumVals)++; @@ -8382,8 +8209,8 @@ FSTATIC RCODE formatDocumentNode( } pDispVals[ *puiNumVals].uiCol = uiCol; - pDispVals[ *puiNumVals].uiForeground = pDomEditor->isMonochrome() ? WPS_WHITE : uiForeground; - pDispVals[ *puiNumVals].uiBackground = pDomEditor->isMonochrome() ? WPS_BLACK : WPS_BLUE; + pDispVals[ *puiNumVals].uiForeground = pDomEditor->isMonochrome() ? FLM_WHITE : uiForeground; + pDispVals[ *puiNumVals].uiBackground = pDomEditor->isMonochrome() ? FLM_BLACK : FLM_BLUE; (*puiNumVals)++; Exit: @@ -8423,7 +8250,7 @@ FSTATIC RCODE formatElementNode( FLMBOOL bGotFirstAttr = FALSE; F_Db * pDb = NULL; FLMUINT uiAttrLen; - FLMUINT uiForeground; + eColorType uiForeground; FLMBOOL bHasLocalData; if (RC_BAD( rc = pRow->pDomNode->isDataLocalToNode( pDomEditor->getDb(), &bHasLocalData))) @@ -8434,12 +8261,12 @@ FSTATIC RCODE formatElementNode( if (pRow->pDomNode) { uiForeground = pRow->pDomNode->isQuarantined() - ? WPS_LIGHTCYAN - : WPS_WHITE; + ? FLM_LIGHTCYAN + : FLM_WHITE; } else { - uiForeground = WPS_WHITE; + uiForeground = FLM_WHITE; } if ((pDispVals = pDomEditor->getDispColumns()) == NULL) @@ -8462,10 +8289,10 @@ FSTATIC RCODE formatElementNode( f_sprintf( pDispVals[ *puiNumVals].szString, "%s", pRow->bExpanded ? "-" : (pRow->bHasChildren || bHasLocalData) ? "+" : " "); pDispVals[ *puiNumVals].uiCol = uiCol; - pDispVals[ *puiNumVals].uiForeground = WPS_WHITE; + pDispVals[ *puiNumVals].uiForeground = FLM_WHITE; pDispVals[ *puiNumVals].uiBackground = pDomEditor->isMonochrome() - ? WPS_BLACK - : WPS_BLUE; + ? FLM_BLACK + : FLM_BLUE; uiCol += f_strlen( pDispVals[ *puiNumVals].szString) + 2; (*puiNumVals)++; } @@ -8483,10 +8310,10 @@ FSTATIC RCODE formatElementNode( f_sprintf( pDispVals[ *puiNumVals].szString, "%u", pRow->uiLevel); pDispVals[ *puiNumVals].uiCol = uiCol; - pDispVals[ *puiNumVals].uiForeground = WPS_WHITE; + pDispVals[ *puiNumVals].uiForeground = FLM_WHITE; pDispVals[ *puiNumVals].uiBackground = pDomEditor->isMonochrome() - ? WPS_BLACK - : WPS_BLUE; + ? FLM_BLACK + : FLM_BLUE; uiCol += f_strlen( pDispVals[ *puiNumVals].szString) + 2; (*puiNumVals)++; } @@ -8524,8 +8351,8 @@ FSTATIC RCODE formatElementNode( pDispVals[ *puiNumVals].uiCol = uiCol; pDispVals[ *puiNumVals].uiForeground = uiForeground; pDispVals[ *puiNumVals].uiBackground = pDomEditor->isMonochrome() - ? WPS_BLACK - : WPS_BLUE; + ? FLM_BLACK + : FLM_BLUE; uiCol += f_strlen( pDispVals[ *puiNumVals].szString); (*puiNumVals)++; @@ -8613,8 +8440,8 @@ FSTATIC RCODE formatElementNode( } pDispVals[ *puiNumVals].uiCol = uiCol; - pDispVals[ *puiNumVals].uiForeground = WPS_LIGHTRED; - pDispVals[ *puiNumVals].uiBackground = pDomEditor->isMonochrome() ? WPS_BLACK : WPS_BLUE; + pDispVals[ *puiNumVals].uiForeground = FLM_LIGHTRED; + pDispVals[ *puiNumVals].uiBackground = pDomEditor->isMonochrome() ? FLM_BLACK : FLM_BLUE; uiCol += f_strlen( pDispVals[ *puiNumVals].szString); (*puiNumVals)++; } @@ -8625,7 +8452,7 @@ FSTATIC RCODE formatElementNode( pDispVals[ *puiNumVals].uiCol = uiCol; pDispVals[ *puiNumVals].uiForeground = uiForeground; - pDispVals[ *puiNumVals].uiBackground = pDomEditor->isMonochrome() ? WPS_BLACK : WPS_BLUE; + pDispVals[ *puiNumVals].uiBackground = pDomEditor->isMonochrome() ? FLM_BLACK : FLM_BLUE; uiCol += f_strlen( pDispVals[ *puiNumVals].szString); (*puiNumVals)++; @@ -8690,8 +8517,8 @@ FSTATIC RCODE formatAttributeNode( f_sprintf( pDispVals[ *puiNumVals].szString, "%s", pRow->bExpanded ? "-" : pRow->bHasChildren ? "+" : " "); pDispVals[ *puiNumVals].uiCol = uiCol; - pDispVals[ *puiNumVals].uiForeground = WPS_WHITE; - pDispVals[ *puiNumVals].uiBackground = pDomEditor->isMonochrome() ? WPS_BLACK : WPS_BLUE; + pDispVals[ *puiNumVals].uiForeground = FLM_WHITE; + pDispVals[ *puiNumVals].uiBackground = pDomEditor->isMonochrome() ? FLM_BLACK : FLM_BLUE; uiCol += f_strlen( pDispVals[ *puiNumVals].szString) + 2; (*puiNumVals)++; } @@ -8709,8 +8536,8 @@ FSTATIC RCODE formatAttributeNode( f_sprintf( pDispVals[ *puiNumVals].szString, "%u", pRow->uiLevel); pDispVals[ *puiNumVals].uiCol = uiCol; - pDispVals[ *puiNumVals].uiForeground = WPS_WHITE; - pDispVals[ *puiNumVals].uiBackground = pDomEditor->isMonochrome() ? WPS_BLACK : WPS_BLUE; + pDispVals[ *puiNumVals].uiForeground = FLM_WHITE; + pDispVals[ *puiNumVals].uiBackground = pDomEditor->isMonochrome() ? FLM_BLACK : FLM_BLUE; uiCol += f_strlen( pDispVals[ *puiNumVals].szString) + 2; (*puiNumVals)++; } @@ -8745,8 +8572,8 @@ FSTATIC RCODE formatAttributeNode( } pDispVals[ *puiNumVals].uiCol = uiCol; - pDispVals[ *puiNumVals].uiForeground = WPS_WHITE; - pDispVals[ *puiNumVals].uiBackground = pDomEditor->isMonochrome() ? WPS_BLACK : WPS_BLUE; + pDispVals[ *puiNumVals].uiForeground = FLM_WHITE; + pDispVals[ *puiNumVals].uiBackground = pDomEditor->isMonochrome() ? FLM_BLACK : FLM_BLUE; uiCol += f_strlen( pDispVals[ *puiNumVals].szString); (*puiNumVals)++; @@ -8773,8 +8600,8 @@ FSTATIC RCODE formatAttributeNode( pDispVals[ *puiNumVals].uiCol = uiCol; - pDispVals[ *puiNumVals].uiForeground = WPS_LIGHTRED; - pDispVals[ *puiNumVals].uiBackground = pDomEditor->isMonochrome() ? WPS_BLACK : WPS_BLUE; + pDispVals[ *puiNumVals].uiForeground = FLM_LIGHTRED; + pDispVals[ *puiNumVals].uiBackground = pDomEditor->isMonochrome() ? FLM_BLACK : FLM_BLUE; uiCol += f_strlen( pDispVals[ *puiNumVals].szString)+1; (*puiNumVals)++; @@ -8783,8 +8610,8 @@ FSTATIC RCODE formatAttributeNode( f_sprintf( pDispVals[ *puiNumVals].szString, pRow->bHasChildren ? ">" : "/>"); pDispVals[ *puiNumVals].uiCol = uiCol; - pDispVals[ *puiNumVals].uiForeground = WPS_WHITE; - pDispVals[ *puiNumVals].uiBackground = pDomEditor->isMonochrome() ? WPS_BLACK : WPS_BLUE; + pDispVals[ *puiNumVals].uiForeground = FLM_WHITE; + pDispVals[ *puiNumVals].uiBackground = pDomEditor->isMonochrome() ? FLM_BLACK : FLM_BLUE; (*puiNumVals)++; Exit: @@ -8821,17 +8648,17 @@ FSTATIC RCODE formatDataNode( char * pszString; FLMUINT uiCol; DME_DISP_COLUMN * pDispVals; - FLMUINT uiForeground; + eColorType uiForeground; if (pRow->pDomNode) { uiForeground = pRow->pDomNode->isQuarantined() - ? WPS_LIGHTCYAN - : WPS_WHITE; + ? FLM_LIGHTCYAN + : FLM_WHITE; } else { - uiForeground = WPS_WHITE; + uiForeground = FLM_WHITE; } if ((pDispVals = pDomEditor->getDispColumns()) == NULL) @@ -8854,8 +8681,8 @@ FSTATIC RCODE formatDataNode( f_sprintf( pDispVals[ *puiNumVals].szString, "%s", pRow->bExpanded ? "-" : "+"); pDispVals[ *puiNumVals].uiCol = uiCol; - pDispVals[ *puiNumVals].uiForeground = WPS_WHITE; - pDispVals[ *puiNumVals].uiBackground = pDomEditor->isMonochrome() ? WPS_BLACK : WPS_BLUE; + pDispVals[ *puiNumVals].uiForeground = FLM_WHITE; + pDispVals[ *puiNumVals].uiBackground = pDomEditor->isMonochrome() ? FLM_BLACK : FLM_BLUE; uiCol += f_strlen( pDispVals[ *puiNumVals].szString) + 2; (*puiNumVals)++; } @@ -8874,8 +8701,8 @@ FSTATIC RCODE formatDataNode( f_sprintf( pDispVals[ *puiNumVals].szString, "%u", pRow->uiLevel); pDispVals[ *puiNumVals].uiCol = uiCol; - pDispVals[ *puiNumVals].uiForeground = WPS_WHITE; - pDispVals[ *puiNumVals].uiBackground = pDomEditor->isMonochrome() ? WPS_BLACK : WPS_BLUE; + pDispVals[ *puiNumVals].uiForeground = FLM_WHITE; + pDispVals[ *puiNumVals].uiBackground = pDomEditor->isMonochrome() ? FLM_BLACK : FLM_BLUE; uiCol += f_strlen( pDispVals[ *puiNumVals].szString) + 2; (*puiNumVals)++; } @@ -8907,7 +8734,7 @@ FSTATIC RCODE formatDataNode( pDispVals[ *puiNumVals].uiCol = uiCol; pDispVals[ *puiNumVals].uiForeground = uiForeground; - pDispVals[ *puiNumVals].uiBackground = pDomEditor->isMonochrome() ? WPS_BLACK : WPS_BLUE; + pDispVals[ *puiNumVals].uiBackground = pDomEditor->isMonochrome() ? FLM_BLACK : FLM_BLUE; (*puiNumVals)++; } @@ -8953,8 +8780,8 @@ FSTATIC RCODE formatProcessingInstruction( f_sprintf( pDispVals[ *puiNumVals].szString, "%s", pRow->bExpanded ? "-" : "+"); pDispVals[ *puiNumVals].uiCol = uiCol; - pDispVals[ *puiNumVals].uiForeground = WPS_WHITE; - pDispVals[ *puiNumVals].uiBackground = pDomEditor->isMonochrome() ? WPS_BLACK : WPS_BLUE; + pDispVals[ *puiNumVals].uiForeground = FLM_WHITE; + pDispVals[ *puiNumVals].uiBackground = pDomEditor->isMonochrome() ? FLM_BLACK : FLM_BLUE; uiCol += f_strlen( pDispVals[ *puiNumVals].szString) + 2; (*puiNumVals)++; } @@ -8972,8 +8799,8 @@ FSTATIC RCODE formatProcessingInstruction( f_sprintf( pDispVals[ *puiNumVals].szString, "%u", pRow->uiLevel); pDispVals[ *puiNumVals].uiCol = uiCol; - pDispVals[ *puiNumVals].uiForeground = WPS_WHITE; - pDispVals[ *puiNumVals].uiBackground = pDomEditor->isMonochrome() ? WPS_BLACK : WPS_BLUE; + pDispVals[ *puiNumVals].uiForeground = FLM_WHITE; + pDispVals[ *puiNumVals].uiBackground = pDomEditor->isMonochrome() ? FLM_BLACK : FLM_BLUE; uiCol += f_strlen( pDispVals[ *puiNumVals].szString) + 2; (*puiNumVals)++; } @@ -9003,8 +8830,8 @@ FSTATIC RCODE formatProcessingInstruction( goto Exit; } pDispVals[ *puiNumVals].uiCol = uiCol; - pDispVals[ *puiNumVals].uiForeground = WPS_WHITE; - pDispVals[ *puiNumVals].uiBackground = pDomEditor->isMonochrome() ? WPS_BLACK : WPS_BLUE; + pDispVals[ *puiNumVals].uiForeground = FLM_WHITE; + pDispVals[ *puiNumVals].uiBackground = pDomEditor->isMonochrome() ? FLM_BLACK : FLM_BLUE; uiCol += f_strlen( pDispVals[ *puiNumVals].szString) + 2; (*puiNumVals)++; @@ -9015,8 +8842,8 @@ FSTATIC RCODE formatProcessingInstruction( goto Exit; } pDispVals[ *puiNumVals].uiCol = uiCol; - pDispVals[ *puiNumVals].uiForeground = WPS_WHITE; - pDispVals[ *puiNumVals].uiBackground = pDomEditor->isMonochrome() ? WPS_BLACK : WPS_BLUE; + pDispVals[ *puiNumVals].uiForeground = FLM_WHITE; + pDispVals[ *puiNumVals].uiBackground = pDomEditor->isMonochrome() ? FLM_BLACK : FLM_BLUE; (*puiNumVals)++; Exit: @@ -9059,8 +8886,8 @@ FSTATIC RCODE formatRow( f_sprintf( pDispVals[ *puiNumVals].szString, "%s", pRow->bExpanded ? "-" : "+"); pDispVals[ *puiNumVals].uiCol = uiCol; - pDispVals[ *puiNumVals].uiForeground = WPS_WHITE; - pDispVals[ *puiNumVals].uiBackground = pDomEditor->isMonochrome() ? WPS_BLACK : WPS_BLUE; + pDispVals[ *puiNumVals].uiForeground = FLM_WHITE; + pDispVals[ *puiNumVals].uiBackground = pDomEditor->isMonochrome() ? FLM_BLACK : FLM_BLUE; uiCol += f_strlen( pDispVals[ *puiNumVals].szString) + 2; (*puiNumVals)++; } @@ -9078,8 +8905,8 @@ FSTATIC RCODE formatRow( f_sprintf( pDispVals[ *puiNumVals].szString, "%u", pRow->uiLevel); pDispVals[ *puiNumVals].uiCol = uiCol; - pDispVals[ *puiNumVals].uiForeground = WPS_WHITE; - pDispVals[ *puiNumVals].uiBackground = pDomEditor->isMonochrome() ? WPS_BLACK : WPS_BLUE; + pDispVals[ *puiNumVals].uiForeground = FLM_WHITE; + pDispVals[ *puiNumVals].uiBackground = pDomEditor->isMonochrome() ? FLM_BLACK : FLM_BLUE; uiCol += f_strlen( pDispVals[ *puiNumVals].szString) + 2; (*puiNumVals)++; } @@ -9095,8 +8922,8 @@ FSTATIC RCODE formatRow( } pDispVals[ *puiNumVals].uiCol = (uiFlags & F_DOMEDIT_FLAG_COMMENT ? 0 : uiCol); - pDispVals[ *puiNumVals].uiForeground = WPS_WHITE; - pDispVals[ *puiNumVals].uiBackground = pDomEditor->isMonochrome() ? WPS_BLACK : WPS_BLUE; + pDispVals[ *puiNumVals].uiForeground = FLM_WHITE; + pDispVals[ *puiNumVals].uiBackground = pDomEditor->isMonochrome() ? FLM_BLACK : FLM_BLUE; (*puiNumVals)++; Exit: @@ -9393,71 +9220,33 @@ RCODE F_DomEditor::editTextBuffer( FLMUINT uiNumWinRows = 3; FLMUINT uiNumWinCols; FTX_WINDOW * pWindow = NULL; - F_FileHdl * pFileHdl = NULL; + IF_FileHdl * pFileHdl = NULL; flmAssert( m_bSetupCalled == TRUE); - if( FTXScreenGetSize( m_pScreen, &uiNumCols, &uiNumRows) != FTXRC_SUCCESS) - { - rc = RC_SET( NE_XFLM_MEM); - goto Exit; - } - + FTXScreenGetSize( m_pScreen, &uiNumCols, &uiNumRows); uiNumWinCols = uiNumCols - 8; - if( FTXWinInit( m_pScreen, uiNumWinCols, - uiNumWinRows, &pWindow) != FTXRC_SUCCESS) - { - rc = RC_SET( NE_XFLM_MEM); - goto Exit; - } - - if( FTXWinSetScroll( pWindow, FALSE) != FTXRC_SUCCESS) + if( RC_BAD( rc = FTXWinInit( m_pScreen, uiNumWinCols, + uiNumWinRows, &pWindow))) { goto Exit; } - FTXWinSetCursorType( pWindow, WPS_CURSOR_UNDERLINE); + FTXWinSetScroll( pWindow, FALSE); + FTXWinSetCursorType( pWindow, FLM_CURSOR_UNDERLINE); + FTXWinSetBackFore( pWindow, m_bMonochrome ? FLM_BLACK : FLM_CYAN, FLM_WHITE); + FTXWinClear( pWindow); + FTXWinDrawBorder( pWindow); - if( FTXWinSetBackFore( pWindow, m_bMonochrome ? WPS_BLACK : WPS_CYAN, - WPS_WHITE) != FTXRC_SUCCESS) - { - rc = RC_SET( NE_XFLM_MEM); - goto Exit; - } + FTXWinMove( pWindow, (uiNumCols - uiNumWinCols) / 2, + (uiNumRows - uiNumWinRows) / 2); - if( FTXWinClear( pWindow) != FTXRC_SUCCESS) - { - rc = RC_SET( NE_XFLM_MEM); - goto Exit; - } - - if( FTXWinDrawBorder( pWindow) != FTXRC_SUCCESS) - { - rc = RC_SET( NE_XFLM_MEM); - goto Exit; - } - - if( FTXWinMove( pWindow, (uiNumCols - uiNumWinCols) / 2, - (uiNumRows - uiNumWinRows) / 2) != FTXRC_SUCCESS) - { - rc = RC_SET( NE_XFLM_MEM); - goto Exit; - } - - if( FTXWinOpen( pWindow) != FTXRC_SUCCESS) - { - rc = RC_SET( NE_XFLM_MEM); - goto Exit; - } - - if( FTXWinClear( pWindow) != FTXRC_SUCCESS) - { - rc = RC_SET( NE_XFLM_MEM); - goto Exit; - } + FTXWinOpen( pWindow); + FTXWinClear( pWindow); // Adjust the buffer size if needed. + if (uiBufSize < MIN_BUFSIZE) { if (RC_BAD( rc = f_realloc( MIN_BUFSIZE, ppszBuffer))) @@ -9472,8 +9261,8 @@ RCODE F_DomEditor::editTextBuffer( uiBufSize = MIN_BUFSIZE; } - if( FTXLineEdit( pWindow, pszBuffer, uiBufSize, uiBufSize, - NULL, puiTermChar) != FTXRC_SUCCESS) + if( RC_BAD( rc = FTXLineEdit( pWindow, pszBuffer, uiBufSize, uiBufSize, + NULL, puiTermChar))) { rc = RC_SET( NE_XFLM_FAILURE); goto Exit; @@ -9558,12 +9347,8 @@ RCODE F_DomEditor::editRow( uiRows = uiBufSize / (m_uiEditCanvasCols - 4) + 3; - if (RC_BAD( rc = FTXDisplayScrollWindow( m_pScreen->pFtxInfo, - m_pScreen, - "View", - pszBuffer, - m_uiEditCanvasCols - 4, - uiRows > 10 ? 10 : uiRows))) + if (RC_BAD( rc = FTXDisplayScrollWindow( m_pScreen, "View", + pszBuffer, m_uiEditCanvasCols - 4, uiRows > 10 ? 10 : uiRows))) { goto Exit; } @@ -9577,7 +9362,7 @@ RCODE F_DomEditor::editRow( } // Save the results? - if (uiTermChar == WPK_ENTER && !bReadOnly) + if (uiTermChar == FKB_ENTER && !bReadOnly) { // Begin a transaction @@ -9619,7 +9404,7 @@ RCODE F_DomEditor::editRow( if( RC_BAD( rc = getNumber( pszBuffer, &ui64Value, NULL))) { displayMessage( "Invalid number", rc, - NULL, WPS_RED, WPS_WHITE); + NULL, FLM_RED, FLM_WHITE); goto Exit; } @@ -9688,12 +9473,8 @@ RCODE F_DomEditor::editRow( uiRows = uiBufSize / (m_uiEditCanvasCols - 4) + 3; - if (RC_BAD( rc = FTXDisplayScrollWindow( m_pScreen->pFtxInfo, - m_pScreen, - "View", - pszBuffer, - m_uiEditCanvasCols - 4, - uiRows > 10 ? 10 : uiRows))) + if (RC_BAD( rc = FTXDisplayScrollWindow( m_pScreen, "View", + pszBuffer, m_uiEditCanvasCols - 4, uiRows > 10 ? 10 : uiRows))) { goto Exit; } @@ -9707,7 +9488,7 @@ RCODE F_DomEditor::editRow( } // Save the results? - if (uiTermChar == WPK_ENTER && !bReadOnly) + if (uiTermChar == FKB_ENTER && !bReadOnly) { // Get a new unicode buffer.... f_free( &puzBuffer); @@ -9874,7 +9655,7 @@ RCODE F_DomEditor::editIndexRow( } // Save the results? - if (uiTermChar == WPK_ENTER) + if (uiTermChar == FKB_ENTER) { switch( pVector->getDataType( uiElementNumber)) { @@ -9963,7 +9744,7 @@ RCODE F_DomEditor::editIndexNode( } // Save the results? - if (uiTermChar == WPK_ENTER) + if (uiTermChar == FKB_ENTER) { FLMUINT64 ui64Num = f_atou64( pszBuffer); @@ -10015,7 +9796,7 @@ RCODE F_DomEditor::selectElementAttribute( if (pRow->uiFlags & F_DOMEDIT_FLAG_ENDTAG) { rc = displayMessage( "Cannot edit Element end tag", - NE_XFLM_FAILURE, puiTermChar, WPS_RED, WPS_WHITE); + NE_XFLM_FAILURE, puiTermChar, FLM_RED, FLM_WHITE); goto Exit; } @@ -10067,7 +9848,7 @@ RCODE F_DomEditor::selectElementAttribute( if (pRow->pDomNode->getNodeType() != ELEMENT_NODE) { rc = displayMessage( "Invalid node type", - NE_XFLM_FAILURE, puiTermChar, WPS_RED, WPS_WHITE); + NE_XFLM_FAILURE, puiTermChar, FLM_RED, FLM_WHITE); goto Exit; } @@ -10258,7 +10039,7 @@ RCODE F_DomEditor::deleteRow( requestInput( szMessage, &szResponse[ 0], sizeof( szResponse), &uiTermChar); - if( uiTermChar == WPK_ESCAPE || szResponse[ 0] == 'N' || szResponse[ 0] == 'n') + if( uiTermChar == FKB_ESCAPE || szResponse[ 0] == 'N' || szResponse[ 0] == 'n') { goto Exit; } @@ -10473,7 +10254,7 @@ RCODE F_DomEditor::addSomething( goto Exit; } - if( uiTermChar != WPK_ENTER) + if( uiTermChar != FKB_ENTER) { goto Exit; } @@ -10565,7 +10346,7 @@ RCODE F_DomEditor::createDocumentNode( requestInput( "Document Title / Comment", szResponse, sizeof( szResponse), &uiTermChar); - if( uiTermChar == WPK_ESCAPE) + if( uiTermChar == FKB_ESCAPE) { goto Exit; } @@ -10693,10 +10474,10 @@ RCODE F_DomEditor::createRootElementNode( if( RC_BAD( tmpRc = selectCollection( &uiCollection, &uiTermChar))) { displayMessage( "Error getting collection", tmpRc, - NULL, WPS_RED, WPS_WHITE); + NULL, FLM_RED, FLM_WHITE); } - if( uiTermChar != WPK_ENTER) + if( uiTermChar != FKB_ENTER) { goto Exit; } @@ -10708,7 +10489,7 @@ RCODE F_DomEditor::createRootElementNode( sizeof( szResponse), &uiTermChar); - if( uiTermChar == WPK_ESCAPE) + if( uiTermChar == FKB_ESCAPE) { goto Exit; } @@ -10729,7 +10510,7 @@ RCODE F_DomEditor::createRootElementNode( goto Exit; } - if( uiTermChar == WPK_ESCAPE) + if( uiTermChar == FKB_ESCAPE) { goto Exit; } @@ -10863,7 +10644,7 @@ RCODE F_DomEditor::createElementNode( sizeof( szResponse), &uiTermChar); - if( uiTermChar == WPK_ESCAPE) + if( uiTermChar == FKB_ESCAPE) { goto Exit; } @@ -10877,7 +10658,7 @@ RCODE F_DomEditor::createElementNode( if (!pRow) { displayMessage( "No DOM Node to add to.", - NE_XFLM_FAILURE, NULL, WPS_RED, WPS_WHITE); + NE_XFLM_FAILURE, NULL, FLM_RED, FLM_WHITE); goto Exit; } @@ -10887,7 +10668,7 @@ RCODE F_DomEditor::createElementNode( pRow->eType != ELEMENT_NODE) { displayMessage( "Invalid DOM node type", - NE_XFLM_FAILURE, NULL, WPS_RED, WPS_WHITE); + NE_XFLM_FAILURE, NULL, FLM_RED, FLM_WHITE); goto Exit; } @@ -10897,7 +10678,7 @@ RCODE F_DomEditor::createElementNode( goto Exit; } - if (uiTermChar == WPK_ESCAPE) + if (uiTermChar == FKB_ESCAPE) { goto Exit; } @@ -10941,7 +10722,7 @@ RCODE F_DomEditor::createElementNode( requestInput( "Insert as Sibling node?", szResponse, sizeof( szResponse), &uiTermChar); - if (uiTermChar == WPK_ESCAPE) + if (uiTermChar == FKB_ESCAPE) { goto Exit; } @@ -11087,7 +10868,7 @@ RCODE F_DomEditor::createTextNode( pRow->eType != ELEMENT_NODE) { displayMessage( "Invalid DOM node type", - NE_XFLM_FAILURE, NULL, WPS_RED, WPS_WHITE); + NE_XFLM_FAILURE, NULL, FLM_RED, FLM_WHITE); goto Exit; } @@ -11095,7 +10876,7 @@ RCODE F_DomEditor::createTextNode( requestInput( "Text", szTextBuffer, uiTextBufLen, &uiTermChar); - if (uiTermChar == WPK_ESCAPE) + if (uiTermChar == FKB_ESCAPE) { goto Exit; } @@ -11140,7 +10921,7 @@ RCODE F_DomEditor::createTextNode( requestInput( "Insert as Sibling node?", szResponse, sizeof( szResponse), &uiTermChar); - if (uiTermChar == WPK_ESCAPE) + if (uiTermChar == FKB_ESCAPE) { goto Exit; } @@ -11297,7 +11078,7 @@ RCODE F_DomEditor::createAttributeNode( if (pRow->eType != ELEMENT_NODE) { displayMessage( "Invalid DOM node type", - NE_XFLM_FAILURE, NULL, WPS_RED, WPS_WHITE); + NE_XFLM_FAILURE, NULL, FLM_RED, FLM_WHITE); goto Exit; } @@ -11307,7 +11088,7 @@ RCODE F_DomEditor::createAttributeNode( goto Exit; } - if (uiTermChar == WPK_ESCAPE) + if (uiTermChar == FKB_ESCAPE) { goto Exit; } @@ -11316,7 +11097,7 @@ RCODE F_DomEditor::createAttributeNode( requestInput( "Attribute Value", szAttrValue, sizeof(szAttrValue), &uiTermChar); - if (uiTermChar == WPK_ESCAPE) + if (uiTermChar == FKB_ESCAPE) { goto Exit; } @@ -11327,7 +11108,7 @@ RCODE F_DomEditor::createAttributeNode( goto Exit; } - if (uiTermChar == WPK_ESCAPE) + if (uiTermChar == FKB_ESCAPE) { goto Exit; } @@ -11393,7 +11174,7 @@ RCODE F_DomEditor::createAttributeNode( if( RC_BAD( rc = getNumber( &szAttrValue[ 0], &ui64Value, NULL))) { displayMessage( "Invalid node number", rc, - NULL, WPS_RED, WPS_WHITE); + NULL, FLM_RED, FLM_WHITE); goto Exit; } @@ -12287,7 +12068,7 @@ RCODE F_DomEditor::selectIndex( *puiTermChar = pIndexList->getLastKey(); } - if( pIndexList->getLastKey() == WPK_ESCAPE) + if( pIndexList->getLastKey() == FKB_ESCAPE) { rc = RC_SET( NE_XFLM_NOT_FOUND); goto Exit; @@ -12341,7 +12122,7 @@ RCODE F_DomEditor::indexList( void) goto Exit; } - if( uiTermChar != WPK_ENTER) + if( uiTermChar != FKB_ENTER) { goto Exit; } @@ -12484,14 +12265,14 @@ ix_list_retry: goto Exit; } - if( pKeyEditor->getLastKey() == WPK_ESCAPE) + if( pKeyEditor->getLastKey() == FKB_ESCAPE) { goto Exit; } if( RC_BAD( rc = createStatusWindow( " Key Retrieval Status (Press ESC to Interrupt) ", - WPS_GREEN, WPS_WHITE, NULL, NULL, &pStatusWindow))) + FLM_GREEN, FLM_WHITE, NULL, NULL, &pStatusWindow))) { goto Exit; } @@ -12577,11 +12358,11 @@ ix_list_retry: // Test for the escape key - if( FTXWinTestKB( pStatusWindow) == FTXRC_SUCCESS) + if( RC_OK( FTXWinTestKB( pStatusWindow))) { FLMUINT uiChar; FTXWinInputChar( pStatusWindow, &uiChar); - if( uiChar == WPK_ESCAPE) + if( uiChar == FKB_ESCAPE) { break; } @@ -12699,7 +12480,7 @@ ix_list_retry: { displayMessage( "No Keys Found Within Specified Range", rc, - NULL, WPS_RED, WPS_WHITE); + NULL, FLM_RED, FLM_WHITE); pKeyEditor->setCurrentAtTop(); goto ix_list_retry; } @@ -12744,7 +12525,7 @@ Exit: if( rc == NE_XFLM_EOF_HIT) { displayMessage( "The index is empty", rc, - NULL, WPS_RED, WPS_WHITE); + NULL, FLM_RED, FLM_WHITE); rc = NE_XFLM_OK; } } @@ -12834,7 +12615,7 @@ Retrieve_Node: case 'F': case 'f': - case WPK_ALT_F: + case FKB_ALT_F: // Don't allow to start another query. *puiKeyOut = 0; @@ -12885,7 +12666,7 @@ void F_DomEditor::doQuery( requestInput( "XPATH Query", pszQuery, uiQueryBufSize, &uiTermChar); - if (uiTermChar == WPK_ESCAPE) + if (uiTermChar == FKB_ESCAPE) { goto Exit; } @@ -12893,7 +12674,7 @@ void F_DomEditor::doQuery( // Create a window for displaying query progress. queryStatus.createQueryStatusWindow( m_pScreen, - WPS_GREEN, WPS_WHITE, pszQuery); + FLM_GREEN, FLM_WHITE, pszQuery); if (RC_BAD( rc = dbSystem.createIFQuery( &pQuery))) { @@ -12912,7 +12693,7 @@ void F_DomEditor::doQuery( goto Exit; } - if (uiTermChar != WPK_ENTER) + if (uiTermChar != FKB_ENTER) { goto Exit; } @@ -13090,7 +12871,7 @@ Exit: if (RC_BAD( rc)) { displayMessage( "Error", RC_SET( rc), - NULL, WPS_RED, WPS_WHITE); + NULL, FLM_RED, FLM_WHITE); } if (pQuery) @@ -13300,8 +13081,8 @@ FSTATIC RCODE formatIndexKeyNode( { f_sprintf( pDispVals[ *puiNumVals].szString, "D)"); pDispVals[ *puiNumVals].uiCol = uiCol; - pDispVals[ *puiNumVals].uiForeground = WPS_CYAN; - pDispVals[ *puiNumVals].uiBackground = pDomEditor->isMonochrome() ? WPS_BLACK : WPS_BLUE; + pDispVals[ *puiNumVals].uiForeground = FLM_CYAN; + pDispVals[ *puiNumVals].uiBackground = pDomEditor->isMonochrome() ? FLM_BLACK : FLM_BLUE; uiCol += f_strlen( pDispVals[ *puiNumVals].szString) + 2; (*puiNumVals)++; } @@ -13309,8 +13090,8 @@ FSTATIC RCODE formatIndexKeyNode( { f_sprintf( pDispVals[ *puiNumVals].szString, "K)"); pDispVals[ *puiNumVals].uiCol = uiCol; - pDispVals[ *puiNumVals].uiForeground = WPS_CYAN; - pDispVals[ *puiNumVals].uiBackground = pDomEditor->isMonochrome() ? WPS_BLACK : WPS_BLUE; + pDispVals[ *puiNumVals].uiForeground = FLM_CYAN; + pDispVals[ *puiNumVals].uiBackground = pDomEditor->isMonochrome() ? FLM_BLACK : FLM_BLUE; uiCol += f_strlen( pDispVals[ *puiNumVals].szString) + 2; (*puiNumVals)++; } @@ -13327,8 +13108,8 @@ FSTATIC RCODE formatIndexKeyNode( goto Exit; } pDispVals[ *puiNumVals].uiCol = uiCol; - pDispVals[ *puiNumVals].uiForeground = WPS_WHITE; - pDispVals[ *puiNumVals].uiBackground = pDomEditor->isMonochrome() ? WPS_BLACK : WPS_BLUE; + pDispVals[ *puiNumVals].uiForeground = FLM_WHITE; + pDispVals[ *puiNumVals].uiBackground = pDomEditor->isMonochrome() ? FLM_BLACK : FLM_BLUE; uiCol += f_strlen( pDispVals[ *puiNumVals].szString) + 2; (*puiNumVals)++; @@ -13409,8 +13190,8 @@ FSTATIC RCODE formatIndexKeyNode( } } pDispVals[ *puiNumVals].uiCol = uiCol; - pDispVals[ *puiNumVals].uiForeground = WPS_YELLOW; - pDispVals[ *puiNumVals].uiBackground = pDomEditor->isMonochrome() ? WPS_BLACK : WPS_BLUE; + pDispVals[ *puiNumVals].uiForeground = FLM_YELLOW; + pDispVals[ *puiNumVals].uiBackground = pDomEditor->isMonochrome() ? FLM_BLACK : FLM_BLUE; uiCol += f_strlen( pDispVals[ *puiNumVals].szString) + 2; (*puiNumVals)++; @@ -13424,8 +13205,8 @@ FSTATIC RCODE formatIndexKeyNode( f_sprintf( pDispVals[ *puiNumVals].szString, "NULL"); } pDispVals[ *puiNumVals].uiCol = uiCol; - pDispVals[ *puiNumVals].uiForeground = WPS_LIGHTRED; - pDispVals[ *puiNumVals].uiBackground = pDomEditor->isMonochrome() ? WPS_BLACK : WPS_BLUE; + pDispVals[ *puiNumVals].uiForeground = FLM_LIGHTRED; + pDispVals[ *puiNumVals].uiBackground = pDomEditor->isMonochrome() ? FLM_BLACK : FLM_BLUE; uiCol += f_strlen( pDispVals[ *puiNumVals].szString) + 2; (*puiNumVals)++; diff --git a/xflaim/util/flm_dlst.cpp b/xflaim/util/flm_dlst.cpp index b1534e8..796e185 100644 --- a/xflaim/util/flm_dlst.cpp +++ b/xflaim/util/flm_dlst.cpp @@ -24,7 +24,6 @@ //------------------------------------------------------------------------------ #include "flaimsys.h" -#include "ftx.h" #include "flm_dlst.h" #include "sharutil.h" @@ -73,7 +72,7 @@ Desc: Allocates the list window and prepares the object for use *****************************************************************************/ RCODE F_DynamicList::setup( FTX_WINDOW * pInitializedWindow) { - RCODE rc = NE_XFLM_OK; + RCODE rc = NE_FLM_OK; flmAssert( pInitializedWindow != NULL); m_pListWin = pInitializedWindow; @@ -83,7 +82,7 @@ RCODE F_DynamicList::setup( FTX_WINDOW * pInitializedWindow) */ FTXWinClear( m_pListWin); - FTXWinSetCursorType( m_pListWin, WPS_CURSOR_INVISIBLE); + FTXWinSetCursorType( m_pListWin, FLM_CURSOR_INVISIBLE); FTXWinSetScroll( m_pListWin, FALSE); FTXWinSetLineWrap( m_pListWin, FALSE); FTXWinGetCanvasSize( m_pListWin, &m_uiListCols, &m_uiListRows); @@ -101,13 +100,13 @@ RCODE F_DynamicList::insert( void * pvData, FLMUINT uiDataLen) { - RCODE rc = NE_XFLM_OK; + RCODE rc = NE_FLM_OK; DLIST_NODE * pTmp; DLIST_NODE * pNew = NULL; if( getNode( uiKey) != NULL) { - rc = RC_SET( NE_XFLM_EXISTS); + rc = RC_SET( NE_FLM_EXISTS); goto Exit; } @@ -214,7 +213,7 @@ RCODE F_DynamicList::update( FLMUINT uiDataLen) { DLIST_NODE * pTmp; - RCODE rc = NE_XFLM_OK; + RCODE rc = NE_FLM_OK; if( (pTmp = getNode( uiKey)) == NULL) { @@ -260,11 +259,11 @@ RCODE F_DynamicList::remove( FLMUINT uiKey) { DLIST_NODE * pTmp; - RCODE rc = NE_XFLM_OK; + RCODE rc = NE_FLM_OK; if( (pTmp = getNode( uiKey)) == NULL) { - rc = RC_SET( NE_XFLM_NOT_FOUND); + rc = RC_SET( NE_FLM_NOT_FOUND); goto Exit; } @@ -327,13 +326,13 @@ void F_DynamicList::refresh( void) return; } - if ( FTXWinGetScreen( m_pListWin, &pScreen) != FTXRC_SUCCESS) + if( RC_BAD( FTXWinGetScreen( m_pListWin, &pScreen))) { flmAssert( 0); goto Exit; } - FTXSetRefreshState( pScreen->pFtxInfo, TRUE); + FTXSetRefreshState( TRUE); pTmp = m_pCur; uiLoop = m_uiRow; while( pTmp && uiLoop > 0) @@ -362,8 +361,10 @@ void F_DynamicList::refresh( void) { FTXWinClearXY( m_pListWin, 0, uiLoop); } - FTXSetRefreshState( pScreen->pFtxInfo, FALSE); + + FTXSetRefreshState( FALSE); m_bChanged = FALSE; + Exit: ; } @@ -519,28 +520,28 @@ void F_DynamicList::defaultKeyAction( { switch( uiKey) { - case WPK_UP: + case FKB_UP: cursorUp(); break; - case WPK_DOWN: + case FKB_DOWN: cursorDown(); break; - case WPK_PGUP: + case FKB_PGUP: pageUp(); break; - case WPK_PGDN: + case FKB_PGDN: pageDown(); break; - case WPK_HOME: + case FKB_HOME: home(); break; - case WPK_END: + case FKB_END: end(); break; case 'd': case 'D': { - RCODE rc = NE_XFLM_OK; + RCODE rc = NE_FLM_OK; rc = this->dumpToFile(); break; } @@ -584,7 +585,6 @@ void F_DynamicList::freeNode( } /**************************************************************************** -Name: dlistDefaultDisplayHook Desc: *****************************************************************************/ RCODE dlistDefaultDisplayHook( @@ -596,8 +596,8 @@ RCODE dlistDefaultDisplayHook( FLMUINT uiDataLen, F_DynamicList* pDynamicList) { - FLMUINT uiBack = WPS_CYAN; - FLMUINT uiFore = WPS_WHITE; + eColorType uiBack = FLM_CYAN; + eColorType uiFore = FLM_WHITE; F_UNREFERENCED_PARM( uiKey); F_UNREFERENCED_PARM( uiDataLen); @@ -614,22 +614,30 @@ RCODE dlistDefaultDisplayHook( { FTXWinPaintRow( pWin, &uiBack, &uiFore, uiRow); } - return( NE_XFLM_OK); + return( NE_FLM_OK); } +/**************************************************************************** +Desc: +*****************************************************************************/ RCODE F_DynamicList::dumpToFile() { - DLIST_NODE * pTmp; - FLMUINT uiLoop; - IF_FileHdl * pFileHdl = NULL; - RCODE rc = NE_XFLM_OK; - F_FileSystem FileSystem; + RCODE rc = NE_FLM_OK; + DLIST_NODE * pTmp; + FLMUINT uiLoop; + IF_FileHdl * pFileHdl = NULL; #define DLST_RESP_SIZE 256 - char szResponse[ DLST_RESP_SIZE]; - FLMUINT uiTermChar; - FTX_SCREEN * pScreen; + char szResponse[ DLST_RESP_SIZE]; + FLMUINT uiTermChar; + FTX_SCREEN * pScreen; + IF_FileSystem * pFileSystem = NULL; + + if( RC_BAD( rc = FlmGetFileSystem( &pFileSystem))) + { + goto Exit; + } - f_strcpy( szResponse, DLIST_DUMPFILE_PATH); + f_strcpy( szResponse, (const char *)DLIST_DUMPFILE_PATH); FTXWinGetScreen( m_pListWin, &pScreen); FTXGetInput( @@ -639,17 +647,17 @@ RCODE F_DynamicList::dumpToFile() DLST_RESP_SIZE-1, &uiTermChar); - if ( uiTermChar != WPK_ENTER) + if ( uiTermChar != FKB_ENTER) { goto Exit; } - if (RC_BAD( rc = FileSystem.Exists( szResponse))) + if (RC_BAD( rc = pFileSystem->doesFileExist( szResponse))) { //create file if it doesn't already exist - if ( rc == NE_XFLM_IO_PATH_NOT_FOUND) + if ( rc == NE_FLM_IO_PATH_NOT_FOUND) { - rc = FileSystem.Create( szResponse, XFLM_IO_RDWR, &pFileHdl); + rc = pFileSystem->createFile( szResponse, FLM_IO_RDWR, &pFileHdl); } else { @@ -658,7 +666,7 @@ RCODE F_DynamicList::dumpToFile() } else { - rc = FileSystem.Open( szResponse, XFLM_IO_RDWR, &pFileHdl); + rc = pFileSystem->openFile( szResponse, FLM_IO_RDWR, &pFileHdl); } TEST_RC_LOCAL( rc); @@ -669,7 +677,7 @@ RCODE F_DynamicList::dumpToFile() //figure out size of file currently, so you can append to it - pFileHdl->Size( &ui64FileSize); + pFileHdl->size( &ui64FileSize); pTmp = m_pFirst; uiLoop = 0; @@ -677,15 +685,15 @@ RCODE F_DynamicList::dumpToFile() { FLMBYTE * pszNextLine = (FLMBYTE*)(pTmp->pvData); - TEST_RC_LOCAL( rc = pFileHdl->Write( + TEST_RC_LOCAL( rc = pFileHdl->write( ui64FileSize, //offset to current file size - f_strlen( pszNextLine), + f_strlen( (const char *)pszNextLine), pszNextLine, &uiBytesWritten)); ui64FileSize += uiBytesWritten; - TEST_RC_LOCAL( rc = pFileHdl->Write( + TEST_RC_LOCAL( rc = pFileHdl->write( ui64FileSize, //add in newline 1, (FLMBYTE*)"\n", @@ -695,7 +703,7 @@ RCODE F_DynamicList::dumpToFile() pTmp = pTmp->pNext; } - (void)pFileHdl->Close(); + (void)pFileHdl->close(); } @@ -716,16 +724,23 @@ Exit_local: f_sprintf( szMessage, "error rc=%u dumping to file %s", (unsigned)rc, DLIST_DUMPFILE_PATH); } - FTXDisplayMessage( pScreen, WPS_RED, WPS_WHITE, szMessage, + FTXDisplayMessage( pScreen, FLM_RED, FLM_WHITE, szMessage, "press ESC or ENTER to close dialog", &uiChar); } Exit: + if (pFileHdl) { pFileHdl->Release(); pFileHdl = NULL; } + + if( pFileSystem) + { + pFileSystem->Release(); + } + return rc; } diff --git a/xflaim/util/flm_dlst.h b/xflaim/util/flm_dlst.h index ea763be..8a7ccd8 100644 --- a/xflaim/util/flm_dlst.h +++ b/xflaim/util/flm_dlst.h @@ -73,7 +73,7 @@ Class definitions #ifdef __cplusplus -class F_DynamicList : public XF_RefCount, public XF_Base +class F_DynamicList : public F_Object { private: diff --git a/xflaim/util/flm_lutl.cpp b/xflaim/util/flm_lutl.cpp index 5b0cbc9..196e60c 100644 --- a/xflaim/util/flm_lutl.cpp +++ b/xflaim/util/flm_lutl.cpp @@ -62,11 +62,10 @@ FSTATIC RCODE ixDisplayHook( FLMUINT uiKey, void * pvData, FLMUINT uiDataLen, - F_DynamicList* pDynamicList - ) + F_DynamicList* pDynamicList) { - FLMUINT uiBack = WPS_CYAN; - FLMUINT uiFore = WPS_WHITE; + eColorType uiBack = FLM_CYAN; + eColorType uiFore = FLM_WHITE; IX_DISPLAY_INFO * pDispInfo = (IX_DISPLAY_INFO *)pvData; char szTmpBuf [100]; const char * pszState; @@ -145,7 +144,7 @@ public: { } - void XFLMAPI catchEvent( + void FLMAPI catchEvent( eEventType eEvent, IF_Db * pDb, FLMUINT uiThreadId, @@ -204,7 +203,7 @@ Note: The caller must open the database and pass a handle to the thread. The handle will be closed when the thread exits. *****************************************************************************/ RCODE flstIndexManagerThread( - F_Thread * pThread) + IF_Thread * pThread) { RCODE rc = NE_XFLM_OK; F_DynamicList * pList = f_new F_DynamicList; @@ -246,8 +245,7 @@ RCODE flstIndexManagerThread( goto Exit; } - if( FTXScreenInit( _getGlobalFtxInfo(), - "Index Manager", &IxDispInfo.pScreen) != FTXRC_SUCCESS) + if( RC_BAD( FTXScreenInit( "Index Manager", &IxDispInfo.pScreen))) { goto Exit; } @@ -255,36 +253,36 @@ RCODE flstIndexManagerThread( FTXScreenGetSize( IxDispInfo.pScreen, &uiScreenCols, &uiScreenRows); FTXScreenDisplay( IxDispInfo.pScreen); - if( FTXWinInit( IxDispInfo.pScreen, 0, - FIMT_TITLE_HEIGHT, &pTitleWin) != FTXRC_SUCCESS) + if( RC_BAD( FTXWinInit( IxDispInfo.pScreen, 0, + FIMT_TITLE_HEIGHT, &pTitleWin))) { goto Exit; } - FTXWinSetBackFore( pTitleWin, WPS_RED, WPS_WHITE); + FTXWinSetBackFore( pTitleWin, FLM_RED, FLM_WHITE); FTXWinClear( pTitleWin); FTXWinPrintStr( pTitleWin, "FLAIM Index Manager"); - FTXWinSetCursorType( pTitleWin, WPS_CURSOR_INVISIBLE); + FTXWinSetCursorType( pTitleWin, FLM_CURSOR_INVISIBLE); FTXWinOpen( pTitleWin); - if( (FTXWinInit( IxDispInfo.pScreen, + if( RC_BAD( FTXWinInit( IxDispInfo.pScreen, uiScreenCols, FIMT_HEADER_HEIGHT, - &pHeaderWin)) != FTXRC_SUCCESS) + &pHeaderWin))) { goto Exit; } FTXWinMove( pHeaderWin, 0, FIMT_TITLE_HEIGHT); - FTXWinSetBackFore( pHeaderWin, WPS_BLUE, WPS_WHITE); + FTXWinSetBackFore( pHeaderWin, FLM_BLUE, FLM_WHITE); FTXWinClear( pHeaderWin); - FTXWinSetCursorType( pHeaderWin, WPS_CURSOR_INVISIBLE); + FTXWinSetCursorType( pHeaderWin, FLM_CURSOR_INVISIBLE); FTXWinSetScroll( pHeaderWin, FALSE); FTXWinSetLineWrap( pHeaderWin, FALSE); FTXWinOpen( pHeaderWin); - if( (FTXWinInit( IxDispInfo.pScreen, uiScreenCols, + if( RC_BAD( FTXWinInit( IxDispInfo.pScreen, uiScreenCols, uiScreenRows - FIMT_TITLE_HEIGHT - FIMT_HEADER_HEIGHT - FIMT_LOG_HEIGHT, - &pListWin)) != FTXRC_SUCCESS) + &pListWin))) { goto Exit; } @@ -292,17 +290,17 @@ RCODE flstIndexManagerThread( FTXWinOpen( pListWin); pList->setup( pListWin); - if( (FTXWinInit( IxDispInfo.pScreen, uiScreenCols, FIMT_LOG_HEIGHT, - &IxDispInfo.pLogWin)) != FTXRC_SUCCESS) + if( RC_BAD( FTXWinInit( IxDispInfo.pScreen, uiScreenCols, FIMT_LOG_HEIGHT, + &IxDispInfo.pLogWin))) { goto Exit; } FTXWinDrawBorder( IxDispInfo.pLogWin); FTXWinMove( IxDispInfo.pLogWin, 0, uiScreenRows - FIMT_LOG_HEIGHT); - FTXWinSetBackFore( IxDispInfo.pLogWin, WPS_BLUE, WPS_WHITE); + FTXWinSetBackFore( IxDispInfo.pLogWin, FLM_BLUE, FLM_WHITE); FTXWinClear( IxDispInfo.pLogWin); - FTXWinSetCursorType( IxDispInfo.pLogWin, WPS_CURSOR_INVISIBLE); + FTXWinSetCursorType( IxDispInfo.pLogWin, FLM_CURSOR_INVISIBLE); FTXWinSetScroll( IxDispInfo.pLogWin, TRUE); FTXWinSetLineWrap( IxDispInfo.pLogWin, FALSE); FTXWinOpen( IxDispInfo.pLogWin); @@ -316,8 +314,8 @@ RCODE flstIndexManagerThread( FTXWinSetFocus( pListWin); uiIterations = 0; - FLM_SECS_TO_TIMER_UNITS( 1, uiUpdateInterval); - FLM_SECS_TO_TIMER_UNITS( 1, uiOneSec); + uiUpdateInterval = FLM_SECS_TO_TIMER_UNITS( 1); + uiOneSec = FLM_SECS_TO_TIMER_UNITS( 1); uiLastUpdateTime = 0; while( !gv_bShutdown) { @@ -530,7 +528,7 @@ Update_Screen: bScreenLocked = TRUE; } - if( FTXWinTestKB( pListWin) == FTXRC_SUCCESS) + if( RC_OK( FTXWinTestKB( pListWin))) { FLMUINT uiChar; @@ -574,11 +572,11 @@ Update_Screen: break; } - case WPK_ALT_S: + case FKB_ALT_S: case 'S': { f_mutexLock( IxDispInfo.hScreenMutex); - FTXMessageWindow( IxDispInfo.pScreen, WPS_RED, WPS_WHITE, + FTXMessageWindow( IxDispInfo.pScreen, FLM_RED, FLM_WHITE, "Suspending all indexes ....", NULL, &pMsgWin); @@ -614,10 +612,10 @@ Update_Screen: } case 'R': - case WPK_ALT_R: + case FKB_ALT_R: { f_mutexLock( IxDispInfo.hScreenMutex); - FTXMessageWindow( IxDispInfo.pScreen, WPS_RED, WPS_WHITE, + FTXMessageWindow( IxDispInfo.pScreen, FLM_RED, FLM_WHITE, "Resuming all indexes ", NULL, &pMsgWin); @@ -676,22 +674,22 @@ Update_Screen: goto Help_Exit; } - if( (FTXWinInit( IxDispInfo.pScreen, uiScreenCols, - 1, &pHelpTitle)) != FTXRC_SUCCESS) + if( RC_BAD( FTXWinInit( IxDispInfo.pScreen, uiScreenCols, + 1, &pHelpTitle))) { goto Help_Exit; } - FTXWinSetBackFore( pHelpTitle, WPS_RED, WPS_WHITE); + FTXWinSetBackFore( pHelpTitle, FLM_RED, FLM_WHITE); FTXWinClear( pHelpTitle); - FTXWinSetCursorType( pHelpTitle, WPS_CURSOR_INVISIBLE); + FTXWinSetCursorType( pHelpTitle, FLM_CURSOR_INVISIBLE); FTXWinSetScroll( pHelpTitle, FALSE); FTXWinSetLineWrap( pHelpTitle, FALSE); FTXWinPrintf( pHelpTitle, "FLAIM Index Manager - Help"); FTXWinOpen( pHelpTitle); - if ( (FTXWinInit( IxDispInfo.pScreen, uiScreenCols, - uiScreenRows - 1, &pHelpWin)) != FTXRC_SUCCESS) + if( RC_BAD( FTXWinInit( IxDispInfo.pScreen, uiScreenCols, + uiScreenRows - 1, &pHelpWin))) { goto Help_Exit; } @@ -725,12 +723,12 @@ Update_Screen: f_mutexLock( IxDispInfo.hScreenMutex); bScreenLocked = TRUE; - if( FTXWinTestKB( pHelpWin) == FTXRC_SUCCESS) + if( RC_OK( FTXWinTestKB( pHelpWin))) { FLMUINT uiTmpChar; FTXWinInputChar( pHelpWin, &uiTmpChar); - if( uiTmpChar == WPK_ESCAPE) + if( uiTmpChar == FKB_ESCAPE) { break; } @@ -764,7 +762,7 @@ Help_Exit: break; } - case WPK_ESCAPE: + case FKB_ESCAPE: { goto Exit; } @@ -834,7 +832,7 @@ Desc: Thread that displays the current status of a database's cache Note: The caller must pass a valid share handle to the thread on startup. *****************************************************************************/ RCODE flstMemoryManagerThread( - F_Thread * pThread) + IF_Thread * pThread) { F_DynamicList * pList = f_new F_DynamicList; FTX_SCREEN * pScreen; @@ -852,8 +850,7 @@ RCODE flstMemoryManagerThread( #define FMMT_TITLE_HEIGHT 1 #define FMMT_HEADER_HEIGHT 3 - if( FTXScreenInit( _getGlobalFtxInfo(), - "XFlaim Memory Manager", &pScreen) != FTXRC_SUCCESS) + if( RC_BAD( FTXScreenInit( "XFlaim Memory Manager", &pScreen))) { goto Exit; } @@ -861,35 +858,35 @@ RCODE flstMemoryManagerThread( FTXScreenGetSize( pScreen, &uiScreenCols, &uiScreenRows); FTXScreenDisplay( pScreen); - if( FTXWinInit( pScreen, 0, FMMT_TITLE_HEIGHT, &pTitleWin) != FTXRC_SUCCESS) + if( RC_BAD( FTXWinInit( pScreen, 0, FMMT_TITLE_HEIGHT, &pTitleWin))) { goto Exit; } - FTXWinPaintBackground( pTitleWin, WPS_RED); + FTXWinPaintBackground( pTitleWin, FLM_RED); FTXWinPrintStr( pTitleWin, "XFlaim Memory Manager"); - FTXWinSetCursorType( pTitleWin, WPS_CURSOR_INVISIBLE); + FTXWinSetCursorType( pTitleWin, FLM_CURSOR_INVISIBLE); FTXWinOpen( pTitleWin); - if( (FTXWinInit( pScreen, uiScreenCols, FMMT_HEADER_HEIGHT, - &pHeaderWin)) != FTXRC_SUCCESS) + if( RC_BAD( FTXWinInit( pScreen, uiScreenCols, FMMT_HEADER_HEIGHT, + &pHeaderWin))) { goto Exit; } - FTXWinSetBackFore( pHeaderWin, WPS_BLUE, WPS_WHITE); + FTXWinSetBackFore( pHeaderWin, FLM_BLUE, FLM_WHITE); FTXWinClear( pHeaderWin); FTXWinPrintf( pHeaderWin, "\n Block Cache Node Cache"); - FTXWinSetCursorType( pHeaderWin, WPS_CURSOR_INVISIBLE); + FTXWinSetCursorType( pHeaderWin, FLM_CURSOR_INVISIBLE); FTXWinSetScroll( pHeaderWin, FALSE); FTXWinSetLineWrap( pHeaderWin, FALSE); FTXWinMove( pHeaderWin, 0, FMMT_TITLE_HEIGHT); FTXWinOpen( pHeaderWin); - if ( (FTXWinInit( pScreen, uiScreenCols, + if( RC_BAD( FTXWinInit( pScreen, uiScreenCols, uiScreenRows - FMMT_TITLE_HEIGHT - FMMT_HEADER_HEIGHT, - &pListWin)) != FTXRC_SUCCESS) + &pListWin))) { goto Exit; } @@ -1062,7 +1059,7 @@ RCODE flstMemoryManagerThread( pList->refresh(); } - if( FTXWinTestKB( pListWin) == FTXRC_SUCCESS) + if( RC_OK( FTXWinTestKB( pListWin))) { FLMUINT uiChar; @@ -1073,25 +1070,25 @@ RCODE flstMemoryManagerThread( case 'r': dbSystem.resetStats(); break; - case WPK_UP: + case FKB_UP: pList->cursorUp(); break; - case WPK_DOWN: + case FKB_DOWN: pList->cursorDown(); break; - case WPK_PGUP: + case FKB_PGUP: pList->pageUp(); break; - case WPK_PGDN: + case FKB_PGDN: pList->pageDown(); break; - case WPK_HOME: + case FKB_HOME: pList->home(); break; - case WPK_END: + case FKB_END: pList->end(); break; - case WPK_ESCAPE: + case FKB_ESCAPE: goto Exit; } pList->refresh(); diff --git a/xflaim/util/flm_lutl.h b/xflaim/util/flm_lutl.h index 85dc721..a290123 100644 --- a/xflaim/util/flm_lutl.h +++ b/xflaim/util/flm_lutl.h @@ -23,10 +23,8 @@ // $Id: flm_lutl.h 3117 2006-01-19 13:34:36 -0700 (Thu, 19 Jan 2006) dsanders $ //------------------------------------------------------------------------------ -#include "ftx.h" - RCODE flstIndexManagerThread( - F_Thread * pThread); + IF_Thread * pThread); RCODE flstMemoryManagerThread( - F_Thread * pThread); + IF_Thread * pThread); diff --git a/xflaim/util/flmunittest.cpp b/xflaim/util/flmunittest.cpp index 25b90a9..efd1147 100644 --- a/xflaim/util/flmunittest.cpp +++ b/xflaim/util/flmunittest.cpp @@ -865,13 +865,6 @@ RCODE TestBase::init( goto Exit; } - if( RC_BAD( rc = m_pDbSystem->init())) - { - goto Exit; - } - - // VISIT: here -- disable asserts on FLAIM errors via a config call!!! - m_bLog = bLog; m_bDisplay = bDisplay; @@ -1580,7 +1573,6 @@ TestBase::~TestBase() if( m_pDbSystem) { - m_pDbSystem->exit(); m_pDbSystem->Release(); } } diff --git a/xflaim/util/fshell.cpp b/xflaim/util/fshell.cpp index b03f499..90c3422 100644 --- a/xflaim/util/fshell.cpp +++ b/xflaim/util/fshell.cpp @@ -32,7 +32,6 @@ // Imported global variables. -extern FTX_INFO * gv_pFtxInfo; extern FLMBOOL gv_bShutdown; // XML Import Error Handling @@ -226,7 +225,7 @@ public: FLMUINT m_uiAttrListSize; FLMUINT m_uiNumAttrs; F_NodeInfo m_nodeInfo; - F_Pool m_Pool; + IF_Pool * m_pPool; }; // Local prototypes @@ -263,7 +262,7 @@ RCODE importXmlFiles( XFLM_IMPORT_STATS * pImportStats); RCODE getErrFromFile( - F_FileIStream * fileIStream, + IF_PosIStream * pFileIStream, FLMUINT uiCurrLineFilePos, FLMUINT uiCurrLineBytes, XMLEncoding eXMLEncoding, @@ -331,13 +330,13 @@ public: pszBackupSetPath, pszRflDir)); } - FINLINE RCODE XFLMAPI openRflFile( + FINLINE RCODE FLMAPI openRflFile( FLMUINT uiFileNum) { return( F_FSRestore::openRflFile( uiFileNum)); } - FINLINE RCODE XFLMAPI read( + FINLINE RCODE FLMAPI read( FLMUINT uiLength, void * pvBuffer, FLMUINT * puiBytesRead) @@ -371,28 +370,28 @@ public: m_ui64RflBytesRead = 0; } - RCODE XFLMAPI reportProgress( + RCODE FLMAPI reportProgress( eRestoreAction * peAction, FLMUINT64 ui64BytesToDo, FLMUINT64 ui64BytesDone); - RCODE XFLMAPI reportError( + RCODE FLMAPI reportError( eRestoreAction * peAction, RCODE rcErr); - RCODE XFLMAPI reportBeginTrans( + RCODE FLMAPI reportBeginTrans( eRestoreAction * peAction, FLMUINT64 ui64TransId); - RCODE XFLMAPI reportCommitTrans( + RCODE FLMAPI reportCommitTrans( eRestoreAction * peAction, FLMUINT64 ui64TransId); - RCODE XFLMAPI reportAbortTrans( + RCODE FLMAPI reportAbortTrans( eRestoreAction * peAction, FLMUINT64 ui64TransId); - RCODE XFLMAPI reportOpenRflFile( + RCODE FLMAPI reportOpenRflFile( eRestoreAction * peAction, FLMUINT uiFileNum) { @@ -403,7 +402,7 @@ public: return( NE_XFLM_OK); } - RCODE XFLMAPI reportRflRead( + RCODE FLMAPI reportRflRead( eRestoreAction * peAction, FLMUINT uiFileNum, FLMUINT uiBytesRead) @@ -416,7 +415,7 @@ public: return( NE_XFLM_OK); } - RCODE XFLMAPI reportBlockChainFree( + RCODE FLMAPI reportBlockChainFree( eRestoreAction * peAction, FLMUINT64, // ui64TransId, FLMUINT64, // ui64MaintDocNum, @@ -429,15 +428,15 @@ public: return( NE_XFLM_OK); } - RCODE XFLMAPI reportEnableEncryption( + RCODE FLMAPI reportEnableEncryption( eRestoreAction * peAction, FLMUINT64 ui64TransId); - RCODE XFLMAPI reportWrapKey( + RCODE FLMAPI reportWrapKey( eRestoreAction * peAction, FLMUINT64 ui64TransId); - RCODE XFLMAPI reportRollOverDbKey( + RCODE FLMAPI reportRollOverDbKey( eRestoreAction * peAction, FLMUINT64) // ui64TransId) { @@ -445,7 +444,7 @@ public: return( NE_XFLM_OK); } - RCODE XFLMAPI reportDocumentDone( + RCODE FLMAPI reportDocumentDone( eRestoreAction * peAction, FLMUINT64, // ui64TransId, FLMUINT, // uiCollection, @@ -455,7 +454,7 @@ public: return( NE_XFLM_OK); } - RCODE XFLMAPI reportNodeCreate( + RCODE FLMAPI reportNodeCreate( eRestoreAction * peAction, FLMUINT64, // ui64TransId, FLMUINT, // uiCollection, @@ -468,7 +467,7 @@ public: return( NE_XFLM_OK); } - RCODE XFLMAPI reportNodeDelete( + RCODE FLMAPI reportNodeDelete( eRestoreAction * peAction, FLMUINT64, // ui64TransId, FLMUINT, // uiCollection, @@ -478,7 +477,7 @@ public: return( NE_XFLM_OK); } - RCODE XFLMAPI reportNodeChildrenDelete( + RCODE FLMAPI reportNodeChildrenDelete( eRestoreAction * peAction, FLMUINT64, // ui64TransId, FLMUINT, // uiCollection, @@ -489,7 +488,7 @@ public: return( NE_XFLM_OK); } - RCODE XFLMAPI reportInsertBefore( + RCODE FLMAPI reportInsertBefore( eRestoreAction * peAction, FLMUINT64, // ui64TransId, FLMUINT, // uiCollection, @@ -501,7 +500,7 @@ public: return( NE_XFLM_OK); } - RCODE XFLMAPI reportNodeUpdate( + RCODE FLMAPI reportNodeUpdate( eRestoreAction * peAction, FLMUINT64, // ui64TransId, FLMUINT, // uiCollection, @@ -511,7 +510,7 @@ public: return( NE_XFLM_OK); } - RCODE XFLMAPI reportNodeSetValue( + RCODE FLMAPI reportNodeSetValue( eRestoreAction * peAction, FLMUINT64, // ui64TransId, FLMUINT, // uiCollection, @@ -521,7 +520,7 @@ public: return( NE_XFLM_OK); } - RCODE XFLMAPI reportNodeFlagsUpdate( + RCODE FLMAPI reportNodeFlagsUpdate( eRestoreAction * peAction, FLMUINT64, // ui64TransId, FLMUINT, // uiCollection, @@ -533,7 +532,7 @@ public: return( NE_XFLM_OK); } - RCODE XFLMAPI reportNodeSetPrefixId( + RCODE FLMAPI reportNodeSetPrefixId( eRestoreAction * peAction, FLMUINT64, // ui64TransId, FLMUINT, // uiCollection, @@ -544,7 +543,7 @@ public: return( NE_XFLM_OK); } - RCODE XFLMAPI reportSetNextNodeId( + RCODE FLMAPI reportSetNextNodeId( eRestoreAction * peAction, FLMUINT64, // ui64TransId, FLMUINT, // uiCollection, @@ -554,7 +553,7 @@ public: return( NE_XFLM_OK); } - RCODE XFLMAPI reportNodeSetMetaValue( + RCODE FLMAPI reportNodeSetMetaValue( eRestoreAction * peAction, FLMUINT64, // ui64TransId, FLMUINT, // uiCollection, @@ -566,7 +565,7 @@ public: return( NE_XFLM_OK); } - RCODE XFLMAPI reportAttributeDelete( + RCODE FLMAPI reportAttributeDelete( eRestoreAction * peAction, FLMUINT64, // ui64TransId, FLMUINT, // uiCollection, @@ -577,7 +576,7 @@ public: return( NE_XFLM_OK); } - RCODE XFLMAPI reportAttributeSetValue( + RCODE FLMAPI reportAttributeSetValue( eRestoreAction * peAction, FLMUINT64, // ui64TransId, FLMUINT, // uiCollection, @@ -588,7 +587,7 @@ public: return( NE_XFLM_OK); } - RCODE XFLMAPI reportNodeSetPrefixId( + RCODE FLMAPI reportNodeSetPrefixId( eRestoreAction * peAction, FLMUINT64, // ui64TransId, FLMUINT, // uiCollection, @@ -643,7 +642,7 @@ private: /**************************************************************************** Desc: *****************************************************************************/ -class F_LocalBackupStatus : public IF_BackupStatus, public XF_Base +class F_LocalBackupStatus : public IF_BackupStatus { public: @@ -653,21 +652,21 @@ public: m_pShell = pShell; } - RCODE XFLMAPI backupStatus( + RCODE FLMAPI backupStatus( FLMUINT64 ui64BytesToDo, FLMUINT64 ui64BytesDone); - FINLINE FLMUINT getRefCount( void) + FINLINE FLMINT FLMAPI getRefCount( void) { return( IF_BackupStatus::getRefCount()); } - virtual FINLINE FLMINT XFLMAPI AddRef( void) + virtual FINLINE FLMINT FLMAPI AddRef( void) { return( IF_BackupStatus::AddRef()); } - virtual FINLINE FLMINT XFLMAPI Release( void) + virtual FINLINE FLMINT FLMAPI Release( void) { return( IF_BackupStatus::Release()); } @@ -682,8 +681,14 @@ Desc: *****************************************************************************/ FlmShell::FlmShell( void) : FlmThreadContext() { - m_HistPool.poolInit( 512); - m_ArgPool.poolInit( 512); + m_pHistPool = NULL; + m_pArgPool = NULL; + + FlmAllocPool( &m_pHistPool); + FlmAllocPool( &m_pArgPool); + + m_pHistPool->poolInit( 512); + m_pArgPool->poolInit( 512); f_memset( m_DbList, 0, MAX_SHELL_OPEN_DB * sizeof( IF_Db *)); m_pTitleWin = NULL; @@ -703,8 +708,15 @@ FlmShell::~FlmShell( void) { FLMUINT uiLoop; - m_HistPool.poolFree(); - m_ArgPool.poolFree(); + if( m_pHistPool) + { + m_pHistPool->Release(); + } + + if( m_pArgPool) + { + m_pArgPool->Release(); + } // Free the command objects. @@ -1129,7 +1141,7 @@ RCODE FlmShell::parseCmdLine( FlmParse Parser; RCODE rc = NE_XFLM_OK; - m_ArgPool.poolReset( NULL); + m_pArgPool->poolReset( NULL); m_iCurrArgC = 0; m_ppCurrArgV = NULL; m_pszOutputFile = NULL; @@ -1140,7 +1152,7 @@ RCODE FlmShell::parseCmdLine( uiArgCount++; } - if (RC_BAD( rc = m_ArgPool.poolCalloc( uiArgCount * sizeof( char *), + if (RC_BAD( rc = m_pArgPool->poolCalloc( uiArgCount * sizeof( char *), (void **)&m_ppCurrArgV))) { goto Exit; @@ -1161,7 +1173,7 @@ RCODE FlmShell::parseCmdLine( uiTokenLen = f_strlen( pszCurrToken); if (!bQuoted && uiTokenLen >= 2 && *pszCurrToken == '>' && !m_pszOutputFile) { - if (RC_BAD( rc = m_ArgPool.poolCalloc( uiTokenLen, + if (RC_BAD( rc = m_pArgPool->poolCalloc( uiTokenLen, (void **)&m_pszOutputFile))) { goto Exit; @@ -1170,7 +1182,7 @@ RCODE FlmShell::parseCmdLine( } else { - if (RC_BAD( rc = m_ArgPool.poolCalloc( uiTokenLen + 1, + if (RC_BAD( rc = m_pArgPool->poolCalloc( uiTokenLen + 1, (void **)&m_ppCurrArgV [uiCurrToken]))) { goto Exit; @@ -1199,9 +1211,10 @@ Desc: *****************************************************************************/ RCODE FlmShell::executeCmdLine( void) { - RCODE rc = NE_XFLM_OK; - FLMBOOL bValidCommand = FALSE; - FLMUINT uiLoop; + RCODE rc = NE_XFLM_OK; + FLMBOOL bValidCommand = FALSE; + FLMUINT uiLoop; + IF_BufferIStream * pBufIStream = NULL; if( !m_iCurrArgC) { @@ -1290,10 +1303,9 @@ RCODE FlmShell::executeCmdLine( void) } else if( f_stricmp( m_ppCurrArgV[ 0], "qp") == 0) { - F_XPath xpathObj; - F_BufferIStream bufIStream; - F_Query query; - RCODE tmpRc; + F_XPath xpathObj; + F_Query query; + RCODE tmpRc; bValidCommand = TRUE; if( m_iCurrArgC != 3) @@ -1311,16 +1323,24 @@ RCODE FlmShell::executeCmdLine( void) con_printf( "Invalid database ID.\n\n"); goto Exit; } - - bufIStream.open( (FLMBYTE *)m_ppCurrArgV[ 2], - f_strlen( m_ppCurrArgV[ 2])); - tmpRc = xpathObj.parseQuery( pDb, &bufIStream, &query); + + if( !pBufIStream) + { + if( RC_BAD( rc = FlmAllocBufferIStream( &pBufIStream))) + { + goto Exit; + } + } + + pBufIStream->open( m_ppCurrArgV[ 2], f_strlen( m_ppCurrArgV[ 2])); + tmpRc = xpathObj.parseQuery( pDb, pBufIStream, &query); + pBufIStream->close(); + con_printf( "Result: 0x%08X\n\n", (unsigned)tmpRc); } } else if( f_stricmp( m_ppCurrArgV[ 0], "meta") == 0) { - F_BufferIStream bufIStream; FLMUINT uiMeta; FLMUINT uiAltMeta; RCODE tmpRc; @@ -1332,11 +1352,18 @@ RCODE FlmShell::executeCmdLine( void) } else { - bufIStream.open( (FLMBYTE *)m_ppCurrArgV[ 1], - f_strlen( m_ppCurrArgV[ 1])); + if( !pBufIStream) + { + if( RC_BAD( rc = FlmAllocBufferIStream( &pBufIStream))) + { + goto MetaExit; + } + } + + pBufIStream->open( m_ppCurrArgV[ 1], f_strlen( m_ppCurrArgV[ 1])); for( ;;) { - if( RC_BAD( tmpRc = flmGetNextMetaphone( &bufIStream, + if( RC_BAD( tmpRc = f_getNextMetaphone( pBufIStream, &uiMeta, &uiAltMeta))) { if( tmpRc == NE_XFLM_EOF_HIT) @@ -1358,6 +1385,11 @@ MetaExit: { con_printf( "Error: 0x%04X\n", tmpRc); } + + if( pBufIStream) + { + pBufIStream->close(); + } } } else if( f_stricmp( m_ppCurrArgV[ 0], "help") == 0 || @@ -1425,6 +1457,11 @@ MetaExit: Exit: + if( pBufIStream) + { + pBufIStream->Release(); + } + return( rc); } @@ -1545,28 +1582,22 @@ RCODE FlmShell::execute( void) char szDir [F_PATH_MAX_SIZE]; DirectoryIterator directoryIterator; char * pszTabCompleteBegin = NULL; + IF_PosIStream * pFileIStream = NULL; - if( FTXScreenInit( m_pSharedContext->getFtxInfo(), - "xshell main", &m_pScreen) != FTXRC_SUCCESS) + if( RC_BAD( rc = FTXScreenInit( "xshell main", &m_pScreen))) { - rc = RC_SET( NE_XFLM_FAILURE); goto Exit; } - if( FTXScreenInitStandardWindows( m_pScreen, WPS_RED, WPS_WHITE, WPS_BLUE, - WPS_WHITE, FALSE, FALSE, NULL, &m_pTitleWin, &m_pWindow) != FTXRC_SUCCESS) + if( RC_BAD( rc = FTXScreenInitStandardWindows( m_pScreen, + FLM_RED, FLM_WHITE, FLM_BLUE, FLM_WHITE, FALSE, FALSE, + NULL, &m_pTitleWin, &m_pWindow))) { - rc = RC_SET( NE_XFLM_FAILURE); - goto Exit; - } - - if( FTXScreenDisplay( m_pScreen) != FTXRC_SUCCESS) - { - rc = RC_SET( NE_XFLM_FAILURE); goto Exit; } + FTXScreenDisplay( m_pScreen); FTXScreenSetShutdownFlag( m_pScreen, getShutdownFlagAddr()); szBuffer[ 0] = '\0'; @@ -1613,7 +1644,7 @@ RCODE FlmShell::execute( void) break; } - if( uiTermChar == WPK_TAB) + if( uiTermChar == FKB_TAB) { char szBase[ 255]; char szWildcard[ 255]; @@ -1652,7 +1683,7 @@ RCODE FlmShell::execute( void) } else { - ftxBeep(); + FTXBeep(); } // If the completed path contains spaces, quote it @@ -1669,7 +1700,7 @@ RCODE FlmShell::execute( void) directoryIterator.reset(); - if( uiTermChar == WPK_UP) + if( uiTermChar == FKB_UP) { for(; uiLastHistorySlot > 0; uiLastHistorySlot--) { @@ -1684,7 +1715,7 @@ RCODE FlmShell::execute( void) continue; } - if( uiTermChar == WPK_DOWN) + if( uiTermChar == FKB_DOWN) { for(; uiLastHistorySlot < MAX_SHELL_HISTORY_ITEMS - 1; uiLastHistorySlot++) { @@ -1698,31 +1729,30 @@ RCODE FlmShell::execute( void) continue; } - if( uiTermChar == WPK_ESCAPE) + if( uiTermChar == FKB_ESCAPE) { szBuffer[ 0] = '\0'; continue; } - if( uiTermChar == WPK_F1) + if( uiTermChar == FKB_F1) { FLMUINT uiLen; - F_FileIStream fileIStream; addCmdHistory( szBuffer); - if( RC_BAD( rc = fileIStream.open( szBuffer))) + if( RC_BAD( rc = FlmOpenFileIStream( szBuffer, &pFileIStream))) { goto BatchError; } - + for( ;;) { FTXWinPrintf( m_pWindow, "\n"); uiLen = MAX_CMD_LINE_LEN; if( RC_BAD( rc = flmReadLine( - &fileIStream, (FLMBYTE *)szBuffer, &uiLen))) + pFileIStream, (FLMBYTE *)szBuffer, &uiLen))) { if( rc == NE_XFLM_EOF_HIT) { @@ -1773,6 +1803,11 @@ BatchError: Exit: + if( pFileIStream) + { + pFileIStream->Release(); + } + if( m_pWindow) { FTXWinFree( &m_pWindow); @@ -1929,7 +1964,7 @@ FLMINT FlmDbOpenCommand::execute( if( RC_BAD( rc = dbSystem.dbOpen( ppszArgV[ 1], NULL, pszRflDir, pszPassword, bAllowLimited, &pDb))) { - if( rc != NE_XFLM_IO_PATH_NOT_FOUND) + if( rc != NE_FLM_IO_PATH_NOT_FOUND) { goto Exit; } @@ -2300,7 +2335,7 @@ public: { } - RCODE XFLMAPI dbCopyStatus( + RCODE FLMAPI dbCopyStatus( FLMUINT64 ui64BytesToCopy, FLMUINT64 ui64BytesCopied, FLMBOOL bNewSrcFile, @@ -2328,12 +2363,12 @@ public: f_sleep( 0); #endif - if (FTXWinTestKB( m_pWin) == FTXRC_SUCCESS) + if( RC_OK( FTXWinTestKB( m_pWin))) { FLMUINT uiChar; FTXWinInputChar( m_pWin, &uiChar); - if (uiChar == WPK_ESC) + if (uiChar == FKB_ESC) { rc = RC_SET( NE_XFLM_USER_ABORT); goto Exit; @@ -2367,7 +2402,7 @@ public: { } - FINLINE RCODE XFLMAPI dbRenameStatus( + FINLINE RCODE FLMAPI dbRenameStatus( const char * pszSrcFileName, const char * pszDstFileName) { @@ -2656,12 +2691,12 @@ RCODE F_LocalBackupStatus::backupStatus( f_sleep( 0); #endif - if( pWin && FTXWinTestKB( pWin) == FTXRC_SUCCESS) + if( pWin && RC_OK( FTXWinTestKB( pWin))) { FLMUINT uiChar; FTXWinInputChar( pWin, &uiChar); - if (uiChar == WPK_ESC) + if (uiChar == FKB_ESC) { rc = RC_SET( NE_XFLM_USER_ABORT); goto Exit; @@ -2712,7 +2747,7 @@ RCODE flmBackupProgFunc( FLMUINT uiChar; FTXWinInputChar( pWin, &uiChar); - if (uiChar == WPK_ESC) + if (uiChar == FKB_ESC) { rc = RC_SET( NE_XFLM_USER_ABORT); goto Exit; @@ -2881,12 +2916,12 @@ RCODE F_LocalRestoreStatus::report_postamble( f_yieldCPU(); - if( pWin && FTXWinTestKB( pWin) == FTXRC_SUCCESS) + if( pWin && RC_OK( FTXWinTestKB( pWin))) { FLMUINT uiChar; FTXWinInputChar( pWin, &uiChar); - if (uiChar == WPK_ESC) + if (uiChar == FKB_ESC) { rc = RC_SET( NE_XFLM_USER_ABORT); goto Exit; @@ -2946,7 +2981,8 @@ RCODE F_LocalRestoreStatus::reportError( FTXWinClearToEOL( pWin); FTXWinPrintf( pWin, "Error: 0x%04X. Retry (Y/N): ", (unsigned)rcErr); - if( FTXWinInputChar( pWin, &uiChar) != FTXRC_SUCCESS) + + if( RC_BAD( FTXWinInputChar( pWin, &uiChar))) { uiChar = 0; goto Exit; @@ -3542,198 +3578,20 @@ FLMINT FlmSysInfoCommand::execute( RCODE rc = NE_XFLM_OK; FTX_WINDOW * pWin = pShell->getWindow(); FLMUINT uiLoop; -#ifdef FLM_WIN - DWORD dwSectorsPerCluster; - DWORD dwBytesPerSector; - DWORD dwNumberOfFreeClusters; - DWORD dwTotalNumberOfClusters; - FLMUINT uiLogicalDrives; - SYSTEM_INFO sysInfo; - MEMORYSTATUS memStatus; - char szBuf[ 128]; -#endif IF_ThreadInfo * pThreadInfo = NULL; F_DbSystem dbSystem; if( iArgC < 2) { -#ifdef FLM_WIN - - GlobalMemoryStatus( &memStatus); - - pShell->con_printf( "Size of MEMORYSTATUS..... %,u\n", - (unsigned)memStatus.dwLength); - pShell->con_printf( "Memory load.............. %,u\n", - (unsigned)memStatus.dwMemoryLoad); - pShell->con_printf( "Total Physical Memory.... %,u\n", - (unsigned)memStatus.dwTotalPhys); - pShell->con_printf( "Avail Physical Memory.... %,u\n", - (unsigned)memStatus.dwAvailPhys); - pShell->con_printf( "Total Page File.......... %,u\n", - (unsigned)memStatus.dwTotalPageFile); - pShell->con_printf( "Avail Page File.......... %,u\n", - (unsigned)memStatus.dwAvailPageFile); - pShell->con_printf( "Total Virtual............ %,u\n", - (unsigned)memStatus.dwTotalVirtual); - pShell->con_printf( "Avail Virtual............ %,u\n", - (unsigned)memStatus.dwAvailVirtual); - - GetSystemInfo( &sysInfo); - pShell->con_printf( "Processors .............. %,u\n", - sysInfo.dwNumberOfProcessors); - pShell->con_printf( "Processor type .......... %,u\n", - (unsigned)sysInfo.dwProcessorType); - pShell->con_printf( "Processor level ......... %,u\n", - (unsigned)sysInfo.wProcessorLevel); - pShell->con_printf( "Processor revision ...... %,u\n", - (unsigned)sysInfo.wProcessorRevision); - pShell->con_printf( "Page size ............... %,u (granularity for protection and commitment)\n", - sysInfo.dwPageSize); - pShell->con_printf( "Allocation granularity .. %,u (size of addr space reserved by VirtualAlloc)\n\n", - sysInfo.dwAllocationGranularity); - - uiLogicalDrives = (FLMUINT)GetLogicalDrives(); - - for( uiLoop = 0; uiLoop < 32; uiLoop++) - { - if( uiLogicalDrives & (0x00000001 << uiLoop)) - { - f_sprintf( (char *)szBuf, "%c:\\", (char)('A' + uiLoop)); - - if( GetDriveType( (char *)szBuf) == DRIVE_FIXED && - GetDiskFreeSpace( (char *)szBuf, &dwSectorsPerCluster, &dwBytesPerSector, - &dwNumberOfFreeClusters, &dwTotalNumberOfClusters)) - { - pShell->con_printf( "Drive Sectors/Cluster Bytes/Sector Free Clusters Total Clusters\n"); - pShell->con_printf( "----- --------------- ------------ ------------- --------------\n"); - pShell->con_printf( "%c %,-12u %,-12u %,-12u %,-12u\n", - szBuf[ 0], - (unsigned)dwSectorsPerCluster, - (unsigned)dwBytesPerSector, - (unsigned)dwNumberOfFreeClusters, - (unsigned)dwTotalNumberOfClusters); - } - } - } -#elif defined( FLM_UNIX) - { - - #if defined( FLM_LINUX) - FLMUINT64 ui64TotalMem; - FLMUINT64 ui64AvailMem; - - flmGetLinuxMemInfo( &ui64TotalMem, &ui64AvailMem); - - pShell->con_printf( "Total Memory ............. %,I64u\n", - ui64TotalMem); - pShell->con_printf( "Available Memory ......... %,I64u\n", - ui64AvailMem); - #endif - - - #if defined( _SC_AVPHYS_PAGES) - { - FLMUINT uiPageSize = (FLMUINT)sysconf(_SC_PAGESIZE); - FLMUINT uiAvailPhysPages = (FLMUINT)sysconf(_SC_AVPHYS_PAGES); - FLMUINT uiTotalPhysPages = (FLMUINT)sysconf(_SC_PHYS_PAGES); - - pShell->con_printf( "Page Size ................ %,u (0x%08X)\n", - (unsigned)uiPageSize, (unsigned)uiPageSize); - pShell->con_printf( "Available Pages .......... %,u (0x%08X)\n", - (unsigned)uiAvailPhysPages, (unsigned)uiAvailPhysPages); - pShell->con_printf( "Total Pages .............. %,u (0x%08X)\n", - (unsigned)uiTotalPhysPages, (unsigned)uiTotalPhysPages); - - pShell->con_printf( "Total Memory (may wrap) .. %,u (0x%08X)\n", - (unsigned)(uiTotalPhysPages * uiPageSize), - (unsigned)(uiTotalPhysPages * uiPageSize)); - pShell->con_printf( "Avail Memory (may wrap) .. %,u (0x%08X)\n", - (unsigned)(uiAvailPhysPages * uiPageSize), - (unsigned)(uiAvailPhysPages * uiPageSize)); - - } - #endif - - #if defined( RUSAGE_SELF) - { - struct rusage resourceUsage; - if( getrusage( RUSAGE_SELF, &resourceUsage) == 0) - { - pShell->con_printf( "Mem. used by process...... %,u (0x%08X)\n", - (unsigned)resourceUsage.ru_idrss, - (unsigned)resourceUsage.ru_idrss); - } - } - #endif - - #if defined( RLIMIT_DATA) - { - struct rlimit rlim; - if( getrlimit( RLIMIT_DATA, &rlim) == 0) - { - pShell->con_printf( "RLIMIT_DATA (cur)......... %,u (0x%08X)\n", - (unsigned)rlim.rlim_cur, (unsigned)rlim.rlim_cur); - pShell->con_printf( "RLIMIT_DATA (max)......... %,u (0x%08X)\n", - (unsigned)rlim.rlim_max, (unsigned)rlim.rlim_max); - } - } - #endif - - #if defined( RLIMIT_FSIZE) - { - struct rlimit rlim; - if( getrlimit( RLIMIT_FSIZE, &rlim) == 0) - { - pShell->con_printf( "RLIMIT_FSIZE (cur)........ %,u (0x%08X)\n", - (unsigned)rlim.rlim_cur, (unsigned)rlim.rlim_cur); - pShell->con_printf( "RLIMIT_FSIZE (max)........ %,u (0x%08X)\n", - (unsigned)rlim.rlim_max, (unsigned)rlim.rlim_max); - } - } - #endif - - #if defined( RLIMIT_STACK) - { - struct rlimit rlim; - if( getrlimit( RLIMIT_STACK, &rlim) == 0) - { - pShell->con_printf( "RLIMIT_STACK (cur)........ %,u (0x%08X)\n", - (unsigned)rlim.rlim_cur, (unsigned)rlim.rlim_cur); - pShell->con_printf( "RLIMIT_STACK (max)........ %,u (0x%08X)\n", - (unsigned)rlim.rlim_max, (unsigned)rlim.rlim_max); - } - } - #endif - - #if defined( RLIMIT_VMEM) - { - struct rlimit rlim; - if( getrlimit( RLIMIT_VMEM, &rlim) == 0) - { - pShell->con_printf( "RLIMIT_VMEM (cur)......... %,u (0x%08X)\n", - (unsigned)rlim.rlim_cur, (unsigned)rlim.rlim_cur); - pShell->con_printf( "RLIMIT_VMEM (max)......... %,u (0x%08X)\n", - (unsigned)rlim.rlim_max, (unsigned)rlim.rlim_max); - } - } - #endif - - #if defined( RLIMIT_AS) - { - struct rlimit rlim; - if( getrlimit( RLIMIT_AS, &rlim) == 0) - { - pShell->con_printf( "RLIMIT_AS (cur)........... %,u (0x%08X)\n", - (unsigned)rlim.rlim_cur, (unsigned)rlim.rlim_cur); - pShell->con_printf( "RLIMIT_AS (max)........... %,u (0x%08X)\n", - (unsigned)rlim.rlim_max, (unsigned)rlim.rlim_max); - } - } - #endif - } -#else - pShell->con_printf( "No information available.\n"); -#endif + FLMUINT64 ui64TotalMem; + FLMUINT64 ui64AvailMem; + + f_getMemoryInfo( &ui64TotalMem, &ui64AvailMem); + + pShell->con_printf( "Total Memory ............. %,I64u\n", + ui64TotalMem); + pShell->con_printf( "Available Memory ......... %,I64u\n", + ui64AvailMem); } else { @@ -3783,14 +3641,14 @@ FLMINT FlmSysInfoCommand::execute( f_yieldCPU(); } - FLM_TIMER_UNITS_TO_MILLI( FLM_GET_TIMER() - uiStartTime, uiMilli); + uiMilli = FLM_TIMER_UNITS_TO_MILLI( FLM_GET_TIMER() - uiStartTime); pShell->con_printf( "Allocations: %u ms, %,u count, %,u bytes\n", (unsigned)uiMilli, (unsigned)uiLoop, (unsigned)(uiCount * uiBlockSize)); if( iArgC > 4 && !f_stricmp( ppszArgV[ 4], "pause")) { - FTXDisplayMessage( pShell->getScreen(), WPS_BLUE, WPS_WHITE, + FTXDisplayMessage( pShell->getScreen(), FLM_BLUE, FLM_WHITE, "Press to continue ...", NULL, NULL); } @@ -3803,7 +3661,7 @@ FLMINT FlmSysInfoCommand::execute( f_free( &pvAlloc); f_yieldCPU(); } - FLM_TIMER_UNITS_TO_MILLI( FLM_GET_TIMER() - uiStartTime, uiMilli); + uiMilli = FLM_TIMER_UNITS_TO_MILLI( FLM_GET_TIMER() - uiStartTime); pShell->con_printf( "Frees: %u ms, %u count, %u bytes\n", (unsigned)uiMilli, (unsigned)uiLoop, (unsigned)(uiLoop * uiBlockSize)); @@ -3853,7 +3711,7 @@ FLMINT FlmSysInfoCommand::execute( for( ;;) { - if( FTXWinTestKB( pWin) == FTXRC_SUCCESS) + if( RC_OK( FTXWinTestKB( pWin))) { break; } @@ -3960,24 +3818,23 @@ FLMBOOL FlmSysInfoCommand::canPerformCommand( Desc: *****************************************************************************/ FLMINT fshellFileSystemTest( - FLMINT iArgC, - char ** ppszArgV, - FlmShell * pShell) + FLMINT iArgC, + char ** ppszArgV, + FlmShell * pShell) { - FLMINT iExitCode = 0; - RCODE rc = NE_XFLM_OK; - F_FileHdl * pFileHdl = NULL; - FLMUINT uiBlockSize = 4096; - FLMUINT uiFileSize = (1024 * 1024 * 100); // 100 MB - FLMUINT uiOffset = 0; - FLMUINT uiBytesWritten; - FLMUINT uiBytesRead; - FLMUINT uiStartTime; - FLMUINT uiMilli; - FLMUINT uiTotal; - FLMUINT uiCount; - FLMBYTE * pucBuf = NULL; - F_RandomGenerator randGen; + FLMINT iExitCode = 0; + RCODE rc = NE_XFLM_OK; + IF_FileHdl * pFileHdl = NULL; + FLMUINT uiBlockSize = 4096; + FLMUINT uiFileSize = (1024 * 1024 * 100); // 100 MB + FLMUINT uiOffset = 0; + FLMUINT uiBytesWritten; + FLMUINT uiBytesRead; + FLMUINT uiStartTime; + FLMUINT uiMilli; + FLMUINT uiTotal; + FLMUINT uiCount; + FLMBYTE * pucBuf = NULL; if( iArgC < 2) { @@ -3992,42 +3849,35 @@ FLMINT fshellFileSystemTest( } f_memset( pucBuf, 0xFF, uiBlockSize); - randGen.randomize(); - - if ((pFileHdl = f_new F_FileHdl) == NULL) + + if( RC_OK( f_getFileSysPtr()->doesFileExist( ppszArgV[ 1]))) { - rc = RC_SET( NE_XFLM_MEM); - goto Exit; - } -#ifdef FLM_WIN - pFileHdl->SetBlockSize( uiBlockSize); -#endif - - if( RC_OK( gv_pFileSystem->Exists( ppszArgV[ 1]))) - { - if( RC_BAD( rc = pFileHdl->Open( ppszArgV[ 1], - XFLM_IO_RDWR | XFLM_IO_SH_DENYNONE | XFLM_IO_DIRECT))) + if( RC_BAD( rc = f_getFileSysPtr()->openFile( ppszArgV[ 1], + FLM_IO_RDWR | FLM_IO_SH_DENYNONE | FLM_IO_DIRECT, &pFileHdl))) { goto Exit; } - - // VISIT: get file size -- make sure it is a multiple of uiBlockSize + + pFileHdl->setBlockSize( uiBlockSize); } else { pShell->con_printf( "Creating %s\n", ppszArgV[ 1]); uiStartTime = FLM_GET_TIMER(); - if( RC_BAD( rc = pFileHdl->Create( ppszArgV[ 1], - XFLM_IO_RDWR | XFLM_IO_EXCL | XFLM_IO_SH_DENYNONE | XFLM_IO_DIRECT))) + if( RC_BAD( rc = f_getFileSysPtr()->createFile( ppszArgV[ 1], + FLM_IO_RDWR | FLM_IO_EXCL | FLM_IO_SH_DENYNONE | FLM_IO_DIRECT, + &pFileHdl))) { goto Exit; } + + pFileHdl->setBlockSize( uiBlockSize); uiOffset = 0; while( uiOffset < uiFileSize) { - if( RC_BAD( rc = pFileHdl->Write( uiOffset, uiBlockSize, + if( RC_BAD( rc = pFileHdl->write( uiOffset, uiBlockSize, pucBuf, &uiBytesWritten))) { goto Exit; @@ -4035,7 +3885,7 @@ FLMINT fshellFileSystemTest( uiOffset += uiBytesWritten; - FLM_TIMER_UNITS_TO_MILLI( FLM_GET_TIMER() - uiStartTime, uiMilli); + uiMilli = FLM_TIMER_UNITS_TO_MILLI( FLM_GET_TIMER() - uiStartTime); pShell->con_printf( "%u / %u (%u bytes/sec) \r", (unsigned)uiOffset, (unsigned)uiFileSize, (unsigned)uiMilli > 1000 ? (uiOffset / (uiMilli / 1000)) : 0); @@ -4056,9 +3906,9 @@ FLMINT fshellFileSystemTest( uiStartTime = FLM_GET_TIMER(); while( uiCount) { - uiOffset = (FLMUINT)((randGen.randomChoice( 1, + uiOffset = (FLMUINT)((f_getRandomUINT32( 1, (FLMUINT32)uiCount) - 1) * uiBlockSize); - if( RC_BAD( rc = pFileHdl->Write( uiOffset, uiBlockSize, + if( RC_BAD( rc = pFileHdl->write( uiOffset, uiBlockSize, pucBuf, &uiBytesWritten))) { goto Exit; @@ -4067,7 +3917,7 @@ FLMINT fshellFileSystemTest( uiCount--; uiTotal += uiBytesWritten; - FLM_TIMER_UNITS_TO_MILLI( FLM_GET_TIMER() - uiStartTime, uiMilli); + uiMilli = FLM_TIMER_UNITS_TO_MILLI( FLM_GET_TIMER() - uiStartTime); pShell->con_printf( "%u / %u (%u bytes/sec) \r", (unsigned)uiTotal, (unsigned)uiFileSize, (unsigned)uiMilli > 1000 ? (uiTotal / (uiMilli / 1000)) : 0); @@ -4080,14 +3930,14 @@ FLMINT fshellFileSystemTest( uiStartTime = FLM_GET_TIMER(); while( uiOffset < uiFileSize) { - if( RC_BAD( rc = pFileHdl->Read( uiOffset, uiBlockSize, + if( RC_BAD( rc = pFileHdl->read( uiOffset, uiBlockSize, pucBuf, &uiBytesRead))) { goto Exit; } uiOffset += uiBytesRead; - FLM_TIMER_UNITS_TO_MILLI( FLM_GET_TIMER() - uiStartTime, uiMilli); + uiMilli = FLM_TIMER_UNITS_TO_MILLI( FLM_GET_TIMER() - uiStartTime); pShell->con_printf( "%u / %u (%u bytes/sec) \r", (unsigned)uiOffset, (unsigned)uiFileSize, (unsigned)uiMilli > 1000 ? (uiOffset / (uiMilli / 1000)) : 0); @@ -4106,9 +3956,9 @@ FLMINT fshellFileSystemTest( uiStartTime = FLM_GET_TIMER(); while( uiCount) { - uiOffset = (FLMUINT)((randGen.randomChoice( 1, (FLMUINT32)uiCount) + uiOffset = (FLMUINT)((f_getRandomUINT32( 1, (FLMUINT32)uiCount) - 1) * uiBlockSize); - if( RC_BAD( rc = pFileHdl->Read( uiOffset, uiBlockSize, + if( RC_BAD( rc = pFileHdl->read( uiOffset, uiBlockSize, pucBuf, &uiBytesRead))) { goto Exit; @@ -4117,7 +3967,7 @@ FLMINT fshellFileSystemTest( uiCount--; uiTotal += uiBytesRead; - FLM_TIMER_UNITS_TO_MILLI( FLM_GET_TIMER() - uiStartTime, uiMilli); + uiMilli = FLM_TIMER_UNITS_TO_MILLI( FLM_GET_TIMER() - uiStartTime); pShell->con_printf( "%u / %u (%u bytes/sec) \r", (unsigned)uiTotal, (unsigned)uiFileSize, (unsigned)uiMilli > 1000 ? (uiTotal / (uiMilli / 1000)) : 0); @@ -4125,7 +3975,7 @@ FLMINT fshellFileSystemTest( pShell->con_printf( "\nFinished random scan.\n"); - if( RC_BAD( rc = pFileHdl->Close())) + if( RC_BAD( rc = pFileHdl->close())) { goto Exit; } @@ -4349,6 +4199,7 @@ FLMINT FlmFileSysCommand::execute( RCODE rc = NE_XFLM_OK; FLMUINT uiLoop = 0; FLMBOOL bForce = FALSE; + IF_DirHdl * pDir = NULL; // Delete the file @@ -4387,11 +4238,11 @@ FLMINT FlmFileSysCommand::execute( if( bForce) { - gv_pFileSystem->SetReadOnly( + f_getFileSysPtr()->setReadOnly( ppszArgV[uiLoop], FALSE); } - if( RC_BAD( rc = gv_pFileSystem->Delete( ppszArgV[ uiLoop]))) + if( RC_BAD( rc = f_getFileSysPtr()->deleteFile( ppszArgV[ uiLoop]))) { goto Exit; } @@ -4467,23 +4318,23 @@ FLMINT FlmFileSysCommand::execute( goto Exit; } - if ( RC_BAD( rc = gv_pFileSystem->Exists( ppszArgV[uiLoop]))) + if ( RC_BAD( rc = f_getFileSysPtr()->doesFileExist( ppszArgV[uiLoop]))) { goto Exit; } - if ( gv_pFileSystem->IsDir( ppszArgV[uiLoop + 1])) + if ( f_getFileSysPtr()->isDir( ppszArgV[uiLoop + 1])) { char szFilename[ F_FILENAME_SIZE]; // If the second param is a directory we'll assume the user wants to // move the file into it with the same filename. - gv_pFileSystem->pathReduce( ppszArgV[uiLoop], NULL, szFilename); - gv_pFileSystem->pathAppend( szFilename, ppszArgV[uiLoop + 1]); + f_getFileSysPtr()->pathReduce( ppszArgV[uiLoop], NULL, szFilename); + f_getFileSysPtr()->pathAppend( szFilename, ppszArgV[uiLoop + 1]); } - if( RC_OK( gv_pFileSystem->Exists( ppszArgV[uiLoop + 1]))) + if( RC_OK( f_getFileSysPtr()->doesFileExist( ppszArgV[uiLoop + 1]))) { if ( !bOverwrite) { @@ -4492,7 +4343,7 @@ FLMINT FlmFileSysCommand::execute( pShell->con_printf( "%s exists. Overwrite? (Y/N)", ppszArgV[ uiLoop + 1]); for(;;) { - if (FTXWinTestKB( pShell->getWindow()) == FTXRC_SUCCESS) + if( RC_OK( FTXWinTestKB( pShell->getWindow()))) { FTXWinInputChar( pShell->getWindow(), &uiChar); @@ -4516,12 +4367,13 @@ FLMINT FlmFileSysCommand::execute( { if ( bForce) { - gv_pFileSystem->SetReadOnly( ppszArgV[uiLoop + 1], FALSE); + f_getFileSysPtr()->setReadOnly( ppszArgV[uiLoop + 1], FALSE); pShell->con_printf( "Error changing file attributes. "); goto Exit; } - if ( RC_BAD( rc = gv_pFileSystem->Delete( ppszArgV[uiLoop + 1]))) + if ( RC_BAD( rc = f_getFileSysPtr()->deleteFile( + ppszArgV[uiLoop + 1]))) { pShell->con_printf( "Error removing destination file. "); goto Exit; @@ -4529,7 +4381,7 @@ FLMINT FlmFileSysCommand::execute( } } - if ( RC_BAD( rc = gv_pFileSystem->Rename( ppszArgV[uiLoop], + if ( RC_BAD( rc = f_getFileSysPtr()->renameFile( ppszArgV[uiLoop], ppszArgV[uiLoop + 1]))) { goto Exit; @@ -4581,23 +4433,23 @@ FLMINT FlmFileSysCommand::execute( goto Exit; } - if ( RC_BAD( rc = gv_pFileSystem->Exists( ppszArgV[uiLoop]))) + if ( RC_BAD( rc = f_getFileSysPtr()->doesFileExist( ppszArgV[uiLoop]))) { goto Exit; } - if ( gv_pFileSystem->IsDir( ppszArgV[uiLoop + 1])) + if ( f_getFileSysPtr()->isDir( ppszArgV[uiLoop + 1])) { char szFilename[ F_FILENAME_SIZE]; // If the second param is a directory we'll assume the user wants to // copy the file into it with the same filename. - gv_pFileSystem->pathReduce( ppszArgV[uiLoop], NULL, szFilename); - gv_pFileSystem->pathAppend( szFilename, ppszArgV[uiLoop + 1]); + f_getFileSysPtr()->pathReduce( ppszArgV[uiLoop], NULL, szFilename); + f_getFileSysPtr()->pathAppend( szFilename, ppszArgV[uiLoop + 1]); } - if ( RC_OK( gv_pFileSystem->Exists( ppszArgV[uiLoop + 1]))) + if ( RC_OK( f_getFileSysPtr()->doesFileExist( ppszArgV[uiLoop + 1]))) { if ( !bOverwrite) { @@ -4606,7 +4458,7 @@ FLMINT FlmFileSysCommand::execute( pShell->con_printf( "%s exists. Overwrite? (Y/N)", ppszArgV[ uiLoop + 1]); for(;;) { - if (FTXWinTestKB( pShell->getWindow()) == FTXRC_SUCCESS) + if( RC_OK( FTXWinTestKB( pShell->getWindow()))) { FTXWinInputChar( pShell->getWindow(), &uiChar); @@ -4635,17 +4487,14 @@ FLMINT FlmFileSysCommand::execute( if ( bForce) { - gv_pFileSystem->SetReadOnly( + f_getFileSysPtr()->setReadOnly( ppszArgV[uiLoop + 1], FALSE); } } } - if ( RC_BAD( rc = gv_pFileSystem->Copy( - ppszArgV[uiLoop], // Name of source file to be copied. - ppszArgV[uiLoop +1], // Name of destination file. - bOverwrite, // Overwrite destination file? - &ui64BytesCopied))) // Returns number of bytes copied. + if ( RC_BAD( rc = f_getFileSysPtr()->copyFile( + ppszArgV[uiLoop], ppszArgV[uiLoop +1], bOverwrite, &ui64BytesCopied))) { goto Exit; } @@ -4656,7 +4505,6 @@ FLMINT FlmFileSysCommand::execute( else if (f_stricmp( "ls", ppszArgV [0]) == 0 || f_stricmp( "dir", ppszArgV [0]) == 0) { - F_DirHdl dir; char szDir [F_PATH_MAX_SIZE]; char szBaseName [F_FILENAME_SIZE]; FLMUINT uiLineCount; @@ -4670,7 +4518,8 @@ FLMINT FlmFileSysCommand::execute( if( iArgC > 1) { - if (RC_BAD( rc = gv_pFileSystem->pathReduce( ppszArgV [1], szDir, szBaseName))) + if (RC_BAD( rc = f_getFileSysPtr()->pathReduce( + ppszArgV [1], szDir, szBaseName))) { goto Exit; } @@ -4678,14 +4527,16 @@ FLMINT FlmFileSysCommand::execute( { f_strcpy( szDir, "."); } - if (RC_BAD( rc = dir.OpenDir( szDir, (char *)szBaseName))) + + if (RC_BAD( rc = f_getFileSysPtr()->openDir( szDir, + (char *)szBaseName, &pDir))) { goto Exit; } } else { - if (RC_BAD( rc = dir.OpenDir( ".", NULL))) + if (RC_BAD( rc = f_getFileSysPtr()->openDir( ".", NULL, &pDir))) { goto Exit; } @@ -4694,9 +4545,9 @@ FLMINT FlmFileSysCommand::execute( uiLineCount = 1; for (;;) { - if (RC_BAD( rc = dir.Next())) + if (RC_BAD( rc = pDir->next())) { - if (rc == NE_XFLM_IO_NO_MORE_FILES) + if (rc == NE_FLM_IO_NO_MORE_FILES) { rc = NE_XFLM_OK; break; @@ -4713,19 +4564,19 @@ FLMINT FlmFileSysCommand::execute( uiChar = 0; for (;;) { - if (FTXWinTestKB( pWindow) == FTXRC_SUCCESS) + if( RC_OK( FTXWinTestKB( pWindow))) { FTXWinInputChar( pWindow, &uiChar); break; } if (pShell->getShutdownFlag()) { - uiChar = WPK_ESC; + uiChar = FKB_ESC; break; } f_yieldCPU(); } - if (uiChar == WPK_ESC) + if (uiChar == FKB_ESC) { break; } @@ -4733,18 +4584,17 @@ FLMINT FlmFileSysCommand::execute( "\r \r"); uiLineCount = 0; } - if (dir.CurrentItemIsDir()) + if (pDir->currentItemIsDir()) { - pShell->con_printf( "%-20s %25s\n", dir.CurrentItemName(), + pShell->con_printf( "%-20s %25s\n", pDir->currentItemName(), ""); } else { char szTmpBuf [60]; - format64BitNum( (FLMUINT64)dir.CurrentItemSize(), - szTmpBuf, FALSE, TRUE); - pShell->con_printf( "%-20s %25s\n", dir.CurrentItemName(), + format64BitNum( pDir->currentItemSize(), szTmpBuf, FALSE, TRUE); + pShell->con_printf( "%-20s %25s\n", pDir->currentItemName(), szTmpBuf); } uiLineCount++; @@ -4758,6 +4608,11 @@ FLMINT FlmFileSysCommand::execute( Exit: + if( pDir) + { + pDir->Release(); + } + if( RC_BAD( rc)) { pShell->con_printf( "\nError: %e\n", rc); @@ -4861,16 +4716,16 @@ FLMINT FlmHexConvertCommand::execute( // Open the source file - if( RC_BAD( rc = gv_pFileSystem->Open( ppszArgV[ 1], - XFLM_IO_RDONLY | XFLM_IO_SH_DENYNONE, &pSrcFile))) + if( RC_BAD( rc = f_getFileSysPtr()->openFile( ppszArgV[ 1], + FLM_IO_RDONLY | FLM_IO_SH_DENYNONE, &pSrcFile))) { goto Exit; } // Create the destination file - if( RC_BAD( rc = gv_pFileSystem->Create( ppszArgV[ 2], - XFLM_IO_RDWR | XFLM_IO_SH_DENYNONE, &pDestFile))) + if( RC_BAD( rc = f_getFileSysPtr()->createFile( ppszArgV[ 2], + FLM_IO_RDWR | FLM_IO_SH_DENYNONE, &pDestFile))) { goto Exit; } @@ -4881,9 +4736,10 @@ FLMINT FlmHexConvertCommand::execute( for( ;;) { - if( RC_BAD( rc = pSrcFile->Read( uiSrcOffset, 1, ucTmpBuf, &uiBytesRead))) + if( RC_BAD( rc = pSrcFile->read( uiSrcOffset, 1, + ucTmpBuf, &uiBytesRead))) { - if( rc == NE_XFLM_IO_END_OF_FILE) + if( rc == NE_FLM_IO_END_OF_FILE) { rc = NE_XFLM_OK; break; @@ -4900,7 +4756,7 @@ FLMINT FlmHexConvertCommand::execute( uiLineOffset = 0; f_sprintf( szOutputBuf,",\n"); - if( RC_BAD( rc = pDestFile->Write( uiDestOffset, + if( RC_BAD( rc = pDestFile->write( uiDestOffset, f_strlen( szOutputBuf), (FLMBYTE *)szOutputBuf, &uiBytesWritten))) { goto Exit; @@ -4917,7 +4773,7 @@ FLMINT FlmHexConvertCommand::execute( f_sprintf( szOutputBuf, "%s0x%02X", szPreamble, (unsigned)ucTmpBuf[ 0]); - if( RC_BAD( rc = pDestFile->Write( uiDestOffset, + if( RC_BAD( rc = pDestFile->write( uiDestOffset, f_strlen( szOutputBuf), (FLMBYTE *)szOutputBuf, &uiBytesWritten))) { goto Exit; @@ -4998,8 +4854,8 @@ FLMINT FlmBase64ConvertCommand::execute( FLMUINT uiDestOffset = 0; FLMUINT uiBytesWritten; IF_FileHdl * pDestFile = NULL; - F_FileIStream * pSrcIStream = NULL; - F_IStream * pBase64Stream = NULL; + IF_PosIStream * pSrcIStream = NULL; + IF_IStream * pBase64Stream = NULL; if( iArgC < 2 || iArgC > 4) { @@ -5009,14 +4865,8 @@ FLMINT FlmBase64ConvertCommand::execute( } // Open the source file - - if( (pSrcIStream = f_new F_FileIStream) == NULL) - { - rc = RC_SET( NE_XFLM_MEM); - goto Exit; - } - - if( RC_BAD( rc = pSrcIStream->open( ppszArgV[ 1]))) + + if( RC_BAD( rc = FlmOpenFileIStream( ppszArgV[ 1], &pSrcIStream))) { goto Exit; } @@ -5029,29 +4879,17 @@ FLMINT FlmBase64ConvertCommand::execute( iExitCode = -1; goto Exit; } - - if( (pBase64Stream = f_new F_Base64DecoderIStream) == NULL) - { - rc = RC_SET( NE_XFLM_MEM); - goto Exit; - } - - if( RC_BAD( rc = ((F_Base64DecoderIStream *)pBase64Stream)->open( - pSrcIStream))) + + if( RC_BAD( rc = FlmOpenBase64DecoderIStream( + pSrcIStream, &pBase64Stream))) { goto Exit; } } else { - if( (pBase64Stream = f_new F_Base64EncoderIStream) == NULL) - { - rc = RC_SET( NE_XFLM_MEM); - goto Exit; - } - - if( RC_BAD( rc = ((F_Base64EncoderIStream *)pBase64Stream)->open( - pSrcIStream, TRUE))) + if( RC_BAD( rc = FlmOpenBase64EncoderIStream( + pSrcIStream, TRUE, &pBase64Stream))) { goto Exit; } @@ -5061,8 +4899,8 @@ FLMINT FlmBase64ConvertCommand::execute( if( iArgC >= 3) { - if( RC_BAD( rc = gv_pFileSystem->Create( ppszArgV[ 2], - XFLM_IO_RDWR | XFLM_IO_SH_DENYNONE, &pDestFile))) + if( RC_BAD( rc = f_getFileSysPtr()->createFile( ppszArgV[ 2], + FLM_IO_RDWR | FLM_IO_SH_DENYNONE, &pDestFile))) { goto Exit; } @@ -5090,7 +4928,7 @@ FLMINT FlmBase64ConvertCommand::execute( if( pDestFile) { - if( RC_BAD( rc = pDestFile->Write( uiDestOffset, + if( RC_BAD( rc = pDestFile->write( uiDestOffset, uiBytesRead, ucReadBuf, &uiBytesWritten))) { goto Exit; @@ -5196,7 +5034,7 @@ RCODE flmXmlImportStatus( Desc: *****************************************************************************/ RCODE getErrFromFile( - F_FileIStream * pFileIStream, + IF_PosIStream * pFileIStream, FLMUINT uiCurrLineFilePos, FLMUINT uiCurrLineBytes, FLMUINT * puiErrLineOffset, @@ -5230,7 +5068,8 @@ RCODE getErrFromFile( { goto Exit; } - if ( RC_BAD( rc = pFileIStream->read( pucSrcBuff, uiCurrLineBytes, &uiBytesRead))) + if ( RC_BAD( rc = pFileIStream->read( pucSrcBuff, + uiCurrLineBytes, &uiBytesRead))) { goto Exit; } @@ -5242,7 +5081,7 @@ RCODE getErrFromFile( { for( ;;) { - if( RC_BAD( rc = flmGetCharFromUTF8Buf( &pucSrcCur, + if( RC_BAD( rc = f_getCharFromUTF8Buf( &pucSrcCur, pucSrcBuff + uiBytesRead, &uzChar))) { @@ -5341,13 +5180,17 @@ RCODE importXmlFiles( FLMBOOL bTransActive = FALSE; IF_DOMNode * pRoot = NULL; IF_DOMNode * pSource = NULL; - F_Pool pool; - F_FileIStream fileIStream; + IF_Pool * pPool = NULL; + IF_PosIStream * pFileIStream = NULL; FLMBOOL bUseSafeMode = FALSE; char szErrorString[ MAX_IMPORT_ERROR_STRING + 1]; FLMUINT uiIndentCount = 0; FLMUINT uiNewErrLineOffset = 0; - pool.poolInit( 256); + + if( RC_BAD( rc = FlmAllocPool( &pPool, 256))) + { + goto Exit; + } RetryLoad: @@ -5359,11 +5202,11 @@ RetryLoad: } flmAssert( !bTransActive); - pool.poolReset( NULL); + pPool->poolReset( NULL); - if( gv_pFileSystem->IsDir( pszPath)) + if( f_getFileSysPtr()->isDir( pszPath)) { - if( RC_BAD( rc = gv_pFileSystem->OpenDir( + if( RC_BAD( rc = f_getFileSysPtr()->openDir( pszPath, (char *)"*", &pDirHdl))) { goto Exit; @@ -5376,13 +5219,13 @@ RetryLoad: for( ;;) { - pool.poolReset( NULL); - if( pWin && FTXWinTestKB( pWin) == FTXRC_SUCCESS) + pPool->poolReset( NULL); + if( pWin && RC_OK( FTXWinTestKB( pWin))) { FLMUINT uiChar; FTXWinInputChar( pWin, &uiChar); - if (uiChar == WPK_ESC) + if (uiChar == FKB_ESC) { rc = RC_SET( NE_XFLM_USER_ABORT); goto Exit; @@ -5391,9 +5234,9 @@ RetryLoad: if( pDirHdl) { - if( RC_BAD( rc = pDirHdl->Next())) + if( RC_BAD( rc = pDirHdl->next())) { - if (rc == NE_XFLM_IO_NO_MORE_FILES) + if (rc == NE_FLM_IO_NO_MORE_FILES) { rc = NE_XFLM_OK; break; @@ -5407,8 +5250,8 @@ RetryLoad: if( pDirHdl) { - pDirHdl->CurrentItemPath( szTmpPath); - if( pDirHdl->CurrentItemIsDir()) + pDirHdl->currentItemPath( szTmpPath); + if( pDirHdl->currentItemIsDir()) { if( bTransActive) { @@ -5436,8 +5279,8 @@ RetryLoad: } bTransActive = TRUE; } - - if( RC_BAD( rc = fileIStream.open( szTmpPath))) + + if( RC_BAD( rc = FlmOpenFileIStream( szTmpPath, &pFileIStream))) { goto Exit; } @@ -5456,8 +5299,7 @@ RetryLoad: } if( RC_BAD( rc = pDb->importDocument( - &fileIStream, uiCollection, - &pRoot, pImportStats))) + pFileIStream, uiCollection, &pRoot, pImportStats))) { if( rc != NE_XFLM_EOF_HIT) { @@ -5476,7 +5318,7 @@ RetryLoad: } uiNewErrLineOffset = pImportStats->uiErrLineOffset; - if( RC_OK( rc = getErrFromFile( &fileIStream, + if( RC_OK( rc = getErrFromFile( pFileIStream, pImportStats->uiErrLineFilePos, pImportStats->uiErrLineBytes, &uiNewErrLineOffset, @@ -5514,7 +5356,7 @@ RetryLoad: break; } - gv_pFileSystem->pathReduce( szTmpPath, szTmpPath2, szFile); + f_getFileSysPtr()->pathReduce( szTmpPath, szTmpPath2, szFile); if( RC_BAD( rc = pRoot->createAttribute( pDb, ATTR_SOURCE_TAG, &pSource))) { @@ -5588,7 +5430,6 @@ Exit: if( pDirHdl) { pDirHdl->Release(); - pDirHdl = NULL; } if( pSource) @@ -5605,8 +5446,12 @@ Exit: { pDb->transAbort(); } + + if( pPool) + { + pPool->Release(); + } - pool.poolFree(); return( rc); } @@ -5838,37 +5683,22 @@ FLMINT FlmDomEditCommand::execute( "DOMEdit for XFLAIM [DB=%s/BUILD=%s]", XFLM_CURRENT_VER_STR, __DATE__); - if( FTXScreenInit( gv_pFtxInfo, szTitle, &pScreen) != FTXRC_SUCCESS) + if( RC_BAD( FTXScreenInit( szTitle, &pScreen))) { iExitCode = -1; goto Exit; } - if( FTXWinInit( pScreen, 0, 1, &pTitleWin) != FTXRC_SUCCESS) + if( RC_BAD( FTXWinInit( pScreen, 0, 1, &pTitleWin))) { iExitCode = -1; goto Exit; } - if( FTXWinPaintBackground( pTitleWin, WPS_RED) != FTXRC_SUCCESS) - { - iExitCode = -1; - goto Exit; - } - - if( FTXWinPrintStr( pTitleWin, szTitle) != FTXRC_SUCCESS) - { - iExitCode = -1; - goto Exit; - } - - FTXWinSetCursorType( pTitleWin, WPS_CURSOR_INVISIBLE); - - if( FTXWinOpen( pTitleWin) != FTXRC_SUCCESS) - { - iExitCode = -1; - goto Exit; - } + FTXWinPaintBackground( pTitleWin, FLM_RED); + FTXWinPrintStr( pTitleWin, szTitle); + FTXWinSetCursorType( pTitleWin, FLM_CURSOR_INVISIBLE); + FTXWinOpen( pTitleWin); if ((pDomEditor = f_new F_DomEditor()) == NULL) { @@ -6274,13 +6104,13 @@ FSTATIC void domDisplayError( FTXWinGetScreen( pWindow, &pScreen); if (errRc == NE_XFLM_OK) { - FTXDisplayMessage( pScreen, WPS_RED, WPS_WHITE, + FTXDisplayMessage( pScreen, FLM_RED, FLM_WHITE, pszError, NULL, &uiTermChar); } else { f_sprintf( szErrBuf, "%s: %e", pszError, errRc); - FTXDisplayMessage( pScreen, WPS_RED, WPS_WHITE, + FTXDisplayMessage( pScreen, FLM_RED, FLM_WHITE, szErrBuf, NULL, &uiTermChar); } } @@ -6383,17 +6213,17 @@ FLMBOOL domDisplayNodeInfo( if (pszOutputFileName && *pszOutputFileName) { - if (RC_BAD( rc = gv_pFileSystem->Delete( pszOutputFileName))) + if (RC_BAD( rc = f_getFileSysPtr()->deleteFile( pszOutputFileName))) { - if (rc != NE_XFLM_IO_PATH_NOT_FOUND) + if (rc != NE_FLM_IO_PATH_NOT_FOUND) { domDisplayError( pWindow, "Error deleting output file", rc); goto Exit; } } - if (RC_BAD( rc = gv_pFileSystem->Create( pszOutputFileName, - XFLM_IO_RDWR | XFLM_IO_EXCL | XFLM_IO_SH_DENYNONE | - XFLM_IO_CREATE_DIR, &pFileHdl))) + if (RC_BAD( rc = f_getFileSysPtr()->createFile( pszOutputFileName, + FLM_IO_RDWR | FLM_IO_EXCL | FLM_IO_SH_DENYNONE | + FLM_IO_CREATE_DIR, &pFileHdl))) { domDisplayError( pWindow, "Error creating output file", rc); goto Exit; @@ -6446,10 +6276,10 @@ FLMBOOL domDisplayNodeInfo( FTXWinPrintf( pWindow, "\n"); for (;;) { - if (FTXWinTestKB( pWindow) == FTXRC_SUCCESS) + if( RC_OK( FTXWinTestKB( pWindow))) { FTXWinInputChar( pWindow, &uiChar); - if (uiChar == WPK_ESC) + if (uiChar == FKB_ESC) { FTXWinPrintf( pWindow, "\nESCAPE PRESSED, stopped reading documents\n"); break; @@ -6643,13 +6473,14 @@ Exit: { pNodeInfo->Release(); } + if (pNode) { pNode->Release(); } + if (pFileHdl) { - pFileHdl->Close(); pFileHdl->Release(); } return( bOk); @@ -6680,7 +6511,9 @@ Entry_Info::Entry_Info() m_pAttrList = NULL; m_uiAttrListSize = 0; m_uiNumAttrs = 0; - m_Pool.poolInit( 512); + + m_pPool = NULL; + FlmAllocPool( &m_pPool, 512); } /**************************************************************************** @@ -6692,7 +6525,11 @@ Entry_Info::~Entry_Info() { f_free( &m_pAttrList); } - m_Pool.poolFree(); + + if( m_pPool) + { + m_pPool->Release(); + } } /**************************************************************************** @@ -7042,7 +6879,8 @@ RCODE Entry_Info::getDirAttrInfo( goto Exit; } uiNameSize++; - if (RC_BAD( rc = m_Pool.poolAlloc( uiNameSize, (void **)&pAttrNodeInfo->pszAttrName))) + if (RC_BAD( rc = m_pPool->poolAlloc( uiNameSize, + (void **)&pAttrNodeInfo->pszAttrName))) { goto Exit; } @@ -7265,14 +7103,14 @@ FSTATIC void domDisplayLine( } if (pFileHdl) { - if (RC_BAD( rc = pFileHdl->Write( XFLM_IO_CURRENT_POS, + if (RC_BAD( rc = pFileHdl->write( FLM_IO_CURRENT_POS, f_strlen( pszLine), pszLine, &uiBytesWritten))) { domDisplayError( pWindow, "Error writing to output file", rc); *puiLineCount = FLM_MAX_UINT; return; } - if (RC_BAD( rc = pFileHdl->Write( XFLM_IO_CURRENT_POS, 1, (void *)"\n", + if (RC_BAD( rc = pFileHdl->write( FLM_IO_CURRENT_POS, 1, (void *)"\n", &uiBytesWritten))) { domDisplayError( pWindow, "Error writing to output file", rc); @@ -7294,12 +7132,13 @@ FSTATIC void domDisplayLine( { FTXWinPrintf( pWindow, "...more, press any key to continue, ESC to quit: "); } - if (FTXWinInputChar( pWindow, &uiChar) == FTXRC_SHUTDOWN) + + if( RC_BAD( FTXWinInputChar( pWindow, &uiChar))) { *puiLineCount = FLM_MAX_UINT; return; } - if (uiChar == WPK_ESC) + if (uiChar == FKB_ESC) { *puiLineCount = FLM_MAX_UINT; return; @@ -7421,17 +7260,17 @@ FLMBOOL domDisplayEntryInfo( if (pszOutputFileName && *pszOutputFileName) { - if (RC_BAD( rc = gv_pFileSystem->Delete( pszOutputFileName))) + if (RC_BAD( rc = f_getFileSysPtr()->deleteFile( pszOutputFileName))) { - if (rc != NE_XFLM_IO_PATH_NOT_FOUND) + if (rc != NE_FLM_IO_PATH_NOT_FOUND) { domDisplayError( pWindow, "Error deleting output file", rc); goto Exit; } } - if (RC_BAD( rc = gv_pFileSystem->Create( pszOutputFileName, - XFLM_IO_RDWR | XFLM_IO_EXCL | XFLM_IO_SH_DENYNONE | - XFLM_IO_CREATE_DIR, &pFileHdl))) + if (RC_BAD( rc = f_getFileSysPtr()->createFile( pszOutputFileName, + FLM_IO_RDWR | FLM_IO_EXCL | FLM_IO_SH_DENYNONE | + FLM_IO_CREATE_DIR, &pFileHdl))) { domDisplayError( pWindow, "Error creating output file", rc); goto Exit; @@ -7497,10 +7336,10 @@ FLMBOOL domDisplayEntryInfo( FTXWinPrintf( pWindow, "\n"); for (;;) { - if (FTXWinTestKB( pWindow) == FTXRC_SUCCESS) + if( RC_OK( FTXWinTestKB( pWindow))) { FTXWinInputChar( pWindow, &uiChar); - if (uiChar == WPK_ESC) + if (uiChar == FKB_ESC) { FTXWinPrintf( pWindow, "\nESCAPE PRESSED, stopped reading documents\n"); break; @@ -7897,11 +7736,12 @@ Exit: { pEntryNode->Release(); } + if (pFileHdl) { - pFileHdl->Close(); pFileHdl->Release(); } + return( bOk); } @@ -8113,7 +7953,7 @@ public: { } - RCODE XFLMAPI infoStatus( + RCODE FLMAPI infoStatus( FLMUINT uiCurrLfNum, FLMBOOL bIsCollection, char * pszCurrLfName, @@ -8185,7 +8025,7 @@ private: Desc: Callback function that is called while gathering data on an index or collection. *****************************************************************************/ -RCODE XFLMAPI SH_BTreeInfoStatus::infoStatus( +RCODE FLMAPI SH_BTreeInfoStatus::infoStatus( FLMUINT uiCurrLfNum, FLMBOOL bIsCollection, char * pszCurrLfName, @@ -8199,10 +8039,10 @@ RCODE XFLMAPI SH_BTreeInfoStatus::infoStatus( // See if user pressed escape - if (FTXWinTestKB( m_pWindow) == FTXRC_SUCCESS) + if( RC_OK( FTXWinTestKB( m_pWindow))) { FTXWinInputChar( m_pWindow, &uiChar); - if (uiChar == WPK_ESC) + if (uiChar == FKB_ESC) { FTXWinPrintf( m_pWindow, "\nESCAPE PRESSED, stopped reading documents\n"); rc = RC_SET( NE_XFLM_USER_ABORT); @@ -8302,17 +8142,17 @@ FLMBOOL domDisplayBTreeInfo( if (pszOutputFileName && *pszOutputFileName) { - if (RC_BAD( rc = gv_pFileSystem->Delete( pszOutputFileName))) + if (RC_BAD( rc = f_getFileSysPtr()->deleteFile( pszOutputFileName))) { - if (rc != NE_XFLM_IO_PATH_NOT_FOUND) + if (rc != NE_FLM_IO_PATH_NOT_FOUND) { domDisplayError( pWindow, "Error deleting output file", rc); goto Exit; } } - if (RC_BAD( rc = gv_pFileSystem->Create( pszOutputFileName, - XFLM_IO_RDWR | XFLM_IO_EXCL | XFLM_IO_SH_DENYNONE | - XFLM_IO_CREATE_DIR, &pFileHdl))) + if (RC_BAD( rc = f_getFileSysPtr()->createFile( pszOutputFileName, + FLM_IO_RDWR | FLM_IO_EXCL | FLM_IO_SH_DENYNONE | + FLM_IO_CREATE_DIR, &pFileHdl))) { domDisplayError( pWindow, "Error creating output file", rc); goto Exit; @@ -8640,9 +8480,9 @@ Exit: { pBTreeInfo->Release(); } + if (pFileHdl) { - pFileHdl->Close(); pFileHdl->Release(); } return( bOk); @@ -8969,18 +8809,16 @@ RCODE DirectoryIterator::setupForSearch( if ( !m_pDirHdl) { - m_pDirHdl = f_new F_DirHdl; - } - - if ( RC_BAD( m_pDirHdl->OpenDir( m_pszResolvedDir, - (char *)pszPattern))) - { - goto Exit; + if( RC_BAD( rc = f_getFileSysPtr()->openDir( m_pszResolvedDir, + pszPattern, &m_pDirHdl))) + { + goto Exit; + } } // First pass - determine the number of matches - while( RC_OK( m_pDirHdl->Next())) + while( RC_OK( m_pDirHdl->next())) { m_uiTotalMatches++; } @@ -8994,25 +8832,28 @@ RCODE DirectoryIterator::setupForSearch( f_memset( m_ppszMatchList, 0, m_uiTotalMatches * sizeof( char *)); // Reopen the directory and copy the matches + + m_pDirHdl->Release(); + m_pDirHdl = NULL; - if ( RC_BAD( m_pDirHdl->OpenDir( m_pszResolvedDir, - (char *)pszPattern))) + if( RC_BAD( rc = f_getFileSysPtr()->openDir( m_pszResolvedDir, + pszPattern, &m_pDirHdl))) { goto Exit; } - + m_uiCurrentMatch = 0; - while ( RC_OK( m_pDirHdl->Next())) + while ( RC_OK( m_pDirHdl->next())) { if( RC_BAD( rc = f_alloc( - f_strlen( m_pDirHdl->CurrentItemName()) + 1, + f_strlen( m_pDirHdl->currentItemName()) + 1, &m_ppszMatchList[m_uiCurrentMatch]))) { goto Exit; } f_strcpy( m_ppszMatchList[m_uiCurrentMatch], - m_pDirHdl->CurrentItemName()); + m_pDirHdl->currentItemName()); m_uiCurrentMatch++; } @@ -9111,10 +8952,9 @@ Desc: *****************************************************************************/ RCODE DirectoryIterator::resolveDir() { - RCODE rc = NE_XFLM_OK; - F_DirHdl dirHdl; - FLMUINT uiIndex = 0; - char szTemp[ MAX_PATH_SIZE]; + RCODE rc = NE_XFLM_OK; + FLMUINT uiIndex = 0; + char szTemp[ MAX_PATH_SIZE]; if ( !m_pszExtendedDir) { @@ -9161,7 +9001,7 @@ RCODE DirectoryIterator::resolveDir() uiIndex++; } - gv_pFileSystem->pathReduce( m_pszBaseDir, szTemp, NULL); + f_getFileSysPtr()->pathReduce( m_pszBaseDir, szTemp, NULL); f_strcpy( m_pszBaseDir, szTemp); if ( m_pszBaseDir[ f_strlen(m_pszBaseDir) - 1] != SLASH) { @@ -9184,6 +9024,7 @@ RCODE DirectoryIterator::resolveDir() f_strcat( m_pszResolvedDir, &m_pszExtendedDir[uiIndex]); Exit: + return rc; } @@ -9381,7 +9222,7 @@ void extractBaseDirAndWildcard( f_strchr( pszPath, SLASH) && //it contains directories pszPath[ f_strlen( pszPath) - 1] != SLASH) //does not end with a slash { - gv_pFileSystem->pathReduce( pszPath, + f_getFileSysPtr()->pathReduce( pszPath, pszBase, pszWildcard); // Darn thing sometimes removes the trailing slash. Put it back. diff --git a/xflaim/util/fshell.h b/xflaim/util/fshell.h index d9c0ede..f9c4acb 100644 --- a/xflaim/util/fshell.h +++ b/xflaim/util/fshell.h @@ -57,7 +57,7 @@ typedef struct DBContextTag /*=========================================================================== Desc: This class is used by the shell to perform commands it has parsed. ===========================================================================*/ -class FlmCommand : public XF_RefCount, public XF_Base +class FlmCommand : public F_Object { public: FlmCommand( void){} @@ -84,7 +84,7 @@ public: Desc: This class manages a database context - FLAIM session and #N open databases. ===========================================================================*/ -class FlmDbContext : public XF_RefCount, public XF_Base +class FlmDbContext : public F_Object { #define MAX_DBCONTEXT_OPEN_DB 9 public: @@ -152,7 +152,7 @@ private: /*=========================================================================== Desc: This class parses a command line ===========================================================================*/ -class FlmParse : public XF_RefCount, public XF_Base +class FlmParse : public F_Object { public: @@ -239,8 +239,8 @@ private: FlmSharedContext * m_pSharedContext; FTX_WINDOW * m_pTitleWin; IF_Db * m_DbList[ MAX_SHELL_OPEN_DB]; - F_Pool m_HistPool; - F_Pool m_ArgPool; + IF_Pool * m_pHistPool; + IF_Pool * m_pArgPool; FLMINT m_iCurrArgC; char ** m_ppCurrArgV; char * m_pszOutputFile; @@ -865,14 +865,14 @@ private: RCODE resolveDir( void); - FLMBOOL m_bInitialized; - char * m_pszBaseDir; - char * m_pszExtendedDir; - char * m_pszResolvedDir; - F_DirHdl * m_pDirHdl; - char ** m_ppszMatchList; - FLMUINT m_uiCurrentMatch; - FLMUINT m_uiTotalMatches; + FLMBOOL m_bInitialized; + char * m_pszBaseDir; + char * m_pszExtendedDir; + char * m_pszResolvedDir; + IF_DirHdl * m_pDirHdl; + char ** m_ppszMatchList; + FLMUINT m_uiCurrentMatch; + FLMUINT m_uiTotalMatches; }; char * positionToPath( diff --git a/xflaim/util/rebuild.cpp b/xflaim/util/rebuild.cpp index 6f50aac..e3cef82 100644 --- a/xflaim/util/rebuild.cpp +++ b/xflaim/util/rebuild.cpp @@ -23,11 +23,8 @@ // $Id: rebuild.cpp 3129 2006-01-25 11:46:17 -0700 (Wed, 25 Jan 2006) ahodgkinson $ //------------------------------------------------------------------------------ -#include "flaimsys.h" -#include "ftx.h" +#include "xflaim.h" #include "sharutil.h" -#include "ffilesys.h" -#include "ffilehdl.h" #define UTIL_ID "REBUILD" @@ -62,10 +59,10 @@ public: { } - RCODE XFLMAPI reportRebuild( + RCODE FLMAPI reportRebuild( XFLM_REBUILD_INFO * pRebuild); - RCODE XFLMAPI reportRebuildErr( + RCODE FLMAPI reportRebuildErr( XFLM_CORRUPT_INFO * pCorruptInfo); private: @@ -163,6 +160,7 @@ static XFLM_CREATE_OPTS gv_DefaultCreateOpts; static FLMBOOL gv_bFixHdrInfo; static FLMBOOL gv_bRunning; static FLMBOOL gv_bPauseBeforeExiting = FALSE; +static IF_DbSystem * gv_pDbSystem = NULL; #ifdef FLM_NLM @@ -177,12 +175,11 @@ typedef LONG (* RBLD_VOID_FUNC_p )(void); Desc: ? *********************************************************************/ extern "C" int main( - int iArgC, - char ** ppszArgV) + int iArgC, + char ** ppszArgV) { - int iRetCode = 0; - F_Pool LogPool; - F_DbSystem dbSystem; + int iRetCode = 0; + IF_Pool * pLogPool = NULL; gv_bBatchMode = FALSE; gv_bRunning = TRUE; @@ -195,17 +192,22 @@ extern "C" int main( #endif - if( RC_BAD( dbSystem.init())) + if( RC_BAD( FlmAllocDbSystem( &gv_pDbSystem))) { - iRetCode = -1; goto Exit; } WpsInit( 0xFFFF, 0xFFFF, "XFLAIM Database Rebuild"); WpsOptimize(); - - LogPool.poolInit( 1024); - if (RC_BAD( LogPool.poolAlloc( MAX_LOG_BUFF, (void **)&gv_pszLogBuffer))) + + if( RC_BAD( FlmAllocPool( &pLogPool))) + { + goto Exit; + } + + pLogPool->poolInit( 1024); + + if (RC_BAD( pLogPool->poolAlloc( MAX_LOG_BUFF, (void **)&gv_pszLogBuffer))) { WpsStrOut( "\nCould not allocate log buffer\n"); @@ -218,7 +220,8 @@ extern "C" int main( iRetCode = 1; } } - LogPool.poolFree(); + + pLogPool->poolFree(); Exit: @@ -239,9 +242,18 @@ Exit: bldGiveUpCPU(); } } + + if( pLogPool) + { + pLogPool->Release(); + } WpsExit(); - dbSystem.exit(); + + if( gv_pDbSystem) + { + gv_pDbSystem->Release(); + } #ifdef FLM_NLM if (!gv_bSynchronized) @@ -264,7 +276,12 @@ FSTATIC FLMBOOL bldDoRebuild( void) char * pszDestRflDir; RCODE rc; F_LocalRebuildStatus dbRebuildStatus; - F_DbSystem dbSystem; + IF_FileSystem * pFileSystem = NULL; + + if( RC_BAD( rc = FlmGetFileSystem( &pFileSystem))) + { + goto Exit; + } gv_ui64BytesDone = 0; gv_ui64DictNodesRecovered = 0; @@ -273,7 +290,7 @@ FSTATIC FLMBOOL bldDoRebuild( void) gv_ui64TotalNodes = 0; gv_ui64NodesRecovered = 0; - WpsScrBackFor (WPS_BLACK, WPS_LIGHTGRAY); + WpsScrBackFor (FLM_BLACK, FLM_LIGHTGRAY); WpsScrClr( 0, 0); gv_bLoggingEnabled = FALSE; @@ -281,8 +298,8 @@ FSTATIC FLMBOOL bldDoRebuild( void) if( gv_szLogFileName[ 0]) { - gv_pFileSystem->Delete( gv_szLogFileName); - if (RC_OK( rc = gv_pFileSystem->Create( gv_szLogFileName, XFLM_IO_RDWR, + pFileSystem->deleteFile( gv_szLogFileName); + if (RC_OK( rc = pFileSystem->createFile( gv_szLogFileName, FLM_IO_RDWR, &gv_pLogFile))) { gv_bLoggingEnabled = TRUE; @@ -299,7 +316,7 @@ FSTATIC FLMBOOL bldDoRebuild( void) /* Configure FLAIM */ - if (RC_BAD( rc = dbSystem.setHardMemoryLimit( + if (RC_BAD( rc = gv_pDbSystem->setHardMemoryLimit( 0, FALSE, 0, gv_uiCacheSize * 1024, 0, FALSE))) { f_sprintf( szErrMsg, "Error setting cache size for FLAIM share: 0x%04X", @@ -309,7 +326,7 @@ FSTATIC FLMBOOL bldDoRebuild( void) goto Exit; } - WpsScrBackFor( WPS_BLACK, WPS_WHITE); + WpsScrBackFor( FLM_BLACK, FLM_WHITE); if( gv_bLoggingEnabled) { bldLogString( NULL); @@ -374,7 +391,7 @@ FSTATIC FLMBOOL bldDoRebuild( void) : NULL); //VISIT: Implement a proper IF_DbRebuildClient!!! - rc = dbSystem.dbRebuild( gv_szSrcFileName, + rc = gv_pDbSystem->dbRebuild( gv_szSrcFileName, gv_szSrcDataDir, gv_szDestFileName, gv_szDestDataDir, @@ -399,10 +416,15 @@ Exit: if( gv_bLoggingEnabled) { bldLogFlush(); - gv_pLogFile->Close(); + gv_pLogFile->close(); gv_pLogFile->Release(); gv_pLogFile = NULL; } + + if( pFileSystem) + { + pFileSystem->Release(); + } return( bOk); } @@ -419,11 +441,10 @@ FSTATIC void bldShowResults( FLMUINT64 ui64DiscardedDocs) { char szErrMsg[ 100]; - F_DbSystem dbSystem; if( RC_BAD( rc)) { - if( rc != NE_XFLM_FAILURE) + if( rc != NE_FLM_FAILURE) { f_strcpy( szErrMsg, "Error calling "); f_strcpy( &szErrMsg[ f_strlen( szErrMsg)], pszFuncName); @@ -803,7 +824,6 @@ FSTATIC FLMBOOL bldParseHdrInfo( FLMBOOL bHaveParam; XFLM_CREATE_OPTS CreateOpts; FLMUINT uiFieldNum; - F_DbSystem dbSystem; f_memcpy( &CreateOpts, &gv_DefaultCreateOpts, sizeof( XFLM_CREATE_OPTS)); uiFieldNum = 1; @@ -838,7 +858,7 @@ FSTATIC FLMBOOL bldParseHdrInfo( szTmpBuf[ uiTmpLen] = 0; if( uiTmpLen) { - uiNum = dbSystem.languageToNum( szTmpBuf); + uiNum = f_languageToNum( szTmpBuf); if( (!uiNum) && (f_stricmp( szTmpBuf, "US") != 0)) { bldShowError( "Illegal language in header information"); @@ -874,7 +894,7 @@ FSTATIC FLMBOOL bldParseHdrInfo( switch( uiFieldNum) { case 1: - if( uiNum != 0 && !dbSystem.validBlockSize( uiNum)) + if( uiNum != 0 && uiNum != 4096 && uiNum != 8192) { bldShowError( "Illegal block size"); return( FALSE); @@ -928,7 +948,7 @@ FSTATIC void bldOutLabel( f_memset( szMsg, '.', uiLen); szMsg[ uiLen] = 0; - WpsScrBackFor (WPS_BLACK, WPS_LIGHTGRAY); + WpsScrBackFor (FLM_BLACK, FLM_LIGHTGRAY); WpsStrOutXY( szMsg, uiCol, uiRow); WpsStrOutXY( pszLabel, uiCol, uiRow); @@ -965,7 +985,7 @@ FSTATIC void bldOutValue( FLMUINT uiRow, const char * pszValue) { - WpsScrBackFor (WPS_BLACK, WPS_LIGHTGRAY); + WpsScrBackFor (FLM_BLACK, FLM_LIGHTGRAY); WpsStrOutXY( pszValue, VALUE_COLUMN, uiRow); } @@ -998,7 +1018,7 @@ FSTATIC RCODE bldGetUserInput( { if( gv_bShutdown) { - uiChar = WPK_ESCAPE; + uiChar = FKB_ESCAPE; break; } else if( WpkTestKB()) @@ -1012,13 +1032,13 @@ FSTATIC RCODE bldGetUserInput( bldGiveUpCPU(); } - WpsScrBackFor (WPS_BLACK, WPS_LIGHTGRAY); + WpsScrBackFor (FLM_BLACK, FLM_LIGHTGRAY); WpsScrClr( 0, 22); switch( uiChar) { case 'q': case 'Q': - case WPK_ESCAPE: + case FKB_ESCAPE: return( RC_SET( NE_XFLM_USER_ABORT)); default: break; @@ -1056,7 +1076,6 @@ FSTATIC void bldLogCorruptError( XFLM_CORRUPT_INFO * pCorruptInfo) { char szBuf[ 100]; - F_DbSystem dbSystem; // Log the container number @@ -1106,7 +1125,7 @@ FSTATIC void bldLogCorruptError( // Log the error message - f_strcpy( szBuf, dbSystem.checkErrorToStr( pCorruptInfo->iErrCode)); + f_strcpy( szBuf, gv_pDbSystem->checkErrorToStr( pCorruptInfo->iErrCode)); f_sprintf( (&szBuf [f_strlen( szBuf)]), " (%d)", (int)pCorruptInfo->iErrCode); bldLogStr( 2, szBuf); @@ -1172,11 +1191,11 @@ RCODE F_LocalRebuildStatus::reportRebuild( } // See if they pressed an ESC character - if ((WpkTestKB()) && (WpkIncar() == WPK_ESCAPE)) + if ((WpkTestKB()) && (WpkIncar() == FKB_ESCAPE)) { - WpsScrBackFor (WPS_BLACK, WPS_LIGHTGRAY); + WpsScrBackFor (FLM_BLACK, FLM_LIGHTGRAY); WpsScrClr( 0, 22); - WpsScrBackFor (WPS_RED, WPS_WHITE); + WpsScrBackFor (FLM_RED, FLM_WHITE); WpsStrOutXY( "ESCAPE key pressed", 0, 22); rc = bldGetUserInput(); goto Exit; @@ -1195,11 +1214,11 @@ RCODE F_LocalRebuildStatus::reportRebuildErr( // See if they pressed an ESC character - if ((WpkTestKB()) && (WpkIncar() == WPK_ESCAPE)) + if ((WpkTestKB()) && (WpkIncar() == FKB_ESCAPE)) { - WpsScrBackFor (WPS_BLACK, WPS_LIGHTGRAY); + WpsScrBackFor (FLM_BLACK, FLM_LIGHTGRAY); WpsScrClr( 0, 22); - WpsScrBackFor (WPS_RED, WPS_WHITE); + WpsScrBackFor (FLM_RED, FLM_WHITE); WpsStrOutXY( "ESCAPE key pressed", 0, 22); rc = bldGetUserInput(); goto Exit; @@ -1221,9 +1240,9 @@ FSTATIC void bldShowError( if( !gv_bBatchMode) { - WpsScrBackFor (WPS_BLACK, WPS_LIGHTGRAY); + WpsScrBackFor (FLM_BLACK, FLM_LIGHTGRAY); WpsScrClr( 0, 22); - WpsScrBackFor (WPS_RED, WPS_WHITE); + WpsScrBackFor (FLM_RED, FLM_WHITE); WpsStrOutXY( pszMessage, 0, 22); WpsStrOutXY( "Press any character to continue, ESCAPE to quit: ", 0, 23); for (;;) @@ -1232,13 +1251,13 @@ FSTATIC void bldShowError( break; else if (WpkTestKB()) { - if (WpkIncar() == WPK_ESCAPE) + if (WpkIncar() == FKB_ESCAPE) gv_bShutdown = TRUE; break; } bldGiveUpCPU(); } - WpsScrBackFor (WPS_BLACK, WPS_LIGHTGRAY); + WpsScrBackFor (FLM_BLACK, FLM_LIGHTGRAY); WpsScrClr( 0, 22); } } @@ -1254,7 +1273,7 @@ FSTATIC void bldLogFlush( if( gv_uiLogBufferCount) { - gv_pLogFile->Write( XFLM_IO_CURRENT_POS, + gv_pLogFile->write( FLM_IO_CURRENT_POS, gv_uiLogBufferCount, gv_pszLogBuffer, &uiBytesWritten); gv_uiLogBufferCount = 0; } diff --git a/xflaim/util/sharutil.cpp b/xflaim/util/sharutil.cpp index 9218a1a..ae77301 100644 --- a/xflaim/util/sharutil.cpp +++ b/xflaim/util/sharutil.cpp @@ -26,13 +26,33 @@ #include "flaimsys.h" #include "sharutil.h" +FSTATIC FTX_WINDOW * wpsGetThrdWin( void); + +FINLINE void wpsLock( + F_MUTEX * phMutex) +{ + f_mutexLock( *phMutex); +} + +FINLINE void wpsUnlock( + F_MUTEX * phMutex) +{ + f_mutexUnlock( *phMutex); +} + +static FLMBOOL gv_bShutdown = FALSE; +static FLMBOOL gv_bInitialized = FALSE; +static FLMBOOL gv_bOptimize = FALSE; +static WPSSCREEN * gv_pScreenList = NULL; +static F_MUTEX gv_hDispMutex = F_MUTEX_NULL; + FSTATIC RCODE propertyExists( char * pszProperty, char * pszBuffer, char ** ppszValue); FSTATIC RCODE _flmWrapperFunc( - F_Thread * pThread); + IF_Thread * pThread); /******************************************************************** Desc: Parses command-line parameters @@ -166,9 +186,9 @@ Desc: appending text to the accumulator safely. all other methods in ****************************************************************************/ RCODE FlmStringAcc::appendTEXT( const FLMBYTE * pszVal) { - RCODE rc = NE_XFLM_OK; - FLMUINT uiIncomingStrLen; - FLMUINT uiStrLen; + RCODE rc = NE_XFLM_OK; + FLMUINT uiIncomingStrLen; + FLMUINT uiStrLen; //be forgiving if they pass in a NULL if ( !pszVal) @@ -176,7 +196,7 @@ RCODE FlmStringAcc::appendTEXT( const FLMBYTE * pszVal) goto Exit; } //also be forgiving if they pass a 0-length string - else if ( (uiIncomingStrLen = f_strlen( pszVal)) == 0) + else if( (uiIncomingStrLen = f_strlen( (const char *)pszVal)) == 0) { goto Exit; } @@ -194,7 +214,7 @@ RCODE FlmStringAcc::appendTEXT( const FLMBYTE * pszVal) //just use small buffer if it's small enough if ( uiStrLen < FSA_QUICKBUF_BUFFER_SIZE) { - f_strcat( m_szQuickBuf, pszVal); + f_strcat( m_szQuickBuf, (const char *)pszVal); m_bQuickBufActive = TRUE; } //we are exceeding the quickbuf size, so get the bytes from the heap @@ -243,7 +263,7 @@ RCODE FlmStringAcc::appendTEXT( const FLMBYTE * pszVal) } //copy over the string - f_strcat( m_pszVal, pszVal); + f_strcat( m_pszVal, (const char *)pszVal); } m_uiValStrLen = uiStrLen; Exit: @@ -370,7 +390,7 @@ RCODE FlmContext::setCurrDir( flmAssert( m_bIsSetup); lock(); - f_strcpy( m_szCurrDir, pszCurrDir); + f_strcpy( (char *)m_szCurrDir, (const char *)pszCurrDir); unlock(); return( rc); @@ -387,7 +407,7 @@ RCODE FlmContext::getCurrDir( flmAssert( m_bIsSetup); lock(); - f_strcpy( pszCurrDir, m_szCurrDir); + f_strcpy( (char *)pszCurrDir, (const char *)m_szCurrDir); unlock(); return( rc); @@ -580,7 +600,6 @@ Desc: FlmSharedContext::FlmSharedContext( void) { m_pParentContext = NULL; - m_pFtxInfo = NULL; m_pThreadList = NULL; m_bLocalShutdownFlag = FALSE; m_pbShutdownFlag = &m_bLocalShutdownFlag; @@ -608,8 +627,7 @@ FlmSharedContext::~FlmSharedContext( void) Desc: *****************************************************************************/ RCODE FlmSharedContext::init( - FlmSharedContext * pSharedContext, - FTX_INFO * pFtxInfo) + FlmSharedContext * pSharedContext) { RCODE rc = NE_XFLM_OK; @@ -619,8 +637,6 @@ RCODE FlmSharedContext::init( goto Exit; } - m_pFtxInfo = pFtxInfo; - if( RC_BAD( rc = f_semCreate( &m_hSem))) { goto Exit; @@ -698,14 +714,20 @@ RCODE FlmSharedContext::spawn( FlmThreadContext * pThread, FLMUINT * puiThreadID) { - char szName[ MAX_THREAD_NAME_LEN + 1]; - RCODE rc = NE_XFLM_OK; + RCODE rc = NE_XFLM_OK; + char szName[ MAX_THREAD_NAME_LEN + 1]; + IF_ThreadMgr * pThreadMgr = NULL; registerThread( pThread); pThread->getName( szName); - if( RC_BAD( rc = f_threadCreate( NULL, - _flmWrapperFunc, szName, - FLM_DEFAULT_THREAD_GROUP, 0, pThread))) + + if( RC_BAD( rc = FlmGetThreadMgr( &pThreadMgr))) + { + goto Exit; + } + + if( RC_BAD( rc = pThreadMgr->createThread( NULL, + _flmWrapperFunc, szName, 0, 0, pThread))) { goto Exit; } @@ -717,6 +739,11 @@ RCODE FlmSharedContext::spawn( Exit: + if( pThreadMgr) + { + pThreadMgr->Release(); + } + return( rc); } @@ -842,7 +869,7 @@ RCODE FlmSharedContext::killThread( // Wait for the thread to exit uiStartTime = FLM_GET_TIMER(); - FLM_SECS_TO_TIMER_UNITS( uiMaxWait, uiMaxWait); + uiMaxWait = FLM_SECS_TO_TIMER_UNITS( uiMaxWait); for( ;;) { (void)f_semWait( m_hSem, 200); @@ -967,7 +994,7 @@ RCODE FlmSharedContext::getThread( Desc: *****************************************************************************/ RCODE _flmWrapperFunc( - F_Thread * pFlmThread) + IF_Thread * pFlmThread) { FlmThreadContext * pThread = (FlmThreadContext *)pFlmThread->getParm1(); FlmSharedContext * pSharedContext = pThread->getSharedContext(); @@ -991,10 +1018,13 @@ Exit: /**************************************************************************** Desc: callback to use to output a line ****************************************************************************/ -void utilOutputLine( char * pszData, void * pvUserData) +void utilOutputLine( + char * pszData, + void * pvUserData) { - FTX_WINDOW * pMainWindow = (FTX_WINDOW*)pvUserData; - FLMUINT uiBack, uiFore; + FTX_WINDOW * pMainWindow = (FTX_WINDOW*)pvUserData; + eColorType uiBack, uiFore; + FTXWinGetBackFore( pMainWindow, &uiBack, &uiFore); FTXWinCPrintf( pMainWindow, uiBack, uiFore, "%s\n", pszData); } @@ -1006,14 +1036,15 @@ Desc: callback to serve as a 'pager' function when the Usage: help ****************************************************************************/ void utilPressAnyKey( char * pszMessage, void * pvUserData) { - FTX_WINDOW * pMainWindow = (FTX_WINDOW*)pvUserData; - FLMUINT uiChar; - FLMUINT uiBack, uiFore; + FTX_WINDOW * pMainWindow = (FTX_WINDOW*)pvUserData; + FLMUINT uiChar; + eColorType uiBack, uiFore; + FTXWinGetBackFore( pMainWindow, &uiBack, &uiFore); FTXWinCPrintf( pMainWindow, uiBack, uiFore, pszMessage); - while ( FTXWinTestKB( pMainWindow) != FTXRC_SUCCESS) + while( RC_BAD( FTXWinTestKB( pMainWindow))) { - f_sleep( 100); //don't hog the cpu + f_sleep( 100); } FTXWinCPrintf( pMainWindow, uiBack, uiFore, "\r "); @@ -1028,7 +1059,6 @@ Desc: routine to startup the TUI RCODE utilInitWindow( char * pszTitle, FLMUINT * puiScreenRows, - FTX_INFO ** ppFtxInfo, FTX_WINDOW ** ppMainWindow, FLMBOOL * pbShutdown) { @@ -1037,30 +1067,30 @@ RCODE utilInitWindow( FLMUINT uiCols; int iResCode = 0; - if( FTXInit( pszTitle, (FLMBYTE)80, (FLMBYTE)50, - WPS_BLUE, WPS_WHITE, NULL, NULL, ppFtxInfo) != FTXRC_SUCCESS) + if( RC_BAD( FTXInit( pszTitle, (FLMBYTE)80, (FLMBYTE)50, + FLM_BLUE, FLM_WHITE, NULL, NULL))) { iResCode = 1; goto Exit; } - FTXSetShutdownFlag( *ppFtxInfo, pbShutdown); + FTXSetShutdownFlag( pbShutdown); - if( FTXScreenInit( *ppFtxInfo, pszTitle, &pScreen) - != FTXRC_SUCCESS) + if( RC_BAD( FTXScreenInit( pszTitle, &pScreen))) { iResCode = 1; goto Exit; } - if( FTXScreenGetSize( pScreen, &uiCols, puiScreenRows) != FTXRC_SUCCESS) + + if( RC_BAD( FTXScreenGetSize( pScreen, &uiCols, puiScreenRows))) { iResCode = 1; goto Exit; } - if ( FTXScreenInitStandardWindows( pScreen, WPS_RED, WPS_WHITE, - WPS_BLUE, WPS_WHITE, FALSE, FALSE, pszTitle, - &pTitleWin, ppMainWindow) != FTXRC_SUCCESS) + if( RC_BAD( FTXScreenInitStandardWindows( pScreen, FLM_RED, FLM_WHITE, + FLM_BLUE, FLM_WHITE, FALSE, FALSE, pszTitle, + &pTitleWin, ppMainWindow))) { iResCode = 1; goto Exit; @@ -1074,9 +1104,9 @@ Exit: Name: utilShutdownWindow Desc: routine to shutdown the TUI ****************************************************************************/ -void utilShutdownWindow( FTX_INFO * pFtxInfo) +void utilShutdownWindow() { - FTXFree( &pFtxInfo); + FTXExit(); } /**************************************************************************** @@ -1086,19 +1116,24 @@ RCODE fileToString( char * pszFile, char ** ppszReturnString) { - char * pszBuffer = NULL; - IF_FileHdl * pFileHdl = NULL; - F_FileSystem fileSystem; - FLMUINT64 ui64FileSize = 0; - FLMUINT uiBytesRead = 0; - RCODE rc = NE_XFLM_OK; + RCODE rc = NE_XFLM_OK; + char * pszBuffer = NULL; + IF_FileHdl * pFileHdl = NULL; + FLMUINT64 ui64FileSize = 0; + FLMUINT uiBytesRead = 0; + IF_FileSystem * pFileSystem = NULL; + + if( RC_BAD( rc = FlmGetFileSystem( &pFileSystem))) + { + goto Exit; + } - if (RC_BAD(rc = fileSystem.Open( pszFile, XFLM_IO_RDONLY, &pFileHdl))) + if (RC_BAD(rc = pFileSystem->openFile( pszFile, FLM_IO_RDONLY, &pFileHdl))) { goto Exit; } - if (RC_BAD( rc = pFileHdl->Size( &ui64FileSize))) + if (RC_BAD( rc = pFileHdl->size( &ui64FileSize))) { goto Exit; } @@ -1113,7 +1148,7 @@ RCODE fileToString( goto Exit; } - if (RC_BAD( rc = pFileHdl->Read( 0, (FLMUINT)ui64FileSize, + if (RC_BAD( rc = pFileHdl->read( 0, (FLMUINT)ui64FileSize, pszBuffer, &uiBytesRead))) { goto Exit; @@ -1124,12 +1159,16 @@ RCODE fileToString( Exit: - if(pFileHdl) + if( pFileHdl) { - pFileHdl->Close(); pFileHdl->Release(); } + if( pFileSystem) + { + pFileSystem->Release(); + } + if ( RC_BAD( rc) && pszBuffer) { f_free( &pszBuffer); @@ -1241,17 +1280,22 @@ RCODE utilWriteProperty( char * pszProp, char * pszValue) { - RCODE rc = NE_XFLM_OK; - char * pszContents = NULL; - char * pszExistingProperty; - FlmStringAcc newContents; - F_FileSystem fileSys; + RCODE rc = NE_XFLM_OK; + char * pszContents = NULL; + char * pszExistingProperty; + FlmStringAcc newContents; + IF_FileSystem * pFileSystem = NULL; + + if( RC_BAD( rc = FlmGetFileSystem( &pFileSystem))) + { + goto Exit; + } //can't have newlines in the props or values flmAssert( !f_strchr( pszProp, '\n')); flmAssert( !f_strchr( pszValue, '\n')); - if ( RC_BAD( fileSys.Exists( pszFile))) + if ( RC_BAD( pFileSystem->doesFileExist( pszFile))) { //add trailing newline TEST_RC( rc = f_filecpy( pszFile, "")); @@ -1320,6 +1364,12 @@ RCODE utilWriteProperty( rc = f_filecpy( pszFile, newContents.getTEXT()); Exit: + + if( pFileSystem) + { + pFileSystem->Release(); + } + if ( pszContents) { f_free( &pszContents); @@ -1332,12 +1382,17 @@ RCODE utilReadProperty( char * pszProp, FlmStringAcc * pAcc) { - RCODE rc = NE_XFLM_OK; - F_FileSystem fileSys; - char * pszContents = NULL; - char * pszValue = NULL; + RCODE rc = NE_XFLM_OK; + char * pszContents = NULL; + char * pszValue = NULL; + IF_FileSystem * pFileSystem = NULL; - if ( RC_BAD( fileSys.Exists( pszFile))) + if( RC_BAD( rc = FlmGetFileSystem( &pFileSystem))) + { + goto Exit; + } + + if ( RC_BAD( pFileSystem->doesFileExist( pszFile))) { //be nice here. simply don't append anything into FlmStringAcc goto Exit; @@ -1351,22 +1406,28 @@ RCODE utilReadProperty( Exit: - if ( pszValue) + if( pFileSystem) + { + pFileSystem->Release(); + } + + if( pszValue) { f_free( &pszValue); } - if ( pszContents) + if( pszContents) { f_free( &pszContents); } - return rc; + + return( rc); } void scramble( - F_RandomGenerator * pRandGen, - FLMUINT * puiArray, - FLMUINT uiNumElems) + IF_RandomGenerator * pRandGen, + FLMUINT * puiArray, + FLMUINT uiNumElems) { FLMUINT uiLoop; FLMUINT uiTmp; @@ -1374,10 +1435,648 @@ void scramble( for( uiLoop = 0; uiLoop < uiNumElems; uiLoop++) { - uiIndex = pRandGen->randomChoice( 0, uiNumElems - 1); + uiIndex = pRandGen->getUINT32( 0, uiNumElems - 1); f_swap( puiArray[uiLoop], puiArray[uiIndex], uiTmp); } } + +/**************************************************************************** +Desc: Initialize and set the title +****************************************************************************/ +void WpsInit( + FLMUINT uiRows, // 0xFFFF means use current screen height. + FLMUINT uiCols, // 0xFFFF means use current screen width. + const char * pszScreenTitle) +{ + char szTitleAndVer[ 100]; + + if( gv_bInitialized) + { + return; + } + + // Setup utilities title which includes the software version. +#ifdef SECURE_UTIL + f_sprintf( (char *)szTitleAndVer, "%s - %s (%u)", + pszScreenTitle, SRC_VER_STR, (unsigned)UTIL_VER); +#else + f_sprintf( (char *)szTitleAndVer, "%s - %s (UNSECURE:%u)", + pszScreenTitle, SRC_VER_STR, (unsigned)UTIL_VER); +#endif + + FTXInit( szTitleAndVer, uiCols, uiRows, FLM_BLACK, FLM_LIGHTGRAY, + NULL, NULL); + + if( RC_BAD( f_mutexCreate( &gv_hDispMutex))) + { + flmAssert( 0); + } + + WpsThrdInit( szTitleAndVer); + gv_bInitialized = TRUE; +} + + +/**************************************************************************** +Desc: Initialize WPS using an existing FTX environment +****************************************************************************/ +void WpsInitFTX( void) +{ + if( gv_bInitialized) + { + return; + } + + if( RC_BAD( f_mutexCreate( &gv_hDispMutex))) + { + flmAssert( 0); + } + + gv_bInitialized = TRUE; +} + + +/**************************************************************************** +Desc: Restores the screen to an initial state +****************************************************************************/ +void WpsExit( void) +{ + if( !gv_bInitialized) + { + return; + } + + gv_bShutdown = TRUE; + WpsThrdExit(); + f_mutexDestroy( &gv_hDispMutex); + FTXExit(); + gv_bInitialized = FALSE; +} + +/**************************************************************************** +Desc: Initialize and set the title of a thread's screen +***************************************************************************/ +void WpsThrdInitUsingScreen( + FTX_SCREEN * pFtxScreen, + const char * pszScreenTitle) +{ + FLMUINT uiRows; + FLMUINT uiThrdId; + WPSSCREEN * pCurScreen = NULL; + + wpsLock( &gv_hDispMutex); + + uiThrdId = f_threadId(); + pCurScreen = gv_pScreenList; + while( pCurScreen != NULL) + { + if( pCurScreen->uiScreenId == uiThrdId) + { + break; + } + pCurScreen = pCurScreen->pNext; + } + + if( pCurScreen == NULL) + { + if( RC_BAD( f_calloc( sizeof( WPSSCREEN), &pCurScreen))) + { + flmAssert( 0); + } + pCurScreen->uiScreenId = uiThrdId; + pCurScreen->pNext = gv_pScreenList; + gv_pScreenList = pCurScreen; + + if( pFtxScreen != NULL) + { + pCurScreen->pScreen = pFtxScreen; + pCurScreen->bPrivate = FALSE; + } + else + { + if( RC_BAD( FTXScreenInit( pszScreenTitle, + &(pCurScreen->pScreen)))) + { + flmAssert( 0); + } + pCurScreen->bPrivate = TRUE; + } + + if( RC_BAD( FTXScreenGetSize( pCurScreen->pScreen, NULL, &uiRows))) + { + flmAssert( 0); + } + + if( RC_BAD( FTXWinInit( pCurScreen->pScreen, 0, + (FLMBYTE)(uiRows - 1), &(pCurScreen->pWin)))) + { + flmAssert( 0); + } + + FTXWinMove( pCurScreen->pWin, 0, 1); + + if( RC_BAD( FTXWinInit( pCurScreen->pScreen, 0, + 1, &(pCurScreen->pTitleWin)))) + { + flmAssert( 0); + } + + FTXWinPaintBackground( pCurScreen->pTitleWin, FLM_RED); + FTXWinPrintStr( pCurScreen->pTitleWin, pszScreenTitle); + FTXWinOpen( pCurScreen->pTitleWin); + FTXWinOpen( pCurScreen->pWin); + } + + wpsUnlock( &gv_hDispMutex); +} + + +/**************************************************************************** +Desc: Frees all screen resources allocated to a thread +Ret: +****************************************************************************/ +void WpsThrdExit( void) +{ + FLMUINT uiThrdId; + WPSSCREEN * pPrevScreen = NULL; + WPSSCREEN * pCurScreen = NULL; + + + wpsLock( &gv_hDispMutex); + + uiThrdId = f_threadId(); + pCurScreen = gv_pScreenList; + while( pCurScreen != NULL) + { + if( pCurScreen->uiScreenId == uiThrdId) + { + break; + } + pPrevScreen = pCurScreen; + pCurScreen = pCurScreen->pNext; + } + + if( pCurScreen != NULL) + { + if( pCurScreen == gv_pScreenList) + { + gv_pScreenList = pCurScreen->pNext; + } + + if( pPrevScreen != NULL) + { + pPrevScreen->pNext = pCurScreen->pNext; + } + + if( pCurScreen->bPrivate == TRUE) + { + FTXScreenFree( &(pCurScreen->pScreen)); + } + else + { + FTXWinFree( &(pCurScreen->pTitleWin)); + FTXWinFree( &(pCurScreen->pWin)); + } + + f_free( &pCurScreen); + } + + wpsUnlock( &gv_hDispMutex); +} + + +/**************************************************************************** +Desc: Returns the size of the screen in columns and rows. +****************************************************************************/ +void WpsScrSize( + FLMUINT * puiNumColsRV, + FLMUINT * puiNumRowsRV + ) +{ + FTXWinGetCanvasSize( wpsGetThrdWin(), puiNumColsRV, puiNumRowsRV); +} + + +/**************************************************************************** +Desc: Output a string at present cursor location. +****************************************************************************/ +void WpsStrOut( + const char * pszString) +{ + FTXWinPrintStr( wpsGetThrdWin(), pszString); + if( !gv_bOptimize) + { + FTXRefresh(); + } +} + +/**************************************************************************** +Desc: Output a formatted string at present cursor location. +****************************************************************************/ +void WpsPrintf( + const char * pszFormat, ...) +{ + char szBuffer[ 512]; + f_va_list args; + + f_va_start( args, pszFormat); + f_vsprintf( szBuffer, pszFormat, &args); + f_va_end( args); + FTXWinPrintStr( wpsGetThrdWin(), szBuffer); + + if( !gv_bOptimize) + { + FTXRefresh(); + } +} + + +/**************************************************************************** +Desc: Output a formatted string at present cursor location with color +****************************************************************************/ +void WpsCPrintf( + eColorType uiBack, + eColorType uiFore, + const char * pszFormat, ...) +{ + char szBuffer[ 512]; + f_va_list args; + eColorType uiOldBack; + eColorType uiOldFore; + + f_va_start( args, pszFormat); + f_vsprintf( szBuffer, pszFormat, &args); + f_va_end( args); + + FTXWinGetBackFore( wpsGetThrdWin(), &uiOldBack, &uiOldFore); + FTXWinSetBackFore( wpsGetThrdWin(), uiBack, uiFore); + FTXWinPrintStr( wpsGetThrdWin(), szBuffer); + FTXWinSetBackFore( wpsGetThrdWin(), uiOldBack, uiOldFore); + + if( !gv_bOptimize) + { + FTXRefresh(); + } +} + + +/**************************************************************************** +Desc: Output a character to the screen at the current location. If char is + a LineFeed then a CarriageReturn will be inserted before the LineFeed. +Notes:On NLM becomes a blocking function if the char is the newline character. +****************************************************************************/ +void WpsChrOut( + char chr + ) +{ + FTXWinPrintChar( wpsGetThrdWin(), (FLMUINT)chr); + if( !gv_bOptimize) + { + FTXRefresh(); + } +} + + +/**************************************************************************** +Desc: Clear the screen from the col/row down +Notes: If col==row==0 then clear entire screen +****************************************************************************/ +void WpsScrClr( + FLMUINT uiCol, + FLMUINT uiRow + ) +{ + FTX_WINDOW * pThrdWin; + FLMUINT uiCurrCol; + FLMUINT uiCurrRow; + + + pThrdWin = wpsGetThrdWin(); + FTXWinGetCursorPos( pThrdWin, &uiCurrCol, &uiCurrRow); + + if( uiCol == 255) + { + uiCol = uiCurrCol; + } + + if( uiRow == 255) + { + uiRow = uiCurrRow; + } + + FTXWinClearXY( pThrdWin, uiCol, uiRow); + FTXWinSetCursorPos( pThrdWin, uiCol, uiRow); + if( !gv_bOptimize) + { + FTXRefresh(); + } +} + +/**************************************************************************** +Desc: Position to the column and row specified. +Notes: The NLM could call GetPositionOfOutputCursor(&r,&c); +****************************************************************************/ +void WpsScrPos( + FLMUINT uiCol, + FLMUINT uiRow + ) +{ + FTX_WINDOW * pThrdWin; + FLMUINT uiCurrCol; + FLMUINT uiCurrRow; + + + pThrdWin = wpsGetThrdWin(); + FTXWinGetCursorPos( pThrdWin, &uiCurrCol, &uiCurrRow); + + if( uiCol == 255) + { + uiCol = uiCurrCol; + } + + if( uiRow == 255) + { + uiRow = uiCurrRow; + } + + FTXWinSetCursorPos( pThrdWin, uiCol, uiRow); +} + + +/**************************************************************************** +Desc: Clear from input cursor to end of line +****************************************************************************/ +void WpsLineClr( + FLMUINT uiCol, + FLMUINT uiRow + ) +{ + FTX_WINDOW * pThrdWin; + FLMUINT uiCurrCol; + FLMUINT uiCurrRow; + + + pThrdWin = wpsGetThrdWin(); + FTXWinGetCursorPos( pThrdWin, &uiCurrCol, &uiCurrRow); + + if( uiCol == 255) + { + uiCol = uiCurrCol; + } + + if( uiRow == 255) + { + uiRow = uiCurrRow; + } + + FTXWinClearLine( pThrdWin, uiCol, uiRow); + if( !gv_bOptimize) + { + FTXRefresh(); + } +} + +/**************************************************************************** +Desc: Edit a line of data like gets(s). Newline replaced by NULL character. +Ret: WPK Character +Notes: Does not support WP extended character input - but could easily! +****************************************************************************/ +FLMUINT WpsLineEd( + char * pszString, + FLMUINT uiMaxLen, + FLMBOOL * pbShutdown + ) +{ + FLMUINT uiCharCount; + FLMUINT uiCursorType; + + + uiCursorType = FTXWinGetCursorType( wpsGetThrdWin()); + FTXWinSetCursorType( wpsGetThrdWin(), FLM_CURSOR_UNDERLINE); + FTXSetShutdownFlag( pbShutdown); + uiCharCount = FTXLineEd( wpsGetThrdWin(), pszString, uiMaxLen); + FTXSetShutdownFlag( NULL); + FTXWinSetCursorType( wpsGetThrdWin(), uiCursorType); + + return( uiCharCount); +} + + +/**************************************************************************** +Desc: Sets the FTX shutdown flag pointer +Ret: +****************************************************************************/ +void WpsSetShutdown( + FLMBOOL * pbShutdown + ) +{ + FTXSetShutdownFlag( pbShutdown); +} + + +/**************************************************************************** +Desc: Edit a line of data with advanced features. +Ret: Number of characters input. +****************************************************************************/ +FLMUINT WpsLineEditExt( + char * pszBuffer, + FLMUINT uiBufSize, + FLMUINT uiMaxWidth, + FLMBOOL * pbShutdown, + FLMUINT * puiTermChar + ) +{ + FLMUINT uiCharCount = 0; + FLMUINT uiCursorType; + + + uiCursorType = FTXWinGetCursorType( wpsGetThrdWin()); + FTXWinSetCursorType( wpsGetThrdWin(), FLM_CURSOR_UNDERLINE); + FTXSetShutdownFlag( pbShutdown); + FTXLineEdit( wpsGetThrdWin(), pszBuffer, uiBufSize, uiMaxWidth, + &uiCharCount, puiTermChar); + FTXSetShutdownFlag( NULL); + FTXWinSetCursorType( wpsGetThrdWin(), uiCursorType); + + return( (FLMINT)uiCharCount); +} + + +/**************************************************************************** +Desc: Get the current X coordinate of the cursor +****************************************************************************/ +FLMUINT WpsCurrCol( void) +{ + FLMUINT uiCol; + + FTXWinGetCursorPos( wpsGetThrdWin(), &uiCol, NULL); + return( uiCol); +} + + +/**************************************************************************** +Desc: Get the current Y coordinate of the cursor +****************************************************************************/ +FLMUINT WpsCurrRow( void) +{ + FLMUINT uiRow; + + FTXWinGetCursorPos( wpsGetThrdWin(), NULL, &uiRow); + return( uiRow); +} + +/**************************************************************************** +Desc: Set the background and foreground colors +Ret: None +****************************************************************************/ +void WpsScrBackFor( + eColorType backColor, + eColorType foreColor) +{ + FTXWinSetBackFore( wpsGetThrdWin(), backColor, foreColor); +} + + +/**************************************************************************** +Desc : Sets the cursor attributes. +****************************************************************************/ +void WpsCursorSetType( + FLMUINT uiType) +{ + FTXWinSetCursorType( wpsGetThrdWin(), uiType); + FTXRefresh(); +} + +/**************************************************************************** +Desc: Specifies that display performance (throughput) should be + optimal. +****************************************************************************/ +void WpsOptimize( void) +{ + gv_bOptimize = TRUE; +} + + +/**************************************************************************** +Desc: Draws a border around the current thread's screen +Ret: none +****************************************************************************/ +void WpsDrawBorder( void) +{ + FTXWinDrawBorder( wpsGetThrdWin()); + if( !gv_bOptimize) + { + FTXRefresh(); + } +} + + +/**************************************************************************** +Desc: Convert keyboard sequences/scan codes to WPK key strokes. +Notes: Does not support WP extended character input - but could easily! +****************************************************************************/ +FLMUINT WpkIncar( void) +{ + FLMUINT uiChar; + + FTXWinInputChar( wpsGetThrdWin(), &uiChar); + return( uiChar); +} + + +/**************************************************************************** +Desc: Convert keyboard sequences/scan codes to WPK key strokes. This + routine accepts a pointer to a shutdown flag. +****************************************************************************/ +FLMUINT WpkGetChar( + FLMBOOL * pbShutdown + ) +{ + FLMUINT uiChar; + + FTXSetShutdownFlag( pbShutdown); + FTXWinInputChar( wpsGetThrdWin(), &uiChar); + FTXSetShutdownFlag( NULL); + + return( uiChar); +} + + +/**************************************************************************** +Desc: Tests the keyboard for a pending character +Ret: 1 if key available, 0 if no key available +****************************************************************************/ +FLMUINT WpkTestKB( void) +{ + FLMUINT uiCharAvail; + + uiCharAvail = (FLMUINT)(FTXWinTestKB( wpsGetThrdWin()) == + NE_FLM_OK ? 1 : 0); + return( uiCharAvail); +} + + +/**************************************************************************** +Desc: Returns a pointer to a thread's screen +****************************************************************************/ +FTX_SCREEN * WpsGetThrdScreen( void) +{ + FLMUINT uiThrdId; + WPSSCREEN * pCurScreen = NULL; + + wpsLock( &gv_hDispMutex); + + uiThrdId = f_threadId(); + + pCurScreen = gv_pScreenList; + while( pCurScreen != NULL) + { + if( pCurScreen->uiScreenId == uiThrdId) + { + break; + } + pCurScreen = pCurScreen->pNext; + } + + if( pCurScreen == NULL) + { + flmAssert( 0); + } + + wpsUnlock( &gv_hDispMutex); + return( pCurScreen->pScreen); +} + +/**************************************************************************** +Desc: Returns a pointer to a thread's screen +****************************************************************************/ +FSTATIC FTX_WINDOW * wpsGetThrdWin( void) +{ + FLMUINT uiThrdId; + WPSSCREEN * pCurScreen = NULL; + + + wpsLock( &gv_hDispMutex); + + uiThrdId = f_threadId(); + pCurScreen = gv_pScreenList; + while( pCurScreen != NULL) + { + if( pCurScreen->uiScreenId == uiThrdId) + { + break; + } + pCurScreen = pCurScreen->pNext; + } + + if( pCurScreen == NULL) + { + flmAssert( 0); + } + + wpsUnlock( &gv_hDispMutex); + return( pCurScreen->pWin); +} diff --git a/xflaim/util/sharutil.h b/xflaim/util/sharutil.h index 921aa99..e171ae0 100644 --- a/xflaim/util/sharutil.h +++ b/xflaim/util/sharutil.h @@ -27,8 +27,6 @@ #ifndef SHARUTIL_H #define SHARUTIL_H -#include "ftx.h" - /* Current utility version */ #define UTIL_VER ((FLMUINT)300) @@ -92,7 +90,7 @@ Desc: treat this vector class like an array, except that you will never leave holes in the elements, the intermediate elements will be filled with 0's. ****************************************************************************/ -class FlmVector : public XF_RefCount, public XF_Base +class FlmVector : public F_Object { public: FlmVector() @@ -120,7 +118,7 @@ Desc: a class to safely build up a string accumulation, without worrying about buffer overflows. ****************************************************************************/ #define FSA_QUICKBUF_BUFFER_SIZE 128 -class FlmStringAcc : public XF_RefCount, public XF_Base +class FlmStringAcc : public F_Object { public: FlmStringAcc() @@ -205,7 +203,7 @@ private: Class: FlmContext Desc: This class manages a context or environment of variables. ===========================================================================*/ -class FlmContext : public XF_RefCount, public XF_Base +class FlmContext : public F_Object { public: FlmContext( void); @@ -244,7 +242,7 @@ typedef FLMUINT (* THREAD_FUNC_p)( Class: FlmThreadContext Desc: This class manages a thread. ===========================================================================*/ -class FlmThreadContext : public XF_RefCount, public XF_Base +class FlmThreadContext : public F_Object { public: FlmThreadContext( void); @@ -289,12 +287,12 @@ public: FINLINE void setWindow( FTX_WINDOW * pWindow) { m_pWindow = pWindow; } FINLINE FTX_WINDOW * getWindow( void) { return( m_pWindow); } - FINLINE void setFlmThread( F_Thread * pThread) + FINLINE void setFlmThread( IF_Thread * pThread) { m_pThread = pThread; } - FINLINE F_Thread * getFlmThread( void) + FINLINE IF_Thread * getFlmThread( void) { return( m_pThread); } @@ -330,7 +328,7 @@ private: FlmThreadContext * m_pNext; FlmThreadContext * m_pPrev; F_MUTEX m_hMutex; - F_Thread * m_pThread; + IF_Thread * m_pThread; THREAD_FUNC_p m_pThrdFunc; void * m_pvAppData; #define MAX_THREAD_NAME_LEN 64 @@ -350,13 +348,7 @@ public: ~FlmSharedContext( void); RCODE init( // Initialized the share object. - FlmSharedContext * pSharedContext, - FTX_INFO * pFtxInfo); - - FINLINE FTX_INFO * getFtxInfo( void) - { - return( m_pFtxInfo); - } + FlmSharedContext * pSharedContext); FINLINE void setShutdownFlag( FLMBOOL * pbShutdownFlag) { @@ -402,25 +394,25 @@ private: FlmSharedContext * m_pParentContext; FLMBOOL m_bPrivateShare; - FTX_INFO * m_pFtxInfo; - F_MUTEX m_hMutex; // Semaphore for controlling multi-thread - // access. + F_MUTEX m_hMutex; F_SEM m_hSem; - FlmThreadContext * m_pThreadList; // List of registered threads + FlmThreadContext * m_pThreadList; FLMBOOL m_bLocalShutdownFlag; FLMBOOL * m_pbShutdownFlag; FLMUINT m_uiNextProcID; }; void utilOutputLine( char * pszData, void * pvUserData); + void utilPressAnyKey( char * pszPressAnyKeyMessage, void * pvUserData); + RCODE utilInitWindow( char * pszTitle, FLMUINT * puiScreenRows, - FTX_INFO ** ppFtxInfo, FTX_WINDOW ** ppMainWindow, FLMBOOL * pbShutdown); -void utilShutdownWindow( FTX_INFO * pFtxInfo); + +void utilShutdownWindow(); RCODE fileToString( char * pszFile, @@ -443,19 +435,132 @@ FLMUINT utilGetTimeString( // | // `---- RCODE utilWriteProperty( - char * pszFile, - char * pszProp, - char * pszValue); + char * pszFile, + char * pszProp, + char * pszValue); RCODE utilReadProperty( - char * pszFile, - char * pszProp, - FlmStringAcc * pAcc); + char * pszFile, + char * pszProp, + FlmStringAcc * pAcc); void scramble( - F_RandomGenerator * pRandGen, - FLMUINT * puiArray, - FLMUINT uiNumElems); + IF_RandomGenerator * pRandGen, + FLMUINT * puiArray, + FLMUINT uiNumElems); +typedef struct wps_screen +{ + FLMBOOL bPrivate; + FLMUINT uiScreenId; + FTX_SCREEN * pScreen; + FTX_WINDOW * pTitleWin; + FTX_WINDOW * pWin; + struct wps_screen * pNext; + void * hThis; +} WPSSCREEN, * WPSSCREEN_p; + +void WpsInit( + FLMUINT rows, + FLMUINT cols, + const char * title); + +void WpsExit( void); + +void WpsThrdInitUsingScreen( + FTX_SCREEN * pScreen, + const char * screenTitle); + +#define WpsThrdInit(a) \ + WpsThrdInitUsingScreen( NULL, (a)) + +void WpsThrdExit( void); + +void WpsWPOut( + FLMINT WPChr); + +void WpsStrOut( + const char * string); + +void WpsPrintf( + const char * pucFormat, ...); + +void WpsCPrintf( + eColorType background, + eColorType foreground, + const char * pucFormat, ...); + +void WpsOptimize( void); + +void WpsScrReset( void); + +#define WpsScrReset() \ + (WpsScrClr(0,0)) + +void WpsScrClr( + FLMUINT col, + FLMUINT row); + +void WpsScrPos( + FLMUINT col, + FLMUINT row); + +void WpsScrBackFor( + eColorType background, + eColorType forground); + +void WpsLineClr( + FLMUINT col, + FLMUINT row); + +FLMUINT WpsLineEd( + char * string, + FLMUINT maxLen, + FLMBOOL * pbShutdown); + +FLMUINT WpsLineEditExt( + char * pbyBuffer, + FLMUINT wBufSize, + FLMUINT wMaxWidth, + FLMBOOL * pbShutdown, + FLMUINT * pwTermChar); + +void WpsStrOutXY( + const char * string, + FLMUINT col, + FLMUINT row); + +#define WpsStrOutXY( string, col, row) \ + (WpsScrPos( col, row), WpsStrOut( string)) + +void WpsDrawBorder( void); + +void WpsCursorSetType( + FLMUINT uiType); + +void WpsCurOff( void); + +void WpsCurOn( void); + +void WpsScrSize( + FLMUINT * puiNumColsRV, + FLMUINT * puiNumRowsRV); + +FLMUINT WpsCurrRow( void); + +FLMUINT WpsCurrCol( void); + +FLMUINT WpkIncar( void); + +FLMUINT WpkGetChar( + FLMBOOL * pbShutdown); + +FLMUINT WpkTestKB( void); + +FTX_SCREEN * WpsGetThrdScreen( void); + +void WpsSetShutdown( + FLMBOOL * pbShutdown); + #endif // SHARUTIL_H diff --git a/xflaim/util/view.cpp b/xflaim/util/view.cpp index c5cf4ff..8bcadca 100644 --- a/xflaim/util/view.cpp +++ b/xflaim/util/view.cpp @@ -72,6 +72,7 @@ FSTATIC FLMBOOL ViewOpenFileDirect( void); static FLMBOOL bPauseBeforeExiting = FALSE; FLMUINT gv_uiTopLine = 0; FLMUINT gv_uiBottomLine = 0; +IF_DbSystem * gv_pDbSystem = NULL; /******************************************************************** Desc: ? @@ -91,16 +92,14 @@ int __cdecl main( #endif { #define MAX_ARGS 30 - FLMUINT uiArg; - FLMINT iArgCnt = (FLMINT)iArgC; - F_DbSystem dbSystem; - char * ppszArgs [MAX_ARGS]; - char szCommandBuffer [300]; - RCODE rc = NE_XFLM_OK; - - if( RC_BAD( rc = dbSystem.init())) + RCODE rc = NE_XFLM_OK; + FLMUINT uiArg; + FLMINT iArgCnt = (FLMINT)iArgC; + char * ppszArgs [MAX_ARGS]; + char szCommandBuffer [300]; + + if( RC_BAD( rc = FlmAllocDbSystem( &gv_pDbSystem))) { - ViewShowRCError( "calling dbsystem.init()", rc); goto Exit; } @@ -270,9 +269,15 @@ int __cdecl main( } uiArg++; } + + if( RC_BAD( rc = FlmAllocPool( &gv_pViewPool))) + { + goto Exit; + } - gv_ViewPool.poolInit(2048); - WpsScrBackFor( WPS_BLACK, WPS_WHITE); + gv_pViewPool->poolInit(2048); + + WpsScrBackFor( FLM_BLACK, FLM_WHITE); WpsScrClr( 0, 0); // Open the file @@ -323,9 +328,18 @@ Exit: viewGiveUpCPU(); } } + + if( gv_pViewPool) + { + gv_pViewPool->Release(); + } WpsExit(); - dbSystem.exit(); + + if( gv_pDbSystem) + { + gv_pDbSystem->Release(); + } #ifdef FLM_NLM if (!gv_bSynchronized) @@ -412,9 +426,9 @@ FSTATIC FLMUINT ViewGetChar( FLMUINT uiNumRows; WpsScrSize( &uiNumCols, &uiNumRows); - WpsScrBackFor( WPS_BLACK, WPS_WHITE); + WpsScrBackFor( FLM_BLACK, FLM_WHITE); WpsScrClr( 0, uiNumRows - 2); - WpsScrBackFor( WPS_RED, WPS_WHITE); + WpsScrBackFor( FLM_RED, FLM_WHITE); if (pszMessage1) { WpsStrOutXY( pszMessage1, 0, uiNumRows - 2); @@ -424,7 +438,7 @@ FSTATIC FLMUINT ViewGetChar( { if (gv_bShutdown) { - uiChar = WPK_ESCAPE; + uiChar = FKB_ESCAPE; break; } else if (WpkTestKB()) @@ -434,9 +448,9 @@ FSTATIC FLMUINT ViewGetChar( } viewGiveUpCPU(); } - WpsScrBackFor( WPS_BLACK, WPS_WHITE); + WpsScrBackFor( FLM_BLACK, FLM_WHITE); WpsScrClr( 0, uiNumRows - 2); - if (uiChar == WPK_ENTER) + if (uiChar == FKB_ENTER) { uiChar = uiDefaultChar; } @@ -464,8 +478,7 @@ Desc: Read the header information from the database -- this includes the file header and the log header. *****************************************************************************/ void ViewReadHdr( - FLMUINT32 * pui32CalcCRC - ) + FLMUINT32 * pui32CalcCRC) { RCODE rc; FLMUINT uiNumCols; @@ -485,7 +498,7 @@ void ViewReadHdr( // Make sure we have a valid block size - if (!F_DbSystem::validBlockSize((FLMUINT)gv_ViewDbHdr.ui16BlockSize)) + if( gv_ViewDbHdr.ui16BlockSize != 4096 && gv_ViewDbHdr.ui16BlockSize != 8192) { gv_ViewDbHdr.ui16BlockSize = XFLM_DEFAULT_BLKSIZ; } @@ -496,7 +509,7 @@ Desc: Ask for input from the user *********************************************************************/ void ViewAskInput( const char * pszPrompt, - const char * pszBuffer, + char * pszBuffer, FLMUINT uiBufLen) { char szTempBuf [80]; @@ -508,7 +521,7 @@ void ViewAskInput( } szTempBuf [0] = 0; WpsLineEd( szTempBuf, uiBufLen, &gv_bShutdown); - f_strcpy( pszBuffer, szTempBuf); + f_strcpy( (char *)pszBuffer, szTempBuf); } /*************************************************************************** @@ -521,7 +534,7 @@ FSTATIC FLMBOOL ViewGetFileName( { const char * pszPrompt = "Enter database file name: "; - WpsScrBackFor( WPS_BLACK, WPS_WHITE); + WpsScrBackFor( FLM_BLACK, FLM_WHITE); WpsScrClr( uiCol, uiRow); if (bDispOnly) { @@ -551,7 +564,7 @@ FSTATIC FLMBOOL ViewOpenFileDirect( void) RCODE rc; IF_FileHdl * pCFileHdl; - if (RC_BAD( rc = gv_pSFileHdl->GetFileHdl( 0, FALSE, &pCFileHdl))) + if (RC_BAD( rc = gv_pSFileHdl->getFileHdl( 0, FALSE, &pCFileHdl))) { ViewShowRCError( "opening file in direct mode", rc); return( FALSE); @@ -568,7 +581,6 @@ FSTATIC FLMBOOL ViewOpenFile( void) { RCODE rc; FLMBOOL bOk = FALSE; - F_DbSystem dbSystem; Get_File_Name: @@ -601,7 +613,7 @@ Get_File_Name: ViewShowRCError( "creating super file handle", rc); goto Exit; } - if (RC_BAD( rc = gv_pSFileHdl->Setup( NULL, gv_szViewFileName, gv_szDataDir))) + if (RC_BAD( rc = gv_pSFileHdl->setup( gv_szViewFileName, gv_szDataDir))) { ViewShowRCError( "setting up super file handle", rc); goto Exit; @@ -609,8 +621,8 @@ Get_File_Name: rc = ViewReadAndVerifyHdrInfo( NULL); - gv_pSFileHdl->ReleaseFiles(TRUE); - gv_pSFileHdl->SetBlockSize( (FLMUINT)gv_ViewDbHdr.ui16BlockSize); + gv_pSFileHdl->releaseFiles(TRUE); + gv_pSFileHdl->setBlockSize( (FLMUINT)gv_ViewDbHdr.ui16BlockSize); if (RC_BAD( rc)) { if (rc == NE_XFLM_IO_PATH_NOT_FOUND) @@ -623,9 +635,9 @@ Get_File_Name: } } - if (RC_BAD( rc = dbSystem.openDb( gv_szViewFileName, gv_szDataDir, - gv_szRflDir, gv_szPassword, XFLM_DONT_REDO_LOG, - (IF_Db **)&gv_hViewDb))) + if (RC_BAD( rc = gv_pDbSystem->dbOpen( gv_szViewFileName, gv_szDataDir, + gv_szRflDir, gv_szPassword, XFLM_DONT_REDO_LOG, + &gv_hViewDb))) { char szTBuf[ 100]; @@ -697,7 +709,7 @@ Desc: This routine gets the dictionary information for a database and RCODE ViewGetDictInfo( void) { RCODE rc = NE_XFLM_OK; - F_Db * pDb = gv_hViewDb; + IF_Db * pDb = gv_hViewDb; // FLMUINT uiSaveFlags; FLMUINT uiFlags; @@ -758,8 +770,8 @@ FSTATIC FLMBOOL ViewSetupMainMenu( void) VAL_IS_EMPTY, 0, 0, 0, 0xFFFFFFFF, 0, MOD_DISABLED, uiCol, uiRow++, MAIN_MENU_DB_HEADER, - WPS_BLACK, WPS_WHITE, - WPS_BLUE, WPS_WHITE)) + FLM_BLACK, FLM_WHITE, + FLM_BLUE, FLM_WHITE)) { goto Exit; } @@ -770,8 +782,8 @@ FSTATIC FLMBOOL ViewSetupMainMenu( void) VAL_IS_LABEL_INDEX, (FLMUINT)LBL_NONE, 0, 0, 0xFFFFFFFF, 0, MOD_DISABLED, uiCol, uiRow++, 0, - WPS_BLACK, WPS_LIGHTGRAY, - WPS_BLUE, WPS_LIGHTGRAY)) + FLM_BLACK, FLM_LIGHTGRAY, + FLM_BLUE, FLM_LIGHTGRAY)) { goto Exit; } @@ -782,8 +794,8 @@ FSTATIC FLMBOOL ViewSetupMainMenu( void) VAL_IS_EMPTY, 0, 0, 0, 0xFFFFFFFF, 0, MOD_DISABLED, uiCol, uiRow++, MAIN_MENU_LOGICAL_FILES, - WPS_BLACK, WPS_WHITE, - WPS_BLUE, WPS_WHITE)) + FLM_BLACK, FLM_WHITE, + FLM_BLUE, FLM_WHITE)) { goto Exit; } diff --git a/xflaim/util/view.h b/xflaim/util/view.h index d0fb26e..0aec1d3 100644 --- a/xflaim/util/view.h +++ b/xflaim/util/view.h @@ -28,7 +28,6 @@ #define VIEW_H #include "flaimsys.h" -#include "ftx.h" #include "sharutil.h" #ifdef MAIN_MODULE @@ -341,10 +340,10 @@ typedef struct View_Menu_Item FLMUINT uiCol; FLMUINT uiRow; FLMUINT uiOption; - FLMUINT uiUnselectBackColor; - FLMUINT uiUnselectForeColor; - FLMUINT uiSelectBackColor; - FLMUINT uiSelectForeColor; + eColorType uiUnselectBackColor; + eColorType uiUnselectForeColor; + eColorType uiSelectBackColor; + eColorType uiSelectForeColor; FLMINT iLabelIndex; // Signed number FLMUINT uiLabelWidth; FLMUINT uiHorizCurPos; @@ -447,7 +446,7 @@ EXTERN FLMBOOL gv_bViewSearching = FALSE #endif ; -EXTERN F_Db * gv_hViewDb +EXTERN IF_Db * gv_hViewDb #ifdef MAIN_MODULE = NULL #endif @@ -465,7 +464,7 @@ EXTERN FLMUINT gv_uiViewSearchLfNum; EXTERN FLMUINT gv_uiViewSearchLfType; EXTERN FLMBYTE gv_ucViewSearchKey[ XFLM_MAX_KEY_SIZE]; EXTERN FLMUINT gv_uiViewSearchKeyLen; -EXTERN F_Pool gv_ViewPool; +EXTERN IF_Pool * gv_pViewPool; EXTERN FLMUINT gv_uiViewTopRow; EXTERN FLMUINT gv_uiViewBottomRow; EXTERN F_TMSTAMP gv_ViewLastTime; @@ -578,10 +577,10 @@ FLMBOOL ViewAddMenuItem( // Source: viewmenu.cpp FLMUINT uiCol, FLMUINT uiRow, FLMUINT uiOption, - FLMUINT uiUnselectBackColor, - FLMUINT uiUnselectForeColor, - FLMUINT uiSelectBackColor, - FLMUINT uiSelectForeColor); + eColorType uiUnselectBackColor, + eColorType uiUnselectForeColor, + eColorType uiSelectBackColor, + eColorType uiSelectForeColor); FLMUINT ViewGetMenuOption( void); // Source: viewmenu.cpp @@ -702,7 +701,7 @@ void FormatLFType( // Source: viewlfil.cpp void ViewAskInput( // Source: view.cpp const char * pszPrompt, - const char * pszBuffer, + char * pszBuffer, FLMUINT uiBufLen); FLMBOOL ViewEdit( // Source: viewedit.cpp diff --git a/xflaim/util/viewblk.cpp b/xflaim/util/viewblk.cpp index cf2fb0c..a009f5d 100644 --- a/xflaim/util/viewblk.cpp +++ b/xflaim/util/viewblk.cpp @@ -39,12 +39,12 @@ FSTATIC FLMBOOL TestStatusBit( FSTATIC FLMBOOL OutBlkHdrExpNum( FLMUINT uiCol, FLMUINT * puiRow, - FLMUINT uiBackColor, - FLMUINT uiForeColor, - FLMUINT uiUnselectBackColor, - FLMUINT uiUnselectForeColor, - FLMUINT uiSelectBackColor, - FLMUINT uiSelectForeColor, + eColorType uiBackColor, + eColorType uiForeColor, + eColorType uiUnselectBackColor, + eColorType uiUnselectForeColor, + eColorType uiSelectBackColor, + eColorType uiSelectForeColor, FLMUINT uiLabelWidth, FLMINT iLabelIndex, FLMUINT uiFileNumber, @@ -64,8 +64,8 @@ FSTATIC void FormatBlkType( FSTATIC FLMBOOL OutputStatus( FLMUINT uiCol, FLMUINT * puiRow, - FLMUINT uiBackColor, - FLMUINT uiForeColor, + eColorType uiBackColor, + eColorType uiForeColor, FLMUINT uiLabelWidth, FLMINT iLabelIndex, FLMBYTE * pucStatusFlags @@ -98,8 +98,8 @@ FSTATIC FLMBOOL OutputNonLeafElements( FSTATIC FLMBOOL OutputDomNode( FLMUINT uiCol, FLMUINT * puiRow, - FLMUINT uiBackColor, - FLMUINT uiForeColor, + eColorType uiBackColor, + eColorType uiForeColor, FLMBYTE * pucVal, STATE_INFO * pStateInfo); @@ -175,8 +175,8 @@ Desc: This routine outputs all of the status bits which were set for FSTATIC FLMBOOL OutputStatus( FLMUINT uiCol, FLMUINT * puiRow, - FLMUINT uiBackColor, - FLMUINT uiForeColor, + eColorType uiBackColor, + eColorType uiForeColor, FLMUINT uiLabelWidth, FLMINT iLabelIndex, FLMBYTE * pucStatusFlags @@ -200,8 +200,8 @@ FSTATIC FLMBOOL OutputStatus( VAL_IS_ERR_INDEX, (FLMUINT64)iError, 0, 0, VIEW_INVALID_FILE_OFFSET, 0, MOD_DISABLED, uiCol, uiRow++, 0, - WPS_RED, WPS_LIGHTGRAY, - WPS_RED, WPS_LIGHTGRAY)) + FLM_RED, FLM_LIGHTGRAY, + FLM_RED, FLM_LIGHTGRAY)) { goto Exit; } @@ -274,7 +274,7 @@ FLMBOOL ViewBlkRead( // Read the block into memory - if (RC_BAD( rc = gv_pSFileHdl->ReadBlock( uiBlkAddress, uiReadLen, + if (RC_BAD( rc = gv_pSFileHdl->readBlock( uiBlkAddress, uiReadLen, pBlkHdr, puiBytesRead))) { if (rc == NE_XFLM_IO_END_OF_FILE) @@ -473,25 +473,24 @@ Desc: This routine outputs one of the number fields in the block in the block header where we expect certain values. *****************************************************************************/ FSTATIC FLMBOOL OutBlkHdrExpNum( - FLMUINT uiCol, - FLMUINT * puiRow, - FLMUINT uiBackColor, - FLMUINT uiForeColor, - FLMUINT uiUnselectBackColor, - FLMUINT uiUnselectForeColor, - FLMUINT uiSelectBackColor, - FLMUINT uiSelectForeColor, - FLMUINT uiLabelWidth, - FLMINT iLabelIndex, - FLMUINT uiFileNumber, - FLMUINT uiFileOffset, - void * pvValue, - FLMUINT uiValueType, - FLMUINT uiModType, - FLMUINT64 ui64ExpNum, - FLMUINT64 ui64IgnoreExpNum, - FLMUINT uiOption - ) + FLMUINT uiCol, + FLMUINT * puiRow, + eColorType uiBackColor, + eColorType uiForeColor, + eColorType uiUnselectBackColor, + eColorType uiUnselectForeColor, + eColorType uiSelectBackColor, + eColorType uiSelectForeColor, + FLMUINT uiLabelWidth, + FLMINT iLabelIndex, + FLMUINT uiFileNumber, + FLMUINT uiFileOffset, + void * pvValue, + FLMUINT uiValueType, + FLMUINT uiModType, + FLMUINT64 ui64ExpNum, + FLMUINT64 ui64IgnoreExpNum, + FLMUINT uiOption) { FLMBOOL bOk = FALSE; FLMUINT uiRow = *puiRow; @@ -534,8 +533,8 @@ FSTATIC FLMBOOL OutBlkHdrExpNum( uiValueType, ui64ExpNum, 0, 0, VIEW_INVALID_FILE_OFFSET, 0, MOD_DISABLED, uiCol + uiLabelWidth + 1, uiRow++, 0, - WPS_RED, WPS_LIGHTGRAY, - WPS_RED, WPS_LIGHTGRAY)) + FLM_RED, FLM_LIGHTGRAY, + FLM_RED, FLM_LIGHTGRAY)) { goto Exit; } @@ -599,31 +598,31 @@ FLMBOOL ViewOutBlkHdr( FLMUINT32 ui32BlkCRC ) { - FLMBOOL bOk = FALSE; - FLMUINT uiLabelWidth = 35; - FLMUINT uiRow = *puiRow; - char szTempBuf [80]; - FLMUINT uiBlkAddress; - FLMUINT uiEndOfBlock; - FLMUINT uiBytesUsed; - FLMUINT uiPercentFull; - FLMUINT uiOption; - FLMUINT uiBackColor = WPS_BLACK; - FLMUINT uiForeColor = WPS_LIGHTGRAY; - FLMUINT uiUnselectBackColor = WPS_BLACK; - FLMUINT uiUnselectForeColor = WPS_WHITE; - FLMUINT uiSelectBackColor = WPS_BLUE; - FLMUINT uiSelectForeColor = WPS_WHITE; - F_LF_HDR lfHdr; - char szLfName [80]; - FLMUINT uiLfNum; - eLFileType eLfType; - FLMUINT uiTempFileOffset; + FLMBOOL bOk = FALSE; + FLMUINT uiLabelWidth = 35; + FLMUINT uiRow = *puiRow; + char szTempBuf [80]; + FLMUINT uiBlkAddress; + FLMUINT uiEndOfBlock; + FLMUINT uiBytesUsed; + FLMUINT uiPercentFull; + FLMUINT uiOption; + eColorType uiBackColor = FLM_BLACK; + eColorType uiForeColor = FLM_LIGHTGRAY; + eColorType uiUnselectBackColor = FLM_BLACK; + eColorType uiUnselectForeColor = FLM_WHITE; + eColorType uiSelectBackColor = FLM_BLUE; + eColorType uiSelectForeColor = FLM_WHITE; + F_LF_HDR lfHdr; + char szLfName [80]; + FLMUINT uiLfNum; + eLFileType eLfType; + FLMUINT uiTempFileOffset; // Output the block Header address - if (!OutBlkHdrExpNum( uiCol, &uiRow, WPS_RED, WPS_LIGHTGRAY, - WPS_RED, WPS_WHITE, uiSelectBackColor, uiSelectForeColor, + if (!OutBlkHdrExpNum( uiCol, &uiRow, FLM_RED, FLM_LIGHTGRAY, + FLM_RED, FLM_WHITE, uiSelectBackColor, uiSelectForeColor, uiLabelWidth, LBL_BLOCK_ADDRESS_BLOCK_HEADER, FSGetFileNumber( pBlkExp->uiBlkAddr), FSGetFileOffset( pBlkExp->uiBlkAddr), @@ -710,10 +709,10 @@ FLMBOOL ViewOutBlkHdr( F_BLK_HDR_ui32PriorBlkImgAddr_OFFSET, 0, MOD_FLMUINT32 | MOD_HEX | MOD_NATIVE, uiCol, uiRow++, uiOption, - (FLMBYTE)(!uiOption ? uiBackColor : uiUnselectBackColor), - (FLMBYTE)(!uiOption ? uiForeColor : uiUnselectForeColor), - (FLMBYTE)(!uiOption ? uiBackColor : uiSelectBackColor), - (FLMBYTE)(!uiOption ? uiForeColor : uiSelectForeColor))) + (!uiOption ? uiBackColor : uiUnselectBackColor), + (!uiOption ? uiForeColor : uiUnselectForeColor), + (!uiOption ? uiBackColor : uiSelectBackColor), + (!uiOption ? uiForeColor : uiSelectForeColor))) { goto Exit; } @@ -928,18 +927,10 @@ FLMBOOL ViewOutBlkHdr( F_BTREE_BLK_HDR_ui16LogicalFile_OFFSET, 0, MOD_FLMUINT16 | MOD_DECIMAL | MOD_NATIVE, uiCol, uiRow++, uiOption, - (FLMBYTE)(!uiOption ? - (FLMBYTE)uiBackColor - : (FLMBYTE)uiUnselectBackColor), - (FLMBYTE)(!uiOption - ? (FLMBYTE)uiForeColor - : (FLMBYTE)uiUnselectForeColor), - (FLMBYTE)(!uiOption - ? (FLMBYTE)uiBackColor - : (FLMBYTE)uiSelectBackColor), - (FLMBYTE)(!uiOption - ? (FLMBYTE)uiForeColor - : (FLMBYTE)uiSelectForeColor))) + (!uiOption ? uiBackColor : uiUnselectBackColor), + (!uiOption ? uiForeColor : uiUnselectForeColor), + (!uiOption ? uiBackColor : uiSelectBackColor), + (!uiOption ? uiForeColor : uiSelectForeColor))) { goto Exit; } @@ -1132,17 +1123,16 @@ Desc: This routine outputs a stream of FLMBYTEs in hex format. This element. *****************************************************************************/ FLMBOOL OutputHexValue( - FLMUINT uiCol, - FLMUINT * puiRow, - FLMUINT uiBackColor, - FLMUINT uiForeColor, - FLMINT iLabelIndex, - FLMUINT uiFileNumber, - FLMUINT uiFileOffset, - FLMBYTE * pucVal, - FLMUINT uiValLen, - FLMBOOL bCopyVal - ) + FLMUINT uiCol, + FLMUINT * puiRow, + eColorType uiBackColor, + eColorType uiForeColor, + FLMINT iLabelIndex, + FLMUINT uiFileNumber, + FLMUINT uiFileOffset, + FLMBYTE * pucVal, + FLMUINT uiValLen, + FLMBOOL bCopyVal) { FLMBOOL bOk = FALSE; FLMUINT uiRow = *puiRow; @@ -1202,8 +1192,8 @@ Desc: This routine outputs the content of a DOM node in the Element FSTATIC FLMBOOL OutputDomNode( FLMUINT uiCol, FLMUINT * puiRow, - FLMUINT uiBackColor, - FLMUINT uiForeColor, + eColorType uiBackColor, + eColorType uiForeColor, FLMBYTE * pucVal, STATE_INFO * pStateInfo) { @@ -1317,10 +1307,10 @@ FSTATIC FLMBOOL OutputDomNode( else { pucTmp = pucData; - uiSENLength = gv_ucSENLengthArray[ *pucTmp]; + uiSENLength = f_getSENLength( *pucTmp); if (uiNumBytes >= uiSENLength) { - if( RC_BAD( rc = flmDecodeSEN( &pucTmp, + if( RC_BAD( rc = f_decodeSEN( &pucTmp, &pucTmp[ FLM_MAX_NUM_BUF_SIZE], &uiValue))) { goto Exit; @@ -1377,10 +1367,10 @@ FSTATIC FLMBOOL OutputDomNode( else { pucTmp = pucData; - uiSENLength = gv_ucSENLengthArray[ *pucTmp]; + uiSENLength = f_getSENLength( *pucTmp); if (uiNumBytes >= uiSENLength) { - if( RC_BAD( rc = flmDecodeSEN( &pucTmp, + if( RC_BAD( rc = f_decodeSEN( &pucTmp, &pucTmp[ FLM_MAX_NUM_BUF_SIZE], &uiValue))) { goto Exit; @@ -1437,10 +1427,10 @@ FSTATIC FLMBOOL OutputDomNode( { // Base ID (required) pucTmp = pucData; - uiSENLength = gv_ucSENLengthArray[ *pucTmp]; + uiSENLength = f_getSENLength( *pucTmp); if (uiNumBytes >= uiSENLength) { - if( RC_BAD( rc = flmDecodeSEN64( &pucTmp, + if( RC_BAD( rc = f_decodeSEN64( &pucTmp, &pucTmp[ FLM_MAX_NUM_BUF_SIZE], &ui64Value))) { goto Exit; @@ -1494,10 +1484,10 @@ FSTATIC FLMBOOL OutputDomNode( else { pucTmp = pucData; - uiSENLength = gv_ucSENLengthArray[ *pucTmp]; + uiSENLength = f_getSENLength( *pucTmp); if (uiNumBytes >= uiSENLength) { - if( RC_BAD( rc = flmDecodeSEN64( &pucTmp, + if( RC_BAD( rc = f_decodeSEN64( &pucTmp, &pucTmp[ FLM_MAX_NUM_BUF_SIZE], &ui64Value))) { goto Exit; @@ -1550,10 +1540,10 @@ FSTATIC FLMBOOL OutputDomNode( else { pucTmp = pucData; - uiSENLength = gv_ucSENLengthArray[ *pucTmp]; + uiSENLength = f_getSENLength( *pucTmp); if (uiNumBytes >= uiSENLength) { - if( RC_BAD( rc = flmDecodeSEN64( &pucTmp, + if( RC_BAD( rc = f_decodeSEN64( &pucTmp, &pucTmp[ FLM_MAX_NUM_BUF_SIZE], &ui64Value))) { goto Exit; @@ -1610,10 +1600,10 @@ FSTATIC FLMBOOL OutputDomNode( { // Previous pucTmp = pucData; - uiSENLength = gv_ucSENLengthArray[ *pucTmp]; + uiSENLength = f_getSENLength( *pucTmp); if (uiNumBytes >= uiSENLength) { - if( RC_BAD( rc = flmDecodeSEN64( &pucTmp, + if( RC_BAD( rc = f_decodeSEN64( &pucTmp, &pucTmp[ FLM_MAX_NUM_BUF_SIZE], &ui64Value))) { goto Exit; @@ -1668,10 +1658,10 @@ FSTATIC FLMBOOL OutputDomNode( { // Next pucTmp = pucData; - uiSENLength = gv_ucSENLengthArray[ *pucTmp]; + uiSENLength = f_getSENLength( *pucTmp); if (uiNumBytes >= uiSENLength) { - if( RC_BAD( rc = flmDecodeSEN64( &pucTmp, + if( RC_BAD( rc = f_decodeSEN64( &pucTmp, &pucTmp[ FLM_MAX_NUM_BUF_SIZE], &ui64Value))) { goto Exit; @@ -1729,10 +1719,10 @@ FSTATIC FLMBOOL OutputDomNode( else { pucTmp = pucData; - uiSENLength = gv_ucSENLengthArray[ *pucTmp]; + uiSENLength = f_getSENLength( *pucTmp); if (uiNumBytes >= uiSENLength) { - if( RC_BAD( rc = flmDecodeSEN64( &pucTmp, + if( RC_BAD( rc = f_decodeSEN64( &pucTmp, &pucTmp[ FLM_MAX_NUM_BUF_SIZE], &ui64Value))) { goto Exit; @@ -1787,10 +1777,10 @@ FSTATIC FLMBOOL OutputDomNode( else { pucTmp = pucData; - uiSENLength = gv_ucSENLengthArray[ *pucTmp]; + uiSENLength = f_getSENLength( *pucTmp); if (uiNumBytes >= uiSENLength) { - if( RC_BAD( rc = flmDecodeSEN64( &pucTmp, + if( RC_BAD( rc = f_decodeSEN64( &pucTmp, &pucTmp[ FLM_MAX_NUM_BUF_SIZE], &ui64Value))) { goto Exit; @@ -1847,10 +1837,10 @@ FSTATIC FLMBOOL OutputDomNode( else { pucTmp = pucData; - uiSENLength = gv_ucSENLengthArray[ *pucTmp]; + uiSENLength = f_getSENLength( *pucTmp); if (uiNumBytes >= uiSENLength) { - if( RC_BAD( rc = flmDecodeSEN64( &pucTmp, + if( RC_BAD( rc = f_decodeSEN64( &pucTmp, &pucTmp[ FLM_MAX_NUM_BUF_SIZE], &ui64Value))) { goto Exit; @@ -1930,12 +1920,12 @@ FSTATIC FLMBOOL OutputLeafElements( // what this is used for and find a way to make it meaningful. FLMBOOL bOk = FALSE; FLMUINT uiLabelWidth = 30; - FLMUINT uiBackColor = WPS_BLACK; - FLMUINT uiForeColor = WPS_LIGHTGRAY; - FLMUINT uiUnselectBackColor = WPS_BLACK; - FLMUINT uiUnselectForeColor = WPS_WHITE; - FLMUINT uiSelectBackColor = WPS_BLUE; - FLMUINT uiSelectForeColor = WPS_WHITE; + eColorType uiBackColor = FLM_BLACK; + eColorType uiForeColor = FLM_LIGHTGRAY; + eColorType uiUnselectBackColor = FLM_BLACK; + eColorType uiUnselectForeColor = FLM_WHITE; + eColorType uiSelectBackColor = FLM_BLUE; + eColorType uiSelectForeColor = FLM_WHITE; FLMUINT uiRow = *puiRow; FLMUINT uiElementCount = 0; FLMINT iErrorCode; @@ -2016,8 +2006,8 @@ FSTATIC FLMBOOL OutputLeafElements( VIEW_INVALID_FILE_OFFSET, 0, MOD_DISABLED, uiCol, uiRow++, 0, - WPS_GREEN, WPS_WHITE, - WPS_GREEN, WPS_WHITE)) + FLM_GREEN, FLM_WHITE, + FLM_GREEN, FLM_WHITE)) { goto Exit; } @@ -2197,10 +2187,10 @@ FSTATIC FLMBOOL OutputLeafElements( FSGetFileOffset( StateInfo.ui32BlkAddress) + StateInfo.uiElmDataOffset, 0, MOD_DISABLED, uiCol, uiRow++, uiOption, - (FLMBYTE)(!uiOption ? uiBackColor : uiUnselectBackColor), - (FLMBYTE)(!uiOption ? uiForeColor : uiUnselectForeColor), - (FLMBYTE)(!uiOption ? uiBackColor : uiSelectBackColor), - (FLMBYTE)(!uiOption ? uiForeColor : uiSelectForeColor))) + (!uiOption ? uiBackColor : uiUnselectBackColor), + (!uiOption ? uiForeColor : uiUnselectForeColor), + (!uiOption ? uiBackColor : uiSelectBackColor), + (!uiOption ? uiForeColor : uiSelectForeColor))) { goto Exit; } @@ -2288,8 +2278,8 @@ FSTATIC FLMBOOL OutputDataOnlyElements( { FLMBOOL bOk = FALSE; FLMUINT uiLabelWidth = 30; - FLMUINT uiBackColor = WPS_BLACK; - FLMUINT uiForeColor = WPS_LIGHTGRAY; + eColorType uiBackColor = FLM_BLACK; + eColorType uiForeColor = FLM_LIGHTGRAY; FLMUINT uiRow = *puiRow; FLMINT iErrorCode; // LFileType eLfType = LF_INVALID; @@ -2604,12 +2594,12 @@ FSTATIC FLMBOOL OutputNonLeafElements( { FLMBOOL bOk = FALSE; FLMUINT uiLabelWidth = 30; - FLMUINT uiBackColor = WPS_BLACK; - FLMUINT uiForeColor = WPS_LIGHTGRAY; - FLMUINT uiUnselectBackColor = WPS_BLACK; - FLMUINT uiUnselectForeColor = WPS_WHITE; - FLMUINT uiSelectBackColor = WPS_BLUE; - FLMUINT uiSelectForeColor = WPS_WHITE; + eColorType uiBackColor = FLM_BLACK; + eColorType uiForeColor = FLM_LIGHTGRAY; + eColorType uiUnselectBackColor = FLM_BLACK; + eColorType uiUnselectForeColor = FLM_WHITE; + eColorType uiSelectBackColor = FLM_BLUE; + eColorType uiSelectForeColor = FLM_WHITE; FLMUINT uiRow = *puiRow; FLMUINT uiElementCount = 0; // FLMBYTE * pucTmpAddr; @@ -2724,8 +2714,8 @@ FSTATIC FLMBOOL OutputNonLeafElements( VIEW_INVALID_FILE_OFFSET, 0, MOD_DISABLED, uiCol, uiRow++, 0, - WPS_GREEN, WPS_WHITE, - WPS_GREEN, WPS_WHITE)) + FLM_GREEN, FLM_WHITE, + FLM_GREEN, FLM_WHITE)) { goto Exit; } @@ -2778,10 +2768,10 @@ FSTATIC FLMBOOL OutputNonLeafElements( FSGetFileOffset( StateInfo.ui32BlkAddress) + StateInfo.uiElmOffset, 0, MOD_CHILD_BLK, uiCol, uiRow++, uiOption, - (FLMBYTE)(!uiOption ? uiBackColor : uiUnselectBackColor), - (FLMBYTE)(!uiOption ? uiForeColor : uiUnselectForeColor), - (FLMBYTE)(!uiOption ? uiBackColor : uiSelectBackColor), - (FLMBYTE)(!uiOption ? uiForeColor : uiSelectForeColor))) + (!uiOption ? uiBackColor : uiUnselectBackColor), + (!uiOption ? uiForeColor : uiUnselectForeColor), + (!uiOption ? uiBackColor : uiSelectBackColor), + (!uiOption ? uiForeColor : uiSelectForeColor))) { goto Exit; } @@ -2996,8 +2986,8 @@ void ViewHexBlock( (FLMUINT)pucBlk, uiNumBytes, uiFileNumber, uiFileOffset, uiNumBytes, MOD_BINARY, uiCol, uiRow++, 0, - WPS_BLACK, WPS_LIGHTGRAY, - WPS_BLACK, WPS_LIGHTGRAY)) + FLM_BLACK, FLM_LIGHTGRAY, + FLM_BLACK, FLM_LIGHTGRAY)) { return; } @@ -3247,7 +3237,7 @@ Switch_Statement: pMenuItem = pMenuItem->pNextItem; } pszTmp = (FLMBYTE *)((FLMUINT)pMenuItem->ui64Value); - if (f_stricmp( pszTmp, COLLECTION_STRING) == 0) + if (f_stricmp( (const char *)pszTmp, COLLECTION_STRING) == 0) { gv_uiViewSearchLfType = XFLM_LF_COLLECTION; } @@ -3354,7 +3344,7 @@ FLMBOOL GetBlockAddrType( for (;;) { bBadDigit = FALSE; - WpsScrBackFor( WPS_BLACK, WPS_WHITE); + WpsScrBackFor( FLM_BLACK, FLM_WHITE); WpsScrClr( 0, uiNumRows - 2); ViewAskInput( "Enter Block Address (in hex): ", diff --git a/xflaim/util/viewdisp.cpp b/xflaim/util/viewdisp.cpp index 1cca6f1..e7f8b40 100644 --- a/xflaim/util/viewdisp.cpp +++ b/xflaim/util/viewdisp.cpp @@ -37,20 +37,20 @@ void ViewShowError( FLMUINT uiNumRows; WpsScrSize( &uiNumCols, &uiNumRows); - WpsScrBackFor( WPS_BLACK, WPS_WHITE); + WpsScrBackFor( FLM_BLACK, FLM_WHITE); WpsScrClr( 0, uiNumRows - 2); - WpsScrBackFor( WPS_RED, WPS_WHITE); + WpsScrBackFor( FLM_RED, FLM_WHITE); WpsStrOutXY( pszMessage, 0, uiNumRows - 2); WpsStrOutXY( "Press ENTER to continue: ", 0, uiNumRows - 1); for (;;) { uiChar = (FLMUINT)WpkIncar(); - if (uiChar == WPK_ENTER || uiChar == WPK_ESCAPE) + if (uiChar == FKB_ENTER || uiChar == FKB_ESCAPE) { break; } } - WpsScrBackFor( WPS_BLACK, WPS_WHITE); + WpsScrBackFor( FLM_BLACK, FLM_WHITE); WpsScrClr( 0, uiNumRows - 2); ViewEscPrompt(); } diff --git a/xflaim/util/viewedit.cpp b/xflaim/util/viewedit.cpp index 594be4c..6747631 100644 --- a/xflaim/util/viewedit.cpp +++ b/xflaim/util/viewedit.cpp @@ -67,12 +67,12 @@ FLMBOOL ViewGetNum( for (;;) { bGetOK = TRUE; - WpsScrBackFor( WPS_BLACK, WPS_WHITE); + WpsScrBackFor( FLM_BLACK, FLM_WHITE); WpsScrClr( 0, uiNumRows - 2); ViewAskInput( pszPrompt, szTempBuf, sizeof( szTempBuf)); - WpsScrBackFor( WPS_BLACK, WPS_WHITE); + WpsScrBackFor( FLM_BLACK, FLM_WHITE); WpsScrClr( 0, uiNumRows - 2); - if (f_stricmp( szTempBuf, (FLMBYTE *)"\\") == 0) + if (f_stricmp( szTempBuf, "\\") == 0) { *pbValEntered = FALSE; goto Exit; @@ -220,12 +220,13 @@ FLMBOOL ViewEditText( FLMUINT uiNumRows; WpsScrSize( &uiNumCols, &uiNumRows); - WpsScrBackFor( WPS_BLACK, WPS_WHITE); + WpsScrBackFor( FLM_BLACK, FLM_WHITE); WpsScrClr( 0, uiNumRows - 2); ViewAskInput( pszPrompt, szTempBuf, sizeof( szTempBuf) - 1); - WpsScrBackFor( WPS_BLACK, WPS_WHITE); + WpsScrBackFor( FLM_BLACK, FLM_WHITE); WpsScrClr( 0, uiNumRows - 2); - if (f_stricmp( szTempBuf, (FLMBYTE *)"\\") == 0) + + if (f_stricmp( szTempBuf, "\\") == 0) { *pbValEntered = FALSE; return( FALSE); @@ -278,7 +279,7 @@ FLMBOOL ViewEditLanguage( { szTempBuf [1] = szTempBuf [1] - 'a' + 'A'; } - uiTempNum = F_DbSystem::languageToNum( szTempBuf); + uiTempNum = f_languageToNum( szTempBuf); } if (uiTempNum == 0 && (szTempBuf [0] != 'U' || szTempBuf [1] != 'S')) @@ -318,10 +319,10 @@ FLMBOOL ViewEditBinary( } for (;;) { - WpsScrBackFor( WPS_BLACK, WPS_WHITE); + WpsScrBackFor( FLM_BLACK, FLM_WHITE); WpsScrClr( 0, uiNumRows - 2); ViewAskInput( pszPrompt, szTempBuf, sizeof( szTempBuf)); - WpsScrBackFor( WPS_BLACK, WPS_WHITE); + WpsScrBackFor( FLM_BLACK, FLM_WHITE); WpsScrClr( 0, uiNumRows - 2); if( f_stricmp( szTempBuf, "\\") == 0) { @@ -493,7 +494,7 @@ FLMBOOL ViewEdit( } // Need to know make a SEN out of this first. - uiSENLen = flmEncodeSEN( ui64Num, &pucSENBuffer); + uiSENLen = f_encodeSEN( ui64Num, &pucSENBuffer); break; case MOD_SEN9: @@ -507,7 +508,7 @@ FLMBOOL ViewEdit( } // Need to know make a SEN out of this first. - uiSENLen = flmEncodeSEN( ui64Num, &pucSENBuffer); + uiSENLen = f_encodeSEN( ui64Num, &pucSENBuffer); break; case MOD_FLMUINT64: @@ -689,14 +690,14 @@ FLMBOOL ViewEdit( FLMUINT64 ui64Value; FLMUINT uiOrigSENLen; - if (RC_BAD( rc = flmDecodeSEN64( &pucOrigSEN, + if (RC_BAD( rc = f_decodeSEN64( &pucOrigSEN, (FLMBYTE *)pBlkHdr + gv_ViewDbHdr.ui16BlockSize, &ui64Value))) { ViewShowRCError( "Decoding original SEN value", rc); } - uiOrigSENLen = flmEncodeSEN( ui64Value, &pucBuffer); + uiOrigSENLen = f_encodeSEN( ui64Value, &pucBuffer); if (uiOrigSENLen != uiSENLen) { @@ -747,19 +748,19 @@ FLMBOOL ViewEdit( } } - if (RC_BAD( rc = gv_pSFileHdl->GetFileHdl( uiFileNumber, TRUE, &pFileHdl))) + if (RC_BAD( rc = gv_pSFileHdl->getFileHdl( uiFileNumber, TRUE, &pFileHdl))) { ViewShowRCError( "getting file handle", rc); } // Write the data out to the file - else if (RC_BAD( rc = pFileHdl->Write( uiFileOffset, uiBytesToWrite, + else if (RC_BAD( rc = pFileHdl->write( uiFileOffset, uiBytesToWrite, pBlkHdr, &uiBytesWritten))) { ViewShowRCError( "updating file", rc); } - else if (RC_BAD( rc = pFileHdl->Flush())) + else if (RC_BAD( rc = pFileHdl->flush())) { ViewShowRCError( "flushing data to file", rc); } diff --git a/xflaim/util/viewhdr.cpp b/xflaim/util/viewhdr.cpp index c54b341..0fc3306 100644 --- a/xflaim/util/viewhdr.cpp +++ b/xflaim/util/viewhdr.cpp @@ -106,18 +106,18 @@ Desc: This routine displays the information found in a log header and FSTATIC FLMBOOL ViewSetupDbHdrMenu( void) { #define LABEL_WIDTH 35 - FLMBOOL bOk = FALSE; - FLMUINT uiRow; - FLMUINT uiCol; - FLMUINT uiBackColor = WPS_BLACK; - FLMUINT uiForeColor = WPS_LIGHTGRAY; - FLMUINT uiUnselectBackColor = WPS_BLACK; - FLMUINT uiUnselectForeColor = WPS_WHITE; - FLMUINT uiSelectBackColor = WPS_BLUE; - FLMUINT uiSelectForeColor = WPS_WHITE; - FLMUINT uiOption; - char szBuf [64]; - FLMUINT32 ui32CalcCRC; + FLMBOOL bOk = FALSE; + FLMUINT uiRow; + FLMUINT uiCol; + eColorType uiBackColor = FLM_BLACK; + eColorType uiForeColor = FLM_LIGHTGRAY; + eColorType uiUnselectBackColor = FLM_BLACK; + eColorType uiUnselectForeColor = FLM_WHITE; + eColorType uiSelectBackColor = FLM_BLUE; + eColorType uiSelectForeColor = FLM_WHITE; + FLMUINT uiOption; + char szBuf [64]; + FLMUINT32 ui32CalcCRC; // Re-read the header information in case it has changed. @@ -156,7 +156,7 @@ FSTATIC FLMBOOL ViewSetupDbHdrMenu( void) } // Display the default language - F_DbSystem::languageToStr( (FLMUINT)gv_ViewDbHdr.ui8DefaultLanguage, szBuf); + f_languageToStr( (FLMUINT)gv_ViewDbHdr.ui8DefaultLanguage, szBuf); if (!ViewAddMenuItem( LBL_DEFAULT_LANGUAGE, LABEL_WIDTH, VAL_IS_TEXT_PTR, (FLMUINT64)((FLMUINT)(&szBuf[ 0])), 0, diff --git a/xflaim/util/viewlfil.cpp b/xflaim/util/viewlfil.cpp index 72f1fbb..90fa5d3 100644 --- a/xflaim/util/viewlfil.cpp +++ b/xflaim/util/viewlfil.cpp @@ -67,26 +67,25 @@ Desc: This routine outputs the information in a single LFH - for a single logical file - FLAIM 1.5 and above. *****************************************************************************/ FSTATIC FLMBOOL ViewOutputLFH( - FLMUINT uiCol, - FLMUINT * puiRow, - F_LF_HDR * pLfHdr, - FLMUINT uiLfCount, - FLMUINT uiFileOffset - ) + FLMUINT uiCol, + FLMUINT * puiRow, + F_LF_HDR * pLfHdr, + FLMUINT uiLfCount, + FLMUINT uiFileOffset) { - FLMBOOL bOk = FALSE; - FLMUINT uiLabelWidth = 35; - FLMUINT uiRow = *puiRow; - FLMUINT uiBlkAddress; - char szTempBuf [80]; - FLMUINT uiBackColor = WPS_BLACK; - FLMUINT uiForeColor = WPS_LIGHTGRAY; - FLMUINT uiUnselectBackColor = WPS_BLACK; - FLMUINT uiUnselectForeColor = WPS_WHITE; - FLMUINT uiSelectBackColor = WPS_BLUE; - FLMUINT uiSelectForeColor = WPS_WHITE; - FLMUINT uiOption; - FLMUINT uiLfNum; + FLMBOOL bOk = FALSE; + FLMUINT uiLabelWidth = 35; + FLMUINT uiRow = *puiRow; + FLMUINT uiBlkAddress; + char szTempBuf [80]; + eColorType uiBackColor = FLM_BLACK; + eColorType uiForeColor = FLM_LIGHTGRAY; + eColorType uiUnselectBackColor = FLM_BLACK; + eColorType uiUnselectForeColor = FLM_WHITE; + eColorType uiSelectBackColor = FLM_BLUE; + eColorType uiSelectForeColor = FLM_WHITE; + FLMUINT uiOption; + FLMUINT uiLfNum; // Output Logical File Name @@ -132,8 +131,8 @@ FSTATIC FLMBOOL ViewOutputLFH( (FLMUINT64)((FLMUINT)(&szTempBuf [0])), 0, 0, VIEW_INVALID_FILE_OFFSET, (FLMUINT)f_strlen( szTempBuf), MOD_DISABLED, - uiCol, uiRow++, 0, WPS_GREEN, WPS_WHITE, - WPS_GREEN, WPS_WHITE)) + uiCol, uiRow++, 0, FLM_GREEN, FLM_WHITE, + FLM_GREEN, FLM_WHITE)) { goto Exit; } @@ -186,10 +185,10 @@ FSTATIC FLMBOOL ViewOutputLFH( 0, uiFileOffset + F_LF_HDR_ui32RootBlkAddr_OFFSET, 0, MOD_FLMUINT32 | MOD_HEX | MOD_NATIVE, uiCol, uiRow++, uiOption, - (FLMBYTE)(!uiOption ? uiBackColor : uiUnselectBackColor), - (FLMBYTE)(!uiOption ? uiForeColor : uiUnselectForeColor), - (FLMBYTE)(!uiOption ? uiBackColor : uiSelectBackColor), - (FLMBYTE)(!uiOption ? uiForeColor : uiSelectForeColor))) + (!uiOption ? uiBackColor : uiUnselectBackColor), + (!uiOption ? uiForeColor : uiUnselectForeColor), + (!uiOption ? uiBackColor : uiSelectBackColor), + (!uiOption ? uiForeColor : uiSelectForeColor))) { goto Exit; } @@ -334,7 +333,7 @@ void ViewLogicalFile( pMenuItem = pMenuItem->pNextItem; } pszTmp = (FLMBYTE *)((FLMUINT)pMenuItem->ui64Value); - if (f_stricmp( pszTmp, COLLECTION_STRING) == 0) + if (f_stricmp( (const char *)pszTmp, COLLECTION_STRING) == 0) { gv_uiViewSearchLfType = XFLM_LF_COLLECTION; } diff --git a/xflaim/util/viewmenu.cpp b/xflaim/util/viewmenu.cpp index 8f5661c..70e1251 100644 --- a/xflaim/util/viewmenu.cpp +++ b/xflaim/util/viewmenu.cpp @@ -89,9 +89,9 @@ void ViewFreeMenuMemory( void) { if (gv_pViewMenuFirstItem) { - gv_ViewPool.poolFree(); - gv_pViewMenuFirstItem = - gv_pViewMenuLastItem = + gv_pViewPool->poolFree(); + gv_pViewMenuFirstItem = NULL; + gv_pViewMenuLastItem = NULL; gv_pViewMenuCurrItem = NULL; } } @@ -106,7 +106,7 @@ void ViewMenuInit( // Clear the screen and display the menu title - WpsScrBackFor( WPS_BLACK, WPS_WHITE); + WpsScrBackFor( FLM_BLACK, FLM_WHITE); WpsScrClr( 0, 0); // Display the title in the middle of the top line of the screen @@ -198,7 +198,7 @@ FSTATIC void ViewDispMenuItem( f_sprintf( (char *)szTempBuf, "%03u:%08X", (unsigned)pMenuItem->uiModFileNumber, (unsigned)pMenuItem->uiModFileOffset); - WpsScrBackFor( WPS_WHITE, WPS_GREEN); + WpsScrBackFor( FLM_WHITE, FLM_GREEN); WpsStrOutXY( szTempBuf, 0, uiRow); } @@ -417,11 +417,10 @@ FLMBOOL ViewAddMenuItem( FLMUINT uiCol, FLMUINT uiRow, FLMUINT uiOption, - FLMUINT uiUnselectBackColor, - FLMUINT uiUnselectForeColor, - FLMUINT uiSelectBackColor, - FLMUINT uiSelectForeColor - ) + eColorType uiUnselectBackColor, + eColorType uiUnselectForeColor, + eColorType uiSelectBackColor, + eColorType uiSelectForeColor) { FLMBOOL bOk = FALSE; VIEW_MENU_ITEM_p pMenuItem; @@ -431,13 +430,13 @@ FLMBOOL ViewAddMenuItem( if ((uiValueType & 0x0F) == VAL_IS_TEXT_PTR) { - uiSize += (f_strlen( (FLMBYTE *)((FLMUINT)ui64Value)) + 1); + uiSize += (f_strlen( (const char *)((FLMUINT)ui64Value)) + 1); } else if ((uiValueType & 0x0F) == VAL_IS_BINARY) { uiSize += uiValueLen; } - if (RC_BAD( gv_ViewPool.poolAlloc(uiSize, (void **)&pMenuItem))) + if (RC_BAD( gv_pViewPool->poolAlloc(uiSize, (void **)&pMenuItem))) { ViewShowError( "Could not allocate memory for menu value"); goto Exit; @@ -464,8 +463,8 @@ FLMBOOL ViewAddMenuItem( if ((uiValueType & 0x0F) == VAL_IS_TEXT_PTR) { pMenuItem->ui64Value = (FLMUINT64)((FLMUINT)&pMenuItem[ 1]); - f_strcpy( (FLMBYTE *)(FLMUINT)pMenuItem->ui64Value, - (FLMBYTE *)(FLMUINT)ui64Value); + f_strcpy( (char *)(FLMUINT)pMenuItem->ui64Value, + (const char *)(FLMUINT)ui64Value); } else if ((uiValueType & 0x0F) == VAL_IS_BINARY) { @@ -513,11 +512,11 @@ void ViewEscPrompt( void) FLMUINT uiNumRows; WpsScrSize( &uiNumCols, &uiNumRows); - WpsScrBackFor( WPS_BLACK, WPS_WHITE); + WpsScrBackFor( FLM_BLACK, FLM_WHITE); WpsScrClr( 0, uiNumRows - 1); - WpsScrBackFor( WPS_RED, WPS_WHITE); + WpsScrBackFor( FLM_RED, FLM_WHITE); WpsStrOutXY( "ESC=Exit, ?=Help", 0, uiNumRows - 1); - WpsScrBackFor( WPS_BLACK, WPS_WHITE); + WpsScrBackFor( FLM_BLACK, FLM_WHITE); WpsStrOutXY( "File: ", 20, uiNumRows - 1); WpsStrOutXY( gv_szViewFileName, 26, uiNumRows - 1); gv_uiViewLastFileOffset = VIEW_INVALID_FILE_OFFSET; @@ -545,7 +544,7 @@ FSTATIC void ViewRefreshMenu( // Refresh the entire screen - WpsScrBackFor( WPS_BLACK, WPS_WHITE); + WpsScrBackFor( FLM_BLACK, FLM_WHITE); WpsScrClr( 0, 1); pMenuItem = gv_pViewMenuFirstItem; @@ -586,7 +585,7 @@ FSTATIC void UpdateHorizCursor( szTempBuf[ 2] = 0; if (bOnFlag) { - WpsScrBackFor( WPS_RED, WPS_WHITE); + WpsScrBackFor( FLM_RED, FLM_WHITE); } else { @@ -868,7 +867,7 @@ FSTATIC void ViewHelpScreen( void) // Clear the screen and display the menu title - WpsScrBackFor( WPS_BLACK, WPS_WHITE); + WpsScrBackFor( FLM_BLACK, FLM_WHITE); WpsScrClr( 0, 1); WpsScrPos( 0, 3); WpsStrOut( " RECOGNIZED KEYBOARD CHARACTERS\n"); @@ -976,37 +975,37 @@ FLMUINT ViewGetMenuOption( void) } switch( uiChar) { - case WPK_ESCAPE: + case FKB_ESCAPE: return( ESCAPE_OPTION); - case WPK_UP: + case FKB_UP: case 'U': case 'u': case '8': DoUpArrow(); break; - case WPK_DOWN: + case FKB_DOWN: case 'D': case 'd': case '2': DoDownArrow(); break; - case WPK_PGDN: + case FKB_PGDN: case '+': case '3': DoPageDown(); break; - case WPK_PGUP: + case FKB_PGUP: case '-': case '9': DoPageUp(); break; - case WPK_HOME: + case FKB_HOME: case 'H': case 'h': case '7': DoHome(); break; - case WPK_END: + case FKB_END: case 'Z': case 'z': case '1': @@ -1014,7 +1013,7 @@ FLMUINT ViewGetMenuOption( void) break; case '\n': case '\r': - case WPK_ENTER: + case FKB_ENTER: if (gv_pViewMenuCurrItem->uiOption) { return( gv_pViewMenuCurrItem->uiOption); @@ -1024,13 +1023,13 @@ FLMUINT ViewGetMenuOption( void) case 'g': case 7: /* Control-G */ return( GOTO_BLOCK_OPTION); - case WPK_RIGHT: + case FKB_RIGHT: case 'R': case 'r': case '6': DoRightArrow(); break; - case WPK_LEFT: + case FKB_LEFT: case 'L': case 'l': case '4': @@ -1086,7 +1085,7 @@ void ViewUpdateDate( Months [CurrTime.month], (unsigned)CurrTime.day, (unsigned)CurrTime.year); - WpsScrBackFor( WPS_BLACK, WPS_WHITE); + WpsScrBackFor( FLM_BLACK, FLM_WHITE); WpsStrOutXY( szTempBuf, 0, 0); } @@ -1121,7 +1120,7 @@ void ViewUpdateDate( (unsigned)uiHour, (unsigned)CurrTime.minute, (unsigned)CurrTime.second, szAmPm); - WpsScrBackFor( WPS_BLACK, WPS_WHITE); + WpsScrBackFor( FLM_BLACK, FLM_WHITE); WpsStrOutXY( szTempBuf, 66, 0); } @@ -1155,7 +1154,7 @@ void ViewUpdateDate( (unsigned)gv_uiViewLastFileNumber, (unsigned)gv_uiViewLastFileOffset); } - WpsScrBackFor( WPS_BLACK, WPS_WHITE); + WpsScrBackFor( FLM_BLACK, FLM_WHITE); WpsStrOutXY( szTempBuf, 47, uiNumRows - 1); } diff --git a/xflaim/util/viewsrch.cpp b/xflaim/util/viewsrch.cpp index 35c2d46..91306a3 100644 --- a/xflaim/util/viewsrch.cpp +++ b/xflaim/util/viewsrch.cpp @@ -133,7 +133,7 @@ FLMBOOL ViewGetKey( void) { goto Exit; } - longToByte( ui32Num, gv_ucViewSearchKey); + f_UINT32ToByte( ui32Num, gv_ucViewSearchKey); gv_uiViewSearchKeyLen = 4; bOk = TRUE; goto Exit; diff --git a/xflaim/util/xshell.cpp b/xflaim/util/xshell.cpp index 03ec13b..5f6dc47 100644 --- a/xflaim/util/xshell.cpp +++ b/xflaim/util/xshell.cpp @@ -27,7 +27,6 @@ #include "fshell.h" static FlmSharedContext * gv_pSharedContext = NULL; -FTX_INFO * gv_pFtxInfo = NULL; FLMBOOL gv_bShutdown = FALSE; FLMBOOL gv_bRunning = TRUE; @@ -64,7 +63,7 @@ int __cdecl main( { RCODE rc = NE_XFLM_OK; FlmShell * pShell = NULL; - F_DbSystem dbSystem; + IF_DbSystem * pDbSystem = NULL; #ifdef FLM_NLM @@ -77,19 +76,18 @@ int __cdecl main( #endif - if( RC_BAD( rc = dbSystem.init())) + if( RC_BAD( rc = FlmAllocDbSystem( &pDbSystem))) { goto Exit; } - if( FTXInit( "X-FLAIM Shell", (FLMBYTE)80, (FLMBYTE)50, - WPS_BLUE, WPS_WHITE, NULL, NULL, &gv_pFtxInfo) != FTXRC_SUCCESS) + if( RC_BAD( rc = FTXInit( "X-FLAIM Shell", (FLMBYTE)80, (FLMBYTE)50, + FLM_BLUE, FLM_WHITE, NULL, NULL))) { - rc = RC_SET( NE_XFLM_MEM); goto Exit; } - FTXSetShutdownFlag( gv_pFtxInfo, &gv_bShutdown); + FTXSetShutdownFlag( &gv_bShutdown); if( (gv_pSharedContext = f_new FlmSharedContext) == NULL) { @@ -97,7 +95,7 @@ int __cdecl main( goto Exit; } - if( RC_BAD( rc = gv_pSharedContext->init( NULL, gv_pFtxInfo))) + if( RC_BAD( rc = gv_pSharedContext->init( NULL))) { goto Exit; } @@ -123,15 +121,13 @@ Exit: gv_pSharedContext->Release(); } - // Free FTX + FTXExit(); + + if( pDbSystem) + { + pDbSystem->Release(); + } - FTXFree( &gv_pFtxInfo); - - // Shut down the FLAIM database engine. This call must be made - // even if the init call failed. No more FLAIM calls should be made - // by the application. - - dbSystem.exit(); gv_bRunning = FALSE; return( 0); }