Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 205799
Collapse All | Expand All

(-)a2ps-4.13.ORIG/Makefile.am (-1 / +1 lines)
Lines 20-26 Link Here
20
20
21
## Make sure to drop doc at the end: it causes may problems, so
21
## Make sure to drop doc at the end: it causes may problems, so
22
## let's do the maximum before it
22
## let's do the maximum before it
23
SUBDIRS = auxdir m4 etc ps ogonkify \
23
SUBDIRS = auxdir m4 etc ps ogonkify libjcode \
24
	lib src po tests sheets encoding afm fonts ppd contrib doc man
24
	lib src po tests sheets encoding afm fonts ppd contrib doc man
25
25
26
ACLOCAL_AMFLAGS = -I m4
26
ACLOCAL_AMFLAGS = -I m4
(-)a2ps-4.13.ORIG/Makefile.in (-1 / +1 lines)
Lines 275-281 Link Here
275
target_alias = @target_alias@
275
target_alias = @target_alias@
276
tex = @tex@
276
tex = @tex@
277
AUTOMAKE_OPTIONS = check-news 1.6.3 dist-bzip2 readme-alpha
277
AUTOMAKE_OPTIONS = check-news 1.6.3 dist-bzip2 readme-alpha
278
SUBDIRS = auxdir m4 etc ps ogonkify \
278
SUBDIRS = auxdir m4 etc ps ogonkify libjcode \
279
	lib src po tests sheets encoding afm fonts ppd contrib doc man
279
	lib src po tests sheets encoding afm fonts ppd contrib doc man
280
280
281
ACLOCAL_AMFLAGS = -I m4
281
ACLOCAL_AMFLAGS = -I m4
(-)a2ps-4.13.ORIG/README.jp (+89 lines)
Line 0 Link Here
1
a2ps 4.12¤Ç´Á»ú¤ò°õºþ¤¹¤ë¤¿¤á¤Î¥Ñ¥Ã¥Á
2
				·ÄØæÂç³ØÂç³Ø±¡
3
				¸ÅÀî ÂÙÇ· <yasu@on.cs.keio.ac.jp>
4
5
composite font ¤ò»È¤Ã¤Æ´Á»ú¤òɽ¼¨¤¹¤ë¤¿¤á¤Î¥Ñ¥Ã¥Á¤Ç¤¹¡£
6
composite font¤Ë¤Ï¡¢ÊÒ»³ µªÉפµ¤ó(¤Ï¤¸¤á¤ÆÆüËܸìghostscript¤òºîÀ®¤·¤¿
7
¿Í)¤Îfixeucfont ¤ò¥Ù¡¼¥¹¤Ëa2psÍѤË¿¾¯¼ê¤ò¤¤¤ì¤Æ¤ª¤ê¤Þ¤¹¡£¤³¤ì¤òÍøÍѤ¹
8
¤ë¤³¤È¤Ç¡¢2¥Ð¥¤¥ÈEUC¡ÜASCII¤Îʸ»úÎó¤ÎPostscript¤Î°·¤¤¤¬¤°¤Ã¤È´Êñ¤Ë¤Ê
9
¤ê¤Þ¤¹¡£
10
11
¡üComposite¥Õ¥©¥ó¥È¤ÎÀßÄêÊýË¡¤Ë¤Ä¤¤¤Æ
12
ºÇÄã¸Â¤ÎÀßÄê¤Ï¥Ñ¥Ã¥Á¤Ë´Þ¤Þ¤ì¤Æ¤¤¤Þ¤¹¤Î¤Ç¡¢¤È¤ê¤¢¤¨¤ºÂç¾æÉפÀ¤È¤Ï»×¤¤¤Þ
13
¤¹¡£°ì±þ¥á¥â¤·¤Æ¤ª¤­¤Þ¤¹¡£
14
15
encoding¥Õ¥¡¥¤¥ë($prefix/share/a2ps/encoding/¤Î²¼¤Î¥Õ¥¡¥¤¥ë)¤Ë¤Ï
16
¡ØComposite:¡Ù¤ª¤è¤Ó¡¢¡ØDefaultComposite:¡Ù¤¬¿·¤¿¤Ë»ØÄê¤Ç¤­¤Þ¤¹¡£¤¿¤È
17
¤¨¤Ð¡¢±Ñ¸ì¥Õ¥©¥ó¥È¤ËÂбþ¤¹¤ëEUC¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°¤ÎÆüËܸì¥Õ¥©¥ó¥È¤ò½ñ¤¤
18
¤Æ¹Ô¤­¤Þ¤¹¡£¤Þ¤¿¡¢¤³¤ÎºÝ¡¢¥Õ¥©¥ó¥ÈÉý¤ÈȾ³Ñ¤È´Á»ú¤ÎÈæ¤â»ØÄꤷ¤Ê¤¯¤Æ¤Ï¤Ê
19
¤ê¤Þ¤»¤ó¡£¼êÈ´¤­¤Ë¤è¤Ã¤Æ¡¢´Á»ú¤Ï¸ÇÄêÉý¥Õ¥©¥ó¥È¤·¤«»ØÄꤷ¤Æ¤Ï¤¤¤±¤Þ¤»¤ó¡£
20
21
--------------------------------------------------
22
#	                  ÆüËܸì¥Õ¥©¥ó¥È          ¥Õ¥©¥ó²£Éý	Ⱦ³Ñ¤È´Á»ú¤ÎÈæ
23
DefaultComposite:         Ryumin-Light-EUC-H      1             1.1	
24
#	    ±Ñ¸ì¥Õ¥©¥ó¥È  ÆüËܸì¥Õ¥©¥ó¥È	  ¥Õ¥©¥ó²£Éý	Ⱦ³Ñ¤È´Á»ú¤ÎÈæ
25
Composite:  Helvetica     GothicBBB-Medium-EUC-H  1		1.1
26
--------------------------------------------------
27
28
¤Þ¤¿¡¢¤³¤ì¤À¤È¼ÐÂδÁ»ú¤¬¤Ê¤¯¡¢¤µ¤ß¤·¤¤¤Î¤Ç¡¢SlantFont¤ò»È¤¤¡¢¼ÐÂΤδÁ
29
»ú¥Õ¥©¥ó¥È¤âºîÀ®¤Ç¤­¤Þ¤¹¡£
30
31
--------------------------------------------------
32
#               ¿·µ¬¼ÐÂÎÆüËܸì¥Õ¥©¥ó¥È̾	¥½¡¼¥¹ÆüËܸì¥Õ¥©¥ó¥È	·¹¤­ÅÙ
33
SlantFont:	Ryumin-Light-EUC-H-Italic	Ryumin-Light-EUC-H	0.2
34
--------------------------------------------------
35
36
SlantFont¤ÇÀ¸À®¤·¤¿¼ÐÂÎ¥Õ¥©¥ó¥È¤ÏComposite¥Õ¥©¥ó¥È(Âè2°ú¿ô)¤ÇÍøÍѤǤ­
37
¤Þ¤¹¡£
38
39
¡ü¤³¤Î¥Ñ¥Ã¥Á¤Î¾ÜºÙ¥Ç¡¼¥¿
40
  ¡¦»Äǰ¤Ê¤¬¤é2¥Ð¥¤¥ÈEUC¥³¡¼¥É¤òÁ°Äó¤È¤·¤¿¥³¡¼¥Ç¥£¥ó¥°¤ò¤·¤Æ¤¤¤Þ¤¹¡£
41
    ¤½¤Î¤¿¤á¡¢¤¢¤Þ¤ê´Á»ú°Ê³°¤Î¸À¸ì¤ò¹Í¤¨¤Æ¤ª¤ê¤Þ¤»¤ó¡Ä¡£
42
  ¡¦ÁÒ¸÷ ·¯Ïº»á¤Îlibjcode¤ò»È¤Ã¤ÆÆâÉô¤ÇÆþÎÏ¥Õ¥¡¥¤¥ë¤Î´Á»ú¥¨¥ó¥³¡¼¥Ç¥£
43
    ¥ó¥°¤ò¤¹¤Ù¤ÆEUC¤ËÊÑ´¹¤·¤Æ½èÍý¤¹¤ë¤è¤¦¤Ë¤·¤Æ¤¤¤Þ¤¹¡£¤¿¤À¤·¡¢¥ª¥ê¥¸
44
    ¥Ê¥ë¤Îlibjcode¤Ï¡¢SJIS¤ª¤è¤ÓEUC¤ÎȽÄ꤬´Å¤«¤Ã¤¿¤Î¤Ç¿¾¯¥«¥¹¥¿¥à¤·
45
    ¤Æ¤ª¤ê¤Þ¤¹¡£
46
  ¡¦¤Þ¤¿¡¢tex¤Îdelegate(contrib/texi2dvi4a2ps)Ãæ¡¢TeX¥É¥é¥¤¥Ð¤Ë¤ÏpTeX
47
    ¤È·è¤á¤¦¤Á¤·¤Æ¤¤¤Þ¤¹¡£¤³¤ì¤¬¤¤¤ä¤Ê¤é¡¢Î㤨¤ÐNTT-jTeX¤ò»ÈÍѤ·¤¿¤¤¾ì
48
    ¹ç¡¢´Ä¶­ÊÑ¿ôTEX¤Ë¡Øjtex¡Ù¤ò¡¢LATEX¤Ë¤Ï¡Øjlatex¡Ù¤ò»ØÄꤷ¤Æ¤¯¤À¤µ¤¤¡£
49
  ¡¦compositefont¤òa2psÍѤË¿¾¯¥«¥¹¥¿¥Þ¥¤¥º¤·¤Æ¤¤¤Þ¤¹¤¬¡¢¥Õ¥©¥ó¥È¤Î¹â
50
    ¤µ¤Ê¤É¤Î¾ðÊó¤ò´°Á´¤Ë¸ÇÄê¤Ç·è¤áÂǤÁ¤·¤Æ¤¤¤ë²Õ½ê¤¬¤¢¤ê¤Þ¤¹(XXX¤Ç¥á¥â
51
    ¤·¤Æ¤¤¤Þ¤¹)¡£¤½¤Î¤¿¤á¤¢¤Þ¤ê±þÍÑÀ­¤¬Ä㤤¤È»×¤¤¤Þ¤¹¡£
52
53
¡üȾ³Ñ¤òÁ´³Ñ¤Î1/2¤ÎÂ礭¤µ¤Ë¤·¤¿¤¤
54
¥Ñ¥Ã¥Á¥Ç¥Õ¥©¥ë¥È¤Ç¤ÏÁ´³Ñʸ»ú¤ÈȾ³Ñʸ»ú¤ÎÂ礭¤µ¤Î¥Ð¥é¥ó¥¹¤Ï¡¢¸«¤¿´¶¤¸¤¬
55
(¸Ä¿ÍŪ¤Ê¥»¥ó¥¹¤Ç)°ÂÄꤹ¤ë¤è¤¦¤Ë¥Á¥å¡¼¥Ë¥ó¥°¤·¤Æ¤¤¤Þ¤¹¡£¤â¤·¡¢¥Æ¥­¥¹¥È
56
¤Çɽ¤òºîÀ®¤·¤Æ¤¤¤Æ¡¢¤½¤Î¤¿¤á¡¢È¾³Ñʸ»ú¤òÁ´³Ñ¤Î¤Á¤ç¤¦¤ÉȾʬ¤Ë¤½¤í¤¨¤¿¤¤
57
¤È¤¤¤¦¾ì¹ç¤ÎÂнèÊýË¡¤ò½ñ¤¤¤Æ¤ª¤­¤Þ¤¹¡£
58
59
¥¤¥ó¥¹¥È¡¼¥ë¸å¡¢$prefix/share/a2ps/encoding/euc-jpÃæ¤Ë¡¢
60
61
--------------------------------------------------
62
DefaultComposite:         Ryumin-Light-EUC-H      1.0  1.1
63
--------------------------------------------------
64
65
¤È¤¤¤¦¤Î¤¬¤¢¤ë¤È»×¤¤¤Þ¤¹¡£ºÇ¸å¤Î¡Ø1.1¡Ù¤ò¡Ø0.8342¡Ù¤¢¤¿¤ê¤ËÊѹ¹¤·¤Æ²¼
66
¤µ¤¤¡£¥Î¡¼¥Þ¥ë¸ÇÄêʸ»ú¤Ë´Ø¤·¤Æ¤Ï¤³¤ì¤Ç˾¤ß¤Î·ë²Ì¤¬ÆÀ¤é¤ì¤ë¤È»×¤¤¤Þ¤¹¡£
67
68
¾¤ÎÂÀ»ú¥Õ¥©¥ó¥È¤Ê¤É¤â¡¢Î㤨¤Ð
69
70
--------------------------------------------------
71
Composite: Courier-Bold   GothicBBB-Medium-EUC-H  1.0  0.8342
72
--------------------------------------------------
73
74
¤Î¤è¤¦¤ËÊѹ¹¤¹¤ì¤Ð¤¤¤¤¤È»×¤¤¤Þ¤¹¡£¤Ê¤ª¡¢Courier¤¬¤Ä¤«¤Ê¤¤¥Õ¥©¥ó¥È
75
(HelveticaÅù)¤Ï¤â¤È¤â¤È¥×¥í¥Ý¡¼¥·¥ç¥Ê¥ë¥Õ¥©¥ó¥È¤Ê¤Î¤Ç¡¢¸ÇÄêÉý¤Ë¤Ï¤Ç¤­
76
¤Þ¤»¤ó¡£
77
78
79
80
¡üºÆÇÛÉۤˤĤ¤¤Æ
81
¤Ê¤ó¤À¤«¤ó¤À¤¤¤Ã¤Æ¡¢¤³¤Î¥Ñ¥Ã¥Á¤Ï¡¢
82
83
ÁÒ¸÷ ·¯Ïº¤µ¤ó¤Îlibjcode  ¡Ü  ÊÒ»³ µªÉפµ¤ó¤Îfixeucfont 
84
85
¤òÁȤ߹ç¤ï¤Æ¤Ç¤­¤¿¤â¤Î¤Ç»ä¼«¿È¤Î¥³¡¼¥É¤Ï¼Â¤Ï¤Û¤È¤ó¤É¤¢¤ê¤Þ¤»¤ó¡Ä¡£
86
87
»ä¼«¿È¤Î¥³¡¼¥É¤ÏºÆÇÛÉÕ¡¿²þ¤¤Ë´Ø¤·¤Æ¤Ê¤ó¤éÀ©¸Â¤òÀߤ±¤ë¤Ä¤â¤ê¤Ï¤¢¤ê¤Þ¤»
88
¤ó¡£¤¿¤À¤·¡¢»ä°Ê³°¤Î¥³¡¼¥É¤ÎÊý¤¬Â¿¤¤¤¿¤á¡¢°ì±þ¤½¤ì¤À¤±¤Ï¸æÎ»¾µ¤ª´ê¤¤Ã×
89
¤·¤Þ¤¹¡£
(-)a2ps-4.13.ORIG/config.h.in (+3 lines)
Lines 24-29 Link Here
24
/* Define if TIOCGWINSZ requires sys/ioctl.h */
24
/* Define if TIOCGWINSZ requires sys/ioctl.h */
25
#undef GWINSZ_IN_SYS_IOCTL
25
#undef GWINSZ_IN_SYS_IOCTL
26
26
27
/* Define if you use libjcode for japanese  */
28
#undef USE_LIBJCODE
29
27
/* Define to 1 if you have the `alarm' function. */
30
/* Define to 1 if you have the `alarm' function. */
28
#undef HAVE_ALARM
31
#undef HAVE_ALARM
29
32
(-)a2ps-4.13.ORIG/configure (-2 / +46 lines)
Lines 1587-1593 Link Here
1587
  --with-medium=medium    specify the default medium (A4, Letter, Legal, etc.)
1587
  --with-medium=medium    specify the default medium (A4, Letter, Legal, etc.)
1588
                          default=A4
1588
                          default=A4
1589
  --with-encoding=enc     specify the default encoding (ascii, latin1,
1589
  --with-encoding=enc     specify the default encoding (ascii, latin1,
1590
                          latin2... latin6, hp etc.) default=latin1
1590
                          latin2... latin6, euc-jp, hp etc.) default=latin1
1591
  --enable-libjcode	  Japanese code auto convert library (default: yes)
1591
1592
1592
Some influential environment variables:
1593
Some influential environment variables:
1593
  CC          C compiler command
1594
  CC          C compiler command
Lines 30943-30948 Link Here
30943
fi;
30944
fi;
30944
30945
30946
# Check whether --enable-libjcode or --disable-libjcode was given.
30947
if test "${enable_libjcode+set}" = set; then
30948
  enableval="$enable_libjcode"
30949
  COMPILE_LIBJCODE=$enableval
30950
else
30951
  COMPILE_LIBJCODE=yes
30952
fi
30953
30954
if test "$COMPILE_LIBJCODE" = "yes"; then
30955
	LIBJCODELIBS=\$\(top_builddir\)/libjcode/libjcode.a
30956
	cat >> confdefs.h <<\EOF
30957
#define USE_LIBJCODE 1
30958
EOF
30959
30960
	ENCODING=euc-jp
30961
fi
30962
30963
30964
30965
30966
# Check whether --enable-libjcode or --disable-libjcode was given.
30967
if test "${enable_libjcode+set}" = set; then
30968
  enableval="$enable_libjcode"
30969
  COMPILE_LIBJCODE=$enableval
30970
else
30971
  COMPILE_LIBJCODE=yes
30972
fi
30973
30974
if test "$COMPILE_LIBJCODE" = "yes"; then
30975
	LIBJCODELIBS=\$\(top_builddir\)/libjcode/libjcode.a
30976
	cat >> confdefs.h <<\EOF
30977
#define USE_LIBJCODE 1
30978
EOF
30979
30980
	ENCODING=euc-jp
30981
fi
30982
30983
30984
30985
30945
########################
30986
########################
30946
# Nice special printers
30987
# Nice special printers
30947
########################
30988
########################
Lines 32925-32931 Link Here
32925
          ac_config_files="$ac_config_files contrib/psset"
32966
          ac_config_files="$ac_config_files contrib/psset"
