Skip to content
stacksmith edited this page Feb 21, 2017 · 16 revisions

PRIN


PRIN is a convenient printing facility for SubText streams. During bulk text output it is painful to programmatically tag text runs, and even without tags and presentations, the format statements become bulky. PRIN form establishes a context within which it is extremely easy to output values, whether constant or computed. Tagging and presentations require a parenthesized expression. In addition, arbitrary expressions may be executed without printing, as long as the form returns NIL.


(prin stream &rest forms)

  • stream evaluates to a subtext stream;
  • forms are evaluated in context and result is output, except the following two forms are handled specially:

(tg tagid &rest forms)

  • tagid resolves to a string or a gtk-text-tag

(pr class init &rest forms)

  • class evaluates to a pres-derived class;
  • init is a list spliced into (make-instance 'class ...) form to create the presentation

Note: Inside prin, forms are evaluated and results printed. Except, if the form returns NIL, it is invisible. The macro (prog0 &body body) is provided for your convenience.

Internally, prin subforms are either items to be printed, or a form that generates a list whose car is the promise (such as a tag), and the rest is items to be printed in that context. Nil is ignored by the printer. You can extend it by following these premises.

Clone this wiki locally