[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Jitter] Print contexts, generalised
From: |
Jose E. Marchesi |
Subject: |
Re: [Jitter] Print contexts, generalised |
Date: |
Sun, 15 Nov 2020 20:26:34 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Hi Luca.
> I am now happy with the state of print contexts, which in their current
> shape should be a good mix of expressive power and ease of use.
>
> Before print contexts in the rest of the Jitter codebase and pushing to
> the master branch, I would like to hear your comment.
>
> The full code is in the print-context branch. The jitter-print.h
> header, whose comments should explain the entire user API, is attached.
>
> Please tell me what you think. Regards,
>
> Example use:
>
> jitter_print_context cx = jitter_print_context_make_fd (1);
> //jitter_print_context cx = jitter_print_context_make_string ();
> jitter_print_char_star (cx, "===========\n");
> jitter_print_char_star (cx, "main is at "); jitter_print_pointer (cx, main);
> jitter_print_char_star (cx, "\n===========\n");
> jitter_print_int (cx, 10, 0); jitter_print_char_star (cx, "\n");
>
> jitter_print_char_star (cx, "This has a hyperlink: ");
> jitter_print_begin_hyperlink (cx, "http://ageinghacker.net");
> jitter_print_char_star (cx, "foo");
> jitter_print_end_hyperlink (cx);
> jitter_print_char_star (cx, "\n");
>
> jitter_print_begin_class (cx, "interesting");
> jitter_print_int (cx, 2, 14);
> jitter_print_end_class (cx);
> jitter_print_char_star (cx, "\n");
>
> jitter_print_char_star (cx, "Look at this: ");
> jitter_print_begin_class (cx, "beautiful");
> jitter_print_char (cx, 'q');
> //jitter_print_end_class (cx);
> jitter_print_char_star (cx, "\n");
>
> jitter_print_int (cx, 10, 1234567); jitter_print_char_star (cx, "\n");
> jitter_print_ulong_long (cx, 10, 1234567); jitter_print_char_star (cx,
> "\n");
> jitter_print_long_long (cx, 10, -123456789012345LL); jitter_print_char_star
> (cx, "\n");
>
> //char *s = jitter_print_context_get_string (cx, NULL); printf ("%s", s);
> free (s);
>
> jitter_print_destroy_context (cx);
>From a poke perspective, I think we are interested on the other side of
the coin: we don't want to print stuff thru Jitter, but we want to be
called(back) by Jitter so we can print stuff.
So, I am guessing, we have to define what you can a new "context kind".
What in the example above is "char_start". In our case it would be a
"poke_term".
Am I correct?
In that case, what is the interface we would have to implement to Jitter
calls us in order to print stuff?