elsarticle/elsarticle-harv.bst
changeset 0 bc6edeef8717
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/elsarticle/elsarticle-harv.bst	Fri Nov 18 16:18:02 2016 +0100
     1.3 @@ -0,0 +1,1537 @@
     1.4 +%% 
     1.5 +%% Copyright 2007, 2008, 2009 Elsevier Ltd
     1.6 +%% 
     1.7 +%% This file is part of the 'Elsarticle Bundle'.
     1.8 +%% ---------------------------------------------
     1.9 +%% 
    1.10 +%% It may be distributed under the conditions of the LaTeX Project Public
    1.11 +%% License, either version 1.2 of this license or (at your option) any
    1.12 +%% later version.  The latest version of this license is in
    1.13 +%%    http://www.latex-project.org/lppl.txt
    1.14 +%% and version 1.2 or later is part of all distributions of LaTeX
    1.15 +%% version 1999/12/01 or later.
    1.16 +%% 
    1.17 +%% The list of all files belonging to the 'Elsarticle Bundle' is
    1.18 +%% given in the file `manifest.txt'.
    1.19 +%% 
    1.20 +
    1.21 + %%-------------------------------------------------------------------
    1.22 + %% This bibliography style file is intended for texts in ENGLISH
    1.23 + %% This is an author-year citation style bibliography. As such, it is
    1.24 + %% non-standard LaTeX, and requires a special package file
    1.25 + %% to function properly.
    1.26 + %% Such a package is    natbib.sty   by Patrick W. Daly
    1.27 + %% The form of the \bibitem entries is
    1.28 + %%   \bibitem[Jones et al.(1990)]{key}...
    1.29 + %%   \bibitem[Jones et al.(1990)Jones, Baker, and Smith]{key}...
    1.30 + %% The essential feature is that the label (the part in brackets) consists
    1.31 + %% of the author names, as they should appear in the citation, with the year
    1.32 + %% in parentheses following. There must be no space before the opening
    1.33 + %% parenthesis!
    1.34 + %% With natbib v5.3, a full list of authors may also follow the year.
    1.35 + %% In natbib.sty, it is possible to define the type of enclosures that is
    1.36 + %% really wanted (brackets or parentheses), but in either case, there must
    1.37 + %% be parentheses in the label.
    1.38 + %% The \cite command functions as follows:
    1.39 + %%   \citet{key} ==>>                Jones et al. (1990)
    1.40 + %%   \citet*{key} ==>>               Jones, Baker, and Smith (1990)
    1.41 + %%   \citep{key} ==>>                (Jones et al., 1990)
    1.42 + %%   \citep*{key} ==>>               (Jones, Baker, and Smith, 1990)
    1.43 + %%   \citep[chap. 2]{key} ==>>       (Jones et al., 1990, chap. 2)
    1.44 + %%   \citep[e.g.][]{key} ==>>        (e.g. Jones et al., 1990)
    1.45 + %%   \citep[e.g.][p. 32]{key} ==>>   (e.g. Jones et al., p. 32)
    1.46 + %%   \citeauthor{key} ==>>           Jones et al.
    1.47 + %%   \citeauthor*{key} ==>>          Jones, Baker, and Smith
    1.48 + %%   \citeyear{key} ==>>             1990
    1.49 + %%---------------------------------------------------------------------
    1.50 +
    1.51 +ENTRY
    1.52 +  { address
    1.53 +    author
    1.54 +    booktitle
    1.55 +    chapter
    1.56 +    edition
    1.57 +    editor
    1.58 +    howpublished
    1.59 +    institution
    1.60 +    journal
    1.61 +    key
    1.62 +    month
    1.63 +    note
    1.64 +    number
    1.65 +    organization
    1.66 +    pages
    1.67 +    publisher
    1.68 +    school
    1.69 +    series
    1.70 +    title
    1.71 +    type
    1.72 +    url
    1.73 +    volume
    1.74 +    year
    1.75 +  }
    1.76 +  {}
    1.77 +  { label extra.label sort.label short.list }
    1.78 +
    1.79 +INTEGERS { output.state before.all mid.sentence after.sentence after.block }
    1.80 +
    1.81 +FUNCTION {init.state.consts}
    1.82 +{ #0 'before.all :=
    1.83 +  #1 'mid.sentence :=
    1.84 +  #2 'after.sentence :=
    1.85 +  #3 'after.block :=
    1.86 +}
    1.87 +
    1.88 +STRINGS { s t }
    1.89 +
    1.90 +FUNCTION {output.nonnull}
    1.91 +{ 's :=
    1.92 +  output.state mid.sentence =
    1.93 +    { ", " * write$ }
    1.94 +    { output.state after.block =
    1.95 +        { add.period$ write$
    1.96 +          newline$
    1.97 +          "\newblock " write$
    1.98 +        }
    1.99 +        { output.state before.all =
   1.100 +            'write$
   1.101 +            { add.period$ " " * write$ }
   1.102 +          if$
   1.103 +        }
   1.104 +      if$
   1.105 +      mid.sentence 'output.state :=
   1.106 +    }
   1.107 +  if$
   1.108 +  s
   1.109 +}
   1.110 +
   1.111 +FUNCTION {output}
   1.112 +{ duplicate$ empty$
   1.113 +    'pop$
   1.114 +    'output.nonnull
   1.115 +  if$
   1.116 +}
   1.117 +
   1.118 +FUNCTION {output.check}
   1.119 +{ 't :=
   1.120 +  duplicate$ empty$
   1.121 +    { pop$ "empty " t * " in " * cite$ * warning$ }
   1.122 +    'output.nonnull
   1.123 +  if$
   1.124 +}
   1.125 +
   1.126 +FUNCTION {fin.entry}
   1.127 +{ add.period$
   1.128 +  write$
   1.129 +  newline$
   1.130 +}
   1.131 +
   1.132 +FUNCTION {new.block}
   1.133 +{ output.state before.all =
   1.134 +    'skip$
   1.135 +    { after.block 'output.state := }
   1.136 +  if$
   1.137 +}
   1.138 +
   1.139 +FUNCTION {new.sentence}
   1.140 +{ output.state after.block =
   1.141 +    'skip$
   1.142 +    { output.state before.all =
   1.143 +        'skip$
   1.144 +        { after.sentence 'output.state := }
   1.145 +      if$
   1.146 +    }
   1.147 +  if$
   1.148 +}
   1.149 +
   1.150 +%%SP 2003/07/25
   1.151 +%% No longer used
   1.152 +FUNCTION {add.blank}
   1.153 +{  " " * before.all 'output.state :=
   1.154 +}
   1.155 +
   1.156 +FUNCTION {date.block}
   1.157 +{
   1.158 +  new.sentence
   1.159 +}
   1.160 +
   1.161 +FUNCTION {not}
   1.162 +{   { #0 }
   1.163 +    { #1 }
   1.164 +  if$
   1.165 +}
   1.166 +
   1.167 +FUNCTION {and}
   1.168 +{   'skip$
   1.169 +    { pop$ #0 }
   1.170 +  if$
   1.171 +}
   1.172 +
   1.173 +FUNCTION {or}
   1.174 +{   { pop$ #1 }
   1.175 +    'skip$
   1.176 +  if$
   1.177 +}
   1.178 +
   1.179 +FUNCTION {new.block.checkb}
   1.180 +{ empty$
   1.181 +  swap$ empty$
   1.182 +  and
   1.183 +    'skip$
   1.184 +    'new.block
   1.185 +  if$
   1.186 +}
   1.187 +
   1.188 +FUNCTION {field.or.null}
   1.189 +{ duplicate$ empty$
   1.190 +    { pop$ "" }
   1.191 +    'skip$
   1.192 +  if$
   1.193 +}
   1.194 +
   1.195 +FUNCTION {emphasize}
   1.196 +{ skip$ }
   1.197 +
   1.198 +FUNCTION {capitalize}
   1.199 +{ "u" change.case$ "t" change.case$ }
   1.200 +
   1.201 +FUNCTION {space.word}
   1.202 +{ " " swap$ * " " * }
   1.203 +
   1.204 + %% Here are the language-specific definitions for explicit words.
   1.205 + %% Each function has a name bbl.xxx where xxx is the English word.
   1.206 + %% The language selected here is ENGLISH
   1.207 +FUNCTION {bbl.and}
   1.208 +{ "and"}
   1.209 +
   1.210 +FUNCTION {bbl.etal}
   1.211 +{ "et~al." }
   1.212 +
   1.213 +FUNCTION {bbl.editors}
   1.214 +{ "Eds." }
   1.215 +
   1.216 +FUNCTION {bbl.editor}
   1.217 +{ "Ed." }
   1.218 +
   1.219 +FUNCTION {bbl.edby}
   1.220 +{ "edited by" }
   1.221 +
   1.222 +FUNCTION {bbl.edition}
   1.223 +{ "Edition" }
   1.224 +
   1.225 +FUNCTION {bbl.volume}
   1.226 +{ "Vol." }
   1.227 +
   1.228 +FUNCTION {bbl.of}
   1.229 +{ "of" }
   1.230 +
   1.231 +FUNCTION {bbl.number}
   1.232 +{ "no." }
   1.233 +
   1.234 +FUNCTION {bbl.nr}
   1.235 +{ "no." }
   1.236 +
   1.237 +FUNCTION {bbl.in}
   1.238 +{ "in" }
   1.239 +
   1.240 +FUNCTION {bbl.pages}
   1.241 +{ "pp." }
   1.242 +
   1.243 +FUNCTION {bbl.page}
   1.244 +{ "p." }
   1.245 +
   1.246 +FUNCTION {bbl.chapter}
   1.247 +{ "Ch." }
   1.248 +
   1.249 +FUNCTION {bbl.techrep}
   1.250 +{ "Tech. Rep." }
   1.251 +
   1.252 +FUNCTION {bbl.mthesis}
   1.253 +{ "Master's thesis" }
   1.254 +
   1.255 +FUNCTION {bbl.phdthesis}
   1.256 +{ "Ph.D. thesis" }
   1.257 +
   1.258 +FUNCTION {bbl.first}
   1.259 +{ "1st" }
   1.260 +
   1.261 +FUNCTION {bbl.second}
   1.262 +{ "2nd" }
   1.263 +
   1.264 +FUNCTION {bbl.third}
   1.265 +{ "3rd" }
   1.266 +
   1.267 +FUNCTION {bbl.fourth}
   1.268 +{ "4th" }
   1.269 +
   1.270 +FUNCTION {bbl.fifth}
   1.271 +{ "5th" }
   1.272 +
   1.273 +FUNCTION {bbl.st}
   1.274 +{ "st" }
   1.275 +
   1.276 +FUNCTION {bbl.nd}
   1.277 +{ "nd" }
   1.278 +
   1.279 +FUNCTION {bbl.rd}
   1.280 +{ "rd" }
   1.281 +
   1.282 +FUNCTION {bbl.th}
   1.283 +{ "th" }
   1.284 +
   1.285 +MACRO {jan} {"Jan."}
   1.286 +
   1.287 +MACRO {feb} {"Feb."}
   1.288 +
   1.289 +MACRO {mar} {"Mar."}
   1.290 +
   1.291 +MACRO {apr} {"Apr."}
   1.292 +
   1.293 +MACRO {may} {"May"}
   1.294 +
   1.295 +MACRO {jun} {"Jun."}
   1.296 +
   1.297 +MACRO {jul} {"Jul."}
   1.298 +
   1.299 +MACRO {aug} {"Aug."}
   1.300 +
   1.301 +MACRO {sep} {"Sep."}
   1.302 +
   1.303 +MACRO {oct} {"Oct."}
   1.304 +
   1.305 +MACRO {nov} {"Nov."}
   1.306 +
   1.307 +MACRO {dec} {"Dec."}
   1.308 +
   1.309 +FUNCTION {eng.ord}
   1.310 +{ duplicate$ "1" swap$ *
   1.311 +  #-2 #1 substring$ "1" =
   1.312 +     { bbl.th * }
   1.313 +     { duplicate$ #-1 #1 substring$
   1.314 +       duplicate$ "1" =
   1.315 +         { pop$ bbl.st * }
   1.316 +         { duplicate$ "2" =
   1.317 +             { pop$ bbl.nd * }
   1.318 +             { "3" =
   1.319 +                 { bbl.rd * }
   1.320 +                 { bbl.th * }
   1.321 +               if$
   1.322 +             }
   1.323 +           if$
   1.324 +          }
   1.325 +       if$
   1.326 +     }
   1.327 +   if$
   1.328 +}
   1.329 +
   1.330 +MACRO {acmcs} {"ACM Comput. Surv."}
   1.331 +
   1.332 +MACRO {acta} {"Acta Inf."}
   1.333 +
   1.334 +MACRO {cacm} {"Commun. ACM"}
   1.335 +
   1.336 +MACRO {ibmjrd} {"IBM J. Res. Dev."}
   1.337 +
   1.338 +MACRO {ibmsj} {"IBM Syst.~J."}
   1.339 +
   1.340 +MACRO {ieeese} {"IEEE Trans. Softw. Eng."}
   1.341 +
   1.342 +MACRO {ieeetc} {"IEEE Trans. Comput."}
   1.343 +
   1.344 +MACRO {ieeetcad}
   1.345 + {"IEEE Trans. Comput.-Aided Design Integrated Circuits"}
   1.346 +
   1.347 +MACRO {ipl} {"Inf. Process. Lett."}
   1.348 +
   1.349 +MACRO {jacm} {"J.~ACM"}
   1.350 +
   1.351 +MACRO {jcss} {"J.~Comput. Syst. Sci."}
   1.352 +
   1.353 +MACRO {scp} {"Sci. Comput. Programming"}
   1.354 +
   1.355 +MACRO {sicomp} {"SIAM J. Comput."}
   1.356 +
   1.357 +MACRO {tocs} {"ACM Trans. Comput. Syst."}
   1.358 +
   1.359 +MACRO {tods} {"ACM Trans. Database Syst."}
   1.360 +
   1.361 +MACRO {tog} {"ACM Trans. Gr."}
   1.362 +
   1.363 +MACRO {toms} {"ACM Trans. Math. Softw."}
   1.364 +
   1.365 +MACRO {toois} {"ACM Trans. Office Inf. Syst."}
   1.366 +
   1.367 +MACRO {toplas} {"ACM Trans. Prog. Lang. Syst."}
   1.368 +
   1.369 +MACRO {tcs} {"Theoretical Comput. Sci."}
   1.370 +
   1.371 +FUNCTION {write.url}
   1.372 +{ url empty$
   1.373 +    { skip$ }
   1.374 +    { "\newline\urlprefix\url{" url * "}" * write$ newline$ }
   1.375 +  if$
   1.376 +}
   1.377 +
   1.378 +INTEGERS { nameptr namesleft numnames }
   1.379 +
   1.380 +FUNCTION {format.names}
   1.381 +{ 's :=
   1.382 +  #1 'nameptr :=
   1.383 +  s num.names$ 'numnames :=
   1.384 +  numnames 'namesleft :=
   1.385 +    { namesleft #0 > }
   1.386 +    { s nameptr
   1.387 +      "{vv~}{ll}{, jj}{, f.}" format.name$
   1.388 +    't :=
   1.389 +      nameptr #1 >
   1.390 +        {
   1.391 +          namesleft #1 >
   1.392 +            { ", " * t * }
   1.393 +            {
   1.394 +              "," *
   1.395 +              s nameptr "{ll}" format.name$ duplicate$ "others" =
   1.396 +                { 't := }
   1.397 +                { pop$ }
   1.398 +              if$
   1.399 +              t "others" =
   1.400 +                {
   1.401 +                  " " * bbl.etal *
   1.402 +                }
   1.403 +                { " " * t * }
   1.404 +              if$
   1.405 +            }
   1.406 +          if$
   1.407 +        }
   1.408 +        't
   1.409 +      if$
   1.410 +      nameptr #1 + 'nameptr :=
   1.411 +      namesleft #1 - 'namesleft :=
   1.412 +    }
   1.413 +  while$
   1.414 +}
   1.415 +FUNCTION {format.names.ed}
   1.416 +{ format.names }
   1.417 +FUNCTION {format.key}
   1.418 +{ empty$
   1.419 +    { key field.or.null }
   1.420 +    { "" }
   1.421 +  if$
   1.422 +}
   1.423 +
   1.424 +FUNCTION {format.authors}
   1.425 +{ author empty$
   1.426 +    { "" }
   1.427 +    { author format.names }
   1.428 +  if$
   1.429 +}
   1.430 +
   1.431 +FUNCTION {format.editors}
   1.432 +{ editor empty$
   1.433 +    { "" }
   1.434 +    { editor format.names
   1.435 +      editor num.names$ #1 >
   1.436 +        { " (" * bbl.editors * ")" * }
   1.437 +        { " (" * bbl.editor * ")" * }
   1.438 +      if$
   1.439 +    }
   1.440 +  if$
   1.441 +}
   1.442 +
   1.443 +FUNCTION {format.in.editors}
   1.444 +{ editor empty$
   1.445 +    { "" }
   1.446 +    { editor format.names.ed
   1.447 +      editor num.names$ #1 >
   1.448 +        { " (" * bbl.editors * ")" * }
   1.449 +        { " (" * bbl.editor * ")" * }
   1.450 +      if$
   1.451 +    }
   1.452 +  if$
   1.453 +}
   1.454 +
   1.455 +FUNCTION {format.note}
   1.456 +{
   1.457 + note empty$
   1.458 +    { "" }
   1.459 +    { note #1 #1 substring$
   1.460 +      duplicate$ "{" =
   1.461 +        'skip$
   1.462 +        { output.state mid.sentence =
   1.463 +          { "l" }
   1.464 +          { "u" }
   1.465 +        if$
   1.466 +        change.case$
   1.467 +        }
   1.468 +      if$
   1.469 +      note #2 global.max$ substring$ *
   1.470 +    }
   1.471 +  if$
   1.472 +}
   1.473 +
   1.474 +FUNCTION {format.title}
   1.475 +{ title empty$
   1.476 +    { "" }
   1.477 +    { title "t" change.case$
   1.478 +    }
   1.479 +  if$
   1.480 +}
   1.481 +
   1.482 +FUNCTION {format.full.names}
   1.483 +{'s :=
   1.484 +  #1 'nameptr :=
   1.485 +  s num.names$ 'numnames :=
   1.486 +  numnames 'namesleft :=
   1.487 +    { namesleft #0 > }
   1.488 +    { s nameptr
   1.489 +      "{vv~}{ll}" format.name$
   1.490 +      't :=
   1.491 +      nameptr #1 >
   1.492 +        {
   1.493 +          namesleft #1 >
   1.494 +            { ", " * t * }
   1.495 +            {
   1.496 +              numnames #2 >
   1.497 +                { "," * }
   1.498 +                'skip$
   1.499 +              if$
   1.500 +              s nameptr "{ll}" format.name$ duplicate$ "others" =
   1.501 +                { 't := }
   1.502 +                { pop$ }
   1.503 +              if$
   1.504 +              t "others" =
   1.505 +                {
   1.506 +                  " " * bbl.etal *
   1.507 +                }
   1.508 +                { bbl.and
   1.509 +                  space.word * t *
   1.510 +                }
   1.511 +              if$
   1.512 +            }
   1.513 +          if$
   1.514 +        }
   1.515 +        't
   1.516 +      if$
   1.517 +      nameptr #1 + 'nameptr :=
   1.518 +      namesleft #1 - 'namesleft :=
   1.519 +    }
   1.520 +  while$
   1.521 +}
   1.522 +
   1.523 +FUNCTION {author.editor.key.full}
   1.524 +{ author empty$
   1.525 +    { editor empty$
   1.526 +        { key empty$
   1.527 +            { cite$ #1 #3 substring$ }
   1.528 +            'key
   1.529 +          if$
   1.530 +        }
   1.531 +        { editor format.full.names }
   1.532 +      if$
   1.533 +    }
   1.534 +    { author format.full.names }
   1.535 +  if$
   1.536 +}
   1.537 +
   1.538 +FUNCTION {author.key.full}
   1.539 +{ author empty$
   1.540 +    { key empty$
   1.541 +         { cite$ #1 #3 substring$ }
   1.542 +          'key
   1.543 +      if$
   1.544 +    }
   1.545 +    { author format.full.names }
   1.546 +  if$
   1.547 +}
   1.548 +
   1.549 +FUNCTION {editor.key.full}
   1.550 +{ editor empty$
   1.551 +    { key empty$
   1.552 +         { cite$ #1 #3 substring$ }
   1.553 +          'key
   1.554 +      if$
   1.555 +    }
   1.556 +    { editor format.full.names }
   1.557 +  if$
   1.558 +}
   1.559 +
   1.560 +FUNCTION {make.full.names}
   1.561 +{ type$ "book" =
   1.562 +  type$ "inbook" =
   1.563 +  or
   1.564 +    'author.editor.key.full
   1.565 +    { type$ "proceedings" =
   1.566 +        'editor.key.full
   1.567 +        'author.key.full
   1.568 +      if$
   1.569 +    }
   1.570 +  if$
   1.571 +}
   1.572 +
   1.573 +FUNCTION {output.bibitem}
   1.574 +{ newline$
   1.575 +  "\bibitem[{" write$
   1.576 +  label write$
   1.577 +  ")" make.full.names duplicate$ short.list =
   1.578 +     { pop$ }
   1.579 +     { * }
   1.580 +   if$
   1.581 +  "}]{" * write$
   1.582 +  cite$ write$
   1.583 +  "}" write$
   1.584 +  newline$
   1.585 +  ""
   1.586 +  before.all 'output.state :=
   1.587 +}
   1.588 +
   1.589 +FUNCTION {n.dashify}
   1.590 +{
   1.591 +  't :=
   1.592 +  ""
   1.593 +    { t empty$ not }
   1.594 +    { t #1 #1 substring$ "-" =
   1.595 +        { t #1 #2 substring$ "--" = not
   1.596 +            { "--" *
   1.597 +              t #2 global.max$ substring$ 't :=
   1.598 +            }
   1.599 +            {   { t #1 #1 substring$ "-" = }
   1.600 +                { "-" *
   1.601 +                  t #2 global.max$ substring$ 't :=
   1.602 +                }
   1.603 +              while$
   1.604 +            }
   1.605 +          if$
   1.606 +        }
   1.607 +        { t #1 #1 substring$ *
   1.608 +          t #2 global.max$ substring$ 't :=
   1.609 +        }
   1.610 +      if$
   1.611 +    }
   1.612 +  while$
   1.613 +}
   1.614 +
   1.615 +FUNCTION {word.in}
   1.616 +{ bbl.in capitalize
   1.617 +  ":" *
   1.618 +  " " * }
   1.619 +
   1.620 +FUNCTION {format.date}
   1.621 +{ year duplicate$ empty$
   1.622 +    { "empty year in " cite$ * "; set to ????" * warning$
   1.623 +       pop$ "????" }
   1.624 +    'skip$
   1.625 +  if$
   1.626 +  month empty$
   1.627 +    'skip$
   1.628 +    { month
   1.629 +      " " * swap$ *
   1.630 +    }
   1.631 +  if$
   1.632 +  extra.label *
   1.633 +  before.all 'output.state :=
   1.634 +  ", " swap$ *
   1.635 +}
   1.636 +
   1.637 +FUNCTION {format.btitle}
   1.638 +{ title
   1.639 +}
   1.640 +
   1.641 +FUNCTION {tie.or.space.connect}
   1.642 +{ duplicate$ text.length$ #3 <
   1.643 +    { "~" }
   1.644 +    { " " }
   1.645 +  if$
   1.646 +  swap$ * *
   1.647 +}
   1.648 +
   1.649 +FUNCTION {either.or.check}
   1.650 +{ empty$
   1.651 +    'pop$
   1.652 +    { "can't use both " swap$ * " fields in " * cite$ * warning$ }
   1.653 +  if$
   1.654 +}
   1.655 +
   1.656 +FUNCTION {format.bvolume}
   1.657 +{ volume empty$
   1.658 +    { "" }
   1.659 +    { bbl.volume volume tie.or.space.connect
   1.660 +      series empty$
   1.661 +        'skip$
   1.662 +        { bbl.of space.word * series emphasize * }
   1.663 +      if$
   1.664 +      "volume and number" number either.or.check
   1.665 +    }
   1.666 +  if$
   1.667 +}
   1.668 +
   1.669 +FUNCTION {format.number.series}
   1.670 +{ volume empty$
   1.671 +    { number empty$
   1.672 +        { series field.or.null }
   1.673 +        { output.state mid.sentence =
   1.674 +            { bbl.number }
   1.675 +            { bbl.number capitalize }
   1.676 +          if$
   1.677 +          number tie.or.space.connect
   1.678 +          series empty$
   1.679 +            { "there's a number but no series in " cite$ * warning$ }
   1.680 +            { bbl.in space.word * series * }
   1.681 +          if$
   1.682 +        }
   1.683 +      if$
   1.684 +    }
   1.685 +    { "" }
   1.686 +  if$
   1.687 +}
   1.688 +
   1.689 +FUNCTION {is.num}
   1.690 +{ chr.to.int$
   1.691 +  duplicate$ "0" chr.to.int$ < not
   1.692 +  swap$ "9" chr.to.int$ > not and
   1.693 +}
   1.694 +
   1.695 +FUNCTION {extract.num}
   1.696 +{ duplicate$ 't :=
   1.697 +  "" 's :=
   1.698 +  { t empty$ not }
   1.699 +  { t #1 #1 substring$
   1.700 +    t #2 global.max$ substring$ 't :=
   1.701 +    duplicate$ is.num
   1.702 +      { s swap$ * 's := }
   1.703 +      { pop$ "" 't := }
   1.704 +    if$
   1.705 +  }
   1.706 +  while$
   1.707 +  s empty$
   1.708 +    'skip$
   1.709 +    { pop$ s }
   1.710 +  if$
   1.711 +}
   1.712 +
   1.713 +FUNCTION {convert.edition}
   1.714 +{ edition extract.num "l" change.case$ 's :=
   1.715 +  s "first" = s "1" = or
   1.716 +    { bbl.first 't := }
   1.717 +    { s "second" = s "2" = or
   1.718 +        { bbl.second 't := }
   1.719 +        { s "third" = s "3" = or
   1.720 +            { bbl.third 't := }
   1.721 +            { s "fourth" = s "4" = or
   1.722 +                { bbl.fourth 't := }
   1.723 +                { s "fifth" = s "5" = or
   1.724 +                    { bbl.fifth 't := }
   1.725 +                    { s #1 #1 substring$ is.num
   1.726 +                        { s eng.ord 't := }
   1.727 +                        { edition 't := }
   1.728 +                      if$
   1.729 +                    }
   1.730 +                  if$
   1.731 +                }
   1.732 +              if$
   1.733 +            }
   1.734 +          if$
   1.735 +        }
   1.736 +      if$
   1.737 +    }
   1.738 +  if$
   1.739 +  t
   1.740 +}
   1.741 +
   1.742 +FUNCTION {format.edition}
   1.743 +{ edition empty$
   1.744 +    { "" }
   1.745 +    { output.state mid.sentence =
   1.746 +        { convert.edition "l" change.case$ " " * bbl.edition * }
   1.747 +        { convert.edition "t" change.case$ " " * bbl.edition * }
   1.748 +      if$
   1.749 +    }
   1.750 +  if$
   1.751 +}
   1.752 +
   1.753 +INTEGERS { multiresult }
   1.754 +
   1.755 +FUNCTION {multi.page.check}
   1.756 +{ 't :=
   1.757 +  #0 'multiresult :=
   1.758 +    { multiresult not
   1.759 +      t empty$ not
   1.760 +      and
   1.761 +    }
   1.762 +    { t #1 #1 substring$
   1.763 +      duplicate$ "-" =
   1.764 +      swap$ duplicate$ "," =
   1.765 +      swap$ "+" =
   1.766 +      or or
   1.767 +        { #1 'multiresult := }
   1.768 +        { t #2 global.max$ substring$ 't := }
   1.769 +      if$
   1.770 +    }
   1.771 +  while$
   1.772 +  multiresult
   1.773 +}
   1.774 +
   1.775 +FUNCTION {format.pages}
   1.776 +{ pages empty$
   1.777 +    { "" }
   1.778 +    { pages multi.page.check
   1.779 +        { bbl.pages pages n.dashify tie.or.space.connect }
   1.780 +        { bbl.page pages tie.or.space.connect }
   1.781 +      if$
   1.782 +    }
   1.783 +  if$
   1.784 +}
   1.785 +
   1.786 +FUNCTION {format.journal.pages}
   1.787 +{ pages empty$
   1.788 +    'skip$
   1.789 +    { duplicate$ empty$
   1.790 +        { pop$ format.pages }
   1.791 +        {
   1.792 +          ", " *
   1.793 +          pages n.dashify *
   1.794 +        }
   1.795 +      if$
   1.796 +    }
   1.797 +  if$
   1.798 +}
   1.799 +
   1.800 +%%SP 2001/01/23
   1.801 +%% Only used in articles
   1.802 +FUNCTION {format.vol.num.pages}
   1.803 +{
   1.804 +%%SP 2001/01/23
   1.805 +%% Add the leading space only if there is a volume
   1.806 +  %% volume field.or.null
   1.807 +  " "
   1.808 +  volume empty$
   1.809 +    { pop$ "" }
   1.810 +    { volume * }
   1.811 +  if$
   1.812 +  number empty$
   1.813 +    'skip$
   1.814 +    {
   1.815 +      "~(" number * ")" * *
   1.816 +      volume empty$
   1.817 +        { "there's a number but no volume in " cite$ * warning$ }
   1.818 +        'skip$
   1.819 +      if$
   1.820 +    }
   1.821 +  if$
   1.822 +}
   1.823 +
   1.824 +FUNCTION {format.chapter.pages}
   1.825 +{ chapter empty$
   1.826 +    { "" }
   1.827 +    { type empty$
   1.828 +        { bbl.chapter }
   1.829 +        { type "l" change.case$ }
   1.830 +      if$
   1.831 +      chapter tie.or.space.connect
   1.832 +    }
   1.833 +  if$
   1.834 +}
   1.835 +
   1.836 +FUNCTION {format.in.ed.booktitle}
   1.837 +{ booktitle empty$
   1.838 +    { "" }
   1.839 +    { editor empty$
   1.840 +        { word.in booktitle * }
   1.841 +        { word.in format.in.editors * ", " *
   1.842 +          booktitle * }
   1.843 +      if$
   1.844 +    }
   1.845 +  if$
   1.846 +}
   1.847 +
   1.848 +FUNCTION {format.thesis.type}
   1.849 +{ type empty$
   1.850 +    'skip$
   1.851 +    { pop$
   1.852 +      type "t" change.case$
   1.853 +    }
   1.854 +  if$
   1.855 +}
   1.856 +
   1.857 +FUNCTION {format.tr.number}
   1.858 +{ type empty$
   1.859 +    { bbl.techrep }
   1.860 +    'type
   1.861 +  if$
   1.862 +  number empty$
   1.863 +    { "t" change.case$ }
   1.864 +    { number tie.or.space.connect }
   1.865 +  if$
   1.866 +}
   1.867 +
   1.868 +FUNCTION {format.article.crossref}
   1.869 +{
   1.870 +  word.in
   1.871 +  " \cite{" * crossref * "}" *
   1.872 +}
   1.873 +
   1.874 +FUNCTION {format.book.crossref}
   1.875 +{ volume empty$
   1.876 +    { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
   1.877 +      word.in
   1.878 +    }
   1.879 +    { bbl.volume capitalize
   1.880 +      volume tie.or.space.connect
   1.881 +      bbl.of space.word *
   1.882 +    }
   1.883 +  if$
   1.884 +  " \cite{" * crossref * "}" *
   1.885 +}
   1.886 +
   1.887 +FUNCTION {format.incoll.inproc.crossref}
   1.888 +{
   1.889 +  word.in
   1.890 +  " \cite{" * crossref * "}" *
   1.891 +}
   1.892 +
   1.893 +FUNCTION {format.org.or.pub}
   1.894 +{ 't :=
   1.895 +  ""
   1.896 +  address empty$ t empty$ and
   1.897 +    'skip$
   1.898 +    {
   1.899 +      t empty$
   1.900 +        { address empty$
   1.901 +          'skip$
   1.902 +          { address * }
   1.903 +          if$
   1.904 +        }
   1.905 +        { t *
   1.906 +          address empty$
   1.907 +            'skip$
   1.908 +            { ", " * address * }
   1.909 +          if$
   1.910 +        }
   1.911 +      if$
   1.912 +    }
   1.913 +  if$
   1.914 +}
   1.915 +
   1.916 +FUNCTION {format.publisher.address}
   1.917 +{ publisher empty$
   1.918 +    { "empty publisher in " cite$ * warning$
   1.919 +      ""
   1.920 +    }
   1.921 +    { publisher }
   1.922 +  if$
   1.923 +  format.org.or.pub
   1.924 +}
   1.925 +
   1.926 +FUNCTION {format.organization.address}
   1.927 +{ organization empty$
   1.928 +    { "" }
   1.929 +    { organization }
   1.930 +  if$
   1.931 +  format.org.or.pub
   1.932 +}
   1.933 +
   1.934 +FUNCTION {article}
   1.935 +{ output.bibitem
   1.936 +  format.authors "author" output.check
   1.937 +  author format.key output
   1.938 +  format.date "year" output.check
   1.939 +  date.block
   1.940 +  format.title "title" output.check
   1.941 +  new.sentence
   1.942 +  crossref missing$
   1.943 +    { journal
   1.944 +      "journal" output.check
   1.945 +%%SP 2001/01/23
   1.946 +%% Add the space in format.vol.num.pages
   1.947 +      %% add.blank
   1.948 +  before.all 'output.state :=
   1.949 +      format.vol.num.pages output
   1.950 +    }
   1.951 +    { format.article.crossref output.nonnull
   1.952 +      format.pages output
   1.953 +    }
   1.954 +  if$
   1.955 +  format.journal.pages
   1.956 +  format.note output
   1.957 +  fin.entry
   1.958 +  write.url
   1.959 +}
   1.960 +
   1.961 +FUNCTION {book}
   1.962 +{ output.bibitem
   1.963 +  author empty$
   1.964 +    { format.editors "author and editor" output.check
   1.965 +      editor format.key output
   1.966 +    }
   1.967 +    { format.authors output.nonnull
   1.968 +      crossref missing$
   1.969 +        { "author and editor" editor either.or.check }
   1.970 +        'skip$
   1.971 +      if$
   1.972 +    }
   1.973 +  if$
   1.974 +  format.date "year" output.check
   1.975 +  date.block
   1.976 +  format.btitle "title" output.check
   1.977 +  crossref missing$
   1.978 +    { format.edition output
   1.979 +      new.sentence
   1.980 +  format.bvolume output
   1.981 +      format.number.series output
   1.982 +      new.sentence
   1.983 +      format.publisher.address output
   1.984 +    }
   1.985 +    {
   1.986 +  new.sentence
   1.987 +      format.book.crossref output.nonnull
   1.988 +    }
   1.989 +  if$
   1.990 +  format.note output
   1.991 +  fin.entry
   1.992 +  write.url
   1.993 +}
   1.994 +
   1.995 +FUNCTION {booklet}
   1.996 +{ output.bibitem
   1.997 +  format.authors output
   1.998 +  author format.key output
   1.999 +  format.date "year" output.check
  1.1000 +  date.block
  1.1001 +  format.title "title" output.check
  1.1002 +  new.sentence
  1.1003 +  howpublished output
  1.1004 +  address output
  1.1005 +  format.note output
  1.1006 +  fin.entry
  1.1007 +  write.url
  1.1008 +}
  1.1009 +
  1.1010 +FUNCTION {inbook}
  1.1011 +{ output.bibitem
  1.1012 +  author empty$
  1.1013 +    { format.editors "author and editor" output.check
  1.1014 +      editor format.key output
  1.1015 +    }
  1.1016 +    { format.authors output.nonnull
  1.1017 +      crossref missing$
  1.1018 +        { "author and editor" editor either.or.check }
  1.1019 +        'skip$
  1.1020 +      if$
  1.1021 +    }
  1.1022 +  if$
  1.1023 +  format.date "year" output.check
  1.1024 +  date.block
  1.1025 +  format.btitle "title" output.check
  1.1026 +  crossref missing$
  1.1027 +    {
  1.1028 +      format.edition output
  1.1029 +      new.sentence
  1.1030 +      format.bvolume output
  1.1031 +      format.number.series output
  1.1032 +      new.sentence
  1.1033 +      format.publisher.address output
  1.1034 +      format.chapter.pages "chapter and pages" output.check
  1.1035 +    }
  1.1036 +    {
  1.1037 +      format.chapter.pages "chapter and pages" output.check
  1.1038 +  new.sentence
  1.1039 +      format.book.crossref output.nonnull
  1.1040 +    }
  1.1041 +  if$
  1.1042 +  format.pages "pages" output.check
  1.1043 +  format.note output
  1.1044 +  fin.entry
  1.1045 +  write.url
  1.1046 +}
  1.1047 +
  1.1048 +FUNCTION {incollection}
  1.1049 +{ output.bibitem
  1.1050 +  format.authors "author" output.check
  1.1051 +  author format.key output
  1.1052 +  format.date "year" output.check
  1.1053 +  date.block
  1.1054 +  format.title "title" output.check
  1.1055 +  new.sentence
  1.1056 +  crossref missing$
  1.1057 +    { format.in.ed.booktitle "booktitle" output.check
  1.1058 +      format.edition output
  1.1059 +      new.sentence
  1.1060 +      format.bvolume output
  1.1061 +      format.number.series output
  1.1062 +      new.sentence
  1.1063 +      format.publisher.address output
  1.1064 +      format.chapter.pages output
  1.1065 +    }
  1.1066 +    { format.incoll.inproc.crossref output.nonnull
  1.1067 +      format.chapter.pages output
  1.1068 +    }
  1.1069 +  if$
  1.1070 +  format.pages "pages" output.check
  1.1071 +  format.note output
  1.1072 +  fin.entry
  1.1073 +  write.url
  1.1074 +}
  1.1075 +
  1.1076 +FUNCTION {inproceedings}
  1.1077 +{ output.bibitem
  1.1078 +  format.authors "author" output.check
  1.1079 +  author format.key output
  1.1080 +  format.date "year" output.check
  1.1081 +  date.block
  1.1082 +  format.title "title" output.check
  1.1083 +  new.sentence
  1.1084 +  crossref missing$
  1.1085 +    { format.in.ed.booktitle "booktitle" output.check
  1.1086 +      format.edition output
  1.1087 +      new.sentence
  1.1088 +      format.bvolume output
  1.1089 +      format.number.series output
  1.1090 +      new.sentence
  1.1091 +      publisher empty$
  1.1092 +        { format.organization.address output }
  1.1093 +        { organization output
  1.1094 +          format.publisher.address output
  1.1095 +        }
  1.1096 +      if$
  1.1097 +%%SP 2001/01/23
  1.1098 +%%      format.pages output
  1.1099 +    }
  1.1100 +    { format.incoll.inproc.crossref output.nonnull
  1.1101 +%%SP 2001/01/23
  1.1102 +%%      format.pages output
  1.1103 +    }
  1.1104 +  if$
  1.1105 +%%SP 2001/01/23
  1.1106 +  format.pages "pages" output.check
  1.1107 +  format.note output
  1.1108 +  fin.entry
  1.1109 +  write.url
  1.1110 +}
  1.1111 +
  1.1112 +FUNCTION {conference} { inproceedings }
  1.1113 +
  1.1114 +FUNCTION {manual}
  1.1115 +{ output.bibitem
  1.1116 +  format.authors output
  1.1117 +  author format.key output
  1.1118 +  format.date "year" output.check
  1.1119 +  date.block
  1.1120 +  format.btitle "title" output.check
  1.1121 +  new.sentence
  1.1122 +  organization output
  1.1123 +  address output
  1.1124 +  format.edition output
  1.1125 +  format.note output
  1.1126 +  fin.entry
  1.1127 +  write.url
  1.1128 +}
  1.1129 +
  1.1130 +FUNCTION {mastersthesis}
  1.1131 +{ output.bibitem
  1.1132 +  format.authors "author" output.check
  1.1133 +  author format.key output
  1.1134 +  format.date "year" output.check
  1.1135 +  date.block
  1.1136 +  format.title "title" output.check
  1.1137 +  new.sentence
  1.1138 +  bbl.mthesis format.thesis.type output.nonnull
  1.1139 +  school "school" output.check
  1.1140 +  address output
  1.1141 +  format.note output
  1.1142 +  fin.entry
  1.1143 +  write.url
  1.1144 +}
  1.1145 +
  1.1146 +FUNCTION {misc}
  1.1147 +{ output.bibitem
  1.1148 +  format.authors output
  1.1149 +  author format.key output
  1.1150 +  format.date "year" output.check
  1.1151 +  date.block
  1.1152 +  format.title output
  1.1153 +  new.sentence
  1.1154 +  howpublished output
  1.1155 +  format.note output
  1.1156 +  fin.entry
  1.1157 +  write.url
  1.1158 +}
  1.1159 +
  1.1160 +FUNCTION {phdthesis}
  1.1161 +{ output.bibitem
  1.1162 +  format.authors "author" output.check
  1.1163 +  author format.key output
  1.1164 +  format.date "year" output.check
  1.1165 +  date.block
  1.1166 +  format.title "title" output.check
  1.1167 +  new.sentence
  1.1168 +  bbl.phdthesis format.thesis.type output.nonnull
  1.1169 +  school "school" output.check
  1.1170 +  address output
  1.1171 +  format.note output
  1.1172 +  fin.entry
  1.1173 +  write.url
  1.1174 +}
  1.1175 +
  1.1176 +FUNCTION {proceedings}
  1.1177 +{ output.bibitem
  1.1178 +  format.editors output
  1.1179 +  editor format.key output
  1.1180 +  format.date "year" output.check
  1.1181 +  date.block
  1.1182 +  format.btitle "title" output.check
  1.1183 +  new.sentence
  1.1184 +  format.bvolume output
  1.1185 +  format.number.series output
  1.1186 +  new.sentence
  1.1187 +  publisher empty$
  1.1188 +    { format.organization.address output }
  1.1189 +    { organization output
  1.1190 +      format.publisher.address output
  1.1191 +    }
  1.1192 +  if$
  1.1193 +  format.note output
  1.1194 +  fin.entry
  1.1195 +  write.url
  1.1196 +}
  1.1197 +
  1.1198 +FUNCTION {techreport}
  1.1199 +{ output.bibitem
  1.1200 +  format.authors "author" output.check
  1.1201 +  author format.key output
  1.1202 +  format.date "year" output.check
  1.1203 +  date.block
  1.1204 +  format.title "title" output.check
  1.1205 +  new.sentence
  1.1206 +  format.tr.number output.nonnull
  1.1207 +  institution "institution" output.check
  1.1208 +  address output
  1.1209 +  format.note output
  1.1210 +  fin.entry
  1.1211 +  write.url
  1.1212 +}
  1.1213 +
  1.1214 +FUNCTION {unpublished}
  1.1215 +{ output.bibitem
  1.1216 +  format.authors "author" output.check
  1.1217 +  author format.key output
  1.1218 +  format.date "year" output.check
  1.1219 +  date.block
  1.1220 +  format.title "title" output.check
  1.1221 +  format.note "note" output.check
  1.1222 +  fin.entry
  1.1223 +  write.url
  1.1224 +}
  1.1225 +
  1.1226 +FUNCTION {default.type} { misc }
  1.1227 +
  1.1228 +READ
  1.1229 +
  1.1230 +FUNCTION {sortify}
  1.1231 +{ purify$
  1.1232 +  "l" change.case$
  1.1233 +}
  1.1234 +
  1.1235 +INTEGERS { len }
  1.1236 +
  1.1237 +FUNCTION {chop.word}
  1.1238 +{ 's :=
  1.1239 +  'len :=
  1.1240 +  s #1 len substring$ =
  1.1241 +    { s len #1 + global.max$ substring$ }
  1.1242 +    's
  1.1243 +  if$
  1.1244 +}
  1.1245 +
  1.1246 +FUNCTION {format.lab.names}
  1.1247 +{ 's :=
  1.1248 +  s #1 "{vv~}{ll}" format.name$
  1.1249 +  s num.names$ duplicate$
  1.1250 +  #2 >
  1.1251 +    { pop$
  1.1252 +      " " * bbl.etal *
  1.1253 +    }
  1.1254 +    { #2 <
  1.1255 +        'skip$
  1.1256 +        { s #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
  1.1257 +            {
  1.1258 +              " " * bbl.etal *
  1.1259 +            }
  1.1260 +            { bbl.and space.word * s #2 "{vv~}{ll}" format.name$
  1.1261 +              * }
  1.1262 +          if$
  1.1263 +        }
  1.1264 +      if$
  1.1265 +    }
  1.1266 +  if$
  1.1267 +}
  1.1268 +
  1.1269 +FUNCTION {author.key.label}
  1.1270 +{ author empty$
  1.1271 +    { key empty$
  1.1272 +        { cite$ #1 #3 substring$ }
  1.1273 +        'key
  1.1274 +      if$
  1.1275 +    }
  1.1276 +    { author format.lab.names }
  1.1277 +  if$
  1.1278 +}
  1.1279 +
  1.1280 +FUNCTION {author.editor.key.label}
  1.1281 +{ author empty$
  1.1282 +    { editor empty$
  1.1283 +        { key empty$
  1.1284 +            { cite$ #1 #3 substring$ }
  1.1285 +            'key
  1.1286 +          if$
  1.1287 +        }
  1.1288 +        { editor format.lab.names }
  1.1289 +      if$
  1.1290 +    }
  1.1291 +    { author format.lab.names }
  1.1292 +  if$
  1.1293 +}
  1.1294 +
  1.1295 +FUNCTION {editor.key.label}
  1.1296 +{ editor empty$
  1.1297 +    { key empty$
  1.1298 +        { cite$ #1 #3 substring$ }
  1.1299 +        'key
  1.1300 +      if$
  1.1301 +    }
  1.1302 +    { editor format.lab.names }
  1.1303 +  if$
  1.1304 +}
  1.1305 +
  1.1306 +FUNCTION {calc.short.authors}
  1.1307 +{ type$ "book" =
  1.1308 +  type$ "inbook" =
  1.1309 +  or
  1.1310 +    'author.editor.key.label
  1.1311 +    { type$ "proceedings" =
  1.1312 +        'editor.key.label
  1.1313 +        'author.key.label
  1.1314 +      if$
  1.1315 +    }
  1.1316 +  if$
  1.1317 +  'short.list :=
  1.1318 +}
  1.1319 +
  1.1320 +FUNCTION {calc.label}
  1.1321 +{ calc.short.authors
  1.1322 +  short.list
  1.1323 +  "("
  1.1324 +  *
  1.1325 +  year duplicate$ empty$
  1.1326 +     { pop$ "????" }
  1.1327 +     'skip$
  1.1328 +  if$
  1.1329 +  *
  1.1330 +  'label :=
  1.1331 +}
  1.1332 +
  1.1333 +FUNCTION {sort.format.names}
  1.1334 +{ 's :=
  1.1335 +  #1 'nameptr :=
  1.1336 +  ""
  1.1337 +  s num.names$ 'numnames :=
  1.1338 +  numnames 'namesleft :=
  1.1339 +    { namesleft #0 > }
  1.1340 +    { s nameptr
  1.1341 +      "{vv{ } }{ll{ }}{  f{ }}{  jj{ }}"
  1.1342 +      format.name$ 't :=
  1.1343 +      nameptr #1 >
  1.1344 +        {
  1.1345 +          "   "  *
  1.1346 +          namesleft #1 = t "others" = and
  1.1347 +            { "zzzzz" * }
  1.1348 +            { t sortify * }
  1.1349 +          if$
  1.1350 +        }
  1.1351 +        { t sortify * }
  1.1352 +      if$
  1.1353 +      nameptr #1 + 'nameptr :=
  1.1354 +      namesleft #1 - 'namesleft :=
  1.1355 +    }
  1.1356 +  while$
  1.1357 +}
  1.1358 +
  1.1359 +FUNCTION {sort.format.title}
  1.1360 +{ 't :=
  1.1361 +  "A " #2
  1.1362 +    "An " #3
  1.1363 +      "The " #4 t chop.word
  1.1364 +    chop.word
  1.1365 +  chop.word
  1.1366 +  sortify
  1.1367 +  #1 global.max$ substring$
  1.1368 +}
  1.1369 +
  1.1370 +FUNCTION {author.sort}
  1.1371 +{ author empty$
  1.1372 +    { key empty$
  1.1373 +        { "to sort, need author or key in " cite$ * warning$
  1.1374 +          ""
  1.1375 +        }
  1.1376 +        { key sortify }
  1.1377 +      if$
  1.1378 +    }
  1.1379 +    { author sort.format.names }
  1.1380 +  if$
  1.1381 +}
  1.1382 +
  1.1383 +FUNCTION {author.editor.sort}
  1.1384 +{ author empty$
  1.1385 +    { editor empty$
  1.1386 +        { key empty$
  1.1387 +            { "to sort, need author, editor, or key in " cite$ * warning$
  1.1388 +              ""
  1.1389 +            }
  1.1390 +            { key sortify }
  1.1391 +          if$
  1.1392 +        }
  1.1393 +        { editor sort.format.names }
  1.1394 +      if$
  1.1395 +    }
  1.1396 +    { author sort.format.names }
  1.1397 +  if$
  1.1398 +}
  1.1399 +
  1.1400 +FUNCTION {editor.sort}
  1.1401 +{ editor empty$
  1.1402 +    { key empty$
  1.1403 +        { "to sort, need editor or key in " cite$ * warning$
  1.1404 +          ""
  1.1405 +        }
  1.1406 +        { key sortify }
  1.1407 +      if$
  1.1408 +    }
  1.1409 +    { editor sort.format.names }
  1.1410 +  if$
  1.1411 +}
  1.1412 +
  1.1413 +FUNCTION {presort}
  1.1414 +{ calc.label
  1.1415 +  label sortify
  1.1416 +  "    "
  1.1417 +  *
  1.1418 +  type$ "book" =
  1.1419 +  type$ "inbook" =
  1.1420 +  or
  1.1421 +    'author.editor.sort
  1.1422 +    { type$ "proceedings" =
  1.1423 +        'editor.sort
  1.1424 +        'author.sort
  1.1425 +      if$
  1.1426 +    }
  1.1427 +  if$
  1.1428 +  #1 entry.max$ substring$
  1.1429 +  'sort.label :=
  1.1430 +  sort.label
  1.1431 +  *
  1.1432 +  "    "
  1.1433 +  *
  1.1434 +  title field.or.null
  1.1435 +  sort.format.title
  1.1436 +  *
  1.1437 +  #1 entry.max$ substring$
  1.1438 +  'sort.key$ :=
  1.1439 +}
  1.1440 +
  1.1441 +ITERATE {presort}
  1.1442 +
  1.1443 +SORT
  1.1444 +
  1.1445 +STRINGS { last.label next.extra }
  1.1446 +
  1.1447 +INTEGERS { last.extra.num number.label }
  1.1448 +
  1.1449 +FUNCTION {initialize.extra.label.stuff}
  1.1450 +{ #0 int.to.chr$ 'last.label :=
  1.1451 +  "" 'next.extra :=
  1.1452 +  #0 'last.extra.num :=
  1.1453 +  #0 'number.label :=
  1.1454 +}
  1.1455 +
  1.1456 +FUNCTION {forward.pass}
  1.1457 +{ last.label label =
  1.1458 +    { last.extra.num #1 + 'last.extra.num :=
  1.1459 +      last.extra.num int.to.chr$ 'extra.label :=
  1.1460 +    }
  1.1461 +    { "a" chr.to.int$ 'last.extra.num :=
  1.1462 +      "" 'extra.label :=
  1.1463 +      label 'last.label :=
  1.1464 +    }
  1.1465 +  if$
  1.1466 +  number.label #1 + 'number.label :=
  1.1467 +}
  1.1468 +
  1.1469 +FUNCTION {reverse.pass}
  1.1470 +{ next.extra "b" =
  1.1471 +    { "a" 'extra.label := }
  1.1472 +    'skip$
  1.1473 +  if$
  1.1474 +  extra.label 'next.extra :=
  1.1475 +  extra.label
  1.1476 +  duplicate$ empty$
  1.1477 +    'skip$
  1.1478 +    { "{\natexlab{" swap$ * "}}" * }
  1.1479 +  if$
  1.1480 +  'extra.label :=
  1.1481 +  label extra.label * 'label :=
  1.1482 +}
  1.1483 +
  1.1484 +EXECUTE {initialize.extra.label.stuff}
  1.1485 +
  1.1486 +ITERATE {forward.pass}
  1.1487 +
  1.1488 +REVERSE {reverse.pass}
  1.1489 +
  1.1490 +FUNCTION {bib.sort.order}
  1.1491 +{ sort.label
  1.1492 +  "    "
  1.1493 +  *
  1.1494 +  year field.or.null sortify
  1.1495 +  *
  1.1496 +  "    "
  1.1497 +  *
  1.1498 +  title field.or.null
  1.1499 +  sort.format.title
  1.1500 +  *
  1.1501 +  #1 entry.max$ substring$
  1.1502 +  'sort.key$ :=
  1.1503 +}
  1.1504 +
  1.1505 +ITERATE {bib.sort.order}
  1.1506 +
  1.1507 +SORT
  1.1508 +
  1.1509 +FUNCTION {begin.bib}
  1.1510 +{ preamble$ empty$
  1.1511 +    'skip$
  1.1512 +    { preamble$ write$ newline$ }
  1.1513 +  if$
  1.1514 +  "\begin{thebibliography}{" number.label int.to.str$ * "}" *
  1.1515 +  write$ newline$
  1.1516 +  "\expandafter\ifx\csname natexlab\endcsname\relax\def\natexlab#1{#1}\fi"
  1.1517 +  write$ newline$
  1.1518 +  "\expandafter\ifx\csname url\endcsname\relax"
  1.1519 +  write$ newline$
  1.1520 +  "  \def\url#1{\texttt{#1}}\fi"
  1.1521 +  write$ newline$
  1.1522 +  "\expandafter\ifx\csname urlprefix\endcsname\relax\def\urlprefix{URL }\fi"
  1.1523 +  write$ newline$
  1.1524 +}
  1.1525 +
  1.1526 +EXECUTE {begin.bib}
  1.1527 +
  1.1528 +EXECUTE {init.state.consts}
  1.1529 +
  1.1530 +ITERATE {call.type$}
  1.1531 +
  1.1532 +FUNCTION {end.bib}
  1.1533 +{ newline$
  1.1534 +  "\end{thebibliography}" write$ newline$
  1.1535 +}
  1.1536 +
  1.1537 +EXECUTE {end.bib}
  1.1538 +%% End of customized bst file
  1.1539 +%%
  1.1540 +%% End of file `elsarticle-harv.bst'.