diff options
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | REVISION | 2 | ||||
-rw-r--r-- | src/libs/libgroff/tmpfile.cc | 24 | ||||
-rw-r--r-- | src/roff/grog/grog.pl | 27 | ||||
-rw-r--r-- | src/roff/grog/grog.sh | 23 | ||||
-rw-r--r-- | src/roff/troff/input.cc | 10 |
6 files changed, 72 insertions, 23 deletions
@@ -1,3 +1,12 @@ +2001-07-02 Werner LEMBERG <wl@gnu.org> + + * REVISION: Increased to 2. + * src/roff/troff/input.cc (read_size): Fix special case `\s[0]'. + + * src/groff/grog/grog.pl (process): Handle `Oo' and `Oc' not at the + beginning of a line. + * src/groff/grog/grog.sh: Ditto. + 2001-06-29 Peter Marquardt <wwwutz@molgen.mpg.de> * src/preproc/eqn/neqn.sh: Put `export' keyword in a new line to @@ -1 +1 @@ -1 +2 diff --git a/src/libs/libgroff/tmpfile.cc b/src/libs/libgroff/tmpfile.cc index d06a82bd..cf2bb8b1 100644 --- a/src/libs/libgroff/tmpfile.cc +++ b/src/libs/libgroff/tmpfile.cc @@ -103,14 +103,13 @@ static void remove_tmp_files() { struct xtmpfile_list *p = xtmpfiles_to_delete; - while (p) - { - if (unlink(p->fname) < 0) - error("cannot unlink `%1': %2", p->fname, strerror(errno)); - struct xtmpfile_list *old = p; - p = p->next; - free(old); - } + while (p) { + if (unlink(p->fname) < 0) + error("cannot unlink `%1': %2", p->fname, strerror(errno)); + struct xtmpfile_list *old = p; + p = p->next; + free(old); + } } static void add_tmp_file(const char *name) @@ -121,11 +120,10 @@ static void add_tmp_file(const char *name) struct xtmpfile_list *p = (struct xtmpfile_list *)malloc(sizeof(struct xtmpfile_list) + strlen (name)); - if (p == NULL) - { - error("cannot unlink `%1': %2", name, strerror(errno)); - return; - } + if (p == NULL) { + error("cannot unlink `%1': %2", name, strerror(errno)); + return; + } p->next = xtmpfiles_to_delete; strcpy(p->fname, name); xtmpfiles_to_delete = p; diff --git a/src/roff/grog/grog.pl b/src/roff/grog/grog.pl index 57cd1594..a61106c1 100644 --- a/src/roff/grog/grog.pl +++ b/src/roff/grog/grog.pl @@ -113,9 +113,36 @@ sub process { # closed by `Oc'. elsif (/^\.Oo$sp/) { $Oo++; + s/^\.Oo/\. /; + redo; + } + # The test for `Oo' and `Oc' not starting a line (as allowed by the + # new implementation of -mdoc) is not complete; it assumes that + # macro arguments are well behaved, i.e., "" is used within "..." to + # indicate a doublequote as a string element, and weird features + # like `.foo a"b' are not used. + elsif (/^\..* Oo( |$)/) { + s/\\\".*//; + s/\"[^\"]*\"//g; + s/\".*//; + if (s/ Oo( |$)/ /) { + $Oo++; + } + redo; } elsif (/^\.Oc$sp/) { $Oo--; + s/^\.Oc/\. /; + redo; + } + elsif (/^\..* Oc( |$)/) { + s/\\\".*//; + s/\"[^\"]*\"//g; + s/\".*//; + if (s/ Oc( |$)/ /) { + $Oo--; + } + redo; } if (/^\.so$sp/) { chop; diff --git a/src/roff/grog/grog.sh b/src/roff/grog/grog.sh index 7919dbf5..ae269af5 100644 --- a/src/roff/grog/grog.sh +++ b/src/roff/grog/grog.sh @@ -29,12 +29,12 @@ do esac done -egrep -h "^\.(P|PS|[PLI]P|[pnil]p|sh|Dd|Tp|Dp|De|Cx|Cl|Oo|Oc|TS|EQ|TH|SH|so|\[|R1|GS|G1|PH|SA)$sp" $* \ +egrep -h "^\.(P|PS|[PLI]P|[pnil]p|sh|Dd|Tp|Dp|De|Cx|Cl|Oo|.* Oo|Oc|.* Oc|TS|EQ|TH|SH|so|\[|R1|GS|G1|PH|SA)$sp" $* \ | sed -e '/^\.so/s/^.*$/.SO_START\ &\ .SO_END/' \ | $soelim \ -| egrep '^\.(P|PS|[PLI]P|[pnil]p|sh|Dd|Tp|Dp|De|Cx|Cl|Oo|Oc|TS|EQ|TH|SH|\[|R1|GS|G1|PH|SA|SO_START|SO_END)' \ +| egrep '^\.(P|PS|[PLI]P|[pnil]p|sh|Dd|Tp|Dp|De|Cx|Cl|Oo|.* Oo|Oc|.* Oc|TS|EQ|TH|SH|\[|R1|GS|G1|PH|SA|SO_START|SO_END)' \ | awk ' /^\.SO_START$/ { so = 1 } /^\.SO_END$/ { so = 0 } @@ -52,8 +52,23 @@ egrep -h "^\.(P|PS|[PLI]P|[pnil]p|sh|Dd|Tp|Dp|De|Cx|Cl|Oo|Oc|TS|EQ|TH|SH|so|\[|R /^\.([pnil]p|sh)/ { me++ } /^\.Dd/ { mdoc++ } /^\.(Tp|Dp|De|Cx|Cl)/ { mdoc_old++ } -/^\.Oo/ { Oo++ } -/^\.Oc/ { Oo-- } +/^\.(O[oc]|.* O[oc]( |$))/ { + sub(/\\\".*/, "") + gsub(/\"[^\"]*\"/, "") + sub(/\".*/, "") + sub(/^\.Oo/, " Oo ") + sub(/^\.Oc/, " Oc ") + sub(/ Oo$/, " Oo ") + sub(/ Oc$/, " Oc ") + while (/ Oo /) { + sub(/ Oo /, " ") + Oo++ + } + while (/ Oc /) { + sub(/ Oc /, " ") + Oo-- + } +} END { if (files ~ /^-/) diff --git a/src/roff/troff/input.cc b/src/roff/troff/input.cc index 6db4ce51..54aaa3fc 100644 --- a/src/roff/troff/input.cc +++ b/src/roff/troff/input.cc @@ -3965,11 +3965,6 @@ static int read_size(int *x) } } else if (csdigit(c)) { - if (!inc && c == '0') { - // special case -- \s0 means to revert to previous size. - *x = 0; - return 1; - } val = c - '0'; if (!inc && c != '0' && c < '4') { tok.next(); @@ -4001,6 +3996,11 @@ static int read_size(int *x) if (!bad) { switch (inc) { case 0: + if (val == 0) { + // special case -- \s[0] and \s0 means to revert to previous size + *x = 0; + return 1; + } *x = val; break; case 1: |