From 6a2c6dcc6a598f020d849c0d7ad821b8982c3dd5 Mon Sep 17 00:00:00 2001 From: wl Date: Mon, 5 Feb 2007 15:24:56 +0000 Subject: * src/preproc/eqn/eqn.man: Revised. * src/preproc/eqn/text.cpp (map, special_char_boc::output): Use `const'. (spacing_type): Fix typo. (special_to_entity): Use `const'. Remove unused variable. * src/preproc/eqn/other.cpp (font_box::output): Use `const'. Formatting, copyright years. --- ChangeLog | 86 +++++ MORE.STUFF | 1 + src/preproc/eqn/box.cpp | 9 +- src/preproc/eqn/delim.cpp | 6 +- src/preproc/eqn/eqn.h | 3 +- src/preproc/eqn/eqn.man | 238 +++++++------- src/preproc/eqn/lex.cpp | 7 +- src/preproc/eqn/limit.cpp | 12 +- src/preproc/eqn/list.cpp | 2 +- src/preproc/eqn/main.cpp | 5 +- src/preproc/eqn/other.cpp | 58 ++-- src/preproc/eqn/over.cpp | 5 +- src/preproc/eqn/pile.cpp | 39 ++- src/preproc/eqn/script.cpp | 12 +- src/preproc/eqn/special.cpp | 2 +- src/preproc/eqn/sqrt.cpp | 5 +- src/preproc/eqn/text.cpp | 740 ++++++++++++++++++++++---------------------- 17 files changed, 689 insertions(+), 541 deletions(-) diff --git a/ChangeLog b/ChangeLog index 35573706..15a0ca9e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2007-02-05 Werner LEMBERG + + * src/preproc/eqn/eqn.man: Revised. + + * src/preproc/eqn/text.cpp (map, special_char_boc::output): Use + `const'. + (spacing_type): Fix typo. + (special_to_entity): Use `const'. + Remove unused variable. + * src/preproc/eqn/other.cpp (font_box::output): Use `const'. + 2007-02-05 Eric S. Raymond * src/devices/grotty/grotty.man: \m[] and \M[] aren't portable, @@ -23,6 +34,79 @@ * MORE.STUFF: More-stuff entries for doclifter and pic2plot. + + Add support for MathML output to eqn. + + The strategy used is very simple and relies on the fact that the box + models of eqn and Presentation MathML differ in only trivial ways. + It leaves the grammar and existing internal object structures + unchanged. A new global, `output_format', is defined as an + enumerated type with values {troff, mathml}. Most of the functions + and methods that emit actual output acquire a top-level conditional, + dispatching on this global, which has one arm for troff mode and one + for MathML mode. In most cases the MathML arm is drastically + simpler. + + (This strategy could be easily generalized to support other output + formats. TeX is a possibility that leaps to mind.) + + The only even moderately tricky changes are in the lexer. Some of + the predefined macros used constructs like `up', `down', `fwd', + `back', and `vcenter' that have no equivalents in MathML. I + attacked this problem in these ways: + + 1. I eliminated three uses of `back' to compose characters in favor + of using equivalent groff specials `\(<<', `\(>>', and `\(<>' + that did not exist when these macros were written. (This will be + a quality improvement for troff users.) + + 2. I eliminated one use of `vcenter' by using \\(md. (Likewise...) + + 3. I then split the table of pre-definitions in three; one large + common table and two small troff-specific and MathML-specific + tables. Use of troff-only operations (up, down, back, fwd, + vcenter) is now confined to the former. The latter now uses + `size big' and drops out the explicit positioning operations, + counting on MathML processors to do them. + + POTENTIAL TROUBLE SPOTS: + + Here are notes for reviewers on places I'm not 100% sure I've done + the right thing: + + * In the process of preparing the troff table, I translated three + definitions (dot_def, dotdot_def, and utilde def) that previously + used explicit \v escapes to use `up' and `down' instead. I + modeled the new definitions on the way `vec' and `dyad' work, but + it's possible I got something subtle wrong. + + * I'm not certain the MathML implementation of font_box::output() is + right, because I don't quite get what the switcheroo between + `current_roman_font' and `old_roman_font' is supposed to + accomplish. It does seem to generare good MathML, though. + + Finally, I made one purely cosmetic change in `text.cpp'; I replaced + with an enum some magic numbers for spacing types that I thought + were too ugly to live. + + REMAINING ISSUES: + + The entirety of eqn is translated when `-TMathML' is specified, + with the following exceptions... + + Limitations that cannot be fixed include non-support for special, + up/down/fwd/back, and vcenter. + + Limitations that might be fixable include non-support for mark and + lineup. I will investigate further, but if these can be implemented + at all it's going to be in a very complicated and nasty way. + + The way character boxes are output means that each digit of a + multi-digit number gets its own tag pair in the MathHTML. + While this is not technically wrong for Presentation MathML, it is + ugly and inefficient. Fixing this will require implementing a + little state machine in the `text.cpp' output method. + * src/preproc/eqn/box.cpp, src/preproc/eqn/delim.cpp, src/preproc/eqn/eqn.h, src/preproc/eqn/eqn.man, src/preproc/eqn/lex.cpp, src/preproc/eqn/limit.cpp, @@ -32,6 +116,8 @@ src/preproc/eqn/sqrt.cpp, src/preproc/eqn/text.cpp, src/preproc/eqn/eqn.man: MathML output mode. + * NEWS: Document it. + 2007-02-02 Eric S. Raymond * src/roff/groff/groff.man: Converted to use .SY/.OP/.YS diff --git a/MORE.STUFF b/MORE.STUFF index 307558f4..c8c22cc8 100644 --- a/MORE.STUFF +++ b/MORE.STUFF @@ -151,6 +151,7 @@ pic2plot, part of the GNU plotutils package, can lift pic markup to SVG. The plotutils package is available at http://www.gnu.org/software/plotutils/ + miscellaneous ------------- diff --git a/src/preproc/eqn/box.cpp b/src/preproc/eqn/box.cpp index 85a55b4d..df31bf22 100644 --- a/src/preproc/eqn/box.cpp +++ b/src/preproc/eqn/box.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -/* Copyright (C) 1989, 1990, 1991, 1992, 2002, 2004 +/* Copyright (C) 1989, 1990, 1991, 1992, 2002, 2004, 2007 Free Software Foundation, Inc. Written by James Clark (jjc@jclark.com) @@ -253,9 +253,9 @@ void do_text(const char *s) printf(".eo\n"); printf(".as " LINE_STRING " \"%s\n", s); printf(".ec\n"); - } else if (output_format == mathml) { - fputs(s, stdout); } + else if (output_format == mathml) + fputs(s, stdout); } void set_minimum_size(int n) @@ -349,7 +349,8 @@ void box::top_level() printf(".ne \\n[" HEIGHT_FORMAT "]u-%dM>?0+(\\n[" DEPTH_FORMAT "]u-%dM>?0)\n", b->uid, body_height, b->uid, body_depth); - } else if (output_format == mathml) { + } + else if (output_format == mathml) { printf(""); b->output(); printf(""); diff --git a/src/preproc/eqn/delim.cpp b/src/preproc/eqn/delim.cpp index a48c0535..83de7202 100644 --- a/src/preproc/eqn/delim.cpp +++ b/src/preproc/eqn/delim.cpp @@ -1,5 +1,6 @@ // -*- C++ -*- -/* Copyright (C) 1989, 1990, 1991, 1992, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1989, 1990, 1991, 1992, 2003, 2007 + Free Software Foundation, Inc. Written by James Clark (jjc@jclark.com) This file is part of groff. @@ -384,7 +385,8 @@ void delim_box::output() p->output(); if (right) printf("\\*[" RIGHT_DELIM_STRING_FORMAT "]", uid); - } else if (output_format == mathml) { + } + else if (output_format == mathml) { printf("%s", left); p->output(); printf("%s", right); diff --git a/src/preproc/eqn/eqn.h b/src/preproc/eqn/eqn.h index a977fe72..8d655b38 100644 --- a/src/preproc/eqn/eqn.h +++ b/src/preproc/eqn/eqn.h @@ -1,5 +1,6 @@ // -*- C++ -*- -/* Copyright (C) 1989, 1990, 1991, 1992, 2001 Free Software Foundation, Inc. +/* Copyright (C) 1989, 1990, 1991, 1992, 2001, 2007 + Free Software Foundation, Inc. Written by James Clark (jjc@jclark.com) This file is part of groff. diff --git a/src/preproc/eqn/eqn.man b/src/preproc/eqn/eqn.man index bff0e00c..bbdeacaa 100644 --- a/src/preproc/eqn/eqn.man +++ b/src/preproc/eqn/eqn.man @@ -1,5 +1,6 @@ .ig -Copyright (C) 1989-2000, 2001, 2004, 2005 Free Software Foundation, Inc. +Copyright (C) 1989-2000, 2001, 2004, 2005, 2007 + Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice @@ -32,13 +33,6 @@ the original English. .. . . -.de TQ -. br -. ns -. TP \\$1 -.. -. -. .\" The BSD man macros can't handle " in arguments to font change macros, .\" so use \(ts instead of ". .tr \(ts" @@ -48,20 +42,11 @@ the original English. . . .SH NAME -@g@eqn \- format equations for troff +@g@eqn \- format equations for troff or MathML . . .SH SYNOPSIS -.nr a \n(.j -.ad l -.nr i \n(.i -.in +\w'\fB@g@eqn 'u -.ti \niu -.B @g@eqn -.de OP -. ie \\n(.$-1 .RI "[\ \fB\\$1\fP" "\\$2" "\ ]" -. el .RB "[\ " "\\$1" "\ ]" -.. +.SY @g@eqn .OP \-rvCNR .OP \-d xy .OP \-T name @@ -70,9 +55,8 @@ the original English. .OP \-s n .OP \-p n .OP \-m n -.RI "[\ " files\|.\|.\|. "\ ]" -.br -.ad \na +.RI [ files\|.\|.\|. ] +.YS . .LP It is possible to have whitespace between a command line option and its @@ -97,11 +81,10 @@ The output of GNU .B eqn cannot be processed with Unix troff; it must be processed with GNU troff. -If no files are given on the command line, the standard input -will be read. +If no files are given on the command line, the standard input is read. A filename of .B \- -will cause the standard input to be read. +causes the standard input to be read. . .LP .B eqn @@ -116,7 +99,7 @@ and finally in the standard macro directory .BR @MACRODIR@ . If it exists, .B eqn -will process it before the other input files. +processes it before the other input files. The .B \-R option prevents this. @@ -130,6 +113,7 @@ it does not support low-resolution, typewriter-like devices . . .SH OPTIONS +. .TP .BI \-d xy Specify delimiters @@ -168,7 +152,7 @@ Only one size reduction. The minimum point-size is\~\c .IR n . .B eqn -will not reduce the size of subscripts or superscripts to +does not reduce the size of subscripts or superscripts to a smaller size than\~\c .IR n . . @@ -181,11 +165,11 @@ Normally, the only effect of this is to define a macro with a value of\~\c .BR 1 ; .B eqnrc -will use this to provide definitions appropriate for the output device. -However, if the specified device is "MathML", the output will be +uses this to provide definitions appropriate for the output device. +However, if the specified device is \[lq]MathML\[rq], the output is MathML markup rather than troff commands, and .B eqnrc -will not be loaded at all. +is not loaded at all. The default output device is .BR @DEVICE@ . . @@ -215,7 +199,7 @@ This is equivalent to a command. This option is deprecated. .B eqn -will normally set equations at whatever the current point size +normally sets equations at whatever the current point size is when the equation is encountered. . .TP @@ -226,8 +210,8 @@ points smaller than the surrounding text. This option is deprecated. Normally .B eqn -makes sets subscripts and superscripts at 70% -of the size of the surrounding text. +sets subscripts and superscripts at 70% of the size of the +surrounding text. . . .SH USAGE @@ -238,7 +222,7 @@ and Unix eqn are described here. GNU .B eqn emits Presentation MathML output when invoked with the -,B -T MathML +.B "-T\~MathML" option. . .LP @@ -358,11 +342,20 @@ subsection. . .SS New primitives .TP -.IB big\ e1 +.BI big\ e Enlarges the expression it modifies; intended to have semantics like -CSS 'large'. In troff output, the point size is increased by 5; in -MathML output, the expression is wrapped in an -pair. +CSS `large'. +In troff output, the point size is increased by\~5; +in MathML output, the expression uses +. +.RS +.IP +.EX + +.EE +.RE +. +.TP .IB e1\ smallover\ e2 This is similar to .BR over ; @@ -404,6 +397,7 @@ is defined as { type "operator" vcenter size +5 \e(*S } .RE . +.IP (Note that vcenter is silently ignored when generating MathML.) . .TP @@ -415,7 +409,7 @@ as an accent over .I e2 is assumed to be at the correct height for a lowercase letter; .I e2 -will be moved down according if +is moved down according to whether .I e1 is taller or shorter than a lowercase letter. For example, @@ -448,7 +442,7 @@ as an accent under .I e2 is assumed to be at the correct height for a character without a descender; .I e2 -will be moved down if +is moved down if .I e1 has a descender. .B utilde @@ -470,8 +464,7 @@ but .I text is not subject to macro expansion because it is quoted; .I text -will be split up and the spacing between individual characters -will be adjusted. +is split up and the spacing between individual characters is adjusted. . .TP .BI nosplit\ text @@ -485,10 +478,10 @@ This has the same effect as .IP but because .I text -is not quoted it will be subject to macro expansion; +is not quoted it is subject to macro expansion; .I text -will not be split up -and the spacing between individual characters will not be adjusted. +is not split up +and the spacing between individual characters is not adjusted. . .TP .IB e\ opprime @@ -504,14 +497,14 @@ with .B opprime the\~\c .B 1 -will be tucked under the prime as a subscript to the\~\c +is tucked under the prime as a subscript to the\~\c .B A (as is conventional in mathematical typesetting), whereas with .B prime the\~\c .B 1 -will be a subscript to the prime character. +is a subscript to the prime character. The precedence of .B opprime is the same as that of @@ -524,7 +517,7 @@ and .BR uaccent . In unquoted text a\~\c .B ' -that is not the first character will be treated like +that is not the first character is treated like .BR opprime . . .TP @@ -538,7 +531,7 @@ macro named When the macro is called, the string .B 0s -will contain the output for\~\c +contains the output for\~\c .IR e , and the number registers .BR 0w , @@ -547,7 +540,7 @@ and the number registers .BR 0skern , and .BR 0skew -will contain the width, height, depth, subscript kern, and skew of\~\c +contain the width, height, depth, subscript kern, and skew of\~\c .IR e . (The .I "subscript kern" @@ -558,7 +551,7 @@ of an object says how far to the right of the center of the object an accent over the object should be placed.) The macro must modify .B 0s -so that it will output the desired result with its origin at the current +so that it outputs the desired result with its origin at the current point, and increase the current horizontal position by the width of the object. The number registers must also be modified so that they correspond to the @@ -732,7 +725,7 @@ definitive. . TP .B minimum_size .B eqn -will not set anything at a smaller point-size than this. +doesn't set anything at a smaller point-size than this. The value is in points. . .TP @@ -742,14 +735,20 @@ The primitive emboldens an equation by overprinting two copies of the equation horizontally offset by this amount. -(This parameter is not used in MathML mode; instead, fat text is -wrapped in an tag pair.) +This parameter is not used in MathML mode; instead, fat text uses +. +.RS +.IP +.EX + +.EE +.RE . .TP .B over_hang -A fraction bar will be longer by twice this amount than +A fraction bar is longer by twice this amount than the maximum of the widths of the numerator and denominator; -in other words, it will overhang the numerator and +in other words, it overhangs the numerator and denominator by at least this amount. . .TP @@ -759,7 +758,7 @@ When or .B under is applied to a single character, -the line will be this long. +the line is this long. Normally, .B bar or @@ -774,7 +773,7 @@ Extensible delimiters produced with the .B left and .B right -primitives will have a combined height and depth of at least this many +primitives have a combined height and depth of at least this many thousandths of twice the maximum amount by which the sub-equation that the delimiters enclose extends away from the axis. . @@ -784,7 +783,7 @@ Extensible delimiters produced with the .B left and .B right -primitives will have a combined height and depth +primitives have a combined height and depth not less than the difference of twice the maximum amount by which the sub-equation that the delimiters enclose extends away from the axis @@ -837,29 +836,29 @@ escape sequence. .B num1 The .B over -command will shift up the numerator by at least this amount. +command shifts up the numerator by at least this amount. . .TP .B num2 The .B smallover -command will shift up the numerator by at least this amount. +command shifts up the numerator by at least this amount. . .TP .B denom1 The .B over -command will shift down the denominator by at least this amount. +command shifts down the denominator by at least this amount. . .TP .B denom2 The .B smallover -command will shift down the denominator by at least this amount. +command shifts down the denominator by at least this amount. . .TP .B sup1 -Normally superscripts will be shifted up by at least this amount. +Normally superscripts are shifted up by at least this amount. . .TP .B sup2 @@ -867,63 +866,63 @@ Superscripts within superscripts or upper limits or numerators of .B smallover fractions -will be shifted up by at least this amount. +are shifted up by at least this amount. This is usually less than sup1. . .TP .B sup3 Superscripts within denominators or square roots -or subscripts or lower limits will be shifted up by at least +or subscripts or lower limits are shifted up by at least this amount. This is usually less than sup2. . .TP .B sub1 -Subscripts will normally be shifted down by at least this amount. +Subscripts are normally shifted down by at least this amount. . .TP .B sub2 When there is both a subscript and a superscript, the subscript -will be shifted down by at least this amount. +is shifted down by at least this amount. . .TP .B sup_drop -The baseline of a superscript will be no more +The baseline of a superscript is no more than this much amount below the top of the object on which the superscript is set. . .TP .B sub_drop -The baseline of a subscript will be at least this much below +The baseline of a subscript is at least this much below the bottom of the object on which the subscript is set. . .TP .B big_op_spacing1 -The baseline of an upper limit will be at least this +The baseline of an upper limit is at least this much above the top of the object on which the limit is set. . .TP .B big_op_spacing2 -The baseline of a lower limit will be at least this +The baseline of a lower limit is at least this much below the bottom of the object on which the limit is set. . .TP .B big_op_spacing3 -The bottom of an upper limit will be at least this much above the +The bottom of an upper limit is at least this much above the top of the object on which the limit is set. . .TP .B big_op_spacing4 -The top of a lower limit will be at least this much below +The top of a lower limit is at least this much below the bottom of the object on which the limit is set. . .TP .B big_op_spacing5 -This much vertical space will be added above and below limits. +This much vertical space is added above and below limits. . .TP .B baseline_sep -The baselines of the rows in a pile or matrix will normally be +The baselines of the rows in a pile or matrix are normally this far apart. In most cases this should be equal to the sum of .B num1 @@ -933,21 +932,21 @@ and .TP .B shift_down The midpoint between the top baseline and the bottom baseline -in a matrix or pile will be shifted down by this much from the axis. +in a matrix or pile is shifted down by this much from the axis. In most cases this should be equal to .BR axis_height . . .TP .B column_sep -This much space will be added between columns in a matrix. +This much space is added between columns in a matrix. . .TP .B matrix_side_sep -This much space will be added at each side of a matrix. +This much space is added at each side of a matrix. . .TP .B draw_lines -If this is non-zero, lines will be drawn using the +If this is non-zero, lines are drawn using the .B \eD escape sequence, rather than with the .B \el @@ -958,7 +957,7 @@ character. .TP .B body_height The amount by which the height of the equation exceeds this -will be added as extra space before the line containing the equation +is added as extra space before the line containing the equation (using .BR \ex ). The default value is 85. @@ -966,7 +965,7 @@ The default value is 85. .TP .B body_depth The amount by which the depth of the equation exceeds this -will be added as extra space after the line containing the equation +is added as extra space after the line containing the equation (using .BR \ex ). The default value is 35. @@ -976,18 +975,18 @@ The default value is 35. If this is non-zero, then .B ndefine -will behave like +behaves like .B define and .B tdefine -will be ignored, +is ignored, otherwise .B tdefine -will behave like +behaves like .B define and .B ndefine -will be ignored. +is ignored. The default value is\~0 (This is typically changed to\~1 by the .B eqnrc @@ -1012,19 +1011,19 @@ In a macro body, where .I n is between 1 and\~9, -will be replaced by the +is replaced by the .IR n-th argument if the macro is called with arguments; if there are fewer than .I n\~\c -arguments, it will be replaced by nothing. +arguments, it is replaced by nothing. A word containing a left parenthesis where the part of the word before the left parenthesis has been defined using the .B define command -will be recognized as a macro call with arguments; +is recognized as a macro call with arguments; characters following the left parenthesis -up to a matching right parenthesis will be treated as comma-separated +up to a matching right parenthesis are treated as comma-separated arguments; commas inside nested parentheses do not terminate an argument. . @@ -1034,7 +1033,7 @@ This is like the .B define command, but .I name -will not be recognized if called with arguments. +is not recognized if called with arguments. . .TP .BI include\ \(ts file \(ts @@ -1052,7 +1051,7 @@ beginning with .B .EQ or .B .EN -will be ignored. +are ignored. . .TP .BI ifdef\ name\ X\ anything\ X @@ -1149,10 +1148,10 @@ You can control which characters are treated as letters command described above. A type of .B letter -will cause a character to be set in italic type. +causea a character to be set in italic type. A type of .B digit -will cause a character to be set in roman type. +causea a character to be set in roman type. . . .SH FILES @@ -1163,12 +1162,15 @@ Initialization file. .SH MATHML MODE LIMITATIONS MathML is designed on the assumption that it cannot know the exact physical characteristics of the media and devices on which it will -be rendered. It does not support fine control of motions and sizes -to the same degree troff does. Thus: +be rendered. +It does not support fine control of motions and sizes to the same +degree troff does. +Thus: +. .IP * .B eqn parameters have no effect on the generated MathML. -.LP +. .IP * The .BR special, @@ -1176,46 +1178,56 @@ The .BR down , .BR fwd , and -.BR back , -operations cannot be implemented, and will yield a -MathML message instead. +.B back +operations cannot be implemented, and yields a +MathML `' message instead. +. .IP * The .B vcenter keyword is silently ignored, as centering on the math axis is the MathML default. +. .IP * -Characters that eqn over troff sets extra large - notably the integral -sign - may appear too small and need to have their wrappers +Characters that +.B eqn +over troff sets extra large \(en notably the integral sign \(en +may appear too small and need to have their `' wrappers adjusted by hand. +. .LP As in its troff mode, .B eqn -in MathML mode leaves the .EQ and .EN delimiters in place for -displayed equations, but emits no explicit delimiters around -inline equations. They can, however, be recognized as strings -that begin with and end with and do not cross -line boundaries. +in MathML mode leaves the +.B .EQ +and +.B .EN +delimiters in place for displayed equations, but emits no explicit +delimiters around inline equations. +They can, however, be recognized as strings that begin with `' +and end with `' and do not cross line boundaries. +. .LP See the .B BUGS section for translation limits specific to .BR eqn . . +. .SH BUGS -Inline equations will be set at the point size that is current at the +Inline equations are set at the point size that is current at the beginning of the input line. . In MathML mode, the -.BR mark, +.B mark and .B lineup -features don't work. These could, in theory, be implemented with - elements. +features don't work. +These could, in theory, be implemented with `' elements. . In MathML mode, each digit of a numeric literal gets a separate - pair and decimal points get an . This is -allowed by the specification, but inefficient. +`\:' pair, and decimal points are tagged with `\:'. +This is allowed by the specification, but inefficient. . . .SH "SEE ALSO" diff --git a/src/preproc/eqn/lex.cpp b/src/preproc/eqn/lex.cpp index a5f0f9bd..5c27a5a2 100644 --- a/src/preproc/eqn/lex.cpp +++ b/src/preproc/eqn/lex.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2002, 2003, 2005 +/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2002, 2003, 2005, 2007 Free Software Foundation, Inc. Written by James Clark (jjc@jclark.com) @@ -120,7 +120,7 @@ static struct { { "special", SPECIAL }, }; -struct builtin_def { +struct builtin_def { const char *name; const char *def; }; @@ -301,7 +301,8 @@ void init_table(const char *device) def->is_simple = 1; macro_table.define(troff_defs[i].name, def); } - } else if (output_format == mathml) { + } + else if (output_format == mathml) { for (i = 0; i < sizeof(mathml_defs)/sizeof(mathml_defs[0]); i++) { definition *def = new definition[1]; def->is_macro = 1; diff --git a/src/preproc/eqn/limit.cpp b/src/preproc/eqn/limit.cpp index 72989202..cdda1c1d 100644 --- a/src/preproc/eqn/limit.cpp +++ b/src/preproc/eqn/limit.cpp @@ -1,5 +1,6 @@ // -*- C++ -*- -/* Copyright (C) 1989, 1990, 1991, 1992, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1989, 1990, 1991, 1992, 2002, 2007 + Free Software Foundation, Inc. Written by James Clark (jjc@jclark.com) This file is part of groff. @@ -167,19 +168,22 @@ void limit_box::output() p->output(); printf(DELIMITER_CHAR); printf("\\h'\\n[" WIDTH_FORMAT "]u'", uid); - } else if (output_format == mathml) { + } + else if (output_format == mathml) { if (from != 0 && to != 0) { printf(""); p->output(); from->output(); to->output(); printf(""); - } else if (from != 0) { + } + else if (from != 0) { printf(""); p->output(); from->output(); printf(""); - } else if (to != 0) { + } + else if (to != 0) { printf(""); p->output(); to->output(); diff --git a/src/preproc/eqn/list.cpp b/src/preproc/eqn/list.cpp index 81a2343e..4a9d0a7e 100644 --- a/src/preproc/eqn/list.cpp +++ b/src/preproc/eqn/list.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -/* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc. +/* Copyright (C) 1989, 1990, 1991, 1992, 2007 Free Software Foundation, Inc. Written by James Clark (jjc@jclark.com) This file is part of groff. diff --git a/src/preproc/eqn/main.cpp b/src/preproc/eqn/main.cpp index b711a920..9bd3ce3b 100644 --- a/src/preproc/eqn/main.cpp +++ b/src/preproc/eqn/main.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2002, 2005 +/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2002, 2005, 2007 Free Software Foundation, Inc. Written by James Clark (jjc@jclark.com) @@ -309,7 +309,8 @@ int main(int argc, char **argv) if (strcmp(device, "ps:html") == 0) { device = "ps"; html = 1; - } else if (strcmp(device, "MathML") == 0) { + } + else if (strcmp(device, "MathML") == 0) { output_format = mathml; load_startup_file = 0; } diff --git a/src/preproc/eqn/other.cpp b/src/preproc/eqn/other.cpp index 9497dbf6..b9989146 100644 --- a/src/preproc/eqn/other.cpp +++ b/src/preproc/eqn/other.cpp @@ -1,5 +1,6 @@ // -*- C++ -*- -/* Copyright (C) 1989, 1990, 1991, 1992, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1989, 1990, 1991, 1992, 2002, 2007 + Free Software Foundation, Inc. Written by James Clark (jjc@jclark.com) This file is part of groff. @@ -77,7 +78,8 @@ void accent_box::output() SKEW_FORMAT "]u)'", p->uid, ab->uid, p->uid); p->output(); - } else if (output_format == mathml) { + } + else if (output_format == mathml) { printf(""); p->output(); ab->output(); @@ -131,7 +133,8 @@ void accent_box::output() p->output(); printf(DELIMITER_CHAR); printf("\\h'\\n[" WIDTH_FORMAT "]u'", uid); - } else if (output_format == mathml) { + } + else if (output_format == mathml) { printf(""); p->output(); ab->output(); @@ -172,9 +175,9 @@ void overline_char_box::output() printf((draw_flag ? "\\D'l%dM 0'" : "\\l'%dM\\&\\(ru'"), accent_width); printf("\\v'%dM/2u+%dM'", 7*default_rule_thickness, x_height); - } else if (output_format == mathml) { - printf("¯"); } + else if (output_format == mathml) + printf("¯"); } void overline_char_box::debug_print() @@ -226,7 +229,8 @@ void overline_box::output() printf("\\l'\\n[" WIDTH_FORMAT "]u\\&\\(ru'", p->uid); printf(DELIMITER_CHAR); p->output(); - } else if (output_format == mathml) { + } + else if (output_format == mathml) { printf(""); p->output(); printf("¯"); @@ -304,7 +308,8 @@ void uaccent_box::output() p->output(); printf(DELIMITER_CHAR); printf("\\h'\\n[" WIDTH_FORMAT "]u'", uid); - } else if (output_format == mathml) { + } + else if (output_format == mathml) { printf(""); p->output(); ab->output(); @@ -350,9 +355,9 @@ void underline_char_box::output() printf((draw_flag ? "\\D'l%dM 0'" : "\\l'%dM\\&\\(ru'"), accent_width); printf("\\v'-%dM/2u'", 7*default_rule_thickness); - } else if (output_format == mathml) { - printf("_"); } + else if (output_format == mathml) + printf("_"); } void underline_char_box::debug_print() @@ -406,7 +411,8 @@ void underline_box::output() printf("\\l'\\n[" WIDTH_FORMAT "]u\\&\\(ru'", p->uid); printf(DELIMITER_CHAR); p->output(); - } else if (output_format == mathml) { + } + else if (output_format == mathml) { printf(""); p->output(); printf("¯"); @@ -450,7 +456,8 @@ void size_box::output() printf("\\s[\\n[" SMALL_SIZE_FORMAT "]u]", uid); p->output(); printf("\\s[\\n[" SIZE_FORMAT "]u]", uid); - } else if (output_format == mathml) { + } + else if (output_format == mathml) { printf("", size); p->output(); printf(""); @@ -503,17 +510,21 @@ void font_box::output() p->output(); current_roman_font = old_roman_font; printf("\\f[\\n[" FONT_FORMAT "]]", uid); - } else if (output_format == mathml) { - char *mlfont = f; + } + else if (output_format == mathml) { + const char *mlfont = f; // bold and italic are already in MathML; translate eqn roman here switch (f[0]) { - case 'I': case 'i': + case 'I': + case 'i': mlfont = "italic"; break; - case 'B': case 'b': + case 'B': + case 'b': mlfont = "bold"; break; - case 'R': case 'r': + case 'R': + case 'r': default: mlfont = "normal"; break; @@ -552,7 +563,8 @@ void fat_box::output() printf("\\h'-\\n[" WIDTH_FORMAT "]u'", p->uid); printf("\\h'%dM'", fat_offset); p->output(); - } else if (output_format == mathml) { + } + else if (output_format == mathml) { printf(""); p->output(); printf(""); @@ -596,8 +608,10 @@ void vmotion_box::output() printf("\\v'%dM'", -n); p->output(); printf("\\v'%dM'", n); - } else if (output_format == mathml) { - printf("eqn vertical motion cannot be expressed in MathML"); + } + else if (output_format == mathml) { + printf("eqn vertical motion cannot be expressed " + "in MathML"); p->output(); } } @@ -633,8 +647,10 @@ void hmotion_box::output() if (output_format == troff) { printf("\\h'%dM'", n); p->output(); - } else if (output_format == mathml) { - printf("eqn horizontal motion cannot be expessed in MathML"); + } + else if (output_format == mathml) { + printf("eqn horizontal motion cannot be expessed " + "in MathML"); p->output(); } } diff --git a/src/preproc/eqn/over.cpp b/src/preproc/eqn/over.cpp index 95a95415..3eec6f04 100644 --- a/src/preproc/eqn/over.cpp +++ b/src/preproc/eqn/over.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -/* Copyright (C) 1989, 1990, 1991, 1992, 2001, 2002 +/* Copyright (C) 1989, 1990, 1991, 1992, 2001, 2002, 2007 Free Software Foundation, Inc. Written by James Clark (jjc@jclark.com) @@ -177,7 +177,8 @@ void over_box::output() fputs(draw_flag ? " 0'" : "\\&\\(ru'", stdout); printf("\\v'%dM'", axis_height); printf("\\h'%dM'", null_delimiter_space); - } else if (output_format == mathml) { + } + else if (output_format == mathml) { // FIXME: passing a displaystyle attribute doesn't validate. printf(""); num->output(); diff --git a/src/preproc/eqn/pile.cpp b/src/preproc/eqn/pile.cpp index 2ce4e4fb..eba09dc3 100644 --- a/src/preproc/eqn/pile.cpp +++ b/src/preproc/eqn/pile.cpp @@ -1,5 +1,6 @@ // -*- C++ -*- -/* Copyright (C) 1989, 1990, 1991, 1992, 2004 Free Software Foundation, Inc. +/* Copyright (C) 1989, 1990, 1991, 1992, 2004, 2007 + Free Software Foundation, Inc. Written by James Clark (jjc@jclark.com) This file is part of groff. @@ -96,13 +97,21 @@ void pile_box::output() printf("\\v'\\n[" SUP_RAISE_FORMAT "]u'", uid); printf("\\v'-(%du*\\n[" BASELINE_SEP_FORMAT "]u)'", col.len - 1, uid); printf("\\h'\\n[" WIDTH_FORMAT "]u'", uid); - } else if (output_format == mathml) { + } + else if (output_format == mathml) { char *av; switch (col.align) { - case LEFT_ALIGN: av = "left"; break; - case RIGHT_ALIGN: av = "right"; break; - case CENTER_ALIGN: av = "center"; break; - default: assert(0); + case LEFT_ALIGN: + av = "left"; + break; + case RIGHT_ALIGN: + av = "right"; + break; + case CENTER_ALIGN: + av = "center"; + break; + default: + assert(0); } printf("", av); for (int i = 0; i < col.len; i++) { @@ -226,7 +235,8 @@ void matrix_box::output() printf("\\h'%dM'", column_sep); } printf("\\h'%dM'", matrix_side_sep); - } else if (output_format == mathml) { + } + else if (output_format == mathml) { int n = p[0]->len; // Each column must have the same number of rows in it printf(""); for (int i = 0; i < n; i++) { @@ -234,10 +244,17 @@ void matrix_box::output() for (int j = 0; j < len; j++) { char *av; switch (p[j]->align) { - case LEFT_ALIGN: av = "left"; break; - case RIGHT_ALIGN: av = "right"; break; - case CENTER_ALIGN: av = "center"; break; - default: assert(0); + case LEFT_ALIGN: + av = "left"; + break; + case RIGHT_ALIGN: + av = "right"; + break; + case CENTER_ALIGN: + av = "center"; + break; + default: + assert(0); } printf("", av); p[j]->p[i]->output(); diff --git a/src/preproc/eqn/script.cpp b/src/preproc/eqn/script.cpp index f5c56fee..71a5853f 100644 --- a/src/preproc/eqn/script.cpp +++ b/src/preproc/eqn/script.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -/* Copyright (C) 1989, 1990, 1991, 1992, 2002, 2004 +/* Copyright (C) 1989, 1990, 1991, 1992, 2002, 2004, 2007 Free Software Foundation, Inc. Written by James Clark (jjc@jclark.com) @@ -189,25 +189,27 @@ void script_box::output() } printf("\\h'\\n[" WIDTH_FORMAT "]u-\\n[" WIDTH_FORMAT "]u'", uid, p->uid); - } else if (output_format == mathml) { + } + else if (output_format == mathml) { if (sup != 0 and sub != 0) { printf(""); p->output(); sub->output(); sup->output(); printf(""); - } else if (sup != 0) { + } + else if (sup != 0) { printf(""); p->output(); sup->output(); printf(""); - } else if (sub != 0) { + } + else if (sub != 0) { printf(""); p->output(); sub->output(); printf(""); } - } } diff --git a/src/preproc/eqn/special.cpp b/src/preproc/eqn/special.cpp index 6e313d4f..f4305a89 100644 --- a/src/preproc/eqn/special.cpp +++ b/src/preproc/eqn/special.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -/* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc. +/* Copyright (C) 1989, 1990, 1991, 1992, 2007 Free Software Foundation, Inc. Written by James Clark (jjc@jclark.com) This file is part of groff. diff --git a/src/preproc/eqn/sqrt.cpp b/src/preproc/eqn/sqrt.cpp index 1d45a765..b340bd4e 100644 --- a/src/preproc/eqn/sqrt.cpp +++ b/src/preproc/eqn/sqrt.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -/* Copyright (C) 1989, 1990, 1991, 1992, 2002, 2003 +/* Copyright (C) 1989, 1990, 1991, 1992, 2002, 2003, 2007 Free Software Foundation, Inc. Written by James Clark (jjc@jclark.com) @@ -166,7 +166,8 @@ void sqrt_box::output() printf(DELIMITER_CHAR); printf("\\h'\\n[" WIDTH_FORMAT "]u'", uid); - } else if (output_format == mathml) { + } + else if (output_format == mathml) { printf(""); p->output(); printf(""); diff --git a/src/preproc/eqn/text.cpp b/src/preproc/eqn/text.cpp index 176500dd..84dc873f 100644 --- a/src/preproc/eqn/text.cpp +++ b/src/preproc/eqn/text.cpp @@ -1,5 +1,6 @@ // -*- C++ -*- -/* Copyright (C) 1989, 1990, 1991, 1992, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1989, 1990, 1991, 1992, 2003, 2007 + Free Software Foundation, Inc. Written by James Clark (jjc@jclark.com) This file is part of groff. @@ -24,379 +25,378 @@ Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "ptable.h" struct map { - char *from; - char *to; + const char *from; + const char *to; }; struct map entity_table[] = { - // Classic troff special characters - {"%", "­"}, // ISOnum - {"'", "´"}, // ISOdia - {"!=", "≠"}, // ISOtech - {"**", "∗"}, // ISOtech - {"*a", "α"}, // ISOgrk3 - {"*A", "A"}, - {"*b", "β"}, // ISOgrk3 - {"*B", "B"}, - {"*d", "δ"}, // ISOgrk3 - {"*D", "Δ"}, // ISOgrk3 - {"*e", "ε"}, // ISOgrk3 - {"*E", "E"}, - {"*f", "φ"}, // ISOgrk3 - {"*F", "Φ"}, // ISOgrk3 - {"*g", "γ"}, // ISOgrk3 - {"*G", "Γ"}, // ISOgrk3 - {"*h", "θ"}, // ISOgrk3 - {"*H", "Θ"}, // ISOgrk3 - {"*i", "ι"}, // ISOgrk3 - {"*I", "I"}, - {"*k", "κ"}, // ISOgrk3 - {"*K", "K;"}, - {"*l", "&lamda;"}, // ISOgrk3 - {"*L", "Λ"}, // ISOgrk3 - {"*m", "μ"}, // ISOgrk3 - {"*M", "M"}, - {"*n", "&nu"}, // ISOgrk3 - {"*N", "N"}, - {"*o", "o"}, - {"*O", "O"}, - {"*p", "π"}, // ISOgrk3 - {"*P", "Π"}, // ISOgrk3 - {"*q", "ψ"}, // ISOgrk3 - {"*Q", "&PSI;"}, // ISOgrk3 - {"*r", "ρ"}, // ISOgrk3 - {"*R", "R"}, - {"*s", "σ"}, // ISOgrk3 - {"*S", "Σ"}, // ISOgrk3 - {"*t", "τ"}, // ISOgrk3 - {"*T", "Τ"}, // ISOgrk3 - {"*u", "υ"}, // ISOgrk3 - {"*U", "Υ"}, // ISOgrk3 - {"*w", "ω"}, // ISOgrk3 - {"*W", "Ω"}, // ISOgrk3 - {"*x", "χ"}, // ISOgrk3 - {"*X", "Χ"}, // ISOgrk3 - {"*y", "η"}, // ISOgrk3 - {"*Y", "Η"}, // ISOgrk3 - {"*z", "ζ"}, // ISOgrk3 - {"*Z", "Ζ"}, // ISOgrk3 - {"+-", "±"}, // ISOnum - {"->", "→"}, // ISOnum - {"12", "½"}, // ISOnum - {"14", "¼"}, // ISOnum - {"34", "¾"}, // ISOnum - {"<-", "←"}, // ISOnum - {"==", "≡"}, // ISOtech - {"Fi", "ffi"}, // ISOpub - {"Fl", "ffl"}, // ISOpub - {"aa", "´"}, // ISOdia - {"ap", "∼"}, // ISOtech - {"bl", "&phonexb;"}, // ISOpub - {"br", "│"}, // ISObox - {"bs", "☎"}, // ISOpub (for the Bell logo) - {"bu", "•"}, // ISOpub - {"bv", "|"}, // ISOnum - {"ca", "∩"}, // ISOtech - {"ci", "○"}, // ISOpub - {"co", "©"}, // ISOnum - {"ct", "¢"}, // ISOnum - {"cu", "∪"}, // ISOtech - {"da", "↓"}, // ISOnum - {"de", "°"}, // ISOnum - {"dg", "†"}, // ISOpub - {"dd", "‡"}, // ISOpub - {"di", "÷"}, // ISOnum - {"em", "—"}, // ISOpub - {"eq", "="}, // ISOnum - {"es", "∅"}, // ISOamso - {"ff", "ff"}, // ISOpub - {"fi", "fi"}, // ISOpub - {"fl", "fl"}, // ISOpub - {"fm", "′"}, // ISOtech - {"ge", "≥"}, // ISOtech - {"gr", "∇"}, // ISOtech - {"hy", "‐"}, // ISOnum - {"ib", "⊆"}, // ISOtech - {"if", "∞"}, // ISOtech - {"ip", "⊇"}, // ISOtech - {"is", "∫"}, // ISOtech - {"le", "≤"}, // ISOtech - // Some pile characters go here - {"mi", "−"}, // ISOtech - {"mo", "∈"}, // ISOtech - {"mu", "×"}, // ISOnum - {"no", "¬"}, // ISOnum - {"or", "|"}, // ISOnum - {"pl", "+"}, // ISOnum - {"pt", "∝"}, // ISOtech - {"rg", "™"}, // ISOnum - // More pile characters go here - {"rn", "¯"}, // ISOdia - {"ru", "_"}, // ISOnum - {"sb", "⊂"}, // ISOtech - {"sc", "§"}, // ISOnum - {"sl", "/"}, - {"sp", "⊃"}, // ISOtech - {"sq", "▪"}, // ISOpub - {"sr", "√"}, // ISOtech - {"ts", "ς"}, // ISOgrk3 - {"ua", "↑"}, // ISOnum - {"ul", "_"}, - {"~=", "≅"}, // ISOtech - // Extended specials supported by groff; see groff_char(7). - // These are listed in the order they occur on that man page. - {"-D", "Ð"}, // ISOlat: Icelandic uppercase eth - {"Sd", "ð"}, // ISOlat1: Icelandic lowercase eth - {"TP", "Þ"}, // ISOlat1: Icelandic uppercase thorn - {"Tp", "þ"}, // ISOlat1: Icelandic lowercase thorn - {"ss", "ß"}, // ISOlat1 - // Ligatures - // ff, fi, fl, ffi, ffl from old troff go here - {"AE", "Æ"}, // ISOlat1 - {"ae", "æ"}, // ISOlat1 - {"OE", "Œ"}, // ISOlat2 - {"oe", "œ"}, // ISOlat2 - {"IJ", "ij"}, // ISOlat2: Dutch IJ ligature - {"ij", "IJ"}, // ISOlat2: Dutch ij ligature - {".i", "ı"}, // ISOlat2,ISOamso - {".j", "&jnodot;"}, // ISOamso (undocumented but in 1.19) - // Accented characters - {"'A", "Á"}, // ISOlat1 - {"'C", "Ć"}, // ISOlat2 - {"'E", "É"}, // ISOlat1 - {"'I", "Í"}, // ISOlat1 - {"'O", "Ó"}, // ISOlat1 - {"'U", "Ú"}, // ISOlat1 - {"'Y", "Ý"}, // ISOlat1 - {"'a", "á"}, // ISOlat1 - {"'c", "ć"}, // ISOlat2 - {"'e", "é"}, // ISOlat1 - {"'i", "í"}, // ISOlat1 - {"'o", "ó"}, // ISOlat1 - {"'u", "ú"}, // ISOlat1 - {"'y", "ý"}, // ISOlat1 - {":A", "Ä"}, // ISOlat1 - {":E", "Ë"}, // ISOlat1 - {":I", "Ï"}, // ISOlat1 - {":O", "Ö"}, // ISOlat1 - {":U", "Ü"}, // ISOlat1 - {":Y", "Ÿ"}, // ISOlat2 - {":a", "ä"}, // ISOlat1 - {":e", "ë"}, // ISOlat1 - {":i", "ï"}, // ISOlat1 - {":o", "ö"}, // ISOlat1 - {":u", "ü"}, // ISOlat1 - {":y", "ÿ"}, // ISOlat1 - {"^A", "Â"}, // ISOlat1 - {"^E", "Ê"}, // ISOlat1 - {"^I", "Î"}, // ISOlat1 - {"^O", "Ô"}, // ISOlat1 - {"^U", "Û"}, // ISOlat1 - {"^a", "â"}, // ISOlat1 - {"^e", "ê"}, // ISOlat1 - {"^i", "î"}, // ISOlat1 - {"^o", "ô"}, // ISOlat1 - {"^u", "û"}, // ISOlat1 - {"`A", "À"}, // ISOlat1 - {"`E", "È"}, // ISOlat1 - {"`I", "Ì"}, // ISOlat1 - {"`O", "Ò"}, // ISOlat1 - {"`U", "Ù"}, // ISOlat1 - {"`a", "à"}, // ISOlat1 - {"`e", "è"}, // ISOlat1 - {"`i", "ì"}, // ISOlat1 - {"`o", "ò"}, // ISOlat1 - {"`u", "ù"}, // ISOlat1 - {"~A", "Ã"}, // ISOlat1 - {"~N", "Ñ"}, // ISOlat1 - {"~O", "Õ"}, // ISOlat1 - {"~a", "ã"}, // ISOlat1 - {"~n", "ñ"}, // ISOlat1 - {"~o", "õ"}, // ISOlat1 - {"vS", "Š"}, // ISOlat2 - {"vs", "š"}, // ISOlat2 - {"vZ", "Ž"}, // ISOlat2 - {"vz", "ž"}, // ISOlat2 - {",C", "Ç"}, // ISOlat1 - {",c", "ç"}, // ISOlat1 - {"/L", "Ł"}, // ISOlat2: Polish L with a slash - {"/l", "ł"}, // ISOlat2: Polish l with a slash - {"/O", "Ø"}, // ISOlat1 - {"/o", "ø"}, // ISOlat1 - {"oA", "Å"}, // ISOlat1 - {"oa", "å"}, // ISOlat1 - // Accents - {"a\"","˝"}, // ISOdia: double acute accent (Hungarian umlaut) - {"a-", "¯"}, // ISOdia: macron or bar accent - {"a.", "˙"}, // ISOdia: dot above - {"a^", "ˆ"}, // ISOdia: circumflex accent - {"aa", "´"}, // ISOdia: acute accent - {"ga", "`"}, // ISOdia: grave accent - {"ab", "˘"}, // ISOdia: breve accent - {"ac", "¸"}, // ISOdia: cedilla accent - {"ad", "¨"}, // ISOdia: umlaut or dieresis - {"ah", "ˇ"}, // ISOdia: caron (aka hacek accent) - {"ao", "˚"}, // ISOdia: ring or circle accent - {"a~", "˜"}, // ISOdia: tilde accent - {"ho", "˛"}, // ISOdia: hook or ogonek accent - {"ha", "^"}, // ASCII circumflex, hat, caret - {"ti", "~"}, // ASCII tilde, large tilde - // Quotes - {"Bq", "‚"}, // ISOpub: low double comma quote - {"bq", "„"}, // ISOpub: low single comma quote - {"lq", "“"}, // ISOnum - {"rq", "”"}, // ISOpub - {"oq", "‘"}, // ISOnum: single open quote - {"cq", "’"}, // ISOnum: single closing quote (ASCII 39) - {"aq", "&zerosp;'"}, // apostrophe quote - {"dq", "\""}, // double quote (ASCII 34) - {"Fo", "«"}, // ISOnum - {"Fc", "»"}, // ISOnum - //{"fo", "&fo;"}, - //{"fc", "&fc;"}, - // Punctuation - {"r!", "¡"}, // ISOnum - {"r?", "¿"}, // ISOnum - // Old troff \(em goes here - {"en", "–"}, // ISOpub: en dash - // Old troff \(hy goes here - // Brackets - {"lB", "["}, // ISOnum: left (square) bracket - {"rB", "]"}, // ISOnum: right (square) bracket - {"lC", "{"}, // ISOnum: left (curly) brace - {"rC", "}"}, // ISOnum: right (curly) brace - {"la", "⟨"}, // ISOtech: left angle bracket - {"ra", "⟩"}, // ISOtech: right angle bracket - // Old troff \(bv goes here - // Bracket-pile characters could go here. - // Arrows - // Old troff \(<- and \(-> go here - {"<>", "↔"}, // ISOamsa - {"da", "↓"}, // ISOnum - {"ua", "↑"}, // ISOnum - {"lA", "⇐"}, // ISOtech - {"rA", "⇒"}, // ISOtech - {"hA", "⇔"}, // ISOtech: horizontal double-headed arrow - {"dA", "⇓"}, // ISOamsa - {"uA", "⇑"}, // ISOamsa - {"vA", "⇕"}, // ISOamsa: vertical double-headed double arrow - //{"an", "&an;"}, - // Lines - {"-h", "ℏ"}, // ISOamso: h-bar (Planck's constant) - // Old troff \(or goes here - {"ba", "|"}, // ISOnum - // Old troff \(br, \{u, \(ul, \(bv go here - {"bb", "¦"}, // ISOnum - {"sl", "/"}, - {"rs", "\"}, // ISOnum - // Text markers - // Old troff \(ci, \(bu, \(dd, \(dg go here - {"lz", "◊"}, // ISOpub - // Old troff sq goes here - {"ps", "¶"}, // ISOnum: paragraph or pilcrow sign - {"sc", "§"}, // ISOnum (in old troff) - // Old troff \(lh, \{h go here - {"at", "@"}, // ISOnum - {"sh", "#"}, // ISOnum - //{"CR", "&CR;"}, - {"OK", "✓"}, // ISOpub - // Legalize - // Old troff \(co, \{g go here - {"tm", "™"}, // ISOnum - // Currency symbols - {"Do", "$"}, // ISOnum - {"ct", "¢"}, // ISOnum - {"eu", "€"}, - {"Eu", "€"}, - {"Ye", "¥"}, // ISOnum - {"Po", "£"}, // ISOnum - {"Cs", "¤"}, // ISOnum: currency sign - {"Fn", "&fnof"}, // ISOtech - // Units - // Old troff de goes here - {"%0", "‰"}, // ISOtech: per thousand, per mille sign - // Old troff \(fm goes here - {"sd", "″"}, // ISOtech - {"mc", "µ"}, // ISOnum - {"Of", "ª"}, // ISOnum - {"Om", "º"}, // ISOnum - // Logical symbols - {"AN", "∧"}, // ISOtech - {"OR", "∨"}, // ISOtech - // Old troff \(no goes here - {"te", "∃"}, // ISOtech: there exists, existential quantifier - {"fa", "∀"}, // ISOtech: for all, universal quantifier - {"st", "&bepsi"}, // ISOamsr: such that - {"3d", "∴"}, // ISOtech - {"tf", "∴"}, // ISOtech - // Mathematical symbols - // Old troff "12", "14", "34" goes here - {"S1", "¹"}, // ISOnum - {"S2", "²"}, // ISOnum - {"S3", "³"}, // ISOnum - // Old troff \(pl", \-, \(+- go here - {"t+-", "±"}, // ISOnum - {"-+", "∓"}, // ISOtech - {"pc", "·"}, // ISOnum - {"md", "·"}, // ISOnum - // Old troff \(mu goes here - {"tmu", "×"}, // ISOnum - {"c*", "⊗"}, // ISOamsb: multiply sign in a circle - {"c+", "⊕"}, // ISOamsb: plus sign in a circle - // Old troff \(di goes here - {"tdi", "÷"}, // ISOnum - {"f/", "―"}, // ISOnum: horizintal bar for fractions - // Old troff \(** goes here - {"<=", "≤"}, // ISOtech - {">=", "≥"}, // ISOtech - {"<<", "≪"}, // ISOamsr - {">>", "≫"}, // ISOamsr - {"!=", "≠"}, // ISOtech - // Old troff \(eq and \(== go here - {"=~", "≅"}, // ISOamsr - // Old troff \(ap goes here - {"~~", "≈"}, // ISOtech - // This appears to be an error in the groff table. - // It clashes with the Bell Labs use of ~= for a congruence sign - // {"~=", "≈"}, // ISOamsr - // Old troff \(pt, \(es, \(mo go here - {"nm", "∉"}, // ISOtech - {"nb", "⊄"}, // ISOamsr - {"nc", "⊅"}, // ISOamsn - {"ne", "≢"}, // ISOamsn - // Old troff \(sb, \(sp, \(ib, \(ip, \(ca, \(cu go here - {"/_", "∠"}, // ISOamso - {"pp", "⊥"}, // ISOtech - // Old troff \(is goes here - {"sum", "∑"}, // ISOamsb - {"product", "∏"}, // ISOamsb - {"gr", "∇"}, // ISOtech - // Old troff \(sr. \{n, \(if go here - {"Ah", "ℵ"}, // ISOtech - {"Im", "ℑ"}, // ISOamso: Fraktur I, imaginary - {"Re", "ℜ"}, // ISOamso: Fraktur R, real - {"wp", "℘"}, // ISOamso - {"pd", "∂"}, // ISOtech: partial differentiation sign - // Their table duplicates the Greek letters here. - // We list only the variant forms here, mapping them into - // the ISO Greek 4 variants (which may or may not be correct :-() - {"+f", "&b.phiv;"}, // ISOgrk4: variant phi - {"+h", "&b.thetas;"}, // ISOgrk4: variant theta - {"+p", "&b.omega;"}, // ISOgrk4: variant pi, looking like omega - // Card symbols - {"CL", "♣"}, // ISOpub: club suit - {"SP", "♠"}, // ISOpub: spade suit - {"HE", "♥"}, // ISOpub: heart suit - {"DI", "♦"}, // ISOpub: diamond suit + // Classic troff special characters + {"%", "­"}, // ISOnum + {"'", "´"}, // ISOdia + {"!=", "≠"}, // ISOtech + {"**", "∗"}, // ISOtech + {"*a", "α"}, // ISOgrk3 + {"*A", "A"}, + {"*b", "β"}, // ISOgrk3 + {"*B", "B"}, + {"*d", "δ"}, // ISOgrk3 + {"*D", "Δ"}, // ISOgrk3 + {"*e", "ε"}, // ISOgrk3 + {"*E", "E"}, + {"*f", "φ"}, // ISOgrk3 + {"*F", "Φ"}, // ISOgrk3 + {"*g", "γ"}, // ISOgrk3 + {"*G", "Γ"}, // ISOgrk3 + {"*h", "θ"}, // ISOgrk3 + {"*H", "Θ"}, // ISOgrk3 + {"*i", "ι"}, // ISOgrk3 + {"*I", "I"}, + {"*k", "κ"}, // ISOgrk3 + {"*K", "K;"}, + {"*l", "&lamda;"}, // ISOgrk3 + {"*L", "Λ"}, // ISOgrk3 + {"*m", "μ"}, // ISOgrk3 + {"*M", "M"}, + {"*n", "&nu"}, // ISOgrk3 + {"*N", "N"}, + {"*o", "o"}, + {"*O", "O"}, + {"*p", "π"}, // ISOgrk3 + {"*P", "Π"}, // ISOgrk3 + {"*q", "ψ"}, // ISOgrk3 + {"*Q", "&PSI;"}, // ISOgrk3 + {"*r", "ρ"}, // ISOgrk3 + {"*R", "R"}, + {"*s", "σ"}, // ISOgrk3 + {"*S", "Σ"}, // ISOgrk3 + {"*t", "τ"}, // ISOgrk3 + {"*T", "Τ"}, // ISOgrk3 + {"*u", "υ"}, // ISOgrk3 + {"*U", "Υ"}, // ISOgrk3 + {"*w", "ω"}, // ISOgrk3 + {"*W", "Ω"}, // ISOgrk3 + {"*x", "χ"}, // ISOgrk3 + {"*X", "Χ"}, // ISOgrk3 + {"*y", "η"}, // ISOgrk3 + {"*Y", "Η"}, // ISOgrk3 + {"*z", "ζ"}, // ISOgrk3 + {"*Z", "Ζ"}, // ISOgrk3 + {"+-", "±"}, // ISOnum + {"->", "→"}, // ISOnum + {"12", "½"}, // ISOnum + {"14", "¼"}, // ISOnum + {"34", "¾"}, // ISOnum + {"<-", "←"}, // ISOnum + {"==", "≡"}, // ISOtech + {"Fi", "ffi"}, // ISOpub + {"Fl", "ffl"}, // ISOpub + {"aa", "´"}, // ISOdia + {"ap", "∼"}, // ISOtech + {"bl", "&phonexb;"}, // ISOpub + {"br", "│"}, // ISObox + {"bs", "☎"}, // ISOpub (for the Bell logo) + {"bu", "•"}, // ISOpub + {"bv", "|"}, // ISOnum + {"ca", "∩"}, // ISOtech + {"ci", "○"}, // ISOpub + {"co", "©"}, // ISOnum + {"ct", "¢"}, // ISOnum + {"cu", "∪"}, // ISOtech + {"da", "↓"}, // ISOnum + {"de", "°"}, // ISOnum + {"dg", "†"}, // ISOpub + {"dd", "‡"}, // ISOpub + {"di", "÷"}, // ISOnum + {"em", "—"}, // ISOpub + {"eq", "="}, // ISOnum + {"es", "∅"}, // ISOamso + {"ff", "ff"}, // ISOpub + {"fi", "fi"}, // ISOpub + {"fl", "fl"}, // ISOpub + {"fm", "′"}, // ISOtech + {"ge", "≥"}, // ISOtech + {"gr", "∇"}, // ISOtech + {"hy", "‐"}, // ISOnum + {"ib", "⊆"}, // ISOtech + {"if", "∞"}, // ISOtech + {"ip", "⊇"}, // ISOtech + {"is", "∫"}, // ISOtech + {"le", "≤"}, // ISOtech + // Some pile characters go here + {"mi", "−"}, // ISOtech + {"mo", "∈"}, // ISOtech + {"mu", "×"}, // ISOnum + {"no", "¬"}, // ISOnum + {"or", "|"}, // ISOnum + {"pl", "+"}, // ISOnum + {"pt", "∝"}, // ISOtech + {"rg", "™"}, // ISOnum + // More pile characters go here + {"rn", "¯"}, // ISOdia + {"ru", "_"}, // ISOnum + {"sb", "⊂"}, // ISOtech + {"sc", "§"}, // ISOnum + {"sl", "/"}, + {"sp", "⊃"}, // ISOtech + {"sq", "▪"}, // ISOpub + {"sr", "√"}, // ISOtech + {"ts", "ς"}, // ISOgrk3 + {"ua", "↑"}, // ISOnum + {"ul", "_"}, + {"~=", "≅"}, // ISOtech + // Extended specials supported by groff; see groff_char(7). + // These are listed in the order they occur on that man page. + {"-D", "Ð"}, // ISOlat: Icelandic uppercase eth + {"Sd", "ð"}, // ISOlat1: Icelandic lowercase eth + {"TP", "Þ"}, // ISOlat1: Icelandic uppercase thorn + {"Tp", "þ"}, // ISOlat1: Icelandic lowercase thorn + {"ss", "ß"}, // ISOlat1 + // Ligatures + // ff, fi, fl, ffi, ffl from old troff go here + {"AE", "Æ"}, // ISOlat1 + {"ae", "æ"}, // ISOlat1 + {"OE", "Œ"}, // ISOlat2 + {"oe", "œ"}, // ISOlat2 + {"IJ", "ij"}, // ISOlat2: Dutch IJ ligature + {"ij", "IJ"}, // ISOlat2: Dutch ij ligature + {".i", "ı"}, // ISOlat2,ISOamso + {".j", "&jnodot;"}, // ISOamso (undocumented but in 1.19) + // Accented characters + {"'A", "Á"}, // ISOlat1 + {"'C", "Ć"}, // ISOlat2 + {"'E", "É"}, // ISOlat1 + {"'I", "Í"}, // ISOlat1 + {"'O", "Ó"}, // ISOlat1 + {"'U", "Ú"}, // ISOlat1 + {"'Y", "Ý"}, // ISOlat1 + {"'a", "á"}, // ISOlat1 + {"'c", "ć"}, // ISOlat2 + {"'e", "é"}, // ISOlat1 + {"'i", "í"}, // ISOlat1 + {"'o", "ó"}, // ISOlat1 + {"'u", "ú"}, // ISOlat1 + {"'y", "ý"}, // ISOlat1 + {":A", "Ä"}, // ISOlat1 + {":E", "Ë"}, // ISOlat1 + {":I", "Ï"}, // ISOlat1 + {":O", "Ö"}, // ISOlat1 + {":U", "Ü"}, // ISOlat1 + {":Y", "Ÿ"}, // ISOlat2 + {":a", "ä"}, // ISOlat1 + {":e", "ë"}, // ISOlat1 + {":i", "ï"}, // ISOlat1 + {":o", "ö"}, // ISOlat1 + {":u", "ü"}, // ISOlat1 + {":y", "ÿ"}, // ISOlat1 + {"^A", "Â"}, // ISOlat1 + {"^E", "Ê"}, // ISOlat1 + {"^I", "Î"}, // ISOlat1 + {"^O", "Ô"}, // ISOlat1 + {"^U", "Û"}, // ISOlat1 + {"^a", "â"}, // ISOlat1 + {"^e", "ê"}, // ISOlat1 + {"^i", "î"}, // ISOlat1 + {"^o", "ô"}, // ISOlat1 + {"^u", "û"}, // ISOlat1 + {"`A", "À"}, // ISOlat1 + {"`E", "È"}, // ISOlat1 + {"`I", "Ì"}, // ISOlat1 + {"`O", "Ò"}, // ISOlat1 + {"`U", "Ù"}, // ISOlat1 + {"`a", "à"}, // ISOlat1 + {"`e", "è"}, // ISOlat1 + {"`i", "ì"}, // ISOlat1 + {"`o", "ò"}, // ISOlat1 + {"`u", "ù"}, // ISOlat1 + {"~A", "Ã"}, // ISOlat1 + {"~N", "Ñ"}, // ISOlat1 + {"~O", "Õ"}, // ISOlat1 + {"~a", "ã"}, // ISOlat1 + {"~n", "ñ"}, // ISOlat1 + {"~o", "õ"}, // ISOlat1 + {"vS", "Š"}, // ISOlat2 + {"vs", "š"}, // ISOlat2 + {"vZ", "Ž"}, // ISOlat2 + {"vz", "ž"}, // ISOlat2 + {",C", "Ç"}, // ISOlat1 + {",c", "ç"}, // ISOlat1 + {"/L", "Ł"}, // ISOlat2: Polish L with a slash + {"/l", "ł"}, // ISOlat2: Polish l with a slash + {"/O", "Ø"}, // ISOlat1 + {"/o", "ø"}, // ISOlat1 + {"oA", "Å"}, // ISOlat1 + {"oa", "å"}, // ISOlat1 + // Accents + {"a\"","˝"}, // ISOdia: double acute accent (Hungarian umlaut) + {"a-", "¯"}, // ISOdia: macron or bar accent + {"a.", "˙"}, // ISOdia: dot above + {"a^", "ˆ"}, // ISOdia: circumflex accent + {"aa", "´"}, // ISOdia: acute accent + {"ga", "`"}, // ISOdia: grave accent + {"ab", "˘"}, // ISOdia: breve accent + {"ac", "¸"}, // ISOdia: cedilla accent + {"ad", "¨"}, // ISOdia: umlaut or dieresis + {"ah", "ˇ"}, // ISOdia: caron (aka hacek accent) + {"ao", "˚"}, // ISOdia: ring or circle accent + {"a~", "˜"}, // ISOdia: tilde accent + {"ho", "˛"}, // ISOdia: hook or ogonek accent + {"ha", "^"}, // ASCII circumflex, hat, caret + {"ti", "~"}, // ASCII tilde, large tilde + // Quotes + {"Bq", "‚"}, // ISOpub: low double comma quote + {"bq", "„"}, // ISOpub: low single comma quote + {"lq", "“"}, // ISOnum + {"rq", "”"}, // ISOpub + {"oq", "‘"}, // ISOnum: single open quote + {"cq", "’"}, // ISOnum: single closing quote (ASCII 39) + {"aq", "&zerosp;'"}, // apostrophe quote + {"dq", "\""}, // double quote (ASCII 34) + {"Fo", "«"}, // ISOnum + {"Fc", "»"}, // ISOnum + //{"fo", "&fo;"}, + //{"fc", "&fc;"}, + // Punctuation + {"r!", "¡"}, // ISOnum + {"r?", "¿"}, // ISOnum + // Old troff \(em goes here + {"en", "–"}, // ISOpub: en dash + // Old troff \(hy goes here + // Brackets + {"lB", "["}, // ISOnum: left (square) bracket + {"rB", "]"}, // ISOnum: right (square) bracket + {"lC", "{"}, // ISOnum: left (curly) brace + {"rC", "}"}, // ISOnum: right (curly) brace + {"la", "⟨"}, // ISOtech: left angle bracket + {"ra", "⟩"}, // ISOtech: right angle bracket + // Old troff \(bv goes here + // Bracket-pile characters could go here. + // Arrows + // Old troff \(<- and \(-> go here + {"<>", "↔"}, // ISOamsa + {"da", "↓"}, // ISOnum + {"ua", "↑"}, // ISOnum + {"lA", "⇐"}, // ISOtech + {"rA", "⇒"}, // ISOtech + {"hA", "⇔"}, // ISOtech: horizontal double-headed arrow + {"dA", "⇓"}, // ISOamsa + {"uA", "⇑"}, // ISOamsa + {"vA", "⇕"}, // ISOamsa: vertical double-headed double arrow + //{"an", "&an;"}, + // Lines + {"-h", "ℏ"}, // ISOamso: h-bar (Planck's constant) + // Old troff \(or goes here + {"ba", "|"}, // ISOnum + // Old troff \(br, \{u, \(ul, \(bv go here + {"bb", "¦"}, // ISOnum + {"sl", "/"}, + {"rs", "\"}, // ISOnum + // Text markers + // Old troff \(ci, \(bu, \(dd, \(dg go here + {"lz", "◊"}, // ISOpub + // Old troff sq goes here + {"ps", "¶"}, // ISOnum: paragraph or pilcrow sign + {"sc", "§"}, // ISOnum (in old troff) + // Old troff \(lh, \{h go here + {"at", "@"}, // ISOnum + {"sh", "#"}, // ISOnum + //{"CR", "&CR;"}, + {"OK", "✓"}, // ISOpub + // Legalize + // Old troff \(co, \{g go here + {"tm", "™"}, // ISOnum + // Currency symbols + {"Do", "$"}, // ISOnum + {"ct", "¢"}, // ISOnum + {"eu", "€"}, + {"Eu", "€"}, + {"Ye", "¥"}, // ISOnum + {"Po", "£"}, // ISOnum + {"Cs", "¤"}, // ISOnum: currency sign + {"Fn", "&fnof"}, // ISOtech + // Units + // Old troff de goes here + {"%0", "‰"}, // ISOtech: per thousand, per mille sign + // Old troff \(fm goes here + {"sd", "″"}, // ISOtech + {"mc", "µ"}, // ISOnum + {"Of", "ª"}, // ISOnum + {"Om", "º"}, // ISOnum + // Logical symbols + {"AN", "∧"}, // ISOtech + {"OR", "∨"}, // ISOtech + // Old troff \(no goes here + {"te", "∃"}, // ISOtech: there exists, existential quantifier + {"fa", "∀"}, // ISOtech: for all, universal quantifier + {"st", "&bepsi"}, // ISOamsr: such that + {"3d", "∴"}, // ISOtech + {"tf", "∴"}, // ISOtech + // Mathematical symbols + // Old troff "12", "14", "34" goes here + {"S1", "¹"}, // ISOnum + {"S2", "²"}, // ISOnum + {"S3", "³"}, // ISOnum + // Old troff \(pl", \-, \(+- go here + {"t+-", "±"}, // ISOnum + {"-+", "∓"}, // ISOtech + {"pc", "·"}, // ISOnum + {"md", "·"}, // ISOnum + // Old troff \(mu goes here + {"tmu", "×"}, // ISOnum + {"c*", "⊗"}, // ISOamsb: multiply sign in a circle + {"c+", "⊕"}, // ISOamsb: plus sign in a circle + // Old troff \(di goes here + {"tdi", "÷"}, // ISOnum + {"f/", "―"}, // ISOnum: horizintal bar for fractions + // Old troff \(** goes here + {"<=", "≤"}, // ISOtech + {">=", "≥"}, // ISOtech + {"<<", "≪"}, // ISOamsr + {">>", "≫"}, // ISOamsr + {"!=", "≠"}, // ISOtech + // Old troff \(eq and \(== go here + {"=~", "≅"}, // ISOamsr + // Old troff \(ap goes here + {"~~", "≈"}, // ISOtech + // This appears to be an error in the groff table. + // It clashes with the Bell Labs use of ~= for a congruence sign + // {"~=", "≈"}, // ISOamsr + // Old troff \(pt, \(es, \(mo go here + {"nm", "∉"}, // ISOtech + {"nb", "⊄"}, // ISOamsr + {"nc", "⊅"}, // ISOamsn + {"ne", "≢"}, // ISOamsn + // Old troff \(sb, \(sp, \(ib, \(ip, \(ca, \(cu go here + {"/_", "∠"}, // ISOamso + {"pp", "⊥"}, // ISOtech + // Old troff \(is goes here + {"sum", "∑"}, // ISOamsb + {"product", "∏"}, // ISOamsb + {"gr", "∇"}, // ISOtech + // Old troff \(sr. \{n, \(if go here + {"Ah", "ℵ"}, // ISOtech + {"Im", "ℑ"}, // ISOamso: Fraktur I, imaginary + {"Re", "ℜ"}, // ISOamso: Fraktur R, real + {"wp", "℘"}, // ISOamso + {"pd", "∂"}, // ISOtech: partial differentiation sign + // Their table duplicates the Greek letters here. + // We list only the variant forms here, mapping them into + // the ISO Greek 4 variants (which may or may not be correct :-() + {"+f", "&b.phiv;"}, // ISOgrk4: variant phi + {"+h", "&b.thetas;"}, // ISOgrk4: variant theta + {"+p", "&b.omega;"}, // ISOgrk4: variant pi, looking like omega + // Card symbols + {"CL", "♣"}, // ISOpub: club suit + {"SP", "♠"}, // ISOpub: spade suit + {"HE", "♥"}, // ISOpub: heart suit + {"DI", "♦"}, // ISOpub: diamond suit }; -char *special_to_entity(const char *sp) +const char *special_to_entity(const char *sp) { struct map *mp; - char *entity; for (mp = entity_table; mp < entity_table + sizeof(entity_table)/sizeof(entity_table[0]); - mp++){ + mp++) { if (strcmp(mp->from, sp) == 0) return mp->to; } @@ -438,7 +438,7 @@ enum spacing_type { s_closing, s_punctuation, s_inner, - s_suppress, + s_suppress }; const char *spacing_type_table[] = { @@ -589,7 +589,8 @@ void char_box::output() fputs("\\&", stdout); // suppress ligaturing and kerning if (font_type != LETTER_TYPE) fputs("\\fP", stdout); - } else if (output_format == mathml) { + } + else if (output_format == mathml) { if (isdigit(c)) printf(""); else if (char_table[c].spacing_type) @@ -660,8 +661,9 @@ void special_char_box::output() printf("\\,\\[%s]\\/", s); if (font_type != LETTER_TYPE) printf("\\fP"); - } else if (output_format == mathml) { - char *entity = special_to_entity(s); + } + else if (output_format == mathml) { + const char *entity = special_to_entity(s); if (entity != NULL) printf("%s", entity); else -- cgit v1.2.1