[comp.lang.icon] reads

yost@esquire.UUCP (David A. Yost) (02/15/90)

I'm writing a filter that has to work in real time
with binary input, so I am calling reads().
If I call reads(), everything works, but extremely
slowly because reads() defaults to reading one character
at a time.  So I call reads() with a larger number as
the count argument.  Problem is, reads() insists
on waiting until all of those characters have come
in before it will return.  This is nice behavior for
some situations but horrible for others, in particular
my situation, where I need reads() to return with whatever
it got.

This leads me to suggest that reads() should have
an additional argument, perhaps as in this spec:

reads (f,i,j)

Values for j are:
0 (the default) will not return until it gets all
  i characters or until end of file.
1 returns with a partial count rather than block.
2 returns with a 0 or partial count rather than block.

Has anyone done anything like this?

I'm really just asking for access to more of the normal
functionality of the underlying UNIX system call.

 --dave yost
   yost@dpw.com or uunet!esquire!yost

kelvin@ASTRO.CS.IASTATE.EDU (02/15/90)

you might want to look at:

  A Stream Data Type that Supports Goal-Directed Pattern Matching on 
    Unbounded Sequences of Values, in Computer Languages, Vol. 15, No. 1
    (jan 1990) by Kelvin Nilsen

this describes one proposed solution to the sort of problems you mentioned.

unfortunately, i haven't yet gathered enough external funding and/or 
 academic rank to spend much time on development and distribution of
 my real-time derivative of Icon, Conicon.


Kelvin Nilsen/Dept. of Computer Science/Iowa State University/Ames, IA  50011 
 (515) 294-2259   kelvin@atanasoff.cs.iastate.edu  uunet!atanasoff!kelvin