diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/cjk/utils/CEFconv')
21 files changed, 1886 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/cjk/utils/CEFconv/cef5conv.1 b/Master/texmf-dist/source/latex/cjk/utils/CEFconv/cef5conv.1 new file mode 100644 index 00000000000..5d9b7f5d8c4 --- /dev/null +++ b/Master/texmf-dist/source/latex/cjk/utils/CEFconv/cef5conv.1 @@ -0,0 +1,127 @@ +.\" man page for cef5conv +.\" Copyright (C) 1994-2008 Werner Lemberg <wl@gnu.org> +.\" +.\" 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 of the License, 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 General Public License for more details. +.\" +.\" You should have received a copy of the GNU General Public License +.\" along with this program in doc/COPYING; if not, write to the Free +.\" Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, +.\" MA 02110-1301 USA +. +.TH CEF5CONV 1 22-May-2008 "CJK Version 4.8.0" +. +.\" ==== +.\" ==== macro definitions +.\" ==== +. +.\" here we define \TeX for troff and nroff +.if t .ds TX \fRT\\h'-0.1667m'\\v'0.20v'E\\v'-0.20v'\\h'-0.125m'X\fP +.if n .ds TX TeX +. +.\" and here the same for \LaTeX +.if t \{\ +.ie '\*(.T'dvi' \ +.ds LX \fRL\h'-0.36m'\v'-0.15v'\s-3A\s0\h'-0.15m'\v'0.15v'\fP\*(TX +.el .ds LX \fRL\h'-0.36m'\v'-0.22v'\s-2A\s0\h'-0.15m'\v'0.22v'\fP\*(TX +.\} +.if n .ds LX LaTeX +. +.\" \LaTeXe +.\" note that we need \vareps for TeX instead of \eps which can only be +.\" accessed with the \N escape sequence (in the Math Italic font) +.if t \{\ +.ie '\*(.T'dvi' .ds LE \*(LX\h'0.15m'2\v'0.20v'\f(MI\N'34'\fP\v'-0.20v' +.el .ds LE \*(LX\h'0.15m'2\v'0.20v'\(*e\v'-0.20v' +.\} +.if n .ds LE LaTeX\ 2e +. +.\" a typewriter font +.if t \{\ +.de C +\fC\\$1\fP +.. +.\} +.if n \{\ +.de C +\\$1 +.. +.\} +. +.\" ==== +.\" ==== end of macro definitions +.\" ==== +. +. +. +.SH NAME +cef5conv \- convert a TeX document in Big\ 5 encoding containing CEF macros +into `preprocessed' form. +. +. +.SH SYNOPSIS +.B cef5conv +< +.I infile +> +.I outfile +. +. +.SH DESCRIPTION +The +.B Chinese Encoding Framework +.RB ( CEF ) +developed by Christian Wittern +.C <cwittern@conline.central.de> +makes it possible to include CJK characters in various encodings using the +SGML macros +.B &CX-aabb; +for Big\ 5 and CNS encoding and +.B &U-aabb; +for Unicode +.RB ( X +denotes a number between 0 and 7; 0 represents Big\ 5 encoding, 1-7 CNS +encoding planes 1-7. +.B aabb +is either a decimal or hexadecimal number). +.PP +.B cef5conv +converts the CEF macros of a Big\ 5 encoded document together with the Big\ +5 encoding itself into a form which can directly processed with \*(LE. +It is identical to +.IP +.B bg5conv +< +.I infile +| +.B cefconv +> +.I outfile +.PP +This filter is part of the +.B CJK +macro package for \*(LE. +. +. +.SH "SEE ALSO" +.BR \%sjisconv (1), +.BR bg5conv (1), +.BR \%cefconv (1), +.BR \%cefsconv (1), +.BR \%extconv (1), +.br +the +.B CJK +documentation files. +. +. +.SH AUTHOR +Werner Lemberg +.C <wl@gnu.org> diff --git a/Master/texmf-dist/source/latex/cjk/utils/CEFconv/cef5conv.c b/Master/texmf-dist/source/latex/cjk/utils/CEFconv/cef5conv.c new file mode 100644 index 00000000000..b62eb30443b --- /dev/null +++ b/Master/texmf-dist/source/latex/cjk/utils/CEFconv/cef5conv.c @@ -0,0 +1,138 @@ +#define banner \ +"cef5conv (CJK ver. 4.8.0)" \ + +/*2:*/ +#line 108 "/home/wl/git/cjk/cjk-4.8.0/utils/CEFconv/cef5conv.w" + +#include <ctype.h> +#include <stdio.h> +#include <stdlib.h> + + +int main(argc,argv) +int argc; +char*argv[]; + +{int ch,i; +unsigned char in[16]; +unsigned char out[32]; +unsigned char*inp,*outp; + +fprintf(stdout,"\\def\\CNSpreproc{%s}",banner); + +ch= fgetc(stdin); + +while(!feof(stdin)) +{if(ch>=0xA1&&ch<=0xFE) +{fprintf(stdout,"\177%c\177",ch); + +ch= fgetc(stdin); +if(!feof(stdin)) +fprintf(stdout,"%d\177",ch); +} +else if(ch=='&') + +{inp= in; +outp= out; +*inp= ch; +*(++inp)= fgetc(stdin); + +if(*inp=='C'&&!feof(stdin)) +{*(++inp)= fgetc(stdin); +if(*inp=='0'&&!feof(stdin)) +{*(outp++)= 'B'; +*(outp++)= 'g'; +*(outp++)= '5'; +} +else if(*inp>='1'&&*inp<='7'&&!feof(stdin)) +{*(outp++)= 'C'; +*(outp++)= 'N'; +*(outp++)= 'S'; +*(outp++)= *inp; +} +else if((*inp=='X'||*inp=='Y')&&!feof(stdin)) +{*(outp++)= 'C'; +*(outp++)= 'E'; +*(outp++)= 'F'; +*(outp++)= *inp; +} +else +goto no_macro; +} +else if(*inp=='U'&&!feof(stdin)) +{*(outp++)= 'U'; +*(outp++)= 'T'; +*(outp++)= 'F'; +*(outp++)= '8'; +} +else +goto no_macro; + +*(++inp)= fgetc(stdin); +if(*inp!='-'||feof(stdin)) +goto no_macro; + +*(outp++)= '\177'; +*(outp++)= '\"'; +*(outp++)= '0'; + +*(++inp)= fgetc(stdin); +if(isxdigit(*inp)&&*inp<0x80&&!feof(stdin)) +*(outp++)= toupper(*inp); +else +goto no_macro; + +*(++inp)= fgetc(stdin); +if(isxdigit(*inp)&&*inp<0x80&&!feof(stdin)) +*(outp++)= toupper(*inp); +else +goto no_macro; + +*(outp++)= '\177'; +*(outp++)= '\177'; +*(outp++)= '\"'; +*(outp++)= '0'; + +*(++inp)= fgetc(stdin); +if(isxdigit(*inp)&&*inp<0x80&&!feof(stdin)) +*(outp++)= toupper(*inp); +else +goto no_macro; + +*(++inp)= fgetc(stdin); +if(isxdigit(*inp)&&*inp<0x80&&!feof(stdin)) +*(outp++)= toupper(*inp); +else +goto no_macro; + +*(outp++)= '\177'; +*outp= '\0'; + +*(++inp)= fgetc(stdin); +if(*inp!=';'||feof(stdin)) +goto no_macro; + +outp= out; +fprintf(stdout,"\17772\177"); +while(*outp) +fputc(*(outp++),stdout); + +ch= fgetc(stdin); +continue; + +no_macro: +ch= *inp; +i= inp-in; +inp= in; +while(i--) +fputc(*(inp++),stdout); +continue; +} +else +fputc(ch,stdout); + +ch= fgetc(stdin); +} +exit(EXIT_SUCCESS); +return 0; +}/*:2*/ diff --git a/Master/texmf-dist/source/latex/cjk/utils/CEFconv/cef5conv.w b/Master/texmf-dist/source/latex/cjk/utils/CEFconv/cef5conv.w new file mode 100644 index 00000000000..3877e4c19fb --- /dev/null +++ b/Master/texmf-dist/source/latex/cjk/utils/CEFconv/cef5conv.w @@ -0,0 +1,240 @@ +% This is the cweb file cef5conv.w of the CJK Package Ver. 4.8.0 22-May-2008 + +% Copyright (C) 1994-2008 Werner Lemberg <wl@@gnu.org> +% +% 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 of the License, 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 General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program in doc/COPYING; if not, write to the Free +% Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, +% MA 02110-1301 USA + +% To print this CWEB file you should (but not must) use the CWEAVE of the +% c2cweb-package (found at the CTAN archives, e.g. ftp.dante.de) and then say +% +% cweave +a cef5conv.w +% +% This (fully compatible) CWEAVE can transform CWEB-files with alternative +% output rules (look at the position of braces below!) the author (it's me +% too :-) prefer. Otherwise this file will be formatted traditionally. + +\def\title{cef5conv (CJK Version 4.8.0)} + +\def\topofcontents{ + \null\vfill + \centerline{\titlefont The {\ttitlefont cef5conv} program} + \vskip 20pt + \centerline{(CJK Version 4.8.0)} + \vfill} + +\def\botofcontents{ + \vfill + \noindent + Copyright \copyright\ 1996, 1998, 2002 by Werner Lemberg + \bigskip\noindent + Permission is granted to make and distribute verbatim copies of this + document provided that the copyright notice and this permission notice + are preserved on all copies. + + \smallskip\noindent + Permission is granted to copy and distribute modified versions of this + document under the conditions for verbatim copying, provided that the + entire resulting derived work is distributed under the terms of a + permission notice identical to this one.} + +\pageno=\contentspagenumber \advance\pageno by 1 +\let\maybe=\iftrue +\fullpageheight=240mm +\pageheight=223mm +\pagewidth=158mm +\setpage +\frenchspacing + +\noinx +\nosecs +\nocon + +@* Function and Use. +This small program will convert Big~5 encoding with CNS encoded Chinese +characters using the {\it Chinese Encoding Framework (CEF)} into a +`preprocessed' form. The need of this program arises from the fact that +Big~5 encoding uses the characters `\.{\\}', `\.{\{}', and `\.{\}}' which +have special meanings in \TeX. + +Use this program as a filter: + +\hskip 2em \.{cef5conv < input\_file > output\_file} + + +@* The program. +In contrast to \.{cefconv} two tasks will be executed: + +Replacing all occurrences of Big~5 encoded characters \.{XY} (\.{X} and +\.{Y} are the first and the second byte of the character) with +\.{\char94 \char94 7fX\char94 \char94 7fZZZ\char94 \char94 7f}, where +\.{ZZZ} represents the second byte as a decimal number. \.{0x7F} is used as +a control character and a delimiter. + +Replacing CEF macros of the form \.{\&xx-yyzz;} (\.{xx} can be C1--C7 for +the CNS planes 1--7, C0 for Big~5 encoding, an encoding CX reserved for +IRIZ, a private encoding CY, and U for Unicode encoding; \.{yyzz} is a +hexadecimal representation of the code point in this plane) with +\medskip +\quad\.{\char94 \char94 7f72\char94 \char94 7fXX\char94 \char94 7f% +\char94 \char94 7f"0yy\char94 \char94 7f"0zz\char94 \char94 7f}\quad. +\medskip +\.{XX} is the corresponding CJK encoding of \.{xx}; the number `72' +specifies a macro in the file \.{MULEenc.sty} which further processes this +representation -- it is automatically loaded by the \.{CJK} package. + +Additionally we define a \TeX\ macro at the very beginning to signal a +preprocessed file. + +The following code is very simple. No error detection is done because \TeX\ +which will see the output of \.{cef5conv} complains loudly if something is +wrong. + +@d banner +"cef5conv (CJK ver. 4.8.0)" + +@c +#include <ctype.h> +#include <stdio.h> +#include <stdlib.h>@# + + +int main(argc, argv) + int argc; + char *argv[]; + + {int ch, i; + unsigned char in[16]; + unsigned char out[32]; + unsigned char *inp, *outp; + + fprintf(stdout, "\\def\\CNSpreproc{%s}", banner);@# + + ch = fgetc(stdin);@# + + while(!feof(stdin)) + {if(ch >= 0xA1 && ch <= 0xFE) + {fprintf(stdout, "\177%c\177", ch);@# + + ch = fgetc(stdin); + if(!feof(stdin)) + fprintf(stdout, "%d\177", ch); + } + else if(ch == '&') + /* the macro test is hardcoded to make things simple */ + {inp = in; + outp = out; + *inp = ch; + *(++inp) = fgetc(stdin);@# + + if(*inp == 'C' && !feof(stdin)) + {*(++inp) = fgetc(stdin); + if(*inp == '0' && !feof(stdin)) + {*(outp++) = 'B'; + *(outp++) = 'g'; + *(outp++) = '5'; + } + else if(*inp >= '1' && *inp <= '7' && !feof(stdin)) + {*(outp++) = 'C'; + *(outp++) = 'N'; + *(outp++) = 'S'; + *(outp++) = *inp; + } + else if((*inp == 'X' || *inp == 'Y') && !feof(stdin)) + {*(outp++) = 'C'; + *(outp++) = 'E'; + *(outp++) = 'F'; + *(outp++) = *inp; + } + else + goto no_macro; + } + else if(*inp == 'U' && !feof(stdin)) + {*(outp++) = 'U'; + *(outp++) = 'T'; + *(outp++) = 'F'; + *(outp++) = '8'; + } + else + goto no_macro;@# + + *(++inp) = fgetc(stdin); + if(*inp != '-' || feof(stdin)) + goto no_macro;@# + + *(outp++) = '\177'; + *(outp++) = '\"'; + *(outp++) = '0';@# + + *(++inp) = fgetc(stdin); + if(isxdigit(*inp) && *inp < 0x80 && !feof(stdin)) + *(outp++) = toupper(*inp); + else + goto no_macro;@# + + *(++inp) = fgetc(stdin); + if(isxdigit(*inp) && *inp < 0x80 && !feof(stdin)) + *(outp++) = toupper(*inp); + else + goto no_macro;@# + + *(outp++) = '\177'; + *(outp++) = '\177'; + *(outp++) = '\"'; + *(outp++) = '0';@# + + *(++inp) = fgetc(stdin); + if(isxdigit(*inp) && *inp < 0x80 && !feof(stdin)) + *(outp++) = toupper(*inp); + else + goto no_macro;@# + + *(++inp) = fgetc(stdin); + if(isxdigit(*inp) && *inp < 0x80 && !feof(stdin)) + *(outp++) = toupper(*inp); + else + goto no_macro;@# + + *(outp++) = '\177'; + *outp = '\0';@# + + *(++inp) = fgetc(stdin); + if(*inp != ';' || feof(stdin)) + goto no_macro;@# + + outp = out; + fprintf(stdout, "\17772\177"); + while(*outp) + fputc(*(outp++), stdout);@# + + ch = fgetc(stdin); + continue;@# + +no_macro: + ch = *inp; + i = inp - in; + inp = in; + while(i--) + fputc(*(inp++), stdout); + continue; + } + else + fputc(ch, stdout);@# + + ch = fgetc(stdin); + } + exit(EXIT_SUCCESS); + return 0; /* never reached */ + } diff --git a/Master/texmf-dist/source/latex/cjk/utils/CEFconv/cef5latex b/Master/texmf-dist/source/latex/cjk/utils/CEFconv/cef5latex new file mode 100644 index 00000000000..5e609181030 --- /dev/null +++ b/Master/texmf-dist/source/latex/cjk/utils/CEFconv/cef5latex @@ -0,0 +1,43 @@ +#! /bin/sh + +# Copyright (C) 1994-2008 Werner Lemberg <wl@gnu.org> +# +# 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 of the License, 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program in doc/COPYING; if not, write to the Free +# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, +# MA 02110-1301 USA + +n=1 +argv= + +# get last argument +while test 1 -lt $#; do + eval argv$n=\$1 + argv="$argv \"\$argv$n\"" + n=`expr $n + 1` + shift +done + +# replace extension with .cjk or append .cjk if there is no extension +tex=$1 +case $tex in +""|*.cjk) + echo >&2 "Usage: $0 [options] latex-file" + exit 1;; +*) + aux=`expr "X$tex" : 'X\(.*\)\.[^/]*$' \| "X$tex" : 'X\(.*\)'`.cjk;; +esac + +cef5conv < "$tex" > "$aux" && eval latex "$argv" "\$aux" + +# EOF diff --git a/Master/texmf-dist/source/latex/cjk/utils/CEFconv/cef5ltx.bat b/Master/texmf-dist/source/latex/cjk/utils/CEFconv/cef5ltx.bat new file mode 100755 index 00000000000..187485301f9 --- /dev/null +++ b/Master/texmf-dist/source/latex/cjk/utils/CEFconv/cef5ltx.bat @@ -0,0 +1,3 @@ +call f_name %1
+cef5conv < %1 > %fd%%fp%%fn%.cjk
+latex %fd%%fu%%fn%.cjk
diff --git a/Master/texmf-dist/source/latex/cjk/utils/CEFconv/cef5ltx.cmd b/Master/texmf-dist/source/latex/cjk/utils/CEFconv/cef5ltx.cmd new file mode 100644 index 00000000000..325de4b6d89 --- /dev/null +++ b/Master/texmf-dist/source/latex/cjk/utils/CEFconv/cef5ltx.cmd @@ -0,0 +1,46 @@ +/*----------------------------------------------------------------------*\ + cef5ltx.cmd + + This file is part of the CJK macro package for LaTeX2e ver. 4.8.0 + + This file is part of the CJK macro package for LaTeX2e ver. 4.8.0 + + Copyright (C) 1994-2008 Wonkoo Kim <wkim+@pitt.edu> + + 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 of the License, 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program in doc/COPYING; if not, write to the Free + Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA + + Wonkoo Kim (wkim+@pitt.edu), September 2, 1996 +\*----------------------------------------------------------------------*/ + +Call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs' +Call SysLoadFuncs + +parse arg file + +drive = filespec('drive', file) +path = filespec('path', file) +fname = filespec('name', file) +m = lastpos('.', fname) +if (m = 0) then m = length(fname) + 1 +cjkfile = drive||path||delstr(fname, m)||'.cjk' + +'cef5conv <' file '>' cjkfile + +ucjkfile = translate(cjkfile,'/','\') +if stream(cjkfile, 'C', 'QUERY EXISTS') \= '' then + 'call latex.cmd' ucjkfile + +/* End of cef5ltx.cmd */ diff --git a/Master/texmf-dist/source/latex/cjk/utils/CEFconv/cef5pdflatex b/Master/texmf-dist/source/latex/cjk/utils/CEFconv/cef5pdflatex new file mode 100644 index 00000000000..cd1118cd7c3 --- /dev/null +++ b/Master/texmf-dist/source/latex/cjk/utils/CEFconv/cef5pdflatex @@ -0,0 +1,43 @@ +#! /bin/sh + +# Copyright (C) 1994-2008 Werner Lemberg <wl@gnu.org> +# +# 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 of the License, 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program in doc/COPYING; if not, write to the Free +# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, +# MA 02110-1301 USA + +n=1 +argv= + +# get last argument +while test 1 -lt $#; do + eval argv$n=\$1 + argv="$argv \"\$argv$n\"" + n=`expr $n + 1` + shift +done + +# replace extension with .cjk or append .cjk if there is no extension +tex=$1 +case $tex in +""|*.cjk) + echo >&2 "Usage: $0 [options] pdflatex-file" + exit 1;; +*) + aux=`expr "X$tex" : 'X\(.*\)\.[^/]*$' \| "X$tex" : 'X\(.*\)'`.cjk;; +esac + +cef5conv < "$tex" > "$aux" && eval pdflatex "$argv" "\$aux" + +# EOF diff --git a/Master/texmf-dist/source/latex/cjk/utils/CEFconv/cefconv.1 b/Master/texmf-dist/source/latex/cjk/utils/CEFconv/cefconv.1 new file mode 100644 index 00000000000..fcadd795f35 --- /dev/null +++ b/Master/texmf-dist/source/latex/cjk/utils/CEFconv/cefconv.1 @@ -0,0 +1,117 @@ +.\" man page for cefconv +.\" Copyright (C) 1994-2008 Werner Lemberg <wl@gnu.org> +.\" +.\" 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 of the License, 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 General Public License for more details. +.\" +.\" You should have received a copy of the GNU General Public License +.\" along with this program in doc/COPYING; if not, write to the Free +.\" Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, +.\" MA 02110-1301 USA +. +.TH CEFCONV 1 22-May-2008 "CJK Version 4.8.0" +. +.\" ==== +.\" ==== macro definitions +.\" ==== +. +.\" here we define \TeX for troff and nroff +.if t .ds TX \fRT\\h'-0.1667m'\\v'0.20v'E\\v'-0.20v'\\h'-0.125m'X\fP +.if n .ds TX TeX +. +.\" and here the same for \LaTeX +.if t \{\ +.ie '\*(.T'dvi' \ +.ds LX \fRL\h'-0.36m'\v'-0.15v'\s-3A\s0\h'-0.15m'\v'0.15v'\fP\*(TX +.el .ds LX \fRL\h'-0.36m'\v'-0.22v'\s-2A\s0\h'-0.15m'\v'0.22v'\fP\*(TX +.\} +.if n .ds LX LaTeX +. +.\" \LaTeXe +.\" note that we need \vareps for TeX instead of \eps which can only be +.\" accessed with the \N escape sequence (in the Math Italic font) +.if t \{\ +.ie '\*(.T'dvi' .ds LE \*(LX\h'0.15m'2\v'0.20v'\f(MI\N'34'\fP\v'-0.20v' +.el .ds LE \*(LX\h'0.15m'2\v'0.20v'\(*e\v'-0.20v' +.\} +.if n .ds LE LaTeX\ 2e +. +.\" a typewriter font +.if t \{\ +.de C +\fC\\$1\fP +.. +.\} +.if n \{\ +.de C +\\$1 +.. +.\} +. +.\" ==== +.\" ==== end of macro definitions +.\" ==== +. +. +. +.SH NAME +cefconv \- convert a TeX document containing CEF macros into `preprocessed' +form. +. +. +.SH SYNOPSIS +.B cefconv +< +.I infile +> +.I outfile +. +. +.SH DESCRIPTION +The +.B Chinese Encoding Framework +.RB ( CEF ) +developed by Christian Wittern +.C <cwittern@conline.central.de> +makes it possible to include CJK characters in various encodings using the +SGML macros +.B &CX-aabb; +for Big\ 5 and CNS encoding and +.B &U-aabb; +for Unicode +.RB ( X +denotes a number between 0 and 7; 0 represents Big\ 5 encoding, 1-7 CNS +encoding planes 1-7. +.B aabb +is either a decimal or hexadecimal number) +.PP +.B \%cefconv +converts the CEF macros into a form which can directly processed with \*(LE. +.PP +This filter is part of the +.B CJK +macro package for \*(LE. +. +. +.SH "SEE ALSO" +.BR \%sjisconv (1), +.BR bg5conv (1), +.BR cef5conv (1), +.BR \%cefsconv (1), +.BR \%extconv (1), +.br +the +.B CJK +documentation files. +. +. +.SH AUTHOR +Werner Lemberg +.C <wl@gnu.org> diff --git a/Master/texmf-dist/source/latex/cjk/utils/CEFconv/cefconv.c b/Master/texmf-dist/source/latex/cjk/utils/CEFconv/cefconv.c new file mode 100644 index 00000000000..562c6775922 --- /dev/null +++ b/Master/texmf-dist/source/latex/cjk/utils/CEFconv/cefconv.c @@ -0,0 +1,130 @@ +#define banner \ +"cefconv (CJK ver. 4.8.0)" \ + +/*2:*/ +#line 100 "/home/wl/git/cjk/cjk-4.8.0/utils/CEFconv/cefconv.w" + +#include <ctype.h> +#include <stdio.h> +#include <stdlib.h> + + +int main(argc,argv) +int argc; +char*argv[]; + +{int ch,i; +unsigned char in[16]; +unsigned char out[32]; +unsigned char*inp,*outp; + +fprintf(stdout,"\\def\\CNSpreproc{%s}",banner); + +ch= fgetc(stdin); + +while(!feof(stdin)) +{if(ch=='&') +{inp= in; +outp= out; +*inp= ch; +*(++inp)= fgetc(stdin); + +if(*inp=='C'&&!feof(stdin)) +{*(++inp)= fgetc(stdin); +if(*inp=='0'&&!feof(stdin)) +{*(outp++)= 'B'; +*(outp++)= 'g'; +*(outp++)= '5'; +} +else if(*inp>='1'&&*inp<='7'&&!feof(stdin)) +{*(outp++)= 'C'; +*(outp++)= 'N'; +*(outp++)= 'S'; +*(outp++)= *inp; +} +else if((*inp=='X'||*inp=='Y')&&!feof(stdin)) +{*(outp++)= 'C'; +*(outp++)= 'E'; +*(outp++)= 'F'; +*(outp++)= *inp; +} +else +goto no_macro; +} +else if(*inp=='U'&&!feof(stdin)) +{*(outp++)= 'U'; +*(outp++)= 'T'; +*(outp++)= 'F'; +*(outp++)= '8'; +} +else +goto no_macro; + +*(++inp)= fgetc(stdin); +if(*inp!='-'||feof(stdin)) +goto no_macro; + +*(outp++)= '\177'; +*(outp++)= '\177'; +*(outp++)= '\"'; +*(outp++)= '0'; + +*(++inp)= fgetc(stdin); +if(isxdigit(*inp)&&*inp<0x80&&!feof(stdin)) +*(outp++)= toupper(*inp); +else +goto no_macro; + +*(++inp)= fgetc(stdin); +if(isxdigit(*inp)&&*inp<0x80&&!feof(stdin)) +*(outp++)= toupper(*inp); +else +goto no_macro; + +*(outp++)= '\177'; +*(outp++)= '\"'; +*(outp++)= '0'; + +*(++inp)= fgetc(stdin); +if(isxdigit(*inp)&&*inp<0x80&&!feof(stdin)) +*(outp++)= toupper(*inp); +else +goto no_macro; + +*(++inp)= fgetc(stdin); +if(isxdigit(*inp)&&*inp<0x80&&!feof(stdin)) +*(outp++)= toupper(*inp); +else +goto no_macro; + +*(outp++)= '\177'; +*outp= '\0'; + +*(++inp)= fgetc(stdin); +if(*inp!=';'||feof(stdin)) +goto no_macro; + +outp= out; +fprintf(stdout,"\17772\177"); +while(*outp) +fputc(*(outp++),stdout); + +ch= fgetc(stdin); +continue; + +no_macro: +ch= *inp; +i= inp-in; +inp= in; +while(i--) +fputc(*(inp++),stdout); +continue; +} +else +fputc(ch,stdout); + +ch= fgetc(stdin); +} +exit(EXIT_SUCCESS); +return 0; +}/*:2*/ diff --git a/Master/texmf-dist/source/latex/cjk/utils/CEFconv/cefconv.w b/Master/texmf-dist/source/latex/cjk/utils/CEFconv/cefconv.w new file mode 100644 index 00000000000..b376926e978 --- /dev/null +++ b/Master/texmf-dist/source/latex/cjk/utils/CEFconv/cefconv.w @@ -0,0 +1,224 @@ +% This is the cweb file cefconv.w of the CJK Package Ver. 4.8.0 22-May-2008 + +% Copyright (C) 1994-2008 Werner Lemberg <wl@@gnu.org> +% +% 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 of the License, 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 General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program in doc/COPYING; if not, write to the Free +% Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, +% MA 02110-1301 USA + +% To print this CWEB file you should (but not must) use the CWEAVE of the +% c2cweb-package (found at the CTAN archives, e.g. ftp.dante.de) and then say +% +% cweave +a cefconv.w +% +% This (fully compatible) CWEAVE can transform CWEB-files with alternative +% output rules (look at the position of braces below!) the author (it's me +% too :-) prefer. Otherwise this file will be formatted traditionally. + +\def\title{cefconv (CJK Version 4.8.0)} + +\def\topofcontents{ + \null\vfill + \centerline{\titlefont The {\ttitlefont cefconv} program} + \vskip 20pt + \centerline{(CJK Version 4.8.0)} + \vfill} + +\def\botofcontents{ + \vfill + \noindent + Copyright \copyright\ 1996, 1998, 2002 by Werner Lemberg + \bigskip\noindent + Permission is granted to make and distribute verbatim copies of this + document provided that the copyright notice and this permission notice + are preserved on all copies. + + \smallskip\noindent + Permission is granted to copy and distribute modified versions of this + document under the conditions for verbatim copying, provided that the + entire resulting derived work is distributed under the terms of a + permission notice identical to this one.} + +\pageno=\contentspagenumber \advance\pageno by 1 +\let\maybe=\iftrue +\fullpageheight=240mm +\pageheight=223mm +\pagewidth=158mm +\setpage +\frenchspacing + +\noinx +\nosecs +\nocon + +@* Function and Use. +This small program will convert EUC encoding with CNS encoded Chinese +characters using the {\it Chinese Encoding Framework (CEF)} into a +`preprocessed' form, expanding the CEF macros. + +Use this program as a filter: + +\hskip 2em \.{cefconv < input\_file > output\_file} + + +@* The program. +In contrast to \.{cef5conv} or \.{cefsconv}, only one task will be executed: + +Replacing CEF macros of the form \.{\&xx-yyzz;} (\.{xx} can be C1--C7 for +the CNS planes 1--7, C0 for Big~5 encoding, an encoding CX reserved for +IRIZ, a private encoding CY, and U for Unicode encoding; \.{yyzz} is a +hexadecimal representation of the code point in this plane) with +\medskip +\quad\.{\char94 \char94 7f72\char94 \char94 ffXX\char94 \char94 7f% +\char94 \char94 7f"0yy\char94 \char94 7f"0zz\char94 \char94 7f}\quad. +\medskip +\.{XX} is the corresponding CJK encoding of \.{xx}; the number `72' +specifies a macro in the file \.{MULEenc.sty} which further processes this +representation -- it is automatically loaded by the \.{CJK} package. + +Additionally we define an empty \TeX\ macro at the very beginning to signal +a preprocessed file. + +The following code is very simple. No error detection is done because \TeX\ +which will see the output of \.{cefconv} complains loudly if something is +wrong. + +@d banner +"cefconv (CJK ver. 4.8.0)" + +@c +#include <ctype.h> +#include <stdio.h> +#include <stdlib.h>@# + + +int main(argc, argv) + int argc; + char *argv[]; + + {int ch, i; + unsigned char in[16]; + unsigned char out[32]; + unsigned char *inp, *outp; + + fprintf(stdout, "\\def\\CNSpreproc{%s}", banner);@# + + ch = fgetc(stdin);@# + + while(!feof(stdin)) + {if(ch == '&') /* the macro test is hardcoded to make things simple */ + {inp = in; + outp = out; + *inp = ch; + *(++inp) = fgetc(stdin);@# + + if(*inp == 'C' && !feof(stdin)) + {*(++inp) = fgetc(stdin); + if(*inp == '0' && !feof(stdin)) + {*(outp++) = 'B'; + *(outp++) = 'g'; + *(outp++) = '5'; + } + else if(*inp >= '1' && *inp <= '7' && !feof(stdin)) + {*(outp++) = 'C'; + *(outp++) = 'N'; + *(outp++) = 'S'; + *(outp++) = *inp; + } + else if((*inp == 'X' || *inp == 'Y') && !feof(stdin)) + {*(outp++) = 'C'; + *(outp++) = 'E'; + *(outp++) = 'F'; + *(outp++) = *inp; + } + else + goto no_macro; + } + else if(*inp == 'U' && !feof(stdin)) + {*(outp++) = 'U'; + *(outp++) = 'T'; + *(outp++) = 'F'; + *(outp++) = '8'; + } + else + goto no_macro;@# + + *(++inp) = fgetc(stdin); + if(*inp != '-' || feof(stdin)) + goto no_macro;@# + + *(outp++) = '\177'; + *(outp++) = '\177'; + *(outp++) = '\"'; + *(outp++) = '0';@# + + *(++inp) = fgetc(stdin); + if(isxdigit(*inp) && *inp < 0x80 && !feof(stdin)) + *(outp++) = toupper(*inp); + else + goto no_macro;@# + + *(++inp) = fgetc(stdin); + if(isxdigit(*inp) && *inp < 0x80 && !feof(stdin)) + *(outp++) = toupper(*inp); + else + goto no_macro;@# + + *(outp++) = '\177'; + *(outp++) = '\"'; + *(outp++) = '0';@# + + *(++inp) = fgetc(stdin); + if(isxdigit(*inp) && *inp < 0x80 && !feof(stdin)) + *(outp++) = toupper(*inp); + else + goto no_macro;@# + + *(++inp) = fgetc(stdin); + if(isxdigit(*inp) && *inp < 0x80 && !feof(stdin)) + *(outp++) = toupper(*inp); + else + goto no_macro;@# + + *(outp++) = '\177'; + *outp = '\0';@# + + *(++inp) = fgetc(stdin); + if(*inp != ';' || feof(stdin)) + goto no_macro;@# + + outp = out; + fprintf(stdout, "\17772\177"); + while(*outp) + fputc(*(outp++), stdout);@# + + ch = fgetc(stdin); + continue;@# + +no_macro: + ch = *inp; + i = inp - in; + inp = in; + while(i--) + fputc(*(inp++), stdout); + continue; + } + else + fputc(ch, stdout);@# + + ch = fgetc(stdin); + } + exit(EXIT_SUCCESS); + return 0; /* never reached */ + } diff --git a/Master/texmf-dist/source/latex/cjk/utils/CEFconv/ceflatex b/Master/texmf-dist/source/latex/cjk/utils/CEFconv/ceflatex new file mode 100644 index 00000000000..1b110c613c6 --- /dev/null +++ b/Master/texmf-dist/source/latex/cjk/utils/CEFconv/ceflatex @@ -0,0 +1,43 @@ +#! /bin/sh + +# Copyright (C) 1994-2008 Werner Lemberg <wl@gnu.org> +# +# 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 of the License, 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program in doc/COPYING; if not, write to the Free +# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, +# MA 02110-1301 USA + +n=1 +argv= + +# get last argument +while test 1 -lt $#; do + eval argv$n=\$1 + argv="$argv \"\$argv$n\"" + n=`expr $n + 1` + shift +done + +# replace extension with .cjk or append .cjk if there is no extension +tex=$1 +case $tex in +""|*.cjk) + echo >&2 "Usage: $0 [options] latex-file" + exit 1;; +*) + aux=`expr "X$tex" : 'X\(.*\)\.[^/]*$' \| "X$tex" : 'X\(.*\)'`.cjk;; +esac + +cefconv < "$tex" > "$aux" && eval latex "$argv" "\$aux" + +# EOF diff --git a/Master/texmf-dist/source/latex/cjk/utils/CEFconv/ceflatex.bat b/Master/texmf-dist/source/latex/cjk/utils/CEFconv/ceflatex.bat new file mode 100755 index 00000000000..ba5925a6df3 --- /dev/null +++ b/Master/texmf-dist/source/latex/cjk/utils/CEFconv/ceflatex.bat @@ -0,0 +1,3 @@ +call f_name %1
+cefconv < %1 > %fd%%fp%%fn%.cjk
+latex %fd%%fu%%fn%.cjk
diff --git a/Master/texmf-dist/source/latex/cjk/utils/CEFconv/ceflatex.cmd b/Master/texmf-dist/source/latex/cjk/utils/CEFconv/ceflatex.cmd new file mode 100644 index 00000000000..ed43ec94304 --- /dev/null +++ b/Master/texmf-dist/source/latex/cjk/utils/CEFconv/ceflatex.cmd @@ -0,0 +1,46 @@ +/*----------------------------------------------------------------------*\ + ceflatex.cmd + + This file is part of the CJK macro package for LaTeX2e ver. 4.8.0 + + This file is part of the CJK macro package for LaTeX2e ver. 4.8.0 + + Copyright (C) 1994-2008 Wonkoo Kim <wkim+@pitt.edu> + + 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 of the License, 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program in doc/COPYING; if not, write to the Free + Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA + + Wonkoo Kim (wkim+@pitt.edu), September 2, 1996 +\*----------------------------------------------------------------------*/ + +Call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs' +Call SysLoadFuncs + +parse arg file + +drive = filespec('drive', file) +path = filespec('path', file) +fname = filespec('name', file) +m = lastpos('.', fname) +if (m = 0) then m = length(fname) + 1 +cjkfile = drive||path||delstr(fname, m)||'.cjk' + +'cefconv <' file '>' cjkfile + +ucjkfile = translate(cjkfile,'/','\') +if stream(cjkfile, 'C', 'QUERY EXISTS') \= '' then + 'call latex.cmd' ucjkfile + +/* End of ceflatex.cmd */ diff --git a/Master/texmf-dist/source/latex/cjk/utils/CEFconv/cefpdflatex b/Master/texmf-dist/source/latex/cjk/utils/CEFconv/cefpdflatex new file mode 100644 index 00000000000..706114a8c77 --- /dev/null +++ b/Master/texmf-dist/source/latex/cjk/utils/CEFconv/cefpdflatex @@ -0,0 +1,43 @@ +#! /bin/sh + +# Copyright (C) 1994-2008 Werner Lemberg <wl@gnu.org> +# +# 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 of the License, 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program in doc/COPYING; if not, write to the Free +# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, +# MA 02110-1301 USA + +n=1 +argv= + +# get last argument +while test 1 -lt $#; do + eval argv$n=\$1 + argv="$argv \"\$argv$n\"" + n=`expr $n + 1` + shift +done + +# replace extension with .cjk or append .cjk if there is no extension +tex=$1 +case $tex in +""|*.cjk) + echo >&2 "Usage: $0 [options] pdflatex-file" + exit 1;; +*) + aux=`expr "X$tex" : 'X\(.*\)\.[^/]*$' \| "X$tex" : 'X\(.*\)'`.cjk;; +esac + +cefconv < "$tex" > "$aux" && eval pdflatex "$argv" "\$aux" + +# EOF diff --git a/Master/texmf-dist/source/latex/cjk/utils/CEFconv/cefsconv.1 b/Master/texmf-dist/source/latex/cjk/utils/CEFconv/cefsconv.1 new file mode 100644 index 00000000000..82995a98b6a --- /dev/null +++ b/Master/texmf-dist/source/latex/cjk/utils/CEFconv/cefsconv.1 @@ -0,0 +1,127 @@ +.\" man page for cefsconv +.\" Copyright (C) 1994-2008 Werner Lemberg <wl@gnu.org> +.\" +.\" 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 of the License, 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 General Public License for more details. +.\" +.\" You should have received a copy of the GNU General Public License +.\" along with this program in doc/COPYING; if not, write to the Free +.\" Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, +.\" MA 02110-1301 USA +. +.TH CEFSCONV 1 22-May-2008 "CJK Version 4.8.0" +. +.\" ==== +.\" ==== macro definitions +.\" ==== +. +.\" here we define \TeX for troff and nroff +.if t .ds TX \fRT\\h'-0.1667m'\\v'0.20v'E\\v'-0.20v'\\h'-0.125m'X\fP +.if n .ds TX TeX +. +.\" and here the same for \LaTeX +.if t \{\ +.ie '\*(.T'dvi' \ +.ds LX \fRL\h'-0.36m'\v'-0.15v'\s-3A\s0\h'-0.15m'\v'0.15v'\fP\*(TX +.el .ds LX \fRL\h'-0.36m'\v'-0.22v'\s-2A\s0\h'-0.15m'\v'0.22v'\fP\*(TX +.\} +.if n .ds LX LaTeX +. +.\" \LaTeXe +.\" note that we need \vareps for TeX instead of \eps which can only be +.\" accessed with the \N escape sequence (in the Math Italic font) +.if t \{\ +.ie '\*(.T'dvi' .ds LE \*(LX\h'0.15m'2\v'0.20v'\f(MI\N'34'\fP\v'-0.20v' +.el .ds LE \*(LX\h'0.15m'2\v'0.20v'\(*e\v'-0.20v' +.\} +.if n .ds LE LaTeX\ 2e +. +.\" a typewriter font +.if t \{\ +.de C +\fC\\$1\fP +.. +.\} +.if n \{\ +.de C +\\$1 +.. +.\} +. +.\" ==== +.\" ==== end of macro definitions +.\" ==== +. +. +. +.SH NAME +cefsconv \- convert a TeX document in SJIS encoding containing CEF macros +into `preprocessed' form. +. +. +.SH SYNOPSIS +.B cefsconv +< +.I infile +> +.I outfile +. +. +.SH DESCRIPTION +The +.B Chinese Encoding Framework +.RB ( CEF ) +developed by Christian Wittern +.C <cwittern@conline.central.de> +makes it possible to include CJK characters in various encodings using the +SGML macros +.B &CX-aabb; +for Big\ 5 and CNS encoding and +.B &U-aabb; +for Unicode +.RB ( X +denotes a number between 0 and 7; 0 represents Big\ 5 encoding, 1-7 CNS +encoding planes 1-7. +.B aabb +is either a decimal or hexadecimal number). +.PP +.B \%cefsconv +converts the CEF macros of a SJIS encoded document together with the SJIS +encoding itself into a form which can directly processed with \*(LE. +It is identical to +.IP +.B sjisconv +< +.I infile +| +.B cefconv +> +.I outfile +.PP +This filter is part of the +.B CJK +macro package for \*(LE. +. +. +.SH "SEE ALSO" +.BR \%sjisconv (1), +.BR bg5conv (1), +.BR \%cefconv (1), +.BR cef5conv (1), +.BR \%extconv (1), +.br +the +.B CJK +documentation files. +. +. +.SH AUTHOR +Werner Lemberg +.C <wl@gnu.org> diff --git a/Master/texmf-dist/source/latex/cjk/utils/CEFconv/cefsconv.c b/Master/texmf-dist/source/latex/cjk/utils/CEFconv/cefsconv.c new file mode 100644 index 00000000000..bd738d742f4 --- /dev/null +++ b/Master/texmf-dist/source/latex/cjk/utils/CEFconv/cefsconv.c @@ -0,0 +1,138 @@ +#define banner \ +"cefsconv (CJK ver. 4.8.0)" \ + +/*2:*/ +#line 108 "/home/wl/git/cjk/cjk-4.8.0/utils/CEFconv/cefsconv.w" + +#include <ctype.h> +#include <stdio.h> +#include <stdlib.h> + + +int main(argc,argv) +int argc; +char*argv[]; + +{int ch,i; +unsigned char in[16]; +unsigned char out[32]; +unsigned char*inp,*outp; + +fprintf(stdout,"\\def\\CNSpreproc{%s}",banner); + +ch= fgetc(stdin); + +while(!feof(stdin)) +{if((ch>=0x81&&ch<=0x9F)||(ch>=0xE0&&ch<=0xEF)) +{fprintf(stdout,"\177%c\177",ch); + +ch= fgetc(stdin); +if(!feof(stdin)) +fprintf(stdout,"%d\177",ch); +} +else if(ch=='&') + +{inp= in; +outp= out; +*inp= ch; +*(++inp)= fgetc(stdin); + +if(*inp=='C'&&!feof(stdin)) +{*(++inp)= fgetc(stdin); +if(*inp=='0'&&!feof(stdin)) +{*(outp++)= 'B'; +*(outp++)= 'g'; +*(outp++)= '5'; +} +else if(*inp>='1'&&*inp<='7'&&!feof(stdin)) +{*(outp++)= 'C'; +*(outp++)= 'N'; +*(outp++)= 'S'; +*(outp++)= *inp; +} +else if((*inp=='X'||*inp=='Y')&&!feof(stdin)) +{*(outp++)= 'C'; +*(outp++)= 'E'; +*(outp++)= 'F'; +*(outp++)= *inp; +} +else +goto no_macro; +} +else if(*inp=='U'&&!feof(stdin)) +{*(outp++)= 'U'; +*(outp++)= 'T'; +*(outp++)= 'F'; +*(outp++)= '8'; +} +else +goto no_macro; + +*(++inp)= fgetc(stdin); +if(*inp!='-'||feof(stdin)) +goto no_macro; + +*(outp++)= '\177'; +*(outp++)= '\"'; +*(outp++)= '0'; + +*(++inp)= fgetc(stdin); +if(isxdigit(*inp)&&*inp<0x80&&!feof(stdin)) +*(outp++)= toupper(*inp); +else +goto no_macro; + +*(++inp)= fgetc(stdin); +if(isxdigit(*inp)&&*inp<0x80&&!feof(stdin)) +*(outp++)= toupper(*inp); +else +goto no_macro; + +*(outp++)= '\177'; +*(outp++)= '\177'; +*(outp++)= '\"'; +*(outp++)= '0'; + +*(++inp)= fgetc(stdin); +if(isxdigit(*inp)&&*inp<0x80&&!feof(stdin)) +*(outp++)= toupper(*inp); +else +goto no_macro; + +*(++inp)= fgetc(stdin); +if(isxdigit(*inp)&&*inp<0x80&&!feof(stdin)) +*(outp++)= toupper(*inp); +else +goto no_macro; + +*(outp++)= '\177'; +*outp= '\0'; + +*(++inp)= fgetc(stdin); +if(*inp!=';'||feof(stdin)) +goto no_macro; + +outp= out; +fprintf(stdout,"\17772\177"); +while(*outp) +fputc(*(outp++),stdout); + +ch= fgetc(stdin); +continue; + +no_macro: +ch= *inp; +i= inp-in; +inp= in; +while(i--) +fputc(*(inp++),stdout); +continue; +} +else +fputc(ch,stdout); + +ch= fgetc(stdin); +} +exit(EXIT_SUCCESS); +return 0; +}/*:2*/ diff --git a/Master/texmf-dist/source/latex/cjk/utils/CEFconv/cefsconv.w b/Master/texmf-dist/source/latex/cjk/utils/CEFconv/cefsconv.w new file mode 100644 index 00000000000..f1a5629b25e --- /dev/null +++ b/Master/texmf-dist/source/latex/cjk/utils/CEFconv/cefsconv.w @@ -0,0 +1,240 @@ +% This is the cweb file cefsconv.w of the CJK Package Ver. 4.8.0 22-May-2008 + +% Copyright (C) 1994-2008 Werner Lemberg <wl@@gnu.org> +% +% 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 of the License, 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 General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program in doc/COPYING; if not, write to the Free +% Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, +% MA 02110-1301 USA + +% To print this CWEB file you should (but not must) use the CWEAVE of the +% c2cweb-package (found at the CTAN archives, e.g. ftp.dante.de) and then say +% +% cweave +a cefsconv.w +% +% This (fully compatible) CWEAVE can transform CWEB-files with alternative +% output rules (look at the position of braces below!) the author (it's me +% too :-) prefer. Otherwise this file will be formatted traditionally. + +\def\title{cefsconv (CJK Version 4.8.0)} + +\def\topofcontents{ + \null\vfill + \centerline{\titlefont The {\ttitlefont cefsconv} program} + \vskip 20pt + \centerline{(CJK Version 4.8.0)} + \vfill} + +\def\botofcontents{ + \vfill + \noindent + Copyright \copyright\ 1996, 1998 by Werner Lemberg + \bigskip\noindent + Permission is granted to make and distribute verbatim copies of this + document provided that the copyright notice and this permission notice + are preserved on all copies. + + \smallskip\noindent + Permission is granted to copy and distribute modified versions of this + document under the conditions for verbatim copying, provided that the + entire resulting derived work is distributed under the terms of a + permission notice identical to this one.} + +\pageno=\contentspagenumber \advance\pageno by 1 +\let\maybe=\iftrue +\fullpageheight=240mm +\pageheight=223mm +\pagewidth=158mm +\setpage +\frenchspacing + +\noinx +\nosecs +\nocon + +@* Function and Use. +This small program will convert SJIS encoding with CNS encoded Chinese +characters using the {\it Chinese Encoding Framework (CEF)} into a +`preprocessed' form. The need of this program arises from the fact that +SJIS encoding uses the characters `\.{\\}', `\.{\{}', and `\.{\}}' which +have special meanings in \TeX. + +Use this program as a filter: + +\hskip 2em \.{cefsconv < input\_file > output\_file} + + +@* The program. +In contrast to \.{cefconv} two tasks will be executed: + +Replacing all occurrences of two byte SJIS encoded characters \.{XY} with +\.{\char94 \char94 7fX\char94 \char94 7fZZZ\char94 \char94 7f} (\.{X} and +\.{Y} are the first and the second byte of the character; \.{ZZZ} represents +the second byte as a decimal number). + +Replacing CEF macros of the form \.{\&xx-yyzz;} (\.{xx} can be C1--C7 for +the CNS planes 1--7, C0 for Big~5 encoding, an encoding CX reserved for +IRIZ, a private encoding CY, and U for Unicode encoding; \.{yyzz} is a +hexadecimal representation of the code point in this plane) with +\medskip +\quad\.{\char94 \char94 7f72\char94 \char94 7fXX\char94 \char94 7f% +\char94 \char94 7f"0yy\char94 \char94 7f"0zz\char94 \char94 7f}\quad. +\medskip +\.{XX} is the corresponding CJK encoding of \.{xx}; the number `72' +specifies a macro in the file \.{MULEenc.sty} which further processes this +representation -- it is necessary to explicitly load this file with +\.{\\usepackage}. + +Additionally we define a \TeX\ macro at the very beginning to signal a +preprocessed file. + +The following code is very simple. No error detection is done because \TeX\ +which will see the output of \.{cefsconv} complains loudly if something is +wrong. + +@d banner +"cefsconv (CJK ver. 4.8.0)" + +@c +#include <ctype.h> +#include <stdio.h> +#include <stdlib.h>@# + + +int main(argc, argv) + int argc; + char *argv[]; + + {int ch, i; + unsigned char in[16]; + unsigned char out[32]; + unsigned char *inp, *outp; + + fprintf(stdout, "\\def\\CNSpreproc{%s}", banner);@# + + ch = fgetc(stdin);@# + + while(!feof(stdin)) + {if((ch >= 0x81 && ch <= 0x9F) || (ch >= 0xE0 && ch <= 0xEF)) + {fprintf(stdout, "\177%c\177", ch);@# + + ch = fgetc(stdin); + if(!feof(stdin)) + fprintf(stdout, "%d\177", ch); + } + else if(ch == '&') + /* the macro test is hardcoded to make things simple */ + {inp = in; + outp = out; + *inp = ch; + *(++inp) = fgetc(stdin);@# + + if(*inp == 'C' && !feof(stdin)) + {*(++inp) = fgetc(stdin); + if(*inp == '0' && !feof(stdin)) + {*(outp++) = 'B'; + *(outp++) = 'g'; + *(outp++) = '5'; + } + else if(*inp >= '1' && *inp <= '7' && !feof(stdin)) + {*(outp++) = 'C'; + *(outp++) = 'N'; + *(outp++) = 'S'; + *(outp++) = *inp; + } + else if((*inp == 'X' || *inp == 'Y') && !feof(stdin)) + {*(outp++) = 'C'; + *(outp++) = 'E'; + *(outp++) = 'F'; + *(outp++) = *inp; + } + else + goto no_macro; + } + else if(*inp == 'U' && !feof(stdin)) + {*(outp++) = 'U'; + *(outp++) = 'T'; + *(outp++) = 'F'; + *(outp++) = '8'; + } + else + goto no_macro;@# + + *(++inp) = fgetc(stdin); + if(*inp != '-' || feof(stdin)) + goto no_macro;@# + + *(outp++) = '\177'; + *(outp++) = '\"'; + *(outp++) = '0';@# + + *(++inp) = fgetc(stdin); + if(isxdigit(*inp) && *inp < 0x80 && !feof(stdin)) + *(outp++) = toupper(*inp); + else + goto no_macro;@# + + *(++inp) = fgetc(stdin); + if(isxdigit(*inp) && *inp < 0x80 && !feof(stdin)) + *(outp++) = toupper(*inp); + else + goto no_macro;@# + + *(outp++) = '\177'; + *(outp++) = '\177'; + *(outp++) = '\"'; + *(outp++) = '0';@# + + *(++inp) = fgetc(stdin); + if(isxdigit(*inp) && *inp < 0x80 && !feof(stdin)) + *(outp++) = toupper(*inp); + else + goto no_macro;@# + + *(++inp) = fgetc(stdin); + if(isxdigit(*inp) && *inp < 0x80 && !feof(stdin)) + *(outp++) = toupper(*inp); + else + goto no_macro;@# + + *(outp++) = '\177'; + *outp = '\0';@# + + *(++inp) = fgetc(stdin); + if(*inp != ';' || feof(stdin)) + goto no_macro;@# + + outp = out; + fprintf(stdout, "\17772\177"); + while(*outp) + fputc(*(outp++), stdout);@# + + ch = fgetc(stdin); + continue;@# + +no_macro: + ch = *inp; + i = inp - in; + inp = in; + while(i--) + fputc(*(inp++), stdout); + continue; + } + else + fputc(ch, stdout);@# + + ch = fgetc(stdin); + } + exit(EXIT_SUCCESS); + return 0; /* never reached */ + } diff --git a/Master/texmf-dist/source/latex/cjk/utils/CEFconv/cefslatex b/Master/texmf-dist/source/latex/cjk/utils/CEFconv/cefslatex new file mode 100644 index 00000000000..db2232d98c6 --- /dev/null +++ b/Master/texmf-dist/source/latex/cjk/utils/CEFconv/cefslatex @@ -0,0 +1,43 @@ +#! /bin/sh + +# Copyright (C) 1994-2008 Werner Lemberg <wl@gnu.org> +# +# 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 of the License, 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program in doc/COPYING; if not, write to the Free +# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, +# MA 02110-1301 USA + +n=1 +argv= + +# get last argument +while test 1 -lt $#; do + eval argv$n=\$1 + argv="$argv \"\$argv$n\"" + n=`expr $n + 1` + shift +done + +# replace extension with .cjk or append .cjk if there is no extension +tex=$1 +case $tex in +""|*.cjk) + echo >&2 "Usage: $0 [options] latex-file" + exit 1;; +*) + aux=`expr "X$tex" : 'X\(.*\)\.[^/]*$' \| "X$tex" : 'X\(.*\)'`.cjk;; +esac + +cefsconv < "$tex" > "$aux" && eval latex "$argv" "\$aux" + +# EOF diff --git a/Master/texmf-dist/source/latex/cjk/utils/CEFconv/cefsltx.bat b/Master/texmf-dist/source/latex/cjk/utils/CEFconv/cefsltx.bat new file mode 100755 index 00000000000..662ef9e3af4 --- /dev/null +++ b/Master/texmf-dist/source/latex/cjk/utils/CEFconv/cefsltx.bat @@ -0,0 +1,3 @@ +call f_name %1
+cefsconv < %1 > %fd%%fp%%fn%.cjk
+latex %fd%%fu%%fn%.cjk
diff --git a/Master/texmf-dist/source/latex/cjk/utils/CEFconv/cefsltx.cmd b/Master/texmf-dist/source/latex/cjk/utils/CEFconv/cefsltx.cmd new file mode 100644 index 00000000000..896634d414e --- /dev/null +++ b/Master/texmf-dist/source/latex/cjk/utils/CEFconv/cefsltx.cmd @@ -0,0 +1,46 @@ +/*----------------------------------------------------------------------*\ + cefsltx.cmd + + This file is part of the CJK macro package for LaTeX2e ver. 4.8.0 + + This file is part of the CJK macro package for LaTeX2e ver. 4.8.0 + + Copyright (C) 1994-2008 Wonkoo Kim <wkim+@pitt.edu> + + 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 of the License, 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program in doc/COPYING; if not, write to the Free + Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA + + Wonkoo Kim (wkim+@pitt.edu), September 2, 1996 +\*----------------------------------------------------------------------*/ + +Call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs' +Call SysLoadFuncs + +parse arg file + +drive = filespec('drive', file) +path = filespec('path', file) +fname = filespec('name', file) +m = lastpos('.', fname) +if (m = 0) then m = length(fname) + 1 +cjkfile = drive||path||delstr(fname, m)||'.cjk' + +'cefsconv <' file '>' cjkfile + +ucjkfile = translate(cjkfile,'/','\') +if stream(cjkfile, 'C', 'QUERY EXISTS') \= '' then + 'call latex.cmd' ucjkfile + +/* End of cefsltx.cmd */ diff --git a/Master/texmf-dist/source/latex/cjk/utils/CEFconv/cefspdflatex b/Master/texmf-dist/source/latex/cjk/utils/CEFconv/cefspdflatex new file mode 100644 index 00000000000..bc99498f4af --- /dev/null +++ b/Master/texmf-dist/source/latex/cjk/utils/CEFconv/cefspdflatex @@ -0,0 +1,43 @@ +#! /bin/sh + +# Copyright (C) 1994-2008 Werner Lemberg <wl@gnu.org> +# +# 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 of the License, 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program in doc/COPYING; if not, write to the Free +# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, +# MA 02110-1301 USA + +n=1 +argv= + +# get last argument +while test 1 -lt $#; do + eval argv$n=\$1 + argv="$argv \"\$argv$n\"" + n=`expr $n + 1` + shift +done + +# replace extension with .cjk or append .cjk if there is no extension +tex=$1 +case $tex in +""|*.cjk) + echo >&2 "Usage: $0 [options] latex-file" + exit 1;; +*) + aux=`expr "X$tex" : 'X\(.*\)\.[^/]*$' \| "X$tex" : 'X\(.*\)'`.cjk;; +esac + +cefsconv < "$tex" > "$aux" && eval pdflatex "$argv" "\$aux" + +# EOF |