Hello community, here is the log from the commit of package dvi2tty checked in at Fri Sep 14 00:24:42 CEST 2007. -------- --- dvi2tty/dvi2tty.changes 2006-01-25 21:35:38.000000000 +0100 +++ /mounts/work_src_done/STABLE/dvi2tty/dvi2tty.changes 2007-09-13 19:27:37.000000000 +0200 @@ -1,0 +2,6 @@ +Thu Sep 13 19:16:49 CEST 2007 - sbrabec@suse.cz + +- Added support for Japanese (#246838). +- Define correct default pager. + +------------------------------------------------------------------- New: ---- dvi2tty-japanese.patch dvi2tty-pager.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ dvi2tty.spec ++++++ --- /var/tmp/diff_new_pack.s31322/_old 2007-09-14 00:24:29.000000000 +0200 +++ /var/tmp/diff_new_pack.s31322/_new 2007-09-14 00:24:29.000000000 +0200 @@ -1,31 +1,33 @@ # # spec file for package dvi2tty (Version 5.3.1) # -# Copyright (c) 2005 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany. # This file and all modifications and additions to the pristine # package are under the same license as the package itself. # -# Please submit bugfixes or comments via http://www.suse.de/feedback/ +# Please submit bugfixes or comments via http://bugs.opensuse.org/ # # norootforbuild Name: dvi2tty -License: Other License(s), see package +License: GPL v2 or later Group: Productivity/Publishing/TeX/Utilities Autoreqprov: on Version: 5.3.1 -Release: 113 +Release: 182 Summary: A TeX-DVI to ASCII Converter Source: %{name}-%{version}.tar.bz2 Patch: %{name}-%{version}.patch +Patch1: dvi2tty-pager.patch +Patch2: dvi2tty-japanese.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build %description DVI2TTY converts a TeX-DVI file into a readable ASCII text file. You can then do full text searches without finding the TeX macros. -For documentation see the man page (man dvi2tty) and +For documentation, see the man page (man dvi2tty) and /usr/share/doc/packages/dvi2tty. @@ -38,12 +40,13 @@ %prep %setup %patch +%patch1 +%patch2 %build make CFLAGS="$RPM_OPT_FLAGS" %install -rm -rf $RPM_BUILD_ROOT install -d $RPM_BUILD_ROOT{/usr/bin/,%{_mandir}/man1/} make install prefix=$RPM_BUILD_ROOT/usr/ @@ -56,7 +59,10 @@ /usr/bin/* %{_mandir}/man1/*.gz -%changelog -n dvi2tty +%changelog +* Thu Sep 13 2007 - sbrabec@suse.cz +- Added support for Japanese (#246838). +- Define correct default pager. * Wed Jan 25 2006 - mls@suse.de - converted neededforbuild to BuildRequires * Wed Jun 15 2005 - meissner@suse.de ++++++ dvi2tty-japanese.patch ++++++ --- dvi2tty.c +++ dvi2tty.c @@ -186,10 +186,10 @@ #define MAXLEN 100 /* size of char-arrays for strings */ #if defined(MSDOS) || defined(VMS) || defined(AMIGA) -#define OPTSET "haJwepPousltvbc" /* legal options */ +#define OPTSET "haJwepPousltvbcAN" /* legal options */ #define OPTWARG "wepPovb" /* options with argument */ #else -#define OPTSET "haJwepPousqlfFtvbc"/* legal options */ +#define OPTSET "haJwepPousqlfFtvbcAN"/* legal options */ #define OPTWARG "wepPoFvb" /* options with argument */ #endif @@ -209,6 +209,8 @@ #if defined(THINK_C) #define nored 10 /* if no input file, redirect stdin */ #endif +#define confl 11 /* -N and -A conflict */ +#define confj 12 /* -J conflicts -N and -A */ @@ -512,7 +514,9 @@ j = strlen(optarg); break; #endif - case 'J' : japan = TRUE; break; + case 'J' : jautodetect = TRUE; break; + case 'A' : asciip = TRUE; break; /* ASCII pTeX */ + case 'N' : japan = TRUE; break; /* NTT jTeX */ case 't' : ttfont = TRUE; break; case 'l' : noffd = TRUE; break; case 's' : scascii = TRUE; break; @@ -554,6 +558,15 @@ break; default : usage(bdopt); } + + /* Option conflicts */ + if (japan && asciip) { + usage(confl); + } + + if (jautodetect && (japan || asciip)) { + usage(confj); + } if ((optch = optarg[j++]) == '\0') break; if ( (optarg[j] == '\0') && (strchr(OPTWARG, optch) != NULL) ) { @@ -855,6 +868,10 @@ command string,\n\Standard Input must be redirected with the radio button."); break; #endif + case confl : fprintf(stderr, "-N and -A conflict"); + break; + case confj : fprintf(stderr, "-J conflicts -N and -A"); + break; default : fprintf(stderr, "unknown usage error"); break; } @@ -906,7 +923,11 @@ fprintf(stderr, " -s National Swedish/Finnish characters printed as }{|][\\ (default %s).\n", DEFSCAND ? "on" : "off"); fprintf(stderr, - " -J Allow processing of japanese fonts\n"); + " -J Enable auto detect for NTT jTeX and ASCII pTeX.\n"); + fprintf(stderr, + " -N Support NTT jTeX dvi.\n"); + fprintf(stderr, + " -A Support ASCII pTeX dvi.\n"); fprintf(stderr, " -c Override -a -u -s and print all characters 0-255.\n"); fprintf(stderr, --- dvi2tty.h +++ dvi2tty.h @@ -96,8 +96,10 @@ extern bool scascii; /* Scand. nat. chars (dvistuff.c) */ extern bool accent; /* Output accent stuff(dvistuff.c) */ extern bool ttfont; /* tt font assumed (dvistuff.c) */ -extern bool japan; /* japanes font support (dvistuff.c) */ -extern bool noffd; /* output ^L or formfeed (dvistuff.c) */ +extern bool jautodetect; /* Auto detect jTeX / ASCII pTeX */ +extern bool japan; /* jTeX font support (dvistuff.c) */ +extern bool asciip; /* pTeX font support (dvistuff.c) */ +extern bool noffd; /* output ^L or formneed (dvistuff.c) */ extern bool printfont; /* include font switches (dvistuff.c) */ extern bool allchar; /* output all characters (dvistuff.c */ --- dvistuff.c +++ dvistuff.c @@ -24,6 +24,13 @@ #include "dvi2tty.h" +#if !defined(JIS) +#define JIS 1 /* if 0 then EUC/SJIS */ +#endif +#if !defined(SJIS) +#define SJIS 0 /* if !JIS, 0 then EUC */ +#endif + #if defined(VMS) # include types.h # include stat @@ -126,7 +133,10 @@ bool accent; /* if true output accents etc: \'{e} etc. */ bool ttfont = FALSE; /* if true we assumed ttfonts, not cmr */ bool symbolfont = FALSE; /* true if font is a symbol font */ -bool japan = FALSE; /* switch to japanese fonts ... */ +bool japan = FALSE; /* switch to NTT japanese fonts ... */ +bool asciip = FALSE; /* switch to ASCII japanese fonts ... */ +bool jautodetect = FALSE;/* Japanese autodetect */ +bool jdetect = FALSE; /* switch if Japanese TeX detection is done */ bool mifont = FALSE; bool T1font = FALSE; /* DC/EC encoding used ? */ int jfontnum = 0; @@ -161,6 +171,14 @@ font * fonts = NULL; /* List of fontnames defined */ +#if JIS +#define SJIS 0 +int inkanji = 0; /* is in kanji sequence */ +#define KANJIIN "\033$B" +#define KANJIOUT "\033(J" +#endif +int kanji1 = 0; /* is first kanji character */ +int kanji2 = 0; /* is second kanji character */ /* @@ -194,6 +212,7 @@ void setfont (long); void jischar (long); int compute_jis (int, int, int *, int *); +void dokanji (int); int getjsubfont (char *); #else @@ -223,6 +242,7 @@ void setfont (long fntnum); void jischar (long charnr); void compute_jis (int f, int c, int * ku, int * ten); +void dokanji (int); int getjsubfont (char * s); #if defined(VMS) long vmsseek (); @@ -424,7 +444,7 @@ else switch (opcode) { case SET1 : japan ? jischar(get1()) : setchar(get1());break; - case SET2 : setchar(get2()); break; + case SET2 : asciip ? dokanji(get2()) : setchar(get2()); break; case SET3 : setchar(get3()); break; case SET4 : setchar(get4()); break; case SET_RULE : { long height = sget4(); @@ -610,18 +630,83 @@ for (i = firstcolumn, j = 1; i <= currentline->charactercount; i++, j++) { ch = currentline->text[i - leftmargin]; + if (asciip) { + if (kanji1) { +#if !JIS && !SJIS + ch |= 0x80; +#endif + kanji2 = 1; + kanji1 = 0; + } + if (!kanji2 && ch > 127) { + kanji1 = 1; +#if JIS + if (!inkanji) { + inkanji = 1; + fprintf(output, KANJIIN); + } + ch &= 0x7f; +#endif + } +#if JIS + if (!kanji1 && !kanji2 && inkanji) { + fprintf(output, KANJIOUT); + inkanji = 0; + } +#endif + if (kanji1 && (j >= (int) foo) && + (currentline->charactercount > i + 1)) { +#if JIS + if (inkanji) { + fprintf(output, KANJIOUT); + } +#endif + fprintf(output, "*\n"); /* if line too large */ + fprintf(output, " *"); /* output mark */ +#if JIS + if (inkanji) { + fprintf(output, KANJIIN); + } +#endif + j = 2; + } + } + if (ch >= SPACE || allchar) putc(ch, output); if ((j > (int) foo) && (currentline->charactercount > i+1)) { - fprintf(output, "*\n"); /* if line to large */ - fprintf(output, " *"); /* mark output */ - j = 2; + if (asciip) { +#if JIS + if (inkanji) { + fprintf(output, KANJIOUT); + } +#endif + } + fprintf(output, "*\n"); /* if line too large */ + fprintf(output, " *"); /* output mark */ + if (asciip) { +#if JIS + if (inkanji) { + fprintf(output, KANJIIN); + } +#endif + } + j = 2; } + if (asciip) kanji2 = 0; } } putc('\n', output); } + if (asciip) { +#if JIS + if (!kanji1 && !kanji2 && inkanji) { + fprintf(output, KANJIOUT); + inkanji = 0; + } +#endif + } currentline = firstline; while (currentline->next != nil) { currentline = currentline->next; @@ -1177,7 +1262,8 @@ if (foo == leftmargin-1) - while ((currentline->text[j - leftmargin] != SPACE) + while (((currentline->text[j - leftmargin] != SPACE) + || kanji1 && (currentline->text[j + 1 - leftmargin] != SPACE)) && (j < rightmargin)) { j++; h += charwidth; @@ -1300,6 +1386,19 @@ name[i] = get1(); name[i] = '\0'; /* just to be sure */ fnt->name = name; + if ((asciip == FALSE && japan == FALSE) && (!jdetect) && jautodetect) { + if (strncmp("min", name, 3) == 0 || strncmp("got", name, 3) == 0) { + /* Detect as ASCII pTeX */ + asciip = TRUE; + japan = FALSE; + jdetect = TRUE; + } else if (strncmp("dmj", name, 3) == 0 || strncmp("dgj", name, 3) == 0) { + /* Detect as NTT jTeX */ + asciip = FALSE; + japan = TRUE; + jdetect = TRUE; + } + } if (new) { fnt->next = fonts; fonts = fnt; @@ -1583,3 +1682,28 @@ } /*vms_ungetc */ #endif + +/* +* DOKANJI -- Process a kanji character opcode. +*/ + +void dokanji(ch) +register int ch; +{ +#if SJIS + register int c1, c2; + c1 = (ch >> 8) & 0xff; + c2 = ch & 0xff; + kanji1 = 1; + outchar((((c1 - 1) >> 1) + ((c1 <= 0x5e) ? 0x71 : 0xb1))); + kanji1 = 0; + outchar((c2 + ((c1 & 1) ? ((c2 < 0x60) ? 0x1f : 0x20) : 0x7e))); +#else + kanji1 = 1; + outchar(0x80 | ( ch >> 8 )); + kanji1 = 0; + outchar(ch & 0xff); +#endif + + return; +} /* dokanji */ ++++++ dvi2tty-pager.patch ++++++ --- dvi2tty.c +++ dvi2tty.c @@ -180,7 +180,7 @@ /* don't have terminals with Scand. nat. chars */ #define WANTPAGER TRUE /* default: try to pipe through a pager (like */ /* more) if stdout is tty and no -o switch */ -#define DEFPAGER "/usr/bin/pg" /* CHANGE TO YOUR LOCAL PAGER */ +#define DEFPAGER "/usr/bin/less" /* CHANGE TO YOUR LOCAL PAGER */ /*------------------ end of customization constants ---------------------*/ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org
participants (1)
-
root@Hilbert.suse.de