Re: when will HTXParse_put_* be used?

Jiang Tao writes:
> Now I am planning to use HTXParse module.
> But I found it seems only HTXParse_write() is called
> when I composed a small program to test, and
> my question is :
> when will HTXparse_put_* be called?

This poses a classic problem about the streams in the library. There are 
three methods to write to a stream:

	character based
	string based
	block based

In theory you only need one so you can look at this as being syntaxtic
sugar that doesn't really have anything to do in the stream definition.
It could as well be for each stream to decide whether it wants to have
these methods or not instead of making them mandatory.

It is for the caller of the stream to decide on which method it wants 
to use so the stream can not know which method is used. Therefore it
must behave the same way regardles of the method. Indeed you will see
that most streams actually have the first two methods doing nothing 
but calling the block write with len 1 and strlen(s) repectively.

Obviously for performance reasons - the best method is to write as much
as possible in order to minimize the number of function calls. This 
is the reason why you only find that the block write method is being called.

Henrik

Received on Tuesday, 5 March 1996 18:50:22 UTC