diff --git a/ChangeLog.txt b/ChangeLog.txt index 48d712ac6b..0d01899502 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -10,6 +10,149 @@ * Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment */ +2014-01-21 20:35 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) + * contrib/hbct/ctnet.c + ! fixed copy and past typo in previous commit + + * src/rdd/hbsix/sxcompat.prg + ! fixed sx_Compress() and sx_Decompress() used with arrays + + ; modifications below comes from Viktor fork: + + * include/dbinfo.ch + * src/rdd/workarea.c + + added support for new dbInfo() action: DBI_CODEPAGE + It returns Harbour CP used by current work area. + + * src/common/expropt2.c + * change instruction order to protect against NULL references + if we ever add support for dummy lists + + * src/common/hbver.c + ! CLANG detection + + * src/lang/l_fr.c + * src/lang/l_hu.c + * updated translations + + * src/rtl/cdpapihb.c + * include/harbour.hbx + + added function hb_cdpExists( ) -> + it returns .T. if the passed codepage is supported + and linked, .F. otherwise + + * src/rtl/hbrand.c + * include/harbour.hbx + + added hb_randStr( ) -> which returns a strong + random stream of bytes of requested length + + * src/vm/hashfunc.c + * include/harbour.hbx + + New hash function to easily check for the existence + of a key and at the same time retrieving its corresponding + value: + hb_HGetRef( , [, <@xValue> ] ) -> + If the key is not found, is also reset to NIL. + Useful to replace hb_HPos()/hb_HValueAt() call pairs and + associated temp variable, or to avoid multiple hash lookups + for the cost of one temp variable. + + * src/rtl/copyfile.c + % use 64KB buffer + + * src/rtl/tget.prg + ! Get():Insert()/Get():OverStrike() GET freeze fix reworked + using better solution by Heinz. + + * src/rtl/tgetlist.prg + * src/rtl/tmenuitm.prg + * src/rtl/tmenusys.prg + * src/rtl/tpopup.prg + ! fixed to precisely verify against multiple expected class names + previously a custom class named f.e. 'LIST' was accepted in some + places for LISTBOX + ! fixed TOFIX where CP/encoding dependent string was + used to determine whether a menu item is separator + throughout the lifetime of the menu. + + * src/common/hbdate.c + * src/common/hbprintf.c + * src/common/hbtrace.c + * src/common/hbver.c + * src/compiler/compi18n.c + * src/compiler/genc.c + * src/compiler/gencc.c + * src/compiler/hbusage.c + * src/debug/dbgthsh.prg + * src/debug/dbgtmenu.prg + * src/debug/debugger.prg + * src/debug/tbrwtext.prg + * src/pp/hbpp.c + * src/rdd/dbfcdx/dbfcdx1.c + * src/rdd/dbfuncs.prg + * src/rdd/dbtotal.prg + * src/rdd/hbsix/sxcompat.prg + * src/rdd/hbsix/sxini.prg + * src/rdd/usrrdd/rdds/arrayrdd.prg + * src/rdd/usrrdd/rdds/hscdx.prg + * src/rtl/adir.prg + * src/rtl/arc4.c + * src/rtl/cdpdet.prg + * src/rtl/dbedit.prg + * src/rtl/dircmd.prg + * src/rtl/diskspac.c + * src/rtl/disksphb.c + * src/rtl/errint.c + * src/rtl/errintlo.c + * src/rtl/errsys.prg + * src/rtl/filesys.c + * src/rtl/fslink.c + * src/rtl/gtkbstat.c + * src/rtl/gtwin/gtwin.c + * src/rtl/gtwvt/gtwvt.c + * src/rtl/hbbffnc.c + * src/rtl/hbi18n1.c + * src/rtl/hbi18n2.prg + * src/rtl/hbini.prg + * src/rtl/hbjson.c + * src/rtl/listbox.prg + * src/rtl/menusys.prg + * src/rtl/mtran.c + * src/rtl/radiogrp.prg + * src/rtl/tgetlist.prg + * src/rtl/tmenusys.prg + * src/rtl/tobject.prg + * src/rtl/tpersist.prg + * src/rtl/tpopup.prg + * src/rtl/tpopuphb.prg + * src/rtl/treport.prg + * src/rtl/tscalar.prg + * src/rtl/ttopbar.prg + * src/rtl/tget.prg + * src/rtl/tlabel.prg + * src/rtl/tmenuitm.prg + * src/rtl/valtoexp.prg + * src/rtl/valtype.c + * src/vm/dlmalloc.c + * src/vm/fm.c + ! check module handle returned by GetModuleHandle() in MS-Windows + builds + ! use %u for unsigned printf formatting + * casting, formatting, casing and some modifications in names + * use #if 0 / #endif to mark commented blocks + * updated year to 2014 + % use FOR EACH, SWITCH, DO CASE statements + % use :__enumFirst() / :__enumLast() + % eliminated some local variables and redundant declarations + % use hb_defaultValue() + % use $ operator instead of At() and hb_HHasKey() + % use hb_ADel() instead of ADel()+ASize() + * replace some functions with procedures + * pacified some MSC warnings + * use hb_StrFormat() for user messages + * use :: instead of Self: + * use ANSI date delimiters + 2014-01-20 17:36 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * src/rtl/hbsocket.c * removed not longer valid TODO note diff --git a/contrib/hbct/ctnet.c b/contrib/hbct/ctnet.c index 3dc6395c6b..fd7335fc66 100644 --- a/contrib/hbct/ctnet.c +++ b/contrib/hbct/ctnet.c @@ -194,7 +194,7 @@ HB_FUNC( NETRMTNAME ) if( WNetGetConnection( lpLocalName, lpRemoteDevice, &dwSize ) == ERROR_MORE_DATA ) { - if( dwSize > 0 && dwSize <= dwLen && WNetGetConnection( lpLocalName, lpRemoteDevice, &dwSize ) == NO_ER + if( dwSize > 0 && dwSize <= dwLen && WNetGetConnection( lpLocalName, lpRemoteDevice, &dwSize ) == NO_ERROR ) HB_RETSTRLEN( lpRemoteDevice, ( HB_SIZE ) ( dwSize - 1 ) ); else hb_retc_null(); diff --git a/include/dbinfo.ch b/include/dbinfo.ch index ff074f5434..034d4e95b2 100644 --- a/include/dbinfo.ch +++ b/include/dbinfo.ch @@ -288,6 +288,7 @@ #define DBI_POSITIONED 144 /* Is cursor positioned to valid record */ #define DBI_ISTEMPORARY 145 /* Is the table a temporary one? */ #define DBI_LOCKTEST 146 /* record / file lock test */ +#define DBI_CODEPAGE 147 /* Codepage used */ /* RECORD MAP (RM) support */ #define DBI_RM_SUPPORTED 150 /* has WA RDD record map support? */ diff --git a/include/harbour.hbx b/include/harbour.hbx index e00f278243..d44428d1c4 100644 --- a/include/harbour.hbx +++ b/include/harbour.hbx @@ -334,6 +334,7 @@ DYNAMIC hb_ByteSwapLL DYNAMIC hb_ByteSwapU DYNAMIC hb_ByteSwapW DYNAMIC hb_cdpCharMax +DYNAMIC hb_cdpExists DYNAMIC hb_cdpInfo DYNAMIC hb_cdpIsUTF8 DYNAMIC hb_cdpList @@ -508,6 +509,7 @@ DYNAMIC hb_HexToStr DYNAMIC hb_HFill DYNAMIC hb_HGet DYNAMIC hb_HGetDef +DYNAMIC hb_HGetRef DYNAMIC hb_HHasKey DYNAMIC hb_HKeepOrder DYNAMIC hb_HKeyAt @@ -726,6 +728,7 @@ DYNAMIC hb_Random DYNAMIC hb_RandomInt DYNAMIC hb_RandomIntMax DYNAMIC hb_RandomSeed +DYNAMIC hb_randStr DYNAMIC hb_RAScan DYNAMIC hb_RAt DYNAMIC hb_rddGetTempAlias diff --git a/src/common/expropt2.c b/src/common/expropt2.c index 575ea3d20b..0643de8c81 100644 --- a/src/common/expropt2.c +++ b/src/common/expropt2.c @@ -1961,8 +1961,8 @@ PHB_EXPR hb_compExprReduceIIF( PHB_EXPR pSelf, HB_COMP_DECL ) PHB_EXPR hb_compExprListStrip( PHB_EXPR pSelf, HB_COMP_DECL ) { while( pSelf->ExprType == HB_ET_LIST && - pSelf->value.asList.pExprList->ExprType <= HB_ET_VARIABLE && - hb_compExprListLen( pSelf ) == 1 ) + hb_compExprListLen( pSelf ) == 1 && + pSelf->value.asList.pExprList->ExprType <= HB_ET_VARIABLE ) { /* replace the list with a simple expression * ( EXPR ) -> EXPR diff --git a/src/common/hbdate.c b/src/common/hbdate.c index c7edff0c30..f45c08dff0 100644 --- a/src/common/hbdate.c +++ b/src/common/hbdate.c @@ -957,9 +957,10 @@ long hb_timeStampUTCOffset( int iYear, int iMonth, int iDay, if( s_fInit ) { - s_pTzSpecificLocalTimeToSystemTime = ( P_TZSPECIFICLOCALTIMETOSYSTEMTIME ) - GetProcAddress( GetModuleHandle( TEXT( "kernel32" ) ), - "TzSpecificLocalTimeToSystemTime" ); + HMODULE hModule = GetModuleHandle( TEXT( "kernel32" ) ); + if( hModule ) + s_pTzSpecificLocalTimeToSystemTime = ( P_TZSPECIFICLOCALTIMETOSYSTEMTIME ) + GetProcAddress( hModule, "TzSpecificLocalTimeToSystemTime" ); s_fInit = HB_FALSE; } @@ -967,12 +968,12 @@ long hb_timeStampUTCOffset( int iYear, int iMonth, int iDay, { SYSTEMTIME lt, st; - lt.wYear = iYear; - lt.wMonth = iMonth; - lt.wDay = iDay; - lt.wHour = iHour; - lt.wMinute = iMinutes; - lt.wSecond = iSeconds; + lt.wYear = ( WORD ) iYear; + lt.wMonth = ( WORD ) iMonth; + lt.wDay = ( WORD ) iDay; + lt.wHour = ( WORD ) iHour; + lt.wMinute = ( WORD ) iMinutes; + lt.wSecond = ( WORD ) iSeconds; lt.wMilliseconds = 0; lt.wDayOfWeek = 0; diff --git a/src/common/hbprintf.c b/src/common/hbprintf.c index be1cd00d70..226cf392d9 100644 --- a/src/common/hbprintf.c +++ b/src/common/hbprintf.c @@ -779,9 +779,9 @@ static size_t put_wstr( char *buffer, size_t bufsize, size_t size, } else if( precision > 0 ) { - int size = precision; + int precision_ori = precision; precision = 0; - while( precision < size && wstr[ precision ] ) + while( precision < precision_ori && wstr[ precision ] ) ++precision; } diff --git a/src/common/hbtrace.c b/src/common/hbtrace.c index 8d1cde2c65..94d399bb17 100644 --- a/src/common/hbtrace.c +++ b/src/common/hbtrace.c @@ -187,8 +187,6 @@ int hb_tr_level( void ) s_level = HB_TR_DEFAULT; - /* ; */ - if( s_fp == NULL ) { if( hb_getenv_buffer( "HB_TR_OUTPUT", env, sizeof( env ) ) && @@ -203,8 +201,6 @@ int hb_tr_level( void ) s_fp = stderr; } - /* ; */ - if( hb_getenv_buffer( "HB_TR_LEVEL", env, sizeof( env ) ) && env[ 0 ] != '\0' ) { @@ -221,24 +217,18 @@ int hb_tr_level( void ) } } - /* ; */ - if( s_sysout < 0 ) { s_sysout = ( hb_getenv_buffer( "HB_TR_SYSOUT", env, sizeof( env ) ) && env[ 0 ] != '\0' ) ? 1 : 0; } - /* ; */ - if( s_flush < 0 ) { s_flush = ( hb_getenv_buffer( "HB_TR_FLUSH", env, sizeof( env ) ) && env[ 0 ] != '\0' ) ? 1 : 0; } - /* ; */ - s_enabled = enabled; } diff --git a/src/common/hbver.c b/src/common/hbver.c index 835f7c0b00..e3cb51c944 100644 --- a/src/common/hbver.c +++ b/src/common/hbver.c @@ -146,7 +146,14 @@ static HB_BOOL s_win_iswow64( void ) { typedef BOOL ( WINAPI * P_ISWOW64PROCESS )( HANDLE, PBOOL ); - P_ISWOW64PROCESS pIsWow64Process = ( P_ISWOW64PROCESS ) GetProcAddress( GetModuleHandle( TEXT( "kernel32" ) ), "IsWow64Process" ); + P_ISWOW64PROCESS pIsWow64Process; + + HMODULE hModule = GetModuleHandle( TEXT( "kernel32" ) ); + + if( hModule ) + pIsWow64Process = ( P_ISWOW64PROCESS ) GetProcAddress( hModule, "IsWow64Process" ); + else + pIsWow64Process = NULL; if( pIsWow64Process ) { @@ -789,6 +796,48 @@ char * hb_verCompiler( void ) #endif iVerPatch = __OPENCC_PATCHLEVEL__; +#elif defined( __clang__ ) && defined( __clang_major__ ) + + /* NOTE: keep clang detection before msvc detection. */ + + pszName = "LLVM/Clang C"; + + #if defined( __cplusplus ) + hb_strncpy( szSub, "++", sizeof( szSub ) - 1 ); + #endif + + iVerMajor = __clang_major__; + iVerMinor = __clang_minor__; + iVerPatch = __clang_patchlevel__; + +#elif defined( __clang__ ) + + pszName = "LLVM/Clang C"; + + #if defined( __cplusplus ) + hb_strncpy( szSub, "++", sizeof( szSub ) - 1 ); + #endif + + hb_strncat( szSub, " 1.x", sizeof( szSub ) - 1 ); + + iVerMajor = iVerMinor = iVerPatch = 0; + +#elif defined( __llvm__ ) && defined( __GNUC__ ) + + pszName = "LLVM/GNU C"; + + #if defined( __cplusplus ) + hb_strncpy( szSub, "++", sizeof( szSub ) - 1 ); + #endif + + iVerMajor = __GNUC__; + iVerMinor = __GNUC_MINOR__; + #if defined( __GNUC_PATCHLEVEL__ ) + iVerPatch = __GNUC_PATCHLEVEL__; + #else + iVerPatch = 0; + #endif + #elif defined( _MSC_VER ) #if ( _MSC_VER >= 800 ) @@ -896,46 +945,6 @@ char * hb_verCompiler( void ) iVerMicro = __VERSION_NUMBER__ % 10; iElements = 4; -#elif defined( __clang__ ) && defined( __clang_major__ ) - - pszName = "LLVM/Clang C"; - - #if defined( __cplusplus ) - hb_strncpy( szSub, "++", sizeof( szSub ) - 1 ); - #endif - - iVerMajor = __clang_major__; - iVerMinor = __clang_minor__; - iVerPatch = __clang_patchlevel__; - -#elif defined( __clang__ ) - - pszName = "LLVM/Clang C"; - - #if defined( __cplusplus ) - hb_strncpy( szSub, "++", sizeof( szSub ) - 1 ); - #endif - - hb_strncat( szSub, " 1.x", sizeof( szSub ) - 1 ); - - iVerMajor = iVerMinor = iVerPatch = 0; - -#elif defined( __llvm__ ) && defined( __GNUC__ ) - - pszName = "LLVM/GNU C"; - - #if defined( __cplusplus ) - hb_strncpy( szSub, "++", sizeof( szSub ) - 1 ); - #endif - - iVerMajor = __GNUC__; - iVerMinor = __GNUC_MINOR__; - #if defined( __GNUC_PATCHLEVEL__ ) - iVerPatch = __GNUC_PATCHLEVEL__; - #else - iVerPatch = 0; - #endif - #elif defined( __TINYC__ ) pszName = "Tiny C Compiler"; diff --git a/src/compiler/compi18n.c b/src/compiler/compi18n.c index d6b3f2f7d7..101b52d780 100644 --- a/src/compiler/compi18n.c +++ b/src/compiler/compi18n.c @@ -342,12 +342,12 @@ HB_BOOL hb_compI18nSave( HB_COMP_DECL, HB_BOOL fFinal ) PHB_I18NSTRING pString = &pI18n->pString[ uiIndex ]; HB_UINT uiLine; - fprintf( file, "#: %s:%d", + fprintf( file, "#: %s:%u", hb_compI18nFileName( szFileName, pString->pPos.szFile ), pString->pPos.uiLine ); for( uiLine = 0; uiLine < pString->uiPosCount; ++uiLine ) - fprintf( file, " %s:%d", + fprintf( file, " %s:%u", hb_compI18nFileName( szFileName, pString->pPosLst[ uiLine ].szFile ), pString->pPosLst[ uiLine ].uiLine ); @@ -367,7 +367,7 @@ HB_BOOL hb_compI18nSave( HB_COMP_DECL, HB_BOOL fFinal ) if( uiLine == 0 ) fprintf( file, "\"\nmsgid_plural \"" ); else - fprintf( file, "\"\nmsgid_plural%d \"", uiLine + 1 ); + fprintf( file, "\"\nmsgid_plural%u \"", uiLine + 1 ); hb_compI18nEscapeString( file, pString->szPlurals[ uiLine ] ); } fprintf( file, "\"\nmsgstr%s \"\"\n\n", pString->uiPlurals ? "[0]" : "" ); diff --git a/src/compiler/genc.c b/src/compiler/genc.c index 9d43cc52d2..060a915fb1 100644 --- a/src/compiler/genc.c +++ b/src/compiler/genc.c @@ -439,11 +439,12 @@ void hb_compGenCCode( HB_COMP_DECL, PHB_FNAME pFileName ) /* generates the static void hb_writeEndInit( HB_COMP_DECL, FILE * yyc, const char * szModulname, const char * szSourceFile ) { -/* +#if 0 HB_SYMBOL_UNUSED( szSourceFile ); - fprintf( yyc, "\nHB_INIT_SYMBOLS_END( hb_vm_SymbolInit_%s%s )\n\n", + fprintf( yyc, + "\nHB_INIT_SYMBOLS_END( hb_vm_SymbolInit_%s%s )\n\n", HB_COMP_PARAM->szPrefix, szModulname ); - */ +#endif fprintf( yyc, "\nHB_INIT_SYMBOLS_EX_END( hb_vm_SymbolInit_%s%s, ", HB_COMP_PARAM->szPrefix, szModulname ); @@ -598,11 +599,11 @@ static HB_GENC_FUNC( hb_p_dec ) static HB_GENC_FUNC( hb_p_arraydim ) { - fprintf( cargo->yyc, "\tHB_P_ARRAYDIM, %i, %i,", + fprintf( cargo->yyc, "\tHB_P_ARRAYDIM, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ] ); if( cargo->bVerbose ) - fprintf( cargo->yyc, "\t/* %i */", HB_PCODE_MKUSHORT( &pFunc->pCode[ nPCodePos + 1 ] ) ); + fprintf( cargo->yyc, "\t/* %u */", HB_PCODE_MKUSHORT( &pFunc->pCode[ nPCodePos + 1 ] ) ); fprintf( cargo->yyc, "\n" ); return 3; } @@ -618,7 +619,7 @@ static HB_GENC_FUNC( hb_p_divide ) static HB_GENC_FUNC( hb_p_do ) { - fprintf( cargo->yyc, "\tHB_P_DO, %i, %i,\n", + fprintf( cargo->yyc, "\tHB_P_DO, %u, %u,\n", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ] ); return 3; @@ -626,7 +627,7 @@ static HB_GENC_FUNC( hb_p_do ) static HB_GENC_FUNC( hb_p_doshort ) { - fprintf( cargo->yyc, "\tHB_P_DOSHORT, %i,\n", pFunc->pCode[ nPCodePos + 1 ] ); + fprintf( cargo->yyc, "\tHB_P_DOSHORT, %u,\n", pFunc->pCode[ nPCodePos + 1 ] ); return 2; } @@ -659,7 +660,7 @@ static HB_GENC_FUNC( hb_p_pushunref ) static HB_GENC_FUNC( hb_p_swap ) { - fprintf( cargo->yyc, "\tHB_P_SWAP, %i,\n", pFunc->pCode[ nPCodePos + 1 ] ); + fprintf( cargo->yyc, "\tHB_P_SWAP, %u,\n", pFunc->pCode[ nPCodePos + 1 ] ); return 2; } @@ -719,7 +720,7 @@ static HB_GENC_FUNC( hb_p_fortest ) static HB_GENC_FUNC( hb_p_frame ) { - fprintf( cargo->yyc, "\tHB_P_FRAME, %i, %i,", + fprintf( cargo->yyc, "\tHB_P_FRAME, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ] ); if( cargo->bVerbose ) @@ -739,7 +740,7 @@ static HB_GENC_FUNC( hb_p_funcptr ) static HB_GENC_FUNC( hb_p_function ) { - fprintf( cargo->yyc, "\tHB_P_FUNCTION, %i, %i,\n", + fprintf( cargo->yyc, "\tHB_P_FUNCTION, %u, %u,\n", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ] ); return 3; @@ -747,28 +748,28 @@ static HB_GENC_FUNC( hb_p_function ) static HB_GENC_FUNC( hb_p_functionshort ) { - fprintf( cargo->yyc, "\tHB_P_FUNCTIONSHORT, %i,\n", pFunc->pCode[ nPCodePos + 1 ] ); + fprintf( cargo->yyc, "\tHB_P_FUNCTIONSHORT, %u,\n", pFunc->pCode[ nPCodePos + 1 ] ); return 2; } static HB_GENC_FUNC( hb_p_arraygen ) { - fprintf( cargo->yyc, "\tHB_P_ARRAYGEN, %i, %i,", + fprintf( cargo->yyc, "\tHB_P_ARRAYGEN, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ] ); if( cargo->bVerbose ) - fprintf( cargo->yyc, "\t/* %i */", HB_PCODE_MKUSHORT( &pFunc->pCode[ nPCodePos + 1 ] ) ); + fprintf( cargo->yyc, "\t/* %u */", HB_PCODE_MKUSHORT( &pFunc->pCode[ nPCodePos + 1 ] ) ); fprintf( cargo->yyc, "\n" ); return 3; } static HB_GENC_FUNC( hb_p_hashgen ) { - fprintf( cargo->yyc, "\tHB_P_HASHGEN, %i, %i,", + fprintf( cargo->yyc, "\tHB_P_HASHGEN, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ] ); if( cargo->bVerbose ) - fprintf( cargo->yyc, "\t/* %i */", HB_PCODE_MKUSHORT( &pFunc->pCode[ nPCodePos + 1 ] ) ); + fprintf( cargo->yyc, "\t/* %u */", HB_PCODE_MKUSHORT( &pFunc->pCode[ nPCodePos + 1 ] ) ); fprintf( cargo->yyc, "\n" ); return 3; } @@ -811,7 +812,7 @@ static HB_GENC_FUNC( hb_p_instring ) static HB_GENC_FUNC( hb_p_jumpnear ) { - fprintf( cargo->yyc, "\tHB_P_JUMPNEAR, %i,", + fprintf( cargo->yyc, "\tHB_P_JUMPNEAR, %u,", pFunc->pCode[ nPCodePos + 1 ] ); if( cargo->bVerbose ) { @@ -825,7 +826,7 @@ static HB_GENC_FUNC( hb_p_jumpnear ) static HB_GENC_FUNC( hb_p_jump ) { - fprintf( cargo->yyc, "\tHB_P_JUMP, %i, %i,", + fprintf( cargo->yyc, "\tHB_P_JUMP, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ] ); if( cargo->bVerbose ) @@ -840,7 +841,7 @@ static HB_GENC_FUNC( hb_p_jump ) static HB_GENC_FUNC( hb_p_jumpfar ) { - fprintf( cargo->yyc, "\tHB_P_JUMPFAR, %i, %i, %i,", + fprintf( cargo->yyc, "\tHB_P_JUMPFAR, %u, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ], pFunc->pCode[ nPCodePos + 3 ] ); @@ -855,7 +856,7 @@ static HB_GENC_FUNC( hb_p_jumpfar ) static HB_GENC_FUNC( hb_p_jumpfalsenear ) { - fprintf( cargo->yyc, "\tHB_P_JUMPFALSENEAR, %i,", + fprintf( cargo->yyc, "\tHB_P_JUMPFALSENEAR, %u,", pFunc->pCode[ nPCodePos + 1 ] ); if( cargo->bVerbose ) { @@ -868,7 +869,7 @@ static HB_GENC_FUNC( hb_p_jumpfalsenear ) static HB_GENC_FUNC( hb_p_jumpfalse ) { - fprintf( cargo->yyc, "\tHB_P_JUMPFALSE, %i, %i,", + fprintf( cargo->yyc, "\tHB_P_JUMPFALSE, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ] ); if( cargo->bVerbose ) @@ -882,7 +883,7 @@ static HB_GENC_FUNC( hb_p_jumpfalse ) static HB_GENC_FUNC( hb_p_jumpfalsefar ) { - fprintf( cargo->yyc, "\tHB_P_JUMPFALSEFAR, %i, %i, %i,", + fprintf( cargo->yyc, "\tHB_P_JUMPFALSEFAR, %u, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ], pFunc->pCode[ nPCodePos + 3 ] ); @@ -897,7 +898,7 @@ static HB_GENC_FUNC( hb_p_jumpfalsefar ) static HB_GENC_FUNC( hb_p_jumptruenear ) { - fprintf( cargo->yyc, "\tHB_P_JUMPTRUENEAR, %i,", + fprintf( cargo->yyc, "\tHB_P_JUMPTRUENEAR, %u,", pFunc->pCode[ nPCodePos + 1 ] ); if( cargo->bVerbose ) { @@ -910,7 +911,7 @@ static HB_GENC_FUNC( hb_p_jumptruenear ) static HB_GENC_FUNC( hb_p_jumptrue ) { - fprintf( cargo->yyc, "\tHB_P_JUMPTRUE, %i, %i,", + fprintf( cargo->yyc, "\tHB_P_JUMPTRUE, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ] ); if( cargo->bVerbose ) @@ -924,7 +925,7 @@ static HB_GENC_FUNC( hb_p_jumptrue ) static HB_GENC_FUNC( hb_p_jumptruefar ) { - fprintf( cargo->yyc, "\tHB_P_JUMPTRUEFAR, %i, %i, %i,", + fprintf( cargo->yyc, "\tHB_P_JUMPTRUEFAR, %u, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ], pFunc->pCode[ nPCodePos + 3 ] ); @@ -958,14 +959,14 @@ static HB_GENC_FUNC( hb_p_lessequal ) static HB_GENC_FUNC( hb_p_line ) { if( cargo->bVerbose ) - fprintf( cargo->yyc, "/* %05" HB_PFS "i */ ", nPCodePos ); + fprintf( cargo->yyc, "/* %05" HB_PFS "u */ ", nPCodePos ); else fprintf( cargo->yyc, "\t" ); - fprintf( cargo->yyc, "HB_P_LINE, %i, %i,", + fprintf( cargo->yyc, "HB_P_LINE, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ] ); if( cargo->bVerbose ) - fprintf( cargo->yyc, "\t/* %i */", HB_PCODE_MKUSHORT( &pFunc->pCode[ nPCodePos + 1 ] ) ); + fprintf( cargo->yyc, "\t/* %u */", HB_PCODE_MKUSHORT( &pFunc->pCode[ nPCodePos + 1 ] ) ); fprintf( cargo->yyc, "\n" ); return 3; } @@ -974,7 +975,7 @@ static HB_GENC_FUNC( hb_p_localname ) { HB_SIZE nStart = nPCodePos; - fprintf( cargo->yyc, "\tHB_P_LOCALNAME, %i, %i,", + fprintf( cargo->yyc, "\tHB_P_LOCALNAME, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ] ); if( cargo->bVerbose ) @@ -999,7 +1000,7 @@ static HB_GENC_FUNC( hb_p_macropop ) HB_SYMBOL_UNUSED( pFunc ); HB_SYMBOL_UNUSED( nPCodePos ); - fprintf( cargo->yyc, "\tHB_P_MACROPOP, %i,\n", pFunc->pCode[ nPCodePos + 1 ] ); + fprintf( cargo->yyc, "\tHB_P_MACROPOP, %u,\n", pFunc->pCode[ nPCodePos + 1 ] ); return 2; } @@ -1008,7 +1009,7 @@ static HB_GENC_FUNC( hb_p_macropopaliased ) HB_SYMBOL_UNUSED( pFunc ); HB_SYMBOL_UNUSED( nPCodePos ); - fprintf( cargo->yyc, "\tHB_P_MACROPOPALIASED, %i,\n", pFunc->pCode[ nPCodePos + 1 ] ); + fprintf( cargo->yyc, "\tHB_P_MACROPOPALIASED, %u,\n", pFunc->pCode[ nPCodePos + 1 ] ); return 2; } @@ -1017,7 +1018,7 @@ static HB_GENC_FUNC( hb_p_macropush ) HB_SYMBOL_UNUSED( pFunc ); HB_SYMBOL_UNUSED( nPCodePos ); - fprintf( cargo->yyc, "\tHB_P_MACROPUSH, %i,\n", pFunc->pCode[ nPCodePos + 1 ] ); + fprintf( cargo->yyc, "\tHB_P_MACROPUSH, %u,\n", pFunc->pCode[ nPCodePos + 1 ] ); return 2; } @@ -1035,7 +1036,7 @@ static HB_GENC_FUNC( hb_p_macrodo ) HB_SYMBOL_UNUSED( pFunc ); HB_SYMBOL_UNUSED( nPCodePos ); - fprintf( cargo->yyc, "\tHB_P_MACRODO, %i, %i,\n", + fprintf( cargo->yyc, "\tHB_P_MACRODO, %u, %u,\n", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ] ); return 3; } @@ -1045,7 +1046,7 @@ static HB_GENC_FUNC( hb_p_macrofunc ) HB_SYMBOL_UNUSED( pFunc ); HB_SYMBOL_UNUSED( nPCodePos ); - fprintf( cargo->yyc, "\tHB_P_MACROFUNC, %i, %i,\n", + fprintf( cargo->yyc, "\tHB_P_MACROFUNC, %u, %u,\n", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ] ); return 3; } @@ -1055,7 +1056,7 @@ static HB_GENC_FUNC( hb_p_macrosend ) HB_SYMBOL_UNUSED( pFunc ); HB_SYMBOL_UNUSED( nPCodePos ); - fprintf( cargo->yyc, "\tHB_P_MACROSEND, %i, %i,\n", + fprintf( cargo->yyc, "\tHB_P_MACROSEND, %u, %u,\n", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ] ); return 3; } @@ -1065,7 +1066,7 @@ static HB_GENC_FUNC( hb_p_macroarraygen ) HB_SYMBOL_UNUSED( pFunc ); HB_SYMBOL_UNUSED( nPCodePos ); - fprintf( cargo->yyc, "\tHB_P_MACROARRAYGEN, %i, %i,\n", + fprintf( cargo->yyc, "\tHB_P_MACROARRAYGEN, %u, %u,\n", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ] ); return 3; } @@ -1075,7 +1076,7 @@ static HB_GENC_FUNC( hb_p_macropushlist ) HB_SYMBOL_UNUSED( pFunc ); HB_SYMBOL_UNUSED( nPCodePos ); - fprintf( cargo->yyc, "\tHB_P_MACROPUSHLIST, %i,\n", pFunc->pCode[ nPCodePos + 1 ] ); + fprintf( cargo->yyc, "\tHB_P_MACROPUSHLIST, %u,\n", pFunc->pCode[ nPCodePos + 1 ] ); return 2; } @@ -1093,7 +1094,7 @@ static HB_GENC_FUNC( hb_p_macropushpare ) HB_SYMBOL_UNUSED( pFunc ); HB_SYMBOL_UNUSED( nPCodePos ); - fprintf( cargo->yyc, "\tHB_P_MACROPUSHPARE, %i,\n", pFunc->pCode[ nPCodePos + 1 ] ); + fprintf( cargo->yyc, "\tHB_P_MACROPUSHPARE, %u,\n", pFunc->pCode[ nPCodePos + 1 ] ); return 2; } @@ -1102,7 +1103,7 @@ static HB_GENC_FUNC( hb_p_macropushaliased ) HB_SYMBOL_UNUSED( pFunc ); HB_SYMBOL_UNUSED( nPCodePos ); - fprintf( cargo->yyc, "\tHB_P_MACROPUSHALIASED, %i,\n", pFunc->pCode[ nPCodePos + 1 ] ); + fprintf( cargo->yyc, "\tHB_P_MACROPUSHALIASED, %u,\n", pFunc->pCode[ nPCodePos + 1 ] ); return 2; } @@ -1126,7 +1127,7 @@ static HB_GENC_FUNC( hb_p_macrotext ) static HB_GENC_FUNC( hb_p_message ) { - fprintf( cargo->yyc, "\tHB_P_MESSAGE, %i, %i,", + fprintf( cargo->yyc, "\tHB_P_MESSAGE, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ] ); if( cargo->bVerbose ) @@ -1222,7 +1223,7 @@ static HB_GENC_FUNC( hb_p_or ) static HB_GENC_FUNC( hb_p_parameter ) { - fprintf( cargo->yyc, "\tHB_P_PARAMETER, %i, %i, %i,", + fprintf( cargo->yyc, "\tHB_P_PARAMETER, %u, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ], pFunc->pCode[ nPCodePos + 3 ] ); @@ -1261,7 +1262,7 @@ static HB_GENC_FUNC( hb_p_popalias ) static HB_GENC_FUNC( hb_p_popaliasedfield ) { - fprintf( cargo->yyc, "\tHB_P_POPALIASEDFIELD, %i, %i,", + fprintf( cargo->yyc, "\tHB_P_POPALIASEDFIELD, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ] ); if( cargo->bVerbose ) @@ -1272,7 +1273,7 @@ static HB_GENC_FUNC( hb_p_popaliasedfield ) static HB_GENC_FUNC( hb_p_popaliasedfieldnear ) { - fprintf( cargo->yyc, "\tHB_P_POPALIASEDFIELDNEAR, %i,", + fprintf( cargo->yyc, "\tHB_P_POPALIASEDFIELDNEAR, %u,", pFunc->pCode[ nPCodePos + 1 ] ); if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolName( cargo->HB_COMP_PARAM, pFunc->pCode[ nPCodePos + 1 ] ) ); @@ -1282,7 +1283,7 @@ static HB_GENC_FUNC( hb_p_popaliasedfieldnear ) static HB_GENC_FUNC( hb_p_popaliasedvar ) { - fprintf( cargo->yyc, "\tHB_P_POPALIASEDVAR, %i, %i,", + fprintf( cargo->yyc, "\tHB_P_POPALIASEDVAR, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ] ); if( cargo->bVerbose ) @@ -1293,7 +1294,7 @@ static HB_GENC_FUNC( hb_p_popaliasedvar ) static HB_GENC_FUNC( hb_p_popfield ) { - fprintf( cargo->yyc, "\tHB_P_POPFIELD, %i, %i,", + fprintf( cargo->yyc, "\tHB_P_POPFIELD, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ] ); if( cargo->bVerbose ) @@ -1304,7 +1305,7 @@ static HB_GENC_FUNC( hb_p_popfield ) static HB_GENC_FUNC( hb_p_poplocal ) { - fprintf( cargo->yyc, "\tHB_P_POPLOCAL, %i, %i,", + fprintf( cargo->yyc, "\tHB_P_POPLOCAL, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ] ); if( cargo->bVerbose ) @@ -1318,7 +1319,7 @@ static HB_GENC_FUNC( hb_p_poplocal ) static HB_GENC_FUNC( hb_p_poplocalnear ) { - fprintf( cargo->yyc, "\tHB_P_POPLOCALNEAR, %i,", + fprintf( cargo->yyc, "\tHB_P_POPLOCALNEAR, %u,", pFunc->pCode[ nPCodePos + 1 ] ); if( cargo->bVerbose ) { @@ -1331,7 +1332,7 @@ static HB_GENC_FUNC( hb_p_poplocalnear ) static HB_GENC_FUNC( hb_p_popmemvar ) { - fprintf( cargo->yyc, "\tHB_P_POPMEMVAR, %i, %i,", + fprintf( cargo->yyc, "\tHB_P_POPMEMVAR, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ] ); if( cargo->bVerbose ) @@ -1342,7 +1343,7 @@ static HB_GENC_FUNC( hb_p_popmemvar ) static HB_GENC_FUNC( hb_p_popstatic ) { - fprintf( cargo->yyc, "\tHB_P_POPSTATIC, %i, %i,", + fprintf( cargo->yyc, "\tHB_P_POPSTATIC, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ] ); if( cargo->bVerbose ) @@ -1353,7 +1354,7 @@ static HB_GENC_FUNC( hb_p_popstatic ) static HB_GENC_FUNC( hb_p_popvariable ) { - fprintf( cargo->yyc, "\tHB_P_POPVARIABLE, %i, %i,", + fprintf( cargo->yyc, "\tHB_P_POPVARIABLE, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ] ); if( cargo->bVerbose ) @@ -1382,7 +1383,7 @@ static HB_GENC_FUNC( hb_p_pushalias ) static HB_GENC_FUNC( hb_p_pushaliasedfield ) { - fprintf( cargo->yyc, "\tHB_P_PUSHALIASEDFIELD, %i, %i,", + fprintf( cargo->yyc, "\tHB_P_PUSHALIASEDFIELD, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ] ); if( cargo->bVerbose ) @@ -1393,7 +1394,7 @@ static HB_GENC_FUNC( hb_p_pushaliasedfield ) static HB_GENC_FUNC( hb_p_pushaliasedfieldnear ) { - fprintf( cargo->yyc, "\tHB_P_PUSHALIASEDFIELDNEAR, %i,", + fprintf( cargo->yyc, "\tHB_P_PUSHALIASEDFIELDNEAR, %u,", pFunc->pCode[ nPCodePos + 1 ] ); if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolName( cargo->HB_COMP_PARAM, pFunc->pCode[ nPCodePos + 1 ] ) ); @@ -1403,7 +1404,7 @@ static HB_GENC_FUNC( hb_p_pushaliasedfieldnear ) static HB_GENC_FUNC( hb_p_pushaliasedvar ) { - fprintf( cargo->yyc, "\tHB_P_PUSHALIASEDVAR, %i, %i,", + fprintf( cargo->yyc, "\tHB_P_PUSHALIASEDVAR, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ] ); if( cargo->bVerbose ) @@ -1414,10 +1415,10 @@ static HB_GENC_FUNC( hb_p_pushaliasedvar ) static HB_GENC_FUNC( hb_p_pushblockshort ) { - fprintf( cargo->yyc, "\tHB_P_PUSHBLOCKSHORT, %i,", + fprintf( cargo->yyc, "\tHB_P_PUSHBLOCKSHORT, %u,", pFunc->pCode[ nPCodePos + 1 ] ); if( cargo->bVerbose ) - fprintf( cargo->yyc, "\t/* %i */", + fprintf( cargo->yyc, "\t/* %u */", pFunc->pCode[ nPCodePos + 1 ] ); fprintf( cargo->yyc, "\n" ); @@ -1432,35 +1433,35 @@ static HB_GENC_FUNC( hb_p_pushblock ) HB_USHORT wVar, w; HB_SIZE nStart = nPCodePos; - fprintf( cargo->yyc, "\tHB_P_PUSHBLOCK, %i, %i,", + fprintf( cargo->yyc, "\tHB_P_PUSHBLOCK, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ] ); if( cargo->bVerbose ) - fprintf( cargo->yyc, "\t/* %i */", + fprintf( cargo->yyc, "\t/* %u */", HB_PCODE_MKUSHORT( &pFunc->pCode[ nPCodePos + 1 ] ) ); fprintf( cargo->yyc, "\n" ); w = HB_PCODE_MKUSHORT( &pFunc->pCode[ nPCodePos + 3 ] ); - fprintf( cargo->yyc, "\t%i, %i,", + fprintf( cargo->yyc, "\t%u, %u,", pFunc->pCode[ nPCodePos + 3 ], pFunc->pCode[ nPCodePos + 4 ] ); if( cargo->bVerbose ) - fprintf( cargo->yyc, "\t/* number of local parameters (%i) */", w ); + fprintf( cargo->yyc, "\t/* number of local parameters (%u) */", w ); fprintf( cargo->yyc, "\n" ); wVar = HB_PCODE_MKUSHORT( &pFunc->pCode[ nPCodePos + 5 ] ); - fprintf( cargo->yyc, "\t%i, %i,", + fprintf( cargo->yyc, "\t%u, %u,", pFunc->pCode[ nPCodePos + 5 ], pFunc->pCode[ nPCodePos + 6 ] ); if( cargo->bVerbose ) - fprintf( cargo->yyc, "\t/* number of local variables (%i) */", wVar ); + fprintf( cargo->yyc, "\t/* number of local variables (%u) */", wVar ); fprintf( cargo->yyc, "\n" ); nPCodePos += 7; /* codeblock size + number of parameters + number of local variables */ /* create the table of referenced local variables */ while( wVar-- ) { - fprintf( cargo->yyc, "\t%i, %i,", + fprintf( cargo->yyc, "\t%u, %u,", pFunc->pCode[ nPCodePos ], pFunc->pCode[ nPCodePos + 1 ] ); /* NOTE: @@ -1489,7 +1490,7 @@ static HB_GENC_FUNC( hb_p_pushblocklarge ) HB_USHORT wVar, w; HB_SIZE nStart = nPCodePos; - fprintf( cargo->yyc, "\tHB_P_PUSHBLOCKLARGE, %i, %i, %i,", + fprintf( cargo->yyc, "\tHB_P_PUSHBLOCKLARGE, %u, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ], pFunc->pCode[ nPCodePos + 3 ] ); @@ -1499,26 +1500,26 @@ static HB_GENC_FUNC( hb_p_pushblocklarge ) fprintf( cargo->yyc, "\n" ); w = HB_PCODE_MKUSHORT( &pFunc->pCode[ nPCodePos + 4 ] ); - fprintf( cargo->yyc, "\t%i, %i,", + fprintf( cargo->yyc, "\t%u, %u,", pFunc->pCode[ nPCodePos + 4 ], pFunc->pCode[ nPCodePos + 5 ] ); if( cargo->bVerbose ) - fprintf( cargo->yyc, "\t/* number of local parameters (%i) */", w ); + fprintf( cargo->yyc, "\t/* number of local parameters (%u) */", w ); fprintf( cargo->yyc, "\n" ); wVar = HB_PCODE_MKUSHORT( &pFunc->pCode[ nPCodePos + 6 ] ); - fprintf( cargo->yyc, "\t%i, %i,", + fprintf( cargo->yyc, "\t%u, %u,", pFunc->pCode[ nPCodePos + 6 ], pFunc->pCode[ nPCodePos + 7 ] ); if( cargo->bVerbose ) - fprintf( cargo->yyc, "\t/* number of local variables (%i) */", wVar ); + fprintf( cargo->yyc, "\t/* number of local variables (%u) */", wVar ); fprintf( cargo->yyc, "\n" ); nPCodePos += 8; /* codeblock size + number of parameters + number of local variables */ /* create the table of referenced local variables */ while( wVar-- ) { - fprintf( cargo->yyc, "\t%i, %i,", + fprintf( cargo->yyc, "\t%u, %u,", pFunc->pCode[ nPCodePos ], pFunc->pCode[ nPCodePos + 1 ] ); /* NOTE: @@ -1550,11 +1551,11 @@ static HB_GENC_FUNC( hb_p_pushdouble ) ++nPCodePos; for( i = 0; i < ( int ) ( sizeof( double ) + sizeof( HB_BYTE ) + sizeof( HB_BYTE ) ); ++i ) { - fprintf( cargo->yyc, " %i,", ( HB_UCHAR ) pFunc->pCode[ nPCodePos + i ] ); + fprintf( cargo->yyc, " %u,", ( HB_UCHAR ) pFunc->pCode[ nPCodePos + i ] ); } if( cargo->bVerbose ) { - fprintf( cargo->yyc, "\t/* %.*f, %d, %d */", + fprintf( cargo->yyc, "\t/* %.*f, %u, %u */", ( HB_UCHAR ) pFunc->pCode[ nPCodePos + sizeof( double ) + sizeof( HB_BYTE ) ], HB_PCODE_MKDOUBLE( &pFunc->pCode[ nPCodePos ] ), ( HB_UCHAR ) pFunc->pCode[ nPCodePos + sizeof( double ) ], @@ -1567,7 +1568,7 @@ static HB_GENC_FUNC( hb_p_pushdouble ) static HB_GENC_FUNC( hb_p_pushfield ) { - fprintf( cargo->yyc, "\tHB_P_PUSHFIELD, %i, %i,", + fprintf( cargo->yyc, "\tHB_P_PUSHFIELD, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ] ); if( cargo->bVerbose ) @@ -1578,7 +1579,7 @@ static HB_GENC_FUNC( hb_p_pushfield ) static HB_GENC_FUNC( hb_p_pushbyte ) { - fprintf( cargo->yyc, "\tHB_P_PUSHBYTE, %i,", + fprintf( cargo->yyc, "\tHB_P_PUSHBYTE, %u,", pFunc->pCode[ nPCodePos + 1 ] ); if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %i */", ( signed char ) pFunc->pCode[ nPCodePos + 1 ] ); @@ -1588,7 +1589,7 @@ static HB_GENC_FUNC( hb_p_pushbyte ) static HB_GENC_FUNC( hb_p_pushint ) { - fprintf( cargo->yyc, "\tHB_P_PUSHINT, %i, %i,", + fprintf( cargo->yyc, "\tHB_P_PUSHINT, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ] ); if( cargo->bVerbose ) @@ -1599,7 +1600,7 @@ static HB_GENC_FUNC( hb_p_pushint ) static HB_GENC_FUNC( hb_p_pushlocal ) { - fprintf( cargo->yyc, "\tHB_P_PUSHLOCAL, %i, %i,", + fprintf( cargo->yyc, "\tHB_P_PUSHLOCAL, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ] ); if( cargo->bVerbose ) @@ -1613,7 +1614,7 @@ static HB_GENC_FUNC( hb_p_pushlocal ) static HB_GENC_FUNC( hb_p_pushlocalnear ) { - fprintf( cargo->yyc, "\tHB_P_PUSHLOCALNEAR, %i,", + fprintf( cargo->yyc, "\tHB_P_PUSHLOCALNEAR, %u,", pFunc->pCode[ nPCodePos + 1 ] ); if( cargo->bVerbose ) { @@ -1626,7 +1627,7 @@ static HB_GENC_FUNC( hb_p_pushlocalnear ) static HB_GENC_FUNC( hb_p_pushlocalref ) { - fprintf( cargo->yyc, "\tHB_P_PUSHLOCALREF, %i, %i,", + fprintf( cargo->yyc, "\tHB_P_PUSHLOCALREF, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ] ); if( cargo->bVerbose ) @@ -1640,7 +1641,7 @@ static HB_GENC_FUNC( hb_p_pushlocalref ) static HB_GENC_FUNC( hb_p_pushlong ) { - fprintf( cargo->yyc, "\tHB_P_PUSHLONG, %i, %i, %i, %i,", + fprintf( cargo->yyc, "\tHB_P_PUSHLONG, %u, %u, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ], pFunc->pCode[ nPCodePos + 3 ], @@ -1654,7 +1655,7 @@ static HB_GENC_FUNC( hb_p_pushlong ) static HB_GENC_FUNC( hb_p_pushlonglong ) { - fprintf( cargo->yyc, "\tHB_P_PUSHLONGLONG, %i, %i, %i, %i, %i, %i, %i, %i, ", + fprintf( cargo->yyc, "\tHB_P_PUSHLONGLONG, %u, %u, %u, %u, %u, %u, %u, %u, ", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ], pFunc->pCode[ nPCodePos + 3 ], @@ -1680,7 +1681,7 @@ static HB_GENC_FUNC( hb_p_pushlonglong ) static HB_GENC_FUNC( hb_p_pushmemvar ) { - fprintf( cargo->yyc, "\tHB_P_PUSHMEMVAR, %i, %i,", + fprintf( cargo->yyc, "\tHB_P_PUSHMEMVAR, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ] ); if( cargo->bVerbose ) @@ -1691,7 +1692,7 @@ static HB_GENC_FUNC( hb_p_pushmemvar ) static HB_GENC_FUNC( hb_p_pushmemvarref ) { - fprintf( cargo->yyc, "\tHB_P_PUSHMEMVARREF, %i, %i,", + fprintf( cargo->yyc, "\tHB_P_PUSHMEMVARREF, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ] ); if( cargo->bVerbose ) @@ -1720,7 +1721,7 @@ static HB_GENC_FUNC( hb_p_pushself ) static HB_GENC_FUNC( hb_p_pushstatic ) { - fprintf( cargo->yyc, "\tHB_P_PUSHSTATIC, %i, %i,", + fprintf( cargo->yyc, "\tHB_P_PUSHSTATIC, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ] ); if( cargo->bVerbose ) @@ -1731,7 +1732,7 @@ static HB_GENC_FUNC( hb_p_pushstatic ) static HB_GENC_FUNC( hb_p_pushstaticref ) { - fprintf( cargo->yyc, "\tHB_P_PUSHSTATICREF, %i, %i,", + fprintf( cargo->yyc, "\tHB_P_PUSHSTATICREF, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ] ); if( cargo->bVerbose ) @@ -1744,10 +1745,10 @@ static HB_GENC_FUNC( hb_p_pushstrshort ) { HB_USHORT wLen = pFunc->pCode[ nPCodePos + 1 ]; - fprintf( cargo->yyc, "\tHB_P_PUSHSTRSHORT, %i,", pFunc->pCode[ nPCodePos + 1 ] ); + fprintf( cargo->yyc, "\tHB_P_PUSHSTRSHORT, %u,", pFunc->pCode[ nPCodePos + 1 ] ); if( cargo->bVerbose ) - fprintf( cargo->yyc, "\t/* %i */", wLen ); + fprintf( cargo->yyc, "\t/* %u */", wLen ); if( wLen > 0 ) { @@ -1762,12 +1763,12 @@ static HB_GENC_FUNC( hb_p_pushstr ) { HB_USHORT wLen = HB_PCODE_MKUSHORT( &pFunc->pCode[ nPCodePos + 1 ] ); - fprintf( cargo->yyc, "\tHB_P_PUSHSTR, %i, %i,", + fprintf( cargo->yyc, "\tHB_P_PUSHSTR, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ] ); if( cargo->bVerbose ) - fprintf( cargo->yyc, "\t/* %i */", wLen ); + fprintf( cargo->yyc, "\t/* %u */", wLen ); if( wLen > 0 ) { @@ -1782,7 +1783,7 @@ static HB_GENC_FUNC( hb_p_pushstrlarge ) { HB_SIZE nLen = HB_PCODE_MKUINT24( &pFunc->pCode[ nPCodePos + 1 ] ); - fprintf( cargo->yyc, "\tHB_P_PUSHSTRLARGE, %i, %i, %i,", + fprintf( cargo->yyc, "\tHB_P_PUSHSTRLARGE, %u, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ], pFunc->pCode[ nPCodePos + 3 ] ); @@ -1803,13 +1804,13 @@ static HB_GENC_FUNC( hb_p_pushstrhidden ) { HB_USHORT wLen = HB_PCODE_MKUSHORT( &pFunc->pCode[ nPCodePos + 2 ] ); - fprintf( cargo->yyc, "\tHB_P_PUSHSTRHIDDEN, %i, %i, %i,", + fprintf( cargo->yyc, "\tHB_P_PUSHSTRHIDDEN, %u, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ], pFunc->pCode[ nPCodePos + 3 ] ); if( cargo->bVerbose ) - fprintf( cargo->yyc, "\t/* %i */", wLen ); + fprintf( cargo->yyc, "\t/* %u */", wLen ); if( wLen > 0 ) { @@ -1822,7 +1823,7 @@ static HB_GENC_FUNC( hb_p_pushstrhidden ) static HB_GENC_FUNC( hb_p_pushsym ) { - fprintf( cargo->yyc, "\tHB_P_PUSHSYM, %i, %i,", + fprintf( cargo->yyc, "\tHB_P_PUSHSYM, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ] ); if( cargo->bVerbose ) @@ -1833,7 +1834,7 @@ static HB_GENC_FUNC( hb_p_pushsym ) static HB_GENC_FUNC( hb_p_pushsymnear ) { - fprintf( cargo->yyc, "\tHB_P_PUSHSYMNEAR, %i,", + fprintf( cargo->yyc, "\tHB_P_PUSHSYMNEAR, %u,", pFunc->pCode[ nPCodePos + 1 ] ); if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolName( cargo->HB_COMP_PARAM, pFunc->pCode[ nPCodePos + 1 ] ) ); @@ -1843,7 +1844,7 @@ static HB_GENC_FUNC( hb_p_pushsymnear ) static HB_GENC_FUNC( hb_p_pushfuncsym ) { - fprintf( cargo->yyc, "\tHB_P_PUSHFUNCSYM, %i, %i,", + fprintf( cargo->yyc, "\tHB_P_PUSHFUNCSYM, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ] ); if( cargo->bVerbose ) @@ -1854,7 +1855,7 @@ static HB_GENC_FUNC( hb_p_pushfuncsym ) static HB_GENC_FUNC( hb_p_pushvariable ) { - fprintf( cargo->yyc, "\tHB_P_PUSHVARIABLE, %i, %i,", + fprintf( cargo->yyc, "\tHB_P_PUSHVARIABLE, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ] ); if( cargo->bVerbose ) @@ -1874,7 +1875,7 @@ static HB_GENC_FUNC( hb_p_retvalue ) static HB_GENC_FUNC( hb_p_send ) { - fprintf( cargo->yyc, "\tHB_P_SEND, %i, %i,\n", + fprintf( cargo->yyc, "\tHB_P_SEND, %u, %u,\n", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ] ); return 3; @@ -1882,7 +1883,7 @@ static HB_GENC_FUNC( hb_p_send ) static HB_GENC_FUNC( hb_p_sendshort ) { - fprintf( cargo->yyc, "\tHB_P_SENDSHORT, %i,\n", pFunc->pCode[ nPCodePos + 1 ] ); + fprintf( cargo->yyc, "\tHB_P_SENDSHORT, %u,\n", pFunc->pCode[ nPCodePos + 1 ] ); return 2; } @@ -1906,14 +1907,14 @@ static HB_GENC_FUNC( hb_p_seqblock ) static HB_GENC_FUNC( hb_p_seqbegin ) { - fprintf( cargo->yyc, "\tHB_P_SEQBEGIN, %i, %i, %i,", + fprintf( cargo->yyc, "\tHB_P_SEQBEGIN, %u, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ], pFunc->pCode[ nPCodePos + 3 ] ); if( cargo->bVerbose ) { HB_ISIZ nOffset = HB_PCODE_MKINT24( &pFunc->pCode[ nPCodePos + 1 ] ); - fprintf( cargo->yyc, "\t/* %" HB_PFS "i (abs: %08" HB_PFS "i) */", nOffset, nPCodePos + nOffset ); + fprintf( cargo->yyc, "\t/* %" HB_PFS "i (abs: %08" HB_PFS "u) */", nOffset, nPCodePos + nOffset ); } fprintf( cargo->yyc, "\n" ); return 4; @@ -1922,17 +1923,17 @@ static HB_GENC_FUNC( hb_p_seqbegin ) static HB_GENC_FUNC( hb_p_seqend ) { if( cargo->bVerbose ) - fprintf( cargo->yyc, "/* %05" HB_PFS "i */ ", nPCodePos ); + fprintf( cargo->yyc, "/* %05" HB_PFS "u */ ", nPCodePos ); else fprintf( cargo->yyc, "\t" ); - fprintf( cargo->yyc, "HB_P_SEQEND, %i, %i, %i,", + fprintf( cargo->yyc, "HB_P_SEQEND, %u, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ], pFunc->pCode[ nPCodePos + 3 ] ); if( cargo->bVerbose ) { HB_ISIZ nOffset = HB_PCODE_MKINT24( &pFunc->pCode[ nPCodePos + 1 ] ); - fprintf( cargo->yyc, "\t/* %" HB_PFS "i (abs: %08" HB_PFS "i) */", nOffset, nPCodePos + nOffset ); + fprintf( cargo->yyc, "\t/* %" HB_PFS "i (abs: %08" HB_PFS "u) */", nOffset, nPCodePos + nOffset ); } fprintf( cargo->yyc, "\n" ); return 4; @@ -1949,14 +1950,14 @@ static HB_GENC_FUNC( hb_p_seqrecover ) static HB_GENC_FUNC( hb_p_seqalways ) { - fprintf( cargo->yyc, "\tHB_P_SEQALWAYS, %i, %i, %i,", + fprintf( cargo->yyc, "\tHB_P_SEQALWAYS, %u, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ], pFunc->pCode[ nPCodePos + 3 ] ); if( cargo->bVerbose ) { HB_ISIZ nOffset = HB_PCODE_MKINT24( &pFunc->pCode[ nPCodePos + 1 ] ); - fprintf( cargo->yyc, "\t/* %" HB_PFS "i (abs: %08" HB_PFS "i) */", nOffset, nPCodePos + nOffset ); + fprintf( cargo->yyc, "\t/* %" HB_PFS "i (abs: %08" HB_PFS "u) */", nOffset, nPCodePos + nOffset ); } fprintf( cargo->yyc, "\n" ); return 4; @@ -1967,18 +1968,18 @@ static HB_GENC_FUNC( hb_p_alwaysbegin ) HB_SYMBOL_UNUSED( pFunc ); if( cargo->bVerbose ) - fprintf( cargo->yyc, "/* %05" HB_PFS "i */ ", nPCodePos ); + fprintf( cargo->yyc, "/* %05" HB_PFS "u */ ", nPCodePos ); else fprintf( cargo->yyc, "\t" ); - fprintf( cargo->yyc, "HB_P_ALWAYSBEGIN, %i, %i, %i,", + fprintf( cargo->yyc, "HB_P_ALWAYSBEGIN, %u, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ], pFunc->pCode[ nPCodePos + 3 ] ); if( cargo->bVerbose ) { HB_ISIZ nOffset = HB_PCODE_MKINT24( &pFunc->pCode[ nPCodePos + 1 ] ); - fprintf( cargo->yyc, "\t/* %" HB_PFS "i (abs: %08" HB_PFS "i) */", nOffset, nPCodePos + nOffset ); + fprintf( cargo->yyc, "\t/* %" HB_PFS "i (abs: %08" HB_PFS "u) */", nOffset, nPCodePos + nOffset ); } fprintf( cargo->yyc, "\n" ); return 4; @@ -1989,7 +1990,7 @@ static HB_GENC_FUNC( hb_p_alwaysend ) HB_SYMBOL_UNUSED( pFunc ); if( cargo->bVerbose ) - fprintf( cargo->yyc, "/* %05" HB_PFS "i */ ", nPCodePos ); + fprintf( cargo->yyc, "/* %05" HB_PFS "u */ ", nPCodePos ); else fprintf( cargo->yyc, "\t" ); @@ -1999,7 +2000,7 @@ static HB_GENC_FUNC( hb_p_alwaysend ) static HB_GENC_FUNC( hb_p_sframe ) { - fprintf( cargo->yyc, "\tHB_P_SFRAME, %i, %i,", + fprintf( cargo->yyc, "\tHB_P_SFRAME, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ] ); if( cargo->bVerbose ) @@ -2010,13 +2011,13 @@ static HB_GENC_FUNC( hb_p_sframe ) static HB_GENC_FUNC( hb_p_statics ) { - fprintf( cargo->yyc, "\tHB_P_STATICS, %i, %i, %i, %i,", + fprintf( cargo->yyc, "\tHB_P_STATICS, %u, %u, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ], pFunc->pCode[ nPCodePos + 3 ], pFunc->pCode[ nPCodePos + 4 ] ); if( cargo->bVerbose ) - fprintf( cargo->yyc, "\t/* symbol (_INITSTATICS), %i statics */", HB_PCODE_MKUSHORT( &pFunc->pCode[ nPCodePos + 3 ] ) ); + fprintf( cargo->yyc, "\t/* symbol (_INITSTATICS), %u statics */", HB_PCODE_MKUSHORT( &pFunc->pCode[ nPCodePos + 3 ] ) ); fprintf( cargo->yyc, "\n" ); return 5; @@ -2026,7 +2027,7 @@ static HB_GENC_FUNC( hb_p_staticname ) { HB_SIZE nStart = nPCodePos; - fprintf( cargo->yyc, "\tHB_P_STATICNAME, %i, %i, %i,", + fprintf( cargo->yyc, "\tHB_P_STATICNAME, %u, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ], pFunc->pCode[ nPCodePos + 3 ] ); @@ -2052,17 +2053,17 @@ static HB_GENC_FUNC( hb_p_threadstatics ) { HB_USHORT w = HB_PCODE_MKUSHORT( &pFunc->pCode[ nPCodePos + 1 ] ), u; - fprintf( cargo->yyc, "\tHB_P_THREADSTATICS, %i, %i,", + fprintf( cargo->yyc, "\tHB_P_THREADSTATICS, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ] ); if( cargo->bVerbose ) - fprintf( cargo->yyc, "\t/* number of thread static variables: %i */", w ); + fprintf( cargo->yyc, "\t/* number of thread static variables: %u */", w ); fprintf( cargo->yyc, "\n" ); nPCodePos += 3; for( u = 0; u < w; ++u ) { - fprintf( cargo->yyc, "\t%i, %i,", + fprintf( cargo->yyc, "\t%u, %u,", pFunc->pCode[ nPCodePos ], pFunc->pCode[ nPCodePos + 1 ] ); if( cargo->bVerbose ) @@ -2129,7 +2130,7 @@ static HB_GENC_FUNC( hb_p_dummy ) static HB_GENC_FUNC( hb_p_enumstart ) { - fprintf( cargo->yyc, "\tHB_P_ENUMSTART, %i, %i,\n", + fprintf( cargo->yyc, "\tHB_P_ENUMSTART, %u, %u,\n", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ] ); return 3; } @@ -2161,11 +2162,11 @@ static HB_GENC_FUNC( hb_p_enumend ) static HB_GENC_FUNC( hb_p_switch ) { if( cargo->bVerbose ) - fprintf( cargo->yyc, "/* %05" HB_PFS "i */ ", nPCodePos ); + fprintf( cargo->yyc, "/* %05" HB_PFS "u */ ", nPCodePos ); else fprintf( cargo->yyc, "\t" ); - fprintf( cargo->yyc, "HB_P_SWITCH, %i, %i,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ] ); + fprintf( cargo->yyc, "HB_P_SWITCH, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ] ); if( cargo->bVerbose ) { @@ -2178,7 +2179,7 @@ static HB_GENC_FUNC( hb_p_switch ) static HB_GENC_FUNC( hb_p_pushdate ) { - fprintf( cargo->yyc, "\tHB_P_PUSHDATE, %i, %i, %i, %i,", + fprintf( cargo->yyc, "\tHB_P_PUSHDATE, %u, %u, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ], pFunc->pCode[ nPCodePos + 3 ], @@ -2200,7 +2201,7 @@ static HB_GENC_FUNC( hb_p_pushdate ) static HB_GENC_FUNC( hb_p_pushtimestamp ) { - fprintf( cargo->yyc, "\tHB_P_PUSHTIMESTAMP, %i, %i, %i, %i, %i, %i, %i, %i,", + fprintf( cargo->yyc, "\tHB_P_PUSHTIMESTAMP, %u, %u, %u, %u, %u, %u, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ], pFunc->pCode[ nPCodePos + 3 ], @@ -2225,7 +2226,7 @@ static HB_GENC_FUNC( hb_p_pushtimestamp ) static HB_GENC_FUNC( hb_p_localnearaddint ) { - fprintf( cargo->yyc, "\tHB_P_LOCALNEARADDINT, %i, %i, %i,", + fprintf( cargo->yyc, "\tHB_P_LOCALNEARADDINT, %u, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ], pFunc->pCode[ nPCodePos + 3 ] ); @@ -2243,7 +2244,7 @@ static HB_GENC_FUNC( hb_p_localnearaddint ) static HB_GENC_FUNC( hb_p_localaddint ) { - fprintf( cargo->yyc, "\tHB_P_LOCALADDINT, %i, %i, %i, %i,", + fprintf( cargo->yyc, "\tHB_P_LOCALADDINT, %u, %u, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ], pFunc->pCode[ nPCodePos + 3 ], @@ -2262,7 +2263,7 @@ static HB_GENC_FUNC( hb_p_localaddint ) static HB_GENC_FUNC( hb_p_localinc ) { - fprintf( cargo->yyc, "\tHB_P_LOCALINC, %i, %i,", pFunc->pCode[ nPCodePos + 1 ], + fprintf( cargo->yyc, "\tHB_P_LOCALINC, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ] ); if( cargo->bVerbose ) @@ -2277,7 +2278,7 @@ static HB_GENC_FUNC( hb_p_localinc ) static HB_GENC_FUNC( hb_p_localdec ) { - fprintf( cargo->yyc, "\tHB_P_LOCALDEC, %i, %i,", pFunc->pCode[ nPCodePos + 1 ], + fprintf( cargo->yyc, "\tHB_P_LOCALDEC, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ] ); if( cargo->bVerbose ) @@ -2292,7 +2293,7 @@ static HB_GENC_FUNC( hb_p_localdec ) static HB_GENC_FUNC( hb_p_localincpush ) { - fprintf( cargo->yyc, "\tHB_P_LOCALINCPUSH, %i, %i,", pFunc->pCode[ nPCodePos + 1 ], + fprintf( cargo->yyc, "\tHB_P_LOCALINCPUSH, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ] ); if( cargo->bVerbose ) @@ -2460,7 +2461,7 @@ static HB_GENC_FUNC( hb_p_withobjectstart ) static HB_GENC_FUNC( hb_p_withobjectmessage ) { - fprintf( cargo->yyc, "\tHB_P_WITHOBJECTMESSAGE, %i, %i,", + fprintf( cargo->yyc, "\tHB_P_WITHOBJECTMESSAGE, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ] ); if( cargo->bVerbose ) @@ -2480,7 +2481,7 @@ static HB_GENC_FUNC( hb_p_withobjectend ) static HB_GENC_FUNC( hb_p_vframe ) { - fprintf( cargo->yyc, "\tHB_P_VFRAME, %i, %i,", + fprintf( cargo->yyc, "\tHB_P_VFRAME, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ] ); if( cargo->bVerbose ) @@ -2491,7 +2492,7 @@ static HB_GENC_FUNC( hb_p_vframe ) static HB_GENC_FUNC( hb_p_largeframe ) { - fprintf( cargo->yyc, "\tHB_P_LARGEFRAME, %i, %i, %i,", + fprintf( cargo->yyc, "\tHB_P_LARGEFRAME, %u, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ], pFunc->pCode[ nPCodePos + 3 ] ); @@ -2503,7 +2504,7 @@ static HB_GENC_FUNC( hb_p_largeframe ) static HB_GENC_FUNC( hb_p_largevframe ) { - fprintf( cargo->yyc, "\tHB_P_LARGEVFRAME, %i, %i, %i,", + fprintf( cargo->yyc, "\tHB_P_LARGEVFRAME, %u, %u, %u,", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ], pFunc->pCode[ nPCodePos + 3 ] ); @@ -2740,7 +2741,7 @@ static void hb_compGenCReadable( HB_COMP_DECL, PHB_HFUNC pFunc, FILE * yyc ) hb_compPCodeEval( pFunc, ( const PHB_PCODE_FUNC * ) pFuncTable, ( void * ) &genc_info ); if( genc_info.bVerbose ) - fprintf( yyc, "/* %05" HB_PFS "i */\n", pFunc->nPCodePos ); + fprintf( yyc, "/* %05" HB_PFS "u */\n", pFunc->nPCodePos ); fprintf( yyc, " };\n\n" ); fprintf( yyc, " hb_vmExecute( pcode, symbols );\n}\n" ); } diff --git a/src/compiler/gencc.c b/src/compiler/gencc.c index 9a4b21c99e..229afafaa7 100644 --- a/src/compiler/gencc.c +++ b/src/compiler/gencc.c @@ -61,7 +61,7 @@ typedef HB_GENC_FUNC_ * PHB_GENC_FUNC; { \ HB_SIZE nLab = HB_GENC_GETLABEL( nPCodePos ); \ if( nLab != 0 ) \ - fprintf( cargo->yyc, "lab%05" HB_PFS "d: ;\n", nLab ); \ + fprintf( cargo->yyc, "lab%05" HB_PFS "u: ;\n", nLab ); \ } while( 0 ) #define HB_GENC_ERROR( s ) \ @@ -196,7 +196,7 @@ static int hb_gencc_checkJumpCondAhead( HB_LONG lValue, PHB_HFUNC pFunc, HB_SIZE { fprintf( cargo->yyc, "\tif( hb_xvm%sIntIs( %ld, &fValue ) ) break;\n", szFunc, lValue ); - fprintf( cargo->yyc, "\tif( %sfValue )\n\t\tgoto lab%05" HB_PFS "d;\n", + fprintf( cargo->yyc, "\tif( %sfValue )\n\t\tgoto lab%05" HB_PFS "u;\n", fNot ? "!" : "", HB_GENC_GETLABEL( nPCodePos + 1 + nOffset ) ); return iSize; } @@ -395,7 +395,7 @@ static HB_GENC_FUNC( hb_p_doshort ) { HB_GENC_LABEL(); - fprintf( cargo->yyc, "\tif( hb_xvmDo( %d ) ) break;\n", + fprintf( cargo->yyc, "\tif( hb_xvmDo( %u ) ) break;\n", pFunc->pCode[ nPCodePos + 1 ] ); return 2; } @@ -428,7 +428,7 @@ static HB_GENC_FUNC( hb_p_swap ) { HB_GENC_LABEL(); - fprintf( cargo->yyc, "\thb_xvmSwap(%d);\n", pFunc->pCode[ nPCodePos + 1 ] ); + fprintf( cargo->yyc, "\thb_xvmSwap( %u );\n", pFunc->pCode[ nPCodePos + 1 ] ); return 2; } @@ -519,7 +519,7 @@ static HB_GENC_FUNC( hb_p_functionshort ) { HB_GENC_LABEL(); - fprintf( cargo->yyc, "\tif( hb_xvmFunction( %d ) ) break;\n", + fprintf( cargo->yyc, "\tif( hb_xvmFunction( %u ) ) break;\n", pFunc->pCode[ nPCodePos + 1 ] ); return 2; } @@ -580,7 +580,7 @@ static HB_GENC_FUNC( hb_p_jumpnear ) HB_GENC_LABEL(); - fprintf( cargo->yyc, "\tgoto lab%05" HB_PFS "d;\n", + fprintf( cargo->yyc, "\tgoto lab%05" HB_PFS "u;\n", HB_GENC_GETLABEL( nPCodePos + nOffset ) ); return 2; } @@ -591,7 +591,7 @@ static HB_GENC_FUNC( hb_p_jump ) HB_GENC_LABEL(); - fprintf( cargo->yyc, "\tgoto lab%05" HB_PFS "d;\n", + fprintf( cargo->yyc, "\tgoto lab%05" HB_PFS "u;\n", HB_GENC_GETLABEL( nPCodePos + nOffset ) ); return 3; } @@ -602,7 +602,7 @@ static HB_GENC_FUNC( hb_p_jumpfar ) HB_GENC_LABEL(); - fprintf( cargo->yyc, "\tgoto lab%05" HB_PFS "d;\n", + fprintf( cargo->yyc, "\tgoto lab%05" HB_PFS "u;\n", HB_GENC_GETLABEL( nPCodePos + nOffset ) ); return 4; } @@ -613,7 +613,7 @@ static HB_GENC_FUNC( hb_p_jumpfalsenear ) HB_GENC_LABEL(); - fprintf( cargo->yyc, "\tif( hb_xvmPopLogical( &fValue ) ) break;\n\tif( ! fValue )\n\t\tgoto lab%05" HB_PFS "d;\n", + fprintf( cargo->yyc, "\tif( hb_xvmPopLogical( &fValue ) ) break;\n\tif( ! fValue )\n\t\tgoto lab%05" HB_PFS "u;\n", HB_GENC_GETLABEL( nPCodePos + nOffset ) ); return 2; } @@ -624,7 +624,7 @@ static HB_GENC_FUNC( hb_p_jumpfalse ) HB_GENC_LABEL(); - fprintf( cargo->yyc, "\tif( hb_xvmPopLogical( &fValue ) ) break;\n\tif( ! fValue )\n\t\tgoto lab%05" HB_PFS "d;\n", + fprintf( cargo->yyc, "\tif( hb_xvmPopLogical( &fValue ) ) break;\n\tif( ! fValue )\n\t\tgoto lab%05" HB_PFS "u;\n", HB_GENC_GETLABEL( nPCodePos + nOffset ) ); return 3; } @@ -635,7 +635,7 @@ static HB_GENC_FUNC( hb_p_jumpfalsefar ) HB_GENC_LABEL(); - fprintf( cargo->yyc, "\tif( hb_xvmPopLogical( &fValue ) ) break;\n\tif( ! fValue )\n\t\tgoto lab%05" HB_PFS "d;\n", + fprintf( cargo->yyc, "\tif( hb_xvmPopLogical( &fValue ) ) break;\n\tif( ! fValue )\n\t\tgoto lab%05" HB_PFS "u;\n", HB_GENC_GETLABEL( nPCodePos + nOffset ) ); return 4; } @@ -646,7 +646,7 @@ static HB_GENC_FUNC( hb_p_jumptruenear ) HB_GENC_LABEL(); - fprintf( cargo->yyc, "\tif( hb_xvmPopLogical( &fValue ) ) break;\n\tif( fValue )\n\t\tgoto lab%05" HB_PFS "d;\n", + fprintf( cargo->yyc, "\tif( hb_xvmPopLogical( &fValue ) ) break;\n\tif( fValue )\n\t\tgoto lab%05" HB_PFS "u;\n", HB_GENC_GETLABEL( nPCodePos + nOffset ) ); return 2; } @@ -657,7 +657,7 @@ static HB_GENC_FUNC( hb_p_jumptrue ) HB_GENC_LABEL(); - fprintf( cargo->yyc, "\tif( hb_xvmPopLogical( &fValue ) ) break;\n\tif( fValue )\n\t\tgoto lab%05" HB_PFS "d;\n", + fprintf( cargo->yyc, "\tif( hb_xvmPopLogical( &fValue ) ) break;\n\tif( fValue )\n\t\tgoto lab%05" HB_PFS "u;\n", HB_GENC_GETLABEL( nPCodePos + nOffset ) ); return 3; } @@ -668,7 +668,7 @@ static HB_GENC_FUNC( hb_p_jumptruefar ) HB_GENC_LABEL(); - fprintf( cargo->yyc, "\tif( hb_xvmPopLogical( &fValue ) ) break;\n\tif( fValue )\n\t\tgoto lab%05" HB_PFS "d;\n", + fprintf( cargo->yyc, "\tif( hb_xvmPopLogical( &fValue ) ) break;\n\tif( fValue )\n\t\tgoto lab%05" HB_PFS "u;\n", HB_GENC_GETLABEL( nPCodePos + nOffset ) ); return 4; } @@ -693,7 +693,7 @@ static HB_GENC_FUNC( hb_p_line ) { HB_GENC_LABEL(); - fprintf( cargo->yyc, "\thb_xvmSetLine( %d );\n", + fprintf( cargo->yyc, "\thb_xvmSetLine( %hu );\n", HB_PCODE_MKUSHORT( &pFunc->pCode[ nPCodePos + 1 ] ) ); return 3; } @@ -716,7 +716,7 @@ static HB_GENC_FUNC( hb_p_macropop ) { HB_GENC_LABEL(); - fprintf( cargo->yyc, "\tif( hb_xvmMacroPop( %d ) ) break;\n", + fprintf( cargo->yyc, "\tif( hb_xvmMacroPop( %u ) ) break;\n", pFunc->pCode[ nPCodePos + 1 ] ); return 2; } @@ -725,7 +725,7 @@ static HB_GENC_FUNC( hb_p_macropopaliased ) { HB_GENC_LABEL(); - fprintf( cargo->yyc, "\tif( hb_xvmMacroPopAliased( %d ) ) break;\n", pFunc->pCode[ nPCodePos + 1 ] ); + fprintf( cargo->yyc, "\tif( hb_xvmMacroPopAliased( %u ) ) break;\n", pFunc->pCode[ nPCodePos + 1 ] ); return 2; } @@ -733,7 +733,7 @@ static HB_GENC_FUNC( hb_p_macropush ) { HB_GENC_LABEL(); - fprintf( cargo->yyc, "\tif( hb_xvmMacroPush( %d ) ) break;\n", + fprintf( cargo->yyc, "\tif( hb_xvmMacroPush( %u ) ) break;\n", pFunc->pCode[ nPCodePos + 1 ] ); return 2; } @@ -786,7 +786,7 @@ static HB_GENC_FUNC( hb_p_macropushlist ) { HB_GENC_LABEL(); - fprintf( cargo->yyc, "\tif( hb_xvmMacroPushList( %d ) ) break;\n", + fprintf( cargo->yyc, "\tif( hb_xvmMacroPushList( %u ) ) break;\n", pFunc->pCode[ nPCodePos + 1 ] ); return 2; } @@ -803,7 +803,7 @@ static HB_GENC_FUNC( hb_p_macropushpare ) { HB_GENC_LABEL(); - fprintf( cargo->yyc, "\tif( hb_xvmMacroPushPare( %d ) ) break;\n", + fprintf( cargo->yyc, "\tif( hb_xvmMacroPushPare( %u ) ) break;\n", pFunc->pCode[ nPCodePos + 1 ] ); return 2; } @@ -812,7 +812,7 @@ static HB_GENC_FUNC( hb_p_macropushaliased ) { HB_GENC_LABEL(); - fprintf( cargo->yyc, "\tif( hb_xvmMacroPushAliased( %d ) ) break;\n", + fprintf( cargo->yyc, "\tif( hb_xvmMacroPushAliased( %u ) ) break;\n", pFunc->pCode[ nPCodePos + 1 ] ); return 2; } @@ -915,7 +915,7 @@ static HB_GENC_FUNC( hb_p_parameter ) { HB_GENC_LABEL(); - fprintf( cargo->yyc, "\thb_xvmParameter( symbols + %hu, %d );\n", + fprintf( cargo->yyc, "\thb_xvmParameter( symbols + %hu, %u );\n", HB_PCODE_MKUSHORT( &pFunc->pCode[ nPCodePos + 1 ] ), pFunc->pCode[ nPCodePos + 3 ] ); return 4; @@ -1062,7 +1062,7 @@ static HB_GENC_FUNC( hb_p_pushaliasedfieldnear ) { HB_GENC_LABEL(); - fprintf( cargo->yyc, "\tif( hb_xvmPushAliasedField( symbols + %d ) ) break;\n", + fprintf( cargo->yyc, "\tif( hb_xvmPushAliasedField( symbols + %u ) ) break;\n", pFunc->pCode[ nPCodePos + 1 ] ); return 2; } @@ -1085,16 +1085,16 @@ static HB_GENC_FUNC( hb_p_pushblockshort ) usSize = pFunc->pCode[ nPCodePos + 1 ] - 2; nPCodePos += 2; - fprintf( cargo->yyc, "\t{\n\t\tstatic const HB_BYTE codeblock[ %hd ] = {", usSize ); + fprintf( cargo->yyc, "\t{\n\t\tstatic const HB_BYTE codeblock[ %hu ] = {", usSize ); for( us = 0; us < usSize; ++us ) { if( ( us & 0x0f ) == 0 ) fprintf( cargo->yyc, "\n\t\t\t" ); if( us == usSize - 1 ) - fprintf( cargo->yyc, "%d", pFunc->pCode[ nPCodePos + us ] ); + fprintf( cargo->yyc, "%u", pFunc->pCode[ nPCodePos + us ] ); else - fprintf( cargo->yyc, "%d, ", pFunc->pCode[ nPCodePos + us ] ); + fprintf( cargo->yyc, "%u, ", pFunc->pCode[ nPCodePos + us ] ); } fprintf( cargo->yyc, " };\n\t\thb_xvmPushBlockShort( codeblock, symbols );\n\t}\n" ); @@ -1110,16 +1110,16 @@ static HB_GENC_FUNC( hb_p_pushblock ) usSize = HB_PCODE_MKUSHORT( &pFunc->pCode[ nPCodePos + 1 ] ) - 3; nPCodePos += 3; - fprintf( cargo->yyc, "\t{\n\t\tstatic const HB_BYTE codeblock[ %hd ] = {", usSize ); + fprintf( cargo->yyc, "\t{\n\t\tstatic const HB_BYTE codeblock[ %hu ] = {", usSize ); for( us = 0; us < usSize; ++us ) { if( ( us & 0x0f ) == 0 ) fprintf( cargo->yyc, "\n\t\t\t" ); if( us == usSize - 1 ) - fprintf( cargo->yyc, "%d", pFunc->pCode[ nPCodePos + us ] ); + fprintf( cargo->yyc, "%u", pFunc->pCode[ nPCodePos + us ] ); else - fprintf( cargo->yyc, "%d, ", pFunc->pCode[ nPCodePos + us ] ); + fprintf( cargo->yyc, "%u, ", pFunc->pCode[ nPCodePos + us ] ); } fprintf( cargo->yyc, " };\n\t\thb_xvmPushBlock( codeblock, symbols );\n\t}\n" ); @@ -1142,9 +1142,9 @@ static HB_GENC_FUNC( hb_p_pushblocklarge ) if( ( ul & 0x0f ) == 0 ) fprintf( cargo->yyc, "\n\t\t\t" ); if( ul == nSize - 1 ) - fprintf( cargo->yyc, "%d", pFunc->pCode[ nPCodePos + ul ] ); + fprintf( cargo->yyc, "%u", pFunc->pCode[ nPCodePos + ul ] ); else - fprintf( cargo->yyc, "%d, ", pFunc->pCode[ nPCodePos + ul ] ); + fprintf( cargo->yyc, "%u, ", pFunc->pCode[ nPCodePos + ul ] ); } fprintf( cargo->yyc, " };\n\t\thb_xvmPushBlock( codeblock, symbols );\n\t}\n" ); @@ -1156,7 +1156,7 @@ static HB_GENC_FUNC( hb_p_pushdouble ) HB_GENC_LABEL(); #if 0 - fprintf( cargo->yyc, "\thb_xvmPushDouble( %.*f, %d, %d );\n", + fprintf( cargo->yyc, "\thb_xvmPushDouble( %.*f, %u, %u );\n", pFunc->pCode[ nPCodePos + 1 + sizeof( double ) + sizeof( HB_BYTE ) ] + 1, HB_PCODE_MKDOUBLE( &pFunc->pCode[ nPCodePos + 1 ] ), pFunc->pCode[ nPCodePos + 1 + sizeof( double ) ], @@ -1170,7 +1170,7 @@ static HB_GENC_FUNC( hb_p_pushdouble ) double d = HB_PCODE_MKDOUBLE( &pFunc->pCode[ nPCodePos + 1 ] ); hb_compGenCString( cargo->yyc, ( const HB_BYTE * ) &d, sizeof( double ) ); } - fprintf( cargo->yyc, ", %d, %d );\n", + fprintf( cargo->yyc, ", %u, %u );\n", pFunc->pCode[ nPCodePos + 1 + sizeof( double ) ], pFunc->pCode[ nPCodePos + 1 + sizeof( double ) + sizeof( HB_BYTE ) ] ); #endif @@ -1513,7 +1513,7 @@ static HB_GENC_FUNC( hb_p_pushsymnear ) } } - fprintf( cargo->yyc, "\thb_xvmPushSymbol( symbols + %d );\n", + fprintf( cargo->yyc, "\thb_xvmPushSymbol( symbols + %u );\n", pFunc->pCode[ nPCodePos + 1 ] ); return 2; } @@ -1557,7 +1557,7 @@ static HB_GENC_FUNC( hb_p_sendshort ) { HB_GENC_LABEL(); - fprintf( cargo->yyc, "\tif( hb_xvmSend( %d ) ) break;\n", + fprintf( cargo->yyc, "\tif( hb_xvmSend( %u ) ) break;\n", pFunc->pCode[ nPCodePos + 1 ] ); return 2; } @@ -1622,7 +1622,7 @@ static HB_GENC_FUNC( hb_p_seqend ) if( nOffset == 4 ) /* no RECOVER clasue */ fprintf( cargo->yyc, "\t} while( 0 );\n\tif( hb_xvmSeqEnd() ) break;\n" ); else /* RECOVER exists */ - fprintf( cargo->yyc, "\tif( hb_xvmSeqEndTest() ) break;\n\tgoto lab%05" HB_PFS "d;\n\t} while( 0 );\n", + fprintf( cargo->yyc, "\tif( hb_xvmSeqEndTest() ) break;\n\tgoto lab%05" HB_PFS "u;\n\t} while( 0 );\n", HB_GENC_GETLABEL( nPCodePos + nOffset ) ); cargo->iNestedBlock--; return 4; @@ -1687,9 +1687,9 @@ static HB_GENC_FUNC( hb_p_threadstatics ) if( ( ul & 0x0f ) == 0 ) fprintf( cargo->yyc, "\n\t\t\t" ); if( ul == nSize - 1 ) - fprintf( cargo->yyc, "%d", pFunc->pCode[ nPCodePos + ul + 3 ] ); + fprintf( cargo->yyc, "%u", pFunc->pCode[ nPCodePos + ul + 3 ] ); else - fprintf( cargo->yyc, "%d, ", pFunc->pCode[ nPCodePos + ul + 3 ] ); + fprintf( cargo->yyc, "%u, ", pFunc->pCode[ nPCodePos + ul + 3 ] ); } fprintf( cargo->yyc, " };\n\t\thb_xvmThreadStatics( %hu, statics );\n\t}\n", w ); @@ -1755,7 +1755,7 @@ static HB_GENC_FUNC( hb_p_enumstart ) { HB_GENC_LABEL(); - fprintf( cargo->yyc, "\tif( hb_xvmEnumStart( %d, %d ) ) break;\n", + fprintf( cargo->yyc, "\tif( hb_xvmEnumStart( %u, %u ) ) break;\n", pFunc->pCode[ nPCodePos + 1 ], pFunc->pCode[ nPCodePos + 2 ] ); return 3; } @@ -1887,7 +1887,7 @@ static HB_GENC_FUNC( hb_p_switch ) nPCodePos += 4; break; } - fprintf( cargo->yyc, "\t\t{\n\t\t\thb_stackPop();\n\t\t\tgoto lab%05" HB_PFS "d;\n\t\t}\n", + fprintf( cargo->yyc, "\t\t{\n\t\t\thb_stackPop();\n\t\t\tgoto lab%05" HB_PFS "u;\n\t\t}\n", HB_GENC_GETLABEL( nNewPos ) ); } if( ! fDefault ) @@ -1921,7 +1921,7 @@ static HB_GENC_FUNC( hb_p_localnearaddint ) { HB_GENC_LABEL(); - fprintf( cargo->yyc, "\tif( hb_xvmLocalAddInt( %d, %d ) ) break;\n", + fprintf( cargo->yyc, "\tif( hb_xvmLocalAddInt( %u, %d ) ) break;\n", pFunc->pCode[ nPCodePos + 1 ], HB_PCODE_MKSHORT( &pFunc->pCode[ nPCodePos + 2 ] ) ); return 4; diff --git a/src/compiler/hbusage.c b/src/compiler/hbusage.c index b1ec4edaf6..62e0e4ed3b 100644 --- a/src/compiler/hbusage.c +++ b/src/compiler/hbusage.c @@ -277,6 +277,6 @@ void hb_compPrintLogo( HB_COMP_DECL ) hb_compOutStd( HB_COMP_PARAM, szVer ); hb_compOutStd( HB_COMP_PARAM, - "\nCopyright (c) 1999-2013, http://harbour-project.org/\n" ); + "\nCopyright (c) 1999-2014, http://harbour-project.org/\n" ); hb_xfree( szVer ); } diff --git a/src/debug/dbgthsh.prg b/src/debug/dbgthsh.prg index 0e2048b398..f97f8c39f8 100644 --- a/src/debug/dbgthsh.prg +++ b/src/debug/dbgthsh.prg @@ -108,7 +108,7 @@ METHOD addWindows( hHash, nRow ) CLASS HBDbHash nWidth := oWndSets:nRight - oWndSets:nLeft - 1 oBrwSets := HBDbBrowser():New( oWndSets:nTop + 1, oWndSets:nLeft + 1, oWndSets:nBottom - 1, oWndSets:nRight - 1 ) oBrwSets:autolite := .F. - oBrwSets:ColorSpec := __Dbg():ClrModal() + oBrwSets:ColorSpec := __dbg():ClrModal() oBrwSets:Cargo := { 1, {} } // Actual highligthed row AAdd( oBrwSets:Cargo[ 2 ], hHash ) @@ -229,13 +229,14 @@ METHOD SetsKeyPressed( nKey, oBrwSets, oWnd, cName, hHash ) CLASS HBDbHash ELSE IF ::lEditable oBrwSets:RefreshCurrent() - IF HB_ISOBJECT( uValue ) - __DbgObject( uValue, cName + "[" + HashKeyString( hHash, nSet ) + "]" ) - ELSEIF HB_ISARRAY( uValue ) - __DbgArrays( uValue, cName + "[" + HashKeyString( hHash, nSet ) + "]" ) - ELSE + DO CASE + CASE HB_ISOBJECT( uValue ) + __dbgObject( uValue, cName + "[" + HashKeyString( hHash, nSet ) + "]" ) + CASE HB_ISARRAY( uValue ) + __dbgArrays( uValue, cName + "[" + HashKeyString( hHash, nSet ) + "]" ) + OTHERWISE ::doGet( oBrwSets, hHash, nSet ) - ENDIF + ENDCASE oBrwSets:RefreshCurrent() oBrwSets:ForceStable() ELSE @@ -284,13 +285,12 @@ STATIC FUNCTION HashBrowseSkip( nPos, oBrwSets ) STATIC FUNCTION HashKeyString( hHash, nAt ) - LOCAL xVal := hb_HKeyAt( hHash, nAt ) - LOCAL cType := ValType( xVal ) + LOCAL xVal := hb_HKeyAt( hHash, nAt ) - DO CASE - CASE cType == "C" ; RETURN '"' + xVal + '"' - CASE cType == "D" ; RETURN '"' + DToC( xVal ) + '"' - CASE cType == "N" ; RETURN hb_ntos( xVal ) - ENDCASE + SWITCH ValType( xVal ) + CASE "C" ; RETURN '"' + xVal + '"' + CASE "D" ; RETURN '"' + DToC( xVal ) + '"' + CASE "N" ; RETURN hb_ntos( xVal ) + ENDSWITCH RETURN AllTrim( __dbgCStr( xVal ) ) diff --git a/src/debug/dbgtmenu.prg b/src/debug/dbgtmenu.prg index 448031306e..bcfe8ca03b 100644 --- a/src/debug/dbgtmenu.prg +++ b/src/debug/dbgtmenu.prg @@ -159,31 +159,30 @@ METHOD AddItem( oMenuItem ) CLASS HBDbMenu METHOD Build() CLASS HBDbMenu - LOCAL n LOCAL nPos := 0 LOCAL oMenuItem IF Len( ::aMenus ) == 1 // pulldown menu - FOR n := 1 TO Len( ::aItems ) - ::aItems[ n ]:nRow := 0 - ::aItems[ n ]:nCol := nPos - nPos += Len( StrTran( ::aItems[ n ]:cPrompt, "~" ) ) + FOR EACH oMenuItem IN ::aItems + oMenuItem:nRow := 0 + oMenuItem:nCol := nPos + nPos += Len( StrTran( oMenuItem:cPrompt, "~" ) ) NEXT ELSE oMenuItem := ATail( ::aMenus[ Len( ::aMenus ) - 1 ]:aItems ) ::nTop := oMenuItem:nRow + 1 ::nLeft := oMenuItem:nCol nPos := ::nLeft - FOR n := 1 TO Len( ::aItems ) - ::aItems[ n ]:nRow := ::nTop + n - ::aItems[ n ]:nCol := ::nLeft + 1 - nPos := Max( nPos, ::nLeft + Len( StrTran( ::aItems[ n ]:cPrompt, "~" ) ) + 1 ) + FOR EACH oMenuItem IN ::aItems + oMenuItem:nRow := ::nTop + oMenuItem:__enumIndex() + oMenuItem:nCol := ::nLeft + 1 + nPos := Max( nPos, ::nLeft + Len( StrTran( oMenuItem:cPrompt, "~" ) ) + 1 ) NEXT ::nRight := nPos + 1 ::nBottom := ::nTop + Len( ::aItems ) + 1 - FOR n := 1 TO Len( ::aItems ) - IF !( Left( ::aItems[ n ]:cPrompt, 1 ) == "-" ) - ::aItems[ n ]:cPrompt := " " + PadR( ::aItems[ n ]:cPrompt, ::nRight - ::nLeft - 1 ) + FOR EACH oMenuItem IN ::aItems + IF !( Left( oMenuItem:cPrompt, 1 ) == "-" ) + oMenuItem:cPrompt := " " + PadR( oMenuItem:cPrompt, ::nRight - ::nLeft - 1 ) ENDIF NEXT ATail( ::aMenus[ Len( ::aMenus ) - 1 ]:aItems ):bAction := ATail( ::aMenus ) @@ -218,7 +217,7 @@ METHOD DeHilite() CLASS HBDbMenu METHOD Display() CLASS HBDbMenu - LOCAL n + LOCAL oMenuItem SetColor( ::cClrPopup ) @@ -231,12 +230,12 @@ METHOD Display() CLASS HBDbMenu hb_Shadow( ::nTop, ::nLeft, ::nBottom, ::nRight ) ENDIF - FOR n := 1 TO Len( ::aItems ) - IF ::aItems[ n ]:cPrompt == "-" // Separator - hb_DispOutAtBox( ::aItems[ n ]:nRow, ::nLeft, ; + FOR EACH oMenuItem IN ::aItems + IF oMenuItem:cPrompt == "-" // Separator + hb_DispOutAtBox( oMenuItem:nRow, ::nLeft, ; hb_UTF8ToStrBox( "├" + Replicate( "─", ::nRight - ::nLeft - 1 ) + "┤" ) ) ELSE - ::aItems[ n ]:Display( ::cClrPopup, ::cClrHotKey ) + oMenuItem:Display( ::cClrPopup, ::cClrHotKey ) ENDIF NEXT @@ -258,12 +257,12 @@ METHOD EvalAction() CLASS HBDbMenu METHOD GetHotKeyPos( cKey ) CLASS HBDbMenu - LOCAL n + LOCAL oMenuItem - FOR n := 1 TO Len( ::aItems ) - IF Upper( SubStr( ::aItems[ n ]:cPrompt, ; - At( "~", ::aItems[ n ]:cPrompt ) + 1, 1 ) ) == cKey - RETURN n + FOR EACH oMenuItem IN ::aItems + IF Upper( SubStr( oMenuItem:cPrompt, ; + At( "~", oMenuItem:cPrompt ) + 1, 1 ) ) == cKey + RETURN oMenuItem:__enumIndex() ENDIF NEXT @@ -271,12 +270,12 @@ METHOD GetHotKeyPos( cKey ) CLASS HBDbMenu METHOD GetItemOrdByCoors( nRow, nCol ) CLASS HBDbMenu - LOCAL n + LOCAL oMenuItem - FOR n := 1 TO Len( ::aItems ) - IF ::aItems[ n ]:nRow == nRow .AND. nCol >= ::aItems[ n ]:nCol .AND. ; - nCol <= ::aItems[ n ]:nCol + Len( ::aItems[ n ]:cPrompt ) - 2 - RETURN n + FOR EACH oMenuItem IN ::aItems + IF oMenuItem:nRow == nRow .AND. nCol >= oMenuItem:nCol .AND. ; + nCol <= oMenuItem:nCol + Len( oMenuItem:cPrompt ) - 2 + RETURN oMenuItem:__enumIndex() ENDIF NEXT @@ -284,19 +283,19 @@ METHOD GetItemOrdByCoors( nRow, nCol ) CLASS HBDbMenu METHOD GetItemByIdent( uIdent ) CLASS HBDbMenu - LOCAL n + LOCAL oMenuItem LOCAL oItem - FOR n := 1 TO Len( ::aItems ) - IF HB_ISOBJECT( ::aItems[ n ]:bAction ) - oItem := ::aItems[ n ]:bAction:GetItemByIdent( uIdent ) + FOR EACH oMenuItem IN ::aItems + IF HB_ISOBJECT( oMenuItem:bAction ) + oItem := oMenuItem:bAction:GetItemByIdent( uIdent ) IF oItem != NIL RETURN oItem ENDIF ELSE - IF ValType( ::aItems[ n ]:Ident ) == ValType( uIdent ) .AND. ; - ::aItems[ n ]:Ident == uIdent - RETURN ::aItems[ n ] + IF ValType( oMenuItem:Ident ) == ValType( uIdent ) .AND. ; + oMenuItem:Ident == uIdent + RETURN oMenuItem ENDIF ENDIF NEXT @@ -377,17 +376,17 @@ METHOD GoTop() CLASS HBDbMenu METHOD LoadColors() CLASS HBDbMenu - LOCAL aColors := __DbgColors() - LOCAL n + LOCAL aColors := __dbgColors() + LOCAL oMenuItem ::cClrPopup := aColors[ 8 ] ::cClrHotKey := aColors[ 9 ] ::cClrHilite := aColors[ 10 ] ::cClrHotFocus := aColors[ 11 ] - FOR n := 1 TO Len( ::aItems ) - IF HB_ISOBJECT( ::aItems[ n ]:bAction ) - ::aItems[ n ]:bAction:LoadColors() + FOR EACH oMenuItem IN ::aItems + IF HB_ISOBJECT( oMenuItem:bAction ) + oMenuItem:bAction:LoadColors() ENDIF NEXT @@ -395,7 +394,7 @@ METHOD LoadColors() CLASS HBDbMenu METHOD Refresh() CLASS HBDbMenu - LOCAL n + LOCAL oMenuItem DispBegin() @@ -404,8 +403,8 @@ METHOD Refresh() CLASS HBDbMenu SetPos( 0, 0 ) ENDIF - FOR n := 1 TO Len( ::aItems ) - ::aItems[ n ]:Display( ::cClrPopup, ::cClrHotKey ) + FOR EACH oMenuItem IN ::aItems + oMenuItem:Display( ::cClrPopup, ::cClrHotKey ) NEXT DispEnd() diff --git a/src/debug/debugger.prg b/src/debug/debugger.prg index 0d652e2cf6..079f897748 100644 --- a/src/debug/debugger.prg +++ b/src/debug/debugger.prg @@ -487,8 +487,8 @@ METHOD All() CLASS HBDebugger METHOD BarDisplay() CLASS HBDebugger - LOCAL cClrItem := __DbgColors()[ 8 ] - LOCAL cClrHotKey := __DbgColors()[ 9 ] + LOCAL cClrItem := __dbgColors()[ 8 ] + LOCAL cClrHotKey := __dbgColors()[ 9 ] DispBegin() @@ -518,7 +518,7 @@ METHOD BuildBrowseStack() CLASS HBDebugger LOCAL aColors IF ::oBrwStack == NIL - aColors := __DbgColors() + aColors := __dbgColors() ::oBrwStack := HBDbBrowser():New( 2, ::nMaxCol - 14, ::nMaxRow - 7, ::nMaxCol - 1 ) ::oBrwStack:ColorSpec := aColors[ 3 ] + "," + aColors[ 4 ] + "," + aColors[ 5 ] + "," + aColors[ 6 ] ::oBrwStack:goTopBlock := {|| ::oBrwStack:Cargo := 1 } @@ -548,8 +548,8 @@ METHOD BuildCommandWindow() CLASS HBDebugger ::oWndCommand:bKeyPressed := {| nKey | ::CommandWindowProcessKey( nKey ) } ::oWndCommand:bPainted := {|| ::CommandWindowDisplay(), ; hb_DispOutAt( ::oWndCommand:nBottom - 1, ::oWndCommand:nLeft + 1, ; - "> ", __DbgColors()[ 2 ] ), ; - ::oGetCommand:SetColor( __DbgColors()[ 2 ] ):display() } + "> ", __dbgColors()[ 2 ] ), ; + ::oGetCommand:SetColor( __dbgColors()[ 2 ] ):display() } AAdd( ::aWindows, ::oWndCommand ) ::aHistCommands := { "" } @@ -558,7 +558,7 @@ METHOD BuildCommandWindow() CLASS HBDebugger nSize := ::oWndCommand:nRight - ::oWndCommand:nLeft - 3 ::oGetCommand := HbDbInput():new( ::oWndCommand:nBottom - 1, ::oWndCommand:nLeft + 3, ; - nSize, "", __DbgColors()[ 2 ], Max( nSize, 256 ) ) + nSize, "", __dbgColors()[ 2 ], Max( nSize, 256 ) ) RETURN NIL @@ -804,11 +804,11 @@ METHOD CommandWindowDisplay( cLine, lCmd ) CLASS HBDebugger n := Len( ::aHistCommands ) nRow := ::oWndCommand:nBottom nSize := ::oWndCommand:nRight - ::oWndCommand:nLeft - 1 - hb_DispOutAt( --nRow, ::oWndCommand:nLeft + 1, "> ", __DbgColors()[ 2 ] ) - WHILE --nRow > ::oWndCommand:nTop + hb_DispOutAt( --nRow, ::oWndCommand:nLeft + 1, "> ", __dbgColors()[ 2 ] ) + DO WHILE --nRow > ::oWndCommand:nTop hb_DispOutAt( nRow, ::oWndCommand:nLeft + 1, ; PadR( iif( n > 0, ::aHistCommands[ n-- ], "" ), nSize ), ; - __DbgColors()[ 2 ] ) + __dbgColors()[ 2 ] ) ENDDO RETURN NIL @@ -848,7 +848,7 @@ METHOD CommandWindowProcessKey( nKey ) CLASS HBDebugger ENDIF hb_DispOutAt( ::oWndCommand:nBottom - 1, ::oWndCommand:nLeft + 1, ; PadR( "> ", ::oWndCommand:nRight - ::oWndCommand:nLeft - 1 ), ; - __DbgColors()[ 2 ] ) + __dbgColors()[ 2 ] ) ::oGetCommand:setValue( "" ):display() EXIT OTHERWISE @@ -1067,13 +1067,14 @@ METHOD DoCommand( cCommand ) CLASS HBDebugger ::FindNext() CASE cCommand == "NUM" - IF Upper( cParam ) == "OFF" - ::LineNumbers( .F. ) - ELSEIF Upper( cParam ) == "ON" - ::LineNumbers( .T. ) - ELSE + SWITCH Upper( cParam ) + CASE "OFF" + ::LineNumbers( .F. ) ; EXIT + CASE "ON" + ::LineNumbers( .T. ) ; EXIT + OTHERWISE cResult := "Command error" - ENDIF + ENDSWITCH CASE starts( "OPTIONS", cCommand ) @@ -1105,7 +1106,7 @@ METHOD DoCommand( cCommand ) CLASS HBDebugger ELSE cParam1 := SubStr( cParam1, At( "{", cParam1 ) + 1 ) FOR n := 1 TO 11 - IF At( ",", cParam1 ) != 0 + IF "," $ cParam1 ::aColors[ n ] := ; StrTran( Left( cParam1, At( ",", cParam1 ) - 1 ), '"' ) cParam1 := SubStr( cParam1, At( ",", cParam1 ) + 1 ) @@ -1284,7 +1285,7 @@ METHOD DoCommand( cCommand ) CLASS HBDebugger hb_DispOutAt( ::oWndCommand:nBottom - 1, ::oWndCommand:nLeft + 1, ; Space( ::oWndCommand:nRight - ::oWndCommand:nLeft - 1 ), ; - __DbgColors()[ 2 ] ) + __dbgColors()[ 2 ] ) IF ! Empty( cResult ) ::CommandWindowDisplay( cResult, .F. ) ENDIF @@ -1305,7 +1306,7 @@ METHOD DoScript( cFileName ) CLASS HBDebugger nLen := MLCount( cInfo, 16384, NIL, .F., .T. ) FOR n := 1 TO nLen cLine := AllTrim( MemoLine( cInfo, 16384, n, NIL, .F., .T. ) ) - IF ::lActive .OR. ( ( nPos := At( ' ', cLine ) ) > 0 .AND. starts( "OPTIONS", Upper( Left( cLine, nPos - 1 ) ) ) ) + IF ::lActive .OR. ( ( nPos := At( " ", cLine ) ) > 0 .AND. starts( "OPTIONS", Upper( Left( cLine, nPos - 1 ) ) ) ) // In inactive debugger, only "OPTIONS" commands can be executed safely ::DoCommand( cLine ) ENDIF @@ -1378,13 +1379,13 @@ METHOD EditVar( nVar ) CLASS HBDebugger CASE cVarStr == "{ ... }" // aArray := ::VarGetValue( ::aVars[ nVar ] ) IF Len( uVarValue ) > 0 - __DbgArrays( uVarValue, cVarName ) + __dbgArrays( uVarValue, cVarName ) ELSE __dbgAlert( "Array is empty" ) ENDIF CASE Upper( Left( cVarStr, 5 ) ) == "CLASS" - __DbgObject( uVarValue, cVarName ) + __dbgObject( uVarValue, cVarName ) OTHERWISE BEGIN SEQUENCE WITH {| oErr | Break( oErr ) } @@ -1512,7 +1513,6 @@ METHOD HandleEvent() CLASS HBDebugger LOCAL nKey LOCAL nMRow LOCAL nMCol - LOCAL n IF ::lAnimate IF ::nSpeed != 0 @@ -1546,14 +1546,14 @@ METHOD HandleEvent() CLASS HBDebugger nMRow := MRow() nMCol := MCol() - FOR n := 1 TO Len( ::aWindows ) - IF ::aWindows[ n ]:IsOver( nMRow, nMCol ) - IF ! ::aWindows[ n ]:lFocused + FOR EACH oWnd IN ::aWindows + IF oWnd:IsOver( nMRow, nMCol ) + IF ! oWnd:lFocused ::aWindows[ ::nCurrentWindow ]:Show( .F. ) - ::nCurrentWindow := n - ::aWindows[ n ]:Show( .T. ) + ::nCurrentWindow := oWnd:__enumIndex() + oWnd:Show( .T. ) ENDIF - ::aWindows[ n ]:LDblClick( nMRow, nMCol ) + oWnd:LDblClick( nMRow, nMCol ) EXIT ENDIF NEXT @@ -1578,14 +1578,14 @@ METHOD HandleEvent() CLASS HBDebugger nMRow := MRow() nMCol := MCol() - FOR n := 1 TO Len( ::aWindows ) - IF ::aWindows[ n ]:IsOver( nMRow, nMCol ) - IF ! ::aWindows[ n ]:lFocused + FOR EACH oWnd IN ::aWindows + IF oWnd:IsOver( nMRow, nMCol ) + IF ! oWnd:lFocused ::aWindows[ ::nCurrentWindow ]:Show( .F. ) - ::nCurrentWindow := n - ::aWindows[ n ]:Show( .T. ) + ::nCurrentWindow := oWnd:__enumIndex() + oWnd:Show( .T. ) ENDIF - ::aWindows[ n ]:LButtonDown( nMRow, nMCol ) + oWnd:LButtonDown( nMRow, nMCol ) EXIT ENDIF NEXT @@ -1594,7 +1594,7 @@ METHOD HandleEvent() CLASS HBDebugger CASE K_RBUTTONDOWN EXIT -/* +#if 0 CASE K_ESC ::RestoreAppStatus() t_oDebugger := NIL @@ -1602,10 +1602,10 @@ METHOD HandleEvent() CLASS HBDebugger DispEnd() ::Exit() EXIT -*/ +#endif CASE K_ENTER - IF !Empty( ::oGetCommand:getValue() ) + IF ! Empty( ::oGetCommand:getValue() ) ::oWndCommand:KeyPressed( nKey ) EXIT ENDIF @@ -1623,8 +1623,7 @@ METHOD HandleEvent() CLASS HBDebugger CASE K_CTRL_HOME CASE K_CTRL_END CASE K_CTRL_ENTER - oWnd := ::aWindows[ ::nCurrentWindow ] - oWnd:KeyPressed( nKey ) + ::aWindows[ ::nCurrentWindow ]:KeyPressed( nKey ) EXIT CASE K_F1 @@ -1672,7 +1671,7 @@ METHOD HandleEvent() CLASS HBDebugger EXIT OTHERWISE - IF !::OpenMenu( __dbgAltToKey( nKey ) ) + IF ! ::OpenMenu( __dbgAltToKey( nKey ) ) ::oWndCommand:KeyPressed( nKey ) ENDIF ENDSWITCH @@ -1779,7 +1778,7 @@ METHOD InputBox( cMsg, uValue, bValid, lEditable ) CLASS HBDebugger uTemp := PadR( uValue, nWidth ) ENDIF __dbgInput( nTop + 1, nLeft + 1, nWidth, @uTemp, bValid, ; - __DbgColors()[ 5 ], Max( Max( nWidth, Len( uTemp ) ), 256 ) ) + __dbgColors()[ 5 ], Max( Max( nWidth, Len( uTemp ) ), 256 ) ) SWITCH cType CASE "C" ; uTemp := AllTrim( uTemp ) ; EXIT CASE "D" ; uTemp := CToD( uTemp ) ; EXIT @@ -1788,7 +1787,7 @@ METHOD InputBox( cMsg, uValue, bValid, lEditable ) CLASS HBDebugger ELSE - hb_DispOutAt( nTop + 1, nLeft + 1, __dbgValToStr( uValue ), "," + __DbgColors()[ 5 ] ) + hb_DispOutAt( nTop + 1, nLeft + 1, __dbgValToStr( uValue ), "," + __dbgColors()[ 5 ] ) SetPos( nTop + 1, nLeft + 1 ) lExit := .F. @@ -1801,26 +1800,28 @@ METHOD InputBox( cMsg, uValue, bValid, lEditable ) CLASS HBDebugger EXIT CASE K_ENTER - IF cType == "A" + + SWITCH cType + CASE "A" IF Len( uValue ) == 0 __dbgAlert( "Array is empty" ) ELSE - __DbgArrays( uValue, cMsg ) + __dbgArrays( uValue, cMsg ) ENDIF - - ELSEIF cType == "H" + EXIT + CASE "H" IF Len( uValue ) == 0 __dbgAlert( "Hash is empty" ) ELSE - __DbgHashes( uValue, cMsg ) + __dbgHashes( uValue, cMsg ) ENDIF - - ELSEIF cType == "O" - __DbgObject( uValue, cMsg ) - - ELSE + EXIT + CASE "O" + __dbgObject( uValue, cMsg ) + EXIT + OTHERWISE __dbgAlert( "Value cannot be edited" ) - ENDIF + ENDSWITCH EXIT OTHERWISE @@ -1900,7 +1901,7 @@ METHOD ListBox( cCaption, aItems ) CLASS HBDebugger oWndList:lShadow := .T. oWndList:Show() - aColors := __DbgColors() + aColors := __dbgColors() n := __dbgAChoice( nTop + 1, nLeft + 1, nBottom - 1, nRight - 1, aItems, ; aColors[ 8 ] + "," + aColors[ 10 ] ) oWndList:Hide() @@ -1939,17 +1940,17 @@ METHOD LoadCallStack() CLASS HBDebugger METHOD LoadColors() CLASS HBDebugger - LOCAL n + LOCAL oWnd ::oPullDown:LoadColors() IF ::lActive ::oPullDown:Refresh() ::BarDisplay() ENDIF - FOR n := 1 TO Len( ::aWindows ) - ::aWindows[ n ]:LoadColors() + FOR EACH oWnd IN ::aWindows + oWnd:LoadColors() IF ::lActive - ::aWindows[ n ]:Refresh() + oWnd:Refresh() ENDIF NEXT @@ -1970,7 +1971,6 @@ METHOD LoadVars() CLASS HBDebugger // updates monitored variables LOCAL m LOCAL xValue LOCAL cName - LOCAL aVars LOCAL aBVars LOCAL hSkip @@ -2007,20 +2007,18 @@ METHOD LoadVars() CLASS HBDebugger // updates monitored variables IF ::aProcStack[ ::oBrwStack:Cargo ][ CSTACK_LINE ] != NIL IF ::lShowGlobals cName := ::aProcStack[ ::oBrwStack:Cargo ][ CSTACK_MODULE ] - FOR n := 1 TO Len( ::aModules ) + FOR EACH n IN ::aModules IF ! ::lShowAllGlobals - IF ! ::ModuleMatch( ::aModules[ n ][ MODULE_NAME ], cName ) + IF ! ::ModuleMatch( n[ MODULE_NAME ], cName ) LOOP ENDIF ENDIF - aVars := ::aModules[ n ][ MODULE_GLOBALS ] - FOR m := 1 TO Len( aVars ) - AAdd( aBVars, aVars[ m ] ) + FOR EACH m IN n[ MODULE_GLOBALS ] + AAdd( aBVars, m ) NEXT IF ! ::lShowAllGlobals - aVars := ::aModules[ n ][ MODULE_EXTERNGLOBALS ] - FOR m := 1 TO Len( aVars ) - AAdd( aBVars, aVars[ m ] ) + FOR EACH m IN n[ MODULE_EXTERNGLOBALS ] + AAdd( aBVars, m ) NEXT ENDIF NEXT @@ -2030,27 +2028,24 @@ METHOD LoadVars() CLASS HBDebugger // updates monitored variables cName := ::aProcStack[ ::oBrwStack:Cargo ][ CSTACK_MODULE ] n := AScan( ::aModules, {| a | ::ModuleMatch( a[ MODULE_NAME ], cName ) } ) IF n > 0 - aVars := ::aModules[ n ][ MODULE_STATICS ] - FOR m := 1 TO Len( aVars ) - AAdd( aBVars, aVars[ m ] ) + FOR EACH m IN ::aModules[ n ][ MODULE_STATICS ] + AAdd( aBVars, m ) NEXT ENDIF - aVars := ::aProcStack[ ::oBrwStack:Cargo ][ CSTACK_STATICS ] - FOR n := 1 TO Len( aVars ) - AAdd( aBVars, aVars[ n ] ) + FOR EACH n IN ::aProcStack[ ::oBrwStack:Cargo ][ CSTACK_STATICS ] + AAdd( aBVars, n ) NEXT ENDIF IF ::lShowLocals - aVars := ::aProcStack[ ::oBrwStack:Cargo ][ CSTACK_LOCALS ] - FOR n := 1 TO Len( aVars ) - cName := aVars[ n ][ VAR_NAME ] + FOR EACH n IN ::aProcStack[ ::oBrwStack:Cargo ][ CSTACK_LOCALS ] + cName := n[ VAR_NAME ] m := AScan( aBVars, ; // Is there another var with this name ? - {| aVar | aVar[ VAR_NAME ] == cName .AND. Left( aVar[ VAR_TYPE ], 1 ) == "S" } ) + {| aVar | aVar[ VAR_NAME ] == cName .AND. Left( aVar[ VAR_TYPE ], 1 ) == "S" } ) IF m > 0 - aBVars[ m ] := aVars[ n ] + aBVars[ m ] := n ELSE - AAdd( aBVars, aVars[ n ] ) + AAdd( aBVars, n ) ENDIF NEXT ENDIF @@ -2102,13 +2097,11 @@ METHOD Locate( nMode, cValue ) CLASS HBDebugger METHOD LocatePrgPath( cPrgName ) CLASS HBDebugger - LOCAL aPaths := ::aPathDirs - LOCAL iMax := Len( aPaths ) LOCAL cRetPrgName - LOCAL i + LOCAL cDir - FOR i := 1 TO iMax - cRetPrgName := aPaths[ i ] + hb_ps() + cPrgName + FOR EACH cDir IN ::aPathDirs + cRetPrgName := cDir + hb_ps() + cPrgName IF hb_FileExists( cRetPrgName ) RETURN cRetPrgName ENDIF @@ -2141,6 +2134,7 @@ METHOD NextWindow() CLASS HBDebugger LOCAL oWnd IF Len( ::aWindows ) > 0 + oWnd := ::aWindows[ ::nCurrentWindow++ ] oWnd:Show( .F. ) IF ::nCurrentWindow > Len( ::aWindows ) @@ -2171,14 +2165,16 @@ METHOD Open() CLASS HBDebugger hb_AIns( aFiles, 1, "(Another file)", .T. ) nFileName := ::ListBox( "Please choose a source file", aFiles ) - IF nFileName == 0 + SWITCH nFileName + CASE 0 RETURN NIL - ELSEIF nFileName == 1 + CASE 1 cFileName := ::InputBox( "Please enter the filename", Space( 255 ) ) cFileName := AllTrim( cFileName ) - ELSE + EXIT + OTHERWISE cFileName := aFiles[ nFileName ] - ENDIF + ENDSWITCH IF ! Empty( cFileName ) ; .AND. ( ValType( ::cPrgName ) == "U" .OR. ! hb_FileMatch( cFileName, ::cPrgName ) ) @@ -2197,8 +2193,8 @@ METHOD Open() CLASS HBDebugger ::oPulldown:GetItemByIdent( "PPO" ):Checked := ::lPPO ::oBrwText := HBBrwText():New( ::oWndCode:nTop + 1, ::oWndCode:nLeft + 1, ; ::oWndCode:nBottom - 1, ::oWndCode:nRight - 1, cFileName, ; - __DbgColors()[ 2 ] + "," + __DbgColors()[ 5 ] + "," + ; - __DbgColors()[ 3 ] + "," + __DbgColors()[ 6 ], ; + __dbgColors()[ 2 ] + "," + __dbgColors()[ 5 ] + "," + ; + __dbgColors()[ 3 ] + "," + __dbgColors()[ 6 ], ; ::lLineNumbers, ::nTabWidth ) ::oWndCode:Browser := ::oBrwText ::oWndCode:SetCaption( ::cPrgName ) @@ -2207,8 +2203,8 @@ METHOD Open() CLASS HBDebugger RETURN NIL - METHOD OpenMenu( cName ) CLASS HBDebugger + LOCAL nPopup := ::oPullDown:GetHotKeyPos( Left( cName, 1 ) ) IF nPopup == 0 @@ -2221,8 +2217,8 @@ METHOD OpenMenu( cName ) CLASS HBDebugger SetCursor( SC_NONE ) ::oPullDown:ShowPopup( nPopup ) ENDIF - RETURN .T. + RETURN .T. METHOD OpenPPO() CLASS HBDebugger @@ -2250,8 +2246,8 @@ METHOD OpenPPO() CLASS HBDebugger IF lSuccess ::oBrwText := HBBrwText():New( ::oWndCode:nTop + 1, ::oWndCode:nLeft + 1, ; ::oWndCode:nBottom - 1, ::oWndCode:nRight - 1, ::cPrgName, ; - __DbgColors()[ 2 ] + "," + __DbgColors()[ 5 ] + "," + ; - __DbgColors()[ 3 ] + "," + __DbgColors()[ 6 ], ::lLineNumbers, ::nTabWidth ) + __dbgColors()[ 2 ] + "," + __dbgColors()[ 5 ] + "," + ; + __dbgColors()[ 3 ] + "," + __dbgColors()[ 6 ], ::lLineNumbers, ::nTabWidth ) ::oWndCode:Browser := ::oBrwText ::oWndCode:SetCaption( ::cPrgName ) ::oWndCode:Refresh() // to force the window caption to update @@ -2342,7 +2338,6 @@ METHOD PrevWindow() CLASS HBDebugger ENDDO oWnd := ::aWindows[ ::nCurrentWindow ] oWnd:Show( .T. ) - ENDIF RETURN NIL @@ -2405,11 +2400,12 @@ METHOD ResizeWindows( oWindow ) CLASS HBDebugger LOCAL nTop LOCAL lVisible2 := .F. - IF oWindow == ::oWndVars + DO CASE + CASE oWindow == ::oWndVars oWindow2 := ::oWndPnt - ELSEIF oWindow == ::oWndPnt + CASE oWindow == ::oWndPnt oWindow2 := ::oWndVars - ENDIF + ENDCASE DispBegin() IF oWindow2 == NIL @@ -2571,9 +2567,9 @@ METHOD SaveSettings( cFileName ) CLASS HBDebugger ENDIF cInfo += "Options Colors {" - FOR n := 1 TO Len( ::aColors ) - cInfo += '"' + ::aColors[ n ] + '"' - IF n < Len( ::aColors ) + FOR EACH n IN ::aColors + cInfo += '"' + n + '"' + IF ! n:__enumIsLast() cInfo += "," ENDIF NEXT @@ -2636,10 +2632,9 @@ METHOD SaveSettings( cFileName ) CLASS HBDebugger cInfo += Upper( aWatch[ 1 ] ) + " " + aWatch[ 2 ] + hb_eol() NEXT - IF !::lWindowsAutoSized + IF ! ::lWindowsAutoSized /* This part of the script must be executed after all windows are created */ - FOR n := 1 TO Len( ::aWindows ) - oWnd := ::aWindows[ n ] + FOR EACH oWnd IN ::aWindows cInfo += "Window Size " + hb_ntos( oWnd:nBottom - oWnd:nTop + 1 ) + " " cInfo += hb_ntos( oWnd:nRight - oWnd:nLeft + 1 ) + hb_eol() cInfo += "Window Move " + hb_ntos( oWnd:nTop ) + " " @@ -2732,7 +2727,7 @@ METHOD ShowCallStack() CLASS HBDebugger // Maintain fixed window array order: code, monitor, watch, callstack, command IF ::nCurrentWindow >= Len( ::aWindows ) - ::nCurrentWindow++ + ::nCurrentWindow++ ENDIF hb_AIns( ::aWindows, Len( ::aWindows ), ::oWndStack, .T. ) @@ -2740,8 +2735,8 @@ METHOD ShowCallStack() CLASS HBDebugger ::BuildBrowseStack() ENDIF - ::oWndStack:bPainted := {|| ::oBrwStack:ColorSpec := __DbgColors()[ 2 ] + "," + ; - __DbgColors()[ 5 ] + "," + __DbgColors()[ 4 ] + "," + __DbgColors()[ 6 ], ; + ::oWndStack:bPainted := {|| ::oBrwStack:ColorSpec := __dbgColors()[ 2 ] + "," + ; + __dbgColors()[ 5 ] + "," + __dbgColors()[ 4 ] + "," + __dbgColors()[ 6 ], ; ::oBrwStack:RefreshAll(), ::oBrwStack:ForceStable() } ::oWndStack:bGotFocus := {|| SetCursor( SC_NONE ) } @@ -2804,8 +2799,8 @@ METHOD ShowCodeLine( nProc ) CLASS HBDebugger IF ::oBrwText == NIL ::oBrwText := HBBrwText():New( ::oWndCode:nTop + 1, ::oWndCode:nLeft + 1, ; ::oWndCode:nBottom - 1, ::oWndCode:nRight - 1, cPrgName, ; - __DbgColors()[ 2 ] + "," + __DbgColors()[ 5 ] + "," + ; - __DbgColors()[ 3 ] + "," + __DbgColors()[ 6 ], ; + __dbgColors()[ 2 ] + "," + __dbgColors()[ 5 ] + "," + ; + __dbgColors()[ 3 ] + "," + __dbgColors()[ 6 ], ; ::lLineNumbers, ::nTabWidth ) ::oWndCode:Browser := ::oBrwText @@ -2888,7 +2883,7 @@ METHOD ShowVars() CLASS HBDebugger // Maintain fixed window array order: code, monitor, watch, callstack, command hb_AIns( ::aWindows, 2, ::oWndVars, .T. ) IF ::nCurrentWindow >= 2 - ::nCurrentWindow++ + ::nCurrentWindow++ ENDIF lWindowCreated := .T. @@ -2903,23 +2898,24 @@ METHOD ShowVars() CLASS HBDebugger iif( ::lShowPublics, " Public", "" ) nBottom := ::oWndVars:nBottom - IF Len( ::aVars ) == 0 + DO CASE + CASE Len( ::aVars ) == 0 IF ::oWndVars:nBottom - ::oWndVars:nTop > 1 nBottom := nTop + 1 ENDIF - ELSEIF Len( ::aVars ) > ::oWndVars:nBottom - ::oWndVars:nTop - 1 + CASE Len( ::aVars ) > ::oWndVars:nBottom - ::oWndVars:nTop - 1 nBottom := nTop + Min( Len( ::aVars ) + 1, MAX_VARS_HEIGHT ) - ELSEIF Len( ::aVars ) < ::oWndVars:nBottom - ::oWndVars:nTop - 1 + CASE Len( ::aVars ) < ::oWndVars:nBottom - ::oWndVars:nTop - 1 nBottom := nTop + Len( ::aVars ) + 1 - ELSE + OTHERWISE nBottom := ::oWndVars:nBottom - ENDIF + ENDCASE ENDIF IF Len( ::aVars ) > 0 .AND. ::oBrwVars == NIL ::oBrwVars := HBDbBrowser():New( nTop + 1, 1, nBottom - 1, ; ::nMaxCol - iif( ::oWndStack != NIL, ::oWndStack:nWidth(), 0 ) - 1 ) - aColors := __DbgColors() + aColors := __dbgColors() ::oBrwVars:Cargo := { 1, {} } // Actual highlighted row ::oBrwVars:ColorSpec := aColors[ 2 ] + "," + aColors[ 5 ] + "," + aColors[ 3 ] + "," + aColors[ 6 ] ::oBrwVars:goTopBlock := {|| ::oBrwVars:cargo[ 1 ] := Min( 1, Len( ::aVars ) ) } @@ -3145,7 +3141,7 @@ METHOD VarGetInfo( aVar ) CLASS HBDebugger OTHERWISE; RETURN aVar[ VAR_NAME ] + " <" + aVar[ VAR_TYPE ] + ", " + ValType( uValue ) + ">: " + __dbgValToStr( uValue ) ENDSWITCH - // ; Never reached + // Never reached RETURN "" @@ -3159,7 +3155,7 @@ METHOD VarGetValue( aVar ) CLASS HBDebugger OTHERWISE; RETURN aVar[ VAR_POS ] // Public or Private ENDSWITCH - // ; Never reached + // Never reached RETURN NIL @@ -3407,7 +3403,7 @@ METHOD WatchpointsShow() CLASS HBDebugger ::oWndPnt:Browser := ::oBrwPnt ::oBrwPnt:Cargo := { 1, {} } // Actual highlighted row - aColors := __DbgColors() + aColors := __dbgColors() ::oBrwPnt:ColorSpec := aColors[ 2 ] + "," + aColors[ 5 ] + "," + aColors[ 3 ] + "," + aColors[ 6 ] ::oBrwPnt:goTopBlock := {|| ::oBrwPnt:cargo[ 1 ] := Min( 1, Len( ::aWatch ) ) } ::oBrwPnt:goBottomBlock := {|| ::oBrwPnt:cargo[ 1 ] := Len( ::aWatch ) } @@ -3442,10 +3438,10 @@ METHOD WatchpointsShow() CLASS HBDebugger ::oBrwPnt:ForceStable() ) } // Maintain fixed window array order: code, monitor, watch, callstack, command - nPos := IIf( ::aWindows[2] == ::oWndVars, 3, 2 ) + nPos := iif( ::aWindows[ 2 ] == ::oWndVars, 3, 2 ) hb_AIns( ::aWindows, nPos, ::oWndPnt, .T. ) IF ::nCurrentWindow >= nPos - ::nCurrentWindow++ + ::nCurrentWindow++ ENDIF ::oWndPnt:Show() @@ -3455,16 +3451,17 @@ METHOD WatchpointsShow() CLASS HBDebugger ::oBrwPnt:cargo[ 1 ] := 1 ENDIF DispBegin() - IF Len( ::aWatch ) > ::oWndPnt:nBottom - ::oWndPnt:nTop - 1 + DO CASE + CASE Len( ::aWatch ) > ::oWndPnt:nBottom - ::oWndPnt:nTop - 1 // Resize( top, left, bottom, right ) ::oWndPnt:Resize( ,, ::oWndPnt:nTop + Min( Len( ::aWatch ) + 1, 4 ) ) lRepaint := .T. - ELSEIF Len( ::aWatch ) < ::oWndPnt:nBottom - ::oWndPnt:nTop - 1 + CASE Len( ::aWatch ) < ::oWndPnt:nBottom - ::oWndPnt:nTop - 1 ::oWndPnt:Resize( ,, ::oWndPnt:nTop + Len( ::aWatch ) + 1 ) lRepaint := .T. - ELSE + OTHERWISE ::oBrwPnt:RefreshAll():ForceStable() - ENDIF + ENDCASE IF ! ::oWndPnt:lVisible .OR. lRepaint ::ResizeWindows( ::oWndPnt ) ENDIF @@ -3553,11 +3550,11 @@ STATIC PROCEDURE SetsKeyPressed( nKey, oBrwSets, nSets, oWnd, cCaption, bEdit ) RETURN -FUNCTION __DbgColors() +FUNCTION __dbgColors() RETURN t_oDebugger:GetColors() -FUNCTION __Dbg() +FUNCTION __dbg() RETURN t_oDebugger @@ -3626,19 +3623,20 @@ FUNCTION __dbgInput( nRow, nCol, nWidth, cValue, bValid, cColor, nSize ) oGet := HbDbInput():new( nRow, nCol, nWidth, cValue, cColor, nSize ) oGet:setFocus() - WHILE .T. + DO WHILE .T. nKey := Inkey( 0, INKEY_ALL ) - IF nKey == K_ESC + DO CASE + CASE nKey == K_ESC EXIT - ELSEIF nKey == K_ENTER + CASE nKey == K_ENTER IF bValid == NIL .OR. Eval( bValid, oGet:getValue() ) cValue := oGet:getValue() lOK := .T. EXIT ENDIF - ELSE + OTHERWISE oGet:applyKey( nKey ) - ENDIF + ENDCASE ENDDO SetCursor( nOldCursor ) @@ -3646,7 +3644,7 @@ FUNCTION __dbgInput( nRow, nCol, nWidth, cValue, bValid, cColor, nSize ) RETURN lOK -FUNCTION __dbgAchoice( nTop, nLeft, nBottom, nRight, aItems, cColors ) +FUNCTION __dbgAChoice( nTop, nLeft, nBottom, nRight, aItems, cColors ) LOCAL oBrw LOCAL oCol @@ -3664,7 +3662,7 @@ FUNCTION __dbgAchoice( nTop, nLeft, nBottom, nRight, aItems, cColors ) oBrw:skipBlock := {| n | n := iif( n < 0, Max( n, 1 - nRow ), ; Min( Len( aItems ) - nRow, n ) ), ; nRow += n, n } - WHILE .T. + DO WHILE .T. oBrw:forceStable() SWITCH Inkey( 0, INKEY_ALL ) CASE K_UP; oBrw:up(); EXIT diff --git a/src/debug/tbrwtext.prg b/src/debug/tbrwtext.prg index 11cbae5231..90300b94c5 100644 --- a/src/debug/tbrwtext.prg +++ b/src/debug/tbrwtext.prg @@ -167,22 +167,17 @@ METHOD SetActiveLine( n ) CLASS HBBrwText RETURN Self METHOD GetLine() CLASS HBBrwText - - RETURN iif( ::lLineNumbers, padr( hb_ntos( ::nRow ) + ":", ::nLineNoLen ), "" ) + ; - MemoLine( ::aRows[ ::nRow ], ::nMaxLineLen, 1, ::nTabWidth, .F. ) + RETURN iif( ::lLineNumbers, PadR( hb_ntos( ::nRow ) + ":", ::nLineNoLen ), "" ) + ; + MemoLine( ::aRows[ ::nRow ], ::nMaxLineLen, 1, ::nTabWidth, .F. ) METHOD GetLineText() CLASS HBBrwText - RETURN PadR( SubStr( ::GetLine(), ::nLineOffset ), ::nWidth ) METHOD GetLineColor() CLASS HBBrwText LOCAL aColor - LOCAL lBreak - lBreak := __dbgIsBreak( __Dbg():pInfo, ::cFileName, ::nRow ) >= 0 - - IF lBreak + IF __dbgIsBreak( __Dbg():pInfo, ::cFileName, ::nRow ) >= 0 aColor := iif( ::nRow == ::nActiveLine, { 4, 4 }, { 3, 3 } ) ELSE aColor := iif( ::nRow == ::nActiveLine, { 2, 2 }, { 1, 1 } ) diff --git a/src/lang/l_fr.c b/src/lang/l_fr.c index a0871922f8..53ca4548b1 100644 --- a/src/lang/l_fr.c +++ b/src/lang/l_fr.c @@ -1,4 +1,4 @@ -/* Last Translator: hbtest */ +/* Last Translator: jujuland (alain.aupeix wanadoo.fr) */ #include "hbapilng.h" @@ -53,90 +53,90 @@ static HB_LANG s_lang = "Limites: ", " - ", "O/N", - "INVALID EXPRESSION", + "EXPRESSION INVALIDE", /* Error description names */ - "Unknown error", - "Argument error", - "Bound error", - "String overflow", - "Numeric overflow", - "Zero divisor", - "Numeric error", - "Syntax error", - "Operation too complex", + "Erreur inconnue", + "Argument erroné", + "Erreur bound", + "Dépassement de chaîne", + "Dépassement numérique", + "Division par zéro", + "Erreur numérique", + "Erreur de syntaxe", + "Opération trop complexe", "", "", - "Memory low", - "Undefined function", - "No exported method", - "Variable does not exist", - "Alias does not exist", - "No exported variable", - "Illegal characters in alias", - "Alias already in use", + "Mémoire basse", + "Fonction non définie", + "Aucune méthode exportée", + "Variable inexistante", + "Alias inexistant", + "Aucune variable exportée", + "Caractère illégal dans l'alias", + "Alias déjà utilisé", "", - "Create error", - "Open error", - "Close error", - "Read error", - "Write error", - "Print error", + "Erreur à la création", + "Erreur à l'ouverture", + "Erreur à la fermeture", + "Erreur de lecture", + "Erreur d'écriture", + "Erreur d'impression", "", "", "", "", - "Operation not supported", - "Limit exceeded", - "Corruption detected", - "Data type error", - "Data width error", - "Workarea not in use", - "Workarea not indexed", - "Exclusive required", - "Lock required", - "Write not allowed", - "Append lock failed", - "Lock Failure", + "Opération non supportée", + "Limite dépassée", + "Corruption détectée", + "Erreur de type de données", + "Erreur de taille de donnée", + "Zone non en cours d'utilisation", + "Zone non indexée", + "Mode exclusif requis", + "Verrouillage requis", + "Ecriture non permise", + "Echec du verrou à l'ajout", + "Echec du verrou", "", "", "", - "Object destructor failure", - "array access", - "array assign", - "array dimension", - "not an array", - "conditional", + "Echec du destructeur d'objet", + "accès au tableau", + "assignation du tableau", + "dimension du tableau", + "pas un tableau", + "conditionnel", /* Internal error names */ - "Unrecoverable error %d: ", - "Error recovery failure", - "No ERRORBLOCK() for error", - "Too many recursive error handler calls", - "RDD invalid or failed to load", - "Invalid method type from %s", - "hb_xgrab can't allocate memory", - "hb_xrealloc called with a NULL pointer", - "hb_xrealloc called with an invalid pointer", - "hb_xrealloc can't reallocate memory", - "hb_xfree called with an invalid pointer", - "hb_xfree called with a NULL pointer", - "Can't locate the starting procedure: '%s'", - "No starting procedure", - "Unsupported VM opcode", - "Symbol item expected from %s", - "Invalid symbol type for self from %s", - "Codeblock expected from %s", - "Incorrect item type on the stack trying to pop from %s", - "Stack underflow", - "An item was going to be copied to itself from %s", - "Invalid symbol item passed as memvar %s", - "Memory buffer overflow", - "hb_xgrab requested to allocate zero bytes", - "hb_xrealloc requested to resize to zero bytes", - "hb_xalloc requested to allocate zero bytes", + "Erreur irrécupérable %d: ", + "Echec lors de la récupération de l'erreur", + "Aucun ERRORBLOCK() pour cette erreur", + "Trop d'appels récursifs au gestionnaire d'erreur", + "RDD invalide ou echec au chargement", + "Type de méthode pour %s", + "allocation mémoire impossible par hb_xgrab", + "hb_xrealloc appelé avec un pointeur NULL", + "hb_xrealloc appelé avec un pointeur invalide", + "hb_xrealloc ne peut réallouer la mémoire", + "hb_xfree appelé avec un pointeur invalide", + "hb_xfree appelé avec un pointeur NULL", + "Allocation impossible à la procédure de démarrage: '%s'", + "Pas de procédure de démarrage", + "Code opération non supporté par VM", + "Elément de symbôle attendu de %s", + "Type de symbôle invalide pour self de %s", + "Codeblock attendu de %s", + "Tentavive de dépilement d'un type d'élément incorrect de %s", + "Débordement de pile", + "Un élément allait être copié dur lui-même de %s", + "Symbol d'élément invalide passé comme memvar %s", + "Débordement du buffer mémoire", + "hb_xgrab appelé pour allouer zéro octets", + "hb_xrealloc appelé pour allouer zéro octets", + "hb_xalloc appelé pour allouer zéro octets", /* Texts */ diff --git a/src/lang/l_hu.c b/src/lang/l_hu.c index efe2e591bb..024dc476ea 100644 --- a/src/lang/l_hu.c +++ b/src/lang/l_hu.c @@ -1,4 +1,4 @@ -/* Last Translator: hbtest */ +/* Last Translator: vszakats */ #include "hbapilng.h" @@ -89,7 +89,7 @@ static HB_LANG s_lang = "", "Nem támogatott művelet", "Korlát túllépve", - "Index hiba felfedezve", + "Sérült vagy hibás adat", "Nem megfelelő adattípus", "Túl széles adat", "Nem megnyitott munkaterület", @@ -97,8 +97,8 @@ static HB_LANG s_lang = "Kizárólagos megnyitási mód szükséges", "Zárolás szükséges", "Írás nem megengedett", - "Zárolás nem sikerült új rekord felvitelekor", - "Zárolás nem sikerült", + "Zárolás sikertelen új rekord felvitelekor", + "Zárolás sikertelen", "", "", "", diff --git a/src/pp/hbpp.c b/src/pp/hbpp.c index 3935fe1761..8fa9d587bd 100644 --- a/src/pp/hbpp.c +++ b/src/pp/hbpp.c @@ -90,7 +90,7 @@ static void hb_pp_writeToken( FILE * fout, PHB_PP_TOKEN pToken, fprintf( fout, ", NULL%*s", i, "" ); i = 16 - ( int ) strlen( pToken->value ); - fprintf( fout, ", \"%s\", %*s %2d,%2d, 0x%04x, %d }%s\n", + fprintf( fout, ", \"%s\", %*s %2d,%2d, 0x%04x, %u }%s\n", pToken->value, i < 0 ? 0 : i, "", ( int ) pToken->len, ( int ) pToken->spaces, @@ -171,7 +171,7 @@ static int hb_pp_writeRules( FILE * fout, PHB_PP_RULE pFirst, const char * szNam if( pRule->pMarkers[ u ].canrepeat ) ulRepeatBits |= ulBit; } - fprintf( fout, " { %s, %s, %d,%2d, 0x%04lx }%s\n", + fprintf( fout, " { %s, %s, %d,%2u, 0x%04lx }%s\n", szMatch, szResult, HB_PP_CMP_MODE( pRule->mode ), pRule->markers, ulRepeatBits, pRule->pPrev ? "," : "" ); pRule = pRule->pPrev; @@ -199,7 +199,7 @@ static void hb_pp_generateRules( FILE * fout, PHB_PP_STATE pState, const char * " * Harbour Project source code:\n" " * Build in preprocessor rules.\n" " *\n" - " * Copyright 2006-2013 Przemyslaw Czerpak \n" + " * Copyright 2006-2014 Przemyslaw Czerpak \n" " * www - http://harbour-project.org\n" " *\n" " * This file is generated automatically by Harbour preprocessor\n" @@ -344,7 +344,7 @@ static int hb_pp_generateVerInfo( char * szVerFile, int iRevID, char * szChangeL " * Harbour Project source code:\n" " * Version information and build time switches.\n" " *\n" - " * Copyright 2008-2013 Przemyslaw Czerpak \n" + " * Copyright 2008-2014 Przemyslaw Czerpak \n" " * www - http://harbour-project.org\n" " *\n" " * This file is generated automatically by Harbour preprocessor\n" @@ -792,7 +792,7 @@ int main( int argc, char * argv[] ) { printf( "Harbour Preprocessor %d.%d.%d%s\n", HB_VER_MAJOR, HB_VER_MINOR, HB_VER_RELEASE, HB_VER_STATUS ); - printf( "Copyright (c) 1999-2013, http://harbour-project.org/\n" ); + printf( "Copyright (c) 1999-2014, http://harbour-project.org/\n" ); } if( szFile ) diff --git a/src/rdd/dbfcdx/dbfcdx1.c b/src/rdd/dbfcdx/dbfcdx1.c index d2020fd98a..e77709b925 100644 --- a/src/rdd/dbfcdx/dbfcdx1.c +++ b/src/rdd/dbfcdx/dbfcdx1.c @@ -566,7 +566,7 @@ static LPCDXKEY hb_cdxKeyPutItem( LPCDXKEY pKey, PHB_ITEM pItem, HB_ULONG ulRec, ptr = NULL; #ifdef HB_CDX_DBGCODE /* TODO: RTerror */ - printf( "hb_cdxKeyPutItem( invalid item type: %i )", hb_itemType( pItem ) ); + printf( "hb_cdxKeyPutItem( invalid item type: %u )", hb_itemType( pItem ) ); #endif break; } @@ -1798,7 +1798,7 @@ static void hb_cdxPageLeafEncode( LPCDXPAGE pPage, HB_BYTE * pKeyBuf, int iKeys #ifdef HB_CDX_DBGCODE if( pKeyPos - pRecPos != pPage->iFree ) { - printf( "\r\nPage=0x%lx, calc=%d, iFree=%d, req=%d, keys=%d, keyLen=%d\r\n", + printf( "\r\nPage=0x%lx, calc=%d, iFree=%d, req=%u, keys=%d, keyLen=%d\r\n", pPage->Page, ( int ) ( pKeyPos - pRecPos ), pPage->iFree, pPage->ReqByte, iKeys, iNum ); fflush( stdout ); hb_cdxErrInternal( "hb_cdxPageLeafEncode: FreeSpace calculated wrong!" ); @@ -3828,9 +3828,9 @@ static int hb_cdxPageSeekKey( LPCDXPAGE pPage, LPCDXKEY pKey, HB_ULONG ulKeyRec hb_cdxPageGetKeyRec( pPage, pPage->iCurKey ) != hb_cdxPageGetKeyRec( pPage->Child, pPage->Child->iKeys - 1 ) ) { - printf( "\r\nkeyLen=%d", pPage->TagParent->uiLen ); - printf( "\r\nparent=%lx, iKey=%d, rec=%ld", pPage->Page, pPage->iCurKey, hb_cdxPageGetKeyRec( pPage, pPage->iCurKey ) ); - printf( "\r\n child=%lx, iKey=%d, rec=%ld", pPage->Child->Page, pPage->Child->iKeys - 1, hb_cdxPageGetKeyRec( pPage->Child, pPage->Child->iKeys - 1 ) ); + printf( "\r\nkeyLen=%u", pPage->TagParent->uiLen ); + printf( "\r\nparent=%lx, iKey=%d, rec=%lu", pPage->Page, pPage->iCurKey, hb_cdxPageGetKeyRec( pPage, pPage->iCurKey ) ); + printf( "\r\n child=%lx, iKey=%d, rec=%lu", pPage->Child->Page, pPage->Child->iKeys - 1, hb_cdxPageGetKeyRec( pPage->Child, pPage->Child->iKeys - 1 ) ); printf( "\r\nparent val=[%s]", hb_cdxPageGetKeyVal( pPage, pPage->iCurKey ) ); printf( "\r\n child val=[%s]", hb_cdxPageGetKeyVal( pPage->Child, pPage->Child->iKeys - 1 ) ); fflush( stdout ); @@ -9659,7 +9659,7 @@ static void hb_cdxTagDoIndex( LPCDXTAG pTag, HB_BOOL fReindex ) } else { - printf( "hb_cdxTagDoIndex: hb_itemType( pItem ) = %i", hb_itemType( pItem ) ); + printf( "hb_cdxTagDoIndex: hb_itemType( pItem ) = %u", hb_itemType( pItem ) ); } break; } diff --git a/src/rdd/dbfuncs.prg b/src/rdd/dbfuncs.prg index 79eb4782b7..1cdee2bb7e 100644 --- a/src/rdd/dbfuncs.prg +++ b/src/rdd/dbfuncs.prg @@ -93,10 +93,10 @@ FUNCTION __dbCopySt( cFileName, aFieldList ) FUNCTION __dbCopyXS( cFileName ) RETURN __dbCopyXStruct( cFileName ) -/* ; NOTE: The created table will be kept open if lOpenMode parameter - is of logical type. If .T. it will be opened in a new workarea, - if .F. it will be opened in the current one. */ -/* ; NOTE: Has an identical parameter list with dbCreate() */ +/* NOTE: The created table will be kept open if lOpenMode parameter + is of logical type. If .T. it will be opened in a new workarea, + if .F. it will be opened in the current one. */ +/* NOTE: Has an identical parameter list with dbCreate() */ FUNCTION __dbOpenSD( cFile, aStruct, cRDD, lOpenMode, cAlias, cDelimArg, cCodePage, nConnection ) RETURN __dbOpenSDF( cFile, aStruct, cRDD, lOpenMode, cAlias, cDelimArg, cCodePage, nConnection ) diff --git a/src/rdd/dbtotal.prg b/src/rdd/dbtotal.prg index c71e03ce59..72ebe8d50d 100644 --- a/src/rdd/dbtotal.prg +++ b/src/rdd/dbtotal.prg @@ -136,7 +136,7 @@ FUNCTION __dbTotal( cFile, xKey, aFields,; AEval( aFields, {| cField | AAdd( aGetField, __GetField( cField ) ) } ) aFieldsSum := Array( Len( aGetField ) ) - /* ; Keep it open after creating it. */ + /* Keep it open after creating it. */ dbCreate( cFile, aNewDbStruct, cRDD, .T., "", NIL, cCodePage, nConnection ) nNewArea := Select() @@ -195,7 +195,7 @@ STATIC FUNCTION __GetField( cField ) LOCAL oError LOCAL lError - /* ; Is the field aliased? */ + /* Is the field aliased? */ IF ( nPos := At( "->", cField ) ) > 0 IF Select( Left( cField, nPos - 1 ) ) != nCurrArea diff --git a/src/rdd/hbsix/sxcompat.prg b/src/rdd/hbsix/sxcompat.prg index 00a91e7e25..03155c5013 100644 --- a/src/rdd/hbsix/sxcompat.prg +++ b/src/rdd/hbsix/sxcompat.prg @@ -173,33 +173,35 @@ FUNCTION sxLog( xKeyVal ) FUNCTION sx_Compress( xVal ) - LOCAL cType := ValType( xVal ), xRetVal + LOCAL xRetVal - IF cType $ "CM" - xRetVal := _sx_StrCompress( xVal ) - ELSEIF cType == "A" + SWITCH ValType( xVal ) + CASE "C" + CASE "M" + RETURN _sx_StrCompress( xVal ) + CASE "A" xRetVal := Array( Len( xVal ) ) - AEval( xVal, {| x | xRetVal := sx_Compress( x ) } ) - ELSE - xRetVal := xVal - ENDIF + AEval( xVal, {| x, i | xRetVal[ i ] := sx_Compress( x ) } ) + RETURN xRetVal + ENDSWITCH - RETURN xRetVal + RETURN xVal FUNCTION sx_Decompress( xVal ) - LOCAL cType := ValType( xVal ), xRetVal + LOCAL xRetVal - IF cType $ "CM" - xRetVal := _sx_StrDecompress( xVal ) - ELSEIF cType == "A" + SWITCH ValType( xVal ) + CASE "C" + CASE "M" + RETURN _sx_StrDecompress( xVal ) + CASE "A" xRetVal := Array( Len( xVal ) ) - AEval( xVal, {| x | xRetVal := sx_Decompress( x ) } ) - ELSE - xRetVal := xVal - ENDIF + AEval( xVal, {| x, i | xRetVal[ i ] := sx_Decompress( x ) } ) + RETURN xRetVal + ENDSWITCH - RETURN xRetVal + RETURN xVal FUNCTION sx_TagInfo( cIndex ) diff --git a/src/rdd/hbsix/sxini.prg b/src/rdd/hbsix/sxini.prg index 661d821113..941ed070c0 100644 --- a/src/rdd/hbsix/sxini.prg +++ b/src/rdd/hbsix/sxini.prg @@ -101,7 +101,7 @@ FUNCTION _sx_IniInit( nArea ) hIni := hb_iniRead( cFile, .F.,, .F. ) IF ! Empty( hIni ) - IF hb_HHasKey( hIni, HB_SIX_SECTION ) + IF HB_SIX_SECTION $ hIni FOR EACH item IN hIni[ HB_SIX_SECTION ] SWITCH item:__enumKey() CASE "SHARED" @@ -147,8 +147,8 @@ FUNCTION sx_IniHeader( cHeaderName, nArea ) nArea := Select() ENDIF - IF hb_HHasKey( SxIniInfo, nArea ) - IF hb_HHasKey( SxIniInfo[ nArea ], cHeaderName ) + IF nArea $ SxIniInfo + IF cHeaderName $ SxIniInfo[ nArea ] RETURN SxIniInfo[ nArea, cHeaderName ] ENDIF ENDIF diff --git a/src/rdd/usrrdd/rdds/arrayrdd.prg b/src/rdd/usrrdd/rdds/arrayrdd.prg index 29017175e8..0253c4f425 100644 --- a/src/rdd/usrrdd/rdds/arrayrdd.prg +++ b/src/rdd/usrrdd/rdds/arrayrdd.prg @@ -341,10 +341,9 @@ STATIC FUNCTION AR_OPEN( nWA, aOpenInfo ) hRDDData := USRRDD_RDDDATA( USRRDD_ID( nWA ) ) - IF hb_HHasKey( hRDDData, cFullName ) + IF cFullName $ hRDDData aDBFData := hRDDData[ cFullName ] aStruct := aDBFData[ DATABASE_STRUCT ] - ELSE oError := ErrorNew() oError:GenCode := EG_OPEN @@ -355,7 +354,6 @@ STATIC FUNCTION AR_OPEN( nWA, aOpenInfo ) NetErr( .T. ) UR_SUPER_ERROR( nWA, oError ) RETURN HB_FAILURE - ENDIF /* Set WorkArea Infos */ @@ -1566,7 +1564,7 @@ FUNCTION hb_EraseArrayRdd( cFullName ) IF HB_ISSTRING( cFullName ) cFullName := Upper( cFullName ) /* First search if memory dbf exists */ - IF hb_HHasKey( hRDDData, cFullName ) + IF cFullName $ hRDDData /* Get ARRAY DATA */ aDBFData := hRDDData[ cFullName ] @@ -1645,9 +1643,8 @@ FUNCTION hb_FileArrayRdd( cFullName ) IF HB_ISSTRING( cFullName ) cFullName := Upper( cFullName ) /* First search if memory dbf exists */ - IF hb_HHasKey( hRDDData, cFullName ) + IF cFullName $ hRDDData nReturn := HB_SUCCESS - ENDIF ENDIF @@ -1663,7 +1660,6 @@ FUNCTION hb_FileArrayRdd( cFullName ) Throw( oError ) nReturn := HB_FAILURE - ENDIF ELSE @@ -1687,7 +1683,7 @@ FUNCTION hb_FileArrayRdd( cFullName ) hb_SetArrayRdd( aArray ) --> NIL This function set DBF with aArray like APPEND FROM aArray in an empty DBF */ -FUNCTION hb_SetArrayRdd( aArray ) +PROCEDURE hb_SetArrayRdd( aArray ) LOCAL aRecInfo LOCAL nWA := Select() @@ -1700,7 +1696,7 @@ FUNCTION hb_SetArrayRdd( aArray ) NEXT AR_GOTOP( nWA ) - RETURN NIL + RETURN STATIC FUNCTION BlankRecord( aStruct ) @@ -1933,7 +1929,7 @@ STATIC FUNCTION DecEmptyValue( xVal ) RETURN xRet -STATIC FUNCTION ModifyIndex( nIndex, xValue, aIndex, aWAData, xValorAnt ) +STATIC PROCEDURE ModifyIndex( nIndex, xValue, aIndex, aWAData, xValorAnt ) LOCAL nPos, aOCInfo, lFor, lDel @@ -1977,7 +1973,7 @@ STATIC FUNCTION ModifyIndex( nIndex, xValue, aIndex, aWAData, xValorAnt ) ENDIF - RETURN NIL + RETURN STATIC FUNCTION Seek( xSeek, lSoft, lLast, aIndexInfo, nRec ) diff --git a/src/rdd/usrrdd/rdds/hscdx.prg b/src/rdd/usrrdd/rdds/hscdx.prg index 19c48b6a24..81095913f4 100644 --- a/src/rdd/usrrdd/rdds/hscdx.prg +++ b/src/rdd/usrrdd/rdds/hscdx.prg @@ -176,7 +176,7 @@ FUNCTION HSX_CREATE( cFile, cExpr, nKeySize, nBufSize, lCase, nFiltSet ) RETURN nHsx -FUNCTION HSX_OPEN( cFile, nBufSize ) +PROCEDURE HSX_OPEN( cFile, nBufSize ) LOCAL aWData, nHsx, nOpenMode @@ -193,9 +193,9 @@ FUNCTION HSX_OPEN( cFile, nBufSize ) ENDIF ENDIF - RETURN NIL + RETURN -FUNCTION HSX_CLOSE( xHSX ) +PROCEDURE HSX_CLOSE( xHSX ) LOCAL aWData, nSlot @@ -214,7 +214,7 @@ FUNCTION HSX_CLOSE( xHSX ) ENDIF ENDIF - RETURN NIL + RETURN FUNCTION HSX_HANDLE( cFile ) diff --git a/src/rdd/workarea.c b/src/rdd/workarea.c index 5cf8364328..11d9ad0c42 100644 --- a/src/rdd/workarea.c +++ b/src/rdd/workarea.c @@ -796,6 +796,10 @@ static HB_ERRCODE hb_waInfo( AREAP pArea, HB_USHORT uiIndex, PHB_ITEM pItem ) hb_itemPutL( pItem, ulRecNo != ulRecCount + 1 ); break; } + case DBI_CODEPAGE: + hb_itemPutC( pItem, pArea->cdPage ? pArea->cdPage->id : NULL ); + break; + case DBI_RM_SUPPORTED: hb_itemPutL( pItem, HB_FALSE ); break; diff --git a/src/rtl/adir.prg b/src/rtl/adir.prg index 8e5c5d30b6..9006fbe8f7 100644 --- a/src/rtl/adir.prg +++ b/src/rtl/adir.prg @@ -62,13 +62,13 @@ FUNCTION ADir( cFileMask, aName, aSize, aDate, aTime, aAttr ) LOCAL cName LOCAL cExt - // ; CA-Cl*pper would fail on this case. + // CA-Cl*pper would fail on this case. IF ! HB_ISSTRING( cFileMask ) RETURN 0 ENDIF - // ; If no drive/dir specified, use the SET DEFAULT setting. + // If no drive/dir specified, use the SET DEFAULT setting. hb_FNameSplit( cFileMask, @cDir, @cName, @cExt ) @@ -76,7 +76,7 @@ FUNCTION ADir( cFileMask, aName, aSize, aDate, aTime, aAttr ) cFileMask := hb_FNameMerge( __DefPath(), cName, cExt ) ENDIF - // ; + // IF HB_ISARRAY( aAttr ) aDir := Directory( cFileMask, "HSD" ) @@ -100,7 +100,7 @@ FUNCTION ADir( cFileMask, aName, aSize, aDate, aTime, aAttr ) nAttrLen := Len( aAttr ) ENDIF - // ; + // nDirLen := Len( aDir ) diff --git a/src/rtl/arc4.c b/src/rtl/arc4.c index 10163e0fc1..720845c4bd 100644 --- a/src/rtl/arc4.c +++ b/src/rtl/arc4.c @@ -172,7 +172,7 @@ static HB_ISIZ read_all( int fd, HB_U8 * buf, size_t count ) #if defined( HB_OS_WIN ) && ! defined( __DMC__ ) && ! defined( __TINYC__ ) #define TRY_SEED_MS_CRYPTOAPI -static int arc4_seed_win32( void ) +static int arc4_seed_win( void ) { /* This is adapted from Tor's crypto_seed_rng() */ static int provider_set = 0; @@ -435,7 +435,7 @@ static void arc4_seed( void ) */ #if defined( TRY_SEED_MS_CRYPTOAPI ) - if( arc4_seed_win32() == 0 ) + if( arc4_seed_win() == 0 ) ok = 1; #endif diff --git a/src/rtl/cdpapihb.c b/src/rtl/cdpapihb.c index e2280fde2b..f68b6d199a 100644 --- a/src/rtl/cdpapihb.c +++ b/src/rtl/cdpapihb.c @@ -86,6 +86,16 @@ HB_FUNC( HB_CDPSELECT ) hb_cdpSelectID( id ); } +HB_FUNC( HB_CDPEXISTS ) +{ + const char * id = hb_parc( 1 ); + + if( id ) + hb_retl( hb_cdpFind( id ) != NULL ); + else + hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); +} + HB_FUNC( HB_CDPUNIID ) { const char * id = hb_parc( 1 ); diff --git a/src/rtl/cdpdet.prg b/src/rtl/cdpdet.prg index b277250884..b5a408da29 100644 --- a/src/rtl/cdpdet.prg +++ b/src/rtl/cdpdet.prg @@ -152,7 +152,7 @@ STATIC FUNCTION __CPWinToCPStd( nCPWin ) /* language[_territory][.codeset] */ /* [language[_territory][.codeset][@modifier]] */ /* TODO: handle "C"/"POSIX" values and values starting with "/" */ -STATIC FUNCTION __UnixParseLangCP( cString, /* @ */ cCP, /* @ */ cLang ) +STATIC PROCEDURE __UnixParseLangCP( cString, /* @ */ cCP, /* @ */ cLang ) LOCAL tmp @@ -167,7 +167,7 @@ STATIC FUNCTION __UnixParseLangCP( cString, /* @ */ cCP, /* @ */ cLang ) cCP := "UTF-8" ENDIF - RETURN NIL + RETURN STATIC FUNCTION __CPUnixToCPStd( cCPUnix ) diff --git a/src/rtl/copyfile.c b/src/rtl/copyfile.c index 5f3c766237..93d669ea4e 100644 --- a/src/rtl/copyfile.c +++ b/src/rtl/copyfile.c @@ -56,7 +56,11 @@ #include #endif -#define BUFFER_SIZE 8192 +#ifdef HB_CLP_STRICT + #define BUFFER_SIZE 8192 +#else + #define BUFFER_SIZE 65536 +#endif static HB_BOOL hb_copyfile( const char * szSource, const char * szDest ) { @@ -106,15 +110,15 @@ static HB_BOOL hb_copyfile( const char * szSource, const char * szDest ) int iSuccess = fstat( fhndSource, &struFileInfo ); #endif void * buffer; - HB_USHORT usRead; + HB_SIZE nRead; buffer = hb_xgrab( BUFFER_SIZE ); bRetVal = HB_TRUE; - while( ( usRead = hb_fsRead( fhndSource, buffer, BUFFER_SIZE ) ) != 0 ) + while( ( nRead = hb_fsReadLarge( fhndSource, buffer, BUFFER_SIZE ) ) != 0 ) { - while( hb_fsWrite( fhndDest, buffer, usRead ) != usRead ) + while( hb_fsWriteLarge( fhndDest, buffer, nRead ) != nRead ) { pError = hb_errRT_FileError( pError, NULL, EG_WRITE, 2016, szDest ); if( hb_errLaunch( pError ) != E_RETRY ) diff --git a/src/rtl/dbedit.prg b/src/rtl/dbedit.prg index 75b995dd44..3cc551813d 100644 --- a/src/rtl/dbedit.prg +++ b/src/rtl/dbedit.prg @@ -144,8 +144,6 @@ FUNCTION dbEdit( nTop, nLeft, nBottom, nRight, ; bBlock := iif( Type( cBlock ) == "M", {|| " " }, hb_macroBlock( cBlock ) ) - /* ; */ - IF HB_ISARRAY( xColumnHeaders ) .AND. Len( xColumnHeaders ) >= nPos .AND. HB_ISSTRING( xColumnHeaders[ nPos ] ) cHeading := xColumnHeaders[ nPos ] ELSEIF HB_ISSTRING( xColumnHeaders ) diff --git a/src/rtl/dircmd.prg b/src/rtl/dircmd.prg index 8ad0662089..563b98b1e1 100644 --- a/src/rtl/dircmd.prg +++ b/src/rtl/dircmd.prg @@ -133,9 +133,9 @@ STATIC PROCEDURE PutNormal( aDirEntry ) file names which do not stick to 8.3 MS-DOS convention */ QOut( ; - PadR( cName, 8 ) + " " + ; - PadR( SubStr( cExt, 2 ), 3 ) + " " + ; - Str( aDirEntry[ F_SIZE ], 8 ) + " " + ; + PadR( cName, 8 ), ; + PadR( SubStr( cExt, 2 ), 3 ), ; + Str( aDirEntry[ F_SIZE ], 8 ), "", ; DToC( aDirEntry[ F_DATE ] ) ) RETURN diff --git a/src/rtl/diskspac.c b/src/rtl/diskspac.c index 06049af079..81c4fad157 100644 --- a/src/rtl/diskspac.c +++ b/src/rtl/diskspac.c @@ -163,10 +163,10 @@ HB_FUNC( DISKSPACE ) if( ! s_fInit ) { - s_pGetDiskFreeSpaceEx = - ( P_GDFSE ) - GetProcAddress( GetModuleHandle( HB_WINAPI_KERNEL32_DLL() ), - HB_WINAPI_FUNCTION_NAME( "GetDiskFreeSpaceEx" ) ); + HMODULE hModule = GetModuleHandle( HB_WINAPI_KERNEL32_DLL() ); + if( hModule ) + s_pGetDiskFreeSpaceEx = ( P_GDFSE ) + GetProcAddress( hModule, HB_WINAPI_FUNCTION_NAME( "GetDiskFreeSpaceEx" ) ); s_fInit = HB_TRUE; } diff --git a/src/rtl/disksphb.c b/src/rtl/disksphb.c index 77d28c97e0..6d59b98758 100644 --- a/src/rtl/disksphb.c +++ b/src/rtl/disksphb.c @@ -122,11 +122,10 @@ HB_FUNC( HB_DISKSPACE ) if( ! s_fInit ) { - s_pGetDiskFreeSpaceEx = - ( P_GDFSE ) - GetProcAddress( GetModuleHandle( HB_WINAPI_KERNEL32_DLL() ), - HB_WINAPI_FUNCTION_NAME( "GetDiskFreeSpaceEx" ) ); - + HMODULE hModule = GetModuleHandle( HB_WINAPI_KERNEL32_DLL() ); + if( hModule ) + s_pGetDiskFreeSpaceEx = ( P_GDFSE ) + GetProcAddress( hModule, HB_WINAPI_FUNCTION_NAME( "GetDiskFreeSpaceEx" ) ); s_fInit = HB_TRUE; } diff --git a/src/rtl/errint.c b/src/rtl/errint.c index 77c9c43000..1815b7273d 100644 --- a/src/rtl/errint.c +++ b/src/rtl/errint.c @@ -61,9 +61,16 @@ void hb_errInternal( HB_ERRCODE errCode, const char * szText, const char * szPar if( hb_cmdargCheck( "ERRGPF" ) ) { +#if defined( _MSC_VER ) && _MSC_VER >= 1800 +#pragma warning(push) +#pragma warning(disable:6011) +#endif int * pGPF = NULL; *pGPF = 0; *( --pGPF ) = 0; +#if defined( _MSC_VER ) && _MSC_VER >= 1800 +#pragma warning(pop) +#endif } exit( EXIT_FAILURE ); diff --git a/src/rtl/errintlo.c b/src/rtl/errintlo.c index d24f077299..afd8a89ff0 100644 --- a/src/rtl/errintlo.c +++ b/src/rtl/errintlo.c @@ -91,7 +91,7 @@ void hb_errInternalRaw( HB_ERRCODE errCode, const char * szText, const char * sz hb_dateTimeStr( szTime ); fprintf( hLog, "Application Internal Error - %s\n", hb_cmdargARGVN( 0 ) ); - fprintf( hLog, "Terminated at: %04d.%02d.%02d %s\n", iYear, iMonth, iDay, szTime ); + fprintf( hLog, "Terminated at: %04d-%02d-%02d %s\n", iYear, iMonth, iDay, szTime ); szInfo = fStack ? hb_setGetCPtr( HB_SET_HBOUTLOGINFO ) : NULL; if( szInfo && *szInfo ) fprintf( hLog, "Info: %s\n", szInfo ); diff --git a/src/rtl/errsys.prg b/src/rtl/errsys.prg index 5b86b3b293..41eb4ef074 100644 --- a/src/rtl/errsys.prg +++ b/src/rtl/errsys.prg @@ -94,7 +94,7 @@ STATIC FUNCTION DefError( oError ) cMessage := ErrorMessage( oError ) IF ! Empty( oError:osCode ) - cDOSError := "(DOS Error " + hb_ntos( oError:osCode ) + ")" + cDOSError := hb_StrFormat( "(DOS Error %1$d)", oError:osCode ) ENDIF // Build buttons @@ -148,8 +148,9 @@ STATIC FUNCTION DefError( oError ) DO WHILE ! Empty( ProcName( ++n ) ) OutErr( hb_eol() ) - OutErr( "Called from " + ProcName( n ) + ; - "(" + hb_ntos( ProcLine( n ) ) + ") " ) + OutErr( hb_StrFormat( "Called from %1$s(%2$d) ", ; + ProcName( n ), ; + ProcLine( n ) ) ) ENDDO diff --git a/src/rtl/filesys.c b/src/rtl/filesys.c index 7ce007f719..418ca37105 100644 --- a/src/rtl/filesys.c +++ b/src/rtl/filesys.c @@ -1296,7 +1296,7 @@ int hb_fsSetDevMode( HB_FHANDLE hFileHandle, int iDevMode ) case FD_TEST: iRet = _setmode( ( int ) hFileHandle, _O_BINARY ); if( iRet != -1 ) - _setmode( ( int ) hFileHandle, iRet ); + ( void ) _setmode( ( int ) hFileHandle, iRet ); break; case FD_BINARY: diff --git a/src/rtl/fslink.c b/src/rtl/fslink.c index 9a5345692b..9f61ce2570 100644 --- a/src/rtl/fslink.c +++ b/src/rtl/fslink.c @@ -75,10 +75,12 @@ HB_BOOL hb_fsLink( const char * pszExisting, const char * pszNewFile ) static _HB_CREATEHARDLINK s_pCreateHardLink = NULL; if( ! s_pCreateHardLink ) - s_pCreateHardLink = - ( _HB_CREATEHARDLINK ) - GetProcAddress( GetModuleHandle( TEXT( "kernel32.dll" ) ), - HB_WINAPI_FUNCTION_NAME( "CreateHardLink" ) ); + { + HMODULE hModule = GetModuleHandle( TEXT( "kernel32.dll" ) ); + if( hModule ) + s_pCreateHardLink = ( _HB_CREATEHARDLINK ) + GetProcAddress( hModule, HB_WINAPI_FUNCTION_NAME( "CreateHardLink" ) ); + } if( s_pCreateHardLink ) { @@ -157,10 +159,12 @@ HB_BOOL hb_fsLinkSym( const char * pszTarget, const char * pszNewFile ) #endif if( ! s_pCreateSymbolicLink ) - s_pCreateSymbolicLink = - ( _HB_CREATESYMBOLICLINK ) - GetProcAddress( GetModuleHandle( TEXT( "kernel32.dll" ) ), - HB_WINAPI_FUNCTION_NAME( "CreateSymbolicLink" ) ); + { + HMODULE hModule = GetModuleHandle( TEXT( "kernel32.dll" ) ); + if( hModule ) + s_pCreateSymbolicLink = ( _HB_CREATESYMBOLICLINK ) + GetProcAddress( hModule, HB_WINAPI_FUNCTION_NAME( "CreateSymbolicLink" ) ); + } if( s_pCreateSymbolicLink ) { @@ -261,10 +265,12 @@ char * hb_fsLinkRead( const char * pszFile ) #endif if( ! s_pGetFinalPathNameByHandle ) - s_pGetFinalPathNameByHandle = - ( _HB_GETFINALPATHNAMEBYHANDLE ) - GetProcAddress( GetModuleHandle( TEXT( "kernel32.dll" ) ), - HB_WINAPI_FUNCTION_NAME( "GetFinalPathNameByHandle" ) ); + { + HMODULE hModule = GetModuleHandle( TEXT( "kernel32.dll" ) ); + if( hModule ) + s_pGetFinalPathNameByHandle = ( _HB_GETFINALPATHNAMEBYHANDLE ) + GetProcAddress( hModule, HB_WINAPI_FUNCTION_NAME( "GetFinalPathNameByHandle" ) ); + } if( s_pGetFinalPathNameByHandle ) { diff --git a/src/rtl/gtkbstat.c b/src/rtl/gtkbstat.c index 5496e6c5e8..411260b405 100644 --- a/src/rtl/gtkbstat.c +++ b/src/rtl/gtkbstat.c @@ -64,25 +64,26 @@ int hb_gt_winapi_getKbdState( void ) BYTE kbState[ 256 ]; int iKbdState = 0; - GetKeyboardState( kbState ); + if( GetKeyboardState( kbState ) ) + { + if( kbState[ VK_SHIFT ] & 0x80 ) iKbdState |= HB_GTI_KBD_SHIFT; + if( kbState[ VK_CONTROL ] & 0x80 ) iKbdState |= HB_GTI_KBD_CTRL; + if( kbState[ VK_MENU ] & 0x80 ) iKbdState |= HB_GTI_KBD_ALT; + if( kbState[ VK_LWIN ] & 0x80 ) iKbdState |= HB_GTI_KBD_LWIN; + if( kbState[ VK_RWIN ] & 0x80 ) iKbdState |= HB_GTI_KBD_RWIN; + if( kbState[ VK_APPS ] & 0x80 ) iKbdState |= HB_GTI_KBD_MENU; + if( kbState[ VK_SCROLL ] & 0x01 ) iKbdState |= HB_GTI_KBD_SCROLOCK; + if( kbState[ VK_NUMLOCK ] & 0x01 ) iKbdState |= HB_GTI_KBD_NUMLOCK; + if( kbState[ VK_CAPITAL ] & 0x01 ) iKbdState |= HB_GTI_KBD_CAPSLOCK; + if( kbState[ VK_INSERT ] & 0x01 ) iKbdState |= HB_GTI_KBD_INSERT; - if( kbState[ VK_SHIFT ] & 0x80 ) iKbdState |= HB_GTI_KBD_SHIFT; - if( kbState[ VK_CONTROL ] & 0x80 ) iKbdState |= HB_GTI_KBD_CTRL; - if( kbState[ VK_MENU ] & 0x80 ) iKbdState |= HB_GTI_KBD_ALT; - if( kbState[ VK_LWIN ] & 0x80 ) iKbdState |= HB_GTI_KBD_LWIN; - if( kbState[ VK_RWIN ] & 0x80 ) iKbdState |= HB_GTI_KBD_RWIN; - if( kbState[ VK_APPS ] & 0x80 ) iKbdState |= HB_GTI_KBD_MENU; - if( kbState[ VK_SCROLL ] & 0x01 ) iKbdState |= HB_GTI_KBD_SCROLOCK; - if( kbState[ VK_NUMLOCK ] & 0x01 ) iKbdState |= HB_GTI_KBD_NUMLOCK; - if( kbState[ VK_CAPITAL ] & 0x01 ) iKbdState |= HB_GTI_KBD_CAPSLOCK; - if( kbState[ VK_INSERT ] & 0x01 ) iKbdState |= HB_GTI_KBD_INSERT; - - if( kbState[ VK_LSHIFT ] & 0x80 ) iKbdState |= HB_GTI_KBD_LSHIFT; - if( kbState[ VK_RSHIFT ] & 0x80 ) iKbdState |= HB_GTI_KBD_RSHIFT; - if( kbState[ VK_LCONTROL ] & 0x80 ) iKbdState |= HB_GTI_KBD_LCTRL; - if( kbState[ VK_RCONTROL ] & 0x80 ) iKbdState |= HB_GTI_KBD_RCTRL; - if( kbState[ VK_LMENU ] & 0x80 ) iKbdState |= HB_GTI_KBD_LALT; - if( kbState[ VK_RMENU ] & 0x80 ) iKbdState |= HB_GTI_KBD_RALT; + if( kbState[ VK_LSHIFT ] & 0x80 ) iKbdState |= HB_GTI_KBD_LSHIFT; + if( kbState[ VK_RSHIFT ] & 0x80 ) iKbdState |= HB_GTI_KBD_RSHIFT; + if( kbState[ VK_LCONTROL ] & 0x80 ) iKbdState |= HB_GTI_KBD_LCTRL; + if( kbState[ VK_RCONTROL ] & 0x80 ) iKbdState |= HB_GTI_KBD_RCTRL; + if( kbState[ VK_LMENU ] & 0x80 ) iKbdState |= HB_GTI_KBD_LALT; + if( kbState[ VK_RMENU ] & 0x80 ) iKbdState |= HB_GTI_KBD_RALT; + } return iKbdState; } @@ -91,27 +92,28 @@ void hb_gt_winapi_setKbdState( int iKbdState ) { BYTE kbState[ 256 ]; - GetKeyboardState( kbState ); + if( GetKeyboardState( kbState ) ) + { + kbState[ VK_SHIFT ] = ( iKbdState & HB_GTI_KBD_SHIFT ) ? 0x80 : 0; + kbState[ VK_CONTROL ] = ( iKbdState & HB_GTI_KBD_CTRL ) ? 0x80 : 0; + kbState[ VK_MENU ] = ( iKbdState & HB_GTI_KBD_ALT ) ? 0x80 : 0; + kbState[ VK_LWIN ] = ( iKbdState & HB_GTI_KBD_LWIN ) ? 0x80 : 0; + kbState[ VK_RWIN ] = ( iKbdState & HB_GTI_KBD_RWIN ) ? 0x80 : 0; + kbState[ VK_APPS ] = ( iKbdState & HB_GTI_KBD_MENU ) ? 0x80 : 0; + kbState[ VK_SCROLL ] = ( iKbdState & HB_GTI_KBD_SCROLOCK ) ? 0x01 : 0; + kbState[ VK_NUMLOCK ] = ( iKbdState & HB_GTI_KBD_NUMLOCK ) ? 0x01 : 0; + kbState[ VK_CAPITAL ] = ( iKbdState & HB_GTI_KBD_CAPSLOCK ) ? 0x01 : 0; + kbState[ VK_INSERT ] = ( iKbdState & HB_GTI_KBD_INSERT ) ? 0x01 : 0; - kbState[ VK_SHIFT ] = ( iKbdState & HB_GTI_KBD_SHIFT ) ? 0x80 : 0; - kbState[ VK_CONTROL ] = ( iKbdState & HB_GTI_KBD_CTRL ) ? 0x80 : 0; - kbState[ VK_MENU ] = ( iKbdState & HB_GTI_KBD_ALT ) ? 0x80 : 0; - kbState[ VK_LWIN ] = ( iKbdState & HB_GTI_KBD_LWIN ) ? 0x80 : 0; - kbState[ VK_RWIN ] = ( iKbdState & HB_GTI_KBD_RWIN ) ? 0x80 : 0; - kbState[ VK_APPS ] = ( iKbdState & HB_GTI_KBD_MENU ) ? 0x80 : 0; - kbState[ VK_SCROLL ] = ( iKbdState & HB_GTI_KBD_SCROLOCK ) ? 0x01 : 0; - kbState[ VK_NUMLOCK ] = ( iKbdState & HB_GTI_KBD_NUMLOCK ) ? 0x01 : 0; - kbState[ VK_CAPITAL ] = ( iKbdState & HB_GTI_KBD_CAPSLOCK ) ? 0x01 : 0; - kbState[ VK_INSERT ] = ( iKbdState & HB_GTI_KBD_INSERT ) ? 0x01 : 0; + kbState[ VK_LSHIFT ] = ( iKbdState & HB_GTI_KBD_LSHIFT ) ? 0x80 : 0; + kbState[ VK_RSHIFT ] = ( iKbdState & HB_GTI_KBD_RSHIFT ) ? 0x80 : 0; + kbState[ VK_LCONTROL ] = ( iKbdState & HB_GTI_KBD_LCTRL ) ? 0x80 : 0; + kbState[ VK_RCONTROL ] = ( iKbdState & HB_GTI_KBD_RCTRL ) ? 0x80 : 0; + kbState[ VK_LMENU ] = ( iKbdState & HB_GTI_KBD_LALT ) ? 0x80 : 0; + kbState[ VK_RMENU ] = ( iKbdState & HB_GTI_KBD_RALT ) ? 0x80 : 0; - kbState[ VK_LSHIFT ] = ( iKbdState & HB_GTI_KBD_LSHIFT ) ? 0x80 : 0; - kbState[ VK_RSHIFT ] = ( iKbdState & HB_GTI_KBD_RSHIFT ) ? 0x80 : 0; - kbState[ VK_LCONTROL ] = ( iKbdState & HB_GTI_KBD_LCTRL ) ? 0x80 : 0; - kbState[ VK_RCONTROL ] = ( iKbdState & HB_GTI_KBD_RCTRL ) ? 0x80 : 0; - kbState[ VK_LMENU ] = ( iKbdState & HB_GTI_KBD_LALT ) ? 0x80 : 0; - kbState[ VK_RMENU ] = ( iKbdState & HB_GTI_KBD_RALT ) ? 0x80 : 0; - - SetKeyboardState( kbState ); + SetKeyboardState( kbState ); + } } #endif /* HB_OS_WIN */ diff --git a/src/rtl/gtwin/gtwin.c b/src/rtl/gtwin/gtwin.c index 234379c7c4..f485a48bce 100644 --- a/src/rtl/gtwin/gtwin.c +++ b/src/rtl/gtwin/gtwin.c @@ -739,16 +739,20 @@ static HB_BOOL hb_gt_win_SetPalette_Vista( HB_BOOL bSet, COLORREF * colors ) typedef BOOL ( WINAPI * P_SETCONSOLESCREENBUFFERINFOEX )( HANDLE, PCONSOLE_SCREEN_BUFFER_INFOEX ); typedef BOOL ( WINAPI * P_GETCONSOLESCREENBUFFERINFOEX )( HANDLE, PCONSOLE_SCREEN_BUFFER_INFOEX ); - static P_GETCONSOLESCREENBUFFERINFOEX s_pGetConsoleScreenBufferInfoEx; - static P_SETCONSOLESCREENBUFFERINFOEX s_pSetConsoleScreenBufferInfoEx; + static P_GETCONSOLESCREENBUFFERINFOEX s_pGetConsoleScreenBufferInfoEx = NULL; + static P_SETCONSOLESCREENBUFFERINFOEX s_pSetConsoleScreenBufferInfoEx = NULL; HB_BOOL bDone = HB_FALSE; int tmp; if( ! s_bChecked ) { - s_pGetConsoleScreenBufferInfoEx = ( P_GETCONSOLESCREENBUFFERINFOEX ) GetProcAddress( GetModuleHandle( TEXT( "kernel32.dll" ) ), "GetConsoleScreenBufferInfoEx" ); - s_pSetConsoleScreenBufferInfoEx = ( P_SETCONSOLESCREENBUFFERINFOEX ) GetProcAddress( GetModuleHandle( TEXT( "kernel32.dll" ) ), "SetConsoleScreenBufferInfoEx" ); + HMODULE hModule = GetModuleHandle( TEXT( "kernel32.dll" ) ); + if( hModule ) + { + s_pGetConsoleScreenBufferInfoEx = ( P_GETCONSOLESCREENBUFFERINFOEX ) GetProcAddress( hModule, "GetConsoleScreenBufferInfoEx" ); + s_pSetConsoleScreenBufferInfoEx = ( P_SETCONSOLESCREENBUFFERINFOEX ) GetProcAddress( hModule, "SetConsoleScreenBufferInfoEx" ); + } s_bChecked = HB_TRUE; } @@ -821,22 +825,25 @@ static HB_BOOL hb_gt_win_SetCloseButton( HB_BOOL bSet, HB_BOOL bClosable ) static HB_BOOL s_bChecked = HB_FALSE; typedef HWND ( WINAPI * P_GETCONSOLEWINDOW )( void ); - static P_GETCONSOLEWINDOW s_pGetConsoleWindow; + static P_GETCONSOLEWINDOW s_pGetConsoleWindow = NULL; #if defined( HB_GTWIN_USE_SETCONSOLEMENUCLOSE ) typedef BOOL ( WINAPI * P_SETCONSOLEMENUCLOSE )( BOOL ); - static P_SETCONSOLEMENUCLOSE s_pSetConsoleMenuClose; + static P_SETCONSOLEMENUCLOSE s_pSetConsoleMenuClose = NULL; #endif HB_BOOL bOldClosable = HB_TRUE; if( ! s_bChecked ) { - HMODULE hKernel32 = GetModuleHandle( TEXT( "kernel32.dll" ) ); - s_pGetConsoleWindow = ( P_GETCONSOLEWINDOW ) GetProcAddress( hKernel32, "GetConsoleWindow" ); + HMODULE hModule = GetModuleHandle( TEXT( "kernel32.dll" ) ); + if( hModule ) + { + s_pGetConsoleWindow = ( P_GETCONSOLEWINDOW ) GetProcAddress( hModule, "GetConsoleWindow" ); #if defined( HB_GTWIN_USE_SETCONSOLEMENUCLOSE ) - s_pSetConsoleMenuClose = ( P_SETCONSOLEMENUCLOSE ) GetProcAddress( hKernel32, "SetConsoleMenuClose" ); + s_pSetConsoleMenuClose = ( P_SETCONSOLEMENUCLOSE ) GetProcAddress( hModule, "SetConsoleMenuClose" ); #endif + } s_bChecked = HB_TRUE; } @@ -1755,9 +1762,13 @@ static HB_BOOL hb_gt_win_IsFullScreen( void ) typedef BOOL ( WINAPI * P_GCDM )( LPDWORD ); - P_GCDM pGetConsoleDisplayMode = ( P_GCDM ) - GetProcAddress( GetModuleHandle( TEXT( "kernel32.dll" ) ), - "GetConsoleDisplayMode" ); + P_GCDM pGetConsoleDisplayMode; + HMODULE hModule = GetModuleHandle( TEXT( "kernel32.dll" ) ); + + if( hModule ) + pGetConsoleDisplayMode = ( P_GCDM ) GetProcAddress( hModule, "GetConsoleDisplayMode" ); + else + pGetConsoleDisplayMode = NULL; if( pGetConsoleDisplayMode && pGetConsoleDisplayMode( &dwModeFlags ) ) { @@ -1774,9 +1785,13 @@ static HB_BOOL hb_gt_win_FullScreen( HB_BOOL bFullScreen ) { typedef BOOL ( WINAPI * P_SCDM )( HANDLE, DWORD, LPDWORD ); - P_SCDM pSetConsoleDisplayMode = ( P_SCDM ) - GetProcAddress( GetModuleHandle( TEXT( "kernel32.dll" ) ), - "SetConsoleDisplayMode" ); + P_SCDM pSetConsoleDisplayMode; + HMODULE hModule = GetModuleHandle( TEXT( "kernel32.dll" ) ); + + if( hModule ) + pSetConsoleDisplayMode = ( P_SCDM ) GetProcAddress( hModule, "SetConsoleDisplayMode" ); + else + pSetConsoleDisplayMode = NULL; if( pSetConsoleDisplayMode ) { diff --git a/src/rtl/gtwvt/gtwvt.c b/src/rtl/gtwvt/gtwvt.c index 95e7669803..cb1456dd02 100644 --- a/src/rtl/gtwvt/gtwvt.c +++ b/src/rtl/gtwvt/gtwvt.c @@ -1482,7 +1482,7 @@ static HBITMAP hb_gt_wvt_GetBoxChar( PHB_GTWVT pWVT, HB_USHORT * puc16 ) } else iTrans = 0; - pWVT->boxIndex[ iPos ] = iTrans; + pWVT->boxIndex[ iPos ] = ( HB_UCHAR ) iTrans; } return pWVT->boxImage[ iTrans ]; @@ -1820,7 +1820,7 @@ static void hb_gt_wvt_FitSize( PHB_GTWVT pWVT ) pWVT->MarginTop = 0; if( wi.right - wi.left != width || wi.bottom - wi.top != height ) /* above condition is necessary to avoid infinite - * recursive in WInCE builds + * recursive in WinCE builds */ SetWindowPos( pWVT->hWnd, NULL, left, top, width, height, SWP_NOZORDER ); } @@ -2111,9 +2111,9 @@ static RECT hb_gt_wvt_GetColRowFromXYRect( PHB_GTWVT pWVT, RECT xy ) colrow.left = xy.left / pWVT->PTEXTSIZE.x; colrow.top = xy.top / pWVT->PTEXTSIZE.y; colrow.right = xy.right / pWVT->PTEXTSIZE.x - - ( xy.right % pWVT->PTEXTSIZE.x ? 0 : 1 ); /* Adjust for when rectangle */ + ( ( xy.right % pWVT->PTEXTSIZE.x ) ? 0 : 1 ); /* Adjust for when rectangle */ colrow.bottom = xy.bottom / pWVT->PTEXTSIZE.y - - ( xy.bottom % pWVT->PTEXTSIZE.y ? 0 : 1 ); /* EXACTLY overlaps characters */ + ( ( xy.bottom % pWVT->PTEXTSIZE.y ) ? 0 : 1 ); /* EXACTLY overlaps characters */ return colrow; } @@ -3014,45 +3014,47 @@ static HB_BOOL hb_gt_wvt_CreateConsoleWindow( PHB_GTWVT pWVT ) if( ! pWVT->hWnd ) { hb_gt_wvt_CreateWindow( pWVT ); - if( ! pWVT->hWnd ) - hb_errInternal( 10001, "Failed to create WVT window", NULL, NULL ); - - hb_gt_wvt_Composited( pWVT, HB_TRUE ); - - /* Set icon */ - if( pWVT->hIcon ) + if( pWVT->hWnd ) { - SendNotifyMessage( pWVT->hWnd, WM_SETICON, ICON_SMALL, ( LPARAM ) pWVT->hIcon ); /* Set Title Bar Icon */ - SendNotifyMessage( pWVT->hWnd, WM_SETICON, ICON_BIG , ( LPARAM ) pWVT->hIcon ); /* Set Task List Icon */ - } + hb_gt_wvt_Composited( pWVT, HB_TRUE ); - { - HMENU hSysMenu = GetSystemMenu( pWVT->hWnd, FALSE ); - if( hSysMenu ) + /* Set icon */ + if( pWVT->hIcon ) { - /* Create "Mark" prompt in SysMenu to allow console type copy operation */ - AppendMenu( hSysMenu, MF_STRING, SYS_EV_MARK, pWVT->lpSelectCopy ); + SendNotifyMessage( pWVT->hWnd, WM_SETICON, ICON_SMALL, ( LPARAM ) pWVT->hIcon ); /* Set Title Bar Icon */ + SendNotifyMessage( pWVT->hWnd, WM_SETICON, ICON_BIG , ( LPARAM ) pWVT->hIcon ); /* Set Task List Icon */ + } + + { + HMENU hSysMenu = GetSystemMenu( pWVT->hWnd, FALSE ); + if( hSysMenu ) + { + /* Create "Mark" prompt in SysMenu to allow console type copy operation */ + AppendMenu( hSysMenu, MF_STRING, SYS_EV_MARK, pWVT->lpSelectCopy ); + } + } + if( pWVT->bFullScreen ) + { + pWVT->bMaximized = HB_FALSE; + pWVT->bFullScreen = HB_FALSE; + hb_gt_wvt_FullScreen( pWVT->pGT ); + } + else + { + if( pWVT->iNewPosX >= 0 && pWVT->iNewPosY >= 0 ) + { + RECT wi = { 0, 0, 0, 0 }; + GetWindowRect( pWVT->hWnd, &wi ); + SetWindowPos( pWVT->hWnd, NULL, pWVT->iNewPosX, pWVT->iNewPosY, + wi.right - wi.left, wi.bottom - wi.top, + SWP_NOSIZE | SWP_NOZORDER ); + } + ShowWindow( pWVT->hWnd, pWVT->bMaximized ? SW_SHOWMAXIMIZED : pWVT->iCmdShow ); + UpdateWindow( pWVT->hWnd ); } - } - if( pWVT->bFullScreen ) - { - pWVT->bMaximized = HB_FALSE; - pWVT->bFullScreen = HB_FALSE; - hb_gt_wvt_FullScreen( pWVT->pGT ); } else - { - if( pWVT->iNewPosX >= 0 && pWVT->iNewPosY >= 0 ) - { - RECT wi = { 0, 0, 0, 0 }; - GetWindowRect( pWVT->hWnd, &wi ); - SetWindowPos( pWVT->hWnd, NULL, pWVT->iNewPosX, pWVT->iNewPosY, - wi.right - wi.left, wi.bottom - wi.top, - SWP_NOSIZE | SWP_NOZORDER ); - } - ShowWindow( pWVT->hWnd, pWVT->bMaximized ? SW_SHOWMAXIMIZED : pWVT->iCmdShow ); - UpdateWindow( pWVT->hWnd ); - } + hb_errInternal( 10001, "Failed to create WVT window", NULL, NULL ); } return HB_TRUE; @@ -3177,18 +3179,20 @@ static void hb_gt_wvt_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFil } pWVT = hb_gt_wvt_New( pGT, ( HINSTANCE ) hInstance, iCmdShow ); - if( ! pWVT ) + if( pWVT ) + { + HB_GTLOCAL( pGT ) = ( void * ) pWVT; + + /* SUPER GT initialization */ + HB_GTSUPER_INIT( pGT, hFilenoStdin, hFilenoStdout, hFilenoStderr ); + HB_GTSELF_RESIZE( pGT, pWVT->ROWS, pWVT->COLS ); + HB_GTSELF_SETFLAG( pGT, HB_GTI_REDRAWMAX, 1 ); + HB_GTSELF_SEMICOLD( pGT ); + + /* hb_gt_wvt_CreateConsoleWindow( pWVT ); */ + } + else hb_errInternal( 10001, "Maximum number of WVT windows reached, cannot create another one", NULL, NULL ); - - HB_GTLOCAL( pGT ) = ( void * ) pWVT; - - /* SUPER GT initialization */ - HB_GTSUPER_INIT( pGT, hFilenoStdin, hFilenoStdout, hFilenoStderr ); - HB_GTSELF_RESIZE( pGT, pWVT->ROWS, pWVT->COLS ); - HB_GTSELF_SETFLAG( pGT, HB_GTI_REDRAWMAX, 1 ); - HB_GTSELF_SEMICOLD( pGT ); - - /* hb_gt_wvt_CreateConsoleWindow( pWVT ); */ } /* ********************************************************************** */ diff --git a/src/rtl/hbbffnc.c b/src/rtl/hbbffnc.c index b6ccf945a9..6c7add657c 100644 --- a/src/rtl/hbbffnc.c +++ b/src/rtl/hbbffnc.c @@ -92,7 +92,6 @@ HB_FUNC( HB_BLOWFISHENCRYPT ) if( nLen ) { char * pszData; - const HB_BLOWFISH * bf = ( const HB_BLOWFISH * ) hb_parc( 1 ); HB_BOOL fRaw = hb_parl( 3 ); /* In raw mode passed string is padded to 8 bytes with '\0' @@ -140,7 +139,6 @@ HB_FUNC( HB_BLOWFISHDECRYPT ) { const char * pszSource; char * pszData; - const HB_BLOWFISH * bf = ( const HB_BLOWFISH * ) hb_parc( 1 ); HB_BOOL fRaw = hb_parl( 3 ); pszData = ( char * ) hb_xgrab( nSize + ( fRaw ? 1 : 0 ) ); diff --git a/src/rtl/hbi18n1.c b/src/rtl/hbi18n1.c index f442327d72..b15e0649e1 100644 --- a/src/rtl/hbi18n1.c +++ b/src/rtl/hbi18n1.c @@ -874,7 +874,7 @@ PHB_ITEM hb_i18n_ngettext( PHB_ITEM pNum, PHB_ITEM pMsgID, PHB_ITEM pContext ) } } - if( HB_IS_ARRAY( pMsgID ) ) + if( pMsgID && HB_IS_ARRAY( pMsgID ) ) { long lIndex; diff --git a/src/rtl/hbi18n2.prg b/src/rtl/hbi18n2.prg index 44f9acfe8f..7f00626687 100644 --- a/src/rtl/hbi18n2.prg +++ b/src/rtl/hbi18n2.prg @@ -93,7 +93,7 @@ STATIC FUNCTION __i18n_strDecode( cLine, cValue, lCont ) #define _BOM_VALUE 0xFEFF #define _UTF8_BOM hb_utf8Chr( _BOM_VALUE ) /* e"\xEF\xBB\xBF" */ -FUNCTION __i18n_potArrayLoad( cFile, cErrorMsg ) +FUNCTION __i18n_potArrayLoad( cFile, /* @ */ cErrorMsg ) LOCAL cLine, cValue LOCAL nMode, nIndex, nOldIndex, nLine, n @@ -102,9 +102,8 @@ FUNCTION __i18n_potArrayLoad( cFile, cErrorMsg ) LOCAL hFile __i18n_fileName( @cFile ) - hFile := FOpen( cFile, FO_READ ) - IF hFile == F_ERROR - cErrorMsg := "cannot open file: " + cFile + IF ( hFile := FOpen( cFile, FO_READ ) ) == F_ERROR + cErrorMsg := hb_StrFormat( "cannot open file: %1$s", cFile ) RETURN NIL ENDIF cValue := Space( FSeek( hFile, 0, FS_END ) ) @@ -112,7 +111,7 @@ FUNCTION __i18n_potArrayLoad( cFile, cErrorMsg ) n := FRead( hFile, @cValue, hb_BLen( cValue ) ) FClose( hFile ) IF n != hb_BLen( cValue ) - cErrorMsg := "cannot read from file: " + cFile + cErrorMsg := hb_StrFormat( "cannot read from file: %1$s", cFile ) RETURN NIL ENDIF /* Strip UTF-8 BOM */ @@ -127,6 +126,7 @@ FUNCTION __i18n_potArrayLoad( cFile, cErrorMsg ) ENDIF aLines := hb_ATokens( cValue, _I18N_EOL ) + cErrorMsg := NIL lCont := .F. nLine := 0 nIndex := 1 @@ -153,7 +153,7 @@ FUNCTION __i18n_potArrayLoad( cFile, cErrorMsg ) cLine := LTrim( SubStr( cLine, 3 ) ) IF cLine == "c-format" ELSE - cErrorMsg := "unsupported flag: " + cLine + cErrorMsg := hb_StrFormat( "unsupported flag: %1$s", cLine ) EXIT ENDIF #endif @@ -186,7 +186,7 @@ FUNCTION __i18n_potArrayLoad( cFile, cErrorMsg ) cErrorMsg := "wrong plural form index" EXIT ENDIF - WHILE IsDigit( SubStr( cLine, n, 1 ) ) + DO WHILE IsDigit( SubStr( cLine, n, 1 ) ) ++n ENDDO ENDIF @@ -219,11 +219,11 @@ FUNCTION __i18n_potArrayLoad( cFile, cErrorMsg ) n := 8 IF IsDigit( SubStr( cLine, n, 1 ) ) nIndex := Val( SubStr( cLine, n ) ) - WHILE IsDigit( SubStr( cLine, n, 1 ) ) + DO WHILE IsDigit( SubStr( cLine, n, 1 ) ) ++n ENDDO ENDIF - WHILE SubStr( cLine, n, 1 ) == " " + DO WHILE SubStr( cLine, n, 1 ) == " " ++n ENDDO IF ! SubStr( cLine, n, 1 ) == "]" @@ -235,8 +235,8 @@ FUNCTION __i18n_potArrayLoad( cFile, cErrorMsg ) EXIT ENDIF IF cValue == NIL - cErrorMsg := "undefined " + iif( nMode == _I18N_MSGID, ; - "msgid", "msgstr" ) + " value" + cErrorMsg := hb_StrFormat( "undefined %1$s value", ; + iif( nMode == _I18N_MSGID, "msgid", "msgstr" ) ) EXIT ENDIF aItem[ _I18N_PLURAL ] := .T. @@ -286,7 +286,7 @@ FUNCTION __i18n_potArrayLoad( cFile, cErrorMsg ) ENDIF IF cErrorMsg != NIL - cErrorMsg := cFile + ":" + hb_ntos( nLine ) + ";" + cErrorMsg + cErrorMsg := hb_StrFormat( "%1$s:%2$d;%3$s", cFile, nLine, cErrorMsg ) aTrans := NIL ENDIF @@ -294,11 +294,11 @@ FUNCTION __i18n_potArrayLoad( cFile, cErrorMsg ) STATIC FUNCTION __i18n_IsBOM_UTF8( cFileName ) - LOCAL fhnd := FOpen( cFileName, FO_READ ) + LOCAL fhnd LOCAL cBuffer LOCAL nLen - IF fhnd != F_ERROR + IF ( fhnd := FOpen( cFileName, FO_READ ) ) != F_ERROR nLen := hb_BLen( _UTF8_BOM ) cBuffer := Space( nLen ) FRead( fhnd, @cBuffer, nLen ) @@ -376,7 +376,7 @@ FUNCTION __i18n_potArrayClean( aTrans, lKeepSource, lKeepVoidTranslations, bTran RETURN aTrans -FUNCTION __i18n_potArraySave( cFile, aTrans, cErrorMsg, lVersionNo, lSourceRef ) +FUNCTION __i18n_potArraySave( cFile, aTrans, /* @ */ cErrorMsg, lVersionNo, lSourceRef ) LOCAL aItem LOCAL hFile @@ -431,12 +431,12 @@ FUNCTION __i18n_potArraySave( cFile, aTrans, cErrorMsg, lVersionNo, lSourceRef ) NEXT __i18n_fileName( @cFile ) - hFile := FCreate( cFile ) - IF hFile == F_ERROR - cErrorMsg := "cannot create translation file: " + cFile + IF ( hFile := FCreate( cFile ) ) == F_ERROR + cErrorMsg := hb_StrFormat( "cannot create translation file: %1$s", cFile ) ELSEIF FWrite( hFile, cPOT ) != hb_BLen( cPOT ) - cErrorMsg := "cannot write to file: " + cFile + cErrorMsg := hb_StrFormat( "cannot write to file: %1$s", cFile ) ELSE + cErrorMsg := NIL lRet := .T. ENDIF FClose( hFile ) @@ -584,8 +584,7 @@ FUNCTION hb_i18n_LoadPOT( cFile, pI18N, cErrorMsg ) LOCAL aTrans LOCAL hI18N - aTrans := __i18n_potArrayLoad( cFile, @cErrorMsg ) - IF aTrans != NIL + IF ( aTrans := __i18n_potArrayLoad( cFile, @cErrorMsg ) ) != NIL IF HB_ISPOINTER( pI18N ) hI18N := __i18n_hashTable( pI18N ) ENDIF @@ -598,7 +597,7 @@ FUNCTION hb_i18n_LoadPOT( cFile, pI18N, cErrorMsg ) RETURN pI18N -FUNCTION hb_i18n_SavePOT( cFile, pI18N, cErrorMsg ) +FUNCTION hb_i18n_SavePOT( cFile, pI18N, /* @ */ cErrorMsg ) LOCAL hI18N LOCAL hFile @@ -647,13 +646,14 @@ FUNCTION hb_i18n_SavePOT( cFile, pI18N, cErrorMsg ) NEXT __i18n_fileName( @cFile ) - hFile := FCreate( cFile ) - IF hFile == F_ERROR - cErrorMsg := "cannot create translation file: " + cFile + IF ( hFile := FCreate( cFile ) ) == F_ERROR + cErrorMsg := hb_StrFormat( "cannot create translation file: %1$s", cFile ) lRet := .F. ELSEIF FWrite( hFile, cPOT ) != hb_BLen( cPOT ) - cErrorMsg := "cannot write to file: " + cFile + cErrorMsg := hb_StrFormat( "cannot write to file: %1$s", cFile ) lRet := .F. + ELSE + cErrorMsg := NIL ENDIF FClose( hFile ) diff --git a/src/rtl/hbini.prg b/src/rtl/hbini.prg index 076c3a8a7f..32b56f9826 100644 --- a/src/rtl/hbini.prg +++ b/src/rtl/hbini.prg @@ -101,7 +101,7 @@ FUNCTION hb_iniNew( lAutoMain ) FUNCTION hb_iniRead( cFileSpec, lKeyCaseSens, cSplitters, lAutoMain ) - RETURN hb_iniReadStr( iif( HB_ISSTRING( cFileSpec ), hb_IniFileLow( cFileSpec ), "" ), lKeyCaseSens, cSplitters, lAutoMain ) + RETURN hb_iniReadStr( iif( HB_ISSTRING( cFileSpec ), hb_iniFileLow( cFileSpec ), "" ), lKeyCaseSens, cSplitters, lAutoMain ) FUNCTION hb_iniReadStr( cData, lKeyCaseSens, cSplitters, lAutoMain ) @@ -119,9 +119,9 @@ FUNCTION hb_iniReadStr( cData, lKeyCaseSens, cSplitters, lAutoMain ) hIni[ "MAIN" ] := { => } ENDIF - RETURN hb_IniStringLow( hIni, cData, lKeyCaseSens, cSplitters, lAutoMain ) + RETURN hb_iniStringLow( hIni, cData, lKeyCaseSens, cSplitters, lAutoMain ) -STATIC FUNCTION hb_IniFileLow( cFileSpec ) +STATIC FUNCTION hb_iniFileLow( cFileSpec ) LOCAL cFile, nLen LOCAL hFile @@ -154,7 +154,7 @@ STATIC FUNCTION hb_IniFileLow( cFileSpec ) RETURN cData -STATIC FUNCTION hb_IniStringLow( hIni, cData, lKeyCaseSens, cSplitters, lAutoMain ) +STATIC FUNCTION hb_iniStringLow( hIni, cData, lKeyCaseSens, cSplitters, lAutoMain ) LOCAL nLen LOCAL aKeyVal, hCurrentSection @@ -232,7 +232,7 @@ STATIC FUNCTION hb_IniStringLow( hIni, cData, lKeyCaseSens, cSplitters, lAutoMai IF Len( aKeyVal[ 2 ] ) == 0 LOOP ENDIF - hb_IniStringLow( hIni, hb_IniFileLow( aKeyVal[ 2 ] ), lKeyCaseSens, cSplitters, lAutoMain ) + hb_iniStringLow( hIni, hb_iniFileLow( aKeyVal[ 2 ] ), lKeyCaseSens, cSplitters, lAutoMain ) cLine := "" LOOP ENDIF @@ -328,7 +328,7 @@ FUNCTION hb_iniWriteStr( hIni, cCommentBegin, cCommentEnd, lAutoMain ) hb_default( @lAutoMain, .T. ) // Fix if lAutoMain is .T. but I haven't a MAIN section - IF lAutoMain .AND. ! hb_HHasKey( hIni, "MAIN" ) + IF lAutoMain .AND. !( "MAIN" $ hIni ) lAutoMain := .F. ENDIF @@ -336,13 +336,12 @@ FUNCTION hb_iniWriteStr( hIni, cCommentBegin, cCommentEnd, lAutoMain ) IF lAutoMain /* When automain is on, write the main section */ hb_HEval( hIni[ "MAIN" ], ; - {| cKey, xVal | cBuffer += hb_CStr( cKey ) + " = " + ; + {| cKey, xVal | cBuffer += hb_CStr( cKey ) + "=" + ; hb_CStr( xVal ) + cNewLine } ) - ELSE /* When automain is off, just write all the toplevel variables. */ hb_HEval( hIni, {| cKey, xVal | iif( ! HB_ISHASH( xVal ), ; - cBuffer += hb_CStr( cKey ) + " = " + ; + cBuffer += hb_CStr( cKey ) + "=" + ; hb_CStr( xVal ) + cNewLine, /* nothing */ ) } ) ENDIF diff --git a/src/rtl/hbjson.c b/src/rtl/hbjson.c index ea21f15206..93be9fd9aa 100644 --- a/src/rtl/hbjson.c +++ b/src/rtl/hbjson.c @@ -82,12 +82,12 @@ encoder still allows to use same structure in the leaves, in this case content will be duplicate. I.e.: - xI := {1, NIL} - xI[2] := xI + xI := { 1, NIL } + xI[ 2 ] := xI ? hb_jsonEncode( xI ) // [1,null] but: - xI := {1, .T.} - xI := {2, xI, xI} + xI := { 1, .T. } + xI := { 2, xI, xI } ? hb_jsonEncode( xI ) // [2,[1,true],[1,true]] */ @@ -153,7 +153,7 @@ static void _hb_jsonEncode( PHB_ITEM pValue, PHB_JSON_ENCODE_CTX pCtx, { if( pCtx->pId[ nIndex ] == id ) { - if( !fEOL && pCtx->fHuman ) + if( ! fEOL && pCtx->fHuman ) _hb_jsonCtxAddIndent( pCtx, nLevel * INDENT_SIZE ); _hb_jsonCtxAdd( pCtx, "null", 4 ); return; @@ -348,7 +348,7 @@ static void _hb_jsonEncode( PHB_ITEM pValue, PHB_JSON_ENCODE_CTX pCtx, if( pCtx->fHuman ) { - _hb_jsonCtxAdd( pCtx, " : ", 3 ); + _hb_jsonCtxAdd( pCtx, ": ", 2 ); fEOL = ( HB_IS_ARRAY( pItem ) || HB_IS_HASH( pItem ) ) && hb_itemSize( pItem ) > 0; } else diff --git a/src/rtl/hbrand.c b/src/rtl/hbrand.c index 2f9985dffe..c41f053130 100644 --- a/src/rtl/hbrand.c +++ b/src/rtl/hbrand.c @@ -59,3 +59,17 @@ void hb_random_block( void * data, HB_SIZE len ) { hb_arc4random_buf( data, len ); } + +HB_FUNC( HB_RANDSTR ) +{ + HB_SIZE len = hb_parns( 1 ); + + if( len > 0 ) + { + void * data = hb_xgrab( len + 1 ); + hb_random_block( data, len ); + hb_retclen( ( char * ) data, len ); + } + else + hb_retc_null(); +} diff --git a/src/rtl/listbox.prg b/src/rtl/listbox.prg index bdf3e7052c..18329a6a59 100644 --- a/src/rtl/listbox.prg +++ b/src/rtl/listbox.prg @@ -192,8 +192,8 @@ METHOD delItem( nPos ) IF nPos >= 1 .AND. nPos <= ::nItemCount - ADel( ::aItems, nPos ) - ASize( ::aItems, --::nItemCount ) + hb_ADel( ::aItems, nPos, .T. ) + ::nItemCount-- IF ::nValue > ::nItemCount ::nValue := ::nItemCount @@ -491,9 +491,8 @@ METHOD insItem( nPos, cText, cData ) HB_ISNUMERIC( nPos ) .AND. ; nPos < ::nItemCount - ASize( ::aItems, ++::nItemCount ) - AIns( ::aItems, nPos ) - ::aItems[ nPos ] := { cText, cData } + hb_AIns( ::aItems, nPos, { cText, cData }, .T. ) + ::nItemCount++ IF ::nItemCount == 1 ::nTopItem := 1 @@ -548,10 +547,10 @@ METHOD open() CLASS ListBox IF ! ::lIsOpen ::aSaveScr := { ; - ::nTop + 1,; - ::nLeft,; - ::nBottom,; - ::nRight,; + ::nTop + 1, ; + ::nLeft, ; + ::nBottom, ; + ::nRight, ; SaveScreen( ::nTop + 1, ::nLeft, ::nBottom, ::nRight ) } ::lIsOpen := .T. @@ -1086,7 +1085,7 @@ METHOD New( nTop, nLeft, nBottom, nRight, lDropDown ) FUNCTION ListBox( nTop, nLeft, nBottom, nRight, lDropDown ) RETURN HBListBox():New( nTop, nLeft, nBottom, nRight, lDropDown ) -FUNCTION _LISTBOX_( nTop, nLeft, nBottom, nRight, xPos, aItems, cCaption,; +FUNCTION _LISTBOX_( nTop, nLeft, nBottom, nRight, xPos, aItems, cCaption, ; cMessage, cColorSpec, bFBlock, bSBlock, lDropDown, lScrollBar, cBitmap ) LOCAL o := HBListBox():New( nTop, nLeft, nBottom, nRight, lDropDown ) diff --git a/src/rtl/menusys.prg b/src/rtl/menusys.prg index d6b27c4467..dea407418d 100644 --- a/src/rtl/menusys.prg +++ b/src/rtl/menusys.prg @@ -82,16 +82,17 @@ FUNCTION IsShortcut( oMenu, nKey, nID ) LOCAL oItem LOCAL i + DO CASE // Test for top menu item not a TopBar Menu: - IF !( oMenu:ClassName() == "TOPBARMENU" ) + CASE !( oMenu:ClassName() == "TOPBARMENU" ) RETURN IsQuick( oMenu, nKey, @nID ) // Test and assign top menu item shortCut, enabled, and ! PopUp: // Changed by enclosing assignment before ':Enabled': - ELSEIF ( nShortCut := oMenu:getShortCt( nKey ) ) > 0 .AND. ; - ( oItem := oMenu:getItem( nShortcut ) ):enabled .AND. ; - ! oItem:isPopUp() + CASE ( nShortCut := oMenu:getShortCt( nKey ) ) > 0 .AND. ; + ( oItem := oMenu:getItem( nShortcut ) ):enabled .AND. ; + ! oItem:isPopUp() oMenu:select( nShortCut ) Eval( oItem:data, oItem ) @@ -100,7 +101,7 @@ FUNCTION IsShortcut( oMenu, nKey, nID ) RETURN .T. // Test and assignment for TopBar MenuItem: - ELSEIF nShortCut == 0 + CASE nShortCut == 0 nTotal := oMenu:itemCount nItem := oMenu:current @@ -124,7 +125,7 @@ FUNCTION IsShortcut( oMenu, nKey, nID ) ENDIF NEXT - ENDIF + ENDCASE RETURN .F. diff --git a/src/rtl/mtran.c b/src/rtl/mtran.c index 6733c3f04f..583a88fec6 100644 --- a/src/rtl/mtran.c +++ b/src/rtl/mtran.c @@ -51,7 +51,7 @@ /* NOTE: pszResult must have an allocated buffer of at least nStringLen */ -HB_SIZE hb_strMemotran( char * pszResult, const char * pszString, HB_SIZE nStringLen, char cHardCR, char cSoftCR ) +static HB_SIZE hb_strMemotran( char * pszResult, const char * pszString, HB_SIZE nStringLen, char cHardCR, char cSoftCR ) { HB_SIZE nStringPos = 0; HB_SIZE nResultPos = 0; diff --git a/src/rtl/radiogrp.prg b/src/rtl/radiogrp.prg index 511d597a81..d06075b60d 100644 --- a/src/rtl/radiogrp.prg +++ b/src/rtl/radiogrp.prg @@ -143,8 +143,8 @@ METHOD addItem( oRadioButton ) CLASS RadioGroup METHOD delItem( nPos ) CLASS RadioGroup IF nPos >= 1 .AND. nPos <= ::nItemCount - ADel( ::aItems[ nPos ] ) - ASize( ::aItems, --::nItemCount ) + hb_ADel( ::aItems, nPos, .T. ) + ::nItemCount-- ENDIF IF ::lHasFocus .AND. ::nItemCount < ::nValue @@ -228,7 +228,7 @@ METHOD hitTest( nMRow, nMCol ) CLASS RadioGroup LOCAL nLen LOCAL nPos - LOCAL aItems + LOCAL item DO CASE CASE Empty( ::cColdbox + ::cHotBox ) @@ -282,11 +282,9 @@ METHOD hitTest( nMRow, nMCol ) CLASS RadioGroup CASE nMRow > ::nBottom CASE nMCol < ::nLeft CASE nMCol <= ::nRight - aItems := ::aItems - nLen := ::nItemCount - FOR nPos := 1 TO nLen - IF aItems[ nPos ]:hitTest( nMRow, nMCol ) != HTNOWHERE - RETURN nPos + FOR EACH item IN ::aItems + IF item:hitTest( nMRow, nMCol ) != HTNOWHERE + RETURN item:__enumIndex() ENDIF NEXT RETURN HTCLIENT @@ -299,18 +297,15 @@ METHOD insItem( nPos, oRadioButton ) CLASS RadioGroup IF HB_ISOBJECT( oRadioButton ) .AND. oRadioButton:ClassName() == "RADIOBUTTN" .AND. ; nPos < ::nItemCount - ASize( ::aItems, ++::nItemCount ) - AIns( ::aItems, nPos, oRadioButton ) - ::aItems[ nPos ] := oRadioButton + hb_AIns( ::aItems, nPos, oRadioButton, .T. ) + ::nItemCount++ ENDIF RETURN ::aItems[ nPos ] METHOD killFocus() CLASS RadioGroup - LOCAL nPos - LOCAL nLen - LOCAL aItems + LOCAL item LOCAL nOldMCur @@ -322,15 +317,12 @@ METHOD killFocus() CLASS RadioGroup Eval( ::bFBlock ) ENDIF - aItems := ::aItems - nLen := ::nItemCount - nOldMCur := MSetCursor( .F. ) DispBegin() - FOR nPos := 1 TO nLen - aItems[ nPos ]:killFocus() + FOR EACH item IN ::aItems + item:killFocus() NEXT ::display() @@ -346,9 +338,7 @@ METHOD killFocus() CLASS RadioGroup METHOD setFocus() CLASS RadioGroup - LOCAL nPos - LOCAL nLen - LOCAL aItems + LOCAL item LOCAL nOldMCur @@ -357,15 +347,12 @@ METHOD setFocus() CLASS RadioGroup ::nCursor := SetCursor( SC_NONE ) ::lHasFocus := .T. - aItems := ::aItems - nLen := ::nItemCount - nOldMCur := MSetCursor( .F. ) DispBegin() - FOR nPos := 1 TO nLen - aItems[ nPos ]:setFocus() + FOR EACH item IN ::aItems + item:setFocus() NEXT ::display() @@ -452,24 +439,20 @@ METHOD select( xValue ) CLASS RadioGroup METHOD setColor( cColorSpec ) CLASS RadioGroup - LOCAL nPos - LOCAL nLen := ::nItemCount - LOCAL aItems := ::aItems + LOCAL item - FOR nPos := 1 TO nLen - aItems[ nPos ]:colorSpec := cColorSpec + FOR EACH item IN ::aItems + item:colorSpec := cColorSpec NEXT RETURN Self METHOD setStyle( cStyle ) CLASS RadioGroup - LOCAL nPos - LOCAL nLen := ::nItemCount - LOCAL aItems := ::aItems + LOCAL item - FOR nPos := 1 TO nLen - aItems[ nPos ]:style := cStyle + FOR EACH item IN ::aItems + item:style := cStyle NEXT RETURN Self diff --git a/src/rtl/tget.prg b/src/rtl/tget.prg index 533a58d714..8efe3091d9 100644 --- a/src/rtl/tget.prg +++ b/src/rtl/tget.prg @@ -95,7 +95,7 @@ CREATE CLASS Get EXPORTED: - VAR decPos INIT 0 READONLY /* ; CA-Cl*pper NG says that it contains NIL, but in fact it contains zero. [vszakats] */ + VAR decPos INIT 0 READONLY /* CA-Cl*pper NG says that it contains NIL, but in fact it contains zero. [vszakats] */ VAR hasFocus INIT .F. READONLY VAR original READONLY VAR rejected INIT .F. READONLY @@ -276,7 +276,7 @@ METHOD display() CLASS Get cBuffer := SubStr( cBuffer, 1, ::decPos - 2 ) + "-." + SubStr( cBuffer, ::decPos + 1 ) ENDIF - IF ::nDispLen != ::nMaxLen .AND. ::nPos != 0 /* ; has scroll? */ + IF ::nDispLen != ::nMaxLen .AND. ::nPos != 0 /* has scroll? */ IF ::nDispLen > 8 nDispPos := Max( 1, Min( ::nPos - ::nDispLen + 4 , ::nMaxLen - ::nDispLen + 1 ) ) ELSE @@ -410,12 +410,12 @@ METHOD reset() CLASS Get ::cBuffer := ::PutMask( ::varGet(), .F. ) ::xVarGet := ::original ::cType := ValType( ::xVarGet ) - ::pos := ::FirstEditable() /* ; Simple 0 in CA-Cl*pper [vszakats] */ + ::pos := ::FirstEditable() /* Simple 0 in CA-Cl*pper [vszakats] */ ::lClear := ( "K" $ ::cPicFunc .OR. ::cType == "N" ) ::lEdit := .F. ::lMinus := .F. ::rejected := .F. - ::typeOut := !( ::type $ "CNDTL" ) .OR. ( ::nPos == 0 ) /* ; Simple .F. in CA-Cl*pper [vszakats] */ + ::typeOut := !( ::type $ "CNDTL" ) .OR. ( ::nPos == 0 ) /* Simple .F. in CA-Cl*pper [vszakats] */ ::display() ENDIF @@ -464,7 +464,7 @@ METHOD setFocus() CLASS Get ENDIF ::lMinus2 := ( ::xVarGet < 0 ) ELSE - ::decPos := 0 /* ; CA-Cl*pper NG says that it contains NIL, but in fact it contains zero. [vszakats] */ + ::decPos := 0 /* CA-Cl*pper NG says that it contains NIL, but in fact it contains zero. [vszakats] */ ENDIF ::display() @@ -481,7 +481,7 @@ METHOD killFocus() CLASS Get ::lClear := .F. ::lMinus := .F. ::lChanged := .F. - ::decPos := 0 /* ; CA-Cl*pper NG says that it contains NIL, but in fact it contains zero. [vszakats] */ + ::decPos := 0 /* CA-Cl*pper NG says that it contains NIL, but in fact it contains zero. [vszakats] */ ::typeOut := .F. IF lHadFocus @@ -587,7 +587,7 @@ METHOD overStrike( cChar ) CLASS Get ::pos := 1 ENDIF - DO WHILE ! ::IsEditable( ::nPos ) .AND. ::nPos <= ::nMaxEdit + DO WHILE ! ::IsEditable( ::nPos ) .AND. ::nPos <= ::nMaxEdit .AND. ! ::typeOut ::pos++ ENDDO @@ -643,7 +643,7 @@ METHOD insert( cChar ) CLASS Get ::pos := 1 ENDIF - DO WHILE ! ::IsEditable( ::nPos ) .AND. ::nPos <= ::nMaxEdit + DO WHILE ! ::IsEditable( ::nPos ) .AND. ::nPos <= ::nMaxEdit .AND. ! ::typeOut ::pos++ ENDDO @@ -1463,7 +1463,7 @@ METHOD reform() CLASS Get IF ::hasFocus ::cBuffer := ::PutMask( ::unTransform(), .F. ) - ::nDispLen := iif( ::nPicLen == NIL, ::nMaxLen, ::nPicLen ) // ; ? + ::nDispLen := iif( ::nPicLen == NIL, ::nMaxLen, ::nPicLen ) // ? ENDIF RETURN Self @@ -1685,10 +1685,10 @@ METHOD IsEditable( nPos ) CLASS Get RETURN .T. ENDIF - /* ; This odd behaviour helps to be more compatible with CA-Cl*pper in some rare situations. - xVar := 98 ; o := _GET_( xVar, "xVar" ) ; o:SetFocus() ; o:picture := "99999" ; o:UnTransform() -> result - We're still not 100% compatible in slighly different situations because the CA-Cl*pper - behaviour is pretty much undefined here. [vszakats] */ + /* This odd behaviour helps to be more compatible with CA-Cl*pper in some rare situations. + xVar := 98 ; o := _GET_( xVar, "xVar" ) ; o:SetFocus() ; o:picture := "99999" ; o:UnTransform() -> result + We're still not 100% compatible in slighly different situations because the CA-Cl*pper + behaviour is pretty much undefined here. [vszakats] */ IF nPos > Len( ::cPicMask ) .AND. nPos <= ::nMaxLen RETURN .T. ENDIF @@ -1941,9 +1941,7 @@ METHOD New( nRow, nCol, bVarBlock, cVarName, cPicture, cColorSpec ) CLASS Get IF nCol == NIL nCol := Col() + iif( Set( _SET_DELIMITERS ), 1, 0 ) ENDIF - IF cVarName == NIL - cVarName := "" - ENDIF + __defaultNIL( @cVarName, "" ) IF bVarBlock == NIL bVarBlock := iif( HB_ISSTRING( cVarName ), MemVarBlock( cVarName ), NIL ) ENDIF diff --git a/src/rtl/tgetlist.prg b/src/rtl/tgetlist.prg index 0333df2ebb..a0c0924257 100644 --- a/src/rtl/tgetlist.prg +++ b/src/rtl/tgetlist.prg @@ -65,6 +65,8 @@ #include "setcurs.ch" #include "tbrowse.ch" +#define IS_IN( str, list ) ( "|" + str + "|" $ "|" + list + "|" ) + #define SCORE_ROW 0 #define SCORE_COL 60 @@ -872,18 +874,19 @@ METHOD GUIReader( oGet, oMenu, aMsg ) CLASS HBGetList oGUI:setFocus() IF oGet:exitState == GE_NOEXIT // Added. - IF ::nHitCode > 0 + DO CASE + CASE ::nHitCode > 0 oGUI:Select( ::nHitCode ) - ELSEIF ::nHitCode == HTCAPTION + CASE ::nHitCode == HTCAPTION oGUI:Select() - ELSEIF ::nHitCode == HTCLIENT + CASE ::nHitCode == HTCLIENT oGUI:Select( K_LBUTTONDOWN ) - ELSEIF ::nHitCode == HTDROPBUTTON + CASE ::nHitCode == HTDROPBUTTON oGUI:Open() - ELSEIF ::nHitCode >= HTSCROLLFIRST .AND. ; - ::nHitCode <= HTSCROLLLAST + CASE ::nHitCode >= HTSCROLLFIRST .AND. ; + ::nHitCode <= HTSCROLLLAST oGUI:Scroll( ::nHitCode ) - ENDIF + ENDCASE ENDIF ::nHitCode := 0 @@ -910,7 +913,7 @@ METHOD GUIReader( oGet, oMenu, aMsg ) CLASS HBGetList ENDDO // De-activate the GET - IF oGUI:ClassName() $ "LISTBOX|RADIOGROUP" .AND. HB_ISNUMERIC( oGet:varGet() ) + IF IS_IN( oGUI:ClassName(), "LISTBOX|RADIOGROUP" ) .AND. HB_ISNUMERIC( oGet:varGet() ) oGet:varPut( oGUI:value ) ELSE oGet:varPut( oGUI:buffer ) @@ -1179,7 +1182,7 @@ METHOD GUIPostValidate( oGet, oGUI, aMsg ) CLASS HBGetList IF !( oGUI:ClassName() == "TBROWSE" ) xOldValue := oGet:varGet() - IF oGUI:ClassName() $ "LISTBOX|RADIOGROUP" .AND. HB_ISNUMERIC( oGet:varGet() ) + IF IS_IN( oGUI:ClassName(), "LISTBOX|RADIOGROUP" ) .AND. HB_ISNUMERIC( oGet:varGet() ) xNewValue := oGUI:Value ELSE xNewValue := oGUI:Buffer @@ -1414,22 +1417,14 @@ METHOD Accelerator( nKey, aMsg ) CLASS HBGetList LOCAL nIteration LOCAL lGUI - IF nKey >= K_ALT_Q .AND. nKey <= K_ALT_P - cKey := SubStr( "qwertyuiop", nKey - K_ALT_Q + 1, 1 ) - - ELSEIF nKey >= K_ALT_A .AND. nKey <= K_ALT_L - cKey := SubStr( "asdfghjkl", nKey - K_ALT_A + 1, 1 ) - - ELSEIF nKey >= K_ALT_Z .AND. nKey <= K_ALT_M - cKey := SubStr( "zxcvbnm", nKey - K_ALT_Z + 1, 1 ) - - ELSEIF nKey >= K_ALT_1 .AND. nKey <= K_ALT_0 - cKey := SubStr( "1234567890", nKey - K_ALT_1 + 1, 1 ) - - ELSE + DO CASE + CASE nKey >= K_ALT_Q .AND. nKey <= K_ALT_P ; cKey := SubStr( "qwertyuiop", nKey - K_ALT_Q + 1, 1 ) + CASE nKey >= K_ALT_A .AND. nKey <= K_ALT_L ; cKey := SubStr( "asdfghjkl", nKey - K_ALT_A + 1, 1 ) + CASE nKey >= K_ALT_Z .AND. nKey <= K_ALT_M ; cKey := SubStr( "zxcvbnm", nKey - K_ALT_Z + 1, 1 ) + CASE nKey >= K_ALT_1 .AND. nKey <= K_ALT_0 ; cKey := SubStr( "1234567890", nKey - K_ALT_1 + 1, 1 ) + OTHERWISE RETURN 0 - - ENDIF + ENDCASE nStart := ::nPos + 1 nEnd := Len( ::aGetList ) @@ -1487,15 +1482,14 @@ METHOD Accelerator( nKey, aMsg ) CLASS HBGetList METHOD HitTest( nMRow, nMCol, aMsg ) CLASS HBGetList - LOCAL nCount - LOCAL nTotal := Len( ::aGetList ) + LOCAL oGet LOCAL lGUI ::nNextGet := 0 - FOR nCount := 1 TO nTotal - IF ( ::nHitCode := ::aGetList[ nCount ]:hitTest( nMRow, nMCol ) ) != HTNOWHERE - ::nNextGet := nCount + FOR EACH oGet IN ::aGetList + IF ( ::nHitCode := oGet:hitTest( nMRow, nMCol ) ) != HTNOWHERE + ::nNextGet := oGet:__enumIndex() EXIT ENDIF NEXT diff --git a/src/rtl/tlabel.prg b/src/rtl/tlabel.prg index 78cfdeba5f..382ccb4173 100644 --- a/src/rtl/tlabel.prg +++ b/src/rtl/tlabel.prg @@ -165,7 +165,7 @@ METHOD New( cLBLName, lPrinter, cAltFile, lNoConsole, bFor, ; ::aLabelData := ::LoadLabel( cLBLName ) // Load the (.lbl) into an array // Add to the left margin if a SET MARGIN has been defined - ::aLabelData[ LBL_LMARGIN ] := ::aLabelData[ LBL_LMARGIN ] + OldMargin + ::aLabelData[ LBL_LMARGIN ] += OldMargin ASize( ::aBandToPrint, Len( ::aLabelData[ LBL_FIELDS ] ) ) AFill( ::aBandToPrint, Space( ::aLabelData[ LBL_LMARGIN ] ) ) @@ -230,8 +230,9 @@ METHOD ExecuteLabel() CLASS HBLabelForm v := Eval( ::aLabelData[ LBL_FIELDS, nField, LF_EXP ] ) - cBuffer := PadR( v, ::aLabelData[ LBL_WIDTH ] ) - cBuffer := cBuffer + Space( ::aLabelData[ LBL_SPACES ] ) + cBuffer := ; + PadR( v, ::aLabelData[ LBL_WIDTH ] ) + ; + Space( ::aLabelData[ LBL_SPACES ] ) IF ::aLabelData[ LBL_FIELDS, nField, LF_BLANK ] IF ! Empty( cBuffer ) @@ -240,24 +241,17 @@ METHOD ExecuteLabel() CLASS HBLabelForm ELSE AAdd( aBuffer, cBuffer ) ENDIF - ELSE - AAdd( aBuffer, NIL ) - ENDIF - NEXT ASize( aBuffer, Len( ::aLabelData[ LBL_FIELDS ] ) ) // Add aBuffer to ::aBandToPrint FOR nField := 1 TO Len( ::aLabelData[ LBL_FIELDS ] ) - IF aBuffer[ nField ] == NIL - ::aBandToPrint[ nField ] := ::aBandToPrint[ nField ] + ::cBlank - ELSE - ::aBandToPrint[ nField ] := ::aBandToPrint[ nField ] + aBuffer[ nField ] - ENDIF + ::aBandToPrint[ nField ] += ; + iif( aBuffer[ nField ] == NIL, ::cBlank, aBuffer[ nField ] ) NEXT IF ::nCurrentCol == ::aLabelData[ LBL_ACROSS ] @@ -268,7 +262,7 @@ METHOD ExecuteLabel() CLASS HBLabelForm NEXT ::lOneMoreBand := .F. - ::nCurrentCol := 1 + ::nCurrentCol := 1 // Print the band AEval( ::aBandToPrint, {| BandLine | PrintIt( BandLine ) } ) @@ -285,14 +279,13 @@ METHOD ExecuteLabel() CLASS HBLabelForm FOR nField := 1 TO ::aLabelData[ LBL_LINES ] PrintIt() NEXT - ENDIF // Clear out the band AFill( ::aBandToPrint, Space( ::aLabelData[ LBL_LMARGIN ] ) ) ELSE ::lOneMoreBand := .T. - ::nCurrentCol := ::nCurrentCol + 1 + ::nCurrentCol++ ENDIF RETURN Self @@ -306,10 +299,8 @@ METHOD SampleLabels() CLASS HBLabelForm ASize( aBand, ::aLabelData[ LBL_HEIGHT ] ) AFill( aBand, Space( ::aLabelData[ LBL_LMARGIN ] ) + ; - Replicate( Replicate( "*", ; - ::aLabelData[ LBL_WIDTH ] ) + ; - Space( ::aLabelData[ LBL_SPACES ] ), ; - ::aLabelData[ LBL_ACROSS ] ) ) + Replicate( Replicate( "*", ::aLabelData[ LBL_WIDTH ] ) + ; + Space( ::aLabelData[ LBL_SPACES ] ), ::aLabelData[ LBL_ACROSS ] ) ) // Prints sample labels DO WHILE lMoreSamples @@ -384,9 +375,7 @@ METHOD LoadLabel( cLblFile ) CLASS HBLabelForm IF Empty( nFileError := FError() ) EXIT ENDIF - NEXT - ENDIF // File error @@ -426,7 +415,7 @@ METHOD LoadLabel( cLblFile ) CLASS HBLabelForm // Get the text of the expression cFieldText := RTrim( hb_BSubStr( cBuff, nOffset, FIELDSIZE ) ) - nOffset := nOffSet + 60 + nOffset += 60 IF ! Empty( cFieldText ) @@ -440,13 +429,9 @@ METHOD LoadLabel( cLblFile ) CLASS HBLabelForm // Compression option AAdd( aLabel[ LBL_FIELDS, i ], .T. ) - ELSE - AAdd( aLabel[ LBL_FIELDS ], NIL ) - ENDIF - NEXT // Close file diff --git a/src/rtl/tmenuitm.prg b/src/rtl/tmenuitm.prg index 8d16414ff3..baabdf55fb 100644 --- a/src/rtl/tmenuitm.prg +++ b/src/rtl/tmenuitm.prg @@ -50,6 +50,8 @@ #include "button.ch" +#define IS_IN( str, list ) ( "|" + str + "|" $ "|" + list + "|" ) + /* NOTE: Harbour doesn't support CA-Cl*pper 5.3 GUI functionality, but it has all related variables and methods. */ @@ -70,8 +72,9 @@ CREATE CLASS MenuItem FUNCTION HBMenuItem METHOD shortcut( nShortcut ) SETGET METHOD style( cStyle ) SETGET - VAR __col INIT -1 AS NUMERIC /* NOTE: This is a Harbour extension. */ - VAR __row INIT -1 AS NUMERIC /* NOTE: This is a Harbour extension. */ + VAR __col INIT -1 AS NUMERIC /* NOTE: This is a Harbour extension. */ + VAR __row INIT -1 AS NUMERIC /* NOTE: This is a Harbour extension. */ + VAR __issep INIT .F. AS LOGICAL /* NOTE: This is a Harbour extension. */ METHOD isPopUp() @@ -96,12 +99,12 @@ METHOD caption( cCaption ) CLASS MenuItem ::cCaption := __eInstVar53( Self, "CAPTION", cCaption, "C", 1001 ) - // ; TOFIX: HB_MENU_SEPARATOR_UNI is dynamic value, so it's not good - // to use it for flag purposes. IF ::cCaption == HB_MENU_SEPARATOR_UNI + ::__issep := .T. ::boData := NIL - ::lChecked := .F. - ::lEnabled := .F. + ::lChecked := ::lEnabled := .F. + ELSE + ::__issep := .F. ENDIF ENDIF @@ -109,9 +112,7 @@ METHOD caption( cCaption ) CLASS MenuItem METHOD checked( lChecked ) CLASS MenuItem - // ; TOFIX: HB_MENU_SEPARATOR_UNI is dynamic value, so it's not good - // to use it for flag purposes. - IF lChecked != NIL .AND. !( ::cCaption == HB_MENU_SEPARATOR_UNI ) + IF lChecked != NIL .AND. ! ::__issep ::lChecked := __eInstVar53( Self, "CHECKED", lChecked, "L", 1001 ) ENDIF @@ -123,7 +124,7 @@ METHOD data( boData ) CLASS MenuItem IF HB_ISBLOCK( boData ) ::boData := boData ELSE - ::boData := __eInstVar53( Self, "DATA", boData, "O", 1001, {|| boData:ClassName() $ "POPUPMENU|HB_POPUPMENU" } ) + ::boData := __eInstVar53( Self, "DATA", boData, "O", 1001, {|| IS_IN( boData:ClassName(), "POPUPMENU|HB_POPUPMENU" ) } ) ENDIF ENDIF @@ -131,9 +132,7 @@ METHOD data( boData ) CLASS MenuItem METHOD enabled( lEnabled ) CLASS MenuItem - // ; TOFIX: HB_MENU_SEPARATOR_UNI is dynamic value, so it's not good - // to use it for flag purposes. - IF lEnabled != NIL .AND. !( ::cCaption == HB_MENU_SEPARATOR_UNI ) + IF lEnabled != NIL .AND. ! ::__issep ::lEnabled := __eInstVar53( Self, "ENABLED", lEnabled, "L", 1001 ) ENDIF @@ -172,18 +171,14 @@ METHOD style( cStyle ) CLASS MenuItem RETURN ::cStyle METHOD isPopUp() CLASS MenuItem - RETURN HB_ISOBJECT( ::data ) .AND. ::data:ClassName() $ "POPUPMENU|HB_POPUPMENU" + RETURN HB_ISOBJECT( ::data ) .AND. IS_IN( ::data:ClassName(), "POPUPMENU|HB_POPUPMENU" ) METHOD New( cCaption, boData, nShortcut, cMessage, nID ) CLASS MenuItem - hb_default( @nShortcut, 0 ) - hb_default( @cMessage, "" ) - hb_default( @nID, 0 ) - ::data := boData - ::nID := nID - ::cMessage := cMessage - ::nShortcut := nShortcut + ::nID := hb_defaultValue( nID, 0 ) + ::cMessage := hb_defaultValue( cMessage, "" ) + ::nShortcut := hb_defaultValue( nShortcut, 0 ) ::caption := cCaption RETURN Self diff --git a/src/rtl/tmenusys.prg b/src/rtl/tmenusys.prg index 7fd4984817..fca2a7b49d 100644 --- a/src/rtl/tmenusys.prg +++ b/src/rtl/tmenusys.prg @@ -52,6 +52,8 @@ #include "inkey.ch" #include "setcurs.ch" +#define IS_IN( str, list ) ( "|" + str + "|" $ "|" + list + "|" ) + /* NOTE: Harbour doesn't support CA-Cl*pper 5.3 GUI functionality, but it has all related variables and methods. */ @@ -155,7 +157,7 @@ METHOD Modal( nSelection, nMsgRow, nMsgLeft, nMsgRight, cMsgColor, GetList ) CLA DO WHILE nSelection <= 0 - nKey := Inkey( 0, INKEY_KEYBOARD + INKEY_LDOWN ) + nKey := Inkey( 0, hb_bitOr( INKEY_KEYBOARD, INKEY_LDOWN ) ) IF nKey == K_LBUTTONDOWN .OR. nKey == K_LDBLCLK nSelection := oTopMenu:hitTest( MRow(), MCol() ) @@ -203,9 +205,9 @@ METHOD Modal( nSelection, nMsgRow, nMsgLeft, nMsgRight, cMsgColor, GetList ) CLA IF lLeftDown - IF ! ::MHitTest( @oNewMenu, @nNewLevel, @nNewItem ) // ; hit nowhere. + IF ! ::MHitTest( @oNewMenu, @nNewLevel, @nNewItem ) // hit nowhere. - ELSEIF nNewLevel != ::nMenuLevel // ; menu level change. + ELSEIF nNewLevel != ::nMenuLevel // menu level change. IF nNewItem != oNewMenu:current .AND. oNewMenu:GetItem( nNewItem ):enabled ::oMenu := oNewMenu @@ -216,7 +218,7 @@ METHOD Modal( nSelection, nMsgRow, nMsgLeft, nMsgRight, cMsgColor, GetList ) CLA ::ShowMsg( .T. ) ENDIF - ELSEIF nNewItem != oNewMenu:Current() // ; menu item change. + ELSEIF nNewItem != oNewMenu:Current() // menu item change. ::PopChild( ::nMenuLevel ) @@ -316,7 +318,7 @@ METHOD Modal( nSelection, nMsgRow, nMsgLeft, nMsgRight, cMsgColor, GetList ) CLA ::ShowMsg( .T. ) ELSE - IF ::oMenu:ClassName() $ "POPUPMENU|HB_POPUPMENU" + IF IS_IN( ::oMenu:ClassName(), "POPUPMENU|HB_POPUPMENU" ) ::oMenu:close() ENDIF @@ -332,14 +334,14 @@ METHOD Modal( nSelection, nMsgRow, nMsgLeft, nMsgRight, cMsgColor, GetList ) CLA IF GetList != NIL .AND. HitTest( GetList, MRow(), MCol(), ::GetMsgArray() ) != 0 GetActive():ExitState := GE_MOUSEHIT ReadStats( SNLASTEXIT, GE_MOUSEHIT ) // Reset Get System values - IF ::oMenu:ClassName() $ "POPUPMENU|HB_POPUPMENU" + IF IS_IN( ::oMenu:ClassName(), "POPUPMENU|HB_POPUPMENU" ) ::PopMenu() ENDIF nReturn := -1 EXIT ENDIF - IF ::oMenu:ClassName() $ "POPUPMENU|HB_POPUPMENU" + IF IS_IN( ::oMenu:ClassName(), "POPUPMENU|HB_POPUPMENU" ) ::PopMenu() ENDIF @@ -411,15 +413,15 @@ METHOD Modal( nSelection, nMsgRow, nMsgLeft, nMsgRight, cMsgColor, GetList ) CLA CASE GetList != NIL .AND. ( nNewItem := Accelerator( GetList, nKey, ::GetMsgArray() ) ) != 0 GetActive():ExitState := GE_SHORTCUT - ReadStats( SNNEXTGET, nNewItem ) // Reset Get System values - IF ::oMenu:ClassName() $ "POPUPMENU|HB_POPUPMENU" + ReadStats( SNNEXTGET, nNewItem ) // reset get system values + IF IS_IN( ::oMenu:ClassName(), "POPUPMENU|HB_POPUPMENU" ) ::PopMenu() ENDIF nReturn := -1 EXIT - CASE ( nNewItem := oTopMenu:getAccel( nKey ) ) != 0 // ; check for the top menu item accelerator key + CASE ( nNewItem := oTopMenu:getAccel( nKey ) ) != 0 // check for the top menu item accelerator key IF oTopMenu:getItem( nNewItem ):enabled ::PopAll() @@ -545,7 +547,7 @@ METHOD Execute() CLASS HBMenuSys // Execute the Data block if selected MenuItem is ! IsPopUp: IF HB_ISOBJECT( oNewMenu ) .AND. ! oNewMenu:IsPopUp - IF ::oMenu:ClassName() $ "TOPBARMENU|POPUPMENU|HB_POPUPMENU" + IF IS_IN( ::oMenu:ClassName(), "TOPBARMENU|POPUPMENU|HB_POPUPMENU" ) SetPos( ::nOldRow, ::nOldCol ) SetCursor( ::nOldCursor ) Eval( oNewMenu:data, oNewMenu ) @@ -557,7 +559,7 @@ METHOD Execute() CLASS HBMenuSys ::oMenu:select( iif( ::PopMenu(), ::oMenu:current, 0 ) ) // Display newly selected current menu item: - IF ::oMenu:ClassName() $ "POPUPMENU|HB_POPUPMENU" .AND. ; + IF IS_IN( ::oMenu:ClassName(), "POPUPMENU|HB_POPUPMENU" ) .AND. ; ::nMenuLevel == 1 .AND. ; ! ::oMenu:isOpen diff --git a/src/rtl/tobject.prg b/src/rtl/tobject.prg index 93d4cbd9ed..a5fdbeea73 100644 --- a/src/rtl/tobject.prg +++ b/src/rtl/tobject.prg @@ -76,14 +76,14 @@ FUNCTION HBObject() oClass:SetOnError( @HBObject_DftonError() ) - oClass:AddInline( "MSGNOTFOUND" , {| Self, cMsg | ::Error( "Message not found", Self:className(), cMsg, iif( Left( cMsg, 1 ) == "_", 1005, 1004 ) ) }, HB_OO_CLSTP_EXPORTED ) + oClass:AddInline( "MSGNOTFOUND" , {| Self, cMsg | ::Error( "Message not found", ::className(), cMsg, iif( Left( cMsg, 1 ) == "_", 1005, 1004 ) ) }, HB_OO_CLSTP_EXPORTED ) #if 0 oClass:AddMultiData( , , HB_OO_CLSTP_EXPORTED, { "CLASS" }, .F. ) - oClass:AddInline( "ADDMETHOD" , {| Self, cMeth, pFunc, nScopeMeth | __clsAddMsg( __classH( Self ) , cMeth , pFunc ,HB_OO_MSG_METHOD , NIL, iif( nScopeMeth == NIL, 1, nScopeMeth ) ) }, HB_OO_CLSTP_EXPORTED ) - oClass:AddInline( "ADDVAR" , {| Self, cVAR, nScopeMeth, uiData, hClass | __clsAddMsg( hClass:=__classH( Self ) , cVar , uidata := __cls_IncData( hClass ), HB_OO_MSG_ACCESS, NIL, iif( nScopeMeth == NIL, 1, nScopeMeth ) ) , ; - __clsAddMsg( hClass , "_"+cVar , uiData , HB_OO_MSG_ASSIGN, NIL, iif( nScopeMeth == NIL, 1, nScopeMeth ) ) }, HB_OO_CLSTP_EXPORTED ) + oClass:AddInline( "ADDMETHOD" , {| Self, cMeth, pFunc, nScopeMeth | __clsAddMsg( __classH( Self ), cMeth, pFunc, HB_OO_MSG_METHOD , NIL, iif( nScopeMeth == NIL, 1, nScopeMeth ) ) }, HB_OO_CLSTP_EXPORTED ) + oClass:AddInline( "ADDVAR" , {| Self, cVAR, nScopeMeth, uiData, hClass | __clsAddMsg( hClass := __classH( Self ), cVar , uidata := __cls_IncData( hClass ), HB_OO_MSG_ACCESS, NIL, iif( nScopeMeth == NIL, 1, nScopeMeth ) ) , ; + __clsAddMsg( hClass , "_"+cVar , uiData , HB_OO_MSG_ASSIGN, NIL, iif( nScopeMeth == NIL, 1, nScopeMeth ) ) }, HB_OO_CLSTP_EXPORTED ) /* These ones exist within Class(y), so we will probably try to implement it */ diff --git a/src/rtl/tpersist.prg b/src/rtl/tpersist.prg index 447835f98b..1d2acccb5c 100644 --- a/src/rtl/tpersist.prg +++ b/src/rtl/tpersist.prg @@ -136,7 +136,7 @@ METHOD SaveToText( cObjectName, nIndent ) CLASS HBPersistent LOCAL oNew := &( ::ClassName() + "()" ):CreateNew() LOCAL aProperties - LOCAL n + LOCAL prop LOCAL uValue LOCAL uNewValue LOCAL cObject @@ -158,28 +158,28 @@ METHOD SaveToText( cObjectName, nIndent ) CLASS HBPersistent aProperties := __clsGetProperties( ::ClassH ) - FOR n := 1 TO Len( aProperties ) - uValue := __objSendMsg( Self, aProperties[ n ] ) - uNewValue := __objSendMsg( oNew, aProperties[ n ] ) - cType := ValType( uValue ) + FOR EACH prop IN aProperties + uValue := __objSendMsg( Self, prop ) + uNewValue := __objSendMsg( oNew, prop ) + cType := ValType( uValue ) IF !( cType == ValType( uNewValue ) ) .OR. !( uValue == uNewValue ) SWITCH cType CASE "A" nIndent += 3 - cObject += ArrayToText( uValue, aProperties[ n ], nIndent ) + cObject += ArrayToText( uValue, prop, nIndent ) nIndent -= 3 - IF n < Len( aProperties ) + IF ! prop:__enumIsLast() cObject += hb_eol() ENDIF EXIT CASE "O" IF __objDerivedFrom( uValue, "HBPERSISTENT" ) - cObject += uValue:SaveToText( aProperties[ n ], nIndent ) + cObject += uValue:SaveToText( prop, nIndent ) ENDIF - IF n < Len( aProperties ) + IF ! prop:__enumIsLast() cObject += hb_eol() ENDIF EXIT @@ -190,11 +190,11 @@ METHOD SaveToText( cObjectName, nIndent ) CLASS HBPersistent EXIT OTHERWISE - IF n == 1 + IF prop:__enumIsFirst() cObject += hb_eol() ENDIF cObject += Space( nIndent ) + " ::" + ; - aProperties[ n ] + " := " + hb_ValToExp( uValue ) + ; + prop + " := " + hb_ValToExp( uValue ) + ; hb_eol() ENDSWITCH @@ -208,12 +208,13 @@ METHOD SaveToText( cObjectName, nIndent ) CLASS HBPersistent STATIC FUNCTION ArrayToText( aArray, cName, nIndent ) + LOCAL nLen := Len( aArray ) LOCAL cArray := hb_eol() + Space( nIndent ) + "ARRAY ::" + cName + ; - " LEN " + hb_ntos( Len( aArray ) ) + hb_eol() + " LEN " + hb_ntos( nLen ) + hb_eol() LOCAL n LOCAL uValue - FOR n := 1 TO Len( aArray ) + FOR n := 1 TO nLen uValue := aArray[ n ] SWITCH ValType( uValue ) diff --git a/src/rtl/tpopup.prg b/src/rtl/tpopup.prg index c190d4d2b0..f9b55f3305 100644 --- a/src/rtl/tpopup.prg +++ b/src/rtl/tpopup.prg @@ -157,22 +157,20 @@ METHOD close( lCloseChild ) CLASS PopupMenu METHOD delItem( nPos ) CLASS PopupMenu LOCAL nLen - LOCAL aItems LOCAL nWidth + LOCAL item IF nPos >= 1 .AND. nPos <= ::nItemCount nLen := Len( ::aItems[ nPos ]:caption ) - ADel( ::aItems, nPos ) - ASize( ::aItems, --::nItemCount ) + hb_ADel( ::aItems, nPos, .T. ) + ::nItemCount-- IF ::nWidth == nLen + 2 - aItems := ::aItems - nLen := ::nItemCount nWidth := 0 - FOR nPos := 1 TO nLen - nWidth := Max( __CapMetrics( aItems[ nPos ] ), nWidth ) + FOR EACH item IN ::aItems + nWidth := Max( __CapMetrics( item ), nWidth ) NEXT ::nWidth := nWidth ENDIF @@ -184,10 +182,8 @@ METHOD display() CLASS PopupMenu LOCAL nTop LOCAL nLeft - LOCAL aItems LOCAL nCurrent - LOCAL nLen - LOCAL nPos + LOCAL item LOCAL nWidth LOCAL oPopup LOCAL nHotKeyPos @@ -200,9 +196,7 @@ METHOD display() CLASS PopupMenu nTop := ::nTop nLeft := ::nLeft - aItems := ::aItems nCurrent := ::nCurrent - nLen := ::nItemCount nWidth := ::nWidth DispBegin() @@ -216,43 +210,41 @@ METHOD display() CLASS PopupMenu ENDIF nLeft++ - FOR nPos := 1 TO nLen + FOR EACH item IN ::aItems nTop++ - // ; TOFIX: HB_MENU_SEPARATOR_UNI is dynamic value, so it's not good - // to use it for flag purposes. - IF aItems[ nPos ]:caption == HB_MENU_SEPARATOR_UNI + IF item:__issep hb_DispOutAtBox( nTop, nLeft - 1, SubStr( ::cBorder, 9, 1 ) + Replicate( SubStr( ::cBorder, 10, 1 ), nWidth ) + SubStr( ::cBorder, 11, 1 ), hb_ColorIndex( ::cColorSpec, 5 ) ) ELSE - cCaption := PadR( aItems[ nPos ]:caption, nWidth - 1 ) + cCaption := PadR( item:caption, nWidth - 1 ) - IF aItems[ nPos ]:checked - cCaption := SubStr( aItems[ nPos ]:style, 1, 1 ) + cCaption + IF item:checked + cCaption := SubStr( item:style, 1, 1 ) + cCaption ELSE cCaption := " " + cCaption ENDIF - IF aItems[ nPos ]:isPopup() + IF item:isPopup() - oPopup := aItems[ nPos ]:data + oPopup := item:data oPopup:top := nTop oPopup:left := ::nRight + 1 oPopup:bottom := NIL oPopup:right := NIL - cCaption += SubStr( aItems[ nPos ]:style, 2, 1 ) + cCaption += SubStr( item:style, 2, 1 ) ELSE cCaption += " " ENDIF - aItems[ nPos ]:__row := nTop - aItems[ nPos ]:__col := nLeft + item:__row := nTop + item:__col := nLeft IF ( nHotKeyPos := At( "&", cCaption ) ) == 0 - IF ( nCharPos := RAt( SubStr( aItems[ nPos ]:style, 2, 1 ), cCaption ) ) > 0 + IF ( nCharPos := RAt( SubStr( item:style, 2, 1 ), cCaption ) ) > 0 cCaption := Stuff( cCaption, nCharPos - 1, 1, "" ) ELSE cCaption := SubStr( cCaption, 1, Len( cCaption ) - 1 ) @@ -264,10 +256,10 @@ METHOD display() CLASS PopupMenu cCaption := Stuff( cCaption, nHotKeyPos, 1, "" ) ENDIF - hb_DispOutAt( nTop, nLeft, cCaption, hb_ColorIndex( ::cColorSpec, iif( nPos == nCurrent, 1, iif( aItems[ nPos ]:enabled, 0, 4 ) ) ) ) + hb_DispOutAt( nTop, nLeft, cCaption, hb_ColorIndex( ::cColorSpec, iif( item:__enumIndex() == nCurrent, 1, iif( item:enabled, 0, 4 ) ) ) ) - IF aItems[ nPos ]:enabled .AND. nHotKeyPos != 0 - hb_DispOutAt( nTop, nLeft + nHotKeyPos - 1, SubStr( cCaption, nHotKeyPos, 1 ), hb_ColorIndex( ::cColorSpec, iif( nPos == nCurrent, 3, 2 ) ) ) + IF item:enabled .AND. nHotKeyPos != 0 + hb_DispOutAt( nTop, nLeft + nHotKeyPos - 1, SubStr( cCaption, nHotKeyPos, 1 ), hb_ColorIndex( ::cColorSpec, iif( item:__enumIndex() == nCurrent, 3, 2 ) ) ) ENDIF ENDIF NEXT @@ -283,13 +275,14 @@ METHOD getAccel( xKey ) CLASS PopupMenu LOCAL cKey LOCAL item - IF HB_ISSTRING( xKey ) + DO CASE + CASE HB_ISSTRING( xKey ) cKey := xKey - ELSEIF HB_ISNUMERIC( xKey ) + CASE HB_ISNUMERIC( xKey ) cKey := hb_keyChar( xKey ) - ELSE + OTHERWISE RETURN 0 - ENDIF + ENDCASE IF Len( cKey ) > 0 cKey := "&" + cKey @@ -304,13 +297,11 @@ METHOD getAccel( xKey ) CLASS PopupMenu METHOD getFirst() CLASS PopupMenu - LOCAL nPos - LOCAL nLen := ::nItemCount - LOCAL aItems := ::aItems + LOCAL item - FOR nPos := 1 TO nLen - IF aItems[ nPos ]:enabled - RETURN nPos + FOR EACH item IN ::aItems + IF item:enabled + RETURN item:__enumIndex() ENDIF NEXT @@ -321,13 +312,11 @@ METHOD getItem( nPos ) CLASS PopupMenu METHOD getLast() CLASS PopupMenu - LOCAL nPos - LOCAL nLen := ::nItemCount - LOCAL aItems := ::aItems + LOCAL item - FOR nPos := nLen TO 1 STEP -1 - IF aItems[ nPos ]:enabled - RETURN nPos + FOR EACH item IN ::aItems DESCEND + IF item:enabled + RETURN item:__enumIndex() ENDIF NEXT @@ -337,13 +326,11 @@ METHOD getNext() CLASS PopupMenu LOCAL nPos - IF ::nCurrent < ::nItemCount - FOR nPos := ::nCurrent + 1 TO ::nItemCount - IF ::aItems[ nPos ]:enabled - RETURN nPos - ENDIF - NEXT - ENDIF + FOR nPos := ::nCurrent + 1 TO ::nItemCount + IF ::aItems[ nPos ]:enabled + RETURN nPos + ENDIF + NEXT RETURN 0 @@ -351,13 +338,11 @@ METHOD getPrev() CLASS PopupMenu LOCAL nPos - IF ::nCurrent > 1 - FOR nPos := ::nCurrent - 1 TO 1 STEP -1 - IF ::aItems[ nPos ]:enabled - RETURN nPos - ENDIF - NEXT - ENDIF + FOR nPos := ::nCurrent - 1 TO 1 STEP -1 + IF ::aItems[ nPos ]:enabled + RETURN nPos + ENDIF + NEXT RETURN 0 @@ -366,13 +351,11 @@ METHOD getPrev() CLASS PopupMenu METHOD getShortCt( nKey ) CLASS PopupMenu - LOCAL nPos - LOCAL nLen := ::nItemCount - LOCAL aItems := ::aItems + LOCAL item - FOR nPos := 1 TO nLen - IF aItems[ nPos ]:shortcut == nKey - RETURN nPos + FOR EACH item IN ::aItems + IF item:shortcut == nKey + RETURN item:__enumIndex() ENDIF NEXT @@ -423,9 +406,7 @@ METHOD hitTest( nMRow, nMCol ) CLASS PopupMenu nPos := nMRow - ::nTop DO CASE - // ; TOFIX: HB_MENU_SEPARATOR_UNI is dynamic value, so it's not good - // to use it for flag purposes. - CASE ::aItems[ nPos ]:caption == HB_MENU_SEPARATOR_UNI + CASE ::aItems[ nPos ]:__issep RETURN HTSEPARATOR OTHERWISE RETURN nPos @@ -439,12 +420,10 @@ METHOD insItem( nPos, oItem ) CLASS PopupMenu IF nPos >= 1 .AND. nPos <= ::nItemCount .AND. ; HB_ISOBJECT( oItem ) .AND. oItem:ClassName() == "MENUITEM" - ASize( ::aItems, ++::nItemCount ) - AIns( ::aItems, nPos ) - ::aItems[ nPos ] := oItem + hb_AIns( ::aItems, nPos, oItem, .T. ) + ::nItemCount++ ::nWidth := Max( __CapMetrics( oItem ), ::nWidth ) - ENDIF RETURN Self diff --git a/src/rtl/tpopuphb.prg b/src/rtl/tpopuphb.prg index 0b79624f1f..185d78da8d 100644 --- a/src/rtl/tpopuphb.prg +++ b/src/rtl/tpopuphb.prg @@ -132,9 +132,10 @@ METHOD isShortCut( nKey, nID ) CLASS hb_PopupMenu DO CASE // Test and assign top menu item shortCut, enabled, and ! PopUp: // Changed by enclosing assignment before ':Enabled': - CASE ( ( nShortCut := ::getShortCt( nKey ) ) > 0 ) .AND. ; - ( ( oItem := ::getItem( nShortcut ) ):enabled ) .AND. ; - ( !( oItem:isPopUp() ) ) + CASE ( nShortCut := ::getShortCt( nKey ) ) > 0 .AND. ; + ( oItem := ::getItem( nShortcut ) ):enabled .AND. ; + ! oItem:isPopUp() + ::select( nShortCut ) Eval( oItem:data, oItem ) nID := oItem:id diff --git a/src/rtl/treport.prg b/src/rtl/treport.prg index 8e732afdb6..f669ad510f 100644 --- a/src/rtl/treport.prg +++ b/src/rtl/treport.prg @@ -334,8 +334,7 @@ METHOD New( cFrmName AS STRING, ; // Print the first line ::PrintIt( Space( ::aReportData[ RPT_LMARGIN ] ) + ; - iif( nGroup == 1, __natMsg( _RFRM_SUBTOTAL ), ; - __natMsg( _RFRM_SUBSUBTOTAL ) ) ) + __natMsg( iif( nGroup == 1, _RFRM_SUBTOTAL, _RFRM_SUBSUBTOTAL ) ) ) // Print the second line QQOut( Space( ::aReportData[ RPT_LMARGIN ] ) ) @@ -471,7 +470,6 @@ METHOD ReportHeader() CLASS HBReportForm IF ! ::aReportData[ RPT_PLAIN ] IF ::aReportData[ RPT_HEADING ] == "" AAdd( aPageHeader, __natMsg( _RFRM_PAGENO ) + Str( ::nPageNumber, 6 ) ) - ELSE aTempPgHeader := ParseHeader( ::aReportData[ RPT_HEADING ], ; Occurs( ";", ::aReportData[ RPT_HEADING ] ) + 1 ) @@ -487,14 +485,16 @@ METHOD ReportHeader() CLASS HBReportForm NEXT NEXT + aPageHeader[ 1 ] := Stuff( aPageHeader[ 1 ], 1, 14, ; __natMsg( _RFRM_PAGENO ) + Str( ::nPageNumber, 6 ) ) - ENDIF - AAdd( aPageHeader, DToC( Date() ) ) + AAdd( aPageHeader, DToC( Date() ) ) ENDIF + FOR nLine := 1 TO Len( ::aReportData[ RPT_HEADER ] ) + nLinesInHeader := Max( XMLCOUNT( LTrim( ::aReportData[ RPT_HEADER, ; nLine ] ) ), 1 ) @@ -504,9 +504,7 @@ METHOD ReportHeader() CLASS HBReportForm nHeadLine ) ) AAdd( aPageHeader, Space( ( nRPageSize - ::aReportData[ RPT_LMARGIN ] - ; Len( cHeader ) ) / 2 ) + cHeader ) - NEXT - NEXT AAdd( aPageHeader, "" ) // S87 compat. @@ -620,8 +618,7 @@ METHOD ExecuteReport() CLASS HBReportForm IF lGroupChanged .OR. MakeAStr( Eval( ::aReportData[ RPT_GROUPS, nGroup, RGT_EXP ] ), ; ::aReportData[ RPT_GROUPS, nGroup, RGT_TYPE ] ) != ::aGroupTotals[ nGroup ] - AAdd( aRecordHeader, iif( nGroup == 1, __natMsg( _RFRM_SUBTOTAL ), ; - __natMsg( _RFRM_SUBSUBTOTAL ) ) ) + AAdd( aRecordHeader, __natMsg( iif( nGroup == 1, _RFRM_SUBTOTAL, _RFRM_SUBSUBTOTAL ) ) ) AAdd( aRecordHeader, "" ) @@ -647,10 +644,8 @@ METHOD ExecuteReport() CLASS HBReportForm Len( aRecordHeader[ Len( aRecordHeader ) ] ) - 1 ) ENDIF NEXT - ENDIF - IF Len( aRecordHeader ) > 0 .AND. lEjectGrp .AND. lGroupChanged IF Len( aRecordHeader ) > ::nLinesLeft ::EjectPage() @@ -672,12 +667,9 @@ METHOD ExecuteReport() CLASS HBReportForm IF ::aReportData[ RPT_PLAIN ] ::nLinesLeft := 1000 - ELSE ::ReportHeader() - ENDIF - ENDIF // Add to aRecordHeader in the event that the group has changed and @@ -839,20 +831,14 @@ METHOD ExecuteReport() CLASS HBReportForm ELSE ::ReportHeader() ENDIF - AEval( aRecordToPrint, ; - {| RecordLine | ; - ::PrintIt( Space( ::aReportData[ RPT_LMARGIN ] ) + RecordLine ) ; - } ; - ) + AEval( aRecordToPrint, {| RecordLine | ; + ::PrintIt( Space( ::aReportData[ RPT_LMARGIN ] ) + RecordLine ) } ) ::nLinesLeft -= Len( aRecordToPrint ) ENDIF ELSE // Send aRecordToPrint to the output device, resetting ::nLinesLeft - AEval( aRecordToPrint, ; - {| RecordLine | ; - ::PrintIt( Space( ::aReportData[ RPT_LMARGIN ] ) + RecordLine ) ; - } ; - ) + AEval( aRecordToPrint, {| RecordLine | ; + ::PrintIt( Space( ::aReportData[ RPT_LMARGIN ] ) + RecordLine ) } ) ::nLinesLeft -= Len( aRecordToPrint ) ENDIF @@ -937,9 +923,7 @@ METHOD LoadReportFile( cFrmFile AS STRING ) CLASS HBReportForm IF Empty( nFileError := FError() ) EXIT ENDIF - NEXT - ENDIF // File error diff --git a/src/rtl/tscalar.prg b/src/rtl/tscalar.prg index 349c1a3fed..15a2fd58c5 100644 --- a/src/rtl/tscalar.prg +++ b/src/rtl/tscalar.prg @@ -82,7 +82,7 @@ METHOD AsString() CLASS ScalarObject CASE "H" ; RETURN "{ ... => ... }" CASE "L" ; RETURN iif( Self, ".T.", ".F." ) CASE "N" ; RETURN hb_ntos( Self ) - CASE "S" ; RETURN "@" + Self:name + "()" + CASE "S" ; RETURN "@" + ::name + "()" CASE "P" ; RETURN "<0x...>" CASE "U" ; RETURN "NIL" ENDSWITCH @@ -162,15 +162,12 @@ METHOD Add( x ) CLASS Array METHOD Collect( b ) CLASS Array - LOCAL i - LOCAL currElem + LOCAL elem LOCAL result := {} - LOCAL nElems := Len( Self ) - FOR i := 1 TO nElems - currElem := Self[ i ] - IF Eval( b, currElem ) - AAdd( result, currElem ) + FOR EACH elem IN Self + IF Eval( b, elem ) + AAdd( result, elem ) ENDIF NEXT @@ -392,7 +389,7 @@ CREATE CLASS Symbol INHERIT HBScalar FUNCTION __HBSymbol ENDCLASS METHOD AsString() CLASS Symbol - RETURN "@" + Self:name + "()" + RETURN "@" + ::name + "()" /* -------------------------------------------- */ diff --git a/src/rtl/ttopbar.prg b/src/rtl/ttopbar.prg index 16ac768246..bb0f130103 100644 --- a/src/rtl/ttopbar.prg +++ b/src/rtl/ttopbar.prg @@ -116,22 +116,20 @@ METHOD addItem( oItem ) CLASS TopBarMenu METHOD delItem( nPos ) CLASS TopBarMenu LOCAL nLen - LOCAL aItems LOCAL nWidth + LOCAL item IF nPos >= 1 .AND. nPos <= ::nItemCount nLen := Len( ::aItems[ nPos ]:caption ) - ADel( ::aItems, nPos ) - ASize( ::aItems, --::nItemCount ) + hb_ADel( ::aItems, nPos, .T. ) + ::nItemCount-- IF ::nWidth == nLen + 2 - aItems := ::aItems - nLen := ::nItemCount nWidth := 0 - FOR nPos := 1 TO nLen - nWidth := Max( __CapMetrics( aItems[ nPos ] ), nWidth ) + FOR EACH item IN ::aItems + nWidth := Max( __CapMetrics( item ), nWidth ) NEXT ::nWidth := nWidth ENDIF @@ -144,15 +142,13 @@ METHOD display() CLASS TopBarMenu LOCAL nRow := ::nRow LOCAL nLeft := ::nLeft LOCAL nRight := ::nRight - LOCAL aItems := ::aItems - LOCAL nItemCount := ::nItemCount LOCAL nCurrent := ::nCurrent + LOCAL item LOCAL cColor1 := hb_ColorIndex( ::cColorSpec, 0 ) LOCAL cColor2 := hb_ColorIndex( ::cColorSpec, 1 ) LOCAL oPopUp - LOCAL nItem LOCAL cCaption LOCAL nCaptionLen LOCAL nPos @@ -161,9 +157,9 @@ METHOD display() CLASS TopBarMenu hb_DispOutAt( nRow, nLeft, Space( nRight - nLeft + 1 ), cColor1 ) - FOR nItem := 1 TO nItemCount + FOR EACH item IN ::aItems - cCaption := " " + RTrim( aItems[ nItem ]:caption ) + " " + cCaption := " " + RTrim( item:caption ) + " " nCaptionLen := Len( cCaption ) IF nCaptionLen == 0 @@ -174,11 +170,11 @@ METHOD display() CLASS TopBarMenu nLeft := nRight - nCaptionLen ENDIF - aItems[ nItem ]:__row := nRow - aItems[ nItem ]:__col := nLeft + item:__row := nRow + item:__col := nLeft - IF aItems[ nItem ]:isPopUp() - oPopUp := aItems[ nItem ]:data + IF item:isPopUp() + oPopUp := item:data oPopUp:top := nRow + 1 oPopUp:left := nLeft oPopUp:bottom := NIL @@ -194,13 +190,13 @@ METHOD display() CLASS TopBarMenu ENDIF ENDIF - hb_DispOutAt( nRow, nLeft, cCaption,; - iif( nItem == nCurrent, cColor2,; - iif( aItems[ nItem ]:enabled, cColor1, hb_ColorIndex( ::cColorSpec, 4 ) ) ) ) + hb_DispOutAt( nRow, nLeft, cCaption, ; + iif( item:__enumIndex() == nCurrent, cColor2, ; + iif( item:enabled, cColor1, hb_ColorIndex( ::cColorSpec, 4 ) ) ) ) - IF aItems[ nItem ]:enabled .AND. nPos > 0 - hb_DispOutAt( nRow, nLeft + nPos - 1, SubStr( cCaption, nPos, 1 ),; - iif( nItem == nCurrent, hb_ColorIndex( ::cColorSpec, 3 ), hb_ColorIndex( ::cColorSpec, 2 ) ) ) + IF item:enabled .AND. nPos > 0 + hb_DispOutAt( nRow, nLeft + nPos - 1, SubStr( cCaption, nPos, 1 ), ; + iif( item:__enumIndex() == nCurrent, hb_ColorIndex( ::cColorSpec, 3 ), hb_ColorIndex( ::cColorSpec, 2 ) ) ) ENDIF nLeft += nCaptionLen @@ -219,11 +215,11 @@ METHOD display() CLASS TopBarMenu METHOD getFirst() CLASS TopBarMenu - LOCAL n + LOCAL item - FOR n := 1 TO ::nItemCount - IF ::aItems[ n ]:enabled - RETURN n + FOR EACH item IN ::aItems + IF item:enabled + RETURN item:__enumIndex() ENDIF NEXT @@ -234,11 +230,11 @@ METHOD getItem( nPos ) CLASS TopBarMenu METHOD getLast() CLASS TopBarMenu - LOCAL n + LOCAL item - FOR n := ::nItemCount TO 1 STEP -1 - IF ::aItems[ n ]:enabled - RETURN n + FOR EACH item IN ::aItems DESCEND + IF item:enabled + RETURN item:__enumIndex() ENDIF NEXT @@ -248,13 +244,11 @@ METHOD getNext() CLASS TopBarMenu LOCAL n - IF ::nCurrent < ::nItemCount - FOR n := ::nCurrent + 1 TO ::nItemCount - IF ::aItems[ n ]:enabled - RETURN n - ENDIF - NEXT - ENDIF + FOR n := ::nCurrent + 1 TO ::nItemCount + IF ::aItems[ n ]:enabled + RETURN n + ENDIF + NEXT RETURN 0 @@ -262,13 +256,11 @@ METHOD getPrev() CLASS TopBarMenu LOCAL n - IF ::nCurrent > 1 - FOR n := ::nCurrent - 1 TO 1 STEP -1 - IF ::aItems[ n ]:enabled - RETURN n - ENDIF - NEXT - ENDIF + FOR n := ::nCurrent - 1 TO 1 STEP -1 + IF ::aItems[ n ]:enabled + RETURN n + ENDIF + NEXT RETURN 0 @@ -303,11 +295,11 @@ METHOD getAccel( nKey ) CLASS TopBarMenu METHOD getShortCt( nKey ) CLASS TopBarMenu - LOCAL n + LOCAL item - FOR n := 1 TO ::nItemCount - IF ::aItems[ n ]:shortcut == nKey - RETURN n + FOR EACH item IN ::aItems + IF item:shortcut == nKey + RETURN item:__enumIndex() ENDIF NEXT @@ -322,20 +314,17 @@ METHOD getShortCt( nKey ) CLASS TopBarMenu METHOD hitTest( nMRow, nMCol ) CLASS TopBarMenu - LOCAL aItems LOCAL nColumn - LOCAL n + LOCAL item IF nMRow == ::nRow - aItems := ::aItems + FOR EACH item IN ::aItems - FOR n := 1 TO ::nItemCount + nColumn := item:__col - nColumn := aItems[ n ]:__col - - IF nMCol >= nColumn .AND. nMCol <= nColumn + Len( aItems[ n ]:caption ) - RETURN n + IF nMCol >= nColumn .AND. nMCol <= nColumn + Len( item:caption ) + RETURN item:__enumIndex() ENDIF NEXT ENDIF @@ -347,9 +336,8 @@ METHOD insItem( nPos, oItem ) CLASS TopBarMenu IF nPos >= 1 .AND. nPos <= ::nItemCount .AND. ; HB_ISOBJECT( oItem ) .AND. oItem:ClassName() == "MENUITEM" - ASize( ::aItems, ++::nItemCount ) - AIns( ::aItems, nPos ) - ::aItems[ nPos ] := oItem + hb_AIns( ::aItems, nPos, oItem, .T. ) + ::nItemCount++ ::nWidth := Max( __CapMetrics( oItem ), ::nWidth ) ENDIF @@ -391,7 +379,7 @@ METHOD setItem( nPos, oItem ) CLASS TopBarMenu METHOD colorSpec( cColorSpec ) CLASS TopBarMenu IF cColorSpec != NIL - ::cColorSpec := __eInstVar53( Self, "COLORSPEC", cColorSpec, "C", 1001,; + ::cColorSpec := __eInstVar53( Self, "COLORSPEC", cColorSpec, "C", 1001, ; {|| ! Empty( hb_ColorIndex( cColorSpec, 5 ) ) .AND. Empty( hb_ColorIndex( cColorSpec, 6 ) ) } ) ENDIF diff --git a/src/rtl/valtoexp.prg b/src/rtl/valtoexp.prg index ff2600eb00..8ff7fba4d2 100644 --- a/src/rtl/valtoexp.prg +++ b/src/rtl/valtoexp.prg @@ -117,7 +117,7 @@ STATIC FUNCTION s_valToExp( xVal, lRaw, cInd, hRefs, cRefs, cObjs ) cVal := "{" FOR EACH tmp IN xVal cKey := s_valToExp( tmp:__enumKey(), lRaw ) - cVal += iif( tmp:__enumIndex() == 1, "", ", " ) + ; + cVal += iif( tmp:__enumIsFirst(), "", ", " ) + ; cKey + "=>" + ; s_valToExp( tmp, lRaw, cInd + cKey, hRefs, @cRefs, @cObjs ) NEXT @@ -127,7 +127,7 @@ STATIC FUNCTION s_valToExp( xVal, lRaw, cInd, hRefs, cRefs, cObjs ) cVal := "{" IF ! lRaw .AND. v == "O" FOR EACH tmp IN __objGetIVars( xVal ) - cVal += iif( tmp:__enumIndex() == 1, '{"', ', {"' ) + ; + cVal += iif( tmp:__enumIsFirst(), '{"', ', {"' ) + ; tmp[ 1 ] + '", ' + ; s_valToExp( tmp[ 2 ], lRaw, ; cInd + hb_ntos( tmp:__enumIndex() ) + ",2", ; @@ -135,7 +135,7 @@ STATIC FUNCTION s_valToExp( xVal, lRaw, cInd, hRefs, cRefs, cObjs ) NEXT ELSE FOR EACH tmp IN xVal - cVal += iif( tmp:__enumIndex() == 1, "", ", " ) + ; + cVal += iif( tmp:__enumIsFirst(), "", ", " ) + ; s_valToExp( tmp, lRaw, cInd + hb_ntos( tmp:__enumIndex() ), hRefs, @cRefs, @cObjs ) NEXT ENDIF diff --git a/src/rtl/valtype.c b/src/rtl/valtype.c index 822ba8d558..10b330b1f3 100644 --- a/src/rtl/valtype.c +++ b/src/rtl/valtype.c @@ -55,11 +55,15 @@ HB_FUNC( VALTYPE ) hb_retc( hb_itemTypeStr( hb_param( 1, HB_IT_ANY ) ) ); } +#if defined( HB_LEGACY_LEVEL5 ) + HB_FUNC( HB_ISNIL ) { hb_retl( HB_ISNIL( 1 ) ); } +#endif + HB_FUNC( HB_ISNUMERIC ) { hb_retl( HB_ISNUM( 1 ) ); diff --git a/src/vm/dlmalloc.c b/src/vm/dlmalloc.c index 7cf10e3746..176261f89d 100644 --- a/src/vm/dlmalloc.c +++ b/src/vm/dlmalloc.c @@ -1557,7 +1557,7 @@ LONG __cdecl _InterlockedExchange(LONG volatile *Target, LONG Value); #endif /* Declarations for bit scanning on win32 */ -#if defined(_MSC_VER) && _MSC_VER>=1300 +#if defined(_MSC_VER) && _MSC_VER>=1300 && !defined(__clang__) #ifndef BitScanForward /* Try to avoid pulling in WinNT.h */ #ifdef __cplusplus extern "C" { @@ -1573,7 +1573,7 @@ unsigned char _BitScanReverse(unsigned long *index, unsigned long mask); #pragma intrinsic(_BitScanForward) #pragma intrinsic(_BitScanReverse) #endif /* BitScanForward */ -#endif /* defined(_MSC_VER) && _MSC_VER>=1300 */ +#endif /* defined(_MSC_VER) && _MSC_VER>=1300 && !defined(__clang__) */ #ifndef WIN32 #ifndef malloc_getpagesize @@ -2947,7 +2947,7 @@ static size_t traverse_and_check(mstate m); }\ } -#elif defined(_MSC_VER) && _MSC_VER>=1300 +#elif defined(_MSC_VER) && _MSC_VER>=1300 && !defined(__clang__) #define compute_tree_index(S, I)\ {\ size_t X = S >> TREEBIN_SHIFT;\ @@ -3039,7 +3039,7 @@ static size_t traverse_and_check(mstate m); I = (bindex_t)J;\ } -#elif defined(_MSC_VER) && _MSC_VER>=1300 +#elif defined(_MSC_VER) && _MSC_VER>=1300 && !defined(__clang__) #define compute_bit2idx(X, I)\ {\ unsigned int J;\ diff --git a/src/vm/fm.c b/src/vm/fm.c index cc5b674128..b41f34f45c 100644 --- a/src/vm/fm.c +++ b/src/vm/fm.c @@ -1155,7 +1155,7 @@ void hb_xexit( void ) /* Deinitialize fixed memory subsystem */ hb_dateTimeStr( szTime ); fprintf( hLog, HB_I_( "Application Memory Allocation Report - %s\n" ), hb_cmdargARGVN( 0 ) ); - fprintf( hLog, HB_I_( "Terminated at: %04d.%02d.%02d %s\n" ), iYear, iMonth, iDay, szTime ); + fprintf( hLog, HB_I_( "Terminated at: %04d-%02d-%02d %s\n" ), iYear, iMonth, iDay, szTime ); if( s_szInfo[ 0 ] ) fprintf( hLog, HB_I_( "Info: %s\n" ), s_szInfo ); fprintf( hLog, "%s\n", buffer ); diff --git a/src/vm/hashfunc.c b/src/vm/hashfunc.c index ae6e6688bf..eb4f5fdad1 100644 --- a/src/vm/hashfunc.c +++ b/src/vm/hashfunc.c @@ -147,6 +147,21 @@ HB_FUNC( HB_HGETDEF ) hb_errRT_BASE( EG_ARG, 1123, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } +HB_FUNC( HB_HGETREF ) +{ + PHB_ITEM pHash = hb_param( 1, HB_IT_HASH ); + PHB_ITEM pKey = hb_param( 2, HB_IT_HASHKEY ); + + if( pHash && pKey ) + { + PHB_ITEM pDest = hb_hashGetItemPtr( pHash, pKey, HB_HASH_AUTOADD_ACCESS ); + hb_itemParamStore( 3, pDest ); + hb_retl( pDest != NULL ); + } + else + hb_retl( HB_FALSE ); +} + HB_FUNC( HB_HSET ) { PHB_ITEM pHash = hb_param( 1, HB_IT_HASH );