From fb0d07b5afc1f5efddf6d35f3d3e9deeea41237b Mon Sep 17 00:00:00 2001 From: Werner LEMBERG Date: Thu, 21 Sep 2000 19:20:53 +0000 Subject: [PATCH] * src/roff/troff/input.cc (main): Fixing compiler warning. * src/include/{driver.h, lib.h}: Move inclusion of string.h and strings.h from the former to the latter. * src/devices/grolbp/lpb.cc, src/include/lib.h: Move strncasecmp() stuff from the former to the latter. --- ChangeLog | 8 ++++++++ src/devices/grolbp/lbp.cc | 11 ----------- src/include/driver.h | 4 ---- src/include/lib.h | 15 +++++++++++++++ src/roff/troff/input.cc | 35 +++++++++++++++++++++++++++++------ 5 files changed, 52 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index 40abf81c..1cbe7cd1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2000-09-21 Werner LEMBERG + + * src/roff/troff/input.cc (main): Fixing compiler warning. + * src/include/{driver.h, lib.h}: Move inclusion of string.h and + strings.h from the former to the latter. + * src/devices/grolbp/lpb.cc, src/include/lib.h: Move strncasecmp() + stuff from the former to the latter. + 2000-09-11 Werner LEMBERG Implementing two new requests .tm1 and .tmc: The former is similar diff --git a/src/devices/grolbp/lbp.cc b/src/devices/grolbp/lbp.cc index 9e36c7bf..6633ab65 100644 --- a/src/devices/grolbp/lbp.cc +++ b/src/devices/grolbp/lbp.cc @@ -33,17 +33,6 @@ TODO #include "nonposix.h" -#if !defined(_AIX) && !defined(sinix) && !defined(__sinix__) -#ifdef HAVE_STRNCASECMP -#ifdef NEED_DECLARATION_STRNCASECMP -extern "C" { - // SunOS's string.h fails to declare this. - int strncasecmp(const char *, const char *, int); -} -#endif /* NEED_DECLARATION_STRNCASECMP */ -#endif /* HAVE_STRNCASECMP */ -#endif /* !_AIX && !sinix && !__sinix__ */ - static short int papersize = -1, // papersize orientation = -1 , // orientation paperlength = 0, // Custom Paper size diff --git a/src/include/driver.h b/src/include/driver.h index c0384c71..300a403b 100644 --- a/src/include/driver.h +++ b/src/include/driver.h @@ -19,10 +19,6 @@ with groff; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include -#include -#ifdef HAVE_STRINGS_H -#include -#endif #include #include #include diff --git a/src/include/lib.h b/src/include/lib.h index 2ce8b22c..98777886 100644 --- a/src/include/lib.h +++ b/src/include/lib.h @@ -36,6 +36,10 @@ char *strsave(const char *s); int is_prime(unsigned); #include +#include +#ifdef HAVE_STRINGS_H +#include +#endif FILE *xtmpfile(char **namep=0, char *postfix=0, int do_unlink=1); char *xtmptemplate(char *extension=0); @@ -61,6 +65,17 @@ inline int illegal_input_char(int c) return c >= 0 && illegal_char_table[c]; } +#if !defined(_AIX) && !defined(sinix) && !defined(__sinix__) +#ifdef HAVE_STRNCASECMP +#ifdef NEED_DECLARATION_STRNCASECMP +extern "C" { + // SunOS's string.h fails to declare this. + int strncasecmp(const char *, const char *, int); +} +#endif /* NEED_DECLARATION_STRNCASECMP */ +#endif /* HAVE_STRNCASECMP */ +#endif /* !_AIX && !sinix && !__sinix__ */ + #ifndef HAVE_STRCASECMP #define strcasecmp(a,b) strcmp((a),(b)) #endif diff --git a/src/roff/troff/input.cc b/src/roff/troff/input.cc index ab5bf06e..835f526e 100644 --- a/src/roff/troff/input.cc +++ b/src/roff/troff/input.cc @@ -3316,9 +3316,25 @@ static symbol dot_symbol("."); enum define_mode { DEFINE_NORMAL, DEFINE_APPEND, DEFINE_IGNORE }; -void do_define_macro(define_mode mode) +void do_define_macro(define_mode mode, int indirect) { - symbol nm; + symbol nm, term; + if (indirect) { + symbol temp1 = get_name(1); + if (temp1.is_null()) { + skip_line(); + return; + } + symbol temp2 = get_name(); + input_stack::push(make_temp_iterator("\n")); + if (!temp2.is_null()) { + interpolate_string(temp2); + input_stack::push(make_temp_iterator(" ")); + } + interpolate_string(temp1); + input_stack::push(make_temp_iterator(" ")); + tok.next(); + } if (mode == DEFINE_NORMAL || mode == DEFINE_APPEND) { nm = get_name(1); if (nm.is_null()) { @@ -3326,7 +3342,7 @@ void do_define_macro(define_mode mode) return; } } - symbol term = get_name(); // the request that terminates the definition + term = get_name(); // the request that terminates the definition if (term.is_null()) term = dot_symbol; while (!tok.newline() && !tok.eof()) @@ -3427,18 +3443,23 @@ void do_define_macro(define_mode mode) void define_macro() { - do_define_macro(DEFINE_NORMAL); + do_define_macro(DEFINE_NORMAL, 0); +} + +void define_indirect_macro() +{ + do_define_macro(DEFINE_NORMAL, 1); } void append_macro() { - do_define_macro(DEFINE_APPEND); + do_define_macro(DEFINE_APPEND, 0); } void ignore() { ignoring = 1; - do_define_macro(DEFINE_IGNORE); + do_define_macro(DEFINE_IGNORE, 0); ignoring = 0; } @@ -5817,6 +5838,7 @@ int main(int argc, char **argv) break; case '?': usage(argv[0]); + break; // never reached default: assert(0); } @@ -5999,6 +6021,7 @@ void init_input_requests() init_request("ds", define_string); init_request("as", append_string); init_request("de", define_macro); + init_request("dei", define_indirect_macro); init_request("am", append_macro); init_request("ig", ignore); init_request("rm", remove_macro); -- 2.11.4.GIT