> No. It's also wrong. Above constants may change in the future. > I want to add this ugly hack only for compilers used on given > system if it's strictly necessary and someone verified correct > value for CRTSCTS. > So far we have only one such compiler. It's OpenWatcom on Linux so > I want to make: > > HB_FUNC( __TP_CTRLCTS ) > { > #if !defined( CRTSCTS ) > # if defined( HB_OS_LINUX ) && defined( __WATCOMC__ ) > # define CRTSCTS 020000000000 > # endif > #endif > > #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; > int curvalue; > int rc; > > tcgetattr( port, &options ); > curvalue = ( options.c_cflag & CRTSCTS ) == CRTSCTS; > > if( newvalue == 0 ) > options.c_cflag &= ~CRTSCTS; > else if( newvalue == 1 ) > options.c_cflag |= CRTSCTS; > > if( newvalue >= 0 ) > rc = tcsetattr( port, TCSAFLUSH, &options ); > > hb_retni( curvalue ? 1 : 0 ); > #endif > } > > if someone will find other compiler which also needs this hack > or compiler where CRTSCTS is enum type not macro then I expect > that seeing iTODO warning message he will update the code to > work well with given system and C compiler and only for this > system and C compiler. I.e. if CRTSCTS is enum type in OS XXX > and compiler YYY then he can change the code to: > > #if !defined( CRTSCTS ) > # if defined( HB_OS_LINUX ) && defined( __WATCOMC__ ) > # define CRTSCTS 020000000000 > # elif defined( HB_OS_XXX ) && defined( __YYY__ ) > # define CRTSCTS CRTSCTS > # endif > #endif > > or if he verify that low level CRTL code support CRTSCTS flow > control and exact value NNN is necessary to activate then he > will make: > > #if !defined( CRTSCTS ) > # if defined( HB_OS_LINUX ) && defined( __WATCOMC__ ) > # define CRTSCTS 020000000000 > # elif defined( HB_OS_XXX ) && defined( __YYY__ ) > # define CRTSCTS NNN > # endif > #endif > > Otherwise he should leave iTODO warning which quite nicely informs > all developers at compile time that such functionality does not > exists in given build. Maybe it will be possible to add it in the > future if someone will know that it's a problem. > Now you simply pacified potential compile time error or warning > on all existing platforms so we do not hear about the problem > until some user will be clever enough to make deeper test and > check that some type of flow control does not work as expected > (probably it's to complicated for most of Harbour users) so > it's possible that real problem hidden by above modification > will never be fixed. > > BTW It will be also nice that he will leave some note about system > or C compiler version he used so in the future we can remove > support for older versions or add additional protection, i.e.: > # if defined( HB_OS_LINUX ) && defined( __WATCOMC__ ) && \ > __WATCOMC__ < 1290
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. Brgds, Viktor _______________________________________________ Harbour mailing list (attachment size limit: 40KB) Harbour@harbour-project.org http://lists.harbour-project.org/mailman/listinfo/harbour