poke-devel
[Top][All Lists]
Advanced

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

Re: Libtextstyle in Jitter and Poke: sub-package mode and CSS installati


From: Jose E. Marchesi
Subject: Re: Libtextstyle in Jitter and Poke: sub-package mode and CSS installation
Date: Wed, 30 Oct 2019 19:57:08 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

    
    A user printer styling the internal components of a literal will need a
    libtextstyle output stream.  This stream will need to be opened with the
    application's CSS file -- here Poke's, and not Jitter's.  The rest of
    the printer (we are speaking here about a VM routine printer) will
    instead user Jitter's style.  I can manually flush the output stream
    when the two styles alternate, in a way that is hidden from the user.

As mentioned in the other email, the user printer will need something
more generic than a libtextstyle output stream.  Let's say a void *.

I don't think that flushing whatever the user printer uses (stdio or
ostream or whatever) in the custom printer is a problem.  Jitter doesn't
need to be concerned with that IMO.

    Still, we need a way to tell the Jittery VM about the application
    printing style.  There will be a new C function for that.

Why not just letting the user to pass a void* payload to the custom
printers that is not necessarily a FILE*?

    And then, inside the printer function, there will be style changes:
    styled_ostream_begin_use_class and styled_ostream_end_use_class.
    
    I want libtextstyle to remain an *optional* dependency, in the interest
    of minimalism.  So all of this must be hidden behind an API which can
    fall back to puts and stdout, requiring no preprocessor conditional in
    the user code.  This I can give you, easily.
    Would you like to use the same facilities in your non-Jittery styled
    printing, from Poke?  I am quite sure that you have the same
    requirement, and therefore you will need a similar wrapper.  If you used
    Jitter functions for printing your styled Poke data structures, we would
    save some effort.
    
    What do you think?

This is what I would like:

1. Add a jitter routine to:

   jitter_register_printer_payload (poke_ostream);

2. Then allow me to define custom printers like:

   void
   pvm_literal_printer (void *out, jitter_uint val)
   {
      pk_term_ostream ostream = out;
      pvm_print_val (ostream, (pvm_val) val, poke_obase, 0);
      pk_term_flush ();
   }

   Jitter should have flushed whatever it printed before calling to my
   custom printer, be it with fflush or ostream_flush or whatever, I
   don't really care.

3. Add a jitter routine so I can do:

   jitter_style_file (PKGDATADIR, "pkoe-default.css");

   And document the set of classes that jitter uses in non-native
   disassembly (what you call VM print) so I can provide sane default
   values in poke-default.css. This should include classes like
   .pvm-insn and the like.

I am ignoring the native disassembly.  For that, you can style it the
way you want.




reply via email to

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