diff --git a/harbour/ChangeLog b/harbour/ChangeLog index eddf71b1c6..9388f630f5 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,25 @@ 2002-12-01 13:30 UTC+0100 Foo Bar */ +2007-09-11 00:40 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) + * include/hbcompat.ch + * include/hbextern.ch + * source/rtl/hbini.prg + + .ini functions added to hbextern.ch. + * .ini functions renamed so that all of them reside + in the hb_ini*() namespace. xhb compatibility translates + added. + + * source/debug/debugger.prg + * Formatting. + + * source/rtl/memoedit.prg + % Minor optimization. + + * source/rtl/teditor.prg + ! Fixed to not ask for confirmation when pressing + on an unedited buffer. + 2007-09-10 22:51 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * contrib/libct/ctnet.c * contrib/libct/dattime2.c diff --git a/harbour/include/hbcompat.ch b/harbour/include/hbcompat.ch index 229f6ee7dc..f1534010b0 100644 --- a/harbour/include/hbcompat.ch +++ b/harbour/include/hbcompat.ch @@ -76,14 +76,18 @@ #xtranslate hb_setLastKey([])=> setLastKey() #xtranslate hb_CStr([]) => CStr() - #xtranslate HB_HEXTONUM([]) => HEXTONUM() - #xtranslate HB_NUMTOHEX([]) => NUMTOHEX() - #xtranslate HB_HEXTOSTR([]) => HEXTOSTR() - #xtranslate HB_STRTOHEX([]) => STRTOHEX() + #xtranslate hb_HexToNum([]) => HexToNum() + #xtranslate hb_NumToHex([]) => NumToHex() + #xtranslate hb_HexToStr([]) => HexToStr() + #xtranslate hb_StrToHex([]) => StrToHex() - #xtranslate HB_RASCAN([]) => RASCAN() + #xtranslate hb_RAScan([]) => RAScan() - #xtranslate HB_ISPOINTER( )=> ISPOINTER( ) + #xtranslate hb_ISPOINTER( )=> ISPOINTER( ) + + #xtranslate hb_IniSetComment([]) => hb_SetIniComment() + #xtranslate hb_IniRead([]) => hb_ReadIni() + #xtranslate hb_IniWrite([]) => hb_WriteIni() #xtranslate HBDebugger() => TDebugger() #xtranslate HBBrwText() => TBrwText() @@ -103,9 +107,9 @@ #xtranslate gtSetClipboard() => hb_gtInfo( GTI_CLIPBOARDDATA, ) #xtranslate gtGetClipboard() => hb_gtInfo( GTI_CLIPBOARDDATA ) - #xtranslate gtGetClipBoardSize() => len( hb_gtInfo( GTI_CLIPBOARDDATA ) ) + #xtranslate gtGetClipBoardSize() => Len( hb_gtInfo( GTI_CLIPBOARDDATA ) ) #xtranslate gtPasteClipBoard([]) => hb_gtInfo( GTI_CLIPBOARDPAST ) - #xtranslate gtProcessMessages() => nextkey() + #xtranslate gtProcessMessages() => NextKey() #xtranslate gfxPrimitive([]) => hb_gfxPrimitive() #xtranslate gfxText([]) => hb_gfxText() @@ -118,43 +122,57 @@ #xtranslate setLastKey([]) => hb_setLastKey() #xtranslate CStr([]) => hb_CStr() - #xtranslate HEXTONUM([]) => HB_HEXTONUM() - #xtranslate NUMTOHEX([]) => HB_NUMTOHEX() - #xtranslate HEXTOSTR([]) => HB_HEXTOSTR() - #xtranslate STRTOHEX([]) => HB_STRTOHEX() + #xtranslate HexToNum([]) => hb_HexToNum() + #xtranslate NumToHex([]) => hb_NumToHex() + #xtranslate HexToStr([]) => hb_HexToStr() + #xtranslate StrToHex([]) => hb_StrToHex() - #xtranslate RASCAN([]) => HB_RASCAN() + #xtranslate RAScan([]) => hb_RAScan() - #xtranslate ISPOINTER( ) => HB_ISPOINTER( ) + #xtranslate ISPOINTER( ) => hb_ISPOINTER( ) - #xtranslate str(,[],[],)=> iif(, ltrim(str()), str()) - #xtranslate HB_CMDARGARGV([])=> HB_ARGV(0) + #xtranslate hb_SetIniComment([]) => hb_IniSetComment() + #xtranslate hb_ReadIni([]) => hb_IniRead() + #xtranslate hb_WriteIni([]) => hb_IniWrite() - #xtranslate HASH([]) => HB_HASH() - #xtranslate HHASKEY([]) => HB_HHASKEY() - #xtranslate HGETPOS([]) => HB_HPOS() - #xtranslate HGET([]) => HB_HGET() - #xtranslate HSET([]) => HB_HSET() - #xtranslate HDEL([]) => HB_HDEL() - #xtranslate HGETKEYAT([]) => HB_HKEYAT() - #xtranslate HGETVALUEAT([]) => HB_HVALUEAT() - #xtranslate HSETVALUEAT([]) => HB_HVALUEAT() - #xtranslate HGETPAIRAT([]) => HB_HPAIRAT() - #xtranslate HDELAT([]) => HB_HDELAT() - #xtranslate HGETKEYS([]) => HB_HKEYS() - #xtranslate HGETVALUES([]) => HB_HVALUES() - #xtranslate HFILL([]) => HB_HFILL() - #xtranslate HCLONE([]) => HB_HCLONE() - #xtranslate HCOPY([]) => HB_HCOPY() - #xtranslate HMERGE([]) => HB_HMERGE() - #xtranslate HEVAL([]) => HB_HEVAL() - #xtranslate HSCAN([]) => HB_HSCAN() - #xtranslate HSETCASEMATCH([])=> HB_HSETCASEMATCH() - #xtranslate HGETCASEMATCH([])=> HB_HCASEMATCH() - #xtranslate HSETAUTOADD([]) => HB_HSETAUTOADD() - #xtranslate HGETAUTOADD([]) => HB_HAUTOADD() - #xtranslate HALLOCATE([]) => HB_HALLOCATE() - #xtranslate HDEFAULT([]) => HB_HDEFAULT() + #xtranslate TDebugger() => HBDebugger() + #xtranslate TBrwText() => HBBrwText() + #xtranslate TDbMenu() => HBDbMenu() + #xtranslate TDbMenuItem() => HBDbMenuItem() + #xtranslate TDbWindow() => HBDbWindow() + #xtranslate TDBGBrowser() => HBDbBrowse() + #xtranslate TDBGArray() => HBDbArray() + #xtranslate TDBGHash() => HBDbHash() + #xtranslate TDBGobject() => HBDbObject() + + #xtranslate Str(,[],[],)=> iif(, LTrim(Str()), Str()) + #xtranslate hb_CMDARGARGV([])=> hb_ARGV(0) + + #xtranslate HASH([]) => hb_HASH() + #xtranslate HHASKEY([]) => hb_HHASKEY() + #xtranslate HGETPOS([]) => hb_HPOS() + #xtranslate HGET([]) => hb_HGET() + #xtranslate HSET([]) => hb_HSET() + #xtranslate HDEL([]) => hb_HDEL() + #xtranslate HGETKEYAT([]) => hb_HKEYAT() + #xtranslate HGETVALUEAT([]) => hb_HVALUEAT() + #xtranslate HSETVALUEAT([]) => hb_HVALUEAT() + #xtranslate HGETPAIRAT([]) => hb_HPAIRAT() + #xtranslate HDELAT([]) => hb_HDELAT() + #xtranslate HGETKEYS([]) => hb_HKEYS() + #xtranslate HGETVALUES([]) => hb_HVALUES() + #xtranslate HFILL([]) => hb_HFILL() + #xtranslate HCLONE([]) => hb_HCLONE() + #xtranslate HCOPY([]) => hb_HCOPY() + #xtranslate HMERGE([]) => hb_HMERGE() + #xtranslate HEVAL([]) => hb_HEVAL() + #xtranslate HSCAN([]) => hb_HSCAN() + #xtranslate HSETCASEMATCH([])=> hb_HSETCASEMATCH() + #xtranslate HGETCASEMATCH([])=> hb_HCASEMATCH() + #xtranslate HSETAUTOADD([]) => hb_HSETAUTOADD() + #xtranslate HGETAUTOADD([]) => hb_HAUTOADD() + #xtranslate HALLOCATE([]) => hb_HALLOCATE() + #xtranslate HDEFAULT([]) => hb_HDEFAULT() /* THROW => generate error */ #xtranslate THROW() => (Eval(ErrorBlock(), ), Break()) @@ -184,16 +202,6 @@ #translate ( & ) => ( HB_BITAND( (), () ) ) #translate ( ^^ ) => ( HB_BITXOR( (), () ) ) - #xtranslate TDebugger() => HBDebugger() - #xtranslate TBrwText() => HBBrwText() - #xtranslate TDbMenu() => HBDbMenu() - #xtranslate TDbMenuItem() => HBDbMenuItem() - #xtranslate TDbWindow() => HBDbWindow() - #xtranslate TDBGBrowser() => HBDbBrowse() - #xtranslate TDBGArray() => HBDbArray() - #xtranslate TDBGHash() => HBDbHash() - #xtranslate TDBGobject() => HBDbObject() - #endif #endif /* __HARBOUR__ */ diff --git a/harbour/include/hbextern.ch b/harbour/include/hbextern.ch index e9bbd11a4f..11a9092d2f 100644 --- a/harbour/include/hbextern.ch +++ b/harbour/include/hbextern.ch @@ -410,6 +410,10 @@ EXTERNAL HB_NUMTOHEX EXTERNAL HB_HEXTOSTR EXTERNAL HB_STRTOHEX +EXTERNAL HB_INISETCOMMENT +EXTERNAL HB_INIREAD +EXTERNAL HB_INIWRITE + EXTERNAL HBCLASS EXTERNAL HBOBJECT diff --git a/harbour/source/debug/debugger.prg b/harbour/source/debug/debugger.prg index df432b808b..f540655fbd 100644 --- a/harbour/source/debug/debugger.prg +++ b/harbour/source/debug/debugger.prg @@ -75,18 +75,10 @@ #include "setcurs.ch" /* A macro to compare filenames on different platforms. */ -#ifdef __PLATFORM__DOS -#define FILENAME_EQUAL(s1, s2) ( Lower( s1 ) == Lower( s2 ) ) +#if defined(__PLATFORM__DOS) || defined(__PLATFORM__OS2) || defined(__PLATFORM__Windows) + #define FILENAME_EQUAL( s1, s2 ) ( Lower( s1 ) == Lower( s2 ) ) #else -#ifdef __PLATFORM__OS2 -#define FILENAME_EQUAL(s1, s2) ( Lower( s1 ) == Lower( s2 ) ) -#else -#ifdef __PLATFORM__Windows -#define FILENAME_EQUAL(s1, s2) ( Lower( s1 ) == Lower( s2 ) ) -#else -#define FILENAME_EQUAL(s1, s2) ( s1 == s2 ) -#endif -#endif + #define FILENAME_EQUAL( s1, s2 ) ( s1 == s2 ) #endif @@ -115,8 +107,7 @@ #define MODULE_GLOBALS 3 #define MODULE_EXTERNGLOBALS 4 - -* The dimension of the debugger window +/* The dimensions of the debugger window */ #define DEBUGGER_MINROW 0 #define DEBUGGER_MINCOL 0 #define DEBUGGER_MAXROW 22 @@ -735,10 +726,10 @@ METHOD Colors() CLASS HBDebugger oBrwColors:AddColumn( oCol := TBColumnNew( "", { || PadR( aColors[ oBrwColors:Cargo[ 1 ] ], 14 ) } ) ) oCol:DefColor := { 1, 2 } - AAdd(oBrwColors:Cargo[ 2 ],acolors) + AAdd( oBrwColors:Cargo[ 2 ],acolors) oBrwColors:AddColumn( oCol := TBColumnNew( "",; { || PadR( '"' + ::aColors[ oBrwColors:Cargo[ 1 ] ] + '"', nWidth - 15 ) } ) ) - AAdd(oBrwColors:Cargo[ 2 ],acolors) + AAdd( oBrwColors:Cargo[ 2 ],acolors) oCol:DefColor := { 1, 3 } ocol:width := 50 oBrwColors:autolite:=.F. @@ -862,14 +853,14 @@ METHOD DoCommand( cCommand ) CLASS HBDebugger DO CASE CASE cCommand == "??" .OR. cCommand == "?" - aCmnd[WP_TYPE] := cCommand - aCmnd[WP_EXPR] := cParam + aCmnd[ WP_TYPE ] := cCommand + aCmnd[ WP_EXPR ] := cParam ::RestoreAppState() cResult := ::GetExprValue( cParam, @lValid ) ::SaveAppState() - IF aCmnd[WP_TYPE] == "??" + IF aCmnd[ WP_TYPE ] == "??" IF lValid ::Inspect( aCmnd[ WP_EXPR ], cResult ) ENDIF @@ -1124,15 +1115,15 @@ METHOD EditColor( nColor, oBrwColors ) CLASS HBDebugger READ SetCursor( SC_NONE ) #else - cColor := getdbginput( Row(), Col() + 15, cColor, { |cColor| iif( Type( cColor ) != "C", ( Alert( "Must be string" ), .F. ), .T. ) }, SubStr( ::ClrModal(), 5 ) ) + cColor := getdbginput( Row(), Col() + 15, cColor, {| cColor | iif( Type( cColor ) != "C", ( Alert( "Must be string" ), .F. ), .T. ) }, SubStr( ::ClrModal(), 5 ) ) #endif Set( _SET_SCOREBOARD, lPrevScore ) Set( _SET_EXIT, lPrevExit ) - if LastKey() != K_ESC + IF LastKey() != K_ESC ::aColors[ nColor ] := &cColor - endif + ENDIF oBrwColors:RefreshCurrent() oBrwColors:ForceStable() @@ -1153,7 +1144,7 @@ METHOD EditSet( nSet, oBrwSets ) CLASS HBDebugger #ifndef HB_NO_READDBG SetCursor( SC_NORMAL ) @ Row(), Col() + 13 GET cSet COLOR SubStr( ::ClrModal(), 5 ) ; - VALID iif( Type(cSet) != cType, ( Alert( "Must be of type '" + cType + "'" ), .F. ), .T. ) + VALID iif( Type( cSet ) != cType, ( Alert( "Must be of type '" + cType + "'" ), .F. ), .T. ) READ SetCursor( SC_NONE ) @@ -1183,25 +1174,23 @@ METHOD EditVar( nVar ) CLASS HBDebugger uVarValue := ::VarGetValue( ::aVars[ nVar ] ) - DO CASE - CASE ValType( uVarValue ) $ "AHOP" - + IF ValType( uVarValue ) $ "AHOP" ::InputBox( cVarName, uVarValue, NIL, .F. ) - - OTHERWISE + ELSE cVarStr := ::InputBox( cVarName, __dbgValToStr( uVarValue ),; { | u | iif( Type( u ) == "UE", ( Alert( "Expression error" ), .F. ), .T. ) } ) - ENDCASE + ENDIF + + IF LastKey() != K_ESC - if LastKey() != K_ESC DO CASE CASE cVarStr == "{ ... }" //aArray := ::VarGetValue( ::aVars[ nVar ] ) - if Len( uVarValue ) > 0 + IF Len( uVarValue ) > 0 __DbgArrays( uVarValue, cVarName ) - else + ELSE Alert( "Array is empty" ) - endif + ENDIF CASE Upper( Left( cVarStr, 5 ) ) == "CLASS" __DbgObject( uVarValue, cVarName ) @@ -1209,7 +1198,7 @@ METHOD EditVar( nVar ) CLASS HBDebugger OTHERWISE ::VarSetValue( ::aVars[ nVar ], &cVarStr ) ENDCASE - endif + ENDIF ::oBrwVars:RefreshCurrent() ::oBrwVars:ForceStable() @@ -1568,11 +1557,11 @@ METHOD InputBox( cMsg, uValue, bValid, lEditable ) CLASS HBDebugger endif nOldCursor := SetCursor( SC_NORMAL ) - oGet := ATAIL( GetList ) - bMouseSave := Setkey( K_LBUTTONDOWN, {|| iif(MRow() == nTop .AND. MCol() == nLeft + 2,; - (oGet:undo(), oGet:exitState := GE_ESCAPE, .T.), .F.)}) + oGet := ATail( GetList ) + bMouseSave := SetKey( K_LBUTTONDOWN, {|| iif( MRow() == nTop .AND. MCol() == nLeft + 2,; + ( oGet:undo(), oGet:exitState := GE_ESCAPE, .T. ), .F. ) } ) READ - Setkey( K_LBUTTONDOWN, bMouseSave) + SetKey( K_LBUTTONDOWN, bMouseSave) SetCursor( nOldCursor ) #else uTemp := getdbginput( nTop + 1, nLeft + 1, uTemp, bValid, __DbgColors()[ 5 ] ) @@ -2047,7 +2036,7 @@ METHOD OSShell() CLASS HBDebugger RECOVER USING oE - Alert("Error: " + oE:description) + Alert( "Error: " + oE:description ) END SEQUENCE @@ -2915,7 +2904,7 @@ METHOD VarSetValue( aVar, uValue ) CLASS HBDebugger hb_dbg_vmVarGSet( aVar[ VAR_LEVEL ], aVar[ VAR_POS ], uValue ) ELSEIF cType == "L" - nProcLevel := hb_dbg_procLevel() - aVar[VAR_LEVEL] //skip debugger stack + nProcLevel := hb_dbg_procLevel() - aVar[ VAR_LEVEL ] //skip debugger stack hb_dbg_vmVarLSet( nProcLevel, aVar[ VAR_POS ], uValue ) ELSEIF cType == "S" diff --git a/harbour/source/rtl/hbini.prg b/harbour/source/rtl/hbini.prg index 0720a77159..755f02a021 100644 --- a/harbour/source/rtl/hbini.prg +++ b/harbour/source/rtl/hbini.prg @@ -82,13 +82,13 @@ STATIC s_cLineComment := ";" STATIC s_cHalfLineComment := "#" -PROCEDURE hb_SetIniComment( cLc, cHlc ) +PROCEDURE hb_IniSetComment( cLc, cHlc ) s_cLineComment := cLc s_cHalfLineComment := cHlc RETURN -FUNCTION hb_ReadIni( cFileSpec, bKeyCaseSens, cSplitters, bAutoMain ) +FUNCTION hb_IniRead( cFileSpec, bKeyCaseSens, cSplitters, bAutoMain ) LOCAL hIni := hb_Hash() /* Default case sensitiveness for keys */ @@ -103,9 +103,9 @@ FUNCTION hb_ReadIni( cFileSpec, bKeyCaseSens, cSplitters, bAutoMain ) hIni[ "MAIN" ] := hb_Hash() ENDIF -RETURN hb_ReadIni2( hIni, cFileSpec, bKeyCaseSens, cSplitters, bAutoMain ) +RETURN hb_IniRdLow( hIni, cFileSpec, bKeyCaseSens, cSplitters, bAutoMain ) -STATIC FUNCTION hb_ReadIni2( hIni, cFileSpec, bKeyCaseSens, cSplitters, bAutoMain ) +STATIC FUNCTION hb_IniRdLow( hIni, cFileSpec, bKeyCaseSens, cSplitters, bAutoMain ) LOCAL aFiles LOCAL cFile, nLen LOCAL aKeyVal, hCurrentSection @@ -208,7 +208,7 @@ STATIC FUNCTION hb_ReadIni2( hIni, cFileSpec, bKeyCaseSens, cSplitters, bAutoMai IF Len( aKeyVal[ 2 ] ) == 0 LOOP ENDIF - hb_ReadIni2( hIni, aKeyVal[ 2 ], bKeyCaseSens, cSplitters, bAutoMain ) + hb_IniRdLow( hIni, aKeyVal[ 2 ], bKeyCaseSens, cSplitters, bAutoMain ) cLine := "" LOOP ENDIF @@ -248,7 +248,7 @@ STATIC FUNCTION hb_ReadIni2( hIni, cFileSpec, bKeyCaseSens, cSplitters, bAutoMai RETURN hIni -FUNCTION hb_WriteIni( xFileName, hIni, cCommentBegin, cCommentEnd, bAutoMain ) +FUNCTION hb_IniWrite( xFileName, hIni, cCommentBegin, cCommentEnd, bAutoMain ) LOCAL hFile LOCAL lClose LOCAL cNewLine := hb_OSNewLine() diff --git a/harbour/source/rtl/memoedit.prg b/harbour/source/rtl/memoedit.prg index 8cdc6d5f19..f3557c5f92 100644 --- a/harbour/source/rtl/memoedit.prg +++ b/harbour/source/rtl/memoedit.prg @@ -149,19 +149,23 @@ METHOD KeyboardHook( nKey ) CLASS HBMemoEditor if nKey == K_ESC - cBackScr := SaveScreen( ::nTop, ::nRight - 18, ::nTop, ::nRight ) - - nRow := Row() - nCol := Col() - @ ::nTop, ::nRight - 18 SAY "Abort Edit? (Y/N)" - - nYesNoKey := Inkey( 0 ) - - RestScreen( ::nTop, ::nRight - 18, ::nTop, ::nRight, cBackScr ) - SetPos( nRow, nCol ) - - if Upper( Chr( nYesNoKey ) ) == "Y" - ::lSaved := .F. + if ::lDirty + cBackScr := SaveScreen( ::nTop, ::nRight - 18, ::nTop, ::nRight ) + + nRow := Row() + nCol := Col() + @ ::nTop, ::nRight - 18 SAY "Abort Edit? (Y/N)" + + nYesNoKey := Inkey( 0 ) + + RestScreen( ::nTop, ::nRight - 18, ::nTop, ::nRight, cBackScr ) + SetPos( nRow, nCol ) + + if Upper( Chr( nYesNoKey ) ) == "Y" + ::lSaved := .F. + ::lExitEdit := .T. + endif + else ::lExitEdit := .T. endif endif diff --git a/harbour/source/rtl/teditor.prg b/harbour/source/rtl/teditor.prg index 00faa842d5..46bb0fadf4 100644 --- a/harbour/source/rtl/teditor.prg +++ b/harbour/source/rtl/teditor.prg @@ -136,7 +136,7 @@ CREATE CLASS HBEditor VAR lSaved AS LOGICAL INIT .F. // True if user exited editor with K_CTRL_W VAR lWordWrap AS LOGICAL INIT .F. // True if word wrapping is active VAR nWordWrapCol AS NUMERIC INIT 0 // At which column word wrapping occurs - VAR lDirty AS LOGICAL // .T. if there are changes not saved + VAR lDirty AS LOGICAL INIT .F. // .T. if there are changes not saved VAR lExitEdit AS LOGICAL INIT .F. // .T. if user requested to end Edit() method VAR cColorSpec AS CHARACTER INIT SetColor() // Color string used for screen writes @@ -181,9 +181,6 @@ METHOD New( cString, nTop, nLeft, nBottom, nRight, lEditMode, nLineLength, nTabS ::InsertState( ::lInsert ) endif - // No need to save - ::lDirty := .F. - // is word wrap required? if ISNUMBER( nLineLength ) ::lWordWrap := .T.