32926
32967
32927
32968
32928
ac_config_files="$ac_config_files Makefile src/Makefile doc/Makefile man/Makefile tests/Makefile tests/defs lib/Makefile auxdir/Makefile m4/Makefile etc/Makefile etc/a2ps_cfg etc/a2ps-site.cfg po/Makefile.in sheets/Makefile encoding/Makefile ps/Makefile afm/Makefile contrib/Makefile contrib/sample/Makefile contrib/emacs/Makefile fonts/Makefile ppd/Makefile"
32969
ac_config_files="$ac_config_files Makefile src/Makefile doc/Makefile man/Makefile tests/Makefile tests/defs lib/Makefile libjcode/Makefile auxdir/Makefile m4/Makefile etc/Makefile etc/a2ps_cfg etc/a2ps-site.cfg po/Makefile.in sheets/Makefile encoding/Makefile ps/Makefile afm/Makefile contrib/Makefile contrib/sample/Makefile contrib/emacs/Makefile fonts/Makefile ppd/Makefile"
32929
32970
32930
cat >confcache <<\_ACEOF
32971
cat >confcache <<\_ACEOF
32931
# This file is a shell script that caches the results of configure
32972
# This file is a shell script that caches the results of configure
Lines 33546-33551 Link Here
33546
    "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;;
33587
    "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;;
33547
    "tests/defs") CONFIG_FILES="$CONFIG_FILES tests/defs" ;;
33588
    "tests/defs") CONFIG_FILES="$CONFIG_FILES tests/defs" ;;
33548
    "lib/Makefile") CONFIG_FILES="$CONFIG_FILES lib/Makefile" ;;
33589
    "lib/Makefile") CONFIG_FILES="$CONFIG_FILES lib/Makefile" ;;
33590
    "libjcode/Makefile") CONFIG_FILES="$CONFIG_FILES libjcode/Makefile" ;;
33549
    "auxdir/Makefile") CONFIG_FILES="$CONFIG_FILES auxdir/Makefile" ;;
33591
    "auxdir/Makefile") CONFIG_FILES="$CONFIG_FILES auxdir/Makefile" ;;
33550
    "m4/Makefile") CONFIG_FILES="$CONFIG_FILES m4/Makefile" ;;
33592
    "m4/Makefile") CONFIG_FILES="$CONFIG_FILES m4/Makefile" ;;
33551
    "etc/Makefile") CONFIG_FILES="$CONFIG_FILES etc/Makefile" ;;
33593
    "etc/Makefile") CONFIG_FILES="$CONFIG_FILES etc/Makefile" ;;
Lines 33804-33809 Link Here
33804
LPR_QUEUE_OPTION!$LPR_QUEUE_OPTION$ac_delim
33846
LPR_QUEUE_OPTION!$LPR_QUEUE_OPTION$ac_delim
33805
MEDIUM!$MEDIUM$ac_delim
33847
MEDIUM!$MEDIUM$ac_delim
33806
ENCODING!$ENCODING$ac_delim
33848
ENCODING!$ENCODING$ac_delim
33849
COMPILE_LIBJCODE!$COMPILE_LIBJCODE$ac_delim
33850
LIBJCODELIBS!$LIBJCODELIBS$ac_delim
33807
COM_gv!$COM_gv$ac_delim
33851
COM_gv!$COM_gv$ac_delim
33808
gv!$gv$ac_delim
33852
gv!$gv$ac_delim
33809
COM_ghostview!$COM_ghostview$ac_delim
33853
COM_ghostview!$COM_ghostview$ac_delim
(-)a2ps-4.13.ORIG/configure.in (-1 / +18 lines)
Lines 274-284 Link Here
274
#
274
#
275
AC_ARG_WITH(encoding,
275
AC_ARG_WITH(encoding,
276
AC_HELP_STRING([--with-encoding=enc],
276
AC_HELP_STRING([--with-encoding=enc],
277
               [specify the default encoding (ascii, latin1, latin2... latin6, hp etc.) [default=latin1]]),
277
               [specify the default encoding (ascii, latin1, latin2... latin6, euc-jp, hp etc.) [default=latin1]]),
278
ENCODING=$with_encoding,
278
ENCODING=$with_encoding,
279
ENCODING=latin1)
279
ENCODING=latin1)
280
AC_SUBST(ENCODING)
280
AC_SUBST(ENCODING)
281
281
282
#
283
# use libjcode
284
#
285
AC_ARG_ENABLE(libjcode,
286
	[  --enable-libjcode	  Japanese code auto convert library (default: yes)],
287
			COMPILE_LIBJCODE=$enableval, COMPILE_LIBJCODE=yes)
288
if test "$COMPILE_LIBJCODE" = "yes"; then
289
	LIBJCODELIBS=\$\(top_builddir\)/libjcode/libjcode.a
290
	AC_DEFINE(USE_LIBJCODE, 1,
291
		  [Define if you want to use libjcode.])
292
	ENCODING=euc-jp
293
fi
294
AC_SUBST(COMPILE_LIBJCODE)
295
AC_SUBST(LIBJCODELIBS)
296
297
282
########################
298
########################
283
# Nice special printers
299
# Nice special printers
284
########################
300
########################
Lines 386-391 Link Here
386
  tests/Makefile tests/defs
402
  tests/Makefile tests/defs
387
  lib/Makefile
403
  lib/Makefile
388
  auxdir/Makefile
404
  auxdir/Makefile
405
  libjcode/Makefile
389
  m4/Makefile
406
  m4/Makefile
390
  etc/Makefile etc/a2ps_cfg etc/a2ps-site.cfg
407
  etc/Makefile etc/a2ps_cfg etc/a2ps-site.cfg
391
  po/Makefile.in
408
  po/Makefile.in
(-)a2ps-4.13.ORIG/contrib/texi2dvi4a2ps (-2 / +2 lines)
Lines 374-380 Link Here
374
      makeinfo= # no point in running makeinfo on latex source.
374
      makeinfo= # no point in running makeinfo on latex source.
375
      texindex=${MAKEINDEX:-makeindex}
375
      texindex=${MAKEINDEX:-makeindex}
376
      if test $oformat = dvi; then
376
      if test $oformat = dvi; then
377
        tex=${LATEX:-latex}
377
        tex=${LATEX:-platex}
378
      else
378
      else
379
        tex=${PDFLATEX:-pdflatex}
379
        tex=${PDFLATEX:-pdflatex}
380
      fi
380
      fi
Lines 385-391 Link Here
385
      bibtex=
385
      bibtex=
386
      texindex=${TEXINDEX:-texindex}
386
      texindex=${TEXINDEX:-texindex}
387
      if test $oformat = dvi; then
387
      if test $oformat = dvi; then
388
        tex=${TEX:-tex}
388
        tex=${TEX:-ptex}
389
      else
389
      else
390
        tex=${PDFTEX:-pdftex}
390
        tex=${PDFTEX:-pdftex}
391
      fi
391
      fi
(-)a2ps-4.13.ORIG/encoding/Makefile.am (-1 / +1 lines)
Lines 16-22 Link Here
16
minor_encodings = \
16
minor_encodings = \
17
ms-cp1250.edf hp.edf mac.edf ibm-cp437.edf ibm-cp850.edf iso2.edf	\
17
ms-cp1250.edf hp.edf mac.edf ibm-cp437.edf ibm-cp850.edf iso2.edf	\
18
iso3.edf iso4.edf iso5.edf iso7.edf iso9.edf iso10.edf iso13.edf	\
18
iso3.edf iso4.edf iso5.edf iso7.edf iso9.edf iso10.edf iso13.edf	\
19
iso15.edf koi8.edf ms-cp1251.edf
19
iso15.edf koi8.edf ms-cp1251.edf euc-jp.edf
20
20
21
if EXTENSIONS
21
if EXTENSIONS
22
encodings_DATA = encoding.map $(major_encodings) $(minor_encodings)
22
encodings_DATA = encoding.map $(major_encodings) $(minor_encodings)
(-)a2ps-4.13.ORIG/encoding/Makefile.in (-1 / +1 lines)
Lines 270-276 Link Here
270
minor_encodings = \
270
minor_encodings = \
271
ms-cp1250.edf hp.edf mac.edf ibm-cp437.edf ibm-cp850.edf iso2.edf	\
271
ms-cp1250.edf hp.edf mac.edf ibm-cp437.edf ibm-cp850.edf iso2.edf	\
272
iso3.edf iso4.edf iso5.edf iso7.edf iso9.edf iso10.edf iso13.edf	\
272
iso3.edf iso4.edf iso5.edf iso7.edf iso9.edf iso10.edf iso13.edf	\
273
iso15.edf koi8.edf ms-cp1251.edf
273
iso15.edf koi8.edf ms-cp1251.edf euc-jp.edf
274
274
275
@EXTENSIONS_FALSE@encodings_DATA = encoding.map $(major_encodings)
275
@EXTENSIONS_FALSE@encodings_DATA = encoding.map $(major_encodings)
276
@EXTENSIONS_TRUE@encodings_DATA = encoding.map $(major_encodings) $(minor_encodings)
276
@EXTENSIONS_TRUE@encodings_DATA = encoding.map $(major_encodings) $(minor_encodings)
(-)a2ps-4.13.ORIG/encoding/encoding.map (+6 lines)
Lines 93-98 Link Here
93
koi8			koi8
93
koi8			koi8
94
koi			koi8
94
koi			koi8
95
95
96
euc-jp			euc-jp
97
eucjp			euc-jp
98
japanese		euc-jp
99
ja			euc-jp
100
jp			euc-jp
101
96
########################################################################
102
########################################################################
97
# Some architectures specific char sets
103
# Some architectures specific char sets
98
########################################################################
104
########################################################################
(-)a2ps-4.13.ORIG/encoding/euc-jp.edf (+109 lines)
Line 0 Link Here
1
# Description of the EUC-JP encoding
2
# Copyright (c) 1988, 89, 90, 91, 92, 93 Miguel Santana
3
# Copyright (c) 1995, 96, 97, 98 Akim Demaille, Miguel Santana
4
#
5
6
#
7
# This file is part of a2ps.
8
# 
9
# This program is free software; you can redistribute it and/or modify
10
# it under the terms of the GNU General Public License as published by
11
# the Free Software Foundation; either version 2, or (at your option)
12
# any later version.
13
#
14
# This program is distributed in the hope that it will be useful,
15
# but WITHOUT ANY WARRANTY; without even the implied warranty of
16
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
# GNU General Public License for more details.
18
#
19
# You should have received a copy of the GNU General Public License
20
# along with this program; see the file COPYING.  If not, write to
21
# the Free Software Foundation, 59 Temple Place - Suite 330,
22
# Boston, MA 02111-1307, USA.
23
#
24
25
Name: EUC-JP
26
27
# This text is reproduced by a courtesy of Roman Czyborra
28
# http://czyborra.com/charsets/iso8859.html
29
Documentation
30
The EUC-JP character set, often simply referred to as Latin 1,
31
covers most West European languages, such as French, Spanish, Catalan,
32
Basque, Portuguese, Italian, Albanian, Rhaeto-Romanic, Dutch, German,
33
Danish, Swedish, Norwegian, Finnish, Faroese, Icelandic, Irish,
34
Scottish, and English, incidentally also Afrikaans and Swahili, thus
35
in effect also the entire American continent, Australia and the
36
southern two-thirds of Africa. The lack of the ligatures Dutch IJ,
37
French OE and ,,German`` quotation marks is considered tolerable.
38
39
The lack of the new C=-resembling Euro currency symbol U+20AC has
40
opened the discussion of a new Latin0.
41
EndDocumentation
42
43
# If there is an unknown font requested, use Courier
44
Default: Courier
45
46
# Automatic spell checking :)
47
Substitute: 	Times			Times-Roman
48
Substitute: 	Helvetica-Italic	Helvetica-Oblique
49
Substitute: 	Helvetica-BoldItalic	Helvetica-BoldOblique
50
51
52
# SlantFont for Japanese Italic Kanji font
53
#		new font			source font		value
54
SlantFont:	Ryumin-Light-EUC-H-Italic	Ryumin-Light-EUC-H	0.2
55
SlantFont:	GothicBBB-Medium-EUC-H-Italic	GothicBBB-Medium-EUC-H	0.2
56
57
# Compose font for japanese EUC code
58
#		target font		additional font			width	size rate
59
DefaultComposite:			Ryumin-Light-EUC-H		1.0	1.1
60
61
# 1:2 fixed
62
#DefaultComposite:			Ryumin-Light-EUC-H		1.0	0.8333
63
64
# 1:1 fixed
65
#DefaultComposite:			Ryumin-Light-EUC-H		1.0	1.6666
66
67
Composite:	Helvetica		GothicBBB-Medium-EUC-H		1.0	1.1
68
Composite:	Helvetica-Oblique	GothicBBB-Medium-EUC-H-Italic	1.0 	1.1
69
Composite:	Helvetica-Bold		GothicBBB-Medium-EUC-H  	1.0 	1.1
70
Composite:	Helvetica-BoldOblique	GothicBBB-Medium-EUC-H-Italic	1.0	1.1
71
72
Composite:	Courier-Oblique		Ryumin-Light-EUC-H-Italic	1.0	1.1
73
Composite:	Courier-Bold		GothicBBB-Medium-EUC-H		1.0	1.1
74
Composite:	Courier-BoldOblique	GothicBBB-Medium-EUC-H-Italic	1.0	1.1
75
Composite:	Times-Bold		GothicBBB-Medium-EUC-H		1.0	1.1
76
77
Vector:
78
.notdef .notdef .notdef .notdef .notdef .notdef .notdef .notdef
79
.notdef .notdef .notdef .notdef .notdef .notdef .notdef .notdef
80
.notdef .notdef .notdef .notdef .notdef .notdef .notdef .notdef
81
.notdef .notdef .notdef .notdef .notdef .notdef .notdef .notdef
82
space exclam quotedbl numbersign dollar percent ampersand quoteright
83
parenleft parenright asterisk plus comma minus period slash
84
zero one two three four five six seven
85
eight nine colon semicolon less equal greater question
86
at A B C D E F G
87
H I J K L M N O
88
P Q R S T U V W
89
X Y Z bracketleft backslash bracketright asciicircum underscore
90
quoteleft a b c d e f g
91
h i j k l m n o
92
p q r s t u v w
93
x y z braceleft bar braceright asciitilde .notdef
94
.notdef .notdef .notdef .notdef .notdef .notdef .notdef .notdef
95
.notdef .notdef .notdef .notdef .notdef .notdef .notdef .notdef
96
.notdef .notdef .notdef .notdef .notdef .notdef .notdef .notdef
97
.notdef .notdef .notdef .notdef .notdef .notdef .notdef .notdef
98
space exclamdown cent sterling currency yen brokenbar section
99
dieresis copyright ordfeminine guillemotleft logicalnot hyphen registered macron
100
degree plusminus twosuperior threesuperior acute mu paragraph bullet
101
cedilla onesuperior ordmasculine guillemotright onequarter onehalf threequarters questiondown
102
Agrave Aacute Acircumflex Atilde Adieresis Aring AE Ccedilla
103
Egrave Eacute Ecircumflex Edieresis Igrave Iacute Icircumflex Idieresis
104
Eth Ntilde Ograve Oacute Ocircumflex Otilde Odieresis multiply
105
Oslash Ugrave Uacute Ucircumflex Udieresis Yacute Thorn germandbls
106
agrave aacute acircumflex atilde adieresis aring ae ccedilla
107
egrave eacute ecircumflex edieresis igrave iacute icircumflex idieresis
108
eth ntilde ograve oacute ocircumflex otilde odieresis divide
109
oslash ugrave uacute ucircumflex udieresis yacute thorn ydieresis
(-)a2ps-4.13.ORIG/lib/encoding.c (-1 / +250 lines)
Lines 37-42 Link Here
37
#include "document.h"
37
#include "document.h"
38
#include "quotearg.h"
38
#include "quotearg.h"
39
#include "strverscmp.h"
39
#include "strverscmp.h"
40
#ifdef USE_LIBJCODE
41
int use_libjcode = false;
42
#endif
40
43
41
/* Suffix of the Encoding Description Files */
44
/* Suffix of the Encoding Description Files */
42
#define EDF_SUFFIX ".edf"
45
#define EDF_SUFFIX ".edf"
Lines 389-403 Link Here
389
 * Association of suffixes rules, and corresponding style sheet
392
 * Association of suffixes rules, and corresponding style sheet
