Re: when will HTXParse_put_* be used?
To: Jiang Tao <firstname.lastname@example.org>
Subject: Re: when will HTXParse_put_* be used?
From: Henrik Frystyk Nielsen <email@example.com>
Date: Tue, 05 Mar 1996 18:50:10 -0500
Cc: W3C Lib <firstname.lastname@example.org>
From email@example.com Tue Mar 5 18: 50:22 1996
Reply-To: Henrik Frystyk Nielsen <firstname.lastname@example.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:
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.