On Wednesday 11 September 2002 4:41 pm, Lars Gullik Bjønnes 
wrote:
> Angus Leeming <[EMAIL PROTECTED]> writes:
> | On Wednesday 11 September 2002 2:39 pm, Lars Gullik Bjønnes
> |
> | wrote:
> | > This is how I think this should be done.
> | >
> | > lyx<->lyxserver--localsocket--pipesocket(as a
> | > socketclient) \
> | >                          socketclient
> | >
> | > what I mean is that the localsocket is the native
> | > interface, and to named pipe is just built on top of this.
> | >
> | > There should be no need to special case pipes _inside_
> | > lyx, it is better off as an external program/daemon.
> | >
> | > then lyx need only to handle the localsocket (or unix
> | > socket) properly.
> |
> | welll I have lyx<->lyxserver<->pipestream
>
> Yes, but as said earlier: pipestream and effectively only have
> one client at a time whereas a localsocket listener can have
> many.
>
> and a pipestream (to get a namedpipe) can be attached to a
> localsocket (a small python script/daemon should be able to do
> that)

Lars, what is the norwegian for "will you read the bloody code 
before talking bollocks"?

I'll make it easy for you. Here's the "bloody code". As you can 
see there's a template parameter commT. 

commT can be
        pipecomm_client
        pipecomm_server
        socketcomm_client
        socketcomm_server

The point being that the bloody pipestream doesn't and shouldn't 
care. The point also being that if we can get this working with 
pipes, then getting it working with sockets is simply a matter 
of writing the low level socketcomm class.

an exasperated Angus
        
template<typename commT, typename charT, typename traitsT>
class basic_fdbuf : public std::basic_streambuf<charT, traitsT> {
public:
        ///
        typedef commT                           comm_type;
        typedef charT                           char_type;
        typedef traitsT                         traits_type;
        typedef typename traits_type::int_type  int_type;
        typedef typename traits_type::pos_type  pos_type;
        typedef typename traits_type::off_type  off_type;

        typedef basic_fdbuf<comm_type, char_type, traits_type> 
filebuf_type;
   
        ///
        basic_fdbuf();
        ///
        virtual ~basic_fdbuf();

        ///
        bool is_open() const { return comm_.is_open(); }
        ///
        filebuf_type * open(char const * basename);
        ///
        filebuf_type * close();
        ///
        int fd(std::ios_base::openmode mode) const { return 
comm_.fd(mode); }

protected:
        ///
        virtual int_type underflow();
        ///
        virtual int_type overflow(int_type c = traits_type::eof());
        ///
        virtual int_type sync();

private:
        ///
        bool flush();
        ///
        static int const bufsize_ = 1024;
        /// get area
        char_type gbuf_[bufsize_];
        /// put area
        char_type pbuf_[bufsize_];
        /// the beast doing all the opening, closing, reading and 
writing
        commT comm_;
};
 

Reply via email to