groff-commit
[Top][All Lists]
Advanced

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

[Groff-commit] groff/src/preproc/eqn main.cpp


From: Eric S. Raymond
Subject: [Groff-commit] groff/src/preproc/eqn main.cpp
Date: Sat, 03 Feb 2007 05:32:55 +0000

CVSROOT:        /sources/groff
Module name:    groff
Changes by:     Eric S. Raymond <esr>   07/02/03 05:32:55

Modified files:
        src/preproc/eqn: main.cpp 

Log message:
        The -TMathML option for eqn.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/groff/src/preproc/eqn/main.cpp?cvsroot=groff&r1=1.3&r2=1.4

Patches:
Index: main.cpp
===================================================================
RCS file: /sources/groff/groff/src/preproc/eqn/main.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- main.cpp    29 Dec 2005 21:26:49 -0000      1.3
+++ main.cpp    3 Feb 2007 05:32:55 -0000       1.4
@@ -45,7 +45,7 @@
 int compatible_flag = 0;
 int no_newline_in_delim_flag = 0;
 int html = 0;
-                      
+eqnmode_t output_format;
 
 int read_line(FILE *fp, string *p)
 {
@@ -67,6 +67,7 @@
 {
   string linebuf;
   string str;
+  if (output_format == troff)
   printf(".lf 1 %s\n", filename);
   current_filename = filename;
   current_lineno = 0;
@@ -110,10 +111,11 @@
       inline_flag = 0;
       yyparse();
       restore_compatibility();
-      if (non_empty_flag) {
+      if (output_format == troff && non_empty_flag) {
        printf(".lf %d\n", current_lineno - 1);
        output_string();
       }
+      if (output_format == troff)
       printf(".lf %d\n", current_lineno);
       put_string(linebuf, stdout);
     }
@@ -171,14 +173,14 @@
       ptr = &linebuf[0];
     }
     str += '\0';
-    if (html) {
+    if (output_format == troff && html) {
       printf(".as1 %s ", LINE_STRING);
       html_begin_suppress();
       printf("\n");
     }
     init_lex(str.contents(), current_filename, start_lineno);
     yyparse();
-    if (html) {
+    if (output_format == troff && html) {
       printf(".as1 %s ", LINE_STRING);
       html_end_suppress();
       printf("\n");
@@ -193,8 +195,10 @@
     }
   }
   restore_compatibility();
+  if (output_format == troff)
   printf(".lf %d\n", current_lineno);
   output_string();
+  if (output_format == troff)
   printf(".lf %d\n", current_lineno + 1);
   return 1;
 }
@@ -302,6 +306,9 @@
       if (strcmp(device, "ps:html") == 0) {
        device = "ps";
        html = 1;
+      } else if (strcmp(device, "MathML") == 0) {
+       output_format = mathml;
+       load_startup_file = 0;
       }
       break;
     case 's':
@@ -349,6 +356,7 @@
     }
   init_table(device);
   init_char_table();
+  if (output_format == troff) {
   printf(".if !'\\*(.T'%s' "
         ".if !'\\*(.T'html' "  // the html device uses `-Tps' to render
                                // equations as images
@@ -362,6 +370,7 @@
         ".if !'%s'ps' "
         ".tm warning: (it is advisable to invoke groff via: groff -Thtml 
-e)\n",
         device);
+  }
   if (load_startup_file) {
     char *path;
     FILE *fp = config_macro_path.open_file(STARTUP_FILE, &path);




reply via email to

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