From 8a2e26e429c9fc826a58734610542303edc9745c Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Wed, 17 Oct 2012 22:59:28 +0000 Subject: [PATCH] 2012-10-18 00:55 UTC+0200 Viktor Szakats (harbour syenar.net) * contrib/hbnf/sysmem.prg * contrib/hbnf/readme.txt + Implemented FT_SYSMEM() * contrib/hbnf/dosver.c * contrib/hbnf/isshare.c * contrib/hbnf/kspeed.c * contrib/hbnf/mouse.c * contrib/hbnf/page.c * contrib/hbnf/setdate.c * contrib/hbnf/settime.c * contrib/hbnf/support.c * contrib/hbnf/vidmode.c ! fixed to #include (not "dos.h") * src/vm/fm.c + Memory( HB_MEM_FM ) to report low-memory on MS-DOS systems (build tested) * contrib/hbnf/nwsem.prg * contrib/hbnf/nwuid.prg * code cleanup, TODOs added --- harbour/ChangeLog | 24 ++++++++++++++++++++++++ harbour/contrib/hbnf/dosver.c | 2 +- harbour/contrib/hbnf/isshare.c | 2 +- harbour/contrib/hbnf/kspeed.c | 2 +- harbour/contrib/hbnf/mouse.c | 2 +- harbour/contrib/hbnf/nwsem.prg | 18 +++++++----------- harbour/contrib/hbnf/nwuid.prg | 12 +++--------- harbour/contrib/hbnf/page.c | 2 +- harbour/contrib/hbnf/readme.txt | 2 -- harbour/contrib/hbnf/setdate.c | 2 +- harbour/contrib/hbnf/settime.c | 2 +- harbour/contrib/hbnf/support.c | 2 +- harbour/contrib/hbnf/sysmem.prg | 11 ++--------- harbour/contrib/hbnf/vidmode.c | 2 +- harbour/src/vm/fm.c | 9 +++++++++ 15 files changed, 54 insertions(+), 40 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 821901d7f8..58544d490a 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,30 @@ The license applies to all entries newer than 2009-04-28. */ +2012-10-18 00:55 UTC+0200 Viktor Szakats (harbour syenar.net) + * contrib/hbnf/sysmem.prg + * contrib/hbnf/readme.txt + + Implemented FT_SYSMEM() + + * contrib/hbnf/dosver.c + * contrib/hbnf/isshare.c + * contrib/hbnf/kspeed.c + * contrib/hbnf/mouse.c + * contrib/hbnf/page.c + * contrib/hbnf/setdate.c + * contrib/hbnf/settime.c + * contrib/hbnf/support.c + * contrib/hbnf/vidmode.c + ! fixed to #include (not "dos.h") + + * src/vm/fm.c + + Memory( HB_MEM_FM ) to report low-memory on MS-DOS systems + (build tested) + + * contrib/hbnf/nwsem.prg + * contrib/hbnf/nwuid.prg + * code cleanup, TODOs added + 2012-10-18 00:32 UTC+0200 Viktor Szakats (harbour syenar.net) * src/3rd/tiff/Makefile - src/3rd/tiff/warning.c diff --git a/harbour/contrib/hbnf/dosver.c b/harbour/contrib/hbnf/dosver.c index e9197241fb..170a6c8c64 100644 --- a/harbour/contrib/hbnf/dosver.c +++ b/harbour/contrib/hbnf/dosver.c @@ -53,7 +53,7 @@ #include "hbapi.h" #if defined( HB_OS_DOS ) -# include "dos.h" +# include #endif HB_FUNC( FT_DOSVER ) diff --git a/harbour/contrib/hbnf/isshare.c b/harbour/contrib/hbnf/isshare.c index 97cdfdf19d..a5ea1043b5 100644 --- a/harbour/contrib/hbnf/isshare.c +++ b/harbour/contrib/hbnf/isshare.c @@ -53,7 +53,7 @@ #include "hbapi.h" #if defined( HB_OS_DOS ) -# include "dos.h" +# include #endif HB_FUNC( FT_ISSHARE ) diff --git a/harbour/contrib/hbnf/kspeed.c b/harbour/contrib/hbnf/kspeed.c index e4048f76a0..7cb91daa03 100644 --- a/harbour/contrib/hbnf/kspeed.c +++ b/harbour/contrib/hbnf/kspeed.c @@ -26,7 +26,7 @@ #include "hbapi.h" #if defined( HB_OS_DOS ) -# include "dos.h" +# include #endif HB_FUNC( FT_SETRATE ) diff --git a/harbour/contrib/hbnf/mouse.c b/harbour/contrib/hbnf/mouse.c index 68739f4bc5..63c4d99b1e 100644 --- a/harbour/contrib/hbnf/mouse.c +++ b/harbour/contrib/hbnf/mouse.c @@ -53,7 +53,7 @@ #include "hbapi.h" #if defined( HB_OS_DOS ) -# include "dos.h" +# include #endif HB_FUNC( FT_MGETPAGE ) diff --git a/harbour/contrib/hbnf/nwsem.prg b/harbour/contrib/hbnf/nwsem.prg index 99e2d2d678..470a8b1e6c 100644 --- a/harbour/contrib/hbnf/nwsem.prg +++ b/harbour/contrib/hbnf/nwsem.prg @@ -38,15 +38,11 @@ #include "ftint86.ch" -#define INT21 33 - #define WAIT_SEMAPHORE 2 #define SIGNAL_SEMAPHORE 3 #define CLOSE_SEMAPHORE 4 -// Sorry this test routine is pretty lame but it sort of gets -// the point across - +/* TODO: rewrite in C */ FUNCTION ft_nwSemOpen( cName, nInitVal, nHandle, nOpenCnt ) LOCAL aRegs[ INT86_MAX_REGS ], cRequest, nRet @@ -64,7 +60,7 @@ FUNCTION ft_nwSemOpen( cName, nInitVal, nHandle, nOpenCnt ) aRegs[ DX ] := REG_DS aRegs[ CX ] := nInitVal - ft_int86( INT21, aRegs ) + ft_int86( 33, aRegs ) nHandle := Bin2L( I2Bin( aRegs[ CX ] ) + I2Bin( aRegs[ DX ] ) ) nOpenCnt := LOWBYTE( aRegs[ BX ] ) @@ -73,6 +69,7 @@ FUNCTION ft_nwSemOpen( cName, nInitVal, nHandle, nOpenCnt ) RETURN iif( nRet < 0, nRet + 256, nRet ) +/* TODO: rewrite in C */ FUNCTION ft_nwSemEx( nHandle, nValue, nOpenCnt ) LOCAL aRegs[ INT86_MAX_REGS ], nRet @@ -85,7 +82,7 @@ FUNCTION ft_nwSemEx( nHandle, nValue, nOpenCnt ) aRegs[ CX ] := Bin2I( hb_BSubStr( L2Bin( nHandle ), 1, 2 ) ) aRegs[ DX ] := Bin2I( hb_BSubStr( L2Bin( nHandle ), 3, 2 ) ) - ft_int86( INT21, aRegs ) + ft_int86( 33, aRegs ) nValue := aRegs[ CX ] nOpenCnt := LOWBYTE( aRegs[ DX ] ) @@ -109,6 +106,7 @@ FUNCTION ft_nwSemClose( nHandle ) // _ftnwsem() - internal for the semaphore package // --------------------------------------------------------- +/* TODO: rewrite in C */ STATIC FUNCTION _ftnwsem( nOp, nHandle, nTimeout ) LOCAL aRegs[ INT86_MAX_REGS ], nRet @@ -122,7 +120,7 @@ STATIC FUNCTION _ftnwsem( nOp, nHandle, nTimeout ) aRegs[ DX ] := Bin2I( hb_BSubStr( L2Bin( nHandle ), 3, 2 ) ) aRegs[ BP ] := nTimeout - ft_int86( INT21, aRegs ) + ft_int86( 33, aRegs ) nRet := LOWBYTE( aRegs[ AX ] ) nRet := iif( nRet < 0, nRet + 256, nRet ) @@ -130,10 +128,8 @@ STATIC FUNCTION _ftnwsem( nOp, nHandle, nTimeout ) FUNCTION ft_nwSemLock( cSemaphore, nHandle ) - LOCAL nRc LOCAL nOpenCnt := 0 - - nRc := FT_NWSEMOPEN( cSemaphore, 0, @nHandle, @nOpenCnt ) + LOCAL nRc := FT_NWSEMOPEN( cSemaphore, 0, @nHandle, @nOpenCnt ) IF nRc == 0 IF nOpenCnt != 1 diff --git a/harbour/contrib/hbnf/nwuid.prg b/harbour/contrib/hbnf/nwuid.prg index c71edb7c9b..46e53caa86 100644 --- a/harbour/contrib/hbnf/nwuid.prg +++ b/harbour/contrib/hbnf/nwuid.prg @@ -33,9 +33,6 @@ #include "ftint86.ch" -#define DOS 33 -#define NW_LOG 227 - FUNCTION FT_NWUID( nConn ) LOCAL aRegs[ INT86_MAX_REGS ] @@ -45,23 +42,20 @@ FUNCTION FT_NWUID( nConn ) nConn := iif( nConn == NIL, FT_NWLSTAT(), nConn ) // Set up request packet - - cReqPkt := hb_BChar( 22 ) // Function 22: Get Connection Information + cReqPkt := hb_BChar( 22 ) // Get Connection Information cReqPkt += hb_BChar( nConn ) cReqPkt := I2Bin( hb_BLen( cReqPkt ) ) + cReqPkt // Set up reply packet - cRepPkt := Space( 63 ) // Assign registers - - aRegs[ AX ] := MAKEHI( NW_LOG ) + aRegs[ AX ] := MAKEHI( 227 ) // NW_LOG aRegs[ DS ] := cReqPkt aRegs[ SI ] := REG_DS aRegs[ ES ] := cRepPkt aRegs[ DI ] := REG_ES - FT_INT86( DOS, aRegs ) + FT_INT86( 33, aRegs ) RETURN AllTrim( StrTran( hb_BSubStr( aRegs[ ES ], 9, 48 ), hb_BChar( 0 ) ) ) diff --git a/harbour/contrib/hbnf/page.c b/harbour/contrib/hbnf/page.c index f4c1c2853d..763896b6fd 100644 --- a/harbour/contrib/hbnf/page.c +++ b/harbour/contrib/hbnf/page.c @@ -53,7 +53,7 @@ #include "hbapi.h" #if defined( HB_OS_DOS ) -# include "dos.h" +# include #endif HB_FUNC( FT_GETVPG ) diff --git a/harbour/contrib/hbnf/readme.txt b/harbour/contrib/hbnf/readme.txt index 8e094ff980..d8090495ab 100644 --- a/harbour/contrib/hbnf/readme.txt +++ b/harbour/contrib/hbnf/readme.txt @@ -15,6 +15,4 @@ nwuid.prg FT_NWUID() scancode.prg FT_SCANCODE() -sysmem.prg FT_SYSMEM() - vidcur.prg FT_GETVCUR(), FT_SETVCUR() diff --git a/harbour/contrib/hbnf/setdate.c b/harbour/contrib/hbnf/setdate.c index f83ca14196..bb502e7bd2 100644 --- a/harbour/contrib/hbnf/setdate.c +++ b/harbour/contrib/hbnf/setdate.c @@ -79,7 +79,7 @@ #include "hbdate.h" #if defined( HB_OS_DOS ) -# include "dos.h" +# include #endif HB_FUNC( FT_SETDATE ) diff --git a/harbour/contrib/hbnf/settime.c b/harbour/contrib/hbnf/settime.c index 30fcf5c662..f9b868d9ea 100644 --- a/harbour/contrib/hbnf/settime.c +++ b/harbour/contrib/hbnf/settime.c @@ -79,7 +79,7 @@ #include "hbdate.h" #if defined( HB_OS_DOS ) -# include "dos.h" +# include #endif HB_FUNC( FT_SETTIME ) diff --git a/harbour/contrib/hbnf/support.c b/harbour/contrib/hbnf/support.c index f199191396..7d835f957d 100644 --- a/harbour/contrib/hbnf/support.c +++ b/harbour/contrib/hbnf/support.c @@ -54,7 +54,7 @@ #include "hbapiitm.h" #if defined( HB_OS_DOS ) -# include "dos.h" +# include #endif HB_FUNC( _FT_NWKSTAT ) diff --git a/harbour/contrib/hbnf/sysmem.prg b/harbour/contrib/hbnf/sysmem.prg index f6b6097d9d..431250b308 100644 --- a/harbour/contrib/hbnf/sysmem.prg +++ b/harbour/contrib/hbnf/sysmem.prg @@ -29,15 +29,8 @@ * */ -#include "ftint86.ch" - -#define MEMSIZE 18 +#include "hbmemory.ch" FUNCTION FT_SYSMEM() - LOCAL aRegs[ INT86_MAX_REGS ] - - aRegs[ AX ] := 0 - FT_INT86( MEMSIZE, aRegs ) - - RETURN aRegs[ AX ] + RETURN Memory( HB_MEM_FM ) diff --git a/harbour/contrib/hbnf/vidmode.c b/harbour/contrib/hbnf/vidmode.c index 7cc4d6c379..9f8f3165b5 100644 --- a/harbour/contrib/hbnf/vidmode.c +++ b/harbour/contrib/hbnf/vidmode.c @@ -78,7 +78,7 @@ #include "hbapi.h" #if defined( HB_OS_DOS ) -# include "dos.h" +# include #endif HB_FUNC( FT_SETMODE ) diff --git a/harbour/src/vm/fm.c b/harbour/src/vm/fm.c index 866191052b..cde297f425 100644 --- a/harbour/src/vm/fm.c +++ b/harbour/src/vm/fm.c @@ -98,6 +98,8 @@ #if defined( HB_OS_WIN ) # include +#elif defined( HB_OS_DOS ) +# include #endif #if defined( HB_MT_VM ) @@ -1339,6 +1341,13 @@ HB_SIZE hb_xquery( int iMode ) else nResult = ulSysInfo / 1024; } +#elif defined( HB_OS_DOS ) + { + union REGS regs; + regs.HB_XREGS.ax = 0; + HB_DOS_INT86( 0x12, ®s, ®s ); + iMode = regs.h.al; + } #else nResult = 9999; #endif