Re: char-ready?

From: Johann Friedrich Heinrichmeyer <Fritz.Heinrichmeyer_at_FernUni-Hagen.de>
Date: Thu, 23 Mar 95 09:05:57 +0100

Good!

I found a similar solution. I suggest to return the following instead of
(result? Truth : Ntruth):


But STOP. You have BUFFERED IO!. You should also look into the buffer of
port->storage_as.port.f.

Here is code from the tcl-addinput stuff modified (untested) by me:


#ifdef _STDIO_USES_IOSTREAM /* GNU libc */
# ifdef _IO_STDIO_H
# define READ_DATA_PENDING(fp) (max(0,(fp)->_IO_read_end \
        - (fp)->_IO_read_ptr))
#else
# define READ_DATA_PENDING(fp) (max(0,(fp)->_egptr - (fp)->_gptr))
# endif
#endif
#if (!defined (READ_DATA_PENDING)) && defined __SLBF
# define READ_DATA_PENDING(fp) (max(0,fp->_r))
#endif
#if !defined (READ_DATA_PENDING)
# define READ_DATA_PENDING(fp) (fp->_cnt)
#endif

  result += READ_DATA_PENDING(port->storage_as.port.f);
  return ((result>0)? STk_makeinteger(result) : Ntruth);

Advantage: You know how much You can read and as everything but Ntruth
is suggested as true not too much should be broken.

Fritz

-- 
Fritz Heinrichmeyer                             FernUniversitaet Hagen
FAX:   +49 2371/566236                          LG Elektronische Schaltungen
EMAIL: fritz.heinrichmeyer_at_fernuni-hagen.de     Frauenstuhlweg 31
PHONE: +49 02371/566-243                        58644 Iserlohn (Germany)
WWW:  http://ES-sun2.fernuni-hagen.de
Received on Thu Mar 23 1995 - 09:07:38 CET

This archive was generated by hypermail 2.3.0 : Mon Jul 21 2014 - 19:38:59 CEST