Statistics
| Branch: | Revision:

root / thesis / IEEEtranN.bst @ df1b1a42

History | View | Annotate | Download (62.1 KB)

1
%%
2
%% IEEEtranN.bst
3
%% BibTeX Bibliography Style file
4
%% Natbib version of IEEEtran.bst
5
%% *** Not for normal IEEE work ***
6
%% Version 1.14 (2015/08/26)
7
%% 
8
%% Copyright (c) 2003-2015 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 and natbib code is from Patrick W Daly's unsrtnat.bst
18
%% 
19
%% 
20
%% Support sites:
21
%% http://www.michaelshell.org/tex/ieeetran/
22
%% http://www.ctan.org/pkg/ieeetran
23
%% and/or
24
%% http://www.ieee.org/
25
%% 
26
%% For use with BibTeX version 0.99a or later
27
%%
28
%% This is a natbib compatible citation style.
29
%% 
30
%%*************************************************************************
31
%% Legal Notice:
32
%% This code is offered as-is without any warranty either expressed or
33
%% implied; without even the implied warranty of MERCHANTABILITY or
34
%% FITNESS FOR A PARTICULAR PURPOSE! 
35
%% User assumes all risk.
36
%% In no event shall the IEEE or any contributor to this code be liable for
37
%% any damages or losses, including, but not limited to, incidental,
38
%% consequential, or any other damages, resulting from the use or misuse
39
%% of any information contained here.
40
%%
41
%% All comments are the opinions of their respective authors and are not
42
%% necessarily endorsed by the IEEE.
43
%%
44
%% This work is distributed under the LaTeX Project Public License (LPPL)
45
%% ( http://www.latex-project.org/ ) version 1.3, and may be freely used,
46
%% distributed and modified. A copy of the LPPL, version 1.3, is included
47
%% in the base LaTeX documentation of all distributions of LaTeX released
48
%% 2003/12/01 or later.
49
%% Retain all contribution notices and credits.
50
%% ** Modified files should be clearly indicated as such, including  **
51
%% ** renaming them and changing author support contact information. **
52
%%*************************************************************************
53

    
54

    
55
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
56
%% DEFAULTS FOR THE CONTROLS OF THE BST STYLE %%
57
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
58

    
59
% These are the defaults for the user adjustable controls. The values used
60
% here can be overridden by the user via IEEEtranBSTCTL entry type.
61

    
62
% NOTE: The recommended LaTeX command to invoke a control entry type is:
63
% 
64
%\makeatletter
65
%\def\bstctlcite{\@ifnextchar[{\@bstctlcite}{\@bstctlcite[@auxout]}}
66
%\def\@bstctlcite[#1]#2{\@bsphack
67
%  \@for\@citeb:=#2\do{%
68
%    \edef\@citeb{\expandafter\@firstofone\@citeb}%
69
%    \if@filesw\immediate\write\csname #1\endcsname{\string\citation{\@citeb}}\fi}%
70
%  \@esphack}
71
%\makeatother
72
%
73
% It is called at the start of the document, before the first \cite, like:
74
% \bstctlcite{IEEEexample:BSTcontrol}
75
%
76
% IEEEtran.cls V1.6 and later does provide this command.
77

    
78

    
79

    
80
% #0 turns off the display of the number for articles.
81
% #1 enables
82
FUNCTION {default.is.use.number.for.article} { #1 }
83

    
84

    
85
% #0 turns off the display of the paper and type fields in @inproceedings.
86
% #1 enables
87
FUNCTION {default.is.use.paper} { #1 }
88

    
89

    
90
% #0 turns off the display of urls
91
% #1 enables
92
FUNCTION {default.is.use.url} { #1 }
93

    
94

    
95
% #0 turns off the forced use of "et al."
96
% #1 enables
97
FUNCTION {default.is.forced.et.al} { #0 }
98

    
99

    
100
% The maximum number of names that can be present beyond which an "et al."
101
% usage is forced. Be sure that num.names.shown.with.forced.et.al (below)
102
% is not greater than this value!
103
% Note: There are many instances of references in IEEE journals which have
104
% a very large number of authors as well as instances in which "et al." is
105
% used profusely.
106
FUNCTION {default.max.num.names.before.forced.et.al} { #10 }
107

    
108

    
109
% The number of names that will be shown with a forced "et al.".
110
% Must be less than or equal to max.num.names.before.forced.et.al
111
FUNCTION {default.num.names.shown.with.forced.et.al} { #1 }
112

    
113

    
114
% #0 turns off the alternate interword spacing for entries with URLs.
115
% #1 enables
116
FUNCTION {default.is.use.alt.interword.spacing} { #1 }
117

    
118

    
119
% If alternate interword spacing for entries with URLs is enabled, this is
120
% the interword spacing stretch factor that will be used. For example, the
121
% default "4" here means that the interword spacing in entries with URLs can
122
% stretch to four times normal. Does not have to be an integer. Note that
123
% the value specified here can be overridden by the user in their LaTeX
124
% code via a command such as: 
125
% "\providecommand\BIBentryALTinterwordstretchfactor{1.5}" in addition to
126
% that via the IEEEtranBSTCTL entry type.
127
FUNCTION {default.ALTinterwordstretchfactor} { "4" }
128

    
129

    
130
% #0 turns off the "dashification" of repeated (i.e., identical to those
131
% of the previous entry) names. The IEEE normally does this.
132
% #1 enables
133
FUNCTION {default.is.dash.repeated.names} { #1 }
134

    
135

    
136
% The default name format control string.
137
FUNCTION {default.name.format.string}{ "{f.~}{vv~}{ll}{, jj}" }
138

    
139

    
140
% The default LaTeX font command for the names.
141
FUNCTION {default.name.latex.cmd}{ "" }
142

    
143

    
144
% The default URL prefix.
145
FUNCTION {default.name.url.prefix}{ "[Online]. Available:" }
146

    
147

    
148
% Other controls that cannot be accessed via IEEEtranBSTCTL entry type.
149

    
150
% #0 turns off the terminal startup banner/completed message so as to
151
% operate more quietly.
152
% #1 enables
153
FUNCTION {is.print.banners.to.terminal} { #1 }
154

    
155

    
156

    
157

    
158
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
159
%% FILE VERSION AND BANNER %%
160
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
161

    
162
FUNCTION{bst.file.version} { "1.14" }
163
FUNCTION{bst.file.date} { "2015/08/26" }
164
FUNCTION{bst.file.website} { "http://www.michaelshell.org/tex/ieeetran/bibtex/" }
165

    
166
FUNCTION {banner.message}
167
{ is.print.banners.to.terminal
168
     { "-- IEEEtranN.bst version" " " * bst.file.version *
169
       " (" * bst.file.date * ") " * "by Michael Shell." *
170
       top$
171
       "-- " bst.file.website *
172
       top$
173
       "-- See the " quote$ * "IEEEtran_bst_HOWTO.pdf" * quote$ * " manual for usage information." *
174
       top$
175
       "** Natbib version - not for normal IEEE work."
176
       top$
177
     }
178
     { skip$ }
179
   if$
180
}
181

    
182
FUNCTION {completed.message}
183
{ is.print.banners.to.terminal
184
     { ""
185
       top$
186
       "Done."
187
       top$
188
     }
189
     { skip$ }
190
   if$
191
}
192

    
193

    
194

    
195

    
196
%%%%%%%%%%%%%%%%%%%%%%
197
%% STRING CONSTANTS %%
198
%%%%%%%%%%%%%%%%%%%%%%
199

    
200
FUNCTION {bbl.and}{ "and" }
201
FUNCTION {bbl.etal}{ "et~al." }
202
FUNCTION {bbl.editors}{ "eds." }
203
FUNCTION {bbl.editor}{ "ed." }
204
FUNCTION {bbl.edition}{ "ed." }
205
FUNCTION {bbl.volume}{ "vol." }
206
FUNCTION {bbl.of}{ "of" }
207
FUNCTION {bbl.number}{ "no." }
208
FUNCTION {bbl.in}{ "in" }
209
FUNCTION {bbl.pages}{ "pp." }
210
FUNCTION {bbl.page}{ "p." }
211
FUNCTION {bbl.chapter}{ "ch." }
212
FUNCTION {bbl.paper}{ "paper" }
213
FUNCTION {bbl.part}{ "pt." }
214
FUNCTION {bbl.patent}{ "Patent" }
215
FUNCTION {bbl.patentUS}{ "U.S." }
216
FUNCTION {bbl.revision}{ "Rev." }
217
FUNCTION {bbl.series}{ "ser." }
218
FUNCTION {bbl.standard}{ "Std." }
219
FUNCTION {bbl.techrep}{ "Tech. Rep." }
220
FUNCTION {bbl.the}{ "The" }
221
FUNCTION {bbl.mthesis}{ "Master's thesis" }
222
FUNCTION {bbl.phdthesis}{ "Ph.D. dissertation" }
223
FUNCTION {bbl.st}{ "st" }
224
FUNCTION {bbl.nd}{ "nd" }
225
FUNCTION {bbl.rd}{ "rd" }
226
FUNCTION {bbl.th}{ "th" }
227

    
228

    
229
% This is the LaTeX spacer that is used when a larger than normal space
230
% is called for (such as just before the address:publisher).
231
FUNCTION {large.space} { "\hskip 1em plus 0.5em minus 0.4em\relax " }
232

    
233
% The LaTeX code for dashes that are used to represent repeated names.
234
% Note: Some older IEEE journals used something like
235
% "\rule{0.275in}{0.5pt}\," which is fairly thick and runs right along
236
% the baseline. However, the IEEE now uses a thinner, above baseline,
237
% six dash long sequence.
238
FUNCTION {repeated.name.dashes} { "------" }
239

    
240

    
241

    
242
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
243
%% PREDEFINED STRING MACROS %%
244
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
245

    
246
MACRO {jan} {"Jan."}
247
MACRO {feb} {"Feb."}
248
MACRO {mar} {"Mar."}
249
MACRO {apr} {"Apr."}
250
MACRO {may} {"May"}
251
MACRO {jun} {"Jun."}
252
MACRO {jul} {"Jul."}
253
MACRO {aug} {"Aug."}
254
MACRO {sep} {"Sep."}
255
MACRO {oct} {"Oct."}
256
MACRO {nov} {"Nov."}
257
MACRO {dec} {"Dec."}
258

    
259

    
260

    
261
%%%%%%%%%%%%%%%%%%
262
%% ENTRY FIELDS %%
263
%%%%%%%%%%%%%%%%%%
264

    
265
ENTRY
266
  { address
267
    assignee
268
    author
269
    booktitle
270
    chapter
271
    day
272
    dayfiled
273
    edition
274
    editor
275
    howpublished
276
    institution
277
    intype
278
    journal
279
    key
280
    language
281
    month
282
    monthfiled
283
    nationality
284
    note
285
    number
286
    organization
287
    pages
288
    paper
289
    publisher
290
    school
291
    series
292
    revision
293
    title
294
    type
295
    url
296
    volume
297
    year
298
    yearfiled
299
    CTLuse_article_number
300
    CTLuse_paper
301
    CTLuse_url
302
    CTLuse_forced_etal
303
    CTLmax_names_forced_etal
304
    CTLnames_show_etal
305
    CTLuse_alt_spacing
306
    CTLalt_stretch_factor
307
    CTLdash_repeated_names
308
    CTLname_format_string
309
    CTLname_latex_cmd
310
    CTLname_url_prefix
311
  }
312
  {}
313
  { label extra.label sort.label short.list}
314

    
315

    
316

    
317

    
318
%%%%%%%%%%%%%%%%%%%%%%%
319
%% INTEGER VARIABLES %%
320
%%%%%%%%%%%%%%%%%%%%%%%
321

    
322
INTEGERS { prev.status.punct this.status.punct punct.std
323
           punct.no punct.comma punct.period 
324
           prev.status.space this.status.space space.std
325
           space.no space.normal space.large
326
           prev.status.quote this.status.quote quote.std
327
           quote.no quote.close
328
           prev.status.nline this.status.nline nline.std
329
           nline.no nline.newblock 
330
           status.cap cap.std
331
           cap.no cap.yes}
332

    
333
INTEGERS { longest.label.width multiresult nameptr namesleft number.label numnames }
334

    
335
INTEGERS { is.use.number.for.article
336
           is.use.paper
337
           is.use.url
338
           is.forced.et.al
339
           max.num.names.before.forced.et.al
340
           num.names.shown.with.forced.et.al
341
           is.use.alt.interword.spacing
342
           is.dash.repeated.names}
343

    
344

    
345
%%%%%%%%%%%%%%%%%%%%%%
346
%% STRING VARIABLES %%
347
%%%%%%%%%%%%%%%%%%%%%%
348

    
349
STRINGS { bibinfo
350
          longest.label
351
          oldname
352
          s
353
          t
354
          ALTinterwordstretchfactor
355
          name.format.string
356
          name.latex.cmd
357
          name.url.prefix}
358

    
359

    
360

    
361

    
362
%%%%%%%%%%%%%%%%%%%%%%%%%
363
%% LOW LEVEL FUNCTIONS %%
364
%%%%%%%%%%%%%%%%%%%%%%%%%
365

    
366
FUNCTION {initialize.controls}
367
{ default.is.use.number.for.article 'is.use.number.for.article :=
368
  default.is.use.paper 'is.use.paper :=
369
  default.is.use.url 'is.use.url :=
370
  default.is.forced.et.al 'is.forced.et.al :=
371
  default.max.num.names.before.forced.et.al 'max.num.names.before.forced.et.al :=
372
  default.num.names.shown.with.forced.et.al 'num.names.shown.with.forced.et.al :=
373
  default.is.use.alt.interword.spacing 'is.use.alt.interword.spacing :=
374
  default.is.dash.repeated.names 'is.dash.repeated.names :=
375
  default.ALTinterwordstretchfactor 'ALTinterwordstretchfactor :=
376
  default.name.format.string 'name.format.string :=
377
  default.name.latex.cmd 'name.latex.cmd :=
378
  default.name.url.prefix 'name.url.prefix :=
379
}
380

    
381

    
382
% This IEEEtran.bst features a very powerful and flexible mechanism for
383
% controlling the capitalization, punctuation, spacing, quotation, and
384
% newlines of the formatted entry fields. (Note: IEEEtran.bst does not need
385
% or use the newline/newblock feature, but it has been implemented for
386
% possible future use.) The output states of IEEEtran.bst consist of
387
% multiple independent attributes and, as such, can be thought of as being
388
% vectors, rather than the simple scalar values ("before.all", 
389
% "mid.sentence", etc.) used in most other .bst files.
390
% 
391
% The more flexible and complex design used here was motivated in part by
392
% the IEEE's rather unusual bibliography style. For example, the IEEE ends the
393
% previous field item with a period and large space prior to the publisher
394
% address; the @electronic entry types use periods as inter-item punctuation
395
% rather than the commas used by the other entry types; and URLs are never
396
% followed by periods even though they are the last item in the entry.
397
% Although it is possible to accommodate these features with the conventional
398
% output state system, the seemingly endless exceptions make for convoluted,
399
% unreliable and difficult to maintain code.
400
%
401
% IEEEtran.bst's output state system can be easily understood via a simple
402
% illustration of two most recently formatted entry fields (on the stack):
403
%
404
%               CURRENT_ITEM
405
%               "PREVIOUS_ITEM
406
%
407
% which, in this example, is to eventually appear in the bibliography as:
408
% 
409
%               "PREVIOUS_ITEM," CURRENT_ITEM
410
%
411
% It is the job of the output routine to take the previous item off of the
412
% stack (while leaving the current item at the top of the stack), apply its
413
% trailing punctuation (including closing quote marks) and spacing, and then
414
% to write the result to BibTeX's output buffer:
415
% 
416
%               "PREVIOUS_ITEM," 
417
% 
418
% Punctuation (and spacing) between items is often determined by both of the
419
% items rather than just the first one. The presence of quotation marks
420
% further complicates the situation because, in standard English, trailing
421
% punctuation marks are supposed to be contained within the quotes.
422
% 
423
% IEEEtran.bst maintains two output state (aka "status") vectors which
424
% correspond to the previous and current (aka "this") items. Each vector
425
% consists of several independent attributes which track punctuation,
426
% spacing, quotation, and newlines. Capitalization status is handled by a
427
% separate scalar because the format routines, not the output routine,
428
% handle capitalization and, therefore, there is no need to maintain the
429
% capitalization attribute for both the "previous" and "this" items.
430
% 
431
% When a format routine adds a new item, it copies the current output status
432
% vector to the previous output status vector and (usually) resets the
433
% current (this) output status vector to a "standard status" vector. Using a
434
% "standard status" vector in this way allows us to redefine what we mean by
435
% "standard status" at the start of each entry handler and reuse the same
436
% format routines under the various inter-item separation schemes. For
437
% example, the standard status vector for the @book entry type may use
438
% commas for item separators, while the @electronic type may use periods,
439
% yet both entry handlers exploit many of the exact same format routines.
440
% 
441
% Because format routines have write access to the output status vector of
442
% the previous item, they can override the punctuation choices of the
443
% previous format routine! Therefore, it becomes trivial to implement rules
444
% such as "Always use a period and a large space before the publisher." By
445
% pushing the generation of the closing quote mark to the output routine, we
446
% avoid all the problems caused by having to close a quote before having all
447
% the information required to determine what the punctuation should be.
448
%
449
% The IEEEtran.bst output state system can easily be expanded if needed.
450
% For instance, it is easy to add a "space.tie" attribute value if the
451
% bibliography rules mandate that two items have to be joined with an
452
% unbreakable space. 
453

    
454
FUNCTION {initialize.status.constants}
455
{ #0 'punct.no :=
456
  #1 'punct.comma :=
457
  #2 'punct.period :=
458
  #0 'space.no := 
459
  #1 'space.normal :=
460
  #2 'space.large :=
461
  #0 'quote.no :=
462
  #1 'quote.close :=
463
  #0 'cap.no :=
464
  #1 'cap.yes :=
465
  #0 'nline.no :=
466
  #1 'nline.newblock :=
467
}
468

    
469
FUNCTION {std.status.using.comma}
470
{ punct.comma 'punct.std :=
471
  space.normal 'space.std :=
472
  quote.no 'quote.std :=
473
  nline.no 'nline.std :=
474
  cap.no 'cap.std :=
475
}
476

    
477
FUNCTION {std.status.using.period}
478
{ punct.period 'punct.std :=
479
  space.normal 'space.std :=
480
  quote.no 'quote.std :=
481
  nline.no 'nline.std :=
482
  cap.yes 'cap.std :=
483
}
484

    
485
FUNCTION {initialize.prev.this.status}
486
{ punct.no 'prev.status.punct :=
487
  space.no 'prev.status.space :=
488
  quote.no 'prev.status.quote :=
489
  nline.no 'prev.status.nline :=
490
  punct.no 'this.status.punct :=
491
  space.no 'this.status.space :=
492
  quote.no 'this.status.quote :=
493
  nline.no 'this.status.nline :=
494
  cap.yes 'status.cap :=
495
}
496

    
497
FUNCTION {this.status.std}
498
{ punct.std 'this.status.punct :=
499
  space.std 'this.status.space :=
500
  quote.std 'this.status.quote :=
501
  nline.std 'this.status.nline :=
502
}
503

    
504
FUNCTION {cap.status.std}{ cap.std 'status.cap := }
505

    
506
FUNCTION {this.to.prev.status}
507
{ this.status.punct 'prev.status.punct :=
508
  this.status.space 'prev.status.space :=
509
  this.status.quote 'prev.status.quote :=
510
  this.status.nline 'prev.status.nline :=
511
}
512

    
513

    
514
FUNCTION {not}
515
{   { #0 }
516
    { #1 }
517
  if$
518
}
519

    
520
FUNCTION {and}
521
{   { skip$ }
522
    { pop$ #0 }
523
  if$
524
}
525

    
526
FUNCTION {or}
527
{   { pop$ #1 }
528
    { skip$ }
529
  if$
530
}
531

    
532

    
533
% convert the strings "yes" or "no" to #1 or #0 respectively
534
FUNCTION {yes.no.to.int}
535
{ "l" change.case$ duplicate$
536
    "yes" =
537
    { pop$  #1 }
538
    { duplicate$ "no" =
539
        { pop$ #0 }
540
        { "unknown boolean " quote$ * swap$ * quote$ *
541
          " in " * cite$ * warning$
542
          #0
543
        }
544
      if$
545
    }
546
  if$
547
}
548

    
549

    
550
% pushes true if the single char string on the stack is in the
551
% range of "0" to "9"
552
FUNCTION {is.num}
553
{ chr.to.int$
554
  duplicate$ "0" chr.to.int$ < not
555
  swap$ "9" chr.to.int$ > not and
556
}
557

    
558
% multiplies the integer on the stack by a factor of 10
559
FUNCTION {bump.int.mag}
560
{ #0 'multiresult :=
561
    { duplicate$ #0 > }
562
    { #1 -
563
      multiresult #10 +
564
      'multiresult :=
565
    }
566
  while$
567
pop$
568
multiresult
569
}
570

    
571
% converts a single character string on the stack to an integer
572
FUNCTION {char.to.integer}
573
{ duplicate$ 
574
  is.num
575
    { chr.to.int$ "0" chr.to.int$ - }
576
    {"noninteger character " quote$ * swap$ * quote$ *
577
          " in integer field of " * cite$ * warning$
578
    #0
579
    }
580
  if$
581
}
582

    
583
% converts a string on the stack to an integer
584
FUNCTION {string.to.integer}
585
{ duplicate$ text.length$ 'namesleft :=
586
  #1 'nameptr :=
587
  #0 'numnames :=
588
    { nameptr namesleft > not }
589
    { duplicate$ nameptr #1 substring$
590
      char.to.integer numnames bump.int.mag +
591
      'numnames :=
592
      nameptr #1 +
593
      'nameptr :=
594
    }
595
  while$
596
pop$
597
numnames
598
}
599

    
600

    
601

    
602

    
603
% The output routines write out the *next* to the top (previous) item on the
604
% stack, adding punctuation and such as needed. Since IEEEtran.bst maintains
605
% the output status for the top two items on the stack, these output
606
% routines have to consider the previous output status (which corresponds to
607
% the item that is being output). Full independent control of punctuation,
608
% closing quote marks, spacing, and newblock is provided.
609
% 
610
% "output.nonnull" does not check for the presence of a previous empty
611
% item.
612
% 
613
% "output" does check for the presence of a previous empty item and will
614
% remove an empty item rather than outputing it.
615
% 
616
% "output.warn" is like "output", but will issue a warning if it detects
617
% an empty item.
618

    
619
FUNCTION {output.nonnull}
620
{ swap$
621
  prev.status.punct punct.comma =
622
     { "," * }
623
     { skip$ }
624
   if$
625
  prev.status.punct punct.period =
626
     { add.period$ }
627
     { skip$ }
628
   if$ 
629
  prev.status.quote quote.close =
630
     { "''" * }
631
     { skip$ }
632
   if$
633
  prev.status.space space.normal =
634
     { " " * }
635
     { skip$ }
636
   if$
637
  prev.status.space space.large =
638
     { large.space * }
639
     { skip$ }
640
   if$
641
  write$
642
  prev.status.nline nline.newblock =
643
     { newline$ "\newblock " write$ }
644
     { skip$ }
645
   if$
646
}
647

    
648
FUNCTION {output}
649
{ duplicate$ empty$
650
    'pop$
651
    'output.nonnull
652
  if$
653
}
654

    
655
FUNCTION {output.warn}
656
{ 't :=
657
  duplicate$ empty$
658
    { pop$ "empty " t * " in " * cite$ * warning$ }
659
    'output.nonnull
660
  if$
661
}
662

    
663
% "fin.entry" is the output routine that handles the last item of the entry
664
% (which will be on the top of the stack when "fin.entry" is called).
665

    
666
FUNCTION {fin.entry}
667
{ this.status.punct punct.no =
668
     { skip$ }
669
     { add.period$ }
670
   if$
671
   this.status.quote quote.close =
672
     { "''" * }
673
     { skip$ }
674
   if$
675
write$
676
newline$
677
}
678

    
679

    
680
FUNCTION {is.last.char.not.punct}
681
{ duplicate$
682
   "}" * add.period$
683
   #-1 #1 substring$ "." =
684
}
685

    
686
FUNCTION {is.multiple.pages}
687
{ 't :=
688
  #0 'multiresult :=
689
    { multiresult not
690
      t empty$ not
691
      and
692
    }
693
    { t #1 #1 substring$
694
      duplicate$ "-" =
695
      swap$ duplicate$ "," =
696
      swap$ "+" =
697
      or or
698
        { #1 'multiresult := }
699
        { t #2 global.max$ substring$ 't := }
700
      if$
701
    }
702
  while$
703
  multiresult
704
}
705

    
706
FUNCTION {capitalize}{ "u" change.case$ "t" change.case$ }
707

    
708
FUNCTION {emphasize}
709
{ duplicate$ empty$
710
    { pop$ "" }
711
    { "\emph{" swap$ * "}" * }
712
  if$
713
}
714

    
715
FUNCTION {do.name.latex.cmd}
716
{ name.latex.cmd
717
  empty$
718
    { skip$ }
719
    { name.latex.cmd "{" * swap$ * "}" * }
720
  if$
721
}
722

    
723
% IEEEtran.bst uses its own \BIBforeignlanguage command which directly
724
% invokes the TeX hyphenation patterns without the need of the Babel
725
% package. Babel does a lot more than switch hyphenation patterns and
726
% its loading can cause unintended effects in many class files (such as
727
% IEEEtran.cls).
728
FUNCTION {select.language}
729
{ duplicate$ empty$ 'pop$
730
    { language empty$ 'skip$
731
        { "\BIBforeignlanguage{" language * "}{" * swap$ * "}" * }
732
      if$
733
    }
734
  if$
735
}
736

    
737
FUNCTION {tie.or.space.prefix}
738
{ duplicate$ text.length$ #3 <
739
    { "~" }
740
    { " " }
741
  if$
742
  swap$
743
}
744

    
745
FUNCTION {get.bbl.editor}
746
{ editor num.names$ #1 > 'bbl.editors 'bbl.editor if$ }
747

    
748
FUNCTION {space.word}{ " " swap$ * " " * }
749

    
750

    
751
% Field Conditioners, Converters, Checkers and External Interfaces
752

    
753
FUNCTION {empty.field.to.null.string}
754
{ duplicate$ empty$
755
    { pop$ "" }
756
    { skip$ }
757
  if$
758
}
759

    
760
FUNCTION {either.or.check}
761
{ empty$
762
    { pop$ }
763
    { "can't use both " swap$ * " fields in " * cite$ * warning$ }
764
  if$
765
}
766

    
767
FUNCTION {empty.entry.warn}
768
{ author empty$ title empty$ howpublished empty$
769
  month empty$ year empty$ note empty$ url empty$
770
  and and and and and and
771
    { "all relevant fields are empty in " cite$ * warning$ }
772
    'skip$
773
  if$
774
}
775

    
776

    
777
% The bibinfo system provides a way for the electronic parsing/acquisition
778
% of a bibliography's contents as is done by ReVTeX. For example, a field
779
% could be entered into the bibliography as:
780
% \bibinfo{volume}{2}
781
% Only the "2" would show up in the document, but the LaTeX \bibinfo command
782
% could do additional things with the information. IEEEtran.bst does provide
783
% a \bibinfo command via "\providecommand{\bibinfo}[2]{#2}". However, it is
784
% currently not used as the bogus bibinfo functions defined here output the
785
% entry values directly without the \bibinfo wrapper. The bibinfo functions
786
% themselves (and the calls to them) are retained for possible future use.
787
% 
788
% bibinfo.check avoids acting on missing fields while bibinfo.warn will
789
% issue a warning message if a missing field is detected. Prior to calling
790
% the bibinfo functions, the user should push the field value and then its
791
% name string, in that order.
792

    
793
FUNCTION {bibinfo.check}
794
{ swap$ duplicate$ missing$
795
    { pop$ pop$ "" }
796
    { duplicate$ empty$
797
        { swap$ pop$ }
798
        { swap$ pop$ }
799
      if$
800
    }
801
  if$
802
}
803

    
804
FUNCTION {bibinfo.warn}
805
{ swap$ duplicate$ missing$
806
    { swap$ "missing " swap$ * " in " * cite$ * warning$ pop$ "" }
807
    { duplicate$ empty$
808
        { swap$ "empty " swap$ * " in " * cite$ * warning$ }
809
        { swap$ pop$ }
810
      if$
811
    }
812
  if$
813
}
814

    
815

    
816
% The IEEE separates large numbers with more than 4 digits into groups of
817
% three. The IEEE uses a small space to separate these number groups. 
818
% Typical applications include patent and page numbers.
819

    
820
% number of consecutive digits required to trigger the group separation.
821
FUNCTION {large.number.trigger}{ #5 }
822

    
823
% For numbers longer than the trigger, this is the blocksize of the groups.
824
% The blocksize must be less than the trigger threshold, and 2 * blocksize
825
% must be greater than the trigger threshold (can't do more than one
826
% separation on the initial trigger).
827
FUNCTION {large.number.blocksize}{ #3 }
828

    
829
% What is actually inserted between the number groups.
830
FUNCTION {large.number.separator}{ "\," }
831

    
832
% So as to save on integer variables by reusing existing ones, numnames
833
% holds the current number of consecutive digits read and nameptr holds
834
% the number that will trigger an inserted space.
835
FUNCTION {large.number.separate}
836
{ 't :=
837
  ""
838
  #0 'numnames :=
839
  large.number.trigger 'nameptr :=
840
  { t empty$ not }
841
  { t #-1 #1 substring$ is.num
842
      { numnames #1 + 'numnames := }
843
      { #0 'numnames := 
844
        large.number.trigger 'nameptr :=
845
      }
846
    if$
847
    t #-1 #1 substring$ swap$ *
848
    t #-2 global.max$ substring$ 't :=
849
    numnames nameptr =
850
      { duplicate$ #1 nameptr large.number.blocksize - substring$ swap$
851
        nameptr large.number.blocksize - #1 + global.max$ substring$
852
        large.number.separator swap$ * *
853
        nameptr large.number.blocksize - 'numnames :=
854
        large.number.blocksize #1 + 'nameptr :=
855
      }
856
      { skip$ }
857
    if$
858
  }
859
  while$
860
}
861

    
862
% Converts all single dashes "-" to double dashes "--".
863
FUNCTION {n.dashify}
864
{ large.number.separate
865
  't :=
866
  ""
867
    { t empty$ not }
868
    { t #1 #1 substring$ "-" =
869
        { t #1 #2 substring$ "--" = not
870
            { "--" *
871
              t #2 global.max$ substring$ 't :=
872
            }
873
            {   { t #1 #1 substring$ "-" = }
874
                { "-" *
875
                  t #2 global.max$ substring$ 't :=
876
                }
877
              while$
878
            }
879
          if$
880
        }
881
        { t #1 #1 substring$ *
882
          t #2 global.max$ substring$ 't :=
883
        }
884
      if$
885
    }
886
  while$
887
}
888

    
889

    
890
% This function detects entries with names that are identical to that of
891
% the previous entry and replaces the repeated names with dashes (if the
892
% "is.dash.repeated.names" user control is nonzero).
893
FUNCTION {name.or.dash}
894
{ 's :=
895
   oldname empty$
896
     { s 'oldname := s }
897
     { s oldname =
898
         { is.dash.repeated.names
899
              { repeated.name.dashes }
900
              { s 'oldname := s }
901
            if$
902
         }
903
         { s 'oldname := s }
904
       if$
905
     }
906
   if$
907
}
908

    
909
% Converts the number string on the top of the stack to
910
% "numerical ordinal form" (e.g., "7" to "7th"). There is
911
% no artificial limit to the upper bound of the numbers as the
912
% two least significant digits determine the ordinal form.
913
FUNCTION {num.to.ordinal}
914
{ duplicate$ #-2 #1 substring$ "1" =
915
      { bbl.th * }
916
      { duplicate$ #-1 #1 substring$ "1" =
917
          { bbl.st * }
918
          { duplicate$ #-1 #1 substring$ "2" =
919
              { bbl.nd * }
920
              { duplicate$ #-1 #1 substring$ "3" =
921
                  { bbl.rd * }
922
                  { bbl.th * }
923
                if$
924
              }
925
            if$
926
          }
927
        if$
928
      }
929
    if$
930
}
931

    
932
% If the string on the top of the stack begins with a number,
933
% (e.g., 11th) then replace the string with the leading number
934
% it contains. Otherwise retain the string as-is. s holds the
935
% extracted number, t holds the part of the string that remains
936
% to be scanned.
937
FUNCTION {extract.num}
938
{ duplicate$ 't :=
939
  "" 's :=
940
  { t empty$ not }
941
  { t #1 #1 substring$
942
    t #2 global.max$ substring$ 't :=
943
    duplicate$ is.num
944
      { s swap$ * 's := }
945
      { pop$ "" 't := }
946
    if$
947
  }
948
  while$
949
  s empty$
950
    'skip$
951
    { pop$ s }
952
  if$
953
}
954

    
955
% Converts the word number string on the top of the stack to
956
% Arabic string form. Will be successful up to "tenth".
957
FUNCTION {word.to.num}
958
{ duplicate$ "l" change.case$ 's :=
959
  s "first" =
960
    { pop$ "1" }
961
    { skip$ }
962
  if$
963
  s "second" =
964
    { pop$ "2" }
965
    { skip$ }
966
  if$
967
  s "third" =
968
    { pop$ "3" }
969
    { skip$ }
970
  if$
971
  s "fourth" =
972
    { pop$ "4" }
973
    { skip$ }
974
  if$
975
  s "fifth" =
976
    { pop$ "5" }
977
    { skip$ }
978
  if$
979
  s "sixth" =
980
    { pop$ "6" }
981
    { skip$ }
982
  if$
983
  s "seventh" =
984
    { pop$ "7" }
985
    { skip$ }
986
  if$
987
  s "eighth" =
988
    { pop$ "8" }
989
    { skip$ }
990
  if$
991
  s "ninth" =
992
    { pop$ "9" }
993
    { skip$ }
994
  if$
995
  s "tenth" =
996
    { pop$ "10" }
997
    { skip$ }
998
  if$
999
}
1000

    
1001

    
1002
% Converts the string on the top of the stack to numerical
1003
% ordinal (e.g., "11th") form.
1004
FUNCTION {convert.edition}
1005
{ duplicate$ empty$ 'skip$
1006
    { duplicate$ #1 #1 substring$ is.num
1007
        { extract.num
1008
          num.to.ordinal
1009
        }
1010
        { word.to.num
1011
          duplicate$ #1 #1 substring$ is.num
1012
            { num.to.ordinal }
1013
            { "edition ordinal word " quote$ * edition * quote$ *
1014
              " may be too high (or improper) for conversion" * " in " * cite$ * warning$
1015
            }
1016
          if$
1017
        }
1018
      if$
1019
    }
1020
  if$
1021
}
1022

    
1023

    
1024

    
1025

    
1026
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1027
%% LATEX BIBLIOGRAPHY CODE %%
1028
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1029

    
1030
% from plainnat.bst
1031
FUNCTION {format.full.names}
1032
{'s :=
1033
  #1 'nameptr :=
1034
  s num.names$ 'numnames :=
1035
  numnames 'namesleft :=
1036
    { namesleft #0 > }
1037
    { s nameptr
1038
      "{vv~}{ll}" format.name$ 't :=
1039
      nameptr #1 >
1040
        {
1041
          namesleft #1 >
1042
            { ", " * t * }
1043
            {
1044
              numnames #2 >
1045
                { "," * }
1046
                'skip$
1047
              if$
1048
              t "others" =
1049
                { " " bbl.etal * * }
1050
                { " " bbl.and * " " * * t * }
1051
              if$
1052
            }
1053
          if$
1054
        }
1055
        't
1056
      if$
1057
      nameptr #1 + 'nameptr :=
1058
      namesleft #1 - 'namesleft :=
1059
    }
1060
  while$
1061
}
1062

    
1063
FUNCTION {author.editor.full}
1064
{ author empty$
1065
    { editor empty$
1066
        { "" }
1067
        { editor format.full.names }
1068
      if$
1069
    }
1070
    { author format.full.names }
1071
  if$
1072
}
1073

    
1074
FUNCTION {author.full}
1075
{ author empty$
1076
    { "" }
1077
    { author format.full.names }
1078
  if$
1079
}
1080

    
1081
FUNCTION {editor.full}
1082
{ editor empty$
1083
    { "" }
1084
    { editor format.full.names }
1085
  if$
1086
}
1087

    
1088
FUNCTION {make.full.names}
1089
{ type$ "book" =
1090
  type$ "inbook" =
1091
  or
1092
    { author.editor.full }
1093
    { type$ "proceedings" =
1094
      type$ "periodical" =
1095
      or
1096
        { editor.full }
1097
        { author.full }
1098
      if$
1099
    }
1100
  if$
1101
}
1102
% END from plainnat.bst
1103

    
1104
FUNCTION {start.entry}
1105
{ newline$
1106
  "\bibitem[" write$
1107
  label write$
1108
  ")" make.full.names duplicate$ short.list =
1109
     { pop$ }
1110
     { * }
1111
   if$
1112
  "]{" * write$
1113
  cite$ write$
1114
  "}" write$
1115
  newline$
1116
  ""
1117
  initialize.prev.this.status
1118
}
1119

    
1120
% Here we write out all the LaTeX code that we will need. The most involved
1121
% code sequences are those that control the alternate interword spacing and
1122
% foreign language hyphenation patterns. The heavy use of \providecommand
1123
% gives users a way to override the defaults. Special thanks to Javier Bezos,
1124
% Johannes Braams, Robin Fairbairns, Heiko Oberdiek, Donald Arseneau and all
1125
% the other gurus on comp.text.tex for their help and advice on the topic of
1126
% \selectlanguage, Babel and BibTeX.
1127
FUNCTION {begin.bib}
1128
{ "% Generated by IEEEtranN.bst, version: " bst.file.version * " (" * bst.file.date * ")" *
1129
  write$ newline$
1130
  preamble$ empty$ 'skip$
1131
    { preamble$ write$ newline$ }
1132
  if$
1133
  "\begin{thebibliography}{" number.label int.to.str$ * "}" *
1134
  write$ newline$
1135
  "\providecommand{\natexlab}[1]{#1}"
1136
  write$ newline$
1137
  "\providecommand{\url}[1]{#1}"
1138
  write$ newline$
1139
  "\csname url@samestyle\endcsname"
1140
  write$ newline$
1141
  "\providecommand{\newblock}{\relax}"
1142
  write$ newline$
1143
  "\providecommand{\bibinfo}[2]{#2}"
1144
  write$ newline$
1145
  "\providecommand{\BIBentrySTDinterwordspacing}{\spaceskip=0pt\relax}"
1146
  write$ newline$
1147
  "\providecommand{\BIBentryALTinterwordstretchfactor}{"
1148
  ALTinterwordstretchfactor * "}" *
1149
  write$ newline$
1150
  "\providecommand{\BIBentryALTinterwordspacing}{\spaceskip=\fontdimen2\font plus "
1151
  write$ newline$
1152
  "\BIBentryALTinterwordstretchfactor\fontdimen3\font minus \fontdimen4\font\relax}"
1153
  write$ newline$
1154
  "\providecommand{\BIBforeignlanguage}[2]{{%"
1155
  write$ newline$
1156
  "\expandafter\ifx\csname l@#1\endcsname\relax"
1157
  write$ newline$
1158
  "\typeout{** WARNING: IEEEtranN.bst: No hyphenation pattern has been}%"
1159
  write$ newline$
1160
  "\typeout{** loaded for the language `#1'. Using the pattern for}%"
1161
  write$ newline$
1162
  "\typeout{** the default language instead.}%"
1163
  write$ newline$
1164
  "\else"
1165
  write$ newline$
1166
  "\language=\csname l@#1\endcsname"
1167
  write$ newline$
1168
  "\fi"
1169
  write$ newline$
1170
  "#2}}"
1171
  write$ newline$
1172
  "\providecommand{\BIBdecl}{\relax}"
1173
  write$ newline$
1174
  "\BIBdecl"
1175
  write$ newline$
1176
}
1177

    
1178
FUNCTION {end.bib}
1179
{ newline$ "\end{thebibliography}" write$ newline$ }
1180

    
1181
FUNCTION {if.url.alt.interword.spacing}
1182
{ is.use.alt.interword.spacing
1183
    { is.use.url
1184
        { url empty$ 'skip$ {"\BIBentryALTinterwordspacing" write$ newline$} if$ }
1185
        { skip$ }
1186
      if$
1187
    }
1188
    { skip$ }
1189
  if$
1190
}
1191

    
1192
FUNCTION {if.url.std.interword.spacing}
1193
{ is.use.alt.interword.spacing
1194
    { is.use.url
1195
        { url empty$ 'skip$ {"\BIBentrySTDinterwordspacing" write$ newline$} if$ }
1196
        { skip$ }
1197
      if$
1198
    }
1199
    { skip$ }
1200
  if$
1201
}
1202

    
1203

    
1204

    
1205

    
1206
%%%%%%%%%%%%%%%%%%%%%
1207
%% FORMAT HANDLERS %%
1208
%%%%%%%%%%%%%%%%%%%%%
1209

    
1210
%% Lower Level Formats (used by higher level formats)
1211

    
1212
FUNCTION {format.address.org.or.pub.date}
1213
{ 't :=
1214
  ""
1215
  year empty$
1216
    { "empty year in " cite$ * warning$ }
1217
    { skip$ }
1218
  if$
1219
  address empty$ t empty$ and
1220
  year empty$ and month empty$ and
1221
    { skip$ }
1222
    { this.to.prev.status
1223
      this.status.std
1224
      cap.status.std
1225
      address "address" bibinfo.check *
1226
      t empty$
1227
        { skip$ }
1228
        { punct.period 'prev.status.punct :=
1229
          space.large 'prev.status.space :=
1230
          address empty$
1231
            { skip$ }
1232
            { ": " * }
1233
          if$
1234
          t *
1235
        }
1236
      if$
1237
      year empty$ month empty$ and
1238
        { skip$ }
1239
        { t empty$ address empty$ and
1240
            { skip$ }
1241
            { ", " * }
1242
          if$
1243
          month empty$
1244
            { year empty$
1245
                { skip$ }
1246
                { year "year" bibinfo.check * }
1247
              if$
1248
            }
1249
            { month "month" bibinfo.check *
1250
              year empty$
1251
                 { skip$ }
1252
                 { " " * year "year" bibinfo.check * }
1253
              if$
1254
            }
1255
          if$
1256
        }
1257
      if$
1258
    }
1259
  if$
1260
}
1261

    
1262

    
1263
FUNCTION {format.names}
1264
{ 'bibinfo :=
1265
  duplicate$ empty$ 'skip$ {
1266
  this.to.prev.status
1267
  this.status.std
1268
  's :=
1269
  "" 't :=
1270
  #1 'nameptr :=
1271
  s num.names$ 'numnames :=
1272
  numnames 'namesleft :=
1273
    { namesleft #0 > }
1274
    { s nameptr
1275
      name.format.string
1276
      format.name$
1277
      bibinfo bibinfo.check
1278
      't :=
1279
      nameptr #1 >
1280
        { nameptr num.names.shown.with.forced.et.al #1 + =
1281
          numnames max.num.names.before.forced.et.al >
1282
          is.forced.et.al and and
1283
            { "others" 't :=
1284
              #1 'namesleft :=
1285
            }
1286
            { skip$ }
1287
          if$
1288
          namesleft #1 >
1289
            { ", " * t do.name.latex.cmd * }
1290
            { s nameptr "{ll}" format.name$ duplicate$ "others" =
1291
                { 't := }
1292
                { pop$ }
1293
              if$
1294
              t "others" =
1295
                { " " * bbl.etal emphasize * }
1296
                { numnames #2 >
1297
                    { "," * }
1298
                    { skip$ }
1299
                  if$
1300
                  bbl.and
1301
                  space.word * t do.name.latex.cmd *
1302
                }
1303
              if$
1304
            }
1305
          if$
1306
        }
1307
        { t do.name.latex.cmd }
1308
      if$
1309
      nameptr #1 + 'nameptr :=
1310
      namesleft #1 - 'namesleft :=
1311
    }
1312
  while$
1313
  cap.status.std
1314
  } if$
1315
}
1316

    
1317

    
1318

    
1319

    
1320
%% Higher Level Formats
1321

    
1322
%% addresses/locations
1323

    
1324
FUNCTION {format.address}
1325
{ address duplicate$ empty$ 'skip$
1326
    { this.to.prev.status
1327
      this.status.std
1328
      cap.status.std
1329
    }
1330
  if$
1331
}
1332

    
1333

    
1334

    
1335
%% author/editor names
1336

    
1337
FUNCTION {format.authors}{ author "author" format.names }
1338

    
1339
FUNCTION {format.editors}
1340
{ editor "editor" format.names duplicate$ empty$ 'skip$
1341
    { ", " *
1342
      get.bbl.editor
1343
      capitalize
1344
      *
1345
    }
1346
  if$
1347
}
1348

    
1349

    
1350

    
1351
%% date
1352

    
1353
FUNCTION {format.date}
1354
{
1355
  month "month" bibinfo.check duplicate$ empty$
1356
  year  "year" bibinfo.check duplicate$ empty$
1357
    { swap$ 'skip$
1358
        { this.to.prev.status
1359
          this.status.std
1360
          cap.status.std
1361
         "there's a month but no year in " cite$ * warning$ }
1362
      if$
1363
      *
1364
    }
1365
    { this.to.prev.status
1366
      this.status.std
1367
      cap.status.std
1368
      swap$ 'skip$
1369
        {
1370
          swap$
1371
          " " * swap$
1372
        }
1373
      if$
1374
      *
1375
    }
1376
  if$
1377
}
1378

    
1379
FUNCTION {format.date.electronic}
1380
{ month "month" bibinfo.check duplicate$ empty$
1381
  year  "year" bibinfo.check duplicate$ empty$
1382
    { swap$ 
1383
        { pop$ }
1384
        { "there's a month but no year in " cite$ * warning$
1385
        pop$ ")" * "(" swap$ *
1386
        this.to.prev.status
1387
        punct.no 'this.status.punct :=
1388
        space.normal 'this.status.space :=
1389
        quote.no 'this.status.quote :=
1390
        cap.yes  'status.cap :=
1391
        }
1392
      if$
1393
    }
1394
    { swap$ 
1395
        { swap$ pop$ ")" * "(" swap$ * }
1396
        { "(" swap$ * ", " * swap$ * ")" * }
1397
      if$
1398
    this.to.prev.status
1399
    punct.no 'this.status.punct :=
1400
    space.normal 'this.status.space :=
1401
    quote.no 'this.status.quote :=
1402
    cap.yes  'status.cap :=
1403
    }
1404
  if$
1405
}
1406

    
1407

    
1408

    
1409
%% edition/title
1410

    
1411
% Note: The IEEE considers the edition to be closely associated with
1412
% the title of a book. So, in IEEEtran.bst the edition is normally handled 
1413
% within the formatting of the title. The format.edition function is 
1414
% retained here for possible future use.
1415
FUNCTION {format.edition}
1416
{ edition duplicate$ empty$ 'skip$
1417
    { this.to.prev.status
1418
      this.status.std
1419
      convert.edition
1420
      status.cap
1421
        { "t" }
1422
        { "l" }
1423
      if$ change.case$
1424
      "edition" bibinfo.check
1425
      "~" * bbl.edition *
1426
      cap.status.std
1427
    }
1428
  if$
1429
}
1430

    
1431
% This is used to format the booktitle of a conference proceedings.
1432
% Here we use the "intype" field to provide the user a way to 
1433
% override the word "in" (e.g., with things like "presented at")
1434
% Use of intype stops the emphasis of the booktitle to indicate that
1435
% we no longer mean the written conference proceedings, but the
1436
% conference itself.
1437
FUNCTION {format.in.booktitle}
1438
{ booktitle "booktitle" bibinfo.check duplicate$ empty$ 'skip$
1439
    { this.to.prev.status
1440
      this.status.std
1441
      select.language
1442
      intype missing$
1443
        { emphasize
1444
          bbl.in " " *
1445
        }
1446
        { intype " " * }
1447
      if$
1448
      swap$ *
1449
      cap.status.std
1450
    }
1451
  if$
1452
}
1453

    
1454
% This is used to format the booktitle of collection.
1455
% Here the "intype" field is not supported, but "edition" is.
1456
FUNCTION {format.in.booktitle.edition}
1457
{ booktitle "booktitle" bibinfo.check duplicate$ empty$ 'skip$
1458
    { this.to.prev.status
1459
      this.status.std
1460
      select.language
1461
      emphasize
1462
      edition empty$ 'skip$
1463
        { ", " *
1464
          edition
1465
          convert.edition
1466
          "l" change.case$
1467
          * "~" * bbl.edition *
1468
        }
1469
      if$
1470
      bbl.in " " * swap$ *
1471
      cap.status.std
1472
    }
1473
  if$
1474
}
1475

    
1476
FUNCTION {format.article.title}
1477
{ title duplicate$ empty$ 'skip$
1478
    { this.to.prev.status
1479
      this.status.std
1480
      "t" change.case$
1481
    }
1482
  if$
1483
  "title" bibinfo.check
1484
  duplicate$ empty$ 'skip$
1485
    { quote.close 'this.status.quote :=
1486
      is.last.char.not.punct
1487
        { punct.std 'this.status.punct := }
1488
        { punct.no 'this.status.punct := }
1489
      if$
1490
      select.language
1491
      "``" swap$ *
1492
      cap.status.std
1493
    }
1494
  if$
1495
}
1496

    
1497
FUNCTION {format.article.title.electronic}
1498
{ title duplicate$ empty$ 'skip$
1499
    { this.to.prev.status
1500
      this.status.std
1501
      cap.status.std
1502
      "t" change.case$ 
1503
    }
1504
  if$
1505
  "title" bibinfo.check
1506
  duplicate$ empty$ 
1507
    { skip$ } 
1508
    { select.language }
1509
  if$
1510
}
1511

    
1512
FUNCTION {format.book.title.edition}
1513
{ title "title" bibinfo.check
1514
  duplicate$ empty$
1515
    { "empty title in " cite$ * warning$ }
1516
    { this.to.prev.status
1517
      this.status.std
1518
      select.language
1519
      emphasize
1520
      edition empty$ 'skip$
1521
        { ", " *
1522
          edition
1523
          convert.edition
1524
          status.cap
1525
            { "t" }
1526
            { "l" }
1527
          if$
1528
          change.case$
1529
          * "~" * bbl.edition *
1530
        }
1531
      if$
1532
      cap.status.std
1533
    }
1534
  if$
1535
}
1536

    
1537
FUNCTION {format.book.title}
1538
{ title "title" bibinfo.check
1539
  duplicate$ empty$ 'skip$
1540
    { this.to.prev.status
1541
      this.status.std
1542
      cap.status.std
1543
      select.language
1544
      emphasize
1545
    }
1546
  if$
1547
}
1548

    
1549

    
1550

    
1551
%% journal
1552

    
1553
FUNCTION {format.journal}
1554
{ journal duplicate$ empty$ 'skip$
1555
    { this.to.prev.status
1556
      this.status.std
1557
      cap.status.std
1558
      select.language
1559
      emphasize
1560
    }
1561
  if$
1562
}
1563

    
1564

    
1565

    
1566
%% how published
1567

    
1568
FUNCTION {format.howpublished}
1569
{ howpublished duplicate$ empty$ 'skip$
1570
    { this.to.prev.status
1571
      this.status.std
1572
      cap.status.std
1573
    }
1574
  if$
1575
}
1576

    
1577

    
1578

    
1579
%% institutions/organization/publishers/school
1580

    
1581
FUNCTION {format.institution}
1582
{ institution duplicate$ empty$ 'skip$
1583
    { this.to.prev.status
1584
      this.status.std
1585
      cap.status.std
1586
    }
1587
  if$
1588
}
1589

    
1590
FUNCTION {format.organization}
1591
{ organization duplicate$ empty$ 'skip$
1592
    { this.to.prev.status
1593
      this.status.std
1594
      cap.status.std
1595
    }
1596
  if$
1597
}
1598

    
1599
FUNCTION {format.address.publisher.date}
1600
{ publisher "publisher" bibinfo.warn format.address.org.or.pub.date }
1601

    
1602
FUNCTION {format.address.publisher.date.nowarn}
1603
{ publisher "publisher" bibinfo.check format.address.org.or.pub.date }
1604

    
1605
FUNCTION {format.address.organization.date}
1606
{ organization "organization" bibinfo.check format.address.org.or.pub.date }
1607

    
1608
FUNCTION {format.school}
1609
{ school duplicate$ empty$ 'skip$
1610
    { this.to.prev.status
1611
      this.status.std
1612
      cap.status.std
1613
    }
1614
  if$
1615
}
1616

    
1617

    
1618

    
1619
%% volume/number/series/chapter/pages
1620

    
1621
FUNCTION {format.volume}
1622
{ volume empty.field.to.null.string
1623
  duplicate$ empty$ 'skip$
1624
    { this.to.prev.status
1625
      this.status.std
1626
      bbl.volume 
1627
      status.cap
1628
        { capitalize }
1629
        { skip$ }
1630
      if$
1631
      swap$ tie.or.space.prefix
1632
      "volume" bibinfo.check
1633
      * *
1634
      cap.status.std
1635
    }
1636
  if$
1637
}
1638

    
1639
FUNCTION {format.number}
1640
{ number empty.field.to.null.string
1641
  duplicate$ empty$ 'skip$
1642
    { this.to.prev.status
1643
      this.status.std
1644
      status.cap
1645
         { bbl.number capitalize }
1646
         { bbl.number }
1647
       if$
1648
      swap$ tie.or.space.prefix
1649
      "number" bibinfo.check
1650
      * *
1651
      cap.status.std
1652
    }
1653
  if$
1654
}
1655

    
1656
FUNCTION {format.number.if.use.for.article}
1657
{ is.use.number.for.article 
1658
     { format.number }
1659
     { "" }
1660
   if$
1661
}
1662

    
1663
% The IEEE does not seem to tie the series so closely with the volume
1664
% and number as is done in other bibliography styles. Instead the
1665
% series is treated somewhat like an extension of the title.
1666
FUNCTION {format.series}
1667
{ series empty$ 
1668
   { "" }
1669
   { this.to.prev.status
1670
     this.status.std
1671
     bbl.series " " *
1672
     series "series" bibinfo.check *
1673
     cap.status.std
1674
   }
1675
 if$
1676
}
1677

    
1678

    
1679
FUNCTION {format.chapter}
1680
{ chapter empty$
1681
    { "" }
1682
    { this.to.prev.status
1683
      this.status.std
1684
      type empty$
1685
        { bbl.chapter }
1686
        { type "l" change.case$
1687
          "type" bibinfo.check
1688
        }
1689
      if$
1690
      chapter tie.or.space.prefix
1691
      "chapter" bibinfo.check
1692
      * *
1693
      cap.status.std
1694
    }
1695
  if$
1696
}
1697

    
1698

    
1699
% The intended use of format.paper is for paper numbers of inproceedings.
1700
% The paper type can be overridden via the type field.
1701
% We allow the type to be displayed even if the paper number is absent
1702
% for things like "postdeadline paper"
1703
FUNCTION {format.paper}
1704
{ is.use.paper
1705
     { paper empty$
1706
        { type empty$
1707
            { "" }
1708
            { this.to.prev.status
1709
              this.status.std
1710
              type "type" bibinfo.check
1711
              cap.status.std
1712
            }
1713
          if$
1714
        }
1715
        { this.to.prev.status
1716
          this.status.std
1717
          type empty$
1718
            { bbl.paper }
1719
            { type "type" bibinfo.check }
1720
          if$
1721
          " " * paper
1722
          "paper" bibinfo.check
1723
          *
1724
          cap.status.std
1725
        }
1726
      if$
1727
     }
1728
     { "" } 
1729
   if$
1730
}
1731

    
1732

    
1733
FUNCTION {format.pages}
1734
{ pages duplicate$ empty$ 'skip$
1735
    { this.to.prev.status
1736
      this.status.std
1737
      duplicate$ is.multiple.pages
1738
        {
1739
          bbl.pages swap$
1740
          n.dashify
1741
        }
1742
        {
1743
          bbl.page swap$
1744
        }
1745
      if$
1746
      tie.or.space.prefix
1747
      "pages" bibinfo.check
1748
      * *
1749
      cap.status.std
1750
    }
1751
  if$
1752
}
1753

    
1754

    
1755

    
1756
%% technical report number
1757

    
1758
FUNCTION {format.tech.report.number}
1759
{ number "number" bibinfo.check
1760
  this.to.prev.status
1761
  this.status.std
1762
  cap.status.std
1763
  type duplicate$ empty$
1764
    { pop$ 
1765
      bbl.techrep
1766
    }
1767
    { skip$ }
1768
  if$
1769
  "type" bibinfo.check 
1770
  swap$ duplicate$ empty$
1771
    { pop$ }
1772
    { tie.or.space.prefix * * }
1773
  if$
1774
}
1775

    
1776

    
1777

    
1778
%% note
1779

    
1780
FUNCTION {format.note}
1781
{ note empty$
1782
    { "" }
1783
    { this.to.prev.status
1784
      this.status.std
1785
      punct.period 'this.status.punct :=
1786
      note #1 #1 substring$
1787
      duplicate$ "{" =
1788
        { skip$ }
1789
        { status.cap
1790
          { "u" }
1791
          { "l" }
1792
        if$
1793
        change.case$
1794
        }
1795
      if$
1796
      note #2 global.max$ substring$ * "note" bibinfo.check
1797
      cap.yes  'status.cap :=
1798
    }
1799
  if$
1800
}
1801

    
1802

    
1803

    
1804
%% patent
1805

    
1806
FUNCTION {format.patent.date}
1807
{ this.to.prev.status
1808
  this.status.std
1809
  year empty$
1810
    { monthfiled duplicate$ empty$
1811
        { "monthfiled" bibinfo.check pop$ "" }
1812
        { "monthfiled" bibinfo.check }
1813
      if$
1814
      dayfiled duplicate$ empty$
1815
        { "dayfiled" bibinfo.check pop$ "" * }
1816
        { "dayfiled" bibinfo.check 
1817
          monthfiled empty$ 
1818
             { "dayfiled without a monthfiled in " cite$ * warning$
1819
               * 
1820
             }
1821
             { " " swap$ * * }
1822
           if$
1823
        }
1824
      if$
1825
      yearfiled empty$
1826
        { "no year or yearfiled in " cite$ * warning$ }
1827
        { yearfiled "yearfiled" bibinfo.check 
1828
          swap$
1829
          duplicate$ empty$
1830
             { pop$ }
1831
             { ", " * swap$ * }
1832
           if$
1833
        }
1834
      if$
1835
    }
1836
    { month duplicate$ empty$
1837
        { "month" bibinfo.check pop$ "" }
1838
        { "month" bibinfo.check }
1839
      if$
1840
      day duplicate$ empty$
1841
        { "day" bibinfo.check pop$ "" * }
1842
        { "day" bibinfo.check 
1843
          month empty$ 
1844
             { "day without a month in " cite$ * warning$
1845
               * 
1846
             }
1847
             { " " swap$ * * }
1848
           if$
1849
        }
1850
      if$
1851
      year "year" bibinfo.check 
1852
      swap$
1853
      duplicate$ empty$
1854
        { pop$ }
1855
        { ", " * swap$ * }
1856
      if$
1857
    }
1858
  if$
1859
  cap.status.std
1860
}
1861

    
1862
FUNCTION {format.patent.nationality.type.number}
1863
{ this.to.prev.status
1864
  this.status.std
1865
  nationality duplicate$ empty$
1866
    { "nationality" bibinfo.warn pop$ "" }
1867
    { "nationality" bibinfo.check
1868
      duplicate$ "l" change.case$ "united states" =
1869
        { pop$ bbl.patentUS }
1870
        { skip$ }
1871
      if$
1872
      " " *
1873
    }
1874
  if$
1875
  type empty$
1876
    { bbl.patent "type" bibinfo.check }
1877
    { type "type" bibinfo.check }
1878
  if$  
1879
  *
1880
  number duplicate$ empty$
1881
    { "number" bibinfo.warn pop$ }
1882
    { "number" bibinfo.check
1883
      large.number.separate
1884
      swap$ " " * swap$ *
1885
    }
1886
  if$ 
1887
  cap.status.std
1888
}
1889

    
1890

    
1891

    
1892
%% standard
1893

    
1894
FUNCTION {format.organization.institution.standard.type.number}
1895
{ this.to.prev.status
1896
  this.status.std
1897
  organization duplicate$ empty$
1898
    { pop$ 
1899
      institution duplicate$ empty$
1900
        { "institution" bibinfo.warn }
1901
        { "institution" bibinfo.warn " " * }
1902
      if$
1903
    }
1904
    { "organization" bibinfo.warn " " * }
1905
  if$
1906
  type empty$
1907
    { bbl.standard "type" bibinfo.check }
1908
    { type "type" bibinfo.check }
1909
  if$  
1910
  *
1911
  number duplicate$ empty$
1912
    { "number" bibinfo.check pop$ }
1913
    { "number" bibinfo.check
1914
      large.number.separate
1915
      swap$ " " * swap$ *
1916
    }
1917
  if$ 
1918
  cap.status.std
1919
}
1920

    
1921
FUNCTION {format.revision}
1922
{ revision empty$
1923
    { "" }
1924
    { this.to.prev.status
1925
      this.status.std
1926
      bbl.revision
1927
      revision tie.or.space.prefix
1928
      "revision" bibinfo.check
1929
      * *
1930
      cap.status.std
1931
    }
1932
  if$
1933
}
1934

    
1935

    
1936
%% thesis
1937

    
1938
FUNCTION {format.master.thesis.type}
1939
{ this.to.prev.status
1940
  this.status.std
1941
  type empty$
1942
    {
1943
      bbl.mthesis
1944
    }
1945
    { 
1946
      type "type" bibinfo.check
1947
    }
1948
  if$
1949
cap.status.std
1950
}
1951

    
1952
FUNCTION {format.phd.thesis.type}
1953
{ this.to.prev.status
1954
  this.status.std
1955
  type empty$
1956
    {
1957
      bbl.phdthesis
1958
    }
1959
    { 
1960
      type "type" bibinfo.check
1961
    }
1962
  if$
1963
cap.status.std
1964
}
1965

    
1966

    
1967

    
1968
%% URL
1969

    
1970
FUNCTION {format.url}
1971
{ is.use.url
1972
    { url empty$
1973
      { "" }
1974
      { this.to.prev.status
1975
        this.status.std
1976
        cap.yes 'status.cap :=
1977
        name.url.prefix " " *
1978
        "\url{" * url * "}" *
1979
        punct.no 'this.status.punct :=
1980
        punct.period 'prev.status.punct :=
1981
        space.normal 'this.status.space :=
1982
        space.normal 'prev.status.space :=
1983
        quote.no 'this.status.quote :=
1984
      }
1985
    if$
1986
    }
1987
    { "" }
1988
  if$
1989
}
1990

    
1991

    
1992

    
1993

    
1994
%%%%%%%%%%%%%%%%%%%%
1995
%% ENTRY HANDLERS %%
1996
%%%%%%%%%%%%%%%%%%%%
1997

    
1998

    
1999
% Note: In many journals, the IEEE (or the authors) tend not to show the number
2000
% for articles, so the display of the number is controlled here by the
2001
% switch "is.use.number.for.article"
2002
FUNCTION {article}
2003
{ std.status.using.comma
2004
  start.entry
2005
  if.url.alt.interword.spacing
2006
  format.authors "author" output.warn
2007
  name.or.dash
2008
  format.article.title "title" output.warn
2009
  format.journal "journal" bibinfo.check "journal" output.warn
2010
  format.volume output
2011
  format.number.if.use.for.article output
2012
  format.pages output
2013
  format.date "year" output.warn
2014
  format.note output
2015
  format.url output
2016
  fin.entry
2017
  if.url.std.interword.spacing
2018
}
2019

    
2020
FUNCTION {book}
2021
{ std.status.using.comma
2022
  start.entry
2023
  if.url.alt.interword.spacing
2024
  author empty$
2025
    { format.editors "author and editor" output.warn }
2026
    { format.authors output.nonnull }
2027
  if$
2028
  name.or.dash
2029
  format.book.title.edition output
2030
  format.series output
2031
  author empty$
2032
    { skip$ }
2033
    { format.editors output }
2034
  if$
2035
  format.address.publisher.date output
2036
  format.volume output
2037
  format.number output
2038
  format.note output
2039
  format.url output
2040
  fin.entry
2041
  if.url.std.interword.spacing
2042
}
2043

    
2044
FUNCTION {booklet}
2045
{ std.status.using.comma
2046
  start.entry
2047
  if.url.alt.interword.spacing
2048
  format.authors output
2049
  name.or.dash
2050
  format.article.title "title" output.warn
2051
  format.howpublished "howpublished" bibinfo.check output
2052
  format.organization "organization" bibinfo.check output
2053
  format.address "address" bibinfo.check output
2054
  format.date output
2055
  format.note output
2056
  format.url output
2057
  fin.entry
2058
  if.url.std.interword.spacing
2059
}
2060

    
2061
FUNCTION {electronic}
2062
{ std.status.using.period
2063
  start.entry
2064
  if.url.alt.interword.spacing
2065
  format.authors output
2066
  name.or.dash
2067
  format.date.electronic output
2068
  format.article.title.electronic output
2069
  format.howpublished "howpublished" bibinfo.check output
2070
  format.organization "organization" bibinfo.check output
2071
  format.address "address" bibinfo.check output
2072
  format.note output
2073
  format.url output
2074
  fin.entry
2075
  empty.entry.warn
2076
  if.url.std.interword.spacing
2077
}
2078

    
2079
FUNCTION {inbook}
2080
{ std.status.using.comma
2081
  start.entry
2082
  if.url.alt.interword.spacing
2083
  author empty$
2084
    { format.editors "author and editor" output.warn }
2085
    { format.authors output.nonnull }
2086
  if$
2087
  name.or.dash
2088
  format.book.title.edition output
2089
  format.series output
2090
  format.address.publisher.date output
2091
  format.volume output
2092
  format.number output
2093
  format.chapter output
2094
  format.pages output
2095
  format.note output
2096
  format.url output
2097
  fin.entry
2098
  if.url.std.interword.spacing
2099
}
2100

    
2101
FUNCTION {incollection}
2102
{ std.status.using.comma
2103
  start.entry
2104
  if.url.alt.interword.spacing
2105
  format.authors "author" output.warn
2106
  name.or.dash
2107
  format.article.title "title" output.warn
2108
  format.in.booktitle.edition "booktitle" output.warn
2109
  format.series output
2110
  format.editors output
2111
  format.address.publisher.date.nowarn output
2112
  format.volume output
2113
  format.number output
2114
  format.chapter output
2115
  format.pages output
2116
  format.note output
2117
  format.url output
2118
  fin.entry
2119
  if.url.std.interword.spacing
2120
}
2121

    
2122
FUNCTION {inproceedings}
2123
{ std.status.using.comma
2124
  start.entry
2125
  if.url.alt.interword.spacing
2126
  format.authors "author" output.warn
2127
  name.or.dash
2128
  format.article.title "title" output.warn
2129
  format.in.booktitle "booktitle" output.warn
2130
  format.series output
2131
  format.editors output
2132
  format.volume output
2133
  format.number output
2134
  publisher empty$
2135
    { format.address.organization.date output }
2136
    { format.organization "organization" bibinfo.check output
2137
      format.address.publisher.date output
2138
    }
2139
  if$
2140
  format.paper output
2141
  format.pages output
2142
  format.note output
2143
  format.url output
2144
  fin.entry
2145
  if.url.std.interword.spacing
2146
}
2147

    
2148
FUNCTION {manual}
2149
{ std.status.using.comma
2150
  start.entry
2151
  if.url.alt.interword.spacing
2152
  format.authors output
2153
  name.or.dash
2154
  format.book.title.edition "title" output.warn
2155
  format.howpublished "howpublished" bibinfo.check output 
2156
  format.organization "organization" bibinfo.check output
2157
  format.address "address" bibinfo.check output
2158
  format.date output
2159
  format.note output
2160
  format.url output
2161
  fin.entry
2162
  if.url.std.interword.spacing
2163
}
2164

    
2165
FUNCTION {mastersthesis}
2166
{ std.status.using.comma
2167
  start.entry
2168
  if.url.alt.interword.spacing
2169
  format.authors "author" output.warn
2170
  name.or.dash
2171
  format.article.title "title" output.warn
2172
  format.master.thesis.type output.nonnull
2173
  format.school "school" bibinfo.warn output
2174
  format.address "address" bibinfo.check output
2175
  format.date "year" output.warn
2176
  format.note output
2177
  format.url output
2178
  fin.entry
2179
  if.url.std.interword.spacing
2180
}
2181

    
2182
FUNCTION {misc}
2183
{ std.status.using.comma
2184
  start.entry
2185
  if.url.alt.interword.spacing
2186
  format.authors output
2187
  name.or.dash
2188
  format.article.title output
2189
  format.howpublished "howpublished" bibinfo.check output 
2190
  format.organization "organization" bibinfo.check output
2191
  format.address "address" bibinfo.check output
2192
  format.pages output
2193
  format.date output
2194
  format.note output
2195
  format.url output
2196
  fin.entry
2197
  empty.entry.warn
2198
  if.url.std.interword.spacing
2199
}
2200

    
2201
FUNCTION {patent}
2202
{ std.status.using.comma
2203
  start.entry
2204
  if.url.alt.interword.spacing
2205
  format.authors output
2206
  name.or.dash
2207
  format.article.title output
2208
  format.patent.nationality.type.number output
2209
  format.patent.date output
2210
  format.note output
2211
  format.url output
2212
  fin.entry
2213
  empty.entry.warn
2214
  if.url.std.interword.spacing
2215
}
2216

    
2217
FUNCTION {periodical}
2218
{ std.status.using.comma
2219
  start.entry
2220
  if.url.alt.interword.spacing
2221
  format.editors output
2222
  name.or.dash
2223
  format.book.title "title" output.warn
2224
  format.series output
2225
  format.volume output
2226
  format.number output
2227
  format.organization "organization" bibinfo.check output
2228
  format.date "year" output.warn
2229
  format.note output
2230
  format.url output
2231
  fin.entry
2232
  if.url.std.interword.spacing
2233
}
2234

    
2235
FUNCTION {phdthesis}
2236
{ std.status.using.comma
2237
  start.entry
2238
  if.url.alt.interword.spacing
2239
  format.authors "author" output.warn
2240
  name.or.dash
2241
  format.article.title "title" output.warn
2242
  format.phd.thesis.type output.nonnull
2243
  format.school "school" bibinfo.warn output
2244
  format.address "address" bibinfo.check output
2245
  format.date "year" output.warn
2246
  format.note output
2247
  format.url output
2248
  fin.entry
2249
  if.url.std.interword.spacing
2250
}
2251

    
2252
FUNCTION {proceedings}
2253
{ std.status.using.comma
2254
  start.entry
2255
  if.url.alt.interword.spacing
2256
  format.editors output
2257
  name.or.dash
2258
  format.book.title "title" output.warn
2259
  format.series output
2260
  format.volume output
2261
  format.number output
2262
  publisher empty$
2263
    { format.address.organization.date output }
2264
    { format.organization "organization" bibinfo.check output
2265
      format.address.publisher.date output
2266
    }
2267
  if$
2268
  format.note output
2269
  format.url output
2270
  fin.entry
2271
  if.url.std.interword.spacing
2272
}
2273

    
2274
FUNCTION {standard}
2275
{ std.status.using.comma
2276
  start.entry
2277
  if.url.alt.interword.spacing
2278
  format.authors output
2279
  name.or.dash
2280
  format.book.title "title" output.warn
2281
  format.howpublished "howpublished" bibinfo.check output 
2282
  format.organization.institution.standard.type.number output
2283
  format.revision output
2284
  format.date output
2285
  format.note output
2286
  format.url output
2287
  fin.entry
2288
  if.url.std.interword.spacing
2289
}
2290

    
2291
FUNCTION {techreport}
2292
{ std.status.using.comma
2293
  start.entry
2294
  if.url.alt.interword.spacing
2295
  format.authors "author" output.warn
2296
  name.or.dash
2297
  format.article.title "title" output.warn
2298
  format.howpublished "howpublished" bibinfo.check output 
2299
  format.institution "institution" bibinfo.warn output
2300
  format.address "address" bibinfo.check output
2301
  format.tech.report.number output.nonnull
2302
  format.date "year" output.warn
2303
  format.note output
2304
  format.url output
2305
  fin.entry
2306
  if.url.std.interword.spacing
2307
}
2308

    
2309
FUNCTION {unpublished}
2310
{ std.status.using.comma
2311
  start.entry
2312
  if.url.alt.interword.spacing
2313
  format.authors "author" output.warn
2314
  name.or.dash
2315
  format.article.title "title" output.warn
2316
  format.date output
2317
  format.note "note" output.warn
2318
  format.url output
2319
  fin.entry
2320
  if.url.std.interword.spacing
2321
}
2322

    
2323

    
2324
% The special entry type which provides the user interface to the
2325
% BST controls
2326
FUNCTION {IEEEtranBSTCTL}
2327
{ is.print.banners.to.terminal
2328
    { "** IEEEtran BST control entry " quote$ * cite$ * quote$ * " detected." *
2329
      top$
2330
    }
2331
    { skip$ }
2332
  if$
2333
  CTLuse_article_number
2334
  empty$
2335
    { skip$ }
2336
    { CTLuse_article_number
2337
      yes.no.to.int
2338
      'is.use.number.for.article :=
2339
    }
2340
  if$
2341
  CTLuse_paper
2342
  empty$
2343
    { skip$ }
2344
    { CTLuse_paper
2345
      yes.no.to.int
2346
      'is.use.paper :=
2347
    }
2348
  if$
2349
  CTLuse_url
2350
  empty$
2351
    { skip$ }
2352
    { CTLuse_url
2353
      yes.no.to.int
2354
      'is.use.url :=
2355
    }
2356
  if$
2357
  CTLuse_forced_etal
2358
  empty$
2359
    { skip$ }
2360
    { CTLuse_forced_etal
2361
      yes.no.to.int
2362
      'is.forced.et.al :=
2363
    }
2364
  if$
2365
  CTLmax_names_forced_etal
2366
  empty$
2367
    { skip$ }
2368
    { CTLmax_names_forced_etal
2369
      string.to.integer
2370
      'max.num.names.before.forced.et.al :=
2371
    }
2372
  if$
2373
  CTLnames_show_etal
2374
  empty$
2375
    { skip$ }
2376
    { CTLnames_show_etal
2377
      string.to.integer
2378
      'num.names.shown.with.forced.et.al :=
2379
    }
2380
  if$
2381
  CTLuse_alt_spacing
2382
  empty$
2383
    { skip$ }
2384
    { CTLuse_alt_spacing
2385
      yes.no.to.int
2386
      'is.use.alt.interword.spacing :=
2387
    }
2388
  if$
2389
  CTLalt_stretch_factor
2390
  empty$
2391
    { skip$ }
2392
    { CTLalt_stretch_factor
2393
      'ALTinterwordstretchfactor :=
2394
      "\renewcommand{\BIBentryALTinterwordstretchfactor}{"
2395
      ALTinterwordstretchfactor * "}" *
2396
      write$ newline$
2397
    }
2398
  if$
2399
  CTLdash_repeated_names
2400
  empty$
2401
    { skip$ }
2402
    { CTLdash_repeated_names
2403
      yes.no.to.int
2404
      'is.dash.repeated.names :=
2405
    }
2406
  if$
2407
  CTLname_format_string
2408
  empty$
2409
    { skip$ }
2410
    { CTLname_format_string
2411
      'name.format.string :=
2412
    }
2413
  if$
2414
  CTLname_latex_cmd
2415
  empty$
2416
    { skip$ }
2417
    { CTLname_latex_cmd
2418
      'name.latex.cmd :=
2419
    }
2420
  if$
2421
  CTLname_url_prefix
2422
  missing$
2423
    { skip$ }
2424
    { CTLname_url_prefix
2425
      'name.url.prefix :=
2426
    }
2427
  if$
2428

    
2429

    
2430
  num.names.shown.with.forced.et.al max.num.names.before.forced.et.al >
2431
    { "CTLnames_show_etal cannot be greater than CTLmax_names_forced_etal in " cite$ * warning$ 
2432
      max.num.names.before.forced.et.al 'num.names.shown.with.forced.et.al :=
2433
    }
2434
    { skip$ }
2435
  if$
2436
}
2437

    
2438

    
2439
%%%%%%%%%%%%%%%%%%%
2440
%% ENTRY ALIASES %%
2441
%%%%%%%%%%%%%%%%%%%
2442
FUNCTION {conference}{inproceedings}
2443
FUNCTION {online}{electronic}
2444
FUNCTION {internet}{electronic}
2445
FUNCTION {webpage}{electronic}
2446
FUNCTION {www}{electronic}
2447
FUNCTION {default.type}{misc}
2448

    
2449

    
2450

    
2451
%%%%%%%%%%%%%%%%%%
2452
%% MAIN PROGRAM %%
2453
%%%%%%%%%%%%%%%%%%
2454

    
2455
READ
2456

    
2457
EXECUTE {initialize.controls}
2458
EXECUTE {initialize.status.constants}
2459
EXECUTE {banner.message}
2460

    
2461

    
2462

    
2463
% BEGIN sort code based on unsrtnat.bst
2464
FUNCTION {sortify}
2465
{ purify$
2466
  "l" change.case$
2467
}
2468

    
2469
INTEGERS { len }
2470

    
2471
FUNCTION {chop.word}
2472
{ 's :=
2473
  'len :=
2474
  s #1 len substring$ =
2475
    { s len #1 + global.max$ substring$ }
2476
    { s }
2477
  if$
2478
}
2479

    
2480
STRINGS { last.label next.extra }
2481

    
2482
INTEGERS { last.extra.num }
2483

    
2484
FUNCTION {format.lab.names}
2485
{ 's :=
2486
  s #1 "{vv~}{ll}" format.name$
2487
  s num.names$ duplicate$
2488
  #2 >
2489
    { pop$ " " bbl.etal * * }
2490
    { #2 <
2491
        'skip$
2492
        { s #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
2493
            { " " bbl.etal * * }
2494
            {  " " bbl.and * " " * * s #2 "{vv~}{ll}" format.name$ * }
2495
          if$
2496
        }
2497
      if$
2498
    }
2499
  if$
2500
}
2501

    
2502
FUNCTION {author.key.label}
2503
{ author empty$
2504
    { key empty$
2505
        { cite$ #1 #3 substring$ }
2506
        { key }
2507
      if$
2508
    }
2509
    { author format.lab.names }
2510
  if$
2511
}
2512

    
2513
FUNCTION {author.editor.key.label}
2514
{ author empty$
2515
    { editor empty$
2516
        { key empty$
2517
            { cite$ #1 #3 substring$ }
2518
            { key }
2519
          if$
2520
        }
2521
        { editor format.lab.names }
2522
      if$
2523
    }
2524
    { author format.lab.names }
2525
  if$
2526
}
2527

    
2528
FUNCTION {author.key.organization.label}
2529
{ author empty$
2530
    { key empty$
2531
        { organization empty$
2532
            { cite$ #1 #3 substring$ }
2533
            { bbl.the " " * #4 organization chop.word #3 text.prefix$ }
2534
          if$
2535
        }
2536
        { key }
2537
      if$
2538
    }
2539
    { author format.lab.names }
2540
  if$
2541
}
2542

    
2543
FUNCTION {author.key.organization.institution.label}
2544
{ author empty$
2545
    { key empty$
2546
        { organization empty$
2547
            { institution empty$
2548
              { cite$ #1 #3 substring$ }
2549
              { bbl.the " " * #4 institution chop.word #3 text.prefix$ }
2550
            if$
2551
            }
2552
            { bbl.the " " * #4 organization chop.word #3 text.prefix$ }
2553
          if$
2554
        }
2555
        { key }
2556
      if$
2557
    }
2558
    { author format.lab.names }
2559
  if$
2560
}
2561

    
2562
FUNCTION {editor.key.organization.label}
2563
{ editor empty$
2564
    { key empty$
2565
        { organization empty$
2566
            { cite$ #1 #3 substring$ }
2567
            { bbl.the " " * #4 organization chop.word #3 text.prefix$ }
2568
          if$
2569
        }
2570
        { key }
2571
      if$
2572
    }
2573
    { editor format.lab.names }
2574
  if$
2575
}
2576

    
2577
FUNCTION {calc.label}
2578
{ type$ "book" =
2579
  type$ "inbook" =
2580
  or 
2581
    { author.editor.key.label }
2582
    { type$ "proceedings" =
2583
      type$ "periodical" =
2584
      or
2585
        { editor.key.organization.label }
2586
        { type$ "manual" =
2587
          type$ "electronic" =
2588
          type$ "misc" =
2589
          or or
2590
            { author.key.organization.label }
2591
            { type$ "standard" =
2592
               { author.key.organization.institution.label }
2593
               { author.key.label }
2594
             if$ 
2595
            }
2596
          if$
2597
        }
2598
      if$
2599
    }
2600
  if$
2601
  duplicate$
2602
  'short.list :=
2603
  "("
2604
  *
2605
  type$ "patent" =
2606
    { year empty$
2607
      { yearfiled }
2608
      { year }
2609
    if$
2610
    }
2611
    { year }
2612
  if$
2613
  duplicate$
2614
  empty$
2615
  short.list key empty.field.to.null.string = or
2616
    { pop$ "" }
2617
    { skip$   }
2618
  if$
2619
  *
2620
  'label :=
2621
}
2622

    
2623

    
2624
INTEGERS { seq.num }
2625

    
2626
FUNCTION {init.seq}
2627
{ #0 'seq.num :=}
2628

    
2629

    
2630
FUNCTION {int.to.fix}
2631
{ "000000000" swap$ int.to.str$ *
2632
  #-1 #10 substring$
2633
}
2634

    
2635

    
2636
FUNCTION {presort}
2637
{ type$ "ieeetranbstctl" =
2638
    { key empty$
2639
        { "_" }
2640
        { key sortify }
2641
      if$
2642
      "    "
2643
      *
2644
      seq.num  int.to.fix
2645
    }
2646
    { calc.label
2647
      label sortify
2648
      "    "
2649
      *
2650
      seq.num #1 + 'seq.num :=
2651
      seq.num  int.to.fix
2652
    }
2653
  if$
2654
  'sort.label :=
2655
  sort.label *
2656
  #1 entry.max$ substring$
2657
  'sort.key$ :=
2658
}
2659

    
2660

    
2661
FUNCTION {initialize.longest.label}
2662
{  "" 'longest.label :=
2663
  #0 int.to.chr$ 'last.label :=
2664
  "" 'next.extra :=
2665
  #0 'longest.label.width :=
2666
  #0 'last.extra.num :=
2667
  #0 'number.label :=
2668
}
2669

    
2670
FUNCTION {forward.pass}
2671
{ type$ "ieeetranbstctl" =
2672
    { skip$ }
2673
    { last.label label =
2674
        { last.extra.num #1 + 'last.extra.num :=
2675
          last.extra.num int.to.chr$ 'extra.label :=
2676
        }
2677
        {  "a" chr.to.int$ 'last.extra.num :=
2678
          "" 'extra.label :=
2679
          label 'last.label :=
2680
        }
2681
      if$
2682
      number.label #1 + 'number.label :=
2683
    }
2684
  if$
2685
}
2686

    
2687
FUNCTION {reverse.pass}
2688
{ type$ "ieeetranbstctl" =
2689
    { skip$ }
2690
    {  next.extra "b" =
2691
       { "a" 'extra.label := }
2692
       { skip$ }
2693
     if$
2694
     extra.label 'next.extra :=
2695
     extra.label
2696
     duplicate$ empty$
2697
       { skip$ }
2698
       { "{\natexlab{" swap$ * "}}" * }
2699
     if$
2700
     'extra.label :=
2701
     label extra.label * 'label :=
2702
    }
2703
  if$
2704
}
2705

    
2706
FUNCTION {bib.sort.order}
2707
{ sort.label  'sort.key$ :=
2708
}
2709
% END sort code based on unsrtnat.bst
2710

    
2711

    
2712

    
2713
EXECUTE {init.seq}
2714

    
2715
ITERATE {presort}
2716

    
2717
SORT
2718

    
2719
EXECUTE {initialize.longest.label}
2720

    
2721
ITERATE {forward.pass}
2722
REVERSE {reverse.pass}
2723

    
2724
ITERATE {bib.sort.order}
2725

    
2726
SORT
2727

    
2728
EXECUTE {begin.bib}
2729
ITERATE {call.type$}
2730
EXECUTE {end.bib}
2731

    
2732
EXECUTE{completed.message}
2733

    
2734

    
2735
%% That's all folks, mds.