% JBibTeX `jplain' family
	% version 0.30 for JBibTeX versions 0.30 or later, LaTeX version 2.09.
	% Copyright (C) 1990, all rights reserved.
	%
	% This file is derived from btxbst.doc of BibTeX 0.99c
	%
	% Copying of this file is authorized only if either
	% (1) you make absolutely no changes to your copy, including name, or
	% (2) if you do make changes, you name it something other than
	% jbtxbst.doc, jplain.bst, junsrt.bst, jalpha.bst, jabbrv.bst,
	% tipsj.bst, jipsj.bst, tieice.bst, jname.bst, jorsj.bst
	%
	% This restriction helps ensure that all standard styles are identical.
	% The file jbtxbst.doc has the documentation for this style.
	%
	% Please notify Shouichi MATSUI(matsui@denken.or.jp) of any bugs in
	% these standard styles or in this documentation file.
	% $B>>0f(B $B@50l(B  ($B:b(B) $BEENOCf1{8&5f=j!!>pJs8&5f=j(B  $B>pJs2J3XIt(B
	% Last update 1994-10-25
%
% $B$3$N%U%!%$%k(B jbtxbst.doc $B$O;29MJ88%%9%?%$%k$NM}2r$r=u$1$k$?$a!$(Bcpp $B$J$I$r(B
% $B;H$C$F!$0c$&%9%?%$%k$r:n@.$9$k>l9g$N?w7?$H$7$F;H$&$?$a$NJ*$G$"$k!%(B
% Oren Patashnik $B;a$K$h$k!$(Bbtxbst.doc $B$rK]Lu$9$k$H$H$b$K!$F|K\8lMQ$K=$@5!$DI2C(B
% $B$r2C$($?$b$N$G$"$k!%(B
%
% $BI8=`%9%?%$%k$O0J2<$N$h$&$K$7$F@8@.$7$?8e!$(B
%	cpp -P -DJPLAIN jbtxbst.doc jplain.txt
%	cpp -P -DJUNSRT jbtxbst.doc junsrt.txt
%	cpp -P -DJALPHA jbtxbst.doc jalpha.txt
%	cpp -P -DJABBRV jbtxbst.doc jabbrv.txt
%	cpp -P -DTIPSJ jbtxbst.doc tipsj.txt
%	cpp -P -DJIPSJ jbtxbst.doc jipsj.txt
%	cpp -P -DTIEICE jbtxbst.doc tieic.txt
%	cpp -P -DJORSJ jbtxbst.doc jorsj.txt
%	cpp -P -DJNAME jbtxbst.doc jname.txt
% $BITMW$J%3%a%s%H9T!$6u9T$r:o=|$7$?8e!$%U%!%$%kL>$rJQ99$9$l$P@8@.$G$-$k!%(B
% ($B<B:]$K$O8e=R$N(B cpp.awk $B$r;H$C$F(B gawk $B$G@8@.$7$?!K!%(B
% 
% ASCII $BHG$N(B versinn 0.98 $B$K4p$E$/(B Kanji BibTeX $B$G;H$o$l$F$$$k(B jplain, jalpha,
% junsrt, jabbrv $B$K6a$$7A$N(B bst $B%U%!%$%k$r:n$k$K$O!$(B
%
%	cpp -P -DJPLAIN -DASCII98 jbtxbst.doc jplain98.txt
%
% $B$H$$$&$h$&$K(B, -DASCII98 $B$rDI2C$9$k!%40A4$KF1$8$G$O$J$$$,!$$+$J$j6a$$7A$N(B
% $BJ88%%j%9%H%G!<%?(B(bbl)$B$,F@$i$l$k$h$&$J%9%?%$%k%U%!%$%k$rF@$k$3$H$,$G$-$k!%(B
%
% cpp $B$r;}$C$F$$$J$$$H$+!$(B(PC $BMQ$N(B)C $B%3%s%Q%$%i!<$N(B cpp $B$K$h$C$F$O>e5-$NMM$K(B
% $B=hM}$G$-$J$$>l9g$,$"$k!%(BTurbo C 2.0 $B$N(B cpp $B$O8-$32a$.$F!$>e5-$NL\E*(B
% $B$K$O;H$($J$$!%$^$?9TF,$K(B # $B$,$J$/$F$b$=$l$r(B cpp $B$X$N;XNa$@$H$_$J$9=hM}7O$G$b(B
% $B$&$^$/$$$+$J$$>l9g$,$"$k!%(B
% cpp $B$G$&$^$/=hM}$G$-$J$$>l9g$K;H$($k(B gawk $BMQ$N%9%/%j%W%H$r(B bst/cpp.awk $B$H$$$&(B
% $B7A$GMQ0U$7$F$"$k!%;H$$J}$K$D$$$F$O(B bst/generate.[bat|sh] $B$r8+$h!*(B
%
% UNIX $B$N(B cpp $B$G$O=hM}$G$-$k$3$H$r4|BT$9$k!%>/$J$/$H$b(B SUN $B$N(B cpp $B$G$O(B
% $B=hM}$G$-$?!%(B
%
% $BIT9,$K$7$F(B cpp $B$,;H$($J$$$H$+!$(B gawk $B$b$J$$$H$+$N>l9g$K$O!$0J2<$N@bL@$r(B
% $B;29M$K$7$F?M4V(B cpp $B$K$J$C$F!$(Beditor $B$r;H$C$FJT=8$7$F:n$j=P$;$P$$$$!%(B
% ($B$3$s$JIT9,$J$3$H$O$J$$$G$7$g$&$M!)!K(B
%
% cpp $B$N=PNO$OFCDj$N9T$,:o=|$5$l$k!J$"$k$$$O6uGr9T$,IU2C$5$l$k!K$3$H$r=|$1$P(B
% $BF~NO$HF1$8$G$"$k!%0J2<$N%7!<%/%(%s%9$O!$(B# $BJ8;z$,Bh#1%+%i%`$K$"$k$H$7$F!$(B
%	#if VAR
%	    VAR $B$,(B 0 $B$G$J$$;~$K4^$a$k9T(B
%	#else
%	    VAR $B$,(B 0 $B$N;~$K4^$a$k9T(B
%	#endif
%
% VAR $B$NCM$K1~$8$F$I$A$i$N9T72$,;H$o$l$k$+!$4^$^$l$k$h$&$K$J$k$+$r<($9!%(B
% #else $BItJ,$O$J$/$F$b$h$$!%(B#else, #endif $B$N8e$K$O%3%a%s%H$r=q$/;v$,$G$-$k!%(B
% $BJQ?t$O(B
%	#define VAR value
% $B$GCM$r@_Dj$G$-!$(B #ifdef VAR $B$G(B VAR $B$,CM$r;}$C$F$$$k$+!JDj5A$5$l$F$$$k$+!K!$(B
% #ifndef VAR $B$G(B VAR $B$,CM$r;}$C$F$$$J$$$+!JL$Dj5A$+!K$rD4$Y$k$3$H$,$G$-$k!%(B
% $B$3$N%U%!%$%kCf$G;H$C$F$$$k$b$&#1$D$N7A<0$O(B #if !VAR $B$G$"$j!$$3$l$O(B VAR $B$N(B
% $BCM$,(B 0 $B$N;~$K8eB3$N9T72$r4^$a$k$h$&$K$9$k$b$N$G$"$k!%(B
%
% $B5,Ls(B: $B%W%j%W%m%;%C%5$N$?$a$NJQ?t$H$7$F$O!$$9$Y$FBgJ8;z$r;H$&$3$H$K$9$l$P!$(B
% $B!!!!!!$I$3$K$"$k$+8+$D$1$k$N$,4JC1$K$J$k!%(B
%
% $B8@$$Lu(B: cpp $B$N5!G=$r%U%k$K;H$&$h$&$K=q$1$P!$$3$N%U%!%$%k$O$b$C$H>.$5$/$G$-$k!%(B
%         $B$7$+$7!$:n6H$7$?4D6-$G$O$A$c$s$H;H$($k(B cpp $B$,$J$+$C$?$N$G!$(B
%         $B%*%j%8%J%k$G;H$C$F$$$J$+$C$?5!G=$O;H$C$F$$$J$$!%(B
%
% cpp $B$X$N(B(gawk $B$X$N(B)$B%3%^%s%I9T$G$O!$(BJPLAIN, JUNSRT, JALPHA, JABBRV, JIPSJ,
% TIPSJ, TIEICE, JNAME, JORSJ $B$N$$$:$l$+$r;XDj$7$F$*$/$3$H!J$I$l$G$b$J$$$H!$(B
% JPLAIN $B$r%G%#%U%)!<%k%H$H$7$F;H$&$h$&$K$J$C$F$$$k!%=>$C$F?7$7$$%9%?%$%k$r(B
% $B:n$j=P$9>l9g$K$O!$$3$N%G%#%U%)%k%H$r@_Dj$7$F$$$kItJ,$r=q$-49$($k$3$H!K!%(B
%
% $B$=$l$>$l$NO@M}JQ?t$O!$$=$l$>$l$N%9%?%$%k$G!$??(B(1)$B$+56(B(0)$B$K@_Dj$7$F$*$/$3$H!%(B
% $B8=:_;H$C$F$$$kJQ?t$H$=$N0UL#$O0J2<$NDL$j$G$"$k!%(B
%
%	LAB_ALPH:	$BJ8;zNs%i%Y%k$r@8@.(B($B$3$l$,56$J$i?t;z%i%Y%k$K$J$k(B)
%	SORTED:		($B?t;z%i%Y%k$G$J$$$J$i!K%i%Y%k!$Cx<T$J$I$N>pJs$r(B
%			$B;H$C$F$K%=!<%H$9$k(B($B56$J$i%=!<%H$5$l$:$K!$=P8==g$KJB$V(B)
%	NAME_FULL:	$BCx<T!$JT<T$NL>A0$H$7$F(B bibliography file $BCf$K=q$+$l$?(B
%			$BJ*$r$=$N$^$^;H$&(B($B56$J$i@+0J30$O%$%K%7%c%k$@$1$K$J$k!%(B
%			$B4A;zI=5-$5$l$?Cx<T$N>l9g$K$O!$@+$HL>$N4V$K%9%Z!<%9$,(B
%			$B$"$l$P!$@+$@$1$K$J$k(B)
%	ATIT_LOWER:	$BK\0J30!JO@J8$J$I!K$N%?%$%H%k$O@hF,$NJ8;z!$%3%m%s$N8e$N(B
%			$B:G=i$NJ8;z0J30$O>.J8;z$K$9$k(B($B56$J$i(B database $BCf$N$^$^(B)
%	MONTH_FULL:	$B7n$NL>A0$r>JN,7A$H$7$J$$(B($B56$J$i>JN,7A(B)
%	JOUR_FULL:	$BO@J8;o!$;(;o$J$I$r>JN,7A$H$7$J$$(B($B56$J$i>JN,7A!$8=:_$O(B
%			$B$=$N7A<0$O(B ACM $B$N=PHGJ*$K$"$k7A<0$G$"$k(B)
%----------------------------------------------------------------------
% $B>>0f$K$h$kDI2CJ,(B
%	 IN_LOWER:		In $B$G$J$/(B in$B!!$r;H$&!%(B
%	 ONE_SENTENCE:  	1$BJ8$N7A$K$9$k!%(B
%	 ED_SHORT:		Editor $B$G$J$/(B Ed.
%	 FAMILY_FIRST:		$B1Q8lI=5-Cx<T$N@+$r@h$K!$L>$r8e$K$9$k!%(B
%        FIRST_FAMILY_FIRST:    $B1Q8lI=5-Cx<T$NBh0lCx<T$@$1@+$r@h$K$9$k!%(B
%	 NO_COM_AND:		3$BL>0J>e$NCx<T$N;~(B and $B$NA0$K(B , $B$rF~$l$J$$!%(B
%	 SMALL_CAP:		$BI=Bj$O(B small cap $B%U%)%s%H!%(B
%	 KANJI_FULL_NAME:	$B4A;zCx<TL>$OL>$^$G=P$9!%(B
%	 ED_IN_PAR :		$BJT=8<TL>$r3g8L$KF~$l$k!%(B
%	 NO_EM:			$BK\!$;(;oL>$H$+$K6/D4;XDj(B($B%$%?%j%C%/(B)$B$O;H$o$J$$!%(B
%	 YEAR_IN_PAR:		$BG/$r3g8L$G0O$`!%(B
%	 ZENKAKU_PUN:		$BF|K\8lJ88%$KBP$7$F$OA43Q$N(B"$B!$(B","$B!%(B","$B!'(B"$B$r;H$&!%(B
%	 ZENKAKU_COLON:		$B#1J87A<0$N;~!$F|K\8lCx<T$N8e$K$OA43Q$N%3%m%s$r(B
%				$BIU$1$k!%(B
%	 JIPSJ_LIKE:    	JIPSJ $B$N$h$&$JC;$$(B Vol., pp. $B;2>H7A<0(B
%				Vol.=V, No.=N, pp. C--D, year=Y, month=M $B$r(B
%				V, N(M Y), C--D $B$N$h$&$J=gHV$GJB$Y$k!%(B
%	 USE_FIRST_ONLY:	$BJ8;zNs%i%Y%k$K$OBh#1Cx<T$7$+;H$o$J$$!%(B
%	 USE_KANJI_HOKA:	``$B$[$+(B''$B$G$J$/(B``$BB>(B''$B$r;H$&(B
%	 SHOW_BOOK_PAGES:	BOOK $B$N%Z!<%8?t$b=PNO$9$k!%(B
%----------------------------------------------------------------------
%
% $B%G%#%U%)!<%k%H$N%9%?%$%k$N;XDj!J?7$7$$%9%?%$%k$r2C$($k>l9g$K$O$3$3$r(B
% $BJQ99$9$kI,MW$,$"$k!%JQ99$7$F$*$+$J$$$H(B jplain $B$K$J$C$F$7$^$&!*!K(B
%
#ifndef JUNSRT
#   ifndef JALPHA
#	ifndef JABBRV
#           ifndef TIPSJ
#	       ifndef JIPSJ
#		  ifndef TIEICE
#		    ifndef JNAME
#		      ifndef JORSJ
#		        define JPLAIN 1
#		      endif  JORSJ
#		    endif  JNAME
#		  endif  TIEICE
#	       endif  JIPSJ
#           endif  TIPSJ
#	endif  JABBRV
#   endif  JALPHA
#endif
%
% ASSCII98 $B$,Dj5A$5$l$F$$$l$P!$(BASCII $BHG$N(B 0.98 $B$K4p$E$/(B Kanji BibTeX $B$N(B
% $B%9%?%$%k%U%!%$%k$r;H$C$FF@$i$l$k7k2L$K6a$$$b$N$,F@$i$l$k$h$&$K$9$k!%(B
% $B$^$C$?$/F1$8$K$J$k$H4|BT$7$F$O$$$1$J$$!*!*!*(B
%
#ifdef ASCII98
#   define ZENKAKU_PUN 1
#   define ZENKAKU_COLON 1
#else !ASCII98
#   define ZENKAKU_PUN 0
#endif
%
#ifdef JPLAIN
% jplain $B%9%?%$%k(B ($B%=!<%H$5$l$??tCM%i%Y%k(B)
#   define LAB_ALPH 0
#   define SORTED 1
#   define NAME_FULL 1
#   define ATIT_LOWER 1
#   define MONTH_FULL 1
#   define JOUR_FULL 1
%--------------------------------------
#   define IN_LOWER  0
#   define ONE_SENTENCE 0
#   define ED_SHORT 0
#   define FAMILY_FIRST 0
#   define FIRST_FAMILY_FIRST 0
#   define NO_COM_AND 0
#   define SMALL_CAP 0
#   define KANJI_FULL_NAME 0
#   define ED_IN_PAR  0
#   define NO_EM 0
#   define YEAR_IN_PAR 0
#   define JIPSJ_LIKE 0
#   define USE_KANJI_HOKA 0
#   define SHOW_BOOK_PAGES 0
%--------------------------------------
#endif JPLAIN
%
#ifdef JUNSRT
% junsrt $B%9%?%$%k(B ($B%=!<%H$5$l$J$$?tCM%i%Y%k(B)
#   define LAB_ALPH 0
#   define SORTED 0
#   define NAME_FULL 1
#   define ATIT_LOWER 1
#   define MONTH_FULL 1
#   define JOUR_FULL 1
%--------------------------------------
#   define IN_LOWER  0
#   define ONE_SENTENCE 0
#   define ED_SHORT 0
#   define FAMILY_FIRST 0
#   define FIRST_FAMILY_FIRST 0
#   define NO_COM_AND 0
#   define SMALL_CAP 0
#   define KANJI_FULL_NAME 0
#   define ED_IN_PAR  0
#   define NO_EM 0
#   define YEAR_IN_PAR 0
#   define JIPSJ_LIKE 0
#   define USE_KANJI_HOKA 0
#   define SHOW_BOOK_PAGES 0
%--------------------------------------
#endif JUNSRT
%
#ifdef JALPHA
% jalpha $B%9%?%$%k(B ($B%=!<%H$5$l$?J8;zNs%i%Y%k(B)
#   define LAB_ALPH 1
#   define SORTED 1
#   define NAME_FULL 1
#   define ATIT_LOWER 1
#   define MONTH_FULL 1
#   define JOUR_FULL 1
%--------------------------------------
#   define USE_FIRST_ONLY 0
#   define IN_LOWER  0
#   define ONE_SENTENCE 0
#   define ED_SHORT 0
#   define FAMILY_FIRST 0
#   define FIRST_FAMILY_FIRST 0
#   define NO_COM_AND 0
#   define SMALL_CAP 0
#   define KANJI_FULL_NAME 0
#   define ED_IN_PAR  0
#   define NO_EM 0
#   define YEAR_IN_PAR 0
#   define JIPSJ_LIKE 0
#   define USE_KANJI_HOKA 0
#   define SHOW_BOOK_PAGES 0
%--------------------------------------
#endif JALPHA
%
#ifdef JABBRV
% jabbrv $B%9%?%$%k(B ($B%=!<%H$5$l$??tCM%i%Y%k$G!$>JN,7A<0(B)
#   define LAB_ALPH 0
#   define SORTED 1
#   define NAME_FULL 0
#   define ATIT_LOWER 1
#   define MONTH_FULL 0
#   define JOUR_FULL 0
%--------------------------------------
#   define IN_LOWER  0
#   define ONE_SENTENCE 0
#   define ED_SHORT 1
#   define FAMILY_FIRST 0
#   define FIRST_FAMILY_FIRST 0
#   define NO_COM_AND 0
#   define SMALL_CAP 0
#   define KANJI_FULL_NAME 0
#   define ED_IN_PAR  0
#   define NO_EM 0
#   define YEAR_IN_PAR 0
#   define JIPSJ_LIKE 0
#   define USE_KANJI_HOKA 1
#   define SHOW_BOOK_PAGES 0
%--------------------------------------
#endif JABBRV
%
#ifdef TIPSJ
% tipsj $B%9%?%$%k(B ($B%=!<%H$5$l$J$$?tCM%i%Y%k$G!$>JN,7A!$#1J87A<0(B)
% $B>pJs=hM}3X2qO@J8;o!$>pJs=hM}3X2q;oMQ(B
#   define LAB_ALPH 0
#   define SORTED 0
#   define NAME_FULL 0
#   define ATIT_LOWER 0
#   define MONTH_FULL 0
#   define JOUR_FULL 0
%--------------------------------------
#   define IN_LOWER  1
#   define ONE_SENTENCE 1
#   define ED_SHORT 1
#   define FAMILY_FIRST 1
#   define FIRST_FAMILY_FIRST 0
#   define NO_COM_AND 1
#   define SMALL_CAP 0
#   define KANJI_FULL_NAME 1
#   define ED_IN_PAR  0
#   define NO_EM 0
#   define YEAR_IN_PAR 1
#   define JIPSJ_LIKE 0
#   define ZENKAKU_COLON 1
#   define USE_KANJI_HOKA 1
#   define SHOW_BOOK_PAGES 1
%--------------------------------------
#endif TIPSJ
%
#ifdef JIPSJ
% jipsj $B%9%?%$%k(B ($B%=!<%H$5$l$??tCM%i%Y%k$G!$>JN,7A$r;H$&!$#1J87A<0(B)
% Journal of Information Processing ($B>pJs=hM}3X2q(B)
#   define LAB_ALPH 0
#   define SORTED 1
#   define NAME_FULL 0
#   define ATIT_LOWER 0
#   define MONTH_FULL 0
#   define JOUR_FULL 0
%--------------------------------------
#   define IN_LOWER  1
#   define ONE_SENTENCE 1
#   define ED_SHORT 1
#   define FAMILY_FIRST 1
#   define FIRST_FAMILY_FIRST 0
#   define NO_COM_AND 1
#   define SMALL_CAP 1
#   define KANJI_FULL_NAME 1
#   define ED_IN_PAR  1
#   define NO_EM 0
#   define YEAR_IN_PAR 1
#   define JIPSJ_LIKE 1
#   define ZENKAKU_COLON 0
#   define USE_KANJI_HOKA 1
#   define SHOW_BOOK_PAGES 0
%--------------------------------------
#endif JIPSJ
%
#ifdef TIEICE
% tieic $B%9%?%$%k(B ($B%=!<%H$5$l$J$$?tCM%i%Y%k$G!$>JN,7A$r;H$&!$#1J87A<0(B)
% $BEE;R>pJsDL?.3X2qO@J8;o(B
#   define LAB_ALPH 0
#   define SORTED 0
#   define NAME_FULL 0
#   define ATIT_LOWER 1
#   define MONTH_FULL 0
#   define JOUR_FULL 0
%--------------------------------------
#   define IN_LOWER  1
#   define ONE_SENTENCE 1
#   define ED_SHORT 1
#   define FAMILY_FIRST 0
#   define FIRST_FAMILY_FIRST 0
#   define NO_COM_AND 1
#   define SMALL_CAP 0
#   define KANJI_FULL_NAME 0
#   define ED_IN_PAR  1
#   define NO_EM 1
#   define YEAR_IN_PAR 1
#   define JIPSJ_LIKE 0
#   define ZENKAKU_COLON 1
#   define USE_KANJI_HOKA 1
#   define SHOW_BOOK_PAGES 0
%--------------------------------------
#endif TIEICE
%
#ifdef JNAME
% jname $B%9%?%$%k(B ($B%=!<%H$5$l$?J8;zNs%i%Y%k$G!$>JN,7A$r;H$&!$#1J87A<0(B)
% $BJ8;zNs%i%Y%k$K$OBh#1Cx<T$NL>A0$7$+;H$o$J$$!%(B
#   define LAB_ALPH 1
#   define SORTED 1
#   define NAME_FULL 0
#   define ATIT_LOWER 0
#   define MONTH_FULL 0
#   define JOUR_FULL 0
%--------------------------------------
#   define USE_FIRST_ONLY 1
#   define IN_LOWER  1
#   define ONE_SENTENCE 1
#   define ED_SHORT 1
#   define FAMILY_FIRST 0
#   define FIRST_FAMILY_FIRST 1
#   define NO_COM_AND 0
#   define SMALL_CAP 0
#   define KANJI_FULL_NAME 0
#   define ED_IN_PAR  0
#   define NO_EM 0
#   define YEAR_IN_PAR 0
#   define JIPSJ_LIKE 0
#   define ZENKAKU_COLON 1
#   define USE_KANJI_HOKA 1
#   define SHOW_BOOK_PAGES 0
%--------------------------------------
#endif JNAME
%
#ifdef JORSJ
% jorsj $B%9%?%$%k(B ($B%=!<%H$5$l$??tCM%i%Y%k$G!$>JN,7A$r;H$&!$#1J87A<0(B)
% Journal of the Operations Research Society of Japan
% $BF|K\%*%Z%l!<%7%g%s%:%j%5!<%A3X2qO@J8;o!J1QJ8!$OBJ8$N$I$A$i$G$bNI$$!*!K(B
#   define LAB_ALPH 0
#   define SORTED 1
#   define NAME_FULL 0
#   define ATIT_LOWER 0
#   define MONTH_FULL 0
#   define JOUR_FULL 0
%--------------------------------------
#   define IN_LOWER  1
#   define ONE_SENTENCE 1
#   define ED_SHORT 1
#   define FAMILY_FIRST 1
#   define FIRST_FAMILY_FIRST 0
#   define NO_COM_AND 1
#   define SMALL_CAP 0
#   define KANJI_FULL_NAME 1
#   define ED_IN_PAR  0
#   define NO_EM 0
#   define YEAR_IN_PAR 0
#   define JIPSJ_LIKE 1
#   define ZENKAKU_COLON 1
#   define USE_KANJI_HOKA 1
#   define SHOW_BOOK_PAGES 0
%--------------------------------------
#endif JORSJ
%
%   $B%(%s%H%j$N%U%)!<%^%C%H7A<0!'(B Mary-Claire van Leunen $B$,(B
%	"A Handbook for Scholars" $B$G?d>)$7$F$$$k7A<0$K6a$$!%K\$NCg4V$NI=Bj$O(B
%	$B%$%?%j%C%/BN$G(B($B6/D4$5$l$F(B)$B!$$=$l0J30$NI=Bj$O(B($BEE;R>pJsDL?.3X2qO@J8;o$r(B
%	$B=|$$$F!$0zMQId$J$7$G!KJ8$N7A<0$GBgJ8;z!$>.J8;z$,;H$o$l$k!%(B
%	$B$3$N%U%!%$%k$G$O!$#1J8$N7A<0$G%U%)!<%^%C%H$9$k%9%?%$%k0J30$G$O!$(B
%	$B<g$?$k%V%m%C%/$N4V$K(B \newblock(\newline $B$d(B \newpage $B$K;w$?L>A0(B)$B$r(B
%	$B=PNO$9$k$N$G!$(B\ducumentstyle $B$N0z?t$H$7$F(B `openbib' $B%*%W%7%g%s$r;XDj(B
%	$B$9$k$3$H$G!$(Bopen $B7A<0$N%j%9%H!$$9$J$o$A%V%m%C%/4V$G2~9T$5$l!$%V%m%C%/(B
%	$BFb$G$O%$%s%G%s%H$5$l$?7A<0$N%j%9%H$rF@$k;v$,$G$-$k!%(B
%	$B%G%#%U%)!<%k%H$O(B closed $B7A<0$G$"$j!$%V%m%C%/Kh$K2~9T$5$l$?$j$7$J$$!%(B
%
%   $BJ88%%j%9%H$NJ8;zNs%i%Y%k$N7A<0$O0J2<$NDL$j!%(B
%		[Knu73] $BCx<T!JJT<T!$%-!<!K$,#1?M$N;~(B
%		[AHU83] $BJ#?tCx<T$N;~$O@+$NF,J8;z$rJB$Y$?$b$N(B
%			(Aho, Hopcroft, Ulman $B$N>l9g$K$O(B AHU $B$H$J$k(B)
%
%   $BJ88%%j%9%H$N?tCM%i%Y%k$N7A<0$O0J2<$NDL$j!%(B
%		[number]
%
%   $BJ8;zNs%i%Y%k$N7A<0$N%=!<%H$O0J2<$NDL$j!J<!$N=g$GJ88%$,JB$V!K!%(B
%		$B<g%-!<$,%i%Y%k!$<!$,Cx<T!JJT<T$J$I$N>l9g$b$"$k!K!$(B
%		$B$=$N<!$,G/!$:G8e$,I=Bj$N%"%k%U%!%Y%C%H=g$GJB$Y$i$l$k!%(B
%
%		$B4A;zCx<TL>$N>l9g$K$O(B yomi $B%U%#!<%k%I$K%m!<%^;zI=5-$rF~$l$F(B
%		$BCV$/;v$G!$J8;zNs%i%Y%k$N%i%Y%k$K$J$k!%=q$-J}$r9)IW$9$l$P!$(B
%		$BF|K\8l$N%i%Y%k$H$9$k$3$H$b$G$-!$$5$i$K#5#02;=g$KJB$Y$k$3$H$b(B
%		$B$G$-$k!%>\$7$/$O(B jbtxdoc.tex $B$r8+$h!%(B
%
%   $B?tCM%i%Y%k$N7A<0$N%=!<%H$O0J2<$NDL$j!J<!$N=g$GJ88%$,JB$V!K!%(B
%		$B<g%-!<$,Cx<T!JJT<T$J$I$N>l9g$b$"$k!K!$<!$,G/!$:G8e$,I=Bj$N(B
%		$B%"%k%U%!%Y%C%H=g$GJB$Y$i$l$k!%(B
%
%		$B4A;zCx<TL>$N>l9g$K$O(B yomi $B%U%#!<%k%I$K%m!<%^;zI=5-$rF~$l$F(B
%		$BCV$/;v$G!$%"%k%U%!%Y%C%H=g$K$J$k!%=q$-J}$r9)IW$9$l$P!$#5#02;(B
%		$B=g$KJB$Y$k$3$H$b$G$-$k!%>\$7$/$O(B jbtxdoc.tex $B$r8+$h!%(B
%
%   $B%=!<%H$5$l$J$$>l9g$NJ88%$N=gHV!'(B
%		$BK\J8Cf$N0zMQ=g!%(B
%
%   History
%   12/16/84	(HWT)	Original `plain' version, by Howard Trickey.
%   12/23/84	(LL)	Some comments made by Leslie Lamport.
%    2/16/85	(OP)	Changes based on LL's comments, Oren Patashnik.
%    2/17/85	(HWT)	Template file and other standard styles made.
%    3/28/85	(OP)	First release, version 0.98b for BibTeX 0.98f.
%    5/ 9/85	(OP)	Version 0.98c for BibTeX 0.98i:
%			fixed Theoretical Computer Science macro name;
%			fixed the format.vol.num.pages function.
%    1/24/88	(OP)	Version 0.99a for BibTeX 0.99a, main changes:
%			assignment operator (:=) arguments reversed;
%			the preamble$ function outputs the database PREAMBLE;
%			entry.max$ and global.max$ (built-in) variables replace
%			entry.string.max and global.string.max functions;
%			alphabetizing by year then title, not just title;
%			many unnecessary ties removed; \it ==> \em;
%			the `alpha' style uses a superscripted `+' instead of a
%			`*' for unnamed names in constructing the label;
%			the `abbrv' style now uses "Mar." and "Sept.";
%			the functions calc.label and presort now look at just
%			the fields they're supposed to;
%			BOOKLET, MASTERSTHESIS, TECHREPORT use nonbook titles;
%			INBOOK and INCOLLECTION take an optional type (e.g.
%			type = "Section"), overriding the default "chapter";
%			BOOK, INBOOK, INCOLLECTION, and PROCEEDINGS now allow
%			either volume or number, not just volume;
%			INCOLLECTION now allows an edition and series field;
%			PROCEEDINGS and INPROCEEDINGS now use the address field
%			to tell where a conference was held;
%			INPROCEEDINGS and PROCEEDINGS now allow either volume
%			or number, and also a series field;
%			MASTERSTHESIS and PHDTHESIS accept types other than
%			"Master's thesis" and "PhD thesis";
%			UNPUBLISHED now outputs, in one block, note then date;
%			MANUAL now prints out the organization in
%			the first block if the author field is empty;
%			MISC can't be empty---it requires some optional field.
%
%  $B0J>e$O1Q8lHG$N(B btxbst.doc $B$NJQ99MzNr$G$"$k!%(B
%
%	1989-06-02 $B>>0f@50l(B(Shouichi Matsui)
%			C version 0.20 $BMQ$KJQ99!$#3$D$N%9%?%$%k$rDI2C(B	
%	1991-01-01 $B>>0f@50l(B(Shouichi Matsui) 
%			C version 0.30 $BMQ$KJQ99$HHyD4@0B??t!*?7$?$J%9%?%$%k$b(B
%			$BDI2C!*(B
%
% $B%(%s%H%j$N%U%#!<%k%I$N@k8@(B
%
%   (April '84 edition $B$N(B 231-232 $B%Z!<%8$K=R$Y$i$l$F$$$k(B) Scribe $B$H(B
%   $BF1$8$h$&$J$b$N$G$"$k$,!$(B(J)BibTeX $B$OL>A0$N=hM}5!G=$r;}$C$F$$$k$N$G!$(B
%   fullauthor $B$"$k$$$O(B editors $B%U%#!<%k%I$O$J$$!%(B
%   annote $B%U%#!<%k%I$OCm<aIU$-$NJ88%%j%9%H%9%?%$%k$r:n$k>l9g$K$O;H$o$l$k$,!$(B
%   $B$3$N%U%!%$%k$GDj5A$7$F$$$k%9%?%$%k$G$O;H$C$F$$$J$$$N$G!$%3%a%s%H%"%&%H(B
%   $B$5$l$F$$$k!%$3$3$K<($7$?%U%#!<%k%I$NB>$K!$AH$_9~$_$NJ88%%j%9%HFb;2>H(B
%   (CROSSREF)$B%U%#!<%k%I$b$"$k$,!$$3$l$K$D$$$F$O8e$G@bL@$9$k!%(B

ENTRY
% $B%U%#!<%k%I72(B:
% $B!!!!0J2<$N@bL@$G!I?7$?$JJ8$r3+;O$9$k!I$N$O#1J87A<0$G%U%)!<%^%C%H$7$J$$!$(B
% $B!!!!%9%?%$%k$N>l9g$K$N$_$"$F$O$^$k!%(B
  { address
%	$BDL>o$O=PHG<R!$5!4X$N=;=j$rF~$l$k!%FI<T$N0Y$K$J$k>l9g$K$N$_F~$l$k$3$H!%(B
%	$BNc$($P!$Bg$-$J=PHG<R$N>l9g$K$O>JN,$9$Y$-$G$"$k!%$7$+$7!$(BPROCEEDINGS
%	$B$^$?$O(B INPROCEEDINGS $B$N>l9g$K$O$3$3$K$O2q5D$N3+:ECO$r=q$/!%$3$N#2$D$N(B
%	$B%(%s%H%j$N7?$G$O!$=PHG<T!$5!4X$N=;=j$,I,MW$J$i!$(Bpublisher $B$+(B
%	organization $B%U%#!<%k%I$K4^$a$k$3$H!%(B
%    annote
%	$BD9$$Cm<a(B($BCm<aIU$-J88%%j%9%HMQ!$?7$?$JJ8$r3+;O$9$k(B)$B!%(B
    author
%	(J)BibTeX $B7A<0$G=q$$$?!$Cx<T$NL>A0(B
    booktitle
%	$B;2>H$5$l$F$$$k$N$,K\A4BN$G$J$$>l9g$K!$K\$NI=Bj$rF~$l$k!%K\A4It$r(B
%	$B;2>H$7$F$$$k>l9g$K$O!$$3$l$G$J$/(B title $B%U%#!<%k%I$r;H$&$3$H!%(B
    chapter
%	$B>O(B($B$"$k$$$O@a$J$I(B)$B$NHV9f!%(B
    edition
%	$BK\$NHG!$(B("Second" $B$J$I$N(B) $B=g=x?t$G$J$$$H$$$1$J$$!%(B
    editor
%	(J)BibTeX $B7A<0$G=q$$$?!$JT<T$NL>A0!%(Bauthor $B%U%#!<%k%I$b$"$k>l9g$K$O(B
%	$BCx:n$,H/I=$5$l$?K\$J$I$NJT<T$NL>A0$r=q$/!%(B
    howpublished
%	$B$3$N4qL/$JJ*$,$I$&$7$F=PHG$5$l$?$+!J?7$?$JJ8$r3+;O$9$k!K!%(B
    institution
%	$B%F%/%K%+%k%l%]!<%H$N%5%]!<%H5!4XL>(B
    journal
%	$BO@J8;o!$;(;o$NL>A0(B($B$$$/$D$+%^%/%m$,MQ0U$5$l$F$$$k(B)$B!%(B
    key
%	$B%"%k%U%!%Y%C%H=g$KJB$Y$k;~!$%i%Y%k$r:n$k;~!$J88%%j%9%HFb;2>H$N%-!<$H$7$F(B
%	$B;H$o$l$k!JCx<T!$JT<T$,$J$$$H$-$KI,MW$G$"$k!K!%(B
    month
%	$B7n(B($B%^%/%m$,MQ0U$5$l$F$$$k(B)$B!%(B
    note
%	$BFI<T$,;2>HJ88%$r8+$D$1$k$N$KLrN)$D>pJs!J?7$?$JJ8$r3+;O$9$k!K!%(B
    number
%	$BO@J8;o!$;(;o!$%F%/%K%+%k%l%]!<%H$NHV9f!$$"$k$$$O%7%j!<%:Cf$NHV9f!%(B
    organization
%	$B2q5D$N%9%]%s%5!<!J$"$k$$$O%^%K%e%"%k$N=PHG<R!K$N5!4XL>$G!$Cx<T!JJT<T!K$,(B
%	$B$J$$>l9g$G!$$3$N>pJs$+$i$G$O%i%Y%k$,4qL/$K$J$k>l9g!$$"$k$$$OJ88%%j%9%HFb(B%	$B;2>H$9$k>l9g$K$O!$E,Ev$J4J7i$J5!4XL>$r(B key $B%U%#!<%k%I$KF~$l$k$3$H!%(B
    pages
%	$B%Z!<%8HV9f!$%Z!<%8?t!$$"$k$$$O%Z!<%8HO0O!JHO0O$O(B `--'  $B$r;H$C$F!$(B
%	$BC1=c$JHO0O$G$O$J$$>l9g$K$O8e$m$K(B `+' $B$rIU$1$F<($9$3$H!K!%(B
    publisher
%	$B=PHG<R(B($B<gBN(B)$B$NL>A0!%(B
    school
%	$B3X9;(B($BBg3X(B)$B$NL>A0!J3X0LO@J8MQ!K!%(B
    series
%	$BJ#?t4,$+$i$J$kK\$N%7%j!<%:L>!$3F!9$NK\$O3F!9$NI=Bj$r;}$C$F$$$k$O$:!%(B
    title
%	$B;2>H$7$F$$$k$b$N$NI=Bj!%(B
    type
%	$B%F%/%K%+%k%l%]!<%H$N>l9g$K%G%#%U%)%k%H$G;H$o$l$k(B "Technical Report"
%	$B$NBe$o$j$NL>>N!JNc$($P(B "Research Note"$B!K!$$"$k$$$O3X0LO@J8$N<oN`!$(B
%	$B$"$k$$$OK\$N%Q!<%H$NL>A0!%(B
    volume
%	$BO@J8;o$J$I$N4,?t!$$"$k$$$OJ#?t4,$N=qJ*$N4,?t!%(B
    year
%	$BG/$O?t;z$@$1$G$J$$$H$$$1$J$$!J@55,2=$7$?8e$G$O!$#4$D$N?t;z$G=*$o$i$J$$(B
%	$B$H$$$1$J$$!%?7$?$JJ8$r3+;O$7$J$$!K!%(B
%	$B><OB(B53$B$H$+$r;H$C$F$b$+$^$o$J$$$,!$(Bjalpha $B$J$I$G@8@.$5$l$k%i%Y%k$,JQ$J(B
%	$B$b$N$K$J$k$3$H$,$"$k$N$GCm0U$9$k$3$H!%(B
    yomi
%	$BCx<T!$JT=8<TL>$N!VFI$_!W$r(Bauthor, editor$B$J$I$N=q<0$G(B
%	$B1Q8lIw$K=q$/!%$R$i$,$J$G=q$1$P0J30$G$O8^==2;=g$N(B
%	$B%=!<%H$b$G$-$k!%>\$7$/$O(B jbtxdoc.tex $B$r8+$h!%(B
  }

% $BF|K\8l$NJ88%$+$I$&$+$N%U%i%0(B
  {is.kanji.entry}

% $B0J2<$NJ8;z7?JQ?t$O0zMQ%i%Y%k$r:n@.$9$k$?$a$K;H$o$l$k!%%a%b%j$,B-$j$J$$(B
% $B>l9g$K$O!$(Bsort.label $B$O(B on the fly $B$K4JC1$K:n@.$G$-$k!%(B

#if LAB_ALPH
#if SORTED
  { label extra.label sort.label }
#else !SORTED

% $BJ8;zNs%i%Y%k$r;H$&>l9g$K!$0zMQ=g$KJB$Y$k$N$ONI$$$H$O;W$($J$$$,!$(B
% $B$=$N>l9g$K$O!$$A$g$C$HJL$N$d$jJ}$G%i%Y%k$r:n$i$J$/$F$O$J$i$J$$!%(B

  { label }
#endif SORTED
#else !LAB_ALPH
  { label }
#endif LAB_ALPH

% $B$=$l$>$l$N%(%s%H%j$N7?$KBP1~$7$?4X?t$O!$@h$:(B output.bibitem $B$r8F$s$G(B
% \bibitem $B$H$=$N0z?t$r(B .BBL $B%U%!%$%k$K=q$-=P$9!%<!$KMM!9$J%U%#!<%k%I$,(B
% $B%U%)!<%^%C%H$5$l(B output $B$+(B output.check $B$K$h$C$F=q$-=P$5$l$k!%$3$l$i$N(B
% $B=PNO4X?t$O6uJ8;zNs$,EO$5$l$F$$$J$$$3$H$r3NG'$7$J$,$i!$6h@Z$j5-9f!J%+%s%^!$(B
% $B%T%j%*%I!$%3%m%s!$(B\newblock$B!K$r=q$-=P$9=hM}$r9T$&!%:G8e$K(B fin.entry $B$,(B
% $B8F$P$l!$J8$N=*$o$j$N%T%j%*%I$r=q$-$@$7$F!$=hM}$,=*N;$9$k!%(B
%
% $B;29MJ88%$O$$$/$D$+$N%V%m%C%/$H$7$F%U%)!<%^%C%H$5$l$k!'(B
% open $B7A<0$G$O!$%V%m%C%/$O?7$7$$9T$r3+;O$7!$%V%m%C%/Cf$G$O%$%s%G%s%H$5$l$k!%(B
% $B%V%m%C%/Cf$K$OJ#?t$NJ8$,$"$C$F$h$$!J$H$O$$$C$F$bJ8K!E*$K$$$&J8$G$O$J$/!$(B
% $B%T%j%*%I$G=*$o$kC18lNs$G$O$"$k$,!K!%%(%s%H%j4X?t$O:G=i$N%V%m%C%/0J30$N(B
% $B%V%m%C%/$r=PNO$9$kA0$K$O(B new.block $B$r8F$P$M$P$J$i$J$$!%(B
% $B$^$??7$7$$J8$r3+;O$9$k>l9g$K$O(B new.sentence $B$r8F$P$M$P$J$i$J$$!%(B
% $B=PNO%k!<%A%s$O!$%T%j%*%I$,#2$DB3$$$?$j$7$J$$$h$&$K!$#2$D$N(B new.sentence
% $B$N4V$K$O!$6uJ8;zNs$G$J$$$b$N$,$"$k$3$H$r3NG'$9$kI,MW$,$"$k!%(B
% new.block $B$K$D$$$F$bF1$8$G$"$k!%(B
%
% $B=PNO%k!<%A%s$O$=$N0z?t$rD>$A$K=PNO$7$J$$!%$=$N$+$o$j$KDL>o$O(B
% $B%9%?%C%/$KCV$-!$(B($B6h@Z$j5-9f$H$7$F2?$,I,MW$+J,$+$C$?;~E@$G(B)$B<!$N(B
% $B=PNO%k!<%A%s$,=PNO$9$k!%=>$C$F=PNO%k!<%A%s$O%9%?%C%/>e$N%G!<%?$K(B
% $BI,MW$J6h@Z$j5-9f$rIU2C$7$F=q$-=P$9I,MW$,$"$k!%(B
%
% $B$I$N6h@Z$j5-9f$,I,MW$+$rH=Dj$9$k$?$a$K!$(Boutput.state $B$r;H$&!%(B
% $B$=$NCM$O0J2<$N$$$:$l$+!%(B
%	before.all		\bibitem $B$ND>8e(B
%	mid.sentence		$BJ8$NESCf!$8eB3$,$"$k>l9g$K$O%+%s%^$,I,MW(B
%	after.sentence		$BJ8$ND>8e!%%T%j%*%I$,I,MW(B
%	after.block		$B%V%m%C%/(B($BJ8(B)$B$ND>8e!%%T%j%*%I$H(B\newblock $B$,I,MW(B
%------------------------------------------------------------------------
%	after.author		$BCx<TL>$N8e(B(: $B$rIU$1$k$N$K;H$&(B)
%------------------------------------------------------------------------
%
%*****************************************************************************
%$BCm0U!'(B
%
%  $B0J2<$N%3%a%s%HCf$G=R$Y$i$l$F$$$k%"%k%4%j%:%`$O!$F|K\8lMQ$N%9%?%$%k%U%!%$%k(B
%  $B$N:n@.$N$?$a$K!$%3!<%I$N$_JQ99$7$?ItJ,$,$"$k$N$G!$<B:]$N%3!<%I$HI,$:$7$b(B
%  $BF1$8$b$N$G$O$J$$!%(B
%
%*****************************************************************************
%
% VAR: output.state : INTEGER		-- $B=PNO$N>uBVJQ?t(B
%
% output.nonnull $B4X?t$O!JEO$5$l$?J*$,6uJ8;zNs$G$J$$$H$7$F!K!$0z?t$r%9%?%C%/(B
% $B$KJ]B8$7!$J]B8$7$F$*$$$?J8;zNs$KI,MW$H$5$l$kE,Ev$J6h@Z$j5-9f$r8e$m$K(B
% $BIU2C$7$F=q$-=P$9!%%F%9%H$N=gHV$OIQEY=g$K$J$C$F$$$k!%(B
%
% $B#1J8$N7A$K$9$k>l9g(B(ONE_SENTENCE$B$,??$N>l9g(B)$B$K$O!$0J2<$H0[$J$k%"%k%4%j%:%`$G(B
% $B$"$k!%<B:]$N%3!<%I$r;2>H$N$3$H!*(B
%
% output.nonnull(s) ==
%  BEGIN
%	s := argument on stack
%	if output.state = mid.sentence then
%	    write$(pop() * ", ")
%		  -- "pop" $B$O4X?t$G$O$J$$!%%9%?%C%/%H%C%W$N%G!<%?$r;H$&!%(B
%	else
%	    if output.state = after.block then
%		write$(add.period$(pop()))
%		newline$
%		write$("\newblock ")
%	    else
%		if output.state = before.all then
%		    write$(pop())
%		else	    -- output.state $B$O(B after.sentence $B$N$O$:(B
%		    write$(add.period$(pop()) * " ")
%		fi
%	    fi
%	    output.state := mid.sentence
%	fi
%	push s on stack
%  END
%
% output $B$O(B $B0z?t$,6u$G$J$$$J$i!J0z?t$OL$Dj5A%U%#!<%k%I$+$b$7$l$J$$$N$G!$(B
% $BI,$:$7$bJ8;zNs$G$O$J$$!K!$(B output.nonnull $B$r8F$S=P$9!%(B
%
% output(s) ==
%  BEGIN
%	if not empty$(s) then output.nonnull(s)
%	fi
%  END
%
% output.check $B$O$[$H$s$I(B output $B4X?t$HF1$8$G$"$k$,!$I,MW$J%U%#!<%k%I$,(B
% $B$J$$$3$H$r%f!<%6!<$K7Y9p$9$k!%!J$3$l$O$=$N%U%#!<%k%I$N$J$$J88%>pJs$O(B
% $BNI$$$b$N$G$O$J$$$3$H$rCN$i$;$k$?$a!$$^$?$=$N%U%#!<%k%I$,$J$/$F$b!$=PNO$5$l$k(B
% $B%U%)!<%^%C%H7A<0$,$^$"$^$"$NJ*$K$J$k$h$&$K$9$k$?$a$G$"$k!K!%(B
%
% output.check(s,t) ==
%  BEGIN
%	if empty$(s) then
%	    warning$("empty " * t * " in " * cite$)
%	else output.nonnull(s)
%	fi
%  END
%
% output.bibitem $B4X?t$O8=:_$N%(%s%H%j$KBP$9$k(B \bibitem $B$r=q$-=P$7(B
%  ($B%i%Y%k$O4{$K$G$-$F$$$k$H2>Dj$9$k(B)$B!$>uBV$K1~$8$?6h@Z$j5-9f$r@_Dj$9$k!%(B
% $B=PNO$N5,Ls$K=>$C$?J8;zNs$r%9%?%C%/$K;D$9!%(B
%
% output.bibitem ==
%  BEGIN
%	newline$
%	write$("\bibitem[")	% $B0J2<#39T$OJ8;zNs%i%Y%kMQ(B
%	write$(label)		%
%	write$("]{")		%
%	write$("\bibitem{")	% $B$3$N9T$O?tCM%i%Y%k$N;~(B
%	write$(cite$)
%	write$("}")
%	push "" on stack
%	output.state := before.all
%  END
%
% fin.entry $B4X?t$O%9%?%C%/$K;D$C$F$$$kJ8;zNs$K%T%j%*%I$rIU2C$7!$%(%s%H%j$N(B
% $B=hM}$r=*$($k!%$b$7>uBV$,$^$@(B before.all $B$G$"$l$P$3$N%(%s%H%j$KBP$7$F$O2?$b(B
% $B=PNO$5$l$F$$$J$$$N$G!$7k2L$OJQ$J$b$N$K$J$k$,!$MxMQ<T$O$=$l$K5$$E$/!%(B
% $BJ88%$O0zMQ$5$l$F$$$k$N$G$"$k$+$i!$0zMQ%i%Y%k$r:n$k$?$a$K(B bibitem $B$O(B
% $BI,MW$G$"$k$+$i!$%(%s%H%j$r>JN,$7$?$j$7$J$$!%(B
%
% fin.entry ==
%  BEGIN
%	write$(add.period$(pop()))
%	newline$
%  END
%
% new.block $B4X?t$O=PNO$9$k?7$?$J%V%m%C%/$N=`Hw$r9T$$!$(B
% new.sentence $B$O?7$?$J%;%s%F%s%9$N=`Hw$r9T$&!%(B
%
% new.block ==
%  BEGIN
%	if output.state <> before.all then
%	    output.state := after.block
%	fi
%  END
%
% new.sentence ==
%  BEGIN
%	if output.state <> after.block then
%	    if output.state <> before.all then
%		output.state :=  after.sentence
%	    fi
%	fi
%  END
%
#if    ONE_SENTENCE
INTEGERS { output.state before.all mid.sentence after.sentence after.block
           after.author}
#else !ONE_SENTENCE
INTEGERS { output.state before.all mid.sentence after.sentence after.block }
#endif ONE_SENTENCE

% $B0J2<$N#3$D$N4X?t$O(B AND, OR, NOT $B$N$?$a$N$b$N$G$"$k!%(B

FUNCTION {not}
{   { #0 }
    { #1 }
  if$
}

FUNCTION {and}
{   'skip$
    { pop$ #0 }
  if$
}

FUNCTION {or}
{   { pop$ #1 }
    'skip$
  if$
}

FUNCTION {init.state.consts}
{ #0 'before.all :=
  #1 'mid.sentence :=
  #2 'after.sentence :=
  #3 'after.block :=
#if    ONE_SENTENCE
  #4 'after.author :=
#endif ONE_SENTENCE
}

% s, t  $B$O:n6HMQ$NJ8;zNsJQ?t(B
STRINGS { s t }

% $BA43Q$N(B"$B!$(B","$B!%!I$r;H$&;~$N$?$a$N4X?t(B
% $B;29MJ88%$O%3%s%Q%/%H$KAH$_$?$$$N$G!$;d$O$3$l$O9%$-$G$O$J$$$,!$(B
% ASCII $BHG$N(B 0.98 $B$G$O$3$N5!G=$,$"$C$?$N$G!%(B

#if   ZENKAKU_PUN
FUNCTION {add.kanji.period}
{
  add.period$ duplicate$
  #-1 #1 substring$ "." =
    {#-2 global.max$ substring$ "$B!%(B" *}
    'skip$
  if$
}
#endif ZENKAKU_PUN

% $BA43Q$N%3%m%s$r;H$&>l9g$K$O$3$NDj5A$O$3$3$K$J$$$H$$$1$J$$!%(B
#if    ZENKAKU_COLON
FUNCTION {field.or.null}
{ duplicate$ empty$
    { pop$ "" }
    'skip$
  if$
}
#endif ZENKAKU_COLON

FUNCTION {output.nonnull}
{ 's :=
  output.state mid.sentence =
#if    ZENKAKU_PUN
    { is.kanji.entry
        { "$B!$(B" * write$ }
        { ", " * write$ }
      if$
    }
#else !ZENKAKU_PUN
    { ", " * write$ }
#endif ZENKAKU_PUN
    { output.state after.block =
	{ 
#if    ZENKAKU_PUN
	  is.kanji.entry
            {add.kanji.period write$}
            {add.period$ write$}
	  if$
#else !ZENKAKU_PUN
          add.period$ write$
#endif ZENKAKU_PUN
	  newline$
	  "\newblock " write$
	}
#if    ONE_SENTENCE
	{ output.state after.author =
#ifdef JIPSJ
	    { " " * write$
#else !JIPSJ
	    { author empty$ editor empty$ and organization empty$ and
		{write$}
#if    ZENKAKU_COLON
		{ author field.or.null is.kanji.str$ 
		  editor field.or.null is.kanji.str$ or
		  organization field.or.null is.kanji.str$ or
		    {"$B!'(B" * write$}
		    {": " * write$}
		  if$
		}
#else !ZENKAKU_COLON
		{": " * write$}
#endif ZENKAKU_COLON
	      if$
#endif JIPSJ
	      mid.sentence 'output.state :=
	    }
	    'write$
	  if$
	}
#else !ONE_SENTENCE
	{ output.state before.all =
	    'write$
#if    ZENKAKU_PUN
	    { is.kanji.entry
		{ add.kanji.period  write$ }
		{ add.period$ " " * write$ }
	      if$
	    }
#else !ZENKAKU_PUN
	    { add.period$ " " * write$ }
#endif ZENKAKU_PUN
	  if$
	}
#endif ONE_SENTENCE
      if$
      mid.sentence 'output.state :=
    }
  if$
  s
}

FUNCTION {output}
{ duplicate$ empty$
    'pop$
    'output.nonnull
  if$
}

FUNCTION {output.check}
{ 't :=
  duplicate$ empty$
    { pop$ "empty " t * " in " * cite$ * warning$ }
    'output.nonnull
  if$
}

FUNCTION {output.bibitem}
{ newline$
#if LAB_ALPH
  "\bibitem[" write$
  label write$
  "]{" write$
#else !LAB_ALPH
  "\bibitem{" write$
#endif LAB_ALPH
  cite$ write$
  "}" write$
  newline$
  ""
  before.all 'output.state :=
}

% $B$3$N4X?t$O%(%s%H%j$N=PNO$r=*$j$K$9$k(B

FUNCTION {fin.entry}
{ 
#if    ZENKAKU_PUN
  is.kanji.entry
    {add.kanji.period}
    {add.period$}
  if$
#else !ZENKAKU_PUN
  add.period$
#endif ZENKAKU_PUN
  write$
  newline$
}

FUNCTION {new.block}
{ output.state before.all =
#if    ONE_SENTENCE
    { after.author 'output.state := }
    'skip$
#else !ONE_SENTENCE
    'skip$
    { after.block 'output.state := }
#endif ONE_SENTENCE
  if$
}

FUNCTION {new.sentence}
{ output.state after.block =
    'skip$
    { output.state before.all =
	'skip$
	{ after.sentence 'output.state := }
      if$
    }
  if$
}

% $B;~$H$7$F!$%V%m%C%/$,==J,$KD9$$>l9g$K$N$_?7$?$J%V%m%C%/$r3+;O$7$J$$$H$$$1$J$$!%(B
% new.block.checka $B4X?t$O$=$N0z?t$,6u$G$J$$>l9g$K(B new.block $B$r<B9T$9$k!%(B
% new.block.checkb $B4X?t$O$=$N#2$D$N0z?t$,$I$A$i$b6u$K$J$$>l9g$K(B new.block $B$r(B
%		   $B<B9T$9$k!%(B

FUNCTION {new.block.checka}
{ empty$
    'skip$
    'new.block
  if$
}

FUNCTION {new.block.checkb}
{ empty$
  swap$ empty$
  and
    'skip$
    'new.block
  if$
}

% new.sentence.check $B4X?t72$bF1$8$h$&$J$b$N(B

FUNCTION {new.sentence.checka}
{ empty$
    'skip$
    'new.sentence
  if$
}

FUNCTION {new.sentence.checkb}
{ empty$
  swap$ empty$
  and
    'skip$
    'new.sentence
  if$
}

% $B%(%s%H%j$N%G!<%?72$r%U%)!<%^%C%H$9$k$?$a$N4X?t72(B
% $B$3$l$i$N4X?t72$G$O!$%+%s%^$"$k$$$O%T%j%*%I!J%T%j%*%I$N8e$K%T%j%*%I$,B3$$$?$j(B
% $B$7$J$$$h$&$K(B add.period$ $B$r;H$C$F!K$rIU$1$i$l$k$h$&$K!$J8;zNs$+6uJ8;zNs(B
% $B$r=PNO$9$k$3$H$r5,Ls$H$9$k!%(B
%
% $BLr$K$?$DJd=u4X?t(B field.or.null $B$O0z?t$,L$Dj5A%U%#!<%k%I!J%G!<%?%Y!<%9$+$i(B
% $B%G!<%?$rFI$s$@;~$KCM$N@_Dj$5$l$F$$$J$$%U%#!<%k%I!K$+$I$&$+!$$"$k$$$O(B
% $B6uGr0J30$NJ8;z$r4^$^$J$$J8;zNs$+$I$&$+$r%A%'%C%/$7!$$=$&$G$"$l$P6uJ8;zNs(B
% $B$rCM$H$7$FJV$9!%(B
% $B$3$N4X?t$N<g$?$kL\E*$O!J$=$l$@$1$G$O$J$$$,!K%9%?%C%/%H%C%W$K;D$C$F$$$k(B
% $BCM$,L$Dj5A%U%#!<%k%I$G$J$/!$J8;zNs$G$"$k$3$H$rJ]>Z$9$k$?$a$3$H$G$"$k!%(B
%
% field.or.null(s) ==
%  BEGIN
%	if empty$(s) then return ""
%	else return s
%  END
%
% $B$b$&#1$D$NJd=u4X?t(B emphasize $B$O0z?t$,6uJ8;zNs$G$J$1$l$P$=$l$K6/D4;XDj$r(B
% $BIU2C$7$?CM$rJV$9!%6uJ8;zNs$J$i6uJ8;zNs$rJV$9!%%$%?%j%C%/Jd@5$OIU2C$7$J$$(B
% $B$N$G!$6h@Z$j5-9f$,B3$/>l9g$K$N$_;H$&$3$H!%(B
%
% $B4A;z$r4^$`J8;zNs$N;~$K$O6/D4;XDj$rIU2C$7$J$$!%$^$?(B NO_EM $B$,Dj5A$5$l$F$$$l$P(B
% $B6/D4;XDj$rIU2C$7$J$$!%(B
%
% emphasize(s) ==
%  BEGIN
%	if empty$(s) then return ""
%	else
%          if is.kanji.str$(s) then return s
% #if    NO_EM
%          return s
% #else !NO_EM
%          else return "{\em " * s * "}"
% #endif NO_EM
%
% format.names $B4X?t$O!$4pK\E*$K$O(B((J)BibTeX $B$NL>A07A<0$G=q$+$l$?!K0z?t$r!$%+%s%^(B
% $B$G6h@Z$j$J$,$i!$$^$?:G8e$NL>A0$NA0$K$O(B and $B$rA0$KIU$1$F!J:G8e$,(B others $B$G(B
% $B$"$l$P(B et~al. $B$H$7$F(B and $B$rIU$1$:$K!(4A;zCx<TL>$N>l9g$K$O(B et~al. $B$G$O$J$/$F!$(B
%  "$B$[$+(B"$B$"$k$$$O(B"$BB>(B" $B$r;H$$!$%+%s%^$G6h@Z$k$@$1$G(B and $B$OIU$1$:$K!K!$(B
% "First Von Last, Junior" $B$N7A$K%U%)!<%^%C%H$9$k!%!JL>A0$N%U%)!<%^%C%H7A<0(B
% $B$N;XDj$K$h$C$F$O(B First $B$O>JN,7A$H$5$l$k$3$H$b$"$k!K!%(B
% $B0z?t$K$O:GDc#1$D$NL>A0$,$J$1$l$P$J$i$J$$!%(B
%
% $B0J2<$N%"%k%4%j%:%`$OF|K\8l$KBP1~$9$k!$?7$7$/F3F~$7$?%9%$%C%A!JJQ?t!K$KBP1~(B
% $B$9$k!$$?$a$K%3!<%IItJ,$,BgI}$K=q$-49$($i$l$F$$$k$N$G!$%3!<%I$H$OI,$:$7$b(B
% $B0lCW$7$F$$$J$$!%$7$+$74pK\E*$J=hM}$NN.$l$OJQ$o$C$F$$$J$$!%(B
%
% VAR: nameptr, namesleft, numnames: INTEGER
% pseudoVAR: nameresult: STRING		(it's what's accumulated on the stack)
%
% format.names(s) ==
%  BEGIN
%	nameptr := 1
%	numnames := num.names$(s)
%	namesleft := numnames
%	while namesleft > 0
%	  do
% $BL>A0$r%U%)!<%^%C%H$9$k7A<0$,Bg$-$/JQ99$5$l$F$$$k(B
%				% for full names:
%	    t := format.name$(s, nameptr, "{ff~}{vv~}{ll}{, jj}")
%				% for abbreviated first names:
%	    t := format.name$(s, nameptr, "{f.~}{vv~}{ll}{, jj}")
%
%	    if nameptr > 1 then
%		if namesleft > 1 then nameresult := nameresult * ", " * t
%		else if numnames > 2
%		       then nameresult := nameresult * ","
%		     fi
%            % $B$3$NItJ,$bBg$-$/JQ99$5$l$F$$$k(B
%            % $B4A;zCx<T$J$i(B and $B$rIU$1$J$$!$(B et~al. $B$G$J$/(B"$B$[$+(B/$BB>(B"$B$H$9$k!%(B
%		     if t = "others"
%		       then nameresult := nameresult * " et~al."
%		       else nameresult := nameresult * " and " * t
%		     fi
%		fi
%	    else nameresult := t
%	    fi
%	    nameptr := nameptr + 1
%	    namesleft := namesleft - 1
%	  od
%	return nameresult
%  END
%
% format.authors $B$O(B author $B$,$"$l$P(B format.names(author) $B$NCM$r!$$J$1$l$P(B
% $B6uJ8;zNs$rJV$9(B
%
% format.authors ==
%  BEGIN
%	if empty$(author) then return ""
%	else return format.names(author)
%	fi
%  END
%
% format.editors $B$O(B format.authors $B$HF1$8$G$"$k$,!$(B editor $B%U%#!<%k%I$r(B
% $B;H$$!$$^$?8e$m$K(B ed., eds. $B$J$I$rIU$1$k!%(B
%
% $BJT=8<T$r3g8L$KF~$l$k$J$I$N=hM}$,IU2C$5$l$F$$$k!%$^$?(Bed., eds. $B$J$I$N(B
% $B>JN,7A$r;H$&$H$+!$4A;zCx<T$N>l9g$K$O!JJT!K$K$9$k$H$+$NJQ99$b$J$5$l$F$$$k!%(B
%
% format.editors ==
%  BEGIN
%	if empty$(editor) then return ""
%	else
%	    if num.names$(editor) > 1 then
%		return format.names(editor) * ", editors"
%	    else
%		return format.names(editor) * ", editor"
%	    fi
%	fi
%  END
%
% $BB>$N%U%)!<%^%C%H4X?t$bF1$8$h$&$J$b$N$J$N$G!$%3%a%s%H%P!<%8%g%s$O<($5$J$$!%(B
%
% $B$3$N4X?t$NCf$N(B `pop$' $BL$Dj5ACM$r<h$j5n$j6uJ8;zNs$rJV$9$?$a$K!$(B
% `skip$' $B$O%3%T!<$7$?(B(duplicate$$B$7$?(B)$BCM$=$N$b$N$rJV$9$?$a$K;H$o$l$F$$$k!%(B

% $BA43Q$N%3%m%s$r;H$o$J$1$l$P!$$3$NDj5A$O$3$3$K$"$l$P$h$$!%(B
#if    !ZENKAKU_COLON
FUNCTION {field.or.null}
{ duplicate$ empty$
    { pop$ "" }
    'skip$
  if$
}
#endif !ZENKAKU_COLON

#if    NO_EM
FUNCTION {emphasize}
{ duplicate$ empty$
    { pop$ "" }
    'skip$
  if$
}
#else  !NO_EM
FUNCTION {emphasize}
{ duplicate$ empty$
    { pop$ "" }
    { duplicate$ is.kanji.str$
	'skip$
	{ "{\em " swap$ * "}" * }
      if$
    }
  if$
}
#endif NO_EM

INTEGERS { nameptr namesleft numnames }

FUNCTION {format.names}
{ 's :=
  #1 'nameptr :=
  s num.names$ 'numnames :=
  numnames 'namesleft :=
% $B$^$@L>A0$,;D$C$F$$$l$P(B
    { namesleft #0 > }
% $B@h$:8=:_CmL\$7$F$$$k=gHV$NL>A0$r%U%)!<%^%C%H$9$k!%(B
#if NAME_FULL
    { s nameptr "{ff}{ll}" format.name$ is.kanji.str$
	{s nameptr "{ff}{ll}" format.name$ 't :=}
 	{s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't :=}
      if$
#else !NAME_FULL
    { s nameptr "{ff}{ll}" format.name$ is.kanji.str$
#if    KANJI_FULL_NAME
	{s nameptr "{ff}{ll}" format.name$ 't :=}
#else !KANJI_FULL_NAME
 	{s nameptr "{ff}" format.name$ 't :=
 	  t empty$
 	    { s nameptr "{ll}" format.name$ 't :=
	      t " $B$K$O!$@+$HL>$N4V$K6uGr$,$J$$$h!)(B in " * cite$ * warning$
	    }
 	    'skip$
 	  if$
 	}
#endif KANJI_FULL_NAME
#if     FAMILY_FIRST
 	{s nameptr "{ll,~~}{vv~}{f.}{, jj}" format.name$ 't :=}
#else  !FAMILY_FIRST
#if     FIRST_FAMILY_FIRST
 	{ nameptr #1 =
 	    {s nameptr "{ll,~~}{vv~}{f.}{, jj}" format.name$ 't :=}
	    {s nameptr "{f.~}{vv~}{ll}{, jj}" format.name$ 't :=}
	  if$
	}
#else  !FIRST_FAMILY_FIRST
 	{s nameptr "{f.~}{vv~}{ll}{, jj}" format.name$ 't :=}
#endif  FIRST_ERV
#endif FAMILY_FIRST
      if$
#endif NAME_FULL
% $BBh#2HVL\0J9_!)(B
      nameptr #1 >
% $BBh#2HVL\0J9_(B
% $B$^$@#2?M0J>e;D$C$F$$$k!)(B
	{ namesleft #1 >
%   $B$^$@#2?M0J>e;D$C$F$$$k(B
#if    ZENKAKU_PUN
	    { is.kanji.entry
		{"$B!$(B" * t * }
		{", " * t * }
	      if$
	    }
#else !ZENKAKU_PUN
	    {", " * t * }
#endif ZENKAKU_PUN
%   $B$b$&:G8e$N#1?M$@!*(B
%     $B:G8e$NL>A0$,(B others $B$+$J!)(B
#if    FAMILY_FIRST
	    { t "others" = t "others,~" = or
#else !FAMILY_FIRST
	    { t "others" =
#endif FAMILY_FIRST
%       $B$=$&$@!*(B
 		{ s is.kanji.str$
#if    USE_KANJI_HOKA
 			{"$BB>(B" * }
#else !USE_KANJI_HOKA
 			{"$B$[$+(B" * }
#endif USE_KANJI_HOKA
#if    SMALL_CAP
 			{"{\rm, et~al.}" * }
#else !SMALL_CAP
 			{", et~al." * }
#endif SMALL_CAP
 		  if$
 		}
%        others $B$G$J$$$>!*(B
 		{ s is.kanji.str$
#if    ZENKAKU_PUN
 		    {"$B!$(B" * t * }
#else !ZENKAKU_PUN
 		    {", " * t * }
#endif ZENKAKU_PUN
% Small caps $B$r;H$&>l9g$G$b(B and $B$O(B roman $B$G$J$$$H$$$1$J$$(B
#if    SMALL_CAP
#if    NO_COM_AND
 		    {"{\rm\ and }" * t * }
#else !NO_COM_AND
		    { numnames #2 =
 			{"{\rm\ and }" * t * }
 			{",{\rm\ and }" * t * }
		      if$
		    }
#endif NO_COM_AND
#else !SMALL_CAP
#if    NO_COM_AND
 		    {" and " * t * }
#else !NO_COM_AND
		    { numnames #2 =
 			{" and " * t * }
 			{", and " * t * }
		      if$
		    }
#endif NO_COM_AND
#endif SMALL_CAP
 		   if$
 		}
	      if$
	    }
	  if$
	}
% $B:G=i$NL>A0$@!*(B
	't
      if$
      nameptr #1 + 'nameptr :=
      namesleft #1 - 'namesleft :=
    }
  while$
}

FUNCTION {format.authors}
{ author empty$
    { "" }
% Small caps $B$N>l9g$K$O(B {\sc, } $B$G0O$`(B
#if    SMALL_CAP
    { "{\sc " author format.names * "}" * }
#else !SMALL_CAP
    { author format.names }
#endif SMALL_CAP
  if$
}

FUNCTION {format.editors}
{ editor empty$
    { "" }
#if    SMALL_CAP
    { "{\sc " editor format.names * "}" *
#else !SMALL_CAP
    { editor format.names
#endif SMALL_CAP
      editor num.names$ #1 >
 	{ editor is.kanji.str$
#if    ED_SHORT
% $BEE;R>pJsDL?.3X2qO@J8;o$G$O(B editor, editors $B$N7A<0$,0c$&!*(B
#ifdef TIEICE
 		{"$B!JJT!K(B" * } {" Eds." * } if$
#else !TIEICE
 		{"$B!JJT!K(B" * } {" eds." * } if$
#endif TIEICE
#else !ED_SHORT
 		{"$B!JJT!K(B" * } {", editors" * } if$
#endif ED_SHORT
 	}
 	{ editor is.kanji.str$
#if    ED_SHORT
#ifdef TIEICE
 		{"$B!JJT!K(B" *} {" Ed." * } if$
#else !TIEICE
 		{"$B!JJT!K(B" *} {" ed." * } if$
#endif !EIEIC
#else !ED_SHORT
 		{"$B!JJT!K(B" *} {", editor" * } if$
#endif ED_SHORT
 	}
      if$
    }
  if$
}

% $BJT=8<T$r3g8L$G$/$/$k>l9g(B
#if    ED_IN_PAR
FUNCTION {format.in.ed.editors}
{ editor empty$
    { "" }
    { editor format.names
      editor num.names$ #1 >
	{ editor is.kanji.str$
% $BEE;R>pJsDL?.3X2qO@J8;o$G$O(B editor, editors $B$N7A<0$,0c$&!*(B
#ifdef TIEICE
		{"$B!JJT!K(B" *} {"Eds.\ by " swap$ * } if$
#else !TIEICE
		{"$B!JJT!K(B" *} {"eds." swap$ * } if$
#endif TIEICE
	}
	{ editor is.kanji.str$
#ifdef TIEICE
		{"$B!JJT!K(B" *} {"Ed.\ by " swap$ *} if$
#else !TIEICE
		{"$B!JJT!K(B" *} {"ed." swap$ *} if$
#endif TIEICE
	}
      if$
    }
  if$
}

#endif ED_IN_PAR

% format.title $B4X?t$OK\$NCg4V$G$J$$$b$N$NI=Bj$r%U%)!<%^%C%H$9$k$N$K;H$o$l$k!%(B
% $BKX$I$N%9%?%$%k$G$O!J:G=i$NJ8;z$H%3%m%s$N8e!J%9%Z!<%9$,B3$$$F$$$k$+$b(B
% $B$7$l$J$$!K$N:G=i$NJ8;z$r=|$$$F!K!$JQ49$5$l$FM_$7$/$J$$BgJ8;z$OCf3g8L(B
%  `{', `{' $B$G0O$^$l$F$$$k$H4|BT$7$F!$%?%$%H%k$NBgJ8;z$r>.J8;z$KJQ49$9$k!%(B
% $B$$$/$D$+$N%9%?%$%k$G$O$3$NJQ49$O9T$o$:$K!$%G!<%?%Y!<%9Cf$N$^$^$H$9$k!%(B
%
% $BEE;R>pJsDL?.3X2q$N%9%?%$%k$G$O%?%$%H%k$r(B``''$B$G0O$`!%(B

FUNCTION {format.title}
% $B#1J87A<0$N>l9g$K$O%?%$%H%k$N=PNO>uBV$r(B after.author $B$K$7$F$+$i!$=hM}3+;O(B
#if    ONE_SENTENCE
{ after.author 'output.state :=
  title empty$
#else !ONE_SENTENCE
{ title empty$
#endif ONE_SENTENCE
    { "" }
#if ATIT_LOWER
#ifdef TIEICE
    { "``" title "t" change.case$ * "''" * }
#else !TIEICE
    { title "t" change.case$ }
#endif TIEICE
#else !ATIT_LOWER
    'title
#endif ATIT_LOWER
  if$
}

% $B%G%#%U%)%k%H$G(B (J)BibTeX $B$OBg0hJQ?t(B global.max$ $B$NCM$r(B (J)BibTeX $B$NDj?t$G$"$k(B
% glob_str_size $B$K@_Dj$9$k!%F1MM$K(B entry.max$ $B$NCM$r%(%s%H%j$NJ8;zNs$N:GBgD9$G(B
% $B$"$k(B ent_str_size $B$K@_Dj$9$k!%(B
% $B$=$s$J$3$H$O$J$$$H$O;W$&$,!$$3$l$rJQ99$7$F$b$h$$!%(B
%
% n.dashify $B4X?t$OJ8;zNsCf$N(B `-' $B$r(B `--' $B$KJQ49$9$k!%(B
%
% pseudoVAR: pageresult: STRING		(it's what's accumulated on the stack)
%
% n.dashify(s) ==
%  BEGIN
%	t := s
%	pageresult := ""
%	while (not empty$(t))
%	  do
%	    if (first character of t = "-")
%	      then
%		if (next character isn't)
%		  then
%		    pageresult := pageresult * "--"
%		    t := t with the "-" removed
%		  else
%		    while (first character of t = "-")
%		      do
%			pageresult := pageresult * "-"
%			t := t with the "-" removed
%		      od
%		fi
%	      else
%		pageresult := pageresult * the first character
%		t := t with the first character removed
%	    fi
%	  od
%	return pageresult
%  END

FUNCTION {n.dashify}
{ 't :=
  ""
    { t empty$ not }
    { t #1 #1 substring$ "-" =
	{ t #1 #2 substring$ "--" = not
	    { "--" *
	      t #2 global.max$ substring$ 't :=
	    }
	    {   { t #1 #1 substring$ "-" = }
		{ "-" *
		  t #2 global.max$ substring$ 't :=
		}
	      while$
	    }
	  if$
	}
	{ t #1 #1 substring$ is.kanji.str$
	  { t #1 #2 substring$ *
	    t #3 global.max$ substring$ 't :=
	  }

	  { t #1 #1 substring$ *
	    t #2 global.max$ substring$ 't :=
	  }
	  if$
	}
      if$
    }
  while$
}

% format.data $B4X?t$O7n$HG/$r%U%)!<%^%C%H$9$k$?$a$N$b$N$G$"$j!$7n$@$1$"$C$F!$(B
% $BG/$,$J$$>l9g$K$O7Y9p%a%C%;!<%8$r=P$7!$$I$A$i$b$J$1$l$P6uJ8;zNs$rJV$9!%(B
%
% $BJ88%$r(B1$BJ8$N7A<0$H$9$k>l9g$K$O86B'E*$K$OG/7n$O3g8L$KF~$l$k!%(B
% $B$^$?>pJs=hM}3X2q1QJ8O@J8;o0J30$N(B1$BJ87A<0$G$O7n$OI=<($7$J$$!%(B

FUNCTION {format.date}
#if    ONE_SENTENCE
{ before.all 'output.state :=
  year empty$
     { "there's no year in " cite$ * warning$
       ""
     }
% $B>pJs=hM}3X2q1QJ8O@J8;o$G$O3g8L$NCf$K(B month year $B$rJB$Y$k(B
#ifdef JIPSJ
     { month empty$
	{ " (" year * ")" *}
	{ " (" month * " " * year * ")" * }
       if$
     }
#else !JIPSJ
#if   YEAR_IN_PAR
     { " (" year * ")" * }
#else !YEAR_IN_PAR
#if  ZENKAKU_PUN
     { is.kanji.entry
	{"$B!$(B" year *  }
	{", " year *  }
       if$
     }
#else !ZENKAKU_PUN
     {", " year *  }
#endif ZENKAKU_PUN
#endif YEAR_IN_PAR
#endif JIPSJ
  if$
}
#else !ONE_SENTENCE
{ year empty$
    { month empty$
	{ "" }
	{ "there's a month but no year in " cite$ * warning$
	  month
	}
      if$
    }
    { month empty$
	'year
	{ month " " * year * }
      if$
    }
  if$
}
#endif ONE_SENTENCE

% format.btitle $B4X?t$OK\$NCg4V$N%(%s%H%j$NI=Bj$r%U%)!<%^%C%H$9$k!%BgJ8;z(B
% $B>.J8;z$O$=$N$^$^$K$7$F$*$-!$6/D4;XDj$rIU$1$k(B(NO_EM $B$,;XDj$5$l$F$$$l$P!$(B
% \em $B$OIU2C$5$l$J$$$3$H$K$J$C$F$$$k!K!%(B
%
% $BEE;R>pJsDL?.3X2qO@J8;o$G$O%?%$%H%k$OFs=E0zMQId$G0O$`(B

FUNCTION {format.btitle}
#if    ONE_SENTENCE
{after.author 'output.state :=
#ifdef TIEICE
"``" title * "''" *
#else !TIEICE
title emphasize
#endif TIEICE
}
#else !ONE_SENTENCE
{ title emphasize
}
#endif ONE_SENTENCE

% $B$$$/$D$+$N4X?t$G$O#2$D$NJ8;zNs$rO"7k$9$k;~$K!$8e$m$NJ8;zNs$,D9$$$b$N$G(B
% $B$J$$!J#3J8;zL$K~!K$N;~$K%?%$(B(~)$B$r4V$KF~$l$F!$$=$l$h$jD9$1$l$P!$6uGr$r(B
% $B4V$KF~$l$F!$O"7k$9$kI,MW$,$"$k!%O"7k7k2L$O%9%?%C%/$KCV$/!%(B
%
% \bibliography $B$G$O%T%j%*%I(B `.' $B$N8e$KM>J,$J6uGr$O$D$12C$($i$l$J$$$N$G!$(B
% \sfcode`\.=1000 $B$,;XDj$5$l$F$$$k$N$G!$>JN,7A$N8e$G$bC1$J$k6uGr$G$h$$!%(B
%
% tie.or.space.connect(str1,str2) ==
%    BEGIN
%	if text.length$(str2) < 3
%	  then return the concatenation of str1, "~", and str2
%	  else return the concatenation of str1, " ", and str2
%    END

FUNCTION {tie.or.space.connect}
{ duplicate$ text.length$ #3 <
    { "~" }
    { " " }
  if$
  swap$ * *
}

% either.or.check $B4X?t$O$$$:$l$+0lJ}$7$+;H$($J$$%U%#!<%k%I$,N>J};H$o$l$F(B
% $B$$$?>l9g$KJ86g$r$$$&!%(B
%
% either.or.check(t,s) ==
%  BEGIN
%	if not empty$(s) then   --- $B%*%j%8%J%k$G$O(B not $B$,H4$1$F$$$?!J%P%0!K(B
%	    warning$(can't use both " * t * " fields in " * cite$)
%	fi
%  END

FUNCTION {either.or.check}
{ empty$
    'pop$
    { "can't use both " swap$ * " fields in " * cite$ * warning$ }
  if$
}

% format.bvolume $B4X?t$O(B volume, $B$=$7$F$*$=$i$/$OJ#?t4,$+$i$J$k%7%j!<%:$N(B
% $B%7%j!<%:L>$r%U%)!<%^%C%H$9$k$?$a$K;H$o$l$k!%(Bvolume $B$H(B series $B$N%U%#!<%k%I$,(B
% $BN>J}$"$k>l9g$K$O!$(Bseries $B$O%7%j!<%:$NI=Bj$G$"$k(B($B;2>H$7$F$$$k4,$NI=Bj$O(B title
% $B$K=q$+$l$F$$$k!K$H2>Dj$7(B "of $B%7%j!<%:I=Bj(B" $B$rIU2C$9$k!%$3$N4X?t$OJ8$NESCf$G(B
% $B8F$P$l$k!%(B
%
% $BF|K\8l$N%9%?%$%k$G$O!$(Bvolume $B$G$J$/!$(B Vol. $B$r;H$&!%%7%j!<%:L>(B, Vol. $B$N(B
% $B7A<0$H$9$k!%(B

FUNCTION {format.bvolume}
{ volume empty$
    { "" }
    { volume is.kanji.str$
	{ volume }
	{ is.kanji.entry
	    {"$BBh(B" volume * "$B4,(B" *}
	    {"Vol." volume tie.or.space.connect}
	  if$
	}
      if$
      series empty$
	'skip$
	{ series is.kanji.str$
	    { volume empty$
		{series swap$ * }
#if    ZENKAKU_PUN
		{series "$B!$(B" * swap$ * }
#else !ZENKAKU_PUN
		{series ", " * swap$ * }
#endif ZENKAKU_PUN
	      if$
	    }
	    { " of " * series emphasize * }
	  if$
	}
      if$
      "volume and number" number either.or.check
    }
  if$
}

% format.number.series $B4X?t$O%7%j!<%:L>(B, $B$=$7$F$*$=$i$/$O%7%j!<%:Cf$G$NHV9f$r(B
% $B%U%)!<%^%C%H$9$k$?$a$K;H$o$l$k!%$3$l$O(B format.bvolume $B$K;w$F$$$k$,!$(B
% $B$3$N4X?t$G$O(B series $B$OB8:_$7!$(Bvolume $B$O$"$C$F$O$J$i$J$$(B(volume $B$,$"$l$P(B
% $B6uJ8;zNs$rJV$9(B)$B!%(Bnumber $B%U%#!<%k%I$,6u$G$"$l$P!$(Bseries $B$r$=$N$^$^=PNO$9$k(B
% ($B6u$+$bCN$l$J$$(B)$B!%(Bseries $B$K$O%7%j!<%:$NI=Bj$,F~$C$F$$$k(B(title $B%U%#!<%k%I$K(B
% $B;2>H$7$F$$$k$b$N$NI=Bj$,F~$C$F$$$k!K$H2>Dj$7$F!$(B"in <series>" $B$N7A$G=PNO$9$k!%(B
% $B$3$N4X?t$OJ8$N@hF,$G;H$o$l$k$N$G!$(B Number $B$N:G=i$OBgJ8;z$G$"$k!%(B
%
% $BF|K\8l$N%7%j!<%:I=Bj$J$i!$(B<series>, <number> $B$N7A$K$J$k!%(B
% $BF|K\8l$N%9%?%$%k$G$O(B number, Number $B$G$J$/!$(B No. $B$r;H$&$h$&$KJQ99$7$?!%(B

FUNCTION {format.number.series}
{ volume empty$
    { number empty$
	{ series field.or.null }
	{ number is.kanji.str$ 
	    { number }
	    {"No." number tie.or.space.connect}
	  if$
	  series empty$
	    { "there's a number but no series in " cite$ * warning$ }
	    { series is.kanji.str$
#if    ZENKAKU_PUN
	        { series "$B!$(B" * swap$ * }
#else !ZENKAKU_PUN
	        { series ", " * swap$ * }
#endif ZENKAKU_PUN
	        { " in " * series * }
	      if$
	    }
	  if$
	}
      if$
    }
    { "" }
  if$
}

% format.edition $B4X?t$O(B edition $B$,$"$l$P(B " edition " $BJ8;zNs$rIU2C$9$k!%(B
% $B$3$l$OJ8$N@hF,$G;H$o$l$J$$$N$G!$(Bedition $B$O>.J8;z$KJQ49$9$k!%(B
% $BF|K\8l$N(B edition $B$KBP$7$F$O(B " edition" $B$OIU2C$7$J$$!%(B

FUNCTION {format.edition}
{ edition empty$
    { "" }
    { edition is.kanji.str$
	{ edition }
        { is.kanji.entry
	    {"$BBh(B" edition * "$BHG(B" *}
	    { output.state mid.sentence =
	      { edition "l" change.case$ " edition" * }
	      { edition "t" change.case$ " edition" * }
              if$
	    }
	  if$
        }
      if$
    }
  if$
}

% format.pages $B4X?t$OK\$N%Z!<%8HO0O$r%U%)!<%^%C%H$9$k!J4u$KO@J8(B/$B5-;v$N%Z!<%8(B
% $BHO0O$N%U%)!<%^%C%H$K$b;H$o$l$k(B).
%
% multi.page.check $B4X?t$O(B "page/p." $B$+(B "pages/pp. " $B$N$I$A$i$r;H$&$N$,E,@Z$+(B
% $BH=CG$9$k$?$a$K(B page $B%U%#!<%k%I$K(B "-", ",", "+" $B$NJ8;z$,4^$^$l$F$$$k$+$I$&$+(B
% $BD4$Y$k!%F|K\8lMQ$N%9%?%$%k$G$O(B page/pages $B$NBe$o$j$K(B p./pp. $B$r;H$C$F$$$k!%(B
%
% $BCm0U!'$3$3$G;H$C$F$$$k(B global.max$ $B$OJ8;zNs$N;D$jA4It$H$$$&0UL#$G;H$C$F$$$k!%(B
%
% VAR: multiresult: INTEGER	(actually, a boolean)
%
% multi.page.check(s) ==
%  BEGIN
%	t := s
%	multiresult := false
%	while ((not multiresult) and (not empty$(t)))
%	  do
%	    if (first character of t = "-" or "," or "+")
%	      then multiresult := true
%	      else t := t with the first character removed
%	    fi
%	  od
%	return multiresult
%  END

INTEGERS { multiresult }

FUNCTION {multi.page.check}
{ 't :=
  #0 'multiresult :=
    { multiresult not
      t empty$ not
      and
    }
    { t #1 #1 substring$
      duplicate$ "-" =
      swap$ duplicate$ "," =
      swap$ "+" =
      or or
	{ #1 'multiresult := }
	{ t #2 global.max$ substring$ 't := }
      if$
    }
  while$
  multiresult
}

% $BF|K\8l$N%9%?%$%k$G$O86B'$H$7$F(B page/pages $B$G$J$/(B p./pp. $B$r;H$&!%(B
% $B>pJs=hM}3X2q1QJ8O@J8;o$G$O(B pp. $B$O>JN,$9$k!%(B

FUNCTION {format.pages}
{ pages empty$
    { "" }
    { pages multi.page.check
#if    JIPSJ_LIKE
	{ " " pages n.dashify * }
	{ " " pages * }
#else !JIPSJ_LIKE
 	{ "pp." pages n.dashify tie.or.space.connect }
	{ "p." pages tie.or.space.connect }
#endif JIPSJ_LIKE
      if$
    }
  if$
}

% format.vol.num.pages $B4X?t$OO@J8;o!$;(;o$NO@J8!$5-;v$N(B volume, number,
% $B%Z!<%8HO0O$r%U%)!<%^%C%H$9$k!%$=$N7A<0$O%9%?%$%k$G0[$J$k$N$G!$%3!<%I$r(B
% $B;2>H$N$3$H!%(B
%
% $B!!>pJs=hM}3X2q1QJ8O@J8;o$G$O(B volume, number (year), pages $B$N7A$GJB$Y$k(B
% $B$^$?(B volume $B$O(B Vol.$B$rIU$1$:$K(B bold $B$G%?%$%W%;%C%H$9$k!%(B No. $B$bIU$1$J$$!%(B
% $B!!EE;R>pJsDL?.3X2qO@J8;o$G$O(B volume $B$O(B Vol.$B$rIU$1$:$K(B bold $B$G%?%$%W%;%C%H$7!$(B
% No. $B$bIU$1$J$$!%(B
% $B!!F|K\%*%Z%l!<%7%g%s%:%j%5!<%A3X2qO@J8;o$G$O!$>pJs=hM}3X2q1QJ8O@J8;o$H(B
% $BF1$8$h$&$J7A$G$"$k$,!$(Bvolume $B$r(B bold $B$G%?%$%W%;%C%H$;$:$K!$(B Vol. $B$r;H$&!%(B

#ifdef JABBRV

FUNCTION {format.vol.num.pages}
{ volume field.or.null
  number empty$
    'skip$
    { "(" number * ")" * *
      volume empty$
	{ "there's a number but no volume in " cite$ * warning$ }
	'skip$
      if$
    }
  if$
  pages empty$
    'skip$
    { duplicate$ empty$
	{ pop$ format.pages }
	{ ":" * pages n.dashify * }
      if$
    }
  if$
}

#else !JABBRV

#if    JIPSJ_LIKE
FUNCTION {format.vol.num.year.pages}
{ volume empty$
    {""}
#ifdef JORSJ
    { volume is.kanji.str$
	{ volume }
	{"Vol." volume tie.or.space.connect }
      if$
    }
#else !JORSJ
    {", {\bf " volume * "}" * }
#endif JORSJ
  if$
#ifndef JORSJ
  number empty$
    'skip$
    {", " number * * }
  if$
#endif
  year empty$
    { "there's no year in " cite$ * warning$ }
%
% JORSJ $B$G$O(B book $B$NCg4V$OG/$r3g8L$KF~$l$J$$$N$G!$O@J8$J$I$O$3$3$GG/$K(B
% $B3g8L$rIU$1$k(B
%
#ifdef JORSJ
    { " (" year * ")" * *}
#else !JORSJ
    { format.date *  }
#endif JORSJ
  if$
  pages empty$
    'skip$
    { duplicate$ empty$
	{ pop$ format.pages }
	{ ", " * pages n.dashify * }
      if$
    }
  if$
}

#else  !JIPSJ_LIKE
%
FUNCTION {format.vol.num.pages}
{ volume empty$
     {""}
#ifdef TIEICE
     {"{\bf " volume * "}, " * }
#else !TIEICE
#if    ZENKAKU_PUN
     { volume is.kanji.str$
	{ is.kanji.entry
	    {volume "$B!$(B" * }
	    {volume ", " * }
	  if$
	}
	{ is.kanji.entry
	    {"Vol." volume tie.or.space.connect "$B!$(B" * }
	    {"Vol." volume tie.or.space.connect ", " * }
	  if$
	}
     }
#else !ZENKAKU_PUN
     { volume is.kanji.str$
        {volume  ", " * }
        {"Vol." volume tie.or.space.connect ", " * }
       if$
     }
#endif ZENKAKU_PUN
#endif TIEICE
  if$
  number empty$
    'skip$
#ifdef TIEICE
    { number  *
#else !TIEICE
    { number is.kanji.str$
        {number *}
        {"No." number tie.or.space.connect *}
      if$
#endif TIEICE
      volume empty$
	{ "there's a number but no volume in " cite$ * warning$ }
	'skip$
      if$
    }
  if$
  pages empty$
    'skip$
    { duplicate$ empty$
	{ pop$ format.pages }
	{ number empty$
#if    ZENKAKU_PUN
  	    { format.pages * }
	    { is.kanji.entry
 		{ "$B!$(B" * format.pages * }
 		{ ", " * format.pages * }
	      if$
	    }
#else !ZENKAKU_PUN
 	    { format.pages * }
 	    { ", " * format.pages * }
#endif ZENKAKU_PUN
	  if$
	}
      if$
    }
  if$
}
#endif JIPSJ_LIKE

#endif JABBRV

% format.chapter.pages $B4X?t$O(B chapter $B$,6u$G$J$1$l$P!$$=$NA0$K(B type $B%U%#!<%k%I(B
% $B$NJ8;zNs!J$=$l$,6u$J$i(B "chapter"$B$r(B)$BIU2C$9$k!%(Bpages $B$,$"$l$P$=$l$r8e$m$K(B
% $B2C$($k!%?7$?$JJ8$r3+;O$7$?$j$7$J$$!%(B
%
% chapter $B$,F|K\8lJ8;zNs$N>l9g$K$O(B "chapter" $B$OIU2C$7$J$$!%(B

FUNCTION {format.chapter.pages}
{ chapter empty$
    'format.pages
    { type empty$
	{ chapter is.kanji.str$
	    { "" }
	    { is.kanji.entry
		{"$B>O(B"}
		{"chapter"}
	      if$
	    }
	  if$
	}
	{ type "l" change.case$ }
      if$
      chapter is.kanji.str$ not is.kanji.entry and
          {"$BBh(B" chapter * swap$ *}
          { chapter is.kanji.str$
		{chapter *}
		{chapter tie.or.space.connect}
	    if$
	  }
      if$
      pages empty$
	'skip$
#if    ZENKAKU_PUN
	{ is.kanji.entry
	    { "$B!$(B" * format.pages * }
	    { ", " * format.pages * }
	  if$
	}
#else !ZENKAKU_PUN
	{ ", " * format.pages * }
#endif ZENKAKU_PUN
      if$
    }
  if$
}

% format.in.ed.booktitle $B4X?t$O!$(Beditor $B%U%#!<%k%I$,$"$l$P$=$l$rI=Bj$NA0$K(B
% $BCV$$$F!$(B"In <booktitle>" $B$N7A$G;O$^$kJ8$r3+;O$9$k$?$a$K;H$o$l$k!%(B
%
% $B>pJs=hM}3X2q1QJ8O@J8;o!$EE;R>pJsDL?.3X2qO@J8;o$J$I$G$O(B ED_IN_PAR $B$r(B 1 $B$K(B
% $B$7$F$*$/$3$H$G!$JT=8<TL>$O3g8L$KF~$l$k(B
% $BK\$N%?%$%H%k$,F|K\8l$J$i(B In$B!!$OIU$1$J$$!##1J87A<0$G%U%)!<%^%C%H$9$k>l9g$J$I$K(B
% In... $B$G$J$/(B in ... $B$N7A<0$H$9$k$K$O!$(BIN_LOWER $B$r(B 1 $B$K$7$F$*$/!%(B

#if    ED_IN_PAR
FUNCTION {format.in.ed.booktitle}
{ booktitle empty$
    { "" }
    { editor empty$
        { booktitle }
	{ booktitle " (" * format.in.ed.editors * ")" *  }
     if$
    }
  if$
}
#else !ED_IN_PAR
FUNCTION {format.in.ed.booktitle}
{ booktitle empty$
    { "" }
    { editor empty$
 	{ booktitle is.kanji.str$
 	    { " " booktitle emphasize * }
#if    IN_LOWER
 	    { "in " booktitle emphasize * }
#else !IN_LOWER
 	    { "In " booktitle emphasize * }
#endif IN_LOWER
 	  if$
 	}
 	{ booktitle is.kanji.str$
#if    ZENKAKU_PUN
 	    { " " format.editors * "$B!$(B" * booktitle * }
#else !ZENKAKU_PUN
 	    { " " format.editors * ", " * booktitle * }
#endif ZENKAKU_PUN
#if    IN_LOWER
 	    { "in " format.editors * ", " * booktitle emphasize * }
#else !IN_LOWER
 	    { "In " format.editors * ", " * booktitle emphasize * }
#endif IN_LOWER
 	  if$
 	}
      if$
    }
  if$
}
#endif ED_IN_PAR

% empty.misc.check $B4X?t$O%=!<%H$5$l$k;~!$J8;zNs%i%Y%k;H$&;~$K(B key $B%U%#!<%k%I$,(B
% $B6u$G$J$$$N$K!$#6$D$N%U%#!<%k%I$,A4It6u$J$iJ86g$r$$$&!%%=!<%H$5$l$J$$!$(B
% $B?tCM%i%Y%k$N;~$K$O#6$D$N%U%#!<%k%I$,A4It6u$J$iJ86g$r$$$&!%(B

FUNCTION {empty.misc.check}
{ author empty$ title empty$ howpublished empty$
  month empty$ year empty$ note empty$
  and and and and and
#if SORTED
  key empty$ not and
#else !SORTED
#if LAB_ALPH
  key empty$ not and
#endif LAB_ALPH
#endif SORTED
    { "all relevant fields are empty in " cite$ * warning$ }
    'skip$
  if$
}

% format.thesis.type $B4X?t$O(B type $B%U%#!<%k%I$,6u$G$J$1$l$P(B($BBgJ8;z!$>.J8;zJQ49(B
% $B$7$?(B) type $B%U%#!<%k%I$NCM$r!$$=$&$G$J$1$l$P4{$K%9%?%C%/$K@Q$^$l$F$$$k(B
% ("Master's thesis" $B$d(B "PhD thesis"$B$J$I$N(B)$BJ8;zNs$rJV$9!%(B

FUNCTION {format.thesis.type}
{ type empty$
    'skip$
    { pop$
      type "t" change.case$
    }
  if$
}

% format.tr.number $B4X?t$O(B type $B$,6u$G$J$1$l$P$=$NCM$G!$6u$J$i(B "Technical Report"
% $B$G;O$^$j!$(Bnumber $B$,$"$l$P$=$l$,8e$KB3$/J8;zNs$rJV$9!%(B number $B$,$J$1$l$P(B
% $B@hF,$rBgJ8;z$K$7$?A0=R$NJ8;zNs$rJV$9!%J8$N@hF,$G;H$o$l$k!%(B

FUNCTION {format.tr.number}
{ type empty$
    { "Technical Report" }
    'type
  if$
  number empty$
    { "t" change.case$ }
    { number tie.or.space.connect }
  if$
}

% $B$5$FJ88%%j%9%HFb;2>HMQ$N4X?t$N@bL@$G$"$k!%$3$l$i$N4X?t$OJ88%%G!<%?%Y!<%9(B
% $BCf$N%(%s%H%j$G!$B>$N%(%s%H%j$N%G!<%?%Y!<%9%-!<$,(B crossref $B%U%#!<%k%I$K(B
% $B=q$+$l$F$$$k;~$K!$5/F0$5$l$k!%$3$N5!G=$K$h$C$FO@J8=8$J$I$NCf$NO@J8$+$i(B
% $BO@J8=8$J$I$r;2>H$9$k$3$H$,$G$-$k!%$3$N%U%!%$%kCf$N%9%?%$%k$G$O0J2<$N(B
% $B#5$D$N%1!<%9$,A[Dj$5$l$F$$$k!%(B
% (1) ARTICLE $B$,B>$N(B ARTICLE $B$r;2>H$7$F$$$k(B;(2) BOOK, (3) INBOOK, $B$"$k$$$O(B
% (4) INCOLLECTION $B$,B>$N(B BOOK $B$r;2>H$7$F$$$k(B;(5) INPROCEEDINGS $B$,(B PROCEEDINGS
% $B$r;2>H$7$F$$$k!%$=$l$>$l$K$D$$$F8e$G>\$7$/@bL@$9$k!%(B
%
% ARTICLE $B%(%s%H%j%?%$%W$OB>$N(B ARTICLE $B%(%s%H%j$rJ88%%j%9%HFb;2>H$7$F$b$h$$!%(B
% $B$3$l$OO@J8;o(B/$B;(;o$,$"$k#1$D$NOCBj$NFC=8$K$J$C$F$$$k;~$K!$(BJOURNAL $B%?%$%W$J$I(B
% $B$H$$$&$b$N$O$J$$$+$i!$$3$l$rCx<T!$I=Bj$N$J$$(B ARTICLE $B$H$7$F07$o$J$1$l$P$J$i(B
% $B$J$$$+$i$G$"$k!%$3$N;~$K$O$=$N(B journal $B$,;2>HJ88%%j%9%H$K4^$^$l$F$$$k>l9g$K!$(B
% $B7Y9p%a%C%;!<%8$,(B2$B$D=P$5$l$k!%$G$b@$$NCf$J$s$F$7$g$;$s$3$s$J$b$N$5!%(B
%
% "In" $B$G$J$/(B "in $B$K$9$k$H$+!$(B\em $B$rIU$1$J$$$h$&$K$9$k$H$+$G$-$k$h$&$K(B
% $B%3!<%I$OJQ99$5$l$F$*$j!$I,$:$7$b0J2<$N%"%k%4%j%:%`$H0lCW$7$J$$!%(B
%
% format.article.crossref ==
%  BEGIN
%	if empty$(key) then
%	    if empty$(journal) then
%		warning$("need key or journal for " * cite$ *
%						" to crossref " * crossref)
%		return(" \cite{" * crossref * "}")
%	    else
%		return("In " * emphazise.correct (journal) *
%						" \cite{" * crossref * "}")
%		fi
%	else
%	    return("In " * key * " \cite{" * crossref * "}")
%	fi
%  END
%
% $BB>$NJ88%%j%9%HFb;2>HMQ$N4X?t$bF1$8$h$&$J$b$N$J$N$G!$%3%a%s%H%P!<%8%g%s$O$J$$!%(B

FUNCTION {format.article.crossref}
{ key empty$
    { journal empty$
	{ "need key or journal for " cite$ * " to crossref " * crossref *
	  warning$
	  ""
	}
 	{ title is.kanji.str$
 	    { " " journal *  }
#if    IN_LOWER
#if    NO_EM
  	    { " " journal * }
#else !NO_EM
  	    { "in {\em " journal * "\/}" * }
#endif NO_EM
#else  !IN_LOWER
  	    { "In {\em " journal * "\/}" * }
#endif IN_LOWER
          if$
	}
      if$
    }
    { title is.kanji.str$
 	{ " " key * }
#if    IN_LOWER
  	{ "in " key * }
#else  !IN_LOWER
  	{ "In " key * }
#endif IN_LOWER
      if$
    }
  if$
  " \cite{" * crossref * "}" *
}

% $BJ88%%j%9%HFb;2>H$5$l$F$$$k$b$N$NJT<TL>$H$7$F$O@+$N$_$r!$JT<T$N?M?t$K(B
% $B1~$8$F!$(B"editor", "editor1 and editor2", "editor1 et~al." $B$N7A<0$GI=8=$9$k!%(B
%
% $BEE;R>pJsDL?.3X2qO@J8;o$G$O;2>H@h$NCx<TL>$b%U%k%M!<%`$G=PNO$9$k!%(B

FUNCTION {format.crossref.editor}
{ editor is.kanji.str$
#ifdef TIEICE
     {editor #1 "{ff}{ll}" format.name$ duplicate$
#else !TIEICE
     {editor #1 "{ff}" format.name$ duplicate$
#endif TIEICE
      empty$
 	{pop$ editor #1 "{ll}" format.name$}
 	'skip$
      if$
      }
#ifdef TIEICE
      {editor #1 "{f. }{vv~}{ll}{ , jj}" format.name$}
#else !TIEICE
      {editor #1 "{vv~}{ll}" format.name$}
#endif TIEICE
  if$
  editor num.names$ duplicate$
  #2 >
    { editor is.kanji.str$
#if    USE_KANJI_HOKA
	  {pop$ "$BB>(B" *} {pop$ ", et~al." * } if$
#else !USE_KANJI_HOKA
	  {pop$ "$B$[$+(B" *} {pop$ ", et~al." * } if$
#endif USE_KANJI_HOKA
    }
    { #2 <
	'skip$
#ifdef TIEICE
	{ editor #2 "{f. }{vv }{ll}{, jj}" format.name$ "others" =
#else !TIEICE
	{ editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
#endif TIEICE
 	    { editor is.kanji.str$
#if    USE_KANJI_HOKA
 		{"$BB>(B" *} {", et~al." * } if$
#else !USE_KANJI_HOKA
 		{"$B$[$+(B" *} {", et~al." * } if$
#endif USE_KANJI_HOKA
 	    }
 	    { editor is.kanji.str$
 		{
#if    ZENKAKU_PUN
		  "$B!$(B" *
#else !ZENKAKU_PUN
		  ", " *
#endif ZENKAKU_PUN
 		   editor #2 "{ff}" format.name$ duplicate$
 		   empty$
 			{pop$ editor #2 "{ll}" format.name$}
 			'skip$
 		   if$
 		 *
 		}
 		{" and " * editor #2 "{vv~}{ll}" format.name$ * }
 	      if$
 	    }
	  if$
	}
      if$
    }
  if$
}

% BOOK (INBOOK) $B%(%s%H%j7?$G$O(B($BJ#?t4,$+$i$J$k$b$N$N0lIt$G$"$k$H$7$F(B)$BB>$N(B
% BOOK($BJ#?t4,A4It(B) $B$rJ88%%j%9%HFb;2>H$7$F$b$h$$!%(B
% $BIaDL$O(B editor $B$,$"$k$+$i!$$=$N;~$O;2>H>pJs$K$=$l$r;H$&!%$J$1$l$P(B key
% $B%U%#!<%k%I$,6u$G$J$1$l$P(B key $B$r!$(Bkey $B$,6u$J$i(B($B%7%j!<%:$KJ#?t4,$NI=Bj$,F~$C$F(B
% $B$$$k$O$:$@$+$i(B) series $B%U%#!<%k%I$r;H$&!%(B

FUNCTION {format.book.crossref}
{ volume empty$
    { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
       title is.kanji.str$
#if    IN_LOWER
 	{"  "} {"in "} if$
#else !IN_LOER
 	{"  "} {"In "} if$
#endif IN_LOWER
    }
    { volume is.kanji.str$
	{ volume }
	{ is.kanji.entry
	    {"$BBh(B" volume * "$B4,(B" *}
	    {"Vol." volume tie.or.space.connect " of " *  }
	  if$
	}
      if$
    }
  if$
  editor empty$
  editor field.or.null author field.or.null =
  or
    { key empty$
	{ series empty$
	    { "need editor, key, or series for " cite$ * " to crossref " *
	      crossref * warning$
	      "" *
	    }
#if    NO_EM
	    { series is.kanji.str$
#if    ZENKAKU_PUN
		{ series "$B!$(B" * swap$ * }
#else !ZENKAKU_PUN
		{ series ", " * swap$ * }
#endif ZENKAKU_PUN
	        { series * }
	      if$
	    }
#else !NO_EM
	    { series is.kanji.str$
#if    ZENKAKU_PUN
		{ series "$B!$(B" * swap$ * }
#else !ZENKAKU_PUN
		{ series ", " * swap$ * }
#endif ZENKAKU_PUN
	        { "{\em " * series * "\/}" * }
	      if$
	    }
#endif NO_EM
	  if$
	}
	{ key * }
      if$
    }
    { format.crossref.editor * }
  if$
  " \cite{" * crossref * "}" *
}

% INCOLLECTION $B%(%s%H%j7?$G$O(B BOOK ($BO@J8=8$G$"$k$H$7$F(B) $B$rJ88%%j%9%HFb;2>H$7$F(B
% $B$b$h$$!$$"$k$$$O(B INPROCEEDINGS $B$O(B PROCEEDING $B$rJ88%%j%9%HFb;2>H$7$F$b$h$$!%(B
% editor $B$,IaDL$O$"$k$+$i!$$=$l$r;2>H>pJs$H$7$F;H$&!%(Bkey $B%U%#!<%k%I$,6u$G$J$1(B
% $B$l$P(B key $B$r!$(Bkey $B$,6u$J$i(B($B$=$3$K;2>H$7$F$$$k$b$N$NI=Bj$,F~$C$F$$$k$O$:$@$+$i(B)
% booktitle $B%U%#!<%k%I$r;H$&!%(B

FUNCTION {format.incoll.inproc.crossref}
{ editor empty$
  editor field.or.null author field.or.null =
  or
    { key empty$
	{ booktitle empty$
	    { "need editor, key, or booktitle for " cite$ * " to crossref " *
	      crossref * warning$
	      ""
	    }
 	    { booktitle is.kanji.str$
 		{ booktitle }
#if    IN_LOWER
#if    JISPJ_LIKE
 		{"in " booktitle * }
#else  !JIPSJ_LIKE
#if    NO_EM
 		{ booktitle }
#else !NO_EM
 		{"in {\em " booktitle * "\/}" * }
#endif NO_EM
#endif JIPSJ_LIKE
#else !IN_LOWER
 		{"In {\em " booktitle * "\/}" * }
#endif IN_LOWER
 	       if$
 	    }
	  if$
	}
#if    IN_LOWER
	{ "in " key * }
#else  !IN_LOWER
	{ "In " key * }
#endif IN_LOWER
      if$
    }
    { title is.kanji.str$
 	{" " format.crossref.editor * }
#if    IN_LOWER
 	{"in " format.crossref.editor * }
#else !IN_LOWER
 	{"In " format.crossref.editor * }
#endif IN_LOWER
      if$
    }
  if$
  " \cite{" * crossref * "}" *
}

% $B$3$3$+$i(B .BIB $B%U%!%$%kCf$K=q$+$l$k2DG=@-$N$"$k%(%s%H%j$N7?(B(ARTICLE $B$H$+(B
% BOOK $B$H$+(B)$BKh$K!$4X?t$rDj5A$9$k!%$3$l$i$N4X?t$,(B .BBL $B%U%!%$%k$K=PNO$r9T$&!%(B
% $B$3$l$i$N4X?t$NDj5A$O(B READ $B%3%^%s%I$h$jA0$K$J$1$l$P$J$i$J$$!%$5$i$K%9%?%$%k(B
% $B@_7W<T$H$7$F$O!$L$Dj5A$N7?MQ$K(B default.type $B$H$$$&4X?t$bDj5A$9$kI,MW$,$"$k!%(B
% $BCm0U(B: $B0J2<$G<($5$l$F$$$k%U%#!<%k%I$N=gHV$O(B(inbook, proceedings$B$GFC$K(B
%       $BCG$C$F$J$$8B$j(B)$B!$=PNO$5$l$k=gHV$KJB$s$G$$$k!%(B
%
% $B3X2q;o$N7A<0$K9g$o$;$F%3!<%I$,=$@5$5$l$F$$$k$N$G!$%"%k%4%j%:%`$H$OI,$:$7$b(B
% $B0lCW$7$J$$!%(B
%
% article $B4X?t$O(B ARTICLE $BMQ$G$"$j!$B>$N(B ARTICLE $B$rJ88%%j%9%HFb;2>H$7$F$h$$!%(B
%	$BI,?\(B: author, title, journal, year
%	$BG$0U(B: volume, number, pages, month, note
%
% article ==
%  BEGIN
%	output.bibitem
%	output.check(format.authors,"author")
%	new.block
%	output.check(format.title,"title")
%	new.block
%	if missing$(crossref) then
%	    output.check(emphasize(journal),"journal")
%	    output(format.vol.num.pages)
%	    output.check(format.date,"year")
%       else
%	    output.nonnull(format.article.crossref)
%	    output(format.pages)
%	fi
%	new.block
%	output(note)
%	fin.entry
%  END
%
% book $B4X?t$OK\A4BN$N;2>HMQ!%(BBOOK $B$G$OB>$N(B BOOK $B$rJ88%%j%9%HFb;2>H$7$F$h$$!%(B
%	$BI,?\(B: author or editor, title, publisher, year
%	$BG$0U(B: volume or number, series, address, edition, month, note
%             SHOW_BOOK_PAGES $B$,(B 1 $B$J$i!$(Bpages $B$bG$0U%U%#!<%k%I(B
%
% book ==
%  BEGIN
%	if empty$(author) then output.check(format.editors,"author and editor")
%	else	output.check(format.authors,"author")
%		if missing$(crossref) then
%		    either.or.check("author and editor",editor)
%		fi
%	fi
%	new.block
%	output.check(format.btitle,"title")
%	if missing$(crossref) then
%	    output(format.bvolume)
%	    new.block
%	    output(format.number.series)
%	    new.sentence
%	    output.check(publisher,"publisher")
%	    output(address)
%       else
%	    new.block
%	    output.nonnull(format.book.crossref)
%	fi
%	output(format.edition)
% #if    SHOW_BOOK_PAGES
%        output(pages)
% #endif SHOW_BOOK_PAGES
%	output.check(format.date,"year")
%	new.block
%	output(note)
%	fin.entry
%  END
%
% $BB>$N%(%s%H%j4X?t$bF1$8$h$&$JJ*$J$N$G!$%3%a%s%H%P!<%8%g%s$O$J$$!%(B
% $B>pJs=hM}3X2q1QJ8O@J8;o$G$O(B volume, number, year, pages $B$N=g$G=PNO$9$k!%(B

FUNCTION {article}
{ output.bibitem
  format.authors "author" output.check
  new.block
  format.title "title" output.check
  new.block
  crossref missing$
    { journal emphasize "journal" output.check
#if    JIPSJ_LIKE
      format.vol.num.year.pages output
#else !JIPSJ_LIKE
      format.vol.num.pages output
      format.date "year" output.check
#endif JIPSJ_LIKE
}
    { format.article.crossref output.nonnull
      format.pages output
    }
  if$
#ifdef TIEICE
  after.block 'output.state :=
#endif !TIEICE
  new.block
  note output
  fin.entry
}

#if    SHOW_BOOK_PAGES
FUNCTION {format.book.pages}
{ pages empty$
    { "" }
    { pages " pp." *}
  if$
}
#endif SHOW_BOOK_PAGES

FUNCTION {book}
{ output.bibitem
  author empty$
    { format.editors "author and editor" output.check }
    { format.authors output.nonnull
      crossref missing$
	{ "author and editor" editor either.or.check }
	'skip$
      if$
    }
  if$
  new.block
  format.btitle "title" output.check
  crossref missing$
    { format.bvolume output
      new.block
      format.number.series output
#if    ONE_SENTENCE
      new.block
#else  !ONE_SENTENCE
      new.sentence
#endif ONE_SENTENCE
      publisher "publisher" output.check
      address output
    }
    { new.block
      format.book.crossref output.nonnull
    }
  if$
  format.edition output
#if    SHOW_BOOK_PAGES
  format.book.pages output
#endif SHOW_BOOK_PAGES
  format.date "year" output.check
#ifdef TIEICE
  after.block 'output.state :=
#endif !TIEICE
  new.block
  note output
  fin.entry
}

% booklet $B$O@=K\$5$l$F$O$$$k$,!$=PHG<R!$%9%]%s%5!<5!4XL>$N$J$$$b$N(B
%	$BI,?\(B: title
%	$BG$0U(B: author, howpublished, address, month, year, note

FUNCTION {booklet}
{ output.bibitem
  format.authors output
  new.block
  format.title "title" output.check
  howpublished address new.block.checkb
  howpublished output
  address output
  format.date output
#ifdef TIEICE
  after.block 'output.state :=
#endif !TIEICE
  new.block
  note output
  fin.entry
}

% conference $B%?%$%W$K$D$$$F$O(B inproceedings $B$r;2>H$;$h!%(B

% inbook $B$OK\$N#1It(B($B>O!$@a(B and/or $B%Z!<%8HO0O(B)$B$r;2>H$9$k$?$a$N$b$N$G$"$j!$(B
% BOOK $B$rJ88%%j%9%HFb;2>H$7$F$$$F$b$h$$!%(B volume $B%U%#!<%k%I$,$J$$>l9g$K$O!$(B
% type $B%U%#!<%k%I$N>pJs$,(B number $B$d(B series $B$h$j$bA0$KJB$Y$i$l$k!%(B
%	$BI,?\(B: author or editor, title, chapter and/or pages, publisher,year
%	$BG$0U(B: volume or number, series, type, address, edition, month, note

FUNCTION {inbook}
{ output.bibitem
  author empty$
    { format.editors "author and editor" output.check }
    { format.authors output.nonnull
      crossref missing$
	{ "author and editor" editor either.or.check }
	'skip$
      if$
    }
  if$
  new.block
  format.btitle "title" output.check
  crossref missing$
    { format.bvolume output
#if    !JIPSJ_LIKE
      format.chapter.pages "chapter and pages" output.check
#endif !JIPSJ_LIKE
      new.block
      format.number.series output
#if    ONE_SENTENCE
      new.block
#else !ONE_SENTENCE
      new.sentence
#endif ONE_SENTENCE
      publisher "publisher" output.check
      address output
    }
#if    JIPSJ_LIKE
    {
#else !JIPSJ_LIKE
    { format.chapter.pages "chapter and pages" output.check
#endif JIPSJ_LIKE
      new.block
      format.book.crossref output.nonnull
    }
  if$
  format.edition output
  format.date "year" output.check
#if    JIPSJ_LIKE
      format.chapter.pages "chapter and pages" output.check
#endif JIPSJ_LIKE
#ifdef TIEICE
  after.block 'output.state :=
#endif TIEICE
  new.block
  note output
  fin.entry
}

% INCOLLECTION $B$O(B INBOOK $B$HF1$8$h$&$J$b$N$G$O$"$k$,!$;2>H$7$F$$$k$b$N$,(B
% $B$=$l8GM-$NI=Bj$r;}$D$b$N$G$"$k(B($B$?$V$sA4BN$NJT<T$b$"$k(B)$B!%(B
% INCOLLECTION $B$O(B BOOK $B$rJ88%%j%9%HFb;2>H$7$F$b$h$$!%(B 
%	$BI,?\(B: author, title, booktitle, publisher, year
%	$BG$0U(B: editor, volume or number, series, type, chapter, pages,
%			address, edition, month, note

FUNCTION {incollection}
{ output.bibitem
  format.authors "author" output.check
  new.block
  format.title "title" output.check
  new.block
  crossref missing$
    { format.in.ed.booktitle "booktitle" output.check
      format.bvolume output
      format.number.series output
#if    !JIPSJ_LIKE
#ifndef TIEICE
      format.chapter.pages output
#endif  TIEICE
#endif !JIPSJ_LIKE
#if    ONE_SENTENCE
      new.block
#else !ONE_SENTENCE
      new.sentence
#endif ONE_SENTENCE
      publisher "publisher" output.check
      address output
      format.edition output
#ifdef TIEICE
      format.chapter.pages output
#endif TIEICE
      format.date "year" output.check
#if    JIPSJ_LIKE
      format.chapter.pages output
#endif JIPSJ_LIKE
    }
    { format.incoll.inproc.crossref output.nonnull
      format.chapter.pages output
    }
  if$
#ifdef TIEICE
  after.block 'output.state :=
#endif TIEICE
  new.block
  note output
  fin.entry
}

% INPROCEEDINGS $B$O2q5D$NO@J8(B/$BM=9F=8$K:\$C$F$$$kO@J8$G!$O@J8(B/$BM=9F=8$rJ88%%j%9%H(B
% $BFb;2>H$7$F$b$h$$!%(Baddress $B%U%#!<%k%I$,$J$1$l$P(B month (&year) $B$,(B note $B$ND>A0(B
% $BCV$+$l$k!%(B
%	$BI,?\(B: author, title, booktitle, year
%	$BG$0U(B: editor, volume or number, series, pages, address, month,
%	      organization, publisher, note

FUNCTION {inproceedings}
{ output.bibitem
  format.authors "author" output.check
  new.block
  format.title "title" output.check
  new.block
  crossref missing$
    { format.in.ed.booktitle "booktitle" output.check
      format.bvolume output
      format.number.series output
#if    JIPSJ_LIKE
      mid.sentence 'output.state :=
#else !JIPSJ_LIKE
#ifndef TIEICE
      format.pages output
#endif TIEICE
#endif JIPSJ_LIKE

#if    ONE_SENTENCE
      new.block
#endif ONE_SENTENCE
      address empty$
	{ organization publisher new.sentence.checkb
#if    ONE_SENTENCE
          new.block
#endif ONE_SENTENCE
	  organization output
#if    ONE_SENTENCE
#if    JIPSJ_LIKE
          new.block
	  mid.sentence 'output.state :=
#else !JIPSJ_LIKE
	  mid.sentence 'output.state :=
          new.block
#endif JIPSJ_LIKE
#endif ONE_SENTENCE
	  publisher output
#ifdef TIEICE
	  format.pages output
	  format.date "year" output.check
#else !TIEICE
	  format.date "year" output.check
#endif TIEICE
	}
	{ address output.nonnull
#ifndef TIEICE
	  format.date "year" output.check
#endif TIEICE
#if    ONE_SENTENCE
          new.block
#else !ONE_SENTENCE
	  new.sentence
#endif ONE_SENTENCE
	  organization output
#if    ONE_SENTENCE
	  mid.sentence 'output.state :=
          new.block
#endif ONE_SENTENCE
	  publisher output
#ifdef TIEICE
	  format.pages output
	  format.date "year" output.check
#endif TIEICE
	}
      if$
    }
    { format.incoll.inproc.crossref output.nonnull
      format.pages output
    }
  if$
#ifdef TIEICE
  after.block 'output.state :=
#endif TIEICE
  new.block
  note output
  fin.entry
}

% conference $B4X?t$O(B Scribe $B$H$N8_49@-$N$?$a$K$"$k!%(B

FUNCTION {conference} { inproceedings }

% manual $B$O%^%K%e%"%k!%(B
%	$BI,?\(B: title
%	$BG$0U(B: author, organization, address, edition, month, year, note

FUNCTION {manual}
{ output.bibitem
  author empty$
    { organization empty$
	'skip$
	{ organization output.nonnull
	  address output
	}
      if$
    }
    { format.authors output.nonnull }
  if$
  new.block
  format.btitle "title" output.check
  author empty$
    { organization empty$
	{ address new.block.checka
	  address output
	}
	'skip$
      if$
    }
    { organization address new.block.checkb
      organization output
      address output
    }
  if$
  format.edition output
  format.date output
#ifdef TIEICE
  after.block 'output.state :=
#endif TIEICE
  new.block
  note output
  fin.entry
}

% mastersthesis $B$O=$;NO@J8(B
%	$BI,?\(B: author, title, school, year
%	$BG$0U(B: type, address, month, note

FUNCTION {mastersthesis}
{ output.bibitem
  format.authors "author" output.check
  new.block
  format.title "title" output.check
  new.block
  "Master's thesis" format.thesis.type output.nonnull
  school "school" output.check
  address output
  format.date "year" output.check
#ifdef TIEICE
  after.block 'output.state :=
#endif TIEICE
  new.block
  note output
  fin.entry
}

% misc $B$OB>$N$I$l$K$b$"$F$O$^$i$J$$J*(B
%	$BI,?\(B: $BG$0U%U%#!<%k%I$N>/$J$/$H$b#1$D(B
%	$BG$0U(B: author, title, howpublished, month, year, note

FUNCTION {misc}
{ output.bibitem
  format.authors output
  title howpublished new.block.checkb
  format.title output
  howpublished new.block.checka
  howpublished output
  format.date output
#ifdef TIEICE
  after.block 'output.state :=
#endif TIEICE
  new.block
  note output
  fin.entry
  empty.misc.check
}

% phdthesis($BGn;NO@J8(B) $B$O(B mastersthesis $B$N$h$&$JJ*!%(B
%	$BI,?\(B: author, title, school, year
%	$BG$0U(B: type, address, month, note

FUNCTION {phdthesis}
{ output.bibitem
  format.authors "author" output.check
  new.block
  format.btitle "title" output.check
  new.block
  "PhD thesis" format.thesis.type output.nonnull
  school "school" output.check
  address output
  format.date "year" output.check
#ifdef TIEICE
  after.block 'output.state :=
#endif TIEICE
  new.block
  note output
  fin.entry
}

% proceedings $B$O2q5D$NO@J8(B/$BM=9F=8$G$"$k!%(B
% organization $B%U%#!<%k%I$,$"$C$F!$(B editor $B%U%#!<%k%I$,$J$$;~$K$O!$(B
% organization $B%U%#!<%k%I$,G$0U%U%#!<%k%I$N:G=i$N$b$N$H$7$F;H$o$l$k(B
% ($B:G=i$N%V%m%C%/$r6u$K$O$7$J$$$h$&$K$9$k!K!%(B
% address $B%U%#!<%k%I$,$J$1$l$P!$(Bmonth (& year) $B$,(B note $B$ND>A0$KJB$V!%(B
%	$BI,?\(B: title, year
%	$BG$0U(B: editor, volume or number, series, address, month,
%	      organization, publisher, note

FUNCTION {proceedings}
{ output.bibitem
  editor empty$
    { organization output }
    { format.editors output.nonnull }
  if$
  new.block
  format.btitle "title" output.check
  format.bvolume output
  format.number.series output
  address empty$
    { editor empty$
	{ publisher new.sentence.checka }
	{ organization publisher new.sentence.checkb
	  organization output
	}
      if$
      publisher output
      format.date "year" output.check
#ifdef TIEICE
  after.block 'output.state :=
#endif TIEICE
    }
    { address output.nonnull
      format.date "year" output.check
#ifdef TIEICE
  after.block 'output.state :=
#endif TIEICE
#if    ONE_SENTENCE
      new.block
#else !ONE_SENTENCE
      new.sentence
#endif ONE_SENTENCE
      editor empty$
	'skip$
	{ organization output }
      if$
      publisher output
    }
  if$
  new.block
  note output
  fin.entry
}

% techreport $B$O%F%/%K%+%k%l%]!<%H(B
%	$BI,?\(B: author, title, institution, year
%	$BG$0U(B: type, number, address, month, note

FUNCTION {techreport}
{ output.bibitem
  format.authors "author" output.check
  new.block
  format.title "title" output.check
  new.block
  format.tr.number output.nonnull
  institution "institution" output.check
  address output
  format.date "year" output.check
#ifdef TIEICE
  after.block 'output.state :=
#endif TIEICE
  new.block
  note output
  fin.entry
}

% unpublished $B$O=PHG$5$l$F$$$J$$$b$N!%(B
%	$BI,?\(B: author, title, note
%	$BG$0U(B: month, year

FUNCTION {unpublished}
{ output.bibitem
  format.authors "author" output.check
  new.block
  format.title "title" output.check
  new.block
  note "note" output.check
  format.date output
  fin.entry
}

% $BJ,N`ITL@$N%(%s%H%j$KBP$7$F$O(B `misc' $B$r;H$&!%(B(J)BibTeX $B$O7Y9p$r=P$9!%(B

FUNCTION {default.type} { misc }

% $B%9%?%$%k$G0[$J$k$+$bCN$l$J$$$,!$0lHLE*$J%^%/%m$,0J2<$KJB$s$G$$$k!%(B
% $BMxMQ<T$O$3$l$i$N%^%/%m$r;H$&$N$,K>$^$7$$!%(B
%
% $B7n$NL>A0$O%U%k%9%Z%k$+>JN,7A$G=q$/!%(B

#if MONTH_FULL

MACRO {jan} {"January"}

MACRO {feb} {"February"}

MACRO {mar} {"March"}

MACRO {apr} {"April"}

MACRO {may} {"May"}

MACRO {jun} {"June"}

MACRO {jul} {"July"}

MACRO {aug} {"August"}

MACRO {sep} {"September"}

MACRO {oct} {"October"}

MACRO {nov} {"November"}

MACRO {dec} {"December"}

#else !MONTH_FULL

MACRO {jan} {"Jan."}

MACRO {feb} {"Feb."}

MACRO {mar} {"Mar."}

MACRO {apr} {"Apr."}

MACRO {may} {"May"}

MACRO {jun} {"June"}

MACRO {jul} {"July"}

MACRO {aug} {"Aug."}

MACRO {sep} {"Sept."}

MACRO {oct} {"Oct."}

MACRO {nov} {"Nov."}

MACRO {dec} {"Dec."}

#endif MONTH_FULL

% $BO@J8;oL>$O%U%k%9%Z%k$+>JN,7A$GI=<($9$k!%>JN,7A$O(B ACM $B$N=PHGJ*$K$"$k7A!%(B
% $B$3$l$H$^$C$?$/0c$&%;%C%H$N>JN,7A$r;H$&>l9g$K$O!$$=$NDj5A$N$_$+$i$J$k(B
% .bib $B%U%!%$%k$r:n$k$N$,0lHV$$$$$@$m$&!%$=$&$9$l$PMxMQ<T$O(B \bibliography
% $B%3%^%s%I$N#1HVL\$N0z?t$H$7$F$=$l$r;XDj$7$F!$$3$l$i$r<h$j9~$a$k!%(B

#if JOUR_FULL

MACRO {acmcs} {"ACM Computing Surveys"}

MACRO {acta} {"Acta Informatica"}

MACRO {cacm} {"Communications of the ACM"}

MACRO {ibmjrd} {"IBM Journal of Research and Development"}

MACRO {ibmsj} {"IBM Systems Journal"}

MACRO {ieeese} {"IEEE Transactions on Software Engineering"}

MACRO {ieeetc} {"IEEE Transactions on Computers"}

MACRO {ieeetcad}
 {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}

MACRO {ipl} {"Information Processing Letters"}

MACRO {jacm} {"Journal of the ACM"}

MACRO {jcss} {"Journal of Computer and System Sciences"}

MACRO {scp} {"Science of Computer Programming"}

MACRO {sicomp} {"SIAM Journal on Computing"}

MACRO {tocs} {"ACM Transactions on Computer Systems"}

MACRO {tods} {"ACM Transactions on Database Systems"}

MACRO {tog} {"ACM Transactions on Graphics"}

MACRO {toms} {"ACM Transactions on Mathematical Software"}

MACRO {toois} {"ACM Transactions on Office Information Systems"}

MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}

MACRO {tcs} {"Theoretical Computer Science"}

MACRO {tieice} {"$BEE;R>pJsDL?.3X2qO@J8;o(B"}
MACRO {tipsj}  {"$B>pJs=hM}3X2qO@J8;o(B"}
MACRO {jipsj}  {"Journal of Informatin Processing Society of Japan"}
MACRO {jorsj}  {"Journal of the Operations Research Society of Japan"}

#else !JOUR_FULL

MACRO {acmcs} {"ACM Comput. Surv."}

MACRO {acta} {"Acta Inf."}

MACRO {cacm} {"Commun. ACM"}

MACRO {ibmjrd} {"IBM J. Res. Dev."}

MACRO {ibmsj} {"IBM Syst.~J."}

MACRO {ieeese} {"IEEE Trans. Softw. Eng."}

MACRO {ieeetc} {"IEEE Trans. Comput."}

MACRO {ieeetcad}
 {"IEEE Trans. Comput.-Aided Design Integrated Circuits"}

MACRO {ipl} {"Inf. Process. Lett."}

MACRO {jacm} {"J.~ACM"}

MACRO {jcss} {"J.~Comput. Syst. Sci."}

MACRO {scp} {"Sci. Comput. Programming"}

MACRO {sicomp} {"SIAM J. Comput."}

MACRO {tocs} {"ACM Trans. Comput. Syst."}

MACRO {tods} {"ACM Trans. Database Syst."}

MACRO {tog} {"ACM Trans. Gr."}

MACRO {toms} {"ACM Trans. Math. Softw."}

MACRO {toois} {"ACM Trans. Office Inf. Syst."}

MACRO {toplas} {"ACM Trans. Prog. Lang. Syst."}

MACRO {tcs} {"Theoretical Comput. Sci."}

MACRO {tieice} {"$B?.3XO@(B"}
MACRO {tipsj}  {"$B>pJs=hM}3X2qO@J8;o(B"}
MACRO {jipsj}  {"J.~Info. Proc. Soc. of Japan"}
MACRO {jorsj}  {"Journal of the O. R. Society of Japan"}

#endif JOUR_FULL

% .BBL $B%U%!%$%k$N%(%s%H%j$rFI$_9~$`(B

READ

% $BFI$_9~$^$l$?J88%$N%G!<%?$,4A;z$N$b$N$+$I$&$+%A%'%C%/$7$F%U%i%0$r@_Dj$9$k!%(B
% ASCII $BHG$N(B 0.98 $BMQ$N$b$N$r=$@5$7$?!%(B

FUNCTION {set.is.kanji.entry}
{
  author    field.or.null is.kanji.str$
  title     field.or.null is.kanji.str$ or
  editor    field.or.null is.kanji.str$ or
  journal   field.or.null is.kanji.str$ or
  booktitle field.or.null is.kanji.str$ or
  series    field.or.null is.kanji.str$ or
  'is.kanji.entry :=
}

ITERATE {set.is.kanji.entry}

% sortify $B4XAG$O0z?t$r(B purify$ $B$7$?8e$K>.J8;z$KJQ49$9$k!%%=!<%H$N$?$a!$(B
% $B$"$k$$$O%=!<%H8e$K%i%Y%k$r:n$k;~$K;H$o$l$k!%(B
%
% chop.word(w,len,s) $B$O(B s $B$=$N$b$N$+!$$"$k$$$O(B s $B$N:G=i$N(B len $BJ8;z$,(B w $B$H(B
% $BEy$7$1$l$P(B($B$3$NHf3S$O4X?t$NDj5A$N(B3$B9TL\$G9T$o$l$k(B w $B$h$j8e$m$N(B s $B$N(B
% $BItJ,J8;zNs$rJV$9(B

#if SORTED

FUNCTION {sortify}
{ purify$
  "l" change.case$
}

INTEGERS { len }

FUNCTION {chop.word}
{ 's :=
  'len :=
  s #1 len substring$ =
    { s len #1 + global.max$ substring$ }
    's
  if$
}

#else !SORTED
#if LAB_ALPH

% $B%=!<%H$5$l$J$$J8;zNs%i%Y%k$D$-J88%%j%9%HMQ$N(B chop.word
% $B$3$s$J$NC/$,;H$&$N!)(B

INTEGERS { len }

FUNCTION {chop.word}
{ 's :=
  'len :=
  s #1 len substring$ =
    { s len #1 + global.max$ substring$ }
    's
  if$
}

#endif LAB_ALPH
#endif SORTED

% $B0J2<$ND9$$%3%a%s%H$OJ8;zNs%i%Y%k$N>l9g$N$_$K$"$F$O$^$k!%(B
%
% format.lab.names $B4X?t$OL>A0$N(B von $B$H(B last $B%Q!<%H$NF,J8;z$r;H$C$FC;$$%i%Y%k(B
% $B$r:n$k(B($BL>A0$N?t$,#40J>e$N>l9g$K$O#3$D$G@Z$j!$(B"+" $B$r8*IU$-$G2C$($k!%L>A0$,(B
% $BJ#?t$"$j!$:G8e$,(B "others" $B$G$"$k>l9g$bF1MM$K(B "+" $B$rIU$1$k!K!%(B
% $BL>A0$,#1$D$7$+$J$/!$(Bvon $B$H(B last $B%Q!<%H$+$i$J$kL>A0%H!<%/%s$,#1$D$7$+$J$$$H!$(B
% ("Knuth" $B$O#1$D!$(B"Brinch Hansen"$B$O#2$D(B) $B@+(B(last name)$B$NF,#3J8;z$+$i%i%Y%k$r(B
% $B:n$k!%(Bet.al.char.used $B$OI,MW$K1~$8$F(B LaTeX $B%^%/%m$r=q$-=P$9$?$a$K!$(B"+" $B$,(B
% $B;H$o$l$?$+$I$&$+$rJ];}$9$kO@M}7?$NJQ?t$G$"$k!%(B
% 
% $B4A;zCx<TL>$N>l9g$K$O(B yomi $B%U%#!<%k%I$N>pJs$r;H$C$F>e$HF1MM$K%i%Y%k$r:n$k!%(B
% yomi $B%U%#!<%k%I$,$J$1$l$P!$Bh0lCx<T$N@+$N$_$+$i%i%Y%k$r:n$k!%(B
%
% format.lab.names(s) ==
%  BEGIN
%    if not empty$(yomi) then s := yomi fi
%    if is.kanji.str$(s) then return $BBh0lCx<T$N@+(B fi
%    else do
%	numnames := num.names$(s)
%	if numnames > 1 then
%	    if numnames > 4 then
%		namesleft := 3
%	    else
%		namesleft := numnames
%	    nameptr := 1
%	    nameresult := ""
%	    while namesleft > 0
%	      do
%		if (name_ptr = numnames) and
%		     format.name$(s, nameptr, "{ff }{vv }{ll}{ jj}") = "others"
%		   then nameresult := nameresult * "{\etalchar{+}}"
%			et.al.char.used := true
%		   else nameresult := nameresult *
%				format.name$(s, nameptr, "{v{}}{l{}}")
%		nameptr := nameptr + 1
%		namesleft := namesleft - 1
%	      od
%	    if numnames > 4 then
%		nameresult := nameresult * "{\etalchar{+}}"
%		et.al.char.used := true
%	else
%	    t := format.name$(s, 1, "{v{}}{l{}}")
%	    if text.length$(t) < 2 then	% there's just one name-token
%		nameresult := text.prefix$(format.name$(s,1,"{ll}"),3)
%	    else
%		nameresult := t
%	    fi
%	fi
%	return nameresult
%    od
%  END
%
% $B%i%Y%k$N<gMWItJ,$r:n$k;~$K$I$N%U%#!<%k%I$KCmL\$9$k$+$O%(%s%H%j$N7?$G0[$J$k!%(B
% $B$3$l$K$h$C$F!$$I$N7?$G$bF1$8>pJs$r;H$&(B($BNc$($P(B author, editor, key $B$N=g$K;H$&(B)
% $B>l9g$KHf$Y$F!$(BLaTeX book $B$G=R$Y$i$l$F$$$k!VL5;k$5$l$k!W%U%#!<%k%I$,K\Ev$K(B
% $B!VL5;k$G$-$k!W$h$&$K$J$C$F$$$k!%(BMISC $B$NH=Dj$O(B calc.label $B4X?tCf$N(B if $B$N(B
%  $B:G8e$N(B else $BIt$KCV$+$l$F$$$k$+$i!$%G!<%?%Y!<%9Cf$N@5$7$/$J$$%(%s%H%j7?$G$b(B
% $B$A$c$s$H=hM}$G$-$k$h$&$K$J$C$F$$$k!%(B
%
% $B%U%#!<%k%I$r8+$F$$$/=gHV$O#4$D$"$k$,!$$=$l$>$l$KBP1~$7$?Jd=u4X?t$,MQ0U$5$l$F(B
% $B$$$k!%:G=i$N4X?t$O@h$:(B author $B%U%#!<%k%I$rD4$Y!$I,MW$J>l9g$K$O(B key $B%U%#!<%k%I(B
% $B$rD4$Y$k!%B>$N#3$D$NJd=u4X?t$bF1$8$h$&$J$b$N$G$"$k$,!$:G=i$K#2$D$N%U%#!<%k%I(B
% $B$rD4$Y!$$=$N8e$K(B key $B%U%#!<%k%I$rD4$Y$k$h$&$K$J$C$F$$$?$j!$(Bkey $B%U%#!<%k%I(B
% $B$r(B organization $B%U%#!<%k%I$h$j@h$KD4$Y$k$h$&$J7A$K$J$C$F$$$k$N$b$"$k!%(B
% (key $B$,@h$J$N$O%i%Y%k$KBP$7$F$NOC$G!$%=!<%HMQ$N%i%Y%k$G$O$J$$$3$H$KCm0U!K!%(B
%
% calc.label $B4X?t$O0J2<$N$h$&$K$7$F%(%s%H%j$NM=HwE*$J%i%Y%k$r:n$k!%(B
% ($B$I$N%U%#!<%k%I$,6u$+$K$h$k$,!$$^$?(B organization $BCf$N(B "The"$B$OL5;k$9$k$,(B)
% author $B$"$k$$$O(B editor $B$"$k$$$O(B organization $B$+$i#3J8;z<h$j=P$7(B($B$3$l$i$,(B
% $B4A;z$N>l9g$K$O!$(Byomi $B%U%#!<%k%I$,6u$G$J$1$l$P(B yomi $B%U%#!<%k%I$r(B author,
% editor, organization $B$NBe$o$j$K;H$C$F#3J8;z<h$j=P$7!$6u$J$i$P#24A;z<h$j=P$7(B)
% $B$F:n$C$?$b$N$N8e$m$K(B year $B$N:G8e$N#2J8;z$rIU$12C$($k!%I,MW$J(B author, editor,
% organization, key $B$,$J$1$l$P%(%i!<$G$"$k$,!$$=$N>l9g$K$O(B citt$ $B$N:G=i$N(B
% $B#3J8;z$r;H$&!%(B 
%
% $BF@$i$l$k%i%Y%k$N(B year $BItJ,$K$O(B purify$ $B$,E,MQ$5$l$F$$$k$,!$(B name $BItJ,$K$O(B
% purify$ $B$OE,MQ$5$l$F$$$J$$!%(B(year $B$KBP$7$F(Bpurify$ $B$rE,MQ$9$k$N$G!$$3$l$rMxMQ(B
% $B$7$FMxMQ<T$O%=!<%H4X?t$r$@$^$7$F!$=gHV$r<+J,$NET9g$NNI$$$h$&$K$G$-$k!K!%(B
%
% $B$3$l$i$N4X?t$G$O%=!<%H$G;H$&%i%Y%k$b:n@.$9$k!%(B
%
% $B:G=*E*$J%i%Y%k$K$O6hJL$N$?$a$K(B 'a', 'b' $B$J$I$r8e$m$K$D$1$kI,MW$b$"$k$,!$(B
% $B$3$N(B extra.label $B$O%=!<%H$7$?8e$G:n$k!%(B
%
% calc.label ==
%  BEGIN
%	if type$ = "book" or "inbook" then
%	    author.editor.key.label
%	else if type$ = "proceedings" then
%	    editor.key.organization.label
%	else if type$ = "manual" then
%	    author.key.organization.label
%	else
%	    author.key.label
%	fi fi fi
%	label := label * substring$(purify$(field.or.null(year)), -1, 2)
%		% assuming we will also sort, we calculate a sort.label
%	sort.label := sortify(label), but use the last four, not two, digits
%  END

#if LAB_ALPH

INTEGERS { et.al.char.used }

FUNCTION {initialize.et.al.char.used}
{ #0 'et.al.char.used :=
}

EXECUTE {initialize.et.al.char.used}

FUNCTION {format.lab.names}
{ 's :=
% yomi $B%U%#!<%k%I$,6u$G$J$1$l$P$=$l$r;H$&(B
  yomi empty$
     'skip$
     { yomi 's :=}
  if$
#if   USE_FIRST_ONLY
%
% $BF|K\8lJ8;zNs$N>l9g$K$O!$Bh0lCx<T$N@+$N$_$H$9$k(B
%
  s  is.kanji.str$
    { s #1 "{ff}" format.name$ #4 text.prefix$ duplicate$ empty$
	{ pop$ s #1 "{ll}" format.name$ #4 text.prefix$
	  s #1 "{ll}" format.name$ " $B$K$O!$@+$HL>$N4V$K6uGr$,$J$$$h!)(B in " *
             cite$ * warning$
        }
	'skip$
     if$
    }
% $BF|K\8lJ8;zNs$G$J$$>l9g$N=hM}(B
    { s #1 "{ll}" format.name$ #3 text.prefix$ }
  if$
#else !USE_FIRST_ONLY
%
% $BF|K\8lJ8;zNs$N>l9g$K$O!$Bh0lCx<T$N@+$N$_$H$9$k(B
%
  s  is.kanji.str$
    { s #1 "{ff}" format.name$ #4 text.prefix$ duplicate$ empty$
	{pop$ s #1 "{ll}" format.name$ #4 text.prefix$}
	'skip$
     if$
    }
% $BF|K\8lJ8;zNs$G$J$$>l9g$N=hM}(B
    {
      s num.names$ 'numnames :=
      numnames #1 >
	{ numnames #4 >
	    { #3 'namesleft := }
	    { numnames 'namesleft := }
	  if$
	  #1 'nameptr :=
	  ""
	    { namesleft #0 > }
	    { nameptr numnames =
		{ s nameptr "{ff }{vv }{ll}{ jj}" format.name$ "others" =
		    { "{\etalchar{+}}" *
		      #1 'et.al.char.used :=
		    }
		    { s nameptr "{v{}}{l{}}" format.name$ * }
		  if$
		}
		{ s nameptr "{v{}}{l{}}" format.name$ * }
	      if$
	      nameptr #1 + 'nameptr :=
	      namesleft #1 - 'namesleft :=
	    }
	  while$
	  numnames #4 >
	    { "{\etalchar{+}}" *
	      #1 'et.al.char.used :=
	    }
	    'skip$
	  if$
	}
	{ s #1 "{v{}}{l{}}" format.name$
	  duplicate$ text.length$ #2 <
	    { pop$ s #1 "{ll}" format.name$ #3 text.prefix$ }
	     'skip$
	  if$
	}
      if$
    }
  if$
#endif USE_FIRST_ONLY
}


FUNCTION {author.key.label}
{ author empty$
    { key empty$
#if SORTED
	{ cite$ #1 #3 substring$ }
#else !SORTED		% $B8e$G$O7Y9p$r=P$5$J$$$+$i$3$3$G=P$7$F$*$/(B
	{ "for label, need author or key in " cite$ * warning$
	  cite$ #1 #3 substring$
	}
#endif SORTED
	{ key #3 text.prefix$ }
      if$
    }
    { author format.lab.names }
  if$
}

FUNCTION {author.editor.key.label}
{ author empty$
    { editor empty$
	{ key empty$
#if SORTED
	    { cite$ #1 #3 substring$ }
#else !SORTED		% $B8e$G$O7Y9p$r=P$5$J$$$+$i$3$3$G=P$7$F$*$/(B
	    { "for label, need author, editor, or key in " cite$ * warning$
	      cite #1 #3 substring$
	    }
#endif SORTED
	    { key #3 text.prefix$ }
	  if$
	}
	{ editor format.lab.names }
      if$
    }
    { author format.lab.names }
  if$
}

FUNCTION {author.key.organization.label}
{ author empty$
    { key empty$
	{ organization empty$
#if SORTED
	    { cite$ #1 #3 substring$ }
#else !SORTED		% $B8e$G$O7Y9p$r=P$5$J$$$+$i$3$3$G=P$7$F$*$/(B
	    { "for label, need author, key, or organization in " cite$ *
								warning$
	      cite #1 #3 substring$
	    }
#endif SORTED
	    { "The " #4 organization chop.word #3 text.prefix$ }
	  if$
	}
	{ key #3 text.prefix$ }
      if$
    }
    { author format.lab.names }
  if$
}

FUNCTION {editor.key.organization.label}
{ editor empty$
    { key empty$
	{ organization empty$
#if SORTED
	    { cite$ #1 #3 substring$ }
#else !SORTED		% $B8e$G$O7Y9p$r=P$5$J$$$+$i$3$3$G=P$7$F$*$/(B
	    { "for label, need editor, key, or organization in " cite$ *
								warning$
	      cite #1 #3 substring$
	    }
#endif SORTED
	    { "The " #4 organization chop.word #3 text.prefix$ }
	  if$
	}
	{ key #3 text.prefix$ }
      if$
    }
    { editor format.lab.names }
  if$
}

FUNCTION {calc.label}
{ type$ "book" =
  type$ "inbook" =
  or
    'author.editor.key.label
    { type$ "proceedings" =
	'editor.key.organization.label
	{ type$ "manual" =
	    'author.key.organization.label
	    'author.key.label
	  if$
	}
      if$
    }
  if$
  duplicate$
  year field.or.null purify$ #-1 #2 substring$
  *
  'label :=
  year field.or.null purify$ #-1 #4 substring$
  *
  sortify 'sort.label :=
}

% $BJ8;zNs%i%Y%k$r;H$&>l9g$K!$0zMQ=g$KJB$Y$k$N$ONI$$$H$O;W$($J$$$,!$(B
% $B$=$N>l9g$K$O!$$A$g$C$HJL$N$d$jJ}$G%i%Y%k$r:n$i$J$/$F$O$J$i$J$$!%(B

#if !SORTED

ITERATE {calc.label}

#endif !SORTED

#endif LAB_ALPH

% $B%=!<%F%#%s%0$G$O(B presort $B$r3F!9$N%(%s%H%j$KBP$7$F<B9T$9$k$3$H$G(B sortkey
% $B$r5a$a$k!%(Bpresort $B%-!<$K$OJ#?t$N%V%i%s%/$G6h@Z$i$l$?(B sortify $B$5$l$?(B
% $B$$$/$D$+$NJ8;zNs$,4^$^$l$k!%$3$l$K$h$C$F(B "brinch  per" $B$NJ}$,(B
% "brinch hansen  per" $B$h$jA0$K$J$k!%(B
%
% $B$3$3$G;H$o$l$F$$$k%U%#!<%k%I72$O0J2<$NDL$j!%J8;zNs%i%Y%k$N>l9g$K$O(B
% (calc.label $B$G5a$a$?(B) sort.label, $BB3$$$F%(%s%H%j$N7?$"$k$$$O2?$,7g$1$F$$$k$+(B
% $B$G0[$J$k$,!$Cx<TL>(B($BJT<T!$@hF,$N(B "The" $B$r=|$$$?5!4XL>$N$3$H$b$"$k(B)$B$^$?$O(B
% key $B%U%#!<%k%I!$<!$,G/!$$=$7$F(B($B@hF,$N(B "The ", "A ", or "An " $B$r=|$$$?(B)
% $BI=Bj$N0lItJ,$G$"$k!%(B.
% $BL>A0$O(B Von Last First Junior $B$N$h$&$K%U%)!<%^%C%H$5$l$k!%(B
% $BL>A0$NCGJR$O(B("brinch hansen")$B$N$h$&$K#1$D$N6uGr$G6h@Z$i$l!$L>A0$N9=@.MWAG$O(B
% (von $B$H@+$NItJ,$r=|$$$F(B)$B#2$D$N6uGr$G6h@Z$i$l!$J#?t$NL>A0$N4V$K$O#3$D$N6uGr(B
% $B$,A^F~$5$l!$L>A0$HG/(B($BJ8;zNs%i%Y%k$N>l9g$K$O%i%Y%k$HL>A0!K$N4V$K$O(B
% $B#4$D$N6uGr$,A^F~$5$l!$$^$?G/$HI=Bj$N4V$K$b#4$D$N6uGr$,A^F~$5$l$k!%(B
%
% sort.format.names $B4X?t$O(B (J)BibTeX $B$NL>A07A<0$G=q$+$l$?0z?t$r$H$j!$(B
% $B>e=R$N7A<0$N(B "  " $B$G6h@Z$i$l$?J8;zNs$rJV$9!%(B format.names$B$H$[$H$s$IF1$8!%(B
%
%
#if SORTED

FUNCTION {sort.format.names}
{ 's :=
%
% yomi $B%U%#!<%k%I$,6u$G$J$1$l$P$=$l$r;H$&(B
%
  yomi empty$
     'skip$
     { yomi 's := }
  if$
  #1 'nameptr :=
  ""
  s num.names$ 'numnames :=
  numnames 'namesleft :=
    { namesleft #0 > }
    { nameptr #1 >
	{ ", " * }
	'skip$
      if$
#if NAME_FULL
      s nameptr "{vv{ } }{ll{ }}{  ff{ }}{  jj{ }}" format.name$ 't :=
#else !NAME_FULL
      s nameptr "{vv{ } }{ll{ }}{  f{ }}{  jj{ }}" format.name$ 't :=
#endif NAME_FULL
      nameptr numnames = t "others" = and
 	{ s is.kanji.str$
#if    USE_KANJI_HOKA
 		{"$BB>(B" * }
#else !USE_KANJI_HOKA
 		{"$B$[$+(B" * }
#endif USE_KANJI_HOKA
 		{"et~al." *}
	  if$
 	}
	{ t sortify * }
      if$
      nameptr #1 + 'nameptr :=
      namesleft #1 - 'namesleft :=
    }
  while$
}

% sort.format.title $B$O0z?t$+$i@hF,$N(B "A ", "An ", "The " $B$r<h$j=|$$$?(B
% $BJ8;zNs$rJV$9!%(B
% chop.word $B$,JQ?t(B s $B$r;H$C$F$$$k$N$G!$JL$NJ8;zNsJQ?t(B t $B$r;H$&!%(B

FUNCTION {sort.format.title}
{ 't :=
  "A " #2
    "An " #3
      "The " #4 t chop.word
    chop.word
  chop.word
  sortify
  #1 global.max$ substring$
}

% $B$3$3$N%=!<%H$NA0=hM}MQ$NJd=u4X?t72$O!$(Bcalc.label $B$N$b$N$HF1$8$h$&$J(B
% $B$b$N$G$"$k$,!$$3$3$G$O(B key $B%U%#!<%k%I$h$j(B organization $B%U%#!<%k%I$,M%@h(B
% $B$9$k!%$^$?%=!<%H$N$?$a$K(B organization $B%U%#!<%k%I$N@hF,$N(B "The "$B$O(B
% $B<h$j=|$/!%(B

FUNCTION {author.sort}
{ author empty$
    { key empty$
	{ "to sort, need author or key in " cite$ * warning$
	  ""
	}
	{ key sortify }
      if$
    }
    { author sort.format.names }
  if$
}

FUNCTION {author.editor.sort}
{ author empty$
    { editor empty$
	{ key empty$
	    { "to sort, need author, editor, or key in " cite$ * warning$
	      ""
	    }
	    { key sortify }
	  if$
	}
	{ editor sort.format.names }
      if$
    }
    { author sort.format.names }
  if$
}

FUNCTION {author.organization.sort}
{ author empty$
    { organization empty$
	{ key empty$
	    { "to sort, need author, organization, or key in " cite$ * warning$
	      ""
	    }
	    { key sortify }
	  if$
	}
	{ "The " #4 organization chop.word sortify }
      if$
    }
    { author sort.format.names }
  if$
}

FUNCTION {editor.organization.sort}
{ editor empty$
    { organization empty$
	{ key empty$
	    { "to sort, need editor, organization, or key in " cite$ * warning$
	      ""
	    }
	    { key sortify }
	  if$
	}
	{ "The " #4 organization chop.word sortify }
      if$
    }
    { editor sort.format.names }
  if$
}

% sort.key$ $B$J$I$N%(%s%H%j$NJ8;zNsJQ?t$ND9$5$K$O(B entry.max$ $B$N>e8B$,$"$k!%(B
% $B$=$3$G!$@8@.$9$k%-!<$ND9$5$r$=$l0JFb$H$9$k!%$=$l$@$1$ND9$5$,$"$l$P(B
% 1$B$D$7$+%^%C%A$9$k$3$H$O$J$$$H2>Dj$9$k!%(B

FUNCTION {presort}
#if LAB_ALPH
{ calc.label
  sort.label
  "    "
  *
  type$ "book" =
#else !LAB_ALPH
{ type$ "book" =
#endif LAB_ALPH
  type$ "inbook" =
  or
    'author.editor.sort
    { type$ "proceedings" =
	'editor.organization.sort
	{ type$ "manual" =
	    'author.organization.sort
	    'author.sort
	  if$
	}
      if$
    }
  if$
#if LAB_ALPH
  *
#endif LAB_ALPH
  "    "
  *
  year field.or.null sortify
  *
  "    "
  *
  title field.or.null
  sort.format.title
  *
  #1 entry.max$ substring$
  'sort.key$ :=
}

ITERATE {presort}

% $B%=!<%H$N=`Hw$O@0$C$?!%(B

SORT

#endif SORTED

% $B$3$NCm<a$O%=!<%H$5$l$?J8;zNs%i%Y%k$r:n$k;~$N$_$"$F$O$^$k!%(B
%
% $BJ8;zNs%i%Y%k$N:G=*%9%F!<%8$G$"$j!$I,MW$K1~$8$F(B 'a', 'b' $B$J$I$r(B
% $BIU2C$9$k!%(B2$B$D$N%Q%9$+$i$J$k!%(B 'b', 'c' $B$rIU2C$9$k$?$a$NA08~$-%Q%9$H!$(B
% 'a' $B$rIU2C$9$k$?$a$N8e8~$-%Q%9$+$i$J$k!%(B('b' $B$,$J$1$l$P(B'a'$B$OIU2C$9$k(B
% $BI,MW$O$J$$(B)
% "thebibliography"$B4D6-$N$?$a$K(B width$ $B$G7W$C$F:G$bD9$$%i%Y%k$r5a$a$F$*$/!%(B
%
% VAR: longest.label, last.sort.label, next.extra: string
%      longest.label.width, last.extra.num: integer
%
% initialize.longest.label ==
%  BEGIN
%	longest.label := ""
%	last.sort.label := int.to.chr$(0)
%	next.extra := ""
%	longest.label.width := 0
%	last.extra.num := 0
%  END
%
% forward.pass ==
%  BEGIN
%	if last.sort.label = sort.label then
%	    last.extra.num := last.extra.num + 1
%	    extra.label := int.to.chr$(last.extra.num)
%	else
%	    last.extra.num := chr.to.int$("a")
%	    extra.label := ""
%	    last.sort.label := sort.label
%	fi
%  END
%
% reverse.pass ==
%  BEGIN
%	if next.extra = "b" then
%	    extra.label := "a"
%	fi
%	label := label * extra.label
%	if width$(label) > longest.label.width then
%	    longest.label := label
%	    longest.label.width := width$(label)
%	fi
%	next.extra := extra.label
%  END

#if LAB_ALPH

#if SORTED

STRINGS { longest.label last.sort.label next.extra }

INTEGERS { longest.label.width last.extra.num }

FUNCTION {initialize.longest.label}
{ "" 'longest.label :=
  #0 int.to.chr$ 'last.sort.label :=
  "" 'next.extra :=
  #0 'longest.label.width :=
  #0 'last.extra.num :=
}

FUNCTION {forward.pass}
{ last.sort.label sort.label =
    { last.extra.num #1 + 'last.extra.num :=
      last.extra.num int.to.chr$ 'extra.label :=
    }
    { "a" chr.to.int$ 'last.extra.num :=
      "" 'extra.label :=
      sort.label 'last.sort.label :=
    }
  if$
}

FUNCTION {reverse.pass}
{ next.extra "b" =
    { "a" 'extra.label := }
    'skip$
  if$
  label extra.label * 'label :=
  label width$ longest.label.width >
    { label 'longest.label :=
      label width$ 'longest.label.width :=
    }
    'skip$
  if$
  extra.label 'next.extra :=
}

EXECUTE {initialize.longest.label}

ITERATE {forward.pass}

REVERSE {reverse.pass}

#else !SORTED

% $BJ8;zNs%i%Y%k$r;H$&;~$K$O!V0zMQ=g!W$N;29MJ88%%j%9%H$H$9$k$N$O(B
% $B$"$^$jNI$/$J$$!%$7$+$7$=$N>l9g$KHw$($F:G$bD9$$%i%Y%k$r5a$a$F$*$/!%(B

STRINGS { longest.label }

INTEGERS { longest.label.width }

FUNCTION {initialize.longest.label}
{ "" 'longest.label :=
  #0 'longest.label.width :=
}

FUNCTION {longest.label.pass}
{ label width$ longest.label.width >
    { label 'longest.label :=
      label width$ 'longest.label.width :=
    }
    'skip$
  if$
}

EXECUTE {initialize.longest.label}

ITERATE {longest.label.pass}

#endif SORTED

#else !LAB_ALPH


% $B?t;z%i%Y%k$r5a$a$k!%%=!<%H$5$l$?=gHV!$$"$k$$$O85$N=gHV$G=hM}$9$k!%(B
% "thebibliography" environment $B$GI,MW$J>pJs$G$"$k!$(B
% width$ $B$G7W$C$F:G$bD9$$%i%Y%k$bF1;~$K5a$a$F$*$/!%(B

STRINGS { longest.label }

INTEGERS { number.label longest.label.width }

FUNCTION {initialize.longest.label}
{ "" 'longest.label :=
  #1 'number.label :=
  #0 'longest.label.width :=
}

FUNCTION {longest.label.pass}
{ number.label int.to.str$ 'label :=
  number.label #1 + 'number.label :=
  label width$ longest.label.width >
    { label 'longest.label :=
      label width$ 'longest.label.width :=
    }
    'skip$
  if$
}

EXECUTE {initialize.longest.label}

ITERATE {longest.label.pass}

#endif LAB_ALPH

% .BBL $B%U%!%$%k$K=q$-=P$9=`Hw$,@0$C$?!%(B
% $B@h$:J8;zNs%i%Y%k$G>JN,$5$l$?L>A0$r<($9$N$K;H$&(B LaTeX $B%^%/%m$rI,MW$K(B
% $B1~$8$F=q$-$@$7!$<!$K%G!<%?%Y!<%9Cf$N(B `preamble' $B%3%^%s%I$NCf?H$r=q$-=P$9!%(B
% $B$=$7$F(B
%     \begin{thebibliography}{...}
% $B$r=q$-=P$9!%$3$3$G(B `...'$B$O(B width$ $B$G7W;;$7$F:G$bD9$$%i%Y%k$G$"$k!%(B

FUNCTION {begin.bib}
#if LAB_ALPH
{ et.al.char.used
    { "\newcommand{\etalchar}[1]{$^{#1}$}" write$ newline$ }
    'skip$
  if$
  preamble$ empty$
#else !LAB_ALPH
{ preamble$ empty$
#endif LAB_ALPH
    'skip$
    { preamble$ write$ newline$ }
  if$
  "\begin{thebibliography}{"  longest.label  * "}" * write$ newline$
}

EXECUTE {begin.bib}

EXECUTE {init.state.consts}

% $BA4$F$N%(%s%H%j$r=PNO$9$k!%(B

ITERATE {call.type$}

% $B:G8e$K(B `\end{thebibliography}' $B%3%^%s%I$r=q$-=P$7$F$*$7$^$$!*(B

FUNCTION {end.bib}
{ newline$
  "\end{thebibliography}" write$ newline$
}

EXECUTE {end.bib}
