groff-commit
[Top][All Lists]
Advanced

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

[groff] 08/34: Add `pstream` request.


From: G. Branden Robinson
Subject: [groff] 08/34: Add `pstream` request.
Date: Mon, 16 Sep 2024 20:48:32 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit 6d7725d2babb24ab43e83861f039edd735e2d852
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Fri Sep 13 03:20:48 2024 -0500

    Add `pstream` request.
    
    * (print_streams): New request handler iterates through
      `stream_dictionary`, writing each entry.
    * (init_input_requests): Wire up `pstream` request to new handler.
---
 src/roff/troff/input.cpp | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index afe1718db..54f7dd61a 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -7214,6 +7214,20 @@ void terminal_continue()
 
 object_dictionary stream_dictionary(20);
 
+void print_streams()
+{
+  object_dictionary_iterator iter(stream_dictionary);
+  FILE *filestream;
+  symbol stream;
+  while (iter.get(&stream, (object **)&filestream)) {
+    assert(!stream.is_null());
+    if (stream != 0 /* nullptr */)
+      errprint("%1\n", stream.contents());
+  }
+  fflush(stderr);
+  skip_line();
+}
+
 static void open_file(bool appending)
 {
   symbol stream = get_name(true /* required */);
@@ -9063,6 +9077,7 @@ void init_input_requests()
   init_request("pm", print_macros);
   init_request("psbb", ps_bbox_request);
   init_request("pso", pipe_source_request);
+  init_request("pstream", print_streams);
   init_request("rchar", remove_character);
   init_request("rd", read_request);
   init_request("return", return_macro_request);



reply via email to

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