diff options
author | wl <wl> | 2004-12-16 13:09:54 +0000 |
---|---|---|
committer | wl <wl> | 2004-12-16 13:09:54 +0000 |
commit | d01ce338f599c0e87ef496690524a4e2e01ac0e5 (patch) | |
tree | b10f1d868e879cee475869c009d4d6e11504eddb | |
parent | 578ccc0822767b6f6d9dea80aaf7aa8bcb899f9b (diff) | |
download | groff-d01ce338f599c0e87ef496690524a4e2e01ac0e5.tar.gz |
Make `test-groff' work again -- previously, wrong paths have been
used. Additionally, it can now be called from anywhere.
* test-groff.in: Don't test for groff binary. This is no longer
necessary since the proper paths are determined by `configure'.
(EXEEXT): Removed. No longer used.
(srcdir, builddir): Use values provided by the configure script.
(XENVIRONMENT): Updated.
* INSTALL: Updated.
Make .tag and .taga work for all devices (but only grohtml actually
handles them).
* src/devices/grohtml/post-html.cpp: s/html-tag/devtag/.
(text_glob::is_br, page::add_tag, html_printer::troff_tag,
html_printer::handle_assertion): Don't use hard-coded string
lengths.
(html_printer::lookahead_for_table): Reset `tbl' properly if
necessary.
(html_printer::devtag): New function, handling `devtag'.
(html_printer::special): Don't handle `html-tag'.
* src/include/printer.h, src/libs/libdriver/printer.cpp
(printer::devtag): New virtual function.
* src/libs/libdriver/input.cpp (parse_x_command) <'X'>: Handle
`devtag'.
* src/roff/troff/env.cpp, src/roff/troff/mtsm.cpp,
src/roff/troff/node.cpp: s/html-tag/devtag/.
* src/roff/troff/input.cpp (tag, taga): Always call
curenv->add_node.
* tmac/an-old.tmac, tmac/s.tmac, tmac/troffrc-end: Use DEVTAG*
macros instead of HTML-TAG*.
* tmac/devtag.tmac: New file, defining the DEVTAG-* macros.
* tmac/www.tmac: Load devtag.tmac.
Replace HTML-TAG* macros with DEVTAG* macros.
(HTML, HTML-NS): Changed definitions.
(URL): Use HTML-NS.
(HTML-TAG, HTML-TAG-NS, HTML-TAG-NEXT): Removed.
* tmac/Makefile.sub (NORMALFILES): Add devtag.tmac.
-rw-r--r-- | ChangeLog | 52 | ||||
-rw-r--r-- | INSTALL | 3 | ||||
-rw-r--r-- | src/devices/grohtml/post-html.cpp | 146 | ||||
-rw-r--r-- | src/include/printer.h | 4 | ||||
-rw-r--r-- | src/libs/libdriver/input.cpp | 5 | ||||
-rw-r--r-- | src/libs/libdriver/printer.cpp | 8 | ||||
-rw-r--r-- | src/roff/troff/env.cpp | 2 | ||||
-rw-r--r-- | src/roff/troff/input.cpp | 6 | ||||
-rw-r--r-- | src/roff/troff/mtsm.cpp | 22 | ||||
-rw-r--r-- | src/roff/troff/node.cpp | 8 | ||||
-rw-r--r-- | test-groff.in | 16 | ||||
-rw-r--r-- | tmac/Makefile.sub | 1 | ||||
-rw-r--r-- | tmac/an-old.tmac | 12 | ||||
-rw-r--r-- | tmac/devtag.tmac | 123 | ||||
-rw-r--r-- | tmac/s.tmac | 24 | ||||
-rw-r--r-- | tmac/troffrc-end | 3 | ||||
-rw-r--r-- | tmac/www.tmac | 79 |
17 files changed, 354 insertions, 160 deletions
@@ -1,3 +1,55 @@ +2004-12-15 Werner LEMBERG <wl@gnu.org> + + Make `test-groff' work again -- previously, wrong paths have been + used. Additionally, it can now be called from anywhere. + + * test-groff.in: Don't test for groff binary. This is no longer + necessary since the proper paths are determined by `configure'. + (EXEEXT): Removed. No longer used. + (srcdir, builddir): Use values provided by the configure script. + (XENVIRONMENT): Updated. + + * INSTALL: Updated. + +2004-12-14 Gaius Mulley <gaius@glam.ac.uk> + + Make .tag and .taga work for all devices (but only grohtml actually + handles them). + + * src/devices/grohtml/post-html.cpp: s/html-tag/devtag/. + (text_glob::is_br, page::add_tag, html_printer::troff_tag, + html_printer::handle_assertion): Don't use hard-coded string + lengths. + (html_printer::lookahead_for_table): Reset `tbl' properly if + necessary. + (html_printer::devtag): New function, handling `devtag'. + (html_printer::special): Don't handle `html-tag'. + + * src/include/printer.h, src/libs/libdriver/printer.cpp + (printer::devtag): New virtual function. + + * src/libs/libdriver/input.cpp (parse_x_command) <'X'>: Handle + `devtag'. + + * src/roff/troff/env.cpp, src/roff/troff/mtsm.cpp, + src/roff/troff/node.cpp: s/html-tag/devtag/. + + * src/roff/troff/input.cpp (tag, taga): Always call + curenv->add_node. + + * tmac/an-old.tmac, tmac/s.tmac, tmac/troffrc-end: Use DEVTAG* + macros instead of HTML-TAG*. + + * tmac/devtag.tmac: New file, defining the DEVTAG-* macros. + + * tmac/www.tmac: Load devtag.tmac. + Replace HTML-TAG* macros with DEVTAG* macros. + (HTML, HTML-NS): Changed definitions. + (URL): Use HTML-NS. + (HTML-TAG, HTML-TAG-NS, HTML-TAG-NEXT): Removed. + + * tmac/Makefile.sub (NORMALFILES): Add devtag.tmac. + 2004-12-10 Werner LEMBERG <wl@gnu.org> Import Mike's `gdiffmk' package. @@ -36,8 +36,7 @@ page length can be changed with the `pl' request. When you have built groff, you can use the test-groff script to try groff out on one of the man pages. (Use the .n files not the .man files.) The test-groff script sets up environment variables to allow -groff to run without being installed. The current directory must be -the build directory when the script is run. For example, you could do +groff to run without being installed. For example, you could do ./test-groff -man -Tascii src/roff/groff/groff.n | less diff --git a/src/devices/grohtml/post-html.cpp b/src/devices/grohtml/post-html.cpp index a881cb67..e4c1b4b1 100644 --- a/src/devices/grohtml/post-html.cpp +++ b/src/devices/grohtml/post-html.cpp @@ -430,7 +430,7 @@ char *char_buffer::add_string (const char *s, unsigned int length) // and return start of new string - return( &tail->buffer[old_used] ); + return &tail->buffer[old_used]; } char *char_buffer::add_string (const string &s) @@ -658,7 +658,7 @@ int text_glob::is_a_tag (void) int text_glob::is_eol (void) { - return is_tag && (strcmp(text_string, "html-tag:.eol") == 0); + return is_tag && (strcmp(text_string, "devtag:.eol") == 0); } /* @@ -667,7 +667,7 @@ int text_glob::is_eol (void) int text_glob::is_eol_ce (void) { - return is_tag && (strcmp(text_string, "html-tag:eol.ce") == 0); + return is_tag && (strcmp(text_string, "devtag:eol.ce") == 0); } /* @@ -676,7 +676,7 @@ int text_glob::is_eol_ce (void) int text_glob::is_tl (void) { - return is_tag && (strcmp(text_string, "html-tag:.tl") == 0); + return is_tag && (strcmp(text_string, "devtag:.tl") == 0); } /* @@ -685,7 +685,7 @@ int text_glob::is_tl (void) int text_glob::is_eo_tl (void) { - return is_tag && (strcmp(text_string, "html-tag:.eo.tl") == 0); + return is_tag && (strcmp(text_string, "devtag:.eo.tl") == 0); } /* @@ -694,8 +694,8 @@ int text_glob::is_eo_tl (void) int text_glob::is_nf (void) { - return is_tag && (strncmp(text_string, "html-tag:.fi", - strlen("html-tag:.fi")) == 0) && + return is_tag && (strncmp(text_string, "devtag:.fi", + strlen("devtag:.fi")) == 0) && (get_arg() == 0); } @@ -705,8 +705,8 @@ int text_glob::is_nf (void) int text_glob::is_fi (void) { - return( is_tag && (strncmp(text_string, "html-tag:.fi", - strlen("html-tag:.fi")) == 0) && + return( is_tag && (strncmp(text_string, "devtag:.fi", + strlen("devtag:.fi")) == 0) && (get_arg() == 1) ); } @@ -716,7 +716,7 @@ int text_glob::is_fi (void) int text_glob::is_eo_h (void) { - return is_tag && (strcmp(text_string, "html-tag:.eo.h") == 0); + return is_tag && (strcmp(text_string, "devtag:.eo.h") == 0); } /* @@ -725,8 +725,8 @@ int text_glob::is_eo_h (void) int text_glob::is_ce (void) { - return is_tag && (strncmp(text_string, "html-tag:.ce", - strlen("html-tag:.ce")) == 0); + return is_tag && (strncmp(text_string, "devtag:.ce", + strlen("devtag:.ce")) == 0); } /* @@ -735,8 +735,8 @@ int text_glob::is_ce (void) int text_glob::is_in (void) { - return is_tag && (strncmp(text_string, "html-tag:.in ", - strlen("html-tag:.in ")) == 0); + return is_tag && (strncmp(text_string, "devtag:.in ", + strlen("devtag:.in ")) == 0); } /* @@ -745,8 +745,8 @@ int text_glob::is_in (void) int text_glob::is_po (void) { - return is_tag && (strncmp(text_string, "html-tag:.po ", - strlen("html-tag:.po ")) == 0); + return is_tag && (strncmp(text_string, "devtag:.po ", + strlen("devtag:.po ")) == 0); } /* @@ -755,8 +755,8 @@ int text_glob::is_po (void) int text_glob::is_ti (void) { - return is_tag && (strncmp(text_string, "html-tag:.ti ", - strlen("html-tag:.ti ")) == 0); + return is_tag && (strncmp(text_string, "devtag:.ti ", + strlen("devtag:.ti ")) == 0); } /* @@ -765,7 +765,8 @@ int text_glob::is_ti (void) int text_glob::is_ll (void) { - return is_tag && (strncmp(text_string, "html-tag:.ll ", strlen("html-tag:.ll ")) == 0); + return is_tag && (strncmp(text_string, "devtag:.ll ", + strlen("devtag:.ll ")) == 0); } /* @@ -774,7 +775,8 @@ int text_glob::is_ll (void) int text_glob::is_col (void) { - return is_tag && (strncmp(text_string, "html-tag:.col", strlen("html-tag:.col")) == 0); + return is_tag && (strncmp(text_string, "devtag:.col", + strlen("devtag:.col")) == 0); } /* @@ -783,7 +785,7 @@ int text_glob::is_col (void) int text_glob::is_tab_ts (void) { - return is_tag && (strcmp(text_string, "html-tag:.tab-ts") == 0); + return is_tag && (strcmp(text_string, "devtag:.tab-ts") == 0); } /* @@ -792,7 +794,7 @@ int text_glob::is_tab_ts (void) int text_glob::is_tab_te (void) { - return is_tag && (strcmp(text_string, "html-tag:.tab-te") == 0); + return is_tag && (strcmp(text_string, "devtag:.tab-te") == 0); } /* @@ -801,7 +803,8 @@ int text_glob::is_tab_te (void) int text_glob::is_ta (void) { - return is_tag && (strncmp(text_string, "html-tag:.ta ", strlen("html-tag:.ta ")) == 0); + return is_tag && (strncmp(text_string, "devtag:.ta ", + strlen("devtag:.ta ")) == 0); } /* @@ -810,7 +813,8 @@ int text_glob::is_ta (void) int text_glob::is_tab (void) { - return is_tag && (strncmp(text_string, "html-tag:tab ", strlen("html-tag:tab ")) == 0); + return is_tag && (strncmp(text_string, "devtag:tab ", + strlen("devtag:tab ")) == 0); } /* @@ -819,7 +823,8 @@ int text_glob::is_tab (void) int text_glob::is_tab0 (void) { - return is_tag && (strncmp(text_string, "html-tag:tab0", strlen("html-tag:tab0")) == 0); + return is_tag && (strncmp(text_string, "devtag:tab0", + strlen("devtag:tab0")) == 0); } /* @@ -841,13 +846,14 @@ int text_glob::is_auto_img (void) int text_glob::is_br (void) { - return is_a_tag() && ((strcmp ("html-tag:.br", text_string) == 0) || - (strncmp("html-tag:.sp", text_string, 11) == 0)); + return is_a_tag() && ((strcmp ("devtag:.br", text_string) == 0) || + (strncmp("devtag:.sp", text_string, + strlen("devtag:.sp")) == 0)); } int text_glob::get_arg (void) { - if (strncmp("html-tag:", text_string, strlen("html-tag:")) == 0) { + if (strncmp("devtag:", text_string, strlen("devtag:")) == 0) { const char *p = text_string; while ((*p != (char)0) && (!isspace(*p))) @@ -867,7 +873,7 @@ int text_glob::get_arg (void) int text_glob::get_tab_args (char *align) { - if (strncmp("html-tag:", text_string, strlen("html-tag:")) == 0) { + if (strncmp("devtag:", text_string, strlen("devtag:")) == 0) { const char *p = text_string; // firstly the alignment C|R|L @@ -1320,7 +1326,8 @@ void page::add_tag (style *s, const string &str, if (str.length() > 0) { text_glob *g; - if (strncmp((str+'\0').contents(), "html-tag:.auto-image", 20) == 0) { + if (strncmp((str+'\0').contents(), "devtag:.auto-image", + strlen("devtag:.auto-image")) == 0) { g = new text_glob(); g->text_glob_auto_image(s, buffer.add_string(str), str.length(), min_vertical, min_horizontal, max_vertical, max_horizontal); @@ -2097,6 +2104,7 @@ public: void begin_page (int); void end_page (int); void special (char *arg, const environment *env, char type); + void devtag (char *arg, const environment *env, char type); font *make_font (const char *); void end_of_line (); }; @@ -2240,7 +2248,7 @@ void html_printer::do_center (char *arg) } /* - * do_centered_image - set a flag such that the next html-tag is + * do_centered_image - set a flag such that the next devtag is * placed inside a centered paragraph. */ @@ -2250,7 +2258,7 @@ void html_printer::do_centered_image (void) } /* - * do_right_image - set a flag such that the next html-tag is + * do_right_image - set a flag such that the next devtag is * placed inside a right aligned paragraph. */ @@ -2260,7 +2268,7 @@ void html_printer::do_right_image (void) } /* - * do_left_image - set a flag such that the next html-tag is + * do_left_image - set a flag such that the next devtag is * placed inside a left aligned paragraph. */ @@ -2996,7 +3004,7 @@ void html_printer::do_tab_te (void) } /* - * do_tab - handle the "html-tag:tab" tag + * do_tab - handle the "devtag:tab" tag */ void html_printer::do_tab (char *s) @@ -3014,7 +3022,7 @@ void html_printer::do_tab (char *s) } /* - * do_tab0 - handle the "html-tag:tab0" tag + * do_tab0 - handle the "devtag:tab0" tag */ void html_printer::do_tab0 (void) @@ -3048,11 +3056,11 @@ void html_printer::do_col (char *s) void html_printer::troff_tag (text_glob *g) { /* - * firstly skip over html-tag: + * firstly skip over devtag: */ - char *t=(char *)g->text_string+9; + char *t=(char *)g->text_string+strlen("devtag:"); - if (strncmp(g->text_string, "html</p>:", 9) == 0) { + if (strncmp(g->text_string, "html</p>:", strlen("html</p>:")) == 0) { do_end_para(g); } else if (g->is_eol()) { do_eol(); @@ -3141,7 +3149,8 @@ void html_printer::troff_tag (text_glob *g) int html_printer::is_in_middle (int left, int right) { - return( abs(abs(left-pageoffset) - abs(pageoffset+linelength-right)) <= CENTER_TOLERANCE ); + return( abs(abs(left-pageoffset) - abs(pageoffset+linelength-right)) + <= CENTER_TOLERANCE ); } /* @@ -3269,7 +3278,7 @@ text_glob *html_printer::insert_tab_ts (text_glob *where) page_contents->glyphs.move_to(where); page_contents->glyphs.move_left(); - page_contents->insert_tag(string("html-tag:.tab-ts")); // tab table start + page_contents->insert_tag(string("devtag:.tab-ts")); // tab table start page_contents->glyphs.move_right(); start_of_table = page_contents->glyphs.get_data(); page_contents->glyphs.move_to(old_pos); @@ -3289,7 +3298,7 @@ void html_printer::insert_tab_te (void) while (page_contents->glyphs.get_data()->is_a_tag()) page_contents->glyphs.move_left(); - page_contents->insert_tag(string("html-tag:.tab-te")); // tab table end + page_contents->insert_tag(string("devtag:.tab-te")); // tab table end while (g != page_contents->glyphs.get_data()) page_contents->glyphs.move_right(); page_contents->dump_page(); @@ -3305,7 +3314,7 @@ void html_printer::insert_tab_0 (text_glob *where) page_contents->glyphs.move_to(where); page_contents->glyphs.move_left(); - page_contents->insert_tag(string("html-tag:tab0")); // tab0 start of line + page_contents->insert_tag(string("devtag:tab0")); // tab0 start of line page_contents->glyphs.move_right(); page_contents->glyphs.move_to(old_pos); } @@ -3498,8 +3507,10 @@ void html_printer::lookahead_for_tables (void) g = page_contents->glyphs.move_right_get_data(); handle_state_assertion(g); if (page_contents->glyphs.is_equal_to_head()) { - if (tbl != NULL) + if (tbl != NULL) { delete tbl; + tbl = NULL; + } return; } @@ -3664,8 +3675,10 @@ void html_printer::lookahead_for_tables (void) page_contents->insert_tag(string("*** LAST ***")); } } - if (tbl != NULL) + if (tbl != NULL) { delete tbl; + tbl = NULL; + } // and reset the registers pageoffset = old_pageoffset; @@ -3728,7 +3741,7 @@ int html_printer::is_font_courier (font *f) return( (fontname != 0) && (fontname[0] == 'C') ); } - return( FALSE ); + return FALSE; } /* @@ -4698,7 +4711,7 @@ void html_printer::handle_assertion (int minv, int minh, int maxv, int maxh, con else if (strcmp(cmd, "assertion:[y") == 0) as.addy(cmd, id, make_val(val, minv, id, file, line), file, line); else - if (strncmp(cmd, "assertion:[", 11) == 0) + if (strncmp(cmd, "assertion:[", strlen("assertion:[")) == 0) page_contents->add_tag(&sbuf_style, string(s), line_number, minv, minh, maxv, maxh); } @@ -4725,8 +4738,7 @@ void html_printer::handle_state_assertion (text_glob *g) /* * special - handle all x X requests from troff. For post-html they * allow users to pass raw html commands, turn auto linked - * headings off/on and also allow troff to emit tags to - * indicate when a: .br, .sp etc occurs. + * headings off/on etc. */ void html_printer::special(char *s, const environment *env, char type) @@ -4793,22 +4805,48 @@ void html_printer::special(char *s, const environment *env, char type) */ } else if (strncmp(s, "index:", 6) == 0) { cutoff_heading = atoi(&s[6]); - } else if (strncmp(s, "html-tag:", 9) == 0) { + } else if (strncmp(s, "assertion:[", 11) == 0) { + int r=font::res; /* resolution of the device */ + + handle_assertion(env->vpos-env->size*r/72, env->hpos, + env->vpos, env->hpos, s); + } + } +} + +/* + * devtag - handles device troff tags sent from the `troff'. + * These include the troff state machine tags: + * .br, .sp, .in, .tl, .ll etc + * + * (see man 5 grohtml_tags). + */ + +void html_printer::devtag (char *s, const environment *env, char type) +{ + if (type != 'p') + return; + + if (s != 0) { + flush_sbuf(); + if (env->fontno >= 0) { + style sty(get_font_from_index(env->fontno), env->size, env->height, + env->slant, env->fontno, *env->col); + sbuf_style = sty; + } + + if (strncmp(s, "devtag:", strlen("devtag:")) == 0) { int r=font::res; /* resolution of the device */ page_contents->add_tag(&sbuf_style, string(s), line_number, env->vpos-env->size*r/72, env->hpos, env->vpos , env->hpos); - } else if (strncmp(s, "assertion:[", 11) == 0) { - int r=font::res; /* resolution of the device */ - - handle_assertion(env->vpos-env->size*r/72, env->hpos, - env->vpos, env->hpos, s); } } } + /* * taken from number.cpp in src/roff/troff, [hunits::hunits(units x)] */ diff --git a/src/include/printer.h b/src/include/printer.h index e182473d..a479e5a5 100644 --- a/src/include/printer.h +++ b/src/include/printer.h @@ -7,7 +7,7 @@ Written by James Clark (jjc@jclark.com) - Last update: 12 Apr 2002 + Last update: 15 Dec 2004 This file is part of groff. @@ -83,6 +83,8 @@ public: virtual void end_of_line(); virtual void special(char *arg, const environment *env, char type = 'p'); + virtual void devtag(char *arg, const environment *env, + char type = 'p'); protected: font_pointer_list *font_list; diff --git a/src/libs/libdriver/input.cpp b/src/libs/libdriver/input.cpp index 810163db..97f8ac62 100644 --- a/src/libs/libdriver/input.cpp +++ b/src/libs/libdriver/input.cpp @@ -8,7 +8,7 @@ Written by James Clark (jjc@jclark.com) Major rewrite 2001 by Bernd Warken (bwarken@mayn.de) - Last update: 04 Apr 2003 + Last update: 15 Dec 2004 This file is part of groff, the GNU roff text processing system. @@ -1520,6 +1520,9 @@ parse_x_command(void) char *str_arg = get_extended_arg(); // includes line skip if (npages <= 0) error("`x X' command invalid before first `p' command"); + else if (str_arg != NULL && (strncmp(str_arg, "devtag:", + strlen("devtag:")) == 0)) + pr->devtag(str_arg, current_env); else pr->special(str_arg, current_env); a_delete str_arg; diff --git a/src/libs/libdriver/printer.cpp b/src/libs/libdriver/printer.cpp index 179daf17..3d4797a0 100644 --- a/src/libs/libdriver/printer.cpp +++ b/src/libs/libdriver/printer.cpp @@ -2,11 +2,11 @@ // <groff_src_dir>/src/libs/libdriver/printer.cpp -/* Copyright (C) 1989, 1990, 1991, 1992, 2001, 2002, 2003 +/* Copyright (C) 1989, 1990, 1991, 1992, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Written by James Clark (jjc@jclark.com) - Last update: 04 Apr 2003 + Last update: 15 Dec 2004 This file is part of groff. @@ -107,6 +107,10 @@ void printer::special(char *, const environment *, char) { } +void printer::devtag(char *, const environment *, char) +{ +} + void printer::draw(int, int *, int, const environment *) { } diff --git a/src/roff/troff/env.cpp b/src/roff/troff/env.cpp index ae1c1061..a12239f5 100644 --- a/src/roff/troff/env.cpp +++ b/src/roff/troff/env.cpp @@ -2206,7 +2206,7 @@ node *environment::make_tag(const char *nm, int i) if (curdiv == topdiv && topdiv->before_first_page) topdiv->begin_page(); macro *m = new macro; - m->append_str("html-tag:"); + m->append_str("devtag:"); for (const char *p = nm; *p; p++) if (!invalid_input_char((unsigned char)*p)) m->append(*p); diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp index d95ea4bd..70d23fe4 100644 --- a/src/roff/troff/input.cpp +++ b/src/roff/troff/input.cpp @@ -6075,8 +6075,7 @@ void tag() for (; c != '\n' && c != EOF; c = get_copy(0)) s += (char)c; s += '\n'; - if (is_html) - curenv->add_node(new tag_node(s, 0)); + curenv->add_node(new tag_node(s, 0)); } tok.next(); } @@ -6099,8 +6098,7 @@ void taga() for (; c != '\n' && c != EOF; c = get_copy(0)) s += (char)c; s += '\n'; - if (is_html) - curenv->add_node(new tag_node(s, 1)); + curenv->add_node(new tag_node(s, 1)); } tok.next(); } diff --git a/src/roff/troff/mtsm.cpp b/src/roff/troff/mtsm.cpp index cecb6a66..2cb6ae03 100644 --- a/src/roff/troff/mtsm.cpp +++ b/src/roff/troff/mtsm.cpp @@ -198,27 +198,27 @@ statem::~statem() void statem::flush(FILE *fp, statem *compare) { - int_values[MTSM_FI].diff(fp, "html-tag:.fi", + int_values[MTSM_FI].diff(fp, "devtag:.fi", compare->int_values[MTSM_FI]); - int_values[MTSM_RJ].diff(fp, "html-tag:.rj", + int_values[MTSM_RJ].diff(fp, "devtag:.rj", compare->int_values[MTSM_RJ]); - int_values[MTSM_SP].diff(fp, "html-tag:.sp", + int_values[MTSM_SP].diff(fp, "devtag:.sp", compare->int_values[MTSM_SP]); - units_values[MTSM_IN].diff(fp, "html-tag:.in", + units_values[MTSM_IN].diff(fp, "devtag:.in", compare->units_values[MTSM_IN]); - units_values[MTSM_LL].diff(fp, "html-tag:.ll", + units_values[MTSM_LL].diff(fp, "devtag:.ll", compare->units_values[MTSM_LL]); - units_values[MTSM_PO].diff(fp, "html-tag:.po", + units_values[MTSM_PO].diff(fp, "devtag:.po", compare->units_values[MTSM_PO]); - string_values[MTSM_TA].diff(fp, "html-tag:.ta", + string_values[MTSM_TA].diff(fp, "devtag:.ta", compare->string_values[MTSM_TA]); - units_values[MTSM_TI].diff(fp, "html-tag:.ti", + units_values[MTSM_TI].diff(fp, "devtag:.ti", compare->units_values[MTSM_TI]); - int_values[MTSM_CE].diff(fp, "html-tag:.ce", + int_values[MTSM_CE].diff(fp, "devtag:.ce", compare->int_values[MTSM_CE]); - bool_values[MTSM_EOL].diff(fp, "html-tag:.eol", + bool_values[MTSM_EOL].diff(fp, "devtag:.eol", compare->bool_values[MTSM_EOL]); - bool_values[MTSM_BR].diff(fp, "html-tag:.br", + bool_values[MTSM_BR].diff(fp, "devtag:.br", compare->bool_values[MTSM_BR]); if (debug_state) { fprintf(stderr, "compared state %d\n", compare->issue_no); diff --git a/src/roff/troff/node.cpp b/src/roff/troff/node.cpp index 6c44b393..88be8651 100644 --- a/src/roff/troff/node.cpp +++ b/src/roff/troff/node.cpp @@ -4081,15 +4081,15 @@ void suppress_node::tprint(troff_output_file *out) switch (last_position) { case 'c': out->start_special(); - put(out, "html-tag:.centered-image"); + put(out, "devtag:.centered-image"); break; case 'r': out->start_special(); - put(out, "html-tag:.right-image"); + put(out, "devtag:.right-image"); break; case 'l': out->start_special(); - put(out, "html-tag:.left-image"); + put(out, "devtag:.left-image"); break; case 'i': ; @@ -4098,7 +4098,7 @@ void suppress_node::tprint(troff_output_file *out) } out->end_special(); out->start_special(); - put(out, "html-tag:.auto-image "); + put(out, "devtag:.auto-image "); put(out, name); out->end_special(); } diff --git a/test-groff.in b/test-groff.in index 1941d029..013e1666 100644 --- a/test-groff.in +++ b/test-groff.in @@ -1,17 +1,9 @@ #! /bin/sh # This script runs groff without requiring that it be installed. -# The current directory must be the top build directory. SEP='@PATH_SEPARATOR@' -EXEEXT=@EXEEXT@ -builddir=./src -srcdir=`echo $0 | sed -e 's;/[^/]*$;;'` - -if test ! -d $builddir/roff/groff || \ - test ! -r $builddir/roff/groff/groff$EXEEXT; then - echo $0 must be run with the top build directory as the current directory 2>&1 - exit 1 -fi +builddir=@abs_top_builddir@/src +srcdir=@abs_top_srcdir@ GROFF_BIN_PATH=\ $builddir/roff/groff$SEP\ @@ -31,9 +23,7 @@ $builddir/devices/grolbp$SEP\ $builddir/devices/grohtml$SEP\ $builddir/devices/xditview -test -n "$srcdir" || srcdir=. - -XENVIRONMENT=`cd $srcdir; pwd`/src/devices/xditview/GXditview.ad +XENVIRONMENT=$srcdir/src/devices/xditview/GXditview.ad export XENVIRONMENT GROFF_COMMAND_PREFIX= diff --git a/tmac/Makefile.sub b/tmac/Makefile.sub index 0d9cd60a..047f14ce 100644 --- a/tmac/Makefile.sub +++ b/tmac/Makefile.sub @@ -23,6 +23,7 @@ NORMALFILES=\ lj4.tmac \ lbp.tmac \ html.tmac html-end.tmac \ + devtag.tmac \ europs.tmac \ composite.tmac \ eqnrc \ diff --git a/tmac/an-old.tmac b/tmac/an-old.tmac index 73d37e42..19e14032 100644 --- a/tmac/an-old.tmac +++ b/tmac/an-old.tmac @@ -109,9 +109,9 @@ .\" .TH title section extra1 extra2 extra3 .de1 TH . if \\n[an-html] \{\ -. HTML-TAG-NS ".tl" +. DEVTAG-TL \\$1 -. HTML-TAG-NS ".eo.tl" +. DEVTAG-EO-TL . \} . . de an-init \" We have to do it like this to get multiple man pages right. @@ -314,7 +314,7 @@ . in \\n[an-margin]u . ti 0 . nr need_eo_h 1 -. HTML-TAG-NS ".NH \\n[an-level]" +. DEVTAG-NH \\n[an-level] . it 1 an-trap . nr an-no-space-flag 1 . nr an-break-flag 1 @@ -377,7 +377,7 @@ .. . .de1 an-trap -. if \\n[need_eo_h]>0 .HTML-TAG-NS ".eo.h" +. if \\n[need_eo_h]>0 .DEVTAG-EO-H . nr need_eo_h 0 . ft R . ps \\n[PS]u @@ -413,9 +413,9 @@ . ti -\\n[an-prevailing-indent]u . chop an-div . ne (1v + 1u) -. HTML-TAG-NS ".col 1" +. DEVTAG-COL 1 \\*[an-div]\\h'|\\n[an-prevailing-indent]u'\c -. HTML-TAG-NEXT ".col 2" +. DEVTAG-COL-NEXT 2 . \} .. . diff --git a/tmac/devtag.tmac b/tmac/devtag.tmac new file mode 100644 index 00000000..22ea976d --- /dev/null +++ b/tmac/devtag.tmac @@ -0,0 +1,123 @@ +.ig +www.tmac - macro package for adding HTML elements to roff documents. + +File position: <groff_source_top>/tmac/devtag.tmac +Installed position: groff's main macro directory. + +------------------------------------------------------------------------ + Legalize +------------------------------------------------------------------------ + +This file is part of groff, the GNU roff type-setting system. + +Copyright (C) 2004 Free Software Foundation, Inc. +written by Gaius Mulley <gaius@glam.ac.uk>. + +groff is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 2, or (at your option) any later +version. + +groff is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with groff; see the file COPYING. If not, write to the Free +Software Foundation, 59 Temple Place - Suite 330, Boston, MA +02111-1307, USA. + + +------------------------------------------------------------------------ + Description +------------------------------------------------------------------------ + +A simple set of macros to provide markup devices (currently only grohtml) +with tags that define the meaning of the formatted text and also +basic formatting instructions. It generalises the tag concept used within +grohtml and in the future it is hoped that more markup based devices +can capitalise on this work. It also clearly defines those tags which are +honoured by grohtml. Note that not all tags are included here. Some +of the grohtml specific tags (header specific and jobname etc) are +called directly from within www.tmac. The tags defined here are +reasonably generic and could be applied to the -Tdoc device when it +is written. +.. +. +.\" -------------------------------------------------------------------- +.\" DEVTAG <name> +.\" +.\" Emit a tag <name> +.\" +.de DEVTAG +. tag devtag:\\$* +.. +.\" -------------------------------------------------------------------- +.\" DEVTAG-NEXT <name> +.\" +.\" When the troff state changes, emit tag <name> +.\" +.de DEVTAG-NEXT +. taga devtag:\\$* +.. +. +.\" -------------------------------------------------------------------- +.\" SH <level> +.\" NH <level> +.\" tell device we are starting a numbered heading +.\" Takes a single parameter <level>. <level> 1 +.\" is the outer most level. +. +.de DEVTAG-NH +. DEVTAG ".NH \\$1" +.. +.als DEVTAG-SH DEVTAG-NH +. +.\" -------------------------------------------------------------------- +.\" COL <n> +.\" indicate that the following text is aligned for the column <n> +.\" n: [1..MAX(n)] +. +.de DEVTAG-COL +. DEVTAG ".col \\$1" +.. +. +.\" -------------------------------------------------------------------- +.\" EO-H +.\" indicate that a header has finished. +. +.de DEVTAG-EO-H +. DEVTAG ".eo.h" +.. +.\" -------------------------------------------------------------------- +.\" EO-TL +.\" indicate that a title has finished. +. +.de DEVTAG-EO-TL +. DEVTAG ".eo.tl" +.. +.\" -------------------------------------------------------------------- +.\" TL +.\" indicate that the following text forms a title. +. +.de DEVTAG-TL +. DEVTAG ".tl" +.. +. +.\" -------------------------------------------------------------------- +.\" COL-NEXT <n> +.\" emit a column tag just before the next glyph. +. +.de DEVTAG-COL-NEXT +. DEVTAG-NEXT ".col \\$1" +.. +. +.\" -------------------------------------------------------------------- +.\" Emacs settings +.\" -------------------------------------------------------------------- +. +.\" Local Variables: +.\" mode: nroff +.\" End: +.\" EOF diff --git a/tmac/s.tmac b/tmac/s.tmac index 33b60c36..30ef1112 100644 --- a/tmac/s.tmac +++ b/tmac/s.tmac @@ -178,7 +178,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. .vs +3p .ll (u;\\n[LL]*5/6) .nr cov*n-au 0 -.HTML-TAG-NS ".tl" +.DEVTAG-TL .. .de @AU .par@reset @@ -382,7 +382,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. .ce 9999 .if d cov*tl-div \{\ . cov*tl-div -. HTML-TAG-NS ".eo.tl" +. DEVTAG-EO-TL .\} .nr cov*i 1 .nr cov*sp 1v @@ -500,7 +500,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. . nr pg*gutw \\n[LL]-(\\n[pg@ncols]*\\n[pg@colw])/(\\n[pg@ncols]-1) . el .nr pg*gutw 0 .\} -.HTML-TAG ".mc \\n[pg@ncols] \\n[pg@colw] \\n[pg*gutw]" +.DEVTAG ".mc \\n[pg@ncols] \\n[pg@colw] \\n[pg*gutw]" .mk pg*col-top .ns .nr pg*col-num 0 @@ -1137,9 +1137,9 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. .\" par@reset .de par@reset .br -.if \\n[need_eo_tl]>0 .HTML-TAG ".eo.tl" +.if \\n[need_eo_tl]>0 .DEVTAG-EO-TL .nr need_eo_tl 0 -.if \\n[need_eo_h]>0 .HTML-TAG ".eo.h" +.if \\n[need_eo_h]>0 .DEVTAG-EO-H .nr need_eo_h 0 .ce 0 .rj 0 @@ -1226,14 +1226,14 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. . chop par*label . ti -\\n[\\n[.ev]:ai]u . ie \\n[dl]+1n<=\\n[\\n[.ev]:ai] \{\ -. HTML-TAG-NS ".col 1" +. DEVTAG-COL 1 \\*[par*label]\h'|\\n[\\n[.ev]:ai]u'\c -. HTML-TAG-NS ".col 2" +. DEVTAG-COL 2 . \} . el \{\ -. HTML-TAG-NS ".col 1" +. DEVTAG-COL 1 \\*[par*label] -. HTML-TAG-NEXT ".col 2" +. DEVTAG-COL-NEXT 2 . br . \} . rm par*label @@ -1403,7 +1403,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. . nr sh*psincr 0 . if 0\\$1>0 .nr sh*psincr (\\n[GROWPS]-0\\$1)*\\n[PSINCR] . SH-NO-TAG -. HTML-TAG ".SH 1" +. DEVTAG-SH 1 . if '\*(.T'html' .nr need_eo_h 1 .. .\" TL, AU, and AI are aliased to these in cov*ab-init. @@ -1414,7 +1414,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. .ps +2 .vs +3p .ce 9999 -.HTML-TAG-NS ".tl" +.DEVTAG-TL .nr need_eo_tl 1 .. .de par@AU @@ -1575,7 +1575,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. .if !dSN .als SN SN-DOT .nr sh*psincr (\\n[GROWPS]-\\n[nh*hl])*\\n[PSINCR] .SH-NO-TAG -.HTML-TAG-NS ".NH \\$1" +.DEVTAG-NH "\\$1" . if '\*(.T'html' .nr need_eo_h 1 \\*[SN-DOT] .. diff --git a/tmac/troffrc-end b/tmac/troffrc-end index ef4f0082..53f1bef5 100644 --- a/tmac/troffrc-end +++ b/tmac/troffrc-end @@ -13,8 +13,7 @@ .do if !d HTML-IMAGE-RIGHT .do ds HTML-IMAGE-RIGHT .do if !d HTML-IMAGE-LEFT .do ds HTML-IMAGE-LEFT .do if !d HTML-IMAGE-END .do ds HTML-IMAGE-END -.do if !d HTML-TAG .do ds HTML-TAG -.do if !d HTML-TAG-NS .do ds HTML-TAG-NS +.do if !d DEVTAG .do ds DEVTAG .do if !d HTML-DO-IMAGE .do ds HTML-DO-IMAGE . .\" Don't let blank lines creep in here. diff --git a/tmac/www.tmac b/tmac/www.tmac index 078d20e6..90bd1f4e 100644 --- a/tmac/www.tmac +++ b/tmac/www.tmac @@ -45,6 +45,8 @@ www functionality. It should work with any macro set. .nr _C \n(.C .cp 0 . +.mso devtag.tmac +. .nr www-html 0 .if '\*[.T]'html' .nr www-html 1 . @@ -262,15 +264,21 @@ www functionality. It should work with any macro set. .\" .de HTML . if \\n[www-html] \{\ +. \" was implemented via .nop \&\X^html:\\$*^ but +. \" is now implemented using HTML-NS to utilize code factoring. +. \" . \" the `\&' makes the vertical mode leave, so to say -. nop \&\X^html:\\$*^ +. \" +. nop \&\c +. HTML-NS \\$* +. nop \& . \} .. .\" .\" an auxiliary macro for HTML (without following space) .\" .de HTML-NS -. tag "html:\\$* +. nop \X^html:\\$*^\c .. .\" .\" emit a HTML tag after shutting down a (possibly open) paragraph @@ -314,10 +322,16 @@ www functionality. It should work with any macro set. . ds \\$0:adr \\$1\" . www:url_breaks \\$0:adr . ie \\n[www-html] \{\ +. ie '\\$3'' \ +. ds \\$0:after \& +. el \ +. ds \\$0:after \&\\$3 . ie '\\$2'' \ -. HTML <a href="\\$1">\\$1</a>\\$3 +. HTML-NS <a href="\\$1">\\$1</a> . el \ -. HTML <a href="\\$1">\\$2</a>\\$3 +. HTML-NS <a href="\\$1">\\$2</a> +. nop \\*[\\$0:after] +. rm \\$0:after . \} . el \{\ . if !r ps4html .ad l @@ -385,12 +399,12 @@ www functionality. It should work with any macro set. .de IMG . ie \\n[www-html] \{\ . ie '\\$2'-R' \ -. HTML-TAG ".right-image" +. DEVTAG ".right-image" . el \{\ . ie '\\$2'-L' \ -. HTML-TAG ".left-image" +. DEVTAG ".left-image" . el \ -. HTML-TAG ".centered-image" +. DEVTAG ".centered-image" . \} . nr www-width 100 . if !'\\$3'' \ @@ -405,35 +419,6 @@ www functionality. It should work with any macro set. . nop \[la]\f[C]\\$1\f[]\[ra] .. .\" -------------------------------------------------------------------- -.\" HTML-TAG -.\" -.\" Emit a tag for grohtml. This is an internal macro. -.\" -.de HTML-TAG -. if \\n[www-html] \{\ -. \" the `\&' makes the vertical mode leave, so to say -. nop \&\X^html-tag:\\$*^ -. \} -.. -.\" -------------------------------------------------------------------- -.\" HTML-TAG-NS -.\" -.\" Emit a tag for grohtml (without a space). This is an internal macro. -.\" -.de HTML-TAG-NS -. tag html-tag:\\$* -.. -.\" -------------------------------------------------------------------- -.\" HTML-TAG-NEXT -.\" -.\" When the troff state changes, emit a tag for grohtml (without a space) -.\" This is an internal macro. -.\" -.de HTML-TAG-NEXT -. taga html-tag:\\$* -.. -. -.\" -------------------------------------------------------------------- .\" PIMG [-R|-L|-C] filename [width] [height] .\" .\" Include a png image. It will work for -Tps and -Thtml. @@ -447,12 +432,12 @@ www functionality. It should work with any macro set. .de PIMG . ie \\n[www-html] \{\ . ie '\\$1'-R' \ -. HTML-TAG ".right-image" +. DEVTAG ".right-image" . el \{\ . ie '\\$1'-L' \ -. HTML-TAG ".left-image" +. DEVTAG ".left-image" . el \ -. HTML-TAG ".centered-image" +. DEVTAG ".centered-image" . \} . nr www-width 0 . nr www-height 0 @@ -657,13 +642,13 @@ www functionality. It should work with any macro set. . nr www-heading-no 1 . el \ . nr www-heading-no \\$1 -. HTML-TAG ".NH \\n[www-heading-no]" +. DEVTAG-NH \\n[www-heading-no] .. . .de HnE . if (\\n[www-heading-no] == -1) \ . www-error "HnE found without a corresponding HnS" -. HTML-TAG ".eo.h" +. DEVTAG-EO-H .. .\" -------------------------------------------------------------------- .\" LK @@ -672,7 +657,7 @@ www functionality. It should work with any macro set. .\" section/numbered headings at this position. .\" .de LK -. HTML-TAG-NS ".links" +. DEVTAG ".links" .. .\" -------------------------------------------------------------------- .\" HR @@ -689,7 +674,7 @@ www functionality. It should work with any macro set. .\" emits by default. .\" .de NHR -. HTML-TAG ".no-auto-rule" +. DEVTAG ".no-auto-rule" .. .\" .\" www-end-nowhere - end of input trap called to finish diversion. @@ -697,7 +682,7 @@ www functionality. It should work with any macro set. .de www-end-nowhere . if !\\n[www-html] \ . di -. HTML-TAG ".eo.tl" +. DEVTAG-EO-TL .. .\" -------------------------------------------------------------------- .\" HTL @@ -711,7 +696,7 @@ www functionality. It should work with any macro set. .\" The macro terminates when a space or break is seen (.sp, .br). .\" .de HTL -. HTML-TAG ".html-tl" +. DEVTAG ".html-tl" . if !\\n[www-html] \ . di www-nowhere . it 2 www-end-nowhere @@ -913,7 +898,7 @@ www functionality. It should work with any macro set. .\" The argument to JOBNAME is the file stem for future output files. .\" .de JOBNAME -. HTML-TAG .job-name \\$1 +. DEVTAG .job-name \\$1 .. .\" -------------------------------------------------------------------- .\" HEAD @@ -922,7 +907,7 @@ www functionality. It should work with any macro set. .\" document .\" -------------------------------------------------------------------- .de HEAD -. HTML-TAG .head "\\$*" +. DEVTAG .head "\\$*" .. .\" -------------------------------------------------------------------- .\" Final Setup |