From a97b5961058b2dade7177a772bacae6b56eb1675 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Sat, 31 Jan 2009 11:36:43 +0000 Subject: [PATCH] 2009-01-31 12:35 UTC+0100 Viktor Szakats (harbour.01 syenar hu) * utils/hbrun/hbrun.prg + If a .dbf file is passed on the command line, hbrun will open it. * contrib/examples/uhttpd/hbmk_vc.bat * Updated. * contrib/examples/uhttpd/hbmk_b32.bat % Minor opt. --- harbour/ChangeLog | 11 ++ harbour/contrib/examples/uhttpd/hbmk_b32.bat | 6 +- harbour/contrib/examples/uhttpd/hbmk_vc.bat | 4 +- harbour/utils/hbrun/hbrun.prg | 169 ++++++++++--------- 4 files changed, 106 insertions(+), 84 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 436b76a69b..f2b55f074a 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,17 @@ 2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2009-01-31 12:35 UTC+0100 Viktor Szakats (harbour.01 syenar hu) + * utils/hbrun/hbrun.prg + + If a .dbf file is passed on the command line, hbrun will + open it. + + * contrib/examples/uhttpd/hbmk_vc.bat + * Updated. + + * contrib/examples/uhttpd/hbmk_b32.bat + % Minor opt. + 2009-01-30 20:19 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/make_gcc.mak ! added additional rules to fix time conditions in parallel compilation diff --git a/harbour/contrib/examples/uhttpd/hbmk_b32.bat b/harbour/contrib/examples/uhttpd/hbmk_b32.bat index 32cc7de0b5..b9220a5839 100644 --- a/harbour/contrib/examples/uhttpd/hbmk_b32.bat +++ b/harbour/contrib/examples/uhttpd/hbmk_b32.bat @@ -46,11 +46,7 @@ if %UHTTP_INET_SUPPORT%.==no. SET UHTTP_INET_SOCKET=socket.c if exist uhttpd.exe uhttpd -s -..\..\..\bin\harbour uhttpd /n /es2 /w3 /i..\..\..\include %UHTTP_GD_DEF% %UHTTP_INET_DEF% -if errorlevel 1 goto DOERROR -..\..\..\bin\harbour cgifunc /n /es2 /w3 /i..\..\..\include %UHTTP_GD_DEF% %UHTTP_INET_DEF% -if errorlevel 1 goto DOERROR -..\..\..\bin\harbour cookie /n /es2 /w3 /i..\..\..\include %UHTTP_GD_DEF% %UHTTP_INET_DEF% +..\..\..\bin\harbour uhttpd cgifunc cookie /n /es2 /w3 /i..\..\..\include %UHTTP_GD_DEF% %UHTTP_INET_DEF% if errorlevel 1 goto DOERROR bcc32 -O2 -tW -d -a8 -I..\..\..\include -L..\..\..\lib uhttpd.c cgifunc.c cookie.c uhttpdc.c %UHTTP_INET_SOCKET% hbdebug.lib hbvmmt.lib hbrtl.lib gtwvt.lib gtwin.lib gtgui.lib hblang.lib hbrdd.lib hbmacro.lib hbpp.lib rddntx.lib rddcdx.lib rddfpt.lib hbcpage.lib hbsix.lib hbcommon.lib hbpcre.lib hbhsx.lib hbzlib.lib xhb.lib hbct.lib cw32mt.lib %UHTTP_GD_LIBS% if errorlevel 1 goto DOERROR diff --git a/harbour/contrib/examples/uhttpd/hbmk_vc.bat b/harbour/contrib/examples/uhttpd/hbmk_vc.bat index 45bee2fc01..273155feab 100644 --- a/harbour/contrib/examples/uhttpd/hbmk_vc.bat +++ b/harbour/contrib/examples/uhttpd/hbmk_vc.bat @@ -46,9 +46,9 @@ if %UHTTP_INET_SUPPORT%.==no. SET UHTTP_INET_SOCKET=socket.c if exist uhttpd.exe uhttpd -s -..\..\..\bin\harbour uhttpd /n /es2 /w3 /i..\..\..\include %UHTTP_GD_DEF% %UHTTP_INET_DEF% +..\..\..\bin\harbour uhttpd cgifunc cookie /n /es2 /w3 /i..\..\..\include %UHTTP_GD_DEF% %UHTTP_INET_DEF% if errorlevel 1 goto DOERROR -cl -nologo -O2 -W3 -I..\..\..\include uhttpd.c uhttpdc.c %UHTTP_INET_SOCKET% /link /subsystem:windows /libpath:..\..\..\lib hbcpage.lib hbdebug.lib hbvmmt.lib hbrtl.lib gtwin.lib hblang.lib hbrdd.lib hbmacro.lib hbpp.lib rddntx.lib rddcdx.lib rddfpt.lib hbsix.lib hbcommon.lib hbpcre.lib hbzlib.lib user32.lib wsock32.lib advapi32.lib hbct.lib gdi32.lib hbwin.lib hbhsx.lib gtwvt.lib %UHTTP_GD_LIBS% xhb.lib +cl -nologo -O2 -W3 -I..\..\..\include uhttpd.c cgifunc.c cookie.c uhttpdc.c %UHTTP_INET_SOCKET% /link /subsystem:windows /libpath:..\..\..\lib hbcpage.lib hbdebug.lib hbvmmt.lib hbrtl.lib gtwin.lib hblang.lib hbrdd.lib hbmacro.lib hbpp.lib rddntx.lib rddcdx.lib rddfpt.lib hbsix.lib hbcommon.lib hbpcre.lib hbzlib.lib user32.lib wsock32.lib advapi32.lib hbct.lib gdi32.lib hbwin.lib hbhsx.lib gtwvt.lib %UHTTP_GD_LIBS% xhb.lib if errorlevel 1 goto DOERROR :CLEAN diff --git a/harbour/utils/hbrun/hbrun.prg b/harbour/utils/hbrun/hbrun.prg index c47fe378c7..aa7d606588 100644 --- a/harbour/utils/hbrun/hbrun.prg +++ b/harbour/utils/hbrun/hbrun.prg @@ -77,11 +77,7 @@ STATIC s_aIncDir := {} /* ********************************************************************** */ PROCEDURE _APPMAIN( cFile, ... ) - LOCAL GetList - LOCAL cLine, cCommand, cPath, cExt - LOCAL nMaxRow, nMaxCol - LOCAL aHistory, nHistIndex - LOCAL bKeyUP, bKeyDown, bKeyIns + LOCAL cPath, cExt #ifdef _DEFAULT_INC_DIR AADD( s_aIncDir, "-I" + _DEFAULT_INC_DIR ) @@ -114,87 +110,106 @@ PROCEDURE _APPMAIN( cFile, ... ) ELSE hb_hrbRun( cFile, ... ) ENDIF + ELSEIF Lower( cExt ) == ".dbf" + HB_DotPrompt( "USE " + cFile ) ELSE hb_hrbRun( cFile, ... ) ENDIF ENDSWITCH ELSE - - CLEAR SCREEN - SET SCOREBOARD OFF - GetList := {} - cCommand := "" - aHistory := { padr( "quit", HB_LINE_LEN ) } - nHistIndex := 2 - - DO WHILE .T. - - IF cLine == NIL - cLine := Space( HB_LINE_LEN ) - ENDIF - - HB_DotInfo( cCommand ) - - nMaxRow := MaxRow() - nMaxCol := MaxCol() - @ nMaxRow, 0 SAY HB_PROMPT - @ nMaxRow, Col() GET cLine ; - PICTURE "@KS" + hb_NToS( nMaxCol - Col() + 1 ) - - SetCursor( IIF( ReadInsert(), SC_INSERT, SC_NORMAL ) ) - - bKeyIns := SetKey( K_INS, ; - {|| SetCursor( IIF( ReadInsert( !ReadInsert() ), ; - SC_NORMAL, SC_INSERT ) ) } ) - bKeyUp := SetKey( K_UP, ; - {|| IIF( nHistIndex > 1, ; - cLine := aHistory[ --nHistIndex ], ) } ) - bKeyDown := SetKey( K_DOWN, ; - {|| cLine := IIF( nHistIndex < LEN( aHistory ), ; - aHistory[ ++nHistIndex ], ; - ( nHistIndex := LEN( aHistory ) + 1, Space( HB_LINE_LEN ) ) ) } ) - - READ - - SetKey( K_DOWN, bKeyDown ) - SetKey( K_UP, bKeyUp ) - SetKey( K_INS, bKeyIns ) - - IF LastKey() == K_ESC .OR. EMPTY( cLine ) - cLine := NIL - IF nMaxRow != MaxRow() .OR. nMaxCol != MaxCol() - @ nMaxRow, 0 CLEAR - ENDIF - LOOP - ENDIF - - IF EMPTY( aHistory ) .OR. ! ATAIL( aHistory ) == cLine - IF LEN( aHistory ) < HB_HISTORY_LEN - AADD( aHistory, cLine ) - ELSE - ADEL( aHistory, 1 ) - aHistory[ LEN( aHistory ) ] := cLine - ENDIF - ENDIF - nHistIndex := LEN( aHistory ) + 1 - - cCommand := AllTrim( cLine, " " ) - cLine := NIL - @ nMaxRow, 0 CLEAR - HB_DotInfo( cCommand ) - - HB_DotExec( cCommand ) - - IF s_nRow >= MaxRow() - Scroll( 2, 0, MaxRow(), MaxCol(), 1 ) - s_nRow := MaxRow() - 1 - ENDIF - - ENDDO + HB_DotPrompt() ENDIF RETURN +STATIC PROCEDURE HB_DotPrompt( cCommand ) + LOCAL GetList + LOCAL cLine + LOCAL nMaxRow, nMaxCol + LOCAL aHistory, nHistIndex + LOCAL bKeyUP, bKeyDown, bKeyIns + + CLEAR SCREEN + SET SCOREBOARD OFF + GetList := {} + aHistory := { padr( "quit", HB_LINE_LEN ) } + nHistIndex := 2 + + IF ISCHARACTER( cCommand ) + AADD( aHistory, PadR( cCommand, HB_LINE_LEN ) ) + HB_DotInfo( cCommand ) + HB_DotExec( cCommand ) + ELSE + cCommand := "" + ENDIF + + DO WHILE .T. + + IF cLine == NIL + cLine := Space( HB_LINE_LEN ) + ENDIF + + HB_DotInfo( cCommand ) + + nMaxRow := MaxRow() + nMaxCol := MaxCol() + @ nMaxRow, 0 SAY HB_PROMPT + @ nMaxRow, Col() GET cLine ; + PICTURE "@KS" + hb_NToS( nMaxCol - Col() + 1 ) + + SetCursor( IIF( ReadInsert(), SC_INSERT, SC_NORMAL ) ) + + bKeyIns := SetKey( K_INS, ; + {|| SetCursor( IIF( ReadInsert( !ReadInsert() ), ; + SC_NORMAL, SC_INSERT ) ) } ) + bKeyUp := SetKey( K_UP, ; + {|| IIF( nHistIndex > 1, ; + cLine := aHistory[ --nHistIndex ], ) } ) + bKeyDown := SetKey( K_DOWN, ; + {|| cLine := IIF( nHistIndex < LEN( aHistory ), ; + aHistory[ ++nHistIndex ], ; + ( nHistIndex := LEN( aHistory ) + 1, Space( HB_LINE_LEN ) ) ) } ) + + READ + + SetKey( K_DOWN, bKeyDown ) + SetKey( K_UP, bKeyUp ) + SetKey( K_INS, bKeyIns ) + + IF LastKey() == K_ESC .OR. EMPTY( cLine ) + cLine := NIL + IF nMaxRow != MaxRow() .OR. nMaxCol != MaxCol() + @ nMaxRow, 0 CLEAR + ENDIF + LOOP + ENDIF + + IF EMPTY( aHistory ) .OR. ! ATAIL( aHistory ) == cLine + IF LEN( aHistory ) < HB_HISTORY_LEN + AADD( aHistory, cLine ) + ELSE + ADEL( aHistory, 1 ) + aHistory[ LEN( aHistory ) ] := cLine + ENDIF + ENDIF + nHistIndex := LEN( aHistory ) + 1 + + cCommand := AllTrim( cLine, " " ) + cLine := NIL + @ nMaxRow, 0 CLEAR + HB_DotInfo( cCommand ) + + HB_DotExec( cCommand ) + + IF s_nRow >= MaxRow() + Scroll( 2, 0, MaxRow(), MaxCol(), 1 ) + s_nRow := MaxRow() - 1 + ENDIF + + ENDDO + + RETURN + /* ********************************************************************** */ STATIC PROCEDURE HB_DotUsage()