Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
blob: c43fcc2d5d7374d07443b71f4d206dddc39a2379 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
  Handles node expansion

  Copyright (C) 2016 LoVullo Associates, Inc.

    This file is part of TAME.

    TAME is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see
    <http://www.gnu.org/licenses/>.

  This process is responsible for expanding shorthand and various other data
  into a consistent format for the compiler and other processes.
-->
<xsl:stylesheet
    version="2.0"
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:preproc="http://www.lovullo.com/rater/preproc"
    xmlns:lv="http://www.lovullo.com/rater"
    xmlns:t="http://www.lovullo.com/rater/apply-template"
    xmlns:c="http://www.lovullo.com/calc"
    xmlns:w="http://www.lovullo.com/rater/worksheet">


<xsl:include href="domain.xsl" />


<xsl:template match="lv:package[ not( @preproc:name ) ]"
              mode="preproc:expand" priority="5"
              as="element( lv:package )">
  <xsl:copy>
    <xsl:sequence select="@*" />

    <!-- generate name from source package identifier -->
    <xsl:attribute name="name" select="$__srcpkg" />

    <!-- relative path to root src directory (for resolving absolute include
         paths) -->
    <xsl:attribute name="__rootpath" select="$__relroot" />

    <!-- TODO: temporary; remove -->
    <xsl:attribute name="preproc:name" select="$__srcpkg" />

    <xsl:apply-templates mode="preproc:expand" />
  </xsl:copy>
</xsl:template>



<xsl:template match="*" mode="preproc:expand" priority="1">
  <xsl:copy>
    <xsl:sequence select="@*" />

    <xsl:apply-templates mode="preproc:expand" />
  </xsl:copy>
</xsl:template>


<!-- imports relative to project root -->
<xsl:template match="lv:import[ starts-with( @package, '/' ) ]" mode="preproc:expand" priority="5">
  <xsl:copy>
    <xsl:sequence select="@*" />

    <!-- resolve path into path relative to project root -->
    <xsl:attribute name="package">
      <xsl:call-template name="__apply-relroot">
        <xsl:with-param name="path" select="@package" />
      </xsl:call-template>
    </xsl:attribute>
  </xsl:copy>
</xsl:template>


<!--
  Domain data are extracted from typedefs

  Eventually, the typedefs will be converted into templates and removed entirely.
-->
<xsl:template match="lv:typedef"
  mode="preproc:expand" priority="5">

  <xsl:apply-templates select="." mode="preproc:mkdomain" />

  <xsl:copy>
    <xsl:sequence select="@*" />
    <xsl:apply-templates mode="preproc:expand" />
  </xsl:copy>
</xsl:template>


<!--
  Infer primitive type if not provided.
-->
<xsl:template mode="preproc:expand"
              match="c:const[ not( @type ) ]
                     |lv:const[ not( @type ) ]"
              priority="5">
  <xsl:copy>
    <xsl:sequence select="@*" />

    <xsl:attribute name="type"
                   select="if ( substring-before( @value, '.' ) ) then
                             'float'
                           else
                             'integer'" />

    <xsl:sequence select="*" />
  </xsl:copy>
</xsl:template>


<!--
  Translate dimension aliases (e.g. scaler, vector, matrix) into respective
  numeric representations.
