Capture Errors output from hb_compileFromBuf()

369 views
Skip to first unread message

eager

unread,
Sep 19, 2012, 2:01:36 PM9/19/12
to harbou...@googlegroups.com
Hi Przemek,

I started using runAScript( cFile,...) while developing Apps. It's a great feature in speeding up the process especially many screens deep. thanks for that. its a gem.
 
what i couldn't figure out is how to capture the errors output from hb_compileFromBuf()? 

Any help that?

Thanks,
Abe.

eager

unread,
Sep 20, 2012, 2:29:29 PM9/20/12
to harbou...@googlegroups.com
Hi,

Googling I found a way to to that on FiveTech web site. and it works... (not sure it's the most elegant way.thou)

-------
FReOpen_Stderr( "comp.log", "w" )

cBuffer = hb_compileFromBuf( hb_memoread( "test4.txt"))

if ! empty(cbuffer)
    pHrb := hb_hrbLoad( HB_HRB_BIND_FORCELOCAL, cBuffer )
    IF ! empty( pHrb )
        BEGIN SEQUENCE
            hb_hrbDo( pHrb)
        RECOVER USING oErr
            //WAPI_OutputDebugString(  oErr:description, "Error running script"
        END SEQUENCE
    ENDIF
ENDIF

#pragma BEGINDUMP

#include <stdio.h>
#include <hbapi.h>

HB_FUNC( FREOPEN_STDERR )
{
   hb_retnl( ( HB_LONG ) freopen( hb_parc( 1 ), hb_parc( 2 ), stderr )) ;
}

#pragma ENDDUMP

Przemyslaw Czerpak

unread,
Sep 20, 2012, 4:22:24 PM9/20/12
to harbou...@googlegroups.com
On Thu, 20 Sep 2012, eager wrote:

Hi,

> Googling I found a way to to that on FiveTech web site. and it works...
> (not sure it's the most elegant way.thou)
[...]
Let's leave this code in peace.
Such things happen if someone does not read ChangeLog and not know
Harbour API. Such redirection should be implemented using GT API
because it will in all cases, is portable and much simpler.
Anyhow it's still not necessary because we have PRG API for it
so it's enough to catch RTE.

best regards,
Przemek

eager

unread,
Sep 20, 2012, 6:23:03 PM9/20/12
to harbou...@googlegroups.com
Hi Przemek,

Thanks for replying, but you are over over estimating my  programming abilities...
If you can please provide an example, i would really appreciate it. I want to to the Przemek way!

Thanks,
Abe

Antonio Linares

unread,
Apr 1, 2018, 11:20:34 PM4/1/18
to Harbour Developers
better later than never :-)

ErrorBlock( { | o | alert( o:Description ), DoBreak() } )

oHrb = HB_CompileFromBuf( cCode, .T., "-n" ) // The .T. does the magic


regards

Antonio



 

Bacco

unread,
Apr 2, 2018, 9:59:07 AM4/2/18
to harbour-devel
Any luck capturing  __PP_PROCESS ?

Tried some combinations, but all I got is RTE.
(I need to check the source later)

--
You received this message because you are subscribed to the Google Groups "Harbour Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-devel+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages