Debian Codegraph @

texmf-dist/bibtex/bst/gbt7714/gbt7714-numerical.bst

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