[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
jitter and libtextstyle
From: |
Jose E. Marchesi |
Subject: |
jitter and libtextstyle |
Date: |
Mon, 14 Oct 2019 16:26:38 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) |
Hi Luca!
I recently "libtextstylized" poke, and to complete the process I would
need a few changes in the Jitter API.
First, PREFIX_print_program currently is invoked like:
pvm_print_program (stdout, prog);
Where the first argument is a FILE*. In order to be able to apply style
in the printed disassembly, I would need PREFIX_print_program to get a
hook instead, that will do the printing of the entities. The hook
should also be made aware of the kind of entity it is printing, like
instruction mnemonic, or argument type.
Also, the instruction pretty printers currently are implemented as hooks
that also get a FILE *. Example:
instruction itoi (?n pvm_literal_printer_cast) # ( INT -- INT INT )
code
PVM_CONVOP (INT, int32_t, int, int32_t);
end
end
Where:
pvm_literal_printer_cast (FILE *out, jitter_uint val)
{
fprintf (out, "%" JITTER_PRIu, val);
}
I am already ignoring the OUT argument in some places, like in:
void
pvm_literal_printer (FILE *out, jitter_uint val)
{
/* XXX what about out. */
pvm_print_val ((pvm_val) val, 10, 0);
}
But then I'm afraid of Jitter relying on the order imposed by the FILE
stream, or caching it in some other way.
I can always flush the libtextstyle output stream in each pretty
printer, and simply ignore the OUT, but that seems a bit fragile to
me... what are your thoughts about an API that would allow
client-provided printers? That would be perfect for me, and for other
users of libtextstyle as well! :)
- jitter and libtextstyle,
Jose E. Marchesi <=