On Sun, 6 Dec 2009, Viktor Szakáts wrote: > I'm leaving this to you as it obviously has no point for > me to update it while I don't understand a single bit about it. > > I can restore original state but that won't help on the > original problem.
here's the deal in condensed form: CRTSCTS is system-dependendant. most every system could have it, but some don't. right now, the only one that doesn't have it is the watcom runtime on linux, but as we know what CRTSCTS is on linux (by way of extracting it from libc), we know how to make watcom define it to the correct value. the modifications przemek proposed makes the code reflect this line of thinking (so that probably noone will make the same mistake i made thinking there's no point for extra guards), and if one ever encounters another platform without CRTSCTS, he sees that - he either needs to come up with a value for CRTSCTS by some means (platform-specific tricks, experiments, crystal ball), or - we'll completely skip the code path that depepnds on a known CRTSCTS (and generate a warning to signal that "there is something that you should probably fix up for full user experience") the specific cases przemek cited were just to show that the actual value is system-dependant, not because they needed to be put in the code, as those systems are fine enough to indicate the needed values by themselves. this seems to be what przemek is getting to. it's essentially the same in effect that was in before, but is hopefully way more verbose in telling why it's there. Index: tpunix.c =================================================================== --- tpunix.c (revision 13140) +++ tpunix.c (working copy) @@ -267,22 +267,18 @@ hb_retl( FALSE ); } -#if ! defined( CRTSCTS ) - #if defined( HB_OS_LINUX ) || - defined( HB_OS_SUNOS ) - #define CRTSCTS 0x80000000 - #elif defined( HB_OS_BSD ) - #define CRTSCTS 0x00010000 - #elif defined( HB_OS_BEOS ) - #define CRTSCTS 0x00006000 - #elif defined( HB_OS_DARWIN ) - #define CRTSCTS 0x00030000 - #endif +#if !defined( CRTSCTS ) +# if defined( HB_OS_LINUX ) && defined( __WATCOMC__ ) && __WATCOMC__ < 1290 +# define CRTSCTS 020000000000 +# endif #endif HB_FUNC( __TP_CTRLCTS ) { -#if defined( CRTSCTS ) +#if !defined( CRTSCTS ) + int iTODO; + hb_retni( 0 ); +#else struct termios options; int port = hb_parnl( 1 ); int newvalue = hb_pcount() == 2 ? hb_parnl( 2 ) : -1; @@ -301,9 +297,6 @@ rc = tcsetattr( port, TCSAFLUSH, &options ); hb_retni( curvalue ? 1 : 0 ); -#else - int iTODO; - hb_retni( 0 ); #endif } as i see it, the essential difference is as follows: #if !defined( CRTSCTS ) && defined( __WATCOMC__ ) # define CRTSCTS 020000000000 #endif what this tells is "crtscts might not be defined on linux/watcom, so here's what it should be". #if !defined( CRTSCTS ) # if defined( HB_OS_LINUX ) && defined( __WATCOMC__ ) && __WATCOMC__ < 1290 # define CRTSCTS 020000000000 # endif #endif what this tells is "crtscts might not be defined. we know one such case is this older versions of watcom on linux, where crtscts should be this.". while the end result is quite the same, it makes whoever is reading think in a different way, which is actually needed here, as przemek helpfully explained. -- [-] mkdir /nonexistent _______________________________________________ Harbour mailing list (attachment size limit: 40KB) Harbour@harbour-project.org http://lists.harbour-project.org/mailman/listinfo/harbour