Debian Codegraph @

texmf-dist/bibtex/bst/gbt7714/gbt7714-2025-authoryear.bst

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