390
 * (The hashing is upon `alias')
393
 * (The hashing is upon `alias')
391
 */
394
 */
395
struct slantfont_info {
396
  char * name;
397
  char * src;
398
  float raito;
399
};
400
392
struct encoding {
401
struct encoding {
393
  char * key;			/* e.g. latin1			*/
402
  char * key;			/* e.g. latin1			*/
394
  char * name;			/* e.g. ISO Latin 1		*/
403
  char * name;			/* e.g. ISO Latin 1		*/
404
  int    composite_flag;		/* flag for composite font	*/
395
  uchar * documentation;		/* Useful pieces of text	*/
405
  uchar * documentation;		/* Useful pieces of text	*/
396
406
397
  char * default_font;		/* When a font can't be used
407
  char * default_font;		/* When a font can't be used
398
				   define the font to use	*/
408
				   define the font to use	*/
399
  struct pair_htable * substitutes;	/* e.g. in latin2, don't use
409
  struct pair_htable * substitutes;	/* e.g. in latin2, don't use
400
					 * Courier, but Courier-Ogonki	*/
410
					 * Courier, but Courier-Ogonki	*/
411
  struct pair_htable * composite;
412
413
  struct slantfont_info     slantfont[NB_FACES];
401
414
402
  char * vector[256];	/* Define the char set			*/
415
  char * vector[256];	/* Define the char set			*/
403
  struct darray * font_names_used;
416
  struct darray * font_names_used;
Lines 407-412 Link Here
407
  struct hash_table_s * fonts;	/* Contains cells that are
420
  struct hash_table_s * fonts;	/* Contains cells that are
408
				 * 1. name of font, 2. int wx[256] 	*/
421
				 * 1. name of font, 2. int wx[256] 	*/
409
  unsigned int * faces_wx[NB_FACES];
422
  unsigned int * faces_wx[NB_FACES];
423
424
  unsigned int   composite_wx[NB_FACES];     /* fixed length font width*/
425
  float          composite_raito[NB_FACES];  /* size raito of additonal and orinal font */
410
};
426
};
411
427
412
/*
428
/*
Lines 423-431 Link Here
423
  res->name = NULL;
439
  res->name = NULL;
424
  res->default_font = NULL;
440
  res->default_font = NULL;
425
  res->documentation = NULL;
441
  res->documentation = NULL;
442
  res->composite_flag = false;
426
443
427
  /* Vector will be set by setup */
444
  /* Vector will be set by setup */
428
  res->substitutes = pair_table_new ();
445
  res->substitutes = pair_table_new ();
446
  res->composite = pair_table_new ();
447
  res->slantfont[0].name = NULL;
429
  res->font_names_used = da_new ("List of font names", 10,
448
  res->font_names_used = da_new ("List of font names", 10,
430
				 da_linear, 10,
449
				 da_linear, 10,
431
				 (da_print_func_t) da_str_print,
450
				 (da_print_func_t) da_str_print,
Lines 471-476 Link Here
471
}
490
}
472
491
473
/*
492
/*
493
 * Add a composite font in the current encoding
494
 */
495
static void
496
encoding_add_composite_font (struct encoding * encoding,
497
			      const char * orig, const char * subs,
498
			      int wx, float raito)
499
{
500
  encoding->composite_flag = true;
501
  pair_add2 (encoding->composite, orig, subs, wx, raito);
502
}
503
504
/*
505
 * Add a composite font in the current encoding
506
 */
507
static void
508
encoding_add_slant_font (struct encoding * encoding,
509
			 const char * new, const char * src,
510
			 float raito)
511
{
512
  static num =  0;
513
  encoding->slantfont[num].name = strdup(new);
514
  encoding->slantfont[num].src  = strdup(src);
515
  encoding->slantfont[num].raito = raito;
516
  encoding->slantfont[num+1].name = NULL;
517
  num++;
518
}
519
520
/*
474
 * When FONT_NAME is used with ENCODING, return the
521
 * When FONT_NAME is used with ENCODING, return the
475
 * real font name to use (e.g., in latin2, Courier-Ogonki
522
 * real font name to use (e.g., in latin2, Courier-Ogonki
476
 * should be returned when asked for Courier).
523
 * should be returned when asked for Courier).
Lines 514-519 Link Here
514
    }
561
    }
515
562
516
  message (msg_enc,
563
  message (msg_enc,
564
	   (stderr, "In encoding %s, composite font for %s is resolved as %s\n",
565
	    encoding->key, font_name, res));
566
  return res;
567
}
568
569
/*
570
 * Get composite font size and raito
571
 */
572
static int
573
composite_font_info_get_wx(struct a2ps_job * job,
574
			   struct encoding * encoding,
575
			   const char * font_list)
576
{
577
  int wx= -1;
578
  char * font_list_copy;
579
  char * font_name;
580
  astrcpy (font_list_copy, font_list);
581
  font_name = strtok (font_list_copy, ",<>;");
582
583
  wx = pair_get_wx (encoding->composite, font_name);
584
  if (wx<0)
585
      wx = pair_get_wx (encoding->composite, "default_composite__");
586
587
  return wx;
588
}
589
590
static float
591
composite_font_info_get_raito(struct a2ps_job * job,
592
			      struct encoding * encoding,
593
			      const char * font_list)
594
{
595
  float raito= -1;
596
  char * font_list_copy;
597
  char * font_name;
598
599
  astrcpy (font_list_copy, font_list);
600
  font_name = strtok (font_list_copy, ",<>;");
601
602
  raito = pair_get_raito (encoding->composite, font_name);
603
  if (raito<0)
604
      raito = pair_get_raito (encoding->composite, "default_composite__");
605
  return raito;
606
}
607
608
const char *
609
encoding_resolve_composite_font (struct a2ps_job * job,
610
				  struct encoding * encoding,
611
				  const char * font_list)
612
{
613
  const char * res = NULL;
614
  char * font_list_copy;
615
  char * font_name;
616
617
  astrcpy (font_list_copy, font_list);
618
  font_name = strtok (font_list_copy, ",<>;");
619
620
  /* Find if there is a substitute for that font */
621
  res = pair_get (encoding->composite, font_name);
622
623
  /* We've found nothing interesting.  Last chance is the default
624
   * font */
625
  if (!res)
626
    {
627
      res = pair_get (encoding->composite, "default_composite__");
628
629
      if (!res)
630
	error (1, 0, "Cannot find font %s, nor any composite font",
631
	       font_name);
632
    }
633
  
634
  message (msg_enc,
517
	   (stderr, "In encoding %s, font %s is resolved as %s\n",
635
	   (stderr, "In encoding %s, font %s is resolved as %s\n",
518
	    encoding->key, font_name, res));
636
	    encoding->key, font_name, res));
519
  return res;
637
  return res;
Lines 585-590 Link Here
585
	{
703
	{
586
	  token2 = GET_TOKEN (NULL);
704
	  token2 = GET_TOKEN (NULL);
587
	  CHECK_TOKEN ();
705
	  CHECK_TOKEN ();
706
#ifdef USE_LIBJCODE
707
	  if( strcmp(token2, "EUC-JP")== 0)
708
	    use_libjcode = true;
709
	  else 
710
	    use_libjcode = false;
711
#endif
588
	  encoding->name = xstrdup (token2);
712
	  encoding->name = xstrdup (token2);
589
	}
713
	}
590
      else if (strequ (token, "Default:"))
714
      else if (strequ (token, "Default:"))
Lines 633-638 Link Here
633
	  subs = token2;
757
	  subs = token2;
634
	  encoding_add_font_substitute (encoding, orig, subs);
758
	  encoding_add_font_substitute (encoding, orig, subs);
635
	}
759
	}
760
      else if (strequ (token, "DefaultComposite:"))
761
	{
762
	  char * orig, * subs;
763
	  int wx;
764
	  float raito;
765
766
	  token2 = GET_TOKEN (NULL);
767
	  CHECK_TOKEN ();
768
	  subs = token2;
769
	  token2 = GET_TOKEN (NULL);
770
	  CHECK_TOKEN ();
771
	  wx = (int)atof(token2)*1000;
772
	  token2 = GET_TOKEN (NULL);
773
	  CHECK_TOKEN ();
774
	  raito = atof(token2);
775
	  encoding_add_composite_font(encoding, "default_composite__",
776
				      subs, wx, raito);
777
	}
778
      else if (strequ (token, "Composite:"))
779
	{
780
	  char * orig, * subs;
781
	  int wx;
782
	  float raito;
783
784
	  token2 = GET_TOKEN (NULL);
785
	  CHECK_TOKEN ();
786
	  orig = token2;
787
	  token2 = GET_TOKEN (NULL);
788
	  CHECK_TOKEN ();
789
	  subs = token2;
790
	  token2 = GET_TOKEN (NULL);
791
	  CHECK_TOKEN ();
792
	  wx = (int)atof(token2)*1000;
793
	  token2 = GET_TOKEN (NULL);
794
	  CHECK_TOKEN ();
795
	  raito = atof(token2);
796
	  encoding_add_composite_font(encoding, orig, subs, wx, raito);
797
	}
798
      else if (strequ (token, "SlantFont:"))
799
	{
800
	  char * new, * src;
801
	  float raito;
802
	  unsigned int num;
803
804
	  token2 = GET_TOKEN (NULL);
805
	  CHECK_TOKEN ();
806
	  new = token2;
807
	  token2 = GET_TOKEN (NULL);
808
	  CHECK_TOKEN ();
809
	  src = token2;
810
	  token2 = GET_TOKEN (NULL);
811
	  CHECK_TOKEN ();
812
	  raito = atof(token2);
813
	  for (num = 0 ; encoding->slantfont[num].name ; num ++ );
814
	  if (num > sizeof encoding->slantfont - 1){
815
	      error_at_line (1, 0, fname, firstline,
816
			   _("too many slant font: `%s'"), new);
817
	  }
818
	  encoding_add_slant_font(encoding, new, src, raito);
819
	}
636
      else
820
      else
637
        error_at_line (1, 0, fname, firstline,
821
        error_at_line (1, 0, fname, firstline,
638
                       _("invalid option `%s'"), quotearg (token));
822
                       _("invalid option `%s'"), quotearg (token));
Lines 754-759 Link Here
754
}
938
}
755
939
756
/*
940
/*
941
 * Return the flag of composite flag
942
 */
943
int
944
encoding_get_composite_flag (struct encoding * enc)
945
{
946
  return enc->composite_flag;
947
}
948
949
/*
757
 * Prepare the environment (a dictionary) for the support
950
 * Prepare the environment (a dictionary) for the support
758
 * of ENCODING, dump it into STREAM.
951
 * of ENCODING, dump it into STREAM.
759
 *
952
 *
Lines 766-774 Link Here
766
		     struct encoding * encoding)
959
		     struct encoding * encoding)
767
{
960
{
768
  size_t i, nb;
961
  size_t i, nb;
962
  size_t ns;
769
  const char * real_font_name;		/* After subsitution	*/
963
  const char * real_font_name;		/* After subsitution	*/
770
  char ** font_names = (char **) encoding->font_names_used->content;
964
  char ** font_names = (char **) encoding->font_names_used->content;
771
965
966
772
  /* How many fonts are there? */
967
  /* How many fonts are there? */
773
  da_qsort (encoding->font_names_used);
968
  da_qsort (encoding->font_names_used);
774
  da_unique (encoding->font_names_used, (da_map_func_t) free);
969
  da_unique (encoding->font_names_used, (da_map_func_t) free);
Lines 787-801 Link Here
787
   * in the current ENCODING	*/
982
   * in the current ENCODING	*/
788
  nb = encoding->font_names_used->len;
983
  nb = encoding->font_names_used->len;
789
984
985
  /* The number of slant fonts */
986
  for (i= 0, ns=0 ; encoding->slantfont[i].name ; i++ )
987
      ns++;
988
790
  /* Create the dictionary and fill it */
989
  /* Create the dictionary and fill it */
791
  fprintf (stream, "%% Dictionary for %s support\n",
990
  fprintf (stream, "%% Dictionary for %s support\n",
792
	  encoding->name);
991
	  encoding->name);
793
  fprintf (stream, "/%sdict %d dict begin\n", encoding->key, nb);
992
  fprintf (stream, "/%sdict %d dict begin\n", encoding->key,
993
	   (encoding->composite_flag == true)? nb+nb+ns:nb+ns);
794
  for (i = 0 ; i < nb ; i++)
994
  for (i = 0 ; i < nb ; i++)
795
    fprintf (stream, "  /f%s %sEncoding /%s reencode_font\n",
995
    fprintf (stream, "  /f%s %sEncoding /%s reencode_font\n",
796
	     font_names [i],
996
	     font_names [i],
797
	     encoding->name,
997
	     encoding->name,
798
	     encoding_resolve_font_substitute (job, encoding, font_names [i]));
998
	     encoding_resolve_font_substitute (job, encoding, font_names [i]));
999
1000
  /* Slant font setting */
1001
  for (i = 0 ; encoding->slantfont[i].name ; i++ )
1002
    fprintf (stream, "  /%s /%s %f slantfont  definefont pop\n",
1003
	     encoding->slantfont[i].name,
1004
	     encoding->slantfont[i].src,
1005
	     encoding->slantfont[i].raito);
1006
1007
  /*
1008
   * Composite font setting.
1009
   * If kanji font size is larger than alphabet character, 
1010
   * set base font size to kanji charactor size.
1011
   */
1012
  if (encoding->composite_flag == true) {
1013
    for (i = 0 ; i < nb ; i++)
1014
      fprintf (stream, "  /f%s /f%s /%s %f %f false  compositefont "
1015
	               "%f scalefont def\n",
1016
	       font_names [i],
1017
	       font_names [i],
1018
	       encoding_resolve_composite_font (job, encoding, font_names [i]),
1019
	       encoding->composite_raito[i],
1020
	       (encoding->composite_raito[i] > 1.0)?
1021
	       0: (1-encoding->composite_raito[i])/2.0,
1022
	       (encoding->composite_raito[i] > 1.0)?
1023
	       1.0/encoding->composite_raito[i]: 1.0 );
1024
  }
799
  fputs ("currentdict end def\n", stream);
1025
  fputs ("currentdict end def\n", stream);
800
}
1026
}
801
1027
Lines 939-944 Link Here
939
				   true_font_name,
1165
				   true_font_name,
940
				   encoding->vector,
1166
				   encoding->vector,
941
				   encoding->faces_wx [face]);
1167
				   encoding->faces_wx [face]);
1168
1169
      if (encoding->composite_flag)
1170
	{
1171
	  encoding->composite_raito[i] =
1172
	    composite_font_info_get_raito(job, encoding, 
1173
					  job->face_eo_font [face]);
1174
1175
	  encoding->composite_wx[i] =
1176
	    composite_font_info_get_wx(job, encoding, 
1177
				       job->face_eo_font [face]);
1178
1179
	  /* If kanji font size is larger than alphabet character, 
1180
	     fit kanji charactor size to base font size */
1181
	  if (encoding->composite_raito[i] < 1.0)
1182
	      encoding->composite_wx[i] *= encoding->composite_raito[i]; 
1183
	}
942
    }
1184
    }
943
}
1185
}
944
1186
Lines 1073-1078 Link Here
1073
  return 0;	/* For -Wall */
1315
  return 0;	/* For -Wall */
1074
}
1316
}
1075
1317
1318
unsigned int
1319
char_composite_WX (a2ps_job * job, uchar c)
1320
{
1321
  return (job->encoding->composite_wx[job->status->face]/
1322
	  job->encoding->composite_raito[job->status->face]);
1323
}
1324
1076
/*
1325
/*
1077
 *	Returns the WX of a string (including M- and ^)
1326
 *	Returns the WX of a string (including M- and ^)
1078
 */
1327
 */
(-)a2ps-4.13.ORIG/lib/encoding.h (+8 lines)
Lines 43-48 Link Here
43
 */
43
 */
44
unsigned int char_WX PARAMS ((struct a2ps_job * job, uchar c));
44
unsigned int char_WX PARAMS ((struct a2ps_job * job, uchar c));
45
unsigned int string_WX PARAMS ((struct a2ps_job * job, uchar * string));
45
unsigned int string_WX PARAMS ((struct a2ps_job * job, uchar * string));
46
unsigned int char_composite_WX PARAMS ((struct a2ps_job * job, uchar c));
46
47
47
48
48
/************************************************************************/
49
/************************************************************************/
Lines 56-61 Link Here
56
					FILE * stream));
57
					FILE * stream));
57
int encoding_char_exists PARAMS ((struct encoding * enc,
58
int encoding_char_exists PARAMS ((struct encoding * enc,
58
					enum face_e face, uchar c));
59
					enum face_e face, uchar c));
60
int encoding_get_composite_flag (struct encoding * enc);
59
struct encoding *
61
struct encoding *
60
get_encoding_by_alias PARAMS ((struct a2ps_job * job, 
62
get_encoding_by_alias PARAMS ((struct a2ps_job * job, 
61
			       char *string));
63
			       char *string));
Lines 71-76 Link Here
71
		 struct encoding * encoding,
73
		 struct encoding * encoding,
72
		 const char * font_name));
74
		 const char * font_name));
73
75
76
77
const char * encoding_resolve_composite_font
78
	PARAMS ((struct a2ps_job * job,
79
		 struct encoding * encoding,
80
		 const char * font_name));
81
74
/*
82
/*
75
 * Have a struct encoding determine the faces_wx
83
 * Have a struct encoding determine the faces_wx
76
 */
84
 */
(-)a2ps-4.13.ORIG/lib/pair_ht.c (+61 lines)
Lines 49-54 Link Here
49
{
49
{
50
  char * key;
50
  char * key;
51
  char * value;
51
  char * value;
52
  float  raito;
53
  int    wx;
52
};
54
};
53
55
54
/*
56
/*
Lines 165-170 Link Here
165
}
167
}
166
168
167
/*
169
/*
170
 *  Add a pair, with your own allocation for them.
171
 * It KEY is yet used, override its value with VALUE
172
 */
173
void
174
pair_add2 (struct hash_table_s * table,
175
	  const char * key, const char * value, int wx, float raito)
176
{
177
  struct pair * item, token;
178
  
179
  token.key = (char *) key;
180
  item = (struct pair *) hash_find_item (table, &token);
181
182
  if (item) {
183
    if (item->value)
184
      free (item->value);
185
  } else {
186
    item = XMALLOC (struct pair, 1);
187
    item->key = xstrdup(key);
188
    item->wx    = wx;
189
    item->raito = raito;
190
  }
191
  
192
  if (value)
193
    item->value = xstrdup (value);
194
  else
195
    item->value = NULL;
196
197
  hash_insert (table, item);
198
}
199
200
/*
168
 * Remove a pair and free it.
201
 * Remove a pair and free it.
169
 * It KEY is yet used, override its value with VALUE
202
 * It KEY is yet used, override its value with VALUE
170
 */
203
 */
Lines 201-206 Link Here
201
    return NULL;
234
    return NULL;
202
}
235
}
203
236
237
int
238
pair_get_wx (struct hash_table_s * table, const char * key)
239
{
240
  struct pair * item, token;
241
  
242
  token.key = (char *) key;
243
  item = (struct pair *) hash_find_item (table, &token);
244
245
  if (item)
246
    return item->wx;
247
  else
248
    return -1;
249
}
250
251
float
252
pair_get_raito (struct hash_table_s * table, const char * key)
253
{
254
  struct pair * item, token;
255
  
256
  token.key = (char *) key;
257
  item = (struct pair *) hash_find_item (table, &token);
258
259
  if (item)
260
    return item->raito;
261
  else
262
    return -1;
263
}
264
204
/*
265
/*
205
 * Return the content of the hash table, ordered
266
 * Return the content of the hash table, ordered
206
 */
267
 */
(-)a2ps-4.13.ORIG/lib/pair_ht.h (+8 lines)
Lines 56-61 Link Here
56
void pair_add PARAMS ((struct pair_htable * table, 
56
void pair_add PARAMS ((struct pair_htable * table, 
57
		       const char * key, const char * value));
57
		       const char * key, const char * value));
58
58
59
void pair_add2 PARAMS ((struct pair_htable * table, 
60
		       const char * key, const char * value,
61
			int wx, float raito));
62
59
/*
63
/*
60
 * The key and value of the matching item  will be free'd
64
 * The key and value of the matching item  will be free'd
61
 * (No problem if KEY matches nothing)
65
 * (No problem if KEY matches nothing)
Lines 68-73 Link Here
68
 */
72
 */
69
char * pair_get PARAMS ((struct pair_htable * table,
73
char * pair_get PARAMS ((struct pair_htable * table,
70
			 const char * key));
74
			 const char * key));
