groff
[Top][All Lists]
Advanced

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

Re: [Groff] Mysteries of .em request


From: Werner LEMBERG
Subject: Re: [Groff] Mysteries of .em request
Date: Sat, 18 Apr 2009 08:33:54 +0200 (CEST)

> Enclosed is a patch for the file `input.cpp', which removes the
> strange behavior of `.em xx'. With this patch added it seems that
> there are no longer any restrictions for the content and function of
> macro `xx'.

Thanks.  Attached an improved version; it implements a request `em1'
which is the same as `em' but doesn't have the last-page restriction.
Please test.


    Werner
--- input.cpp.old       2009-02-21 08:35:54.000000000 +0100
+++ input.cpp   2009-04-18 08:30:47.000000000 +0200
@@ -103,6 +103,7 @@
 static symbol blank_line_macro_name;
 static symbol leading_spaces_macro_name;
 static int compatible_flag = 0;
+static int em1_flag = 0;
 int ascii_output_flag = 0;
 int suppress_output_flag = 0;
 int is_html = 0;
@@ -2546,7 +2547,7 @@
 
 void exit_troff()
 {
-  exit_started = 1;
+  exit_started = em1_flag ? 0 : 1;
   topdiv->set_last_page();
   if (!end_macro_name.is_null()) {
     spring_trap(end_macro_name);
@@ -2557,7 +2558,7 @@
   tok.next();
   process_input_stack();
   end_diversions();
-  if (topdiv->get_page_length() > 0) {
+  if (!em1_flag && topdiv->get_page_length() > 0) {
     done_end_macro = 1;
     topdiv->set_ejecting();
     static unsigned char buf[2] = { LAST_PAGE_EJECTOR, '\0' };
@@ -2600,6 +2601,14 @@
 void end_macro()
 {
   end_macro_name = get_name();
+  em1_flag = 0;
+  skip_line();
+}
+
+void end_macro1()
+{
+  end_macro_name = get_name();
+  em1_flag = 1;
   skip_line();
 }
 
@@ -7816,6 +7825,7 @@
   init_request("ecs", save_escape_char);
   init_request("el", else_request);
   init_request("em", end_macro);
+  init_request("em1", end_macro1);
   init_request("eo", escape_off);
   init_request("ex", exit_request);
   init_request("fchar", define_fallback_character);

reply via email to

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