source: docs/Working/re/IEEEtranS.bst @ 3653

Last change on this file since 3653 was 3624, checked in by cameron, 6 years ago

Formats for PACT

File size: 61.6 KB
Line 
1%%
2%% IEEEtranS.bst
3%% BibTeX Bibliography Style file
4%% Sorting version of IEEEtran.bst
5%% *** Not for normal IEEE work ***
6%% Version 1.13 (2008/09/30)
7%%
8%% Copyright (c) 2003-2008 Michael Shell
9%%
10%% Original starting code base and algorithms obtained from the output of
11%% Patrick W. Daly's makebst package as well as from prior versions of
12%% IEEE BibTeX styles:
13%%
14%% 1. Howard Trickey and Oren Patashnik's ieeetr.bst  (1985/1988)
15%% 2. Silvano Balemi and Richard H. Roy's IEEEbib.bst (1993)
16%%
17%% Added sorting code is from plain.bst.
18%%
19%% Support sites:
20%% http://www.michaelshell.org/tex/ieeetran/
21%% http://www.ctan.org/tex-archive/macros/latex/contrib/IEEEtran/
22%% and/or
23%% http://www.ieee.org/
24%%
25%% For use with BibTeX version 0.99a or later
26%%
27%% This is a numerical citation style.
28%%
29%%*************************************************************************
30%% Legal Notice:
31%% This code is offered as-is without any warranty either expressed or
32%% implied; without even the implied warranty of MERCHANTABILITY or
33%% FITNESS FOR A PARTICULAR PURPOSE!
34%% User assumes all risk.
35%% In no event shall IEEE or any contributor to this code be liable for
36%% any damages or losses, including, but not limited to, incidental,
37%% consequential, or any other damages, resulting from the use or misuse
38%% of any information contained here.
39%%
40%% All comments are the opinions of their respective authors and are not
41%% necessarily endorsed by the IEEE.
42%%
43%% This work is distributed under the LaTeX Project Public License (LPPL)
44%% ( http://www.latex-project.org/ ) version 1.3, and may be freely used,
45%% distributed and modified. A copy of the LPPL, version 1.3, is included
46%% in the base LaTeX documentation of all distributions of LaTeX released
47%% 2003/12/01 or later.
48%% Retain all contribution notices and credits.
49%% ** Modified files should be clearly indicated as such, including  **
50%% ** renaming them and changing author support contact information. **
51%%
52%% File list of work: IEEEabrv.bib, IEEEfull.bib, IEEEexample.bib,
53%%                    IEEEtran.bst, IEEEtranS.bst, IEEEtranSA.bst,
54%%                    IEEEtranN.bst, IEEEtranSN.bst, IEEEtran_bst_HOWTO.pdf
55%%*************************************************************************
56%
57%
58% Changelog:
59%
60% 1.10 (2002/09/27) Initial release
61%
62% 1.11 (2003/04/02)
63%  1. Fixed bug with URLs containing underscores when using url.sty. Thanks
64%     to Ming Kin Lai for reporting this.
65%
66% 1.12 (2007/01/11)
67%  1. Fixed bug with unwanted comma before "et al." when an entry contained
68%     more than two author names. Thanks to Pallav Gupta for reporting this.
69%  2. Fixed bug with anomalous closing quote in tech reports that have a
70%     type, but without a number or address. Thanks to Mehrdad Mirreza for
71%     reporting this.
72%  3. Use braces in \providecommand in begin.bib to better support
73%     latex2html. TeX style length assignments OK with recent versions
74%     of latex2html - 1.71 (2002/2/1) or later is strongly recommended.
75%     Use of the language field still causes trouble with latex2html.
76%     Thanks to Federico Beffa for reporting this.
77%  4. Added IEEEtran.bst ID and version comment string to .bbl output.
78%  5. Provide a \BIBdecl hook that allows the user to execute commands
79%     just prior to the first entry.
80%  6. Use default urlstyle (is using url.sty) of "same" rather than rm to
81%     better work with a wider variety of bibliography styles.
82%  7. Changed month abbreviations from Sept., July and June to Sep., Jul.,
83%     and Jun., respectively, as IEEE now does. Thanks to Moritz Borgmann
84%     for reporting this.
85%  8. Control entry types should not be considered when calculating longest
86%     label width.
87%  9. Added alias www for electronic/online.
88% 10. Added CTLname_url_prefix control entry type.
89%
90% 1.13 (2008/09/30)
91%  1. Fixed bug with edition number to ordinal conversion. Thanks to
92%     Michael Roland for reporting this and correcting the algorithm.
93
94
95%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
96%% DEFAULTS FOR THE CONTROLS OF THE BST STYLE %%
97%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
98
99% These are the defaults for the user adjustable controls. The values used
100% here can be overridden by the user via IEEEtranBSTCTL entry type.
101
102% NOTE: The recommended LaTeX command to invoke a control entry type is:
103%
104%\makeatletter
105%\def\bstctlcite{\@ifnextchar[{\@bstctlcite}{\@bstctlcite[@auxout]}}
106%\def\@bstctlcite[#1]#2{\@bsphack
107%  \@for\@citeb:=#2\do{%
108%    \edef\@citeb{\expandafter\@firstofone\@citeb}%
109%    \if@filesw\immediate\write\csname #1\endcsname{\string\citation{\@citeb}}\fi}%
110%  \@esphack}
111%\makeatother
112%
113% It is called at the start of the document, before the first \cite, like:
114% \bstctlcite{IEEEexample:BSTcontrol}
115%
116% IEEEtran.cls V1.6 and later does provide this command.
117
118
119
120% #0 turns off the display of the number for articles.
121% #1 enables
122FUNCTION {default.is.use.number.for.article} { #1 }
123
124
125% #0 turns off the display of the paper and type fields in @inproceedings.
126% #1 enables
127FUNCTION {default.is.use.paper} { #1 }
128
129
130% #0 turns off the forced use of "et al."
131% #1 enables
132FUNCTION {default.is.forced.et.al} { #0 }
133
134% The maximum number of names that can be present beyond which an "et al."
135% usage is forced. Be sure that num.names.shown.with.forced.et.al (below)
136% is not greater than this value!
137% Note: There are many instances of references in IEEE journals which have
138% a very large number of authors as well as instances in which "et al." is
139% used profusely.
140FUNCTION {default.max.num.names.before.forced.et.al} { #10 }
141
142% The number of names that will be shown with a forced "et al.".
143% Must be less than or equal to max.num.names.before.forced.et.al
144FUNCTION {default.num.names.shown.with.forced.et.al} { #1 }
145
146
147% #0 turns off the alternate interword spacing for entries with URLs.
148% #1 enables
149FUNCTION {default.is.use.alt.interword.spacing} { #1 }
150
151% If alternate interword spacing for entries with URLs is enabled, this is
152% the interword spacing stretch factor that will be used. For example, the
153% default "4" here means that the interword spacing in entries with URLs can
154% stretch to four times normal. Does not have to be an integer. Note that
155% the value specified here can be overridden by the user in their LaTeX
156% code via a command such as:
157% "\providecommand\BIBentryALTinterwordstretchfactor{1.5}" in addition to
158% that via the IEEEtranBSTCTL entry type.
159FUNCTION {default.ALTinterwordstretchfactor} { "4" }
160
161
162% #0 turns off the "dashification" of repeated (i.e., identical to those
163% of the previous entry) names. IEEE normally does this.
164% #1 enables
165FUNCTION {default.is.dash.repeated.names} { #1 }
166
167
168% The default name format control string.
169FUNCTION {default.name.format.string}{ "{f.~}{vv~}{ll}{, jj}" }
170
171
172% The default LaTeX font command for the names.
173FUNCTION {default.name.latex.cmd}{ "" }
174
175
176% The default URL prefix.
177FUNCTION {default.name.url.prefix}{ "[Online]. Available:" }
178
179
180% Other controls that cannot be accessed via IEEEtranBSTCTL entry type.
181
182% #0 turns off the terminal startup banner/completed message so as to
183% operate more quietly.
184% #1 enables
185FUNCTION {is.print.banners.to.terminal} { #1 }
186
187
188
189
190%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
191%% FILE VERSION AND BANNER %%
192%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
193
194FUNCTION{bst.file.version} { "1.13" }
195FUNCTION{bst.file.date} { "2008/09/30" }
196FUNCTION{bst.file.website} { "http://www.michaelshell.org/tex/ieeetran/bibtex/" }
197
198FUNCTION {banner.message}
199{ is.print.banners.to.terminal
200     { "-- IEEEtranS.bst version" " " * bst.file.version *
201       " (" * bst.file.date * ") " * "by Michael Shell." *
202       top$
203       "-- " bst.file.website *
204       top$
205       "-- See the " quote$ * "IEEEtran_bst_HOWTO.pdf" * quote$ * " manual for usage information." *
206       top$
207       "** Sorting version - not for normal IEEE work."
208       top$
209     }
210     { skip$ }
211   if$
212}
213
214FUNCTION {completed.message}
215{ is.print.banners.to.terminal
216     { ""
217       top$
218       "Done."
219       top$
220     }
221     { skip$ }
222   if$
223}
224
225
226
227
228%%%%%%%%%%%%%%%%%%%%%%
229%% STRING CONSTANTS %%
230%%%%%%%%%%%%%%%%%%%%%%
231
232FUNCTION {bbl.and}{ "and" }
233FUNCTION {bbl.etal}{ "et~al." }
234FUNCTION {bbl.editors}{ "eds." }
235FUNCTION {bbl.editor}{ "ed." }
236FUNCTION {bbl.edition}{ "ed." }
237FUNCTION {bbl.volume}{ "vol." }
238FUNCTION {bbl.of}{ "of" }
239FUNCTION {bbl.number}{ "no." }
240FUNCTION {bbl.in}{ "in" }
241FUNCTION {bbl.pages}{ "pp." }
242FUNCTION {bbl.page}{ "p." }
243FUNCTION {bbl.chapter}{ "ch." }
244FUNCTION {bbl.paper}{ "paper" }
245FUNCTION {bbl.part}{ "pt." }
246FUNCTION {bbl.patent}{ "Patent" }
247FUNCTION {bbl.patentUS}{ "U.S." }
248FUNCTION {bbl.revision}{ "Rev." }
249FUNCTION {bbl.series}{ "ser." }
250FUNCTION {bbl.standard}{ "Std." }
251FUNCTION {bbl.techrep}{ "Tech. Rep." }
252FUNCTION {bbl.mthesis}{ "Master's thesis" }
253FUNCTION {bbl.phdthesis}{ "Ph.D. dissertation" }
254FUNCTION {bbl.st}{ "st" }
255FUNCTION {bbl.nd}{ "nd" }
256FUNCTION {bbl.rd}{ "rd" }
257FUNCTION {bbl.th}{ "th" }
258
259
260% This is the LaTeX spacer that is used when a larger than normal space
261% is called for (such as just before the address:publisher).
262FUNCTION {large.space} { "\hskip 1em plus 0.5em minus 0.4em\relax " }
263
264% The LaTeX code for dashes that are used to represent repeated names.
265% Note: Some older IEEE journals used something like
266% "\rule{0.275in}{0.5pt}\," which is fairly thick and runs right along
267% the baseline. However, IEEE now uses a thinner, above baseline,
268% six dash long sequence.
269FUNCTION {repeated.name.dashes} { "------" }
270
271
272
273%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
274%% PREDEFINED STRING MACROS %%
275%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
276
277MACRO {jan} {"Jan."}
278MACRO {feb} {"Feb."}
279MACRO {mar} {"Mar."}
280MACRO {apr} {"Apr."}
281MACRO {may} {"May"}
282MACRO {jun} {"Jun."}
283MACRO {jul} {"Jul."}
284MACRO {aug} {"Aug."}
285MACRO {sep} {"Sep."}
286MACRO {oct} {"Oct."}
287MACRO {nov} {"Nov."}
288MACRO {dec} {"Dec."}
289
290
291
292%%%%%%%%%%%%%%%%%%
293%% ENTRY FIELDS %%
294%%%%%%%%%%%%%%%%%%
295
296ENTRY
297  { address
298    assignee
299    author
300    booktitle
301    chapter
302    day
303    dayfiled
304    edition
305    editor
306    howpublished
307    institution
308    intype
309    journal
310    key
311    language
312    month
313    monthfiled
314    nationality
315    note
316    number
317    organization
318    pages
319    paper
320    publisher
321    school
322    series
323    revision
324    title
325    type
326    url
327    volume
328    year
329    yearfiled
330    CTLuse_article_number
331    CTLuse_paper
332    CTLuse_forced_etal
333    CTLmax_names_forced_etal
334    CTLnames_show_etal
335    CTLuse_alt_spacing
336    CTLalt_stretch_factor
337    CTLdash_repeated_names
338    CTLname_format_string
339    CTLname_latex_cmd
340    CTLname_url_prefix
341  }
342  {}
343  { label }
344
345
346
347
348%%%%%%%%%%%%%%%%%%%%%%%
349%% INTEGER VARIABLES %%
350%%%%%%%%%%%%%%%%%%%%%%%
351
352INTEGERS { prev.status.punct this.status.punct punct.std
353           punct.no punct.comma punct.period
354           prev.status.space this.status.space space.std
355           space.no space.normal space.large
356           prev.status.quote this.status.quote quote.std
357           quote.no quote.close
358           prev.status.nline this.status.nline nline.std
359           nline.no nline.newblock
360           status.cap cap.std
361           cap.no cap.yes}
362
363INTEGERS { longest.label.width multiresult nameptr namesleft number.label numnames }
364
365INTEGERS { is.use.number.for.article
366           is.use.paper
367           is.forced.et.al
368           max.num.names.before.forced.et.al
369           num.names.shown.with.forced.et.al
370           is.use.alt.interword.spacing
371           is.dash.repeated.names}
372
373
374%%%%%%%%%%%%%%%%%%%%%%
375%% STRING VARIABLES %%
376%%%%%%%%%%%%%%%%%%%%%%
377
378STRINGS { bibinfo
379          longest.label
380          oldname
381          s
382          t
383          ALTinterwordstretchfactor
384          name.format.string
385          name.latex.cmd
386          name.url.prefix}
387
388
389
390
391%%%%%%%%%%%%%%%%%%%%%%%%%
392%% LOW LEVEL FUNCTIONS %%
393%%%%%%%%%%%%%%%%%%%%%%%%%
394
395FUNCTION {initialize.controls}
396{ default.is.use.number.for.article 'is.use.number.for.article :=
397  default.is.use.paper 'is.use.paper :=
398  default.is.forced.et.al 'is.forced.et.al :=
399  default.max.num.names.before.forced.et.al 'max.num.names.before.forced.et.al :=
400  default.num.names.shown.with.forced.et.al 'num.names.shown.with.forced.et.al :=
401  default.is.use.alt.interword.spacing 'is.use.alt.interword.spacing :=
402  default.is.dash.repeated.names 'is.dash.repeated.names :=
403  default.ALTinterwordstretchfactor 'ALTinterwordstretchfactor :=
404  default.name.format.string 'name.format.string :=
405  default.name.latex.cmd 'name.latex.cmd :=
406  default.name.url.prefix 'name.url.prefix :=
407}
408
409
410% This IEEEtran.bst features a very powerful and flexible mechanism for
411% controlling the capitalization, punctuation, spacing, quotation, and
412% newlines of the formatted entry fields. (Note: IEEEtran.bst does not need
413% or use the newline/newblock feature, but it has been implemented for
414% possible future use.) The output states of IEEEtran.bst consist of
415% multiple independent attributes and, as such, can be thought of as being
416% vectors, rather than the simple scalar values ("before.all",
417% "mid.sentence", etc.) used in most other .bst files.
418%
419% The more flexible and complex design used here was motivated in part by
420% IEEE's rather unusual bibliography style. For example, IEEE ends the
421% previous field item with a period and large space prior to the publisher
422% address; the @electronic entry types use periods as inter-item punctuation
423% rather than the commas used by the other entry types; and URLs are never
424% followed by periods even though they are the last item in the entry.
425% Although it is possible to accommodate these features with the conventional
426% output state system, the seemingly endless exceptions make for convoluted,
427% unreliable and difficult to maintain code.
428%
429% IEEEtran.bst's output state system can be easily understood via a simple
430% illustration of two most recently formatted entry fields (on the stack):
431%
432%               CURRENT_ITEM
433%               "PREVIOUS_ITEM
434%
435% which, in this example, is to eventually appear in the bibliography as:
436%
437%               "PREVIOUS_ITEM," CURRENT_ITEM
438%
439% It is the job of the output routine to take the previous item off of the
440% stack (while leaving the current item at the top of the stack), apply its
441% trailing punctuation (including closing quote marks) and spacing, and then
442% to write the result to BibTeX's output buffer:
443%
444%               "PREVIOUS_ITEM,"
445%
446% Punctuation (and spacing) between items is often determined by both of the
447% items rather than just the first one. The presence of quotation marks
448% further complicates the situation because, in standard English, trailing
449% punctuation marks are supposed to be contained within the quotes.
450%
451% IEEEtran.bst maintains two output state (aka "status") vectors which
452% correspond to the previous and current (aka "this") items. Each vector
453% consists of several independent attributes which track punctuation,
454% spacing, quotation, and newlines. Capitalization status is handled by a
455% separate scalar because the format routines, not the output routine,
456% handle capitalization and, therefore, there is no need to maintain the
457% capitalization attribute for both the "previous" and "this" items.
458%
459% When a format routine adds a new item, it copies the current output status
460% vector to the previous output status vector and (usually) resets the
461% current (this) output status vector to a "standard status" vector. Using a
462% "standard status" vector in this way allows us to redefine what we mean by
463% "standard status" at the start of each entry handler and reuse the same
464% format routines under the various inter-item separation schemes. For
465% example, the standard status vector for the @book entry type may use
466% commas for item separators, while the @electronic type may use periods,
467% yet both entry handlers exploit many of the exact same format routines.
468%
469% Because format routines have write access to the output status vector of
470% the previous item, they can override the punctuation choices of the
471% previous format routine! Therefore, it becomes trivial to implement rules
472% such as "Always use a period and a large space before the publisher." By
473% pushing the generation of the closing quote mark to the output routine, we
474% avoid all the problems caused by having to close a quote before having all
475% the information required to determine what the punctuation should be.
476%
477% The IEEEtran.bst output state system can easily be expanded if needed.
478% For instance, it is easy to add a "space.tie" attribute value if the
479% bibliography rules mandate that two items have to be joined with an
480% unbreakable space.
481
482FUNCTION {initialize.status.constants}
483{ #0 'punct.no :=
484  #1 'punct.comma :=
485  #2 'punct.period :=
486  #0 'space.no :=
487  #1 'space.normal :=
488  #2 'space.large :=
489  #0 'quote.no :=
490  #1 'quote.close :=
491  #0 'cap.no :=
492  #1 'cap.yes :=
493  #0 'nline.no :=
494  #1 'nline.newblock :=
495}
496
497FUNCTION {std.status.using.comma}
498{ punct.comma 'punct.std :=
499  space.normal 'space.std :=
500  quote.no 'quote.std :=
501  nline.no 'nline.std :=
502  cap.no 'cap.std :=
503}
504
505FUNCTION {std.status.using.period}
506{ punct.period 'punct.std :=
507  space.normal 'space.std :=
508  quote.no 'quote.std :=
509  nline.no 'nline.std :=
510  cap.yes 'cap.std :=
511}
512
513FUNCTION {initialize.prev.this.status}
514{ punct.no 'prev.status.punct :=
515  space.no 'prev.status.space :=
516  quote.no 'prev.status.quote :=
517  nline.no 'prev.status.nline :=
518  punct.no 'this.status.punct :=
519  space.no 'this.status.space :=
520  quote.no 'this.status.quote :=
521  nline.no 'this.status.nline :=
522  cap.yes 'status.cap :=
523}
524
525FUNCTION {this.status.std}
526{ punct.std 'this.status.punct :=
527  space.std 'this.status.space :=
528  quote.std 'this.status.quote :=
529  nline.std 'this.status.nline :=
530}
531
532FUNCTION {cap.status.std}{ cap.std 'status.cap := }
533
534FUNCTION {this.to.prev.status}
535{ this.status.punct 'prev.status.punct :=
536  this.status.space 'prev.status.space :=
537  this.status.quote 'prev.status.quote :=
538  this.status.nline 'prev.status.nline :=
539}
540
541
542FUNCTION {not}
543{   { #0 }
544    { #1 }
545  if$
546}
547
548FUNCTION {and}
549{   { skip$ }
550    { pop$ #0 }
551  if$
552}
553
554FUNCTION {or}
555{   { pop$ #1 }
556    { skip$ }
557  if$
558}
559
560
561% convert the strings "yes" or "no" to #1 or #0 respectively
562FUNCTION {yes.no.to.int}
563{ "l" change.case$ duplicate$
564    "yes" =
565    { pop$  #1 }
566    { duplicate$ "no" =
567        { pop$ #0 }
568        { "unknown boolean " quote$ * swap$ * quote$ *
569          " in " * cite$ * warning$
570          #0
571        }
572      if$
573    }
574  if$
575}
576
577
578% pushes true if the single char string on the stack is in the
579% range of "0" to "9"
580FUNCTION {is.num}
581{ chr.to.int$
582  duplicate$ "0" chr.to.int$ < not
583  swap$ "9" chr.to.int$ > not and
584}
585
586% multiplies the integer on the stack by a factor of 10
587FUNCTION {bump.int.mag}
588{ #0 'multiresult :=
589    { duplicate$ #0 > }
590    { #1 -
591      multiresult #10 +
592      'multiresult :=
593    }
594  while$
595pop$
596multiresult
597}
598
599% converts a single character string on the stack to an integer
600FUNCTION {char.to.integer}
601{ duplicate$
602  is.num
603    { chr.to.int$ "0" chr.to.int$ - }
604    {"noninteger character " quote$ * swap$ * quote$ *
605          " in integer field of " * cite$ * warning$
606    #0
607    }
608  if$
609}
610
611% converts a string on the stack to an integer
612FUNCTION {string.to.integer}
613{ duplicate$ text.length$ 'namesleft :=
614  #1 'nameptr :=
615  #0 'numnames :=
616    { nameptr namesleft > not }
617    { duplicate$ nameptr #1 substring$
618      char.to.integer numnames bump.int.mag +
619      'numnames :=
620      nameptr #1 +
621      'nameptr :=
622    }
623  while$
624pop$
625numnames
626}
627
628
629
630
631% The output routines write out the *next* to the top (previous) item on the
632% stack, adding punctuation and such as needed. Since IEEEtran.bst maintains
633% the output status for the top two items on the stack, these output
634% routines have to consider the previous output status (which corresponds to
635% the item that is being output). Full independent control of punctuation,
636% closing quote marks, spacing, and newblock is provided.
637%
638% "output.nonnull" does not check for the presence of a previous empty
639% item.
640%
641% "output" does check for the presence of a previous empty item and will
642% remove an empty item rather than outputing it.
643%
644% "output.warn" is like "output", but will issue a warning if it detects
645% an empty item.
646
647FUNCTION {output.nonnull}
648{ swap$
649  prev.status.punct punct.comma =
650     { "," * }
651     { skip$ }
652   if$
653  prev.status.punct punct.period =
654     { add.period$ }
655     { skip$ }
656   if$
657  prev.status.quote quote.close =
658     { "''" * }
659     { skip$ }
660   if$
661  prev.status.space space.normal =
662     { " " * }
663     { skip$ }
664   if$
665  prev.status.space space.large =
666     { large.space * }
667     { skip$ }
668   if$
669  write$
670  prev.status.nline nline.newblock =
671     { newline$ "\newblock " write$ }
672     { skip$ }
673   if$
674}
675
676FUNCTION {output}
677{ duplicate$ empty$
678    'pop$
679    'output.nonnull
680  if$
681}
682
683FUNCTION {output.warn}
684{ 't :=
685  duplicate$ empty$
686    { pop$ "empty " t * " in " * cite$ * warning$ }
687    'output.nonnull
688  if$
689}
690
691% "fin.entry" is the output routine that handles the last item of the entry
692% (which will be on the top of the stack when "fin.entry" is called).
693
694FUNCTION {fin.entry}
695{ this.status.punct punct.no =
696     { skip$ }
697     { add.period$ }
698   if$
699   this.status.quote quote.close =
700     { "''" * }
701     { skip$ }
702   if$
703write$
704newline$
705}
706
707
708FUNCTION {is.last.char.not.punct}
709{ duplicate$
710   "}" * add.period$
711   #-1 #1 substring$ "." =
712}
713
714FUNCTION {is.multiple.pages}
715{ 't :=
716  #0 'multiresult :=
717    { multiresult not
718      t empty$ not
719      and
720    }
721    { t #1 #1 substring$
722      duplicate$ "-" =
723      swap$ duplicate$ "," =
724      swap$ "+" =
725      or or
726        { #1 'multiresult := }
727        { t #2 global.max$ substring$ 't := }
728      if$
729    }
730  while$
731  multiresult
732}
733
734FUNCTION {capitalize}{ "u" change.case$ "t" change.case$ }
735
736FUNCTION {emphasize}
737{ duplicate$ empty$
738    { pop$ "" }
739    { "\emph{" swap$ * "}" * }
740  if$
741}
742
743FUNCTION {do.name.latex.cmd}
744{ name.latex.cmd
745  empty$
746    { skip$ }
747    { name.latex.cmd "{" * swap$ * "}" * }
748  if$
749}
750
751% IEEEtran.bst uses its own \BIBforeignlanguage command which directly
752% invokes the TeX hyphenation patterns without the need of the Babel
753% package. Babel does a lot more than switch hyphenation patterns and
754% its loading can cause unintended effects in many class files (such as
755% IEEEtran.cls).
756FUNCTION {select.language}
757{ duplicate$ empty$ 'pop$
758    { language empty$ 'skip$
759        { "\BIBforeignlanguage{" language * "}{" * swap$ * "}" * }
760      if$
761    }
762  if$
763}
764
765FUNCTION {tie.or.space.prefix}
766{ duplicate$ text.length$ #3 <
767    { "~" }
768    { " " }
769  if$
770  swap$
771}
772
773FUNCTION {get.bbl.editor}
774{ editor num.names$ #1 > 'bbl.editors 'bbl.editor if$ }
775
776FUNCTION {space.word}{ " " swap$ * " " * }
777
778
779% Field Conditioners, Converters, Checkers and External Interfaces
780
781FUNCTION {empty.field.to.null.string}
782{ duplicate$ empty$
783    { pop$ "" }
784    { skip$ }
785  if$
786}
787
788FUNCTION {either.or.check}
789{ empty$
790    { pop$ }
791    { "can't use both " swap$ * " fields in " * cite$ * warning$ }
792  if$
793}
794
795FUNCTION {empty.entry.warn}
796{ author empty$ title empty$ howpublished empty$
797  month empty$ year empty$ note empty$ url empty$
798  and and and and and and
799    { "all relevant fields are empty in " cite$ * warning$ }
800    'skip$
801  if$
802}
803
804
805% The bibinfo system provides a way for the electronic parsing/acquisition
806% of a bibliography's contents as is done by ReVTeX. For example, a field
807% could be entered into the bibliography as:
808% \bibinfo{volume}{2}
809% Only the "2" would show up in the document, but the LaTeX \bibinfo command
810% could do additional things with the information. IEEEtran.bst does provide
811% a \bibinfo command via "\providecommand{\bibinfo}[2]{#2}". However, it is
812% currently not used as the bogus bibinfo functions defined here output the
813% entry values directly without the \bibinfo wrapper. The bibinfo functions
814% themselves (and the calls to them) are retained for possible future use.
815%
816% bibinfo.check avoids acting on missing fields while bibinfo.warn will
817% issue a warning message if a missing field is detected. Prior to calling
818% the bibinfo functions, the user should push the field value and then its
819% name string, in that order.
820
821FUNCTION {bibinfo.check}
822{ swap$ duplicate$ missing$
823    { pop$ pop$ "" }
824    { duplicate$ empty$
825        { swap$ pop$ }
826        { swap$ pop$ }
827      if$
828    }
829  if$
830}
831
832FUNCTION {bibinfo.warn}
833{ swap$ duplicate$ missing$
834    { swap$ "missing " swap$ * " in " * cite$ * warning$ pop$ "" }
835    { duplicate$ empty$
836        { swap$ "empty " swap$ * " in " * cite$ * warning$ }
837        { swap$ pop$ }
838      if$
839    }
840  if$
841}
842
843
844% IEEE separates large numbers with more than 4 digits into groups of
845% three. IEEE uses a small space to separate these number groups.
846% Typical applications include patent and page numbers.
847
848% number of consecutive digits required to trigger the group separation.
849FUNCTION {large.number.trigger}{ #5 }
850
851% For numbers longer than the trigger, this is the blocksize of the groups.
852% The blocksize must be less than the trigger threshold, and 2 * blocksize
853% must be greater than the trigger threshold (can't do more than one
854% separation on the initial trigger).
855FUNCTION {large.number.blocksize}{ #3 }
856
857% What is actually inserted between the number groups.
858FUNCTION {large.number.separator}{ "\," }
859
860% So as to save on integer variables by reusing existing ones, numnames
861% holds the current number of consecutive digits read and nameptr holds
862% the number that will trigger an inserted space.
863FUNCTION {large.number.separate}
864{ 't :=
865  ""
866  #0 'numnames :=
867  large.number.trigger 'nameptr :=
868  { t empty$ not }
869  { t #-1 #1 substring$ is.num
870      { numnames #1 + 'numnames := }
871      { #0 'numnames :=
872        large.number.trigger 'nameptr :=
873      }
874    if$
875    t #-1 #1 substring$ swap$ *
876    t #-2 global.max$ substring$ 't :=
877    numnames nameptr =
878      { duplicate$ #1 nameptr large.number.blocksize - substring$ swap$
879        nameptr large.number.blocksize - #1 + global.max$ substring$
880        large.number.separator swap$ * *
881        nameptr large.number.blocksize - 'numnames :=
882        large.number.blocksize #1 + 'nameptr :=
883      }
884      { skip$ }
885    if$
886  }
887  while$
888}
889
890% Converts all single dashes "-" to double dashes "--".
891FUNCTION {n.dashify}
892{ large.number.separate
893  't :=
894  ""
895    { t empty$ not }
896    { t #1 #1 substring$ "-" =
897        { t #1 #2 substring$ "--" = not
898            { "--" *
899              t #2 global.max$ substring$ 't :=
900            }
901            {   { t #1 #1 substring$ "-" = }
902                { "-" *
903                  t #2 global.max$ substring$ 't :=
904                }
905              while$
906            }
907          if$
908        }
909        { t #1 #1 substring$ *
910          t #2 global.max$ substring$ 't :=
911        }
912      if$
913    }
914  while$
915}
916
917
918% This function detects entries with names that are identical to that of
919% the previous entry and replaces the repeated names with dashes (if the
920% "is.dash.repeated.names" user control is nonzero).
921FUNCTION {name.or.dash}
922{ 's :=
923   oldname empty$
924     { s 'oldname := s }
925     { s oldname =
926         { is.dash.repeated.names
927              { repeated.name.dashes }
928              { s 'oldname := s }
929            if$
930         }
931         { s 'oldname := s }
932       if$
933     }
934   if$
935}
936
937% Converts the number string on the top of the stack to
938% "numerical ordinal form" (e.g., "7" to "7th"). There is
939% no artificial limit to the upper bound of the numbers as the
940% two least significant digits determine the ordinal form.
941FUNCTION {num.to.ordinal}
942{ duplicate$ #-2 #1 substring$ "1" =
943      { bbl.th * }
944      { duplicate$ #-1 #1 substring$ "1" =
945          { bbl.st * }
946          { duplicate$ #-1 #1 substring$ "2" =
947              { bbl.nd * }
948              { duplicate$ #-1 #1 substring$ "3" =
949                  { bbl.rd * }
950                  { bbl.th * }
951                if$
952              }
953            if$
954          }
955        if$
956      }
957    if$
958}
959
960% If the string on the top of the stack begins with a number,
961% (e.g., 11th) then replace the string with the leading number
962% it contains. Otherwise retain the string as-is. s holds the
963% extracted number, t holds the part of the string that remains
964% to be scanned.
965FUNCTION {extract.num}
966{ duplicate$ 't :=
967  "" 's :=
968  { t empty$ not }
969  { t #1 #1 substring$
970    t #2 global.max$ substring$ 't :=
971    duplicate$ is.num
972      { s swap$ * 's := }
973      { pop$ "" 't := }
974    if$
975  }
976  while$
977  s empty$
978    'skip$
979    { pop$ s }
980  if$
981}
982
983% Converts the word number string on the top of the stack to
984% Arabic string form. Will be successful up to "tenth".
985FUNCTION {word.to.num}
986{ duplicate$ "l" change.case$ 's :=
987  s "first" =
988    { pop$ "1" }
989    { skip$ }
990  if$
991  s "second" =
992    { pop$ "2" }
993    { skip$ }
994  if$
995  s "third" =
996    { pop$ "3" }
997    { skip$ }
998  if$
999  s "fourth" =
1000    { pop$ "4" }
1001    { skip$ }
1002  if$
1003  s "fifth" =
1004    { pop$ "5" }
1005    { skip$ }
1006  if$
1007  s "sixth" =
1008    { pop$ "6" }
1009    { skip$ }
1010  if$
1011  s "seventh" =
1012    { pop$ "7" }
1013    { skip$ }
1014  if$
1015  s "eighth" =
1016    { pop$ "8" }
1017    { skip$ }
1018  if$
1019  s "ninth" =
1020    { pop$ "9" }
1021    { skip$ }
1022  if$
1023  s "tenth" =
1024    { pop$ "10" }
1025    { skip$ }
1026  if$
1027}
1028
1029
1030% Converts the string on the top of the stack to numerical
1031% ordinal (e.g., "11th") form.
1032FUNCTION {convert.edition}
1033{ duplicate$ empty$ 'skip$
1034    { duplicate$ #1 #1 substring$ is.num
1035        { extract.num
1036          num.to.ordinal
1037        }
1038        { word.to.num
1039          duplicate$ #1 #1 substring$ is.num
1040            { num.to.ordinal }
1041            { "edition ordinal word " quote$ * edition * quote$ *
1042              " may be too high (or improper) for conversion" * " in " * cite$ * warning$
1043            }
1044          if$
1045        }
1046      if$
1047    }
1048  if$
1049}
1050
1051
1052
1053
1054%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1055%% LATEX BIBLIOGRAPHY CODE %%
1056%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1057
1058FUNCTION {start.entry}
1059{ newline$
1060  "\bibitem{" write$
1061  cite$ write$
1062  "}" write$
1063  newline$
1064  ""
1065  initialize.prev.this.status
1066}
1067
1068% Here we write out all the LaTeX code that we will need. The most involved
1069% code sequences are those that control the alternate interword spacing and
1070% foreign language hyphenation patterns. The heavy use of \providecommand
1071% gives users a way to override the defaults. Special thanks to Javier Bezos,
1072% Johannes Braams, Robin Fairbairns, Heiko Oberdiek, Donald Arseneau and all
1073% the other gurus on comp.text.tex for their help and advice on the topic of
1074% \selectlanguage, Babel and BibTeX.
1075FUNCTION {begin.bib}
1076{ "% Generated by IEEEtranS.bst, version: " bst.file.version * " (" * bst.file.date * ")" *
1077  write$ newline$
1078  preamble$ empty$ 'skip$
1079    { preamble$ write$ newline$ }
1080  if$
1081  "\begin{thebibliography}{"  longest.label  * "}" *
1082  write$ newline$
1083  "\providecommand{\url}[1]{#1}"
1084  write$ newline$
1085  "\csname url@samestyle\endcsname"
1086  write$ newline$
1087  "\providecommand{\newblock}{\relax}"
1088  write$ newline$
1089  "\providecommand{\bibinfo}[2]{#2}"
1090  write$ newline$
1091  "\providecommand{\BIBentrySTDinterwordspacing}{\spaceskip=0pt\relax}"
1092  write$ newline$
1093  "\providecommand{\BIBentryALTinterwordstretchfactor}{"
1094  ALTinterwordstretchfactor * "}" *
1095  write$ newline$
1096  "\providecommand{\BIBentryALTinterwordspacing}{\spaceskip=\fontdimen2\font plus "
1097  write$ newline$
1098  "\BIBentryALTinterwordstretchfactor\fontdimen3\font minus \fontdimen4\font\relax}"
1099  write$ newline$
1100  "\providecommand{\BIBforeignlanguage}[2]{{%"
1101  write$ newline$
1102  "\expandafter\ifx\csname l@#1\endcsname\relax"
1103  write$ newline$
1104  "\typeout{** WARNING: IEEEtranS.bst: No hyphenation pattern has been}%"
1105  write$ newline$
1106  "\typeout{** loaded for the language `#1'. Using the pattern for}%"
1107  write$ newline$
1108  "\typeout{** the default language instead.}%"
1109  write$ newline$
1110  "\else"
1111  write$ newline$
1112  "\language=\csname l@#1\endcsname"
1113  write$ newline$
1114  "\fi"
1115  write$ newline$
1116  "#2}}"
1117  write$ newline$
1118  "\providecommand{\BIBdecl}{\relax}"
1119  write$ newline$
1120  "\BIBdecl"
1121  write$ newline$
1122}
1123
1124FUNCTION {end.bib}
1125{ newline$ "\end{thebibliography}" write$ newline$ }
1126
1127FUNCTION {if.url.alt.interword.spacing}
1128{ is.use.alt.interword.spacing
1129     {url empty$ 'skip$ {"\BIBentryALTinterwordspacing" write$ newline$} if$}
1130     { skip$ }
1131   if$
1132}
1133
1134FUNCTION {if.url.std.interword.spacing}
1135{ is.use.alt.interword.spacing
1136     {url empty$ 'skip$ {"\BIBentrySTDinterwordspacing" write$ newline$} if$}
1137     { skip$ }
1138   if$
1139}
1140
1141
1142
1143
1144%%%%%%%%%%%%%%%%%%%%%%%%
1145%% LONGEST LABEL PASS %%
1146%%%%%%%%%%%%%%%%%%%%%%%%
1147
1148FUNCTION {initialize.longest.label}
1149{ "" 'longest.label :=
1150  #1 'number.label :=
1151  #0 'longest.label.width :=
1152}
1153
1154FUNCTION {longest.label.pass}
1155{ type$ "ieeetranbstctl" =
1156    { skip$ }
1157    { number.label int.to.str$ 'label :=
1158      number.label #1 + 'number.label :=
1159      label width$ longest.label.width >
1160        { label 'longest.label :=
1161          label width$ 'longest.label.width :=
1162        }
1163        { skip$ }
1164      if$
1165    }
1166  if$
1167}
1168
1169
1170
1171
1172%%%%%%%%%%%%%%%%%%%%%
1173%% FORMAT HANDLERS %%
1174%%%%%%%%%%%%%%%%%%%%%
1175
1176%% Lower Level Formats (used by higher level formats)
1177
1178FUNCTION {format.address.org.or.pub.date}
1179{ 't :=
1180  ""
1181  year empty$
1182    { "empty year in " cite$ * warning$ }
1183    { skip$ }
1184  if$
1185  address empty$ t empty$ and
1186  year empty$ and month empty$ and
1187    { skip$ }
1188    { this.to.prev.status
1189      this.status.std
1190      cap.status.std
1191      address "address" bibinfo.check *
1192      t empty$
1193        { skip$ }
1194        { punct.period 'prev.status.punct :=
1195          space.large 'prev.status.space :=
1196          address empty$
1197            { skip$ }
1198            { ": " * }
1199          if$
1200          t *
1201        }
1202      if$
1203      year empty$ month empty$ and
1204        { skip$ }
1205        { t empty$ address empty$ and
1206            { skip$ }
1207            { ", " * }
1208          if$
1209          month empty$
1210            { year empty$
1211                { skip$ }
1212                { year "year" bibinfo.check * }
1213              if$
1214            }
1215            { month "month" bibinfo.check *
1216              year empty$
1217                 { skip$ }
1218                 { " " * year "year" bibinfo.check * }
1219              if$
1220            }
1221          if$
1222        }
1223      if$
1224    }
1225  if$
1226}
1227
1228
1229FUNCTION {format.names}
1230{ 'bibinfo :=
1231  duplicate$ empty$ 'skip$ {
1232  this.to.prev.status
1233  this.status.std
1234  's :=
1235  "" 't :=
1236  #1 'nameptr :=
1237  s num.names$ 'numnames :=
1238  numnames 'namesleft :=
1239    { namesleft #0 > }
1240    { s nameptr
1241      name.format.string
1242      format.name$
1243      bibinfo bibinfo.check
1244      't :=
1245      nameptr #1 >
1246        { nameptr num.names.shown.with.forced.et.al #1 + =
1247          numnames max.num.names.before.forced.et.al >
1248          is.forced.et.al and and
1249            { "others" 't :=
1250              #1 'namesleft :=
1251            }
1252            { skip$ }
1253          if$
1254          namesleft #1 >
1255            { ", " * t do.name.latex.cmd * }
1256            { s nameptr "{ll}" format.name$ duplicate$ "others" =
1257                { 't := }
1258                { pop$ }
1259              if$
1260              t "others" =
1261                { " " * bbl.etal emphasize * }
1262                { numnames #2 >
1263                    { "," * }
1264                    { skip$ }
1265                  if$
1266                  bbl.and
1267                  space.word * t do.name.latex.cmd *
1268                }
1269              if$
1270            }
1271          if$
1272        }
1273        { t do.name.latex.cmd }
1274      if$
1275      nameptr #1 + 'nameptr :=
1276      namesleft #1 - 'namesleft :=
1277    }
1278  while$
1279  cap.status.std
1280  } if$
1281}
1282
1283
1284
1285
1286%% Higher Level Formats
1287
1288%% addresses/locations
1289
1290FUNCTION {format.address}
1291{ address duplicate$ empty$ 'skip$
1292    { this.to.prev.status
1293      this.status.std
1294      cap.status.std
1295    }
1296  if$
1297}
1298
1299
1300
1301%% author/editor names
1302
1303FUNCTION {format.authors}{ author "author" format.names }
1304
1305FUNCTION {format.editors}
1306{ editor "editor" format.names duplicate$ empty$ 'skip$
1307    { ", " *
1308      get.bbl.editor
1309      capitalize
1310      *
1311    }
1312  if$
1313}
1314
1315
1316
1317%% date
1318
1319FUNCTION {format.date}
1320{
1321  month "month" bibinfo.check duplicate$ empty$
1322  year  "year" bibinfo.check duplicate$ empty$
1323    { swap$ 'skip$
1324        { this.to.prev.status
1325          this.status.std
1326          cap.status.std
1327         "there's a month but no year in " cite$ * warning$ }
1328      if$
1329      *
1330    }
1331    { this.to.prev.status
1332      this.status.std
1333      cap.status.std
1334      swap$ 'skip$
1335        {
1336          swap$
1337          " " * swap$
1338        }
1339      if$
1340      *
1341    }
1342  if$
1343}
1344
1345FUNCTION {format.date.electronic}
1346{ month "month" bibinfo.check duplicate$ empty$
1347  year  "year" bibinfo.check duplicate$ empty$
1348    { swap$
1349        { pop$ }
1350        { "there's a month but no year in " cite$ * warning$
1351        pop$ ")" * "(" swap$ *
1352        this.to.prev.status
1353        punct.no 'this.status.punct :=
1354        space.normal 'this.status.space :=
1355        quote.no 'this.status.quote :=
1356        cap.yes  'status.cap :=
1357        }
1358      if$
1359    }
1360    { swap$
1361        { swap$ pop$ ")" * "(" swap$ * }
1362        { "(" swap$ * ", " * swap$ * ")" * }
1363      if$
1364    this.to.prev.status
1365    punct.no 'this.status.punct :=
1366    space.normal 'this.status.space :=
1367    quote.no 'this.status.quote :=
1368    cap.yes  'status.cap :=
1369    }
1370  if$
1371}
1372
1373
1374
1375%% edition/title
1376
1377% Note: IEEE considers the edition to be closely associated with
1378% the title of a book. So, in IEEEtran.bst the edition is normally handled
1379% within the formatting of the title. The format.edition function is
1380% retained here for possible future use.
1381FUNCTION {format.edition}
1382{ edition duplicate$ empty$ 'skip$
1383    { this.to.prev.status
1384      this.status.std
1385      convert.edition
1386      status.cap
1387        { "t" }
1388        { "l" }
1389      if$ change.case$
1390      "edition" bibinfo.check
1391      "~" * bbl.edition *
1392      cap.status.std
1393    }
1394  if$
1395}
1396
1397% This is used to format the booktitle of a conference proceedings.
1398% Here we use the "intype" field to provide the user a way to
1399% override the word "in" (e.g., with things like "presented at")
1400% Use of intype stops the emphasis of the booktitle to indicate that
1401% we no longer mean the written conference proceedings, but the
1402% conference itself.
1403FUNCTION {format.in.booktitle}
1404{ booktitle "booktitle" bibinfo.check duplicate$ empty$ 'skip$
1405    { this.to.prev.status
1406      this.status.std
1407      select.language
1408      intype missing$
1409        { emphasize
1410          bbl.in " " *
1411        }
1412        { intype " " * }
1413      if$
1414      swap$ *
1415      cap.status.std
1416    }
1417  if$
1418}
1419
1420% This is used to format the booktitle of collection.
1421% Here the "intype" field is not supported, but "edition" is.
1422FUNCTION {format.in.booktitle.edition}
1423{ booktitle "booktitle" bibinfo.check duplicate$ empty$ 'skip$
1424    { this.to.prev.status
1425      this.status.std
1426      select.language
1427      emphasize
1428      edition empty$ 'skip$
1429        { ", " *
1430          edition
1431          convert.edition
1432          "l" change.case$
1433          * "~" * bbl.edition *
1434        }
1435      if$
1436      bbl.in " " * swap$ *
1437      cap.status.std
1438    }
1439  if$
1440}
1441
1442FUNCTION {format.article.title}
1443{ title duplicate$ empty$ 'skip$
1444    { this.to.prev.status
1445      this.status.std
1446      "t" change.case$
1447    }
1448  if$
1449  "title" bibinfo.check
1450  duplicate$ empty$ 'skip$
1451    { quote.close 'this.status.quote :=
1452      is.last.char.not.punct
1453        { punct.std 'this.status.punct := }
1454        { punct.no 'this.status.punct := }
1455      if$
1456      select.language
1457      "``" swap$ *
1458      cap.status.std
1459    }
1460  if$
1461}
1462
1463FUNCTION {format.article.title.electronic}
1464{ title duplicate$ empty$ 'skip$
1465    { this.to.prev.status
1466      this.status.std
1467      cap.status.std
1468      "t" change.case$
1469    }
1470  if$
1471  "title" bibinfo.check
1472  duplicate$ empty$
1473    { skip$ }
1474    { select.language }
1475  if$
1476}
1477
1478FUNCTION {format.book.title.edition}
1479{ title "title" bibinfo.check
1480  duplicate$ empty$
1481    { "empty title in " cite$ * warning$ }
1482    { this.to.prev.status
1483      this.status.std
1484      select.language
1485      emphasize
1486      edition empty$ 'skip$
1487        { ", " *
1488          edition
1489          convert.edition
1490          status.cap
1491            { "t" }
1492            { "l" }
1493          if$
1494          change.case$
1495          * "~" * bbl.edition *
1496        }
1497      if$
1498      cap.status.std
1499    }
1500  if$
1501}
1502
1503FUNCTION {format.book.title}
1504{ title "title" bibinfo.check
1505  duplicate$ empty$ 'skip$
1506    { this.to.prev.status
1507      this.status.std
1508      cap.status.std
1509      select.language
1510      emphasize
1511    }
1512  if$
1513}
1514
1515
1516
1517%% journal
1518
1519FUNCTION {format.journal}
1520{ journal duplicate$ empty$ 'skip$
1521    { this.to.prev.status
1522      this.status.std
1523      cap.status.std
1524      select.language
1525      emphasize
1526    }
1527  if$
1528}
1529
1530
1531
1532%% how published
1533
1534FUNCTION {format.howpublished}
1535{ howpublished duplicate$ empty$ 'skip$
1536    { this.to.prev.status
1537      this.status.std
1538      cap.status.std
1539    }
1540  if$
1541}
1542
1543
1544
1545%% institutions/organization/publishers/school
1546
1547FUNCTION {format.institution}
1548{ institution duplicate$ empty$ 'skip$
1549    { this.to.prev.status
1550      this.status.std
1551      cap.status.std
1552    }
1553  if$
1554}
1555
1556FUNCTION {format.organization}
1557{ organization duplicate$ empty$ 'skip$
1558    { this.to.prev.status
1559      this.status.std
1560      cap.status.std
1561    }
1562  if$
1563}
1564
1565FUNCTION {format.address.publisher.date}
1566{ publisher "publisher" bibinfo.warn format.address.org.or.pub.date }
1567
1568FUNCTION {format.address.publisher.date.nowarn}
1569{ publisher "publisher" bibinfo.check format.address.org.or.pub.date }
1570
1571FUNCTION {format.address.organization.date}
1572{ organization "organization" bibinfo.check format.address.org.or.pub.date }
1573
1574FUNCTION {format.school}
1575{ school duplicate$ empty$ 'skip$
1576    { this.to.prev.status
1577      this.status.std
1578      cap.status.std
1579    }
1580  if$
1581}
1582
1583
1584
1585%% volume/number/series/chapter/pages
1586
1587FUNCTION {format.volume}
1588{ volume empty.field.to.null.string
1589  duplicate$ empty$ 'skip$
1590    { this.to.prev.status
1591      this.status.std
1592      bbl.volume
1593      status.cap
1594        { capitalize }
1595        { skip$ }
1596      if$
1597      swap$ tie.or.space.prefix
1598      "volume" bibinfo.check
1599      * *
1600      cap.status.std
1601    }
1602  if$
1603}
1604
1605FUNCTION {format.number}
1606{ number empty.field.to.null.string
1607  duplicate$ empty$ 'skip$
1608    { this.to.prev.status
1609      this.status.std
1610      status.cap
1611         { bbl.number capitalize }
1612         { bbl.number }
1613       if$
1614      swap$ tie.or.space.prefix
1615      "number" bibinfo.check
1616      * *
1617      cap.status.std
1618    }
1619  if$
1620}
1621
1622FUNCTION {format.number.if.use.for.article}
1623{ is.use.number.for.article
1624     { format.number }
1625     { "" }
1626   if$
1627}
1628
1629% IEEE does not seem to tie the series so closely with the volume
1630% and number as is done in other bibliography styles. Instead the
1631% series is treated somewhat like an extension of the title.
1632FUNCTION {format.series}
1633{ series empty$
1634   { "" }
1635   { this.to.prev.status
1636     this.status.std
1637     bbl.series " " *
1638     series "series" bibinfo.check *
1639     cap.status.std
1640   }
1641 if$
1642}
1643
1644
1645FUNCTION {format.chapter}
1646{ chapter empty$
1647    { "" }
1648    { this.to.prev.status
1649      this.status.std
1650      type empty$
1651        { bbl.chapter }
1652        { type "l" change.case$
1653          "type" bibinfo.check
1654        }
1655      if$
1656      chapter tie.or.space.prefix
1657      "chapter" bibinfo.check
1658      * *
1659      cap.status.std
1660    }
1661  if$
1662}
1663
1664
1665% The intended use of format.paper is for paper numbers of inproceedings.
1666% The paper type can be overridden via the type field.
1667% We allow the type to be displayed even if the paper number is absent
1668% for things like "postdeadline paper"
1669FUNCTION {format.paper}
1670{ is.use.paper
1671     { paper empty$
1672        { type empty$
1673            { "" }
1674            { this.to.prev.status
1675              this.status.std
1676              type "type" bibinfo.check
1677              cap.status.std
1678            }
1679          if$
1680        }
1681        { this.to.prev.status
1682          this.status.std
1683          type empty$
1684            { bbl.paper }
1685            { type "type" bibinfo.check }
1686          if$
1687          " " * paper
1688          "paper" bibinfo.check
1689          *
1690          cap.status.std
1691        }
1692      if$
1693     }
1694     { "" }
1695   if$
1696}
1697
1698
1699FUNCTION {format.pages}
1700{ pages duplicate$ empty$ 'skip$
1701    { this.to.prev.status
1702      this.status.std
1703      duplicate$ is.multiple.pages
1704        {
1705          bbl.pages swap$
1706          n.dashify
1707        }
1708        {
1709          bbl.page swap$
1710        }
1711      if$
1712      tie.or.space.prefix
1713      "pages" bibinfo.check
1714      * *
1715      cap.status.std
1716    }
1717  if$
1718}
1719
1720
1721
1722%% technical report number
1723
1724FUNCTION {format.tech.report.number}
1725{ number "number" bibinfo.check
1726  this.to.prev.status
1727  this.status.std
1728  cap.status.std
1729  type duplicate$ empty$
1730    { pop$
1731      bbl.techrep
1732    }
1733    { skip$ }
1734  if$
1735  "type" bibinfo.check
1736  swap$ duplicate$ empty$
1737    { pop$ }
1738    { tie.or.space.prefix * * }
1739  if$
1740}
1741
1742
1743
1744%% note
1745
1746FUNCTION {format.note}
1747{ note empty$
1748    { "" }
1749    { this.to.prev.status
1750      this.status.std
1751      punct.period 'this.status.punct :=
1752      note #1 #1 substring$
1753      duplicate$ "{" =
1754        { skip$ }
1755        { status.cap
1756          { "u" }
1757          { "l" }
1758        if$
1759        change.case$
1760        }
1761      if$
1762      note #2 global.max$ substring$ * "note" bibinfo.check
1763      cap.yes  'status.cap :=
1764    }
1765  if$
1766}
1767
1768
1769
1770%% patent
1771
1772FUNCTION {format.patent.date}
1773{ this.to.prev.status
1774  this.status.std
1775  year empty$
1776    { monthfiled duplicate$ empty$
1777        { "monthfiled" bibinfo.check pop$ "" }
1778        { "monthfiled" bibinfo.check }
1779      if$
1780      dayfiled duplicate$ empty$
1781        { "dayfiled" bibinfo.check pop$ "" * }
1782        { "dayfiled" bibinfo.check
1783          monthfiled empty$
1784             { "dayfiled without a monthfiled in " cite$ * warning$
1785               *
1786             }
1787             { " " swap$ * * }
1788           if$
1789        }
1790      if$
1791      yearfiled empty$
1792        { "no year or yearfiled in " cite$ * warning$ }
1793        { yearfiled "yearfiled" bibinfo.check
1794          swap$
1795          duplicate$ empty$
1796             { pop$ }
1797             { ", " * swap$ * }
1798           if$
1799        }
1800      if$
1801    }
1802    { month duplicate$ empty$
1803        { "month" bibinfo.check pop$ "" }
1804        { "month" bibinfo.check }
1805      if$
1806      day duplicate$ empty$
1807        { "day" bibinfo.check pop$ "" * }
1808        { "day" bibinfo.check
1809          month empty$
1810             { "day without a month in " cite$ * warning$
1811               *
1812             }
1813             { " " swap$ * * }
1814           if$
1815        }
1816      if$
1817      year "year" bibinfo.check
1818      swap$
1819      duplicate$ empty$
1820        { pop$ }
1821        { ", " * swap$ * }
1822      if$
1823    }
1824  if$
1825  cap.status.std
1826}
1827
1828FUNCTION {format.patent.nationality.type.number}
1829{ this.to.prev.status
1830  this.status.std
1831  nationality duplicate$ empty$
1832    { "nationality" bibinfo.warn pop$ "" }
1833    { "nationality" bibinfo.check
1834      duplicate$ "l" change.case$ "united states" =
1835        { pop$ bbl.patentUS }
1836        { skip$ }
1837      if$
1838      " " *
1839    }
1840  if$
1841  type empty$
1842    { bbl.patent "type" bibinfo.check }
1843    { type "type" bibinfo.check }
1844  if$ 
1845  *
1846  number duplicate$ empty$
1847    { "number" bibinfo.warn pop$ }
1848    { "number" bibinfo.check
1849      large.number.separate
1850      swap$ " " * swap$ *
1851    }
1852  if$
1853  cap.status.std
1854}
1855
1856
1857
1858%% standard
1859
1860FUNCTION {format.organization.institution.standard.type.number}
1861{ this.to.prev.status
1862  this.status.std
1863  organization duplicate$ empty$
1864    { pop$
1865      institution duplicate$ empty$
1866        { "institution" bibinfo.warn }
1867        { "institution" bibinfo.warn " " * }
1868      if$
1869    }
1870    { "organization" bibinfo.warn " " * }
1871  if$
1872  type empty$
1873    { bbl.standard "type" bibinfo.check }
1874    { type "type" bibinfo.check }
1875  if$ 
1876  *
1877  number duplicate$ empty$
1878    { "number" bibinfo.check pop$ }
1879    { "number" bibinfo.check
1880      large.number.separate
1881      swap$ " " * swap$ *
1882    }
1883  if$
1884  cap.status.std
1885}
1886
1887FUNCTION {format.revision}
1888{ revision empty$
1889    { "" }
1890    { this.to.prev.status
1891      this.status.std
1892      bbl.revision
1893      revision tie.or.space.prefix
1894      "revision" bibinfo.check
1895      * *
1896      cap.status.std
1897    }
1898  if$
1899}
1900
1901
1902%% thesis
1903
1904FUNCTION {format.master.thesis.type}
1905{ this.to.prev.status
1906  this.status.std
1907  type empty$
1908    {
1909      bbl.mthesis
1910    }
1911    {
1912      type "type" bibinfo.check
1913    }
1914  if$
1915cap.status.std
1916}
1917
1918FUNCTION {format.phd.thesis.type}
1919{ this.to.prev.status
1920  this.status.std
1921  type empty$
1922    {
1923      bbl.phdthesis
1924    }
1925    {
1926      type "type" bibinfo.check
1927    }
1928  if$
1929cap.status.std
1930}
1931
1932
1933
1934%% URL
1935
1936FUNCTION {format.url}
1937{ url empty$
1938    { "" }
1939    { this.to.prev.status
1940      this.status.std
1941      cap.yes 'status.cap :=
1942      name.url.prefix " " *
1943      "\url{" * url * "}" *
1944      punct.no 'this.status.punct :=
1945      punct.period 'prev.status.punct :=
1946      space.normal 'this.status.space :=
1947      space.normal 'prev.status.space :=
1948      quote.no 'this.status.quote :=
1949    }
1950  if$
1951}
1952
1953
1954
1955
1956%%%%%%%%%%%%%%%%%%%%
1957%% ENTRY HANDLERS %%
1958%%%%%%%%%%%%%%%%%%%%
1959
1960
1961% Note: In many journals, IEEE (or the authors) tend not to show the number
1962% for articles, so the display of the number is controlled here by the
1963% switch "is.use.number.for.article"
1964FUNCTION {article}
1965{ std.status.using.comma
1966  start.entry
1967  if.url.alt.interword.spacing
1968  format.authors "author" output.warn
1969  name.or.dash
1970  format.article.title "title" output.warn
1971  format.journal "journal" bibinfo.check "journal" output.warn
1972  format.volume output
1973  format.number.if.use.for.article output
1974  format.pages output
1975  format.date "year" output.warn
1976  format.note output
1977  format.url output
1978  fin.entry
1979  if.url.std.interword.spacing
1980}
1981
1982FUNCTION {book}
1983{ std.status.using.comma
1984  start.entry
1985  if.url.alt.interword.spacing
1986  author empty$
1987    { format.editors "author and editor" output.warn }
1988    { format.authors output.nonnull }
1989  if$
1990  name.or.dash
1991  format.book.title.edition output
1992  format.series output
1993  author empty$
1994    { skip$ }
1995    { format.editors output }
1996  if$
1997  format.address.publisher.date output
1998  format.volume output
1999  format.number output
2000  format.note output
2001  format.url output
2002  fin.entry
2003  if.url.std.interword.spacing
2004}
2005
2006FUNCTION {booklet}
2007{ std.status.using.comma
2008  start.entry
2009  if.url.alt.interword.spacing
2010  format.authors output
2011  name.or.dash
2012  format.article.title "title" output.warn
2013  format.howpublished "howpublished" bibinfo.check output
2014  format.organization "organization" bibinfo.check output
2015  format.address "address" bibinfo.check output
2016  format.date output
2017  format.note output
2018  format.url output
2019  fin.entry
2020  if.url.std.interword.spacing
2021}
2022
2023FUNCTION {electronic}
2024{ std.status.using.period
2025  start.entry
2026  if.url.alt.interword.spacing
2027  format.authors output
2028  name.or.dash
2029  format.date.electronic output
2030  format.article.title.electronic output
2031  format.howpublished "howpublished" bibinfo.check output
2032  format.organization "organization" bibinfo.check output
2033  format.address "address" bibinfo.check output
2034  format.note output
2035  format.url output
2036  fin.entry
2037  empty.entry.warn
2038  if.url.std.interword.spacing
2039}
2040
2041FUNCTION {inbook}
2042{ std.status.using.comma
2043  start.entry
2044  if.url.alt.interword.spacing
2045  author empty$
2046    { format.editors "author and editor" output.warn }
2047    { format.authors output.nonnull }
2048  if$
2049  name.or.dash
2050  format.book.title.edition output
2051  format.series output
2052  format.address.publisher.date output
2053  format.volume output
2054  format.number output
2055  format.chapter output
2056  format.pages output
2057  format.note output
2058  format.url output
2059  fin.entry
2060  if.url.std.interword.spacing
2061}
2062
2063FUNCTION {incollection}
2064{ std.status.using.comma
2065  start.entry
2066  if.url.alt.interword.spacing
2067  format.authors "author" output.warn
2068  name.or.dash
2069  format.article.title "title" output.warn
2070  format.in.booktitle.edition "booktitle" output.warn
2071  format.series output
2072  format.editors output
2073  format.address.publisher.date.nowarn output
2074  format.volume output
2075  format.number output
2076  format.chapter output
2077  format.pages output
2078  format.note output
2079  format.url output
2080  fin.entry
2081  if.url.std.interword.spacing
2082}
2083
2084FUNCTION {inproceedings}
2085{ std.status.using.comma
2086  start.entry
2087  if.url.alt.interword.spacing
2088  format.authors "author" output.warn
2089  name.or.dash
2090  format.article.title "title" output.warn
2091  format.in.booktitle "booktitle" output.warn
2092  format.series output
2093  format.editors output
2094  format.volume output
2095  format.number output
2096  publisher empty$
2097    { format.address.organization.date output }
2098    { format.organization "organization" bibinfo.check output
2099      format.address.publisher.date output
2100    }
2101  if$
2102  format.paper output
2103  format.pages output
2104  format.note output
2105  format.url output
2106  fin.entry
2107  if.url.std.interword.spacing
2108}
2109
2110FUNCTION {manual}
2111{ std.status.using.comma
2112  start.entry
2113  if.url.alt.interword.spacing
2114  format.authors output
2115  name.or.dash
2116  format.book.title.edition "title" output.warn
2117  format.howpublished "howpublished" bibinfo.check output
2118  format.organization "organization" bibinfo.check output
2119  format.address "address" bibinfo.check output
2120  format.date output
2121  format.note output
2122  format.url output
2123  fin.entry
2124  if.url.std.interword.spacing
2125}
2126
2127FUNCTION {mastersthesis}
2128{ std.status.using.comma
2129  start.entry
2130  if.url.alt.interword.spacing
2131  format.authors "author" output.warn
2132  name.or.dash
2133  format.article.title "title" output.warn
2134  format.master.thesis.type output.nonnull
2135  format.school "school" bibinfo.warn output
2136  format.address "address" bibinfo.check output
2137  format.date "year" output.warn
2138  format.note output
2139  format.url output
2140  fin.entry
2141  if.url.std.interword.spacing
2142}
2143
2144FUNCTION {misc}
2145{ std.status.using.comma
2146  start.entry
2147  if.url.alt.interword.spacing
2148  format.authors output
2149  name.or.dash
2150  format.article.title output
2151  format.howpublished "howpublished" bibinfo.check output
2152  format.organization "organization" bibinfo.check output
2153  format.address "address" bibinfo.check output
2154  format.pages output
2155  format.date output
2156  format.note output
2157  format.url output
2158  fin.entry
2159  empty.entry.warn
2160  if.url.std.interword.spacing
2161}
2162
2163FUNCTION {patent}
2164{ std.status.using.comma
2165  start.entry
2166  if.url.alt.interword.spacing
2167  format.authors output
2168  name.or.dash
2169  format.article.title output
2170  format.patent.nationality.type.number output
2171  format.patent.date output
2172  format.note output
2173  format.url output
2174  fin.entry
2175  empty.entry.warn
2176  if.url.std.interword.spacing
2177}
2178
2179FUNCTION {periodical}
2180{ std.status.using.comma
2181  start.entry
2182  if.url.alt.interword.spacing
2183  format.editors output
2184  name.or.dash
2185  format.book.title "title" output.warn
2186  format.series output
2187  format.volume output
2188  format.number output
2189  format.organization "organization" bibinfo.check output
2190  format.date "year" output.warn
2191  format.note output
2192  format.url output
2193  fin.entry
2194  if.url.std.interword.spacing
2195}
2196
2197FUNCTION {phdthesis}
2198{ std.status.using.comma
2199  start.entry
2200  if.url.alt.interword.spacing
2201  format.authors "author" output.warn
2202  name.or.dash
2203  format.article.title "title" output.warn
2204  format.phd.thesis.type output.nonnull
2205  format.school "school" bibinfo.warn output
2206  format.address "address" bibinfo.check output
2207  format.date "year" output.warn
2208  format.note output
2209  format.url output
2210  fin.entry
2211  if.url.std.interword.spacing
2212}
2213
2214FUNCTION {proceedings}
2215{ std.status.using.comma
2216  start.entry
2217  if.url.alt.interword.spacing
2218  format.editors output
2219  name.or.dash
2220  format.book.title "title" output.warn
2221  format.series output
2222  format.volume output
2223  format.number output
2224  publisher empty$
2225    { format.address.organization.date output }
2226    { format.organization "organization" bibinfo.check output
2227      format.address.publisher.date output
2228    }
2229  if$
2230  format.note output
2231  format.url output
2232  fin.entry
2233  if.url.std.interword.spacing
2234}
2235
2236FUNCTION {standard}
2237{ std.status.using.comma
2238  start.entry
2239  if.url.alt.interword.spacing
2240  format.authors output
2241  name.or.dash
2242  format.book.title "title" output.warn
2243  format.howpublished "howpublished" bibinfo.check output
2244  format.organization.institution.standard.type.number output
2245  format.revision output
2246  format.date output
2247  format.note output
2248  format.url output
2249  fin.entry
2250  if.url.std.interword.spacing
2251}
2252
2253FUNCTION {techreport}
2254{ std.status.using.comma
2255  start.entry
2256  if.url.alt.interword.spacing
2257  format.authors "author" output.warn
2258  name.or.dash
2259  format.article.title "title" output.warn
2260  format.howpublished "howpublished" bibinfo.check output
2261  format.institution "institution" bibinfo.warn output
2262  format.address "address" bibinfo.check output
2263  format.tech.report.number output.nonnull
2264  format.date "year" output.warn
2265  format.note output
2266  format.url output
2267  fin.entry
2268  if.url.std.interword.spacing
2269}
2270
2271FUNCTION {unpublished}
2272{ std.status.using.comma
2273  start.entry
2274  if.url.alt.interword.spacing
2275  format.authors "author" output.warn
2276  name.or.dash
2277  format.article.title "title" output.warn
2278  format.date output
2279  format.note "note" output.warn
2280  format.url output
2281  fin.entry
2282  if.url.std.interword.spacing
2283}
2284
2285
2286% The special entry type which provides the user interface to the
2287% BST controls
2288FUNCTION {IEEEtranBSTCTL}
2289{ is.print.banners.to.terminal
2290    { "** IEEEtran BST control entry " quote$ * cite$ * quote$ * " detected." *
2291      top$
2292    }
2293    { skip$ }
2294  if$
2295  CTLuse_article_number
2296  empty$
2297    { skip$ }
2298    { CTLuse_article_number
2299      yes.no.to.int
2300      'is.use.number.for.article :=
2301    }
2302  if$
2303  CTLuse_paper
2304  empty$
2305    { skip$ }
2306    { CTLuse_paper
2307      yes.no.to.int
2308      'is.use.paper :=
2309    }
2310  if$
2311  CTLuse_forced_etal
2312  empty$
2313    { skip$ }
2314    { CTLuse_forced_etal
2315      yes.no.to.int
2316      'is.forced.et.al :=
2317    }
2318  if$
2319  CTLmax_names_forced_etal
2320  empty$
2321    { skip$ }
2322    { CTLmax_names_forced_etal
2323      string.to.integer
2324      'max.num.names.before.forced.et.al :=
2325    }
2326  if$
2327  CTLnames_show_etal
2328  empty$
2329    { skip$ }
2330    { CTLnames_show_etal
2331      string.to.integer
2332      'num.names.shown.with.forced.et.al :=
2333    }
2334  if$
2335  CTLuse_alt_spacing
2336  empty$
2337    { skip$ }
2338    { CTLuse_alt_spacing
2339      yes.no.to.int
2340      'is.use.alt.interword.spacing :=
2341    }
2342  if$
2343  CTLalt_stretch_factor
2344  empty$
2345    { skip$ }
2346    { CTLalt_stretch_factor
2347      'ALTinterwordstretchfactor :=
2348      "\renewcommand{\BIBentryALTinterwordstretchfactor}{"
2349      ALTinterwordstretchfactor * "}" *
2350      write$ newline$
2351    }
2352  if$
2353  CTLdash_repeated_names
2354  empty$
2355    { skip$ }
2356    { CTLdash_repeated_names
2357      yes.no.to.int
2358      'is.dash.repeated.names :=
2359    }
2360  if$
2361  CTLname_format_string
2362  empty$
2363    { skip$ }
2364    { CTLname_format_string
2365      'name.format.string :=
2366    }
2367  if$
2368  CTLname_latex_cmd
2369  empty$
2370    { skip$ }
2371    { CTLname_latex_cmd
2372      'name.latex.cmd :=
2373    }
2374  if$
2375  CTLname_url_prefix
2376  missing$
2377    { skip$ }
2378    { CTLname_url_prefix
2379      'name.url.prefix :=
2380    }
2381  if$
2382
2383
2384  num.names.shown.with.forced.et.al max.num.names.before.forced.et.al >
2385    { "CTLnames_show_etal cannot be greater than CTLmax_names_forced_etal in " cite$ * warning$
2386      max.num.names.before.forced.et.al 'num.names.shown.with.forced.et.al :=
2387    }
2388    { skip$ }
2389  if$
2390}
2391
2392
2393%%%%%%%%%%%%%%%%%%%
2394%% ENTRY ALIASES %%
2395%%%%%%%%%%%%%%%%%%%
2396FUNCTION {conference}{inproceedings}
2397FUNCTION {online}{electronic}
2398FUNCTION {internet}{electronic}
2399FUNCTION {webpage}{electronic}
2400FUNCTION {www}{electronic}
2401FUNCTION {default.type}{misc}
2402
2403
2404
2405%%%%%%%%%%%%%%%%%%
2406%% MAIN PROGRAM %%
2407%%%%%%%%%%%%%%%%%%
2408
2409READ
2410
2411EXECUTE {initialize.controls}
2412EXECUTE {initialize.status.constants}
2413EXECUTE {banner.message}
2414
2415
2416
2417% BEGIN sort code based on that of plain.bst
2418
2419FUNCTION {sortify}
2420{ purify$
2421  "l" change.case$
2422}
2423
2424INTEGERS { len }
2425
2426FUNCTION {chop.word}
2427{ 's :=
2428  'len :=
2429  s #1 len substring$ =
2430    { s len #1 + global.max$ substring$ }
2431    { s }
2432  if$
2433}
2434
2435FUNCTION {sort.format.names}
2436{ 's :=
2437  #1 'nameptr :=
2438  ""
2439  s num.names$ 'numnames :=
2440  numnames 'namesleft :=
2441    { namesleft #0 > }
2442    { nameptr #1 >
2443        { "   " * }
2444        { skip$ }
2445      if$
2446      s nameptr "{vv{ } }{ll{ }}{  ff{ }}{  jj{ }}" format.name$ 't :=
2447      nameptr numnames = t "others" = and
2448        { "et al" * }
2449        { t sortify * }
2450      if$
2451      nameptr #1 + 'nameptr :=
2452      namesleft #1 - 'namesleft :=
2453    }
2454  while$
2455}
2456
2457FUNCTION {sort.format.title}
2458{ 't :=
2459  "A " #2
2460    "An " #3
2461      "The " #4 t chop.word
2462    chop.word
2463  chop.word
2464  sortify
2465  #1 global.max$ substring$
2466}
2467
2468FUNCTION {author.sort}
2469{ author empty$
2470    { key empty$
2471        { "to sort, need author or key in " cite$ * warning$ "" }
2472        { key sortify }
2473      if$
2474    }
2475    { author sort.format.names }
2476  if$
2477}
2478
2479FUNCTION {author.editor.sort}
2480{ author empty$
2481    { editor empty$
2482        { key empty$
2483            { "to sort, need author, editor, or key in " cite$ * warning$ "" }
2484            { key sortify }
2485          if$
2486        }
2487        { editor sort.format.names }
2488      if$
2489    }
2490    { author sort.format.names }
2491  if$
2492}
2493
2494FUNCTION {author.organization.sort}
2495{ author empty$
2496    { organization empty$
2497        { key empty$
2498            { "to sort, need author, organization, or key in " cite$ * warning$ "" }
2499            { key sortify }
2500          if$
2501        }
2502        { "The " #4 organization chop.word sortify }
2503      if$
2504    }
2505    { author sort.format.names }
2506  if$
2507}
2508
2509FUNCTION {editor.organization.sort}
2510{ editor empty$
2511    { organization empty$
2512        { key empty$
2513            { "to sort, need editor, organization, or key in " cite$ * warning$ "" }
2514            { key sortify }
2515          if$
2516        }
2517        { "The " #4 organization chop.word sortify }
2518      if$
2519    }
2520    { editor sort.format.names }
2521  if$
2522}
2523
2524FUNCTION {author.organization.institution.sort}
2525{ author empty$
2526    { organization empty$
2527        { institution empty$
2528            { key empty$
2529                { "to sort, need author, organization, institution or key in " cite$ * warning$ "" }
2530                { key sortify }
2531              if$
2532            }
2533            { "The " #4 institution chop.word sortify }
2534          if$
2535        }
2536        { "The " #4 organization chop.word sortify }
2537      if$
2538    }
2539    { author sort.format.names }
2540  if$
2541}
2542
2543
2544FUNCTION {presort}
2545{ type$ "ieeetranbstctl" =
2546    { key empty$
2547        { "_" }
2548        { key sortify }
2549      if$
2550    }
2551    { type$ "book" =
2552      type$ "inbook" =
2553      or
2554        { author.editor.sort }
2555        { type$ "proceedings" =
2556          type$ "periodical" =
2557          or
2558            { editor.organization.sort }
2559            { type$ "manual" =
2560              type$ "electronic" =
2561              type$ "misc" =
2562              or or
2563                { author.organization.sort }
2564                { type$ "standard" =
2565                   { author.organization.institution.sort }
2566                   { author.sort }
2567                 if$
2568                }
2569              if$
2570            }
2571          if$
2572        }
2573      if$
2574      "    "
2575      *
2576      type$ "patent" =
2577        { year empty$
2578          { yearfiled }
2579          { year }
2580        if$
2581        }
2582        { year }
2583      if$
2584      empty.field.to.null.string sortify
2585      *
2586      "    "
2587      *
2588      title empty.field.to.null.string
2589      sort.format.title
2590      *
2591    }
2592  if$
2593  #1 entry.max$ substring$
2594  'sort.key$ :=
2595}
2596
2597ITERATE {presort}
2598
2599SORT
2600
2601% END sort code based on that of plain.bst
2602
2603
2604
2605EXECUTE {initialize.longest.label}
2606ITERATE {longest.label.pass}
2607
2608EXECUTE {begin.bib}
2609ITERATE {call.type$}
2610EXECUTE {end.bib}
2611
2612EXECUTE{completed.message}
2613
2614
2615%% That's all folks, mds.
Note: See TracBrowser for help on using the repository browser.