Debian Codegraph @

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

raw
1 %%
2 %% This is file `gbt7714-2005-authoryear.bst',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% gbt7714-bst.dtx (with options: `2005,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 "half" 'control.bib.punct := % GB / half / bylanguage
83 #1 'control.convert.punct :=
84 #3 'control.max.bib.names :=
85 #3 'control.min.bib.names :=
86 #1 'control.max.cite.names :=
87 #1 'control.min.cite.names :=
88 #0 'control.bib.final.and :=
89 #1 'control.cite.final.and :=
90 #1 'control.space.before.et.al :=
91 #1 'control.uppercase.family :=
92 #0 'control.initialize.with.hyphen :=
93 #1 'control.check.pinyin :=
94 #1 'control.initialize.pinyin :=
95 "byentry" 'control.cite.lang := % byentry / chinese / english / macro
96 #1 'control.year.before.title :=
97 "period" '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 #1 '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 #0 'control.doi :=
123 #0 'control.cstr :=
124 #0 'control.eprint :=
125 #0 'control.note :=
126 #1 'control.end.dot :=
127 #1 'control.warn.empty.field :=
128 #1 'lang.zh.order :=
129 #2 'lang.ja.order :=
130 #3 'lang.en.order :=
131 #4 'lang.ru.order :=
132 #5 'lang.other.order :=
133 }
134
135 ENTRY
136 { address
137 archiveprefix
138 author
139 bookauthor
140 booksubtitle
141 booktitle
142 booktitleaddon
143 country % 专利国别
144 cstr
145 date
146 dimensions
147 doi
148 edition
149 editor
150 eid
151 entrymediumid
152 entrysubtype
153 entrytypeid
154 eventtitle
155 eprint
156 eprinttype
157 holder
158 howpublished
159 institution
160 journal
161 journalsubtitle
162 journaltitle
163 journaltitleaddon
164 key
165 langid
166 language
167 location
168 mainsubtitle
169 maintitle
170 maintitleaddon
171 mark
172 medium
173 nationality % 专利国别,兼容 IEEEtran.bst
174 note
175 number
176 organization
177 pages
178 publisher
179 scale
180 school
181 series
182 shortjournal
183 subtitle
184 title
185 titleaddon
186 translator
187 url
188 urldate
189 version
190 volume
191 year
192 CTL_bib_punct
193 CTL_convert_punct
194 CTL_max_bib_names
195 CTL_min_bib_names
196 CTL_max_cite_names
197 CTL_min_cite_names
198 CTL_uppercase_family
199 CTL_initialize_with_hyphen
200 CTL_check_pinyin
201 CTL_initialize_pinyin
202 CTL_bib_final_and
203 CTL_cite_final_and
204 CTL_cite_lang
205 CTL_space_before_et_al
206 CTL_year_before_title
207 CTL_name_year_delim
208 CTL_sentence_case
209 CTL_sentence_case_title
210 CTL_sentence_case_booktitle
211 CTL_sentence_case_journal
212 CTL_capitalize_subtitle
213 CTL_link_title
214 CTL_article_title
215 CTL_patent_country
216 CTL_entry_type_id
217 CTL_space_before_type_id
218 CTL_entry_medium_id
219 CTL_slash
220 CTL_in
221 CTL_emph_booktitle
222 CTL_emph_journal
223 CTL_short_journal
224 CTL_journal_dots
225 CTL_link_journal
226 CTL_bold_volume
227 CTL_unknown_publisher
228 CTL_space_before_pages
229 CTL_page_ranges
230 CTL_page_range_delim
231 CTL_urldate
232 CTL_url
233 CTL_doi
234 CTL_eprint
235 CTL_note
236 CTL_end_dot
237 CTL_warn_empty_field
238 }
239 { entry.lang is.lang.cjk entry.numbered require.url }
240 { label extra.label sort.label short.list entry.type.id entry.eprint entry.url }
241
242 INTEGERS { output.state before.all mid.sentence after.sentence after.block after.punct }
243
244 INTEGERS { lang.zh lang.ja lang.ko lang.en lang.ru lang.other }
245
246 INTEGERS { charptr len }
247
248 STRINGS { pinyin.table }
249
250 FUNCTION {init.state.consts}
251 { #0 'before.all :=
252 #1 'mid.sentence :=
253 #2 'after.sentence :=
254 #3 'after.block :=
255 #4 'after.punct :=
256 #3 'lang.zh :=
257 #4 'lang.ja :=
258 #5 'lang.ko :=
259 #1 'lang.en :=
260 #2 'lang.ru :=
261 #0 'lang.other :=
262 " a ai an ang ao "
263 "ba bai ban bang bao bei ben beng bi bian biao bie bin bing bo bu " *
264 "ca cai can cang cao ce cen ceng cha chai chan chang chao che chen cheng chi chong chou chu chuai chuan chuang chui chun chuo ci cong cou cu cuan cui cun cuo " *
265 "da dai dan dang dao de dei deng di dia dian diao die ding diu dong dou du duan dui dun duo " *
266 "e ei en eng er " *
267 "fa fan fang fei fen feng fo fou fu " *
268 "ga gai gan gang gao ge gei gen geng gong gou gu gua guai guan guang gui gun guo " *
269 "ha hai han hang hao he hei hen heng hong hou hu hua huai huan huang hui hun huo " *
270 "ji jia jian jiang jiao jie jin jing jiong jiu ju juan jue jun " *
271 "ka kai kan kang kao ke ken keng kong kou ku kua kuai kuan kuang kui kun kuo " *
272 "la lai lan lang lao le lei leng li lia lian liang liao lie lin ling liu long lou lu luan lun luo lü lüe lyu lyue " *
273 "ma mai man mang mao me mei men meng mi mian miao mie min ming miu mo mou mu " *
274 "na nai nan nang nao ne nei nen neng ni nian niang niao nie nin ning niu nong nu nuan nuo nü nüe nyu nyue " *
275 "o ou " *
276 "pa pai pan pang pao pei pen peng pi pian piao pie pin ping po pou pu " *
277 "qi qia qian qiang qiao qie qin qing qiong qiu qu quan que qun " *
278 "ran rang rao re ren reng ri rong rou ru ruan rui run ruo " *
279 "sa sai san sang sao se sen seng sha shai shan shang shao she shei shen sheng shi shou shu shua shuai shuan shuang shui shun shuo si song sou su suan sui sun suo " *
280 "ta tai tan tang tao te teng ti tian tiao tie ting tong tou tu tuan tui tun tuo " *
281 "wa wai wan wang wei wen weng wo wu " *
282 "xi xia xian xiang xiao xie xin xing xiong xiu xu xuan xue xun " *
283 "ya yan yang yao ye yi yin ying yong you yu yuan yue yun " *
284 "za zai zan zang zao ze zei zen zeng zha zhai zhan zhang zhao zhe zhei zhen zheng zhi zhong zhou zhu zhua zhuai zhuan zhuang zhui zhun zhuo zi zong zou zu zuan zui zun zuo " *
285 'pinyin.table :=
286 }
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} { "\ " }
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$ "standard" = or
1455 type$ "techreport" = or
1456 { #1 'entry.numbered := }
1457 { #0 'entry.numbered := }
1458 if$
1459 }
1460
1461 INTEGERS { nameptr namesleft numnames name.lang }
1462
1463 FUNCTION {is.lowercase.word}
1464 { #1
1465 { #0 > }
1466 { duplicate$ #1 #1 substring$ chr.to.int$
1467 duplicate$ #96 >
1468 swap$ #123 <
1469 and
1470 { #2 global.max$ substring$
1471 duplicate$ empty$
1472 { #0 }
1473 { #1 }
1474 if$
1475 }
1476 { #0 }
1477 if$
1478 }
1479 while$
1480 empty$
1481 }
1482
1483 FUNCTION {is.single.pinyin}
1484 { " " swap$ * " " *
1485 pinyin.table swap$ contains
1486 }
1487
1488 FUNCTION {is.single.pinyin.word}
1489 { duplicate$ is.lowercase.word
1490 'is.single.pinyin
1491 { pop$ #0 }
1492 if$
1493 }
1494
1495 FUNCTION {is.double.pinyin}
1496 { duplicate$ string.length 'a :=
1497 #1
1498 { a #0 > and }
1499 { duplicate$ #1 a substring$ is.single.pinyin
1500 { duplicate$ a #1 + global.max$ substring$
1501 duplicate$ empty$
1502 { pop$ #0 }
1503 { is.single.pinyin
1504 { #0 }
1505 { a #1 - 'a :=
1506 #1
1507 }
1508 if$
1509 }
1510 if$
1511 }
1512 { a #1 - 'a :=
1513 #1
1514 }
1515 if$
1516 }
1517 while$
1518 't :=
1519 t #1 #1 substring$
1520 t a #1 + #1 substring$
1521 duplicate$ empty$
1522 'pop$
1523 { " " swap$ * * }
1524 if$
1525 't :=
1526 a #0 >
1527 }
1528
1529 FUNCTION {is.double.pinyin.word}
1530 { duplicate$ is.lowercase.word
1531 'is.double.pinyin
1532 { pop$ #0 }
1533 if$
1534 }
1535
1536 FUNCTION {extract.before}
1537 { 'find :=
1538 'text :=
1539 find string.length 'find_length :=
1540 ""
1541 { text empty$ not }
1542 { text #1 find_length substring$ find =
1543 { "" 'text := }
1544 { text #1 #1 substring$ *
1545 text #2 global.max$ substring$ 'text :=
1546 }
1547 if$
1548 }
1549 while$
1550 }
1551
1552 FUNCTION {extract.after}
1553 { 'find :=
1554 'text :=
1555 find string.length 'find_length :=
1556 ""
1557 { text empty$ not }
1558 { text #1 find_length substring$ find =
1559 { text find_length #1 + global.max$ substring$ *
1560 "" 'text :=
1561 }
1562 { text #2 global.max$ substring$ 'text := }
1563 if$
1564 }
1565 while$
1566 }
1567
1568 FUNCTION {format.western.given.name}
1569 { s nameptr "{ f.}" format.name$
1570 control.initialize.with.hyphen
1571 'skip$
1572 { duplicate$ "-" contains
1573 { "-" " " find.replace
1574 "u" change.case$
1575 }
1576 'skip$
1577 if$
1578 }
1579 if$
1580 s nameptr "{, jj}" format.name$ *
1581 "." "" find.replace
1582 }
1583
1584 FUNCTION {is.family.name.pinyin}
1585 { s nameptr "{ll}" format.name$
1586 duplicate$ empty$
1587 { pop$ #0 }
1588 { "l" change.case$
1589 duplicate$ "-" contains
1590 { duplicate$ "-" extract.before is.single.pinyin.word
1591 { "-" extract.after is.single.pinyin.word }
1592 { pop$ #0 }
1593 if$
1594 }
1595 { % 这个函数实在太慢了
1596 % is.double.pinyin
1597 is.single.pinyin.word
1598 }
1599 if$
1600 }
1601 if$
1602 }
1603
1604 FUNCTION {is.given.name.pinyin}
1605 { s nameptr "{ff}" format.name$
1606 duplicate$ empty$
1607 { pop$ #0 }
1608 { "l" change.case$
1609 "’" "'" find.replace
1610 duplicate$ "'" contains
1611 { duplicate$ "'" extract.before
1612 duplicate$ #1 #1 substring$ 't :=
1613 is.single.pinyin.word
1614 { "'" extract.after
1615 duplicate$ #1 #1 substring$ t " " * swap$ * 't :=
1616 is.single.pinyin.word
1617 }
1618 { pop$ #0 }
1619 if$
1620 }
1621 'is.double.pinyin.word
1622 if$
1623 }
1624 if$
1625 }
1626
1627 FUNCTION {is.name.pinyin}
1628 { s nameptr "{vv}{jj}" format.name$ empty$
1629 { is.family.name.pinyin
1630 'is.given.name.pinyin
1631 { #0 }
1632 if$
1633 }
1634 { #0 }
1635 if$
1636 }
1637
1638 FUNCTION {format.latin.name}
1639 { s nameptr "{vv~}{ll}" format.name$
1640 control.uppercase.family
1641 'smart.upper.case
1642 'skip$
1643 if$
1644 control.check.pinyin
1645 { is.name.pinyin
1646 { control.initialize.pinyin
1647 { " " t "u" change.case$ * }
1648 { s nameptr "{ ff}" format.name$ }
1649 if$
1650 }
1651 { format.western.given.name }
1652 if$
1653 }
1654 { format.western.given.name }
1655 if$
1656 *
1657 }
1658
1659 FUNCTION {format.name}
1660 { s nameptr "{vv~}{ll}{,~ff}{, jj}" format.name$
1661 get.str.lang
1662 duplicate$
1663 duplicate$ lang.zh = swap$ lang.ja = or
1664 { pop$
1665 s nameptr "{vv~}{ll}" format.name$
1666 s nameptr "{ff}{, jj}" format.name$
1667 duplicate$ get.str.lang
1668 duplicate$ lang.zh = swap$ lang.ja = or
1669 { * }
1670 { pop$ }
1671 if$
1672 }
1673 { lang.ru =
1674 { s nameptr "{vv~}{ll}" format.name$
1675 s nameptr "{ff}{, jj}" format.name$
1676 "." "" find.replace
1677 duplicate$ empty$
1678 'pop$
1679 { " " swap$ * * }
1680 if$
1681 }
1682 { format.latin.name }
1683 if$
1684 }
1685 if$
1686 }
1687
1688 FUNCTION {inter.word.space}
1689 { is.lang.cjk
1690 { "" }
1691 { " " }
1692 if$
1693 }
1694
1695 FUNCTION {format.names}
1696 { 's :=
1697 #1 'nameptr :=
1698 s num.names$ 'numnames :=
1699 numnames 'namesleft :=
1700 { namesleft #0 > }
1701 { format.name 't :=
1702 nameptr #1 >
1703 { numnames control.max.bib.names >
1704 nameptr control.min.bib.names > and
1705 { "others" 't :=
1706 #1 'namesleft :=
1707 }
1708 'skip$
1709 if$
1710 namesleft #1 >
1711 { add.comma t * }
1712 { t "l" change.case$ "others" =
1713 { nameptr #2 >
1714 { add.comma }
1715 { inter.word.space * }
1716 if$
1717 bbl.et.al *
1718 }
1719 { control.bib.final.and
1720 { is.lang.cjk not nameptr #2 > and
1721 { add.comma }
1722 { inter.word.space * }
1723 if$
1724 bbl.and * inter.word.space *
1725 }
1726 { add.comma }
1727 if$
1728 t *
1729 }
1730 if$
1731 }
1732 if$
1733 }
1734 't
1735 if$
1736 nameptr #1 + 'nameptr :=
1737 namesleft #1 - 'namesleft :=
1738 }
1739 while$
1740 format.punctuations
1741 }
1742
1743 FUNCTION {warn.empty.field}
1744 { control.warn.empty.field
1745 { "empty " swap$ * " in " * cite$ * warning$ }
1746 'pop$
1747 if$
1748 }
1749
1750 FUNCTION {format.anonymous}
1751 {
1752 bbl.anonymous
1753 }
1754
1755 FUNCTION {format.authors}
1756 { author empty$
1757 { "author" warn.empty.field
1758 format.anonymous
1759 }
1760 { author format.names }
1761 if$
1762 }
1763
1764 FUNCTION {format.editors}
1765 { editor empty$
1766 { "editor" warn.empty.field
1767 format.anonymous
1768 }
1769 { editor format.names }
1770 if$
1771 }
1772
1773 FUNCTION {format.authors.editors}
1774 { author empty$
1775 { editor empty$
1776 { "author and editor" warn.empty.field
1777 format.anonymous
1778 }
1779 { editor format.names }
1780 if$
1781 }
1782 { author format.names }
1783 if$
1784 }
1785
1786 FUNCTION {format.translators}
1787 { translator empty$
1788 { "" }
1789 { translator format.names
1790 add.comma bbl.translator *
1791 }
1792 if$
1793 }
1794
1795 FUNCTION {format.lab.name}
1796 { s nameptr "{vv~}{ll}{,~ff}{, jj}" format.name$
1797 get.str.lang
1798 duplicate$ lang.zh =
1799 swap$ lang.ja = or
1800 { s nameptr "{vv~}{ll}" format.name$
1801 s nameptr "{ff}{, jj}" format.name$
1802 duplicate$ get.str.lang
1803 duplicate$ lang.zh = swap$ lang.ja = or
1804 { * }
1805 'pop$
1806 if$
1807 }
1808 { s nameptr "{vv~}{ll}" format.name$ }
1809 if$
1810 }
1811
1812 FUNCTION {format.full.names}
1813 { 's :=
1814 #1 'nameptr :=
1815 s num.names$ 'numnames :=
1816 numnames 'namesleft :=
1817 { namesleft #0 > }
1818 { format.lab.name 't :=
1819 nameptr #1 >
1820 { namesleft #1 >
1821 { add.comma t * }
1822 { t "l" change.case$ "others" =
1823 { nameptr #2 >
1824 { add.comma }
1825 { inter.word.space * }
1826 if$
1827 cite.et.al *
1828 }
1829 { control.cite.final.and
1830 { is.lang.cjk not nameptr #2 > and
1831 { add.comma }
1832 { inter.word.space * }
1833 if$
1834 cite.and * inter.word.space *
1835 }
1836 { add.comma }
1837 if$
1838 t *
1839 }
1840 if$
1841 }
1842 if$
1843 }
1844 't
1845 if$
1846 nameptr #1 + 'nameptr :=
1847 namesleft #1 - 'namesleft :=
1848 }
1849 while$
1850 format.punctuations
1851 }
1852
1853 FUNCTION {author.editor.full}
1854 { author empty$
1855 { editor empty$
1856 { "" }
1857 { editor format.full.names }
1858 if$
1859 }
1860 { author format.full.names }
1861 if$
1862 }
1863
1864 FUNCTION {author.full}
1865 { author empty$
1866 { "" }
1867 { author format.full.names }
1868 if$
1869 }
1870
1871 FUNCTION {editor.full}
1872 { editor empty$
1873 { "" }
1874 { editor format.full.names }
1875 if$
1876 }
1877
1878 FUNCTION {holder.author.full}
1879 { holder empty$
1880 { author empty$
1881 { "" }
1882 { author format.full.names }
1883 if$
1884 }
1885 { holder format.full.names }
1886 if$
1887 }
1888
1889 FUNCTION {make.full.names}
1890 { type$ "book" =
1891 type$ "inbook" = booktitle empty$ not and
1892 or
1893 'author.editor.full
1894 { type$ "collection" =
1895 type$ "proceedings" =
1896 or
1897 'editor.full
1898 { type$ "patent" =
1899 'holder.author.full
1900 'author.full
1901 if$
1902 }
1903 if$
1904 }
1905 if$
1906 }
1907
1908 FUNCTION {output.bibitem}
1909 { newline$
1910 "\bibitem[" write$
1911 label ")" *
1912 make.full.names duplicate$ short.list =
1913 { pop$ }
1914 { duplicate$ "]" contains
1915 { "{" swap$ * "}" * }
1916 'skip$
1917 if$
1918 *
1919 }
1920 if$
1921 "]{" * write$
1922 cite$ write$
1923 "}" write$
1924 newline$
1925 ""
1926 before.all 'output.state :=
1927 }
1928
1929 FUNCTION {format.title.subtitle.titleaddon}
1930 { title empty$
1931 { "" }
1932 { title
1933 subtitle empty$
1934 'skip$
1935 { add.colon.by.language subtitle * }
1936 if$
1937 titleaddon empty$
1938 'skip$
1939 { add.colon.by.language titleaddon * }
1940 if$
1941 }
1942 if$
1943 }
1944
1945 FUNCTION {change.sentence.case}
1946 { entry.lang lang.en =
1947 'smart.sentence.case
1948 'skip$
1949 if$
1950 }
1951
1952 FUNCTION {add.link}
1953 { url empty$ not
1954 { "\href{" url * "}{" * swap$ * "}" * }
1955 { doi empty$ not
1956 { "\href{https://doi.org/" doi * "}{" * swap$ * "}" * }
1957 'skip$
1958 if$
1959 }
1960 if$
1961 }
1962
1963 FUNCTION {format.tr.number}
1964 { ""
1965 number empty$
1966 'skip$
1967 { type$ "patent" = control.patent.country and
1968 { country empty$ not
1969 { country * }
1970 { nationality empty$ not
1971 { nationality * }
1972 { address empty$ not
1973 { address * }
1974 { location empty$ not
1975 { location * }
1976 { "" }
1977 { entry.lang lang.zh =
1978 { "中国" * }
1979 'skip$
1980 if$
1981 }
1982 if$
1983 }
1984 if$
1985 }
1986 if$
1987 }
1988 if$
1989 }
1990 'skip$
1991 if$
1992 duplicate$ empty$
1993 'skip$
1994 'add.comma
1995 if$
1996 number
1997 duplicate$ get.str.lang lang.zh =
1998 'format.punctuations
1999 'skip$
2000 if$
2001 *
2002 }
2003 if$
2004 }
2005
2006 FUNCTION {entry.has.url.or.doi}
2007 { control.url require.url or entry.url empty$ not and
2008 doi empty$ not cstr empty$ not or
2009 control.doi control.url or require.url or and
2010 or
2011 }
2012
2013 FUNCTION {format.entry.type.id}
2014 { control.entry.type.id
2015 { entry.type.id
2016 control.entry.medium.id
2017 { entrymediumid empty$
2018 { medium empty$
2019 { entry.has.url.or.doi
2020 type$ "online" = or
2021 type$ "webpage" = or
2022 { "/OL" * }
2023 'skip$
2024 if$
2025 }
2026 { "The field 'medium' for entry medium ID is deprecated. Use 'entrymediumid' instead." warning$
2027 "/" * medium *
2028 }
2029 if$
2030 }
2031 { "/" * entrymediumid * }
2032 if$
2033 }
2034 'skip$
2035 if$
2036 make.brackets
2037 control.space.before.type.id
2038 { " " }
2039 { "\allowbreak" }
2040 if$
2041 swap$ *
2042 }
2043 { "" }
2044 if$
2045 }
2046
2047 FUNCTION {format.title}
2048 { title empty$
2049 { "" }
2050 { format.title.subtitle.titleaddon
2051 control.sentence.case.title
2052 'change.sentence.case
2053 'skip$
2054 if$
2055 format.punctuations
2056 control.link.title
2057 'add.link
2058 'skip$
2059 if$
2060 entry.numbered number empty$ not and
2061 { add.colon
2062 format.tr.number *
2063 }
2064 'skip$
2065 if$
2066 format.entry.type.id *
2067 }
2068 if$
2069 }
2070
2071 FUNCTION {tie.or.space.connect}
2072 { duplicate$ text.length$ #3 <
2073 { "~" }
2074 { " " }
2075 if$
2076 swap$ * *
2077 }
2078
2079 FUNCTION {either.or.check}
2080 { empty$
2081 'pop$
2082 { "can't use both " swap$ * " fields in " * cite$ * warning$ }
2083 if$
2084 }
2085
2086 FUNCTION {is.digit}
2087 { duplicate$ empty$
2088 { pop$ #0 }
2089 { chr.to.int$
2090 duplicate$ "0" chr.to.int$ <
2091 { pop$ #0 }
2092 { "9" chr.to.int$ >
2093 { #0 }
2094 { #1 }
2095 if$
2096 }
2097 if$
2098 }
2099 if$
2100 }
2101
2102 FUNCTION {is.number}
2103 { #1
2104 { #0 > }
2105 { duplicate$ #1 #1 substring$ chr.to.int$
2106 duplicate$ #47 >
2107 swap$ #58 <
2108 and
2109 { #2 global.max$ substring$
2110 duplicate$ empty$
2111 { #0 }
2112 { #1 }
2113 if$
2114 }
2115 { #0 }
2116 if$
2117 }
2118 while$
2119 empty$
2120 }
2121
2122 FUNCTION {format.bvolume}
2123 { volume empty$
2124 { "" }
2125 { volume is.number
2126 { entry.lang lang.zh =
2127 { "第" volume tie.or.space.connect " 卷" * }
2128 { entry.lang lang.ko =
2129 { "제" volume tie.or.space.connect " 권" * }
2130 { "v." volume * }
2131 if$
2132 }
2133 if$
2134 }
2135 { volume }
2136 if$
2137 }
2138 if$
2139 }
2140
2141 FUNCTION {format.maintitle}
2142 { maintitle empty$
2143 { "" }
2144 { mainsubtitle empty$
2145 'skip$
2146 { add.colon.by.language mainsubtitle * }
2147 if$
2148 maintitleaddon empty$
2149 'skip$
2150 { add.colon.by.language maintitleaddon * }
2151 if$
2152 }
2153 if$
2154 }
2155
2156 FUNCTION {format.maintitle.volume}
2157 { maintitle empty$
2158 { "" }
2159 { maintitle
2160 volume empty$
2161 'skip$
2162 { add.colon.by.language
2163 format.bvolume *
2164 }
2165 if$
2166 }
2167 if$
2168 }
2169
2170 FUNCTION {format.title.volume}
2171 { title empty$
2172 { "" }
2173 { format.title.subtitle.titleaddon
2174 volume empty$
2175 'skip$
2176 { add.colon.by.language
2177 format.bvolume *
2178 }
2179 if$
2180 }
2181 if$
2182 }
2183
2184 FUNCTION {format.series.volume}
2185 { series empty$
2186 { "" }
2187 { series
2188 volume empty$
2189 'skip$
2190 { add.colon.by.language
2191 format.bvolume *
2192 }
2193 if$
2194 }
2195 if$
2196 }
2197
2198 FUNCTION {format.btitle}
2199 { maintitle empty$
2200 { series empty$
2201 { format.title.volume }
2202 { volume empty$
2203 { format.title.volume }
2204 { format.series.volume
2205 entry.numbered
2206 'skip$
2207 { "volume and number" number either.or.check }
2208 if$
2209 bbl.wide.space *
2210 format.title.subtitle.titleaddon
2211 *
2212 }
2213 if$
2214 }
2215 if$
2216 }
2217 { volume empty$
2218 { format.maintitle
2219 add.colon.by.language
2220 format.title.subtitle.titleaddon *
2221 }
2222 { format.maintitle.volume
2223 bbl.wide.space *
2224 format.title.subtitle.titleaddon
2225 *
2226 }
2227 if$
2228 }
2229 if$
2230 duplicate$ empty$
2231 'skip$
2232 { control.sentence.case.title
2233 'change.sentence.case
2234 'skip$
2235 if$
2236 format.punctuations
2237 emphasize.book.title
2238 control.link.title
2239 'add.link
2240 'skip$
2241 if$
2242 entry.numbered number empty$ not and
2243 { add.colon format.tr.number * }
2244 'skip$
2245 if$
2246 type$ "map" =
2247 scale empty$ not and
2248 { add.period
2249 duplicate$ #-1 #1 substring$ "." =
2250 { " " * }
2251 'skip$
2252 if$
2253 scale *
2254 }
2255 'skip$
2256 if$
2257 format.entry.type.id *
2258 }
2259 if$
2260 }
2261
2262 FUNCTION {format.booktitle}
2263 { booktitle empty$
2264 { "" }
2265 { booktitle
2266 control.sentence.case.booktitle
2267 'change.sentence.case
2268 'skip$
2269 if$
2270 booksubtitle empty$
2271 'skip$
2272 { add.colon
2273 booksubtitle
2274 control.sentence.case.booktitle
2275 { "l" change.case$ }
2276 'skip$
2277 if$
2278 *
2279 }
2280 if$
2281 emphasize.book.title
2282 booktitleaddon empty$
2283 'skip$
2284 { add.colon
2285 booktitleaddon
2286 control.sentence.case.booktitle
2287 { "l" change.case$ }
2288 'skip$
2289 if$
2290 *
2291 }
2292 if$
2293 format.punctuations
2294 }
2295 if$
2296 }
2297
2298 FUNCTION {format.series.volume.booktitle}
2299 { series empty$
2300 { maintitle empty$
2301 { format.booktitle
2302 volume empty$
2303 'skip$
2304 { add.colon
2305 format.bvolume *
2306 }
2307 if$
2308 }
2309 { format.maintitle.volume
2310 bbl.wide.space *
2311 format.booktitle *
2312 }
2313 if$
2314 }
2315 { volume empty$
2316 { format.booktitle }
2317 { format.series.volume
2318 bbl.wide.space *
2319 format.booktitle *
2320 }
2321 if$
2322 }
2323 if$
2324 }
2325
2326 FUNCTION {format.in.ed.booktitle}
2327 { booktitle empty$
2328 { "" }
2329 { control.in
2330 { bbl.in add.colon }
2331 { "" }
2332 if$
2333 editor empty$
2334 'skip$
2335 { format.editors * output new.block "" }
2336 if$
2337 format.series.volume.booktitle *
2338 }
2339 if$
2340 }
2341
2342 FUNCTION {remove.dots}
2343 { 's :=
2344 ""
2345 { s empty$ not }
2346 { s #1 #1 substring$
2347 duplicate$ "." =
2348 'pop$
2349 { * }
2350 if$
2351 s #2 global.max$ substring$ 's :=
2352 }
2353 while$
2354 }
2355
2356 FUNCTION {format.journal.title}
2357 { journal empty$
2358 { journaltitle empty$
2359 { "" }
2360 { journaltitle }
2361 if$
2362 }
2363 { journal }
2364 if$
2365 journalsubtitle empty$
2366 'skip$
2367 { duplicate$ empty$
2368 'skip$
2369 'add.colon.by.language
2370 if$
2371 journalsubtitle *
2372 }
2373 if$
2374 journaltitleaddon empty$
2375 'skip$
2376 { duplicate$ empty$
2377 'skip$
2378 'add.colon.by.language
2379 if$
2380 journaltitleaddon *
2381 }
2382 if$
2383 control.sentence.case.journal
2384 'change.sentence.case
2385 'skip$
2386 if$
2387 }
2388
2389 FUNCTION {format.short.journal}
2390 { shortjournal empty$
2391 { format.journal.title
2392 duplicate$ field.or.null " " contains % The journal title is not a single word
2393 is.lang.cjk not and
2394 { "shortjournal" warn.empty.field }
2395 'skip$
2396 if$
2397 }
2398 { shortjournal
2399 control.journal.dots
2400 'skip$
2401 'remove.dots
2402 if$
2403 }
2404 if$
2405 }
2406
2407 FUNCTION {get.journal.title}
2408 { control.short.journal
2409 'format.short.journal
2410 { format.journal.title
2411 duplicate$ empty$
2412 { shortjournal empty$
2413 { "journal" warn.empty.field }
2414 { pop$ format.short.journal }
2415 if$
2416 }
2417 { shortjournal empty$ control.journal.dots not and
2418 'remove.dots
2419 { duplicate$ shortjournal = control.journal.dots not and
2420 'remove.dots
2421 'skip$
2422 if$
2423 }
2424 if$
2425 }
2426 if$
2427 }
2428 if$
2429 }
2430
2431 FUNCTION {check.arxiv.preprint}
2432 { "l" change.case$
2433 duplicate$ #1 #5 substring$ "arxiv" =
2434 { 'x :=
2435 "arxiv:" 'y :=
2436 y text.length$ 'len :=
2437 x text.length$ len - #1 + 'charptr :=
2438 { charptr #0 >
2439 x charptr len substring$ y = not
2440 and
2441 }
2442 { charptr #1 - 'charptr := }
2443 while$
2444 charptr #0 >
2445 { x charptr #6 + global.max$ substring$ 'x :=
2446 x string.length #1 + 'len :=
2447 #1 'charptr :=
2448 { charptr len <
2449 x charptr #1 substring$ " " = not and
2450 x charptr #1 substring$ "[" = not and
2451 }
2452 { charptr #1 + 'charptr := }
2453 while$
2454 x #1 charptr substring$
2455 duplicate$ empty$
2456 'pop$
2457 { "\url{https://arxiv.org/abs/" swap$ * "}" * 'entry.url := }
2458 if$
2459 }
2460 'skip$
2461 if$
2462 #1
2463 }
2464 { pop$ #0 }
2465 if$
2466 }
2467
2468 FUNCTION {format.journal}
2469 { get.journal.title
2470 duplicate$ empty$
2471 'skip$
2472 { format.punctuations
2473 control.emph.journal is.lang.cjk not and
2474 'emphasize
2475 'skip$
2476 if$
2477 }
2478 if$
2479 }
2480
2481 FUNCTION {set.entry.type.id}
2482 { entry.type.id empty$
2483 { entrytypeid empty$
2484 { entrysubtype empty$
2485 { mark empty$
2486 { 'entry.type.id := }
2487 { pop$
2488 "The field 'mark' for entry type ID is deprecated. Use 'entrytypeid' instead." warning$
2489 mark 'entry.type.id :=
2490 }
2491 if$
2492 }
2493 { entrysubtype "newspaper" =
2494 { pop$ "N" 'entry.type.id := }
2495 { entrysubtype "inproceedings" =
2496 { pop$ "C" 'entry.type.id := }
2497 { entrysubtype "report" =
2498 { pop$ "R" 'entry.type.id := }
2499 { entrysubtype "techreport" =
2500 { pop$ "R" 'entry.type.id := }
2501 { entrysubtype "standard" =
2502 { pop$ "S" 'entry.type.id := }
2503 { entrysubtype "patent" =
2504 { pop$ "P" 'entry.type.id := }
2505 { entrysubtype "dataset" =
2506 { pop$ "DS" 'entry.type.id := }
2507 { 'entry.type.id := }
2508 if$
2509 }
2510 if$
2511 }
2512 if$
2513 }
2514 if$
2515 }
2516 if$
2517 }
2518 if$
2519 }
2520 if$
2521 }
2522 if$
2523 }
2524 { pop$ entrytypeid 'entry.type.id := }
2525 if$
2526 }
2527 'pop$
2528 if$
2529 }
2530
2531 FUNCTION {num.to.ordinal}
2532 { is.lang.cjk
2533 'skip$
2534 { duplicate$ #-2 #1 substring$ "1" =
2535 { "th" * }
2536 { duplicate$ #-1 #1 substring$ "1" =
2537 { "st" * }
2538 { duplicate$ #-1 #1 substring$ "2" =
2539 { "nd" * }
2540 { duplicate$ #-1 #1 substring$ "3" =
2541 { "rd" * }
2542 { "th" * }
2543 if$
2544 }
2545 if$
2546 }
2547 if$
2548 }
2549 if$
2550 }
2551 if$
2552 }
2553
2554 FUNCTION {extract.num}
2555 { duplicate$ 't :=
2556 "" 's :=
2557 { t empty$ not }
2558 { t #1 #1 substring$
2559 t #2 global.max$ substring$ 't :=
2560 duplicate$ is.digit
2561 { s swap$ * 's := }
2562 { pop$ "" 't := }
2563 if$
2564 }
2565 while$
2566 s empty$
2567 'skip$
2568 { pop$ s }
2569 if$
2570 }
2571
2572 FUNCTION {word.to.num}
2573 { duplicate$ "l" change.case$ 's :=
2574 s "first" =
2575 { pop$ "1" }
2576 'skip$
2577 if$
2578 s "second" =
2579 { pop$ "2" }
2580 'skip$
2581 if$
2582 s "third" =
2583 { pop$ "3" }
2584 'skip$
2585 if$
2586 s "fourth" =
2587 { pop$ "4" }
2588 'skip$
2589 if$
2590 s "fifth" =
2591 { pop$ "5" }
2592 'skip$
2593 if$
2594 s "sixth" =
2595 { pop$ "6" }
2596 'skip$
2597 if$
2598 s "seventh" =
2599 { pop$ "7" }
2600 'skip$
2601 if$
2602 s "eighth" =
2603 { pop$ "8" }
2604 'skip$
2605 if$
2606 s "ninth" =
2607 { pop$ "9" }
2608 'skip$
2609 if$
2610 s "tenth" =
2611 { pop$ "10" }
2612 'skip$
2613 if$
2614 s "revised edition" =
2615 { pop$ "Rev. ed." }
2616 'skip$
2617 if$
2618 s "revised ed." =
2619 { pop$ "Rev. ed." }
2620 'skip$
2621 if$
2622 s "revised" =
2623 { pop$ "Rev. ed." }
2624 'skip$
2625 if$
2626 s "rev." =
2627 { pop$ "Rev. ed." }
2628 'skip$
2629 if$
2630 s "修订版" =
2631 { pop$ "修订版" }
2632 'skip$
2633 if$
2634 s "修订" =
2635 { pop$ "修订版" }
2636 'skip$
2637 if$
2638 }
2639
2640 FUNCTION {format.edition}
2641 { edition empty$
2642 { "" }
2643 { edition
2644 duplicate$ #1 #1 substring$ is.digit
2645 'extract.num
2646 'word.to.num
2647 if$
2648 duplicate$ "1" =
2649 { pop$ "" }
2650 { duplicate$ #1 #1 substring$ is.digit
2651 { num.to.ordinal
2652 " " * bbl.edition *
2653 }
2654 'skip$
2655 if$
2656 }
2657 if$
2658 }
2659 if$
2660 }
2661
2662 FUNCTION {format.version}
2663 { version empty$
2664 { "" }
2665 { version #1 #1 substring$
2666 duplicate$ "V" =
2667 { pop$ version }
2668 { "v" =
2669 { "V" version #2 global.max$ substring$ * }
2670 { "V" version * }
2671 if$
2672 }
2673 if$
2674 }
2675 if$
2676 }
2677
2678 FUNCTION {format.publisher}
2679 { publisher empty$
2680 { institution empty$
2681 { school empty$
2682 { "" }
2683 { school }
2684 if$
2685 }
2686 { institution }
2687 if$
2688 }
2689 { publisher }
2690 if$
2691 format.punctuations
2692 }
2693
2694 FUNCTION {format.address.publisher}
2695 { address empty$
2696 { location empty$
2697 { "" }
2698 { location }
2699 if$
2700 }
2701 { address }
2702 if$
2703 format.punctuations
2704 duplicate$ empty$ not
2705 { format.publisher empty$ not
2706 { add.colon format.publisher * }
2707 { entry.has.url.or.doi not control.unknown.publisher and
2708 { add.colon bbl.sine.nomine make.brackets * }
2709 'skip$
2710 if$
2711 }
2712 if$
2713 }
2714 { pop$
2715 entry.has.url.or.doi not control.unknown.publisher and
2716 { format.publisher empty$ not
2717 { bbl.sine.loco make.brackets add.colon format.publisher * }
2718 { bbl.sine.loco.sine.nomine make.brackets }
2719 if$
2720 }
2721 { format.publisher empty$ not
2722 { format.publisher }
2723 { "" }
2724 if$
2725 }
2726 if$
2727 }
2728 if$
2729 }
2730
2731 FUNCTION {format.eventtitle}
2732 { eventtitle empty$
2733 { "" }
2734 { eventtitle format.punctuations }
2735 if$
2736 }
2737
2738 FUNCTION {normalize.year.dash}
2739 {
2740 "---" "-" find.replace
2741 "--" "-" find.replace
2742 "–" "-" find.replace
2743 "—" "-" find.replace
2744 }
2745
2746 FUNCTION {format.date}
2747 { year empty$
2748 { date empty$
2749 { entry.has.url.or.doi
2750 { "" }
2751 { "year" warn.empty.field
2752 urldate empty$
2753 { "" }
2754 { urldate "-" extract.before extra.label * make.brackets }
2755 if$
2756 }
2757 if$
2758 }
2759 { date "/" extract.before "-" extract.before
2760 date "/" contains
2761 { "-" normalize.year.dash *
2762 date "/" extract.after "-" extract.before *
2763 }
2764 'skip$
2765 if$
2766 extra.label *
2767 }
2768 if$
2769 }
2770 { year normalize.year.dash
2771 extra.label *
2772 }
2773 if$
2774 control.year.before.title
2775 { pop$ "" }
2776 'skip$
2777 if$
2778 }
2779
2780 FUNCTION {format.full.date}
2781 { date empty$
2782 { year }
2783 { control.year.before.title
2784 { date }
2785 { date #1 #4 substring$
2786 extra.label *
2787 date #5 global.max$ substring$ *
2788 }
2789 if$
2790 }
2791 if$
2792 }
2793
2794 FUNCTION {format.lab.date}
2795 { year empty$
2796 { date empty$
2797 { urldate empty$
2798 { bbl.no.date
2799 extra.label empty$
2800 'skip$
2801 { "-" * extra.label *}
2802 if$
2803 }
2804 { urldate "-" extract.before extra.label * make.brackets }
2805 if$
2806 }
2807 { date "/" extract.before "-" extract.before
2808 date "/" contains
2809 { "-" normalize.year.dash *
2810 date "/" extract.after "-" extract.before *
2811 }
2812 'skip$
2813 if$
2814 extra.label *
2815 }
2816 if$
2817 }
2818 { year normalize.year.dash extra.label * }
2819 if$
2820 }
2821
2822 FUNCTION {format.date.before.title}
2823 { control.year.before.title
2824 { "period" control.name.year.delim =
2825 'new.sentence
2826 'skip$
2827 if$
2828 format.lab.date
2829 }
2830 { "" }
2831 if$
2832 }
2833
2834 FUNCTION {format.creation.modification.date}
2835 { date empty$
2836 {
2837 ""
2838 }
2839 { date }
2840 if$
2841 duplicate$ empty$
2842 'skip$
2843 { make.parentheses
2844 "\allowbreak " swap$ *
2845 }
2846 if$
2847 }
2848
2849 FUNCTION {format.urldate}
2850 {
2851 entry.has.url.or.doi
2852 control.urldate urldate empty$ not and and
2853 { "\allowbreak" urldate make.brackets * }
2854 { "" }
2855 if$
2856 }
2857
2858 FUNCTION {normalize.page.range}
2859 { "" swap$
2860 { duplicate$ empty$ not }
2861 { #1 skip.inter.token.chars.by 't :=
2862 empty$
2863 { "" }
2864 'control.page.range.delim
2865 if$
2866 * t
2867 #1 tokenize.by 't :=
2868 * t
2869 }
2870 while$
2871 pop$
2872 }
2873
2874 FUNCTION {format.pages}
2875 { pages empty$
2876 { "" }
2877 { pages
2878 control.page.ranges
2879 'normalize.page.range
2880 { #1 tokenize.by pop$ }
2881 if$
2882 }
2883 if$
2884 }
2885
2886 FUNCTION {format.dimensions}
2887 { dimensions empty$
2888 { "" }
2889 { dimensions
2890 "x" "$\times$" find.replace
2891 "×" "$\times$" find.replace
2892 }
2893 if$
2894 }
2895
2896 FUNCTION {format.journal.volume}
2897 { volume empty$
2898 { "" }
2899 { control.bold.volume
2900 { "\textbf{" volume * "}" * }
2901 { volume }
2902 if$
2903 }
2904 if$
2905 }
2906
2907 FUNCTION {format.journal.number}
2908 { number empty$
2909 { "" }
2910 { "\allowbreak " number make.parentheses * }
2911 if$
2912 }
2913
2914 FUNCTION {format.journal.pages}
2915 { pages empty$
2916 { eid empty$
2917 { "" }
2918 { eid }
2919 if$
2920 }
2921 { format.pages }
2922 if$
2923 }
2924
2925 FUNCTION {format.newspaper.pages}
2926 { pages empty$
2927 { "" }
2928 { "\allowbreak " format.pages make.parentheses * }
2929 if$
2930 }
2931
2932 FUNCTION {check.electronic}
2933 { entry.url empty$
2934 { url empty$
2935 { howpublished field.or.null #1 #5 substring$ "\url{" =
2936 { howpublished 'entry.url := }
2937 { note field.or.null #1 #5 substring$ "\url{" =
2938 { note "}" extract.before "}" * 'entry.url := }
2939 'skip$
2940 if$
2941 }
2942 if$
2943 }
2944 { "\url{" url * "}" * 'entry.url := }
2945 if$
2946 }
2947 'skip$
2948 if$
2949 }
2950
2951 FUNCTION {format.url}
2952 { control.url require.url or
2953 { entry.url empty$
2954 { control.doi not require.url or
2955 { cstr empty$
2956 { doi empty$
2957 'skip$
2958 { "\url{https://doi.org/" doi * "}" * 'entry.url := }
2959 if$
2960 }
2961 { "\url{https://cstr.cn/" cstr * "}" * 'entry.url := }
2962 if$
2963 }
2964 'skip$
2965 if$
2966 }
2967 'skip$
2968 if$
2969 entry.url empty$
2970 { "" }
2971 { new.block
2972 entry.url
2973 }
2974 if$
2975 }
2976 { "" }
2977 if$
2978 }
2979
2980 FUNCTION {either.or}
2981 { swap$
2982 duplicate$ empty$
2983 { pop$
2984 duplicate$ empty$
2985 { pop$ "" }
2986 'skip$
2987 if$
2988 }
2989 { swap$ pop$ }
2990 if$
2991 }
2992
2993 FUNCTION {format.doi}
2994 { control.doi
2995 { control.cstr not cstr empty$ or
2996 { doi empty$
2997 { "" }
2998 { control.url require.url or
2999 entry.url doi contains and
3000 { "" }
3001 { new.block "DOI:\doi{" doi * "}" * }
3002 if$
3003 }
3004 if$
3005 }
3006 { control.url require.url or
3007 entry.url cstr contains and
3008 { "" }
3009 { new.block "CSTR:\cstr{" cstr * "}" * }
3010 if$
3011 }
3012 if$
3013 }
3014 { "" }
3015 if$
3016 }
3017
3018 FUNCTION {format.eprint}
3019 { archiveprefix eprinttype either.or
3020 duplicate$ empty$
3021 { pop$
3022 journal journaltitle either.or shortjournal either.or
3023 "l" change.case$ #1 #5 substring$ "arxiv" =
3024 { "arXiv" }
3025 { "" }
3026 if$
3027 }
3028 { duplicate$ "arxiv" =
3029 { pop$ "arXiv" }
3030 { duplicate$ "pubmed" =
3031 { pop$ "PubMed" }
3032 'skip$
3033 if$
3034 }
3035 if$
3036 }
3037 if$
3038 entry.url empty$
3039 { duplicate$ "l" change.case$ "arxiv" = entry.eprint empty$ not and
3040 { "\url{https://arxiv.org/abs/" entry.eprint * "}" * 'entry.url := }
3041 'skip$
3042 if$
3043 }
3044 'skip$
3045 if$
3046 control.eprint eprint empty$ not and
3047 { duplicate$ empty$
3048 'skip$
3049 { ":" * }
3050 if$
3051 eprint *
3052 }
3053 'skip$
3054 if$
3055 }
3056
3057 FUNCTION {format.note}
3058 { note empty$ not control.note and
3059 { note }
3060 { "" }
3061 if$
3062 }
3063
3064 FUNCTION {empty.misc.check}
3065 { author empty$ title empty$
3066 year empty$
3067 and and
3068 key empty$ not and
3069 { "all relevant fields are empty in " cite$ * warning$ }
3070 'skip$
3071 if$
3072 }
3073
3074 FUNCTION {link.open}
3075 { control.link.journal
3076 { url empty$
3077 { doi empty$
3078 { "" }
3079 { "\href{https://doi.org/" doi * "}{" * }
3080 if$
3081 }
3082 { "\href{" url * "}{" * }
3083 if$
3084 duplicate$ empty$
3085 { pop$ }
3086 { "" set.punct
3087 output
3088 before.all 'output.state :=
3089 }
3090 if$
3091 }
3092 'skip$
3093 if$
3094 }
3095
3096 FUNCTION {link.close}
3097 { control.link.journal
3098 { url empty$ doi empty$ and
3099 'skip$
3100 { "" set.punct
3101 "}" output
3102 before.all 'output.state :=
3103 }
3104 if$
3105 }
3106 'skip$
3107 if$
3108 }
3109
3110 FUNCTION {article.journal}
3111 { "J" set.entry.type.id
3112 volume empty$ number empty$ and entry.url empty$ not and
3113 date field.or.null text.length$ #9 > and
3114 entry.type.id "J" = and
3115 { #1 'require.url := }
3116 'skip$
3117 if$
3118 output.bibitem
3119 format.authors output
3120 format.date.before.title output
3121 control.article.title
3122 { new.block
3123 format.title "title" output.check
3124 }
3125 'skip$
3126 if$
3127 new.block
3128 format.translators output
3129 new.block
3130 link.open
3131 format.journal "journal" output.check
3132 entry.type.id "N" =
3133 { format.full.date "date" output.check
3134 "" set.punct
3135 format.newspaper.pages output
3136 }
3137 {
3138 format.date output
3139 format.journal.volume output
3140 "" set.punct
3141 format.journal.number output
3142 bbl.pages.colon set.punct
3143 format.journal.pages output
3144 }
3145 if$
3146 link.close
3147 "" set.punct
3148 format.urldate output
3149 format.url output
3150 format.doi output
3151 new.block
3152 format.note output
3153 fin.entry
3154 }
3155
3156 FUNCTION {archive}
3157 { "A" set.entry.type.id
3158 output.bibitem
3159 format.authors output
3160 format.date.before.title output
3161 new.block
3162 format.btitle "title" output.check
3163 % new.block
3164 % format.translators output
3165 new.block
3166 format.address.publisher output
3167 format.date output
3168 bbl.pages.colon set.punct
3169 format.pages output
3170 "" set.punct
3171 format.creation.modification.date output
3172 "" set.punct
3173 format.urldate output
3174 format.url output
3175 format.doi output
3176 new.block
3177 format.note output
3178 fin.entry
3179 }
3180
3181 FUNCTION {book}
3182 { "M" set.entry.type.id
3183 output.bibitem
3184 format.authors.editors output
3185 format.date.before.title output
3186 new.block
3187 format.btitle "title" output.check
3188 new.block
3189 format.translators output
3190 new.sentence
3191 format.edition output
3192 new.block
3193 format.address.publisher output
3194 format.date output
3195 bbl.pages.colon set.punct
3196 format.pages output
3197 "" set.punct
3198 format.urldate output
3199 format.url output
3200 format.doi output
3201 new.block
3202 format.note output
3203 fin.entry
3204 }
3205
3206 FUNCTION {letter} { archive }
3207
3208 FUNCTION {dataset}
3209 { "DS" set.entry.type.id
3210 output.bibitem
3211 format.authors output
3212 format.date.before.title output
3213 new.block
3214 format.btitle "title" output.check
3215 new.block
3216 format.version output
3217 new.block
3218 publisher "publisher" output.check
3219 "" set.punct
3220 format.creation.modification.date output
3221 "" set.punct
3222 format.urldate output
3223 format.url output
3224 format.doi output
3225 new.block
3226 format.note output
3227 fin.entry
3228 }
3229
3230 FUNCTION {database}
3231 { "DB" set.entry.type.id
3232 dataset
3233 }
3234
3235 FUNCTION {inbook}
3236 { "M" set.entry.type.id
3237 booktitle empty$
3238 'book
3239 { output.bibitem
3240 format.authors output
3241 format.date.before.title output
3242 control.article.title
3243 { new.block
3244 format.title "title" output.check
3245 }
3246 'skip$
3247 if$
3248 new.block
3249 format.translators output
3250 new.slash
3251 booktitle empty$
3252 { "" }
3253 { control.in
3254 { bbl.in add.colon }
3255 { "" }
3256 if$
3257 bookauthor empty$
3258 { editor empty$
3259 'skip$
3260 { format.editors * output new.block "" }
3261 if$
3262 }
3263 { bookauthor format.names * output new.block "" }
3264 if$
3265 format.series.volume.booktitle *
3266 }
3267 if$
3268 "booktitle" output.check
3269 new.block
3270 format.edition output
3271 new.block
3272 format.address.publisher output
3273 format.date output
3274 bbl.pages.colon set.punct
3275 format.pages output
3276 "" set.punct
3277 format.urldate output
3278 format.url output
3279 format.doi output
3280 new.block
3281 format.note output
3282 fin.entry
3283 }
3284 if$
3285 }
3286
3287 FUNCTION {incollection}
3288 { "M" set.entry.type.id
3289 output.bibitem
3290 format.authors output
3291 format.date.before.title output
3292 control.article.title
3293 { new.block
3294 format.title "title" output.check
3295 }
3296 'skip$
3297 if$
3298 new.block
3299 format.translators output
3300 new.slash
3301 format.in.ed.booktitle "booktitle" output.check
3302 new.block
3303 format.edition output
3304 new.block
3305 format.address.publisher output
3306 format.date output
3307 bbl.pages.colon set.punct
3308 format.pages output
3309 "" set.punct
3310 format.urldate output
3311 format.url output
3312 format.doi output
3313 new.block
3314 format.note output
3315 fin.entry
3316 }
3317
3318 FUNCTION {inproceedings}
3319 { "C" set.entry.type.id
3320 output.bibitem
3321 format.authors output
3322 format.date.before.title output
3323 control.article.title
3324 { new.block
3325 format.title "title" output.check
3326 }
3327 'skip$
3328 if$
3329 new.slash
3330 booktitle empty$
3331 { format.eventtitle "eventtitle" output.check }
3332 { format.in.ed.booktitle "booktitle" output.check
3333 new.block
3334 format.edition output
3335 new.block
3336 format.address.publisher output
3337 }
3338 if$
3339 format.date output
3340 bbl.pages.colon set.punct
3341 format.pages output
3342 "" set.punct
3343 format.urldate 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 "" set.punct
3370 format.urldate 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 "" set.punct
3401 format.urldate output
3402 format.url output
3403 format.doi output
3404 new.block
3405 format.note output
3406 fin.entry
3407 }
3408
3409 FUNCTION {proceedings}
3410 { "C" set.entry.type.id
3411 output.bibitem
3412 format.editors output
3413 format.date.before.title output
3414 new.block
3415 format.btitle "title" output.check
3416 new.block
3417 format.translators output
3418 new.sentence
3419 format.edition output
3420 new.block
3421 format.address.publisher output
3422 format.date output
3423 bbl.pages.colon set.punct
3424 format.pages output
3425 "" set.punct
3426 format.urldate output
3427 format.url output
3428 format.doi output
3429 new.block
3430 format.note output
3431 fin.entry
3432 }
3433
3434 FUNCTION {preprint}
3435 { #1 'require.url :=
3436 "Z" set.entry.type.id
3437 output.bibitem
3438 format.authors output
3439 format.date.before.title output
3440 control.article.title
3441 { new.block
3442 format.title "title" output.check
3443 }
3444 'skip$
3445 if$
3446 new.block
3447 format.version output
3448 new.block
3449 format.eprint output
3450 "" set.punct
3451 format.creation.modification.date output
3452 "" set.punct
3453 format.urldate "urldate" output.check
3454 format.url "url" output.check
3455 format.doi output
3456 new.block
3457 format.note output
3458 fin.entry
3459 }
3460
3461 FUNCTION {thesis}
3462 { "D" set.entry.type.id
3463 output.bibitem
3464 format.authors output
3465 format.date.before.title output
3466 new.block
3467 format.btitle "title" output.check
3468 new.block
3469 format.address.publisher output
3470 format.date output
3471 bbl.pages.colon set.punct
3472 format.pages output
3473 "" set.punct
3474 format.urldate output
3475 format.url output
3476 format.doi output
3477 new.block
3478 format.note output
3479 fin.entry
3480 }
3481
3482 FUNCTION {phdthesis} { thesis }
3483
3484 FUNCTION {mastersthesis} { thesis }
3485
3486 FUNCTION {techreport}
3487 { "R" set.entry.type.id
3488 output.bibitem
3489 format.authors output
3490 format.date.before.title output
3491 new.block
3492 format.btitle "title" output.check
3493 % new.block
3494 % format.translators output
3495 new.block
3496 institution empty$
3497 pages empty$ and
3498 control.url and
3499 entry.url empty$ not and
3500 'skip$
3501 { format.address.publisher output
3502 format.date output
3503 bbl.pages.colon set.punct
3504 format.pages output
3505 }
3506 if$
3507 "" set.punct
3508 format.creation.modification.date output
3509 "" set.punct
3510 format.urldate output
3511 format.url output
3512 format.doi output
3513 new.block
3514 format.note output
3515 fin.entry
3516 }
3517
3518 FUNCTION {report} { techreport }
3519
3520 FUNCTION {manual} { techreport }
3521
3522 FUNCTION {webpage}
3523 { #1 'require.url :=
3524 output.bibitem
3525 format.authors output
3526 format.date.before.title output
3527 new.block
3528 "EB" set.entry.type.id
3529 format.btitle "title" output.check
3530 new.block
3531 publisher empty$
3532 'skip$
3533 { format.address.publisher output
3534 format.date output
3535 bbl.pages.colon set.punct
3536 format.pages output
3537 "" set.punct
3538 }
3539 if$
3540 format.creation.modification.date output
3541 "" set.punct
3542 format.urldate "urldate" output.check
3543 format.url "url" output.check
3544 format.doi output
3545 new.block
3546 format.note output
3547 fin.entry
3548 }
3549
3550 FUNCTION {misc}
3551 { eprint empty$ not archiveprefix empty$ not or eprinttype empty$ not or
3552 'preprint
3553 { entry.url empty$
3554 {
3555 "M" set.entry.type.id
3556 book
3557 }
3558 'webpage
3559 if$
3560 }
3561 if$
3562 empty.misc.check
3563 }
3564
3565 FUNCTION {article}
3566 { entrysubtype field.or.null "l" change.case$ "newspaper" =
3567 { "N" set.entry.type.id
3568 article.journal
3569 }
3570 { journal journaltitle either.or shortjournal either.or
3571 duplicate$ empty$
3572 { pop$
3573 archiveprefix eprinttype either.or eprint either.or empty$
3574 'article.journal
3575 'preprint
3576 if$
3577 }
3578 { check.arxiv.preprint
3579 'preprint
3580 'article.journal
3581 if$
3582 }
3583 if$
3584 }
3585 if$
3586 }
3587
3588 FUNCTION {booklet} { book }
3589
3590 FUNCTION {collection}
3591 { "G" set.entry.type.id
3592 book
3593 }
3594
3595 FUNCTION {image} { misc }
3596
3597 FUNCTION {legislation} { archive }
3598
3599 FUNCTION {map}
3600 { "CM" set.entry.type.id
3601 booktitle empty$ not
3602 { incollection }
3603 { output.bibitem
3604 format.authors output
3605 format.date.before.title output
3606 new.block
3607 format.btitle "title" output.check
3608 new.block
3609 format.edition output
3610 new.block
3611 format.address.publisher output
3612 format.date output
3613 bbl.pages.colon set.punct
3614 format.pages output
3615 "" set.punct
3616 format.creation.modification.date output
3617 "" set.punct
3618 format.urldate output
3619 format.url output
3620 format.doi output
3621 new.block
3622 format.note output
3623 fin.entry
3624 }
3625 if$
3626 }
3627
3628 FUNCTION {newspaper}
3629 { "N" set.entry.type.id
3630 article.journal
3631 }
3632
3633 FUNCTION {online}
3634 { eprint empty$
3635 archiveprefix empty$ and
3636 eprinttype empty$ and
3637 { webpage }
3638 { preprint }
3639 if$
3640 }
3641
3642 FUNCTION {software}
3643 { "CP" set.entry.type.id
3644 webpage
3645 }
3646
3647 FUNCTION {standard}
3648 { "S" set.entry.type.id
3649 booktitle empty$
3650 'book
3651 'incollection
3652 if$
3653 }
3654
3655 FUNCTION {unpublished} { misc }
3656
3657 FUNCTION {video} { misc }
3658
3659 FUNCTION {default.type} { misc }
3660
3661 FUNCTION {mult}
3662 { 'a := %% we store the first value
3663 'b := %% we store the second value
3664
3665 b #0 < %% We remember the sign of b, and
3666 {#-1 #0 b - 'b :=} %% then consider its absolute value.
3667 {#1} %%
3668 if$ %%
3669
3670 #0 %% Put 0 on the stack.
3671 {b #0 >} %% While b is strictly positive,
3672 { %% we add a to the value on the stack
3673 a + %% and decrement b.
3674 b #1 - 'b := %%
3675 } %%
3676 while$ %%
3677
3678 swap$ %% Last, we take the opposite
3679 'skip$ %% if b was negative.
3680 {#0 swap$ -} %%
3681 if$ %%
3682 }
3683
3684 FUNCTION {chr.to.value} %% The ASCII code of a character
3685 { chr.to.int$ #48 - %% ASCII value of "0" -> 48
3686 duplicate$ duplicate$ %% "1" -> 49
3687 #0 < swap$ #9 > or %% ...
3688 { %% "9" -> 57
3689 #48 + int.to.chr$
3690 " is not a number..." *
3691 warning$ %% Return 0 if it is not a number
3692 pop$ #0 %%
3693 }
3694 {}
3695 if$
3696 }
3697
3698 FUNCTION {str.to.int.aux} %% The auxiliary function
3699 { { duplicate$ empty$ not } %% While the string is not empty
3700 { %% consider its first char
3701 swap$ #10 mult 'a := %% and ``add'' it at the end of
3702 duplicate$ #1 #1 substring$ %% the result.
3703 chr.to.value a +
3704 swap$
3705 #2 global.max$ substring$
3706 }
3707 while$
3708 pop$
3709 }
3710
3711 FUNCTION {str.to.int}
3712 { %% Handling negative values
3713 duplicate$ #1 #1 substring$ "-" =
3714 {#1 swap$ #2 global.max$ substring$}
3715 {#0 swap$}
3716 if$
3717 %% Initialization, and then
3718 #0 swap$ str.to.int.aux %% call to the aux. function
3719 swap$
3720 {#0 swap$ -} %% And handle the sign.
3721 {}
3722 if$
3723 }
3724
3725 FUNCTION {boolean.to.int}
3726 { "l" change.case$ duplicate$
3727 "true" =
3728 { pop$ #1 }
3729 { duplicate$ "false" =
3730 { pop$ #0 }
3731 { "unknown boolean " quote$ * swap$ * quote$ *
3732 " in " * cite$ * warning$
3733 #0
3734 }
3735 if$
3736 }
3737 if$
3738 }
3739
3740 FUNCTION {GBT7714BSTCTL}
3741 { CTL_bib_punct empty$
3742 'skip$
3743 { CTL_bib_punct 'control.bib.punct := }
3744 if$
3745 CTL_convert_punct empty$
3746 'skip$
3747 { CTL_convert_punct boolean.to.int 'control.convert.punct := }
3748 if$
3749 CTL_max_bib_names empty$
3750 'skip$
3751 { CTL_max_bib_names str.to.int 'control.max.bib.names := }
3752 if$
3753 CTL_min_bib_names empty$
3754 'skip$
3755 { CTL_min_bib_names str.to.int 'control.min.bib.names := }
3756 if$
3757 CTL_max_cite_names empty$
3758 'skip$
3759 { CTL_max_cite_names str.to.int 'control.max.cite.names := }
3760 if$
3761 CTL_min_cite_names empty$
3762 'skip$
3763 { CTL_min_cite_names str.to.int 'control.min.cite.names := }
3764 if$
3765 CTL_uppercase_family empty$
3766 'skip$
3767 { CTL_uppercase_family boolean.to.int 'control.uppercase.family := }
3768 if$
3769 CTL_initialize_with_hyphen empty$
3770 'skip$
3771 { CTL_initialize_with_hyphen boolean.to.int 'control.initialize.with.hyphen := }
3772 if$
3773 CTL_check_pinyin empty$
3774 'skip$
3775 { CTL_check_pinyin boolean.to.int 'control.check.pinyin := }
3776 if$
3777 CTL_initialize_pinyin empty$
3778 'skip$
3779 { CTL_initialize_pinyin boolean.to.int 'control.initialize.pinyin := }
3780 if$
3781 CTL_bib_final_and empty$
3782 'skip$
3783 { CTL_bib_final_and boolean.to.int 'control.bib.final.and := }
3784 if$
3785 CTL_cite_final_and empty$
3786 'skip$
3787 { CTL_cite_final_and boolean.to.int 'control.cite.final.and := }
3788 if$
3789 CTL_cite_lang empty$
3790 'skip$
3791 { CTL_cite_lang 'control.cite.lang := }
3792 if$
3793 CTL_space_before_et_al empty$
3794 'skip$
3795 { CTL_space_before_et_al boolean.to.int 'control.space.before.et.al := }
3796 if$
3797 CTL_year_before_title empty$
3798 'skip$
3799 { CTL_year_before_title boolean.to.int 'control.year.before.title := }
3800 if$
3801 CTL_name_year_delim empty$
3802 'skip$
3803 { CTL_name_year_delim 'control.name.year.delim := }
3804 if$
3805 CTL_sentence_case empty$
3806 'skip$
3807 { CTL_sentence_case boolean.to.int 'control.sentence.case.title :=
3808 CTL_sentence_case boolean.to.int 'control.sentence.case.booktitle :=
3809 CTL_sentence_case boolean.to.int 'control.sentence.case.journal :=
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}