Debian Codegraph @

texmf-dist/bibtex/bst/gbt7714/gbt7714-author-year.bst

raw
1 %%
2 %% This is file `gbt7714-author-year.bst',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% gbt7714-bst.dtx (with options: `2015,authoryear,deprecated')
8 %% -------------------------------------------------------------------
9 %% GB/T 7714 BibTeX Style
10 %% https://github.com/zepinglee/gbt7714-bibtex-style
11 %% Version: 2026-05-26 v2.3.0
12 %% -------------------------------------------------------------------
13 %% Copyright (C) 2016-2026 by Zeping Lee <zepinglee AT gmail DOT com>
14 %% -------------------------------------------------------------------
15 %% This file may be distributed and/or modified under the
16 %% conditions of the LaTeX Project Public License, either version 1.3c
17 %% of this license or (at your option) any later version.
18 %% The latest version of this license is in
19 %% https://www.latex-project.org/lppl.txt
20 %% and version 1.3c or later is part of all distributions of LaTeX
21 %% version 2008 or later.
22 %% -------------------------------------------------------------------
23 INTEGERS {
24 control.convert.punct
25 control.max.bib.names
26 control.min.bib.names
27 control.max.cite.names
28 control.min.cite.names
29 control.uppercase.family
30 control.initialize.with.hyphen
31 control.check.pinyin
32 control.initialize.pinyin
33 control.cite.final.and
34 control.bib.final.and
35 control.space.before.et.al
36 control.year.before.title
37 control.sentence.case.title
38 control.sentence.case.journal
39 control.sentence.case.booktitle
40 control.link.title
41 control.article.title
42 control.patent.country
43 control.entry.type.id
44 control.space.before.type.id
45 control.entry.medium.id
46 control.slash
47 control.in
48 control.emph.booktitle
49 control.emph.journal
50 control.short.journal
51 control.journal.dots
52 control.link.journal
53 control.bold.volume
54 control.unknown.publisher
55 control.space.before.pages
56 control.page.ranges
57 control.urldate
58 control.url
59 control.doi
60 control.cstr
61 control.eprint
62 control.note
63 control.end.dot
64 control.capitalize.subtitle
65 control.warn.empty.field
66 lang.zh.order
67 lang.ja.order
68 lang.en.order
69 lang.ru.order
70 lang.other.order
71 }
72
73 STRINGS {
74 control.bib.punct
75 control.cite.lang
76 control.name.year.delim
77 control.page.range.delim
78 }
79
80 FUNCTION {load.config}
81 {
82 "half" 'control.bib.punct := % GB / half / bylanguage
83 #1 'control.convert.punct :=
84 #3 'control.max.bib.names :=
85 #3 'control.min.bib.names :=
86 #1 'control.max.cite.names :=
87 #1 'control.min.cite.names :=
88 #0 'control.bib.final.and :=
89 #1 'control.cite.final.and :=
90 #1 'control.space.before.et.al :=
91 #1 'control.uppercase.family :=
92 #0 'control.initialize.with.hyphen :=
93 #1 'control.check.pinyin :=
94 #1 'control.initialize.pinyin :=
95 "byentry" 'control.cite.lang := % byentry / chinese / english / macro
96 #1 'control.year.before.title :=
97 "comma" 'control.name.year.delim := % comma / period
98 #1 'control.sentence.case.title :=
99 #1 'control.sentence.case.booktitle :=
100 #0 'control.sentence.case.journal :=
101 #0 'control.capitalize.subtitle :=
102 #0 'control.link.title :=
103 #1 'control.article.title :=
104 #0 'control.patent.country :=
105 #1 'control.entry.type.id :=
106 #0 'control.space.before.type.id :=
107 #1 'control.entry.medium.id :=
108 #1 'control.slash :=
109 #0 'control.in :=
110 #0 'control.emph.booktitle :=
111 #0 'control.emph.journal :=
112 #0 'control.short.journal :=
113 #0 'control.journal.dots :=
114 #0 'control.link.journal :=
115 #0 'control.bold.volume :=
116 #0 'control.unknown.publisher :=
117 #1 'control.space.before.pages :=
118 #1 'control.page.ranges :=
119 "-" 'control.page.range.delim :=
120 #1 'control.urldate :=
121 #1 'control.url :=
122 #1 'control.doi :=
123 #0 'control.cstr :=
124 #0 'control.eprint :=
125 #0 'control.note :=
126 #1 'control.end.dot :=
127 #1 'control.warn.empty.field :=
128 #1 'lang.zh.order :=
129 #2 'lang.ja.order :=
130 #3 'lang.en.order :=
131 #4 'lang.ru.order :=
132 #5 'lang.other.order :=
133 }
134
135 ENTRY
136 { address
137 archiveprefix
138 author
139 bookauthor
140 booksubtitle
141 booktitle
142 booktitleaddon
143 country % 专利国别
144 cstr
145 date
146 dimensions
147 doi
148 edition
149 editor
150 eid
151 entrymediumid
152 entrysubtype
153 entrytypeid
154 eventtitle
155 eprint
156 eprinttype
157 holder
158 howpublished
159 institution
160 journal
161 journalsubtitle
162 journaltitle
163 journaltitleaddon
164 key
165 langid
166 language
167 location
168 mainsubtitle
169 maintitle
170 maintitleaddon
171 mark
172 medium
173 nationality % 专利国别,兼容 IEEEtran.bst
174 note
175 number
176 organization
177 pages
178 publisher
179 scale
180 school
181 series
182 shortjournal
183 subtitle
184 title
185 titleaddon
186 translator
187 url
188 urldate
189 version
190 volume
191 year
192 CTL_bib_punct
193 CTL_convert_punct
194 CTL_max_bib_names
195 CTL_min_bib_names
196 CTL_max_cite_names
197 CTL_min_cite_names
198 CTL_uppercase_family
199 CTL_initialize_with_hyphen
200 CTL_check_pinyin
201 CTL_initialize_pinyin
202 CTL_bib_final_and
203 CTL_cite_final_and
204 CTL_cite_lang
205 CTL_space_before_et_al
206 CTL_year_before_title
207 CTL_name_year_delim
208 CTL_sentence_case
209 CTL_sentence_case_title
210 CTL_sentence_case_booktitle
211 CTL_sentence_case_journal
212 CTL_capitalize_subtitle
213 CTL_link_title
214 CTL_article_title
215 CTL_patent_country
216 CTL_entry_type_id
217 CTL_space_before_type_id
218 CTL_entry_medium_id
219 CTL_slash
220 CTL_in
221 CTL_emph_booktitle
222 CTL_emph_journal
223 CTL_short_journal
224 CTL_journal_dots
225 CTL_link_journal
226 CTL_bold_volume
227 CTL_unknown_publisher
228 CTL_space_before_pages
229 CTL_page_ranges
230 CTL_page_range_delim
231 CTL_urldate
232 CTL_url
233 CTL_doi
234 CTL_eprint
235 CTL_note
236 CTL_end_dot
237 CTL_warn_empty_field
238 }
239 { entry.lang is.lang.cjk entry.numbered require.url }
240 { label extra.label sort.label short.list entry.type.id entry.eprint entry.url }
241
242 INTEGERS { output.state before.all mid.sentence after.sentence after.block after.punct }
243
244 INTEGERS { lang.zh lang.ja lang.ko lang.en lang.ru lang.other }
245
246 INTEGERS { charptr len }
247
248 STRINGS { pinyin.table }
249
250 FUNCTION {init.state.consts}
251 { #0 'before.all :=
252 #1 'mid.sentence :=
253 #2 'after.sentence :=
254 #3 'after.block :=
255 #4 'after.punct :=
256 #3 'lang.zh :=
257 #4 'lang.ja :=
258 #5 'lang.ko :=
259 #1 'lang.en :=
260 #2 'lang.ru :=
261 #0 'lang.other :=
262 " a ai an ang ao "
263 "ba bai ban bang bao bei ben beng bi bian biao bie bin bing bo bu " *
264 "ca cai can cang cao ce cen ceng cha chai chan chang chao che chen cheng chi chong chou chu chuai chuan chuang chui chun chuo ci cong cou cu cuan cui cun cuo " *
265 "da dai dan dang dao de dei deng di dia dian diao die ding diu dong dou du duan dui dun duo " *
266 "e ei en eng er " *
267 "fa fan fang fei fen feng fo fou fu " *
268 "ga gai gan gang gao ge gei gen geng gong gou gu gua guai guan guang gui gun guo " *
269 "ha hai han hang hao he hei hen heng hong hou hu hua huai huan huang hui hun huo " *
270 "ji jia jian jiang jiao jie jin jing jiong jiu ju juan jue jun " *
271 "ka kai kan kang kao ke ken keng kong kou ku kua kuai kuan kuang kui kun kuo " *
272 "la lai lan lang lao le lei leng li lia lian liang liao lie lin ling liu long lou lu luan lun luo lü lüe lyu lyue " *
273 "ma mai man mang mao me mei men meng mi mian miao mie min ming miu mo mou mu " *
274 "na nai nan nang nao ne nei nen neng ni nian niang niao nie nin ning niu nong nu nuan nuo nü nüe nyu nyue " *
275 "o ou " *
276 "pa pai pan pang pao pei pen peng pi pian piao pie pin ping po pou pu " *
277 "qi qia qian qiang qiao qie qin qing qiong qiu qu quan que qun " *
278 "ran rang rao re ren reng ri rong rou ru ruan rui run ruo " *
279 "sa sai san sang sao se sen seng sha shai shan shang shao she shei shen sheng shi shou shu shua shuai shuan shuang shui shun shuo si song sou su suan sui sun suo " *
280 "ta tai tan tang tao te teng ti tian tiao tie ting tong tou tu tuan tui tun tuo " *
281 "wa wai wan wang wei wen weng wo wu " *
282 "xi xia xian xiang xiao xie xin xing xiong xiu xu xuan xue xun " *
283 "ya yan yang yao ye yi yin ying yong you yu yuan yue yun " *
284 "za zai zan zang zao ze zei zen zeng zha zhai zhan zhang zhao zhe zhei zhen zheng zhi zhong zhou zhu zhua zhuai zhuan zhuang zhui zhun zhuo zi zong zou zu zuan zui zun zuo " *
285 'pinyin.table :=
286 "The style name 'gbt7714-author-year' is deprecated. Use 'gbt7714-authoryear' instead." warning$
287 }
288
289 FUNCTION {bbl.anonymous}
290 { entry.lang lang.zh =
291 { "佚名" }
292 { "Anon" }
293 if$
294 }
295
296 FUNCTION {bbl.no.date}
297 { entry.lang lang.zh =
298 { "无日期" }
299 { "n.d." }
300 if$
301 }
302
303 FUNCTION {space.precedes.et.al}
304 { is.lang.cjk
305 { control.space.before.et.al
306 { "\ " }
307 { "" }
308 if$
309 }
310 { " " }
311 if$
312 }
313
314 FUNCTION {bbl.and}
315 { entry.lang lang.zh =
316 { "和" }
317 { entry.lang lang.ja =
318 { "と" }
319 { entry.lang lang.ru =
320 { "и" }
321 { "and" }
322 if$
323 }
324 if$
325 }
326 if$
327 }
328
329 FUNCTION {bbl.et.al}
330 { entry.lang lang.zh =
331 { "等" }
332 { entry.lang lang.ja =
333 { "ほか" }
334 { entry.lang lang.ru =
335 { "и~др." }
336 { "et~al." }
337 if$
338 }
339 if$
340 }
341 if$
342 }
343
344 FUNCTION {cite.and}
345 { control.cite.lang "byentry" =
346 'bbl.and
347 { control.cite.lang "macro" =
348 { "{\biband}" }
349 { control.cite.lang "chinese" =
350 { "和" }
351 { "and" }
352 if$
353 }
354 if$
355 }
356 if$
357 }
358
359 FUNCTION {cite.et.al}
360 { control.cite.lang "byentry" =
361 { bbl.et.al }
362 { control.cite.lang "macro" =
363 { "{\bibetal}" }
364 { control.cite.lang "chinese" =
365 { "等" }
366 { "et~al." }
367 if$
368 }
369 if$
370 }
371 if$
372 }
373
374 FUNCTION {bbl.in}
375 { entry.lang lang.zh =
376 { "见" }
377 { "In" }
378 if$
379 }
380
381 FUNCTION {bbl.translator}
382 { entry.lang lang.zh =
383 { "译" }
384 { "trans." }
385 if$
386 }
387
388 FUNCTION {bbl.wide.space} { "\quad " }
389
390 FUNCTION {bbl.edition}
391 { entry.lang lang.zh =
392 { "版" }
393 { entry.lang lang.ja =
394 { "版" }
395 { entry.lang lang.ru =
396 { "изд." }
397 { "ed." }
398 if$
399 }
400 if$
401 }
402 if$
403 }
404
405 FUNCTION {bbl.double.slash} { "//\allowbreak" }
406
407 FUNCTION {bbl.sine.loco}
408 { entry.lang lang.zh =
409 { "出版地不详" }
410 { "S.l." }
411 if$
412 }
413
414 FUNCTION {bbl.sine.nomine}
415 { entry.lang lang.zh =
416 { "出版者不详" }
417 { "s.n." }
418 if$
419 }
420
421 FUNCTION {bbl.sine.loco.sine.nomine}
422 { entry.lang lang.zh =
423 { "出版地不详: 出版者不详" }
424 { "S.l.: s.n." }
425 if$
426 }
427
428 FUNCTION {default.self.tokens} { ":,-'–—?.!" }
429
430 FUNCTION {latin.upper} { "ÀÁÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞŸĀĂĄĆĈĊČĎĐĒĔĖĘĚĜĞĠĢĤĦĨĪĬĮİIĴĶĹĻĽĿŁŃŅŇŊŌŎŐŒŔŖŘŚŜŞŠŢŤŦŨŪŬŮŰŲŴŶŸŹŻŽ" }
431
432 FUNCTION {latin.lower} { "àáãäåæçèéêëìíîïðñòóôõöøùúûüýþÿāăąćĉċčďđēĕėęěĝğġģĥħĩīĭįiıĵķĺļľŀłńņňŋōŏőœŕŗřśŝşšţťŧũūŭůűųŵŷÿźżž" }
433
434 FUNCTION {range.delimiters} { "-–—~" }
435
436 FUNCTION {not}
437 { { #0 }
438 { #1 }
439 if$
440 }
441
442 FUNCTION {and}
443 { 'skip$
444 { pop$ #0 }
445 if$
446 }
447
448 FUNCTION {or}
449 { { pop$ #1 }
450 'skip$
451 if$
452 }
453
454 FUNCTION {string.length}
455 { #0 swap$
456 { duplicate$ "" = not }
457 { swap$ #1 + swap$
458 #2 global.max$ substring$
459 }
460 while$
461 pop$
462 }
463
464 STRINGS { x y }
465
466 STRINGS { replace find text }
467
468 FUNCTION {contains}
469 { 'find :=
470 'text :=
471 find string.length 'len :=
472 text string.length len - #1 + 'charptr :=
473 { charptr #0 >
474 text charptr len substring$ find = not
475 and
476 }
477 { charptr #1 - 'charptr := }
478 while$
479 charptr #0 >
480 }
481
482 STRINGS { s t }
483
484 FUNCTION {add.period}
485 { "bylanguage" control.bib.punct =
486 { is.lang.cjk
487 { "." * }
488 'add.period$
489 if$
490 }
491 'add.period$
492 if$
493 }
494
495 FUNCTION {after.period.space}
496 { is.lang.cjk
497 "bylanguage" control.bib.punct = and
498 { "" }
499 { " " }
500 if$
501 }
502
503 FUNCTION {add.comma}
504 { "bylanguage" control.bib.punct =
505 is.lang.cjk and
506 "GB" control.bib.punct = or
507 { "," * }
508 { ", " * }
509 if$
510 }
511
512 FUNCTION {add.colon}
513 { "bylanguage" control.bib.punct =
514 is.lang.cjk and
515 "GB" control.bib.punct = or
516 { ":" * }
517 { ": " * }
518 if$
519 }
520
521 FUNCTION {add.colon.by.language}
522 { is.lang.cjk
523 { ":" * }
524 { ": " * }
525 if$
526 }
527
528 FUNCTION {bbl.pages.colon}
529 { "bylanguage" control.bib.punct =
530 is.lang.cjk and
531 "GB" control.bib.punct = or
532 { ":" }
533 { control.space.before.pages
534 { ": " }
535 { ":\allowbreak " }
536 if$
537 }
538 if$
539 }
540
541 FUNCTION {make.parentheses}
542 { "bylanguage" control.bib.punct =
543 is.lang.cjk and
544 "GB" control.bib.punct = or
545 { "(" swap$ * ")" * }
546 { "(" swap$ * ")" * }
547 if$
548 }
549
550 FUNCTION {make.brackets}
551 { "[" swap$ * "]" *
552 }
553
554 INTEGERS { find_length }
555 FUNCTION { find.replace }
556 { 'replace :=
557 'find :=
558 'text :=
559 find string.length 'find_length :=
560 ""
561 { text empty$ not }
562 { text #1 find_length substring$ find =
563 { replace *
564 text #1 find_length + global.max$ substring$ 'text :=
565 }
566 { text #1 #1 substring$ *
567 text #2 global.max$ substring$ 'text :=
568 }
569 if$
570 }
571 while$
572 }
573
574 FUNCTION {convert.fullwidth.punctuations}
575 { ", " "," find.replace
576 ": " ":" find.replace
577 "; " ";" find.replace
578 "! " "!" find.replace
579 "!" "!" find.replace
580 "? " "?" find.replace
581 "?" "?" find.replace
582 " (" "(" find.replace
583 "(" "(" find.replace
584 ") " ")" find.replace
585 ")" ")" find.replace
586 }
587
588 FUNCTION {convert.halfwidth.punctuations}
589 { "." ". " find.replace
590 "," ", " find.replace
591 ":" ": " find.replace
592 ";" "; " find.replace
593 "!" "! " find.replace
594 "?" "? " find.replace
595 "(" " (" find.replace
596 ")." ")." find.replace
597 ")," ")," find.replace
598 "):" "):" find.replace
599 ");" ");" find.replace
600 ")}" ")}" find.replace
601 ")" ") " find.replace
602 % Strip leading and trailing spaces
603 duplicate$ #1 #1 substring$ " " =
604 { #2 global.max$ substring$ }
605 'skip$
606 if$
607 duplicate$ #-1 #1 substring$ " " =
608 { duplicate$ string.length #1 - #1 swap$ substring$ }
609 'skip$
610 if$
611 }
612
613 FUNCTION {convert.punctuations}
614 { "GB" control.bib.punct =
615 { "." ". " find.replace
616 convert.fullwidth.punctuations
617 }
618 { "half" control.bib.punct =
619 { convert.halfwidth.punctuations }
620 { "bylanguage" control.bib.punct =
621 { is.lang.cjk
622 { ". " "." find.replace
623 convert.fullwidth.punctuations
624 }
625 { convert.halfwidth.punctuations }
626 if$
627 }
628 'skip$
629 if$
630 }
631 if$
632 }
633 if$
634 }
635
636 FUNCTION {format.punctuations}
637 { control.convert.punct
638 'convert.punctuations
639 'skip$
640 if$
641 is.lang.cjk
642 { "---" "—" find.replace
643 "--" "—" find.replace
644 }
645 { "“" "``" find.replace
646 "”" "''" find.replace
647 "‘" "`" find.replace
648 "’" "'" find.replace
649 "—" "---" find.replace
650 "–" "--" find.replace
651 }
652 if$
653 }
654
655 STRINGS { output.punct }
656
657 FUNCTION {set.punct}
658 { output.state mid.sentence =
659 output.state after.punct = or
660 { 'output.punct :=
661 after.punct 'output.state :=
662 }
663 'pop$
664 if$
665 }
666
667 FUNCTION {output.nonnull}
668 { 's :=
669 output.state mid.sentence =
670 { add.comma write$ }
671 { output.state after.block =
672 { add.period write$
673 newline$
674 "\newblock " write$
675 }
676 { output.state before.all =
677 'write$
678 { output.state after.punct =
679 { output.punct * write$ }
680 { add.period after.period.space * write$ }
681 if$
682 }
683 if$
684 }
685 if$
686 mid.sentence 'output.state :=
687 }
688 if$
689 s
690 }
691
692 FUNCTION {output}
693 { duplicate$ empty$
694 'pop$
695 'output.nonnull
696 if$
697 }
698
699 FUNCTION {output.check}
700 { 't :=
701 duplicate$ empty$
702 { pop$
703 control.warn.empty.field
704 { "empty " t * " in " * cite$ * warning$ }
705 'skip$
706 if$
707 }
708 'output.nonnull
709 if$
710 }
711
712 FUNCTION {fin.entry}
713 { control.end.dot
714 'add.period
715 'skip$
716 if$
717 write$
718 newline$
719 }
720
721 FUNCTION {new.block}
722 { output.state before.all =
723 'skip$
724 { after.block 'output.state := }
725 if$
726 }
727
728 FUNCTION {new.sentence}
729 { output.state after.block =
730 'skip$
731 { output.state before.all =
732 'skip$
733 { after.sentence 'output.state := }
734 if$
735 }
736 if$
737 }
738
739 FUNCTION {new.slash}
740 { output.state before.all =
741 'skip$
742 { control.slash
743 { bbl.double.slash * write$
744 newline$
745 ""
746 before.all 'output.state :=
747 }
748 { new.block }
749 if$
750 }
751 if$
752 }
753
754 FUNCTION {new.block.checka}
755 { empty$
756 'skip$
757 'new.block
758 if$
759 }
760
761 FUNCTION {new.block.checkb}
762 { empty$
763 swap$ empty$
764 and
765 'skip$
766 'new.block
767 if$
768 }
769
770 FUNCTION {new.sentence.checka}
771 { empty$
772 'skip$
773 'new.sentence
774 if$
775 }
776
777 FUNCTION {new.sentence.checkb}
778 { empty$
779 swap$ empty$
780 and
781 'skip$
782 'new.sentence
783 if$
784 }
785
786 INTEGERS { a b }
787
788 FUNCTION {is.int.in.range}
789 { 'b :=
790 #1 +
791 b >
792 { #1 - b < }
793 { pop$ #0 }
794 if$
795 }
796
797 FUNCTION {mult.power2}
798 { { duplicate$ #0 > }
799 { swap$
800 duplicate$ +
801 swap$ #1 -
802 }
803 while$
804 pop$
805 }
806
807 FUNCTION {find.match.brace}
808 { 's :=
809 't :=
810 #1
811 { duplicate$ #0 >
812 s empty$ not and }
813 { s #1 #1 substring$ "{" =
814 { #1 + }
815 { s #1 #1 substring$ "}" =
816 { #1 - }
817 'skip$
818 if$
819 }
820 if$
821 t s #1 #1 substring$ * 't :=
822 s #2 global.max$ substring$ 's :=
823 }
824 while$
825
826 duplicate$ #0 >
827 { "Unbalanced brace(s): one or more closing braces are missing" warning$
828 { duplicate$ #0 > }
829 { t "}" * 't :=
830 #1 -
831 }
832 while$
833 }
834 'skip$
835 if$
836 pop$
837
838 t
839 s
840 }
841
842 FUNCTION {split.first.char.from.str}
843 { duplicate$ "" =
844 { "split.first.char.from.str: Trying to split an empty string!" warning$
845 ""
846 }
847 { duplicate$ #1 #1 substring$ chr.to.int$ #128 <
848 { duplicate$ #1 #1 substring$ swap$
849 #2 global.max$ substring$ swap$
850 }
851 { duplicate$ #1 #1 substring$ chr.to.int$ #224 <
852 { duplicate$ #1 #2 substring$ swap$
853 #3 global.max$ substring$ swap$
854 }
855 { duplicate$ #1 #1 substring$ chr.to.int$ #240 <
856 { duplicate$ #1 #3 substring$ swap$
857 #4 global.max$ substring$ swap$
858 }
859 { duplicate$ #1 #4 substring$ swap$
860 #5 global.max$ substring$ swap$
861 }
862 if$
863 }
864 if$
865 }
866 if$
867 }
868 if$
869 }
870
871 FUNCTION {get.first.char.from.str}
872 { split.first.char.from.str swap$ pop$ }
873
874 FUNCTION {split.first.tex.char.from.str}
875 { duplicate$ #1 #1 substring$ "{" =
876 { split.first.char.from.str swap$
877 find.match.brace swap$
878 }
879 'split.first.char.from.str
880 if$
881 }
882
883 FUNCTION {char.to.unicode}
884 { duplicate$ #4 #1 substring$ "" =
885 { duplicate$ #3 #1 substring$ "" =
886 { duplicate$ #2 #1 substring$ "" =
887 { duplicate$ "" =
888 { "Empty string is not a char!" warning$
889 pop$ #-1
890 }
891 { #1 #1 substring$ chr.to.int$ }
892 if$
893 }
894 { duplicate$ #2 #1 substring$ chr.to.int$ #128 - swap$
895 #1 #1 substring$ chr.to.int$ #192 -
896 #6 mult.power2 +
897 }
898 if$
899 }
900 { duplicate$ #3 #1 substring$ chr.to.int$ #128 - swap$
901 duplicate$ #2 #1 substring$ chr.to.int$ #128 - swap$
902 #1 #1 substring$ chr.to.int$ #224 -
903 #6 mult.power2 +
904 #6 mult.power2 +
905 }
906 if$
907 }
908 { duplicate$ #4 #1 substring$ chr.to.int$ #128 - swap$
909 duplicate$ #3 #1 substring$ chr.to.int$ #128 - swap$
910 duplicate$ #2 #1 substring$ chr.to.int$ #128 - swap$
911 #1 #1 substring$ chr.to.int$ #240 -
912 #6 mult.power2 +
913 #6 mult.power2 +
914 #6 mult.power2 +
915 }
916 if$
917 }
918
919 FUNCTION {is.char.in.str}
920 { 't :=
921 t "" =
922 { "is.char.in.str: Empty string is not a char!" warning$ }
923 'skip$
924 if$
925
926 #0 swap$
927 { duplicate$ "" = not }
928 { split.first.char.from.str t =
929 { pop$ pop$ #1 "" }
930 'skip$
931 if$
932 }
933 while$
934 pop$
935 }
936
937 FUNCTION {is.upper.ascii}
938 { char.to.unicode #65 swap$ #90 swap$ is.int.in.range }
939
940 FUNCTION {is.upper}
941 { duplicate$ is.upper.ascii
942 { pop$ #1 }
943 { latin.upper swap$ is.char.in.str }
944 if$
945 }
946
947 FUNCTION {is.lower.ascii}
948 { char.to.unicode #97 swap$ #122 swap$ is.int.in.range }
949
950 FUNCTION {is.lower}
951 { duplicate$ is.lower.ascii
952 { pop$ #1 }
953 { latin.lower swap$ is.char.in.str }
954 if$
955 }
956
957 FUNCTION {is.printable.ascii}
958 { char.to.unicode #32 swap$ #126 swap$ is.int.in.range }
959
960 FUNCTION {is.letter.ascii}
961 { duplicate$ is.upper.ascii swap$ is.lower.ascii or }
962
963 FUNCTION {is.symbol.ascii}
964 { duplicate$ is.printable.ascii swap$ is.letter.ascii not and }
965
966 FUNCTION {is.all.lower}
967 { #1 swap$
968 { duplicate$ "" = not }
969 { split.first.char.from.str is.lower
970 'skip$
971 { pop$ pop$ #0 "" }
972 if$
973 }
974 while$
975 pop$
976 }
977
978 FUNCTION {is.tex.str.in.title.case}
979 { duplicate$ "" =
980 { pop$ #0 }
981 { split.first.tex.char.from.str purify$
982 duplicate$ "" =
983 { pop$ pop$ #0 }
984 { split.first.char.from.str is.upper
985 { duplicate$ "" = % single-letter word
986 { pop$ pop$ #1 }
987 { duplicate$ is.all.lower
988 { empty$
989 { duplicate$ "" =
990 { pop$ #0 }
991 'is.all.lower
992 if$
993 }
994 'is.all.lower
995 if$
996 }
997 { pop$ pop$ #0 }
998 if$
999 }
1000 if$
1001 }
1002 { pop$ pop$ #0}
1003 if$
1004 }
1005 if$
1006 }
1007 if$
1008 }
1009
1010 FUNCTION {is.in.inter.token.chars}
1011 { duplicate$ #0 =
1012 { pop$ " " = }
1013 { #1 =
1014 { " " range.delimiters * swap$ is.char.in.str }
1015 'is.letter.ascii
1016 if$
1017 }
1018 if$
1019 }
1020
1021 FUNCTION {skip.inter.token.chars.by}
1022 { 'b :=
1023 't :=
1024
1025 "" t
1026 { duplicate$ "" = not }
1027 { split.first.char.from.str
1028 duplicate$ b is.in.inter.token.chars
1029 { swap$ 't := * t }
1030 { swap$ * 't := "" }
1031 if$
1032 }
1033 while$
1034
1035 pop$ t
1036 }
1037
1038 FUNCTION {skip.inter.token.chars}
1039 { #0 skip.inter.token.chars.by }
1040
1041 FUNCTION {skip.inter.token.command}
1042 { duplicate$ "" =
1043 { "" }
1044 { duplicate$ #1 #1 substring$ is.symbol.ascii
1045 { split.first.char.from.str swap$ }
1046 { #2 skip.inter.token.chars.by }
1047 if$
1048 }
1049 if$
1050 }
1051
1052 FUNCTION {is.special.char.command}
1053 { #2 global.max$ substring$ skip.inter.token.command
1054 empty$
1055 'skip$
1056 { "is.special.char.command: cmdstr has extra components!" warning$ }
1057 if$
1058
1059 duplicate$ duplicate$ duplicate$ duplicate$ duplicate$ duplicate$
1060 "oOlLij" swap$ is.char.in.str
1061 swap$ "oe" = or
1062 swap$ "OE" = or
1063 swap$ "ae" = or
1064 swap$ "AE" = or
1065 swap$ "aa" = or
1066 swap$ "AA" = or
1067 }
1068
1069 FUNCTION {map.char}
1070 { 't :=
1071 split.first.char.from.str
1072 { swap$ duplicate$ "" = not }
1073 { swap$ t =
1074 { pop$ "" t }
1075 { swap$ split.first.char.from.str pop$ swap$
1076 split.first.char.from.str
1077 }
1078 if$
1079 }
1080 while$
1081 pop$ t =
1082 'get.first.char.from.str
1083 { pop$ t }
1084 if$
1085 }
1086
1087 FUNCTION {to.lower}
1088 { duplicate$ is.upper.ascii
1089 { chr.to.int$ #32 + int.to.chr$ }
1090 { latin.lower swap$ latin.upper swap$ map.char }
1091 if$
1092 }
1093
1094 FUNCTION {to.upper}
1095 { duplicate$ is.lower.ascii
1096 { chr.to.int$ #32 - int.to.chr$ }
1097 { latin.upper swap$ latin.lower swap$ map.char }
1098 if$
1099 }
1100
1101 FUNCTION {all.to.lower}
1102 { "" swap$
1103 { duplicate$ empty$ not }
1104 { split.first.char.from.str to.lower swap$ 't := * t }
1105 while$
1106 *
1107 }
1108
1109 FUNCTION {command.to.lower}
1110 { duplicate$ "" =
1111 { "command.to.lower: Empty string is not a texchar!" warning$ }
1112 { duplicate$ #1 #1 substring$ #92 int.to.chr$ =
1113 { duplicate$ is.special.char.command
1114 'all.to.lower
1115 'skip$
1116 if$
1117 }
1118 'to.lower
1119 if$
1120 }
1121 if$
1122 }
1123
1124 FUNCTION {tex.to.lower}
1125 { duplicate$ #1 #2 substring$ "{" #92 int.to.chr$ * =
1126 { "" swap$
1127 { duplicate$ "" = not }
1128 { split.first.char.from.str
1129 duplicate$ #92 int.to.chr$ =
1130 { swap$ skip.inter.token.command 't := * t
1131 swap$ command.to.lower
1132 }
1133 'to.lower
1134 if$
1135 swap$ 't := * t
1136 }
1137 while$
1138 pop$
1139 }
1140 { duplicate$ #1 #1 substring$ "{" =
1141 { split.first.char.from.str swap$ find.match.brace pop$ }
1142 'command.to.lower
1143 if$
1144 }
1145 if$
1146 }
1147
1148 FUNCTION {all.to.upper}
1149 { "" swap$
1150 { duplicate$ empty$ not }
1151 { split.first.char.from.str to.upper swap$ 't := * t }
1152 while$
1153 *
1154 }
1155
1156 FUNCTION {command.to.upper}
1157 { duplicate$ "" =
1158 { "command.to.lower: Empty string is not a texchar!" warning$ }
1159 { duplicate$ #1 #1 substring$ #92 int.to.chr$ =
1160 { duplicate$ is.special.char.command
1161 'all.to.upper
1162 'skip$
1163 if$
1164 }
1165 'to.upper
1166 if$
1167 }
1168 if$
1169 }
1170
1171 FUNCTION {tex.to.upper}
1172 { duplicate$ #1 #2 substring$ "{" #92 int.to.chr$ * =
1173 { "" swap$
1174 { duplicate$ "" = not }
1175 { split.first.char.from.str
1176 duplicate$ #92 int.to.chr$ =
1177 { swap$ skip.inter.token.command 't := * t
1178 swap$ command.to.upper
1179 }
1180 'to.upper
1181 if$
1182 swap$ 't := * t
1183 }
1184 while$
1185 pop$
1186 }
1187 { duplicate$ #1 #1 substring$ "{" =
1188 { split.first.char.from.str swap$ find.match.brace pop$ }
1189 'command.to.upper
1190 if$
1191 }
1192 if$
1193 }
1194
1195 FUNCTION {lower.token.if.in.title.case}
1196 { duplicate$ is.tex.str.in.title.case
1197 { split.first.tex.char.from.str tex.to.lower swap$ * }
1198 'skip$
1199 if$
1200 }
1201
1202 FUNCTION {self.tokens}
1203 { #0 =
1204 'default.self.tokens
1205 'range.delimiters
1206 if$
1207 }
1208
1209 FUNCTION {tokenize.by}
1210 { 'b :=
1211 's :=
1212
1213 s "" =
1214 { "" "" }
1215 { s split.first.char.from.str
1216 duplicate$ b self.tokens swap$ is.char.in.str
1217 'swap$
1218 { duplicate$ #92 int.to.chr$ =
1219 { swap$ skip.inter.token.command 's := * s }
1220 { pop$ pop$ "" s
1221 { duplicate$ "" = not }
1222 { split.first.char.from.str
1223 duplicate$ "\ " b self.tokens * swap$ is.char.in.str
1224 { pop$ pop$ "" }
1225 { duplicate$ "{" =
1226 { swap$ find.match.brace }
1227 'swap$
1228 if$
1229 's := * s
1230 }
1231 if$
1232 }
1233 while$
1234 pop$ s
1235 }
1236 if$
1237 }
1238 if$
1239 }
1240 if$
1241 }
1242
1243 FUNCTION {tokenize}
1244 { #0 tokenize.by }
1245
1246 FUNCTION {smart.sentence.case}
1247 { tokenize 's :=
1248
1249 { s "" = not }
1250 { s skip.inter.token.chars 's := * s
1251 tokenize swap$
1252 duplicate$ ":" =
1253 { swap$ 's := *
1254 s skip.inter.token.chars 's := * s
1255 tokenize swap$
1256 control.capitalize.subtitle
1257 'skip$
1258 { lower.token.if.in.title.case }
1259 if$
1260 }
1261 'lower.token.if.in.title.case
1262 if$
1263 swap$ 's := *
1264 }
1265 while$
1266 }
1267
1268 FUNCTION {smart.upper.case}
1269 { s swap$ t swap$
1270
1271 "" swap$
1272 { duplicate$ "" = not }
1273 { tokenize swap$
1274 duplicate$ #1 #1 substring$ #92 int.to.chr$ =
1275 'command.to.upper
1276 { "" swap$
1277 { duplicate$ "" = not }
1278 { split.first.tex.char.from.str tex.to.upper
1279 swap$ 't := * t
1280 }
1281 while$
1282 pop$
1283 }
1284 if$
1285 swap$ 't := * t
1286 skip.inter.token.chars 't := * t
1287 }
1288 while$
1289 pop$
1290
1291 swap$ 't :=
1292 swap$ 's :=
1293 }
1294
1295 FUNCTION {field.or.null}
1296 { duplicate$ empty$
1297 { pop$ "" }
1298 'skip$
1299 if$
1300 }
1301
1302 FUNCTION {emphasize}
1303 { duplicate$ empty$
1304 { pop$ "" }
1305 { "\emph{" swap$ * "}" * }
1306 if$
1307 }
1308
1309 FUNCTION {emphasize.book.title}
1310 { control.emph.booktitle
1311 is.lang.cjk not and
1312 'emphasize
1313 'skip$
1314 if$
1315 }
1316
1317 INTEGERS { codepoint tmp.lang }
1318
1319 FUNCTION {get.codepoint.lang}
1320 { 'codepoint :=
1321 codepoint #128 <
1322 { codepoint #64 > codepoint #91 < and codepoint #96 > codepoint #123 < and or
1323 { lang.en }
1324 { lang.other }
1325 if$
1326 }
1327 { codepoint #1023 > codepoint #1328 < and
1328 { lang.ru }
1329 { codepoint #19967 > codepoint #40960 < and
1330 { lang.zh }
1331 { codepoint #13311 > codepoint #19904 < and
1332 { lang.zh }
1333 { codepoint #12351 > codepoint #12544 < and
1334 { lang.ja }
1335 { codepoint #44031 > codepoint #55216 < and
1336 { lang.ko }
1337 { lang.other }
1338 if$
1339 }
1340 if$
1341 }
1342 if$
1343 }
1344 if$
1345 }
1346 if$
1347 }
1348 if$
1349 }
1350
1351 FUNCTION {get.str.lang}
1352 { lang.other 'tmp.lang :=
1353 { duplicate$ empty$ not }
1354 { split.first.char.from.str
1355 char.to.unicode
1356 get.codepoint.lang
1357 duplicate$ tmp.lang >
1358 { 'tmp.lang := }
1359 'pop$
1360 if$
1361 }
1362 while$
1363 duplicate$ empty$
1364 { pop$ }
1365 { "non-empty string " quote$ swap$ * quote$ " left" warning$ }
1366 if$
1367 tmp.lang
1368 }
1369
1370 FUNCTION {check.entry.lang}
1371 { title field.or.null
1372 duplicate$ empty$
1373 { author field.or.null * }
1374 'skip$
1375 if$
1376 duplicate$ empty$
1377 { journal field.or.null * }
1378 'skip$
1379 if$
1380 duplicate$ empty$
1381 { journaltitle field.or.null * }
1382 'skip$
1383 if$
1384 duplicate$ empty$
1385 { booktitle field.or.null * }
1386 'skip$
1387 if$
1388 duplicate$ empty$
1389 { address field.or.null * }
1390 'skip$
1391 if$
1392 duplicate$ empty$
1393 { location field.or.null * }
1394 'skip$
1395 if$
1396 duplicate$ empty$
1397 { publisher field.or.null * }
1398 'skip$
1399 if$
1400 get.str.lang
1401 }
1402
1403 FUNCTION {set.entry.lang}
1404 { langid empty$
1405 { language empty$
1406 { "" }
1407 { language }
1408 if$
1409 }
1410 { langid }
1411 if$
1412 "l" change.case$
1413 's :=
1414 s empty$
1415 { check.entry.lang }
1416 { s "english" = s "american" = or s "british" = or
1417 { lang.en }
1418 { s "chinese" =
1419 { lang.zh }
1420 { s "japanese" =
1421 { lang.ja }
1422 { s "korean" =
1423 { lang.ko }
1424 { s "russian" =
1425 { lang.ru }
1426 { lang.other }
1427 if$
1428 }
1429 if$
1430 }
1431 if$
1432 }
1433 if$
1434 }
1435 if$
1436 }
1437 if$
1438 'entry.lang :=
1439 #0 'is.lang.cjk :=
1440 entry.lang lang.zh =
1441 entry.lang lang.ja = or
1442 entry.lang lang.ko = or
1443 { #1 'is.lang.cjk := }
1444 'skip$
1445 if$
1446 }
1447
1448 FUNCTION {set.entry.numbered}
1449 { type$ "archive" =
1450 type$ "letter" = or
1451 type$ "legislation" = or
1452 type$ "patent" = or
1453 type$ "regulation" = or
1454 type$ "report" = or
1455 type$ "standard" = or
1456 type$ "techreport" = or
1457 { #1 'entry.numbered := }
1458 { #0 'entry.numbered := }
1459 if$
1460 }
1461
1462 INTEGERS { nameptr namesleft numnames name.lang }
1463
1464 FUNCTION {is.lowercase.word}
1465 { #1
1466 { #0 > }
1467 { duplicate$ #1 #1 substring$ chr.to.int$
1468 duplicate$ #96 >
1469 swap$ #123 <
1470 and
1471 { #2 global.max$ substring$
1472 duplicate$ empty$
1473 { #0 }
1474 { #1 }
1475 if$
1476 }
1477 { #0 }
1478 if$
1479 }
1480 while$
1481 empty$
1482 }
1483
1484 FUNCTION {is.single.pinyin}
1485 { " " swap$ * " " *
1486 pinyin.table swap$ contains
1487 }
1488
1489 FUNCTION {is.single.pinyin.word}
1490 { duplicate$ is.lowercase.word
1491 'is.single.pinyin
1492 { pop$ #0 }
1493 if$
1494 }
1495
1496 FUNCTION {is.double.pinyin}
1497 { duplicate$ string.length 'a :=
1498 #1
1499 { a #0 > and }
1500 { duplicate$ #1 a substring$ is.single.pinyin
1501 { duplicate$ a #1 + global.max$ substring$
1502 duplicate$ empty$
1503 { pop$ #0 }
1504 { is.single.pinyin
1505 { #0 }
1506 { a #1 - 'a :=
1507 #1
1508 }
1509 if$
1510 }
1511 if$
1512 }
1513 { a #1 - 'a :=
1514 #1
1515 }
1516 if$
1517 }
1518 while$
1519 't :=
1520 t #1 #1 substring$
1521 t a #1 + #1 substring$
1522 duplicate$ empty$
1523 'pop$
1524 { " " swap$ * * }
1525 if$
1526 't :=
1527 a #0 >
1528 }
1529
1530 FUNCTION {is.double.pinyin.word}
1531 { duplicate$ is.lowercase.word
1532 'is.double.pinyin
1533 { pop$ #0 }
1534 if$
1535 }
1536
1537 FUNCTION {extract.before}
1538 { 'find :=
1539 'text :=
1540 find string.length 'find_length :=
1541 ""
1542 { text empty$ not }
1543 { text #1 find_length substring$ find =
1544 { "" 'text := }
1545 { text #1 #1 substring$ *
1546 text #2 global.max$ substring$ 'text :=
1547 }
1548 if$
1549 }
1550 while$
1551 }
1552
1553 FUNCTION {extract.after}
1554 { 'find :=
1555 'text :=
1556 find string.length 'find_length :=
1557 ""
1558 { text empty$ not }
1559 { text #1 find_length substring$ find =
1560 { text find_length #1 + global.max$ substring$ *
1561 "" 'text :=
1562 }
1563 { text #2 global.max$ substring$ 'text := }
1564 if$
1565 }
1566 while$
1567 }
1568
1569 FUNCTION {format.western.given.name}
1570 { s nameptr "{ f.}" format.name$
1571 control.initialize.with.hyphen
1572 'skip$
1573 { duplicate$ "-" contains
1574 { "-" " " find.replace
1575 "u" change.case$
1576 }
1577 'skip$
1578 if$
1579 }
1580 if$
1581 s nameptr "{, jj}" format.name$ *
1582 "." "" find.replace
1583 }
1584
1585 FUNCTION {is.family.name.pinyin}
1586 { s nameptr "{ll}" format.name$
1587 duplicate$ empty$
1588 { pop$ #0 }
1589 { "l" change.case$
1590 duplicate$ "-" contains
1591 { duplicate$ "-" extract.before is.single.pinyin.word
1592 { "-" extract.after is.single.pinyin.word }
1593 { pop$ #0 }
1594 if$
1595 }
1596 { % 这个函数实在太慢了
1597 % is.double.pinyin
1598 is.single.pinyin.word
1599 }
1600 if$
1601 }
1602 if$
1603 }
1604
1605 FUNCTION {is.given.name.pinyin}
1606 { s nameptr "{ff}" format.name$
1607 duplicate$ empty$
1608 { pop$ #0 }
1609 { "l" change.case$
1610 "’" "'" find.replace
1611 duplicate$ "'" contains
1612 { duplicate$ "'" extract.before
1613 duplicate$ #1 #1 substring$ 't :=
1614 is.single.pinyin.word
1615 { "'" extract.after
1616 duplicate$ #1 #1 substring$ t " " * swap$ * 't :=
1617 is.single.pinyin.word
1618 }
1619 { pop$ #0 }
1620 if$
1621 }
1622 'is.double.pinyin.word
1623 if$
1624 }
1625 if$
1626 }
1627
1628 FUNCTION {is.name.pinyin}
1629 { s nameptr "{vv}{jj}" format.name$ empty$
1630 { is.family.name.pinyin
1631 'is.given.name.pinyin
1632 { #0 }
1633 if$
1634 }
1635 { #0 }
1636 if$
1637 }
1638
1639 FUNCTION {format.latin.name}
1640 { s nameptr "{vv~}{ll}" format.name$
1641 control.uppercase.family
1642 'smart.upper.case
1643 'skip$
1644 if$
1645 control.check.pinyin
1646 { is.name.pinyin
1647 { control.initialize.pinyin
1648 { " " t "u" change.case$ * }
1649 { s nameptr "{ ff}" format.name$ }
1650 if$
1651 }
1652 { format.western.given.name }
1653 if$
1654 }
1655 { format.western.given.name }
1656 if$
1657 *
1658 }
1659
1660 FUNCTION {format.name}
1661 { s nameptr "{vv~}{ll}{,~ff}{, jj}" format.name$
1662 get.str.lang
1663 duplicate$
1664 duplicate$ lang.zh = swap$ lang.ja = or
1665 { pop$
1666 s nameptr "{vv~}{ll}" format.name$
1667 s nameptr "{ff}{, jj}" format.name$
1668 duplicate$ get.str.lang
1669 duplicate$ lang.zh = swap$ lang.ja = or
1670 { * }
1671 { pop$ }
1672 if$
1673 }
1674 { lang.ru =
1675 { s nameptr "{vv~}{ll}" format.name$
1676 s nameptr "{ff}{, jj}" format.name$
1677 "." "" find.replace
1678 duplicate$ empty$
1679 'pop$
1680 { " " swap$ * * }
1681 if$
1682 }
1683 { format.latin.name }
1684 if$
1685 }
1686 if$
1687 }
1688
1689 FUNCTION {inter.word.space}
1690 { is.lang.cjk
1691 { "" }
1692 { " " }
1693 if$
1694 }
1695
1696 FUNCTION {format.names}
1697 { 's :=
1698 #1 'nameptr :=
1699 s num.names$ 'numnames :=
1700 numnames 'namesleft :=
1701 { namesleft #0 > }
1702 { format.name 't :=
1703 nameptr #1 >
1704 { numnames control.max.bib.names >
1705 nameptr control.min.bib.names > and
1706 { "others" 't :=
1707 #1 'namesleft :=
1708 }
1709 'skip$
1710 if$
1711 namesleft #1 >
1712 { add.comma t * }
1713 { t "l" change.case$ "others" =
1714 { nameptr #2 >
1715 { add.comma }
1716 { inter.word.space * }
1717 if$
1718 bbl.et.al *
1719 }
1720 { control.bib.final.and
1721 { is.lang.cjk not nameptr #2 > and
1722 { add.comma }
1723 { inter.word.space * }
1724 if$
1725 bbl.and * inter.word.space *
1726 }
1727 { add.comma }
1728 if$
1729 t *
1730 }
1731 if$
1732 }
1733 if$
1734 }
1735 't
1736 if$
1737 nameptr #1 + 'nameptr :=
1738 namesleft #1 - 'namesleft :=
1739 }
1740 while$
1741 format.punctuations
1742 }
1743
1744 FUNCTION {warn.empty.field}
1745 { control.warn.empty.field
1746 { "empty " swap$ * " in " * cite$ * warning$ }
1747 'pop$
1748 if$
1749 }
1750
1751 FUNCTION {format.anonymous}
1752 {
1753 bbl.anonymous
1754 }
1755
1756 FUNCTION {format.authors}
1757 { author empty$
1758 { "author" warn.empty.field
1759 format.anonymous
1760 }
1761 { author format.names }
1762 if$
1763 }
1764
1765 FUNCTION {format.editors}
1766 { editor empty$
1767 { "editor" warn.empty.field
1768 format.anonymous
1769 }
1770 { editor format.names }
1771 if$
1772 }
1773
1774 FUNCTION {format.authors.editors}
1775 { author empty$
1776 { editor empty$
1777 { "author and editor" warn.empty.field
1778 format.anonymous
1779 }
1780 { editor format.names }
1781 if$
1782 }
1783 { author format.names }
1784 if$
1785 }
1786
1787 FUNCTION {format.translators}
1788 { translator empty$
1789 { "" }
1790 { translator format.names
1791 add.comma bbl.translator *
1792 }
1793 if$
1794 }
1795
1796 FUNCTION {format.lab.name}
1797 { s nameptr "{vv~}{ll}{,~ff}{, jj}" format.name$
1798 get.str.lang
1799 duplicate$ lang.zh =
1800 swap$ lang.ja = or
1801 { s nameptr "{vv~}{ll}" format.name$
1802 s nameptr "{ff}{, jj}" format.name$
1803 duplicate$ get.str.lang
1804 duplicate$ lang.zh = swap$ lang.ja = or
1805 { * }
1806 'pop$
1807 if$
1808 }
1809 { s nameptr "{vv~}{ll}" format.name$ }
1810 if$
1811 }
1812
1813 FUNCTION {format.full.names}
1814 { 's :=
1815 #1 'nameptr :=
1816 s num.names$ 'numnames :=
1817 numnames 'namesleft :=
1818 { namesleft #0 > }
1819 { format.lab.name 't :=
1820 nameptr #1 >
1821 { namesleft #1 >
1822 { add.comma t * }
1823 { t "l" change.case$ "others" =
1824 { nameptr #2 >
1825 { add.comma }
1826 { inter.word.space * }
1827 if$
1828 cite.et.al *
1829 }
1830 { control.cite.final.and
1831 { is.lang.cjk not nameptr #2 > and
1832 { add.comma }
1833 { inter.word.space * }
1834 if$
1835 cite.and * inter.word.space *
1836 }
1837 { add.comma }
1838 if$
1839 t *
1840 }
1841 if$
1842 }
1843 if$
1844 }
1845 't
1846 if$
1847 nameptr #1 + 'nameptr :=
1848 namesleft #1 - 'namesleft :=
1849 }
1850 while$
1851 format.punctuations
1852 }
1853
1854 FUNCTION {author.editor.full}
1855 { author empty$
1856 { editor empty$
1857 { "" }
1858 { editor format.full.names }
1859 if$
1860 }
1861 { author format.full.names }
1862 if$
1863 }
1864
1865 FUNCTION {author.full}
1866 { author empty$
1867 { "" }
1868 { author format.full.names }
1869 if$
1870 }
1871
1872 FUNCTION {editor.full}
1873 { editor empty$
1874 { "" }
1875 { editor format.full.names }
1876 if$
1877 }
1878
1879 FUNCTION {holder.author.full}
1880 { holder empty$
1881 { author empty$
1882 { "" }
1883 { author format.full.names }
1884 if$
1885 }
1886 { holder format.full.names }
1887 if$
1888 }
1889
1890 FUNCTION {make.full.names}
1891 { type$ "book" =
1892 type$ "inbook" = booktitle empty$ not and
1893 or
1894 'author.editor.full
1895 { type$ "collection" =
1896 type$ "proceedings" =
1897 or
1898 'editor.full
1899 { type$ "patent" =
1900 'holder.author.full
1901 'author.full
1902 if$
1903 }
1904 if$
1905 }
1906 if$
1907 }
1908
1909 FUNCTION {output.bibitem}
1910 { newline$
1911 "\bibitem[" write$
1912 label ")" *
1913 make.full.names duplicate$ short.list =
1914 { pop$ }
1915 { duplicate$ "]" contains
1916 { "{" swap$ * "}" * }
1917 'skip$
1918 if$
1919 *
1920 }
1921 if$
1922 "]{" * write$
1923 cite$ write$
1924 "}" write$
1925 newline$
1926 ""
1927 before.all 'output.state :=
1928 }
1929
1930 FUNCTION {format.title.subtitle.titleaddon}
1931 { title empty$
1932 { "" }
1933 { title
1934 subtitle empty$
1935 'skip$
1936 { add.colon.by.language subtitle * }
1937 if$
1938 titleaddon empty$
1939 'skip$
1940 { add.colon.by.language titleaddon * }
1941 if$
1942 }
1943 if$
1944 }
1945
1946 FUNCTION {change.sentence.case}
1947 { entry.lang lang.en =
1948 'smart.sentence.case
1949 'skip$
1950 if$
1951 }
1952
1953 FUNCTION {add.link}
1954 { url empty$ not
1955 { "\href{" url * "}{" * swap$ * "}" * }
1956 { doi empty$ not
1957 { "\href{https://doi.org/" doi * "}{" * swap$ * "}" * }
1958 'skip$
1959 if$
1960 }
1961 if$
1962 }
1963
1964 FUNCTION {format.tr.number}
1965 { ""
1966 number empty$
1967 'skip$
1968 { type$ "patent" = control.patent.country and
1969 { country empty$ not
1970 { country * }
1971 { nationality empty$ not
1972 { nationality * }
1973 { address empty$ not
1974 { address * }
1975 { location empty$ not
1976 { location * }
1977 { "" }
1978 { entry.lang lang.zh =
1979 { "中国" * }
1980 'skip$
1981 if$
1982 }
1983 if$
1984 }
1985 if$
1986 }
1987 if$
1988 }
1989 if$
1990 }
1991 'skip$
1992 if$
1993 duplicate$ empty$
1994 'skip$
1995 'add.comma
1996 if$
1997 number
1998 duplicate$ get.str.lang lang.zh =
1999 'format.punctuations
2000 'skip$
2001 if$
2002 *
2003 }
2004 if$
2005 }
2006
2007 FUNCTION {entry.has.url.or.doi}
2008 { control.url require.url or entry.url empty$ not and
2009 doi empty$ not cstr empty$ not or
2010 control.doi control.url or require.url or and
2011 or
2012 }
2013
2014 FUNCTION {format.entry.type.id}
2015 { control.entry.type.id
2016 { entry.type.id
2017 control.entry.medium.id
2018 { entrymediumid empty$
2019 { medium empty$
2020 { entry.has.url.or.doi
2021 type$ "online" = or
2022 type$ "webpage" = or
2023 { "/OL" * }
2024 'skip$
2025 if$
2026 }
2027 { "The field 'medium' for entry medium ID is deprecated. Use 'entrymediumid' instead." warning$
2028 "/" * medium *
2029 }
2030 if$
2031 }
2032 { "/" * entrymediumid * }
2033 if$
2034 }
2035 'skip$
2036 if$
2037 make.brackets
2038 control.space.before.type.id
2039 { " " }
2040 { "\allowbreak" }
2041 if$
2042 swap$ *
2043 }
2044 { "" }
2045 if$
2046 }
2047
2048 FUNCTION {format.title}
2049 { title empty$
2050 { "" }
2051 { format.title.subtitle.titleaddon
2052 control.sentence.case.title
2053 'change.sentence.case
2054 'skip$
2055 if$
2056 format.punctuations
2057 control.link.title
2058 'add.link
2059 'skip$
2060 if$
2061 entry.numbered number empty$ not and
2062 { add.colon
2063 format.tr.number *
2064 }
2065 'skip$
2066 if$
2067 format.entry.type.id *
2068 }
2069 if$
2070 }
2071
2072 FUNCTION {tie.or.space.connect}
2073 { duplicate$ text.length$ #3 <
2074 { "~" }
2075 { " " }
2076 if$
2077 swap$ * *
2078 }
2079
2080 FUNCTION {either.or.check}
2081 { empty$
2082 'pop$
2083 { "can't use both " swap$ * " fields in " * cite$ * warning$ }
2084 if$
2085 }
2086
2087 FUNCTION {is.digit}
2088 { duplicate$ empty$
2089 { pop$ #0 }
2090 { chr.to.int$
2091 duplicate$ "0" chr.to.int$ <
2092 { pop$ #0 }
2093 { "9" chr.to.int$ >
2094 { #0 }
2095 { #1 }
2096 if$
2097 }
2098 if$
2099 }
2100 if$
2101 }
2102
2103 FUNCTION {is.number}
2104 { #1
2105 { #0 > }
2106 { duplicate$ #1 #1 substring$ chr.to.int$
2107 duplicate$ #47 >
2108 swap$ #58 <
2109 and
2110 { #2 global.max$ substring$
2111 duplicate$ empty$
2112 { #0 }
2113 { #1 }
2114 if$
2115 }
2116 { #0 }
2117 if$
2118 }
2119 while$
2120 empty$
2121 }
2122
2123 FUNCTION {format.bvolume}
2124 { volume empty$
2125 { "" }
2126 { volume is.number
2127 { entry.lang lang.zh =
2128 { "第" volume tie.or.space.connect " 卷" * }
2129 { entry.lang lang.ko =
2130 { "제" volume tie.or.space.connect " 권" * }
2131 { "v." volume * }
2132 if$
2133 }
2134 if$
2135 }
2136 { volume }
2137 if$
2138 }
2139 if$
2140 }
2141
2142 FUNCTION {format.maintitle}
2143 { maintitle empty$
2144 { "" }
2145 { mainsubtitle empty$
2146 'skip$
2147 { add.colon.by.language mainsubtitle * }
2148 if$
2149 maintitleaddon empty$
2150 'skip$
2151 { add.colon.by.language maintitleaddon * }
2152 if$
2153 }
2154 if$
2155 }
2156
2157 FUNCTION {format.maintitle.volume}
2158 { maintitle empty$
2159 { "" }
2160 { maintitle
2161 volume empty$
2162 'skip$
2163 { add.colon.by.language
2164 format.bvolume *
2165 }
2166 if$
2167 }
2168 if$
2169 }
2170
2171 FUNCTION {format.title.volume}
2172 { title empty$
2173 { "" }
2174 { format.title.subtitle.titleaddon
2175 volume empty$
2176 'skip$
2177 { add.colon.by.language
2178 format.bvolume *
2179 }
2180 if$
2181 }
2182 if$
2183 }
2184
2185 FUNCTION {format.series.volume}
2186 { series empty$
2187 { "" }
2188 { series
2189 volume empty$
2190 'skip$
2191 { add.colon.by.language
2192 format.bvolume *
2193 }
2194 if$
2195 }
2196 if$
2197 }
2198
2199 FUNCTION {format.btitle}
2200 { maintitle empty$
2201 { series empty$
2202 { format.title.volume }
2203 { volume empty$
2204 { format.title.volume }
2205 { format.series.volume
2206 entry.numbered
2207 'skip$
2208 { "volume and number" number either.or.check }
2209 if$
2210 bbl.wide.space *
2211 format.title.subtitle.titleaddon
2212 *
2213 }
2214 if$
2215 }
2216 if$
2217 }
2218 { volume empty$
2219 { format.maintitle
2220 add.colon.by.language
2221 format.title.subtitle.titleaddon *
2222 }
2223 { format.maintitle.volume
2224 bbl.wide.space *
2225 format.title.subtitle.titleaddon
2226 *
2227 }
2228 if$
2229 }
2230 if$
2231 duplicate$ empty$
2232 'skip$
2233 { control.sentence.case.title
2234 'change.sentence.case
2235 'skip$
2236 if$
2237 format.punctuations
2238 emphasize.book.title
2239 control.link.title
2240 'add.link
2241 'skip$
2242 if$
2243 entry.numbered number empty$ not and
2244 { add.colon format.tr.number * }
2245 'skip$
2246 if$
2247 type$ "map" =
2248 scale empty$ not and
2249 { add.period
2250 duplicate$ #-1 #1 substring$ "." =
2251 { " " * }
2252 'skip$
2253 if$
2254 scale *
2255 }
2256 'skip$
2257 if$
2258 format.entry.type.id *
2259 }
2260 if$
2261 }
2262
2263 FUNCTION {format.booktitle}
2264 { booktitle empty$
2265 { "" }
2266 { booktitle
2267 control.sentence.case.booktitle
2268 'change.sentence.case
2269 'skip$
2270 if$
2271 booksubtitle empty$
2272 'skip$
2273 { add.colon
2274 booksubtitle
2275 control.sentence.case.booktitle
2276 { "l" change.case$ }
2277 'skip$
2278 if$
2279 *
2280 }
2281 if$
2282 emphasize.book.title
2283 booktitleaddon empty$
2284 'skip$
2285 { add.colon
2286 booktitleaddon
2287 control.sentence.case.booktitle
2288 { "l" change.case$ }
2289 'skip$
2290 if$
2291 *
2292 }
2293 if$
2294 format.punctuations
2295 }
2296 if$
2297 }
2298
2299 FUNCTION {format.series.volume.booktitle}
2300 { series empty$
2301 { maintitle empty$
2302 { format.booktitle
2303 volume empty$
2304 'skip$
2305 { add.colon
2306 format.bvolume *
2307 }
2308 if$
2309 }
2310 { format.maintitle.volume
2311 bbl.wide.space *
2312 format.booktitle *
2313 }
2314 if$
2315 }
2316 { volume empty$
2317 { format.booktitle }
2318 { format.series.volume
2319 bbl.wide.space *
2320 format.booktitle *
2321 }
2322 if$
2323 }
2324 if$
2325 }
2326
2327 FUNCTION {format.in.ed.booktitle}
2328 { booktitle empty$
2329 { "" }
2330 { control.in
2331 { bbl.in add.colon }
2332 { "" }
2333 if$
2334 editor empty$
2335 'skip$
2336 { format.editors * output new.block "" }
2337 if$
2338 format.series.volume.booktitle *
2339 }
2340 if$
2341 }
2342
2343 FUNCTION {remove.dots}
2344 { 's :=
2345 ""
2346 { s empty$ not }
2347 { s #1 #1 substring$
2348 duplicate$ "." =
2349 'pop$
2350 { * }
2351 if$
2352 s #2 global.max$ substring$ 's :=
2353 }
2354 while$
2355 }
2356
2357 FUNCTION {format.journal.title}
2358 { journal empty$
2359 { journaltitle empty$
2360 { "" }
2361 { journaltitle }
2362 if$
2363 }
2364 { journal }
2365 if$
2366 journalsubtitle empty$
2367 'skip$
2368 { duplicate$ empty$
2369 'skip$
2370 'add.colon.by.language
2371 if$
2372 journalsubtitle *
2373 }
2374 if$
2375 journaltitleaddon empty$
2376 'skip$
2377 { duplicate$ empty$
2378 'skip$
2379 'add.colon.by.language
2380 if$
2381 journaltitleaddon *
2382 }
2383 if$
2384 control.sentence.case.journal
2385 'change.sentence.case
2386 'skip$
2387 if$
2388 }
2389
2390 FUNCTION {format.short.journal}
2391 { shortjournal empty$
2392 { format.journal.title
2393 duplicate$ field.or.null " " contains % The journal title is not a single word
2394 is.lang.cjk not and
2395 { "shortjournal" warn.empty.field }
2396 'skip$
2397 if$
2398 }
2399 { shortjournal
2400 control.journal.dots
2401 'skip$
2402 'remove.dots
2403 if$
2404 }
2405 if$
2406 }
2407
2408 FUNCTION {get.journal.title}
2409 { control.short.journal
2410 'format.short.journal
2411 { format.journal.title
2412 duplicate$ empty$
2413 { shortjournal empty$
2414 { "journal" warn.empty.field }
2415 { pop$ format.short.journal }
2416 if$
2417 }
2418 { shortjournal empty$ control.journal.dots not and
2419 'remove.dots
2420 { duplicate$ shortjournal = control.journal.dots not and
2421 'remove.dots
2422 'skip$
2423 if$
2424 }
2425 if$
2426 }
2427 if$
2428 }
2429 if$
2430 }
2431
2432 FUNCTION {check.arxiv.preprint}
2433 { "l" change.case$
2434 duplicate$ #1 #5 substring$ "arxiv" =
2435 { 'x :=
2436 "arxiv:" 'y :=
2437 y text.length$ 'len :=
2438 x text.length$ len - #1 + 'charptr :=
2439 { charptr #0 >
2440 x charptr len substring$ y = not
2441 and
2442 }
2443 { charptr #1 - 'charptr := }
2444 while$
2445 charptr #0 >
2446 { x charptr #6 + global.max$ substring$ 'x :=
2447 x string.length #1 + 'len :=
2448 #1 'charptr :=
2449 { charptr len <
2450 x charptr #1 substring$ " " = not and
2451 x charptr #1 substring$ "[" = not and
2452 }
2453 { charptr #1 + 'charptr := }
2454 while$
2455 x #1 charptr substring$
2456 duplicate$ empty$
2457 'pop$
2458 { "\url{https://arxiv.org/abs/" swap$ * "}" * 'entry.url := }
2459 if$
2460 }
2461 'skip$
2462 if$
2463 #1
2464 }
2465 { pop$ #0 }
2466 if$
2467 }
2468
2469 FUNCTION {format.journal}
2470 { get.journal.title
2471 duplicate$ empty$
2472 'skip$
2473 { format.punctuations
2474 control.emph.journal is.lang.cjk not and
2475 'emphasize
2476 'skip$
2477 if$
2478 }
2479 if$
2480 }
2481
2482 FUNCTION {set.entry.type.id}
2483 { entry.type.id empty$
2484 { entrytypeid empty$
2485 { entrysubtype empty$
2486 { mark empty$
2487 { 'entry.type.id := }
2488 { pop$
2489 "The field 'mark' for entry type ID is deprecated. Use 'entrytypeid' instead." warning$
2490 mark 'entry.type.id :=
2491 }
2492 if$
2493 }
2494 { entrysubtype "newspaper" =
2495 { pop$ "N" 'entry.type.id := }
2496 { entrysubtype "inproceedings" =
2497 { pop$ "C" 'entry.type.id := }
2498 { entrysubtype "report" =
2499 { pop$ "R" 'entry.type.id := }
2500 { entrysubtype "techreport" =
2501 { pop$ "R" 'entry.type.id := }
2502 { entrysubtype "standard" =
2503 { pop$ "S" 'entry.type.id := }
2504 { entrysubtype "patent" =
2505 { pop$ "P" 'entry.type.id := }
2506 { entrysubtype "dataset" =
2507 { pop$ "DS" 'entry.type.id := }
2508 { 'entry.type.id := }
2509 if$
2510 }
2511 if$
2512 }
2513 if$
2514 }
2515 if$
2516 }
2517 if$
2518 }
2519 if$
2520 }
2521 if$
2522 }
2523 if$
2524 }
2525 { pop$ entrytypeid 'entry.type.id := }
2526 if$
2527 }
2528 'pop$
2529 if$
2530 }
2531
2532 FUNCTION {num.to.ordinal}
2533 { is.lang.cjk
2534 'skip$
2535 { duplicate$ #-2 #1 substring$ "1" =
2536 { "th" * }
2537 { duplicate$ #-1 #1 substring$ "1" =
2538 { "st" * }
2539 { duplicate$ #-1 #1 substring$ "2" =
2540 { "nd" * }
2541 { duplicate$ #-1 #1 substring$ "3" =
2542 { "rd" * }
2543 { "th" * }
2544 if$
2545 }
2546 if$
2547 }
2548 if$
2549 }
2550 if$
2551 }
2552 if$
2553 }
2554
2555 FUNCTION {extract.num}
2556 { duplicate$ 't :=
2557 "" 's :=
2558 { t empty$ not }
2559 { t #1 #1 substring$
2560 t #2 global.max$ substring$ 't :=
2561 duplicate$ is.digit
2562 { s swap$ * 's := }
2563 { pop$ "" 't := }
2564 if$
2565 }
2566 while$
2567 s empty$
2568 'skip$
2569 { pop$ s }
2570 if$
2571 }
2572
2573 FUNCTION {word.to.num}
2574 { duplicate$ "l" change.case$ 's :=
2575 s "first" =
2576 { pop$ "1" }
2577 'skip$
2578 if$
2579 s "second" =
2580 { pop$ "2" }
2581 'skip$
2582 if$
2583 s "third" =
2584 { pop$ "3" }
2585 'skip$
2586 if$
2587 s "fourth" =
2588 { pop$ "4" }
2589 'skip$
2590 if$
2591 s "fifth" =
2592 { pop$ "5" }
2593 'skip$
2594 if$
2595 s "sixth" =
2596 { pop$ "6" }
2597 'skip$
2598 if$
2599 s "seventh" =
2600 { pop$ "7" }
2601 'skip$
2602 if$
2603 s "eighth" =
2604 { pop$ "8" }
2605 'skip$
2606 if$
2607 s "ninth" =
2608 { pop$ "9" }
2609 'skip$
2610 if$
2611 s "tenth" =
2612 { pop$ "10" }
2613 'skip$
2614 if$
2615 s "revised edition" =
2616 { pop$ "Rev. ed." }
2617 'skip$
2618 if$
2619 s "revised ed." =
2620 { pop$ "Rev. ed." }
2621 'skip$
2622 if$
2623 s "revised" =
2624 { pop$ "Rev. ed." }
2625 'skip$
2626 if$
2627 s "rev." =
2628 { pop$ "Rev. ed." }
2629 'skip$
2630 if$
2631 s "修订版" =
2632 { pop$ "修订版" }
2633 'skip$
2634 if$
2635 s "修订" =
2636 { pop$ "修订版" }
2637 'skip$
2638 if$
2639 }
2640
2641 FUNCTION {format.edition}
2642 { edition empty$
2643 { "" }
2644 { edition
2645 duplicate$ #1 #1 substring$ is.digit
2646 'extract.num
2647 'word.to.num
2648 if$
2649 duplicate$ "1" =
2650 { pop$ "" }
2651 { duplicate$ #1 #1 substring$ is.digit
2652 { num.to.ordinal
2653 " " * bbl.edition *
2654 }
2655 'skip$
2656 if$
2657 }
2658 if$
2659 }
2660 if$
2661 }
2662
2663 FUNCTION {format.version}
2664 { version empty$
2665 { "" }
2666 { version #1 #1 substring$
2667 duplicate$ "V" =
2668 { pop$ version }
2669 { "v" =
2670 { "V" version #2 global.max$ substring$ * }
2671 { "V" version * }
2672 if$
2673 }
2674 if$
2675 }
2676 if$
2677 }
2678
2679 FUNCTION {format.publisher}
2680 { publisher empty$
2681 { institution empty$
2682 { school empty$
2683 { "" }
2684 { school }
2685 if$
2686 }
2687 { institution }
2688 if$
2689 }
2690 { publisher }
2691 if$
2692 format.punctuations
2693 }
2694
2695 FUNCTION {format.address.publisher}
2696 { address empty$
2697 { location empty$
2698 { "" }
2699 { location }
2700 if$
2701 }
2702 { address }
2703 if$
2704 format.punctuations
2705 duplicate$ empty$ not
2706 { format.publisher empty$ not
2707 { add.colon format.publisher * }
2708 { entry.has.url.or.doi not control.unknown.publisher and
2709 { add.colon bbl.sine.nomine make.brackets * }
2710 'skip$
2711 if$
2712 }
2713 if$
2714 }
2715 { pop$
2716 entry.has.url.or.doi not control.unknown.publisher and
2717 { format.publisher empty$ not
2718 { bbl.sine.loco make.brackets add.colon format.publisher * }
2719 { bbl.sine.loco.sine.nomine make.brackets }
2720 if$
2721 }
2722 { format.publisher empty$ not
2723 { format.publisher }
2724 { "" }
2725 if$
2726 }
2727 if$
2728 }
2729 if$
2730 }
2731
2732 FUNCTION {format.eventtitle}
2733 { eventtitle empty$
2734 { "" }
2735 { eventtitle format.punctuations }
2736 if$
2737 }
2738
2739 FUNCTION {normalize.year.dash}
2740 {
2741 "---" "-" find.replace
2742 "--" "-" find.replace
2743 "–" "-" find.replace
2744 "—" "-" find.replace
2745 }
2746
2747 FUNCTION {format.date}
2748 { year empty$
2749 { date empty$
2750 { entry.has.url.or.doi
2751 { "" }
2752 { "year" warn.empty.field
2753 urldate empty$
2754 { "" }
2755 { urldate "-" extract.before extra.label * make.brackets }
2756 if$
2757 }
2758 if$
2759 }
2760 { date "/" extract.before "-" extract.before
2761 date "/" contains
2762 { "-" normalize.year.dash *
2763 date "/" extract.after "-" extract.before *
2764 }
2765 'skip$
2766 if$
2767 extra.label *
2768 }
2769 if$
2770 }
2771 { year normalize.year.dash
2772 extra.label *
2773 }
2774 if$
2775 control.year.before.title
2776 { pop$ "" }
2777 'skip$
2778 if$
2779 }
2780
2781 FUNCTION {format.full.date}
2782 { date empty$
2783 { year }
2784 { control.year.before.title
2785 { date }
2786 { date #1 #4 substring$
2787 extra.label *
2788 date #5 global.max$ substring$ *
2789 }
2790 if$
2791 }
2792 if$
2793 }
2794
2795 FUNCTION {format.lab.date}
2796 { year empty$
2797 { date empty$
2798 { urldate empty$
2799 { bbl.no.date
2800 extra.label empty$
2801 'skip$
2802 { "-" * extra.label *}
2803 if$
2804 }
2805 { urldate "-" extract.before extra.label * make.brackets }
2806 if$
2807 }
2808 { date "/" extract.before "-" extract.before
2809 date "/" contains
2810 { "-" normalize.year.dash *
2811 date "/" extract.after "-" extract.before *
2812 }
2813 'skip$
2814 if$
2815 extra.label *
2816 }
2817 if$
2818 }
2819 { year normalize.year.dash extra.label * }
2820 if$
2821 }
2822
2823 FUNCTION {format.date.before.title}
2824 { control.year.before.title
2825 { "period" control.name.year.delim =
2826 'new.sentence
2827 'skip$
2828 if$
2829 format.lab.date
2830 }
2831 { "" }
2832 if$
2833 }
2834
2835 FUNCTION {format.creation.modification.date}
2836 { date empty$
2837 {
2838 ""
2839 }
2840 { date }
2841 if$
2842 duplicate$ empty$
2843 'skip$
2844 { make.parentheses
2845 "\allowbreak " swap$ *
2846 }
2847 if$
2848 }
2849
2850 FUNCTION {format.urldate}
2851 {
2852 entry.has.url.or.doi
2853 control.urldate urldate empty$ not and and
2854 { "\allowbreak" urldate make.brackets * }
2855 { "" }
2856 if$
2857 }
2858
2859 FUNCTION {normalize.page.range}
2860 { "" swap$
2861 { duplicate$ empty$ not }
2862 { #1 skip.inter.token.chars.by 't :=
2863 empty$
2864 { "" }
2865 'control.page.range.delim
2866 if$
2867 * t
2868 #1 tokenize.by 't :=
2869 * t
2870 }
2871 while$
2872 pop$
2873 }
2874
2875 FUNCTION {format.pages}
2876 { pages empty$
2877 { "" }
2878 { pages
2879 control.page.ranges
2880 'normalize.page.range
2881 { #1 tokenize.by pop$ }
2882 if$
2883 }
2884 if$
2885 }
2886
2887 FUNCTION {format.dimensions}
2888 { dimensions empty$
2889 { "" }
2890 { dimensions
2891 "x" "$\times$" find.replace
2892 "×" "$\times$" find.replace
2893 }
2894 if$
2895 }
2896
2897 FUNCTION {format.journal.volume}
2898 { volume empty$
2899 { "" }
2900 { control.bold.volume
2901 { "\textbf{" volume * "}" * }
2902 { volume }
2903 if$
2904 }
2905 if$
2906 }
2907
2908 FUNCTION {format.journal.number}
2909 { number empty$
2910 { "" }
2911 { "\allowbreak " number make.parentheses * }
2912 if$
2913 }
2914
2915 FUNCTION {format.journal.pages}
2916 { pages empty$
2917 { eid empty$
2918 { "" }
2919 { eid }
2920 if$
2921 }
2922 { format.pages }
2923 if$
2924 }
2925
2926 FUNCTION {format.newspaper.pages}
2927 { pages empty$
2928 { "" }
2929 { "\allowbreak " format.pages make.parentheses * }
2930 if$
2931 }
2932
2933 FUNCTION {check.electronic}
2934 { entry.url empty$
2935 { url empty$
2936 { howpublished field.or.null #1 #5 substring$ "\url{" =
2937 { howpublished 'entry.url := }
2938 { note field.or.null #1 #5 substring$ "\url{" =
2939 { note "}" extract.before "}" * 'entry.url := }
2940 'skip$
2941 if$
2942 }
2943 if$
2944 }
2945 { "\url{" url * "}" * 'entry.url := }
2946 if$
2947 }
2948 'skip$
2949 if$
2950 }
2951
2952 FUNCTION {format.url}
2953 { control.url require.url or
2954 { entry.url empty$
2955 { control.doi not require.url or
2956 { cstr empty$
2957 { doi empty$
2958 'skip$
2959 { "\url{https://doi.org/" doi * "}" * 'entry.url := }
2960 if$
2961 }
2962 { "\url{https://cstr.cn/" cstr * "}" * 'entry.url := }
2963 if$
2964 }
2965 'skip$
2966 if$
2967 }
2968 'skip$
2969 if$
2970 entry.url empty$
2971 { "" }
2972 { new.block
2973 entry.url
2974 }
2975 if$
2976 }
2977 { "" }
2978 if$
2979 }
2980
2981 FUNCTION {either.or}
2982 { swap$
2983 duplicate$ empty$
2984 { pop$
2985 duplicate$ empty$
2986 { pop$ "" }
2987 'skip$
2988 if$
2989 }
2990 { swap$ pop$ }
2991 if$
2992 }
2993
2994 FUNCTION {format.doi}
2995 { control.doi
2996 { control.cstr not cstr empty$ or
2997 { doi empty$
2998 { "" }
2999 { control.url require.url or
3000 entry.url doi contains and
3001 { "" }
3002 { new.block "DOI:\doi{" doi * "}" * }
3003 if$
3004 }
3005 if$
3006 }
3007 { control.url require.url or
3008 entry.url cstr contains and
3009 { "" }
3010 { new.block "CSTR:\cstr{" cstr * "}" * }
3011 if$
3012 }
3013 if$
3014 }
3015 { "" }
3016 if$
3017 }
3018
3019 FUNCTION {format.eprint}
3020 { archiveprefix eprinttype either.or
3021 duplicate$ empty$
3022 { pop$
3023 journal journaltitle either.or shortjournal either.or
3024 "l" change.case$ #1 #5 substring$ "arxiv" =
3025 { "arXiv" }
3026 { "" }
3027 if$
3028 }
3029 { duplicate$ "arxiv" =
3030 { pop$ "arXiv" }
3031 { duplicate$ "pubmed" =
3032 { pop$ "PubMed" }
3033 'skip$
3034 if$
3035 }
3036 if$
3037 }
3038 if$
3039 entry.url empty$
3040 { duplicate$ "l" change.case$ "arxiv" = entry.eprint empty$ not and
3041 { "\url{https://arxiv.org/abs/" entry.eprint * "}" * 'entry.url := }
3042 'skip$
3043 if$
3044 }
3045 'skip$
3046 if$
3047 control.eprint eprint empty$ not and
3048 { duplicate$ empty$
3049 'skip$
3050 { ":" * }
3051 if$
3052 eprint *
3053 }
3054 'skip$
3055 if$
3056 }
3057
3058 FUNCTION {format.note}
3059 { note empty$ not control.note and
3060 { note }
3061 { "" }
3062 if$
3063 }
3064
3065 FUNCTION {empty.misc.check}
3066 { author empty$ title empty$
3067 year empty$
3068 and and
3069 key empty$ not and
3070 { "all relevant fields are empty in " cite$ * warning$ }
3071 'skip$
3072 if$
3073 }
3074
3075 FUNCTION {link.open}
3076 { control.link.journal
3077 { url empty$
3078 { doi empty$
3079 { "" }
3080 { "\href{https://doi.org/" doi * "}{" * }
3081 if$
3082 }
3083 { "\href{" url * "}{" * }
3084 if$
3085 duplicate$ empty$
3086 { pop$ }
3087 { "" set.punct
3088 output
3089 before.all 'output.state :=
3090 }
3091 if$
3092 }
3093 'skip$
3094 if$
3095 }
3096
3097 FUNCTION {link.close}
3098 { control.link.journal
3099 { url empty$ doi empty$ and
3100 'skip$
3101 { "" set.punct
3102 "}" output
3103 before.all 'output.state :=
3104 }
3105 if$
3106 }
3107 'skip$
3108 if$
3109 }
3110
3111 FUNCTION {article.journal}
3112 { "J" set.entry.type.id
3113 volume empty$ number empty$ and entry.url empty$ not and
3114 date field.or.null text.length$ #9 > and
3115 entry.type.id "J" = and
3116 { #1 'require.url := }
3117 'skip$
3118 if$
3119 output.bibitem
3120 format.authors output
3121 format.date.before.title output
3122 control.article.title
3123 { new.block
3124 format.title "title" output.check
3125 }
3126 'skip$
3127 if$
3128 new.block
3129 format.translators output
3130 new.block
3131 link.open
3132 format.journal "journal" output.check
3133 entry.type.id "N" =
3134 { format.full.date "date" output.check
3135 "" set.punct
3136 format.newspaper.pages output
3137 }
3138 {
3139 format.date output
3140 format.journal.volume output
3141 "" set.punct
3142 format.journal.number output
3143 bbl.pages.colon set.punct
3144 format.journal.pages output
3145 }
3146 if$
3147 link.close
3148 "" set.punct
3149 format.urldate output
3150 format.url output
3151 format.doi output
3152 new.block
3153 format.note output
3154 fin.entry
3155 }
3156
3157 FUNCTION {archive}
3158 { "A" set.entry.type.id
3159 output.bibitem
3160 format.authors output
3161 format.date.before.title output
3162 new.block
3163 format.btitle "title" output.check
3164 % new.block
3165 % format.translators output
3166 new.block
3167 format.address.publisher output
3168 format.date output
3169 bbl.pages.colon set.punct
3170 format.pages output
3171 "" set.punct
3172 format.creation.modification.date output
3173 "" set.punct
3174 format.urldate output
3175 format.url output
3176 format.doi output
3177 new.block
3178 format.note output
3179 fin.entry
3180 }
3181
3182 FUNCTION {book}
3183 { "M" set.entry.type.id
3184 output.bibitem
3185 format.authors.editors output
3186 format.date.before.title output
3187 new.block
3188 format.btitle "title" output.check
3189 new.block
3190 format.translators output
3191 new.sentence
3192 format.edition output
3193 new.block
3194 format.address.publisher output
3195 format.date output
3196 bbl.pages.colon set.punct
3197 format.pages output
3198 "" set.punct
3199 format.urldate output
3200 format.url output
3201 format.doi output
3202 new.block
3203 format.note output
3204 fin.entry
3205 }
3206
3207 FUNCTION {letter} { archive }
3208
3209 FUNCTION {dataset}
3210 { "DS" set.entry.type.id
3211 output.bibitem
3212 format.authors output
3213 format.date.before.title output
3214 new.block
3215 format.btitle "title" output.check
3216 new.block
3217 format.version output
3218 new.block
3219 publisher "publisher" output.check
3220 "" set.punct
3221 format.creation.modification.date output
3222 "" set.punct
3223 format.urldate output
3224 format.url output
3225 format.doi output
3226 new.block
3227 format.note output
3228 fin.entry
3229 }
3230
3231 FUNCTION {database}
3232 { "DB" set.entry.type.id
3233 dataset
3234 }
3235
3236 FUNCTION {inbook}
3237 { "M" set.entry.type.id
3238 booktitle empty$
3239 'book
3240 { output.bibitem
3241 format.authors output
3242 format.date.before.title output
3243 control.article.title
3244 { new.block
3245 format.title "title" output.check
3246 }
3247 'skip$
3248 if$
3249 new.block
3250 format.translators output
3251 new.slash
3252 booktitle empty$
3253 { "" }
3254 { control.in
3255 { bbl.in add.colon }
3256 { "" }
3257 if$
3258 bookauthor empty$
3259 { editor empty$
3260 'skip$
3261 { format.editors * output new.block "" }
3262 if$
3263 }
3264 { bookauthor format.names * output new.block "" }
3265 if$
3266 format.series.volume.booktitle *
3267 }
3268 if$
3269 "booktitle" output.check
3270 new.block
3271 format.edition output
3272 new.block
3273 format.address.publisher output
3274 format.date output
3275 bbl.pages.colon set.punct
3276 format.pages output
3277 "" set.punct
3278 format.urldate output
3279 format.url output
3280 format.doi output
3281 new.block
3282 format.note output
3283 fin.entry
3284 }
3285 if$
3286 }
3287
3288 FUNCTION {incollection}
3289 { "M" set.entry.type.id
3290 output.bibitem
3291 format.authors output
3292 format.date.before.title output
3293 control.article.title
3294 { new.block
3295 format.title "title" output.check
3296 }
3297 'skip$
3298 if$
3299 new.block
3300 format.translators output
3301 new.slash
3302 format.in.ed.booktitle "booktitle" output.check
3303 new.block
3304 format.edition output
3305 new.block
3306 format.address.publisher output
3307 format.date output
3308 bbl.pages.colon set.punct
3309 format.pages output
3310 "" set.punct
3311 format.urldate output
3312 format.url output
3313 format.doi output
3314 new.block
3315 format.note output
3316 fin.entry
3317 }
3318
3319 FUNCTION {inproceedings}
3320 { "C" set.entry.type.id
3321 output.bibitem
3322 format.authors output
3323 format.date.before.title output
3324 control.article.title
3325 { new.block
3326 format.title "title" output.check
3327 }
3328 'skip$
3329 if$
3330 new.slash
3331 booktitle empty$
3332 { format.eventtitle "eventtitle" output.check }
3333 { format.in.ed.booktitle "booktitle" output.check
3334 new.block
3335 format.edition output
3336 new.block
3337 format.address.publisher output
3338 }
3339 if$
3340 format.date output
3341 bbl.pages.colon set.punct
3342 format.pages output
3343 "" set.punct
3344 format.urldate output
3345 format.url output
3346 format.doi output
3347 new.block
3348 format.note output
3349 fin.entry
3350 }
3351
3352 FUNCTION {conference} { inproceedings }
3353
3354 FUNCTION {patent}
3355 { "P" set.entry.type.id
3356 output.bibitem
3357 holder empty$
3358 { format.authors "holder and author" output.check }
3359 { holder format.names output.nonnull }
3360 if$
3361 format.date.before.title output
3362 control.article.title
3363 { new.block
3364 format.title "title" output.check
3365 }
3366 'skip$
3367 if$
3368 new.block
3369 format.full.date "year" output.check
3370 "" set.punct
3371 format.urldate output
3372 format.url output
3373 format.doi output
3374 new.block
3375 format.note output
3376 fin.entry
3377 }
3378
3379 FUNCTION {format.periodical.volume}
3380 { volume number either.or
3381 duplicate$ empty$
3382 { pop$ "" }
3383 { format.punctuations
3384 normalize.year.dash
3385 }
3386 if$
3387 }
3388
3389 FUNCTION {periodical}
3390 { "J" set.entry.type.id
3391 output.bibitem
3392 format.editors output
3393 format.date.before.title output
3394 new.block
3395 format.title "title" output.check
3396 new.block
3397 format.periodical.volume output
3398 new.block
3399 format.address.publisher output
3400 format.date output
3401 "" set.punct
3402 format.urldate output
3403 format.url output
3404 format.doi output
3405 new.block
3406 format.note output
3407 fin.entry
3408 }
3409
3410 FUNCTION {proceedings}
3411 { "C" set.entry.type.id
3412 output.bibitem
3413 format.editors output
3414 format.date.before.title output
3415 new.block
3416 format.btitle "title" output.check
3417 new.block
3418 format.translators output
3419 new.sentence
3420 format.edition output
3421 new.block
3422 format.address.publisher output
3423 format.date output
3424 bbl.pages.colon set.punct
3425 format.pages output
3426 "" set.punct
3427 format.urldate output
3428 format.url output
3429 format.doi output
3430 new.block
3431 format.note output
3432 fin.entry
3433 }
3434
3435 FUNCTION {preprint}
3436 { #1 'require.url :=
3437 "A" set.entry.type.id
3438 output.bibitem
3439 format.authors output
3440 format.date.before.title output
3441 control.article.title
3442 { new.block
3443 format.title "title" output.check
3444 }
3445 'skip$
3446 if$
3447 new.block
3448 format.version output
3449 new.block
3450 format.eprint output
3451 "" set.punct
3452 format.creation.modification.date output
3453 "" set.punct
3454 format.urldate "urldate" output.check
3455 format.url "url" output.check
3456 format.doi output
3457 new.block
3458 format.note output
3459 fin.entry
3460 }
3461
3462 FUNCTION {thesis}
3463 { "D" set.entry.type.id
3464 output.bibitem
3465 format.authors output
3466 format.date.before.title output
3467 new.block
3468 format.btitle "title" output.check
3469 new.block
3470 format.address.publisher output
3471 format.date output
3472 bbl.pages.colon set.punct
3473 format.pages output
3474 "" set.punct
3475 format.urldate output
3476 format.url output
3477 format.doi output
3478 new.block
3479 format.note output
3480 fin.entry
3481 }
3482
3483 FUNCTION {phdthesis} { thesis }
3484
3485 FUNCTION {mastersthesis} { thesis }
3486
3487 FUNCTION {techreport}
3488 { "R" set.entry.type.id
3489 output.bibitem
3490 format.authors output
3491 format.date.before.title output
3492 new.block
3493 format.btitle "title" output.check
3494 % new.block
3495 % format.translators output
3496 new.block
3497 institution empty$
3498 pages empty$ and
3499 control.url and
3500 entry.url empty$ not and
3501 'skip$
3502 { format.address.publisher output
3503 format.date output
3504 bbl.pages.colon set.punct
3505 format.pages output
3506 }
3507 if$
3508 "" set.punct
3509 format.creation.modification.date output
3510 "" set.punct
3511 format.urldate output
3512 format.url output
3513 format.doi output
3514 new.block
3515 format.note output
3516 fin.entry
3517 }
3518
3519 FUNCTION {report} { techreport }
3520
3521 FUNCTION {manual} { techreport }
3522
3523 FUNCTION {webpage}
3524 { #1 'require.url :=
3525 output.bibitem
3526 format.authors output
3527 format.date.before.title output
3528 new.block
3529 "EB" set.entry.type.id
3530 format.btitle "title" output.check
3531 new.block
3532 publisher empty$
3533 'skip$
3534 { format.address.publisher output
3535 format.date output
3536 bbl.pages.colon set.punct
3537 format.pages output
3538 "" set.punct
3539 }
3540 if$
3541 format.creation.modification.date output
3542 "" set.punct
3543 format.urldate "urldate" output.check
3544 format.url "url" output.check
3545 format.doi output
3546 new.block
3547 format.note output
3548 fin.entry
3549 }
3550
3551 FUNCTION {misc}
3552 { eprint empty$ not archiveprefix empty$ not or eprinttype empty$ not or
3553 'preprint
3554 { entry.url empty$
3555 {
3556 "Z" set.entry.type.id
3557 book
3558 }
3559 'webpage
3560 if$
3561 }
3562 if$
3563 empty.misc.check
3564 }
3565
3566 FUNCTION {article}
3567 { entrysubtype field.or.null "l" change.case$ "newspaper" =
3568 { "N" set.entry.type.id
3569 article.journal
3570 }
3571 { journal journaltitle either.or shortjournal either.or
3572 duplicate$ empty$
3573 { pop$
3574 archiveprefix eprinttype either.or eprint either.or empty$
3575 'article.journal
3576 'preprint
3577 if$
3578 }
3579 { check.arxiv.preprint
3580 'preprint
3581 'article.journal
3582 if$
3583 }
3584 if$
3585 }
3586 if$
3587 }
3588
3589 FUNCTION {booklet} { book }
3590
3591 FUNCTION {collection}
3592 { "G" set.entry.type.id
3593 book
3594 }
3595
3596 FUNCTION {image} { misc }
3597
3598 FUNCTION {legislation} { archive }
3599
3600 FUNCTION {map}
3601 { "CM" set.entry.type.id
3602 booktitle empty$ not
3603 { incollection }
3604 { output.bibitem
3605 format.authors output
3606 format.date.before.title output
3607 new.block
3608 format.btitle "title" output.check
3609 new.block
3610 format.edition output
3611 new.block
3612 format.address.publisher output
3613 format.date output
3614 bbl.pages.colon set.punct
3615 format.pages output
3616 "" set.punct
3617 format.creation.modification.date output
3618 "" set.punct
3619 format.urldate output
3620 format.url output
3621 format.doi output
3622 new.block
3623 format.note output
3624 fin.entry
3625 }
3626 if$
3627 }
3628
3629 FUNCTION {newspaper}
3630 { "N" set.entry.type.id
3631 article.journal
3632 }
3633
3634 FUNCTION {online}
3635 { eprint empty$
3636 archiveprefix empty$ and
3637 eprinttype empty$ and
3638 { webpage }
3639 { preprint }
3640 if$
3641 }
3642
3643 FUNCTION {software}
3644 { "CP" set.entry.type.id
3645 webpage
3646 }
3647
3648 FUNCTION {standard}
3649 { "S" set.entry.type.id
3650 booktitle empty$
3651 'book
3652 'incollection
3653 if$
3654 }
3655
3656 FUNCTION {unpublished} { misc }
3657
3658 FUNCTION {video} { misc }
3659
3660 FUNCTION {default.type} { misc }
3661
3662 FUNCTION {mult}
3663 { 'a := %% we store the first value
3664 'b := %% we store the second value
3665
3666 b #0 < %% We remember the sign of b, and
3667 {#-1 #0 b - 'b :=} %% then consider its absolute value.
3668 {#1} %%
3669 if$ %%
3670
3671 #0 %% Put 0 on the stack.
3672 {b #0 >} %% While b is strictly positive,
3673 { %% we add a to the value on the stack
3674 a + %% and decrement b.
3675 b #1 - 'b := %%
3676 } %%
3677 while$ %%
3678
3679 swap$ %% Last, we take the opposite
3680 'skip$ %% if b was negative.
3681 {#0 swap$ -} %%
3682 if$ %%
3683 }
3684
3685 FUNCTION {chr.to.value} %% The ASCII code of a character
3686 { chr.to.int$ #48 - %% ASCII value of "0" -> 48
3687 duplicate$ duplicate$ %% "1" -> 49
3688 #0 < swap$ #9 > or %% ...
3689 { %% "9" -> 57
3690 #48 + int.to.chr$
3691 " is not a number..." *
3692 warning$ %% Return 0 if it is not a number
3693 pop$ #0 %%
3694 }
3695 {}
3696 if$
3697 }
3698
3699 FUNCTION {str.to.int.aux} %% The auxiliary function
3700 { { duplicate$ empty$ not } %% While the string is not empty
3701 { %% consider its first char
3702 swap$ #10 mult 'a := %% and ``add'' it at the end of
3703 duplicate$ #1 #1 substring$ %% the result.
3704 chr.to.value a +
3705 swap$
3706 #2 global.max$ substring$
3707 }
3708 while$
3709 pop$
3710 }
3711
3712 FUNCTION {str.to.int}
3713 { %% Handling negative values
3714 duplicate$ #1 #1 substring$ "-" =
3715 {#1 swap$ #2 global.max$ substring$}
3716 {#0 swap$}
3717 if$
3718 %% Initialization, and then
3719 #0 swap$ str.to.int.aux %% call to the aux. function
3720 swap$
3721 {#0 swap$ -} %% And handle the sign.
3722 {}
3723 if$
3724 }
3725
3726 FUNCTION {boolean.to.int}
3727 { "l" change.case$ duplicate$
3728 "true" =
3729 { pop$ #1 }
3730 { duplicate$ "false" =
3731 { pop$ #0 }
3732 { "unknown boolean " quote$ * swap$ * quote$ *
3733 " in " * cite$ * warning$
3734 #0
3735 }
3736 if$
3737 }
3738 if$
3739 }
3740
3741 FUNCTION {GBT7714BSTCTL}
3742 { CTL_bib_punct empty$
3743 'skip$
3744 { CTL_bib_punct 'control.bib.punct := }
3745 if$
3746 CTL_convert_punct empty$
3747 'skip$
3748 { CTL_convert_punct boolean.to.int 'control.convert.punct := }
3749 if$
3750 CTL_max_bib_names empty$
3751 'skip$
3752 { CTL_max_bib_names str.to.int 'control.max.bib.names := }
3753 if$
3754 CTL_min_bib_names empty$
3755 'skip$
3756 { CTL_min_bib_names str.to.int 'control.min.bib.names := }
3757 if$
3758 CTL_max_cite_names empty$
3759 'skip$
3760 { CTL_max_cite_names str.to.int 'control.max.cite.names := }
3761 if$
3762 CTL_min_cite_names empty$
3763 'skip$
3764 { CTL_min_cite_names str.to.int 'control.min.cite.names := }
3765 if$
3766 CTL_uppercase_family empty$
3767 'skip$
3768 { CTL_uppercase_family boolean.to.int 'control.uppercase.family := }
3769 if$
3770 CTL_initialize_with_hyphen empty$
3771 'skip$
3772 { CTL_initialize_with_hyphen boolean.to.int 'control.initialize.with.hyphen := }
3773 if$
3774 CTL_check_pinyin empty$
3775 'skip$
3776 { CTL_check_pinyin boolean.to.int 'control.check.pinyin := }
3777 if$
3778 CTL_initialize_pinyin empty$
3779 'skip$
3780 { CTL_initialize_pinyin boolean.to.int 'control.initialize.pinyin := }
3781 if$
3782 CTL_bib_final_and empty$
3783 'skip$
3784 { CTL_bib_final_and boolean.to.int 'control.bib.final.and := }
3785 if$
3786 CTL_cite_final_and empty$
3787 'skip$
3788 { CTL_cite_final_and boolean.to.int 'control.cite.final.and := }
3789 if$
3790 CTL_cite_lang empty$
3791 'skip$
3792 { CTL_cite_lang 'control.cite.lang := }
3793 if$
3794 CTL_space_before_et_al empty$
3795 'skip$
3796 { CTL_space_before_et_al boolean.to.int 'control.space.before.et.al := }
3797 if$
3798 CTL_year_before_title empty$
3799 'skip$
3800 { CTL_year_before_title boolean.to.int 'control.year.before.title := }
3801 if$
3802 CTL_name_year_delim empty$
3803 'skip$
3804 { CTL_name_year_delim 'control.name.year.delim := }
3805 if$
3806 CTL_sentence_case empty$
3807 'skip$
3808 { CTL_sentence_case boolean.to.int 'control.sentence.case.title :=
3809 CTL_sentence_case boolean.to.int 'control.sentence.case.booktitle :=
3810 CTL_sentence_case boolean.to.int 'control.sentence.case.journal :=
3811 }
3812 if$
3813 CTL_sentence_case_title empty$
3814 'skip$
3815 { CTL_sentence_case_title boolean.to.int 'control.sentence.case.title := }
3816 if$
3817 CTL_sentence_case_booktitle empty$
3818 'skip$
3819 { CTL_sentence_case_booktitle boolean.to.int 'control.sentence.case.booktitle := }
3820 if$
3821 CTL_sentence_case_journal empty$
3822 'skip$
3823 { CTL_sentence_case_journal boolean.to.int 'control.sentence.case.journal := }
3824 if$
3825 CTL_capitalize_subtitle empty$
3826 'skip$
3827 { CTL_capitalize_subtitle boolean.to.int 'control.capitalize.subtitle := }
3828 if$
3829 CTL_link_title empty$
3830 'skip$
3831 { CTL_link_title boolean.to.int 'control.link.title := }
3832 if$
3833 CTL_article_title empty$
3834 'skip$
3835 { CTL_article_title boolean.to.int 'control.article.title := }
3836 if$
3837 CTL_patent_country empty$
3838 'skip$
3839 { CTL_patent_country boolean.to.int 'control.patent.country := }
3840 if$
3841 CTL_entry_type_id empty$
3842 'skip$
3843 { CTL_entry_type_id boolean.to.int 'control.entry.type.id := }
3844 if$
3845 CTL_space_before_type_id empty$
3846 'skip$
3847 { CTL_space_before_type_id boolean.to.int 'control.space.before.type.id := }
3848 if$
3849 CTL_entry_medium_id empty$
3850 'skip$
3851 { CTL_entry_medium_id boolean.to.int 'control.entry.medium.id := }
3852 if$
3853 CTL_slash empty$
3854 'skip$
3855 { CTL_slash boolean.to.int 'control.slash := }
3856 if$
3857 CTL_in empty$
3858 'skip$
3859 { CTL_in boolean.to.int 'control.in := }
3860 if$
3861 CTL_emph_booktitle empty$
3862 'skip$
3863 { CTL_emph_booktitle boolean.to.int 'control.emph.booktitle := }
3864 if$
3865 CTL_emph_journal empty$
3866 'skip$
3867 { CTL_emph_journal boolean.to.int 'control.emph.journal := }
3868 if$
3869 CTL_short_journal empty$
3870 'skip$
3871 { CTL_short_journal boolean.to.int 'control.short.journal := }
3872 if$
3873 CTL_journal_dots empty$
3874 'skip$
3875 { CTL_journal_dots boolean.to.int 'control.journal.dots := }
3876 if$
3877 CTL_link_journal empty$
3878 'skip$
3879 { CTL_link_journal boolean.to.int 'control.link.journal := }
3880 if$
3881 CTL_bold_volume empty$
3882 'skip$
3883 { CTL_bold_volume boolean.to.int 'control.bold.volume := }
3884 if$
3885 CTL_unknown_publisher empty$
3886 'skip$
3887 { CTL_unknown_publisher boolean.to.int 'control.unknown.publisher := }
3888 if$
3889 CTL_space_before_pages empty$
3890 'skip$
3891 { CTL_space_before_pages boolean.to.int 'control.space.before.pages := }
3892 if$
3893 CTL_page_ranges empty$
3894 'skip$
3895 { CTL_page_ranges boolean.to.int 'control.page.ranges := }
3896 if$
3897 CTL_page_range_delim empty$
3898 'skip$
3899 { CTL_page_range_delim 'control.page.range.delim := }
3900 if$
3901 CTL_urldate empty$
3902 'skip$
3903 { CTL_urldate boolean.to.int 'control.urldate := }
3904 if$
3905 CTL_url empty$
3906 'skip$
3907 { CTL_url boolean.to.int 'control.url := }
3908 if$
3909 CTL_doi empty$
3910 'skip$
3911 { CTL_doi boolean.to.int 'control.doi := }
3912 if$
3913 CTL_eprint empty$
3914 'skip$
3915 { CTL_eprint boolean.to.int 'control.eprint := }
3916 if$
3917 CTL_note empty$
3918 'skip$
3919 { CTL_note boolean.to.int 'control.note := }
3920 if$
3921 CTL_end_dot empty$
3922 'skip$
3923 { CTL_end_dot boolean.to.int 'control.end.dot := }
3924 if$
3925 CTL_warn_empty_field empty$
3926 'skip$
3927 { CTL_warn_empty_field boolean.to.int 'control.warn.empty.field := }
3928 if$
3929 }
3930
3931 FUNCTION {control.pass}
3932 { type$ "gbt7714bstctl" =
3933 'GBT7714BSTCTL
3934 'skip$
3935 if$
3936 }
3937
3938 FUNCTION {control.check}
3939 { % TODO
3940 }
3941
3942 MACRO {jan} {"January"}
3943
3944 MACRO {feb} {"February"}
3945
3946 MACRO {mar} {"March"}
3947
3948 MACRO {apr} {"April"}
3949
3950 MACRO {may} {"May"}
3951
3952 MACRO {jun} {"June"}
3953
3954 MACRO {jul} {"July"}
3955
3956 MACRO {aug} {"August"}
3957
3958 MACRO {sep} {"September"}
3959
3960 MACRO {oct} {"October"}
3961
3962 MACRO {nov} {"November"}
3963
3964 MACRO {dec} {"December"}
3965
3966 MACRO {acmcs} {"ACM Computing Surveys"}
3967
3968 MACRO {acta} {"Acta Informatica"}
3969
3970 MACRO {cacm} {"Communications of the ACM"}
3971
3972 MACRO {ibmjrd} {"IBM Journal of Research and Development"}
3973
3974 MACRO {ibmsj} {"IBM Systems Journal"}
3975
3976 MACRO {ieeese} {"IEEE Transactions on Software Engineering"}
3977
3978 MACRO {ieeetc} {"IEEE Transactions on Computers"}
3979
3980 MACRO {ieeetcad}
3981 {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
3982
3983 MACRO {ipl} {"Information Processing Letters"}
3984
3985 MACRO {jacm} {"Journal of the ACM"}
3986
3987 MACRO {jcss} {"Journal of Computer and System Sciences"}
3988
3989 MACRO {scp} {"Science of Computer Programming"}
3990
3991 MACRO {sicomp} {"SIAM Journal on Computing"}
3992
3993 MACRO {tocs} {"ACM Transactions on Computer Systems"}
3994
3995 MACRO {tods} {"ACM Transactions on Database Systems"}
3996
3997 MACRO {tog} {"ACM Transactions on Graphics"}
3998
3999 MACRO {toms} {"ACM Transactions on Mathematical Software"}
4000
4001 MACRO {toois} {"ACM Transactions on Office Information Systems"}
4002
4003 MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
4004
4005 MACRO {tcs} {"Theoretical Computer Science"}
4006
4007 FUNCTION {sortify}
4008 { purify$
4009 "l" change.case$
4010 }
4011
4012 FUNCTION {chop.word}
4013 { 's :=
4014 'len :=
4015 s #1 len substring$ =
4016 { s len #1 + global.max$ substring$ }
4017 's
4018 if$
4019 }
4020
4021 FUNCTION {format.lab.names}
4022 { 's :=
4023 #1 'nameptr :=
4024 s num.names$ 'numnames :=
4025 numnames 'namesleft :=
4026 { namesleft #0 > }
4027 { format.lab.name 't :=
4028 nameptr #1 >
4029 { numnames control.max.cite.names >
4030 nameptr control.min.cite.names > and
4031 { "others" 't :=
4032 #1 'namesleft :=
4033 }
4034 'skip$
4035 if$
4036 namesleft #1 >
4037 { add.comma t * }
4038 { t "others" =
4039 { nameptr #2 >
4040 { add.comma }
4041 { space.precedes.et.al * }
4042 if$
4043 cite.et.al *
4044 }
4045 { control.cite.final.and
4046 { is.lang.cjk not nameptr #2 > and
4047 { add.comma }
4048 { inter.word.space * }
4049 if$
4050 cite.and * inter.word.space *
4051 }
4052 { add.comma }
4053 if$
4054 t *
4055 }
4056 if$
4057 }
4058 if$
4059 }
4060 't
4061 if$
4062 nameptr #1 + 'nameptr :=
4063 namesleft #1 - 'namesleft :=
4064 }
4065 while$
4066 format.punctuations
4067 }
4068
4069 FUNCTION {author.key.label}
4070 { author empty$
4071 { bbl.anonymous }
4072 { author format.lab.names }
4073 if$
4074 }
4075
4076 FUNCTION {author.editor.key.label}
4077 { author empty$
4078 { editor empty$
4079 { bbl.anonymous }
4080 { editor format.lab.names }
4081 if$
4082 }
4083 { author format.lab.names }
4084 if$
4085 }
4086
4087 FUNCTION {author.key.organization.label}
4088 { author empty$
4089 { organization empty$
4090 { bbl.anonymous }
4091 { "The " #4 organization chop.word #3 text.prefix$ }
4092 if$
4093 }
4094 { author format.lab.names }
4095 if$
4096 }
4097
4098 FUNCTION {editor.key.organization.label}
4099 { editor empty$
4100 { organization empty$
4101 { bbl.anonymous }
4102 { "The " #4 organization chop.word #3 text.prefix$ }
4103 if$
4104 }
4105 { editor format.lab.names }
4106 if$
4107 }
4108
4109 FUNCTION {holder.author.label}
4110 { holder empty$
4111 { author empty$
4112 { bbl.anonymous }
4113 { author format.lab.names }
4114 if$
4115 }
4116 { holder format.lab.names }
4117 if$
4118 }
4119
4120 FUNCTION {calc.short.authors}
4121 { type$ "book" =
4122 type$ "inbook" = booktitle empty$ not and
4123 or
4124 'author.editor.key.label
4125 { type$ "collection" =
4126 type$ "proceedings" =
4127 or
4128 type$ "periodical" =
4129 or
4130 { editor empty$ not
4131 'editor.key.organization.label
4132 'author.key.organization.label
4133 if$
4134 }
4135 { type$ "patent" =
4136 'holder.author.label
4137 'author.key.label
4138 if$
4139 }
4140 if$
4141 }
4142 if$
4143 'short.list :=
4144 }
4145
4146 FUNCTION {calc.label}
4147 { calc.short.authors
4148 short.list
4149 duplicate$ "]" contains
4150 { "{" swap$ * "}" * }
4151 'skip$
4152 if$
4153 "("
4154 *
4155 format.lab.date
4156 duplicate$ "]" contains
4157 { "{" swap$ * "}" * }
4158 'skip$
4159 if$
4160 *
4161 'label :=
4162 }
4163
4164 FUNCTION {sort.language.label}
4165 { entry.lang lang.zh =
4166 { lang.zh.order }
4167 { entry.lang lang.ja =
4168 { lang.ja.order }
4169 { entry.lang lang.en =
4170 { lang.en.order }
4171 { entry.lang lang.ru =
4172 { lang.ru.order }
4173 { lang.other.order }
4174 if$
4175 }
4176 if$
4177 }
4178 if$
4179 }
4180 if$
4181 #64 +
4182 int.to.chr$
4183 }
4184
4185 FUNCTION {sort.format.names}
4186 { 's :=
4187 #1 'nameptr :=
4188 ""
4189 s num.names$ 'numnames :=
4190 numnames 'namesleft :=
4191 { namesleft #0 > }
4192 { s nameptr "{vv{ } }{ll{ }}{ ff{ }}{ jj{ }}" format.name$ 't :=
4193 nameptr #1 >
4194 { " " *
4195 namesleft #1 = t "others" = and
4196 { "zzzzz" * }
4197 { numnames #2 > nameptr #2 = and
4198 { "zz" * year field.or.null * " " * }
4199 'skip$
4200 if$
4201 t sortify *
4202 }
4203 if$
4204 }
4205 { t sortify * }
4206 if$
4207 nameptr #1 + 'nameptr :=
4208 namesleft #1 - 'namesleft :=
4209 }
4210 while$
4211 }
4212
4213 FUNCTION {sort.format.title}
4214 { 't :=
4215 "A " #2
4216 "An " #3
4217 "The " #4 t chop.word
4218 chop.word
4219 chop.word
4220 sortify
4221 #1 global.max$ substring$
4222 }
4223
4224 FUNCTION {anonymous.sort}
4225 { entry.lang lang.zh =
4226 { "yi4 ming2" }
4227 { "anon" }
4228 if$
4229 }
4230
4231 FUNCTION {warn.empty.key}
4232 { is.lang.cjk
4233 { "key" warn.empty.field }
4234 'skip$
4235 if$
4236 }
4237
4238 FUNCTION {author.sort}
4239 { key empty$
4240 { warn.empty.key
4241 author empty$
4242 { anonymous.sort }
4243 { author sort.format.names }
4244 if$
4245 }
4246 { key }
4247 if$
4248 }
4249
4250 FUNCTION {author.editor.sort}
4251 { key empty$
4252 { warn.empty.key
4253 author empty$
4254 { editor empty$
4255 { anonymous.sort }
4256 { editor sort.format.names }
4257 if$
4258 }
4259 { author sort.format.names }
4260 if$
4261 }
4262 { key }
4263 if$
4264 }
4265
4266 FUNCTION {author.organization.sort}
4267 { key empty$
4268 { warn.empty.key
4269 author empty$
4270 { organization empty$
4271 { anonymous.sort }
4272 { "The " #4 organization chop.word sortify }
4273 if$
4274 }
4275 { author sort.format.names }
4276 if$
4277 }
4278 { key }
4279 if$
4280 }
4281
4282 FUNCTION {editor.organization.sort}
4283 { key empty$
4284 { warn.empty.key
4285 editor empty$
4286 { organization empty$
4287 { anonymous.sort }
4288 { "The " #4 organization chop.word sortify }
4289 if$
4290 }
4291 { editor sort.format.names }
4292 if$
4293 }
4294 { key }
4295 if$
4296 }
4297
4298 FUNCTION {presort}
4299 { type$ "gbt7714bstctl" =
4300 {
4301 "_"
4302 " "
4303 }
4304 { set.entry.lang
4305 set.entry.numbered
4306 "" 'entry.url :=
4307 #0 'require.url :=
4308 check.electronic
4309 calc.label
4310 label sortify
4311 " "
4312 *
4313 sort.language.label
4314 " "
4315 *
4316 type$ "book" =
4317 type$ "inbook" = booktitle empty$ not and
4318 or
4319 'author.editor.sort
4320 { type$ "collection" =
4321 type$ "proceedings" =
4322 or
4323 'editor.organization.sort
4324 'author.sort
4325 if$
4326 }
4327 if$
4328 *
4329 " "
4330 *
4331 year field.or.null sortify
4332 *
4333 " "
4334 *
4335 cite$
4336 *
4337 #1 entry.max$ substring$
4338 }
4339 if$
4340 'sort.label :=
4341 sort.label *
4342 #1 entry.max$ substring$
4343 'sort.key$ :=
4344 }
4345
4346 STRINGS { longest.label last.label next.extra last.extra.label }
4347
4348 INTEGERS { longest.label.width number.label }
4349
4350 FUNCTION {initialize.longest.label}
4351 { "" 'longest.label :=
4352 #0 int.to.chr$ 'last.label :=
4353 "" 'next.extra :=
4354 #0 'longest.label.width :=
4355 #0 'number.label :=
4356 "" 'last.extra.label :=
4357 }
4358
4359 FUNCTION {forward.pass}
4360 { type$ "gbt7714bstctl" =
4361 'skip$
4362 {
4363 last.label label =
4364 { "" 'extra.label :=
4365 last.extra.label text.length$ 'charptr :=
4366 { last.extra.label charptr #1 substring$ "z" =
4367 charptr #0 > and
4368 }
4369 { "a" extra.label * 'extra.label :=
4370 charptr #1 - 'charptr :=
4371 }
4372 while$
4373 charptr #0 >
4374 { last.extra.label charptr #1 substring$ chr.to.int$ #1 + int.to.chr$
4375 extra.label * 'extra.label :=
4376 last.extra.label #1 charptr #1 - substring$
4377 extra.label * 'extra.label :=
4378 }
4379 { "a" extra.label * 'extra.label := }
4380 if$
4381 extra.label 'last.extra.label :=
4382 }
4383 { "a" 'last.extra.label :=
4384 "" 'extra.label :=
4385 label 'last.label :=
4386 }
4387 if$
4388 number.label #1 + 'number.label :=
4389 }
4390 if$
4391 }
4392
4393 FUNCTION {reverse.pass}
4394 { type$ "gbt7714bstctl" =
4395 'skip$
4396 {
4397 next.extra "b" =
4398 { "a" 'extra.label := }
4399 'skip$
4400 if$
4401 extra.label 'next.extra :=
4402 extra.label
4403 duplicate$ empty$
4404 'skip$
4405 { "{\natexlab{" swap$ * "}}" * }
4406 if$
4407 'extra.label :=
4408 label extra.label * 'label :=
4409 }
4410 if$
4411 }
4412
4413 FUNCTION {bib.sort.order}
4414 { sort.label 'sort.key$ := }
4415
4416 FUNCTION {begin.bib}
4417 { preamble$ empty$
4418 'skip$
4419 { preamble$ write$ newline$ }
4420 if$
4421 "\begin{thebibliography}{" number.label int.to.str$ * "}" *
4422 write$ newline$
4423 control.cite.lang "macro" =
4424 { "\providecommand{\biband}{和}"
4425 write$ newline$
4426 "\providecommand{\bibetal}{等}"
4427 write$ newline$
4428 }
4429 'skip$
4430 if$
4431 "\providecommand{\natexlab}[1]{#1}"
4432 write$ newline$
4433 "\providecommand{\url}[1]{#1}"
4434 write$ newline$
4435 "\expandafter\ifx\csname urlstyle\endcsname\relax\else"
4436 write$ newline$
4437 " \urlstyle{same}\fi"
4438 write$ newline$
4439 control.doi control.eprint or
4440 { "\expandafter\ifx\csname href\endcsname\relax"
4441 write$ newline$
4442 control.doi
4443 { " \def\doi{\begingroup \urlstyle{same}\Url}"
4444 write$ newline$
4445 control.cstr
4446 { " \def\cstr{\begingroup \urlstyle{same}\Url}"
4447 write$ newline$
4448 }
4449 'skip$
4450 if$
4451 }
4452 'skip$
4453 if$
4454 control.eprint
4455 { " \def\eprint#1#2{#2}"
4456 write$ newline$
4457 }
4458 'skip$
4459 if$
4460 "\else"
4461 write$ newline$
4462 control.doi
4463 { " \def\doi#1{\href{https://doi.org/#1}{\nolinkurl{#1}}}"
4464 write$ newline$
4465 control.cstr
4466 { " \def\cstr#1{\href{https://cstr.cn/#1}{\nolinkurl{#1}}}"
4467 write$ newline$
4468 }
4469 'skip$
4470 if$
4471 }
4472 'skip$
4473 if$
4474 control.eprint
4475 { " \let\eprint\href"
4476 write$ newline$
4477 }
4478 'skip$
4479 if$
4480 "\fi"
4481 write$ newline$
4482 }
4483 'skip$
4484 if$
4485 }
4486
4487 FUNCTION {end.bib}
4488 { newline$
4489 "\end{thebibliography}" write$ newline$
4490 }
4491
4492 READ
4493
4494 EXECUTE {init.state.consts}
4495
4496 EXECUTE {load.config}
4497
4498 ITERATE {control.pass}
4499
4500 EXECUTE {control.check}
4501
4502 ITERATE {presort}
4503
4504 SORT
4505
4506 EXECUTE {initialize.longest.label}
4507
4508 ITERATE {forward.pass}
4509
4510 REVERSE {reverse.pass}
4511
4512 ITERATE {bib.sort.order}
4513
4514 SORT
4515
4516 EXECUTE {begin.bib}
4517
4518 ITERATE {call.type$}
4519
4520 EXECUTE {end.bib}