Annotation of libwww/Library/src/HTTee.c, revision 2.1

2.1     ! timbl       1: 
        !             2: /*
        !             3: **     T E E    C L A S S
        !             4: **
        !             5: **     The Tee class just writes to two streams.  Easy.
        !             6: **     See also the Black Hole stream which is even easier.
        !             7: */
        !             8: 
        !             9: 
        !            10: #include "HTTee.h"
        !            11: 
        !            12: 
        !            13: /*             Stream Object
        !            14: **             ------------
        !            15: */
        !            16: 
        !            17: struct _HTStream {
        !            18:        CONST HTStreamClass *   isa;
        !            19:        
        !            20:        HTStream *              s1;
        !            21:        HTStream *              s2;
        !            22: };
        !            23: 
        !            24: 
        !            25: PRIVATE void HTTee_put_character ARGS2(HTStream *, me, char, c)
        !            26: {
        !            27:     (*me->s1->isa->put_character)(me->s1, c);
        !            28:     (*me->s2->isa->put_character)(me->s2, c);
        !            29: }
        !            30: PRIVATE void HTTee_put_string ARGS2(HTStream *, me, CONST char*, s)
        !            31: {
        !            32:     (*me->s1->isa->put_string)(me->s1, s);
        !            33:     (*me->s2->isa->put_string)(me->s2, s);
        !            34: }
        !            35: PRIVATE void HTTee_write ARGS3(HTStream *, me, CONST char*, s, int, l)
        !            36: {
        !            37:     (*me->s1->isa->put_block)(me->s1, s, l);
        !            38:     (*me->s2->isa->put_block)(me->s2, s, l);
        !            39: }
        !            40: PRIVATE void HTTee_free ARGS1(HTStream *, me)
        !            41: {
        !            42:     (*me->s1->isa->free)(me->s1);
        !            43:     (*me->s2->isa->free)(me->s2);
        !            44: }
        !            45: PRIVATE void HTTee_abort ARGS2(HTStream *, me, HTError, e)
        !            46: {
        !            47:     (*me->s1->isa->abort)(me->s1, e);
        !            48:     (*me->s2->isa->abort)(me->s2, e);
        !            49: }
        !            50: 
        !            51: 
        !            52: /*     Tee stream
        !            53: **     ----------
        !            54: */
        !            55: PRIVATE CONST HTStreamClass HTTeeClass =
        !            56: {              
        !            57:        "Tee",
        !            58:        HTTee_free,
        !            59:        HTTee_abort,
        !            60:        HTTee_put_character,    HTTee_put_string,
        !            61:        HTTee_write
        !            62: }; 
        !            63: 
        !            64: 
        !            65: /*     Tee creation
        !            66: */
        !            67: PUBLIC HTStream * HTTee ARGS2(HTStream *, s1,HTStream *, s2)
        !            68: {
        !            69:     HTStream * me = (HTStream*)malloc(sizeof(*me));
        !            70:     if (!me) outofmem(__FILE__, "HTTee");
        !            71:     me->isa = &HTTeeClass;
        !            72:     me->s1 = s1;
        !            73:     me->s2 = s2;
        !            74:     return me;
        !            75: }
        !            76: 
        !            77: 

Webmaster