Debian Codegraph @

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

raw
1 %%
2 %% This is file `gbt7714-2015-numeric.bst',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% gbt7714-bst.dtx (with options: `2015,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 "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 }
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$ "standard" = or
1445 type$ "techreport" = or
1446 { #1 'entry.numbered := }
1447 { #0 'entry.numbered := }
1448 if$
1449 }
1450
1451 INTEGERS { nameptr namesleft numnames name.lang }
1452
1453 FUNCTION {is.lowercase.word}
1454 { #1
1455 { #0 > }
1456 { duplicate$ #1 #1 substring$ chr.to.int$
1457 duplicate$ #96 >
1458 swap$ #123 <
1459 and
1460 { #2 global.max$ substring$
1461 duplicate$ empty$
1462 { #0 }
1463 { #1 }
1464 if$
1465 }
1466 { #0 }
1467 if$
1468 }
1469 while$
1470 empty$
1471 }
1472
1473 FUNCTION {is.single.pinyin}
1474 { " " swap$ * " " *
1475 pinyin.table swap$ contains
1476 }
1477
1478 FUNCTION {is.single.pinyin.word}
1479 { duplicate$ is.lowercase.word
1480 'is.single.pinyin
1481 { pop$ #0 }
1482 if$
1483 }
1484
1485 FUNCTION {is.double.pinyin}
1486 { duplicate$ string.length 'a :=
1487 #1
1488 { a #0 > and }
1489 { duplicate$ #1 a substring$ is.single.pinyin
1490 { duplicate$ a #1 + global.max$ substring$
1491 duplicate$ empty$
1492 { pop$ #0 }
1493 { is.single.pinyin
1494 { #0 }
1495 { a #1 - 'a :=
1496 #1
1497 }
1498 if$
1499 }
1500 if$
1501 }
1502 { a #1 - 'a :=
1503 #1
1504 }
1505 if$
1506 }
1507 while$
1508 't :=
1509 t #1 #1 substring$
1510 t a #1 + #1 substring$
1511 duplicate$ empty$
1512 'pop$
1513 { " " swap$ * * }
1514 if$
1515 't :=
1516 a #0 >
1517 }
1518
1519 FUNCTION {is.double.pinyin.word}
1520 { duplicate$ is.lowercase.word
1521 'is.double.pinyin
1522 { pop$ #0 }
1523 if$
1524 }
1525
1526 FUNCTION {extract.before}
1527 { 'find :=
1528 'text :=
1529 find string.length 'find_length :=
1530 ""
1531 { text empty$ not }
1532 { text #1 find_length substring$ find =
1533 { "" 'text := }
1534 { text #1 #1 substring$ *
1535 text #2 global.max$ substring$ 'text :=
1536 }
1537 if$
1538 }
1539 while$
1540 }
1541
1542 FUNCTION {extract.after}
1543 { 'find :=
1544 'text :=
1545 find string.length 'find_length :=
1546 ""
1547 { text empty$ not }
1548 { text #1 find_length substring$ find =
1549 { text find_length #1 + global.max$ substring$ *
1550 "" 'text :=
1551 }
1552 { text #2 global.max$ substring$ 'text := }
1553 if$
1554 }
1555 while$
1556 }
1557
1558 FUNCTION {format.western.given.name}
1559 { s nameptr "{ f.}" format.name$
1560 control.initialize.with.hyphen
1561 'skip$
1562 { duplicate$ "-" contains
1563 { "-" " " find.replace
1564 "u" change.case$
1565 }
1566 'skip$
1567 if$
1568 }
1569 if$
1570 s nameptr "{, jj}" format.name$ *
1571 "." "" find.replace
1572 }
1573
1574 FUNCTION {is.family.name.pinyin}
1575 { s nameptr "{ll}" format.name$
1576 duplicate$ empty$
1577 { pop$ #0 }
1578 { "l" change.case$
1579 duplicate$ "-" contains
1580 { duplicate$ "-" extract.before is.single.pinyin.word
1581 { "-" extract.after is.single.pinyin.word }
1582 { pop$ #0 }
1583 if$
1584 }
1585 { % 这个函数实在太慢了
1586 % is.double.pinyin
1587 is.single.pinyin.word
1588 }
1589 if$
1590 }
1591 if$
1592 }
1593
1594 FUNCTION {is.given.name.pinyin}
1595 { s nameptr "{ff}" format.name$
1596 duplicate$ empty$
1597 { pop$ #0 }
1598 { "l" change.case$
1599 "’" "'" find.replace
1600 duplicate$ "'" contains
1601 { duplicate$ "'" extract.before
1602 duplicate$ #1 #1 substring$ 't :=
1603 is.single.pinyin.word
1604 { "'" extract.after
1605 duplicate$ #1 #1 substring$ t " " * swap$ * 't :=
1606 is.single.pinyin.word
1607 }
1608 { pop$ #0 }
1609 if$
1610 }
1611 'is.double.pinyin.word
1612 if$
1613 }
1614 if$
1615 }
1616
1617 FUNCTION {is.name.pinyin}
1618 { s nameptr "{vv}{jj}" format.name$ empty$
1619 { is.family.name.pinyin
1620 'is.given.name.pinyin
1621 { #0 }
1622 if$
1623 }
1624 { #0 }
1625 if$
1626 }
1627
1628 FUNCTION {format.latin.name}
1629 { s nameptr "{vv~}{ll}" format.name$
1630 control.uppercase.family
1631 'smart.upper.case
1632 'skip$
1633 if$
1634 control.check.pinyin
1635 { is.name.pinyin
1636 { control.initialize.pinyin
1637 { " " t "u" change.case$ * }
1638 { s nameptr "{ ff}" format.name$ }
1639 if$
1640 }
1641 { format.western.given.name }
1642 if$
1643 }
1644 { format.western.given.name }
1645 if$
1646 *
1647 }
1648
1649 FUNCTION {format.name}
1650 { s nameptr "{vv~}{ll}{,~ff}{, jj}" format.name$
1651 get.str.lang
1652 duplicate$
1653 duplicate$ lang.zh = swap$ lang.ja = or
1654 { pop$
1655 s nameptr "{vv~}{ll}" format.name$
1656 s nameptr "{ff}{, jj}" format.name$
1657 duplicate$ get.str.lang
1658 duplicate$ lang.zh = swap$ lang.ja = or
1659 { * }
1660 { pop$ }
1661 if$
1662 }
1663 { lang.ru =
1664 { s nameptr "{vv~}{ll}" format.name$
1665 s nameptr "{ff}{, jj}" format.name$
1666 "." "" find.replace
1667 duplicate$ empty$
1668 'pop$
1669 { " " swap$ * * }
1670 if$
1671 }
1672 { format.latin.name }
1673 if$
1674 }
1675 if$
1676 }
1677
1678 FUNCTION {inter.word.space}
1679 { is.lang.cjk
1680 { "" }
1681 { " " }
1682 if$
1683 }
1684
1685 FUNCTION {format.names}
1686 { 's :=
1687 #1 'nameptr :=
1688 s num.names$ 'numnames :=
1689 numnames 'namesleft :=
1690 { namesleft #0 > }
1691 { format.name 't :=
1692 nameptr #1 >
1693 { numnames control.max.bib.names >
1694 nameptr control.min.bib.names > and
1695 { "others" 't :=
1696 #1 'namesleft :=
1697 }
1698 'skip$
1699 if$
1700 namesleft #1 >
1701 { add.comma t * }
1702 { t "l" change.case$ "others" =
1703 { nameptr #2 >
1704 { add.comma }
1705 { inter.word.space * }
1706 if$
1707 bbl.et.al *
1708 }
1709 { control.bib.final.and
1710 { is.lang.cjk not nameptr #2 > and
1711 { add.comma }
1712 { inter.word.space * }
1713 if$
1714 bbl.and * inter.word.space *
1715 }
1716 { add.comma }
1717 if$
1718 t *
1719 }
1720 if$
1721 }
1722 if$
1723 }
1724 't
1725 if$
1726 nameptr #1 + 'nameptr :=
1727 namesleft #1 - 'namesleft :=
1728 }
1729 while$
1730 format.punctuations
1731 }
1732
1733 FUNCTION {warn.empty.field}
1734 { control.warn.empty.field
1735 { "empty " swap$ * " in " * cite$ * warning$ }
1736 'pop$
1737 if$
1738 }
1739
1740 FUNCTION {format.anonymous}
1741 {
1742 ""
1743 }
1744
1745 FUNCTION {format.authors}
1746 { author empty$
1747 { "author" warn.empty.field
1748 format.anonymous
1749 }
1750 { author format.names }
1751 if$
1752 }
1753
1754 FUNCTION {format.editors}
1755 { editor empty$
1756 { "editor" warn.empty.field
1757 format.anonymous
1758 }
1759 { editor format.names }
1760 if$
1761 }
1762
1763 FUNCTION {format.authors.editors}
1764 { author empty$
1765 { editor empty$
1766 { "author and editor" warn.empty.field
1767 format.anonymous
1768 }
1769 { editor format.names }
1770 if$
1771 }
1772 { author format.names }
1773 if$
1774 }
1775
1776 FUNCTION {format.translators}
1777 { translator empty$
1778 { "" }
1779 { translator format.names
1780 add.comma bbl.translator *
1781 }
1782 if$
1783 }
1784
1785 FUNCTION {format.lab.name}
1786 { s nameptr "{vv~}{ll}{,~ff}{, jj}" format.name$
1787 get.str.lang
1788 duplicate$ lang.zh =
1789 swap$ lang.ja = or
1790 { s nameptr "{vv~}{ll}" format.name$
1791 s nameptr "{ff}{, jj}" format.name$
1792 duplicate$ get.str.lang
1793 duplicate$ lang.zh = swap$ lang.ja = or
1794 { * }
1795 'pop$
1796 if$
1797 }
1798 { s nameptr "{vv~}{ll}" format.name$ }
1799 if$
1800 }
1801
1802 FUNCTION {format.full.names}
1803 { 's :=
1804 #1 'nameptr :=
1805 s num.names$ 'numnames :=
1806 numnames 'namesleft :=
1807 { namesleft #0 > }
1808 { format.lab.name 't :=
1809 nameptr #1 >
1810 { namesleft #1 >
1811 { add.comma t * }
1812 { t "l" change.case$ "others" =
1813 { nameptr #2 >
1814 { add.comma }
1815 { inter.word.space * }
1816 if$
1817 cite.et.al *
1818 }
1819 { control.cite.final.and
1820 { is.lang.cjk not nameptr #2 > and
1821 { add.comma }
1822 { inter.word.space * }
1823 if$
1824 cite.and * inter.word.space *
1825 }
1826 { add.comma }
1827 if$
1828 t *
1829 }
1830 if$
1831 }
1832 if$
1833 }
1834 't
1835 if$
1836 nameptr #1 + 'nameptr :=
1837 namesleft #1 - 'namesleft :=
1838 }
1839 while$
1840 format.punctuations
1841 }
1842
1843 FUNCTION {author.editor.full}
1844 { author empty$
1845 { editor empty$
1846 { "" }
1847 { editor format.full.names }
1848 if$
1849 }
1850 { author format.full.names }
1851 if$
1852 }
1853
1854 FUNCTION {author.full}
1855 { author empty$
1856 { "" }
1857 { author format.full.names }
1858 if$
1859 }
1860
1861 FUNCTION {editor.full}
1862 { editor empty$
1863 { "" }
1864 { editor format.full.names }
1865 if$
1866 }
1867
1868 FUNCTION {holder.author.full}
1869 { holder empty$
1870 { author empty$
1871 { "" }
1872 { author format.full.names }
1873 if$
1874 }
1875 { holder format.full.names }
1876 if$
1877 }
1878
1879 FUNCTION {make.full.names}
1880 { type$ "book" =
1881 type$ "inbook" = booktitle empty$ not and
1882 or
1883 'author.editor.full
1884 { type$ "collection" =
1885 type$ "proceedings" =
1886 or
1887 'editor.full
1888 { type$ "patent" =
1889 'holder.author.full
1890 'author.full
1891 if$
1892 }
1893 if$
1894 }
1895 if$
1896 }
1897
1898 FUNCTION {output.bibitem}
1899 { newline$
1900 "\bibitem[" write$
1901 label ")" *
1902 make.full.names duplicate$ short.list =
1903 { pop$ }
1904 { duplicate$ "]" contains
1905 { "{" swap$ * "}" * }
1906 'skip$
1907 if$
1908 *
1909 }
1910 if$
1911 "]{" * write$
1912 cite$ write$
1913 "}" write$
1914 newline$
1915 ""
1916 before.all 'output.state :=
1917 }
1918
1919 FUNCTION {format.title.subtitle.titleaddon}
1920 { title empty$
1921 { "" }
1922 { title
1923 subtitle empty$
1924 'skip$
1925 { add.colon.by.language subtitle * }
1926 if$
1927 titleaddon empty$
1928 'skip$
1929 { add.colon.by.language titleaddon * }
1930 if$
1931 }
1932 if$
1933 }
1934
1935 FUNCTION {change.sentence.case}
1936 { entry.lang lang.en =
1937 'smart.sentence.case
1938 'skip$
1939 if$
1940 }
1941
1942 FUNCTION {add.link}
1943 { url empty$ not
1944 { "\href{" url * "}{" * swap$ * "}" * }
1945 { doi empty$ not
1946 { "\href{https://doi.org/" doi * "}{" * swap$ * "}" * }
1947 'skip$
1948 if$
1949 }
1950 if$
1951 }
1952
1953 FUNCTION {format.tr.number}
1954 { ""
1955 number empty$
1956 'skip$
1957 { type$ "patent" = control.patent.country and
1958 { country empty$ not
1959 { country * }
1960 { nationality empty$ not
1961 { nationality * }
1962 { address empty$ not
1963 { address * }
1964 { location empty$ not
1965 { location * }
1966 { "" }
1967 { entry.lang lang.zh =
1968 { "中国" * }
1969 'skip$
1970 if$
1971 }
1972 if$
1973 }
1974 if$
1975 }
1976 if$
1977 }
1978 if$
1979 }
1980 'skip$
1981 if$
1982 duplicate$ empty$
1983 'skip$
1984 'add.comma
1985 if$
1986 number
1987 duplicate$ get.str.lang lang.zh =
1988 'format.punctuations
1989 'skip$
1990 if$
1991 *
1992 }
1993 if$
1994 }
1995
1996 FUNCTION {entry.has.url.or.doi}
1997 { control.url require.url or entry.url empty$ not and
1998 doi empty$ not cstr empty$ not or
1999 control.doi control.url or require.url or and
2000 or
2001 }
2002
2003 FUNCTION {format.entry.type.id}
2004 { control.entry.type.id
2005 { entry.type.id
2006 control.entry.medium.id
2007 { entrymediumid empty$
2008 { medium empty$
2009 { entry.has.url.or.doi
2010 type$ "online" = or
2011 type$ "webpage" = or
2012 { "/OL" * }
2013 'skip$
2014 if$
2015 }
2016 { "The field 'medium' for entry medium ID is deprecated. Use 'entrymediumid' instead." warning$
2017 "/" * medium *
2018 }
2019 if$
2020 }
2021 { "/" * entrymediumid * }
2022 if$
2023 }
2024 'skip$
2025 if$
2026 make.brackets
2027 control.space.before.type.id
2028 { " " }
2029 { "\allowbreak" }
2030 if$
2031 swap$ *
2032 }
2033 { "" }
2034 if$
2035 }
2036
2037 FUNCTION {format.title}
2038 { title empty$
2039 { "" }
2040 { format.title.subtitle.titleaddon
2041 control.sentence.case.title
2042 'change.sentence.case
2043 'skip$
2044 if$
2045 format.punctuations
2046 control.link.title
2047 'add.link
2048 'skip$
2049 if$
2050 entry.numbered number empty$ not and
2051 { add.colon
2052 format.tr.number *
2053 }
2054 'skip$
2055 if$
2056 format.entry.type.id *
2057 }
2058 if$
2059 }
2060
2061 FUNCTION {tie.or.space.connect}
2062 { duplicate$ text.length$ #3 <
2063 { "~" }
2064 { " " }
2065 if$
2066 swap$ * *
2067 }
2068
2069 FUNCTION {either.or.check}
2070 { empty$
2071 'pop$
2072 { "can't use both " swap$ * " fields in " * cite$ * warning$ }
2073 if$
2074 }
2075
2076 FUNCTION {is.digit}
2077 { duplicate$ empty$
2078 { pop$ #0 }
2079 { chr.to.int$
2080 duplicate$ "0" chr.to.int$ <
2081 { pop$ #0 }
2082 { "9" chr.to.int$ >
2083 { #0 }
2084 { #1 }
2085 if$
2086 }
2087 if$
2088 }
2089 if$
2090 }
2091
2092 FUNCTION {is.number}
2093 { #1
2094 { #0 > }
2095 { duplicate$ #1 #1 substring$ chr.to.int$
2096 duplicate$ #47 >
2097 swap$ #58 <
2098 and
2099 { #2 global.max$ substring$
2100 duplicate$ empty$
2101 { #0 }
2102 { #1 }
2103 if$
2104 }
2105 { #0 }
2106 if$
2107 }
2108 while$
2109 empty$
2110 }
2111
2112 FUNCTION {format.bvolume}
2113 { volume empty$
2114 { "" }
2115 { volume is.number
2116 { entry.lang lang.zh =
2117 { "第" volume tie.or.space.connect " 卷" * }
2118 { entry.lang lang.ko =
2119 { "제" volume tie.or.space.connect " 권" * }
2120 { "v." volume * }
2121 if$
2122 }
2123 if$
2124 }
2125 { volume }
2126 if$
2127 }
2128 if$
2129 }
2130
2131 FUNCTION {format.maintitle}
2132 { maintitle empty$
2133 { "" }
2134 { mainsubtitle empty$
2135 'skip$
2136 { add.colon.by.language mainsubtitle * }
2137 if$
2138 maintitleaddon empty$
2139 'skip$
2140 { add.colon.by.language maintitleaddon * }
2141 if$
2142 }
2143 if$
2144 }
2145
2146 FUNCTION {format.maintitle.volume}
2147 { maintitle empty$
2148 { "" }
2149 { maintitle
2150 volume empty$
2151 'skip$
2152 { add.colon.by.language
2153 format.bvolume *
2154 }
2155 if$
2156 }
2157 if$
2158 }
2159
2160 FUNCTION {format.title.volume}
2161 { title empty$
2162 { "" }
2163 { format.title.subtitle.titleaddon
2164 volume empty$
2165 'skip$
2166 { add.colon.by.language
2167 format.bvolume *
2168 }
2169 if$
2170 }
2171 if$
2172 }
2173
2174 FUNCTION {format.series.volume}
2175 { series empty$
2176 { "" }
2177 { series
2178 volume empty$
2179 'skip$
2180 { add.colon.by.language
2181 format.bvolume *
2182 }
2183 if$
2184 }
2185 if$
2186 }
2187
2188 FUNCTION {format.btitle}
2189 { maintitle empty$
2190 { series empty$
2191 { format.title.volume }
2192 { volume empty$
2193 { format.title.volume }
2194 { format.series.volume
2195 entry.numbered
2196 'skip$
2197 { "volume and number" number either.or.check }
2198 if$
2199 bbl.wide.space *
2200 format.title.subtitle.titleaddon
2201 *
2202 }
2203 if$
2204 }
2205 if$
2206 }
2207 { volume empty$
2208 { format.maintitle
2209 add.colon.by.language
2210 format.title.subtitle.titleaddon *
2211 }
2212 { format.maintitle.volume
2213 bbl.wide.space *
2214 format.title.subtitle.titleaddon
2215 *
2216 }
2217 if$
2218 }
2219 if$
2220 duplicate$ empty$
2221 'skip$
2222 { control.sentence.case.title
2223 'change.sentence.case
2224 'skip$
2225 if$
2226 format.punctuations
2227 emphasize.book.title
2228 control.link.title
2229 'add.link
2230 'skip$
2231 if$
2232 entry.numbered number empty$ not and
2233 { add.colon format.tr.number * }
2234 'skip$
2235 if$
2236 type$ "map" =
2237 scale empty$ not and
2238 { add.period
2239 duplicate$ #-1 #1 substring$ "." =
2240 { " " * }
2241 'skip$
2242 if$
2243 scale *
2244 }
2245 'skip$
2246 if$
2247 format.entry.type.id *
2248 }
2249 if$
2250 }
2251
2252 FUNCTION {format.booktitle}
2253 { booktitle empty$
2254 { "" }
2255 { booktitle
2256 control.sentence.case.booktitle
2257 'change.sentence.case
2258 'skip$
2259 if$
2260 booksubtitle empty$
2261 'skip$
2262 { add.colon
2263 booksubtitle
2264 control.sentence.case.booktitle
2265 { "l" change.case$ }
2266 'skip$
2267 if$
2268 *
2269 }
2270 if$
2271 emphasize.book.title
2272 booktitleaddon empty$
2273 'skip$
2274 { add.colon
2275 booktitleaddon
2276 control.sentence.case.booktitle
2277 { "l" change.case$ }
2278 'skip$
2279 if$
2280 *
2281 }
2282 if$
2283 format.punctuations
2284 }
2285 if$
2286 }
2287
2288 FUNCTION {format.series.volume.booktitle}
2289 { series empty$
2290 { maintitle empty$
2291 { format.booktitle
2292 volume empty$
2293 'skip$
2294 { add.colon
2295 format.bvolume *
2296 }
2297 if$
2298 }
2299 { format.maintitle.volume
2300 bbl.wide.space *
2301 format.booktitle *
2302 }
2303 if$
2304 }
2305 { volume empty$
2306 { format.booktitle }
2307 { format.series.volume
2308 bbl.wide.space *
2309 format.booktitle *
2310 }
2311 if$
2312 }
2313 if$
2314 }
2315
2316 FUNCTION {format.in.ed.booktitle}
2317 { booktitle empty$
2318 { "" }
2319 { control.in
2320 { bbl.in add.colon }
2321 { "" }
2322 if$
2323 editor empty$
2324 'skip$
2325 { format.editors * output new.block "" }
2326 if$
2327 format.series.volume.booktitle *
2328 }
2329 if$
2330 }
2331
2332 FUNCTION {remove.dots}
2333 { 's :=
2334 ""
2335 { s empty$ not }
2336 { s #1 #1 substring$
2337 duplicate$ "." =
2338 'pop$
2339 { * }
2340 if$
2341 s #2 global.max$ substring$ 's :=
2342 }
2343 while$
2344 }
2345
2346 FUNCTION {format.journal.title}
2347 { journal empty$
2348 { journaltitle empty$
2349 { "" }
2350 { journaltitle }
2351 if$
2352 }
2353 { journal }
2354 if$
2355 journalsubtitle empty$
2356 'skip$
2357 { duplicate$ empty$
2358 'skip$
2359 'add.colon.by.language
2360 if$
2361 journalsubtitle *
2362 }
2363 if$
2364 journaltitleaddon empty$
2365 'skip$
2366 { duplicate$ empty$
2367 'skip$
2368 'add.colon.by.language
2369 if$
2370 journaltitleaddon *
2371 }
2372 if$
2373 control.sentence.case.journal
2374 'change.sentence.case
2375 'skip$
2376 if$
2377 }
2378
2379 FUNCTION {format.short.journal}
2380 { shortjournal empty$
2381 { format.journal.title
2382 duplicate$ field.or.null " " contains % The journal title is not a single word
2383 is.lang.cjk not and
2384 { "shortjournal" warn.empty.field }
2385 'skip$
2386 if$
2387 }
2388 { shortjournal
2389 control.journal.dots
2390 'skip$
2391 'remove.dots
2392 if$
2393 }
2394 if$
2395 }
2396
2397 FUNCTION {get.journal.title}
2398 { control.short.journal
2399 'format.short.journal
2400 { format.journal.title
2401 duplicate$ empty$
2402 { shortjournal empty$
2403 { "journal" warn.empty.field }
2404 { pop$ format.short.journal }
2405 if$
2406 }
2407 { shortjournal empty$ control.journal.dots not and
2408 'remove.dots
2409 { duplicate$ shortjournal = control.journal.dots not and
2410 'remove.dots
2411 'skip$
2412 if$
2413 }
2414 if$
2415 }
2416 if$
2417 }
2418 if$
2419 }
2420
2421 FUNCTION {check.arxiv.preprint}
2422 { "l" change.case$
2423 duplicate$ #1 #5 substring$ "arxiv" =
2424 { 'x :=
2425 "arxiv:" 'y :=
2426 y text.length$ 'len :=
2427 x text.length$ len - #1 + 'charptr :=
2428 { charptr #0 >
2429 x charptr len substring$ y = not
2430 and
2431 }
2432 { charptr #1 - 'charptr := }
2433 while$
2434 charptr #0 >
2435 { x charptr #6 + global.max$ substring$ 'x :=
2436 x string.length #1 + 'len :=
2437 #1 'charptr :=
2438 { charptr len <
2439 x charptr #1 substring$ " " = not and
2440 x charptr #1 substring$ "[" = not and
2441 }
2442 { charptr #1 + 'charptr := }
2443 while$
2444 x #1 charptr substring$
2445 duplicate$ empty$
2446 'pop$
2447 { "\url{https://arxiv.org/abs/" swap$ * "}" * 'entry.url := }
2448 if$
2449 }
2450 'skip$
2451 if$
2452 #1
2453 }
2454 { pop$ #0 }
2455 if$
2456 }
2457
2458 FUNCTION {format.journal}
2459 { get.journal.title
2460 duplicate$ empty$
2461 'skip$
2462 { format.punctuations
2463 control.emph.journal is.lang.cjk not and
2464 'emphasize
2465 'skip$
2466 if$
2467 }
2468 if$
2469 }
2470
2471 FUNCTION {set.entry.type.id}
2472 { entry.type.id empty$
2473 { entrytypeid empty$
2474 { entrysubtype empty$
2475 { mark empty$
2476 { 'entry.type.id := }
2477 { pop$
2478 "The field 'mark' for entry type ID is deprecated. Use 'entrytypeid' instead." warning$
2479 mark 'entry.type.id :=
2480 }
2481 if$
2482 }
2483 { entrysubtype "newspaper" =
2484 { pop$ "N" 'entry.type.id := }
2485 { entrysubtype "inproceedings" =
2486 { pop$ "C" 'entry.type.id := }
2487 { entrysubtype "report" =
2488 { pop$ "R" 'entry.type.id := }
2489 { entrysubtype "techreport" =
2490 { pop$ "R" 'entry.type.id := }
2491 { entrysubtype "standard" =
2492 { pop$ "S" 'entry.type.id := }
2493 { entrysubtype "patent" =
2494 { pop$ "P" 'entry.type.id := }
2495 { entrysubtype "dataset" =
2496 { pop$ "DS" 'entry.type.id := }
2497 { 'entry.type.id := }
2498 if$
2499 }
2500 if$
2501 }
2502 if$
2503 }
2504 if$
2505 }
2506 if$
2507 }
2508 if$
2509 }
2510 if$
2511 }
2512 if$
2513 }
2514 { pop$ entrytypeid 'entry.type.id := }
2515 if$
2516 }
2517 'pop$
2518 if$
2519 }
2520
2521 FUNCTION {num.to.ordinal}
2522 { is.lang.cjk
2523 'skip$
2524 { duplicate$ #-2 #1 substring$ "1" =
2525 { "th" * }
2526 { duplicate$ #-1 #1 substring$ "1" =
2527 { "st" * }
2528 { duplicate$ #-1 #1 substring$ "2" =
2529 { "nd" * }
2530 { duplicate$ #-1 #1 substring$ "3" =
2531 { "rd" * }
2532 { "th" * }
2533 if$
2534 }
2535 if$
2536 }
2537 if$
2538 }
2539 if$
2540 }
2541 if$
2542 }
2543
2544 FUNCTION {extract.num}
2545 { duplicate$ 't :=
2546 "" 's :=
2547 { t empty$ not }
2548 { t #1 #1 substring$
2549 t #2 global.max$ substring$ 't :=
2550 duplicate$ is.digit
2551 { s swap$ * 's := }
2552 { pop$ "" 't := }
2553 if$
2554 }
2555 while$
2556 s empty$
2557 'skip$
2558 { pop$ s }
2559 if$
2560 }
2561
2562 FUNCTION {word.to.num}
2563 { duplicate$ "l" change.case$ 's :=
2564 s "first" =
2565 { pop$ "1" }
2566 'skip$
2567 if$
2568 s "second" =
2569 { pop$ "2" }
2570 'skip$
2571 if$
2572 s "third" =
2573 { pop$ "3" }
2574 'skip$
2575 if$
2576 s "fourth" =
2577 { pop$ "4" }
2578 'skip$
2579 if$
2580 s "fifth" =
2581 { pop$ "5" }
2582 'skip$
2583 if$
2584 s "sixth" =
2585 { pop$ "6" }
2586 'skip$
2587 if$
2588 s "seventh" =
2589 { pop$ "7" }
2590 'skip$
2591 if$
2592 s "eighth" =
2593 { pop$ "8" }
2594 'skip$
2595 if$
2596 s "ninth" =
2597 { pop$ "9" }
2598 'skip$
2599 if$
2600 s "tenth" =
2601 { pop$ "10" }
2602 'skip$
2603 if$
2604 s "revised edition" =
2605 { pop$ "Rev. ed." }
2606 'skip$
2607 if$
2608 s "revised ed." =
2609 { pop$ "Rev. ed." }
2610 'skip$
2611 if$
2612 s "revised" =
2613 { pop$ "Rev. ed." }
2614 'skip$
2615 if$
2616 s "rev." =
2617 { pop$ "Rev. ed." }
2618 'skip$
2619 if$
2620 s "修订版" =
2621 { pop$ "修订版" }
2622 'skip$
2623 if$
2624 s "修订" =
2625 { pop$ "修订版" }
2626 'skip$
2627 if$
2628 }
2629
2630 FUNCTION {format.edition}
2631 { edition empty$
2632 { "" }
2633 { edition
2634 duplicate$ #1 #1 substring$ is.digit
2635 'extract.num
2636 'word.to.num
2637 if$
2638 duplicate$ "1" =
2639 { pop$ "" }
2640 { duplicate$ #1 #1 substring$ is.digit
2641 { num.to.ordinal
2642 " " * bbl.edition *
2643 }
2644 'skip$
2645 if$
2646 }
2647 if$
2648 }
2649 if$
2650 }
2651
2652 FUNCTION {format.version}
2653 { version empty$
2654 { "" }
2655 { version #1 #1 substring$
2656 duplicate$ "V" =
2657 { pop$ version }
2658 { "v" =
2659 { "V" version #2 global.max$ substring$ * }
2660 { "V" version * }
2661 if$
2662 }
2663 if$
2664 }
2665 if$
2666 }
2667
2668 FUNCTION {format.publisher}
2669 { publisher empty$
2670 { institution empty$
2671 { school empty$
2672 { "" }
2673 { school }
2674 if$
2675 }
2676 { institution }
2677 if$
2678 }
2679 { publisher }
2680 if$
2681 format.punctuations
2682 }
2683
2684 FUNCTION {format.address.publisher}
2685 { address empty$
2686 { location empty$
2687 { "" }
2688 { location }
2689 if$
2690 }
2691 { address }
2692 if$
2693 format.punctuations
2694 duplicate$ empty$ not
2695 { format.publisher empty$ not
2696 { add.colon format.publisher * }
2697 { entry.has.url.or.doi not control.unknown.publisher and
2698 { add.colon bbl.sine.nomine make.brackets * }
2699 'skip$
2700 if$
2701 }
2702 if$
2703 }
2704 { pop$
2705 entry.has.url.or.doi not control.unknown.publisher and
2706 { format.publisher empty$ not
2707 { bbl.sine.loco make.brackets add.colon format.publisher * }
2708 { bbl.sine.loco.sine.nomine make.brackets }
2709 if$
2710 }
2711 { format.publisher empty$ not
2712 { format.publisher }
2713 { "" }
2714 if$
2715 }
2716 if$
2717 }
2718 if$
2719 }
2720
2721 FUNCTION {format.eventtitle}
2722 { eventtitle empty$
2723 { "" }
2724 { eventtitle format.punctuations }
2725 if$
2726 }
2727
2728 FUNCTION {normalize.year.dash}
2729 {
2730 "---" "-" find.replace
2731 "--" "-" find.replace
2732 "–" "-" find.replace
2733 "—" "-" find.replace
2734 }
2735
2736 FUNCTION {format.date}
2737 { year empty$
2738 { date empty$
2739 { entry.has.url.or.doi
2740 { "" }
2741 { "year" warn.empty.field
2742 urldate empty$
2743 { "" }
2744 { urldate "-" extract.before extra.label * make.brackets }
2745 if$
2746 }
2747 if$
2748 }
2749 { date "/" extract.before "-" extract.before
2750 date "/" contains
2751 { "-" normalize.year.dash *
2752 date "/" extract.after "-" extract.before *
2753 }
2754 'skip$
2755 if$
2756 extra.label *
2757 }
2758 if$
2759 }
2760 { year normalize.year.dash
2761 extra.label *
2762 }
2763 if$
2764 }
2765
2766 FUNCTION {format.full.date}
2767 { date empty$
2768 { year }
2769 { control.year.before.title
2770 { date }
2771 { date #1 #4 substring$
2772 extra.label *
2773 date #5 global.max$ substring$ *
2774 }
2775 if$
2776 }
2777 if$
2778 }
2779
2780 FUNCTION {format.lab.date}
2781 { year empty$
2782 { date empty$
2783 { urldate empty$
2784 { bbl.no.date
2785 extra.label empty$
2786 'skip$
2787 { "-" * extra.label *}
2788 if$
2789 }
2790 { urldate "-" extract.before extra.label * make.brackets }
2791 if$
2792 }
2793 { date "/" extract.before "-" extract.before
2794 date "/" contains
2795 { "-" normalize.year.dash *
2796 date "/" extract.after "-" extract.before *
2797 }
2798 'skip$
2799 if$
2800 extra.label *
2801 }
2802 if$
2803 }
2804 { year normalize.year.dash extra.label * }
2805 if$
2806 }
2807
2808 FUNCTION {format.creation.modification.date}
2809 { date empty$
2810 {
2811 ""
2812 }
2813 { date }
2814 if$
2815 duplicate$ empty$
2816 'skip$
2817 { make.parentheses
2818 "\allowbreak " swap$ *
2819 }
2820 if$
2821 }
2822
2823 FUNCTION {format.urldate}
2824 {
2825 entry.has.url.or.doi
2826 control.urldate urldate empty$ not and and
2827 { "\allowbreak" urldate make.brackets * }
2828 { "" }
2829 if$
2830 }
2831
2832 FUNCTION {normalize.page.range}
2833 { "" swap$
2834 { duplicate$ empty$ not }
2835 { #1 skip.inter.token.chars.by 't :=
2836 empty$
2837 { "" }
2838 'control.page.range.delim
2839 if$
2840 * t
2841 #1 tokenize.by 't :=
2842 * t
2843 }
2844 while$
2845 pop$
2846 }
2847
2848 FUNCTION {format.pages}
2849 { pages empty$
2850 { "" }
2851 { pages
2852 control.page.ranges
2853 'normalize.page.range
2854 { #1 tokenize.by pop$ }
2855 if$
2856 }
2857 if$
2858 }
2859
2860 FUNCTION {format.dimensions}
2861 { dimensions empty$
2862 { "" }
2863 { dimensions
2864 "x" "$\times$" find.replace
2865 "×" "$\times$" find.replace
2866 }
2867 if$
2868 }
2869
2870 FUNCTION {format.journal.volume}
2871 { volume empty$
2872 { "" }
2873 { control.bold.volume
2874 { "\textbf{" volume * "}" * }
2875 { volume }
2876 if$
2877 }
2878 if$
2879 }
2880
2881 FUNCTION {format.journal.number}
2882 { number empty$
2883 { "" }
2884 { "\allowbreak " number make.parentheses * }
2885 if$
2886 }
2887
2888 FUNCTION {format.journal.pages}
2889 { pages empty$
2890 { eid empty$
2891 { "" }
2892 { eid }
2893 if$
2894 }
2895 { format.pages }
2896 if$
2897 }
2898
2899 FUNCTION {format.newspaper.pages}
2900 { pages empty$
2901 { "" }
2902 { "\allowbreak " format.pages make.parentheses * }
2903 if$
2904 }
2905
2906 FUNCTION {check.electronic}
2907 { entry.url empty$
2908 { url empty$
2909 { howpublished field.or.null #1 #5 substring$ "\url{" =
2910 { howpublished 'entry.url := }
2911 { note field.or.null #1 #5 substring$ "\url{" =
2912 { note "}" extract.before "}" * 'entry.url := }
2913 'skip$
2914 if$
2915 }
2916 if$
2917 }
2918 { "\url{" url * "}" * 'entry.url := }
2919 if$
2920 }
2921 'skip$
2922 if$
2923 }
2924
2925 FUNCTION {format.url}
2926 { control.url require.url or
2927 { entry.url empty$
2928 { control.doi not require.url or
2929 { cstr empty$
2930 { doi empty$
2931 'skip$
2932 { "\url{https://doi.org/" doi * "}" * 'entry.url := }
2933 if$
2934 }
2935 { "\url{https://cstr.cn/" cstr * "}" * 'entry.url := }
2936 if$
2937 }
2938 'skip$
2939 if$
2940 }
2941 'skip$
2942 if$
2943 entry.url empty$
2944 { "" }
2945 { new.block
2946 entry.url
2947 }
2948 if$
2949 }
2950 { "" }
2951 if$
2952 }
2953
2954 FUNCTION {either.or}
2955 { swap$
2956 duplicate$ empty$
2957 { pop$
2958 duplicate$ empty$
2959 { pop$ "" }
2960 'skip$
2961 if$
2962 }
2963 { swap$ pop$ }
2964 if$
2965 }
2966
2967 FUNCTION {format.doi}
2968 { control.doi
2969 { control.cstr not cstr empty$ or
2970 { doi empty$
2971 { "" }
2972 { control.url require.url or
2973 entry.url doi contains and
2974 { "" }
2975 { new.block "DOI:\doi{" doi * "}" * }
2976 if$
2977 }
2978 if$
2979 }
2980 { control.url require.url or
2981 entry.url cstr contains and
2982 { "" }
2983 { new.block "CSTR:\cstr{" cstr * "}" * }
2984 if$
2985 }
2986 if$
2987 }
2988 { "" }
2989 if$
2990 }
2991
2992 FUNCTION {format.eprint}
2993 { archiveprefix eprinttype either.or
2994 duplicate$ empty$
2995 { pop$
2996 journal journaltitle either.or shortjournal either.or
2997 "l" change.case$ #1 #5 substring$ "arxiv" =
2998 { "arXiv" }
2999 { "" }
3000 if$
3001 }
3002 { duplicate$ "arxiv" =
3003 { pop$ "arXiv" }
3004 { duplicate$ "pubmed" =
3005 { pop$ "PubMed" }
3006 'skip$
3007 if$
3008 }
3009 if$
3010 }
3011 if$
3012 entry.url empty$
3013 { duplicate$ "l" change.case$ "arxiv" = entry.eprint empty$ not and
3014 { "\url{https://arxiv.org/abs/" entry.eprint * "}" * 'entry.url := }
3015 'skip$
3016 if$
3017 }
3018 'skip$
3019 if$
3020 control.eprint eprint empty$ not and
3021 { duplicate$ empty$
3022 'skip$
3023 { ":" * }
3024 if$
3025 eprint *
3026 }
3027 'skip$
3028 if$
3029 }
3030
3031 FUNCTION {format.note}
3032 { note empty$ not control.note and
3033 { note }
3034 { "" }
3035 if$
3036 }
3037
3038 FUNCTION {empty.misc.check}
3039 { author empty$ title empty$
3040 year empty$
3041 and and
3042 key empty$ not and
3043 { "all relevant fields are empty in " cite$ * warning$ }
3044 'skip$
3045 if$
3046 }
3047
3048 FUNCTION {link.open}
3049 { control.link.journal
3050 { url empty$
3051 { doi empty$
3052 { "" }
3053 { "\href{https://doi.org/" doi * "}{" * }
3054 if$
3055 }
3056 { "\href{" url * "}{" * }
3057 if$
3058 duplicate$ empty$
3059 { pop$ }
3060 { "" set.punct
3061 output
3062 before.all 'output.state :=
3063 }
3064 if$
3065 }
3066 'skip$
3067 if$
3068 }
3069
3070 FUNCTION {link.close}
3071 { control.link.journal
3072 { url empty$ doi empty$ and
3073 'skip$
3074 { "" set.punct
3075 "}" output
3076 before.all 'output.state :=
3077 }
3078 if$
3079 }
3080 'skip$
3081 if$
3082 }
3083
3084 FUNCTION {article.journal}
3085 { "J" set.entry.type.id
3086 volume empty$ number empty$ and entry.url empty$ not and
3087 date field.or.null text.length$ #9 > and
3088 entry.type.id "J" = and
3089 { #1 'require.url := }
3090 'skip$
3091 if$
3092 output.bibitem
3093 format.authors output
3094 control.article.title
3095 { new.block
3096 format.title "title" output.check
3097 }
3098 'skip$
3099 if$
3100 new.block
3101 format.translators output
3102 new.block
3103 link.open
3104 format.journal "journal" output.check
3105 entry.type.id "N" =
3106 { format.full.date "date" output.check
3107 "" set.punct
3108 format.newspaper.pages output
3109 }
3110 {
3111 format.date output
3112 format.journal.volume output
3113 "" set.punct
3114 format.journal.number output
3115 bbl.pages.colon set.punct
3116 format.journal.pages output
3117 }
3118 if$
3119 link.close
3120 "" set.punct
3121 format.urldate output
3122 format.url output
3123 format.doi output
3124 new.block
3125 format.note output
3126 fin.entry
3127 }
3128
3129 FUNCTION {archive}
3130 { "A" set.entry.type.id
3131 output.bibitem
3132 format.authors output
3133 new.block
3134 format.btitle "title" output.check
3135 % new.block
3136 % format.translators output
3137 new.block
3138 format.address.publisher output
3139 format.date output
3140 bbl.pages.colon set.punct
3141 format.pages output
3142 "" set.punct
3143 format.creation.modification.date output
3144 "" set.punct
3145 format.urldate output
3146 format.url output
3147 format.doi output
3148 new.block
3149 format.note output
3150 fin.entry
3151 }
3152
3153 FUNCTION {book}
3154 { "M" set.entry.type.id
3155 output.bibitem
3156 format.authors.editors output
3157 new.block
3158 format.btitle "title" output.check
3159 new.block
3160 format.translators output
3161 new.sentence
3162 format.edition output
3163 new.block
3164 format.address.publisher output
3165 format.date output
3166 bbl.pages.colon set.punct
3167 format.pages output
3168 "" set.punct
3169 format.urldate output
3170 format.url output
3171 format.doi output
3172 new.block
3173 format.note output
3174 fin.entry
3175 }
3176
3177 FUNCTION {letter} { archive }
3178
3179 FUNCTION {dataset}
3180 { "DS" set.entry.type.id
3181 output.bibitem
3182 format.authors output
3183 new.block
3184 format.btitle "title" output.check
3185 new.block
3186 format.version output
3187 new.block
3188 publisher "publisher" output.check
3189 "" set.punct
3190 format.creation.modification.date output
3191 "" set.punct
3192 format.urldate output
3193 format.url output
3194 format.doi output
3195 new.block
3196 format.note output
3197 fin.entry
3198 }
3199
3200 FUNCTION {database}
3201 { "DB" set.entry.type.id
3202 dataset
3203 }
3204
3205 FUNCTION {inbook}
3206 { "M" set.entry.type.id
3207 booktitle empty$
3208 'book
3209 { output.bibitem
3210 format.authors output
3211 control.article.title
3212 { new.block
3213 format.title "title" output.check
3214 }
3215 'skip$
3216 if$
3217 new.block
3218 format.translators output
3219 new.slash
3220 booktitle empty$
3221 { "" }
3222 { control.in
3223 { bbl.in add.colon }
3224 { "" }
3225 if$
3226 bookauthor empty$
3227 { editor empty$
3228 'skip$
3229 { format.editors * output new.block "" }
3230 if$
3231 }
3232 { bookauthor format.names * output new.block "" }
3233 if$
3234 format.series.volume.booktitle *
3235 }
3236 if$
3237 "booktitle" output.check
3238 new.block
3239 format.edition output
3240 new.block
3241 format.address.publisher output
3242 format.date output
3243 bbl.pages.colon set.punct
3244 format.pages output
3245 "" set.punct
3246 format.urldate output
3247 format.url output
3248 format.doi output
3249 new.block
3250 format.note output
3251 fin.entry
3252 }
3253 if$
3254 }
3255
3256 FUNCTION {incollection}
3257 { "M" set.entry.type.id
3258 output.bibitem
3259 format.authors output
3260 control.article.title
3261 { new.block
3262 format.title "title" output.check
3263 }
3264 'skip$
3265 if$
3266 new.block
3267 format.translators output
3268 new.slash
3269 format.in.ed.booktitle "booktitle" output.check
3270 new.block
3271 format.edition output
3272 new.block
3273 format.address.publisher output
3274 format.date output
3275 bbl.pages.colon set.punct
3276 format.pages output
3277 "" set.punct
3278 format.urldate output
3279 format.url output
3280 format.doi output
3281 new.block
3282 format.note output
3283 fin.entry
3284 }
3285
3286 FUNCTION {inproceedings}
3287 { "C" set.entry.type.id
3288 output.bibitem
3289 format.authors output
3290 control.article.title
3291 { new.block
3292 format.title "title" output.check
3293 }
3294 'skip$
3295 if$
3296 new.slash
3297 booktitle empty$
3298 { format.eventtitle "eventtitle" output.check }
3299 { format.in.ed.booktitle "booktitle" output.check
3300 new.block
3301 format.edition output
3302 new.block
3303 format.address.publisher output
3304 }
3305 if$
3306 format.date output
3307 bbl.pages.colon set.punct
3308 format.pages output
3309 "" set.punct
3310 format.urldate output
3311 format.url output
3312 format.doi output
3313 new.block
3314 format.note output
3315 fin.entry
3316 }
3317
3318 FUNCTION {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 "" set.punct
3336 format.urldate 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 "" set.punct
3366 format.urldate output
3367 format.url output
3368 format.doi output
3369 new.block
3370 format.note output
3371 fin.entry
3372 }
3373
3374 FUNCTION {proceedings}
3375 { "C" set.entry.type.id
3376 output.bibitem
3377 format.editors output
3378 new.block
3379 format.btitle "title" output.check
3380 new.block
3381 format.translators output
3382 new.sentence
3383 format.edition output
3384 new.block
3385 format.address.publisher output
3386 format.date output
3387 bbl.pages.colon set.punct
3388 format.pages output
3389 "" set.punct
3390 format.urldate output
3391 format.url output
3392 format.doi output
3393 new.block
3394 format.note output
3395 fin.entry
3396 }
3397
3398 FUNCTION {preprint}
3399 { #1 'require.url :=
3400 "A" set.entry.type.id
3401 output.bibitem
3402 format.authors output
3403 control.article.title
3404 { new.block
3405 format.title "title" output.check
3406 }
3407 'skip$
3408 if$
3409 new.block
3410 format.version output
3411 new.block
3412 format.eprint output
3413 "" set.punct
3414 format.creation.modification.date output
3415 "" set.punct
3416 format.urldate "urldate" output.check
3417 format.url "url" output.check
3418 format.doi output
3419 new.block
3420 format.note output
3421 fin.entry
3422 }
3423
3424 FUNCTION {thesis}
3425 { "D" set.entry.type.id
3426 output.bibitem
3427 format.authors output
3428 new.block
3429 format.btitle "title" output.check
3430 new.block
3431 format.address.publisher output
3432 format.date output
3433 bbl.pages.colon set.punct
3434 format.pages output
3435 "" set.punct
3436 format.urldate output
3437 format.url output
3438 format.doi output
3439 new.block
3440 format.note output
3441 fin.entry
3442 }
3443
3444 FUNCTION {phdthesis} { thesis }
3445
3446 FUNCTION {mastersthesis} { thesis }
3447
3448 FUNCTION {techreport}
3449 { "R" set.entry.type.id
3450 output.bibitem
3451 format.authors output
3452 new.block
3453 format.btitle "title" output.check
3454 % new.block
3455 % format.translators output
3456 new.block
3457 institution empty$
3458 pages empty$ and
3459 control.url and
3460 entry.url empty$ not and
3461 'skip$
3462 { format.address.publisher output
3463 format.date output
3464 bbl.pages.colon set.punct
3465 format.pages output
3466 }
3467 if$
3468 "" set.punct
3469 format.creation.modification.date output
3470 "" set.punct
3471 format.urldate output
3472 format.url output
3473 format.doi output
3474 new.block
3475 format.note output
3476 fin.entry
3477 }
3478
3479 FUNCTION {report} { techreport }
3480
3481 FUNCTION {manual} { techreport }
3482
3483 FUNCTION {webpage}
3484 { #1 'require.url :=
3485 output.bibitem
3486 format.authors output
3487 new.block
3488 "EB" set.entry.type.id
3489 format.btitle "title" output.check
3490 new.block
3491 publisher empty$
3492 'skip$
3493 { format.address.publisher output
3494 format.date output
3495 bbl.pages.colon set.punct
3496 format.pages output
3497 "" set.punct
3498 }
3499 if$
3500 format.creation.modification.date output
3501 "" set.punct
3502 format.urldate "urldate" output.check
3503 format.url "url" output.check
3504 format.doi output
3505 new.block
3506 format.note output
3507 fin.entry
3508 }
3509
3510 FUNCTION {misc}
3511 { eprint empty$ not archiveprefix empty$ not or eprinttype empty$ not or
3512 'preprint
3513 { entry.url empty$
3514 {
3515 "Z" set.entry.type.id
3516 book
3517 }
3518 'webpage
3519 if$
3520 }
3521 if$
3522 empty.misc.check
3523 }
3524
3525 FUNCTION {article}
3526 { entrysubtype field.or.null "l" change.case$ "newspaper" =
3527 { "N" set.entry.type.id
3528 article.journal
3529 }
3530 { journal journaltitle either.or shortjournal either.or
3531 duplicate$ empty$
3532 { pop$
3533 archiveprefix eprinttype either.or eprint either.or empty$
3534 'article.journal
3535 'preprint
3536 if$
3537 }
3538 { check.arxiv.preprint
3539 'preprint
3540 'article.journal
3541 if$
3542 }
3543 if$
3544 }
3545 if$
3546 }
3547
3548 FUNCTION {booklet} { book }
3549
3550 FUNCTION {collection}
3551 { "G" set.entry.type.id
3552 book
3553 }
3554
3555 FUNCTION {image} { misc }
3556
3557 FUNCTION {legislation} { archive }
3558
3559 FUNCTION {map}
3560 { "CM" set.entry.type.id
3561 booktitle empty$ not
3562 { incollection }
3563 { output.bibitem
3564 format.authors output
3565 new.block
3566 format.btitle "title" output.check
3567 new.block
3568 format.edition output
3569 new.block
3570 format.address.publisher output
3571 format.date output
3572 bbl.pages.colon set.punct
3573 format.pages output
3574 "" set.punct
3575 format.creation.modification.date output
3576 "" set.punct
3577 format.urldate output
3578 format.url output
3579 format.doi output
3580 new.block
3581 format.note output
3582 fin.entry
3583 }
3584 if$
3585 }
3586
3587 FUNCTION {newspaper}
3588 { "N" set.entry.type.id
3589 article.journal
3590 }
3591
3592 FUNCTION {online}
3593 { eprint empty$
3594 archiveprefix empty$ and
3595 eprinttype empty$ and
3596 { webpage }
3597 { preprint }
3598 if$
3599 }
3600
3601 FUNCTION {software}
3602 { "CP" set.entry.type.id
3603 webpage
3604 }
3605
3606 FUNCTION {standard}
3607 { "S" set.entry.type.id
3608 booktitle empty$
3609 'book
3610 'incollection
3611 if$
3612 }
3613
3614 FUNCTION {unpublished} { misc }
3615
3616 FUNCTION {video} { misc }
3617
3618 FUNCTION {default.type} { misc }
3619
3620 FUNCTION {mult}
3621 { 'a := %% we store the first value
3622 'b := %% we store the second value
3623
3624 b #0 < %% We remember the sign of b, and
3625 {#-1 #0 b - 'b :=} %% then consider its absolute value.
3626 {#1} %%
3627 if$ %%
3628
3629 #0 %% Put 0 on the stack.
3630 {b #0 >} %% While b is strictly positive,
3631 { %% we add a to the value on the stack
3632 a + %% and decrement b.
3633 b #1 - 'b := %%
3634 } %%
3635 while$ %%
3636
3637 swap$ %% Last, we take the opposite
3638 'skip$ %% if b was negative.
3639 {#0 swap$ -} %%
3640 if$ %%
3641 }
3642
3643 FUNCTION {chr.to.value} %% The ASCII code of a character
3644 { chr.to.int$ #48 - %% ASCII value of "0" -> 48
3645 duplicate$ duplicate$ %% "1" -> 49
3646 #0 < swap$ #9 > or %% ...
3647 { %% "9" -> 57
3648 #48 + int.to.chr$
3649 " is not a number..." *
3650 warning$ %% Return 0 if it is not a number
3651 pop$ #0 %%
3652 }
3653 {}
3654 if$
3655 }
3656
3657 FUNCTION {str.to.int.aux} %% The auxiliary function
3658 { { duplicate$ empty$ not } %% While the string is not empty
3659 { %% consider its first char
3660 swap$ #10 mult 'a := %% and ``add'' it at the end of
3661 duplicate$ #1 #1 substring$ %% the result.
3662 chr.to.value a +
3663 swap$
3664 #2 global.max$ substring$
3665 }
3666 while$
3667 pop$
3668 }
3669
3670 FUNCTION {str.to.int}
3671 { %% Handling negative values
3672 duplicate$ #1 #1 substring$ "-" =
3673 {#1 swap$ #2 global.max$ substring$}
3674 {#0 swap$}
3675 if$
3676 %% Initialization, and then
3677 #0 swap$ str.to.int.aux %% call to the aux. function
3678 swap$
3679 {#0 swap$ -} %% And handle the sign.
3680 {}
3681 if$
3682 }
3683
3684 FUNCTION {boolean.to.int}
3685 { "l" change.case$ duplicate$
3686 "true" =
3687 { pop$ #1 }
3688 { duplicate$ "false" =
3689 { pop$ #0 }
3690 { "unknown boolean " quote$ * swap$ * quote$ *
3691 " in " * cite$ * warning$
3692 #0
3693 }
3694 if$
3695 }
3696 if$
3697 }
3698
3699 FUNCTION {GBT7714BSTCTL}
3700 { CTL_bib_punct empty$
3701 'skip$
3702 { CTL_bib_punct 'control.bib.punct := }
3703 if$
3704 CTL_convert_punct empty$
3705 'skip$
3706 { CTL_convert_punct boolean.to.int 'control.convert.punct := }
3707 if$
3708 CTL_max_bib_names empty$
3709 'skip$
3710 { CTL_max_bib_names str.to.int 'control.max.bib.names := }
3711 if$
3712 CTL_min_bib_names empty$
3713 'skip$
3714 { CTL_min_bib_names str.to.int 'control.min.bib.names := }
3715 if$
3716 CTL_max_cite_names empty$
3717 'skip$
3718 { CTL_max_cite_names str.to.int 'control.max.cite.names := }
3719 if$
3720 CTL_min_cite_names empty$
3721 'skip$
3722 { CTL_min_cite_names str.to.int 'control.min.cite.names := }
3723 if$
3724 CTL_uppercase_family empty$
3725 'skip$
3726 { CTL_uppercase_family boolean.to.int 'control.uppercase.family := }
3727 if$
3728 CTL_initialize_with_hyphen empty$
3729 'skip$
3730 { CTL_initialize_with_hyphen boolean.to.int 'control.initialize.with.hyphen := }
3731 if$
3732 CTL_check_pinyin empty$
3733 'skip$
3734 { CTL_check_pinyin boolean.to.int 'control.check.pinyin := }
3735 if$
3736 CTL_initialize_pinyin empty$
3737 'skip$
3738 { CTL_initialize_pinyin boolean.to.int 'control.initialize.pinyin := }
3739 if$
3740 CTL_bib_final_and empty$
3741 'skip$
3742 { CTL_bib_final_and boolean.to.int 'control.bib.final.and := }
3743 if$
3744 CTL_cite_final_and empty$
3745 'skip$
3746 { CTL_cite_final_and boolean.to.int 'control.cite.final.and := }
3747 if$
3748 CTL_cite_lang empty$
3749 'skip$
3750 { CTL_cite_lang 'control.cite.lang := }
3751 if$
3752 CTL_space_before_et_al empty$
3753 'skip$
3754 { CTL_space_before_et_al boolean.to.int 'control.space.before.et.al := }
3755 if$
3756 CTL_year_before_title empty$
3757 'skip$
3758 { CTL_year_before_title boolean.to.int 'control.year.before.title := }
3759 if$
3760 CTL_name_year_delim empty$
3761 'skip$
3762 { CTL_name_year_delim 'control.name.year.delim := }
3763 if$
3764 CTL_sentence_case empty$
3765 'skip$
3766 { CTL_sentence_case boolean.to.int 'control.sentence.case.title :=
3767 CTL_sentence_case boolean.to.int 'control.sentence.case.booktitle :=
3768 CTL_sentence_case boolean.to.int 'control.sentence.case.journal :=
3769 }
3770 if$
3771 CTL_sentence_case_title empty$
3772 'skip$
3773 { CTL_sentence_case_title boolean.to.int 'control.sentence.case.title := }
3774 if$
3775 CTL_sentence_case_booktitle empty$
3776 'skip$
3777 { CTL_sentence_case_booktitle boolean.to.int 'control.sentence.case.booktitle := }
3778 if$
3779 CTL_sentence_case_journal empty$
3780 'skip$
3781 { CTL_sentence_case_journal boolean.to.int 'control.sentence.case.journal := }
3782 if$
3783 CTL_capitalize_subtitle empty$
3784 'skip$
3785 { CTL_capitalize_subtitle boolean.to.int 'control.capitalize.subtitle := }
3786 if$
3787 CTL_link_title empty$
3788 'skip$
3789 { CTL_link_title boolean.to.int 'control.link.title := }
3790 if$
3791 CTL_article_title empty$
3792 'skip$
3793 { CTL_article_title boolean.to.int 'control.article.title := }
3794 if$
3795 CTL_patent_country empty$
3796 'skip$
3797 { CTL_patent_country boolean.to.int 'control.patent.country := }
3798 if$
3799 CTL_entry_type_id empty$
3800 'skip$
3801 { CTL_entry_type_id boolean.to.int 'control.entry.type.id := }
3802 if$
3803 CTL_space_before_type_id empty$
3804 'skip$
3805 { CTL_space_before_type_id boolean.to.int 'control.space.before.type.id := }
3806 if$
3807 CTL_entry_medium_id empty$
3808 'skip$
3809 { CTL_entry_medium_id boolean.to.int 'control.entry.medium.id := }
3810 if$
3811 CTL_slash empty$
3812 'skip$
3813 { CTL_slash boolean.to.int 'control.slash := }
3814 if$
3815 CTL_in empty$
3816 'skip$
3817 { CTL_in boolean.to.int 'control.in := }
3818 if$
3819 CTL_emph_booktitle empty$
3820 'skip$
3821 { CTL_emph_booktitle boolean.to.int 'control.emph.booktitle := }
3822 if$
3823 CTL_emph_journal empty$
3824 'skip$
3825 { CTL_emph_journal boolean.to.int 'control.emph.journal := }
3826 if$
3827 CTL_short_journal empty$
3828 'skip$
3829 { CTL_short_journal boolean.to.int 'control.short.journal := }
3830 if$
3831 CTL_journal_dots empty$
3832 'skip$
3833 { CTL_journal_dots boolean.to.int 'control.journal.dots := }
3834 if$
3835 CTL_link_journal empty$
3836 'skip$
3837 { CTL_link_journal boolean.to.int 'control.link.journal := }
3838 if$
3839 CTL_bold_volume empty$
3840 'skip$
3841 { CTL_bold_volume boolean.to.int 'control.bold.volume := }
3842 if$
3843 CTL_unknown_publisher empty$
3844 'skip$
3845 { CTL_unknown_publisher boolean.to.int 'control.unknown.publisher := }
3846 if$
3847 CTL_space_before_pages empty$
3848 'skip$
3849 { CTL_space_before_pages boolean.to.int 'control.space.before.pages := }
3850 if$
3851 CTL_page_ranges empty$
3852 'skip$
3853 { CTL_page_ranges boolean.to.int 'control.page.ranges := }
3854 if$
3855 CTL_page_range_delim empty$
3856 'skip$
3857 { CTL_page_range_delim 'control.page.range.delim := }
3858 if$
3859 CTL_urldate empty$
3860 'skip$
3861 { CTL_urldate boolean.to.int 'control.urldate := }
3862 if$
3863 CTL_url empty$
3864 'skip$
3865 { CTL_url boolean.to.int 'control.url := }
3866 if$
3867 CTL_doi empty$
3868 'skip$
3869 { CTL_doi boolean.to.int 'control.doi := }
3870 if$
3871 CTL_eprint empty$
3872 'skip$
3873 { CTL_eprint boolean.to.int 'control.eprint := }
3874 if$
3875 CTL_note empty$
3876 'skip$
3877 { CTL_note boolean.to.int 'control.note := }
3878 if$
3879 CTL_end_dot empty$
3880 'skip$
3881 { CTL_end_dot boolean.to.int 'control.end.dot := }
3882 if$
3883 CTL_warn_empty_field empty$
3884 'skip$
3885 { CTL_warn_empty_field boolean.to.int 'control.warn.empty.field := }
3886 if$
3887 }
3888
3889 FUNCTION {control.pass}
3890 { type$ "gbt7714bstctl" =
3891 'GBT7714BSTCTL
3892 'skip$
3893 if$
3894 }
3895
3896 FUNCTION {control.check}
3897 { % TODO
3898 }
3899
3900 MACRO {jan} {"January"}
3901
3902 MACRO {feb} {"February"}
3903
3904 MACRO {mar} {"March"}
3905
3906 MACRO {apr} {"April"}
3907
3908 MACRO {may} {"May"}
3909
3910 MACRO {jun} {"June"}
3911
3912 MACRO {jul} {"July"}
3913
3914 MACRO {aug} {"August"}
3915
3916 MACRO {sep} {"September"}
3917
3918 MACRO {oct} {"October"}
3919
3920 MACRO {nov} {"November"}
3921
3922 MACRO {dec} {"December"}
3923
3924 MACRO {acmcs} {"ACM Computing Surveys"}
3925
3926 MACRO {acta} {"Acta Informatica"}
3927
3928 MACRO {cacm} {"Communications of the ACM"}
3929
3930 MACRO {ibmjrd} {"IBM Journal of Research and Development"}
3931
3932 MACRO {ibmsj} {"IBM Systems Journal"}
3933
3934 MACRO {ieeese} {"IEEE Transactions on Software Engineering"}
3935
3936 MACRO {ieeetc} {"IEEE Transactions on Computers"}
3937
3938 MACRO {ieeetcad}
3939 {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
3940
3941 MACRO {ipl} {"Information Processing Letters"}
3942
3943 MACRO {jacm} {"Journal of the ACM"}
3944
3945 MACRO {jcss} {"Journal of Computer and System Sciences"}
3946
3947 MACRO {scp} {"Science of Computer Programming"}
3948
3949 MACRO {sicomp} {"SIAM Journal on Computing"}
3950
3951 MACRO {tocs} {"ACM Transactions on Computer Systems"}
3952
3953 MACRO {tods} {"ACM Transactions on Database Systems"}
3954
3955 MACRO {tog} {"ACM Transactions on Graphics"}
3956
3957 MACRO {toms} {"ACM Transactions on Mathematical Software"}
3958
3959 MACRO {toois} {"ACM Transactions on Office Information Systems"}
3960
3961 MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
3962
3963 MACRO {tcs} {"Theoretical Computer Science"}
3964
3965 FUNCTION {sortify}
3966 { purify$
3967 "l" change.case$
3968 }
3969
3970 FUNCTION {chop.word}
3971 { 's :=
3972 'len :=
3973 s #1 len substring$ =
3974 { s len #1 + global.max$ substring$ }
3975 's
3976 if$
3977 }
3978
3979 FUNCTION {format.lab.names}
3980 { 's :=
3981 #1 'nameptr :=
3982 s num.names$ 'numnames :=
3983 numnames 'namesleft :=
3984 { namesleft #0 > }
3985 { format.lab.name 't :=
3986 nameptr #1 >
3987 { numnames control.max.cite.names >
3988 nameptr control.min.cite.names > and
3989 { "others" 't :=
3990 #1 'namesleft :=
3991 }
3992 'skip$
3993 if$
3994 namesleft #1 >
3995 { add.comma t * }
3996 { t "others" =
3997 { nameptr #2 >
3998 { add.comma }
3999 { space.precedes.et.al * }
4000 if$
4001 cite.et.al *
4002 }
4003 { control.cite.final.and
4004 { is.lang.cjk not nameptr #2 > and
4005 { add.comma }
4006 { inter.word.space * }
4007 if$
4008 cite.and * inter.word.space *
4009 }
4010 { add.comma }
4011 if$
4012 t *
4013 }
4014 if$
4015 }
4016 if$
4017 }
4018 't
4019 if$
4020 nameptr #1 + 'nameptr :=
4021 namesleft #1 - 'namesleft :=
4022 }
4023 while$
4024 format.punctuations
4025 }
4026
4027 FUNCTION {author.key.label}
4028 { author empty$
4029 { bbl.anonymous }
4030 { author format.lab.names }
4031 if$
4032 }
4033
4034 FUNCTION {author.editor.key.label}
4035 { author empty$
4036 { editor empty$
4037 { bbl.anonymous }
4038 { editor format.lab.names }
4039 if$
4040 }
4041 { author format.lab.names }
4042 if$
4043 }
4044
4045 FUNCTION {author.key.organization.label}
4046 { author empty$
4047 { organization empty$
4048 { bbl.anonymous }
4049 { "The " #4 organization chop.word #3 text.prefix$ }
4050 if$
4051 }
4052 { author format.lab.names }
4053 if$
4054 }
4055
4056 FUNCTION {editor.key.organization.label}
4057 { editor empty$
4058 { organization empty$
4059 { bbl.anonymous }
4060 { "The " #4 organization chop.word #3 text.prefix$ }
4061 if$
4062 }
4063 { editor format.lab.names }
4064 if$
4065 }
4066
4067 FUNCTION {holder.author.label}
4068 { holder empty$
4069 { author empty$
4070 { bbl.anonymous }
4071 { author format.lab.names }
4072 if$
4073 }
4074 { holder format.lab.names }
4075 if$
4076 }
4077
4078 FUNCTION {calc.short.authors}
4079 { type$ "book" =
4080 type$ "inbook" = booktitle empty$ not and
4081 or
4082 'author.editor.key.label
4083 { type$ "collection" =
4084 type$ "proceedings" =
4085 or
4086 type$ "periodical" =
4087 or
4088 { editor empty$ not
4089 'editor.key.organization.label
4090 'author.key.organization.label
4091 if$
4092 }
4093 { type$ "patent" =
4094 'holder.author.label
4095 'author.key.label
4096 if$
4097 }
4098 if$
4099 }
4100 if$
4101 'short.list :=
4102 }
4103
4104 FUNCTION {calc.label}
4105 { calc.short.authors
4106 short.list
4107 duplicate$ "]" contains
4108 { "{" swap$ * "}" * }
4109 'skip$
4110 if$
4111 "("
4112 *
4113 format.lab.date
4114 duplicate$ "]" contains
4115 { "{" swap$ * "}" * }
4116 'skip$
4117 if$
4118 *
4119 'label :=
4120 }
4121
4122 INTEGERS { seq.num }
4123
4124 FUNCTION {init.seq}
4125 { #0 'seq.num :=}
4126
4127 FUNCTION {int.to.fix}
4128 { "000000000" swap$ int.to.str$ *
4129 #-1 #10 substring$
4130 }
4131
4132 FUNCTION {presort}
4133 { type$ "gbt7714bstctl" =
4134 {
4135 "_ "
4136 seq.num int.to.fix
4137 }
4138 { set.entry.lang
4139 set.entry.numbered
4140 "" 'entry.url :=
4141 #0 'require.url :=
4142 check.electronic
4143 calc.label
4144 label sortify
4145 " "
4146 *
4147 seq.num #1 + 'seq.num :=
4148 seq.num int.to.fix
4149 }
4150 if$
4151 'sort.label :=
4152 sort.label *
4153 #1 entry.max$ substring$
4154 'sort.key$ :=
4155 }
4156
4157 STRINGS { longest.label last.label next.extra last.extra.label }
4158
4159 INTEGERS { longest.label.width number.label }
4160
4161 FUNCTION {initialize.longest.label}
4162 { "" 'longest.label :=
4163 #0 int.to.chr$ 'last.label :=
4164 "" 'next.extra :=
4165 #0 'longest.label.width :=
4166 #0 'number.label :=
4167 "" 'last.extra.label :=
4168 }
4169
4170 FUNCTION {forward.pass}
4171 { type$ "gbt7714bstctl" =
4172 'skip$
4173 {
4174 number.label #1 + 'number.label :=
4175 }
4176 if$
4177 }
4178
4179 FUNCTION {reverse.pass}
4180 { type$ "gbt7714bstctl" =
4181 'skip$
4182 {
4183 label extra.label * 'label :=
4184 }
4185 if$
4186 }
4187
4188 FUNCTION {bib.sort.order}
4189 { sort.label 'sort.key$ := }
4190
4191 FUNCTION {begin.bib}
4192 { preamble$ empty$
4193 'skip$
4194 { preamble$ write$ newline$ }
4195 if$
4196 "\begin{thebibliography}{" number.label int.to.str$ * "}" *
4197 write$ newline$
4198 control.cite.lang "macro" =
4199 { "\providecommand{\biband}{和}"
4200 write$ newline$
4201 "\providecommand{\bibetal}{等}"
4202 write$ newline$
4203 }
4204 'skip$
4205 if$
4206 "\providecommand{\natexlab}[1]{#1}"
4207 write$ newline$
4208 "\providecommand{\url}[1]{#1}"
4209 write$ newline$
4210 "\expandafter\ifx\csname urlstyle\endcsname\relax\else"
4211 write$ newline$
4212 " \urlstyle{same}\fi"
4213 write$ newline$
4214 control.doi control.eprint or
4215 { "\expandafter\ifx\csname href\endcsname\relax"
4216 write$ newline$
4217 control.doi
4218 { " \def\doi{\begingroup \urlstyle{same}\Url}"
4219 write$ newline$
4220 control.cstr
4221 { " \def\cstr{\begingroup \urlstyle{same}\Url}"
4222 write$ newline$
4223 }
4224 'skip$
4225 if$
4226 }
4227 'skip$
4228 if$
4229 control.eprint
4230 { " \def\eprint#1#2{#2}"
4231 write$ newline$
4232 }
4233 'skip$
4234 if$
4235 "\else"
4236 write$ newline$
4237 control.doi
4238 { " \def\doi#1{\href{https://doi.org/#1}{\nolinkurl{#1}}}"
4239 write$ newline$
4240 control.cstr
4241 { " \def\cstr#1{\href{https://cstr.cn/#1}{\nolinkurl{#1}}}"
4242 write$ newline$
4243 }
4244 'skip$
4245 if$
4246 }
4247 'skip$
4248 if$
4249 control.eprint
4250 { " \let\eprint\href"
4251 write$ newline$
4252 }
4253 'skip$
4254 if$
4255 "\fi"
4256 write$ newline$
4257 }
4258 'skip$
4259 if$
4260 }
4261
4262 FUNCTION {end.bib}
4263 { newline$
4264 "\end{thebibliography}" write$ newline$
4265 }
4266
4267 READ
4268
4269 EXECUTE {init.state.consts}
4270
4271 EXECUTE {load.config}
4272
4273 ITERATE {control.pass}
4274
4275 EXECUTE {control.check}
4276
4277 EXECUTE {init.seq}
4278
4279 ITERATE {presort}
4280
4281 SORT
4282
4283 EXECUTE {initialize.longest.label}
4284
4285 ITERATE {forward.pass}
4286
4287 REVERSE {reverse.pass}
4288
4289 ITERATE {bib.sort.order}
4290
4291 SORT
4292
4293 EXECUTE {begin.bib}
4294
4295 ITERATE {call.type$}
4296
4297 EXECUTE {end.bib}