-->
<xsl:template mode="preproc:expand" priority="8"
              match="c:*[ @dim
                          and not( string( @dim ) castable as xs:integer ) ]">
  <xsl:copy>
    <xsl:sequence select="@*" />

    <!-- replace dim with numeric -->
    <xsl:attribute name="dim">
      <xsl:choose>
        <xsl:when test="@dim = 'scaler' or @dim = ''">
          <xsl:sequence select="0" />
        </xsl:when>

        <xsl:when test="@dim = 'vector'">
          <xsl:sequence select="1" />
        </xsl:when>

        <xsl:when test="@dim = 'matrix'">
          <xsl:sequence select="2" />
        </xsl:when>

        <xsl:otherwise>
          <xsl:message terminate="yes"
                       select="concat(
                                 '!!! [preproc] error: ',
                                 'unknown dimension alias ''',
                                 @dim, '''' )" />
        </xsl:otherwise>
      </xsl:choose>
    </xsl:attribute>

    <xsl:sequence select="node()" />
  </xsl:copy>
</xsl:template>


<!--
  Give let's a name so that they may be easily referenced uniquely
-->
<xsl:template match="c:let[ not( @name ) ]" mode="preproc:expand" priority="5">
  <xsl:copy>
    <xsl:sequence select="@*" />
    <xsl:attribute name="name" select="generate-id(.)" />

    <xsl:apply-templates select="*" mode="preproc:expand" />
  </xsl:copy>
</xsl:template>


<!--
  Default label of c:let value expressions to description if no label is provided

  This is useful for breakdown display.

  TODO: play well with others; if we change the priority back to 5, we introduce
  match ambiguities
-->
<xsl:template match="c:let/c:values/c:value/c:*[1][ not( @label ) ]" mode="preproc:expand" priority="4">
  <xsl:copy>
    <xsl:sequence select="@*" />

    <!-- default the label to the description of the parent c:value -->
    <xsl:attribute name="label" select="../@desc" />

    <xsl:apply-templates select="*" mode="preproc:expand" />
  </xsl:copy>
</xsl:template>


<!--
  c:when with no children is shorthand for > 0

  Note: we check for any children because we may have things like
  template applications that we do not want wiped out.
-->
<xsl:template match="c:when[ not( * ) ]" mode="preproc:expand" priority="5">
  <xsl:copy>
    <xsl:sequence select="@*" />

    <c:gt>
      <c:value-of name="FALSE" />
    </c:gt>
  </xsl:copy>
</xsl:template>


<!--
  c:when with multiple children
-->
<xsl:template match="c:when[ count( c:* ) gt 1 ]" mode="preproc:expand" priority="5">
  <xsl:variable name="when" select="." />

  <!-- expand into adjacent c:when's -->
  <xsl:for-each select="c:*">
    <c:when>
      <xsl:sequence select="$when/@*" />
      <xsl:apply-templates select="." mode="preproc:expand" />
    </c:when>
  </xsl:for-each>
</xsl:template>


<!--
  Recursion shorthand

  This exists simply because function application is so verbose and, when
  recursing, generally only a small fraction of the arguments actually change.
-->
<xsl:template match="c:recurse" mode="preproc:expand" priority="5">
  <xsl:variable name="self" select="." />
  <xsl:variable name="fname" select="ancestor::lv:function/@name" />
  <xsl:variable name="overrides" select="./c:arg" />

  <c:apply name="{$fname}">
    <!-- every non-@name attribute should be converted into an argument -->
    <xsl:call-template name="preproc:arg-short-expand" />

    <!-- include all non-overridden args -->
    <xsl:for-each select="
        ancestor::lv:function/lv:param[
          not(
            @name=$overrides/@name
            or @name=$self/@*/local-name()
          )
        ]
      ">

      <!-- copy the arg value -->
      <c:arg name="{@name}">
        <c:value-of name="{@name}" />
      </c:arg>
    </xsl:for-each>

    <!-- copy in the overrides -->
    <xsl:apply-templates select="$overrides" mode="preproc:expand" />
  </c:apply>
</xsl:template>


<!-- metadata constants have different semantics -->
<!-- TODO: maybe ignore single-quoted? -->
<xsl:template mode="preproc:expand" priority="6"
              match="lv:meta/lv:prop/lv:const">
  <xsl:sequence select="." />
</xsl:template>


<!-- constants that contain 'e' (scientific notation) should be expanded; allows
     for avoiding constants with many zeroes, which is hard to read -->
<xsl:template mode="preproc:expand" priority="5"
    match="c:const[ substring-before( @value, 'e' ) ]
           |lv:const[ substring-before( @value, 'e' ) ]">
  <xsl:copy>
    <xsl:sequence select="@*" />

    <xsl:attribute name="value">
      <xsl:call-template name="preproc:expand-e">
        <xsl:with-param name="number" select="@value" />
      </xsl:call-template>
    </xsl:attribute>

    <xsl:apply-templates mode="preproc:expand" />
  </xsl:copy>
</xsl:template>

<xsl:template mode="preproc:expand" priority="5"
    match="c:const[ substring-before( @value, 'm' ) ]
           |lv:const[ substring-before( @value, 'm' ) ]">
  <xsl:copy>
    <xsl:sequence select="@*" />

    <xsl:attribute name="value">
      <xsl:call-template name="preproc:expand-e">
        <xsl:with-param name="number"
          select="concat( substring-before( @value, 'm' ), 'e6' )" />
      </xsl:call-template>
    </xsl:attribute>

    <xsl:apply-templates mode="preproc:expand" />
  </xsl:copy>
</xsl:template>

<xsl:template mode="preproc:expand" priority="5"
    match="c:const[ substring-before( @value, 'k' ) ]
           |lv:const[ substring-before( @value, 'k' ) ]">
  <xsl:copy>
    <xsl:sequence select="@*" />

    <xsl:attribute name="value">
      <xsl:call-template name="preproc:expand-e">
        <xsl:with-param name="number"
          select="concat( substring-before( @value, 'k' ), 'e3' )" />
      </xsl:call-template>
    </xsl:attribute>

    <xsl:apply-templates mode="preproc:expand" />
  </xsl:copy>
</xsl:template>


<!-- expand scientific notation -->
<!-- XXX: negatives not currently supported -->
<xsl:template name="preproc:expand-e">
  <xsl:param name="number" />
  <xsl:param name="whole" select="substring-before( $number, '.' )" />
  <xsl:param name="dec"   select="substring-before( substring-after( $number, '.' ), 'e' )" />
  <xsl:param name="count" as="xs:double"
             select="number( substring-after( $number, 'e' ) )" />

  <!-- output the whole number portion -->
  <xsl:choose>
    <xsl:when test="$whole and not( $whole = '' )">
      <xsl:value-of select="$whole" />
    </xsl:when>

    <!-- if no decimal was provided, then use the entire number before 'e' -->
    <xsl:when test="$number and not( $number = '' ) and ( $whole = '' )">
      <xsl:value-of select="substring-before( $number, 'e' )" />
    </xsl:when>
  </xsl:choose>

  <xsl:choose>
    <xsl:when test="$count > 0">
      <xsl:choose>
        <!-- if we have a decimal, then use the first digit (as if we moved one
             place to the right) -->
        <xsl:when test="$dec and not( $dec = '' )">
          <xsl:value-of select="substring( $dec, 1, 1 )" />
        </xsl:when>

        <!-- no decimal portion remaining; fill with 0 -->
        <xsl:otherwise>
          <xsl:text>0</xsl:text>
        </xsl:otherwise>
      </xsl:choose>

      <!-- recursively expand -->
      <xsl:call-template name="preproc:expand-e">
        <!-- already processed the whole -->
        <xsl:with-param name="whole" select="''" />

        <xsl:with-param name="dec">
          <!-- move to the right one decimal place; otherwise, no decimal -->
          <xsl:if test="$dec">
            <xsl:value-of select="substring( $dec, 2 )" />
          </xsl:if>
        </xsl:with-param>

        <xsl:with-param name="count" select="$count - 1" />
      </xsl:call-template>
    </xsl:when>

    <!-- output the remaining decimal, if any -->
    <xsl:otherwise>
      <xsl:if test="$dec and not( $dec = '' )">
        <xsl:text>.</xsl:text>
        <xsl:value-of select="$dec" />
      </xsl:if>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>


<!--
  Optimize away c:cases if they contain only c:otherwise

  This is useful primarily for templates that may create a case statement for
  conditional operations (using lv:if/lv:unless) and ensures that there is no
  penalty for doing so if none of the template conditions result in a c:case.

  Note that we should *not* perform these optimizations if there are templates
  awaiting application or any other lv:* nodes that have not been expanded.
-->
<xsl:template mode="preproc:expand" priority="5" match="
    c:cases[
      not( lv:* or t:* )
      and c:otherwise[
        not( preceding-sibling::c:* or following-sibling::c:* )
      ]
    ]
  ">

  <!-- just replace with the content of the otherwise block (do not explicitly
       process c:*, since there may be templates) -->
  <xsl:apply-templates select="c:otherwise/*" mode="preproc:expand" />
</xsl:template>


<!--
  Optimize away c:sum/c:product blocks that contain one or zero elements, so
  long as they do not contain a generator (since that would remove a ref) or @of
  (since that will actually loop through multiple).

  Note that we should *not* perform these optimizations if there are templates
  awaiting application or any other lv:* nodes that have not been expanded.
-->
<xsl:template match="c:sum[ lv:* or t:* ]|c:product[ lv:* or t:* ]" mode="preproc:expand" priority="7">
  <xsl:copy>
    <xsl:sequence select="@*" />
    <xsl:apply-templates mode="preproc:expand" />
  </xsl:copy>
</xsl:template>

<xsl:template match="c:sum[ not( @of or @generates ) and count( c:* ) &lt; 2 ]" mode="preproc:expand" priority="5">
  <xsl:apply-templates select="c:*" mode="preproc:expand" />
</xsl:template>
<xsl:template match="c:product[ not( @of or @generates ) and count( c:* ) &lt; 2 ]" mode="preproc:expand" priority="5">
  <xsl:apply-templates select="c:*" mode="preproc:expand" />
</xsl:template>


<!-- TODO: We could add shorthand for indexes too, e.g. name[i] or name[0] -->
<xsl:template match="
    c:apply[
      @*[
        not(
          local-name() = 'name'
          or local-name() = 'label'
        )
      ]
    ]
  "
  mode="preproc:expand" priority="5">

  <xsl:copy>
    <!-- keep the name attribute, which specifies what function to apply -->
    <xsl:sequence select="@name, @label" />

    <!-- every other attribute should be converted into an argument -->
    <xsl:call-template name="preproc:arg-short-expand" />

    <xsl:apply-templates select="c:arg" mode="preproc:expand" />
  </xsl:copy>
</xsl:template>


<xsl:template name="preproc:arg-short-expand">
  <xsl:for-each select="@*[
      not(
        local-name() = 'name'
        or local-name() = 'label'
      )
    ]">

    <c:arg name="{local-name()}">
      <c:value-of name="{.}" />
    </c:arg>
  </xsl:for-each>
</xsl:template>


<xsl:template match="lv:rate[ lv:class ]|lv:function[ lv:class ]|lv:yield[ lv:class ]"
  mode="preproc:expand" priority="9">
  <!-- already processed -->
  <xsl:copy>
    <xsl:sequence select="@*" />
    <xsl:apply-templates mode="preproc:expand" />
  </xsl:copy>
</xsl:template>

<!--
  Add lv:class nodes containing the values of each individual class

  This eliminates the need to tokenize later and drastically simplifies xpath
  queries.
-->
<xsl:template match="lv:rate|lv:function|lv:yield" mode="preproc:expand" priority="5">
  <xsl:variable name="self" select="." />

  <xsl:variable name="classes" select="tokenize( @class, ' ' )" />
  <xsl:variable name="no-classes" select="tokenize( @no, ' ' )" />

  <xsl:copy>
    <xsl:sequence select="@*" />

    <!-- convert classes into nodes to make life easier down the road (if any) -->
    <xsl:for-each select="$classes">
      <xsl:if test=".">
        <lv:class ref="{.}" no="false" />
      </xsl:if>
    </xsl:for-each>

    <xsl:for-each select="$no-classes">
      <xsl:if test=".">
        <lv:class ref="{.}" no="true" />
      </xsl:if>
    </xsl:for-each>

    <xsl:apply-templates mode="preproc:expand" />
  </xsl:copy>
</xsl:template>



<!--
  To make life a bit easier, calculate the set type of a classification @yields
  and add it to the node as a @set attribute
-->
<xsl:template match="lv:classify" mode="preproc:expand" priority="5">
  <xsl:variable name="self" select="." />

  <xsl:copy>
    <!-- if there is no @yields attribute, then generate one -->
    <xsl:if test="not( @yields )">
      <xsl:attribute name="yields">
        <xsl:text>__is</xsl:text>
        <!-- certain characters are not valid for @yields -->
        <xsl:value-of select="translate( @as, '-', '' )" />
      </xsl:attribute>
    </xsl:if>

    <xsl:apply-templates mode="preproc:expand"
                         select="@*" />

    <!-- copy everything else -->
    <xsl:apply-templates mode="preproc:expand" />
  </xsl:copy>
</xsl:template>


<!--
  Normalize whitespace for class descriptions
-->
<xsl:template mode="preproc:expand" priority="5"
              match="lv:classify/@desc">
  <xsl:attribute name="desc"
                 select="normalize-space( . )" />
</xsl:template>

<!--
  All other class attributes are copied verbatim
-->
<xsl:template mode="preproc:expand" priority="1"
              match="lv:classify/@*">
  <xsl:sequence select="." />
</xsl:template>


<!-- default lv:match/@on short-hand to assert on a value of TRUE -->
<xsl:template match="lv:match[ not( @value
                                    or @anyOf
                                    or @pattern
                                    or * ) ]"
  mode="preproc:expand" priority="7">

  <xsl:copy>
    <xsl:copy-of select="@*" />
    <xsl:attribute name="value"
                   select="'TRUE'" />
  </xsl:copy>
</xsl:template>


<xsl:template mode="preproc:expand"
              match="lv:join[ @all='true' ]"
              priority="8">
  <xsl:call-template name="preproc:mk-class-join-contents" />
</xsl:template>


<xsl:template mode="preproc:expand"
              match="lv:join"
              priority="7">
  <lv:any>
    <xsl:call-template name="preproc:mk-class-join-contents" />
  </lv:any>
</xsl:template>


<xsl:template name="preproc:mk-class-join-contents">
  <xsl:variable name="prefix" select="@prefix" />

  <!-- TODO: remove lv:template nodes in a pass before this so that this
       check is not necessary -->
  <xsl:for-each select="root(.)/lv:classify[
                        starts-with( @as, $prefix )
                        and not( ancestor::lv:template )
                        ]">
    <lv:match value="TRUE">
      <xsl:attribute name="on">
        <xsl:choose>
          <xsl:when test="@yields">
            <xsl:value-of select="@yields" />
          </xsl:when>

          <xsl:otherwise>
            <xsl:text>__is</xsl:text>
            <xsl:value-of select="@as" />
          </xsl:otherwise>
        </xsl:choose>
      </xsl:attribute>
    </lv:match>
  </xsl:for-each>
</xsl:template>


<!-- enums have implicit values (as they are, well, enumerated; @value overrides) -->
<!-- TODO: should @value set the next implicit index? -->
<xsl:template match="lv:item[ not( @value ) ]" mode="preproc:expand" priority="5">
  <xsl:copy>
    <xsl:sequence select="@*" />
    <xsl:attribute name="value" select="count( preceding-sibling::* )" />
    <xsl:apply-templates mode="preproc:expand" />
  </xsl:copy>
</xsl:template>


<xsl:template match="w:display[ @prefix ]" mode="preproc:expand" priority="5">
  <xsl:variable name="prefix" select="@prefix" />
  <xsl:variable name="children" select="w:*" />

  <xsl:for-each select="root(.)//lv:rate[ starts-with( @yields, $prefix ) ]">
    <w:display name="{@yields}">
      <xsl:sequence select="$children" />
    </w:display>
  </xsl:for-each>
</xsl:template>


<!-- remove templates that have been copied from an external source for
     processing -->
<xsl:template match="lv:template[
                       @name=root()
                         /preproc:symtable/preproc:sym[ @src ]/@name ]"
  mode="preproc:expand" priority="5">
</xsl:template>

<!-- IMPORTANT: do not process unexpanded templates -->
<xsl:template match="lv:template" mode="preproc:expand" priority="4">
  <xsl:sequence select="." />
</xsl:template>


<xsl:template match="preproc:symtable" mode="preproc:expand" priority="5">
  <!-- ignore -->
  <xsl:sequence select="." />
</xsl:template>


<xsl:template match="lv:__external-data" mode="preproc:expand" priority="5">
  <!-- intended for use by code generators; data is not retained in object file
       unless some other process overrides this template -->
</xsl:template>

</xsl:stylesheet>

<!--
Footnotes

What!? We need footnotes for this project!?

[0] This was a complicated issue to begin dealing with due to the information we
    need and the information that is available. In particular, at this point, we
    would like to exclude any non-external objects from appearing in the
    rate-only output, but we cannot do that, since the preprocessor has not yet
    reached that block! We cannot reorder, because the class order block depends
    on the rate block!

    (See the commit that introduced this footnote: In the past, the template at
    this position passed an `external-only' flag to the template.)

    Originally, the method was to ``guess'' based on the how the system was
    currently being used (dangerous, but was meant to be temporary...though we
    know how that goes...): implicit externals were ignored, meaning it may not
    function as we would like. Now, this could be resolved in the short-term by
    actually addinging explicit external attributes to everything that needed it
    so that this code would run smoothly. Worked great! Well, so I had thought.

    Then it came down to a certain classification that used the `frame'
    classification. This classification was only used by an external
    classification in scottsdale, but other companies used it for rating, so the
    @external classifier was inappropriate. Of course, the system could easily
    figure out if it was to be marked as external or not (it already does), but
    we do not yet have access to that information. Therefore, what ended up
    happening, was the frame classification was excluded from the classifier,
    excluded from one of the iterations that this footnote references (because
    it was not explicitly external) and included elsewhere where we didn't care
    if it was external or not. When the dependency tree was flattened to
    determine compilation order, the classification that uses `frame' was
    compiled *before* the `frame' classification itself, due to that exclusion!
    Since `frame' was excluded from the classifier, therefore, it was always
    false! That is the situation I was trying to avoid with the explicit
    @external attributes, but here, that solution would not work.

    Therefore, checking for external-only here will not work; we must output
    everything and work on post-processing the data once everything is said and
    done, to remove the duplicates that are also present in the classifier.
-->