File: references.c

package info (click to toggle)
abiword 0.7.7-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 20,604 kB
  • ctags: 18,358
  • sloc: cpp: 88,791; ansic: 66,296; sh: 7,777; makefile: 3,397; xml: 687; perl: 361; awk: 273; sed: 36; csh: 28
file content (121 lines) | stat: -rw-r--r-- 3,898 bytes parent folder | download
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
#include <stdlib.h>
#include <stdio.h>
#include "wv.h"

#if 0
extern FILE *erroroutput;
extern FILE *outputfile;
extern DOP dop;
extern long int cp;
extern int insuper;
extern int footnotehack;


void decode_f_reference(textportions *portions)
    {
    U32 i;
    error(erroroutput,"footnotes\n");
    /*
    search in the first thing for the cp of this
    reference, then use this index into the second
    one to determine what text to use ?
    */
    i=0;
    while(i<portions->fndref_no)
        {
        if (portions->fndRef[i] == cp)
            {
            error(erroroutput,"found correct ref pos at %x, index was %d\n",portions->fndRef[i],i);
            if (portions->fndFRD[i].frd > 0)
                {
                if (!insuper)
                    {
                    fprintf(outputfile,"<sup>");
                    insuper=2;
                    }
                error(erroroutput,"is autonumbered <%d>\n",portions->fndFRD[i].frd);
                portions->auto_foot++;
                fprintf(outputfile,"<a href=\"#foot%d\">",i);
				decode_list_nfc(portions->fndFRD[i].frd,dop.new_nfcFtnRef);
                fprintf(outputfile,"</a>");
                }
            else
                {
                error(erroroutput,"is custom <%d>\n",portions->fndFRD[i].frd);
                /*dont handling custom footnotes the same way*/
                fprintf(outputfile,"<a href=\"#foot%d\">",i);
                footnotehack=1;
                }
            if (insuper==2)
                fprintf(outputfile,"</sup>");
            break;
            }
        error(erroroutput,"conpared given pos %x and ref list %x",cp,portions->fndRef[i]);
        i++;
        }

    /*
    now to hold off to the end of the page, before listing the references
    off
    */
    if ( (i < portions->fndref_no ) && (i < 256) )
        portions->list_footnotes[portions->list_foot_no++] = i;
    else if (i >= 256)
        fprintf(erroroutput,"oops silly programmer :-) lost a footnote\n");
    }


void decode_e_reference(textportions *portions)
    {
    int i;
    error(erroroutput,"endnotes\n");
    /*
    search in the first thing for the cp of this
    reference, then use this index into the second
    one to determine what text to use ?
    */
    i=0;
    while(i<portions->endref_no)
        {
        if (portions->endRef[i] == cp)
            {
            error(erroroutput,"found correct ref pos at %x, index was %d\n",portions->endRef[i],i);
            if (portions->endFRD[i].frd > 0)
                {
                if (!insuper)
                    {
                    fprintf(outputfile,"<sup>");
                    insuper=2;
                    }
                error(erroroutput,"is autonumbered <%d>, i is %d, true is %d\n",portions->endFRD[i].frd,i,portions->endTrueFRD[i]);
				portions->endTrueFRD[i] = portions->auto_end++;
                fprintf(outputfile,"<a href=\"#end%d\">",i);
				decode_list_nfc(portions->endTrueFRD[i],dop.new_nfcEdnRef);
                fprintf(outputfile,"</a>");
                }
            else
                {
                error(erroroutput,"is custom <%d>\n",portions->endFRD[i].frd);
                /*dont handling custom footnotes the same way*/
                fprintf(outputfile,"<a href=\"#end%d\">",i);
                footnotehack=1;
                }
            if (insuper==2)
                fprintf(outputfile,"</sup>");
            break;
            }
        error(erroroutput,"conpared given pos %x and ref list %x",cp,portions->endRef[i]);
        i++;
        }

    /*
    now to hold off to the end of the page, before listing the references
    off
    */
    if ( (i < portions->endref_no ) && (i < 256) )
        portions->list_endnotes[portions->list_end_no++] = i;
    else if (i >= 256)
        fprintf(erroroutput,"oops silly programmer :-) lost a endnote\n");
    }

#endif