diff options
author | ru <ru@FreeBSD.org> | 2005-10-20 10:45:19 +0000 |
---|---|---|
committer | ru <ru@FreeBSD.org> | 2005-10-20 10:45:19 +0000 |
commit | 353ac0b339df3493d1950b6527988b77b76bd197 (patch) | |
tree | 8a188846a3f5bd2f2b8cb869cba64e3c470a2b26 /contrib/groff/src/libs | |
parent | c40093b1f1b43dc237b9d272697cdd0842ec64ec (diff) | |
download | FreeBSD-src-353ac0b339df3493d1950b6527988b77b76bd197.zip FreeBSD-src-353ac0b339df3493d1950b6527988b77b76bd197.tar.gz |
Virgin import of FSF groff v1.19.2
Diffstat (limited to 'contrib/groff/src/libs')
61 files changed, 5629 insertions, 741 deletions
diff --git a/contrib/groff/src/libs/libbib/common.cpp b/contrib/groff/src/libs/libbib/common.cpp index 4b2bcca..9d16e7a 100644 --- a/contrib/groff/src/libs/libbib/common.cpp +++ b/contrib/groff/src/libs/libbib/common.cpp @@ -15,7 +15,7 @@ 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. */ +Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ unsigned hash(const char *s, int len) { diff --git a/contrib/groff/src/libs/libbib/index.cpp b/contrib/groff/src/libs/libbib/index.cpp index 3633df1..6b9b9e3 100644 --- a/contrib/groff/src/libs/libbib/index.cpp +++ b/contrib/groff/src/libs/libbib/index.cpp @@ -1,5 +1,6 @@ // -*- C++ -*- -/* Copyright (C) 1989, 1990, 1991, 1992, 2001 Free Software Foundation, Inc. +/* Copyright (C) 1989, 1990, 1991, 1992, 2001, 2004 + Free Software Foundation, Inc. Written by James Clark (jjc@jclark.com) This file is part of groff. @@ -16,7 +17,7 @@ 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. */ +Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "lib.h" @@ -349,7 +350,7 @@ int index_search_item_iterator::next(const linear_searcher &, } int index_search_item_iterator::get_tag(int tagno, - const linear_searcher &searcher, + const linear_searcher &searchr, const char **pp, int *lenp, reference_id *ridp) { @@ -389,7 +390,6 @@ int index_search_item_iterator::get_tag(int tagno, int length = tp->length; int err = 0; if (length == 0) { - struct stat sb; if (fstat(fileno(fp), &sb) < 0) { error("can't stat `%1': %2", filename, strerror(errno)); err = 1; @@ -426,7 +426,7 @@ int index_search_item_iterator::get_tag(int tagno, buf[didx] = buf[sidx]; } buf[length + 1] = '\n'; - res = searcher.search(buf + 1, buf + 2 + length, pp, lenp); + res = searchr.search(buf + 1, buf + 2 + length, pp, lenp); if (res && ridp) *ridp = reference_id(indx->filename_id + tp->filename_index, tp->start); diff --git a/contrib/groff/src/libs/libbib/linear.cpp b/contrib/groff/src/libs/libbib/linear.cpp index 1dd902b..c1919ab7 100644 --- a/contrib/groff/src/libs/libbib/linear.cpp +++ b/contrib/groff/src/libs/libbib/linear.cpp @@ -17,7 +17,7 @@ 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. */ +Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "lib.h" diff --git a/contrib/groff/src/libs/libbib/map.c b/contrib/groff/src/libs/libbib/map.c index 4d878a2..f45625d 100644 --- a/contrib/groff/src/libs/libbib/map.c +++ b/contrib/groff/src/libs/libbib/map.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001 +/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2004 Free Software Foundation, Inc. Written by James Clark (jjc@jclark.com) @@ -16,7 +16,7 @@ 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. */ +Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ #include <stdlib.h> @@ -34,11 +34,13 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define MAP_FILE 0 #endif -char *mapread(fd, nbytes) - int fd; - int nbytes; +#ifdef __cplusplus +extern "C" { +#endif + +char *mapread(int fd, int nbytes) { - char *p = (char *)mmap((caddr_t)0, (size_t)nbytes, PROT_READ, + char *p = (char *)mmap((void *)0, (size_t)nbytes, PROT_READ, MAP_FILE|MAP_PRIVATE, fd, (off_t)0); if (p == (char *)-1) return 0; @@ -48,31 +50,37 @@ char *mapread(fd, nbytes) return p; } -int unmap(p, len) - char *p; - int len; +int unmap(char *p, int len) { - return munmap((caddr_t)p, len); + return munmap((void *)p, len); } +#ifdef __cplusplus +} +#endif + #else /* not HAVE_MMAP */ #include <errno.h> -char *mapread(fd, nbytes) - int fd; - int nbytes; +#ifdef __cplusplus +extern "C" { +#endif + +char *mapread(int fd, int nbytes) { errno = ENODEV; return 0; } -int unmap(p, len) - char *p; - int len; +int unmap(char *p, int len) { errno = EINVAL; return -1; } +#ifdef __cplusplus +} +#endif + #endif /* not HAVE_MMAP */ diff --git a/contrib/groff/src/libs/libbib/search.cpp b/contrib/groff/src/libs/libbib/search.cpp index 2223fb6..4ed0baa 100644 --- a/contrib/groff/src/libs/libbib/search.cpp +++ b/contrib/groff/src/libs/libbib/search.cpp @@ -17,7 +17,7 @@ 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. */ +Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "lib.h" diff --git a/contrib/groff/src/libs/libdriver/input.cpp b/contrib/groff/src/libs/libdriver/input.cpp index acb6f13..bf8a74e 100644 --- a/contrib/groff/src/libs/libdriver/input.cpp +++ b/contrib/groff/src/libs/libdriver/input.cpp @@ -2,13 +2,13 @@ // <groff_src_dir>/src/libs/libdriver/input.cpp -/* Copyright (C) 1989, 1990, 1991, 1992, 2001, 2002, 2003 +/* Copyright (C) 1989, 1990, 1991, 1992, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. Written by James Clark (jjc@jclark.com) Major rewrite 2001 by Bernd Warken (bwarken@mayn.de) - Last update: 04 Apr 2003 + Last update: 15 Jun 2005 This file is part of groff, the GNU roff text processing system. @@ -24,8 +24,8 @@ 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. + Software Foundation, 51 Franklin St - Fifth Floor, Boston, MA + 02110-1301, USA. */ /* Description @@ -272,16 +272,15 @@ public: IntArray(void); IntArray(const size_t); ~IntArray(void); - const IntArg operator[](const size_t i) const + IntArg operator[](const size_t i) const { if (i >= num_stored) fatal("index out of range"); return (IntArg) data[i]; } void append(IntArg); - const IntArg * const - get_data(void) const { return (IntArg *) data; } - const size_t len(void) const { return num_stored; } + IntArg *get_data(void) const { return (IntArg *)data; } + size_t len(void) const { return num_stored; } }; // Characters read from the input queue. @@ -442,7 +441,7 @@ EnvStack::EnvStack(void) { num_allocated = 4; // allocate pointer to array of num_allocated pointers to environment - data = (environment **) malloc(envp_size * num_allocated); + data = (environment **)malloc(envp_size * num_allocated); if (data == 0) fatal("could not allocate environment data"); num_stored = 0; @@ -475,7 +474,7 @@ EnvStack::push(environment *e) if (num_stored >= num_allocated) { environment **old_data = data; num_allocated *= 2; - data = (environment **) malloc(envp_size * num_allocated); + data = (environment **)malloc(envp_size * num_allocated); if (data == 0) fatal("could not allocate data"); for (size_t i = 0; i < num_stored; i++) @@ -608,6 +607,7 @@ void delete_current_env(void) delete current_env->col; delete current_env->fill; delete current_env; + current_env = 0; } ////////////////////////////////////////////////////////////////////// @@ -1034,13 +1034,13 @@ remember_filename(const char *filename) { char *fname; if (strcmp(filename, "-") == 0) - fname = "<standard input>"; + fname = (char *)"<standard input>"; else - fname = (char *) filename; + fname = (char *)filename; size_t len = strlen(fname) + 1; if (current_filename != 0) free((char *)current_filename); - current_filename = (const char *) malloc(len); + current_filename = (const char *)malloc(len); if (current_filename == 0) fatal("can't malloc space for filename"); strncpy((char *)current_filename, (char *)fname, len); @@ -1060,13 +1060,13 @@ remember_source_filename(const char *filename) { char *fname; if (strcmp(filename, "-") == 0) - fname = "<standard input>"; + fname = (char *)"<standard input>"; else - fname = (char *) filename; + fname = (char *)filename; size_t len = strlen(fname) + 1; if (current_source_filename != 0) free((char *)current_source_filename); - current_source_filename = (const char *) malloc(len); + current_source_filename = (const char *)malloc(len); if (current_source_filename == 0) fatal("can't malloc space for filename"); strncpy((char *)current_source_filename, (char *)fname, len); @@ -1083,7 +1083,7 @@ void send_draw(const Char subcmd, const IntArray * const args) { EnvInt n = (EnvInt) args->len(); - pr->draw((int) subcmd, (IntArg *) args->get_data(), n, current_env); + pr->draw((int) subcmd, (IntArg *)args->get_data(), n, current_env); } ////////////////////////////////////////////////////////////////////// @@ -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 && (strncmp(str_arg, "devtag:", + strlen("devtag:")) == 0)) + pr->devtag(str_arg, current_env); else pr->special(str_arg, current_env); a_delete str_arg; @@ -1823,6 +1826,7 @@ do_file(const char *filename) if (npages > 0) pr->end_page(current_env->vpos); delete pr; + pr = 0; fclose(current_file); // If `stopped' is not `true' here then there wasn't any `x stop'. if (!stopped) diff --git a/contrib/groff/src/libs/libdriver/printer.cpp b/contrib/groff/src/libs/libdriver/printer.cpp index 179daf1..fd77d6b 100644 --- a/contrib/groff/src/libs/libdriver/printer.cpp +++ b/contrib/groff/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, 2005 Free Software Foundation, Inc. Written by James Clark (jjc@jclark.com) - Last update: 04 Apr 2003 + Last update: 02 Mar 2005 This file is part of groff. @@ -22,12 +22,61 @@ 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. + Software Foundation, 51 Franklin St - Fifth Floor, Boston, MA + 02110-1301, USA. */ #include "driver.h" +/* If we are sending output to an onscreen pager (as is the normal case + when reading man pages), then we may get an error state on the output + stream, if the user does not read all the way to the end. + + We normally expect to catch this, and clean up the error context, when + the pager exits, because we should get, and handle, a SIGPIPE. + + However ... +*/ + +#if (defined(_MSC_VER) || defined(_WIN32)) \ + && !defined(__CYGWIN__) && !defined(_UWIN) + + /* Native MS-Windows doesn't know about SIGPIPE, so we cannot detect the + early exit from the pager, and therefore, cannot clean up the error + context; thus we use the following static function to identify this + particular error context, and so suppress unwanted diagnostics. + */ + + static int + check_for_output_error (FILE* stream) + { + /* First, clean up any prior error context on the output stream */ + if (ferror (stream)) + clearerr (stream); + /* Clear errno, in case clearerr() and fflush() don't */ + errno = 0; + /* Flush the output stream, so we can capture any error context, other + than the specific case we wish to suppress. + + Microsoft doesn't document it, but the error code for the specific + context we are trying to suppress seems to be EINVAL -- a strange + choice, since it is not normally associated with fflush(); of course, + it *should* be EPIPE, but this *definitely* is not used, and *is* so + documented. + */ + return ((fflush(stream) < 0) && (errno != EINVAL)); + } + +#else + + /* For other systems, we simply assume that *any* output error context + is to be reported. + */ +# define check_for_output_error(stream) ferror(stream) || fflush(stream) < 0 + +#endif + + font_pointer_list::font_pointer_list(font *f, font_pointer_list *fp) : p(f), next(fp) { @@ -47,7 +96,7 @@ printer::~printer() delete tem->p; delete tem; } - if (ferror(stdout) || fflush(stdout) < 0) + if (check_for_output_error(stdout)) fatal("output error"); } @@ -107,6 +156,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/contrib/groff/src/libs/libgroff/Makefile.sub b/contrib/groff/src/libs/libgroff/Makefile.sub index 30277ab..e7606a8 100644 --- a/contrib/groff/src/libs/libgroff/Makefile.sub +++ b/contrib/groff/src/libs/libgroff/Makefile.sub @@ -1,4 +1,5 @@ LIB=groff +EXTRA_CFLAGS=-D__GETOPT_PREFIX=groff_ OBJS=\ assert.$(OBJEXT) \ change_lf.$(OBJEXT) \ @@ -15,12 +16,18 @@ OBJS=\ geometry.$(OBJEXT) \ getopt.$(OBJEXT) \ getopt1.$(OBJEXT) \ + glyphuni.$(OBJEXT) \ htmlhint.$(OBJEXT) \ + hypot.$(OBJEXT) \ + iftoa.$(OBJEXT) \ invalid.$(OBJEXT) \ + itoa.$(OBJEXT) \ lf.$(OBJEXT) \ lineno.$(OBJEXT) \ macropath.$(OBJEXT) \ + matherr.$(OBJEXT) \ maxfilename.$(OBJEXT) \ + maxpathname.$(OBJEXT) \ mksdir.$(OBJEXT) \ nametoindex.$(OBJEXT) \ new.$(OBJEXT) \ @@ -28,14 +35,18 @@ OBJS=\ prime.$(OBJEXT) \ progname.$(OBJEXT) \ ptable.$(OBJEXT) \ + quotearg.$(OBJEXT) \ + relocate.$(OBJEXT) \ searchpath.$(OBJEXT) \ + spawnvp.$(OBJEXT) \ string.$(OBJEXT) \ strsave.$(OBJEXT) \ + symbol.$(OBJEXT) \ tmpfile.$(OBJEXT) \ tmpname.$(OBJEXT) \ - iftoa.$(OBJEXT) \ - itoa.$(OBJEXT) \ - matherr.$(OBJEXT) \ + unicode.$(OBJEXT) \ + uniglyph.$(OBJEXT) \ + uniuni.$(OBJEXT) \ version.$(OBJEXT) \ $(LIBOBJS) CCSRCS=\ @@ -52,25 +63,32 @@ CCSRCS=\ $(srcdir)/font.cpp \ $(srcdir)/fontfile.cpp \ $(srcdir)/geometry.cpp \ + $(srcdir)/glyphuni.cpp \ $(srcdir)/htmlhint.cpp \ + $(srcdir)/hypot.cpp \ $(srcdir)/invalid.cpp \ $(srcdir)/lf.cpp \ $(srcdir)/lineno.cpp \ $(srcdir)/macropath.cpp \ $(srcdir)/maxfilename.cpp \ + $(srcdir)/maxpathname.cpp \ $(srcdir)/mksdir.cpp \ $(srcdir)/mkstemp.cpp \ $(srcdir)/nametoindex.cpp \ $(srcdir)/new.cpp \ $(srcdir)/paper.cpp \ $(srcdir)/prime.cpp \ - $(srcdir)/progname.cpp \ $(srcdir)/ptable.cpp \ + $(srcdir)/relocate.cpp \ $(srcdir)/searchpath.cpp \ $(srcdir)/string.cpp \ $(srcdir)/strsave.cpp \ + $(srcdir)/symbol.cpp \ $(srcdir)/tmpfile.cpp \ $(srcdir)/tmpname.cpp \ + $(srcdir)/unicode.cpp \ + $(srcdir)/uniglyph.cpp \ + $(srcdir)/uniuni.cpp \ version.cpp CSRCS=\ $(srcdir)/fmod.c \ @@ -80,7 +98,10 @@ CSRCS=\ $(srcdir)/iftoa.c \ $(srcdir)/itoa.c \ $(srcdir)/matherr.c \ + $(srcdir)/progname.c \ $(srcdir)/putenv.c \ + $(srcdir)/quotearg.c \ + $(srcdir)/spawnvp.c \ $(srcdir)/strcasecmp.c \ $(srcdir)/strerror.c \ $(srcdir)/strncasecmp.c \ diff --git a/contrib/groff/src/libs/libgroff/assert.cpp b/contrib/groff/src/libs/libgroff/assert.cpp index 89742e3..bc08eab 100644 --- a/contrib/groff/src/libs/libgroff/assert.cpp +++ b/contrib/groff/src/libs/libgroff/assert.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc. +/* Copyright (C) 1989, 1990, 1991, 1992, 2004 Free Software Foundation, Inc. Written by James Clark (jjc@jclark.com) This file is part of groff. @@ -15,13 +15,13 @@ 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. */ +Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ #include <stdio.h> #include <stdlib.h> #include "assert.h" -extern const char *program_name; +extern "C" const char *program_name; void assertion_failed(int lineno, const char *filename) { diff --git a/contrib/groff/src/libs/libgroff/change_lf.cpp b/contrib/groff/src/libs/libgroff/change_lf.cpp index 2e44af1..0313779 100644 --- a/contrib/groff/src/libs/libgroff/change_lf.cpp +++ b/contrib/groff/src/libs/libgroff/change_lf.cpp @@ -15,7 +15,7 @@ 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. */ +Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ #include <string.h> diff --git a/contrib/groff/src/libs/libgroff/cmap.cpp b/contrib/groff/src/libs/libgroff/cmap.cpp index 4b75d06..2691c01 100644 --- a/contrib/groff/src/libs/libgroff/cmap.cpp +++ b/contrib/groff/src/libs/libgroff/cmap.cpp @@ -16,7 +16,7 @@ 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. */ +Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ #include <ctype.h> #include "cmap.h" diff --git a/contrib/groff/src/libs/libgroff/color.cpp b/contrib/groff/src/libs/libgroff/color.cpp index da138dc..b82bdcd 100644 --- a/contrib/groff/src/libs/libgroff/color.cpp +++ b/contrib/groff/src/libs/libgroff/color.cpp @@ -2,9 +2,9 @@ /* <groff_src_dir>/src/libs/libgroff/color.cpp -Last update: 13 Apr 2003 +Last update: 26 May 2004 -Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. +Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Written by Gaius Mulley <gaius@glam.ac.uk> This file is part of groff. @@ -21,8 +21,9 @@ 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. */ +Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ +#include "lib.h" #include "color.h" #include "cset.h" #ifdef HAVE_UNISTD_H @@ -73,6 +74,7 @@ void color::operator delete(void *p) color::color(const color * const c) { + nm = c->nm; scheme = c->scheme; components[0] = c->components[0]; components[1] = c->components[1]; diff --git a/contrib/groff/src/libs/libgroff/cset.cpp b/contrib/groff/src/libs/libgroff/cset.cpp index e4845c1..8199e62 100644 --- a/contrib/groff/src/libs/libgroff/cset.cpp +++ b/contrib/groff/src/libs/libgroff/cset.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -/* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc. +/* Copyright (C) 1989, 1990, 1991, 1992, 2004 Free Software Foundation, Inc. Written by James Clark (jjc@jclark.com) This file is part of groff. @@ -16,9 +16,11 @@ 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. */ +Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ #include <ctype.h> + +#include "lib.h" #include "cset.h" cset csalpha(CSET_BUILTIN); diff --git a/contrib/groff/src/libs/libgroff/device.cpp b/contrib/groff/src/libs/libgroff/device.cpp index 7efbfef..53baf97 100644 --- a/contrib/groff/src/libs/libgroff/device.cpp +++ b/contrib/groff/src/libs/libgroff/device.cpp @@ -16,7 +16,7 @@ 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. */ +Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ #include <stdlib.h> #include "device.h" diff --git a/contrib/groff/src/libs/libgroff/errarg.cpp b/contrib/groff/src/libs/libgroff/errarg.cpp index 2ddc0cc..1d6ef30 100644 --- a/contrib/groff/src/libs/libgroff/errarg.cpp +++ b/contrib/groff/src/libs/libgroff/errarg.cpp @@ -17,7 +17,7 @@ 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. */ +Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ #include <stdio.h> #include "assert.h" diff --git a/contrib/groff/src/libs/libgroff/error.cpp b/contrib/groff/src/libs/libgroff/error.cpp index f7d3ec0..8aea0c0 100644 --- a/contrib/groff/src/libs/libgroff/error.cpp +++ b/contrib/groff/src/libs/libgroff/error.cpp @@ -16,7 +16,7 @@ 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. */ +Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ #include <stdio.h> #include <stdlib.h> diff --git a/contrib/groff/src/libs/libgroff/fatal.cpp b/contrib/groff/src/libs/libgroff/fatal.cpp index 42560dc..bed8298b 100644 --- a/contrib/groff/src/libs/libgroff/fatal.cpp +++ b/contrib/groff/src/libs/libgroff/fatal.cpp @@ -15,7 +15,7 @@ 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. */ +Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ #include <stdlib.h> diff --git a/contrib/groff/src/libs/libgroff/fmod.c b/contrib/groff/src/libs/libgroff/fmod.c index 818f946..92e7306 100644 --- a/contrib/groff/src/libs/libgroff/fmod.c +++ b/contrib/groff/src/libs/libgroff/fmod.c @@ -15,7 +15,7 @@ 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. */ +Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ #include <math.h> diff --git a/contrib/groff/src/libs/libgroff/font.cpp b/contrib/groff/src/libs/libgroff/font.cpp index c633cc8..466c71d 100644 --- a/contrib/groff/src/libs/libgroff/font.cpp +++ b/contrib/groff/src/libs/libgroff/font.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2002, 2003 +/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. Written by James Clark (jjc@jclark.com) @@ -17,7 +17,7 @@ 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. */ +Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "lib.h" @@ -71,6 +71,7 @@ struct text_file { int lineno; int size; int skip_comments; + int silent; char *buf; text_file(FILE *fp, char *p); ~text_file(); @@ -82,7 +83,7 @@ struct text_file { }; text_file::text_file(FILE *p, char *s) -: fp(p), path(s), lineno(0), size(0), skip_comments(1), buf(0) +: fp(p), path(s), lineno(0), size(0), skip_comments(1), silent(0), buf(0) { } @@ -141,7 +142,8 @@ void text_file::error(const char *format, const errarg &arg2, const errarg &arg3) { - error_with_file_and_line(path, lineno, format, arg1, arg2, arg3); + if (!silent) + error_with_file_and_line(path, lineno, format, arg1, arg2, arg3); } @@ -272,7 +274,7 @@ int font::get_width(int c, int point_size) int i = ch_index[c]; assert(i >= 0); - if (point_size == unitwidth) + if (point_size == unitwidth || font::unscaled_charwidths) return ch[i].width; if (!widths_cache) @@ -394,27 +396,32 @@ const char *font::get_internal_name() const char *font::get_special_device_encoding(int c) { assert(c >= 0 && c < nindices && ch_index[c] >= 0); - return( ch[ch_index[c]].special_device_coding ); + return ch[ch_index[c]].special_device_coding; } -void font::alloc_ch_index(int index) +const char *font::get_image_generator() +{ + return image_generator; +} + +void font::alloc_ch_index(int idx) { if (nindices == 0) { nindices = 128; - if (index >= nindices) - nindices = index + 10; - ch_index = new short[nindices]; + if (idx >= nindices) + nindices = idx + 10; + ch_index = new int[nindices]; for (int i = 0; i < nindices; i++) ch_index[i] = -1; } else { int old_nindices = nindices; nindices *= 2; - if (index >= nindices) - nindices = index + 10; - short *old_ch_index = ch_index; - ch_index = new short[nindices]; - memcpy(ch_index, old_ch_index, sizeof(short)*old_nindices); + if (idx >= nindices) + nindices = idx + 10; + int *old_ch_index = ch_index; + ch_index = new int[nindices]; + memcpy(ch_index, old_ch_index, sizeof(int)*old_nindices); for (int i = old_nindices; i < nindices; i++) ch_index[i] = -1; a_delete old_ch_index; @@ -443,9 +450,9 @@ void font::compact() break; i++; if (i < nindices) { - short *old_ch_index = ch_index; - ch_index = new short[i]; - memcpy(ch_index, old_ch_index, i*sizeof(short)); + int *old_ch_index = ch_index; + ch_index = new int[i]; + memcpy(ch_index, old_ch_index, i*sizeof(int)); a_delete old_ch_index; nindices = i; } @@ -458,16 +465,16 @@ void font::compact() } } -void font::add_entry(int index, const font_char_metric &metric) +void font::add_entry(int idx, const font_char_metric &metric) { - assert(index >= 0); - if (index >= nindices) - alloc_ch_index(index); - assert(index < nindices); + assert(idx >= 0); + if (idx >= nindices) + alloc_ch_index(idx); + assert(idx < nindices); if (ch_used + 1 >= ch_size) extend_ch(); assert(ch_used + 1 < ch_size); - ch_index[index] = ch_used; + ch_index[idx] = ch_used; ch[ch_used++] = metric; } @@ -479,10 +486,10 @@ void font::copy_entry(int new_index, int old_index) ch_index[new_index] = ch_index[old_index]; } -font *font::load_font(const char *s, int *not_found) +font *font::load_font(const char *s, int *not_found, int head_only) { font *f = new font(s); - if (!f->load(not_found)) { + if (!f->load(not_found, head_only)) { delete f; return 0; } @@ -557,7 +564,7 @@ again: // If the font can't be found, then if not_found is non-NULL, it will be set // to 1 otherwise a message will be printed. -int font::load(int *not_found) +int font::load(int *not_found, int head_only) { char *path; FILE *fp; @@ -570,6 +577,7 @@ int font::load(int *not_found) } text_file t(fp, path); t.skip_comments = 1; + t.silent = head_only; char *p; for (;;) { if (!t.next()) { @@ -638,6 +646,8 @@ int font::load(int *not_found) else break; } + if (head_only) + return 1; char *command = p; int had_charset = 0; t.skip_comments = 0; @@ -704,12 +714,12 @@ int font::load(int *not_found) t.error("unnamed character cannot be duplicate"); return 0; } - int index = name_to_index(nm); - if (index < 0) { + int idx = name_to_index(nm); + if (idx < 0) { t.error("invalid character `%1'", nm); return 0; } - copy_entry(index, last_index); + copy_entry(idx, last_index); } else { font_char_metric metric; @@ -758,9 +768,9 @@ int font::load(int *not_found) metric.special_device_coding = NULL; } else { - char *name = new char[strlen(p) + 1]; - strcpy(name, p); - metric.special_device_coding = name; + char *nam = new char[strlen(p) + 1]; + strcpy(nam, p); + metric.special_device_coding = nam; } if (strcmp(nm, "---") == 0) { last_index = number_to_index(metric.code); @@ -810,7 +820,7 @@ static struct { { "spare1", &font::biggestfont }, { "biggestfont", &font::biggestfont }, { "spare2", &font::spare2 }, - { "sizescale", &font::sizescale } + { "sizescale", &font::sizescale }, }; int font::load_desc() @@ -905,6 +915,8 @@ int font::load_desc() return 0; } } + else if (strcmp("unscaled_charwidths", p) == 0) + unscaled_charwidths = 1; else if (strcmp("pass_filenames", p) == 0) pass_filenames = 1; else if (strcmp("sizes", p) == 0) { @@ -981,6 +993,14 @@ int font::load_desc() tcommand = 1; else if (strcmp("use_charnames_in_special", p) == 0) use_charnames_in_special = 1; + else if (strcmp("image_generator", p) == 0) { + p = strtok(0, WS); + if (!p) { + t.error("image_generator command requires an argument"); + return 0; + } + image_generator = strsave(p); + } else if (strcmp("charset", p) == 0) break; else if (unknown_desc_command_handler) { diff --git a/contrib/groff/src/libs/libgroff/fontfile.cpp b/contrib/groff/src/libs/libgroff/fontfile.cpp index 8502d12..18d0b86 100644 --- a/contrib/groff/src/libs/libgroff/fontfile.cpp +++ b/contrib/groff/src/libs/libgroff/fontfile.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2002 +/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2002, 2004 Free Software Foundation, Inc. Written by James Clark (jjc@jclark.com) @@ -17,7 +17,7 @@ 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. */ +Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "lib.h" @@ -45,7 +45,9 @@ int font::spare2 = 0; int font::sizescale = 1; int font::tcommand = 0; int font::pass_filenames = 0; +int font::unscaled_charwidths = 0; int font::use_charnames_in_special = 0; +const char *font::image_generator = NULL; const char **font::font_name_table = 0; int *font::sizes = 0; const char *font::family = 0; @@ -57,10 +59,10 @@ void font::command_line_font_dir(const char *dir) font_path.command_line_dir(dir); } -FILE *font::open_file(const char *name, char **pathp) +FILE *font::open_file(const char *nm, char **pathp) { - char *filename = new char[strlen(name) + strlen(device) + 5]; - sprintf(filename, "dev%s/%s", device, name); + char *filename = new char[strlen(nm) + strlen(device) + 5]; + sprintf(filename, "dev%s/%s", device, nm); FILE *fp = font_path.open_file(filename, pathp); a_delete filename; return fp; diff --git a/contrib/groff/src/libs/libgroff/geometry.cpp b/contrib/groff/src/libs/libgroff/geometry.cpp index 256d266..7d96e5c 100644 --- a/contrib/groff/src/libs/libgroff/geometry.cpp +++ b/contrib/groff/src/libs/libgroff/geometry.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2002, 2003 +/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Written by Gaius Mulley <gaius@glam.ac.uk> using adjust_arc_center() from printer.cpp, written by James Clark. @@ -18,7 +18,7 @@ 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. */ +Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ #include <stdio.h> @@ -113,174 +113,67 @@ int printer::adjust_arc_center(const int *p, double *c) * Works out in which quadrant the arc starts and * stops, and from this it determines the x, y * max/min limits. The arc is drawn clockwise. - * - * [I'm sure there is a better way to do this, but - * I don't know how. Please can someone let me - * know or "improve" this function.] */ -void check_output_arc_limits(int x1, int y1, - int xv1, int yv1, - int xv2, int yv2, - double c0, double c1, +void check_output_arc_limits(int x_1, int y_1, + int xv_1, int yv_1, + int xv_2, int yv_2, + double c_0, double c_1, int *minx, int *maxx, int *miny, int *maxy) { - int radius = (int)sqrt(c0*c0 + c1*c1); - int x2 = x1 + xv1 + xv2; // end of arc is (x2, y2) - int y2 = y1 + yv1 + yv2; - - // firstly lets use the `circle' limitation - *minx = x1 + xv1 - radius; - *maxx = x1 + xv1 + radius; - *miny = y1 + yv1 - radius; - *maxy = y1 + yv1 + radius; - - /* now to see which min/max can be reduced and increased for the limits of - * the arc - * - * Q2 | Q1 - * -----+----- - * Q3 | Q4 - * - * - * NB. (x1+xv1, y1+yv1) is at the origin - * - * below we ask a nested question - * (i) from which quadrant does the first vector start? - * (ii) into which quadrant does the second vector go? - * from the 16 possible answers we determine the limits of the arc - */ - if (xv1 > 0 && yv1 > 0) { - // first vector in Q3 - if (xv2 >= 0 && yv2 >= 0 ) { - // second in Q1 - *maxx = x2; - *miny = y1; - } - else if (xv2 < 0 && yv2 >= 0) { - // second in Q2 - *maxx = x2; - *miny = y1; - } - else if (xv2 >= 0 && yv2 < 0) { - // second in Q4 - *miny = MIN(y1, y2); - } - else if (xv2 < 0 && yv2 < 0) { - // second in Q3 - if (x1 >= x2) { - *minx = x2; - *maxx = x1; - *miny = MIN(y1, y2); - *maxy = MAX(y1, y2); - } - else { - // xv2, yv2 could all be zero? - } - } - } - else if (xv1 > 0 && yv1 < 0) { - // first vector in Q2 - if (xv2 >= 0 && yv2 >= 0) { - // second in Q1 - *maxx = MAX(x1, x2); - *minx = MIN(x1, x2); - *miny = y1; - } - else if (xv2 < 0 && yv2 >= 0) { - // second in Q2 - if (x1 < x2) { - *maxx = x2; - *minx = x1; - *miny = MIN(y1, y2); - *maxy = MAX(y1, y2); - } - else { - // otherwise almost full circle anyway - } - } - else if (xv2 >= 0 && yv2 < 0) { - // second in Q4 - *miny = y2; - *minx = x1; - } - else if (xv2 < 0 && yv2 < 0) { - // second in Q3 - *minx = MIN(x1, x2); - } - } - else if (xv1 <= 0 && yv1 <= 0) { - // first vector in Q1 - if (xv2 >= 0 && yv2 >= 0) { - // second in Q1 - if (x1 < x2) { - *minx = x1; - *maxx = x2; - *miny = MIN(y1, y2); - *maxy = MAX(y1, y2); - } - else { - // nearly full circle - } - } - else if (xv2 < 0 && yv2 >= 0) { - // second in Q2 - *maxy = MAX(y1, y2); - } - else if (xv2 >= 0 && yv2 < 0) { - // second in Q4 - *miny = MIN(y1, y2); - *maxy = MAX(y1, y2); - *minx = MIN(x1, x2); - } - else if (xv2 < 0 && yv2 < 0) { - // second in Q3 - *minx = x2; - *maxy = y1; - } - } - else if (xv1 <= 0 && yv1 > 0) { - // first vector in Q4 - if (xv2 >= 0 && yv2 >= 0) { - // second in Q1 - *maxx = MAX(x1, x2); - } - else if (xv2 < 0 && yv2 >= 0) { - // second in Q2 - *maxy = MAX(y1, y2); - *maxx = MAX(x1, x2); - } - else if (xv2 >= 0 && yv2 < 0) { - // second in Q4 - if (x1 >= x2) { - *miny = MIN(y1, y2); - *maxy = MAX(y1, y2); - *minx = MIN(x1, x2); - *maxx = MAX(x2, x2); - } - else { - // nearly full circle - } - } - else if (xv2 < 0 && yv2 < 0) { - // second in Q3 - *maxy = MAX(y1, y2); - *minx = MIN(x1, x2); - *maxx = MAX(x1, x2); - } - } - - // this should *never* happen but if it does it means a case above is wrong - // this code is only present for safety sake - if (*maxx < *minx) { - fprintf(stderr, "assert failed *minx > *maxx\n"); - fflush(stderr); - *maxx = *minx; - } - if (*maxy < *miny) { - fprintf(stderr, "assert failed *miny > *maxy\n"); - fflush(stderr); - *maxy = *miny; - } + int radius = (int)sqrt(c_0 * c_0 + c_1 * c_1); + // clockwise direction + int xcenter = x_1 + xv_1; + int ycenter = y_1 + yv_1; + int xend = xcenter + xv_2; + int yend = ycenter + yv_2; + // for convenience, transform to counterclockwise direction, + // centered at the origin + int xs = xend - xcenter; + int ys = yend - ycenter; + int xe = x_1 - xcenter; + int ye = y_1 - ycenter; + *minx = *maxx = xs; + *miny = *maxy = ys; + if (xe > *maxx) + *maxx = xe; + else if (xe < *minx) + *minx = xe; + if (ye > *maxy) + *maxy = ye; + else if (ye < *miny) + *miny = ye; + int qs, qe; // quadrants 0..3 + if (xs >= 0) + qs = (ys >= 0) ? 0 : 3; + else + qs = (ys >= 0) ? 1 : 2; + if (xe >= 0) + qe = (ye >= 0) ? 0 : 3; + else + qe = (ye >= 0) ? 1 : 2; + // make qs always smaller than qe + if ((qs > qe) + || ((qs == qe) && (double(xs) * ye < double(xe) * ys))) + qe += 4; + for (int i = qs; i < qe; i++) + switch (i % 4) { + case 0: + *maxy = radius; + break; + case 1: + *minx = -radius; + break; + case 2: + *miny = -radius; + break; + case 3: + *maxx = radius; + break; + } + *minx += xcenter; + *maxx += xcenter; + *miny += ycenter; + *maxy += ycenter; } diff --git a/contrib/groff/src/libs/libgroff/getcwd.c b/contrib/groff/src/libs/libgroff/getcwd.c index 7a769ff..d7443ec 100644 --- a/contrib/groff/src/libs/libgroff/getcwd.c +++ b/contrib/groff/src/libs/libgroff/getcwd.c @@ -15,7 +15,7 @@ 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. */ +Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ /* Partial emulation of getcwd in terms of getwd. */ diff --git a/contrib/groff/src/libs/libgroff/getopt.c b/contrib/groff/src/libs/libgroff/getopt.c index 289d137..bcb81c8 100644 --- a/contrib/groff/src/libs/libgroff/getopt.c +++ b/contrib/groff/src/libs/libgroff/getopt.c @@ -2,24 +2,23 @@ NOTE: getopt is now part of the C library, so if you don't know what "Keep this file name-space clean" means, talk to drepper@gnu.org before changing it! - Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001,2002 - Free Software Foundation, Inc. + Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001,2002,2003,2004 + Free Software Foundation, Inc. This file is part of the GNU C Library. - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + This program 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. - The GNU C Library is distributed in the hope that it will be useful, + This program 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 - Lesser General Public License for more details. + 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 Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>. Ditto for AIX 3.2 and <stdlib.h>. */ @@ -31,35 +30,8 @@ # include <config.h> #endif -#if !defined __STDC__ || !__STDC__ -/* This is a separate conditional since some stdc systems - reject `defined (const)'. */ -# ifndef const -# define const -# endif -#endif - #include <stdio.h> -/* Comment out all this code if we are using the GNU C Library, and are not - actually compiling the library itself. This code is part of the GNU C - Library, but also included in many other GNU distributions. Compiling - and linking in this code is a waste when using the GNU C library - (especially if it is a shared library). Rather than having every GNU - program understand `configure --with-gnu-libc' and omit the object files, - it is simpler to just do this in the source for each such file. */ - -#define GETOPT_INTERFACE_VERSION 2 -#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 -# include <gnu-versions.h> -# if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION -# define ELIDE_CODE -# endif -#endif - -#ifndef ELIDE_CODE - - /* This needs to come after some library #include to get __GNU_LIBRARY__ defined. */ #ifdef __GNU_LIBRARY__ @@ -69,47 +41,43 @@ # include <unistd.h> #endif /* GNU C library. */ +#include <string.h> + #ifdef VMS # include <unixlib.h> -# if HAVE_STRING_H - 0 -# include <string.h> -# endif #endif -#ifndef _ -/* This is for other GNU distributions with internationalized messages. */ -# if (HAVE_LIBINTL_H && ENABLE_NLS) || defined _LIBC -# include <libintl.h> -# ifndef _ -# define _(msgid) gettext (msgid) -# endif -# else -# define _(msgid) (msgid) -# endif -# if defined _LIBC && defined USE_IN_LIBIO -# include <wchar.h> -# endif +#ifdef _LIBC +# include <libintl.h> +#else +# include "gettext.h" +# define _(msgid) gettext (msgid) +#endif + +#if defined _LIBC && defined USE_IN_LIBIO +# include <wchar.h> #endif #ifndef attribute_hidden # define attribute_hidden #endif -/* This version of `getopt' appears to the caller like standard Unix `getopt' - but it behaves differently for the user, since it allows the user - to intersperse the options with the other arguments. +/* Unlike standard Unix `getopt', functions like `getopt_long' + let the user intersperse the options with the other arguments. - As `getopt' works, it permutes the elements of ARGV so that, + As `getopt_long' works, it permutes the elements of ARGV so that, when it is done, all the options precede everything else. Thus all application programs are extended to handle flexible argument order. - Setting the environment variable POSIXLY_CORRECT disables permutation. - Then the behavior is completely standard. + Using `getopt' or setting the environment variable POSIXLY_CORRECT + disables permutation. + Then the application's behavior is completely standard. GNU application programs can use a third alternative mode in which they can distinguish the relative order of options and other arguments. */ #include "getopt.h" +#include "getopt_int.h" /* For communication from `getopt' to the caller. When `getopt' finds an option that takes an argument, @@ -134,21 +102,6 @@ char *optarg; /* 1003.2 says this must be 1 before any call. */ int optind = 1; -/* Formerly, initialization of getopt depended on optind==0, which - causes problems with re-calling getopt as programs generally don't - know that. */ - -int __getopt_initialized attribute_hidden; - -/* The next char to be scanned in the option-element - in which the last option character we returned was found. - This allows us to pick up the scan where we left off. - - If this is zero, or a null string, it means resume the scan - by advancing to the next ARGV-element. */ - -static char *nextchar; - /* Callers store zero here to inhibit the error message for unrecognized options. */ @@ -160,57 +113,12 @@ int opterr = 1; int optopt = '?'; -/* Describe how to deal with options that follow non-option ARGV-elements. +/* Keep a global copy of all internal members of getopt_data. */ - If the caller did not specify anything, - the default is REQUIRE_ORDER if the environment variable - POSIXLY_CORRECT is defined, PERMUTE otherwise. +static struct _getopt_data getopt_data; - REQUIRE_ORDER means don't recognize them as options; - stop option processing when the first non-option is seen. - This is what Unix does. - This mode of operation is selected by either setting the environment - variable POSIXLY_CORRECT, or using `+' as the first character - of the list of option characters. - - PERMUTE is the default. We permute the contents of ARGV as we scan, - so that eventually all the non-options are at the end. This allows options - to be given in any order, even with programs that were not written to - expect this. - - RETURN_IN_ORDER is an option available to programs that were written - to expect options and other ARGV-elements in any order and that care about - the ordering of the two. We describe each non-option ARGV-element - as if it were the argument of an option with character code 1. - Using `-' as the first character of the list of option characters - selects this mode of operation. - - The special argument `--' forces an end of option-scanning regardless - of the value of `ordering'. In the case of RETURN_IN_ORDER, only - `--' can cause `getopt' to return -1 with `optind' != ARGC. */ - -static enum -{ - REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER -} ordering; - -/* Value of POSIXLY_CORRECT environment variable. */ -static char *posixly_correct; -#ifdef __GNU_LIBRARY__ -/* We want to avoid inclusion of string.h with non-GNU libraries - because there are many ways it can cause trouble. - On some systems, it contains special magic macros that don't work - in GCC. */ -# include <string.h> -# define my_index strchr -#else - -# if HAVE_STRING_H -# include <string.h> -# else -# include <strings.h> -# endif +#ifndef __GNU_LIBRARY__ /* Avoid depending on library functions or files whose names are inconsistent. */ @@ -219,43 +127,8 @@ static char *posixly_correct; extern char *getenv (); #endif -static char * -my_index (str, chr) - const char *str; - int chr; -{ - while (*str) - { - if (*str == chr) - return (char *) str; - str++; - } - return 0; -} - -/* If using GCC, we can safely declare strlen this way. - If not using GCC, it is ok not to declare it. */ -#ifdef __GNUC__ -/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h. - That was relevant to code that was here before. */ -# if (!defined __STDC__ || !__STDC__) && !defined strlen -/* gcc with -traditional declares the built-in strlen to return int, - and has done so at least since version 2.4.5. -- rms. */ -extern int strlen (const char *); -# endif /* not __STDC__ */ -#endif /* __GNUC__ */ - #endif /* not __GNU_LIBRARY__ */ -/* Handle permutation of arguments. */ - -/* Describe the part of ARGV that contains non-options that have - been skipped. `first_nonopt' is the index in ARGV of the first of them; - `last_nonopt' is the index after the last of them. */ - -static int first_nonopt; -static int last_nonopt; - #ifdef _LIBC /* Stored original parameters. XXX This is no good solution. We should rather copy the args so @@ -269,14 +142,11 @@ extern char **__libc_argv; # ifdef USE_NONOPTION_FLAGS /* Defined in getopt_init.c */ extern char *__getopt_nonoption_flags; - -static int nonoption_flags_max_len; -static int nonoption_flags_len; # endif # ifdef USE_NONOPTION_FLAGS # define SWAP_FLAGS(ch1, ch2) \ - if (nonoption_flags_len > 0) \ + if (d->__nonoption_flags_len > 0) \ { \ char __tmp = __getopt_nonoption_flags[ch1]; \ __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \ @@ -298,17 +168,12 @@ static int nonoption_flags_len; `first_nonopt' and `last_nonopt' are relocated so that they describe the new indices of the non-options in ARGV after they are moved. */ -#if defined __STDC__ && __STDC__ -static void exchange (char **); -#endif - static void -exchange (argv) - char **argv; +exchange (char **argv, struct _getopt_data *d) { - int bottom = first_nonopt; - int middle = last_nonopt; - int top = optind; + int bottom = d->__first_nonopt; + int middle = d->__last_nonopt; + int top = d->optind; char *tem; /* Exchange the shorter segment with the far end of the longer segment. @@ -320,19 +185,19 @@ exchange (argv) /* First make sure the handling of the `__getopt_nonoption_flags' string can work normally. Our top argument must be in the range of the string. */ - if (nonoption_flags_len > 0 && top >= nonoption_flags_max_len) + if (d->__nonoption_flags_len > 0 && top >= d->__nonoption_flags_max_len) { /* We must extend the array. The user plays games with us and presents new arguments. */ char *new_str = malloc (top + 1); if (new_str == NULL) - nonoption_flags_len = nonoption_flags_max_len = 0; + d->__nonoption_flags_len = d->__nonoption_flags_max_len = 0; else { memset (__mempcpy (new_str, __getopt_nonoption_flags, - nonoption_flags_max_len), - '\0', top + 1 - nonoption_flags_max_len); - nonoption_flags_max_len = top + 1; + d->__nonoption_flags_max_len), + '\0', top + 1 - d->__nonoption_flags_max_len); + d->__nonoption_flags_max_len = top + 1; __getopt_nonoption_flags = new_str; } } @@ -378,76 +243,71 @@ exchange (argv) /* Update records for the slots the non-options now occupy. */ - first_nonopt += (optind - last_nonopt); - last_nonopt = optind; + d->__first_nonopt += (d->optind - d->__last_nonopt); + d->__last_nonopt = d->optind; } /* Initialize the internal data when the first call is made. */ -#if defined __STDC__ && __STDC__ -static const char *_getopt_initialize (int, char *const *, const char *); -#endif static const char * -_getopt_initialize (argc, argv, optstring) - int argc; - char *const *argv; - const char *optstring; +_getopt_initialize (int argc, char **argv, const char *optstring, + int posixly_correct, struct _getopt_data *d) { /* Start processing options with ARGV-element 1 (since ARGV-element 0 is the program name); the sequence of previously skipped non-option ARGV-elements is empty. */ - first_nonopt = last_nonopt = optind; + d->__first_nonopt = d->__last_nonopt = d->optind; - nextchar = NULL; + d->__nextchar = NULL; - posixly_correct = getenv ("POSIXLY_CORRECT"); + d->__posixly_correct = posixly_correct || !!getenv ("POSIXLY_CORRECT"); /* Determine how to handle the ordering of options and nonoptions. */ if (optstring[0] == '-') { - ordering = RETURN_IN_ORDER; + d->__ordering = RETURN_IN_ORDER; ++optstring; } else if (optstring[0] == '+') { - ordering = REQUIRE_ORDER; + d->__ordering = REQUIRE_ORDER; ++optstring; } - else if (posixly_correct != NULL) - ordering = REQUIRE_ORDER; + else if (d->__posixly_correct) + d->__ordering = REQUIRE_ORDER; else - ordering = PERMUTE; + d->__ordering = PERMUTE; #if defined _LIBC && defined USE_NONOPTION_FLAGS - if (posixly_correct == NULL + if (!d->__posixly_correct && argc == __libc_argc && argv == __libc_argv) { - if (nonoption_flags_max_len == 0) + if (d->__nonoption_flags_max_len == 0) { if (__getopt_nonoption_flags == NULL || __getopt_nonoption_flags[0] == '\0') - nonoption_flags_max_len = -1; + d->__nonoption_flags_max_len = -1; else { const char *orig_str = __getopt_nonoption_flags; - int len = nonoption_flags_max_len = strlen (orig_str); - if (nonoption_flags_max_len < argc) - nonoption_flags_max_len = argc; + int len = d->__nonoption_flags_max_len = strlen (orig_str); + if (d->__nonoption_flags_max_len < argc) + d->__nonoption_flags_max_len = argc; __getopt_nonoption_flags = - (char *) malloc (nonoption_flags_max_len); + (char *) malloc (d->__nonoption_flags_max_len); if (__getopt_nonoption_flags == NULL) - nonoption_flags_max_len = -1; + d->__nonoption_flags_max_len = -1; else memset (__mempcpy (__getopt_nonoption_flags, orig_str, len), - '\0', nonoption_flags_max_len - len); + '\0', d->__nonoption_flags_max_len - len); } } - nonoption_flags_len = nonoption_flags_max_len; + d->__nonoption_flags_len = d->__nonoption_flags_max_len; } else - nonoption_flags_len = 0; + d->__nonoption_flags_len = 0; #endif return optstring; @@ -495,10 +355,6 @@ _getopt_initialize (argc, argv, optstring) `flag' field is nonzero, the value of the option's `val' field if the `flag' field is zero. - The elements of ARGV aren't really const, because we permute them. - But we pretend they're const in the prototype to be compatible - with other systems. - LONGOPTS is a vector of `struct option' terminated by an element containing a name which is zero. @@ -507,32 +363,32 @@ _getopt_initialize (argc, argv, optstring) recent call. If LONG_ONLY is nonzero, '-' as well as '--' can introduce - long-named options. */ + long-named options. + + If POSIXLY_CORRECT is nonzero, behave as if the POSIXLY_CORRECT + environment variable were set. */ int -_getopt_internal (argc, argv, optstring, longopts, longind, long_only) - int argc; - char *const *argv; - const char *optstring; - const struct option *longopts; - int *longind; - int long_only; +_getopt_internal_r (int argc, char **argv, const char *optstring, + const struct option *longopts, int *longind, + int long_only, int posixly_correct, struct _getopt_data *d) { - int print_errors = opterr; + int print_errors = d->opterr; if (optstring[0] == ':') print_errors = 0; if (argc < 1) return -1; - optarg = NULL; + d->optarg = NULL; - if (optind == 0 || !__getopt_initialized) + if (d->optind == 0 || !d->__initialized) { - if (optind == 0) - optind = 1; /* Don't scan ARGV[0], the program name. */ - optstring = _getopt_initialize (argc, argv, optstring); - __getopt_initialized = 1; + if (d->optind == 0) + d->optind = 1; /* Don't scan ARGV[0], the program name. */ + optstring = _getopt_initialize (argc, argv, optstring, + posixly_correct, d); + d->__initialized = 1; } /* Test whether ARGV[optind] points to a non-option argument. @@ -540,40 +396,41 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) from the shell indicating it is not an option. The later information is only used when the used in the GNU libc. */ #if defined _LIBC && defined USE_NONOPTION_FLAGS -# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \ - || (optind < nonoption_flags_len \ - && __getopt_nonoption_flags[optind] == '1')) +# define NONOPTION_P (argv[d->optind][0] != '-' || argv[d->optind][1] == '\0' \ + || (d->optind < d->__nonoption_flags_len \ + && __getopt_nonoption_flags[d->optind] == '1')) #else -# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0') +# define NONOPTION_P (argv[d->optind][0] != '-' || argv[d->optind][1] == '\0') #endif - if (nextchar == NULL || *nextchar == '\0') + if (d->__nextchar == NULL || *d->__nextchar == '\0') { /* Advance to the next ARGV-element. */ /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been moved back by the user (who may also have changed the arguments). */ - if (last_nonopt > optind) - last_nonopt = optind; - if (first_nonopt > optind) - first_nonopt = optind; + if (d->__last_nonopt > d->optind) + d->__last_nonopt = d->optind; + if (d->__first_nonopt > d->optind) + d->__first_nonopt = d->optind; - if (ordering == PERMUTE) + if (d->__ordering == PERMUTE) { /* If we have just processed some options following some non-options, exchange them so that the options come first. */ - if (first_nonopt != last_nonopt && last_nonopt != optind) - exchange ((char **) argv); - else if (last_nonopt != optind) - first_nonopt = optind; + if (d->__first_nonopt != d->__last_nonopt + && d->__last_nonopt != d->optind) + exchange ((char **) argv, d); + else if (d->__last_nonopt != d->optind) + d->__first_nonopt = d->optind; /* Skip any additional non-options and extend the range of non-options previously skipped. */ - while (optind < argc && NONOPTION_P) - optind++; - last_nonopt = optind; + while (d->optind < argc && NONOPTION_P) + d->optind++; + d->__last_nonopt = d->optind; } /* The special ARGV-element `--' means premature end of options. @@ -581,28 +438,29 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) then exchange with previous non-options as if it were an option, then skip everything else like a non-option. */ - if (optind != argc && !strcmp (argv[optind], "--")) + if (d->optind != argc && !strcmp (argv[d->optind], "--")) { - optind++; + d->optind++; - if (first_nonopt != last_nonopt && last_nonopt != optind) - exchange ((char **) argv); - else if (first_nonopt == last_nonopt) - first_nonopt = optind; - last_nonopt = argc; + if (d->__first_nonopt != d->__last_nonopt + && d->__last_nonopt != d->optind) + exchange ((char **) argv, d); + else if (d->__first_nonopt == d->__last_nonopt) + d->__first_nonopt = d->optind; + d->__last_nonopt = argc; - optind = argc; + d->optind = argc; } /* If we have done all the ARGV-elements, stop the scan and back over any non-options that we skipped and permuted. */ - if (optind == argc) + if (d->optind == argc) { /* Set the next-arg-index to point at the non-options that we previously skipped, so the caller will digest them. */ - if (first_nonopt != last_nonopt) - optind = first_nonopt; + if (d->__first_nonopt != d->__last_nonopt) + d->optind = d->__first_nonopt; return -1; } @@ -611,17 +469,17 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) if (NONOPTION_P) { - if (ordering == REQUIRE_ORDER) + if (d->__ordering == REQUIRE_ORDER) return -1; - optarg = argv[optind++]; + d->optarg = argv[d->optind++]; return 1; } /* We have found another option-ARGV-element. Skip the initial punctuation. */ - nextchar = (argv[optind] + 1 - + (longopts != NULL && argv[optind][1] == '-')); + d->__nextchar = (argv[d->optind] + 1 + + (longopts != NULL && argv[d->optind][1] == '-')); } /* Decode the current option-ARGV-element. */ @@ -640,8 +498,9 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) This distinction seems to be the most useful approach. */ if (longopts != NULL - && (argv[optind][1] == '-' - || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1]))))) + && (argv[d->optind][1] == '-' + || (long_only && (argv[d->optind][2] + || !strchr (optstring, argv[d->optind][1]))))) { char *nameend; const struct option *p; @@ -651,15 +510,15 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) int indfound = -1; int option_index; - for (nameend = nextchar; *nameend && *nameend != '='; nameend++) + for (nameend = d->__nextchar; *nameend && *nameend != '='; nameend++) /* Do nothing. */ ; /* Test all long options for either exact match or abbreviated matches. */ for (p = longopts, option_index = 0; p->name; p++, option_index++) - if (!strncmp (p->name, nextchar, nameend - nextchar)) + if (!strncmp (p->name, d->__nextchar, nameend - d->__nextchar)) { - if ((unsigned int) (nameend - nextchar) + if ((unsigned int) (nameend - d->__nextchar) == (unsigned int) strlen (p->name)) { /* Exact match found. */ @@ -690,37 +549,44 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) char *buf; if (__asprintf (&buf, _("%s: option `%s' is ambiguous\n"), - argv[0], argv[optind]) >= 0) + argv[0], argv[d->optind]) >= 0) { + _IO_flockfile (stderr); + + int old_flags2 = ((_IO_FILE *) stderr)->_flags2; + ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); + ((_IO_FILE *) stderr)->_flags2 = old_flags2; + _IO_funlockfile (stderr); + free (buf); } #else fprintf (stderr, _("%s: option `%s' is ambiguous\n"), - argv[0], argv[optind]); + argv[0], argv[d->optind]); #endif } - nextchar += strlen (nextchar); - optind++; - optopt = 0; + d->__nextchar += strlen (d->__nextchar); + d->optind++; + d->optopt = 0; return '?'; } if (pfound != NULL) { option_index = indfound; - optind++; + d->optind++; if (*nameend) { /* Don't test has_arg with >, because some C compilers don't allow it to be used on enums. */ if (pfound->has_arg) - optarg = nameend + 1; + d->optarg = nameend + 1; else { if (print_errors) @@ -730,7 +596,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) int n; #endif - if (argv[optind - 1][1] == '-') + if (argv[d->optind - 1][1] == '-') { /* --option */ #if defined _LIBC && defined USE_IN_LIBIO @@ -749,38 +615,48 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) #if defined _LIBC && defined USE_IN_LIBIO n = __asprintf (&buf, _("\ %s: option `%c%s' doesn't allow an argument\n"), - argv[0], argv[optind - 1][0], + argv[0], argv[d->optind - 1][0], pfound->name); #else fprintf (stderr, _("\ %s: option `%c%s' doesn't allow an argument\n"), - argv[0], argv[optind - 1][0], pfound->name); + argv[0], argv[d->optind - 1][0], + pfound->name); #endif } #if defined _LIBC && defined USE_IN_LIBIO if (n >= 0) { + _IO_flockfile (stderr); + + int old_flags2 = ((_IO_FILE *) stderr)->_flags2; + ((_IO_FILE *) stderr)->_flags2 + |= _IO_FLAGS2_NOTCANCEL; + if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); + ((_IO_FILE *) stderr)->_flags2 = old_flags2; + _IO_funlockfile (stderr); + free (buf); } #endif } - nextchar += strlen (nextchar); + d->__nextchar += strlen (d->__nextchar); - optopt = pfound->val; + d->optopt = pfound->val; return '?'; } } else if (pfound->has_arg == 1) { - if (optind < argc) - optarg = argv[optind++]; + if (d->optind < argc) + d->optarg = argv[d->optind++]; else { if (print_errors) @@ -790,27 +666,36 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) if (__asprintf (&buf, _("\ %s: option `%s' requires an argument\n"), - argv[0], argv[optind - 1]) >= 0) + argv[0], argv[d->optind - 1]) >= 0) { + _IO_flockfile (stderr); + + int old_flags2 = ((_IO_FILE *) stderr)->_flags2; + ((_IO_FILE *) stderr)->_flags2 + |= _IO_FLAGS2_NOTCANCEL; + if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); + ((_IO_FILE *) stderr)->_flags2 = old_flags2; + _IO_funlockfile (stderr); + free (buf); } #else fprintf (stderr, _("%s: option `%s' requires an argument\n"), - argv[0], argv[optind - 1]); + argv[0], argv[d->optind - 1]); #endif } - nextchar += strlen (nextchar); - optopt = pfound->val; + d->__nextchar += strlen (d->__nextchar); + d->optopt = pfound->val; return optstring[0] == ':' ? ':' : '?'; } } - nextchar += strlen (nextchar); + d->__nextchar += strlen (d->__nextchar); if (longind != NULL) *longind = option_index; if (pfound->flag) @@ -825,8 +710,8 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) or the option starts with '--' or is not a valid short option, then it's an error. Otherwise interpret it as a short option. */ - if (!long_only || argv[optind][1] == '-' - || my_index (optstring, *nextchar) == NULL) + if (!long_only || argv[d->optind][1] == '-' + || strchr (optstring, *d->__nextchar) == NULL) { if (print_errors) { @@ -835,15 +720,15 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) int n; #endif - if (argv[optind][1] == '-') + if (argv[d->optind][1] == '-') { /* --option */ #if defined _LIBC && defined USE_IN_LIBIO n = __asprintf (&buf, _("%s: unrecognized option `--%s'\n"), - argv[0], nextchar); + argv[0], d->__nextchar); #else fprintf (stderr, _("%s: unrecognized option `--%s'\n"), - argv[0], nextchar); + argv[0], d->__nextchar); #endif } else @@ -851,28 +736,36 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) /* +option or -option */ #if defined _LIBC && defined USE_IN_LIBIO n = __asprintf (&buf, _("%s: unrecognized option `%c%s'\n"), - argv[0], argv[optind][0], nextchar); + argv[0], argv[d->optind][0], d->__nextchar); #else fprintf (stderr, _("%s: unrecognized option `%c%s'\n"), - argv[0], argv[optind][0], nextchar); + argv[0], argv[d->optind][0], d->__nextchar); #endif } #if defined _LIBC && defined USE_IN_LIBIO if (n >= 0) { + _IO_flockfile (stderr); + + int old_flags2 = ((_IO_FILE *) stderr)->_flags2; + ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; + if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); + ((_IO_FILE *) stderr)->_flags2 = old_flags2; + _IO_funlockfile (stderr); + free (buf); } #endif } - nextchar = (char *) ""; - optind++; - optopt = 0; + d->__nextchar = (char *) ""; + d->optind++; + d->optopt = 0; return '?'; } } @@ -880,12 +773,12 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) /* Look at and handle the next short option-character. */ { - char c = *nextchar++; - char *temp = my_index (optstring, c); + char c = *d->__nextchar++; + char *temp = strchr (optstring, c); /* Increment `optind' when we start to process its last character. */ - if (*nextchar == '\0') - ++optind; + if (*d->__nextchar == '\0') + ++d->optind; if (temp == NULL || c == ':') { @@ -896,7 +789,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) int n; #endif - if (posixly_correct) + if (d->__posixly_correct) { /* 1003.2 specifies the format of this message. */ #if defined _LIBC && defined USE_IN_LIBIO @@ -919,16 +812,24 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) #if defined _LIBC && defined USE_IN_LIBIO if (n >= 0) { + _IO_flockfile (stderr); + + int old_flags2 = ((_IO_FILE *) stderr)->_flags2; + ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; + if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); + ((_IO_FILE *) stderr)->_flags2 = old_flags2; + _IO_funlockfile (stderr); + free (buf); } #endif } - optopt = c; + d->optopt = c; return '?'; } /* Convenience. Treat POSIX -W foo same as long option --foo */ @@ -943,14 +844,14 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) int option_index; /* This is an option that requires an argument. */ - if (*nextchar != '\0') + if (*d->__nextchar != '\0') { - optarg = nextchar; + d->optarg = d->__nextchar; /* If we end this ARGV-element by taking the rest as an arg, we must advance to the next element now. */ - optind++; + d->optind++; } - else if (optind == argc) + else if (d->optind == argc) { if (print_errors) { @@ -962,11 +863,19 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) _("%s: option requires an argument -- %c\n"), argv[0], c) >= 0) { + _IO_flockfile (stderr); + + int old_flags2 = ((_IO_FILE *) stderr)->_flags2; + ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; + if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); + ((_IO_FILE *) stderr)->_flags2 = old_flags2; + _IO_funlockfile (stderr); + free (buf); } #else @@ -974,7 +883,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) argv[0], c); #endif } - optopt = c; + d->optopt = c; if (optstring[0] == ':') c = ':'; else @@ -982,22 +891,23 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) return c; } else - /* We already incremented `optind' once; + /* We already incremented `d->optind' once; increment it again when taking next ARGV-elt as argument. */ - optarg = argv[optind++]; + d->optarg = argv[d->optind++]; /* optarg is now the argument, see if it's in the table of longopts. */ - for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++) + for (d->__nextchar = nameend = d->optarg; *nameend && *nameend != '='; + nameend++) /* Do nothing. */ ; /* Test all long options for either exact match or abbreviated matches. */ for (p = longopts, option_index = 0; p->name; p++, option_index++) - if (!strncmp (p->name, nextchar, nameend - nextchar)) + if (!strncmp (p->name, d->__nextchar, nameend - d->__nextchar)) { - if ((unsigned int) (nameend - nextchar) == strlen (p->name)) + if ((unsigned int) (nameend - d->__nextchar) == strlen (p->name)) { /* Exact match found. */ pfound = p; @@ -1023,22 +933,30 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) char *buf; if (__asprintf (&buf, _("%s: option `-W %s' is ambiguous\n"), - argv[0], argv[optind]) >= 0) + argv[0], argv[d->optind]) >= 0) { + _IO_flockfile (stderr); + + int old_flags2 = ((_IO_FILE *) stderr)->_flags2; + ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; + if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); + ((_IO_FILE *) stderr)->_flags2 = old_flags2; + _IO_funlockfile (stderr); + free (buf); } #else fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"), - argv[0], argv[optind]); + argv[0], argv[d->optind]); #endif } - nextchar += strlen (nextchar); - optind++; + d->__nextchar += strlen (d->__nextchar); + d->optind++; return '?'; } if (pfound != NULL) @@ -1049,7 +967,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) /* Don't test has_arg with >, because some C compilers don't allow it to be used on enums. */ if (pfound->has_arg) - optarg = nameend + 1; + d->optarg = nameend + 1; else { if (print_errors) @@ -1061,11 +979,20 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) %s: option `-W %s' doesn't allow an argument\n"), argv[0], pfound->name) >= 0) { + _IO_flockfile (stderr); + + int old_flags2 = ((_IO_FILE *) stderr)->_flags2; + ((_IO_FILE *) stderr)->_flags2 + |= _IO_FLAGS2_NOTCANCEL; + if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); + ((_IO_FILE *) stderr)->_flags2 = old_flags2; + _IO_funlockfile (stderr); + free (buf); } #else @@ -1075,14 +1002,14 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) #endif } - nextchar += strlen (nextchar); + d->__nextchar += strlen (d->__nextchar); return '?'; } } else if (pfound->has_arg == 1) { - if (optind < argc) - optarg = argv[optind++]; + if (d->optind < argc) + d->optarg = argv[d->optind++]; else { if (print_errors) @@ -1092,26 +1019,35 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) if (__asprintf (&buf, _("\ %s: option `%s' requires an argument\n"), - argv[0], argv[optind - 1]) >= 0) + argv[0], argv[d->optind - 1]) >= 0) { + _IO_flockfile (stderr); + + int old_flags2 = ((_IO_FILE *) stderr)->_flags2; + ((_IO_FILE *) stderr)->_flags2 + |= _IO_FLAGS2_NOTCANCEL; + if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); + ((_IO_FILE *) stderr)->_flags2 = old_flags2; + _IO_funlockfile (stderr); + free (buf); } #else fprintf (stderr, _("%s: option `%s' requires an argument\n"), - argv[0], argv[optind - 1]); + argv[0], argv[d->optind - 1]); #endif } - nextchar += strlen (nextchar); + d->__nextchar += strlen (d->__nextchar); return optstring[0] == ':' ? ':' : '?'; } } - nextchar += strlen (nextchar); + d->__nextchar += strlen (d->__nextchar); if (longind != NULL) *longind = option_index; if (pfound->flag) @@ -1121,7 +1057,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) } return pfound->val; } - nextchar = NULL; + d->__nextchar = NULL; return 'W'; /* Let the application handle it. */ } if (temp[1] == ':') @@ -1129,26 +1065,26 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) if (temp[2] == ':') { /* This is an option that accepts an argument optionally. */ - if (*nextchar != '\0') + if (*d->__nextchar != '\0') { - optarg = nextchar; - optind++; + d->optarg = d->__nextchar; + d->optind++; } else - optarg = NULL; - nextchar = NULL; + d->optarg = NULL; + d->__nextchar = NULL; } else { /* This is an option that requires an argument. */ - if (*nextchar != '\0') + if (*d->__nextchar != '\0') { - optarg = nextchar; + d->optarg = d->__nextchar; /* If we end this ARGV-element by taking the rest as an arg, we must advance to the next element now. */ - optind++; + d->optind++; } - else if (optind == argc) + else if (d->optind == argc) { if (print_errors) { @@ -1160,11 +1096,19 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) %s: option requires an argument -- %c\n"), argv[0], c) >= 0) { + _IO_flockfile (stderr); + + int old_flags2 = ((_IO_FILE *) stderr)->_flags2; + ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; + if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else fputs (buf, stderr); + ((_IO_FILE *) stderr)->_flags2 = old_flags2; + _IO_funlockfile (stderr); + free (buf); } #else @@ -1173,7 +1117,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) argv[0], c); #endif } - optopt = c; + d->optopt = c; if (optstring[0] == ':') c = ':'; else @@ -1182,8 +1126,8 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) else /* We already incremented `optind' once; increment it again when taking next ARGV-elt as argument. */ - optarg = argv[optind++]; - nextchar = NULL; + d->optarg = argv[d->optind++]; + d->__nextchar = NULL; } } return c; @@ -1191,18 +1135,40 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) } int -getopt (argc, argv, optstring) - int argc; - char *const *argv; - const char *optstring; +_getopt_internal (int argc, char **argv, const char *optstring, + const struct option *longopts, int *longind, + int long_only, int posixly_correct) +{ + int result; + + getopt_data.optind = optind; + getopt_data.opterr = opterr; + + result = _getopt_internal_r (argc, argv, optstring, longopts, longind, + long_only, posixly_correct, &getopt_data); + + optind = getopt_data.optind; + optarg = getopt_data.optarg; + optopt = getopt_data.optopt; + + return result; +} + +/* glibc gets a LSB-compliant getopt. + Standalone applications get a POSIX-compliant getopt. */ +#if _LIBC +enum { POSIXLY_CORRECT = 0 }; +#else +enum { POSIXLY_CORRECT = 1 }; +#endif + +int +getopt (int argc, char *const *argv, const char *optstring) { - return _getopt_internal (argc, argv, optstring, - (const struct option *) 0, - (int *) 0, - 0); + return _getopt_internal (argc, (char **) argv, optstring, NULL, NULL, 0, + POSIXLY_CORRECT); } -#endif /* Not ELIDE_CODE. */ #ifdef TEST @@ -1210,9 +1176,7 @@ getopt (argc, argv, optstring) the above definition of `getopt'. */ int -main (argc, argv) - int argc; - char **argv; +main (int argc, char **argv) { int c; int digit_optind = 0; diff --git a/contrib/groff/src/libs/libgroff/getopt1.c b/contrib/groff/src/libs/libgroff/getopt1.c index 22a7efb..5acd224 100644 --- a/contrib/groff/src/libs/libgroff/getopt1.c +++ b/contrib/groff/src/libs/libgroff/getopt1.c @@ -1,58 +1,35 @@ /* getopt_long and getopt_long_only entry points for GNU getopt. - Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98 + Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98,2004 Free Software Foundation, Inc. This file is part of the GNU C Library. - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + This program 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. - The GNU C Library is distributed in the hope that it will be useful, + This program 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 - Lesser General Public License for more details. + 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 Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H #include <config.h> #endif -#include "getopt.h" - -#if !defined __STDC__ || !__STDC__ -/* This is a separate conditional since some stdc systems - reject `defined (const)'. */ -#ifndef const -#define const -#endif +#ifdef _LIBC +# include <getopt.h> +#else +# include "getopt.h" #endif +#include "getopt_int.h" #include <stdio.h> -/* Comment out all this code if we are using the GNU C Library, and are not - actually compiling the library itself. This code is part of the GNU C - Library, but also included in many other GNU distributions. Compiling - and linking in this code is a waste when using the GNU C library - (especially if it is a shared library). Rather than having every GNU - program understand `configure --with-gnu-libc' and omit the object files, - it is simpler to just do this in the source for each such file. */ - -#define GETOPT_INTERFACE_VERSION 2 -#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 -#include <gnu-versions.h> -#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION -#define ELIDE_CODE -#endif -#endif - -#ifndef ELIDE_CODE - - /* This needs to come after some library #include to get __GNU_LIBRARY__ defined. */ #ifdef __GNU_LIBRARY__ @@ -64,14 +41,20 @@ #endif int -getopt_long (argc, argv, options, long_options, opt_index) - int argc; - char *const *argv; - const char *options; - const struct option *long_options; - int *opt_index; +getopt_long (int argc, char *__getopt_argv_const *argv, const char *options, + const struct option *long_options, int *opt_index) { - return _getopt_internal (argc, argv, options, long_options, opt_index, 0); + return _getopt_internal (argc, (char **) argv, options, long_options, + opt_index, 0, 0); +} + +int +_getopt_long_r (int argc, char **argv, const char *options, + const struct option *long_options, int *opt_index, + struct _getopt_data *d) +{ + return _getopt_internal_r (argc, argv, options, long_options, opt_index, + 0, 0, d); } /* Like getopt_long, but '-' as well as '--' can indicate a long option. @@ -80,27 +63,30 @@ getopt_long (argc, argv, options, long_options, opt_index) instead. */ int -getopt_long_only (argc, argv, options, long_options, opt_index) - int argc; - char *const *argv; - const char *options; - const struct option *long_options; - int *opt_index; +getopt_long_only (int argc, char *__getopt_argv_const *argv, + const char *options, + const struct option *long_options, int *opt_index) { - return _getopt_internal (argc, argv, options, long_options, opt_index, 1); + return _getopt_internal (argc, (char **) argv, options, long_options, + opt_index, 1, 0); } +int +_getopt_long_only_r (int argc, char **argv, const char *options, + const struct option *long_options, int *opt_index, + struct _getopt_data *d) +{ + return _getopt_internal_r (argc, argv, options, long_options, opt_index, + 1, 0, d); +} -#endif /* Not ELIDE_CODE. */ #ifdef TEST #include <stdio.h> int -main (argc, argv) - int argc; - char **argv; +main (int argc, char **argv) { int c; int digit_optind = 0; diff --git a/contrib/groff/src/libs/libgroff/glyphuni.cpp b/contrib/groff/src/libs/libgroff/glyphuni.cpp new file mode 100644 index 0000000..4cd4917 --- /dev/null +++ b/contrib/groff/src/libs/libgroff/glyphuni.cpp @@ -0,0 +1,504 @@ +// -*- C++ -*- +/* Copyright (C) 2002, 2003, 2004 + Free Software Foundation, Inc. + Written by Werner Lemberg <wl@gnu.org> + +This file is part of groff. + +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, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include "lib.h" +#include "stringclass.h" +#include "ptable.h" + +#include "unicode.h" + +struct glyph_to_unicode { + char *value; +}; + +declare_ptable(glyph_to_unicode) +implement_ptable(glyph_to_unicode) + +PTABLE(glyph_to_unicode) glyph_to_unicode_table; + +struct S { + const char *key; + const char *value; +} glyph_to_unicode_list[] = { + { "!", "0021" }, + { "\"", "0022" }, + { "dq", "0022" }, + { "#", "0023" }, + { "sh", "0023" }, + { "$", "0024" }, + { "Do", "0024" }, + { "%", "0025" }, + { "&", "0026" }, + { "aq", "0027" }, + { "(", "0028" }, + { ")", "0029" }, + { "*", "002A" }, + { "+", "002B" }, + { "pl", "002B" }, + { ",", "002C" }, + { ".", "002E" }, + { "/", "002F" }, + { "sl", "002F" }, + { "0", "0030" }, + { "1", "0031" }, + { "2", "0032" }, + { "3", "0033" }, + { "4", "0034" }, + { "5", "0035" }, + { "6", "0036" }, + { "7", "0037" }, + { "8", "0038" }, + { "9", "0039" }, + { ":", "003A" }, + { ";", "003B" }, + { "<", "003C" }, + { "=", "003D" }, + { "eq", "003D" }, + { ">", "003E" }, + { "?", "003F" }, + { "@", "0040" }, + { "at", "0040" }, + { "A", "0041" }, + { "B", "0042" }, + { "C", "0043" }, + { "D", "0044" }, + { "E", "0045" }, + { "F", "0046" }, + { "G", "0047" }, + { "H", "0048" }, + { "I", "0049" }, + { "J", "004A" }, + { "K", "004B" }, + { "L", "004C" }, + { "M", "004D" }, + { "N", "004E" }, + { "O", "004F" }, + { "P", "0050" }, + { "Q", "0051" }, + { "R", "0052" }, + { "S", "0053" }, + { "T", "0054" }, + { "U", "0055" }, + { "V", "0056" }, + { "W", "0057" }, + { "X", "0058" }, + { "Y", "0059" }, + { "Z", "005A" }, +//{ "[", "005B" }, + { "lB", "005B" }, +//{ "\\", "005C" }, + { "rs", "005C" }, +//{ "]", "005D" }, + { "rB", "005D" }, + { "a^", "005E" }, + { "^", "005E" }, + { "ha", "005E" }, + { "_", "005F" }, + { "ru", "005F" }, + { "ul", "005F" }, +//{ "\\`", "0060" }, + { "ga", "0060" }, + { "a", "0061" }, + { "b", "0062" }, + { "c", "0063" }, + { "d", "0064" }, + { "e", "0065" }, + { "f", "0066" }, + { "ff", "0066_0066" }, + { "Fi", "0066_0066_0069" }, + { "Fl", "0066_0066_006C" }, + { "fi", "0066_0069" }, + { "fl", "0066_006C" }, + { "g", "0067" }, + { "h", "0068" }, + { "i", "0069" }, + { "j", "006A" }, + { "k", "006B" }, + { "l", "006C" }, + { "m", "006D" }, + { "n", "006E" }, + { "o", "006F" }, + { "p", "0070" }, + { "q", "0071" }, + { "r", "0072" }, + { "s", "0073" }, + { "t", "0074" }, + { "u", "0075" }, + { "v", "0076" }, + { "w", "0077" }, + { "x", "0078" }, + { "y", "0079" }, + { "z", "007A" }, + { "lC", "007B" }, + { "{", "007B" }, + { "ba", "007C" }, + { "or", "007C" }, + { "|", "007C" }, + { "rC", "007D" }, + { "}", "007D" }, + { "a~", "007E" }, + { "~", "007E" }, + { "ti", "007E" }, + { "r!", "00A1" }, + { "ct", "00A2" }, + { "Po", "00A3" }, + { "Cs", "00A4" }, + { "Ye", "00A5" }, + { "bb", "00A6" }, + { "sc", "00A7" }, + { "ad", "00A8" }, + { "co", "00A9" }, + { "Of", "00AA" }, + { "Fo", "00AB" }, + { "no", "00AC" }, + { "tno", "00AC" }, + { "shc", "00AD" }, + { "rg", "00AE" }, + { "a-", "00AF" }, + { "de", "00B0" }, + { "+-", "00B1" }, + { "t+-", "00B1" }, + { "S2", "00B2" }, + { "S3", "00B3" }, + { "aa", "00B4" }, +//{ "\\'", "00B4" }, + { "mc", "00B5" }, + { "ps", "00B6" }, + { "pc", "00B7" }, + { "ac", "00B8" }, + { "S1", "00B9" }, + { "Om", "00BA" }, + { "Fc", "00BB" }, + { "14", "00BC" }, + { "12", "00BD" }, + { "34", "00BE" }, + { "r?", "00BF" }, + { "`A", "00C0" }, + { "'A", "00C1" }, + { "^A", "00C2" }, + { "~A", "00C3" }, + { ":A", "00C4" }, + { "oA", "00C5" }, + { "AE", "00C6" }, + { ",C", "00C7" }, + { "`E", "00C8" }, + { "'E", "00C9" }, + { "^E", "00CA" }, + { ":E", "00CB" }, + { "`I", "00CC" }, + { "'I", "00CD" }, + { "^I", "00CE" }, + { ":I", "00CF" }, + { "-D", "00D0" }, + { "~N", "00D1" }, + { "`O", "00D2" }, + { "'O", "00D3" }, + { "^O", "00D4" }, + { "~O", "00D5" }, + { ":O", "00D6" }, + { "mu", "00D7" }, + { "tmu", "00D7" }, + { "/O", "00D8" }, + { "`U", "00D9" }, + { "'U", "00DA" }, + { "^U", "00DB" }, + { ":U", "00DC" }, + { "'Y", "00DD" }, + { "TP", "00DE" }, + { "ss", "00DF" }, + { "`a", "00E0" }, + { "'a", "00E1" }, + { "^a", "00E2" }, + { "~a", "00E3" }, + { ":a", "00E4" }, + { "oa", "00E5" }, + { "ae", "00E6" }, + { ",c", "00E7" }, + { "`e", "00E8" }, + { "'e", "00E9" }, + { "^e", "00EA" }, + { ":e", "00EB" }, + { "`i", "00EC" }, + { "'i", "00ED" }, + { "^i", "00EE" }, + { ":i", "00EF" }, + { "Sd", "00F0" }, + { "~n", "00F1" }, + { "`o", "00F2" }, + { "'o", "00F3" }, + { "^o", "00F4" }, + { "~o", "00F5" }, + { ":o", "00F6" }, + { "di", "00F7" }, + { "tdi", "00F7" }, + { "/o", "00F8" }, + { "`u", "00F9" }, + { "'u", "00FA" }, + { "^u", "00FB" }, + { ":u", "00FC" }, + { "'y", "00FD" }, + { "Tp", "00FE" }, + { ":y", "00FF" }, + { "'C", "0106" }, + { "'c", "0107" }, + { ".i", "0131" }, + { "IJ", "0132" }, + { "ij", "0133" }, + { "/L", "0141" }, + { "/l", "0142" }, + { "OE", "0152" }, + { "oe", "0153" }, + { "vS", "0160" }, + { "vs", "0161" }, + { ":Y", "0178" }, + { "vZ", "017D" }, + { "vz", "017E" }, + { "Fn", "0192" }, + { "ah", "02C7" }, + { "ab", "02D8" }, + { "a.", "02D9" }, + { "ao", "02DA" }, + { "ho", "02DB" }, + { "a\"", "02DD" }, + { "*A", "0391" }, + { "*B", "0392" }, + { "*G", "0393" }, + { "*D", "0394" }, + { "*E", "0395" }, + { "*Z", "0396" }, + { "*Y", "0397" }, + { "*H", "0398" }, + { "*I", "0399" }, + { "*K", "039A" }, + { "*L", "039B" }, + { "*M", "039C" }, + { "*N", "039D" }, + { "*C", "039E" }, + { "*O", "039F" }, + { "*P", "03A0" }, + { "*R", "03A1" }, + { "*S", "03A3" }, + { "*T", "03A4" }, + { "*U", "03A5" }, + { "*F", "03A6" }, + { "*X", "03A7" }, + { "*Q", "03A8" }, + { "*W", "03A9" }, + { "*a", "03B1" }, + { "*b", "03B2" }, + { "*g", "03B3" }, + { "*d", "03B4" }, + { "*e", "03B5" }, + { "*z", "03B6" }, + { "*y", "03B7" }, + { "*h", "03B8" }, + { "*i", "03B9" }, + { "*k", "03BA" }, + { "*l", "03BB" }, + { "*m", "03BC" }, + { "*n", "03BD" }, + { "*c", "03BE" }, + { "*o", "03BF" }, + { "*p", "03C0" }, + { "*r", "03C1" }, + { "ts", "03C2" }, + { "*s", "03C3" }, + { "*t", "03C4" }, + { "*u", "03C5" }, + { "*f", "03C6" }, + { "*x", "03C7" }, + { "*q", "03C8" }, + { "*w", "03C9" }, + { "+h", "03D1" }, + { "+f", "03D5" }, + { "+p", "03D6" }, + { "+e", "03F5" }, + { "-", "2010" }, + { "hy", "2010" }, + { "en", "2013" }, + { "em", "2014" }, + { "`", "2018" }, + { "oq", "2018" }, + { "'", "2019" }, + { "cq", "2019" }, + { "bq", "201A" }, + { "lq", "201C" }, + { "rq", "201D" }, + { "Bq", "201E" }, + { "dg", "2020" }, + { "dd", "2021" }, + { "bu", "2022" }, + { "%0", "2030" }, + { "fm", "2032" }, + { "sd", "2033" }, + { "fo", "2039" }, + { "fc", "203A" }, + { "rn", "203E" }, + { "f/", "2044" }, + { "eu", "20AC" }, + { "Eu", "20AC" }, + { "-h", "210F" }, + { "hbar", "210F" }, + { "Im", "2111" }, + { "wp", "2118" }, + { "Re", "211C" }, + { "tm", "2122" }, + { "Ah", "2135" }, + { "18", "215B" }, + { "38", "215C" }, + { "58", "215D" }, + { "78", "215E" }, + { "<-", "2190" }, + { "ua", "2191" }, + { "->", "2192" }, + { "da", "2193" }, + { "<>", "2194" }, + { "va", "2195" }, + { "CR", "21B5" }, + { "lA", "21D0" }, + { "uA", "21D1" }, + { "rA", "21D2" }, + { "dA", "21D3" }, + { "hA", "21D4" }, + { "vA", "21D5" }, + { "fa", "2200" }, + { "pd", "2202" }, + { "te", "2203" }, + { "es", "2205" }, + { "gr", "2207" }, + { "mo", "2208" }, + { "nm", "2209" }, + { "st", "220B" }, + { "product", "220F" }, + { "coproduct", "2210" }, + { "sum", "2211" }, +//{ "\\-", "2212" }, + { "mi", "2212" }, + { "-+", "2213" }, + { "**", "2217" }, + { "sr", "221A" }, + { "pt", "221D" }, + { "if", "221E" }, + { "/_", "2220" }, + { "AN", "2227" }, + { "OR", "2228" }, + { "ca", "2229" }, + { "cu", "222A" }, + { "is", "222B" }, + { "integral", "222B" }, + { "tf", "2234" }, + { "3d", "2234" }, + { "ap", "223C" }, + { "|=", "2243" }, + { "=~", "2245" }, + { "~~", "2248" }, + { "~=", "2248" }, + { "!=", "2260" }, + { "==", "2261" }, + { "ne", "2262" }, + { "<=", "2264" }, + { ">=", "2265" }, + { ">>", "226A" }, + { "<<", "226B" }, + { "sb", "2282" }, + { "sp", "2283" }, + { "nb", "2284" }, + { "nc", "2285" }, + { "ib", "2286" }, + { "ip", "2287" }, + { "c+", "2295" }, + { "c*", "2297" }, + { "pp", "22A5" }, + { "md", "22C5" }, + { "lc", "2308" }, + { "rc", "2309" }, + { "lf", "230A" }, + { "rf", "230B" }, + { "parenlefttp", "239B" }, + { "parenleftex", "239C" }, + { "parenleftbt", "239D" }, + { "parenrighttp", "239E" }, + { "parenrightex", "239F" }, + { "parenrightbt", "23A0" }, + { "bracketlefttp", "23A1" }, + { "bracketleftex", "23A2" }, + { "bracketleftbt", "23A3" }, + { "bracketrighttp", "23A4" }, + { "bracketrightex", "23A5" }, + { "bracketrightbt", "23A6" }, + { "lt", "23A7" }, + { "bracelefttp", "23A7" }, + { "lk", "23A8" }, + { "braceleftmid", "23A8" }, + { "lb", "23A9" }, + { "braceleftbt", "23A9" }, + { "bv", "23AA" }, + { "braceex", "23AA" }, + { "braceleftex", "23AA" }, + { "bracerightex", "23AA" }, + { "rt", "23AB" }, + { "bracerighttp", "23AB" }, + { "rk", "23AC" }, + { "bracerightmid", "23AC" }, + { "rb", "23AD" }, + { "bracerightbt", "23AD" }, + { "an", "23AF" }, + { "br", "2502" }, + { "rk", "251D" }, + { "lk", "2525" }, + { "lt", "256D" }, + { "rt", "256E" }, + { "rb", "256F" }, + { "lb", "2570" }, + { "sq", "25A1" }, + { "lz", "25CA" }, + { "ci", "25CB" }, + { "lh", "261C" }, + { "rh", "261E" }, + { "SP", "2660" }, + { "CL", "2663" }, + { "HE", "2665" }, + { "DI", "2666" }, + { "OK", "2713" }, + { "la", "27E8" }, + { "ra", "27E9" }, +}; + +// global constructor +static struct glyph_to_unicode_init { + glyph_to_unicode_init(); +} _glyph_to_unicode_init; + +glyph_to_unicode_init::glyph_to_unicode_init() { + for (unsigned int i = 0; + i < sizeof(glyph_to_unicode_list)/sizeof(glyph_to_unicode_list[0]); + i++) { + glyph_to_unicode *gtu = new glyph_to_unicode[1]; + gtu->value = (char *)glyph_to_unicode_list[i].value; + glyph_to_unicode_table.define(glyph_to_unicode_list[i].key, gtu); + } +} + +const char *glyph_name_to_unicode(const char *s) +{ + glyph_to_unicode *result = glyph_to_unicode_table.lookup(s); + return result ? result->value : 0; +} diff --git a/contrib/groff/src/libs/libgroff/htmlhint.cpp b/contrib/groff/src/libs/libgroff/htmlhint.cpp index 3015767..6ade077 100644 --- a/contrib/groff/src/libs/libgroff/htmlhint.cpp +++ b/contrib/groff/src/libs/libgroff/htmlhint.cpp @@ -15,7 +15,7 @@ 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. */ +Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "lib.h" diff --git a/contrib/groff/src/libs/libgroff/hypot.cpp b/contrib/groff/src/libs/libgroff/hypot.cpp new file mode 100644 index 0000000..6d2606d --- /dev/null +++ b/contrib/groff/src/libs/libgroff/hypot.cpp @@ -0,0 +1,40 @@ +/* Copyright (C) 2005 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <math.h> + +#ifdef NEED_DECLARATION_HYPOT + double hypot(double, double); +#endif /* NEED_DECLARATION_HYPOT */ + +double groff_hypot(double x, double y) +{ + double result = hypot(x, y); + +#ifdef __INTERIX + /* hypot() on Interix is broken */ + if (isnan(result) && !isnan(x) && !isnan(y)) + return 0.0; +#endif + + return result; +} diff --git a/contrib/groff/src/libs/libgroff/iftoa.c b/contrib/groff/src/libs/libgroff/iftoa.c index 29a3d89..d1751c57c 100644 --- a/contrib/groff/src/libs/libgroff/iftoa.c +++ b/contrib/groff/src/libs/libgroff/iftoa.c @@ -1,4 +1,5 @@ -/* Copyright (C) 1989, 1990, 1991, 1992, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2004 + Free Software Foundation, Inc. Written by James Clark (jjc@jclark.com) This file is part of groff. @@ -15,12 +16,15 @@ 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. */ +Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ #define INT_DIGITS 19 /* enough for 64-bit integer */ -char *if_to_a(i, decimal_point) - int i, decimal_point; +#ifdef __cplusplus +extern "C" { +#endif + +char *if_to_a(int i, int decimal_point) { /* room for a -, INT_DIGITS digits, a decimal point, and a terminating '\0' */ static char buf[INT_DIGITS + 3]; @@ -63,3 +67,7 @@ char *if_to_a(i, decimal_point) } return p; } + +#ifdef __cplusplus +} +#endif diff --git a/contrib/groff/src/libs/libgroff/invalid.cpp b/contrib/groff/src/libs/libgroff/invalid.cpp index f36894a..959aef9 100644 --- a/contrib/groff/src/libs/libgroff/invalid.cpp +++ b/contrib/groff/src/libs/libgroff/invalid.cpp @@ -15,7 +15,7 @@ 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. */ +Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "lib.h" diff --git a/contrib/groff/src/libs/libgroff/itoa.c b/contrib/groff/src/libs/libgroff/itoa.c index 245c7df..85fb68b 100644 --- a/contrib/groff/src/libs/libgroff/itoa.c +++ b/contrib/groff/src/libs/libgroff/itoa.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2002 +/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2002, 2004 Free Software Foundation, Inc. Written by James Clark (jjc@jclark.com) @@ -16,13 +16,16 @@ 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. */ +Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ #define INT_DIGITS 19 /* enough for 64 bit integer */ #define UINT_DIGITS 20 -char *i_to_a(i) - int i; +#ifdef __cplusplus +extern "C" { +#endif + +char *i_to_a(int i) { /* Room for INT_DIGITS digits, - and '\0' */ static char buf[INT_DIGITS + 2]; @@ -44,8 +47,7 @@ char *i_to_a(i) return p; } -char *ui_to_a(i) - unsigned int i; +char *ui_to_a(unsigned int i) { /* Room for UINT_DIGITS digits and '\0' */ static char buf[UINT_DIGITS + 1]; @@ -56,3 +58,7 @@ char *ui_to_a(i) } while (i != 0); return p; } + +#ifdef __cplusplus +} +#endif diff --git a/contrib/groff/src/libs/libgroff/lf.cpp b/contrib/groff/src/libs/libgroff/lf.cpp index 34272c7..3254fcf 100644 --- a/contrib/groff/src/libs/libgroff/lf.cpp +++ b/contrib/groff/src/libs/libgroff/lf.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -/* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc. +/* Copyright (C) 1989, 1990, 1991, 1992, 2004 Free Software Foundation, Inc. Written by James Clark (jjc@jclark.com) This file is part of groff. @@ -16,10 +16,11 @@ 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. */ +Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include <string.h> #include <ctype.h> + +#include "lib.h" #include "cset.h" #include "stringclass.h" diff --git a/contrib/groff/src/libs/libgroff/macropath.cpp b/contrib/groff/src/libs/libgroff/macropath.cpp index 03c04cb..2c09fd7 100644 --- a/contrib/groff/src/libs/libgroff/macropath.cpp +++ b/contrib/groff/src/libs/libgroff/macropath.cpp @@ -16,7 +16,7 @@ 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. */ +Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "lib.h" #include "searchpath.h" diff --git a/contrib/groff/src/libs/libgroff/matherr.c b/contrib/groff/src/libs/libgroff/matherr.c index 757a540..2a65e18 100644 --- a/contrib/groff/src/libs/libgroff/matherr.c +++ b/contrib/groff/src/libs/libgroff/matherr.c @@ -15,7 +15,7 @@ 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. */ +Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H #include <config.h> diff --git a/contrib/groff/src/libs/libgroff/maxfilename.cpp b/contrib/groff/src/libs/libgroff/maxfilename.cpp index 25f5549..9215cd9 100644 --- a/contrib/groff/src/libs/libgroff/maxfilename.cpp +++ b/contrib/groff/src/libs/libgroff/maxfilename.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -/* Copyright (C) 1992, 2001, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1992, 2001, 2003, 2005 Free Software Foundation, Inc. Written by James Clark (jjc@jclark.com) This file is part of groff. @@ -16,7 +16,7 @@ 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. */ +Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ /* file_name_max(dir) does the same as pathconf(dir, _PC_NAME_MAX) */ @@ -37,10 +37,6 @@ size_t file_name_max(const char *fname) #else /* not _POSIX_VERSION */ -#ifdef HAVE_CC_LIMITS_H -#include <limits.h> -#endif /* HAVE_CC_LIMITS_H */ - #ifdef HAVE_DIRENT_H #include <dirent.h> #else /* not HAVE_DIRENT_H */ diff --git a/contrib/groff/src/libs/libgroff/maxpathname.cpp b/contrib/groff/src/libs/libgroff/maxpathname.cpp new file mode 100644 index 0000000..7bca55c --- /dev/null +++ b/contrib/groff/src/libs/libgroff/maxpathname.cpp @@ -0,0 +1,71 @@ +// -*- C++ -*- +/* Copyright (C) 2005 Free Software Foundation, Inc. + Written by Werner Lemberg (wl@gnu.org) + +This file is part of groff. + +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, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* path_name_max(dir) does the same as pathconf(dir, _PC_PATH_MAX) */ + +#include "lib.h" + +#include <sys/types.h> + +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif /* HAVE_UNISTD_H */ + +#ifdef _POSIX_VERSION + +size_t path_name_max() +{ + return pathconf("/", _PC_PATH_MAX) < 1 ? 1024 : pathconf("/",_PC_PATH_MAX); +} + +#else /* not _POSIX_VERSION */ + +#include <stdlib.h> + +#ifdef HAVE_DIRENT_H +# include <dirent.h> +#else /* not HAVE_DIRENT_H */ +# ifdef HAVE_SYS_DIR_H +# include <sys/dir.h> +# endif /* HAVE_SYS_DIR_H */ +#endif /* not HAVE_DIRENT_H */ + +#ifndef PATH_MAX +# ifdef MAXPATHLEN +# define PATH_MAX MAXPATHLEN +# else /* !MAXPATHLEN */ +# ifdef MAX_PATH +# define PATH_MAX MAX_PATH +# else /* !MAX_PATH */ +# ifdef _MAX_PATH +# define PATH_MAX _MAX_PATH +# else /* !_MAX_PATH */ +# define PATH_MAX 255 +# endif /* !_MAX_PATH */ +# endif /* !MAX_PATH */ +# endif /* !MAXPATHLEN */ +#endif /* !PATH_MAX */ + +size_t path_name_max() +{ + return PATH_MAX; +} + +#endif /* not _POSIX_VERSION */ diff --git a/contrib/groff/src/libs/libgroff/mksdir.cpp b/contrib/groff/src/libs/libgroff/mksdir.cpp index bf4d300..472bd9e 100644 --- a/contrib/groff/src/libs/libgroff/mksdir.cpp +++ b/contrib/groff/src/libs/libgroff/mksdir.cpp @@ -15,7 +15,7 @@ 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. */ +Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ /* This file is heavily based on the file mkstemp.c which is part of the diff --git a/contrib/groff/src/libs/libgroff/mkstemp.cpp b/contrib/groff/src/libs/libgroff/mkstemp.cpp index cd2717c..3279d77 100644 --- a/contrib/groff/src/libs/libgroff/mkstemp.cpp +++ b/contrib/groff/src/libs/libgroff/mkstemp.cpp @@ -15,7 +15,7 @@ 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. */ +Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ /* This file is heavily based on the file mkstemp.c which is part of the diff --git a/contrib/groff/src/libs/libgroff/nametoindex.cpp b/contrib/groff/src/libs/libgroff/nametoindex.cpp index def26b3..e4dacff 100644 --- a/contrib/groff/src/libs/libgroff/nametoindex.cpp +++ b/contrib/groff/src/libs/libgroff/nametoindex.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2002, 2003 +/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Written by James Clark (jjc@jclark.com) @@ -17,7 +17,7 @@ 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. */ +Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "lib.h" @@ -107,9 +107,9 @@ int font::name_to_index(const char *s) return indexer.ascii_char_index(s[0]); /* char128 and \200 are synonyms */ if (s[0] == 'c' && s[1] == 'h' && s[2] == 'a' && s[3] == 'r') { - char *res; - long n = strtol(s + 4, &res, 10); - if (res != s + 4 && *res == '\0' && n >= 0 && n < 256) + char *val; + long n = strtol(s + 4, &val, 10); + if (val != s + 4 && *val == '\0' && n >= 0 && n < 256) return indexer.ascii_char_index((unsigned char)n); } return indexer.named_char_index(s); diff --git a/contrib/groff/src/libs/libgroff/new.cpp b/contrib/groff/src/libs/libgroff/new.cpp index 739cffa..84393fd 100644 --- a/contrib/groff/src/libs/libgroff/new.cpp +++ b/contrib/groff/src/libs/libgroff/new.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 1989, 1990, 1991, 1992, 2001, 2003 +/* Copyright (C) 1989, 1990, 1991, 1992, 2001, 2003, 2004 Free Software Foundation, Inc. Written by James Clark (jjc@jclark.com) @@ -16,7 +16,7 @@ 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. */ +Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "lib.h" @@ -26,7 +26,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "posix.h" #include "nonposix.h" -extern const char *program_name; +extern "C" const char *program_name; static void ewrite(const char *s) { diff --git a/contrib/groff/src/libs/libgroff/paper.cpp b/contrib/groff/src/libs/libgroff/paper.cpp index db8f5bc..4f114f4 100644 --- a/contrib/groff/src/libs/libgroff/paper.cpp +++ b/contrib/groff/src/libs/libgroff/paper.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -/* Copyright (C) 2002, 2003 +/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. Written by Werner Lemberg (wl@gnu.org) @@ -17,7 +17,7 @@ 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. */ +Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "lib.h" #include "paper.h" @@ -49,14 +49,14 @@ static void add_iso_paper(char series, int offset, } // length and width in inch -static void add_american_paper(const char *name, int index, +static void add_american_paper(const char *name, int idx, double length, double width ) { char *p = new char[strlen(name) + 1]; strcpy(p, name); - papersizes[index].name = p; - papersizes[index].length = length; - papersizes[index].width = width; + papersizes[idx].name = p; + papersizes[idx].length = length; + papersizes[idx].width = width; } int papersize_init::initialised = 0; diff --git a/contrib/groff/src/libs/libgroff/progname.c b/contrib/groff/src/libs/libgroff/progname.c new file mode 100644 index 0000000..a70e341 --- /dev/null +++ b/contrib/groff/src/libs/libgroff/progname.c @@ -0,0 +1 @@ +const char *program_name = 0; diff --git a/contrib/groff/src/libs/libgroff/ptable.cpp b/contrib/groff/src/libs/libgroff/ptable.cpp index 76735c2..bde2c3c 100644 --- a/contrib/groff/src/libs/libgroff/ptable.cpp +++ b/contrib/groff/src/libs/libgroff/ptable.cpp @@ -15,7 +15,7 @@ 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. */ +Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "ptable.h" #include "errarg.h" diff --git a/contrib/groff/src/libs/libgroff/quotearg.c b/contrib/groff/src/libs/libgroff/quotearg.c new file mode 100644 index 0000000..0ab3dc6 --- /dev/null +++ b/contrib/groff/src/libs/libgroff/quotearg.c @@ -0,0 +1,209 @@ +/* Copyright (C) 2004 + Free Software Foundation, Inc. + Written by: Jeff Conrad (jeff_conrad@msn.com) + and Keith Marshall (keith.d.marshall@ntlworld.com) + +This file is part of groff. + +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, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <ctype.h> +#include <limits.h> + +/* Define the default mechanism, and messages, for error reporting + * (user may substitute a preferred alternative, by defining his own + * implementation of the macros REPORT_ERROR, QUOTE_ARG_MALLOC_FAILED + * and QUOTE_ARG_REALLOC_FAILED, in the header file `nonposix.h'). + */ + +#include "nonposix.h" + +#ifndef REPORT_ERROR +# define REPORT_ERROR(WHY) fprintf(stderr, "%s:%s\n", program_name, WHY) +#endif +#ifndef QUOTE_ARG_MALLOC_ERROR +# define QUOTE_ARG_MALLOC_ERROR "malloc: Buffer allocation failed" +#endif +#ifndef QUOTE_ARG_REALLOC_ERROR +# define QUOTE_ARG_REALLOC_ERROR "realloc: Buffer resize failed" +#endif + +extern char *program_name; /* main program must define this */ + +#undef FALSE +#undef TRUE +#define FALSE 0 +#define TRUE 1 + +static int +needs_quoting(const char *string) +{ + /* Scan `string' to see whether it needs quoting for MSVC `spawn'/`exec' + * (i.e., whether it contains whitespace or embedded quotes). + */ + + if (string == NULL) /* ignore NULL strings */ + return FALSE; + + if (*string == '\0') /* explicit arguments of zero length */ + return TRUE; /* need quoting, so they aren't discarded */ + + while (*string) { + /* Scan non-NULL strings, up to '\0' terminator, + * returning 'TRUE' if quote or white space found. + */ + + if (*string == '"' || isspace(*string)) + return TRUE; + + /* otherwise, continue scanning to end of string */ + + ++string; + } + + /* Fall through, if no quotes or white space found, + * in which case, return `FALSE'. + */ + + return FALSE; +} + +char * +quote_arg(char *string) +{ + /* Enclose arguments in double quotes so that the parsing done in the + * MSVC runtime startup code doesn't split them at whitespace. Escape + * embedded double quotes so that they emerge intact from the parsing. + */ + + int backslashes; + char *quoted, *p, *q; + + if (needs_quoting(string)) { + /* Need to create a quoted copy of `string'; + * maximum buffer space needed is twice the original length, + * plus two enclosing quotes and one `\0' terminator. + */ + + if ((quoted = (char *)malloc(2 * strlen(string) + 3)) == NULL) { + /* Couldn't get a buffer for the quoted string, + * so complain, and bail out gracefully. + */ + + REPORT_ERROR(QUOTE_ARG_MALLOC_ERROR); + exit(1); + } + + /* Ok to proceed: + * insert the opening quote, then copy the source string, + * adding escapes as required. + */ + + *quoted = '"'; + for (backslashes = 0, p = string, q = quoted; *p; p++) { + if (*p == '\\') { + /* Just count backslashes when we find them. + * We will copy them out later, when we know if the count + * needs to be adjusted, to escape an embedded quote. + */ + + ++backslashes; + } + else if (*p == '"') { + /* This embedded quote character must be escaped, + * but first double up any immediately preceding backslashes, + * with one extra, as the escape character. + */ + + for (backslashes += backslashes + 1; backslashes; backslashes--) + *++q = '\\'; + + /* and now, add the quote character itself */ + + *++q = '"'; + } + else { + /* Any other character is simply copied, + * but first, if we have any pending backslashes, + * we must now insert them, without any count adjustment. + */ + + while (backslashes) { + *++q = '\\'; + --backslashes; + } + + /* and then, copy the current character */ + + *++q = *p; + } + } + + /* At end of argument: + * If any backslashes remain to be copied out, append them now, + * doubling the actual count to protect against reduction by MSVC, + * as a consequence of the immediately following closing quote. + */ + + for (backslashes += backslashes; backslashes; backslashes--) + *++q = '\\'; + + /* Finally, + * add the closing quote, terminate the quoted string, + * and adjust its size to what was actually required, + * ready for return. + */ + + *++q = '"'; + *++q = '\0'; + if ((string = (char *)realloc(quoted, strlen(quoted) + 1)) == NULL) { + /* but bail out gracefully, on error */ + + REPORT_ERROR(QUOTE_ARG_REALLOC_ERROR); + exit(1); + } + } + + /* `string' now refers to the argument, + * quoted and escaped, as required. + */ + + return string; +} + +void +purge_quoted_args(char **argv) +{ + /* To avoid memory leaks, + * free all memory previously allocated by `quoted_arg()', + * within the scope of the referring argument vector, `argv'. + */ + + if (argv) + while (*argv) { + /* Any argument beginning with a double quote + * SHOULD have been allocated by `quoted_arg()'. + */ + + if (**argv == '"') + free( *argv ); /* so free its allocation */ + ++argv; /* and continue to the next argument */ + } +} + +/* quotearg.c: end of file */ diff --git a/contrib/groff/src/libs/libgroff/relocate.cpp b/contrib/groff/src/libs/libgroff/relocate.cpp new file mode 100644 index 0000000..5aace8b --- /dev/null +++ b/contrib/groff/src/libs/libgroff/relocate.cpp @@ -0,0 +1,238 @@ +// -*- C++ -*- +/* Provide relocation for macro and font files. + Copyright (C) 2005 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU Library General Public License as published + by the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, + USA. */ + +// Made after relocation code in kpathsea and gettext. + +#include "lib.h" + +#include <errno.h> +#include <stdlib.h> + +#include "defs.h" +#include "posix.h" +#include "nonposix.h" +#include "relocate.h" + +#if defined _WIN32 +# define WIN32_LEAN_AND_MEAN +# include <windows.h> +#endif + +#define INSTALLPATHLEN (sizeof(INSTALLPATH) - 1) +#ifndef DEBUG +# define DEBUG 0 +#endif + +extern "C" const char *program_name; + +// The prefix (parent directory) corresponding to the binary. +char *curr_prefix = 0; +size_t curr_prefix_len = 0; + +// Return the directory part of a filename, or `.' if no path separators. +char *xdirname(char *s) +{ + static const char dot[] = "."; + if (!s) + return 0; + // DIR_SEPS[] are possible directory separator characters, see nonposix.h. + // We want the rightmost separator of all possible ones. + // Example: d:/foo\\bar. + char *p = strrchr(s, DIR_SEPS[0]); + const char *sep = &DIR_SEPS[1]; + while (*sep) { + char *p1 = strrchr(s, *sep); + if (p1 && (!p || p1 > p)) + p = p1; + sep++; + } + if (p) + *p = '\0'; + else + s = (char *)dot; + return s; +} + +// Return the full path of NAME along the path PATHP. +// Adapted from search_path::open_file in searchpath.cpp. +char *searchpath(const char *name, const char *pathp) +{ + char *path; + if (!name || !*name) + return 0; +#if DEBUG + fprintf(stderr, "searchpath: pathp: `%s'\n", pathp); + fprintf(stderr, "searchpath: trying `%s'\n", name); +#endif + // Try first NAME as such; success if NAME is an absolute filename, + // or if NAME is found in the current directory. + if (!access (name, F_OK)) { + path = new char[path_name_max()]; +#ifdef _WIN32 + path = _fullpath(path, name, path_name_max()); +#else + path = realpath(name, path); +#endif +#if DEBUG + fprintf(stderr, "searchpath: found `%s'\n", path); +#endif + return path; + } + // Secondly, try the current directory. + // Now search along PATHP. + size_t namelen = strlen(name); + char *p = (char *)pathp; + for (;;) { + char *end = strchr(p, PATH_SEP_CHAR); + if (!end) + end = strchr(p, '\0'); + int need_slash = end > p && strchr(DIR_SEPS, end[-1]) == 0; + path = new char[end - p + need_slash + namelen + 1]; + memcpy(path, p, end - p); + if (need_slash) + path[end - p] = '/'; + strcpy(path + (end - p) + need_slash, name); +#if DEBUG + fprintf(stderr, "searchpath: trying `%s'\n", path); +#endif + if (!access(path, F_OK)) { +#if DEBUG + fprintf(stderr, "searchpath: found `%s'\n", name); +#endif + return path; + } + a_delete path; + if (*end == '\0') + break; + p = end + 1; + } + return 0; +} + +// Search NAME along PATHP with the elements of PATHEXT in turn added. +char *searchpathext(const char *name, const char *pathext, const char *pathp) +{ + char *found = 0; + char *tmpathext = strsave(pathext); // strtok modifies this string, + // so make a copy + char *ext = strtok(tmpathext, PATH_SEP); + while (ext) { + char *namex = new char[strlen(name) + strlen(ext) + 1]; + strcpy(namex, name); + strcat(namex, ext); + found = searchpath(namex, pathp); + a_delete namex; + if (found) + break; + ext = strtok(0, PATH_SEP); + } + a_delete tmpathext; + return found; +} + +// Convert an MS path to a POSIX path. +char *msw2posixpath(char *path) +{ + char *s = path; + while (*s) { + if (*s == '\\') + *s = '/'; + *s++; + } + return path; +} + +// Compute the current prefix. +void set_current_prefix() +{ + char *pathextstr; + curr_prefix = new char[path_name_max()]; + // Obtain the full path of the current binary; + // using GetModuleFileName on MS-Windows, + // and searching along PATH on other systems. +#ifdef _WIN32 + int len = GetModuleFileName(0, curr_prefix, path_name_max()); + if (len) + len = GetShortPathName(curr_prefix, curr_prefix, path_name_max()); +# if DEBUG + fprintf(stderr, "curr_prefix: %s\n", curr_prefix); +# endif /* DEBUG */ +#else /* !_WIN32 */ + curr_prefix = searchpath(program_name, getenv("PATH")); + if (!curr_prefix && !strchr(program_name, '.')) { // try with extensions + pathextstr = strsave(getenv("PATHEXT")); + if (!pathextstr) + pathextstr = strsave(PATH_EXT); + curr_prefix = searchpathext(program_name, pathextstr, getenv("PATH")); + a_delete pathextstr; + } + if (!curr_prefix) + return; +#endif /* !_WIN32 */ + msw2posixpath(curr_prefix); +#if DEBUG + fprintf(stderr, "curr_prefix: %s\n", curr_prefix); +#endif + curr_prefix = xdirname(curr_prefix); // directory of executable + curr_prefix = xdirname(curr_prefix); // parent directory of executable + curr_prefix_len = strlen(curr_prefix); +#if DEBUG + fprintf(stderr, "curr_prefix: %s\n", curr_prefix); + fprintf(stderr, "curr_prefix_len: %d\n", curr_prefix_len); +#endif +} + +// Strip the installation prefix and replace it +// with the current installation prefix; return the relocated path. +char *relocatep(const char *path) +{ +#if DEBUG + fprintf(stderr, "relocatep: path = %s\n", path); + fprintf(stderr, "relocatep: INSTALLPATH = %s\n", INSTALLPATH); + fprintf(stderr, "relocatep: INSTALLPATHLEN = %d\n", INSTALLPATHLEN); +#endif + if (!curr_prefix) + set_current_prefix(); + if (strncmp(INSTALLPATH, path, INSTALLPATHLEN)) + return strsave(path); + char *relative_path = (char *)path + INSTALLPATHLEN; + size_t relative_path_len = strlen(relative_path); + char *relocated_path = new char[curr_prefix_len + relative_path_len + 1]; + strcpy(relocated_path, curr_prefix); + strcat(relocated_path, relative_path); +#if DEBUG + fprintf(stderr, "relocated_path: %s\n", relocated_path); +#endif /* DEBUG */ + return relocated_path; +} + +// Return the original pathname if it exists; +// otherwise return the relocated path. +char *relocate(const char *path) +{ + char *p; + if (access(path, F_OK)) + p = relocatep(path); + else + p = strsave(path); +#if DEBUG + fprintf (stderr, "relocate: %s\n", p); +#endif + return p; +} diff --git a/contrib/groff/src/libs/libgroff/searchpath.cpp b/contrib/groff/src/libs/libgroff/searchpath.cpp index 1f8b233..6b9b81c 100644 --- a/contrib/groff/src/libs/libgroff/searchpath.cpp +++ b/contrib/groff/src/libs/libgroff/searchpath.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001 +/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2003, 2005 Free Software Foundation, Inc. Written by James Clark (jjc@jclark.com) @@ -17,16 +17,23 @@ 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. */ +Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "lib.h" #include <stdlib.h> #include <assert.h> +#include <errno.h> #include "searchpath.h" #include "nonposix.h" +#ifdef _WIN32 +# include "relocate.h" +#else +# define relocate(path) strsave(path) +#endif + search_path::search_path(const char *envvar, const char *standard, int add_home, int add_current) { @@ -75,11 +82,11 @@ void search_path::command_line_dir(const char *s) char *p = dirs; p += old_len - init_len; if (init_len == 0) - *p++ = PATH_SEP[0]; + *p++ = PATH_SEP_CHAR; memcpy(p, s, slen); p += slen; if (init_len > 0) { - *p++ = PATH_SEP[0]; + *p++ = PATH_SEP_CHAR; memcpy(p, old + old_len - init_len, init_len); p += init_len; } @@ -103,15 +110,20 @@ FILE *search_path::open_file(const char *name, char **pathp) unsigned namelen = strlen(name); char *p = dirs; for (;;) { - char *end = strchr(p, PATH_SEP[0]); + char *end = strchr(p, PATH_SEP_CHAR); if (!end) end = strchr(p, '\0'); int need_slash = end > p && strchr(DIR_SEPS, end[-1]) == 0; - char *path = new char[(end - p) + need_slash + namelen + 1]; - memcpy(path, p, end - p); + char *origpath = new char[(end - p) + need_slash + namelen + 1]; + memcpy(origpath, p, end - p); if (need_slash) - path[end - p] = '/'; - strcpy(path + (end - p) + need_slash, name); + origpath[end - p] = '/'; + strcpy(origpath + (end - p) + need_slash, name); +#if 0 + fprintf(stderr, "origpath `%s'\n", origpath); +#endif + char *path = relocate(origpath); + a_delete origpath; #if 0 fprintf(stderr, "trying `%s'\n", path); #endif @@ -130,3 +142,67 @@ FILE *search_path::open_file(const char *name, char **pathp) } return 0; } + +FILE *search_path::open_file_cautious(const char *name, char **pathp, + const char *mode) +{ + if (!mode) + mode = "r"; + bool reading = (strchr(mode, 'r') != 0); + if (name == 0 || strcmp(name, "-") == 0) { + if (pathp) + *pathp = strsave(reading ? "stdin" : "stdout"); + return (reading ? stdin : stdout); + } + if (!reading || IS_ABSOLUTE(name) || *dirs == '\0') { + FILE *fp = fopen(name, mode); + if (fp) { + if (pathp) + *pathp = strsave(name); + return fp; + } + else + return 0; + } + unsigned namelen = strlen(name); + char *p = dirs; + for (;;) { + char *end = strchr(p, PATH_SEP_CHAR); + if (!end) + end = strchr(p, '\0'); + int need_slash = end > p && strchr(DIR_SEPS, end[-1]) == 0; + char *origpath = new char[(end - p) + need_slash + namelen + 1]; + memcpy(origpath, p, end - p); + if (need_slash) + origpath[end - p] = '/'; + strcpy(origpath + (end - p) + need_slash, name); +#if 0 + fprintf(stderr, "origpath `%s'\n", origpath); +#endif + char *path = relocate(origpath); + a_delete origpath; +#if 0 + fprintf(stderr, "trying `%s'\n", path); +#endif + FILE *fp = fopen(path, mode); + if (fp) { + if (pathp) + *pathp = path; + else + a_delete path; + return fp; + } + int err = errno; + a_delete path; + if (err != ENOENT) + { + errno = err; + return 0; + } + if (*end == '\0') + break; + p = end + 1; + } + errno = ENOENT; + return 0; +} diff --git a/contrib/groff/src/libs/libgroff/spawnvp.c b/contrib/groff/src/libs/libgroff/spawnvp.c new file mode 100644 index 0000000..1848124 --- /dev/null +++ b/contrib/groff/src/libs/libgroff/spawnvp.c @@ -0,0 +1,122 @@ +/* Copyright (C) 2004 + Free Software Foundation, Inc. + Written by: Keith Marshall (keith.d.marshall@ntlworld.com) + +This file is part of groff. + +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, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include <stdio.h> +#include <stdlib.h> + +#ifdef HAVE_PROCESS_H +# include <process.h> +#endif + +#if defined(__MSDOS__) \ + || (defined(_WIN32) && !defined(_UWIN) && !defined(__CYGWIN__)) \ + || defined(__EMX__) + +#define SPAWN_FUNCTION_WRAPPERS 1 + +/* Define the default mechanism, and messages, for error reporting + * (user may substitute a preferred alternative, by defining his own + * implementation of the macros REPORT_ERROR and ARGV_MALLOC_ERROR, + * in the header file `nonposix.h'). + */ + +#include "nonposix.h" + +#ifndef REPORT_ERROR +# define REPORT_ERROR(WHY) fprintf(stderr, "%s:%s\n", program_name, WHY) +#endif +#ifndef ARGV_MALLOC_ERROR +# define ARGV_MALLOC_ERROR "malloc: Allocation for 'argv' failed" +#endif + +extern char *program_name; + +extern char *quote_arg(char *string); +extern void purge_quoted_args(char **argv); + +int +spawnvp_wrapper(int mode, char *path, char **argv) +{ + /* Invoke the system `spawnvp' service + * enclosing the passed arguments in double quotes, as required, + * so that the (broken) default parsing in the MSVC runtime doesn't + * split them at whitespace. */ + + char **quoted_argv; /* used to build a quoted local copy of `argv' */ + + int i; /* used as an index into `argv' or `quoted_argv' */ + int status = -1; /* initialise return code, in case we fail */ + int argc = 0; /* initialise argument count; may be none */ + + /* First count the number of arguments + * which are actually present in the passed `argv'. */ + + if (argv) + for (quoted_argv = argv; *quoted_argv; ++argc, ++quoted_argv) + ; + + /* If we do not now have an argument count, + * then we must fall through and fail. */ + + if (argc) { + /* We do have at least one argument: + * We will use a copy of the `argv', in which to do the quoting, + * so we must allocate space for it. */ + + if ((quoted_argv = (char **)malloc(++argc * sizeof(char **))) == NULL) { + /* If we didn't get enough space, + * then complain, and bail out gracefully. */ + + REPORT_ERROR(ARGV_MALLOC_ERROR); + exit(1); + } + + /* Now copy the passed `argv' into our new vector, + * quoting its contents as required. */ + + for (i = 0; i < argc; i++) + quoted_argv[i] = quote_arg(argv[i]); + + /* Invoke the MSVC `spawnvp' service + * passing our now appropriately quoted copy of `argv'. */ + + status = spawnvp(mode, path, quoted_argv); + + /* Clean up our memory allocations + * for the quoted copy of `argv', which is no longer required. */ + + purge_quoted_args(quoted_argv); + free(quoted_argv); + } + + /* Finally, + * return the status code returned by `spawnvp', + * or a failure code if we fell through. */ + + return status; +} + +#endif /* __MSDOS__ || _WIN32 */ + +/* spawnvp.c: end of file */ diff --git a/contrib/groff/src/libs/libgroff/strcasecmp.c b/contrib/groff/src/libs/libgroff/strcasecmp.c index ae7601d..6ed6cc2 100644 --- a/contrib/groff/src/libs/libgroff/strcasecmp.c +++ b/contrib/groff/src/libs/libgroff/strcasecmp.c @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ #if HAVE_CONFIG_H # include <config.h> @@ -29,7 +29,7 @@ # define LENGTH_LIMIT_EXPR(Expr) 0 #endif -#include <sys/types.h> +#include <stddef.h> #include <ctype.h> #define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch)) diff --git a/contrib/groff/src/libs/libgroff/strerror.c b/contrib/groff/src/libs/libgroff/strerror.c index be2d1f3..d5757f3 100644 --- a/contrib/groff/src/libs/libgroff/strerror.c +++ b/contrib/groff/src/libs/libgroff/strerror.c @@ -1,4 +1,5 @@ -/* Copyright (C) 1989, 1990, 1991, 1992, 2001 Free Software Foundation, Inc. +/* Copyright (C) 1989, 1990, 1991, 1992, 2001, 2003 + Free Software Foundation, Inc. Written by James Clark (jjc@jclark.com) This file is part of groff. @@ -15,13 +16,15 @@ 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. */ +Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H #include <config.h> #endif #include <stdio.h> +#include <errno.h> +#include <stdlib.h> /* for MinGW */ #define INT_DIGITS 19 /* enough for 64 bit integer */ diff --git a/contrib/groff/src/libs/libgroff/string.cpp b/contrib/groff/src/libs/libgroff/string.cpp index 2ef547e..9be873c 100644 --- a/contrib/groff/src/libs/libgroff/string.cpp +++ b/contrib/groff/src/libs/libgroff/string.cpp @@ -17,7 +17,7 @@ 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. */ +Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "lib.h" diff --git a/contrib/groff/src/libs/libgroff/strsave.cpp b/contrib/groff/src/libs/libgroff/strsave.cpp index dfd2b6f..2db7073 100644 --- a/contrib/groff/src/libs/libgroff/strsave.cpp +++ b/contrib/groff/src/libs/libgroff/strsave.cpp @@ -16,7 +16,7 @@ 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. */ +Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ #include <string.h> diff --git a/contrib/groff/src/libs/libgroff/strtol.c b/contrib/groff/src/libs/libgroff/strtol.c index 46b1702..0c758a0 100644 --- a/contrib/groff/src/libs/libgroff/strtol.c +++ b/contrib/groff/src/libs/libgroff/strtol.c @@ -16,7 +16,7 @@ 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. */ +Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H #include <config.h> diff --git a/contrib/groff/src/libs/libgroff/symbol.cpp b/contrib/groff/src/libs/libgroff/symbol.cpp new file mode 100644 index 0000000..38e3071 --- /dev/null +++ b/contrib/groff/src/libs/libgroff/symbol.cpp @@ -0,0 +1,159 @@ +// -*- C++ -*- +/* Copyright (C) 1989, 1990, 1991, 1992, 2002, 2004 + Free Software Foundation, Inc. + Written by James Clark (jjc@jclark.com) + +This file is part of groff. + +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, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include "lib.h" + +#include "errarg.h" +#include "error.h" +#include "symbol.h" + +const char **symbol::table = 0; +int symbol::table_used = 0; +int symbol::table_size = 0; +char *symbol::block = 0; +int symbol::block_size = 0; + +const symbol NULL_SYMBOL; +const symbol EMPTY_SYMBOL(""); + +#ifdef BLOCK_SIZE +#undef BLOCK_SIZE +#endif + +const int BLOCK_SIZE = 1024; +// the table will increase in size as necessary +// the size will be chosen from the following array +// add some more if you want +static const unsigned int table_sizes[] = { + 101, 503, 1009, 2003, 3001, 4001, 5003, 10007, 20011, 40009, 80021, + 160001, 500009, 1000003, 1500007, 2000003, 0 +}; +const double FULL_MAX = 0.3; // don't let the table get more than this full + +static unsigned int hash_string(const char *p) +{ + // compute a hash code; this assumes 32-bit unsigned ints + // see p436 of Compilers by Aho, Sethi & Ullman + // give special treatment to two-character names + unsigned int hc = 0, g; + if (*p != 0) { + hc = *p++; + if (*p != 0) { + hc <<= 7; + hc += *p++; + for (; *p != 0; p++) { + hc <<= 4; + hc += *p; + if ((g = (hc & 0xf0000000)) == 0) { + hc ^= g >> 24; + hc ^= g; + } + } + } + } + return hc; +} + +// Tell compiler that a variable is intentionally unused. +inline void unused(void *) { } + +symbol::symbol(const char *p, int how) +{ + if (p == 0) { + s = 0; + return; + } + if (*p == 0) { + s = ""; + return; + } + if (table == 0) { + table_size = table_sizes[0]; + table = (const char **)new char*[table_size]; + for (int i = 0; i < table_size; i++) + table[i] = 0; + table_used = 0; + } + unsigned int hc = hash_string(p); + const char **pp; + for (pp = table + hc % table_size; + *pp != 0; + (pp == table ? pp = table + table_size - 1 : --pp)) + if (strcmp(p, *pp) == 0) { + s = *pp; + return; + } + if (how == MUST_ALREADY_EXIST) { + s = 0; + return; + } + if (table_used >= table_size - 1 || table_used >= table_size*FULL_MAX) { + const char **old_table = table; + unsigned int old_table_size = table_size; + int i; + for (i = 1; table_sizes[i] <= old_table_size; i++) + if (table_sizes[i] == 0) + fatal("too many symbols"); + table_size = table_sizes[i]; + table_used = 0; + table = (const char **)new char*[table_size]; + for (i = 0; i < table_size; i++) + table[i] = 0; + for (pp = old_table + old_table_size - 1; + pp >= old_table; + --pp) { + symbol temp(*pp, 1); /* insert it into the new table */ + unused(&temp); + } + a_delete old_table; + for (pp = table + hc % table_size; + *pp != 0; + (pp == table ? pp = table + table_size - 1 : --pp)) + ; + } + ++table_used; + if (how == DONT_STORE) { + s = *pp = p; + } + else { + int len = strlen(p)+1; + if (block == 0 || block_size < len) { + block_size = len > BLOCK_SIZE ? len : BLOCK_SIZE; + block = new char [block_size]; + } + (void)strcpy(block, p); + s = *pp = block; + block += len; + block_size -= len; + } +} + +symbol concat(symbol s1, symbol s2) +{ + char *buf = new char [strlen(s1.contents()) + strlen(s2.contents()) + 1]; + strcpy(buf, s1.contents()); + strcat(buf, s2.contents()); + symbol res(buf); + a_delete buf; + return res; +} + +symbol default_symbol("default"); diff --git a/contrib/groff/src/libs/libgroff/tmpfile.cpp b/contrib/groff/src/libs/libgroff/tmpfile.cpp index 41b7f06..fbc48c8 100644 --- a/contrib/groff/src/libs/libgroff/tmpfile.cpp +++ b/contrib/groff/src/libs/libgroff/tmpfile.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001 +/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2003 Free Software Foundation, Inc. Written by James Clark (jjc@jclark.com) @@ -17,7 +17,7 @@ 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. */ +Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "lib.h" @@ -33,6 +33,13 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define GROFF_TMPDIR_ENVVAR "GROFF_TMPDIR" // otherwise if this is set, create temporary files there #define TMPDIR_ENVVAR "TMPDIR" +// otherwise, on MS-DOS or MS-Windows ... +#if defined(__MSDOS__) || defined(_WIN32) +// if either of these is set, create temporary files there +// (giving priority to WIN32_TMPDIR_ENVVAR) +#define WIN32_TMPDIR_ENVVAR "TMP" +#define MSDOS_TMPDIR_ENVVAR "TEMP" +#endif // otherwise if P_tmpdir is defined, create temporary files there #ifdef P_tmpdir # define DEFAULT_TMPDIR P_tmpdir @@ -55,12 +62,23 @@ struct temp_init { temp_init::temp_init() { - const char *tem = getenv(GROFF_TMPDIR_ENVVAR); - if (!tem) { - tem = getenv(TMPDIR_ENVVAR); - if (!tem) - tem = DEFAULT_TMPDIR; - } + // First, choose a location for creating temporary files... + const char *tem; + // using the first match for any of the environment specs in listed order. + if ( + (tem = getenv(GROFF_TMPDIR_ENVVAR)) == NULL + && (tem = getenv(TMPDIR_ENVVAR)) == NULL +#if defined(__MSDOS__) || defined(_WIN32) + // If we didn't find a match for either of the above + // (which are preferred, regardless of the host operating system), + // and we are hosted on either MS-Windows or MS-DOS, + // then try the Microsoft conventions. + && (tem = getenv(WIN32_TMPDIR_ENVVAR)) == NULL + && (tem = getenv(MSDOS_TMPDIR_ENVVAR)) == NULL +#endif + ) + // If we didn't find an environment spec fall back to this default. + tem = DEFAULT_TMPDIR; size_t tem_len = strlen(tem); const char *tem_end = tem + tem_len - 1; int need_slash = strchr(DIR_SEPS, *tem_end) == NULL ? 1 : 0; diff --git a/contrib/groff/src/libs/libgroff/tmpname.cpp b/contrib/groff/src/libs/libgroff/tmpname.cpp index f867fe0..8d80f4b 100644 --- a/contrib/groff/src/libs/libgroff/tmpname.cpp +++ b/contrib/groff/src/libs/libgroff/tmpname.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2001, 2003 Free Software Foundation, Inc. +/* Copyright (C) 2001, 2003, 2004 Free Software Foundation, Inc. Written by Werner Lemberg (wl@gnu.org) This file is part of groff. @@ -15,7 +15,7 @@ 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. */ +Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ /* This file is heavily based on the function __gen_tempname() in the @@ -48,8 +48,8 @@ extern "C" { #endif #endif -#if HAVE_CC_STDINT_H -# include <stdint.h> +#if HAVE_CC_INTTYPES_H +# include <inttypes.h> #endif /* Use the widest available unsigned type if uint64_t is not diff --git a/contrib/groff/src/libs/libgroff/unicode.cpp b/contrib/groff/src/libs/libgroff/unicode.cpp new file mode 100644 index 0000000..32810df --- /dev/null +++ b/contrib/groff/src/libs/libgroff/unicode.cpp @@ -0,0 +1,67 @@ +// -*- C++ -*- +/* Copyright (C) 2002 + Free Software Foundation, Inc. + Written by Werner Lemberg <wl@gnu.org> + +This file is part of groff. + +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, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include "lib.h" +#include "cset.h" +#include "stringclass.h" + +#include "unicode.h" + +const char *check_unicode_name(const char *u) +{ + if (*u != 'u') + return 0; + const char *p = ++u; + for (;;) { + int val = 0; + const char *start = p; + for (;;) { + // only uppercase hex digits allowed + if (!csxdigit(*p)) + return 0; + if (csdigit(*p)) + val = val*0x10 + (*p-'0'); + else if (csupper(*p)) + val = val*0x10 + (*p-'A'+10); + else + return 0; + // biggest Unicode value is U+10FFFF + if (val > 0x10FFFF) + return 0; + p++; + if (*p == '\0' || *p == '_') + break; + } + // surrogates not allowed + if ((val >= 0xD800 && val <= 0xDBFF) || (val >= 0xDC00 && val <= 0xDFFF)) + return 0; + if (val > 0xFFFF) { + if (*start == '0') // no leading zeros allowed if > 0xFFFF + return 0; + } + else if (p - start != 4) // otherwise, check for exactly 4 hex digits + return 0; + if (*p == '\0') + break; + p++; + } + return u; +} diff --git a/contrib/groff/src/libs/libgroff/uniglyph.cpp b/contrib/groff/src/libs/libgroff/uniglyph.cpp new file mode 100644 index 0000000..ab6f531 --- /dev/null +++ b/contrib/groff/src/libs/libgroff/uniglyph.cpp @@ -0,0 +1,504 @@ +// -*- C++ -*- +/* Copyright (C) 2002, 2003, 2004 + Free Software Foundation, Inc. + Written by Werner Lemberg <wl@gnu.org> + +This file is part of groff. + +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, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include "lib.h" +#include "stringclass.h" +#include "ptable.h" + +#include "unicode.h" + +struct unicode_to_glyph { + char *value; +}; + +declare_ptable(unicode_to_glyph) +implement_ptable(unicode_to_glyph) + +PTABLE(unicode_to_glyph) unicode_to_glyph_table; + +struct S { + const char *key; + const char *value; +} unicode_to_glyph_list[] = { + { "0021", "!" }, +//{ "0022", "\"" }, + { "0022", "dq" }, +//{ "0023", "#" }, + { "0023", "sh" }, +//{ "0024", "$" }, + { "0024", "Do" }, + { "0025", "%" }, + { "0026", "&" }, + { "0027", "aq" }, + { "0028", "(" }, + { "0029", ")" }, + { "002A", "*" }, +//{ "002B", "+" }, + { "002B", "pl" }, + { "002C", "," }, + { "002E", "." }, +//{ "002F", "/" }, + { "002F", "sl" }, + { "0030", "0" }, + { "0031", "1" }, + { "0032", "2" }, + { "0033", "3" }, + { "0034", "4" }, + { "0035", "5" }, + { "0036", "6" }, + { "0037", "7" }, + { "0038", "8" }, + { "0039", "9" }, + { "003A", ":" }, + { "003B", ";" }, + { "003C", "<" }, +//{ "003D", "=" }, + { "003D", "eq" }, + { "003D_0338", "!=" }, + { "003E", ">" }, + { "003F", "?" }, +//{ "0040", "@" }, + { "0040", "at" }, + { "0041", "A" }, + { "0041_0300", "`A" }, + { "0041_0301", "'A" }, + { "0041_0302", "^A" }, + { "0041_0303", "~A" }, + { "0041_0308", ":A" }, + { "0041_030A", "oA" }, + { "0042", "B" }, + { "0043", "C" }, + { "0043_0301", "'C" }, + { "0043_0327", ",C" }, + { "0044", "D" }, + { "0045", "E" }, + { "0045_0300", "`E" }, + { "0045_0301", "'E" }, + { "0045_0302", "^E" }, + { "0045_0308", ":E" }, + { "0046", "F" }, + { "0047", "G" }, + { "0048", "H" }, + { "0049", "I" }, + { "0049_0300", "`I" }, + { "0049_0301", "'I" }, + { "0049_0302", "^I" }, + { "0049_0308", ":I" }, + { "004A", "J" }, + { "004B", "K" }, + { "004C", "L" }, + { "004D", "M" }, + { "004E", "N" }, + { "004E_0303", "~N" }, + { "004F", "O" }, + { "004F_0300", "`O" }, + { "004F_0301", "'O" }, + { "004F_0302", "^O" }, + { "004F_0303", "~O" }, + { "004F_0308", ":O" }, + { "0050", "P" }, + { "0051", "Q" }, + { "0052", "R" }, + { "0053", "S" }, + { "0053_030C", "vS" }, + { "0054", "T" }, + { "0055", "U" }, + { "0055_0300", "`U" }, + { "0055_0301", "'U" }, + { "0055_0302", "^U" }, + { "0055_0308", ":U" }, + { "0056", "V" }, + { "0057", "W" }, + { "0058", "X" }, + { "0059", "Y" }, + { "0059_0301", "'Y" }, + { "0059_0308", ":Y" }, + { "005A", "Z" }, + { "005A_030C", "vZ" }, + { "005B", "lB" }, +//{ "005B", "[" }, + { "005C", "rs" }, +//{ "005C", "\\" }, + { "005D", "rB" }, +//{ "005D", "]" }, +//{ "005E", "^" }, +//{ "005E", "a^" }, + { "005E", "ha" }, +//{ "005F", "_" }, +//{ "005F", "ru" }, + { "005F", "ul" }, + { "0060", "ga" }, +//{ "0060", "\\`" }, + { "0061", "a" }, + { "0061_0300", "`a" }, + { "0061_0301", "'a" }, + { "0061_0302", "^a" }, + { "0061_0303", "~a" }, + { "0061_0308", ":a" }, + { "0061_030A", "oa" }, + { "0062", "b" }, + { "0063", "c" }, + { "0063_0301", "'c" }, + { "0063_0327", ",c" }, + { "0064", "d" }, + { "0065", "e" }, + { "0065_0300", "`e" }, + { "0065_0301", "'e" }, + { "0065_0302", "^e" }, + { "0065_0308", ":e" }, + { "0066", "f" }, + { "0066_0066", "ff" }, + { "0066_0066_0069", "Fi" }, + { "0066_0066_006C", "Fl" }, + { "0066_0069", "fi" }, + { "0066_006C", "fl" }, + { "0067", "g" }, + { "0068", "h" }, + { "0069", "i" }, + { "0069_0300", "`i" }, + { "0069_0301", "'i" }, + { "0069_0302", "^i" }, + { "0069_0308", ":i" }, + { "006A", "j" }, + { "006B", "k" }, + { "006C", "l" }, + { "006D", "m" }, + { "006E", "n" }, + { "006E_0303", "~n" }, + { "006F", "o" }, + { "006F_0300", "`o" }, + { "006F_0301", "'o" }, + { "006F_0302", "^o" }, + { "006F_0303", "~o" }, + { "006F_0308", ":o" }, + { "0070", "p" }, + { "0071", "q" }, + { "0072", "r" }, + { "0073", "s" }, + { "0073_030C", "vs" }, + { "0074", "t" }, + { "0075", "u" }, + { "0075_0300", "`u" }, + { "0075_0301", "'u" }, + { "0075_0302", "^u" }, + { "0075_0308", ":u" }, + { "0076", "v" }, + { "0077", "w" }, + { "0078", "x" }, + { "0079", "y" }, + { "0079_0301", "'y" }, + { "0079_0308", ":y" }, + { "007A", "z" }, + { "007A_030C", "vz" }, + { "007B", "lC" }, +//{ "007B", "{" }, + { "007C", "ba" }, +//{ "007C", "or" }, +//{ "007C", "|" }, + { "007D", "rC" }, +//{ "007D", "}" }, +//{ "007E", "a~" }, + { "007E", "ti" }, +//{ "007E", "~" }, + { "00A1", "r!" }, + { "00A2", "ct" }, + { "00A3", "Po" }, + { "00A4", "Cs" }, + { "00A5", "Ye" }, + { "00A6", "bb" }, + { "00A7", "sc" }, + { "00A8", "ad" }, + { "00A9", "co" }, + { "00AA", "Of" }, + { "00AB", "Fo" }, + { "00AC", "no" }, +//{ "00AC", "tno" }, + { "00AD", "shc" }, + { "00AE", "rg" }, + { "00AF", "a-" }, + { "00B0", "de" }, + { "00B1", "+-" }, +//{ "00B1", "t+-" }, + { "00B2", "S2" }, + { "00B3", "S3" }, + { "00B4", "aa" }, +//{ "00B4", "\\'" }, + { "00B5", "mc" }, + { "00B6", "ps" }, + { "00B7", "pc" }, + { "00B8", "ac" }, + { "00B9", "S1" }, + { "00BA", "Om" }, + { "00BB", "Fc" }, + { "00BC", "14" }, + { "00BD", "12" }, + { "00BE", "34" }, + { "00BF", "r?" }, + { "00C6", "AE" }, + { "00D0", "-D" }, + { "00D7", "mu" }, +//{ "00D7", "tmu" }, + { "00D8", "/O" }, + { "00DE", "TP" }, + { "00DF", "ss" }, + { "00E6", "ae" }, + { "00F0", "Sd" }, + { "00F7", "di" }, +//{ "00F7", "tdi" }, + { "00F8", "/o" }, + { "00FE", "Tp" }, + { "0131", ".i" }, + { "0132", "IJ" }, + { "0133", "ij" }, + { "0141", "/L" }, + { "0142", "/l" }, + { "0152", "OE" }, + { "0153", "oe" }, + { "0192", "Fn" }, + { "02C7", "ah" }, + { "02D8", "ab" }, + { "02D9", "a." }, + { "02DA", "ao" }, + { "02DB", "ho" }, + { "02DD", "a\"" }, + { "0391", "*A" }, + { "0392", "*B" }, + { "0393", "*G" }, + { "0394", "*D" }, + { "0395", "*E" }, + { "0396", "*Z" }, + { "0397", "*Y" }, + { "0398", "*H" }, + { "0399", "*I" }, + { "039A", "*K" }, + { "039B", "*L" }, + { "039C", "*M" }, + { "039D", "*N" }, + { "039E", "*C" }, + { "039F", "*O" }, + { "03A0", "*P" }, + { "03A1", "*R" }, + { "03A3", "*S" }, + { "03A4", "*T" }, + { "03A5", "*U" }, + { "03A6", "*F" }, + { "03A7", "*X" }, + { "03A8", "*Q" }, + { "03A9", "*W" }, + { "03B1", "*a" }, + { "03B2", "*b" }, + { "03B3", "*g" }, + { "03B4", "*d" }, + { "03B5", "*e" }, + { "03B6", "*z" }, + { "03B7", "*y" }, + { "03B8", "*h" }, + { "03B9", "*i" }, + { "03BA", "*k" }, + { "03BB", "*l" }, + { "03BC", "*m" }, + { "03BD", "*n" }, + { "03BE", "*c" }, + { "03BF", "*o" }, + { "03C0", "*p" }, + { "03C1", "*r" }, + { "03C2", "ts" }, + { "03C3", "*s" }, + { "03C4", "*t" }, + { "03C5", "*u" }, + { "03C6", "*f" }, + { "03C7", "*x" }, + { "03C8", "*q" }, + { "03C9", "*w" }, + { "03D1", "+h" }, + { "03D5", "+f" }, + { "03D6", "+p" }, + { "03F5", "+e" }, +//{ "2010", "-" }, + { "2010", "hy" }, + { "2013", "en" }, + { "2014", "em" }, +//{ "2018", "`" }, + { "2018", "oq" }, +//{ "2019", "'" }, + { "2019", "cq" }, + { "201A", "bq" }, + { "201C", "lq" }, + { "201D", "rq" }, + { "201E", "Bq" }, + { "2020", "dg" }, + { "2021", "dd" }, + { "2022", "bu" }, + { "2030", "%0" }, + { "2032", "fm" }, + { "2033", "sd" }, + { "2039", "fo" }, + { "203A", "fc" }, + { "203E", "rn" }, + { "2044", "f/" }, + { "20AC", "Eu" }, +//{ "20AC", "eu" }, + { "210F", "-h" }, +//{ "210F", "hbar" }, + { "2111", "Im" }, + { "2118", "wp" }, + { "211C", "Re" }, + { "2122", "tm" }, + { "2135", "Ah" }, + { "215B", "18" }, + { "215C", "38" }, + { "215D", "58" }, + { "215E", "78" }, + { "2190", "<-" }, + { "2191", "ua" }, + { "2192", "->" }, + { "2193", "da" }, + { "2194", "<>" }, + { "2195", "va" }, + { "21B5", "CR" }, + { "21D0", "lA" }, + { "21D1", "uA" }, + { "21D2", "rA" }, + { "21D3", "dA" }, + { "21D4", "hA" }, + { "21D5", "vA" }, + { "2200", "fa" }, + { "2202", "pd" }, + { "2203", "te" }, + { "2205", "es" }, + { "2207", "gr" }, + { "2208", "mo" }, + { "2208_0338", "nm" }, + { "220B", "st" }, + { "220F", "product" }, + { "2210", "coproduct" }, + { "2211", "sum" }, + { "2212", "mi" }, +//{ "2212", "\\-" }, + { "2213", "-+" }, + { "2217", "**" }, + { "221A", "sr" }, + { "221D", "pt" }, + { "221E", "if" }, + { "2220", "/_" }, + { "2227", "AN" }, + { "2228", "OR" }, + { "2229", "ca" }, + { "222A", "cu" }, + { "222B", "is" }, +//{ "222B", "integral" }, +//{ "2234", "3d" }, + { "2234", "tf" }, + { "223C", "ap" }, + { "2243", "|=" }, + { "2245", "=~" }, +//{ "2248", "~=" }, + { "2248", "~~" }, + { "2261", "==" }, + { "2261_0338", "ne" }, + { "2264", "<=" }, + { "2265", ">=" }, + { "226A", ">>" }, + { "226B", "<<" }, + { "2282", "sb" }, + { "2282_0338", "nb" }, + { "2283", "sp" }, + { "2283_0338", "nc" }, + { "2286", "ib" }, + { "2287", "ip" }, + { "2295", "c+" }, + { "2297", "c*" }, + { "22A5", "pp" }, + { "22C5", "md" }, + { "2308", "lc" }, + { "2309", "rc" }, + { "230A", "lf" }, + { "230B", "rf" }, + { "239B", "parenlefttp" }, + { "239C", "parenleftex" }, + { "239D", "parenleftbt" }, + { "239E", "parenrighttp" }, + { "239F", "parenrightex" }, + { "23A0", "parenrightbt" }, +//{ "23A1", "bracketlefttp" }, + { "23A2", "bracketleftex" }, +//{ "23A3", "bracketleftbt" }, +//{ "23A4", "bracketrighttp" }, + { "23A5", "bracketrightex" }, +//{ "23A6", "bracketrightbt" }, + { "23A7", "lt" }, +//{ "23A7", "bracelefttp" }, + { "23A8", "lk" }, +//{ "23A8", "braceleftmid" }, + { "23A9", "lb" }, +//{ "23A9", "braceleftbt" }, + { "23AA", "bv" }, +//{ "23AA", "braceex" }, +//{ "23AA", "braceleftex" }, +//{ "23AA", "bracerightex" }, + { "23AB", "rt" }, +//{ "23AB", "bracerighttp" }, + { "23AC", "rk" }, +//{ "23AC", "bracerightmid" }, + { "23AD", "rb" }, +//{ "23AD", "bracerightbt" }, + { "23AF", "an" }, + { "2502", "br" }, + { "251D", "rk" }, + { "2525", "lk" }, + { "256D", "lt" }, + { "256E", "rt" }, + { "256F", "rb" }, + { "2570", "lb" }, + { "25A1", "sq" }, + { "25CA", "lz" }, + { "25CB", "ci" }, + { "261C", "lh" }, + { "261E", "rh" }, + { "2660", "SP" }, + { "2663", "CL" }, + { "2665", "HE" }, + { "2666", "DI" }, + { "2713", "OK" }, + { "27E8", "la" }, + { "27E9", "ra" }, +}; + +// global constructor +static struct unicode_to_glyph_init { + unicode_to_glyph_init(); +} _unicode_to_glyph_init; + +unicode_to_glyph_init::unicode_to_glyph_init() { + for (unsigned int i = 0; + i < sizeof(unicode_to_glyph_list)/sizeof(unicode_to_glyph_list[0]); + i++) { + unicode_to_glyph *utg = new unicode_to_glyph[1]; + utg->value = (char *)unicode_to_glyph_list[i].value; + unicode_to_glyph_table.define(unicode_to_glyph_list[i].key, utg); + } +} + +const char *unicode_to_glyph_name(const char *s) +{ + unicode_to_glyph *result = unicode_to_glyph_table.lookup(s); + return result ? result->value : 0; +} diff --git a/contrib/groff/src/libs/libgroff/uniuni.cpp b/contrib/groff/src/libs/libgroff/uniuni.cpp new file mode 100644 index 0000000..61bc833 --- /dev/null +++ b/contrib/groff/src/libs/libgroff/uniuni.cpp @@ -0,0 +1,1994 @@ +// -*- C++ -*- +/* Copyright (C) 2002, 2003, 2004 + Free Software Foundation, Inc. + Written by Werner Lemberg <wl@gnu.org> + +This file is part of groff. + +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, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ + +// This code has been algorithmically derived from the file +// UnicodeData-3.2.0.txt, available from unicode.org. + +#include "lib.h" +#include "stringclass.h" +#include "ptable.h" + +#include "unicode.h" + +struct unicode_decompose { + char *value; +}; + +declare_ptable(unicode_decompose) +implement_ptable(unicode_decompose) + +PTABLE(unicode_decompose) unicode_decompose_table; + +// the first digit in the composite string gives the number of composites + +struct S { + const char *key; + const char *value; +} unicode_decompose_list[] = { + { "00C0", "20041_0300" }, + { "00C1", "20041_0301" }, + { "00C2", "20041_0302" }, + { "00C3", "20041_0303" }, + { "00C4", "20041_0308" }, + { "00C5", "20041_030A" }, + { "00C7", "20043_0327" }, + { "00C8", "20045_0300" }, + { "00C9", "20045_0301" }, + { "00CA", "20045_0302" }, + { "00CB", "20045_0308" }, + { "00CC", "20049_0300" }, + { "00CD", "20049_0301" }, + { "00CE", "20049_0302" }, + { "00CF", "20049_0308" }, + { "00D1", "2004E_0303" }, + { "00D2", "2004F_0300" }, + { "00D3", "2004F_0301" }, + { "00D4", "2004F_0302" }, + { "00D5", "2004F_0303" }, + { "00D6", "2004F_0308" }, + { "00D9", "20055_0300" }, + { "00DA", "20055_0301" }, + { "00DB", "20055_0302" }, + { "00DC", "20055_0308" }, + { "00DD", "20059_0301" }, + { "00E0", "20061_0300" }, + { "00E1", "20061_0301" }, + { "00E2", "20061_0302" }, + { "00E3", "20061_0303" }, + { "00E4", "20061_0308" }, + { "00E5", "20061_030A" }, + { "00E7", "20063_0327" }, + { "00E8", "20065_0300" }, + { "00E9", "20065_0301" }, + { "00EA", "20065_0302" }, + { "00EB", "20065_0308" }, + { "00EC", "20069_0300" }, + { "00ED", "20069_0301" }, + { "00EE", "20069_0302" }, + { "00EF", "20069_0308" }, + { "00F1", "2006E_0303" }, + { "00F2", "2006F_0300" }, + { "00F3", "2006F_0301" }, + { "00F4", "2006F_0302" }, + { "00F5", "2006F_0303" }, + { "00F6", "2006F_0308" }, + { "00F9", "20075_0300" }, + { "00FA", "20075_0301" }, + { "00FB", "20075_0302" }, + { "00FC", "20075_0308" }, + { "00FD", "20079_0301" }, + { "00FF", "20079_0308" }, + { "0100", "20041_0304" }, + { "0101", "20061_0304" }, + { "0102", "20041_0306" }, + { "0103", "20061_0306" }, + { "0104", "20041_0328" }, + { "0105", "20061_0328" }, + { "0106", "20043_0301" }, + { "0107", "20063_0301" }, + { "0108", "20043_0302" }, + { "0109", "20063_0302" }, + { "010A", "20043_0307" }, + { "010B", "20063_0307" }, + { "010C", "20043_030C" }, + { "010D", "20063_030C" }, + { "010E", "20044_030C" }, + { "010F", "20064_030C" }, + { "0112", "20045_0304" }, + { "0113", "20065_0304" }, + { "0114", "20045_0306" }, + { "0115", "20065_0306" }, + { "0116", "20045_0307" }, + { "0117", "20065_0307" }, + { "0118", "20045_0328" }, + { "0119", "20065_0328" }, + { "011A", "20045_030C" }, + { "011B", "20065_030C" }, + { "011C", "20047_0302" }, + { "011D", "20067_0302" }, + { "011E", "20047_0306" }, + { "011F", "20067_0306" }, + { "0120", "20047_0307" }, + { "0121", "20067_0307" }, + { "0122", "20047_0327" }, + { "0123", "20067_0327" }, + { "0124", "20048_0302" }, + { "0125", "20068_0302" }, + { "0128", "20049_0303" }, + { "0129", "20069_0303" }, + { "012A", "20049_0304" }, + { "012B", "20069_0304" }, + { "012C", "20049_0306" }, + { "012D", "20069_0306" }, + { "012E", "20049_0328" }, + { "012F", "20069_0328" }, + { "0130", "20049_0307" }, + { "0134", "2004A_0302" }, + { "0135", "2006A_0302" }, + { "0136", "2004B_0327" }, + { "0137", "2006B_0327" }, + { "0139", "2004C_0301" }, + { "013A", "2006C_0301" }, + { "013B", "2004C_0327" }, + { "013C", "2006C_0327" }, + { "013D", "2004C_030C" }, + { "013E", "2006C_030C" }, + { "0143", "2004E_0301" }, + { "0144", "2006E_0301" }, + { "0145", "2004E_0327" }, + { "0146", "2006E_0327" }, + { "0147", "2004E_030C" }, + { "0148", "2006E_030C" }, + { "014C", "2004F_0304" }, + { "014D", "2006F_0304" }, + { "014E", "2004F_0306" }, + { "014F", "2006F_0306" }, + { "0150", "2004F_030B" }, + { "0151", "2006F_030B" }, + { "0154", "20052_0301" }, + { "0155", "20072_0301" }, + { "0156", "20052_0327" }, + { "0157", "20072_0327" }, + { "0158", "20052_030C" }, + { "0159", "20072_030C" }, + { "015A", "20053_0301" }, + { "015B", "20073_0301" }, + { "015C", "20053_0302" }, + { "015D", "20073_0302" }, + { "015E", "20053_0327" }, + { "015F", "20073_0327" }, + { "0160", "20053_030C" }, + { "0161", "20073_030C" }, + { "0162", "20054_0327" }, + { "0163", "20074_0327" }, + { "0164", "20054_030C" }, + { "0165", "20074_030C" }, + { "0168", "20055_0303" }, + { "0169", "20075_0303" }, + { "016A", "20055_0304" }, + { "016B", "20075_0304" }, + { "016C", "20055_0306" }, + { "016D", "20075_0306" }, + { "016E", "20055_030A" }, + { "016F", "20075_030A" }, + { "0170", "20055_030B" }, + { "0171", "20075_030B" }, + { "0172", "20055_0328" }, + { "0173", "20075_0328" }, + { "0174", "20057_0302" }, + { "0175", "20077_0302" }, + { "0176", "20059_0302" }, + { "0177", "20079_0302" }, + { "0178", "20059_0308" }, + { "0179", "2005A_0301" }, + { "017A", "2007A_0301" }, + { "017B", "2005A_0307" }, + { "017C", "2007A_0307" }, + { "017D", "2005A_030C" }, + { "017E", "2007A_030C" }, + { "01A0", "2004F_031B" }, + { "01A1", "2006F_031B" }, + { "01AF", "20055_031B" }, + { "01B0", "20075_031B" }, + { "01CD", "20041_030C" }, + { "01CE", "20061_030C" }, + { "01CF", "20049_030C" }, + { "01D0", "20069_030C" }, + { "01D1", "2004F_030C" }, + { "01D2", "2006F_030C" }, + { "01D3", "20055_030C" }, + { "01D4", "20075_030C" }, + { "01D5", "30055_0308_0304" }, + { "01D6", "30075_0308_0304" }, + { "01D7", "30055_0308_0301" }, + { "01D8", "30075_0308_0301" }, + { "01D9", "30055_0308_030C" }, + { "01DA", "30075_0308_030C" }, + { "01DB", "30055_0308_0300" }, + { "01DC", "30075_0308_0300" }, + { "01DE", "30041_0308_0304" }, + { "01DF", "30061_0308_0304" }, + { "01E0", "30041_0307_0304" }, + { "01E1", "30061_0307_0304" }, + { "01E2", "200C6_0304" }, + { "01E3", "200E6_0304" }, + { "01E6", "20047_030C" }, + { "01E7", "20067_030C" }, + { "01E8", "2004B_030C" }, + { "01E9", "2006B_030C" }, + { "01EA", "2004F_0328" }, + { "01EB", "2006F_0328" }, + { "01EC", "3004F_0328_0304" }, + { "01ED", "3006F_0328_0304" }, + { "01EE", "201B7_030C" }, + { "01EF", "20292_030C" }, + { "01F0", "2006A_030C" }, + { "01F4", "20047_0301" }, + { "01F5", "20067_0301" }, + { "01F8", "2004E_0300" }, + { "01F9", "2006E_0300" }, + { "01FA", "30041_030A_0301" }, + { "01FB", "30061_030A_0301" }, + { "01FC", "200C6_0301" }, + { "01FD", "200E6_0301" }, + { "01FE", "200D8_0301" }, + { "01FF", "200F8_0301" }, + { "0200", "20041_030F" }, + { "0201", "20061_030F" }, + { "0202", "20041_0311" }, + { "0203", "20061_0311" }, + { "0204", "20045_030F" }, + { "0205", "20065_030F" }, + { "0206", "20045_0311" }, + { "0207", "20065_0311" }, + { "0208", "20049_030F" }, + { "0209", "20069_030F" }, + { "020A", "20049_0311" }, + { "020B", "20069_0311" }, + { "020C", "2004F_030F" }, + { "020D", "2006F_030F" }, + { "020E", "2004F_0311" }, + { "020F", "2006F_0311" }, + { "0210", "20052_030F" }, + { "0211", "20072_030F" }, + { "0212", "20052_0311" }, + { "0213", "20072_0311" }, + { "0214", "20055_030F" }, + { "0215", "20075_030F" }, + { "0216", "20055_0311" }, + { "0217", "20075_0311" }, + { "0218", "20053_0326" }, + { "0219", "20073_0326" }, + { "021A", "20054_0326" }, + { "021B", "20074_0326" }, + { "021E", "20048_030C" }, + { "021F", "20068_030C" }, + { "0226", "20041_0307" }, + { "0227", "20061_0307" }, + { "0228", "20045_0327" }, + { "0229", "20065_0327" }, + { "022A", "3004F_0308_0304" }, + { "022B", "3006F_0308_0304" }, + { "022C", "3004F_0303_0304" }, + { "022D", "3006F_0303_0304" }, + { "022E", "2004F_0307" }, + { "022F", "2006F_0307" }, + { "0230", "3004F_0307_0304" }, + { "0231", "3006F_0307_0304" }, + { "0232", "20059_0304" }, + { "0233", "20079_0304" }, + { "0340", "10300" }, + { "0341", "10301" }, + { "0343", "10313" }, + { "0344", "20308_0301" }, + { "0374", "102B9" }, + { "037E", "1003B" }, + { "0385", "200A8_0301" }, + { "0386", "20391_0301" }, + { "0387", "100B7" }, + { "0388", "20395_0301" }, + { "0389", "20397_0301" }, + { "038A", "20399_0301" }, + { "038C", "2039F_0301" }, + { "038E", "203A5_0301" }, + { "038F", "203A9_0301" }, + { "0390", "303B9_0308_0301" }, + { "03AA", "20399_0308" }, + { "03AB", "203A5_0308" }, + { "03AC", "203B1_0301" }, + { "03AD", "203B5_0301" }, + { "03AE", "203B7_0301" }, + { "03AF", "203B9_0301" }, + { "03B0", "303C5_0308_0301" }, + { "03CA", "203B9_0308" }, + { "03CB", "203C5_0308" }, + { "03CC", "203BF_0301" }, + { "03CD", "203C5_0301" }, + { "03CE", "203C9_0301" }, + { "03D3", "203D2_0301" }, + { "03D4", "203D2_0308" }, + { "0400", "20415_0300" }, + { "0401", "20415_0308" }, + { "0403", "20413_0301" }, + { "0407", "20406_0308" }, + { "040C", "2041A_0301" }, + { "040D", "20418_0300" }, + { "040E", "20423_0306" }, + { "0419", "20418_0306" }, + { "0439", "20438_0306" }, + { "0450", "20435_0300" }, + { "0451", "20435_0308" }, + { "0453", "20433_0301" }, + { "0457", "20456_0308" }, + { "045C", "2043A_0301" }, + { "045D", "20438_0300" }, + { "045E", "20443_0306" }, + { "0476", "20474_030F" }, + { "0477", "20475_030F" }, + { "04C1", "20416_0306" }, + { "04C2", "20436_0306" }, + { "04D0", "20410_0306" }, + { "04D1", "20430_0306" }, + { "04D2", "20410_0308" }, + { "04D3", "20430_0308" }, + { "04D6", "20415_0306" }, + { "04D7", "20435_0306" }, + { "04DA", "204D8_0308" }, + { "04DB", "204D9_0308" }, + { "04DC", "20416_0308" }, + { "04DD", "20436_0308" }, + { "04DE", "20417_0308" }, + { "04DF", "20437_0308" }, + { "04E2", "20418_0304" }, + { "04E3", "20438_0304" }, + { "04E4", "20418_0308" }, + { "04E5", "20438_0308" }, + { "04E6", "2041E_0308" }, + { "04E7", "2043E_0308" }, + { "04EA", "204E8_0308" }, + { "04EB", "204E9_0308" }, + { "04EC", "2042D_0308" }, + { "04ED", "2044D_0308" }, + { "04EE", "20423_0304" }, + { "04EF", "20443_0304" }, + { "04F0", "20423_0308" }, + { "04F1", "20443_0308" }, + { "04F2", "20423_030B" }, + { "04F3", "20443_030B" }, + { "04F4", "20427_0308" }, + { "04F5", "20447_0308" }, + { "04F8", "2042B_0308" }, + { "04F9", "2044B_0308" }, + { "0622", "20627_0653" }, + { "0623", "20627_0654" }, + { "0624", "20648_0654" }, + { "0625", "20627_0655" }, + { "0626", "2064A_0654" }, + { "06C0", "206D5_0654" }, + { "06C2", "206C1_0654" }, + { "06D3", "206D2_0654" }, + { "0929", "20928_093C" }, + { "0931", "20930_093C" }, + { "0934", "20933_093C" }, + { "0958", "20915_093C" }, + { "0959", "20916_093C" }, + { "095A", "20917_093C" }, + { "095B", "2091C_093C" }, + { "095C", "20921_093C" }, + { "095D", "20922_093C" }, + { "095E", "2092B_093C" }, + { "095F", "2092F_093C" }, + { "09CB", "209C7_09BE" }, + { "09CC", "209C7_09D7" }, + { "09DC", "209A1_09BC" }, + { "09DD", "209A2_09BC" }, + { "09DF", "209AF_09BC" }, + { "0A33", "20A32_0A3C" }, + { "0A36", "20A38_0A3C" }, + { "0A59", "20A16_0A3C" }, + { "0A5A", "20A17_0A3C" }, + { "0A5B", "20A1C_0A3C" }, + { "0A5E", "20A2B_0A3C" }, + { "0B48", "20B47_0B56" }, + { "0B4B", "20B47_0B3E" }, + { "0B4C", "20B47_0B57" }, + { "0B5C", "20B21_0B3C" }, + { "0B5D", "20B22_0B3C" }, + { "0B94", "20B92_0BD7" }, + { "0BCA", "20BC6_0BBE" }, + { "0BCB", "20BC7_0BBE" }, + { "0BCC", "20BC6_0BD7" }, + { "0C48", "20C46_0C56" }, + { "0CC0", "20CBF_0CD5" }, + { "0CC7", "20CC6_0CD5" }, + { "0CC8", "20CC6_0CD6" }, + { "0CCA", "20CC6_0CC2" }, + { "0CCB", "30CC6_0CC2_0CD5" }, + { "0D4A", "20D46_0D3E" }, + { "0D4B", "20D47_0D3E" }, + { "0D4C", "20D46_0D57" }, + { "0DDA", "20DD9_0DCA" }, + { "0DDC", "20DD9_0DCF" }, + { "0DDD", "30DD9_0DCF_0DCA" }, + { "0DDE", "20DD9_0DDF" }, + { "0F43", "20F42_0FB7" }, + { "0F4D", "20F4C_0FB7" }, + { "0F52", "20F51_0FB7" }, + { "0F57", "20F56_0FB7" }, + { "0F5C", "20F5B_0FB7" }, + { "0F69", "20F40_0FB5" }, + { "0F73", "20F71_0F72" }, + { "0F75", "20F71_0F74" }, + { "0F76", "20FB2_0F80" }, + { "0F78", "20FB3_0F80" }, + { "0F81", "20F71_0F80" }, + { "0F93", "20F92_0FB7" }, + { "0F9D", "20F9C_0FB7" }, + { "0FA2", "20FA1_0FB7" }, + { "0FA7", "20FA6_0FB7" }, + { "0FAC", "20FAB_0FB7" }, + { "0FB9", "20F90_0FB5" }, + { "1026", "21025_102E" }, + { "1E00", "20041_0325" }, + { "1E01", "20061_0325" }, + { "1E02", "20042_0307" }, + { "1E03", "20062_0307" }, + { "1E04", "20042_0323" }, + { "1E05", "20062_0323" }, + { "1E06", "20042_0331" }, + { "1E07", "20062_0331" }, + { "1E08", "30043_0327_0301" }, + { "1E09", "30063_0327_0301" }, + { "1E0A", "20044_0307" }, + { "1E0B", "20064_0307" }, + { "1E0C", "20044_0323" }, + { "1E0D", "20064_0323" }, + { "1E0E", "20044_0331" }, + { "1E0F", "20064_0331" }, + { "1E10", "20044_0327" }, + { "1E11", "20064_0327" }, + { "1E12", "20044_032D" }, + { "1E13", "20064_032D" }, + { "1E14", "30045_0304_0300" }, + { "1E15", "30065_0304_0300" }, + { "1E16", "30045_0304_0301" }, + { "1E17", "30065_0304_0301" }, + { "1E18", "20045_032D" }, + { "1E19", "20065_032D" }, + { "1E1A", "20045_0330" }, + { "1E1B", "20065_0330" }, + { "1E1C", "30045_0327_0306" }, + { "1E1D", "30065_0327_0306" }, + { "1E1E", "20046_0307" }, + { "1E1F", "20066_0307" }, + { "1E20", "20047_0304" }, + { "1E21", "20067_0304" }, + { "1E22", "20048_0307" }, + { "1E23", "20068_0307" }, + { "1E24", "20048_0323" }, + { "1E25", "20068_0323" }, + { "1E26", "20048_0308" }, + { "1E27", "20068_0308" }, + { "1E28", "20048_0327" }, + { "1E29", "20068_0327" }, + { "1E2A", "20048_032E" }, + { "1E2B", "20068_032E" }, + { "1E2C", "20049_0330" }, + { "1E2D", "20069_0330" }, + { "1E2E", "30049_0308_0301" }, + { "1E2F", "30069_0308_0301" }, + { "1E30", "2004B_0301" }, + { "1E31", "2006B_0301" }, + { "1E32", "2004B_0323" }, + { "1E33", "2006B_0323" }, + { "1E34", "2004B_0331" }, + { "1E35", "2006B_0331" }, + { "1E36", "2004C_0323" }, + { "1E37", "2006C_0323" }, + { "1E38", "3004C_0323_0304" }, + { "1E39", "3006C_0323_0304" }, + { "1E3A", "2004C_0331" }, + { "1E3B", "2006C_0331" }, + { "1E3C", "2004C_032D" }, + { "1E3D", "2006C_032D" }, + { "1E3E", "2004D_0301" }, + { "1E3F", "2006D_0301" }, + { "1E40", "2004D_0307" }, + { "1E41", "2006D_0307" }, + { "1E42", "2004D_0323" }, + { "1E43", "2006D_0323" }, + { "1E44", "2004E_0307" }, + { "1E45", "2006E_0307" }, + { "1E46", "2004E_0323" }, + { "1E47", "2006E_0323" }, + { "1E48", "2004E_0331" }, + { "1E49", "2006E_0331" }, + { "1E4A", "2004E_032D" }, + { "1E4B", "2006E_032D" }, + { "1E4C", "3004F_0303_0301" }, + { "1E4D", "3006F_0303_0301" }, + { "1E4E", "3004F_0303_0308" }, + { "1E4F", "3006F_0303_0308" }, + { "1E50", "3004F_0304_0300" }, + { "1E51", "3006F_0304_0300" }, + { "1E52", "3004F_0304_0301" }, + { "1E53", "3006F_0304_0301" }, + { "1E54", "20050_0301" }, + { "1E55", "20070_0301" }, + { "1E56", "20050_0307" }, + { "1E57", "20070_0307" }, + { "1E58", "20052_0307" }, + { "1E59", "20072_0307" }, + { "1E5A", "20052_0323" }, + { "1E5B", "20072_0323" }, + { "1E5C", "30052_0323_0304" }, + { "1E5D", "30072_0323_0304" }, + { "1E5E", "20052_0331" }, + { "1E5F", "20072_0331" }, + { "1E60", "20053_0307" }, + { "1E61", "20073_0307" }, + { "1E62", "20053_0323" }, + { "1E63", "20073_0323" }, + { "1E64", "30053_0301_0307" }, + { "1E65", "30073_0301_0307" }, + { "1E66", "30053_030C_0307" }, + { "1E67", "30073_030C_0307" }, + { "1E68", "30053_0323_0307" }, + { "1E69", "30073_0323_0307" }, + { "1E6A", "20054_0307" }, + { "1E6B", "20074_0307" }, + { "1E6C", "20054_0323" }, + { "1E6D", "20074_0323" }, + { "1E6E", "20054_0331" }, + { "1E6F", "20074_0331" }, + { "1E70", "20054_032D" }, + { "1E71", "20074_032D" }, + { "1E72", "20055_0324" }, + { "1E73", "20075_0324" }, + { "1E74", "20055_0330" }, + { "1E75", "20075_0330" }, + { "1E76", "20055_032D" }, + { "1E77", "20075_032D" }, + { "1E78", "30055_0303_0301" }, + { "1E79", "30075_0303_0301" }, + { "1E7A", "30055_0304_0308" }, + { "1E7B", "30075_0304_0308" }, + { "1E7C", "20056_0303" }, + { "1E7D", "20076_0303" }, + { "1E7E", "20056_0323" }, + { "1E7F", "20076_0323" }, + { "1E80", "20057_0300" }, + { "1E81", "20077_0300" }, + { "1E82", "20057_0301" }, + { "1E83", "20077_0301" }, + { "1E84", "20057_0308" }, + { "1E85", "20077_0308" }, + { "1E86", "20057_0307" }, + { "1E87", "20077_0307" }, + { "1E88", "20057_0323" }, + { "1E89", "20077_0323" }, + { "1E8A", "20058_0307" }, + { "1E8B", "20078_0307" }, + { "1E8C", "20058_0308" }, + { "1E8D", "20078_0308" }, + { "1E8E", "20059_0307" }, + { "1E8F", "20079_0307" }, + { "1E90", "2005A_0302" }, + { "1E91", "2007A_0302" }, + { "1E92", "2005A_0323" }, + { "1E93", "2007A_0323" }, + { "1E94", "2005A_0331" }, + { "1E95", "2007A_0331" }, + { "1E96", "20068_0331" }, + { "1E97", "20074_0308" }, + { "1E98", "20077_030A" }, + { "1E99", "20079_030A" }, + { "1E9B", "2017F_0307" }, + { "1EA0", "20041_0323" }, + { "1EA1", "20061_0323" }, + { "1EA2", "20041_0309" }, + { "1EA3", "20061_0309" }, + { "1EA4", "30041_0302_0301" }, + { "1EA5", "30061_0302_0301" }, + { "1EA6", "30041_0302_0300" }, + { "1EA7", "30061_0302_0300" }, + { "1EA8", "30041_0302_0309" }, + { "1EA9", "30061_0302_0309" }, + { "1EAA", "30041_0302_0303" }, + { "1EAB", "30061_0302_0303" }, + { "1EAC", "30041_0323_0302" }, + { "1EAD", "30061_0323_0302" }, + { "1EAE", "30041_0306_0301" }, + { "1EAF", "30061_0306_0301" }, + { "1EB0", "30041_0306_0300" }, + { "1EB1", "30061_0306_0300" }, + { "1EB2", "30041_0306_0309" }, + { "1EB3", "30061_0306_0309" }, + { "1EB4", "30041_0306_0303" }, + { "1EB5", "30061_0306_0303" }, + { "1EB6", "30041_0323_0306" }, + { "1EB7", "30061_0323_0306" }, + { "1EB8", "20045_0323" }, + { "1EB9", "20065_0323" }, + { "1EBA", "20045_0309" }, + { "1EBB", "20065_0309" }, + { "1EBC", "20045_0303" }, + { "1EBD", "20065_0303" }, + { "1EBE", "30045_0302_0301" }, + { "1EBF", "30065_0302_0301" }, + { "1EC0", "30045_0302_0300" }, + { "1EC1", "30065_0302_0300" }, + { "1EC2", "30045_0302_0309" }, + { "1EC3", "30065_0302_0309" }, + { "1EC4", "30045_0302_0303" }, + { "1EC5", "30065_0302_0303" }, + { "1EC6", "30045_0323_0302" }, + { "1EC7", "30065_0323_0302" }, + { "1EC8", "20049_0309" }, + { "1EC9", "20069_0309" }, + { "1ECA", "20049_0323" }, + { "1ECB", "20069_0323" }, + { "1ECC", "2004F_0323" }, + { "1ECD", "2006F_0323" }, + { "1ECE", "2004F_0309" }, + { "1ECF", "2006F_0309" }, + { "1ED0", "3004F_0302_0301" }, + { "1ED1", "3006F_0302_0301" }, + { "1ED2", "3004F_0302_0300" }, + { "1ED3", "3006F_0302_0300" }, + { "1ED4", "3004F_0302_0309" }, + { "1ED5", "3006F_0302_0309" }, + { "1ED6", "3004F_0302_0303" }, + { "1ED7", "3006F_0302_0303" }, + { "1ED8", "3004F_0323_0302" }, + { "1ED9", "3006F_0323_0302" }, + { "1EDA", "3004F_031B_0301" }, + { "1EDB", "3006F_031B_0301" }, + { "1EDC", "3004F_031B_0300" }, + { "1EDD", "3006F_031B_0300" }, + { "1EDE", "3004F_031B_0309" }, + { "1EDF", "3006F_031B_0309" }, + { "1EE0", "3004F_031B_0303" }, + { "1EE1", "3006F_031B_0303" }, + { "1EE2", "3004F_031B_0323" }, + { "1EE3", "3006F_031B_0323" }, + { "1EE4", "20055_0323" }, + { "1EE5", "20075_0323" }, + { "1EE6", "20055_0309" }, + { "1EE7", "20075_0309" }, + { "1EE8", "30055_031B_0301" }, + { "1EE9", "30075_031B_0301" }, + { "1EEA", "30055_031B_0300" }, + { "1EEB", "30075_031B_0300" }, + { "1EEC", "30055_031B_0309" }, + { "1EED", "30075_031B_0309" }, + { "1EEE", "30055_031B_0303" }, + { "1EEF", "30075_031B_0303" }, + { "1EF0", "30055_031B_0323" }, + { "1EF1", "30075_031B_0323" }, + { "1EF2", "20059_0300" }, + { "1EF3", "20079_0300" }, + { "1EF4", "20059_0323" }, + { "1EF5", "20079_0323" }, + { "1EF6", "20059_0309" }, + { "1EF7", "20079_0309" }, + { "1EF8", "20059_0303" }, + { "1EF9", "20079_0303" }, + { "1F00", "203B1_0313" }, + { "1F01", "203B1_0314" }, + { "1F02", "303B1_0313_0300" }, + { "1F03", "303B1_0314_0300" }, + { "1F04", "303B1_0313_0301" }, + { "1F05", "303B1_0314_0301" }, + { "1F06", "303B1_0313_0342" }, + { "1F07", "303B1_0314_0342" }, + { "1F08", "20391_0313" }, + { "1F09", "20391_0314" }, + { "1F0A", "30391_0313_0300" }, + { "1F0B", "30391_0314_0300" }, + { "1F0C", "30391_0313_0301" }, + { "1F0D", "30391_0314_0301" }, + { "1F0E", "30391_0313_0342" }, + { "1F0F", "30391_0314_0342" }, + { "1F10", "203B5_0313" }, + { "1F11", "203B5_0314" }, + { "1F12", "303B5_0313_0300" }, + { "1F13", "303B5_0314_0300" }, + { "1F14", "303B5_0313_0301" }, + { "1F15", "303B5_0314_0301" }, + { "1F18", "20395_0313" }, + { "1F19", "20395_0314" }, + { "1F1A", "30395_0313_0300" }, + { "1F1B", "30395_0314_0300" }, + { "1F1C", "30395_0313_0301" }, + { "1F1D", "30395_0314_0301" }, + { "1F20", "203B7_0313" }, + { "1F21", "203B7_0314" }, + { "1F22", "303B7_0313_0300" }, + { "1F23", "303B7_0314_0300" }, + { "1F24", "303B7_0313_0301" }, + { "1F25", "303B7_0314_0301" }, + { "1F26", "303B7_0313_0342" }, + { "1F27", "303B7_0314_0342" }, + { "1F28", "20397_0313" }, + { "1F29", "20397_0314" }, + { "1F2A", "30397_0313_0300" }, + { "1F2B", "30397_0314_0300" }, + { "1F2C", "30397_0313_0301" }, + { "1F2D", "30397_0314_0301" }, + { "1F2E", "30397_0313_0342" }, + { "1F2F", "30397_0314_0342" }, + { "1F30", "203B9_0313" }, + { "1F31", "203B9_0314" }, + { "1F32", "303B9_0313_0300" }, + { "1F33", "303B9_0314_0300" }, + { "1F34", "303B9_0313_0301" }, + { "1F35", "303B9_0314_0301" }, + { "1F36", "303B9_0313_0342" }, + { "1F37", "303B9_0314_0342" }, + { "1F38", "20399_0313" }, + { "1F39", "20399_0314" }, + { "1F3A", "30399_0313_0300" }, + { "1F3B", "30399_0314_0300" }, + { "1F3C", "30399_0313_0301" }, + { "1F3D", "30399_0314_0301" }, + { "1F3E", "30399_0313_0342" }, + { "1F3F", "30399_0314_0342" }, + { "1F40", "203BF_0313" }, + { "1F41", "203BF_0314" }, + { "1F42", "303BF_0313_0300" }, + { "1F43", "303BF_0314_0300" }, + { "1F44", "303BF_0313_0301" }, + { "1F45", "303BF_0314_0301" }, + { "1F48", "2039F_0313" }, + { "1F49", "2039F_0314" }, + { "1F4A", "3039F_0313_0300" }, + { "1F4B", "3039F_0314_0300" }, + { "1F4C", "3039F_0313_0301" }, + { "1F4D", "3039F_0314_0301" }, + { "1F50", "203C5_0313" }, + { "1F51", "203C5_0314" }, + { "1F52", "303C5_0313_0300" }, + { "1F53", "303C5_0314_0300" }, + { "1F54", "303C5_0313_0301" }, + { "1F55", "303C5_0314_0301" }, + { "1F56", "303C5_0313_0342" }, + { "1F57", "303C5_0314_0342" }, + { "1F59", "203A5_0314" }, + { "1F5B", "303A5_0314_0300" }, + { "1F5D", "303A5_0314_0301" }, + { "1F5F", "303A5_0314_0342" }, + { "1F60", "203C9_0313" }, + { "1F61", "203C9_0314" }, + { "1F62", "303C9_0313_0300" }, + { "1F63", "303C9_0314_0300" }, + { "1F64", "303C9_0313_0301" }, + { "1F65", "303C9_0314_0301" }, + { "1F66", "303C9_0313_0342" }, + { "1F67", "303C9_0314_0342" }, + { "1F68", "203A9_0313" }, + { "1F69", "203A9_0314" }, + { "1F6A", "303A9_0313_0300" }, + { "1F6B", "303A9_0314_0300" }, + { "1F6C", "303A9_0313_0301" }, + { "1F6D", "303A9_0314_0301" }, + { "1F6E", "303A9_0313_0342" }, + { "1F6F", "303A9_0314_0342" }, + { "1F70", "203B1_0300" }, + { "1F71", "203B1_0301" }, + { "1F72", "203B5_0300" }, + { "1F73", "203B5_0301" }, + { "1F74", "203B7_0300" }, + { "1F75", "203B7_0301" }, + { "1F76", "203B9_0300" }, + { "1F77", "203B9_0301" }, + { "1F78", "203BF_0300" }, + { "1F79", "203BF_0301" }, + { "1F7A", "203C5_0300" }, + { "1F7B", "203C5_0301" }, + { "1F7C", "203C9_0300" }, + { "1F7D", "203C9_0301" }, + { "1F80", "303B1_0313_0345" }, + { "1F81", "303B1_0314_0345" }, + { "1F82", "403B1_0313_0300_0345" }, + { "1F83", "403B1_0314_0300_0345" }, + { "1F84", "403B1_0313_0301_0345" }, + { "1F85", "403B1_0314_0301_0345" }, + { "1F86", "403B1_0313_0342_0345" }, + { "1F87", "403B1_0314_0342_0345" }, + { "1F88", "30391_0313_0345" }, + { "1F89", "30391_0314_0345" }, + { "1F8A", "40391_0313_0300_0345" }, + { "1F8B", "40391_0314_0300_0345" }, + { "1F8C", "40391_0313_0301_0345" }, + { "1F8D", "40391_0314_0301_0345" }, + { "1F8E", "40391_0313_0342_0345" }, + { "1F8F", "40391_0314_0342_0345" }, + { "1F90", "303B7_0313_0345" }, + { "1F91", "303B7_0314_0345" }, + { "1F92", "403B7_0313_0300_0345" }, + { "1F93", "403B7_0314_0300_0345" }, + { "1F94", "403B7_0313_0301_0345" }, + { "1F95", "403B7_0314_0301_0345" }, + { "1F96", "403B7_0313_0342_0345" }, + { "1F97", "403B7_0314_0342_0345" }, + { "1F98", "30397_0313_0345" }, + { "1F99", "30397_0314_0345" }, + { "1F9A", "40397_0313_0300_0345" }, + { "1F9B", "40397_0314_0300_0345" }, + { "1F9C", "40397_0313_0301_0345" }, + { "1F9D", "40397_0314_0301_0345" }, + { "1F9E", "40397_0313_0342_0345" }, + { "1F9F", "40397_0314_0342_0345" }, + { "1FA0", "303C9_0313_0345" }, + { "1FA1", "303C9_0314_0345" }, + { "1FA2", "403C9_0313_0300_0345" }, + { "1FA3", "403C9_0314_0300_0345" }, + { "1FA4", "403C9_0313_0301_0345" }, + { "1FA5", "403C9_0314_0301_0345" }, + { "1FA6", "403C9_0313_0342_0345" }, + { "1FA7", "403C9_0314_0342_0345" }, + { "1FA8", "303A9_0313_0345" }, + { "1FA9", "303A9_0314_0345" }, + { "1FAA", "403A9_0313_0300_0345" }, + { "1FAB", "403A9_0314_0300_0345" }, + { "1FAC", "403A9_0313_0301_0345" }, + { "1FAD", "403A9_0314_0301_0345" }, + { "1FAE", "403A9_0313_0342_0345" }, + { "1FAF", "403A9_0314_0342_0345" }, + { "1FB0", "203B1_0306" }, + { "1FB1", "203B1_0304" }, + { "1FB2", "303B1_0300_0345" }, + { "1FB3", "203B1_0345" }, + { "1FB4", "303B1_0301_0345" }, + { "1FB6", "203B1_0342" }, + { "1FB7", "303B1_0342_0345" }, + { "1FB8", "20391_0306" }, + { "1FB9", "20391_0304" }, + { "1FBA", "20391_0300" }, + { "1FBB", "20391_0301" }, + { "1FBC", "20391_0345" }, + { "1FBE", "103B9" }, + { "1FC1", "200A8_0342" }, + { "1FC2", "303B7_0300_0345" }, + { "1FC3", "203B7_0345" }, + { "1FC4", "303B7_0301_0345" }, + { "1FC6", "203B7_0342" }, + { "1FC7", "303B7_0342_0345" }, + { "1FC8", "20395_0300" }, + { "1FC9", "20395_0301" }, + { "1FCA", "20397_0300" }, + { "1FCB", "20397_0301" }, + { "1FCC", "20397_0345" }, + { "1FCD", "21FBF_0300" }, + { "1FCE", "21FBF_0301" }, + { "1FCF", "21FBF_0342" }, + { "1FD0", "203B9_0306" }, + { "1FD1", "203B9_0304" }, + { "1FD2", "303B9_0308_0300" }, + { "1FD3", "303B9_0308_0301" }, + { "1FD6", "203B9_0342" }, + { "1FD7", "303B9_0308_0342" }, + { "1FD8", "20399_0306" }, + { "1FD9", "20399_0304" }, + { "1FDA", "20399_0300" }, + { "1FDB", "20399_0301" }, + { "1FDD", "21FFE_0300" }, + { "1FDE", "21FFE_0301" }, + { "1FDF", "21FFE_0342" }, + { "1FE0", "203C5_0306" }, + { "1FE1", "203C5_0304" }, + { "1FE2", "303C5_0308_0300" }, + { "1FE3", "303C5_0308_0301" }, + { "1FE4", "203C1_0313" }, + { "1FE5", "203C1_0314" }, + { "1FE6", "203C5_0342" }, + { "1FE7", "303C5_0308_0342" }, + { "1FE8", "203A5_0306" }, + { "1FE9", "203A5_0304" }, + { "1FEA", "203A5_0300" }, + { "1FEB", "203A5_0301" }, + { "1FEC", "203A1_0314" }, + { "1FED", "200A8_0300" }, + { "1FEE", "200A8_0301" }, + { "1FEF", "10060" }, + { "1FF2", "303C9_0300_0345" }, + { "1FF3", "203C9_0345" }, + { "1FF4", "303C9_0301_0345" }, + { "1FF6", "203C9_0342" }, + { "1FF7", "303C9_0342_0345" }, + { "1FF8", "2039F_0300" }, + { "1FF9", "2039F_0301" }, + { "1FFA", "203A9_0300" }, + { "1FFB", "203A9_0301" }, + { "1FFC", "203A9_0345" }, + { "1FFD", "100B4" }, + { "2000", "12002" }, + { "2001", "12003" }, + { "2126", "103A9" }, + { "212A", "1004B" }, + { "212B", "20041_030A" }, + { "219A", "22190_0338" }, + { "219B", "22192_0338" }, + { "21AE", "22194_0338" }, + { "21CD", "221D0_0338" }, + { "21CE", "221D4_0338" }, + { "21CF", "221D2_0338" }, + { "2204", "22203_0338" }, + { "2209", "22208_0338" }, + { "220C", "2220B_0338" }, + { "2224", "22223_0338" }, + { "2226", "22225_0338" }, + { "2241", "2223C_0338" }, + { "2244", "22243_0338" }, + { "2247", "22245_0338" }, + { "2249", "22248_0338" }, + { "2260", "2003D_0338" }, + { "2262", "22261_0338" }, + { "226D", "2224D_0338" }, + { "226E", "2003C_0338" }, + { "226F", "2003E_0338" }, + { "2270", "22264_0338" }, + { "2271", "22265_0338" }, + { "2274", "22272_0338" }, + { "2275", "22273_0338" }, + { "2278", "22276_0338" }, + { "2279", "22277_0338" }, + { "2280", "2227A_0338" }, + { "2281", "2227B_0338" }, + { "2284", "22282_0338" }, + { "2285", "22283_0338" }, + { "2288", "22286_0338" }, + { "2289", "22287_0338" }, + { "22AC", "222A2_0338" }, + { "22AD", "222A8_0338" }, + { "22AE", "222A9_0338" }, + { "22AF", "222AB_0338" }, + { "22E0", "2227C_0338" }, + { "22E1", "2227D_0338" }, + { "22E2", "22291_0338" }, + { "22E3", "22292_0338" }, + { "22EA", "222B2_0338" }, + { "22EB", "222B3_0338" }, + { "22EC", "222B4_0338" }, + { "22ED", "222B5_0338" }, + { "2329", "13008" }, + { "232A", "13009" }, + { "2ADC", "22ADD_0338" }, + { "304C", "2304B_3099" }, + { "304E", "2304D_3099" }, + { "3050", "2304F_3099" }, + { "3052", "23051_3099" }, + { "3054", "23053_3099" }, + { "3056", "23055_3099" }, + { "3058", "23057_3099" }, + { "305A", "23059_3099" }, + { "305C", "2305B_3099" }, + { "305E", "2305D_3099" }, + { "3060", "2305F_3099" }, + { "3062", "23061_3099" }, + { "3065", "23064_3099" }, + { "3067", "23066_3099" }, + { "3069", "23068_3099" }, + { "3070", "2306F_3099" }, + { "3071", "2306F_309A" }, + { "3073", "23072_3099" }, + { "3074", "23072_309A" }, + { "3076", "23075_3099" }, + { "3077", "23075_309A" }, + { "3079", "23078_3099" }, + { "307A", "23078_309A" }, + { "307C", "2307B_3099" }, + { "307D", "2307B_309A" }, + { "3094", "23046_3099" }, + { "309E", "2309D_3099" }, + { "30AC", "230AB_3099" }, + { "30AE", "230AD_3099" }, + { "30B0", "230AF_3099" }, + { "30B2", "230B1_3099" }, + { "30B4", "230B3_3099" }, + { "30B6", "230B5_3099" }, + { "30B8", "230B7_3099" }, + { "30BA", "230B9_3099" }, + { "30BC", "230BB_3099" }, + { "30BE", "230BD_3099" }, + { "30C0", "230BF_3099" }, + { "30C2", "230C1_3099" }, + { "30C5", "230C4_3099" }, + { "30C7", "230C6_3099" }, + { "30C9", "230C8_3099" }, + { "30D0", "230CF_3099" }, + { "30D1", "230CF_309A" }, + { "30D3", "230D2_3099" }, + { "30D4", "230D2_309A" }, + { "30D6", "230D5_3099" }, + { "30D7", "230D5_309A" }, + { "30D9", "230D8_3099" }, + { "30DA", "230D8_309A" }, + { "30DC", "230DB_3099" }, + { "30DD", "230DB_309A" }, + { "30F4", "230A6_3099" }, + { "30F7", "230EF_3099" }, + { "30F8", "230F0_3099" }, + { "30F9", "230F1_3099" }, + { "30FA", "230F2_3099" }, + { "30FE", "230FD_3099" }, + { "F900", "18C48" }, + { "F901", "166F4" }, + { "F902", "18ECA" }, + { "F903", "18CC8" }, + { "F904", "16ED1" }, + { "F905", "14E32" }, + { "F906", "153E5" }, + { "F907", "19F9C" }, + { "F908", "19F9C" }, + { "F909", "15951" }, + { "F90A", "191D1" }, + { "F90B", "15587" }, + { "F90C", "15948" }, + { "F90D", "161F6" }, + { "F90E", "17669" }, + { "F90F", "17F85" }, + { "F910", "1863F" }, + { "F911", "187BA" }, + { "F912", "188F8" }, + { "F913", "1908F" }, + { "F914", "16A02" }, + { "F915", "16D1B" }, + { "F916", "170D9" }, + { "F917", "173DE" }, + { "F918", "1843D" }, + { "F919", "1916A" }, + { "F91A", "199F1" }, + { "F91B", "14E82" }, + { "F91C", "15375" }, + { "F91D", "16B04" }, + { "F91E", "1721B" }, + { "F91F", "1862D" }, + { "F920", "19E1E" }, + { "F921", "15D50" }, + { "F922", "16FEB" }, + { "F923", "185CD" }, + { "F924", "18964" }, + { "F925", "162C9" }, + { "F926", "181D8" }, + { "F927", "1881F" }, + { "F928", "15ECA" }, + { "F929", "16717" }, + { "F92A", "16D6A" }, + { "F92B", "172FC" }, + { "F92C", "190CE" }, + { "F92D", "14F86" }, + { "F92E", "151B7" }, + { "F92F", "152DE" }, + { "F930", "164C4" }, + { "F931", "16AD3" }, + { "F932", "17210" }, + { "F933", "176E7" }, + { "F934", "18001" }, + { "F935", "18606" }, + { "F936", "1865C" }, + { "F937", "18DEF" }, + { "F938", "19732" }, + { "F939", "19B6F" }, + { "F93A", "19DFA" }, + { "F93B", "1788C" }, + { "F93C", "1797F" }, + { "F93D", "17DA0" }, + { "F93E", "183C9" }, + { "F93F", "19304" }, + { "F940", "19E7F" }, + { "F941", "18AD6" }, + { "F942", "158DF" }, + { "F943", "15F04" }, + { "F944", "17C60" }, + { "F945", "1807E" }, + { "F946", "17262" }, + { "F947", "178CA" }, + { "F948", "18CC2" }, + { "F949", "196F7" }, + { "F94A", "158D8" }, + { "F94B", "15C62" }, + { "F94C", "16A13" }, + { "F94D", "16DDA" }, + { "F94E", "16F0F" }, + { "F94F", "17D2F" }, + { "F950", "17E37" }, + { "F951", "1964B" }, + { "F952", "152D2" }, + { "F953", "1808B" }, + { "F954", "151DC" }, + { "F955", "151CC" }, + { "F956", "17A1C" }, + { "F957", "17DBE" }, + { "F958", "183F1" }, + { "F959", "19675" }, + { "F95A", "18B80" }, + { "F95B", "162CF" }, + { "F95C", "16A02" }, + { "F95D", "18AFE" }, + { "F95E", "14E39" }, + { "F95F", "15BE7" }, + { "F960", "16012" }, + { "F961", "17387" }, + { "F962", "17570" }, + { "F963", "15317" }, + { "F964", "178FB" }, + { "F965", "14FBF" }, + { "F966", "15FA9" }, + { "F967", "14E0D" }, + { "F968", "16CCC" }, + { "F969", "16578" }, + { "F96A", "17D22" }, + { "F96B", "153C3" }, + { "F96C", "1585E" }, + { "F96D", "17701" }, + { "F96E", "18449" }, + { "F96F", "18AAA" }, + { "F970", "16BBA" }, + { "F971", "18FB0" }, + { "F972", "16C88" }, + { "F973", "162FE" }, + { "F974", "182E5" }, + { "F975", "163A0" }, + { "F976", "17565" }, + { "F977", "14EAE" }, + { "F978", "15169" }, + { "F979", "151C9" }, + { "F97A", "16881" }, + { "F97B", "17CE7" }, + { "F97C", "1826F" }, + { "F97D", "18AD2" }, + { "F97E", "191CF" }, + { "F97F", "152F5" }, + { "F980", "15442" }, + { "F981", "15973" }, + { "F982", "15EEC" }, + { "F983", "165C5" }, + { "F984", "16FFE" }, + { "F985", "1792A" }, + { "F986", "195AD" }, + { "F987", "19A6A" }, + { "F988", "19E97" }, + { "F989", "19ECE" }, + { "F98A", "1529B" }, + { "F98B", "166C6" }, + { "F98C", "16B77" }, + { "F98D", "18F62" }, + { "F98E", "15E74" }, + { "F98F", "16190" }, + { "F990", "16200" }, + { "F991", "1649A" }, + { "F992", "16F23" }, + { "F993", "17149" }, + { "F994", "17489" }, + { "F995", "179CA" }, + { "F996", "17DF4" }, + { "F997", "1806F" }, + { "F998", "18F26" }, + { "F999", "184EE" }, + { "F99A", "19023" }, + { "F99B", "1934A" }, + { "F99C", "15217" }, + { "F99D", "152A3" }, + { "F99E", "154BD" }, + { "F99F", "170C8" }, + { "F9A0", "188C2" }, + { "F9A1", "18AAA" }, + { "F9A2", "15EC9" }, + { "F9A3", "15FF5" }, + { "F9A4", "1637B" }, + { "F9A5", "16BAE" }, + { "F9A6", "17C3E" }, + { "F9A7", "17375" }, + { "F9A8", "14EE4" }, + { "F9A9", "156F9" }, + { "F9AA", "15BE7" }, + { "F9AB", "15DBA" }, + { "F9AC", "1601C" }, + { "F9AD", "173B2" }, + { "F9AE", "17469" }, + { "F9AF", "17F9A" }, + { "F9B0", "18046" }, + { "F9B1", "19234" }, + { "F9B2", "196F6" }, + { "F9B3", "19748" }, + { "F9B4", "19818" }, + { "F9B5", "14F8B" }, + { "F9B6", "179AE" }, + { "F9B7", "191B4" }, + { "F9B8", "196B8" }, + { "F9B9", "160E1" }, + { "F9BA", "14E86" }, + { "F9BB", "150DA" }, + { "F9BC", "15BEE" }, + { "F9BD", "15C3F" }, + { "F9BE", "16599" }, + { "F9BF", "16A02" }, + { "F9C0", "171CE" }, + { "F9C1", "17642" }, + { "F9C2", "184FC" }, + { "F9C3", "1907C" }, + { "F9C4", "19F8D" }, + { "F9C5", "16688" }, + { "F9C6", "1962E" }, + { "F9C7", "15289" }, + { "F9C8", "1677B" }, + { "F9C9", "167F3" }, + { "F9CA", "16D41" }, + { "F9CB", "16E9C" }, + { "F9CC", "17409" }, + { "F9CD", "17559" }, + { "F9CE", "1786B" }, + { "F9CF", "17D10" }, + { "F9D0", "1985E" }, + { "F9D1", "1516D" }, + { "F9D2", "1622E" }, + { "F9D3", "19678" }, + { "F9D4", "1502B" }, + { "F9D5", "15D19" }, + { "F9D6", "16DEA" }, + { "F9D7", "18F2A" }, + { "F9D8", "15F8B" }, + { "F9D9", "16144" }, + { "F9DA", "16817" }, + { "F9DB", "17387" }, + { "F9DC", "19686" }, + { "F9DD", "15229" }, + { "F9DE", "1540F" }, + { "F9DF", "15C65" }, + { "F9E0", "16613" }, + { "F9E1", "1674E" }, + { "F9E2", "168A8" }, + { "F9E3", "16CE5" }, + { "F9E4", "17406" }, + { "F9E5", "175E2" }, + { "F9E6", "17F79" }, + { "F9E7", "188CF" }, + { "F9E8", "188E1" }, + { "F9E9", "191CC" }, + { "F9EA", "196E2" }, + { "F9EB", "1533F" }, + { "F9EC", "16EBA" }, + { "F9ED", "1541D" }, + { "F9EE", "171D0" }, + { "F9EF", "17498" }, + { "F9F0", "185FA" }, + { "F9F1", "196A3" }, + { "F9F2", "19C57" }, + { "F9F3", "19E9F" }, + { "F9F4", "16797" }, + { "F9F5", "16DCB" }, + { "F9F6", "181E8" }, + { "F9F7", "17ACB" }, + { "F9F8", "17B20" }, + { "F9F9", "17C92" }, + { "F9FA", "172C0" }, + { "F9FB", "17099" }, + { "F9FC", "18B58" }, + { "F9FD", "14EC0" }, + { "F9FE", "18336" }, + { "F9FF", "1523A" }, + { "FA00", "15207" }, + { "FA01", "15EA6" }, + { "FA02", "162D3" }, + { "FA03", "17CD6" }, + { "FA04", "15B85" }, + { "FA05", "16D1E" }, + { "FA06", "166B4" }, + { "FA07", "18F3B" }, + { "FA08", "1884C" }, + { "FA09", "1964D" }, + { "FA0A", "1898B" }, + { "FA0B", "15ED3" }, + { "FA0C", "15140" }, + { "FA0D", "155C0" }, + { "FA10", "1585A" }, + { "FA12", "16674" }, + { "FA15", "151DE" }, + { "FA16", "1732A" }, + { "FA17", "176CA" }, + { "FA18", "1793C" }, + { "FA19", "1795E" }, + { "FA1A", "17965" }, + { "FA1B", "1798F" }, + { "FA1C", "19756" }, + { "FA1D", "17CBE" }, + { "FA1E", "17FBD" }, + { "FA20", "18612" }, + { "FA22", "18AF8" }, + { "FA25", "19038" }, + { "FA26", "190FD" }, + { "FA2A", "198EF" }, + { "FA2B", "198FC" }, + { "FA2C", "19928" }, + { "FA2D", "19DB4" }, + { "FA30", "14FAE" }, + { "FA31", "150E7" }, + { "FA32", "1514D" }, + { "FA33", "152C9" }, + { "FA34", "152E4" }, + { "FA35", "15351" }, + { "FA36", "1559D" }, + { "FA37", "15606" }, + { "FA38", "15668" }, + { "FA39", "15840" }, + { "FA3A", "158A8" }, + { "FA3B", "15C64" }, + { "FA3C", "15C6E" }, + { "FA3D", "16094" }, + { "FA3E", "16168" }, + { "FA3F", "1618E" }, + { "FA40", "161F2" }, + { "FA41", "1654F" }, + { "FA42", "165E2" }, + { "FA43", "16691" }, + { "FA44", "16885" }, + { "FA45", "16D77" }, + { "FA46", "16E1A" }, + { "FA47", "16F22" }, + { "FA48", "1716E" }, + { "FA49", "1722B" }, + { "FA4A", "17422" }, + { "FA4B", "17891" }, + { "FA4C", "1793E" }, + { "FA4D", "17949" }, + { "FA4E", "17948" }, + { "FA4F", "17950" }, + { "FA50", "17956" }, + { "FA51", "1795D" }, + { "FA52", "1798D" }, + { "FA53", "1798E" }, + { "FA54", "17A40" }, + { "FA55", "17A81" }, + { "FA56", "17BC0" }, + { "FA57", "17DF4" }, + { "FA58", "17E09" }, + { "FA59", "17E41" }, + { "FA5A", "17F72" }, + { "FA5B", "18005" }, + { "FA5C", "181ED" }, + { "FA5D", "18279" }, + { "FA5E", "18279" }, + { "FA5F", "18457" }, + { "FA60", "18910" }, + { "FA61", "18996" }, + { "FA62", "18B01" }, + { "FA63", "18B39" }, + { "FA64", "18CD3" }, + { "FA65", "18D08" }, + { "FA66", "18FB6" }, + { "FA67", "19038" }, + { "FA68", "196E3" }, + { "FA69", "197FF" }, + { "FA6A", "1983B" }, + { "FB1D", "205D9_05B4" }, + { "FB1F", "205F2_05B7" }, + { "FB2A", "205E9_05C1" }, + { "FB2B", "205E9_05C2" }, + { "FB2C", "305E9_05BC_05C1" }, + { "FB2D", "305E9_05BC_05C2" }, + { "FB2E", "205D0_05B7" }, + { "FB2F", "205D0_05B8" }, + { "FB30", "205D0_05BC" }, + { "FB31", "205D1_05BC" }, + { "FB32", "205D2_05BC" }, + { "FB33", "205D3_05BC" }, + { "FB34", "205D4_05BC" }, + { "FB35", "205D5_05BC" }, + { "FB36", "205D6_05BC" }, + { "FB38", "205D8_05BC" }, + { "FB39", "205D9_05BC" }, + { "FB3A", "205DA_05BC" }, + { "FB3B", "205DB_05BC" }, + { "FB3C", "205DC_05BC" }, + { "FB3E", "205DE_05BC" }, + { "FB40", "205E0_05BC" }, + { "FB41", "205E1_05BC" }, + { "FB43", "205E3_05BC" }, + { "FB44", "205E4_05BC" }, + { "FB46", "205E6_05BC" }, + { "FB47", "205E7_05BC" }, + { "FB48", "205E8_05BC" }, + { "FB49", "205E9_05BC" }, + { "FB4A", "205EA_05BC" }, + { "FB4B", "205D5_05B9" }, + { "FB4C", "205D1_05BF" }, + { "FB4D", "205DB_05BF" }, + { "FB4E", "205E4_05BF" }, + { "1D15E", "21D157_1D165" }, + { "1D15F", "21D158_1D165" }, + { "1D160", "31D158_1D165_1D16E" }, + { "1D161", "31D158_1D165_1D16F" }, + { "1D162", "31D158_1D165_1D170" }, + { "1D163", "31D158_1D165_1D171" }, + { "1D164", "31D158_1D165_1D172" }, + { "1D1BB", "21D1B9_1D165" }, + { "1D1BC", "21D1BA_1D165" }, + { "1D1BD", "31D1B9_1D165_1D16E" }, + { "1D1BE", "31D1BA_1D165_1D16E" }, + { "1D1BF", "31D1B9_1D165_1D16F" }, + { "1D1C0", "31D1BA_1D165_1D16F" }, + { "2F800", "14E3D" }, + { "2F801", "14E38" }, + { "2F802", "14E41" }, + { "2F803", "120122" }, + { "2F804", "14F60" }, + { "2F805", "14FAE" }, + { "2F806", "14FBB" }, + { "2F807", "15002" }, + { "2F808", "1507A" }, + { "2F809", "15099" }, + { "2F80A", "150E7" }, + { "2F80B", "150CF" }, + { "2F80C", "1349E" }, + { "2F80D", "12063A" }, + { "2F80E", "1514D" }, + { "2F80F", "15154" }, + { "2F810", "15164" }, + { "2F811", "15177" }, + { "2F812", "12051C" }, + { "2F813", "134B9" }, + { "2F814", "15167" }, + { "2F815", "1518D" }, + { "2F816", "12054B" }, + { "2F817", "15197" }, + { "2F818", "151A4" }, + { "2F819", "14ECC" }, + { "2F81A", "151AC" }, + { "2F81B", "151B5" }, + { "2F81C", "1291DF" }, + { "2F81D", "151F5" }, + { "2F81E", "15203" }, + { "2F81F", "134DF" }, + { "2F820", "1523B" }, + { "2F821", "15246" }, + { "2F822", "15272" }, + { "2F823", "15277" }, + { "2F824", "13515" }, + { "2F825", "152C7" }, + { "2F826", "152C9" }, + { "2F827", "152E4" }, + { "2F828", "152FA" }, + { "2F829", "15305" }, + { "2F82A", "15306" }, + { "2F82B", "15317" }, + { "2F82C", "15349" }, + { "2F82D", "15351" }, + { "2F82E", "1535A" }, + { "2F82F", "15373" }, + { "2F830", "1537D" }, + { "2F831", "1537F" }, + { "2F832", "1537F" }, + { "2F833", "1537F" }, + { "2F834", "120A2C" }, + { "2F835", "17070" }, + { "2F836", "153CA" }, + { "2F837", "153DF" }, + { "2F838", "120B63" }, + { "2F839", "153EB" }, + { "2F83A", "153F1" }, + { "2F83B", "15406" }, + { "2F83C", "1549E" }, + { "2F83D", "15438" }, + { "2F83E", "15448" }, + { "2F83F", "15468" }, + { "2F840", "154A2" }, + { "2F841", "154F6" }, + { "2F842", "15510" }, + { "2F843", "15553" }, + { "2F844", "15563" }, + { "2F845", "15584" }, + { "2F846", "15584" }, + { "2F847", "15599" }, + { "2F848", "155AB" }, + { "2F849", "155B3" }, + { "2F84A", "155C2" }, + { "2F84B", "15716" }, + { "2F84C", "15606" }, + { "2F84D", "15717" }, + { "2F84E", "15651" }, + { "2F84F", "15674" }, + { "2F850", "15207" }, + { "2F851", "158EE" }, + { "2F852", "157CE" }, + { "2F853", "157F4" }, + { "2F854", "1580D" }, + { "2F855", "1578B" }, + { "2F856", "15832" }, + { "2F857", "15831" }, + { "2F858", "158AC" }, + { "2F859", "1214E4" }, + { "2F85A", "158F2" }, + { "2F85B", "158F7" }, + { "2F85C", "15906" }, + { "2F85D", "1591A" }, + { "2F85E", "15922" }, + { "2F85F", "15962" }, + { "2F860", "1216A8" }, + { "2F861", "1216EA" }, + { "2F862", "159EC" }, + { "2F863", "15A1B" }, + { "2F864", "15A27" }, + { "2F865", "159D8" }, + { "2F866", "15A66" }, + { "2F867", "136EE" }, + { "2F868", "12136A" }, + { "2F869", "15B08" }, + { "2F86A", "15B3E" }, + { "2F86B", "15B3E" }, + { "2F86C", "1219C8" }, + { "2F86D", "15BC3" }, + { "2F86E", "15BD8" }, + { "2F86F", "15BE7" }, + { "2F870", "15BF3" }, + { "2F871", "121B18" }, + { "2F872", "15BFF" }, + { "2F873", "15C06" }, + { "2F874", "15F33" }, + { "2F875", "15C22" }, + { "2F876", "13781" }, + { "2F877", "15C60" }, + { "2F878", "15C6E" }, + { "2F879", "15CC0" }, + { "2F87A", "15C8D" }, + { "2F87B", "121DE4" }, + { "2F87C", "15D43" }, + { "2F87D", "121DE6" }, + { "2F87E", "15D6E" }, + { "2F87F", "15D6B" }, + { "2F880", "15D7C" }, + { "2F881", "15DE1" }, + { "2F882", "15DE2" }, + { "2F883", "1382F" }, + { "2F884", "15DFD" }, + { "2F885", "15E28" }, + { "2F886", "15E3D" }, + { "2F887", "15E69" }, + { "2F888", "13862" }, + { "2F889", "122183" }, + { "2F88A", "1387C" }, + { "2F88B", "15EB0" }, + { "2F88C", "15EB3" }, + { "2F88D", "15EB6" }, + { "2F88E", "15ECA" }, + { "2F88F", "12A392" }, + { "2F890", "15EFE" }, + { "2F891", "122331" }, + { "2F892", "122331" }, + { "2F893", "18201" }, + { "2F894", "15F22" }, + { "2F895", "15F22" }, + { "2F896", "138C7" }, + { "2F897", "1232B8" }, + { "2F898", "1261DA" }, + { "2F899", "15F62" }, + { "2F89A", "15F6B" }, + { "2F89B", "138E3" }, + { "2F89C", "15F9A" }, + { "2F89D", "15FCD" }, + { "2F89E", "15FD7" }, + { "2F89F", "15FF9" }, + { "2F8A0", "16081" }, + { "2F8A1", "1393A" }, + { "2F8A2", "1391C" }, + { "2F8A3", "16094" }, + { "2F8A4", "1226D4" }, + { "2F8A5", "160C7" }, + { "2F8A6", "16148" }, + { "2F8A7", "1614C" }, + { "2F8A8", "1614E" }, + { "2F8A9", "1614C" }, + { "2F8AA", "1617A" }, + { "2F8AB", "1618E" }, + { "2F8AC", "161B2" }, + { "2F8AD", "161A4" }, + { "2F8AE", "161AF" }, + { "2F8AF", "161DE" }, + { "2F8B0", "161F2" }, + { "2F8B1", "161F6" }, + { "2F8B2", "16210" }, + { "2F8B3", "1621B" }, + { "2F8B4", "1625D" }, + { "2F8B5", "162B1" }, + { "2F8B6", "162D4" }, + { "2F8B7", "16350" }, + { "2F8B8", "122B0C" }, + { "2F8B9", "1633D" }, + { "2F8BA", "162FC" }, + { "2F8BB", "16368" }, + { "2F8BC", "16383" }, + { "2F8BD", "163E4" }, + { "2F8BE", "122BF1" }, + { "2F8BF", "16422" }, + { "2F8C0", "163C5" }, + { "2F8C1", "163A9" }, + { "2F8C2", "13A2E" }, + { "2F8C3", "16469" }, + { "2F8C4", "1647E" }, + { "2F8C5", "1649D" }, + { "2F8C6", "16477" }, + { "2F8C7", "13A6C" }, + { "2F8C8", "1654F" }, + { "2F8C9", "1656C" }, + { "2F8CA", "12300A" }, + { "2F8CB", "165E3" }, + { "2F8CC", "166F8" }, + { "2F8CD", "16649" }, + { "2F8CE", "13B19" }, + { "2F8CF", "16691" }, + { "2F8D0", "13B08" }, + { "2F8D1", "13AE4" }, + { "2F8D2", "15192" }, + { "2F8D3", "15195" }, + { "2F8D4", "16700" }, + { "2F8D5", "1669C" }, + { "2F8D6", "180AD" }, + { "2F8D7", "143D9" }, + { "2F8D8", "16717" }, + { "2F8D9", "1671B" }, + { "2F8DA", "16721" }, + { "2F8DB", "1675E" }, + { "2F8DC", "16753" }, + { "2F8DD", "1233C3" }, + { "2F8DE", "13B49" }, + { "2F8DF", "167FA" }, + { "2F8E0", "16785" }, + { "2F8E1", "16852" }, + { "2F8E2", "16885" }, + { "2F8E3", "12346D" }, + { "2F8E4", "1688E" }, + { "2F8E5", "1681F" }, + { "2F8E6", "16914" }, + { "2F8E7", "13B9D" }, + { "2F8E8", "16942" }, + { "2F8E9", "169A3" }, + { "2F8EA", "169EA" }, + { "2F8EB", "16AA8" }, + { "2F8EC", "1236A3" }, + { "2F8ED", "16ADB" }, + { "2F8EE", "13C18" }, + { "2F8EF", "16B21" }, + { "2F8F0", "1238A7" }, + { "2F8F1", "16B54" }, + { "2F8F2", "13C4E" }, + { "2F8F3", "16B72" }, + { "2F8F4", "16B9F" }, + { "2F8F5", "16BBA" }, + { "2F8F6", "16BBB" }, + { "2F8F7", "123A8D" }, + { "2F8F8", "121D0B" }, + { "2F8F9", "123AFA" }, + { "2F8FA", "16C4E" }, + { "2F8FB", "123CBC" }, + { "2F8FC", "16CBF" }, + { "2F8FD", "16CCD" }, + { "2F8FE", "16C67" }, + { "2F8FF", "16D16" }, + { "2F900", "16D3E" }, + { "2F901", "16D77" }, + { "2F902", "16D41" }, + { "2F903", "16D69" }, + { "2F904", "16D78" }, + { "2F905", "16D85" }, + { "2F906", "123D1E" }, + { "2F907", "16D34" }, + { "2F908", "16E2F" }, + { "2F909", "16E6E" }, + { "2F90A", "13D33" }, + { "2F90B", "16ECB" }, + { "2F90C", "16EC7" }, + { "2F90D", "123ED1" }, + { "2F90E", "16DF9" }, + { "2F90F", "16F6E" }, + { "2F910", "123F5E" }, + { "2F911", "123F8E" }, + { "2F912", "16FC6" }, + { "2F913", "17039" }, + { "2F914", "1701E" }, + { "2F915", "1701B" }, + { "2F916", "13D96" }, + { "2F917", "1704A" }, + { "2F918", "1707D" }, + { "2F919", "17077" }, + { "2F91A", "170AD" }, + { "2F91B", "120525" }, + { "2F91C", "17145" }, + { "2F91D", "124263" }, + { "2F91E", "1719C" }, + { "2F91F", "143AB" }, + { "2F920", "17228" }, + { "2F921", "17235" }, + { "2F922", "17250" }, + { "2F923", "124608" }, + { "2F924", "17280" }, + { "2F925", "17295" }, + { "2F926", "124735" }, + { "2F927", "124814" }, + { "2F928", "1737A" }, + { "2F929", "1738B" }, + { "2F92A", "13EAC" }, + { "2F92B", "173A5" }, + { "2F92C", "13EB8" }, + { "2F92D", "13EB8" }, + { "2F92E", "17447" }, + { "2F92F", "1745C" }, + { "2F930", "17471" }, + { "2F931", "17485" }, + { "2F932", "174CA" }, + { "2F933", "13F1B" }, + { "2F934", "17524" }, + { "2F935", "124C36" }, + { "2F936", "1753E" }, + { "2F937", "124C92" }, + { "2F938", "17570" }, + { "2F939", "12219F" }, + { "2F93A", "17610" }, + { "2F93B", "124FA1" }, + { "2F93C", "124FB8" }, + { "2F93D", "125044" }, + { "2F93E", "13FFC" }, + { "2F93F", "14008" }, + { "2F940", "176F4" }, + { "2F941", "1250F3" }, + { "2F942", "1250F2" }, + { "2F943", "125119" }, + { "2F944", "125133" }, + { "2F945", "1771E" }, + { "2F946", "1771F" }, + { "2F947", "1771F" }, + { "2F948", "1774A" }, + { "2F949", "14039" }, + { "2F94A", "1778B" }, + { "2F94B", "14046" }, + { "2F94C", "14096" }, + { "2F94D", "12541D" }, + { "2F94E", "1784E" }, + { "2F94F", "1788C" }, + { "2F950", "178CC" }, + { "2F951", "140E3" }, + { "2F952", "125626" }, + { "2F953", "17956" }, + { "2F954", "12569A" }, + { "2F955", "1256C5" }, + { "2F956", "1798F" }, + { "2F957", "179EB" }, + { "2F958", "1412F" }, + { "2F959", "17A40" }, + { "2F95A", "17A4A" }, + { "2F95B", "17A4F" }, + { "2F95C", "12597C" }, + { "2F95D", "125AA7" }, + { "2F95E", "125AA7" }, + { "2F95F", "17AAE" }, + { "2F960", "14202" }, + { "2F961", "125BAB" }, + { "2F962", "17BC6" }, + { "2F963", "17BC9" }, + { "2F964", "14227" }, + { "2F965", "125C80" }, + { "2F966", "17CD2" }, + { "2F967", "142A0" }, + { "2F968", "17CE8" }, + { "2F969", "17CE3" }, + { "2F96A", "17D00" }, + { "2F96B", "125F86" }, + { "2F96C", "17D63" }, + { "2F96D", "14301" }, + { "2F96E", "17DC7" }, + { "2F96F", "17E02" }, + { "2F970", "17E45" }, + { "2F971", "14334" }, + { "2F972", "126228" }, + { "2F973", "126247" }, + { "2F974", "14359" }, + { "2F975", "1262D9" }, + { "2F976", "17F7A" }, + { "2F977", "12633E" }, + { "2F978", "17F95" }, + { "2F979", "17FFA" }, + { "2F97A", "18005" }, + { "2F97B", "1264DA" }, + { "2F97C", "126523" }, + { "2F97D", "18060" }, + { "2F97E", "1265A8" }, + { "2F97F", "18070" }, + { "2F980", "12335F" }, + { "2F981", "143D5" }, + { "2F982", "180B2" }, + { "2F983", "18103" }, + { "2F984", "1440B" }, + { "2F985", "1813E" }, + { "2F986", "15AB5" }, + { "2F987", "1267A7" }, + { "2F988", "1267B5" }, + { "2F989", "123393" }, + { "2F98A", "12339C" }, + { "2F98B", "18201" }, + { "2F98C", "18204" }, + { "2F98D", "18F9E" }, + { "2F98E", "1446B" }, + { "2F98F", "18291" }, + { "2F990", "1828B" }, + { "2F991", "1829D" }, + { "2F992", "152B3" }, + { "2F993", "182B1" }, + { "2F994", "182B3" }, + { "2F995", "182BD" }, + { "2F996", "182E6" }, + { "2F997", "126B3C" }, + { "2F998", "182E5" }, + { "2F999", "1831D" }, + { "2F99A", "18363" }, + { "2F99B", "183AD" }, + { "2F99C", "18323" }, + { "2F99D", "183BD" }, + { "2F99E", "183E7" }, + { "2F99F", "18457" }, + { "2F9A0", "18353" }, + { "2F9A1", "183CA" }, + { "2F9A2", "183CC" }, + { "2F9A3", "183DC" }, + { "2F9A4", "126C36" }, + { "2F9A5", "126D6B" }, + { "2F9A6", "126CD5" }, + { "2F9A7", "1452B" }, + { "2F9A8", "184F1" }, + { "2F9A9", "184F3" }, + { "2F9AA", "18516" }, + { "2F9AB", "1273CA" }, + { "2F9AC", "18564" }, + { "2F9AD", "126F2C" }, + { "2F9AE", "1455D" }, + { "2F9AF", "14561" }, + { "2F9B0", "126FB1" }, + { "2F9B1", "1270D2" }, + { "2F9B2", "1456B" }, + { "2F9B3", "18650" }, + { "2F9B4", "1865C" }, + { "2F9B5", "18667" }, + { "2F9B6", "18669" }, + { "2F9B7", "186A9" }, + { "2F9B8", "18688" }, + { "2F9B9", "1870E" }, + { "2F9BA", "186E2" }, + { "2F9BB", "18779" }, + { "2F9BC", "18728" }, + { "2F9BD", "1876B" }, + { "2F9BE", "18786" }, + { "2F9BF", "14D57" }, + { "2F9C0", "187E1" }, + { "2F9C1", "18801" }, + { "2F9C2", "145F9" }, + { "2F9C3", "18860" }, + { "2F9C4", "18863" }, + { "2F9C5", "127667" }, + { "2F9C6", "188D7" }, + { "2F9C7", "188DE" }, + { "2F9C8", "14635" }, + { "2F9C9", "188FA" }, + { "2F9CA", "134BB" }, + { "2F9CB", "1278AE" }, + { "2F9CC", "127966" }, + { "2F9CD", "146BE" }, + { "2F9CE", "146C7" }, + { "2F9CF", "18AA0" }, + { "2F9D0", "18AED" }, + { "2F9D1", "18B8A" }, + { "2F9D2", "18C55" }, + { "2F9D3", "127CA8" }, + { "2F9D4", "18CAB" }, + { "2F9D5", "18CC1" }, + { "2F9D6", "18D1B" }, + { "2F9D7", "18D77" }, + { "2F9D8", "127F2F" }, + { "2F9D9", "120804" }, + { "2F9DA", "18DCB" }, + { "2F9DB", "18DBC" }, + { "2F9DC", "18DF0" }, + { "2F9DD", "1208DE" }, + { "2F9DE", "18ED4" }, + { "2F9DF", "18F38" }, + { "2F9E0", "1285D2" }, + { "2F9E1", "1285ED" }, + { "2F9E2", "19094" }, + { "2F9E3", "190F1" }, + { "2F9E4", "19111" }, + { "2F9E5", "12872E" }, + { "2F9E6", "1911B" }, + { "2F9E7", "19238" }, + { "2F9E8", "192D7" }, + { "2F9E9", "192D8" }, + { "2F9EA", "1927C" }, + { "2F9EB", "193F9" }, + { "2F9EC", "19415" }, + { "2F9ED", "128BFA" }, + { "2F9EE", "1958B" }, + { "2F9EF", "14995" }, + { "2F9F0", "195B7" }, + { "2F9F1", "128D77" }, + { "2F9F2", "149E6" }, + { "2F9F3", "196C3" }, + { "2F9F4", "15DB2" }, + { "2F9F5", "19723" }, + { "2F9F6", "129145" }, + { "2F9F7", "12921A" }, + { "2F9F8", "14A6E" }, + { "2F9F9", "14A76" }, + { "2F9FA", "197E0" }, + { "2F9FB", "12940A" }, + { "2F9FC", "14AB2" }, + { "2F9FD", "129496" }, + { "2F9FE", "1980B" }, + { "2F9FF", "1980B" }, + { "2FA00", "19829" }, + { "2FA01", "1295B6" }, + { "2FA02", "198E2" }, + { "2FA03", "14B33" }, + { "2FA04", "19929" }, + { "2FA05", "199A7" }, + { "2FA06", "199C2" }, + { "2FA07", "199FE" }, + { "2FA08", "14BCE" }, + { "2FA09", "129B30" }, + { "2FA0A", "19B12" }, + { "2FA0B", "19C40" }, + { "2FA0C", "19CFD" }, + { "2FA0D", "14CCE" }, + { "2FA0E", "14CED" }, + { "2FA0F", "19D67" }, + { "2FA10", "12A0CE" }, + { "2FA11", "14CF8" }, + { "2FA12", "12A105" }, + { "2FA13", "12A20E" }, + { "2FA14", "12A291" }, + { "2FA15", "19EBB" }, + { "2FA16", "14D56" }, + { "2FA17", "19EF9" }, + { "2FA18", "19EFE" }, + { "2FA19", "19F05" }, + { "2FA1A", "19F0F" }, + { "2FA1B", "19F16" }, + { "2FA1C", "19F3B" }, + { "2FA1D", "12A600" }, +}; + +// global constructor + +static struct unicode_decompose_init { + unicode_decompose_init(); +} _unicode_decompose_init; + +unicode_decompose_init::unicode_decompose_init() { + for (unsigned int i = 0; + i < sizeof(unicode_decompose_list)/sizeof(unicode_decompose_list[0]); + i++) { + unicode_decompose *dec = new unicode_decompose[1]; + dec->value = (char *)unicode_decompose_list[i].value; + unicode_decompose_table.define(unicode_decompose_list[i].key, dec); + } +} + +const char *decompose_unicode(const char *s) +{ + unicode_decompose *result = unicode_decompose_table.lookup(s); + return result ? result->value : 0; +} diff --git a/contrib/groff/src/libs/libxutil/DviChar.c b/contrib/groff/src/libs/libxutil/DviChar.c new file mode 100644 index 0000000..26aff6c --- /dev/null +++ b/contrib/groff/src/libs/libxutil/DviChar.c @@ -0,0 +1,658 @@ +/* + * DviChar.c + * + * Map DVI (ditroff output) character names to + * font indexes and back + */ + +#include <stdlib.h> +#include <string.h> +#include "DviChar.h" + +extern char *xmalloc(int); + +#define allocHash() ((DviCharNameHash *) xmalloc (sizeof (DviCharNameHash))) + +struct map_list { + struct map_list *next; + DviCharNameMap *map; +}; + +static struct map_list *world; + +static int standard_maps_loaded = 0; +static void load_standard_maps (void); +static int hash_name (const char *); +static void dispose_hash(DviCharNameMap *); +static void compute_hash(DviCharNameMap *); + +DviCharNameMap * +DviFindMap (char *encoding) +{ + struct map_list *m; + + if (!standard_maps_loaded) + load_standard_maps (); + for (m = world; m; m=m->next) + if (!strcmp (m->map->encoding, encoding)) + return m->map; + return 0; +} + +void +DviRegisterMap (DviCharNameMap *map) +{ + struct map_list *m; + + if (!standard_maps_loaded) + load_standard_maps (); + for (m = world; m; m = m->next) + if (!strcmp (m->map->encoding, map->encoding)) + break; + if (!m) { + m = (struct map_list *) xmalloc (sizeof *m); + m->next = world; + world = m; + } + dispose_hash (map); + m->map = map; + compute_hash (map); +} + +static void +dispose_hash (DviCharNameMap *map) +{ + DviCharNameHash **buckets; + DviCharNameHash *h, *next; + int i; + + buckets = map->buckets; + for (i = 0; i < DVI_HASH_SIZE; i++) { + for (h = buckets[i]; h; h=next) { + next = h->next; + free (h); + } + } +} + +static int +hash_name (const char *name) +{ + int i = 0; + + while (*name) + i = (i << 1) ^ *name++; + if (i < 0) + i = -i; + return i; +} + +static void +compute_hash (DviCharNameMap *map) +{ + DviCharNameHash **buckets; + int c, s, i; + DviCharNameHash *h; + + buckets = map->buckets; + for (i = 0; i < DVI_HASH_SIZE; i++) + buckets[i] = 0; + for (c = 0; c < DVI_MAP_SIZE; c++) + for (s = 0; s < DVI_MAX_SYNONYMS; s++) { + if (!map->dvi_names[c][s]) + break; + i = hash_name (map->dvi_names[c][s]) % DVI_HASH_SIZE; + h = allocHash (); + h->next = buckets[i]; + buckets[i] = h; + h->name = map->dvi_names[c][s]; + h->position = c; + } + +} + +int +DviCharIndex (DviCharNameMap *map, const char *name) +{ + int i; + DviCharNameHash *h; + + i = hash_name (name) % DVI_HASH_SIZE; + for (h = map->buckets[i]; h; h=h->next) + if (!strcmp (h->name, name)) + return h->position; + return -1; +} + +static DviCharNameMap ISO8859_1_map = { + "iso8859-1", + 0, +{ +{ 0, /* 0 */}, +{ 0, /* 1 */}, +{ 0, /* 2 */}, +{ 0, /* 3 */}, +{ 0, /* 4 */}, +{ 0, /* 5 */}, +{ 0, /* 6 */}, +{ 0, /* 7 */}, +{ 0, /* 8 */}, +{ 0, /* 9 */}, +{ 0, /* 10 */}, +{ 0, /* 11 */}, +{ 0, /* 12 */}, +{ 0, /* 13 */}, +{ 0, /* 14 */}, +{ 0, /* 15 */}, +{ 0, /* 16 */}, +{ 0, /* 17 */}, +{ 0, /* 18 */}, +{ 0, /* 19 */}, +{ 0, /* 20 */}, +{ 0, /* 21 */}, +{ 0, /* 22 */}, +{ 0, /* 23 */}, +{ 0, /* 24 */}, +{ 0, /* 25 */}, +{ 0, /* 26 */}, +{ 0, /* 27 */}, +{ 0, /* 28 */}, +{ 0, /* 29 */}, +{ 0, /* 30 */}, +{ 0, /* 31 */}, +{ 0, /* 32 */}, +{ "!", /* 33 */}, +{ "\"", "dq", /* 34 */}, +{ "#", "sh", /* 35 */}, +{ "$", "Do", /* 36 */}, +{ "%", /* 37 */}, +{ "&", /* 38 */}, +{ "'", "cq", /* 39 */}, +{ "(", /* 40 */}, +{ ")", /* 41 */}, +{ "*", /* 42 */}, +{ "+", /* 43 */}, +{ ",", /* 44 */}, +{ "\\-", /* 45 */}, +{ ".", /* 46 */}, +{ "/", "sl", /* 47 */}, +{ "0", /* 48 */}, +{ "1", /* 49 */}, +{ "2", /* 50 */}, +{ "3", /* 51 */}, +{ "4", /* 52 */}, +{ "5", /* 53 */}, +{ "6", /* 54 */}, +{ "7", /* 55 */}, +{ "8", /* 56 */}, +{ "9", /* 57 */}, +{ ":", /* 58 */}, +{ ";", /* 59 */}, +{ "<", /* 60 */}, +{ "=", /* 61 */}, +{ ">", /* 62 */}, +{ "?", /* 63 */}, +{ "@", "at", /* 64 */}, +{ "A", /* 65 */}, +{ "B", /* 66 */}, +{ "C", /* 67 */}, +{ "D", /* 68 */}, +{ "E", /* 69 */}, +{ "F", /* 70 */}, +{ "G", /* 71 */}, +{ "H", /* 72 */}, +{ "I", /* 73 */}, +{ "J", /* 74 */}, +{ "K", /* 75 */}, +{ "L", /* 76 */}, +{ "M", /* 77 */}, +{ "N", /* 78 */}, +{ "O", /* 79 */}, +{ "P", /* 80 */}, +{ "Q", /* 81 */}, +{ "R", /* 82 */}, +{ "S", /* 83 */}, +{ "T", /* 84 */}, +{ "U", /* 85 */}, +{ "V", /* 86 */}, +{ "W", /* 87 */}, +{ "X", /* 88 */}, +{ "Y", /* 89 */}, +{ "Z", /* 90 */}, +{ "[", "lB", /* 91 */}, +{ "\\", "rs", /* 92 */}, +{ "]", "rB", /* 93 */}, +{ "^", "a^", "ha", /* 94 */}, +{ "_", /* 95 */}, +{ "`", "oq", /* 96 */}, +{ "a", /* 97 */}, +{ "b", /* 98 */}, +{ "c", /* 99 */}, +{ "d", /* 100 */}, +{ "e", /* 101 */}, +{ "f", /* 102 */}, +{ "g", /* 103 */}, +{ "h", /* 104 */}, +{ "i", /* 105 */}, +{ "j", /* 106 */}, +{ "k", /* 107 */}, +{ "l", /* 108 */}, +{ "m", /* 109 */}, +{ "n", /* 110 */}, +{ "o", /* 111 */}, +{ "p", /* 112 */}, +{ "q", /* 113 */}, +{ "r", /* 114 */}, +{ "s", /* 115 */}, +{ "t", /* 116 */}, +{ "u", /* 117 */}, +{ "v", /* 118 */}, +{ "w", /* 119 */}, +{ "x", /* 120 */}, +{ "y", /* 121 */}, +{ "z", /* 122 */}, +{ "{", "lC", /* 123 */}, +{ "|", "ba", /* 124 */}, +{ "}", "rC", /* 125 */}, +{ "~", "a~", "ti", /* 126 */}, +{ 0, /* 127 */}, +{ 0, /* 128 */}, +{ 0, /* 129 */}, +{ 0, /* 130 */}, +{ 0, /* 131 */}, +{ 0, /* 132 */}, +{ 0, /* 133 */}, +{ 0, /* 134 */}, +{ 0, /* 135 */}, +{ 0, /* 136 */}, +{ 0, /* 137 */}, +{ 0, /* 138 */}, +{ 0, /* 139 */}, +{ 0, /* 140 */}, +{ 0, /* 141 */}, +{ 0, /* 142 */}, +{ 0, /* 143 */}, +{ 0, /* 144 */}, +{ 0, /* 145 */}, +{ 0, /* 146 */}, +{ 0, /* 147 */}, +{ 0, /* 148 */}, +{ 0, /* 149 */}, +{ 0, /* 150 */}, +{ 0, /* 151 */}, +{ 0, /* 152 */}, +{ 0, /* 153 */}, +{ 0, /* 154 */}, +{ 0, /* 155 */}, +{ 0, /* 156 */}, +{ 0, /* 157 */}, +{ 0, /* 158 */}, +{ 0, /* 159 */}, +{ 0, /* 160 */}, +{ "r!", /* 161 */}, +{ "ct", /* 162 */}, +{ "Po", /* 163 */}, +{ "Cs", /* 164 */}, +{ "Ye", /* 165 */}, +{ "bb", /* 166 */}, +{ "sc", /* 167 */}, +{ "ad", /* 168 */}, +{ "co", /* 169 */}, +{ "Of", /* 170 */}, +{ "Fo", /* 171 */}, +{ "tno", /* 172 */}, +{ "-", "hy", /* 173 */}, +{ "rg", /* 174 */}, +{ "a-", /* 175 */}, +{ "de", /* 176 */}, +{ "t+-", /* 177 */}, +{ "S2", /* 178 */}, +{ "S3", /* 179 */}, +{ "aa", /* 180 */}, +{ "mc", /* 181 */}, +{ "ps", /* 182 */}, +{ "pc", /* 183 */}, +{ "ac", /* 184 */}, +{ "S1", /* 185 */}, +{ "Om", /* 186 */}, +{ "Fc", /* 187 */}, +{ "14", /* 188 */}, +{ "12", /* 189 */}, +{ "34", /* 190 */}, +{ "r?", /* 191 */}, +{ "`A", /* 192 */}, +{ "'A", /* 193 */}, +{ "^A", /* 194 */}, +{ "~A", /* 195 */}, +{ ":A", /* 196 */}, +{ "oA", /* 197 */}, +{ "AE", /* 198 */}, +{ ",C", /* 199 */}, +{ "`E", /* 200 */}, +{ "'E", /* 201 */}, +{ "^E", /* 202 */}, +{ ":E", /* 203 */}, +{ "`I", /* 204 */}, +{ "'I", /* 205 */}, +{ "^I", /* 206 */}, +{ ":I", /* 207 */}, +{ "-D", /* 208 */}, +{ "~N", /* 209 */}, +{ "`O", /* 210 */}, +{ "'O", /* 211 */}, +{ "^O", /* 212 */}, +{ "~O", /* 213 */}, +{ ":O", /* 214 */}, +{ "tmu", /* 215 */}, +{ "/O", /* 216 */}, +{ "`U", /* 217 */}, +{ "'U", /* 218 */}, +{ "^U", /* 219 */}, +{ ":U", /* 220 */}, +{ "'Y", /* 221 */}, +{ "TP", /* 222 */}, +{ "ss", /* 223 */}, +{ "`a", /* 224 */}, +{ "'a", /* 225 */}, +{ "^a", /* 226 */}, +{ "~a", /* 227 */}, +{ ":a", /* 228 */}, +{ "oa", /* 229 */}, +{ "ae", /* 230 */}, +{ ",c", /* 231 */}, +{ "`e", /* 232 */}, +{ "'e", /* 233 */}, +{ "^e", /* 234 */}, +{ ":e", /* 235 */}, +{ "`i", /* 236 */}, +{ "'i", /* 237 */}, +{ "^i", /* 238 */}, +{ ":i", /* 239 */}, +{ "Sd", /* 240 */}, +{ "~n", /* 241 */}, +{ "`o", /* 242 */}, +{ "'o", /* 243 */}, +{ "^o", /* 244 */}, +{ "~o", /* 245 */}, +{ ":o", /* 246 */}, +{ "tdi", /* 247 */}, +{ "/o", /* 248 */}, +{ "`u", /* 249 */}, +{ "'u", /* 250 */}, +{ "^u", /* 251 */}, +{ ":u", /* 252 */}, +{ "'y", /* 253 */}, +{ "Tp", /* 254 */}, +{ ":y", /* 255 */}, +}}; + +static DviCharNameMap Adobe_Symbol_map = { + "adobe-fontspecific", + 1, +{ +{ 0, /* 0 */}, +{ 0, /* 1 */}, +{ 0, /* 2 */}, +{ 0, /* 3 */}, +{ 0, /* 4 */}, +{ 0, /* 5 */}, +{ 0, /* 6 */}, +{ 0, /* 7 */}, +{ 0, /* 8 */}, +{ 0, /* 9 */}, +{ 0, /* 10 */}, +{ 0, /* 11 */}, +{ 0, /* 12 */}, +{ 0, /* 13 */}, +{ 0, /* 14 */}, +{ 0, /* 15 */}, +{ 0, /* 16 */}, +{ 0, /* 17 */}, +{ 0, /* 18 */}, +{ 0, /* 19 */}, +{ 0, /* 20 */}, +{ 0, /* 21 */}, +{ 0, /* 22 */}, +{ 0, /* 23 */}, +{ 0, /* 24 */}, +{ 0, /* 25 */}, +{ 0, /* 26 */}, +{ 0, /* 27 */}, +{ 0, /* 28 */}, +{ 0, /* 29 */}, +{ 0, /* 30 */}, +{ 0, /* 31 */}, +{ 0, /* 32 */}, +{ "!", /* 33 */}, +{ "fa", /* 34 */}, +{ "#", "sh", /* 35 */}, +{ "te", /* 36 */}, +{ "%", /* 37 */}, +{ "&", /* 38 */}, +{ "st", /* 39 */}, +{ "(", /* 40 */}, +{ ")", /* 41 */}, +{ "**", /* 42 */}, +{ "+", "pl", /* 43 */}, +{ ",", /* 44 */}, +{ "\\-", "mi", /* 45 */}, +{ ".", /* 46 */}, +{ "/", "sl", /* 47 */}, +{ "0", /* 48 */}, +{ "1", /* 49 */}, +{ "2", /* 50 */}, +{ "3", /* 51 */}, +{ "4", /* 52 */}, +{ "5", /* 53 */}, +{ "6", /* 54 */}, +{ "7", /* 55 */}, +{ "8", /* 56 */}, +{ "9", /* 57 */}, +{ ":", /* 58 */}, +{ ";", /* 59 */}, +{ "<", /* 60 */}, +{ "=", "eq", /* 61 */}, +{ ">", /* 62 */}, +{ "?", /* 63 */}, +{ "=~", /* 64 */}, +{ "*A", /* 65 */}, +{ "*B", /* 66 */}, +{ "*X", /* 67 */}, +{ "*D", /* 68 */}, +{ "*E", /* 69 */}, +{ "*F", /* 70 */}, +{ "*G", /* 71 */}, +{ "*Y", /* 72 */}, +{ "*I", /* 73 */}, +{ "+h", /* 74 */}, +{ "*K", /* 75 */}, +{ "*L", /* 76 */}, +{ "*M", /* 77 */}, +{ "*N", /* 78 */}, +{ "*O", /* 79 */}, +{ "*P", /* 80 */}, +{ "*H", /* 81 */}, +{ "*R", /* 82 */}, +{ "*S", /* 83 */}, +{ "*T", /* 84 */}, +{ 0, /* 85 */}, +{ "ts", /* 86 */}, +{ "*W", /* 87 */}, +{ "*C", /* 88 */}, +{ "*Q", /* 89 */}, +{ "*Z", /* 90 */}, +{ "[", "lB", /* 91 */}, +{ "tf", "3d", /* 92 */}, +{ "]", "rB", /* 93 */}, +{ "pp", /* 94 */}, +{ "_", /* 95 */}, +{ "radicalex", /* 96 */}, +{ "*a", /* 97 */}, +{ "*b", /* 98 */}, +{ "*x", /* 99 */}, +{ "*d", /* 100 */}, +{ "*e", /* 101 */}, +{ "*f", /* 102 */}, +{ "*g", /* 103 */}, +{ "*y", /* 104 */}, +{ "*i", /* 105 */}, +{ "+f", /* 106 */}, +{ "*k", /* 107 */}, +{ "*l", /* 108 */}, +{ "*m", /* 109 */}, +{ "*n", /* 110 */}, +{ "*o", /* 111 */}, +{ "*p", /* 112 */}, +{ "*h", /* 113 */}, +{ "*r", /* 114 */}, +{ "*s", /* 115 */}, +{ "*t", /* 116 */}, +{ "*u", /* 117 */}, +{ "+p", /* 118 */}, +{ "*w", /* 119 */}, +{ "*c", /* 120 */}, +{ "*q", /* 121 */}, +{ "*z", /* 122 */}, +{ "lC", "{", /* 123 */}, +{ "ba", "|", /* 124 */}, +{ "rC", "}", /* 125 */}, +{ "ap", /* 126 */}, +{ 0, /* 127 */}, +{ 0, /* 128 */}, +{ 0, /* 129 */}, +{ 0, /* 130 */}, +{ 0, /* 131 */}, +{ 0, /* 132 */}, +{ 0, /* 133 */}, +{ 0, /* 134 */}, +{ 0, /* 135 */}, +{ 0, /* 136 */}, +{ 0, /* 137 */}, +{ 0, /* 138 */}, +{ 0, /* 139 */}, +{ 0, /* 140 */}, +{ 0, /* 141 */}, +{ 0, /* 142 */}, +{ 0, /* 143 */}, +{ 0, /* 144 */}, +{ 0, /* 145 */}, +{ 0, /* 146 */}, +{ 0, /* 147 */}, +{ 0, /* 148 */}, +{ 0, /* 149 */}, +{ 0, /* 150 */}, +{ 0, /* 151 */}, +{ 0, /* 152 */}, +{ 0, /* 153 */}, +{ 0, /* 154 */}, +{ 0, /* 155 */}, +{ 0, /* 156 */}, +{ 0, /* 157 */}, +{ 0, /* 158 */}, +{ 0, /* 159 */}, +{ 0, /* 160 */}, +{ "*U", /* 161 */}, +{ "fm", /* 162 */}, +{ "<=", /* 163 */}, +{ "f/", /* 164 */}, +{ "if", /* 165 */}, +{ "Fn", /* 166 */}, +{ "CL", /* 167 */}, +{ "DI", /* 168 */}, +{ "HE", /* 169 */}, +{ "SP", /* 170 */}, +{ "<>", /* 171 */}, +{ "<-", /* 172 */}, +{ "ua", "arrowverttp", /* 173 */}, +{ "->", /* 174 */}, +{ "da", "arrowvertbt", /* 175 */}, +{ "de", /* 176 */}, +{ "+-", /* 177 */}, +{ "sd", /* 178 */}, +{ ">=", /* 179 */}, +{ "mu", /* 180 */}, +{ "pt", /* 181 */}, +{ "pd", /* 182 */}, +{ "bu", /* 183 */}, +{ "di", /* 184 */}, +{ "!=", /* 185 */}, +{ "==", /* 186 */}, +{ "~=", "~~", /* 187 */}, +{ 0, /* 188 */}, +{ "arrowvertex", /* 189 */}, +{ "an", /* 190 */}, +{ "CR", /* 191 */}, +{ "Ah", /* 192 */}, +{ "Im", /* 193 */}, +{ "Re", /* 194 */}, +{ "wp", /* 195 */}, +{ "c*", /* 196 */}, +{ "c+", /* 197 */}, +{ "es", /* 198 */}, +{ "ca", /* 199 */}, +{ "cu", /* 200 */}, +{ "sp", /* 201 */}, +{ "ip", /* 202 */}, +{ "nb", /* 203 */}, +{ "sb", /* 204 */}, +{ "ib", /* 205 */}, +{ "mo", /* 206 */}, +{ "nm", /* 207 */}, +{ "/_", /* 208 */}, +{ "gr", /* 209 */}, +{ "rg", /* 210 */}, +{ "co", /* 211 */}, +{ "tm", /* 212 */}, +{ 0, /* 213 */}, +{ "sr", "sqrt", /* 214 */}, +{ "md", /* 215 */}, +{ "no", /* 216 */}, +{ "AN", /* 217 */}, +{ "OR", /* 218 */}, +{ "hA", /* 219 */}, +{ "lA", /* 220 */}, +{ "uA", /* 221 */}, +{ "rA", /* 222 */}, +{ "dA", /* 223 */}, +{ "lz", /* 224 */}, +{ "la", /* 225 */}, +{ 0, /* 226 */}, +{ 0, /* 227 */}, +{ 0, /* 228 */}, +{ 0, /* 229 */}, +{ "parenlefttp", /* 230 */}, +{ "parenleftex", /* 231 */}, +{ "parenleftbt", /* 232 */}, +{ "bracketlefttp", "lc", /* 233 */}, +{ "bracketleftex", /* 234 */}, +{ "bracketleftbt", "lf", /* 235 */}, +{ "bracelefttp", "lt", /* 236 */}, +{ "braceleftmid", "lk", /* 237 */}, +{ "braceleftbt", "lb", /* 238 */}, +{ "bracerightex", "braceleftex", "braceex", "bv", /* 239 */}, +{ 0, /* 240 */}, +{ "ra", /* 241 */}, +{ "is", "integral", /* 242 */}, +{ 0, /* 243 */}, +{ 0, /* 244 */}, +{ 0, /* 245 */}, +{ "parenrighttp", /* 246 */}, +{ "parenrightex", /* 247 */}, +{ "parenrightbt", /* 248 */}, +{ "bracketrighttp", "rc", /* 249 */}, +{ "bracketrightex", /* 250 */}, +{ "bracketrightbt", "rf", /* 251 */}, +{ "bracerighttp", "rt", /* 252 */}, +{ "bracerightmid", "rk", /* 253 */}, +{ "bracerightbt", "rb", /* 254 */}, +{ 0, /* 255 */}, +}}; + + +static void +load_standard_maps (void) +{ + standard_maps_loaded = 1; + DviRegisterMap (&ISO8859_1_map); + DviRegisterMap (&Adobe_Symbol_map); +} diff --git a/contrib/groff/src/libs/libxutil/Makefile.sub b/contrib/groff/src/libs/libxutil/Makefile.sub new file mode 100644 index 0000000..24444a6 --- /dev/null +++ b/contrib/groff/src/libs/libxutil/Makefile.sub @@ -0,0 +1,10 @@ +LIB=xutil +EXTRA_CFLAGS=$(X_CFLAGS) +OBJS=\ + DviChar.$(OBJEXT) \ + XFontName.$(OBJEXT) \ + xmalloc.$(OBJEXT) +CSRCS=\ + $(srcdir)/DviChar.c \ + $(srcdir)/XFontName.c \ + $(srcdir)/xmalloc.c diff --git a/contrib/groff/src/libs/libxutil/XFontName.c b/contrib/groff/src/libs/libxutil/XFontName.c new file mode 100644 index 0000000..7ed78ae --- /dev/null +++ b/contrib/groff/src/libs/libxutil/XFontName.c @@ -0,0 +1,241 @@ +/* + * XFontName.c + * + * build/parse X Font name strings + */ + +#include <X11/Xlib.h> +#include <X11/Xos.h> +#include "XFontName.h" +#include <ctype.h> + +static char * +extractStringField (char *name, char *buffer, int size, + unsigned int *attrp, unsigned int bit) +{ + char *buf = buffer; + + if (!*name) + return 0; + while (*name && *name != '-' && size > 0) { + *buf++ = *name++; + --size; + } + if (size <= 0) + return 0; + *buf = '\0'; + if (buffer[0] != '*' || buffer[1] != '\0') + *attrp |= bit; + if (*name == '-') + return name+1; + return name; +} + +static char * +extractUnsignedField (char *name, unsigned int *result, + unsigned int *attrp, unsigned int bit) +{ + char buf[256]; + char *c; + unsigned int i; + + name = extractStringField (name, buf, sizeof (buf), attrp, bit); + if (!name) + return 0; + if (!(*attrp & bit)) + return name; + i = 0; + for (c = buf; *c; c++) { + if (!isdigit (*c)) + return 0; + i = i * 10 + (*c - '0'); + } + *result = i; + return name; +} + +Bool +XParseFontName (XFontNameString fontNameString, XFontName *fontName, + unsigned int *fontNameAttributes) +{ + char *name = fontNameString; + XFontName temp; + unsigned int attributes = 0; + +#define GetString(field,bit)\ + if (!(name = extractStringField \ + (name, temp.field, sizeof (temp.field),\ + &attributes, bit))) \ + return False; + +#define GetUnsigned(field,bit)\ + if (!(name = extractUnsignedField \ + (name, &temp.field, \ + &attributes, bit))) \ + return False; + + GetString (Registry, FontNameRegistry) + GetString (Foundry, FontNameFoundry) + GetString (FamilyName, FontNameFamilyName) + GetString (WeightName, FontNameWeightName) + GetString (Slant, FontNameSlant) + GetString (SetwidthName, FontNameSetwidthName) + GetString (AddStyleName, FontNameAddStyleName) + GetUnsigned (PixelSize, FontNamePixelSize) + GetUnsigned (PointSize, FontNamePointSize) + GetUnsigned (ResolutionX, FontNameResolutionX) + GetUnsigned (ResolutionY, FontNameResolutionY) + GetString (Spacing, FontNameSpacing) + GetUnsigned (AverageWidth, FontNameAverageWidth) + GetString (CharSetRegistry, FontNameCharSetRegistry) + if (!*name) { + temp.CharSetEncoding[0] = '\0'; + attributes |= FontNameCharSetEncoding; + } else { + GetString (CharSetEncoding, FontNameCharSetEncoding) + } + *fontName = temp; + *fontNameAttributes = attributes; + return True; +} + +static char * +utoa (unsigned int u, char *s, int size) +{ + char *t; + + t = s + size; + *--t = '\0'; + do + *--t = (u % 10) + '0'; + while (u /= 10); + return t; +} + +Bool +XFormatFontName (XFontName *fontName, unsigned int fontNameAttributes, + XFontNameString fontNameString) +{ + char tmp[256]; + char *name = tmp, *f; + int left = sizeof (tmp) - 1; + char number[32]; + +#define PutString(field, bit)\ + f = (fontNameAttributes & bit) ? \ + fontName->field \ + : (char *)"*"; \ + if ((left -= strlen (f)) < 0) \ + return False; \ + while (*f) \ + if ((*name++ = *f++) == '-') \ + return False; +#define PutHyphen()\ + if (--left < 0) \ + return False; \ + *name++ = '-'; + +#define PutUnsigned(field, bit) \ + f = (fontNameAttributes & bit) ? \ + utoa (fontName->field, number, sizeof (number)) \ + : (char *)"*"; \ + if ((left -= strlen (f)) < 0) \ + return False; \ + while (*f) \ + *name++ = *f++; + + PutString (Registry, FontNameRegistry) + PutHyphen (); + PutString (Foundry, FontNameFoundry) + PutHyphen (); + PutString (FamilyName, FontNameFamilyName) + PutHyphen (); + PutString (WeightName, FontNameWeightName) + PutHyphen (); + PutString (Slant, FontNameSlant) + PutHyphen (); + PutString (SetwidthName, FontNameSetwidthName) + PutHyphen (); + PutString (AddStyleName, FontNameAddStyleName) + PutHyphen (); + PutUnsigned (PixelSize, FontNamePixelSize) + PutHyphen (); + PutUnsigned (PointSize, FontNamePointSize) + PutHyphen (); + PutUnsigned (ResolutionX, FontNameResolutionX) + PutHyphen (); + PutUnsigned (ResolutionY, FontNameResolutionY) + PutHyphen (); + PutString (Spacing, FontNameSpacing) + PutHyphen (); + PutUnsigned (AverageWidth, FontNameAverageWidth) + PutHyphen (); + PutString (CharSetRegistry, FontNameCharSetRegistry) + PutHyphen (); + PutString (CharSetEncoding, FontNameCharSetEncoding) + *name = '\0'; + strcpy (fontNameString, tmp); + return True; +} + +Bool +XCompareFontName (XFontName *name1, XFontName *name2, + unsigned int fontNameAttributes) +{ +#define CompareString(field,bit) \ + if (fontNameAttributes & bit) \ + if (strcmp (name1->field, name2->field)) \ + return False; + +#define CompareUnsigned(field,bit) \ + if (fontNameAttributes & bit) \ + if (name1->field != name2->field) \ + return False; + + CompareString (Registry, FontNameRegistry) + CompareString (Foundry, FontNameFoundry) + CompareString (FamilyName, FontNameFamilyName) + CompareString (WeightName, FontNameWeightName) + CompareString (Slant, FontNameSlant) + CompareString (SetwidthName, FontNameSetwidthName) + CompareString (AddStyleName, FontNameAddStyleName) + CompareUnsigned (PixelSize, FontNamePixelSize) + CompareUnsigned (PointSize, FontNamePointSize) + CompareUnsigned (ResolutionX, FontNameResolutionX) + CompareUnsigned (ResolutionY, FontNameResolutionY) + CompareString (Spacing, FontNameSpacing) + CompareUnsigned (AverageWidth, FontNameAverageWidth) + CompareString (CharSetRegistry, FontNameCharSetRegistry) + CompareString (CharSetEncoding, FontNameCharSetEncoding) + return True; +} + +Bool +XCopyFontName (XFontName *name1, XFontName *name2, + unsigned int fontNameAttributes) +{ +#define CopyString(field,bit) \ + if (fontNameAttributes & bit) \ + strcpy (name2->field, name1->field); + +#define CopyUnsigned(field,bit) \ + if (fontNameAttributes & bit) \ + name2->field = name1->field; + + CopyString (Registry, FontNameRegistry) + CopyString (Foundry, FontNameFoundry) + CopyString (FamilyName, FontNameFamilyName) + CopyString (WeightName, FontNameWeightName) + CopyString (Slant, FontNameSlant) + CopyString (SetwidthName, FontNameSetwidthName) + CopyString (AddStyleName, FontNameAddStyleName) + CopyUnsigned (PixelSize, FontNamePixelSize) + CopyUnsigned (PointSize, FontNamePointSize) + CopyUnsigned (ResolutionX, FontNameResolutionX) + CopyUnsigned (ResolutionY, FontNameResolutionY) + CopyString (Spacing, FontNameSpacing) + CopyUnsigned (AverageWidth, FontNameAverageWidth) + CopyString (CharSetRegistry, FontNameCharSetRegistry) + CopyString (CharSetEncoding, FontNameCharSetEncoding) + return True; +} diff --git a/contrib/groff/src/libs/libxutil/xmalloc.c b/contrib/groff/src/libs/libxutil/xmalloc.c new file mode 100644 index 0000000..f31056b --- /dev/null +++ b/contrib/groff/src/libs/libxutil/xmalloc.c @@ -0,0 +1,7 @@ +#include <X11/Xlib.h> +#include <X11/Intrinsic.h> + +char *xmalloc(int n) +{ + return XtMalloc(n); +} |