diff --git a/harbour/ChangeLog b/harbour/ChangeLog index e7c4fa25f5..f02045e00c 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,33 @@ +20000417-11:05 GMT+1 Ryszard Glab + + *include/hbsetup.h + *added automatic recognition of target platform for Watcom compiler + Now HB_OS_DOS is correctly set for this compiler + + *include/hbdefs.h + *added definition of HB_XREGS - this should be used to access + a word size member of REGS union structure (Watcom uses different + naming scheme) - for example: + union REGS regs; + regs.HB_XREGS.ax = 1; + + *source/rtl/filesys.c + *fixed support for Watcom compiler + + *source/rtl/diskspac.c + *source/rtl/inkey.c + *source/rtl/isprint.c + *source/rtl/net.c + *source/rtl/gtdos/gtdos.c + *source/rtl/gtdos/mousedos.c + *changed to use HB_XREGS + + *source/rtl/gtapi.c + *fixed printing using console output + + *source/rtl/gtcrs/gtcrs.c + *altarnate characters set is disabled for xterm + 20000417-06:32 GMT+1 Victor Szakats * source/vm/asort.c diff --git a/harbour/include/hbdefs.h b/harbour/include/hbdefs.h index defe38b240..2fc17d34f6 100644 --- a/harbour/include/hbdefs.h +++ b/harbour/include/hbdefs.h @@ -85,12 +85,15 @@ #if defined(__WATCOMC__) && defined(__386__) && !defined(__WINDOWS_386__) #define HB_DOS_INT86 int386 #define HB_DOS_INT86X int386x + #define HB_XREGS w #elif defined(__RSX32__) #define HB_DOS_INT86 _int86 #define HB_DOS_INT86X _int86x + #define HB_XREGS x #else #define HB_DOS_INT86 int86 #define HB_DOS_INT86X int86x + #define HB_XREGS x #endif #endif diff --git a/harbour/include/hbsetup.h b/harbour/include/hbsetup.h index 274271ffb2..79bd3bcf93 100644 --- a/harbour/include/hbsetup.h +++ b/harbour/include/hbsetup.h @@ -198,6 +198,20 @@ * Platform detection */ +#ifdef __WATCOMC__ + #if defined(__OS2__) + #define HB_OS_OS2 + #elif defined(__NT__) || defined(__WINDOWS_386__) || defined(__WINDOWS__) + #define HB_OS_WIN_32 + #elif defined(__386__) + #define HB_OS_DOS + #define HB_OS_DOS_32 + #else + #define HB_OS_DOS + #define HB_OS_DOS_16 + #endif +#endif + #ifndef HB_OS_DOS #if defined(DOS) || defined(_QC) || defined(__DOS__) || defined(MSDOS) || defined(__MSDOS__) || defined(__RSX32__) #define HB_OS_DOS diff --git a/harbour/source/rtl/diskspac.c b/harbour/source/rtl/diskspac.c index 2dd93b4704..c6f1163c0f 100644 --- a/harbour/source/rtl/diskspac.c +++ b/harbour/source/rtl/diskspac.c @@ -65,18 +65,18 @@ HB_FUNC( DISKSPACE ) while( TRUE ) { union REGS regs; - - regs.x.dx = uiDrive; + + regs.HB_XREGS.dx = uiDrive; regs.h.ah = 0x36; HB_DOS_INT86( 0x21, ®s, ®s ); - - if( regs.x.ax != 0xFFFF ) + + if( regs.HB_XREGS.ax != 0xFFFF ) { - USHORT uiClusterTotal = regs.x.dx; - USHORT uiClusterFree = regs.x.bx; - USHORT uiSecPerCluster = regs.x.ax; - USHORT uiSectorSize = regs.x.cx; - + USHORT uiClusterTotal = regs.HB_XREGS.dx; + USHORT uiClusterFree = regs.HB_XREGS.bx; + USHORT uiSecPerCluster = regs.HB_XREGS.ax; + USHORT uiSectorSize = regs.HB_XREGS.cx; + switch( uiType ) { case HB_DISK_AVAIL: @@ -85,13 +85,13 @@ HB_FUNC( DISKSPACE ) ( double ) uiSecPerCluster * ( double ) uiSectorSize; break; - + case HB_DISK_USED: case HB_DISK_TOTAL: dSpace = ( double ) uiClusterTotal * ( double ) uiSecPerCluster * ( double ) uiSectorSize; - + if( uiType == HB_DISK_USED ) dSpace -= ( double ) uiClusterFree * ( double ) uiSecPerCluster * @@ -102,12 +102,12 @@ HB_FUNC( DISKSPACE ) else { USHORT uiAction = hb_errRT_BASE_Ext1( EG_OPEN, 2018, NULL, NULL, 0, EF_CANDEFAULT ); - + /* NOTE: Under 'Standard' behaviour, this error does not allow 'retry' but if you should wish to make it so, then or EF_CANRETRY with EF_CANDEFAULT above) */ - + if( uiAction == E_RETRY ) continue; } @@ -122,41 +122,41 @@ HB_FUNC( DISKSPACE ) { typedef BOOL (WINAPI *P_GDFSE)(LPCTSTR, PULARGE_INTEGER, PULARGE_INTEGER, PULARGE_INTEGER); - + char szPath[ 4 ]; P_GDFSE pGetDiskFreeSpaceEx; UINT uiErrMode; - + /* Get the default drive */ - + if( uiDrive == 0 ) { USHORT uiErrorOld = hb_fsError(); - + uiDrive = hb_fsCurDrv() + 1; - + hb_fsSetError( uiErrorOld ); } - + szPath[ 0 ] = uiDrive + 'A' - 1; szPath[ 1 ] = ':'; szPath[ 2 ] = '\\'; szPath[ 3 ] = '\0'; - + uiErrMode = SetErrorMode( SEM_FAILCRITICALERRORS ); - + SetLastError( 0 ); - + pGetDiskFreeSpaceEx = ( P_GDFSE ) GetProcAddress( GetModuleHandle( "kernel32.dll" ), "GetDiskFreeSpaceExA"); - + if( pGetDiskFreeSpaceEx ) { ULARGE_INTEGER i64FreeBytesToCaller, i64TotalBytes, i64FreeBytes, i64RetVal; - + if( pGetDiskFreeSpaceEx( szPath, ( PULARGE_INTEGER ) &i64FreeBytesToCaller, ( PULARGE_INTEGER ) &i64TotalBytes, @@ -167,23 +167,23 @@ HB_FUNC( DISKSPACE ) case HB_DISK_AVAIL: memcpy( &i64RetVal, &i64FreeBytesToCaller, sizeof( ULARGE_INTEGER ) ); break; - + case HB_DISK_FREE: memcpy( &i64RetVal, &i64FreeBytes, sizeof( ULARGE_INTEGER ) ); break; - + case HB_DISK_USED: case HB_DISK_TOTAL: memcpy( &i64RetVal, &i64TotalBytes, sizeof( ULARGE_INTEGER ) ); } - + #if (defined(__GNUC__) || defined(_MSC_VER)) && !defined(__RSXNT__) - + dSpace = ( double ) i64RetVal.LowPart + ( double ) i64RetVal.HighPart + ( double ) i64RetVal.HighPart * ( double ) 0xFFFFFFFF; - + if( uiType == HB_DISK_USED ) { dSpace -= ( double ) i64FreeBytes.LowPart + @@ -191,18 +191,18 @@ HB_FUNC( DISKSPACE ) ( double ) i64FreeBytes.HighPart * ( double ) 0xFFFFFFFF; } - + #else - + /* NOTE: Borland doesn't seem to deal with the un-named struct that is part of ULARGE_INTEGER [pt] */ - + dSpace = ( double ) i64RetVal.u.LowPart + ( double ) i64RetVal.u.HighPart + ( double ) i64RetVal.u.HighPart * ( double ) 0xFFFFFFFF; - + if( uiType == HB_DISK_USED ) { dSpace -= ( double ) i64FreeBytes.u.LowPart + @@ -210,7 +210,7 @@ HB_FUNC( DISKSPACE ) ( double ) i64FreeBytes.u.HighPart * ( double ) 0xFFFFFFFF; } - + #endif } } @@ -220,9 +220,9 @@ HB_FUNC( DISKSPACE ) DWORD dwBytesPerSector; DWORD dwNumberOfFreeClusters; DWORD dwTotalNumberOfClusters; - + SetLastError( 0 ); - + if( GetDiskFreeSpace( szPath, &dwSectorsPerCluster, &dwBytesPerSector, @@ -237,34 +237,34 @@ HB_FUNC( DISKSPACE ) ( double ) dwSectorsPerCluster * ( double ) dwBytesPerSector; break; - + case HB_DISK_USED: case HB_DISK_TOTAL: dSpace = ( double ) dwTotalNumberOfClusters * ( double ) dwSectorsPerCluster * ( double ) dwBytesPerSector; - + if( uiType == HB_DISK_USED ) dSpace -= ( double ) dwNumberOfFreeClusters * ( double ) dwSectorsPerCluster * ( double ) dwBytesPerSector; break; - + } } } - + SetErrorMode( uiErrMode ); - + if( GetLastError() != 0 ) { USHORT uiAction = hb_errRT_BASE_Ext1( EG_OPEN, 2018, NULL, NULL, 0, EF_CANDEFAULT ); - + /* NOTE: Under 'Standard' behaviour, this error does not allow 'retry' but if you should wish to make it so, then or EF_CANRETRY with EF_CANDEFAULT above) */ - + if( uiAction == E_RETRY ) continue; } @@ -277,21 +277,21 @@ HB_FUNC( DISKSPACE ) { struct _FSALLOCATE fsa; USHORT rc; - + /* Query level 1 info from filesystem */ while( ( rc = DosQueryFSInfo( uiDrive, 1, &fsa, sizeof( fsa ) ) ) != 0 ) { USHORT uiAction = hb_errRT_BASE_Ext1( EG_OPEN, 2018, NULL, NULL, 0, EF_CANDEFAULT ); - + /* NOTE: Under 'Standard' behaviour, this error does not allow 'retry' but if you should wish to make it so, then or EF_CANRETRY with EF_CANDEFAULT above) */ - + if( uiAction != E_RETRY ) break; } - + if( rc == 0 ) { switch( uiType ) @@ -302,13 +302,13 @@ HB_FUNC( DISKSPACE ) ( double ) fsa.cSectorUnit * ( double ) fsa.cbSector; break; - + case HB_DISK_USED: case HB_DISK_TOTAL: dSpace = ( double ) fsa.cUnit * ( double ) fsa.cSectorUnit * ( double ) fsa.cbSector; - + if( uiType == HB_DISK_USED ) dSpace -= ( double ) fsa.cUnitAvail * ( double ) fsa.cSectorUnit * diff --git a/harbour/source/rtl/filesys.c b/harbour/source/rtl/filesys.c index 9bf8f2464b..36b33ca4f9 100644 --- a/harbour/source/rtl/filesys.c +++ b/harbour/source/rtl/filesys.c @@ -1128,25 +1128,7 @@ USHORT hb_fsChDrv( BYTE nDrive ) #if defined(HB_FS_DRIVE_LETTER) - { - USHORT uiSave = _getdrive(); - - errno = 0; - _chdrive( nDrive + 1 ); - if( ( nDrive + 1 ) == _getdrive() ) - { - uiResult = 0; - s_uiErrorLast = errno; - } - else - { - _chdrive( uiSave ); - uiResult = FS_ERROR; - s_uiErrorLast = FS_ERROR; - } - } - -#elif defined( __WATCOMC__ ) + #if defined( __WATCOMC__ ) { /* 'unsigned int' _have to_ be used in Watcom @@ -1173,7 +1155,25 @@ USHORT hb_fsChDrv( BYTE nDrive ) s_uiErrorLast = FS_ERROR; } } + #else + { + USHORT uiSave = _getdrive(); + errno = 0; + _chdrive( nDrive + 1 ); + if( ( nDrive + 1 ) == _getdrive() ) + { + uiResult = 0; + s_uiErrorLast = errno; + } + else + { + _chdrive( uiSave ); + uiResult = FS_ERROR; + s_uiErrorLast = FS_ERROR; + } + } + #endif #else uiResult = FS_ERROR; @@ -1198,26 +1198,7 @@ USHORT hb_fsIsDrv( BYTE nDrive ) #if defined(HB_FS_DRIVE_LETTER) - { - USHORT uiSave = _getdrive(); - - errno = 0; - _chdrive( nDrive + 1 ); - if( ( nDrive + 1 ) == _getdrive() ) - { - uiResult = 0; - s_uiErrorLast = errno; - } - else - { - uiResult = FS_ERROR; - s_uiErrorLast = FS_ERROR; - } - - _chdrive( uiSave ); - } - -#elif defined( __WATCOMC__ ) + #if defined( __WATCOMC__ ) { /* 'unsigned int' _have to_ be used in Watcom @@ -1241,6 +1222,26 @@ USHORT hb_fsIsDrv( BYTE nDrive ) } _dos_setdrive( uiSave, &uiTotal ); } + #else + { + USHORT uiSave = _getdrive(); + + errno = 0; + _chdrive( nDrive + 1 ); + if( ( nDrive + 1 ) == _getdrive() ) + { + uiResult = 0; + s_uiErrorLast = errno; + } + else + { + uiResult = FS_ERROR; + s_uiErrorLast = FS_ERROR; + } + + _chdrive( uiSave ); + } + #endif #else diff --git a/harbour/source/rtl/gtapi.c b/harbour/source/rtl/gtapi.c index 9c4150e2eb..1c58830fd0 100644 --- a/harbour/source/rtl/gtapi.c +++ b/harbour/source/rtl/gtapi.c @@ -162,7 +162,7 @@ USHORT hb_gtBox( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, B uiMaxRow = hb_gt_GetScreenHeight(); uiMaxCol = hb_gt_GetScreenWidth(); - /* TODO: Would be better to support these cases, Clipper implementation was + /* TODO: Would be better to support these cases, Clipper implementation was quite messy, which can be considered as a bug there. [vszakats] */ if( uiTop < uiMaxRow && uiBottom < uiMaxRow && @@ -178,10 +178,10 @@ USHORT hb_gtBox( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, B USHORT uiTopBak = uiTop; USHORT uiLeftBak = uiLeft; - - /* NOTE: For full compatibility, pad box string with last char if too + + /* NOTE: For full compatibility, pad box string with last char if too short [vszakats] */ - + { USHORT tmp; @@ -192,7 +192,7 @@ USHORT hb_gtBox( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, B szBox[ tmp++ ] = cPadChar; szBox[ tmp ] = '\0'; } - + /* Ensure that box is drawn from top left to bottom right. */ if( uiTop > uiBottom ) { @@ -206,27 +206,27 @@ USHORT hb_gtBox( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, B uiLeft = uiRight; uiRight = tmp; } - + uiRow = uiTop; uiCol = uiLeft; - + /* Draw the box or line as specified */ uiHeight = uiBottom - uiTop + 1; uiWidth = uiRight - uiLeft + 1; - + hb_gtDispBegin(); - + if( uiHeight > 1 && uiWidth > 1 ) hb_gtWriteAt( uiRow, uiCol, szBox + 0, sizeof( BYTE ) ); /* Upper left corner */ - + uiCol = ( uiHeight > 1 ? uiLeft + 1 : uiLeft ); - + if( uiCol <= uiRight ) hb_gtRepChar( uiRow, uiCol, szBox[ 1 ], uiRight - uiLeft + ( uiHeight > 1 ? -1 : 1 ) ); /* Top line */ - + if( uiHeight > 1 && uiWidth > 1 ) hb_gtWriteAt( uiRow, uiRight, szBox + 2, sizeof( BYTE ) ); /* Upper right corner */ - + if( szBox[ 8 ] && uiHeight > 2 && uiWidth > 2 ) { for( uiRow = uiTop + 1; uiRow < uiBottom; uiRow++ ) @@ -246,23 +246,23 @@ USHORT hb_gtBox( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, B hb_gtWriteAt( uiRow, uiRight, szBox + 3, sizeof( BYTE ) ); /* Right side */ } } - + if( uiHeight > 1 && uiWidth > 1 ) { hb_gtWriteAt( uiBottom, uiLeft, szBox + 6, sizeof( BYTE ) ); /* Bottom left corner */ - + uiCol = ( uiHeight > 1 ? uiLeft + 1 : uiLeft ); - + if( uiCol <= uiRight && uiHeight > 1 ) hb_gtRepChar( uiBottom, uiCol, szBox[ 5 ], uiRight - uiLeft + ( uiHeight > 1 ? -1 : 1 ) ); /* Bottom line */ - + hb_gtWriteAt( uiBottom, uiRight, szBox + 4, sizeof( BYTE ) ); /* Bottom right corner */ } - + hb_gtDispEnd(); - + hb_gtSetPos( uiTopBak + 1, uiLeftBak + 1 ); - + return 0; } else @@ -367,8 +367,8 @@ USHORT hb_gtPostExt( void ) return 0; } -/* NOTE: szColorString must be at least CLR_STRLEN wide by the NG. It seems - that CA-Cl*pper SETCOLOR() will return string lengths up to 131+EOF. +/* NOTE: szColorString must be at least CLR_STRLEN wide by the NG. It seems + that CA-Cl*pper SETCOLOR() will return string lengths up to 131+EOF. That seems like a 127+1 buffer size, plus lazy overflow checking. [vszakats] */ @@ -417,8 +417,8 @@ USHORT hb_gtGetColorStr( char * pszColorString ) if( j == 0 ) { /* NOTE: When STRICT is on, Harbour will put both the "*" and "+" - chars to the first half of the colorspec (like "W*+/B"), - which is quite ugly, otherwise it will put the "+" to the + chars to the first half of the colorspec (like "W*+/B"), + which is quite ugly, otherwise it will put the "+" to the first half and the "*" to the second (like "W+/B*"), which is how it should be done. [vszakats] */ @@ -630,7 +630,7 @@ USHORT hb_gtSetCursor( USHORT uiCursorStyle ) if( uiCursorStyle <= SC_SPECIAL2 ) { /* Set the cursor only when, it's in bounds. */ - if( s_iRow >= 0 && s_iRow < hb_gt_GetScreenHeight() && + if( s_iRow >= 0 && s_iRow < hb_gt_GetScreenHeight() && s_iCol >= 0 && s_iCol < hb_gt_GetScreenWidth() ) hb_gt_SetCursorStyle( uiCursorStyle ); @@ -678,7 +678,7 @@ USHORT hb_gtSetPos( SHORT iRow, SHORT iCol ) hb_gt_SetPos( iRow, iCol ); /* If cursor was out bounds, now enable it */ - if( s_iRow < 0 || s_iRow >= uiMaxRow || + if( s_iRow < 0 || s_iRow >= uiMaxRow || s_iCol < 0 || s_iCol >= uiMaxCol ) hb_gt_SetCursorStyle( s_uiCursorStyle ); } @@ -721,7 +721,7 @@ USHORT hb_gtRectSize( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRig return 0; } -/* NOTE: Above this buffer size the function will allocate dynamic memory and +/* NOTE: Above this buffer size the function will allocate dynamic memory and will be slower. [vszakats] */ #define REPCHAR_BUFFER_SIZE 255 @@ -921,15 +921,14 @@ USHORT hb_gtWriteCon( BYTE * pStr, ULONG ulLength ) case HB_CHAR_CR: iCol = 0; - if( *pStr != HB_CHAR_LF ) - bDisp = TRUE; - else + if( *pStr == HB_CHAR_LF ) { if( iRow >= 0 ) ++iRow; - bDisp = TRUE; bNewLine = TRUE; ++pStr; + --ulLength; } + bDisp = TRUE; break; default: diff --git a/harbour/source/rtl/gtcrs/gtcrs.c b/harbour/source/rtl/gtcrs/gtcrs.c index 59aa8e9b10..8b2a18823a 100644 --- a/harbour/source/rtl/gtcrs/gtcrs.c +++ b/harbour/source/rtl/gtcrs/gtcrs.c @@ -125,16 +125,17 @@ static void hb_gt_Initialize_Terminal( void ) */ if( s_under_buggy_xterm ) { +/* char * str; - str = tigetstr( "enacs" ); /* enable alt character set */ + str = tigetstr( "enacs" ); / * enable alt character set * / if( (str != NULL) && (str != (char *)-1) ) write( fileno(stdout), str, strlen(str) ); - str = tigetstr( "smacs" ); /* start alt characters set */ + str = tigetstr( "smacs" ); / * start alt characters set * / if( (str != NULL) && (str != (char *)-1) ) write( fileno(stdout), str, strlen(str) ); - +*/ s_alternate_char_set = 0; } else diff --git a/harbour/source/rtl/gtdos/gtdos.c b/harbour/source/rtl/gtdos/gtdos.c index e9cbb804ba..fdd7e4527f 100644 --- a/harbour/source/rtl/gtdos/gtdos.c +++ b/harbour/source/rtl/gtdos/gtdos.c @@ -75,7 +75,7 @@ /* For screen support */ #if defined(__POWERC) || (defined(__TURBOC__) && !defined(__BORLANDC__)) || (defined(__ZTC__) && !defined(__SC__)) #define FAR far -#elif defined(HB_OS_DOS) && !defined(__DJGPP__) && !defined(__RSX32__) +#elif defined(HB_OS_DOS) && !defined(__DJGPP__) && !defined(__RSX32__) && !defined(__WATCOMC__) #define FAR _far #else #define FAR @@ -119,7 +119,7 @@ static int kbhit( void ) regs.h.ah = 0x0B; HB_DOS_INT86( 0x21, ®s, ®s ); - return regs.x.ax; + return regs.HB_XREGS.ax; } #endif @@ -952,8 +952,8 @@ void hb_gt_Tone( double dFrequency, double dDuration ) while( dDuration > 0.0 ) { - /* Use USHORT, because this variable gets added to clock() - to form end_clock and we want to minimize overflow risk */ + /* Use USHORT, because this variable gets added to clock() + to form end_clock and we want to minimize overflow risk */ USHORT temp = ( USHORT ) HB_MIN( HB_MAX( 0, dDuration ), USHRT_MAX ); clock_t end_clock; diff --git a/harbour/source/rtl/gtdos/mousedos.c b/harbour/source/rtl/gtdos/mousedos.c index dd2236b966..7bfac3aba8 100644 --- a/harbour/source/rtl/gtdos/mousedos.c +++ b/harbour/source/rtl/gtdos/mousedos.c @@ -48,10 +48,10 @@ void hb_mouse_Init( void ) { union REGS regs; - regs.x.ax = 0; + regs.HB_XREGS.ax = 0; HB_DOS_INT86( 0x33, ®s, ®s ); - s_bPresent = regs.x.ax; - s_iButtons = regs.x.bx; + s_bPresent = regs.HB_XREGS.ax; + s_iButtons = regs.HB_XREGS.bx; if( s_bPresent ) { @@ -77,7 +77,7 @@ void hb_mouse_Show( void ) { union REGS regs; - regs.x.ax = 1; + regs.HB_XREGS.ax = 1; HB_DOS_INT86( 0x33, ®s, ®s ); s_bCursorVisible = TRUE; @@ -91,7 +91,7 @@ void hb_mouse_Hide( void ) { union REGS regs; - regs.x.ax = 2; + regs.HB_XREGS.ax = 2; HB_DOS_INT86( 0x33, ®s, ®s ); s_bCursorVisible = FALSE; @@ -104,10 +104,10 @@ int hb_mouse_Col( void ) { union REGS regs; - regs.x.ax = 3; + regs.HB_XREGS.ax = 3; HB_DOS_INT86( 0x33, ®s, ®s ); - return regs.x.cx / 8; + return regs.HB_XREGS.cx / 8; } else return -1; @@ -119,10 +119,10 @@ int hb_mouse_Row( void ) { union REGS regs; - regs.x.ax = 3; + regs.HB_XREGS.ax = 3; HB_DOS_INT86( 0x33, ®s, ®s ); - return regs.x.dx / 8; + return regs.HB_XREGS.dx / 8; } else return -1; @@ -134,9 +134,9 @@ void hb_mouse_SetPos( int iRow, int iCol ) { union REGS regs; - regs.x.ax = 4; - regs.x.cx = iRow * 8; - regs.x.dx = iCol * 8; + regs.HB_XREGS.ax = 4; + regs.HB_XREGS.cx = iRow * 8; + regs.HB_XREGS.dx = iCol * 8; HB_DOS_INT86( 0x33, ®s, ®s ); } } @@ -147,11 +147,11 @@ BOOL hb_mouse_IsButtonPressed( int iButton ) { union REGS regs; - regs.x.ax = 5; - regs.x.bx = iButton; + regs.HB_XREGS.ax = 5; + regs.HB_XREGS.bx = iButton; HB_DOS_INT86( 0x33, ®s, ®s ); - return regs.x.bx ? TRUE : FALSE; + return regs.HB_XREGS.bx ? TRUE : FALSE; } else return FALSE; @@ -163,10 +163,10 @@ int hb_mouse_CountButton( void ) { union REGS regs; - regs.x.ax = 3; + regs.HB_XREGS.ax = 3; HB_DOS_INT86( 0x33, ®s, ®s ); - return regs.x.bx; + return regs.HB_XREGS.bx; } else return 0; @@ -181,17 +181,17 @@ void hb_mouse_SetBounds( int iTop, int iLeft, int iBottom, int iRight ) iLeft *= 8; iRight *= 8; - regs.x.ax = 7; - regs.x.cx = iLeft; - regs.x.dx = iRight; + regs.HB_XREGS.ax = 7; + regs.HB_XREGS.cx = iLeft; + regs.HB_XREGS.dx = iRight; HB_DOS_INT86( 0x33, ®s, ®s ); iTop *= 8; iBottom *= 8; - regs.x.ax = 8; - regs.x.cx = iTop; - regs.x.dx = iBottom; + regs.HB_XREGS.ax = 8; + regs.HB_XREGS.cx = iTop; + regs.HB_XREGS.dx = iBottom; HB_DOS_INT86( 0x33, ®s, ®s ); } } @@ -202,15 +202,15 @@ void hb_mouse_GetBounds( int * piTop, int * piLeft, int * piBottom, int * piRigh { union REGS regs; - regs.x.ax = 7; + regs.HB_XREGS.ax = 7; HB_DOS_INT86( 0x33, ®s, ®s ); - *piLeft = regs.x.cx / 8; - *piRight = regs.x.dx / 8; + *piLeft = regs.HB_XREGS.cx / 8; + *piRight = regs.HB_XREGS.dx / 8; - regs.x.ax = 8; + regs.HB_XREGS.ax = 8; HB_DOS_INT86( 0x33, ®s, ®s ); - *piTop = regs.x.cx / 8; - *piBottom = regs.x.dx / 8; + *piTop = regs.HB_XREGS.cx / 8; + *piBottom = regs.HB_XREGS.dx / 8; } } diff --git a/harbour/source/rtl/inkey.c b/harbour/source/rtl/inkey.c index a5098981ec..77577dcf70 100644 --- a/harbour/source/rtl/inkey.c +++ b/harbour/source/rtl/inkey.c @@ -81,11 +81,11 @@ void hb_releaseCPU( void ) /* NOTE: there is a bug under NT 4 and 2000 - if the app is running in protected mode, time slices will _not_ be released - you must switch to real mode first, execute the following, and switch back. - + It just occurred to me that this is actually by design. Since MS doesn't want you to do this from a console app, their solution was to not allow the call to work in protected mode - screw the rest of the planet . - + returns zero on failure. (means not supported) */ @@ -93,7 +93,7 @@ void hb_releaseCPU( void ) union REGS regs; regs.h.ah = 2; - regs.x.ax = 0x1680; + regs.HB_XREGS.ax = 0x1680; HB_DOS_INT86( 0x2F, ®s, ®s ); } @@ -190,7 +190,7 @@ int hb_inkeyNext( void ) /* Return the next key without extracting it */ else key = s_inkeyBuffer[ s_inkeyTail ]; /* Next key */ } - else + else key = s_inkeyForce; /* Typeahead support is disabled */ return key; @@ -203,7 +203,7 @@ void hb_inkeyPoll( void ) /* Poll the console keyboard to stuff the Harbour if( hb_set.HB_SET_TYPEAHEAD || s_inkeyPoll ) { int ch = hb_gtReadKey( s_eventmask ); - + switch( ch ) { case HB_BREAK_FLAG: /* Check for Ctrl+Break */ diff --git a/harbour/source/rtl/isprint.c b/harbour/source/rtl/isprint.c index 161fd79b3d..cf14efb084 100644 --- a/harbour/source/rtl/isprint.c +++ b/harbour/source/rtl/isprint.c @@ -56,7 +56,7 @@ HB_FUNC( ISPRINTER ) union REGS regs; regs.h.ah = 2; - regs.x.dx = uiPort - 1; + regs.HB_XREGS.dx = uiPort - 1; HB_DOS_INT86( 0x17, ®s, ®s ); @@ -74,7 +74,7 @@ HB_FUNC( ISPRINTER ) on any platform, but the result may not be the expected one, since Unix/Linux doesn't support LPT/COM by nature, other OSs may not reflect the actual physical presence of the printer when - trying to open it, since we are talking to the spooler. + trying to open it, since we are talking to the spooler. [vszakats] */ if( ( hb_strnicmp( pszDOSPort, "LPT", 3 ) == 0 || diff --git a/harbour/source/rtl/net.c b/harbour/source/rtl/net.c index 5465b2f6ef..b2ea9af3fe 100644 --- a/harbour/source/rtl/net.c +++ b/harbour/source/rtl/net.c @@ -51,7 +51,7 @@ HB_FUNC( NETNAME ) char szValue[ 16 ]; union REGS regs; - regs.x.ax = 0x5E00; + regs.HB_XREGS.ax = 0x5E00; #if defined(__DJGPP__) { @@ -61,10 +61,10 @@ HB_FUNC( NETNAME ) #else { struct SREGS sregs; - - regs.x.dx = FP_OFF( szValue ); + + regs.HB_XREGS.dx = FP_OFF( szValue ); sregs.ds = FP_SEG( szValue ); - + HB_DOS_INT86X( 0x21, ®s, ®s, &sregs ); } #endif