poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Move some term code from lib to src


From: Jose E. Marchesi
Subject: Re: [PATCH] Move some term code from lib to src
Date: Thu, 30 Apr 2020 10:03:30 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Hi Tim.

Finally completed the library interface revamp.  Sorry it took a while,
been busy :)

    The attached patch is for discussion.
    
    It moves some (IMO application) code from lib/ to src/poke.c.
    
Right now, the situation is:


                          (textstyle.h)
        +-----------+              +--------------+
        |  libpoke  |<-------------| libtextstyle |
        +-----------+              +--------------+
             |
             |  (pk-term.h)
             v
        +-------------+
        | application |
        +-------------+

The user of libpoke can make use of the pk-term services, which includes
class handling, and supports the same set of command-line options like
--color, but that doesn't imply the application uses or is even aware of
libtextstyle itself.

What you are proposing is:

                          (textstyle.h)
        +-----------+              +--------------+
        |  libpoke  |<-------------| libtextstyle |
        +-----------+              +--------------+
             |                      /
             |  (pk-term.h)        /
             v                    /
        +-------------+          /
        | application |<--------+
        +-------------+    (textstyle.h)


The problem I see with this approach is that it forces applications
using libpoke to be aware of libtextstyle.

Now, it may be argued that libpoke is not the right place from where to
offer terminal services as such.  Then we would like to do something
like:

                          (textstyle.h)
        +-----------+              +--------------+
        |  libpoke  |<-------------| libtextstyle |
        +-----------+              +--------------+
             |                      /
             |                     /
             v                    /
        +-------------+          /
        | application |<--------+
        +-------------+    (textstyle.h)


Note how pk-term is no longer exported by libpoke.  Therefore, the
application (in this case poke.c) would need to use the libtextstyle
services directly.

But what would be best would be to make libpoke to use printing services
provided by the application, via callbacks:

        +-----------+
        |  libpoke  |
        +-----------+
             |
             |
             v
        +-------------+               +--------------+
        | application |<--------------| libtextstyle |
        +-------------+               +--------------+
                            (textstyle.h)

The callback interface, defined in libpoke.h, should understand things
like style classes and hyperlinks.  This is my favorite approach:

- No dependendency of libpoke to libtextstyle.

- Makes it possible to embed libpoke in programs that provide their own
  information presentation meanings, such as X-window windows or their
  own prompts.

- The .css file would be distributed by the application (poke) and not
  by libpoke.

WDYT?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]