75
int    pair_get_wx PARAMS ((struct pair_htable * table,
76
			    const char * key));
77
float  pair_get_raito PARAMS ((struct pair_htable * table,
78
			       const char * key));
71
79
72
void pair_table_list_short PARAMS ((struct pair_htable * table,
80
void pair_table_list_short PARAMS ((struct pair_htable * table,
73
				    FILE * stream));
81
				    FILE * stream));
(-)a2ps-4.13.ORIG/lib/psgen.c (-1 / +26 lines)
Lines 875-880 Link Here
875
  print:
875
  print:
876
  default:
876
  default:
877
    {
877
    {
878
      static mb_flag= 0;
878
      uchar buf[256];
879
      uchar buf[256];
879
      int nchars;
880
      int nchars;
880
      *buf = '\0';
881
      *buf = '\0';
Lines 889-894 Link Here
889
    job->status->face_declared = false;
890
    job->status->face_declared = false;
890
  }
891
  }
891
892
893
  if (c > 127 && encoding_get_composite_flag (job->encoding) &&
894
      job->status->face != Symbol) {
895
    if (mb_flag) {
896
        nchars = ps_escape_char (job, mb_flag, buf) + 
897
	         ps_escape_char (job, c, buf);
898
	job->status->wx += char_composite_WX(job, c);
899
	job->status->column += nchars;
900
	if (line_full) {
901
	    if (job->folding) {
902
	        fold_line (job, new_face);
903
		job->status->column = nchars*2;
904
		job->status->wx = char_composite_WX(job, c);
905
	    } else {
906
	      job->status->is_in_cut = true;
907
	      return;
908
	    }
909
	}
910
	mb_flag = 0;
911
    } else {
912
        mb_flag = c;
913
	return;
914
    }
915
  } else {
892
      nchars = ps_escape_char (job, c, buf);
916
      nchars = ps_escape_char (job, c, buf);
893
      job->status->wx += char_WX (job, c);
917
      job->status->wx += char_WX (job, c);
894
      job->status->column += nchars;
918
      job->status->column += nchars;
Lines 902-909 Link Here
902
	  return;
926
	  return;
903
	}
927
	}
904
      }
928
      }
929
  }
905
      output (jdiv, "%s", buf);
930
      output (jdiv, "%s", buf);
906
      job->status->chars++;
931
      job->status->chars+=nchars;
907
    }
932
    }
908
    break;
933
    break;
909
  }
934
  }
(-)a2ps-4.13.ORIG/libjcode/Doc/rfc1468.txt (+339 lines)
Line 0 Link Here
1
2
3
4
5
6
7
Network Working Group                                           J. Murai
8
Request for Comments: 1468                               Keio University
9
                                                              M. Crispin
10
                                                       Panda Programming
11
                                                         E. van der Poel
12
                                                               June 1993
13
14
15
           Japanese Character Encoding for Internet Messages
16
17
Status of this Memo
18
19
   This memo provides information for the Internet community.  It does
20
   not specify an Internet standard.  Distribution of this memo is
21
   unlimited.
22
23
Introduction
24
25
   This document describes the encoding used in electronic mail [RFC822]
26
   and network news [RFC1036] messages in several Japanese networks. It
27
   was first specified by and used in JUNET [JUNET]. The encoding is now
28
   also widely used in Japanese IP communities.
29
30
   The name given to this encoding is "ISO-2022-JP", which is intended
31
   to be used in the "charset" parameter field of MIME headers (see
32
   [MIME1] and [MIME2]).
33
34
Description
35
36
   The text starts in ASCII [ASCII], and switches to Japanese characters
37
   through an escape sequence. For example, the escape sequence ESC $ B
38
   (three bytes, hexadecimal values: 1B 24 42) indicates that the bytes
39
   following this escape sequence are Japanese characters, which are
40
   encoded in two bytes each.  To switch back to ASCII, the escape
