diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 43c1815100..b435c49327 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,46 @@ +19990916-14:20 GMT+1 Victor Szel + + * source/rtl/mouse/*.* + * Copyright text format change. + * source/rtl/gt/*.c + ! Indentations, formatting errors corrected. + ! // comments change to /**/ + + Copyright headers added. + * source/rtl/inkey.c + ! // comments change to /**/ + * source/rtl/gt/gt_tpl.c + ! Fixed hb_gt_SetMode() return value type. + * source/rtl/gtapi.c + ! hb_gtRepChar() will check for buffer overflow. + * include/gtapi.h + ! Added hb_gt_Replicate() to GTAPI.H + * Variable names revised, standardized. + * source/rtl/errorapi.c + * hb_errPutArgs() Now using Item API instead of Array API. + + * source/rtl/console.c + source/rtl/gtapi.c + source/rtl/gt/*.c + include/gtapi.h + + API functions made more Clipper compatible with some arg type changes: + hb_gtBox() - Character parameter: char * -> BYTE * + hb_gtRepChar() - USHORT character changed to BYTE, this is not completely + Clipper compatible, but I've considered a bug to accept a character + in an USHORT. + hb_gtRest() - Buffer parameter: char * -> void * + hb_gtSave() - Buffer parameter: char * -> void * + hb_gtWrite*() - Character parameter: char * -> BYTE * + * Some types changed in the low-level API. + hb_gt_IsColor() - retval: int -> BOOL + hb_gt_Get/SetCursorStyle() - int -> USHORT to match the high level API + hb_gt_Puts() - char * -> BYTE *, int -> ULONG for the length. + hb_gt_GetText() - char * -> BYTE * + hb_gt_PutText() - char * -> BYTE * + hb_gt_Replicate() - char -> BYTE, DWORD -> ULONG + ; IMHO later we should change all unsigned coordinate types to signed ones, + so that we can have a better "virtual screen" support. All attribute + types to a generic HB_ATTR, all characters to HB_CHAR. + 19990916-11:15 GMT+1 Victor Szel * source/vm/hvm.c diff --git a/harbour/include/gtapi.h b/harbour/include/gtapi.h index 12e6bc13b1..9c6b1a4bbd 100644 --- a/harbour/include/gtapi.h +++ b/harbour/include/gtapi.h @@ -48,60 +48,61 @@ extern void hb_gtInit( void ); extern void hb_gtExit( void ); -extern int hb_gtBox( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, char * fpBoxString ); +extern int hb_gtBox( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, BYTE * pbyBoxString ); extern int hb_gtBoxD( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight ); extern int hb_gtBoxS( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight ); extern int hb_gtColorSelect( USHORT uiColorIndex ); extern int hb_gtDispBegin( void ); extern USHORT hb_gtDispCount( void ); extern int hb_gtDispEnd( void ); -extern int hb_gtGetBlink( BOOL * bBlink ); -extern int hb_gtGetColorStr( char * fpColorString ); -extern int hb_gtGetCursor( USHORT * uipCursorShape ); -extern int hb_gtGetPos( USHORT * uipRow, USHORT * uipCol ); +extern int hb_gtGetBlink( BOOL * pbBlink ); +extern int hb_gtGetColorStr( char * pszColorString ); +extern int hb_gtGetCursor( USHORT * puiCursorShape ); +extern int hb_gtGetPos( USHORT * puiRow, USHORT * puiCol ); extern BOOL hb_gtIsColor( void ); extern USHORT hb_gtMaxCol( void ); extern USHORT hb_gtMaxRow( void ); extern int hb_gtPostExt( void ); extern int hb_gtPreExt( void ); -extern int hb_gtRectSize( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, USHORT * uipBuffSize ); -extern int hb_gtRepChar( USHORT uiRow, USHORT uiCol, USHORT uiChar, USHORT uiCount ); -extern int hb_gtRest( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, char * vlpScrBuff ); -extern int hb_gtSave( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, char * vlpScrBuff ); -extern int hb_gtScrDim( USHORT * uipHeight, USHORT * uipWidth ); +extern int hb_gtRectSize( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, USHORT * puiBuffSize ); +extern int hb_gtRepChar( USHORT uiRow, USHORT uiCol, BYTE byChar, USHORT uiCount ); +extern int hb_gtRest( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, void * pScrBuff ); +extern int hb_gtSave( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, void * pScrBuff ); +extern int hb_gtScrDim( USHORT * puiHeight, USHORT * puiWidth ); extern int hb_gtScroll( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, SHORT iRows, SHORT iCols ); extern int hb_gtSetBlink( BOOL bBlink ); -extern int hb_gtSetColorStr( char * fpColorString ); +extern int hb_gtSetColorStr( char * pszColorString ); extern int hb_gtSetCursor( USHORT uiCursorShape ); extern int hb_gtSetMode( USHORT uiRows, USHORT uiCols ); extern int hb_gtSetPos( USHORT uiRow, USHORT uiCol ); extern int hb_gtSetSnowFlag( BOOL bNoSnow ); -extern int hb_gtWrite( char * fpStr, ULONG length ); -extern int hb_gtWriteAt( USHORT uiRow, USHORT uiCol, char * fpStr, ULONG length ); -extern int hb_gtWriteCon( char * fpStr, ULONG length ); +extern int hb_gtWrite( BYTE * pbyStr, ULONG ulLen ); +extern int hb_gtWriteAt( USHORT uiRow, USHORT uiCol, BYTE * pbyStr, ULONG ulLen ); +extern int hb_gtWriteCon( BYTE * pbyStr, ULONG ulLen ); /* Private interface listed below. these are common to all platforms */ extern void hb_gt_Init( void ); -extern int hb_gt_IsColor( void ); +extern BOOL hb_gt_IsColor( void ); extern void hb_gt_Done( void ); extern USHORT hb_gt_GetScreenWidth( void ); extern USHORT hb_gt_GetScreenHeight( void ); -extern void hb_gt_SetPos( USHORT cRow, USHORT cCol ); +extern void hb_gt_SetPos( USHORT uiRow, USHORT uiCol ); extern USHORT hb_gt_Col( void ); extern USHORT hb_gt_Row( void ); -extern void hb_gt_Scroll( USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight, BYTE attr, SHORT vert, SHORT horiz ); -extern void hb_gt_SetCursorStyle( int style ); -extern int hb_gt_GetCursorStyle( void ); -extern void hb_gt_Puts( USHORT cRow, USHORT cCol, BYTE attr, char *str, int len ); -extern void hb_gt_GetText( USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight, char *dest ); -extern void hb_gt_PutText( USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight, char *srce ); -extern void hb_gt_SetAttribute( USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight, BYTE attr ); -extern void hb_gt_DrawShadow( USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight, BYTE attr ); +extern void hb_gt_Scroll( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, BYTE byAttr, SHORT iRows, SHORT iCols ); +extern void hb_gt_SetCursorStyle( USHORT uiCursorShape ); +extern USHORT hb_gt_GetCursorStyle( void ); +extern void hb_gt_Puts( USHORT uiRow, USHORT uiCol, BYTE byAttr, BYTE * pbyStr, ULONG ulLen ); +extern void hb_gt_GetText( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, BYTE * pbyDst ); +extern void hb_gt_PutText( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, BYTE * pbySrc ); +extern void hb_gt_SetAttribute( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, BYTE byAttr ); +extern void hb_gt_DrawShadow( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, BYTE byAttr ); extern void hb_gt_DispBegin( void ); extern void hb_gt_DispEnd( void ); extern BOOL hb_gt_SetMode( USHORT uiRows, USHORT uiCols ); extern BOOL hb_gt_GetBlink( void ); extern void hb_gt_SetBlink( BOOL bBlink ); +extern void hb_gt_Replicate( BYTE byChar, ULONG ulLen ); #endif /* HB_GTAPI_H_ */ diff --git a/harbour/source/rtl/console.c b/harbour/source/rtl/console.c index 49593c2b95..a69a25b5ee 100644 --- a/harbour/source/rtl/console.c +++ b/harbour/source/rtl/console.c @@ -1019,7 +1019,7 @@ HARBOUR HB_SAVESCREEN( void ) #ifdef HARBOUR_USE_GTAPI USHORT uiX; USHORT uiCoords[ 4 ]; - char * pBuffer; + void * pBuffer; uiCoords[ 0 ] = 0; uiCoords[ 1 ] = 0; @@ -1031,10 +1031,10 @@ HARBOUR HB_SAVESCREEN( void ) uiCoords[ uiX - 1 ] = hb_parni( uiX ); hb_gtRectSize( uiCoords[ 0 ], uiCoords[ 1 ], uiCoords[ 2 ], uiCoords[ 3 ], &uiX ); - pBuffer = ( char * ) hb_xgrab( uiX ); + pBuffer = hb_xgrab( uiX ); hb_gtSave( uiCoords[ 0 ], uiCoords[ 1 ], uiCoords[ 2 ], uiCoords[ 3 ], pBuffer ); hb_retclen( pBuffer, uiX ); - hb_xfree( ( void * ) pBuffer ); + hb_xfree( pBuffer ); #else hb_retc( "" ); #endif @@ -1058,7 +1058,7 @@ HARBOUR HB_RESTSCREEN( void ) uiCoords[ uiX - 1 ] = hb_parni( uiX ); hb_gtRest( uiCoords[ 0 ], uiCoords[ 1 ], uiCoords[ 2 ], uiCoords[ 3 ], - hb_parc( 5 ) ); + ( void * ) hb_parc( 5 ) ); } #endif } diff --git a/harbour/source/rtl/errorapi.c b/harbour/source/rtl/errorapi.c index 466a928de2..b4d4c417c3 100644 --- a/harbour/source/rtl/errorapi.c +++ b/harbour/source/rtl/errorapi.c @@ -504,17 +504,15 @@ PHB_ITEM hb_errPutFlags( PHB_ITEM pError, USHORT uiFlags ) PHB_ITEM hb_errPutArgs( PHB_ITEM pError, USHORT uiArgCount, ... ) { - PHB_ITEM pArray = hb_itemNew( NULL ); + PHB_ITEM pArray = hb_itemArrayNew( uiArgCount ); USHORT uiArgPos; va_list va; /* Build the array from the passed arguments. */ - hb_arrayNew( pArray, uiArgCount ); - va_start( va, uiArgCount ); for( uiArgPos = 1; uiArgPos <= uiArgCount; uiArgPos++ ) - hb_arraySet( pArray, uiArgPos, va_arg( va, PHB_ITEM ) ); + hb_itemArrayPut( pArray, uiArgPos, va_arg( va, PHB_ITEM ) ); va_end( va ); /* Assign the new array to the object data item. */ @@ -524,6 +522,8 @@ PHB_ITEM hb_errPutArgs( PHB_ITEM pError, USHORT uiArgCount, ... ) hb_vmPush( pArray ); hb_vmDo( 1 ); + hb_itemRelease( pArray ); + return pError; } diff --git a/harbour/source/rtl/gt/gt_tpl.c b/harbour/source/rtl/gt/gt_tpl.c index 244f02bd55..53932f2632 100644 --- a/harbour/source/rtl/gt/gt_tpl.c +++ b/harbour/source/rtl/gt/gt_tpl.c @@ -3,150 +3,172 @@ */ /* - * GT_TPL.C: Video subsystem template. + * Harbour Project source code: + * Video subsystem template + * + * Copyright 1999 {list of individual authors and e-mail addresses} + * www - http://www.harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version, with one exception: + * + * The exception is that if you link the Harbour Runtime Library (HRL) + * and/or the Harbour Virtual Machine (HVM) with other files to produce + * an executable, this does not by itself cause the resulting executable + * to be covered by the GNU General Public License. Your use of that + * executable is in no way restricted on account of linking the HRL + * and/or HVM code into it. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit + * their web site at http://www.gnu.org/). * - * User programs should never call this layer directly! */ +/* NOTE: User programs should never call this layer directly! */ + /* TODO: include any standard headers here */ #include "gtapi.h" -void hb_gt_Init(void) +void hb_gt_Init( void ) { - /* TODO: Is anything required to initialize the video subsystem? */ + /* TODO: Is anything required to initialize the video subsystem? */ } -void hb_gt_Done(void) +void hb_gt_Done( void ) { - /* TODO: */ + /* TODO: */ } -int hb_gt_IsColor(void) +BOOL hb_gt_IsColor( void ) { - /* TODO: How to detect this? */ - return 1; + /* TODO: How to detect this? */ + return TRUE; } -char hb_gt_GetScreenWidth(void) +USHORT hb_gt_GetScreenWidth( void ) { /* TODO: How many columns on screen? */ - return (char)0; + return 0; } -char hb_gt_GetScreenHeight(void) +USHORT hb_gt_GetScreenHeight( void ) { /* TODO: How many rows on screen? */ - return (char)0; + return 0; } -void hb_gt_SetPos(char x, char y) +void hb_gt_SetPos( USHORT uiRow, USHORT uiCol ) { /* TODO: How to reposition the cursor? */ } -char hb_gt_Col(void) +USHORT hb_gt_Col( void ) { /* TODO: What Column is the cursor on? */ return 0; } -char hb_gt_Row(void) +USHORT hb_gt_Row( void ) { /* TODO: What Row is the cursor on? */ return 0; } -static void hb_gt_GetCursorSize(char *start, char *end) +static void hb_gt_GetCursorSize( char * start, char * end ) { - /* TODO: if your system supports the concept of cursor scan lines, + /* TODO: if your system supports the concept of cursor scan lines, fill this in - otherwise, you need some way to detect the size of the current screen cursor. */ - *start = 0; - *end = 0; + *start = 0; + *end = 0; } -int hb_gt_GetCursorStyle(void) +USHORT hb_gt_GetCursorStyle( void ) { /* TODO: What shape is the cursor? */ - int rc=0; + USHORT rc = 0; /* - char start, end - if ( !visible ) - { - rc=SC_NONE; - } - else - { + char start, end; + if( !visible ) + { + rc = SC_NONE; + } + else + { */ - /* example from the dos driver */ + /* example from the dos driver */ /* - hb_gt_GetCursorSize( &start, &end ) - if((start == 32) && (end == 32)) - { - rc=SC_NONE; - } - else if((start == 6) && (end == 7)) - { - rc=SC_NORMAL; - } - else if((start == 4) && (end == 7)) - { - rc=SC_INSERT; - } - else if((start == 0) && (end == 7)) - { - rc=SC_SPECIAL1; - } - else if((start == 0) && (end == 3)) - { - rc=SC_SPECIAL2; - } - } + hb_gt_GetCursorSize( &start, &end ) + + if( ( start == 32 ) && ( end == 32 ) ) + rc = SC_NONE; + + else if( ( start == 6 ) && ( end == 7 ) ) + rc = SC_NORMAL; + + else if( ( start == 4 ) && ( end == 7 ) ) + rc = SC_INSERT; + + else if( ( start == 0 ) && ( end == 7 ) ) + rc = SC_SPECIAL1; + + else if( ( start == 0 ) && ( end == 3 ) ) + rc = SC_SPECIAL2; + } */ - return(rc); + return rc; } -void hb_gt_SetCursorStyle(int style) +void hb_gt_SetCursorStyle( USHORT uiStyle ) { /* TODO: How to set the shape of the cursor? */ /* see ..\..\..\tests\working\cursrtst.prg for an explanation */ - switch(style) - { - case SC_NONE: - /* TODO: turn it off */ - break; + switch( uiStyle ) + { + case SC_NONE: + /* TODO: turn it off */ + break; - case SC_NORMAL: - break; + case SC_NORMAL: + break; - case SC_INSERT: - break; + case SC_INSERT: + break; - case SC_SPECIAL1: - break; + case SC_SPECIAL1: + break; - case SC_SPECIAL2: - break; + case SC_SPECIAL2: + break; - default: - break; - } + default: + break; + } } -void hb_gt_Puts(char x, char y, char attr, char *str, int len) +void hb_gt_Puts( USHORT uiRow, USHORT uiCol, BYTE byAttr, BYTE * pbyStr, ULONG ulLen ) { } -void hb_gt_GetText(char x1, char y1, char x2, char y2, char *dest) +void hb_gt_GetText( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, BYTE * pbyDst ) { } -void hb_gt_PutText(char x1, char y1, char x2, char y2, char *srce) +void hb_gt_PutText( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, BYTE * pbySrc ) { } -void hb_gt_SetAttribute( char cTop, char cLeft, char cBottom, char cRight, char attribute ) +void hb_gt_SetAttribute( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, BYTE byAttr ) { /* TODO: we want to take a screen that is say bright white on blue, and change the attributes only for a section of the screen @@ -154,16 +176,16 @@ void hb_gt_SetAttribute( char cTop, char cLeft, char cBottom, char cRight, char */ } -void hb_gt_DrawShadow( char cTop, char cLeft, char cBottom, char cRight, char attribute ) +void hb_gt_DrawShadow( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, BYTE byAttr ) { /* TODO: similar to above - see gtwin.c for an idea */ } -void hb_gt_Scroll( char cTop, char cLeft, char cBottom, char cRight, char attribute, char vert, char horiz ) +void hb_gt_Scroll( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, BYTE byAttr, SHORT iRows, SHORT iCols ) { } -void hb_gt_DispBegin(void) +void hb_gt_DispBegin( void ) { /* TODO: Is there a way to change screen buffers? ie: can we write somewhere without it going to the screen @@ -177,12 +199,12 @@ void hb_gt_DispEnd() /* TODO: here we flush the buffer, and restore normal screen writes */ } -void hb_gt_SetMode( USHORT uiRows, USHORT uiCols ) +BOOL hb_gt_SetMode( USHORT uiRows, USHORT uiCols ) { /* TODO: How to change the size of the screen? */ } -void hb_gt_Replicate( char c, DWORD nLength ) +void hb_gt_Replicate( BYTE byChar, ULONG ulLen ) { /* TODO: this will write character c nlength times to the screen. Note that it is not used yet @@ -194,7 +216,7 @@ void hb_gt_Replicate( char c, DWORD nLength ) BOOL hb_gt_GetBlink() { - /* TODO: under dos, the background 'intensity' bit can be switched + /* TODO: under dos, the background 'intensity' bit can be switched from intensity to 'blinking' does this work under your platform? */ diff --git a/harbour/source/rtl/gt/gtdos.c b/harbour/source/rtl/gt/gtdos.c index 6ed9ed5589..6603f6d1a7 100644 --- a/harbour/source/rtl/gt/gtdos.c +++ b/harbour/source/rtl/gt/gtdos.c @@ -3,462 +3,487 @@ */ /* - * GTDOS.C: Video subsystem for DOS compilers. + * Harbour Project source code: + * Video subsystem for DOS compilers * + * Copyright 1999 {list of individual authors and e-mail addresses} + * www - http://www.harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version, with one exception: + * + * The exception is that if you link the Harbour Runtime Library (HRL) + * and/or the Harbour Virtual Machine (HVM) with other files to produce + * an executable, this does not by itself cause the resulting executable + * to be covered by the GNU General Public License. Your use of that + * executable is in no way restricted on account of linking the HRL + * and/or HVM code into it. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit + * their web site at http://www.gnu.org/). + * + */ + +/* * This module is based on VIDMGR by Andrew Clarke and modified for * the Harbour project - * - * User programs should never call this layer directly! */ +/* NOTE: User programs should never call this layer directly! */ + #include #include #include "gtapi.h" #if defined(__POWERC) || (defined(__TURBOC__) && !defined(__BORLANDC__)) || \ - (defined(__ZTC__) && !defined(__SC__)) - #define FAR far + (defined(__ZTC__) && !defined(__SC__)) + #define FAR far #elif (defined(__MSDOS__) || defined(MSDOS) || defined(DOS)) && !defined(__DJGPP__) - #define FAR _far + #define FAR _far #else - #define FAR + #define FAR #endif #ifdef __DJGPP__ - #include - #include + #include + #include #else - #ifndef MK_FP - #define MK_FP(seg,off) \ - ((void FAR *)(((unsigned long)(seg) << 16)|(unsigned)(off))) - #endif + #ifndef MK_FP + #define MK_FP( seg, off ) \ + ((void FAR *)(((unsigned long)(seg) << 16)|(unsigned)(off))) + #endif #endif -static void hb_gt_xGetXY(USHORT cRow, USHORT cCol, BYTE *attr, char *ch); -static void hb_gt_xPutch(USHORT cRow, USHORT cCol, BYTE attr, char ch); +static void hb_gt_xGetXY( USHORT cRow, USHORT cCol, BYTE * attr, BYTE * ch ); +static void hb_gt_xPutch( USHORT cRow, USHORT cCol, BYTE attr, BYTE ch ); -static char hb_gt_GetScreenMode(void); -static void hb_gt_SetCursorSize(char start, char end); -static void hb_gt_GetCursorSize(char *start, char *end); +static char hb_gt_GetScreenMode( void ); +static void hb_gt_SetCursorSize( char start, char end ); +static void hb_gt_GetCursorSize( char * start, char * end ); #if defined(__WATCOMC__) && defined(__386__) - #define FAR + #define FAR #endif #ifndef __DJGPP__ - static char FAR *scrnPtr; - static char FAR *scrnStealth; - static char FAR *hb_gt_ScreenAddress(void); + static char FAR * scrnPtr; + static char FAR * scrnStealth; + static char FAR * hb_gt_ScreenAddress( void ); #endif -void hb_gt_Init(void) +void hb_gt_Init( void ) { #ifdef __DJGPP__ gppconio_init(); #else - scrnStealth = (char *)-1; + scrnStealth = ( char * ) -1; scrnPtr = hb_gt_ScreenAddress(); #endif } -void hb_gt_Done(void) +void hb_gt_Done( void ) { } -int hb_gt_IsColor(void) +BOOL hb_gt_IsColor( void ) { - return hb_gt_GetScreenMode() != 7; + return hb_gt_GetScreenMode() != 7; } #ifndef __DJGPP__ -static char FAR *hb_gt_ScreenAddress() +static char FAR * hb_gt_ScreenAddress() { - char FAR *ptr; + char FAR * ptr; - #if defined(__WATCOMC__) && defined(__386__) - if (hb_gt_IsColor()) - { - ptr = (char *)(0xB800 << 4); - } - else - { - ptr = (char *)(0xB000 << 4); - } - #else - if (hb_gt_IsColor()) - { - ptr = (char FAR *)MK_FP(0xB800, 0x0000); - } - else - { - ptr = (char FAR *)MK_FP(0xB000, 0x0000); - } - #endif + #if defined(__WATCOMC__) && defined(__386__) + if( hb_gt_IsColor() ) + { + ptr = ( char * ) ( 0xB800 << 4 ); + } + else + { + ptr = ( char * )( 0xB000 << 4 ); + } + #else + if( hb_gt_IsColor() ) + { + ptr = ( char FAR * ) MK_FP( 0xB800, 0x0000 ); + } + else + { + ptr = ( char FAR * ) MK_FP( 0xB000, 0x0000 ); + } + #endif - return ptr; + return ptr; } #endif #ifndef __DJGPP__ -char FAR *hb_gt_ScreenPtr(USHORT cRow, USHORT cCol) +char FAR * hb_gt_ScreenPtr( USHORT cRow, USHORT cCol ) { - return scrnPtr + (cRow * hb_gt_GetScreenWidth() * 2) + (cCol * 2); + return scrnPtr + ( cRow * hb_gt_GetScreenWidth() * 2 ) + ( cCol * 2 ); } #endif -static char hb_gt_GetScreenMode(void) +static char hb_gt_GetScreenMode( void ) { #if defined(__WATCOMC__) && defined(__386__) - return *((char *)0x0449); + return *( ( char * ) 0x0449 ); #elif defined(__DJGPP__) - return _farpeekb( 0x0040, 0x0049 ); + return _farpeekb( 0x0040, 0x0049 ); #else - return *((char FAR *)MK_FP(0x0040, 0x0049)); + return *( ( char FAR * ) MK_FP( 0x0040, 0x0049 ) ); #endif } -USHORT hb_gt_GetScreenWidth(void) +USHORT hb_gt_GetScreenWidth( void ) { #if defined(__WATCOMC__) && defined(__386__) - return (USHORT)*((char *)0x044a); + return ( USHORT ) *( ( char * ) 0x044A ); #elif defined(__DJGPP__) - return (USHORT)_farpeekb( 0x0040, 0x004a ); + return ( USHORT ) _farpeekb( 0x0040, 0x004A ); #else - return (USHORT)*((char FAR *)MK_FP(0x0040, 0x004a)); + return ( USHORT ) *( ( char FAR * ) MK_FP( 0x0040, 0x004A ) ); #endif } -USHORT hb_gt_GetScreenHeight(void) +USHORT hb_gt_GetScreenHeight( void ) { #if defined(__WATCOMC__) && defined(__386__) - return (USHORT)(char)(*((char *)0x0484) + 1); + return ( USHORT ) ( char ) ( *( ( char * ) 0x0484 ) + 1 ); #elif defined(__DJGPP__) - return (USHORT)_farpeekb( 0x0040, 0x0084 ) + 1; + return ( USHORT ) _farpeekb( 0x0040, 0x0084 ) + 1; #else - return (USHORT)((char)(*((char FAR *)MK_FP(0x0040, 0x0084)) + 1)); + return ( USHORT ) ( ( char ) ( *( ( char FAR * ) MK_FP( 0x0040, 0x0084 ) ) + 1 ) ); #endif } -void hb_gt_SetPos(USHORT usRow, USHORT usCol) +void hb_gt_SetPos( USHORT usRow, USHORT usCol ) { #if defined(__TURBOC__) - BYTE cRow, cCol; + BYTE cRow, cCol; - cRow = (BYTE)usRow; - cCol = (BYTE)usCol; + cRow = ( BYTE ) usRow; + cCol = ( BYTE ) usCol; - _AH = 0x02; - _BH = 0; - _DH = cRow; - _DL = cCol; - geninterrupt(0x10); + _AH = 0x02; + _BH = 0; + _DH = cRow; + _DL = cCol; + geninterrupt( 0x10 ); #else - union REGS regs; - regs.h.ah = 0x02; - regs.h.bh = 0; - regs.h.dh = (BYTE)(usRow); - regs.h.dl = (BYTE)(usCol); + union REGS regs; + regs.h.ah = 0x02; + regs.h.bh = 0; + regs.h.dh = ( BYTE ) usRow; + regs.h.dl = ( BYTE ) usCol; #if defined(__WATCOMC__) && defined(__386__) - int386(0x10, ®s, ®s); + int386( 0x10, ®s, ®s ); #else - int86(0x10, ®s, ®s); + int86( 0x10, ®s, ®s ); #endif #endif } -static void hb_gt_SetCursorSize(char start, char end) +static void hb_gt_SetCursorSize( char start, char end ) { #if defined(__TURBOC__) - _AH = 0x01; - _CH = start; - _CL = end; - geninterrupt(0x10); + _AH = 0x01; + _CH = start; + _CL = end; + geninterrupt( 0x10 ); #else - union REGS regs; - regs.h.ah = 0x01; - regs.h.ch = start; - regs.h.cl = end; + union REGS regs; + regs.h.ah = 0x01; + regs.h.ch = start; + regs.h.cl = end; #if defined(__WATCOMC__) && defined(__386__) - int386(0x10, ®s, ®s); + int386( 0x10, ®s, ®s ); #else - int86(0x10, ®s, ®s); + int86( 0x10, ®s, ®s ); #endif #endif } -static void hb_gt_GetCursorSize(char *start, char *end) +static void hb_gt_GetCursorSize( char * start, char *end ) { #if defined(__TURBOC__) - _AH = 0x03; - _BH = 0; - geninterrupt(0x10); - *start = _CH; - *end = _CL; + _AH = 0x03; + _BH = 0; + geninterrupt( 0x10 ); + *start = _CH; + *end = _CL; #else - union REGS regs; - regs.h.ah = 0x03; - regs.h.bh = 0; + union REGS regs; + regs.h.ah = 0x03; + regs.h.bh = 0; #if defined(__WATCOMC__) && defined(__386__) - int386(0x10, ®s, ®s); + int386( 0x10, ®s, ®s ); #else - int86(0x10, ®s, ®s); + int86( 0x10, ®s, ®s ); #endif - *start = regs.h.ch; - *end = regs.h.cl; + *start = regs.h.ch; + *end = regs.h.cl; #endif } -int hb_gt_GetCursorStyle(void) +USHORT hb_gt_GetCursorStyle( void ) { - char start, end; - int rc; + char start, end; + int rc; - hb_gt_GetCursorSize(&start, &end); + hb_gt_GetCursorSize( &start, &end ); - if((start == 32) && (end == 32)) - { - rc=SC_NONE; - } - else if((start == 6) && (end == 7)) - { - rc=SC_NORMAL; - } - else if((start == 4) && (end == 7)) - { - rc=SC_INSERT; - } - else if((start == 0) && (end == 7)) - { - rc=SC_SPECIAL1; - } - else if((start == 0) && (end == 3)) - { - rc=SC_SPECIAL2; - } - else - { - rc=SC_NONE; - } + if( ( start == 32 ) && ( end == 32 ) ) + rc = SC_NONE; - return(rc); + else if( ( start == 6 ) && ( end == 7 ) ) + rc = SC_NORMAL; + + else if( ( start == 4 ) && ( end == 7 ) ) + rc = SC_INSERT; + + else if( ( start == 0 ) && ( end == 7 ) ) + rc = SC_SPECIAL1; + + else if( ( start == 0 ) && ( end == 3 ) ) + rc = SC_SPECIAL2; + + else + rc = SC_NONE; + + return rc; } -void hb_gt_SetCursorStyle(int style) +void hb_gt_SetCursorStyle( USHORT style ) { - switch(style) - { - case SC_NONE: - hb_gt_SetCursorSize(32, 32); - break; + switch( style ) + { + case SC_NONE: + hb_gt_SetCursorSize( 32, 32 ); + break; - case SC_NORMAL: - hb_gt_SetCursorSize(6, 7); - break; + case SC_NORMAL: + hb_gt_SetCursorSize( 6, 7 ); + break; - case SC_INSERT: - hb_gt_SetCursorSize(4, 7); - break; + case SC_INSERT: + hb_gt_SetCursorSize( 4, 7 ); + break; - case SC_SPECIAL1: - hb_gt_SetCursorSize(0, 7); - break; + case SC_SPECIAL1: + hb_gt_SetCursorSize( 0, 7 ); + break; - case SC_SPECIAL2: - hb_gt_SetCursorSize(0, 3); - break; + case SC_SPECIAL2: + hb_gt_SetCursorSize( 0, 3 ); + break; - default: - break; - } + default: + break; + } } -static void hb_gt_xGetXY(USHORT cRow, USHORT cCol, BYTE *attr, char *ch) +static void hb_gt_xGetXY( USHORT cRow, USHORT cCol, BYTE * attr, BYTE * ch ) { #ifdef __DJGPP__ - short ch_attr; - gettext( cCol + 1, cRow + 1, cCol + 1, cRow + 1, &ch_attr ); - *ch = ch_attr >> 8; - *attr = ch_attr & 0xFF; -///printf("\r\nhb_gt_xGetXY(): row == %d, col = %d, char = %d, attr = %d", cRow, cCol, *ch, *attr ); + short ch_attr; + gettext( cCol + 1, cRow + 1, cCol + 1, cRow + 1, &ch_attr ); + *ch = ch_attr >> 8; + *attr = ch_attr & 0xFF; + +/* printf("\r\nhb_gt_xGetXY(): row == %d, col = %d, char = %d, attr = %d", cRow, cCol, *ch, *attr ); */ #else - char FAR *p; - p = hb_gt_ScreenPtr(cRow, cCol); - *ch = *p; - *attr = *(p + 1); + char FAR *p; + p = hb_gt_ScreenPtr( cRow, cCol ); + *ch = *p; + *attr = *( p + 1 ); #endif } -void hb_gt_xPutch(USHORT cRow, USHORT cCol, BYTE attr, char ch) +void hb_gt_xPutch( USHORT cRow, USHORT cCol, BYTE attr, BYTE ch ) { #ifdef __DJGPP__ - long ch_attr = ( ch << 8 ) | attr; -///printf("\r\nhb_gt_xPutch(): row == %d, col = %d, char = %d, attr = %d", cRow, cCol, ch, attr ); - puttext( cCol + 1, cRow + 1, cCol + 1, cRow + 1, &ch_attr ); + long ch_attr = ( ch << 8 ) | attr; +/* printf("\r\nhb_gt_xPutch(): row == %d, col = %d, char = %d, attr = %d", cRow, cCol, ch, attr ); */ + puttext( cCol + 1, cRow + 1, cCol + 1, cRow + 1, &ch_attr ); #else - char FAR *p; - p = hb_gt_ScreenPtr(cRow, cCol); - *p = ch; - *(p + 1) = attr; + char FAR * p; + p = hb_gt_ScreenPtr( cRow, cCol ); + *p = ch; + *( p + 1 ) = attr; #endif } -void hb_gt_Puts(USHORT cRow, USHORT cCol, BYTE attr, char *str, int len) +void hb_gt_Puts( USHORT cRow, USHORT cCol, BYTE attr, BYTE *str, ULONG len ) { #ifdef __DJGPP__ - int i = len; - int bottom, left = cCol, right, top = cRow; - int width = hb_gt_GetScreenWidth(); - char * ch_attr, * ptr; -///printf("\r\nhb_gt_Puts(): row == %d, col = %d, attr = %d, len = %d", cRow, cCol, attr, len ); - ptr = ch_attr = hb_xgrab( i * 2 ); - while( i-- ) - { -///printf("+"); - *ptr++ = *str++; -///printf("-"); - *ptr++ = attr; - } - i = len - 1; /* We want end position, not next cursor position */ - right = left; - bottom = top; - if (right + i > width - 1) - { - /* Calculate end row position and the remainder size for the end column adjust */ - bottom += (i / width); - i = i % width; - } - right += i; - if (right > width - 1) - { - /* Column movement overflows into next row */ - bottom++; - right -= width; - } -///printf("\r\nhb_gt_Puts(): puttext( %d,%d, %d,%d )", left + 1, top + 1, right + 1, bottom + 1 ); - puttext( left + 1, top + 1, right + 1, bottom + 1, ch_attr ); - hb_xfree( ch_attr ); + int i = ( int ) len; + int bottom, left = cCol, right, top = cRow; + int width = hb_gt_GetScreenWidth(); + BYTE * ch_attr, * ptr; +/* printf("\r\nhb_gt_Puts(): row == %d, col = %d, attr = %d, len = %d", cRow, cCol, attr, len ); */ + ptr = ch_attr = hb_xgrab( i * 2 ); + while( i-- ) + { +/* printf("+"); */ + *ptr++ = *str++; +/* printf("-"); */ + *ptr++ = attr; + } + i = len - 1; /* We want end position, not next cursor position */ + right = left; + bottom = top; + if( right + i > width - 1 ) + { + /* Calculate end row position and the remainder size for the end column adjust */ + bottom += ( i / width ); + i = i % width; + } + right += i; + if( right > width - 1 ) + { + /* Column movement overflows into next row */ + bottom++; + right -= width; + } +/* printf("\r\nhb_gt_Puts(): puttext( %d,%d, %d,%d )", left + 1, top + 1, right + 1, bottom + 1 ); */ + puttext( left + 1, top + 1, right + 1, bottom + 1, ch_attr ); + hb_xfree( ch_attr ); #else - char FAR *p; - int i; - p = hb_gt_ScreenPtr( cRow, cCol ); - for(i=0; i= 0 ) { iColOld += iCols; - iColSize = (int) (usRight - usLeft); + iColSize = ( int ) ( usRight - usLeft ); iColSize -= iCols; } else { iColNew -= iCols; - iColSize = (int) (usRight - usLeft); + iColSize = ( int ) ( usRight - usLeft ); iColSize += iCols; } @@ -510,7 +535,7 @@ void hb_gt_Scroll( USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight, hb_gt_GetText( iRowPos, iColOld, iRowPos, iColOld + iColSize, fpBuff ); /* Write the scrolled text to the current row */ - hb_gt_PutText ( iCount, iColNew, iCount, iColNew + iColSize, fpBuff ); + hb_gt_PutText( iCount, iColNew, iCount, iColNew + iColSize, fpBuff ); } } } @@ -521,86 +546,87 @@ void hb_gt_Scroll( USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight, hb_gtSetPos( usRow, usCol ); } -void hb_gt_DispBegin(void) +void hb_gt_DispBegin( void ) { /* ptucker */ #ifndef __DJGPP__ - if( hb_gtDispCount() == 1 ) - { - char FAR *ptr; - ULONG nSize; + if( hb_gtDispCount() == 1 ) + { + char FAR * ptr; + ULONG nSize; - nSize = hb_gt_GetScreenWidth() * hb_gt_GetScreenHeight() * 2; + nSize = hb_gt_GetScreenWidth() * hb_gt_GetScreenHeight() * 2; - ptr = scrnPtr; - if( (scrnPtr = scrnStealth) == (char *)-1) - scrnPtr = (char FAR *)hb_xgrab( nSize ); - scrnStealth = ptr; - memcpy( (void *)scrnPtr, (void *)ptr, nSize ); - } + ptr = scrnPtr; + if( ( scrnPtr = scrnStealth ) == ( char * ) -1 ) + scrnPtr = ( char FAR * ) hb_xgrab( nSize ); + scrnStealth = ptr; + memcpy( ( void * ) scrnPtr, ( void * ) ptr, nSize ); + } #endif } -void hb_gt_DispEnd(void) +void hb_gt_DispEnd( void ) { /* ptucker */ #ifndef __DJGPP__ - if( hb_gtDispCount() == 1 ) - { - char FAR *ptr; - ULONG nSize; + if( hb_gtDispCount() == 1 ) + { + char FAR * ptr; + ULONG nSize; - nSize = hb_gt_GetScreenWidth() * hb_gt_GetScreenHeight() * 2; + nSize = hb_gt_GetScreenWidth() * hb_gt_GetScreenHeight() * 2; - ptr = scrnPtr; - scrnPtr = scrnStealth; - scrnStealth = ptr; - memcpy( (void *)scrnPtr, (void *)ptr, nSize ); - } + ptr = scrnPtr; + scrnPtr = scrnStealth; + scrnStealth = ptr; + memcpy( ( void * ) scrnPtr, ( void * )ptr, nSize ); + } #endif } BOOL hb_gt_SetMode( USHORT usRows, USHORT usCols ) { - usRows=usCols=0; + HB_SYMBOL_UNUSED( usRows ); + HB_SYMBOL_UNUSED( usCols ); + return 0; } -void hb_gt_Replicate(char c, DWORD nLength) +void hb_gt_Replicate( BYTE c, ULONG nLength ) { - c= ' '; + c = ' '; nLength = 0; - } BOOL hb_gt_GetBlink() { #if defined(__WATCOMC__) && defined(__386__) - return *((char *)0x0465) & 0x10; + return *( ( char * ) 0x0465 ) & 0x10; #elif defined(__DJGPP__) - return _farpeekb( 0x0040, 0x0065 ) & 0x10; + return _farpeekb( 0x0040, 0x0065 ) & 0x10; #else - return *((char FAR *)MK_FP(0x0040, 0x0065)) &0x10; + return *( ( char FAR * ) MK_FP( 0x0040, 0x0065 ) ) &0x10; #endif } void hb_gt_SetBlink( BOOL bBlink ) { #if defined(__TURBOC__) - _AX = 0x1003; - _BX = bBlink; - geninterrupt(0x10); - return; + _AX = 0x1003; + _BX = bBlink; + geninterrupt( 0x10 ); + return; #else - union REGS regs; - regs.h.ah = 0x10; - regs.h.al = 0x03; - regs.h.bh = 0; - regs.h.bl = bBlink; + union REGS regs; + regs.h.ah = 0x10; + regs.h.al = 0x03; + regs.h.bh = 0; + regs.h.bl = bBlink; #if defined(__WATCOMC__) && defined(__386__) - int386(0x10, ®s, ®s); + int386( 0x10, ®s, ®s ); #else - int86(0x10, ®s, ®s); + int86( 0x10, ®s, ®s ); #endif #endif } diff --git a/harbour/source/rtl/gt/gtos2.c b/harbour/source/rtl/gt/gtos2.c index 31c2ab54bc..481858acf8 100644 --- a/harbour/source/rtl/gt/gtos2.c +++ b/harbour/source/rtl/gt/gtos2.c @@ -3,14 +3,43 @@ */ /* - * GTOS2.C: Video subsystem for OS/2 compilers. + * Harbour Project source code: + * Video subsystem for OS/2 compilers * + * Copyright 1999 {list of individual authors and e-mail addresses} + * www - http://www.harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version, with one exception: + * + * The exception is that if you link the Harbour Runtime Library (HRL) + * and/or the Harbour Virtual Machine (HVM) with other files to produce + * an executable, this does not by itself cause the resulting executable + * to be covered by the GNU General Public License. Your use of that + * executable is in no way restricted on account of linking the HRL + * and/or HVM code into it. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit + * their web site at http://www.gnu.org/). + * + */ + +/* * This module is partially based on VIDMGR by Andrew Clarke and modified * for the Harbour project - * - * User programs should never call this layer directly! */ +/* NOTE: User programs should never call this layer directly! */ + #define INCL_VIO #define INCL_NOPMAPI @@ -18,67 +47,69 @@ #include #include "gtapi.h" -static char hb_gt_GetCellSize(void); -static void hb_gt_SetCursorSize(char start, char end, int visible); -static void hb_gt_GetCursorSize(char *start, char *end); +static char hb_gt_GetCellSize( void ); +static void hb_gt_SetCursorSize( char start, char end, int visible ); +/* +static void hb_gt_GetCursorSize( char * start, char * end ); +*/ -void hb_gt_Init(void) +void hb_gt_Init( void ) { - /* TODO: Is anything required to initialize the video subsystem? */ + /* TODO: Is anything required to initialize the video subsystem? */ } -void hb_gt_Done(void) +void hb_gt_Done( void ) { - /* TODO: */ + /* TODO: */ } -int hb_gt_IsColor(void) +BOOL hb_gt_IsColor( void ) { /* Chen Kedem */ - VIOMODEINFO vi; + VIOMODEINFO vi; - vi.cb = sizeof(VIOMODEINFO); - VioGetMode(&vi, 0); - return (vi.fbType); /* 0 = monochrom-compatible mode */ + vi.cb = sizeof( VIOMODEINFO ); + VioGetMode( &vi, 0 ); + return vi.fbType != 0; /* 0 = monochrom-compatible mode */ } -char hb_gt_GetScreenWidth(void) +USHORT hb_gt_GetScreenWidth( void ) { - VIOMODEINFO vi; + VIOMODEINFO vi; - vi.cb = sizeof(VIOMODEINFO); - VioGetMode(&vi, 0); - return vi.col; + vi.cb = sizeof( VIOMODEINFO ); + VioGetMode( &vi, 0 ); + return vi.col; } -char hb_gt_GetScreenHeight(void) +USHORT hb_gt_GetScreenHeight( void ) { - VIOMODEINFO vi; + VIOMODEINFO vi; - vi.cb = sizeof(VIOMODEINFO); - VioGetMode(&vi, 0); - return vi.row; + vi.cb = sizeof( VIOMODEINFO ); + VioGetMode( &vi, 0 ); + return vi.row; } -void hb_gt_SetPos(USHORT nRow, USHORT nCol) +void hb_gt_SetPos( USHORT uiRow, USHORT uiCol ) { - VioSetCurPos(nRow, nCol, 0); + VioSetCurPos( uiRow, uiCol, 0 ); } -USHORT hb_gt_Row(void) +USHORT hb_gt_Row( void ) { - USHORT x, y; + USHORT x, y; - VioGetCurPos(&y, &x, 0); - return y; + VioGetCurPos( &y, &x, 0 ); + return y; } -USHORT hb_gt_Col(void) +USHORT hb_gt_Col( void ) { - USHORT x, y; + USHORT x, y; - VioGetCurPos(&y, &x, 0); - return x; + VioGetCurPos( &y, &x, 0 ); + return x; } @@ -86,26 +117,26 @@ void hb_gt_Scroll( USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight, { /* Chen Kedem */ - BYTE bCell[ 2 ]; /* character/attribute pair */ + BYTE bCell[ 2 ]; /* character/attribute pair */ - if( sVert > 128 ) sVert = sVert - 256; - if( sHoriz > 128 ) sHoriz = sHoriz - 256; - bCell [ 0 ] = ' '; - bCell [ 1 ] = attr; - if ( (sVert | sHoriz) == 0 ) /* both zero, clear region */ - VioScrollUp ( usTop, usLeft, usBottom, usRight, 0xFFFF, bCell, 0 ); - else - { - if ( sVert > 0 ) /* scroll up */ - VioScrollUp ( usTop, usLeft, usBottom, usRight, sVert, bCell, 0 ); - else if ( sVert < 0 ) /* scroll down */ - VioScrollDn ( usTop, usLeft, usBottom, usRight, -sVert, bCell, 0 ); + if( sVert > 128 ) sVert = sVert - 256; + if( sHoriz > 128 ) sHoriz = sHoriz - 256; + bCell [ 0 ] = ' '; + bCell [ 1 ] = attr; + if( ( sVert | sHoriz ) == 0 ) /* both zero, clear region */ + VioScrollUp ( usTop, usLeft, usBottom, usRight, 0xFFFF, bCell, 0 ); + else + { + if( sVert > 0 ) /* scroll up */ + VioScrollUp ( usTop, usLeft, usBottom, usRight, sVert, bCell, 0 ); + else if( sVert < 0 ) /* scroll down */ + VioScrollDn ( usTop, usLeft, usBottom, usRight, -sVert, bCell, 0 ); - if ( sHoriz > 0 ) /* scroll left */ - VioScrollLf ( usTop, usLeft, usBottom, usRight, sHoriz, bCell, 0 ); - else if ( sHoriz < 0 ) /* scroll right */ - VioScrollRt ( usTop, usLeft, usBottom, usRight, -sHoriz, bCell, 0 ); - } + if( sHoriz > 0 ) /* scroll left */ + VioScrollLf ( usTop, usLeft, usBottom, usRight, sHoriz, bCell, 0 ); + else if( sHoriz < 0 ) /* scroll right */ + VioScrollRt ( usTop, usLeft, usBottom, usRight, -sHoriz, bCell, 0 ); + } } /* QUESTION: not been used, do we need this function ? */ @@ -113,147 +144,138 @@ void hb_gt_Scroll( USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight, as that function is written below, we don't need this */ /* -static void hb_gt_GetCursorSize(char *start, char *end) +static void hb_gt_GetCursorSize( char * start, char * end ) { - VIOCURSORINFO vi; + VIOCURSORINFO vi; - VioGetCurType(&vi, 0); - *start = vi.yStart; - *end = vi.cEnd; + VioGetCurType( &vi, 0 ); + *start = vi.yStart; + *end = vi.cEnd; } */ -static void hb_gt_SetCursorSize(char start, char end, int visible) +static void hb_gt_SetCursorSize( char start, char end, int visible ) { /* Chen Kedem */ - VIOCURSORINFO vi; + VIOCURSORINFO vi; - vi.yStart = start; - vi.cEnd = end; - vi.cx = 0; - vi.attr = ( visible ? 0 : -1 ); - VioSetCurType(&vi, 0); + vi.yStart = start; + vi.cEnd = end; + vi.cx = 0; + vi.attr = ( visible ? 0 : -1 ); + VioSetCurType( &vi, 0 ); } static char hb_gt_GetCellSize() { /* Chen Kedem */ - char rc ; + char rc ; - VIOMODEINFO vi; - vi.cb = sizeof(VIOMODEINFO); - VioGetMode(&vi, 0); - rc = (char)(vi.row ? (vi.vres / vi.row)-1 : 0 ); - return rc; + VIOMODEINFO vi; + vi.cb = sizeof( VIOMODEINFO ); + VioGetMode( &vi, 0 ); + rc = ( char )( vi.row ? ( vi.vres / vi.row ) - 1 : 0 ); + return rc; } -int hb_gt_GetCursorStyle(void) +USHORT hb_gt_GetCursorStyle( void ) { /* Chen Kedem */ - int rc; - char cellsize; - VIOCURSORINFO vi; + int rc; + char cellsize; + VIOCURSORINFO vi; - VioGetCurType(&vi, 0); + VioGetCurType( &vi, 0 ); - if ( vi.attr ) - { - rc=SC_NONE; - } - else - { - cellsize = hb_gt_GetCellSize(); + if( vi.attr ) + rc = SC_NONE; + else + { + cellsize = hb_gt_GetCellSize(); - if ( vi.yStart == 0 && vi.cEnd == 0 ) - { - rc=SC_NONE; - } - else if ( ( vi.yStart == cellsize-1 || vi.yStart == cellsize-2 ) && vi.cEnd == cellsize ) - { - rc=SC_NORMAL; - } - else if ( vi.yStart == cellsize/2 && vi.cEnd == cellsize ) - { - rc=SC_INSERT; - } - else if ( vi.yStart == 0 && vi.cEnd == cellsize ) - { - rc=SC_SPECIAL1; - } - else if ( vi.yStart == 0 && vi.cEnd == cellsize/2 ) - { - rc=SC_SPECIAL2; - } - else - { - rc=SC_NONE; - } - } + if( vi.yStart == 0 && vi.cEnd == 0 ) + rc = SC_NONE; - return(rc); + else if( ( vi.yStart == cellsize - 1 || vi.yStart == cellsize - 2 ) && vi.cEnd == cellsize ) + rc = SC_NORMAL; + + else if( vi.yStart == cellsize / 2 && vi.cEnd == cellsize ) + rc = SC_INSERT; + + else if( vi.yStart == 0 && vi.cEnd == cellsize ) + rc = SC_SPECIAL1; + + else if( vi.yStart == 0 && vi.cEnd == cellsize / 2 ) + rc = SC_SPECIAL2; + + else + rc = SC_NONE; + } + + return rc; } -void hb_gt_SetCursorStyle(int style) +void hb_gt_SetCursorStyle( USHORT style ) { /* Chen Kedem */ - char cellsize; - VIOCURSORINFO vi; + char cellsize; + VIOCURSORINFO vi; - cellsize = hb_gt_GetCellSize(); - switch(style) - { - case SC_NONE: - hb_gt_SetCursorSize( 0, 0, 0); - break; + cellsize = hb_gt_GetCellSize(); + switch( style ) + { + case SC_NONE: + hb_gt_SetCursorSize( 0, 0, 0 ); + break; - case SC_NORMAL: - hb_gt_SetCursorSize(cellsize-1, cellsize, 1); - break; + case SC_NORMAL: + hb_gt_SetCursorSize( cellsize - 1, cellsize, 1 ); + break; - case SC_INSERT: - hb_gt_SetCursorSize(cellsize/2, cellsize, 1); - break; + case SC_INSERT: + hb_gt_SetCursorSize( cellsize / 2, cellsize, 1 ); + break; - case SC_SPECIAL1: - hb_gt_SetCursorSize(0, cellsize, 1); - break; + case SC_SPECIAL1: + hb_gt_SetCursorSize( 0, cellsize, 1 ); + break; - case SC_SPECIAL2: - hb_gt_SetCursorSize(0, cellsize/2, 1); - break; + case SC_SPECIAL2: + hb_gt_SetCursorSize( 0, cellsize / 2, 1 ); + break; - default: - break; - } + default: + break; + } } -void hb_gt_Puts(USHORT usRow, USHORT usCol, BYTE attr, char *str, int len) +void hb_gt_Puts( USHORT usRow, USHORT usCol, BYTE attr, BYTE * str, ULONG len ) { - VioWrtCharStrAtt(str, (USHORT) len, usRow, usCol, (BYTE *) &attr, 0); + VioWrtCharStrAtt( ( char * ) str, ( USHORT ) len, usRow, usCol, ( BYTE * ) &attr, 0 ); } -void hb_gt_GetText(USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight, char *dest) +void hb_gt_GetText( USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight, BYTE *dest ) { - USHORT width, y; + USHORT width, y; - width = (USHORT) ((usRight - usLeft + 1) * 2); - for (y = usTop; y <= usBottom; y++) - { - VioReadCellStr((BYTE *) dest, &width, y, usLeft, 0); - dest += width; - } + width = ( USHORT ) ( ( usRight - usLeft + 1 ) * 2 ); + for( y = usTop; y <= usBottom; y++ ) + { + VioReadCellStr( dest, &width, y, usLeft, 0 ); + dest += width; + } } -void hb_gt_PutText(USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight, char *srce) +void hb_gt_PutText( USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight, BYTE *srce ) { - USHORT width, y; + USHORT width, y; - width = (USHORT) ((usRight - usLeft + 1) * 2); - for (y = usTop; y <= usBottom; y++) - { - VioWrtCellStr((BYTE *) srce, width, y, usLeft, 0); - srce += width; - } + width = ( USHORT ) ( ( usRight - usLeft + 1 ) * 2 ); + for( y = usTop; y <= usBottom; y++ ) + { + VioWrtCellStr( srce, width, y, usLeft, 0 ); + srce += width; + } } void hb_gt_SetAttribute( USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight, BYTE attr ) @@ -263,27 +285,27 @@ void hb_gt_SetAttribute( USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT us TODO: work with DispBegin DispEnd */ - USHORT width, y + USHORT width, y /* assume top level check that coordinate are all valid and fall within visible screen, else if width cannot be fit on current line it is going to warp to the next line */ - width = (USHORT) (usRight - usLeft + 1); - for (y = usTop; y <= usBottom; y++) - VioWrtNAttr( &attr, width, y, usLeft, 0); + width = ( USHORT ) ( usRight - usLeft + 1 ); + for( y = usTop; y <= usBottom; y++ ) + VioWrtNAttr( &attr, width, y, usLeft, 0 ); } void hb_gt_DrawShadow( USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight, BYTE attr ) { /* Chen Kedem */ - hb_gt_SetAttribute( usBottom+1, usLeft+1, usBottom+1, usRight+1, attr ); - hb_gt_SetAttribute( usTop+1, usRight+1, usBottom+1, usRight+1, attr ); + hb_gt_SetAttribute( usBottom + 1, usLeft + 1, usBottom + 1, usRight + 1, attr ); + hb_gt_SetAttribute( usTop + 1, usRight + 1, usBottom + 1, usRight + 1, attr ); } -void hb_gt_DispBegin(void) +void hb_gt_DispBegin( void ) { /* TODO: Is there a way to change screen buffers? ie: can we write somewhere without it going to the screen @@ -292,32 +314,31 @@ void hb_gt_DispBegin(void) */ } -void hb_gt_DispEnd(void) +void hb_gt_DispEnd( void ) { /* TODO: here we flush the buffer, and restore normal screen writes */ } BOOL hb_gt_SetMode( USHORT uiRows, USHORT uiCols ) { - VIOMODEINFO vi; + VIOMODEINFO vi; - VioGetMode(&vi, 0); /* fill structure with current settings */ - vi.row = uiRows; - vi.col = uiCols; - return (BOOL)VioSetMode(&vi, 0); /* 0 = Ok, other = Fail */ + VioGetMode( &vi, 0 ); /* fill structure with current settings */ + vi.row = uiRows; + vi.col = uiCols; + return ( BOOL ) VioSetMode( &vi, 0 ); /* 0 = Ok, other = Fail */ } -void hb_gt_Replicate(char c, ULONG nLength) +void hb_gt_Replicate( BYTE c, ULONG ulLen ) { - /* TODO: this will write character c nlength times to the screen. - Note that it is not used yet - If there is no native function that supports this, it is - already handled in a generic way by higher level functions. - */ - - c= ' '; - nLength = 0; + /* TODO: this will write character c nlength times to the screen. + Note that it is not used yet + If there is no native function that supports this, it is + already handled in a generic way by higher level functions. + */ + c = ' '; + ulLen = 0; } BOOL hb_gt_GetBlink() @@ -325,10 +346,10 @@ BOOL hb_gt_GetBlink() /* Chen Kedem */ VIOINTENSITY vi; - vi.cb = sizeof(VIOINTENSITY); /* 6 */ + vi.cb = sizeof( VIOINTENSITY ); /* 6 */ vi.type = 2; /* get intensity/blink toggle */ - VioGetState(&vi, 0); - return (vi.fs == 0); /* 0 = blink, 1 = intens */ + VioGetState( &vi, 0 ); + return ( vi.fs == 0 ); /* 0 = blink, 1 = intens */ } void hb_gt_SetBlink( BOOL bBlink ) @@ -336,8 +357,8 @@ void hb_gt_SetBlink( BOOL bBlink ) /* Chen Kedem */ VIOINTENSITY vi; - vi.cb = sizeof(VIOINTENSITY); /* 6 */ + vi.cb = sizeof( VIOINTENSITY ); /* 6 */ vi.type = 2; /* set intensity/blink toggle */ - vi.fs = (bBlink ? 0 : 1); /* 0 = blink, 1 = intens */ - VioSetState(&vi, 0); + vi.fs = ( bBlink ? 0 : 1 ); /* 0 = blink, 1 = intens */ + VioSetState( &vi, 0 ); } diff --git a/harbour/source/rtl/gt/gtwin.c b/harbour/source/rtl/gt/gtwin.c index f30e3165a1..0e7eeef1a7 100644 --- a/harbour/source/rtl/gt/gtwin.c +++ b/harbour/source/rtl/gt/gtwin.c @@ -3,14 +3,43 @@ */ /* - * GTWIN.C: Video subsystem for Windows 95/NT compilers. + * Harbour Project source code: + * Video subsystem for Win32 compilers * + * Copyright 1999 {list of individual authors and e-mail addresses} + * www - http://www.harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version, with one exception: + * + * The exception is that if you link the Harbour Runtime Library (HRL) + * and/or the Harbour Virtual Machine (HVM) with other files to produce + * an executable, this does not by itself cause the resulting executable + * to be covered by the GNU General Public License. Your use of that + * executable is in no way restricted on account of linking the HRL + * and/or HVM code into it. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit + * their web site at http://www.gnu.org/). + * + */ + +/* * Portions of this module are based (somewhat) on VIDMGR by * Andrew Clarke and modified for the Harbour project - * - * User programs should never call this layer directly! */ +/* NOTE: User programs should never call this layer directly! */ + #include #include @@ -25,7 +54,7 @@ #if ! defined(__GNUC__) #ifdef __CYGWIN__ -typedef WORD far *LPWORD; +typedef WORD far * LPWORD; #endif #endif /* __GNUC__ */ @@ -49,407 +78,403 @@ static HANDLE HCursor; /* When DispBegin is in effect, all cursor related #define HB_LOG 0 #if (defined(HB_LOG) && (HB_LOG != 0)) -static FILE* flog = 0; +static FILE * flog = 0; int line = 0; #define LOG(x) \ -do { \ - flog = fopen("c:/tmp/gt.log", "a"); \ - fprintf(flog, "%5d> GT: %s\n", line++, x); \ - fflush(flog); \ - fclose(flog); \ -} while (0) +do +{ \ + flog = fopen( "c:/tmp/gt.log", "a" ); \ + fprintf( flog, "%5d> GT: %s\n", line++, x ); \ + fflush( flog ); \ + fclose( flog ); \ +} while ( 0 ) #else #define LOG(x) #endif /* #if (defined(HB_LOG) && (HB_LOG != 0)) */ -void hb_gt_Init(void) +void hb_gt_Init( void ) { - LOG("Initializing"); - HInput = GetStdHandle(STD_INPUT_HANDLE); - HOriginal = HOutput = HCursor = GetStdHandle(STD_OUTPUT_HANDLE); + LOG( "Initializing" ); + HInput = GetStdHandle( STD_INPUT_HANDLE ); + HOriginal = HOutput = HCursor = GetStdHandle( STD_OUTPUT_HANDLE ); } -void hb_gt_Done(void) +void hb_gt_Done( void ) { - if( HOutput != HOriginal ) - { - /* ptucker */ - /* because the current screen may not be the one that was active - when the app started, we need to restore that screen and update - it with the current image before quitting. - */ - /* easy fix ;-) */ - hb_gtDispBegin(); /* must use these versions ! */ - hb_gtDispEnd(); - - } - CloseHandle(HInput); - HInput = INVALID_HANDLE_VALUE; - CloseHandle(HOutput); - HOutput = INVALID_HANDLE_VALUE; - if( HStealth != INVALID_HANDLE_VALUE ) - { - CloseHandle(HStealth); - HStealth = INVALID_HANDLE_VALUE; - } - LOG("Ending"); + if( HOutput != HOriginal ) + { + /* ptucker */ + /* because the current screen may not be the one that was active + when the app started, we need to restore that screen and update + it with the current image before quitting. + */ + /* easy fix ;-) */ + hb_gtDispBegin(); /* must use these versions ! */ + hb_gtDispEnd(); + } + CloseHandle( HInput ); + HInput = INVALID_HANDLE_VALUE; + CloseHandle( HOutput ); + HOutput = INVALID_HANDLE_VALUE; + if( HStealth != INVALID_HANDLE_VALUE ) + { + CloseHandle( HStealth ); + HStealth = INVALID_HANDLE_VALUE; + } + LOG( "Ending" ); } -int hb_gt_IsColor(void) +BOOL hb_gt_IsColor( void ) { /* TODO: need to call something to do this instead of returning TRUE */ return TRUE; } -USHORT hb_gt_GetScreenWidth(void) +USHORT hb_gt_GetScreenWidth( void ) { - CONSOLE_SCREEN_BUFFER_INFO csbi; + CONSOLE_SCREEN_BUFFER_INFO csbi; - LOG("GetScreenWidth"); - GetConsoleScreenBufferInfo(HOutput, &csbi); -/* return csbi.dwMaximumWindowSize.X; */ -/* return max(csbi.srWindow.Right - csbi.srWindow.Left +1,40); */ - return max(csbi.dwSize.X,40); + LOG( "GetScreenWidth" ); + GetConsoleScreenBufferInfo( HOutput, &csbi ); +/* return csbi.dwMaximumWindowSize.X; */ +/* return max( csbi.srWindow.Right - csbi.srWindow.Left + 1, 40 ); */ + return max( csbi.dwSize.X, 40 ); } -USHORT hb_gt_GetScreenHeight(void) +USHORT hb_gt_GetScreenHeight( void ) { - CONSOLE_SCREEN_BUFFER_INFO csbi; + CONSOLE_SCREEN_BUFFER_INFO csbi; - LOG("GetScreenHeight"); - GetConsoleScreenBufferInfo(HOutput, &csbi); -/* return csbi.dwMaximumWindowSize.Y; */ -/* return max(csbi.srWindow.Bottom - csbi.srWindow.Top +1,25); */ - return max(csbi.dwSize.Y,25); + LOG( "GetScreenHeight" ); + GetConsoleScreenBufferInfo( HOutput, &csbi ); +/* return csbi.dwMaximumWindowSize.Y; */ +/* return max( csbi.srWindow.Bottom - csbi.srWindow.Top + 1, 25 ); */ + return max( csbi.dwSize.Y, 25 ); } -void hb_gt_SetPos(USHORT cRow, USHORT cCol) +void hb_gt_SetPos( USHORT cRow, USHORT cCol ) { - COORD dwCursorPosition; + COORD dwCursorPosition; - LOG("GotoXY"); - dwCursorPosition.X = (SHORT) (cCol); - dwCursorPosition.Y = (SHORT) (cRow); - LOG(".. Calling SetConsoleCursorPosition()"); - SetConsoleCursorPosition(HCursor, dwCursorPosition); - LOG(".. Called SetConsoleCursorPosition()"); + LOG( "GotoXY" ); + dwCursorPosition.X = ( SHORT ) cCol; + dwCursorPosition.Y = ( SHORT ) cRow; + LOG( ".. Calling SetConsoleCursorPosition()" ); + SetConsoleCursorPosition( HCursor, dwCursorPosition ); + LOG( ".. Called SetConsoleCursorPosition()" ); } -int hb_gt_GetCursorStyle(void) +USHORT hb_gt_GetCursorStyle( void ) { - CONSOLE_CURSOR_INFO cci; - int rc; + CONSOLE_CURSOR_INFO cci; + int rc; - LOG("GetCursorStyle"); - GetConsoleCursorInfo(HCursor, &cci); + LOG( "GetCursorStyle" ); + GetConsoleCursorInfo( HCursor, &cci ); - if(!cci.bVisible) - { - rc=SC_NONE; - } - else - { - switch(cci.dwSize) - { - case 50: - rc=SC_INSERT; /* half block in clipper */ - break; + if( ! cci.bVisible ) + { + rc = SC_NONE; + } + else + { + switch( cci.dwSize ) + { + case 50: + rc = SC_INSERT; /* half block in clipper */ + break; - case 99: - rc=SC_SPECIAL1; /* full block in clipper */ - break; + case 99: + rc = SC_SPECIAL1; /* full block in clipper */ + break; - case 66: - rc=SC_SPECIAL2; /* upper half block in clipper */ - break; - /* TODO: cannot tell if the block is upper or lower for cursor */ - /* Answer: Supposed to be upper third, but ms don't support it. */ + case 66: + rc = SC_SPECIAL2; /* upper half block in clipper */ + break; + /* TODO: cannot tell if the block is upper or lower for cursor */ + /* Answer: Supposed to be upper third, but ms don't support it. */ - default: - rc=SC_NORMAL; /* anything else, we'll call it normal */ - break; - } - } + default: + rc = SC_NORMAL; /* anything else, we'll call it normal */ + break; + } + } - return(rc); + return rc; } -void hb_gt_SetCursorStyle(int style) +void hb_gt_SetCursorStyle( USHORT style ) { - CONSOLE_CURSOR_INFO cci; + CONSOLE_CURSOR_INFO cci; - LOG("SetCursorStyle"); - GetConsoleCursorInfo(HCursor, &cci); - cci.bVisible = 1; /* always visible unless explicitly request off */ - switch (style) - { - case SC_NONE: - cci.bVisible = 0; - break; + LOG( "SetCursorStyle" ); + GetConsoleCursorInfo( HCursor, &cci ); + cci.bVisible = 1; /* always visible unless explicitly request off */ + switch( style ) + { + case SC_NONE: + cci.bVisible = 0; + break; - case SC_INSERT: - cci.dwSize = 50; - break; + case SC_INSERT: + cci.dwSize = 50; + break; - case SC_SPECIAL1: - cci.dwSize = 99; - break; - - case SC_SPECIAL2: - cci.dwSize = 66; - /* In their infinite wisdom, MS doesn't support cursors that - don't start at the bottom of the cell */ - break; - case SC_NORMAL: - default: /* traps for invalid values */ - cci.dwSize = 25; /* this was 12, but when used in full screen dos window - cursor state is erratic - doesn't turn off, etc. */ - break; - - } - SetConsoleCursorInfo(HCursor, &cci); + case SC_SPECIAL1: + cci.dwSize = 99; + break; + case SC_SPECIAL2: + cci.dwSize = 66; + /* In their infinite wisdom, MS doesn't support cursors that + don't start at the bottom of the cell */ + break; + case SC_NORMAL: + default: /* traps for invalid values */ + cci.dwSize = 25; /* this was 12, but when used in full screen dos window + cursor state is erratic - doesn't turn off, etc. */ + break; + } + SetConsoleCursorInfo( HCursor, &cci ); } -void hb_gt_Puts(USHORT cRow, USHORT cCol, BYTE attr, char *str, int len) +void hb_gt_Puts( USHORT cRow, USHORT cCol, BYTE attr, BYTE *str, ULONG len ) { - DWORD dwlen; - COORD coord; + DWORD dwlen; + COORD coord; - LOG("Puts"); - coord.X = (DWORD) (cCol); - coord.Y = (DWORD) (cRow); - WriteConsoleOutputCharacterA(HOutput, str, (DWORD)len, coord, &dwlen); - FillConsoleOutputAttribute(HOutput, (WORD)(attr&0xff), (DWORD)len, coord, &dwlen); + LOG( "Puts" ); + coord.X = ( DWORD ) cCol; + coord.Y = ( DWORD ) cRow; + WriteConsoleOutputCharacterA( HOutput, str, ( DWORD ) len, coord, &dwlen ); + FillConsoleOutputAttribute( HOutput, ( WORD )( attr & 0xFF ), ( DWORD ) len, coord, &dwlen ); } -void hb_gt_GetText(USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight, char *dest) +void hb_gt_GetText( USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight, BYTE * dest ) { - DWORD len; - COORD coord; - LPWORD pwattr; - char * pstr; - USHORT width, i, y; + DWORD len; + COORD coord; + LPWORD pwattr; + BYTE * pstr; + USHORT width, i, y; - LOG("GetText"); - width = (usRight - usLeft + 1); - pwattr = (LPWORD) hb_xgrab(width * sizeof(*pwattr)); - if (!pwattr) - { + LOG( "GetText" ); + width = ( usRight - usLeft + 1 ); + pwattr = ( LPWORD ) hb_xgrab( width * sizeof( *pwattr ) ); + if( ! pwattr ) + { return; - } - pstr = (char *)hb_xgrab(width); - if (!pstr) - { - hb_xfree(pwattr); + } + pstr = ( BYTE * ) hb_xgrab( width ); + if( ! pstr ) + { + hb_xfree( pwattr ); return; - } - for (y = usTop; y <= usBottom; y++) - { - coord.X = (DWORD) (usLeft); - coord.Y = (DWORD) (y); - ReadConsoleOutputCharacterA(HOutput, pstr, width, coord, &len); - ReadConsoleOutputAttribute(HOutput, pwattr, width, coord, &len); - for (i = 0; i < width; i++) - { - *dest = *(pstr + i); - dest++; - *dest = (char)*(pwattr + i)&0xff; - dest++; - } - } - hb_xfree(pwattr); - hb_xfree(pstr); + } + for( y = usTop; y <= usBottom; y++ ) + { + coord.X = ( DWORD ) usLeft; + coord.Y = ( DWORD ) y; + ReadConsoleOutputCharacterA( HOutput, pstr, width, coord, &len ); + ReadConsoleOutputAttribute( HOutput, pwattr, width, coord, &len ); + for( i = 0; i < width; i++ ) + { + *dest = *( pstr + i ); + dest++; + *dest = ( BYTE ) *( pwattr + i ) & 0xFF; + dest++; + } + } + hb_xfree( pwattr ); + hb_xfree( pstr ); } -void hb_gt_PutText(USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight, char *srce) +void hb_gt_PutText( USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight, BYTE * srce ) { - DWORD len; - COORD coord; - LPWORD pwattr; - char *pstr; - USHORT width, i, y; + DWORD len; + COORD coord; + LPWORD pwattr; + BYTE * pstr; + USHORT width, i, y; - LOG("PutText"); - width = (usRight - usLeft + 1); - pwattr = (LPWORD) hb_xgrab(width * sizeof(*pwattr)); - if (!pwattr) - { + LOG( "PutText") ; + width = ( usRight - usLeft + 1 ); + pwattr = ( LPWORD ) hb_xgrab( width * sizeof( *pwattr ) ); + if( ! pwattr ) + { return; - } - pstr = (char *)hb_xgrab(width); - if (!pstr) - { - hb_xfree(pwattr); + } + pstr = ( BYTE * ) hb_xgrab( width ); + if( ! pstr ) + { + hb_xfree( pwattr ); return; - } - for (y = usTop; y <= usBottom; y++) - { - for (i = 0; i < width; i++) - { - *(pstr + i) = *srce; - srce++; - *(pwattr + i) = ((WORD)((unsigned char)*srce)&0xff); - srce++; - } - coord.X = (DWORD) (usLeft); - coord.Y = (DWORD) (y); - WriteConsoleOutputAttribute(HOutput, pwattr, width, coord, &len); - WriteConsoleOutputCharacterA(HOutput, pstr, width, coord, &len); - } - hb_xfree(pwattr); - hb_xfree(pstr); + } + for( y = usTop; y <= usBottom; y++ ) + { + for( i = 0; i < width; i++ ) + { + *( pstr + i ) = *srce; + srce++; + *( pwattr + i ) = ( ( WORD )( ( BYTE ) *srce ) & 0xFF ); + srce++; + } + coord.X = ( DWORD ) usLeft; + coord.Y = ( DWORD ) y; + WriteConsoleOutputAttribute( HOutput, pwattr, width, coord, &len ); + WriteConsoleOutputCharacterA( HOutput, pstr, width, coord, &len ); + } + hb_xfree( pwattr ); + hb_xfree( pstr ); } void hb_gt_SetAttribute( USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight, BYTE attr ) { /* ptucker */ - DWORD len; - COORD coord; - USHORT width, y; + DWORD len; + COORD coord; + USHORT width, y; - width = (usRight - usLeft + 1); + width = ( usRight - usLeft + 1 ); - coord.X = (DWORD) (usLeft); - - for (y = usTop; y <= usBottom; y++) - { - coord.Y = y; - FillConsoleOutputAttribute(HOutput, (WORD)(attr&0xff), width, coord, &len); - } + coord.X = ( DWORD ) usLeft; + for( y = usTop; y <= usBottom; y++ ) + { + coord.Y = y; + FillConsoleOutputAttribute( HOutput, ( WORD )( attr & 0xFF ), width, coord, &len ); + } } void hb_gt_DrawShadow( USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight, BYTE attr ) { /* ptucker */ - DWORD len; - COORD coord; - USHORT width; + DWORD len; + COORD coord; + USHORT width; - width = (usRight - usLeft + 1); + width = ( usRight - usLeft + 1 ); - coord.X = (DWORD) (usLeft); - coord.Y = (DWORD) (usBottom); - - FillConsoleOutputAttribute(HOutput, (WORD)(attr&0xff), width, coord, &len); - hb_gt_SetAttribute( usTop, usRight, usBottom, usRight, attr ); + coord.X = ( DWORD ) usLeft; + coord.Y = ( DWORD ) usBottom; + FillConsoleOutputAttribute( HOutput, ( WORD )( attr & 0xFF ), width, coord, &len ); + hb_gt_SetAttribute( usTop, usRight, usBottom, usRight, attr ); } -USHORT hb_gt_Col(void) +USHORT hb_gt_Col( void ) { - CONSOLE_SCREEN_BUFFER_INFO csbi; + CONSOLE_SCREEN_BUFFER_INFO csbi; - LOG("WhereX"); - GetConsoleScreenBufferInfo(HCursor, &csbi); - return csbi.dwCursorPosition.X; + LOG( "WhereX" ); + GetConsoleScreenBufferInfo( HCursor, &csbi ); + return csbi.dwCursorPosition.X; } -USHORT hb_gt_Row(void) +USHORT hb_gt_Row( void ) { - CONSOLE_SCREEN_BUFFER_INFO csbi; + CONSOLE_SCREEN_BUFFER_INFO csbi; - LOG("WhereY"); - GetConsoleScreenBufferInfo(HCursor, &csbi); - return csbi.dwCursorPosition.Y; + LOG( "WhereY" ); + GetConsoleScreenBufferInfo( HCursor, &csbi ); + return csbi.dwCursorPosition.Y; } void hb_gt_Scroll( USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight, BYTE attr, SHORT sVert, SHORT sHoriz ) { /* ptucker */ - SMALL_RECT Source, Clip; - COORD Target; - CHAR_INFO FillChar; + SMALL_RECT Source, Clip; + COORD Target; + CHAR_INFO FillChar; - Source.Top = usTop; - Source.Left = usLeft; - Source.Bottom = usBottom; - Source.Right = usRight; + Source.Top = usTop; + Source.Left = usLeft; + Source.Bottom = usBottom; + Source.Right = usRight; - memcpy( &Clip, &Source, sizeof(Clip) ); + memcpy( &Clip, &Source, sizeof( Clip ) ); - if( (sHoriz | sVert) == 0 ) /* both zero? */ - { - Target.Y = usBottom+1; /* set outside the clipping region */ - Target.X = usRight+1; - } - else - { - Target.Y = usTop-sVert; - Target.X = usLeft-sHoriz; - } - FillChar.Char.AsciiChar = ' '; - FillChar.Attributes = (WORD)(attr&0xff); + if( ( sHoriz | sVert ) == 0 ) /* both zero? */ + { + Target.Y = usBottom+1; /* set outside the clipping region */ + Target.X = usRight+1; + } + else + { + Target.Y = usTop-sVert; + Target.X = usLeft-sHoriz; + } + FillChar.Char.AsciiChar = ' '; + FillChar.Attributes = ( WORD )( attr & 0xFF ); - ScrollConsoleScreenBuffer(HOutput, &Source, &Clip, Target, &FillChar); + ScrollConsoleScreenBuffer( HOutput, &Source, &Clip, Target, &FillChar ); } -void hb_gt_DispBegin(void) +void hb_gt_DispBegin( void ) { /* ptucker */ - if( hb_gtDispCount() == 1 ) - { - COORD coDest = {0, 0}; - COORD coBuf; /* the size of the buffer to read into */ - CHAR_INFO *pCharInfo; /* buffer to store info from ReadConsoleOutput */ - SMALL_RECT srWin; /* source rectangle to read from */ - CONSOLE_SCREEN_BUFFER_INFO csbi; + if( hb_gtDispCount() == 1 ) + { + COORD coDest = { 0, 0 }; + COORD coBuf; /* the size of the buffer to read into */ + CHAR_INFO * pCharInfo; /* buffer to store info from ReadConsoleOutput */ + SMALL_RECT srWin; /* source rectangle to read from */ + CONSOLE_SCREEN_BUFFER_INFO csbi; - GetConsoleScreenBufferInfo(HCursor, &csbi); - srWin.Top = srWin.Left = 0; - srWin.Bottom = (coBuf.Y = csbi.dwSize.Y) -1; - srWin.Right = (coBuf.X = csbi.dwSize.X) -1; + GetConsoleScreenBufferInfo( HCursor, &csbi ); + srWin.Top = srWin.Left = 0; + srWin.Bottom = ( coBuf.Y = csbi.dwSize.Y ) - 1; + srWin.Right = ( coBuf.X = csbi.dwSize.X ) - 1; - /* allocate a buffer for the screen rectangle */ - pCharInfo = (CHAR_INFO *)hb_xgrab(coBuf.Y * coBuf.X * sizeof(CHAR_INFO)); + /* allocate a buffer for the screen rectangle */ + pCharInfo = ( CHAR_INFO * ) hb_xgrab( coBuf.Y * coBuf.X * sizeof( CHAR_INFO ) ); - /* read the screen rectangle into the buffer */ - ReadConsoleOutput(HOutput, /* current screen handle */ - pCharInfo, /* transfer area */ - coBuf, /* size of destination buffer */ - coDest, /* upper-left cell to write data to */ - &srWin); /* screen buffer rectangle to read from */ + /* read the screen rectangle into the buffer */ + ReadConsoleOutput( HOutput, /* current screen handle */ + pCharInfo, /* transfer area */ + coBuf, /* size of destination buffer */ + coDest, /* upper-left cell to write data to */ + &srWin ); /* screen buffer rectangle to read from */ - if( HStealth == INVALID_HANDLE_VALUE ) - { - HStealth = CreateConsoleScreenBuffer( - GENERIC_READ | GENERIC_WRITE, /* Access flag */ - FILE_SHARE_READ | FILE_SHARE_WRITE, /* Buffer share mode */ - NULL, /* Security attribute */ - CONSOLE_TEXTMODE_BUFFER, /* Type of buffer */ - NULL); /* reserved */ + if( HStealth == INVALID_HANDLE_VALUE ) + { + HStealth = CreateConsoleScreenBuffer( + GENERIC_READ | GENERIC_WRITE, /* Access flag */ + FILE_SHARE_READ | FILE_SHARE_WRITE, /* Buffer share mode */ + NULL, /* Security attribute */ + CONSOLE_TEXTMODE_BUFFER, /* Type of buffer */ + NULL ); /* reserved */ - } + } - hb_gt_SetScreenBuffer( HStealth, HOutput ); + hb_gt_SetScreenBuffer( HStealth, HOutput ); - HOutput = HStealth; - WriteConsoleOutput(HOutput, /* output handle */ - pCharInfo, /* data to write */ - coBuf, /* col/row size of source buffer */ - coDest, /* upper-left cell to write data from in src */ - &srWin); /* screen buffer rect to write data to */ + HOutput = HStealth; + WriteConsoleOutput( HOutput, /* output handle */ + pCharInfo, /* data to write */ + coBuf, /* col/row size of source buffer */ + coDest, /* upper-left cell to write data from in src */ + &srWin ); /* screen buffer rect to write data to */ - hb_xfree(pCharInfo); - } + hb_xfree( pCharInfo ); + } } -void hb_gt_DispEnd(void) +void hb_gt_DispEnd( void ) { /* ptucker */ - if( hb_gtDispCount() == 1 ) - { - HANDLE htmp = HStealth; + if( hb_gtDispCount() == 1 ) + { + HANDLE htmp = HStealth; - HStealth = HCursor; - hb_gt_DispBegin(); - HStealth = htmp; - } + HStealth = HCursor; + hb_gt_DispBegin(); + HStealth = htmp; + } } static BOOL hb_gt_SetScreenBuffer( HANDLE HNew, HANDLE HOld ) @@ -457,72 +482,72 @@ static BOOL hb_gt_SetScreenBuffer( HANDLE HNew, HANDLE HOld ) /* ptucker */ /* set a new buffer to have the same characteristics as an existing buffer */ - CONSOLE_SCREEN_BUFFER_INFO csbi; - SMALL_RECT srWin; + CONSOLE_SCREEN_BUFFER_INFO csbi; + SMALL_RECT srWin; - GetConsoleScreenBufferInfo(HOld, &csbi); + GetConsoleScreenBufferInfo( HOld, &csbi ); - /* new console window size and scroll position */ - srWin.Top = srWin.Left = 0; - srWin.Bottom = csbi.dwSize.Y - 1; - srWin.Right = csbi.dwSize.X - 1; + /* new console window size and scroll position */ + srWin.Top = srWin.Left = 0; + srWin.Bottom = csbi.dwSize.Y - 1; + srWin.Right = csbi.dwSize.X - 1; - SetConsoleScreenBufferSize(HNew, csbi.dwSize); - SetConsoleWindowInfo(HNew, TRUE, &csbi.srWindow); - SetConsoleWindowInfo(HNew, FALSE, &srWin); + SetConsoleScreenBufferSize( HNew, csbi.dwSize ); + SetConsoleWindowInfo( HNew, TRUE, &csbi.srWindow ); + SetConsoleWindowInfo( HNew, FALSE, &srWin ); - return 0; + return 0; } BOOL hb_gt_SetMode( USHORT uiRows, USHORT uiCols ) { /* ptucker */ - CONSOLE_SCREEN_BUFFER_INFO csbi; - SMALL_RECT srWin; - COORD coBuf; + CONSOLE_SCREEN_BUFFER_INFO csbi; + SMALL_RECT srWin; + COORD coBuf; - GetConsoleScreenBufferInfo(HOutput, &csbi); - coBuf = GetLargestConsoleWindowSize(HOutput); + GetConsoleScreenBufferInfo( HOutput, &csbi ); + coBuf = GetLargestConsoleWindowSize( HOutput ); - /* new console window size and scroll position */ - srWin.Top = srWin.Left = 0; - srWin.Bottom = (SHORT) (min(uiRows, coBuf.Y) - 1); - srWin.Right = (SHORT) (min(uiCols, coBuf.X) - 1); + /* new console window size and scroll position */ + srWin.Top = srWin.Left = 0; + srWin.Bottom = ( SHORT ) ( min( uiRows, coBuf.Y ) - 1 ); + srWin.Right = ( SHORT ) ( min( uiCols, coBuf.X ) - 1 ); - /* new console buffer size */ - coBuf.Y = uiRows; - coBuf.X = uiCols; + /* new console buffer size */ + coBuf.Y = uiRows; + coBuf.X = uiCols; - /* if the current buffer is larger than what we want, resize the */ - /* console window first, then the buffer */ - if ((DWORD) csbi.dwSize.X * csbi.dwSize.Y > (DWORD) uiCols * uiRows ) - { - SetConsoleWindowInfo(HOutput, TRUE, &srWin); - SetConsoleScreenBufferSize(HOutput, coBuf); - } - else if ((DWORD) csbi.dwSize.X * csbi.dwSize.Y < (DWORD) uiCols * uiRows ) - { - SetConsoleScreenBufferSize(HOutput, coBuf); - SetConsoleWindowInfo(HOutput, TRUE, &srWin); - } - return 0; + /* if the current buffer is larger than what we want, resize the */ + /* console window first, then the buffer */ + if( ( DWORD ) csbi.dwSize.X * csbi.dwSize.Y > ( DWORD ) uiCols * uiRows ) + { + SetConsoleWindowInfo( HOutput, TRUE, &srWin ); + SetConsoleScreenBufferSize( HOutput, coBuf ); + } + else if( ( DWORD ) csbi.dwSize.X * csbi.dwSize.Y < ( DWORD ) uiCols * uiRows ) + { + SetConsoleScreenBufferSize( HOutput, coBuf ); + SetConsoleWindowInfo( HOutput, TRUE, &srWin ); + } + return 0; } -void hb_gt_Replicate(char c, DWORD nLength) +void hb_gt_Replicate( BYTE c, ULONG ulLength ) { /* ptucker */ - COORD coBuf = {0,0}; - DWORD nWritten; + COORD coBuf = { 0, 0 }; + DWORD dwWritten; /* TODO: later... */ - FillConsoleOutputCharacter( - HOutput, /* handle to screen buffer */ - c, /* character to write */ - nLength, /* number of cells to write */ - coBuf, /* coordinates of first cell */ - &nWritten /* receives actual number written */ - ); + FillConsoleOutputCharacter( + HOutput, /* handle to screen buffer */ + c, /* character to write */ + ( DWORD ) ulLength, /* number of cells to write */ + coBuf, /* coordinates of first cell */ + &dwWritten /* receives actual number written */ + ); } @@ -542,14 +567,14 @@ void hb_gt_DebugScreen( BOOL activate ) { if( HDOutput == INVALID_HANDLE_VALUE ) { - HDOutput = CreateConsoleScreenBuffer( - GENERIC_READ | GENERIC_WRITE, /* Access flag */ - FILE_SHARE_READ | FILE_SHARE_WRITE, /* Buffer share mode */ - NULL, /* Security attribute */ - CONSOLE_TEXTMODE_BUFFER, /* Type of buffer */ - NULL); /* reserved */ + HDOutput = CreateConsoleScreenBuffer( + GENERIC_READ | GENERIC_WRITE, /* Access flag */ + FILE_SHARE_READ | FILE_SHARE_WRITE, /* Buffer share mode */ + NULL, /* Security attribute */ + CONSOLE_TEXTMODE_BUFFER, /* Type of buffer */ + NULL ); /* reserved */ - hb_gt_SetScreenBuffer( HDOutput, HOutput ); + hb_gt_SetScreenBuffer( HDOutput, HOutput ); } HOsave = HOutput; HOutput = HCursor = HDOutput; diff --git a/harbour/source/rtl/gtapi.c b/harbour/source/rtl/gtapi.c index a3fa0c52db..426dfd8e44 100644 --- a/harbour/source/rtl/gtapi.c +++ b/harbour/source/rtl/gtapi.c @@ -107,10 +107,10 @@ void hb_gtExit( void ) hb_xfree( s_Color ); } -int hb_gtBox( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, char * pbyFrame ) +int hb_gtBox( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, BYTE * pbyFrame ) { - char pszBox[ 10 ]; - char cPadChar; + BYTE pszBox[ 10 ]; + BYTE cPadChar; USHORT uiRow; USHORT uiCol; @@ -604,13 +604,16 @@ int hb_gtRectSize( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, return 0; } -int hb_gtRepChar( USHORT uiRow, USHORT uiCol, USHORT uiChar, USHORT uiCount ) +int hb_gtRepChar( USHORT uiRow, USHORT uiCol, BYTE byChar, USHORT uiCount ) { int rc; - char buff[ 255 ]; + BYTE buff[ 255 ]; - memset( buff, uiChar, uiCount ); - buff[ uiCount ] = 0; + if( uiCount > sizeof( buff ) ) + return 1; + + memset( buff, byChar, uiCount ); + buff[ uiCount ] = '\0'; rc = hb_gtSetPos( uiRow, uiCol ); if( rc != 0 ) return rc; @@ -619,16 +622,16 @@ int hb_gtRepChar( USHORT uiRow, USHORT uiCol, USHORT uiChar, USHORT uiCount ) return rc; } -int hb_gtRest( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, char * vlpScrBuff ) +int hb_gtRest( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, void * vlpScrBuff ) { - hb_gt_PutText( uiTop, uiLeft, uiBottom, uiRight, vlpScrBuff ); + hb_gt_PutText( uiTop, uiLeft, uiBottom, uiRight, ( BYTE * ) vlpScrBuff ); return 0; } -int hb_gtSave( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, char * vlpScrBuff ) +int hb_gtSave( USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, void * vlpScrBuff ) { - hb_gt_GetText( uiTop, uiLeft, uiBottom, uiRight, vlpScrBuff ); + hb_gt_GetText( uiTop, uiLeft, uiBottom, uiRight, ( BYTE * ) vlpScrBuff ); return 0; } @@ -674,14 +677,14 @@ int hb_gtSetSnowFlag( BOOL bNoSnow ) return 0; } -int hb_gtWrite( char * fpStr, ULONG length ) +int hb_gtWrite( BYTE * fpStr, ULONG length ) { int iRow, iCol, iMaxCol, iMaxRow; ULONG size = length; - char attr = s_Color[ s_uiColorIndex ] & 0xFF; + BYTE attr = s_Color[ s_uiColorIndex ] & 0xFF; char *fpPointer = fpStr; - /* TODO: this is doing more work than needed */ + /* TODO: this is doing more work than needed */ /* Determine where the cursor is going to end up */ iRow = s_uiCurrentRow; @@ -689,7 +692,7 @@ int hb_gtWrite( char * fpStr, ULONG length ) iMaxRow = hb_gtMaxRow(); iMaxCol = hb_gtMaxCol(); - length = ( length < iMaxCol-iCol+1 ) ? length : iMaxCol - iCol + 1; + length = ( length < iMaxCol - iCol + 1 ) ? length : iMaxCol - iCol + 1; size = length; @@ -743,7 +746,7 @@ int hb_gtWrite( char * fpStr, ULONG length ) return 0; } -int hb_gtWriteAt( USHORT uiRow, USHORT uiCol, char * fpStr, ULONG length ) +int hb_gtWriteAt( USHORT uiRow, USHORT uiCol, BYTE * fpStr, ULONG length ) { int rc; @@ -753,7 +756,7 @@ int hb_gtWriteAt( USHORT uiRow, USHORT uiCol, char * fpStr, ULONG length ) return hb_gtWrite( fpStr, length ); } -int hb_gtWriteCon( char * fpStr, ULONG length ) +int hb_gtWriteCon( BYTE * fpStr, ULONG length ) { int rc = 0, nLen = 0; BOOL ldisp = FALSE; diff --git a/harbour/source/rtl/inkey.c b/harbour/source/rtl/inkey.c index 00b0ffb468..e784d5dc22 100644 --- a/harbour/source/rtl/inkey.c +++ b/harbour/source/rtl/inkey.c @@ -550,8 +550,8 @@ HARBOUR HB_INKEY( void ) /* When not using the GT API, flush both stdout and stderr, because we are waiting for input and want to ensure that any user prompts are visible. */ -// fflush( stdout ); -// fflush( stderr ); +/* fflush( stdout ); */ +/* fflush( stderr ); */ #endif } diff --git a/harbour/source/rtl/mouse/mousedos.c b/harbour/source/rtl/mouse/mousedos.c index 0157915d02..904c51450c 100644 --- a/harbour/source/rtl/mouse/mousedos.c +++ b/harbour/source/rtl/mouse/mousedos.c @@ -3,37 +3,36 @@ */ /* - Harbour Project source code - - Harbour Mouse Subsystem for DOS - - Copyright 1999 Jose Lalin . - Luiz Rafael Culik . - www - http://www.harbour-project.org - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version, with one exception: - - The exception is that if you link the Harbour Runtime Library (HRL) - and/or the Harbour Virtual Machine (HVM) with other files to produce - an executable, this does not by itself cause the resulting executable - to be covered by the GNU General Public License. Your use of that - executable is in no way restricted on account of linking the HRL - and/or HVM code into it. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit - their web site at http://www.gnu.org/). - -*/ + * Harbour Project source code: + * Harbour Mouse Subsystem for DOS + * + * Copyright 1999 Jose Lalin + * Luiz Rafael Culik + * www - http://www.harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version, with one exception: + * + * The exception is that if you link the Harbour Runtime Library (HRL) + * and/or the Harbour Virtual Machine (HVM) with other files to produce + * an executable, this does not by itself cause the resulting executable + * to be covered by the GNU General Public License. Your use of that + * executable is in no way restricted on account of linking the HRL + * and/or HVM code into it. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit + * their web site at http://www.gnu.org/). + * + */ /* TOFIX: Change this to something better */ /* #define BORLANDC */ diff --git a/harbour/source/rtl/mouse/mouseos2.c b/harbour/source/rtl/mouse/mouseos2.c index 9f277b445b..e2dff88cf6 100644 --- a/harbour/source/rtl/mouse/mouseos2.c +++ b/harbour/source/rtl/mouse/mouseos2.c @@ -3,41 +3,46 @@ */ /* - Harbour Project source code + * Harbour Project source code: + * Harbour mouse subsystem for OS/2 compilers + * + * Copyright 1999 Chen Kedem + * www - http://www.harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version, with one exception: + * + * The exception is that if you link the Harbour Runtime Library (HRL) + * and/or the Harbour Virtual Machine (HVM) with other files to produce + * an executable, this does not by itself cause the resulting executable + * to be covered by the GNU General Public License. Your use of that + * executable is in no way restricted on account of linking the HRL + * and/or HVM code into it. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit + * their web site at http://www.gnu.org/). + * + */ - Harbour mouse subsystem for OS/2 compilers. - - Copyright 1999 by Chen Kedem - www - http://www.harbour-project.org - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version, with one exception: - - The exception is that if you link the Harbour Runtime Library (HRL) - and/or the Harbour Virtual Machine (HVM) with other files to produce - an executable, this does not by itself cause the resulting executable - to be covered by the GNU General Public License. Your use of that - executable is in no way restricted on account of linking the HRL - and/or HVM code into it. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit - their web site at http://www.gnu.org/). - - V 1.3 Chen Kedem hb_mouse_Hide() now work in any text - screen mode by calling VioGetMode. - hb_mouse_IsButtonPressed() now return - TRUE if any button was pressed. - V 1.0 Chen Kedem Initial version. -*/ +/* + * ChangeLog: + * + * V 1.3 Chen Kedem hb_mouse_Hide() now work in any text + * screen mode by calling VioGetMode. + * hb_mouse_IsButtonPressed() now return + * TRUE if any button was pressed. + * V 1.0 Chen Kedem Initial version. + * + */ #define INCL_MOU #define INCL_VIO /* needed only for VioGetMode/VIOMODEINFO */ diff --git a/harbour/source/rtl/mouse/mousetpl.c b/harbour/source/rtl/mouse/mousetpl.c index f8bd767388..b1993a4b88 100644 --- a/harbour/source/rtl/mouse/mousetpl.c +++ b/harbour/source/rtl/mouse/mousetpl.c @@ -3,36 +3,35 @@ */ /* - Harbour Project source code - - Harbour Mouse Subsystem Template - - Copyright 1999 Victor Szel - www - http://www.harbour-project.org - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version, with one exception: - - The exception is that if you link the Harbour Runtime Library (HRL) - and/or the Harbour Virtual Machine (HVM) with other files to produce - an executable, this does not by itself cause the resulting executable - to be covered by the GNU General Public License. Your use of that - executable is in no way restricted on account of linking the HRL - and/or HVM code into it. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit - their web site at http://www.gnu.org/). - -*/ + * Harbour Project source code: + * {Harbour Mouse Subsystem Template} + * + * Copyright 1999 {list of individual authors and e-mail addresses} + * www - http://www.harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version, with one exception: + * + * The exception is that if you link the Harbour Runtime Library (HRL) + * and/or the Harbour Virtual Machine (HVM) with other files to produce + * an executable, this does not by itself cause the resulting executable + * to be covered by the GNU General Public License. Your use of that + * executable is in no way restricted on account of linking the HRL + * and/or HVM code into it. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit + * their web site at http://www.gnu.org/). + * + */ #include "mouseapi.h" diff --git a/harbour/source/rtl/mouse/mousewin.c b/harbour/source/rtl/mouse/mousewin.c index b32c537326..0650e504af 100644 --- a/harbour/source/rtl/mouse/mousewin.c +++ b/harbour/source/rtl/mouse/mousewin.c @@ -3,36 +3,35 @@ */ /* - Harbour Project source code - - Harbour Mouse Subsystem for Windows - - Copyright 1999 ???????????? - www - http://www.harbour-project.org - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version, with one exception: - - The exception is that if you link the Harbour Runtime Library (HRL) - and/or the Harbour Virtual Machine (HVM) with other files to produce - an executable, this does not by itself cause the resulting executable - to be covered by the GNU General Public License. Your use of that - executable is in no way restricted on account of linking the HRL - and/or HVM code into it. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit - their web site at http://www.gnu.org/). - -*/ + * Harbour Project source code: + * Harbour Mouse Subsystem for Windows + * + * Copyright 1999 {list of individual authors and e-mail addresses} + * www - http://www.harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version, with one exception: + * + * The exception is that if you link the Harbour Runtime Library (HRL) + * and/or the Harbour Virtual Machine (HVM) with other files to produce + * an executable, this does not by itself cause the resulting executable + * to be covered by the GNU General Public License. Your use of that + * executable is in no way restricted on account of linking the HRL + * and/or HVM code into it. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit + * their web site at http://www.gnu.org/). + * + */ #include "mouseapi.h"