File: docs

package info (click to toggle)
c%2B%2B-annotations 10.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 10,536 kB
  • ctags: 3,247
  • sloc: cpp: 19,157; makefile: 1,521; ansic: 165; sh: 128; perl: 90
file content (235 lines) | stat: -rw-r--r-- 5,807 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
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
string stringlist(string path, string subdir, string pattern)
{
    list lst;
    string entry;
    int idx;
    string ret;

    path += subdir + "/";
    chdir(subdir);

    lst = makelist(O_SUBDIR, "*");

    for (idx = listlen(lst); idx--; )
        ret += stringlist(path, element(idx, lst), pattern);

    lst = makelist(pattern);

    for (idx = listlen(lst); idx--; )
        ret +=  path + element(idx, lst) + " ";

    chdir("..");

    return ret;
}

void cleanup(string task, string files)
{
    list filelist;
    int idx;

    filelist = strtok(files, " ");
    
    for (idx = listlen(filelist); idx--; )
        system("tmp/bin/" + task + " -q " + element(idx, filelist));
}

void txtdoc()
{
    if (!exists("tmp/docs/txt/cplusplus.txt"))
    {
        md("tmp/docs/txt");
        chdir("yo");
        system("yodl2txt --no-warnings "
                "-o ../tmp/docs/txt/cplusplus.txt -l3 cplusplus");
        chdir("..");
    }
}

void htmldoc()
{
    list htmlList;
    int idx;
    string html;

    md("tmp/docs/html");

                                    // cp necessary files for HTML
    if (!exists("tmp/docs/html/annotations.gif"))
        system("cp -r html/* tmp/docs/html");

                                    // convert .yo to .html
    if (!exists("tmp/docs/html/cplusplus.html"))
    {
        chdir("yo");
        system("yodl2html --no-warnings -l3 cplusplus ");
        system("mv *.html ../tmp/docs/html");
        system("cp cplusplus.css ../tmp/docs/html");
        chdir("..");
    }

    chdir("tmp/docs/html");
                                    // index.html is the file holding the
                                    // <iframe>s: add it and related files
                                    // to tmp/docs/html
    if (!exists("index.html"))          
        system("cp ../../../single/* .");

    htmlList = (list)"cplusplus.html" + makelist("cplusplus??.html");

                                    // patch the html-files
    for (idx = listlen(htmlList); idx--; )
    {
        html = element(idx, htmlList);
        system("../../../scripts/patchhtml < " + html + " > _" + html);
        system("mv _" + html + " " + html);
    }

                                    // create the contents page
    system("../../../scripts/htmlcontentspage > contents.html");

                                    // write index entries to cplusplus.index
                                    // and create cppindex.html
    system("grep '^<index' cplusplus.html cplusplus??.html > "
                                                        "cplusplus.index");
    system("../../bin/htmlindex < cplusplus.index > cppindex.html");

                                    // remove the <index> entries from the
                                    // html files
    for (idx = listlen(htmlList); idx--; )
    {
        html = element(idx, htmlList);
        system("../../bin/rmindexlines < " + html + " > _" + html);
        system("mv _" + html + " " + html);
    }

    chdir(g_cwd);
}

void pspdf(string basename)
{
    string pdfname;
    string psname;

    chdir("tmp/docs/latex");

    psname = basename + ".ps";
    if (basename + ".dvi" younger psname)
        system("dvips -o" + psname + " " + basename);

    pdfname = basename + ".pdf";
    if (psname younger pdfname)
        system("ps2pdf " + psname + " " + pdfname);

    chdir(g_cwd);
}

void runps()
{
    pspdf("cplusplus");
    pspdf("cplusplusus");

    exit(0);
}

void latexdoc(string us, int makeps)
{
    string basename;
    string dvistamp;
    string latexname;
    string latexstamp;
    string ulatexname;
    string ulatexstamp;
    string yodldefine;

    md("tmp/docs/latex");

                                    // cp necessary files for LaTeX   
    if (!exists("tmp/docs/latex/cplusplus.sty"))
        system("cp -r latex/* tmp/docs/latex");

                                    // assign file name variables
    basename = "cplusplus" + us;
    latexname = basename + ".latex";
    ulatexname = "_" + latexname;

    ulatexstamp = "tmp/_" + basename + "-stamp";

                                    // create the _xxx.latex file
    if (!exists(ulatexstamp))
    {
        chdir("yo");

        if (us != "")
            yodldefine = "--define " + us;

        system("yodl2latex --no-warnings -l3 -DAPATH=" + g_cwd + "tmp/bin/ " +
                yodldefine + " -o ../tmp/docs/latex/" + 
                ulatexname + " cplusplus");
        chdir("..");
        system("touch " + ulatexstamp);
    }


    chdir("tmp/docs/latex");
    latexstamp = "../../../tmp/" + basename + "-stamp";

                                    // rm blanks around verb() statements
    if (!exists(latexstamp))
    {
        system("../../../scripts/patchlatexverb <" + ulatexname +
                                               ">" + latexname);
        system("touch " + latexstamp);
    }
     
                                    // make dvi-file   
    dvistamp = "../../../tmp/dvi" + us + "-stamp";

    if (!exists(dvistamp))
    {        
        system("latex " + latexname);
        system("latex " + latexname);

        system("sed 's/!/\"!/g' " + basename + ".idx |"
                    " makeindex -i -o " + basename + ".ind");

        system("../../../scripts/patchlatexidx " + us);
        system("latex " + latexname);

        system("rm _* *.out");
        system("touch " + dvistamp);
    }

    chdir(g_cwd);

    if (makeps)
        pspdf(basename);
}

void runtxt()
{ 
    system("rm -f tmp/docs/txt/cplusplus.txt");
    txtdoc();
    exit(0);
}

void runhtml()
{
    system("rm -rf tmp/docs/html tmp/html*-stamp");
    htmldoc();
    exit(0);
}
   
void docs()
{
    man();

    programs(1);

    txtdoc();
    htmldoc();
    latexdoc("", 1);
    latexdoc("us", 1);

    exit(0);
}