[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Move some term code from lib to src
From: |
Tim Rühsen |
Subject: |
Re: [PATCH] Move some term code from lib to src |
Date: |
Thu, 30 Apr 2020 10:11:13 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 |
Hey Jose !
On 30.04.20 10:03, Jose E. Marchesi wrote:
>
> 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?
I fully agree that this is a clear design and the best I can think of as
well.
After your very good and surely time-taking explanations above, I feel a
bit shabby for my short answer :-) But, yes, very good !
Regards, Tim
signature.asc
Description: OpenPGP digital signature