W3C home > Mailing lists > Public > www-lib@w3.org > January to March 1996

Re: when will HTXParse_put_* be used?

From: Henrik Frystyk Nielsen <frystyk@w3.org>
Date: Tue, 05 Mar 1996 18:50:10 -0500
Message-Id: <9603052350.AA02623@www20>
To: Jiang Tao <jiangt@ceci.mit.edu>
Cc: W3C Lib <www-lib@w3.org>
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 23 April 2007 18:18:26 GMT