Debian Codegraph @

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

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