diff --git a/harbour/ChangeLog b/harbour/ChangeLog index a8af1c9b71..ece3614aaa 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -7,6 +7,23 @@ For example: 2002-12-01 23:12 UTC+0100 Foo Bar */ + * bug fixed, reported by Lorenzo Fiorini +2002-02-21 18:10 UTC+0500 Jorge A. Giraldo + * source/debug/debugger.prg + * Fixed bug when browsing vars + reported by Jorge A. Giraldo + +2002-02-24 09:34 UTC+0200 Chen Kedem + + * doc/dirstruc.txt + + Add two lines about the Delphi directory + +2002-02-23 15:48 UTC+0300 Alexander Kresin + * source/rdd/dbfntx/dbfntx1.c + ! bug fixed in unique indexes creating, reported by Mikhail Malyh + +2002-02-23 09:55 UTC+0100 Antonio Linares + * source/debug/debugger.prg * Fixed bug when browsing vars reported by Jorge A. Giraldo diff --git a/harbour/contrib/delphi/hbdll/easypath.dpr b/harbour/contrib/delphi/hbdll/easypath.dpr index 7a7ec411fb..325caf9b1e 100644 --- a/harbour/contrib/delphi/hbdll/easypath.dpr +++ b/harbour/contrib/delphi/hbdll/easypath.dpr @@ -1,5 +1,5 @@ {* - * $id$ + * $Id$ *} program EasyPath; diff --git a/harbour/contrib/delphi/hbdll/errorsys.prg b/harbour/contrib/delphi/hbdll/errorsys.prg index 361a2961d8..0c26f3c7fd 100644 --- a/harbour/contrib/delphi/hbdll/errorsys.prg +++ b/harbour/contrib/delphi/hbdll/errorsys.prg @@ -144,25 +144,27 @@ STATIC FUNCTION DefError( oError ) cMessage += " " + cDOSError+Chr(13) ENDIF - // QOut() /// dgh - Temporary to keep DOS prompt from overwriting message. - // QOut( cMessage ) - n := 2 WHILE ! Empty( ProcName( n ) ) /* CHANGED */ cMessage += "Called from " + ProcName( n ) + ; - "(" + AllTrim( Str( ProcLine( n++ ) ) ) + ")"+Chr(13) + "(" + AllTrim( Str( ProcLine( n ) ) ) + ")"+Chr(13) - // QOut("Called from " + ProcName( n ) + ; - // "(" + AllTrim( Str( ProcLine( n++ ) ) ) + ")") + // QUESTION: from a DLL point of view, there is not main procedure, + // instead of that, something that is not a valid string is + // given, causing this errorsys routine to be re-entrant. + // This next line is a temporal workaround to this problem, + // and a specific code to this Harbour to Delphi integration. + If Upper(ProcName(n)) = 'MACROCALL' + Exit + EndIf + n++ ENDDO MSGBOX( cMessage ) // Windows MessageBox -/// For some strange reason, the DOS prompt gets written on the first line -/// *of* the message instead of on the first line *after* the message after -/// the program quits, unless the screen has scrolled. - dgh - QUIT + D('QUIT') // NOTE: A QUIT in a DLL is something not very smart, better to + // QUIT // let Delphi to end properly. RETURN .F. diff --git a/harbour/contrib/delphi/hbdll/main.pas b/harbour/contrib/delphi/hbdll/main.pas index 483ccc1f22..6ce3c0f0f7 100644 --- a/harbour/contrib/delphi/hbdll/main.pas +++ b/harbour/contrib/delphi/hbdll/main.pas @@ -1,5 +1,5 @@ {* - * $id$ + * $Id$ *} {* @@ -84,6 +84,8 @@ function MacroCall( pParam : pchar ) : pchar; stdcall; external 'MyProg' name 'MacroCall'; function h( sParam : String ) : variant; +function ExtParam( sString : String; iPos : Integer; sSepar : String ) : String; +function AllTrim(sString: string): string; implementation @@ -107,7 +109,7 @@ begin sResult := Copy(sRtnVal,2,Length(sRtnVal)-1); // Changes string result to the expected type - if sType = 'C' then // is character or string + if sType = 'C' then // is character result := sResult else if sType = 'I' then // integer @@ -123,24 +125,93 @@ begin if sResult = 'True' then result := true else - result := false; + result := false + else + result := unassigned; end; function ReceiveCallBack(mesg: PChar): integer; stdcall; -const - nCallsMade : integer = 0; +var + s, sCommand : String; begin - Main_FRM.ProgressBar1.Position := StrToInt(String(mesg)); + s := String(mesg); + sCommand := ExtParam(s,1,','); + + if sCommand = 'QUIT' then + begin + ShowMessage(ExtParam(s,2,',')); + oApplication.Terminate; + Halt(0); + end + else + if sCommand = 'ProgressBar1' then + Main_FRM.ProgressBar1.Position := StrToInt(ExtParam(s, 2, ',')); + oApplication.ProcessMessages; - Inc(nCallsMade); + // The answer our Harbour program expects. // Callbackresult is a Harbour Public variable // that is requested when expecting some answer. // h(' CallBackResult := "NOANSWER" '); + result := 0; end; +function ExtParam( sString : String; iPos : Integer; sSepar : String ) : String; +var + sStrT, sPara : String; + iX, iPosiT : Integer; + +begin + sStrT := AllTrim(sString)+sSepar; + iX := 0; + sPara := ''; // tiene que haber al menos un parametro + While true do + begin + Inc(iX); + iPosiT := Pos(sSepar, sStrT); + if iPosiT = 0 then + Break; + sPara := Copy(sStrT, 1, iPosiT-1); + if iX = iPos then + break; + sStrT := Copy(sStrT, iPosiT+1, Length(sStrT)-iPosiT+1); + sPara := ''; + end; + result := AllTrim(sPara); +end; + +function AllTrim(sString: string): string; +var + n, + nBeginPos, + nEndPos : Integer; +begin + nBeginPos := 0; + for n := 1 to Length(sString) do + if sString[n] <> ' ' then + begin + nBeginPos := n; + break; + end; + + + nEndPos := Length(sString); + If nBeginPos <> 0 then + begin + for n := Length(sString) downto 1 do + if sString[n] <> ' ' then + begin + nEndPos := n; + break; + end; + end; + + Result := Copy(sString, nBeginPos, nEndPos-nBeginPos+1); + +end; + Initialization begin SetCallBack(ReceiveCallBack); diff --git a/harbour/contrib/delphi/hbdll/myprog.prg b/harbour/contrib/delphi/hbdll/myprog.prg index 8825bb16b7..810ec240bb 100644 --- a/harbour/contrib/delphi/hbdll/myprog.prg +++ b/harbour/contrib/delphi/hbdll/myprog.prg @@ -60,6 +60,9 @@ MEMVAR CallBackResult FUNCTION MakeIndex( cFileName, cField ) PUBLIC CallBackResult := '' +? +? 'Please click the Delphi App to see the status' +? Use (cFileName) Alias FIL Index on &(cField) to (cFileName) EVAL IndexStatus() EVERY LastRec()/10 Close FIL @@ -67,7 +70,7 @@ RETURN 'The file '+cFileName+' has been indexed' FUNCTION IndexStatus LOCAL cCompleted := LTrim( Str(Int((RecNo()/LastRec()) * 100)) ), nSeconds -D(cCompleted) +D('ProgressBar1'+','+cCompleted) nSeconds := Seconds() // Let's make this thing to go slowly WHILE nSeconds+1 >= Seconds() diff --git a/harbour/contrib/delphi/hbdll/start.bat b/harbour/contrib/delphi/hbdll/start.bat index cde81fc3de..701fa4e491 100644 --- a/harbour/contrib/delphi/hbdll/start.bat +++ b/harbour/contrib/delphi/hbdll/start.bat @@ -1,4 +1,4 @@ -rem Makes our PRG to be a DLL, from an Antonio's idea an research +rem Makes our PRG to be a DLL, from an Antonio's idea and research rem rem $Id$ rem