From 2c507cf4507583ed314b465ce0c38e2075ab7e30 Mon Sep 17 00:00:00 2001 From: Ron Pinkas Date: Mon, 4 Jun 2001 06:55:16 +0000 Subject: [PATCH] 2001-06-03 23:50 UTC-0800 Ron Pinkas * contrib/dot/pp.prg + Added #ifdef WIN to support using Windows MessageBox() instead of Alert(), use BLD pp -dWIN to activate. * contrib/dot/pp_harb.ch + Minor revision in TInnterpreter() class. + Added wrapper for MessageBox() * contrib/dot/rp_run.ch + Added #ifdef #command to translate --- harbour/ChangeLog | 9 +++++++++ harbour/contrib/dot/pp.prg | 16 +++++++++++++++- harbour/contrib/dot/pp_harb.ch | 20 +++++++++++++++----- harbour/contrib/dot/rp_run.ch | 3 +++ 4 files changed, 42 insertions(+), 6 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index fa20d0df46..e7fe35a03b 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,12 @@ +2001-06-03 23:50 UTC-0800 Ron Pinkas + * contrib/dot/pp.prg + + Added #ifdef WIN to support using Windows MessageBox() instead of Alert(), use BLD pp -dWIN to activate. + * contrib/dot/pp_harb.ch + + Minor revision in TInnterpreter() class. + + Added wrapper for MessageBox() + * contrib/dot/rp_run.ch + + Added #ifdef #command to translate + 2001-06-03 09:35 UTC+1 JFL (mafact) * harbour/source/vm/Classe.c * Temporary disabled scoping for rel. 0.37 ! diff --git a/harbour/contrib/dot/pp.prg b/harbour/contrib/dot/pp.prg index ee1e1c4327..0393a45de7 100644 --- a/harbour/contrib/dot/pp.prg +++ b/harbour/contrib/dot/pp.prg @@ -29,6 +29,11 @@ #DEFINE CRLF HB_OsNewLine() #ifdef FW #INCLUDE "fwextern.ch" + #else + #ifdef WIN + #COMMAND Alert( ) => MessageBox( 0, xToStr( ), "PP for Windows", 0 ) + EXTERN MessageBox + #endif #endif #else #DEFINE __CLIPPER__ @@ -571,6 +576,9 @@ PROCEDURE RP_Dot() bCount := .F. PP_PreProFile( "rp_dot.ch" ) + #ifdef WIN + PP_PreProLine( '#COMMAND Alert( ) => MessageBox( 0, xToStr( ), "TInterpreter for Windows", 0 )' ) + #endif ErrorBlock( {|oErr| RP_Dot_Err( oErr ) } ) @@ -2513,7 +2521,7 @@ FUNCTION PP_PreProFile( sSource, sPPOExt, bBlanks ) ENDIF ENDIF - IF ProcName(1) == 'MAIN' + IF ProcName(2) == "" FClose( hPP ) IF bCCH @@ -7575,6 +7583,9 @@ STATIC FUNCTION InitRunRules() aAdd( aTransRules, { 'PROCLINE' , { { 0, 0, '(', NIL, NIL }, { 1, 1, NIL, '<', { ')' } }, { 0, 0, ')', NIL, NIL } } , .F. } ) /* Commands */ + #ifdef WIN + aAdd( aCommRules, { 'ALERT' , { { 1, 0, '(', '<', NIL }, { 0, 0, ')', NIL, NIL } } , .F. } ) + #endif aAdd( aCommRules, { '_HB_CLASS' , { { 1, 0, NIL, '*', NIL } } , .F. } ) aAdd( aCommRules, { '_HB_MEMBER' , { { 1, 0, NIL, '*', NIL } } , .F. } ) aAdd( aCommRules, { 'MEMVAR' , { { 1, 0, NIL, '*', NIL } } , .F. } ) @@ -7635,6 +7646,9 @@ STATIC FUNCTION InitRunResults() aAdd( aTransResults, { { { 0, 'PP_ProcLine( ' }, { 0, 1 }, { 0, ' )' } }, { -1, 1, -1} , { NIL } } ) /* Commands Results*/ + #ifdef WIN + aAdd( aCommResults, { { { 0, 'MessageBox( 0, xToStr( ' }, { 0, 1 }, { 0, ' ), "TInterpreter for Windows", 0 )' } }, { -1, 1, -1} , { NIL } } ) + #endif aAdd( aCommResults, { , , { NIL } } ) aAdd( aCommResults, { , , { NIL } } ) aAdd( aCommResults, { , , { NIL } } ) diff --git a/harbour/contrib/dot/pp_harb.ch b/harbour/contrib/dot/pp_harb.ch index b2a9f6cac7..4d96445eca 100644 --- a/harbour/contrib/dot/pp_harb.ch +++ b/harbour/contrib/dot/pp_harb.ch @@ -8,6 +8,7 @@ CLASS TInterpreter DATA cText DATA acPPed + DATA cPPed DATA aCompiledProcs DATA aInitExit DATA nProcs @@ -16,6 +17,7 @@ CLASS TInterpreter METHOD AddLine( cLine ) INLINE ( ::nProcs := 0, ::acPPed := {}, ::cText += ( cLine + Chr(10) ) ) METHOD SetScript( cText ) INLINE ( ::nProcs := 0, ::acPPed := {}, ::cText := cText ) + METHOD GetPPO() INLINE ( ::cPPed ) METHOD Compile() METHOD Run() @@ -48,7 +50,7 @@ METHOD Compile() IF Len( ::acPPed ) == 0 PP_InitStd() PP_LoadRun() - PP_PreProText( ::cText, ::acPPed ) + ::cPPed := PP_PreProText( ::cText, ::acPPed ) ::aCompiledProcs := {} ::aInitExit := { {}, {} } ENDIF @@ -136,7 +138,7 @@ static HB_FUNC( NEXTTOKEN ) s2[0] = sLine[0]; s2[1] = sLine[1]; - if( strstr( "++\--\->\:=\==\!=\<>\>=\<=\+=\-=\*=\^=\**\/=\%=\??", (char*) s2 ) ) + if( strstr( "++\\--\\->\\:=\\==\\!=\\<>\\>=\\<=\\+=\\-=\\*=\\^=\\**\\/=\\%=\\??", (char*) s2 ) ) { sReturn[0] = s2[0]; sReturn[1] = s2[1]; @@ -363,7 +365,7 @@ static HB_FUNC( NEXTTOKEN ) goto Done; } - else if ( strchr( "+-*/:=^!&()[]{}@,|<>#%?$", sLine[0] ) ) + else if ( strchr( "+-*/:=^!&()[]{}@,|<>#%?$~", sLine[0] ) ) { sReturn[0] = sLine[0]; sReturn[1] = '\0'; @@ -526,7 +528,7 @@ static HB_FUNC( NEXTIDENTIFIER ) } else { - char *sSkipped = hb_xgrab( nStart + 1 ); + char *sSkipped = (char *) hb_xgrab( nStart + 1 ); strncpy( sSkipped, sLine, nStart ); sSkipped[nStart]= '\0'; @@ -538,7 +540,7 @@ static HB_FUNC( NEXTIDENTIFIER ) if( nStart >= 0 ) { - char *sIdentifier = hb_xgrab( ( nAt - nStart ) + 1 ); + char *sIdentifier = (char *) hb_xgrab( ( nAt - nStart ) + 1 ); strncpy( sIdentifier, sLine + nStart, ( nAt - nStart ) ); sIdentifier[nAt - nStart] = '\0'; @@ -565,6 +567,14 @@ static HB_FUNC( NEXTIDENTIFIER ) } } +//----------------------------------------------------------------------------// +#include + +HB_FUNC( MESSAGEBOX ) +{ + hb_retni( MessageBox( ( HWND ) hb_parnl( 1 ), hb_parc( 2 ), hb_parc( 3 ), hb_parni( 4 ) ) ); +} + #pragma STOPDUMP STATIC FUNCTION InitFWRules() diff --git a/harbour/contrib/dot/rp_run.ch b/harbour/contrib/dot/rp_run.ch index 1f798f02ed..355fe3c06d 100644 --- a/harbour/contrib/dot/rp_run.ch +++ b/harbour/contrib/dot/rp_run.ch @@ -1,4 +1,7 @@ #ifdef __HARBOUR__ + #ifdef WIN + #COMMAND Alert( ) => MessageBox( 0, xToStr( ), "TInterpreter for Windows", 0 ) + #endif #else //#define __CLIPPER__ #endif