41
   sequence ESC ( B is used.
42
43
   The following table gives the escape sequences and the character sets
44
   used in ISO-2022-JP messages. The ISOREG number is the registration
45
   number in ISO's registry [ISOREG].
46
47
       Esc Seq    Character Set                  ISOREG
48
49
       ESC ( B    ASCII                             6
50
       ESC ( J    JIS X 0201-1976 ("Roman" set)    14
51
       ESC $ @    JIS X 0208-1978                  42
52
       ESC $ B    JIS X 0208-1983                  87
53
54
   Note that JIS X 0208 was called JIS C 6226 until the name was changed
55
56
57
58
Murai, Crispin & van der Poel                                   [Page 1]
59
60
RFC 1468   Japanese Character Encoding for Internet Messages   June 1993
61
62
63
   on March 1st, 1987. Likewise, JIS C 6220 was renamed JIS X 0201.
64
65
   The "Roman" character set of JIS X 0201 [JISX0201] is identical to
66
   ASCII except for backslash () and tilde (~). The backslash is
67
   replaced by the Yen sign, and the tilde is replaced by overline. This
68
   set is Japan's national variant of ISO 646 [ISO646].
69
70
   The JIS X 0208 [JISX0208] character sets consist of Kanji, Hiragana,
71
   Katakana and some other symbols and characters. Each character takes
72
   up two bytes.
73
74
   For further details about the JIS Japanese national character set
75
   standards, refer to [JISX0201] and [JISX0208].  For further
76
   information about the escape sequences, see [ISO2022] and [ISOREG].
77
78
   If there are JIS X 0208 characters on a line, there must be a switch
79
   to ASCII or to the "Roman" set of JIS X 0201 before the end of the
80
   line (i.e., before the CRLF). This means that the next line starts in
81
   the character set that was switched to before the end of the previous
82
   line.
83
84
   Also, the text must end in ASCII.
85
86
   Other restrictions are given in the Formal Syntax below.
87
88
Formal Syntax
89
90
   The notational conventions used here are identical to those used in
91
   RFC 822 [RFC822].
92
93
   The * (asterisk) convention is as follows:
94
95
       l*m something
96
97
   meaning at least l and at most m somethings, with l and m taking
98
   default values of 0 and infinity, respectively.
99
100
101
   message             = headers 1*( CRLF *single-byte-char *segment
102
                         single-byte-seq *single-byte-char )
103
                                           ; see also [MIME1] "body-part"
104
                                           ; note: must end in ASCII
105
106
   headers             = <see [RFC822] "fields" and [MIME1] "body-part">
107
108
   segment             = single-byte-segment / double-byte-segment
109
110
   single-byte-segment = single-byte-seq 1*single-byte-char
111
112
113
114
Murai, Crispin & van der Poel                                   [Page 2]
115
116
RFC 1468   Japanese Character Encoding for Internet Messages   June 1993
117
118
119
   double-byte-segment = double-byte-seq 1*( one-of-94 one-of-94 )
120
121
   single-byte-seq     = ESC "(" ( "B" / "J" )
122
123
   double-byte-seq     = ESC "$" ( "@" / "B" )
124
125
   CRLF                = CR LF
126
127
                                                    ; ( Octal, Decimal.)
128
129
   ESC                 = <ISO 2022 ESC, escape>     ; (    33,      27.)
130
131
   SI                  = <ISO 2022 SI, shift-in>    ; (    17,      15.)
132
133
   SO                  = <ISO 2022 SO, shift-out>   ; (    16,      14.)
134
135
   CR                  = <ASCII CR, carriage return>; (    15,      13.)
136
137
   LF                  = <ASCII LF, linefeed>       ; (    12,      10.)
138
139
   one-of-94           = <any one of 94 values>     ; (41-176, 33.-126.)
140
141
   7BIT                = <any 7-bit value>          ; ( 0-177,  0.-127.)
142
143
   single-byte-char    = <any 7BIT, including bare CR & bare LF, but NOT
144
                          including CRLF, and not including ESC, SI, SO>
145
146
MIME Considerations
147
148
   The name given to the JUNET character encoding is "ISO-2022-JP". This
149
   name is intended to be used in MIME messages as follows:
150
151
       Content-Type: text/plain; charset=iso-2022-jp
152
153
   The ISO-2022-JP encoding is already in 7-bit form, so it is not
154
   necessary to use a Content-Transfer-Encoding header. It should be
155
   noted that applying the Base64 or Quoted-Printable encoding will
156
   render the message unreadable in current JUNET software.
157
158
   ISO-2022-JP may also be used in MIME Part 2 headers.  The "B"
159
   encoding should be used with ISO-2022-JP text.
160
161
Background Information
162
163
   The JUNET encoding was described in the JUNET User's Guide [JUNET]
164
   (JUNET Riyou No Tebiki Dai Ippan).
165
166
   The encoding is based on the particular usage of ISO 2022 announced
167
168
169
170
Murai, Crispin & van der Poel                                   [Page 3]
171
172
RFC 1468   Japanese Character Encoding for Internet Messages   June 1993
173
174
175
   by 4/1 (see [ISO2022] for details). However, the escape sequence
176
   normally used for this announcement is not included in ISO-2022-JP
177
   messages.
178
179
   The Kana set of JIS X 0201 is not used in ISO-2022-JP messages.
180
181
   In the past, some systems erroneously used the escape sequence ESC (
182
   H in JUNET messages. This escape sequence is officially registered
183
   for a Swedish character set [ISOREG], and should not be used in ISO-
184
   2022-JP messages.
185
186
   Some systems do not distinguish between ESC ( B and ESC ( J or
187
   between ESC $ @ and ESC $ B for display. However, when relaying a
188
   message to another system, the escape sequences must not be altered
189
   in any way.
190
191
   The human user (not implementor) should try to keep lines within 80
192
   display columns, or, preferably, within 75 (or so) columns, to allow
193
   insertion of ">" at the beginning of each line in excerpts. Each JIS
194
   X 0208 character takes up two columns, and the escape sequences do
195
   not take up any columns. The implementor is reminded that JIS X 0208
196
   characters take up two bytes and should not be split in the middle to
197
   break lines for displaying, etc.
198
199
   The JIS X 0208 standard was revised in 1990, to add two characters at
200
   the end of the table. Although ISO 2022 specifies special additional
201
   escape sequences to indicate the use of revised character sets, it is
202
   suggested here not to make use of this special escape sequence in
203
   ISO-2022-JP text, even if the two characters added to JIS X 0208 in
204
   1990 are used.
205
206
   For further information about Japanese character encodings such as PC
207
   codes, FTP locations of implementations, etc, see "Electronic
208
   Handling of Japanese Text" [JPN.INF].
209
210
References
211
212
   [ASCII] American National Standards Institute, "Coded character set
213
   -- 7-bit American national standard code for information
214
   interchange", ANSI X3.4-1986.
215
216
   [ISO646] International Organization for Standardization (ISO),
217
   "Information technology -- ISO 7-bit coded character set for
218
   information interchange", International Standard, Ref. No. ISO/IEC
219
   646:1991.
220
221
   [ISO2022] International Organization for Standardization (ISO),
222
   "Information processing -- ISO 7-bit and 8-bit coded character sets
223
224
225
226
Murai, Crispin & van der Poel                                   [Page 4]
227
228
RFC 1468   Japanese Character Encoding for Internet Messages   June 1993
229
230
231
   -- Code extension techniques", International Standard, Ref. No. ISO
232
   2022-1986 (E).
233
234
   [ISOREG] International Organization for Standardization (ISO),
235
   "International Register of Coded Character Sets To Be Used With
236
   Escape Sequences".
237
238
   [JISX0201] Japanese Standards Association, "Code for Information
239
   Interchange", JIS X 0201-1976.
240
241
   [JISX0208] Japanese Standards Association, "Code of the Japanese
242
   graphic character set for information interchange", JIS X 0208-1978,
243
   -1983 and -1990.
244
245
   [JPN.INF] Ken R. Lunde <lunde@adobe.com>, "Electronic Handling of
246
   Japanese Text", March 1992,
247
   msi.umn.edu(128.101.24.1):pub/lunde/japan[123].inf
248
249
   [JUNET] JUNET Riyou No Tebiki Sakusei Iin Kai (JUNET User's Guide
250
   Drafting Committee), "JUNET Riyou No Tebiki (Dai Ippan)" ("JUNET
251
   User's Guide (First Edition)"), February 1988.
252
253
   [MIME1] Borenstein N., and N. Freed, "MIME (Multipurpose
254
   Internet Mail Extensions): Mechanisms for Specifying and
255
   Describing the Format of Internet Message Bodies", RFC 1341,
256
   Bellcore, Innosoft, June 1992.
257
258
   [MIME2] Moore, K., "Representation of Non-ASCII Text in Internet
259
   Message Headers", RFC 1342, University of Tennessee, June 1992.
260
261
   [RFC822] Crocker, D., "Standard for the Format of ARPA Internet
262
   Text Messages", STD 11, RFC 822, UDEL, August 1982.
263
264
   [RFC1036] Horton M., and R. Adams, "Standard for Interchange of USENET
265
   Messages", RFC 1036, AT&T Bell Laboratories, Center for Seismic
266
   Studies, December 1987.
267
268
Acknowledgements
269
270
   Many people assisted in drafting this document. The authors wish to
271
   thank in particular Akira Kato, Masahiro Sekiguchi and Ken'ichi
272
   Handa.
273
274
Security Considerations
275
276
   Security issues are not discussed in this memo.
277
278
279
280
281
282
Murai, Crispin & van der Poel                                   [Page 5]
283
284
RFC 1468   Japanese Character Encoding for Internet Messages   June 1993
285
286
287
Authors' Addresses
288
289
   Jun Murai
290
   Keio University
291
   5322 Endo, Fujisawa
292
   Kanagawa 252 Japan
293
294
   Fax: +81 466 49 1101
295
   EMail: jun@wide.ad.jp
296
297
298
   Mark Crispin
299
   Panda Programming
300
   6158 Lariat Loop NE
301
   Bainbridge Island, WA 98110-2098
302
   USA
303
304
   Phone: +1 206 842 2385
305
   EMail: MRC@PANDA.COM
306
307
308
   Erik M. van der Poel
309
   A-105 Park Avenue
310
   4-4-10 Ohta, Kisarazu
311
   Chiba 292 Japan
312
313
   Phone: +81 438 22 5836
314
   Fax:   +81 438 22 5837
315
   EMail: erik@poel.juice.or.jp
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
Murai, Crispin & van der Poel                                   [Page 6]
339
(-)a2ps-4.13.ORIG/libjcode/Doc/rfc1554.txt (+339 lines)
Line 0 Link Here
1
2
3
4
5
6
7
Network Working Group                                            M. Ohta
8
Request for Comments: 1554                 Tokyo Institute of Technology
9
Category: Informational                                         K. Handa
10
                                                                     ETL
11
                                                           December 1993
12
13
14
          ISO-2022-JP-2: Multilingual Extension of ISO-2022-JP
15
16
Status of this Memo
17
18
   This memo provides information for the Internet community.  This memo
19
   does not specify an Internet standard of any kind.  Distribution of
20
   this memo is unlimited.
21
22
Introduction
23
24
   This memo describes a text encoding scheme: "ISO-2022-JP-2", which is
25
   used experimentally for electronic mail [RFC822] and network news
26
   [RFC1036] messages in several Japanese networks.  The encoding is a
27
   multilingual extension of "ISO-2022-JP", the existing encoding for
28
   Japanese [2022JP].  The encoding is supported by an Emacs based
29
   multilingual text editor: MULE [MULE].
30
31
   The name, "ISO-2022-JP-2", is intended to be used in the "charset"
32
   parameter field of MIME headers (see [MIME1] and [MIME2]).
33
34
Description
35
36
   The text with "ISO-2022-JP-2" starts in ASCII [ASCII], and switches
37
   to other character sets of ISO 2022 [ISO2022] through limited
38
   combinations of escape sequences.  All the characters are encoded
39
   with 7 bits only.
40
41
   At the beginning of text, the existence of an announcer sequence:
42
   "ESC 2/0 4/1 ESC 2/0 4/6 ESC 2/0 5/10" is (though omitted) assumed.
43
   Thus, characters of 94 character sets are designated to G0 and
44
   invoked as GL.  C1 control characters are represented with 7 bits.
45
   Characters of 96 character sets are designated to G2 and invoked with
46
   SS2 (single shift two, "ESC 4/14" or "ESC N").
47
48
   For example, the escape sequence "ESC 2/4 2/8 4/3" or "ESC $ ( C"
49
   indicates that the bytes following the escape sequence are Korean KSC
50
   characters, which are encoded in two bytes each.  The escape sequence
51
   "ESC 2/14 4/1" or "ESC . A" indicates that ISO 8859-1 is designated
52
   to G2. After the designation, the single shifted sequence "ESC 4/14
53
   4/1" or "ESC N A" is interpreted to represent a character "A with
54
   acute".
55
56
57
58
Ohta & Handa                                                    [Page 1]
59
60
RFC 1554         Multilingual Extension of ISO-2022-JP     December 1993
61
62
63
   The following table gives the escape sequences and the character sets
64
   used in "ISO-2022-JP-2" messages. The reg# is the registration number
65
   in ISO's registry [ISOREG].
66
67
                              94 character sets
68
      reg#  character set      ESC sequence                designated to
69
      ------------------------------------------------------------------
70
      6     ASCII              ESC 2/8 4/2      ESC ( B    G0
71
      42    JIS X 0208-1978    ESC 2/4 4/0      ESC $ @    G0
72
      87    JIS X 0208-1983    ESC 2/4 4/2      ESC $ B    G0
73
      14    JIS X 0201-Roman   ESC 2/8 4/10     ESC ( J    G0
74
      58    GB2312-1980        ESC 2/4 4/1      ESC $ A    G0
75
      149   KSC5601-1987       ESC 2/4 2/8 4/3  ESC $ ( C  G0
76
      159   JIS X 0212-1990    ESC 2/4 2/8 4/4  ESC $ ( D  G0
77
78
                              96 character sets
79
      reg#  character set      ESC sequence                designated to
80
      ------------------------------------------------------------------
81
      100   ISO8859-1          ESC 2/14 4/1     ESC . A    G2
82
      126   ISO8859-7(Greek)   ESC 2/14 4/6     ESC . F    G2
83
84
   For further information about the character sets and the escape
85
   sequences, see [ISO2022] and [ISOREG].
86
87
   If there is any G0 designation in text, there must be a switch to
88
   ASCII or to JIS X 0201-Roman before a space character (but not
89
   necessarily before "ESC 4/14 2/0" or "ESC N ' '") or control
90
   characters such as tab or CRLF.  This means that the next line starts
91
   in the character set that was switched to before the end of the
92
   previous line.  Though the designation to JIS X 0201-Roman is allowed
93
   for backward compatibility to "ISO-2022-JP", its use is discouraged.
94
   Applications such as pagers and editors which randomly seek within a
95
   text file encoded with "ISO-2022-JP-2" may assume that all the lines
96
   begin with ASCII, not with JIS X 0201-Roman.
97
98
   At the beginning of a line, information on G2 designation of the
99
   previous line is cleared.  New designation must be given before a
100
   character in 96 character sets is used in the line.
101
102
   The text must end in ASCII designated to G0.
103
104
   As the "ISO-2022-JP", and thus, "ISO-2022-JP-2", is designed to
105
   represent English and modern Japanese, left-to-right directionality
106
   is assumed if the text is displayed horizontally.
107
108
   Users of "ISO-2022-JP-2" must be aware that some common transport
109
   such as old Bnews can not relay a 7-bit value 7/15 (decimal 127),
110
   which is used to encode, say, "y with diaeresis" of ISO 8859-1.
111
112
113
114
Ohta & Handa                                                    [Page 2]
115
116
RFC 1554         Multilingual Extension of ISO-2022-JP     December 1993
117
118
119
   Other restrictions are given in the Formal Syntax section below.
120
121
Formal Syntax
122
123
   The notational conventions used here are identical to those used in
124
   STD 11, RFC 822 [RFC822].
125
126
   The * (asterisk) convention is as follows:
127
128
      l*m something
129
130
   meaning at least l and at most m somethings, with l and m taking
131
   default values of 0 and infinity, respectively.
132
133
   message             = headers 1*(CRLF text)
134
                                          ; see also [MIME1] "body-part"
135
                                          ; note: must end in ASCII
136
137
   text                = *(single-byte-char /
138
                           g2-desig-seq /
139
                           single-shift-char)
140
                          [*segment
141
                           reset-seq
142
                           *(single-byte-char /
143
                             g2-desig-seq /
144
                             single-shift-char ) ]
145
                                          ; note: g2-desig-seq must
146
                                          ; precede single-shift-char
147
148
   headers             = <see [RFC822] "fields" and [MIME1] "body-part">
149
150
   segment             = single-byte-segment / double-byte-segment
151
152
   single-byte-segment = single-byte-seq
153
                         *(single-byte-char /
154
                           g2-desig-seq /
155
                           single-shift-char )
156
157
   double-byte-segment = double-byte-seq
158
                         *((one-of-94 one-of-94) /
159
                           g2-desig-seq /
160
                           single-shift-char )
161
162
   reset-seq           = ESC "(" ( "B" / "J" )
163
164
   single-byte-seq     = ESC "(" ( "B" / "J" )
165
166
   double-byte-seq     = (ESC "$" ( "@" / "A" / "B" )) /
167
168
169
170
Ohta & Handa                                                    [Page 3]
171
172
RFC 1554         Multilingual Extension of ISO-2022-JP     December 1993
173
174
175
                         (ESC "$" "(" ( "C" / "D" ))
176
177
   g2-desig-seq        = ESC "." ( "A" / "F" )
178
179
   single-shift-seq    = ESC "N"
180
181
   single-shift-char   = single-shift-seq one-of-96
182
183
   CRLF                = CR LF
184
185
                                                    ; ( Octal, Decimal.)
186
187
   ESC                 = <ISO 2022 ESC, escape>     ; (    33,      27.)
188
189
   SI                  = <ISO 2022 SI, shift-in>    ; (    17,      15.)
190
191
   SO                  = <ISO 2022 SO, shift-out>   ; (    16,      14.)
192
193
   CR                  = <ASCII CR, carriage return>; (    15,      13.)
194
195
   LF                  = <ASCII LF, linefeed>       ; (    12,      10.)
196
197
   one-of-94           = <any one of 94 values>     ; (41-176, 33.-126.)
198
199
   one-of-96           = <any one of 96 values>     ; (40-177, 32.-127.)
200
201
   7BIT                = <any 7-bit value>          ; ( 0-177,  0.-127.)
202
203
   single-byte-char    = <any 7BIT, including bare CR & bare LF, but NOT
204
                          including CRLF, and not including ESC, SI, SO>
205
206
MIME Considerations
207
208
   The name given to the character encoding is "ISO-2022-JP-2". This
209
   name is intended to be used in MIME messages as follows:
210
211
      Content-Type: text/plain; charset=iso-2022-jp-2
212
213
   The "ISO-2022-JP-2" encoding is already in 7-bit form, so it is not
214
   necessary to use a Content-Transfer-Encoding header. It should be
215
   noted that applying the Base64 or Quoted-Printable encoding will
216
   render the message unreadable in non-MIME-compliant software.
217
218
   "ISO-2022-JP-2" may also be used in MIME headers.  Both "B" and "Q"
219
   encoding could be useful with "ISO-2022-JP-2" text.
220
221
222
223
224
225
226
Ohta & Handa                                                    [Page 4]
227
228
RFC 1554         Multilingual Extension of ISO-2022-JP     December 1993
229
230
231
References
232
233
   [ASCII] American National Standards Institute, "Coded character set
234
           -- 7-bit American national standard code for information
235
           interchange", ANSI X3.4-1986.
236
237
238
   [ISO2022] International Organization for Standardization (ISO),
239
             "Information processing -- ISO 7-bit and 8-bit coded
240
             character sets -- Code extension techniques",
241
             International Standard, Ref. No. ISO 2022-1986 (E).
242
243
   [ISOREG] International Organization for Standardization (ISO),
244
            "International Register of Coded Character Sets To Be Used
245
            With Escape Sequences".
246
247
   [MIME1] Borenstein, N., and N. Freed, "MIME  (Multipurpose Internet
248
           Mail Extensions) Part One: Mechanisms for Specifying and
249
           Describing the Format of Internet Message Bodies", RFC 1521,
250
           September 1993.
251
252
   [MIME2] Moore, K., "MIME (Multipurpose Internet Mail Extensions) Part
253
           Two: Message Header Extensions for Non-ASCII Text", RFC 1522,
254
           September 1993.
255
256
   [RFC822] Crocker, D., "Standard for the Format of ARPA Internet Text
257
            Messages", STD 11, RFC 1522, UDEL, August 1982.
258
259
   [RFC1036] Horton M., and R. Adams, "Standard for Interchange of
260
             USENET Messages", RFC 1036, AT&T Bell Laboratories, Center
261
             for Seismic Studies, December 1987.
262
263
   [2022JP] Murai, J., Crispin, M., and E. van der Poel, "Japanese
264
            Character Encoding for Internet Messages", RFC 1468, June
265
            1993.
266
267
   [MULE] Nishikimi, M., Handa, K., and S. Tomura, "Mule: MULtilingual
268
          Enhancement to GNU Emacs", Proc. of INET'93, August, 1993.
269
270
Acknowledgements
271
272
   This memo is the result of discussion between various people in a
273
   news group: fj.kanji and is reviewed by a mailing list: jp-msg
274
   @iij.ad.jp.  The Authors wish to thank in particular Prof. Eiichi
275
   Wada for his suggestions based on profound knowledge in ISO 2022 and
276
   related standards.
277
278
279
280
281
282
Ohta & Handa                                                    [Page 5]
283
284
RFC 1554         Multilingual Extension of ISO-2022-JP     December 1993
285
286
287
Security Considerations
288
289
   Security issues are not discussed in this memo.
290
291
Authors' Addresses
292
293
   Masataka Ohta
294
   Tokyo Institute of Technology
295
   2-12-1, O-okayama, Meguro-ku,
296
   Tokyo 152, JAPAN
297
298
   Phone: +81-3-5499-7084
299
   Fax: +81-3-3729-1940
300
   EMail: mohta@cc.titech.ac.jp
301
302
303
   Ken'ichi Handa
304
   Electrotechnical Laboratory
305
   Umezono 1-1-4, Tsukuba,
306
   Ibaraki 305, JAPAN
307
308
   Phone: +81-298-58-5916
309
   Fax: +81-298-58-5918
310
   EMail: handa@etl.go.jp
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
Ohta & Handa                                                    [Page 6]
339
(-)a2ps-4.13.ORIG/libjcode/Makefile.in (+100 lines)
Line 0 Link Here
1
# Makefile for directory with library jcode
2
# by Kuramitsu Kimio
3
4
PACKAGE = @PACKAGE@
5
VERSION = @VERSION@
6
7
SHELL = /bin/sh
8
9
srcdir = @srcdir@
10
top_srcdir = @top_srcdir@
11
top_builddir = ..
12
VPATH = @srcdir@
13
14
prefix = @prefix@
15
exec_prefix = @exec_prefix@
16
transform = @program_transform_name@
17
libdir = $(exec_prefix)/lib
18
includedir = $(prefix)/include
19
datadir = $(prefix)/@DATADIRNAME@
20
subdir = libjcode
21
22
INSTALL = @INSTALL@
23
INSTALL_DATA = @INSTALL_DATA@
24
MKINSTALLDIRS = @MKINSTALLDIRS@
25
26
AR = ar
27
CC = @CC@
28
LIBTOOL = @LIBTOOL@
29
RANLIB = @RANLIB@
30
31
DEFS = -DLOCALEDIR=\"$(localedir)\" -DGNULOCALEDIR=\"$(gnulocaledir)\" \
32
-DLOCALE_ALIAS_PATH=\"$(aliaspath)\" @DEFS@
33
CPPFLAGS = @CPPFLAGS@
34
CFLAGS = @CFLAGS@
35
LDFLAGS = @LDFLAGS@
36
37
COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
38
39
HEADERS = $(COMHDRS)
40
COMHDRS = jlib.h
41
SOURCES = $(COMSRCS)
42
COMSRCS = detect.c libjcode.c
43
OBJECTS = detect.$lo libjcode.$lo
44
DISTFILES.common = README
45
DISTFILES.normal = VERSION
46
47
.SUFFIXES:
48
.SUFFIXES: .c .o .lo
49
.c.o:
50
	$(COMPILE) $<
51
.c.lo:
52
	$(LIBTOOL) --mode=compile $(COMPILE) $<
53
54
INCLUDES = -I. -I$(top_srcdir)/
55
56
all: all-@COMPILE_LIBJCODE@
57
58
all-yes: libjcode.$la
59
all-no:
60
61
libjcode.a: $(OBJECTS)
62
	rm -f $@
63
	$(AR) cru $@ $(OBJECTS)
64
	$(RANLIB) $@
65
66
libjcode.la: $(OBJECTS)
67
	$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ $(OBJECTS) \
68
		   -version-info 1:0 -rpath $(libdir)
69
70
check: all
71
72
install: install-exec install-data
73
install-exec: all
74
75
install-data: all
76
77
# Define this as empty until I found a useful application.
78
installcheck:
79
80
uninstall:
81
82
info dvi:
83
84
$(OBJECTS): jlibconfig.h jlib.h
85
86
mostlyclean:
87
	rm -f *.a *.o *.lo core core.*
88
89
clean: mostlyclean
90
91
distclean: clean
92
	rm -f Makefile ID TAGS po2msg.sed po2tbl.sed
93
94
maintainer-clean: distclean
95
	@echo "This command is intended for maintainers to use;"
96
	@echo "it deletes files that may require special tools to rebuild."
97
98
Makefile: Makefile.in ../config.status
99
	cd .. \
100
	  && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
(-)a2ps-4.13.ORIG/libjcode/README (+158 lines)
Line 0 Link Here
1
libjcode ¥é¥¤¥Ö¥é¥ê¥Ñ¥Ã¥±¡¼¥¸	1.00 ÈÇ/ 1996
2
3
¤´Â¸ÃΤÎÄ̤ꡢÆüËܸì¤òɽ¤¹¤¿¤á¤Îʸ»ú¥³¡¼¥É¤Ï¡¢JIS(ISO-2022)¡¢EUC¡¢SJIS  ¤Î
4
£³¼ïÎब¤è¤¯»È¤ï¤ì¤Æ¤¤¤Þ¤¹¡£¤³¤ì¤Ï¡¢¥Ñ¥½¥³¥ó´Ö¤ÇSJIS¤Îʸ¾Ï¤ò¤ä¤ê¼è¤ê¤¹¤ë»þ
5
¤Ï¡¢²¿¤Ë¤âÌäÂê¤Î¤Ê¤¤ÏäǤ·¤¿¡£¤·¤«¤·¡¢WWW ¤Î¤è¤¦¤Ê¥¤¥ó¥¿¡¼¥Í¥Ã¥È»þÂå¤Ë¤Ê¤ë
6
¤È¡¢ÍÍ¡¹¤Êʸ»ú¥³¡¼¥É¤¬º®ºß¤·¤Æ¤·¤Þ¤¤¡¢Â礭¤Êº®Íð¤ò¾·¤¯·ë²Ì¤Ë¤Ê¤ê¤Þ¤¹¡£
7
8
¤½¤ó¤ÊÃæ¤Ç¿¤¯¤Î¥×¥í¥°¥é¥Þ¡¼¤¬ÆüËܸ쥳¡¼¥É½èÍý¤ÎÈÑ»¨¤µ¤Î櫤˴٤é¤Ê¤¯¤ÆºÑ¤à
9
¤è¤¦¤Ë¤Þ¤È¤á¤¿¤Î¤¬¡¢¤³¤Î C¸À¸ìÍѤΠlibjcode ¥é¥¤¥Ö¥é¥ê¤Ç¤¹¡£
10
11
-- libjcode ¥Ñ¥Ã¥±¡¼¥¸¤ÎÆÃħ ------------------------------------------------
12
13
 1. ¥¤¥ó¥¿¡¼¥Í¥Ã¥È¤Ç¤ÎÍøÍѤòÁ°Äó¤È¤·¤¿ÆüËܸ쥳¡¼¥ÉÊÑ´¹¥é¥¤¥Ö¥é¥ê
14
 2. SJIS Ⱦ³Ñ¥«¥Ê¤òÁ´³Ñ¤ËÊÑ´¹²Äǽ
15
16
-- ¥Ñ¥Ã¥±¡¼¥¸¤ÎÃæ¿È ---------------------------------------------------------
17
18
	/
19
	README		¤³¤Î¥Õ¥¡¥¤¥ë
20
	Makefile	Unix ÈÇ Makefile
21
	config.h	ÀßÄêÍÑ #include ¥Õ¥¡¥¤¥ë
22
	libjcode.c	JIS¡¢SJIS¡¢EUC¤ÎÊÑ´¹
23
	detect.c	¥³¡¼¥ÉȽÄêÍÑ
24
	sample.c	´Êñ¤Ê¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à
25
	jlib.h		¥é¥¤¥Ö¥é¥êÍÑ #include ¥Õ¥¡¥¤¥ë
26
27
	Doc/
28
	rfc1468.txt	RFC1468
29
			"Japanese Character Encoding for Internet Messages."
30
	rfc1554.txt	RFC1554	
31
			"ISO-2022-JP-2: Multilingual Extension of ISO-2022-JP"
32
33
-- ÍøÍѾå¤ÎÃí°Õ -------------------------------------------------------------
34
35
libjcode ¤Ï¡¢´°Á´¤Ë¥Õ¥ê¡¼¤Ê¥é¥¤¥Ö¥é¥ê¤Ç¤¹¡£¥¤¥ó¥¿¡¼¥Í¥Ã¥È¤Ë¤ª¤±¤ëÆüËܸì´Ä¶­
36
¤Î²þÁ±¤òºÇ½ªÌÜɸ¤Ë¤·¤Æ¤ª¤ê¤Þ¤¹¡£ÆüËܸ쥳¡¼¥É¤ÎÊÑ´¹¤ò¹Ô¤¤¤¿¤¤Êý¤Ê¤éï¤Ç¤â¡¢
37
¼«Í³¤Ë²þÎɤ·¤Æ¡¢¼«Ê¬¤Î¥×¥í¥°¥é¥à¤Ë¹ç¤ï¤»¤ÆÁȤ߹þ¤à¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£
38
39
¤¿¤À¤·¡¢ÍøÍѤˤ¹¤ë¾ì¹ç¤Ï¼¡¤Î¾ò·ï¤ò¼é¤Ã¤Æ¤¯¤À¤µ¤¤¡£
40
41
 1. libjcode ¤òÍøÍѤ·¤¿¤¿¤á¤ËÇ¡²¿¤Ê¤ë»³²¤¬À¸¤¸¤Æ¤âºî¼Ô¤Ë¤Ï°ìÀÚ¤ÎÀÕǤ¤ò
42
    ¼è¤ê¤Þ¤»¤ó¡£
43
 2. ¹ñΩÂç³Ø¤Î¥³¥ó¥Ô¥å¡¼¥¿»ñ¸»¤ò»È¤Ã¤Æ¤¤¤ë¤Î¤Ç¡¢Ãøºî¸¢É½¼¨¡¢
44
	(C) Kuramitsu Kimio, Tokyo Univ. 1996-97
45
    ¤òǰ¤Î¤¿¤á¤Ë»Ä¤·¤Æ¤ª¤¤¤Æ¤¯¤À¤µ¤¤¡£
46
47
¥é¥¤¥Ö¥é¥êÍøÍÑÃæ¤Ë¥Ð¥°¤òȯ¸«¤·Ä¾¤µ¤ì¤¿Êý¡¢¤è¤ê¸úΨ¤Î¤è¤ê¥¢¥ë¥´¥ê¥º¥à¤ò¼ÂÁõ
48
¤Ê¤µ¤Ã¤¿Êý¤Ï¡¢¤½¤ì¤òºî¼Ô¤ËÁ÷¤Ã¤ÆÄº¤±¤ë¤È¡¢libjcode ¤È¤·¤Æ¤â¤è¤ê¿®ÍêÀ­¤Î¹â¤¤
49
¥é¥¤¥Ö¥é¥ê¤Ø¤ÈÀ®Ä¹¤Ç¤­¤Þ¤¹¡£¤è¤í¤·¤¯¤ª´ê¤¤¤·¤Þ¤¹¡£
50
51
¤Þ¤¿¡¢libjcode¤òÁȤ߹þ¤ó¤À¥½¥Õ¥È¥¦¥¨¥¢¤Î̾Á°¤â¶µ¤¨¤Æ¤¤¤¿¤À¤±¤ë¤È¡¢¼ÂºÝ¤Î¼Â
52
ÁõÎã¤È¤·¤Æ¡¢¾Ò²ð¤·¤¿¤¤¤È»×¤¤¤Þ¤¹¡£
53
54
-- »È¤¤Êý -------------------------------------------------------------------
55
56
1. ¤Þ¤º¡¢make ¤Ë¤è¤Ã¤Æ¡¢libjcode.a ¥é¥¤¥Ö¥é¥ê¤òºî¤ê¤Þ¤¹¡£
57
   config.h ¤òľ¤¹¤³¤È¤Ç¡¢Â¿¾¯µ¡Ç½¤òÊѤ¨¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¤¬¡¢¥½¡¼¥¹¥³¡¼¥É
58
   ¤òÆÉ¤ó¤ÀÊý¤¬Áᤤ¤Ç¤·¤ç¤¦¡£
59
60
2. ¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à sample.c ¤È Makefile ¤ò¸«¤ë¤È¡¢¤³¤Î¥é¥¤¥Ö¥é¥ê¤ò¤É¤Î
61
   ¤è¤¦¤ËÁȤ߹þ¤à¤«»²¹Í¤Ë¤·¤Æ¤¯¤À¤µ¤¤¡£
62
63
-- ưºî³Îǧ´Ä¶­ -------------------------------------------------------------
64
65
ANSI C ¥³¥ó¥Ñ¥¤¥é¤ò»È¤Ã¤Æ¤¤¤ì¤Ð¡¢ÉáÄ̤˥³¥ó¥Ñ¥¤¥ë¤Ç¤­¤ë¤Ï¤º¤Ç¤¹¡£
66
67
	Solaris 2.5 (Sparc) with gcc 2.7.2
68
	Linux 2.0 with gcc 2.7.2
69
70
-- ¥é¥¤¥Ö¥é¥ê¤Î°ìÍ÷ ---------------------------------------------------------
71
72
ÉáÄ̤˻Ȥ¨¤ë¥é¥¤¥Ö¥é¥ê´Ø¿ô¤Ï¡¢jlib.h ¥Ø¥Ã¥À¥Õ¥¡¥¤¥ë¤Ë½ñ¤«¤ì¤Æ¤¤¤Þ¤¹¡£ºÇ½é
73
¤Ë #include "jlib.h" ¤òÄɲä·¤Þ¤¹¡£
74
75
#define ¥Ç¥£¥ì¥¯¥Æ¥£¥Ö¤ÎÆâÍÆ
76
77
#define ASCII	ASCII ¥³¡¼¥É
78
#define JIS	iso-2022-jp ¥³¡¼¥É
79
#define EUC	x-euc-jp ¥³¡¼¥É
80
#define SJIS	x-sjis ¥³¡¼¥É
81
82
´Ø¿ô:
83
84
extern int detectKanjiCode(char *str);
85
86
	ʸ»úÎó str ¤Î¥³¡¼¥É¤òȽÄꤷ¤Þ¤¹¡£
87
	ÊÖ¤êÃͤϡ¢ASCII, JIS, EUC, SJIS ¤Î¤É¤ì¤«¤Ç¤¹¡£
88
89
extern char *toStringJIS(char *str);
90
91
	ʸ»úÎó str ¤òJIS ¥³¡¼¥É¤ËÊÑ´¹¤·¤Þ¤¹¡£
92
93
extern char *toStringEUC(char *str);
94
95
	ʸ»úÎó str ¤òEUC ¥³¡¼¥É¤ËÊÑ´¹¤·¤Þ¤¹¡£
96
97
extern char *toStringSJIS(char *str);
98
99
	ʸ»úÎó str ¤òSJIS ¥³¡¼¥É¤ËÊÑ´¹¤·¤Þ¤¹¡£
100
101
-- ÃΤé¤ì¤Æ¤¤¤ëÌäÂêÅÀ -------------------------------------------------------
102
103
Ⱦ³ÑSJIS¤¬´Þ¤Þ¤ì¤¿¥Æ¥­¥¹¥È¤òÁÛÄꤷ¤Æ¤¤¤ë¤Î¤Ç¡¢EUC ¤È SJIS ¤Î¼«Æ°È½Ä꤬
104
¤«¤Ê¤ê¼å¤¤¡£
105
106
-- º£¸å¤ÎͽÄê ---------------------------------------------------------------
107
108
³Î¼Â¤Ë¤ä¤í¤¦¤È»×¤Ã¤Æ¤¤¤ë¤³¤È¡£
109
	JIS X 0212-1990 (¯¾Î Êä½õ´Á»ú)¤ÎÊÑ´¹¤ËÂбþ
110
	MIME ¥Ø¥Ã¥À¤Î¥¨¥ó¥³¡¼¥É/¥Ç¥³¡¼¥É
111
112
¤Ç¤­¤¿¤é¤ä¤ê¤¿¤¤¤³¤È(CGI ¸þ¤±¥é¥¤¥Ö¥é¥ê)
113
	Á´³Ñ --> Ⱦ³Ñ 
114
		(Îã £æ£ï£ï¡÷£í£á£é£ì¡¥£ã£ï£í --> foo@mail.com)
115
	Ê¿²¾Ì¾ <--> ¥«¥¿¥«¥Ê 
116
	ROMAN »ú --> ¤«¤Ê
117
		(Kuramitsu --> ¤¯¤é¤ß¤Ä)
118
119
Ä©À路¤¿¤¤¤³¤È¡£
120
	SJIS ¤È ISO-8859-1(laten) ¤Î¼«Æ°¼±ÊÌ
121
122
Æ»µÁŪ¤ËǺ¤à¤È¤³¤í
123
	Unicode ¤Ø¤ÎÂбþ
124
125
126
-- Îò»Ë ---------------------------------------------------------------------
127
128
libjcode ¤òºî¤ëľÀܤΤ­¤Ã¤«¤±¤È¤Ê¤Ã¤¿¤Î¤Ï¡¢Thomus Boutell Ãø¤Î
129
"CGI Programming with C and Perl"(Addison-Wesley)¤ËÉÕ°¤¹¤ë¥µ¥ó¥×¥ëCGI¥×¥í
130
¥°¥é¥à¤òÆüËܸì¤ÎÆþÎϤò¼õ¤±ÉÕ¤±¤ë¤è¤¦¤Ë¤¹¤ë¤¿¤á¤Ë¡¢´Á»ú¥³¡¼¥ÉÊÑ´¹¤Ë¿¨¤ì¤ëɬ
131
Í×À­¤¬¤¢¤ê¤Þ¤·¤¿¡£¤È¤³¤í¤¬¡¢PerlÍѤˤÏÍ¥¤ì¤¿´Á»úÊÑ´¹¤Î¥é¥¤¥Ö¥é¥ê¤¬Â¸ºß¤·¤Þ
132
¤·¤¿¤¬¡¢»Äǰ¤Ê¤¬¤éCÈǤˤϡ¢Í¥¤ì¤¿¥é¥¤¥Ö¥é¥ê¤¬¼ê¤ËÆþ¤ì¤ë¤³¤È¤¬¤Ç¤­¤Þ¤»¤ó¤Ç
133
¤·¤¿¡£
134
135
¤½¤³¤Ç¡¢Ken Lunde Ãø¤Î¡ÖÆüËܸì¾ðÊó½èÍý¡×(O'Reilly)¤ò»²¹Í¤Ë¥é¥¤¥Ö¥é¥êºîÀ®¤ò
136
»Ï¤á¤ë¤³¤È¤Ë¤·¤Þ¤·¤¿¡£
137
138
1996/12/10	¥Û¡¼¥à¥Ú¡¼¥¸¾å¤Ç¸ø³«³«»Ï¡£
139
		http://www.lib.m.u-tokyo.ac.jp/~kiki/libjcode/
140
141
1996/12/19	"CGI Programming with C and Perl5"¤ÎÆüËܸìÈÇÉÕÏ¿CD-ROMÉÕÏ¿
142
		¤È¤·¤Æ¡¢libjcode-1.00 ÇÛÉÛ³«»Ï
143
144
-- ¼Õ¼­ ---------------------------------------------------------------------
145
146
ºä¼¸¦µæ¼¼¤ÎÀèÇڤǤ¢¤ëÀîȨ ÂÀ°ì(kawabata@is.s.u-tokyo.ac.jp)¤µ¤ó¤Ë¤Ï¡¢ÆüËÜ
147
¸ì½èÍý¤È¤¤¤¦¶¹¤¤´ÑÅÀ¤Ë¤È¤é¤ï¤ì¤º¡¢¹­¤¯Â¿¹ñ¸ì´Ä¶­¤ä½èÍý¤Ë¤Ä¤¤¤ÆÍÍ¡¹¤Ê½õ¸À¤ä
148
¥¢¥É¥Ð¥¤¥¹¤ò¤·¤ÆÄº¤­¤Þ¤·¤¿¡£¤Þ¤¿¡¢Ëܥ饤¥Ö¥é¥ê¼Â¸½¤Î¤¿¤á¤Î¥Ð¥°¼è¤ê¤â¼êÅÁ¤Ã
149
¤ÆÄº¤­¤Þ¤·¤¿¡£
150
151
---
152
Ëܥ饤¥Ö¥é¥ê¤ò³èÍѤ·¤ÆÂ¿¤¯¤ÎCGI¥×¥í¥°¥é¥à¤äWindows/Macintosh ÍѤΥե꡼¥¦
153
¥¨¥¢¡¢¤Þ¤¿¾¦ÍÑ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤ÎÆüËܸìÈǤ¬Àµ¤·¤¯´Á»ú¥³¡¼¥É¤ò°·¤¨¤ë¤è¤¦¤Ë
154
¤Ê¤Ã¤ÆÄº¤±¤ì¤ì¤Ð¡¢¹¬¤¤¤Ç¤¹¡£
155
156
					 		      1996ǯ 12·î
157
					      ÁÒ¸÷ ·¯Ïº / Kuramitsu Kimio
158
						  kiki@is.s.u-tokyo.ac.jp
(-)a2ps-4.13.ORIG/libjcode/detect.c (+204 lines)
Line 0 Link Here
1
/*
2
 * detect.c - libjcode ¥³¡¼¥É¼«Æ°È½Äê¥ë¡¼¥Á¥ó
3
 *                (C) Kuramitsu Kimio, Tokyo Univ. 1996-97 
4
 *
5
 * Ken Lunde Ãø ¡ÖÆüËܸì¾ðÊó½èÍý¡× ¤È jconv.c ¤ò»²¹Í¤Ëºî¤ê 
6
 * ¤Þ¤·¤¿¡£
7
 * CGI ¥×¥í¥°¥é¥à¤Ç¤ÎÍøÍѤò¹Í¤¨¤Æ¡¢¤Ò¤é¤¬¤Ê¡¢¤«¤¿¤«¤Ê¤ÎʤÓ
8
 * ¤Ë¤è¤ëSJIS, EUC ¤Î¿äÄꥢ¥ë¥´¥ê¥º¥àÅù¤ò²Ã¤¨¤Æ¤¢¤ê¤Þ¤¹¡£
9
 *
10
 * ¹¹¿·ÍúÎò
11
 *       - jcode.pl¤ÎSJIS/EUCȽÄê¤Ë¥³¡¼¥É¤òÍѤ¤¤¿
12
 *                Yasuyuki Furukawa (yasu@on.cs.keio.ac.jp)
13
 */
14
15
#include <stdio.h>
16
#include "config.h"
17
#include "jlibconfig.h"
18
19
static int _detect(unsigned char *str, int expected);
20
static int _detect_euc_or_sjis(unsigned char *str);
21
void printDetectCode(int detected);
22
int detectKanjiCode(char *str);
23
24
25
/* ------------------------------------------------------ ´Á»ú¥³¡¼¥É¤Î¼±ÊÌ --*/
26
27
static int _detect(unsigned char *str, int expected)
28
{
29
  register int c;
30
31
  while((c = (int)*str)!= '\0') {
32
33
    /* JIS ¥³¡¼¥É¤ÎȽÄê */
34
    if(c == ESC) {
35
      if((c = (int)*(++str)) == '\0') return expected; 
36
      if (c == '$') {
37
	if((c = (int)*(++str)) == '\0') return expected; 
38
	/* ESC $ B --> ¿·JIS 
39
	   ESC $ @ --> µìJIS */
40
	if (c == 'B' || c == '@') return JIS;
41
      }
42
#ifdef NECKANJI
43
      if (c == 'K')
44
	return NEC;    /* ESC K --> NEC JIS */
45
#endif
46
      str++;
47
      continue;
48
    }
49
    
50
    /* SJIS ¤Ë°ì°Õ¤Ë·èÄê */
51
    if ((c >= 129 && c <= 141) || (c >= 143 && c <= 159))
52
        return SJIS;
53
    /* SS2 */
54
    if (c == SS2) {
55
      if((c = (int)*(++str)) == '\0') return expected; 
56
      if ((c >= 64 && c <= 126) || (c >= 128 && c <= 160) || 
57
	  (c >= 224 && c <= 252)) return SJIS;
58
      if (c >= 161 && c <= 223) expected = EUCORSJIS;
59
      str++;
60
      continue;
61
    }
62
63
    if (c >= 161 && c <= 223) {
64
      if((c = (int)*(++str)) == '\0') return expected; 
65
      
66
      if (c >= 240 && c <= 254)
67
	return EUC;
68
      if (c >= 161 && c <= 223) {
69
	expected = EUCORSJIS;
70
	str++;
71
	continue;
72
      }
73
      if (c <= 159) return SJIS;
74
      if (c >= 240 && c <= 254) return EUC;
75
     
76
      if (c >= 224 && c <= 239) {
77
	expected = EUCORSJIS;
78
	while (c >= 64) {
79
	  if (c >= 129) {
80
	    if (c <= 141 || (c >= 143 && c <= 159))
81
	      return SJIS;
82
	    else if (c >= 253 && c <= 254) {
83
	      return EUC;
84
	    }
85
	  }
86
	  if((c = (int)*(++str)) == '\0') return EUCORSJIS; 
87
	}
88
	str++;
89
	continue;
90
      }
91
      
92
      if (c >= 224 && c <= 239) {
93
        if((c = (int)*(++str)) == '\0') return expected; 
94
        if ((c >= 64 && c <= 126) || (c >= 128 && c <= 160))
95
          return SJIS;
96
        if (c >= 253 && c <= 254) return EUC;
97
        if (c >= 161 && c <= 252)
98
          expected = EUCORSJIS;
99
      }
100
    }
101
    str++;
102
  }
103
  return expected;
104
}
105
106
/* ---------------------------------------------------SJIS ¤« EUC ¤ÎȽÄê -- */
107
/* ÆüËܸì¤ÎÆÃħ(¤Ò¤é¤¬¤Ê¡¢¥«¥¿¥«¥Ê)¤«¤éȽÄꤹ¤ë¤¿¤á¡¢
108
   ȽÄê¥ß¥¹¤¬È¯À¸¤¹¤ë¾ì¹ç¤â¤¢¤ê¤Þ¤¹¡£ */
109
110
static int _detect_euc_or_sjis(unsigned char *str) {
111
  int c1, c2;
112
  int euc_c = 0, sjis_c = 0;
113
  unsigned char *ptr;
114
  static int expected = EUCORSJIS;
115
116
#ifdef USE_CACHE_KANA_NARABI
117
  if (expected != EUCORSJIS)
118
      return expected;
119
#endif
120
121
  ptr = str, c2 = 0;
122
  while ((c1 = (int)*ptr++) != '\0') {
123
      if ((c2 >  0x80 && c2 < 0xa0) && (c2 >= 0xe0 && c2 < 0xfd) &&
124
	  (c1 >= 0x40 && c1 < 0x7f) && (c1 >= 0x80 && c1 < 0xfd))
125
	  sjis_c++, c1 = *ptr++;
126
      c2 = c1;
127
  }
128
  if (sjis_c == 0)
129
      expected = EUC;
130
  else {
131
      ptr = str, c2 = 0;
132
      while ((c1 = (int)*ptr++) != '\0') {
133
	  if ((c2 > 0xa0  && c2 < 0xff) &&
134
	      (c1 > 0xa0  && c1 < 0xff))
135
	    euc_c++, c1 = *ptr++;
136
	  c2 = c1;
137
      }
138
      if (sjis_c > euc_c)
139
	  expected = SJIS;
140
      else
141
	  expected = EUC;
142
  }
143
  return expected;
144
}
145
146
/* ---------------------------------------------------------- Public ´Ø¿ô -- */
147
148
149
#ifdef DEBUG
150
void printDetectCode(int detected) {
151
  switch(detected) {
152
  case ASCII:
153
    fprintf(stderr, "ASCII/JIS-Roman characters(94 printable)\n");
154
    break;
155
  case JIS:
156
    fprintf(stderr, "JIS(iso-2022-jp)\n");
157
    break;
158
  case EUC:
159
    fprintf(stderr, "EUC(x-euc-jp)\n");
160
    break;
161
  case SJIS:
162
    fprintf(stderr, "SJIS(x-sjis)\n");
163
    break;
164
  case NEW:
165
    fprintf(stderr, "JIS X 0208-1990\n");
166
    break;
167
  case OLD:
168
    fprintf(stderr, "JIS X 0208-1978\n");
169
    break;
170
  case EUCORSJIS:
171
    fprintf(stderr, "EUC or SJIS\n");
172
    break;
173
  default:
174
    printf("Another Codes!!\n");
175
  }
176
}
177
#endif
178
179
int detectKanjiCode(char *str)
180
{
181
  static int detected = ASCII;
182
183
  if(!str) return (0);
184
185
  /* JIS, EUC, SJIS, EUCORSJIS ¤ÎȽÄê */
186
  detected = _detect((unsigned char *)str, ASCII);
187
188
  /* ¿·JIS, µìJIS, NEC JIS ¤Î¾ì¹ç¡¢JIS ¤ËÊѹ¹¤¹¤ë */
189
  if(detected == NEW || detected == OLD || detected == NEC)
190
    return JIS;
191
192
  /* SJIS ¤« EUC ¤Î¶èÊ̤ò¥«¥Ê¤ÎʤӤ«¤é¿äÄꤹ¤ë */
193
  if(detected == EUCORSJIS)
194
#ifdef KANA_NARABI
195
    detected = _detect_euc_or_sjis((unsigned char *)str);
196
#else
197
    detected = EUC;  /* ¥Ç¥Õ¥©¥ë¥È EUC */
198
#endif
199
#ifdef DEBUG
200
    printDetectCode(detected);
201
#endif
202
203
  return detected;
204
}
(-)a2ps-4.13.ORIG/libjcode/jlib.h (+17 lines)
Line 0 Link Here
1
/*
2
 *  jlib.h -- jlib.c ÍѤΥإåÀ¥Õ¥¡¥¤¥ë  by. ÁÒ¸÷ ·¯Ïº
3
 *
4
 *  jlib.c ¤òÍøÍѤ¹¤ë¾ì¹ç¤Ï¡¢include ¤·¤Æ¤¯¤À¤µ¤¤¡£
5
 *
6
 */
7
8
#define ASCII         0
9
#define JIS           1
10
#define EUC           2
11
#define SJIS          3
12
13
extern int detectKanjiCode(char *str);
14
extern char *toStringJIS(char *str);
15
extern char *toStringEUC(char *str);
16
extern char *toStringSJIS(char *str);
17
extern char *toStringAuto(char *str);
(-)a2ps-4.13.ORIG/libjcode/jlibconfig.h (+42 lines)
Line 0 Link Here
1
/*
2
 * config.h
3
 */
4
5
#define ASCII         0
6
#define JIS           1
7
#define EUC           2
8
#define SJIS          3
9
#define NEW           4
10
#define OLD           5
11
#define NEC           6
12
#define EUCORSJIS     7
13
#define NUL           0
14
#define LF            10
15
#define FF            12
16
#define CR            13
17
#define ESC           27
18
#define SS2           142
19
#define TRUE          1
20
#define FALSE         0
21
22
/* Ⱦ³Ñ¥«¥Ê(SJIS) ¤ò¶¯À©Åª¤ËÁ´³Ñ¥«¥Ê¤ËÊѹ¹¤¹¤ë */
23
#undef NO_HANKAKU_SJIS
24
25
/* ¤Ò¤é¤¬¤Ê¡¢¥«¥¿¥«¥Ê¤ÎʤӤ«¤é EUC , SJIS ¤ò¿äÄꤹ¤ë */
26
#define KANA_NARABI
27
28
/* EUC , SJIS ¤ò¿äÄê¤ò»Ï¤á¤Î°ìÅÙ¤·¤«¹Ô¤Ê¤ï¤Ê¤¤ */
29
/* (¥Õ¥¡¥¤¥ë¤ò°ì¤Ä¤·¤«¤Ò¤é¤«¤Ê¤¤¤Ê¤éÍ­¸ú¤Ç¤¤¤¤) */
30
#undef USE_CACHE_KANA_NARABI
31
32
/* strdup´Ø¿ô¤¬¥·¥¹¥Æ¥à¤Ë¤¢¤ì¤Ðdefine */
33
#define HAVE_STRDUP     1
34
35
/* ¥Ç¥Ð¥Ã¥¯ÍѤδؿô¤òÍ­¸ú¤Ë¤¹¤ë */
36
#undef DEBUG
37
38
/* ¥í¥±¡¼¥ë̾(Âçʸ»ú¡¢¾®Ê¸»ú¤Ï¶èÊ̤µ¤ì¤Ê¤¤) */
39
#define SJIS_LOCALE_NAME  "ja_JP.SJIS", "ja_JP.PCK"
40
#define JIS_LOCALE_NAME   "ja_JP.JIS", "ja_JP.jis7"
41
#define EUC_LOCALE_NAME   "ja_JP.ujis", "ja_JP.EUC",\
42
                          "ja_JP.eucJP","japanese", "ja"
(-)a2ps-4.13.ORIG/libjcode/libjcode.c (+554 lines)
Line 0 Link Here
1
/* 
2
 *  libjcode.c -- ´Á»úÊÑ´¹¥é¥¤¥Ö¥é¥ê    1.0 ÈÇ
3
 *                (C) Kuramitsu Kimio, Tokyo Univ. 1996-97
4
 *
5
 *  ¤³¤Î¥é¥¤¥Ö¥é¥ê¤Ï¡¢CGI Programming with C and Perl ¤Î¤¿¤á¤Ë
6
 *  Ken Lunde Ãø ¡ÖÆüËܸì¾ðÊó½èÍý¡× (O'llery) ¤ò»²¹Í¤Ë¤·¤Æ¡¢
7
 *  ¥¹¥È¥ê¡¼¥àÍѤÀ¤Ã¤¿jconv.c ¤ò¡¢¥¹¥È¥ê¥ó¥°Âбþ¤Ë¤·¤Æ¥é¥¤¥Ö¥é¥ê²½
8
 *  ¤·¤Þ¤·¤¿¡£ 
9
 *  ¤¿¤À¤·¡¢CGI (INTERNET)¤Ç¤ÎÍøÍѤò¹Í¤¨¤Æ¡¢Êѹ¹¤·¤Æ¤¢¤ê¤Þ¤¹¡£
10
 */
11
 
12
#include <stdio.h>
13
#include <stdlib.h>
14
#include <string.h>
15
#include <locale.h>
16
#include "jlib.h"
17
#include "config.h"
18
#include "jlibconfig.h"
19
 
20
extern int detectKanjiCode(char *str);
21
static unsigned char *_to_jis(unsigned char *str);
22
static unsigned char *_to_ascii(unsigned char *str);
23
static void _jis_shift(int *p1, int *p2);
24
static void _sjis_shift(int *p1, int *p2);
25
static unsigned char *_sjis_han2zen(unsigned char *str, int *p1, int *p2);
26
static void _shift2seven(unsigned char *str, unsigned char *str2);
27
static void _shift2euc(unsigned char *str, unsigned char *str2);
28
static void _shift_self(unsigned char *str, unsigned char *str2);
29
static void _euc2seven(unsigned char *str, unsigned char *str2);
30
static void _euc2shift(unsigned char *str, unsigned char *str2);
31
static unsigned char *_skip_esc(unsigned char *str, int *esc_in);
32
static void _seven2shift(unsigned char *str, unsigned char *str2);
33
static void _seven2euc(unsigned char *str, unsigned char *str2);
34
35
36
37
#define CHAROUT(ch) *str2 = (unsigned char)(ch); str2++;
38
39
#ifndef HAVE_STRDUP
40
#define strdup(str)  _strdup(str)
41
static char *_str_dup(unsigned char *buf) {
42
43
  unsigned char *p, *str;
44
  if((str = (char *)malloc(strlen(buf) + 1)) == NULL) {
45
    fprintf(stderr, "Can't malloc string buffer\n");
46
    exit(2);
47
  }
48
49
  p = (unsigned char *)str;
50
   
51
  while(*buf)
52
    *p++ = *buf++;
53
54
  *p = '\0';
55
56
  return str;
57
}
58
#endif
59
60
/* --------------------------------------- JIS(ISO-2022) ¥³¡¼¥É¤ØÀÚ¤êÂØ¤¨ -- */
61
62
static unsigned char *_to_jis(unsigned char *str) {
63
  *str = (unsigned char)ESC; str++;
64
  *str = (unsigned char)'$'; str++;
65
  *str = (unsigned char)'B'; str++;
66
  return str;
67
}
68
69
/* ----------------------------------------------- ASCII ¥³¡¼¥É¤ØÀÚ¤êÂØ¤¨ -- */
70
71
/* ESC ( B ¤È ESC ( J ¤Î°ã¤¤¡£
72
   ËÜÍè¤Ï¡¢ ESC ( J ¤¬Àµ¤·¤¤JIS-Roman ÂηϤǤ¢¤ë¤¬¡¢
73
   ¥¤¥ó¥¿¡¼¥Í¥Ã¥È¤Î¾å¤Ç¤Ï¡¢±Ñ¿ô»ú¤ÏASCII ¤ÎÊý¤¬¼«Á³¤«¤È»×¤ï¤ì¤ë¡£
74
   \ µ­¹æ¤È ~µ­¹æ¤¬°ã¤¦¤À¤±¤Ç¤¢¤ë¡£ */
75
76
static unsigned char *_to_ascii(unsigned char *str) {
77
  *str = (unsigned char)ESC; str++;
78
  *str = (unsigned char)'('; str++;
79
  *str = (unsigned char)'B'; str++;
80
  return str;
81
}
82
83
/* -------------------------------------- JIS ¥³¡¼¥É ¤ò SJIS¤È¤·¤Æ¥·¥Õ¥È -- */
84
85
static void _jis_shift(int *p1, int *p2)
86
{
87
  unsigned char c1 = *p1;
88
  unsigned char c2 = *p2;
89
  int rowOffset = c1 < 95 ? 112 : 176;
90
  int cellOffset = c1 % 2 ? (c2 > 95 ? 32 : 31) : 126;
91
92
  *p1 = ((c1 + 1) >> 1) + rowOffset;
93
  *p2 += cellOffset;
94
}
95
96
/* --------------------------------- SJIS ¥³¡¼¥É¤òJIS ¥³¡¼¥É¤È¤·¤Æ¥·¥Õ¥È -- */
97
98
static void _sjis_shift(int *p1, int *p2)
99
{
100
  unsigned char c1 = *p1;
101
  unsigned char c2 = *p2;
102
  int adjust = c2 < 159;
103
  int rowOffset = c1 < 160 ? 112 : 176;
104
  int cellOffset = adjust ? (c2 > 127 ? 32 : 31) : 126;
105
106
  *p1 = ((c1 - rowOffset) << 1) - adjust;
107
  *p2 -= cellOffset;
108
}
109
110
/* ---------------------------------------------- SJIS Ⱦ³Ñ¤òÁ´³Ñ¤ËÊÑ´¹ -- */
111
#define HANKATA(a)  (a >= 161 && a <= 223)
112
#define ISMARU(a)   (a >= 202 && a <= 206)
113
#define ISNIGORI(a) ((a >= 182 && a <= 196) || (a >= 202 && a <= 206) || (a == 179))
114
115
static int stable[][2] = {
116
    {129,66},{129,117},{129,118},{129,65},{129,69},{131,146},{131,64},
117
    {131,66},{131,68},{131,70},{131,72},{131,131},{131,133},{131,135},
118
    {131,98},{129,91},{131,65},{131,67},{131,69},{131,71},{131,73},
119
    {131,74},{131,76},{131,78},{131,80},{131,82},{131,84},{131,86},
120
    {131,88},{131,90},{131,92},{131,94},{131,96},{131,99},{131,101},
121
    {131,103},{131,105},{131,106},{131,107},{131,108},{131,109},
122
    {131,110},{131,113},{131,116},{131,119},{131,122},{131,125},
123
    {131,126},{131,128},{131,129},{131,130},{131,132},{131,134},
124
    {131,136},{131,137},{131,138},{131,139},{131,140},{131,141},
125
    {131,143},{131,147},{129,74},{129,75}};
126
127
static unsigned char *_sjis_han2zen(unsigned char *str, int *p1, int *p2)
128
{
129
  register int c1, c2;
130
131
  c1 = (int)*str; str++;
132
  *p1 = stable[c1 - 161][0];
133
  *p2 = stable[c1 - 161][1];
134
135
  /* Âù²»¡¢È¾Âù²»¤Î½èÍý */
136
  c2 = (int)*str;
137
  if (c2 == 222 && ISNIGORI(c1)) {
138
    if ((*p2 >= 74 && *p2 <= 103) || (*p2 >= 110 && *p2 <= 122))
139
      (*p2)++;
140
    else if (*p1 == 131 && *p2 == 69)
141
      *p2 = 148;
142
    str++;
143
  }
144
145
  if (c2 == 223 && ISMARU(c1) && (*p2 >= 110 && *p2 <= 122) ) {
146
    *p2 += 2;
147
    str++;
148
  }
149
  return str++;
150
}
151
152
/* -------------------------------------------------- SJIS ¥³¡¼¥É¤òÊÑ´¹ -- */
153
154
#define SJIS1(A)    ((A >= 129 && A <= 159) || (A >= 224 && A <= 239))
155
#define SJIS2(A)    (A >= 64 && A <= 252)
156
157
static void _shift2seven(unsigned char *str, unsigned char *str2)
158
{
159
  int p1,p2,esc_in = FALSE;
160
161
  while ((p1 = (int)*str) != '\0') {
162
163
    if (SJIS1(p1)) {
164
      if((p2 = (int)*(++str)) == '\0') break;
165
      if (SJIS2(p2)) {
166
        _sjis_shift(&p1,&p2);
167
        if (!esc_in) {
168
          esc_in = TRUE;
169
          str2 = _to_jis(str2);
170
        }
171
      }
172
      CHAROUT(p1);
173
      CHAROUT(p2);
174
      str++;
175
      continue;
176
    }
177
178
#ifdef NO_HANKAKU_SJIS
179
    /* Ⱦ³Ñ SJIS ¤Ï¡¢¶¯À©Åª¤ËÁ´³Ñ¤ËÊѤ¨¤ë */
180
    if (HANKATA(p1)) {
181
      str = _sjis_han2zen(str, &p1, &p2);
182
      _sjis_shift(&p1,&p2);
183
      if (!esc_in) {
184
        esc_in = TRUE;
185
        str2 = _to_jis(str2);
186
      }
187
      CHAROUT(p1);
188
      CHAROUT(p2);
189
      continue;
190
    }
191
#endif
192
193
    if (esc_in) {
194
      /* LF / CR ¤Î¾ì¹ç¤Ï¡¢Àµ¾ï¤Ë¥¨¥¹¥±¡¼¥×¥¢¥¦¥È¤µ¤ì¤ë */
195
      esc_in = FALSE;
196
      str2 = _to_ascii(str2);
197
    }
198
    CHAROUT(p1);
199
    str++;
200
  }
201
202
  if (esc_in)
203
    str2 = _to_ascii(str2);
204
  *str2='\0';
205
}
206
207
/* --------------------------------------------- SJIS ¤ò EUC ¤ËÊÑ´¹¤¹¤ë -- */
208
209
static void _shift2euc(unsigned char *str, unsigned char *str2)
210
{
211
  int p1,p2;
212
  
213
  while ((p1 = (int)*str) != '\0') {
214
    if (SJIS1(p1)) {
215
      if((p2 = (int)*(++str)) == '\0') break;
216
      if (SJIS2(p2)) {
217
        _sjis_shift(&p1,&p2);
218
        p1 += 128;
219
        p2 += 128;
220
      }
221
      CHAROUT(p1);
222
      CHAROUT(p2);
223
      str++;
224
      continue;
225
    }
226
227
#ifdef NO_HANKAKU_SJIS
228
    /* Ⱦ³Ñ SJIS ¤Ï¡¢¶¯À©Åª¤ËÁ´³Ñ¤ËÊѤ¨¤ë */
229
    if (HANKATA(p1)) {
230
      str = _sjis_han2zen(str,&p1,&p2);
231
      _sjis_shift(&p1,&p2);
232
      p1 += 128;
233
      p2 += 128;
234
      CHAROUT(p1);
235
      CHAROUT(p2);
236
      continue;
237
    }
238
#endif
239
    CHAROUT(p1);
240
    str++;
241
  }
242
  *str2='\0';
243
}
244
245
/* ------------------------------------------------- Ⱦ³Ñ SJIS ¤ò¼è¤ê½ü¤¯ -- */
246
247
static void _shift_self(unsigned char *str, unsigned char *str2)
248
{
249
  int p1,p2;
250
  
251
  while ((p1 = (int)*str) != '\0') {
252
#ifdef NO_HANKAKU_SJIS
253
    /* Ⱦ³Ñ SJIS ¤Ï¡¢¶¯À©Åª¤ËÁ´³Ñ¤ËÊѤ¨¤ë */
254
    if (HANKATA(p1)) {
255
      str = _sjis_han2zen(str, &p1, &p2);
256
      CHAROUT(p1);
257
      CHAROUT(p2);
258
      continue;
259
    }
260
#endif
261
    CHAROUT(p1);
262
    str++;
263
  }
264
  *str2='\0';
265
}
266
267
/* ------------------------------------------------------EUC ¤«¤é JIS ¤Ø -- */
268
269
#define ISEUC(A)    (A >= 161 && A <= 254)
270
271
static void _euc2seven(unsigned char *str, unsigned char *str2)
272
{
273
  int p1, p2, esc_in = FALSE;
274
275
  while ((p1 = (int)*str) != '\0') {
276
277
    if (p1 == LF || p1 == CR) {
278
      if (esc_in) {
279
        esc_in = FALSE;
280
        str2 = _to_ascii(str2);
281
      }
282
      CHAROUT(p1);
283
      str++;
284
      continue;
285
    }
286
287
    if (ISEUC(p1)) {
288
      if((p2 = (int)*(++str)) == '\0') break;
289
      if (ISEUC(p2)) {
290
291
	if (!esc_in) {
292
	  esc_in = TRUE;
293
	  str2 =_to_jis(str2);
294
	}
295
296
	CHAROUT(p1-128);
297
	CHAROUT(p2-128);
298
	str++;
299
	continue;
300
      }
301
    }
302
303
    if (esc_in) {
304
      esc_in = FALSE;
305
      str2 = _to_ascii(str2);
306
    }
307
    CHAROUT(p1);
308
    str++;
309
  }
310
  *str2='\0';
311
}
312
313
/* ------------------------------------------------ EUC ¤«¤é SJIS ¤ËÊÑ´¹ -- */
314
 
315
static void _euc2shift(unsigned char *str, unsigned char *str2)
316
{
317
  int p1,p2;
318
319
  while ((p1 = (int)*str) != '\0') {
320
    if (ISEUC(p1)) {
321
      if((p2 = (int)*(++str)) == '\0') break;
322
      if (ISEUC(p2)) {
323
	p1 -= 128;
324
        p2 -= 128;
325
        _jis_shift(&p1,&p2);
326
      }
327
      CHAROUT(p1);
328
      CHAROUT(p2);
329
      str++;
330
      continue;
331
    }
332
333
    CHAROUT(p1);
334
    str++;
335
  }
336
  *str2='\0';
337
}
338
339
/* -------------------------------------- ESC ¥·¡¼¥±¥ó¥¹¤ò¥¹¥­¥Ã¥×¤¹¤ë ----- */
340
341
static unsigned char *_skip_esc(unsigned char *str, int *esc_in) {
342
  int c;
343
  
344
  c = (int)*(++str);
345
  if ((c == '$') || (c == '(')) str++;
346
  if ((c == 'K') || (c == '$')) *esc_in = TRUE;
347
  else *esc_in = FALSE;
348
349
  if(*str != '\0') str++;
350
  return str;
351
}
352
353
354
/* ----------------------------------------------- JIS ¤ò SJIS ¤ËÊÑ´¹¤¹¤ë -- */
355
356
static void _seven2shift(unsigned char *str, unsigned char *str2)
357
{
358
  int p1, p2, esc_in = FALSE;
359
360
  while ((p1 = (int)*str) != '\0') {
361
362
    /* ESC¥·¡¼¥±¥ó¥¹¤ò¥¹¥­¥Ã¥×¤¹¤ë */
363
    if (p1 == ESC) {
364
      str = _skip_esc(str, &esc_in);
365
      continue;
366
    }
367
368
    if (p1 == LF || p1 == CR) {
369
      if (esc_in) esc_in = FALSE;
370
    }
371
372
    if(esc_in) { /* ISO-2022-JP ¥³¡¼¥É */
373
      if((p2 = (int)*(++str)) == '\0') break;
374
375
      _jis_shift(&p1, &p2);
376
377
      CHAROUT(p1);
378
      CHAROUT(p2);
379
    }else{       /* ASCII ¥³¡¼¥É */
380
      CHAROUT(p1);
381
    }
382
    str++;
383
  }
384
  *str2 = '\0';
385
}
386
387
/* ------------------------------------------------ JIS ¤ò EUC ¤ËÊÑ´¹¤¹¤ë -- */
388
389
static void _seven2euc(unsigned char *str, unsigned char *str2)
390
{
391
  int p1, esc_in = FALSE;
392
393
  while ((p1 = (int)*str) != '\0') {
394
395
    /* ESC¥·¡¼¥±¥ó¥¹¤ò¥¹¥­¥Ã¥×¤¹¤ë */
396
    if (p1 == ESC) {
397
      str = _skip_esc(str, &esc_in);
398
      continue;
399
    }
400
401
    if (p1 == LF || p1 == CR) {
402
      if (esc_in) esc_in = FALSE;
403
    }
404
405
    if(esc_in) { /* ISO-2022-JP ¥³¡¼¥É */
406
      CHAROUT(p1 + 128); 
407
      
408
      if((p1 = (int)*(++str)) == '\0') break;
409
      CHAROUT(p1 + 128);
410
    }else{       /* ASCII ¥³¡¼¥É */
411
      CHAROUT(p1);
412
    }
413
    str++;
414
  }
415
  *str2 = '\0';
416
}
417
418
/* ------------------------------------------------------------------------ */
419
/* --------------------------------------------------------- Public ´Ø¿ô -- */
420
char *toStringJIS(char *str) {
421
  int detected;
422
  unsigned char *buf, *ret;
423
424
  if(!str) return (NULL);
425
  detected = detectKanjiCode(str);
426
  if(detected == ASCII || detected == JIS)
427
    return strdup(str);
428
429
  buf = (unsigned char*)malloc(strlen(str)*2);
430
  if (!buf) return NULL;
431
432
  switch(detected) {
433
  case SJIS :
434
    _shift2seven((unsigned char *)str, buf);
435
    break;
436
  case EUC :
437
    _euc2seven((unsigned char *)str, buf);
438
    break;
439
  default:
440
    free(buf);
441
    return strdup(str);
442
    break;
443
  }
444
445
  ret = strdup(buf);
446
  free(buf);
447
  return ret;
448
}
449
450
char *toStringEUC(char *str) {
451
  int detected;
452
  unsigned char *buf, *ret;
453
454
  if(!str) return (NULL);
455
  detected = detectKanjiCode(str);
456
  if(detected == ASCII || detected == EUC) return strdup(str);
457
458
  buf = (unsigned char*)malloc(strlen(str)*2);
459
  if (!buf) return NULL;
460
461
  switch(detected) {
462
  case SJIS :
463
    _shift2euc((unsigned char *)str, buf);
464
    break;
465
  case JIS :
466
  case NEW : case OLD : case NEC :
467
     _seven2euc((unsigned char *)str, buf);
468
    break;
469
  default:
470
    free(buf);
471
    return strdup(str);
472
    break;
473
  }
474
475
  ret = strdup(buf);
476
  free(buf);
477
  return ret;
478
}
479
480
char *toStringSJIS(char *str) {
481
  int detected;
482
  unsigned char *buf, *ret;
483
484
  if (!str) return NULL;
485
  detected = detectKanjiCode(str);
486
  if(detected == ASCII) return strdup(str);
487
  
488
  buf = (unsigned char*)malloc(strlen(str)*2);
489
  if (!buf) return NULL;
490
491
  switch(detected) {
492
  case NEW : case OLD : case NEC :
493
  case JIS :
494
    _seven2shift((unsigned char *)str, buf);
495
    break;
496
  case EUC :
497
    _euc2shift((unsigned char *)str, buf);
498
    break;
499
  case SJIS :  
500
  default:
501
    _shift_self((unsigned char *)str, buf);
502
  }
503
504
  ret = strdup(buf);
505
  free(buf);
506
  return ret;
507
}
508
509
char *toStringAuto(char *str) {
510
  static int  jpcode = -1;
511
  static char *sjis_locale_name[] = {SJIS_LOCALE_NAME, NULL};
512
  static char *jis_locale_name[]  = {JIS_LOCALE_NAME, NULL};
513
  static char *euc_locale_name[]  = {EUC_LOCALE_NAME, NULL};
514
  static struct LOCALETABLE {
515
    int code;
516
    char **name_list;
517
  } locale_table[] = { {SJIS, sjis_locale_name},
518
		     {EUC, euc_locale_name},
519
		     {JIS, jis_locale_name}};
520
521
  if(!str) return (NULL);
522
523
  if (jpcode == -1) {
524
    char *ctype = setlocale(LC_CTYPE, "");
525
    int i, j;
526
    for( j=0; jpcode == -1 && 
527
	      j < sizeof(locale_table)/sizeof(struct LOCALETABLE); j++ ) {
528
      char **name = locale_table[j].name_list;
529
      for( i=0; name[i]; i++ )
530
	if (strcasecmp(ctype, name[i]) == 0) {
531
	  jpcode = locale_table[j].code;
532
	  break;
533
	}
534
    }
535
    if(jpcode == -1)
536
        jpcode = ASCII;
537
  }
538
539
  switch (jpcode) {
540
    case SJIS:
541
      return (toStringSJIS(str));
542
    break;
543
    case JIS:
544
    case NEW : case OLD : case NEC :
545
      return (toStringJIS(str));
546
    break;
547
    case EUC:
548
      return (toStringEUC(str));
549
    break;
550
    default:
551
      return (strdup(str));
552
    break;
553
  }
554
}
(-)a2ps-4.13.ORIG/libjcode/sample.c (+41 lines)
Line 0 Link Here
1
/*
2
  sample.c -- ¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à   by. ÁÒ¸÷ ·¯Ïº, 1996
3
4
  ¤³¤Î¥×¥í¥°¥é¥à¤Ï¡¢¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à¤Ç¤¹¡£
5
  ɸ½àÆþÎϤ«¤éÆÉ¤ß¹þ¤ó¤À¥Æ¥­¥¹¥È¤ò¥ª¥×¥·¥ç¥ó¤Ë¤¢¤ï¤»¤Æ¡¢
6
  ¥³¡¼¥ÉÊÑ´¹¤·¤Þ¤¹¡£
7
*/
8
9
#include <stdio.h>
10
#include <string.h>
11
#include "jlib.h"
12
13
extern void printDetectCode(int code);
14
15
void main(int ac, char *av[]) {
16
  char buffer[BUFSIZ];
17
  int mode=JIS;
18
19
  if(ac == 2) {
20
    if(!strcmp(av[1], "-e")) mode = EUC;
21
    if(!strcmp(av[1], "-s")) mode =SJIS;
22
  }
23
24
  while(fgets(buffer,BUFSIZ,stdin) != NULL) {
25
    switch(mode) {
26
    case EUC:
27
      printf("%s", toStringEUC(buffer));
28
      break;
29
    case SJIS:
30
      printf("%s", toStringSJIS(buffer));
31
      break;
32
    default:
33
      printf("%s", toStringJIS(buffer));
34
      break;
35
    }
36
  }
37
  exit(0);
38
}
39
40
41
(-)a2ps-4.13.ORIG/ps/base.ps (-1 / +143 lines)
Lines 153-159 Link Here
153
% Return the y size of the current font
153
% Return the y size of the current font
154
% - => fontsize
154
% - => fontsize
155
/currentfontsize {
155
/currentfontsize {
156
  currentfont /FontMatrix get 3 get 1000 mul
156
  currentfont /FontType get 0 eq {
157
    currentfont /FontMatrix get 3 get
158
  }{
159
    currentfont /FontMatrix get 3 get 1000 mul
160
  } ifelse
157
} bind def
161
} bind def
158
162
159
% reencode the font
163
% reencode the font
Lines 200-205 Link Here
200
  end 
204
  end 
201
} bind def
205
} bind def
202
206
207
% composite fonts for ASCII-EUC mixed string
208
% Version 1.2 1/31/1990
209
% Orignal Ken'ichi HANDA (handa@etl.go.jp)
210
% Modified Norio Katayama (katayama@rd.nacsis.ac.jp),1998
211
% Extend & Fix Koji Nakamaru (maru@on.cs.keio.ac.jp), 1999
212
% Anyone can freely copy, modify, distribute this program.
213
214
/copyfont {	% font-dic extra-entry-count  copyfont  font-dic
215
	1 index maxlength add dict begin
216
	{	1 index /FID ne 2 index /UniqueID ne and
217
		{def} {pop pop} ifelse
218
	} forall
219
	currentdict
220
	end
221
} bind def
222
223
/compositefont { % ASCIIFontName EUCFontName RomanScale RomanOffset Rot(T/F) compositefont font
224
    /RomanRotation exch def
225
    /RomanOffset exch def
226
    /RomanScale exch def
227
    userdict /fixeucfont_dict known not {
228
	userdict begin
229
	    /fixeucfont_dict 2 dict begin
230
		/UpperByteEncoding [
231
		    16#00 1 16#20 { pop 0 } for
232
		    16#21 1 16#28 { 16#20 sub } for
233
		    16#29 1 16#2F { pop 0 } for
234
		    16#30 1 16#74 { 16#27 sub } for
235
		    16#75 1 16#FF { pop 0 } for
236
		] def
237
	        /LowerByteEncoding [
238
		    16#00 1 16#A0 { pop /.notdef } for
239
		    16#A1 1 16#FE { 16#80 sub 16 2 string cvrs
240
				    (cXX) dup 1 4 -1 roll
241
				    putinterval cvn } for
242
		    /.notdef
243
		] def
244
		currentdict
245
	    end def
246
	end
247
    } if
248
    findfont dup /FontType get 0 eq {
249
	14 dict begin
250
	    %
251
	    % 7+8 bit EUC font
252
	    %
253
	    12 dict begin
254
		/EUCFont exch def
255
		/FontInfo (7+8 bit EUC font) readonly def
256
		/PaintType 0 def
257
		/FontType 0 def
258
		/FontMatrix matrix def
259
		% /FontName
260
		/Encoding fixeucfont_dict /UpperByteEncoding get def
261
		/FMapType 2 def
262
		EUCFont /WMode known
263
		{ EUCFont /WMode get /WMode exch def }
264
		{ /WMode 0 def } ifelse
265
		/FDepVector [
266
		    EUCFont /FDepVector get 0 get
267
		    [ 16#21 1 16#28 {} for 16#30 1 16#74 {} for ]
268
		    {
269
			13 dict begin
270
			    /EUCFont EUCFont def
271
			    /UpperByte exch 16#80 add def	
272
			    % /FontName
273
			    /FontInfo (EUC lower byte font) readonly def
274
			    /PaintType 0 def
275
			    /FontType 3 def
276
			    /FontMatrix matrix def
277
			    /FontBBox {0 0 0 0} def
278
			    /Encoding
279
				fixeucfont_dict /LowerByteEncoding get def
280
			    % /UniqueID
281
			    % /WMode
282
			    /BuildChar {
283
				gsave
284
				exch dup /EUCFont get setfont
285
				/UpperByte get
286
				2 string
287
				dup 0 4 -1 roll put
288
				dup 1 4 -1 roll put
289
				dup stringwidth setcharwidth
290
				0 0 moveto show
291
				grestore
292
			    } bind def
293
			    currentdict
294
			end
295
			/lowerbytefont exch definefont
296
		    } forall
297
		] def
298
		currentdict
299
	    end
300
	    /eucfont exch definefont
301
	    exch
302
	    findfont 1 copyfont dup begin
303
		RomanRotation {
304
			/FontMatrix FontMatrix
305
			[ 0 RomanScale neg RomanScale 0 RomanOffset neg 0 ]
306
			matrix concatmatrix def
307
		}{
308
			/FontMatrix FontMatrix
309
			[ RomanScale 0 0 RomanScale 0 RomanOffset ] matrix concatmatrix
310
			def
311
			/CDevProc
312
			    {pop pop pop pop 0 exch -1000 exch 2 div 880} def
313
		} ifelse
314
	    end
315
	    /asciifont exch definefont
316
	    exch
317
	    /FDepVector [ 4 2 roll ] def
318
	    /FontType 0 def
319
	    /WMode 0 def
320
	    /FMapType 4 def
321
	    /FontMatrix matrix def
322
	    /Encoding [0 1] def
323
	    /FontBBox {0 0 0 0} def
324
%	    /FontHeight 1.0 def % XXXX
325
	    /FontHeight RomanScale 1.0 ge { RomanScale }{ 1.0 } ifelse def
326
	    /Descent -0.3 def   % XXXX
327
	    currentdict
328
	end
329
	/tmpfont exch definefont
330
	pop
331
	/tmpfont findfont
332
    }{
333
	pop findfont 0 copyfont
334
    } ifelse
335
} def	
336
337
/slantfont {	% FontName slant-degree  slantfont  font'
338
    exch findfont 1 copyfont begin
339
    [ 1 0 4 -1 roll 1 0 0 ] FontMatrix exch matrix concatmatrix
340
    /FontMatrix exch def
341
    currentdict
342
    end
343
} def
344
203
% Function print line number (<string> # -)
345
% Function print line number (<string> # -)
204
/# {
346
/# {
205
  gsave
347
  gsave
(-)a2ps-4.13.ORIG/src/Makefile.am (-2 / +2 lines)
Lines 49-56 Link Here
49
# I don't really understand why I have to put srcdir here, but
49
# I don't really understand why I have to put srcdir here, but
50
# it is needed for yacc and lex files (seems related to #line, but
50
# it is needed for yacc and lex files (seems related to #line, but
51
# I really don't understand why)...
51
# I really don't understand why)...
52
INCLUDES = -I.. -I$(srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/intl
52
INCLUDES = -I.. -I$(srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/intl -I$(top_builddir)/libjcode
53
53
54
a2ps_LDADD = $(top_builddir)/lib/liba2ps.la @LIBINTL@ -lm
54
a2ps_LDADD = $(top_builddir)/lib/liba2ps.la @LIBINTL@ @LEXLIB@ @LIBJCODELIBS@ -lm
55
55
56
EXTRA_DIST = $(BUILT_SOURCES)
56
EXTRA_DIST = $(BUILT_SOURCES)
(-)a2ps-4.13.ORIG/src/Makefile.in (-2 / +2 lines)
Lines 304-311 Link Here
304
# I don't really understand why I have to put srcdir here, but
304
# I don't really understand why I have to put srcdir here, but
305
# it is needed for yacc and lex files (seems related to #line, but
305
# it is needed for yacc and lex files (seems related to #line, but
306
# I really don't understand why)...
306
# I really don't understand why)...
307
INCLUDES = -I.. -I$(srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/intl
307
INCLUDES = -I.. -I$(srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/intl -I$(top_builddir)/libjcode
308
a2ps_LDADD = $(top_builddir)/lib/liba2ps.la @LIBINTL@ -lm
308
a2ps_LDADD = $(top_builddir)/lib/liba2ps.la @LIBINTL@ @LEXLIB@ @LIBJCODELIBS@ -lm
309
EXTRA_DIST = $(BUILT_SOURCES)
309
EXTRA_DIST = $(BUILT_SOURCES)
310
all: $(BUILT_SOURCES)
310
all: $(BUILT_SOURCES)
311
	$(MAKE) $(AM_MAKEFLAGS) all-am
311
	$(MAKE) $(AM_MAKEFLAGS) all-am
(-)a2ps-4.13.ORIG/src/buffer.c (+16 lines)
Lines 41-46 Link Here
41
#include "argmatch.h"
41
#include "argmatch.h"
42
#include "buffer.h"
42
#include "buffer.h"
43
#include <assert.h>
43
#include <assert.h>
44
#ifdef USE_LIBJCODE
45
#include "jlib.h"
46
extern use_libjcode;
47
#endif
44
48
45
/****************************************************************/
49
/****************************************************************/
46
/*		 	Handling of the various eol styles	*/
50
/*		 	Handling of the various eol styles	*/
Lines 418-426 Link Here
418
     match_keyword, which looks one char after the current char.  With
422
     match_keyword, which looks one char after the current char.  With
419
     this sentinel, which is probably not in the alphabet, we save a
423
     this sentinel, which is probably not in the alphabet, we save a
420
     test on the length of the buffer. */
424
     test on the length of the buffer. */
425
#ifdef USE_LIBJCODE
426
  obstack_1grow (&buffer->obstack, '\0');
427
  if (use_libjcode == true)
428
    {
429
      if(buffer->content) free(buffer->content);
430
      buffer->content = toStringEUC(obstack_finish (&buffer->obstack));
431
    }
432
  else
433
      buffer->content = (uchar *) obstack_finish (&buffer->obstack);
434
  buffer->len = strlen(buffer->content);
435
#else
421
  buffer->len = obstack_object_size (&buffer->obstack);
436
  buffer->len = obstack_object_size (&buffer->obstack);
422
  obstack_1grow (&buffer->obstack, '\0');
437
  obstack_1grow (&buffer->obstack, '\0');
423
  buffer->content = (uchar *) obstack_finish (&buffer->obstack);
438
  buffer->content = (uchar *) obstack_finish (&buffer->obstack);
439
#endif
424
440
425
  /* One more line read */
441
  /* One more line read */
426
  buffer->line++;
442
  buffer->line++;

Return to bug 205799