diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 05ef2af410..60e73fa049 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,23 @@ +19990921-12:25 EDT David G. Holm + + * source/rtl/console.c + - Removed special handling for Unix and Cygwin in HB___ACCEPT(), + per Georg Lehner + + * source/rtl/filesys.c + ! Corrected convert_open_flags() check for FO_READONLY to + mask out the share-mode flags before doing the check + ! Switched OS/2 from open() to sopen() in hb_fsOpen() + + * source/rtl/inkey.c + % Made two changes to Unix support, per Georg Lehner: + 1) Added 'ta.c_iflag &= ~ICRNL;' + 2) Changed 'return;' in hb_inkeyPoll() to 'ch = 0;' + + * source/rtl/gt/gtos2.c + ! Removed the unsigned to signed conversions for sVert and sHoriz, + now that the conversions are no longer needed + 19990921-15:33 GMT+3 Alexander Kresin * source/hbpp/hbpp.c * Yet another bug fixed with restrivted match markers consisting of more diff --git a/harbour/source/rtl/console.c b/harbour/source/rtl/console.c index b01f0ab845..c20505cbde 100644 --- a/harbour/source/rtl/console.c +++ b/harbour/source/rtl/console.c @@ -82,7 +82,7 @@ #include #endif -#if defined(OS_UNIX_COMPATIBLE) || defined(__CYGWIN__) +#if defined(__CYGWIN__) #include #include #endif @@ -1094,31 +1094,6 @@ HARBOUR HB___ACCEPT( void ) /* Internal Clipper function used in ACCEPT command if( hb_pcount() >= 1 ) /* cPrompt passed */ HB_QOUT(); -#if defined (OS_UNIX_COMPATIBLE) || defined(__CYGWIN__) - /* Read the data using fgets(), because hb_inkeyPoll() doesn't support - Unix compatible operating systems yet. */ - { - /* Set up for echoed canonical input */ - struct termios ta; - tcgetattr( STDIN_FILENO, &ta ); - ta.c_lflag |= ( ICANON | ECHO ); - tcsetattr( STDIN_FILENO, TCSAFLUSH, &ta ); - - /* Avoid an undefined variable warning */ - input = 0; - - /* Get a line of user input */ - s_szAcceptResult[ 0 ] = '\0'; /* start with something defined */ - if( fgets( s_szAcceptResult, ACCEPT_BUFFER_LEN, stdin ) ) - strtok( s_szAcceptResult, "\n" ); /* strip off the trailing newline if it exists */ - - /* Restore unechoed non-canonical input */ - ta.c_lflag &= ~( ICANON | ECHO ); - tcsetattr( STDIN_FILENO, TCSAFLUSH, &ta ); - - ulLen = strlen( s_szAcceptResult ); - } -#else ulLen = 0; input = 0; while( input != K_ENTER ) @@ -1152,7 +1127,6 @@ HARBOUR HB___ACCEPT( void ) /* Internal Clipper function used in ACCEPT command } } s_szAcceptResult[ ulLen ] = '\0'; -#endif hb_retc( s_szAcceptResult ); } diff --git a/harbour/source/rtl/filesys.c b/harbour/source/rtl/filesys.c index 60cd15a138..4bd22dfeb0 100644 --- a/harbour/source/rtl/filesys.c +++ b/harbour/source/rtl/filesys.c @@ -206,21 +206,23 @@ static int convert_open_flags( USHORT uiFlags ) /* by default FO_READ + FO_COMPAT is set */ int result_flags = 0; - result_flags |= O_BINARY; -/* DEBUG: printf("\nconvert_open_flags: O_BINARY"); */ +/* DEBUG: printf("\nHarbour open flags: 0x%04x", uiFlags); */ -#if defined( _MSC_VER ) || defined(__MINGW32__) - if( uiFlags == 0 ) + result_flags |= O_BINARY; +/* DEBUG: printf(", O_BINARY"); */ + +#if defined( _MSC_VER ) || defined(__MINGW32__) || defined(__IBMCPP__) + if( ( uiFlags & ( FO_WRITE | FO_READWRITE ) ) == FO_READ ) { result_flags |= O_RDONLY; -/* DEBUG: printf(" O_RDONLY"); */ +/* DEBUG: printf(", O_RDONLY"); */ } #else - if( uiFlags == 0 ) + if( ( uiFlags & ( FO_WRITE | FO_READWRITE ) ) == FO_READ ) { result_flags |= ( O_RDONLY | SH_COMPAT ); -/* DEBUG: printf(" O_RDONLY SH_COMPAT"); */ +/* DEBUG: printf(", O_RDONLY SH_COMPAT"); */ } #endif @@ -228,48 +230,48 @@ static int convert_open_flags( USHORT uiFlags ) if( uiFlags & FO_WRITE ) { result_flags |= O_WRONLY; -/* DEBUG: printf(" O_WRONLY"); */ +/* DEBUG: printf(", O_WRONLY"); */ } if( uiFlags & FO_READWRITE ) { result_flags |= O_RDWR; -/* DEBUG: printf(" O_RDWR"); */ +/* DEBUG: printf(", O_RDWR"); */ } -#if ! defined(_MSC_VER) && ! defined(__MINGW32__) +#if ! defined(_MSC_VER) && ! defined(__MINGW32__) && ! defined(__IBMCPP__) /* shared flags */ if( ( uiFlags & FO_DENYREAD ) == FO_DENYREAD ) { result_flags |= SH_DENYRD; -/* DEBUG: printf(" SH_DENYRD"); */ +/* DEBUG: printf(", SH_DENYRD"); */ } else if( uiFlags & FO_EXCLUSIVE ) { result_flags |= SH_DENYRW; -/* DEBUG: printf(" SH_DENYRW"); */ +/* DEBUG: printf(", SH_DENYRW"); */ } else if( uiFlags & FO_DENYWRITE ) { result_flags |= SH_DENYWR; -/* DEBUG: printf(" SH_DENYWR"); */ +/* DEBUG: printf(", SH_DENYWR"); */ } if( uiFlags & FO_DENYNONE ) { result_flags |= SH_DENYNO; -/* DEBUG: printf(" SH_DENYNO"); */ +/* DEBUG: printf(", SH_DENYNO"); */ } if( uiFlags & FO_SHARED ) { result_flags |= SH_DENYNO; -/* DEBUG: printf(" SH_DENYNO"); */ +/* DEBUG: printf(", SH_DENYNO"); */ } -/* DEBUG: printf(" 0x%04x\n", result_flags); */ #endif +/* DEBUG: printf(", C/C++ open flags: 0x%04x\n", result_flags); */ return result_flags; } @@ -322,7 +324,7 @@ FHANDLE hb_fsOpen( BYTE * pFilename, USHORT uiFlags ) { FHANDLE hFileHandle; -#if defined(HAVE_POSIX_IO) +#if defined(HAVE_POSIX_IO) && ! defined(__IBMCPP__) errno = 0; hFileHandle = open( ( char * ) pFilename, convert_open_flags( uiFlags ) ); @@ -348,7 +350,7 @@ FHANDLE hb_fsOpen( BYTE * pFilename, USHORT uiFlags ) hFileHandle = _open( ( char * ) pFilename, convert_open_flags( uiFlags ) ); s_uiErrorLast = errno; -#elif defined(__MINGW32__) +#elif defined(__MINGW32__) || defined(__IBMCPP__) int iShare = SH_DENYNO; @@ -585,7 +587,7 @@ ULONG hb_fsWriteLarge( FHANDLE hFileHandle, BYTE * pBuff, ULONG ulCount ) */ if( uiWritten == ( USHORT )-1 || uiWritten == 0 ) break; - + ulWritten += ( ULONG ) uiWritten; pPtr += uiWritten; } diff --git a/harbour/source/rtl/gt/gtos2.c b/harbour/source/rtl/gt/gtos2.c index 1783d9523a..7c97772155 100644 --- a/harbour/source/rtl/gt/gtos2.c +++ b/harbour/source/rtl/gt/gtos2.c @@ -118,9 +118,6 @@ void hb_gt_Scroll( USHORT usTop, USHORT usLeft, USHORT usBottom, USHORT usRight, /* Chen Kedem */ 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 */ diff --git a/harbour/source/rtl/inkey.c b/harbour/source/rtl/inkey.c index f411fe98f8..0e27cc0bb2 100644 --- a/harbour/source/rtl/inkey.c +++ b/harbour/source/rtl/inkey.c @@ -143,6 +143,7 @@ HB_CALL_ON_STARTUP_BEGIN( init_input_mode ) tcgetattr( STDIN_FILENO, &ta ); ta.c_lflag &= ~( ICANON | ECHO ); + ta.c_iflag &= ~ICRNL; ta.c_cc[ VMIN ] = 0; ta.c_cc[ VTIME ] = 0; tcsetattr( STDIN_FILENO, TCSAFLUSH, &ta ); @@ -428,7 +429,7 @@ void hb_inkeyPoll( void ) /* Poll the console keyboard to stuff the Harbour #elif defined(OS_UNIX_COMPATIBLE) /* TODO: */ if( ! read( STDIN_FILENO, &ch, 1 ) ) - return; + ch = 0; #elif defined(__CYGWIN__) /* TODO: */ /* NOTE: Cygwin needs the Unix support, but for some reason it @@ -439,7 +440,7 @@ void hb_inkeyPoll( void ) /* Poll the console keyboard to stuff the Harbour /* Only read keyboard input here if not called from the HVM and the typeahead buffer is empty. */ read( STDIN_FILENO, &ch, 1 ); /* Read a key */ - if( ch == '\n' ) ch = '\r'; /* Convert LF to CR */ +/// if( ch == '\n' ) ch = '\r'; /* Convert LF to CR */ } #else /* TODO: Support for other platforms, such as Mac */