OpenCores
URL https://opencores.org/ocsvn/core_arm/core_arm/trunk

Subversion Repositories core_arm

[/] [core_arm/] [trunk/] [soft/] [doc/] [doc5.pl] - Blame information for rev 2

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 tarookumic
@d5_cuts;
2
$d5_dumphtml = "";
3
$d5_dumphtml_types = "";
4
%d5_dumphtml_types_alloc = ();
5
$d5_divstart = "\n<div onclick=\"javascript:totop('%id%')\" id=\"T%id%\" style=\"visibility:hidden; position:absolute; BACKGROUND-COLOR: white;\">\n<table border=1 cellpadding=0 cellspacing=0><tr><td><a href=\"javascript:hide('%id%')\"><img src=\"%img_docclose%\" alt=\"close\"></a>";
6
$d5_divend = "</td></tr></table>\n</div>";
7
 
8
sub d5_addcut
9
{
10
    my ($posbeg,$posend,$cmd,$arg) = @_;
11
    my (%cut,$filename);
12
    if ($dbgon == 1) { print ("\n+Addcut($posbeg,$posend,$cmd,$arg)\n");}
13
    %cut = ( posbeg => $posbeg,
14
             posend => $posend,
15
             cmd    => $cmd,
16
             arg    => $arg );
17
    push (@d5_cuts,[%cut]);
18
}
19
 
20
sub d5_dumpcut
21
{
22
    my $filename;
23
    my ($posbeg,$posend,$cmd,$arg,$i);
24
    my %tmp;
25
    if ($dbgon == 1) {
26
        for($i = 0;$i < $#d5_cuts;$i++) {
27
            %tmp = @{$d5_cuts[$i]};
28
            $posbeg = $tmp{posbeg};
29
            $posend = $tmp{posend};
30
            $cmd = $tmp{cmd};
31
            $arg = $tmp{arg};
32
            $filename = d3_filename ($posbeg);
33
            print("$filename"."[$posbeg-$posend]: $cmd($arg)\n");
34
        }
35
    }
36
}
37
 
38
sub d5_gethtml
39
{
40
    my ($beg,$end,$ommit) = @_;
41
    my ($filename,$posbeg,$posend,$ok,$id);
42
    my $cmd,my $arg,my $i=0,my $off,my $html="",my $part;
43
    my %tmp = ();
44
    my @cuts =();
45
    if ($dbgon == 1) {
46
        print ("Dump[$beg,$end]\n");
47
    }
48
    for($i = 0;$i <= $#d5_cuts;$i++) {
49
        %tmp = @{$d5_cuts[$i]};
50
        $posbeg = $tmp{posbeg};
51
        $posend = $tmp{posend};
52
        if (($posbeg >= $beg && $posbeg < $end) ||
53
            ($posend > $beg && $posend <= $end)) {
54
            if ($posbeg < $beg) {
55
                $posbeg = $beg;
56
            }
57
            if ($posend > $end) {
58
                $posend = $end;
59
            }
60
            $tmp{posbeg} = $posbeg;
61
            $tmp{posend} = $posend;
62
            push(@cuts,[%tmp]);
63
        }
64
    }
65
    $off = $beg;
66
    if ($dbgon == 1) {
67
        print ("Start Cutting from $off\n");
68
    }
69
    $html = "<pre><code class=\"vhdl\">";
70
    for($i = 0;$i <= $#cuts;$i++) {
71
        %tmp = @{$cuts[$i]};
72
        $posbeg = $tmp{posbeg};
73
        $posend = $tmp{posend};
74
        $part = substr($body_all,$posbeg,$posend-$posbeg);
75
        $cmd = $tmp{cmd};
76
        $arg = $tmp{arg};
77
        if ($dbgon == 1) {
78
            print ("Cut [$posbeg,$posend]: $cmd,$arg\n");
79
        }
80
        if ($off < $posbeg) {
81
            $html .= substr($body_all,$off,$posbeg-$off);
82
        }
83
        if (($cmd eq "vartyp") || ($cmd eq "record")) {
84
            ($ok,$id) = d5_addtype_dumphtml($arg);
85
            if ($ok == 1 && (not ($arg eq $ommit))) {
86
                $html .= "<a name=\"$arg\" href=\"javascript:show('$id')\">".$part."</a>";
87
            } else {
88
                $html .= $part;
89
            }
90
        } elsif ($cmd eq "const") {
91
            ($ok,$id) = d5_addconst_dumphtml($arg);
92
            if ($ok == 1 && (not ($arg eq $ommit))) {
93
                $html .= "<a name=\"$arg\" href=\"javascript:show('$id')\">".$part."</a>";
94
            } else {
95
                $html .= $part;
96
            }
97
        } elsif ($cmd eq "proc") {
98
            ($ok,$id) = d5_addproc_dumphtml($arg);
99
            if ($ok == 1 && (not ($arg eq $ommit))) {
100
                $html .= "<a name=\"$arg\" href=\"javascript:show('$id')\">".$part."</a>";
101
            } else {
102
                $html .= $part;
103
            }
104
        } elsif ($cmd eq "func") {
105
            ($ok,$id) = d5_addfunc_dumphtml($arg);
106
            if ($ok == 1 && (not ($arg eq $ommit))) {
107
                $html .= "<a name=\"$arg\" href=\"javascript:show('$id')\">".$part."</a>";
108
            } else {
109
                $html .= $part;
110
            }
111
        } elsif ($cmd eq "enum") {
112
            ($ok,$id) = d5_addenum_dumphtml($arg);
113
            if ($ok == 1 && (not ($arg eq $ommit))) {
114
                $html .= "<a name=\"$arg\" href=\"javascript:show('$id')\">".$part."</a>";
115
            } else {
116
                $html .= $part;
117
            }
118
        } elsif ($cmd eq "file") {
119
 
120
            ($ok,$id) = d5_addfile_dumphtml($arg);
121
            if ($ok == 1 && (not ($arg eq $ommit))) {
122
                $html .= "<a href=\"javascript:show('$id')\">".$part."</a>";
123
            } else {
124
                $html .= $part;
125
            }
126
        } elsif ($cmd eq "style") {
127
 
128
            $html .= "<span class=\"$arg\">$part</span>";
129
 
130
        } else {
131
            $html .= $part;
132
        }
133
        $off = $posend;
134
    }
135
    if ($off < $end) {
136
        $html .= substr($body_all,$off,$end-$off);
137
    }
138
    $html .= "</code></pre>";
139
}
140
 
141
sub d5_addfile_dumphtml()
142
{
143
    my ($type) = @_;
144
    my ($posbeg,$posend,$fname);
145
    my %tmp = ();
146
    my ($id,$html,$title);
147
    if (exists($d3_usedby_set{$type})) {
148
        %tmp = @{$d3_usedby_set{$type}};
149
        $html = $tmp{html};
150
        $id = $tmp{id};
151
        if (not (exists($d5_dumphtml_types_alloc{$id}))) {
152
            if ($dbgon == 1) {
153
                print ("Output file usage div [$id:$type]\n");
154
            }
155
            $d5_dumphtml_types_alloc{$id} = 1;
156
            $d5_dumphtml_types .= $html;
157
        }
158
        return (1,$id);
159
    }
160
    return (0,-1);
161
}
162
 
163
sub d5_addenum_dumphtml()
164
{
165
    my ($type) = @_;
166
    my ($posbeg,$posend,$fname);
167
    my %tmp = ();
168
    my ($id,$html,$title);
169
    if (exists($d2_enums{$type})) {
170
        %tmp = @{$d2_enums{$type}};
171
        $posbeg = $tmp{posbeg};
172
        $posend = $tmp{posend};
173
        $id = $tmp{id};
174
        if (not (exists($d5_dumphtml_types_alloc{$id}))) {
175
            if ($dbgon == 1) {
176
                print ("Output const div [$id:$type]\n");
177
            }
178
            $d5_dumphtml_types_alloc{$id} = 1;
179
            $fname = d3_filename($posbeg);
180
 
181
            $d3_pathreplace{"%$d3_pathreplaceid%"} = d3_gethtmlname($fname);
182
            $title = "&nbsp;&nbsp;&nbsp;Enum <b>$type</b> defined in <a href=\"%$d3_pathreplaceid%#$type\">$fname</a>";
183
            $title = $d5_divstart."$title<br>";
184
            $title =~ s/%id%/$id/g;
185
            $d3_pathreplaceid++;
186
 
187
            $html = d5_gethtml($posbeg,$posend,$type);
188
            $d5_dumphtml_types .= $title.$html.$d5_divend;
189
 
190
        }
191
        return (1,$id);
192
    }
193
    return (0,-1);
194
}
195
 
196
sub d5_addfunc_dumphtml()
197
{
198
    my ($type) = @_;
199
    my ($posbeg,$posend,$fname);
200
    my %tmp = ();
201
    my ($id,$html,$title);
202
    if (exists($d2_funcs{$type})) {
203
        %tmp = @{$d2_funcs{$type}};
204
        $posbeg = $tmp{posbeg};
205
        $posend = $tmp{posend};
206
        $id = $tmp{id};
207
        if (not (exists($d5_dumphtml_types_alloc{$id}))) {
208
            if ($dbgon == 1) {
209
                print ("Output const div [$id:$type]\n");
210
            }
211
            $d5_dumphtml_types_alloc{$id} = 1;
212
            $fname = d3_filename($posbeg);
213
            $d3_pathreplace{"%$d3_pathreplaceid%"} = d3_gethtmlname($fname);
214
            $title = "&nbsp;&nbsp;&nbsp;Function <b>$type</b> defined in <a href=\"%$d3_pathreplaceid%#$type\">$fname</a>";
215
            $title = $d5_divstart."$title<br>";
216
            $title =~ s/%id%/$id/g;
217
            $d3_pathreplaceid++;
218
 
219
            $html = d5_gethtml($posbeg,$posend,$type);
220
            $d5_dumphtml_types .= $title.$html.$d5_divend;
221
 
222
        }
223
        return (1,$id);
224
    }
225
    return (0,-1);
226
}
227
 
228
sub d5_addproc_dumphtml()
229
{
230
    my ($type) = @_;
231
    my ($posbeg,$posend,$fname);
232
    my %tmp = ();
233
    my ($id,$html,$title);
234
    if (exists($d2_procs{$type})) {
235
        %tmp = @{$d2_procs{$type}};
236
        $posbeg = $tmp{posbeg};
237
        $posend = $tmp{posend};
238
        $id = $tmp{id};
239
        if (not (exists($d5_dumphtml_types_alloc{$id}))) {
240
            if ($dbgon == 1) {
241
                print ("Output const div [$id:$type]\n");
242
            }
243
            $d5_dumphtml_types_alloc{$id} = 1;
244
            $fname = d3_filename($posbeg);
245
            $d3_pathreplace{"%$d3_pathreplaceid%"} = d3_gethtmlname($fname);
246
            $title = "&nbsp;&nbsp;&nbsp;Procedure <b>$type</b> defined in <a href=\"%$d3_pathreplaceid%#$type\">$fname</a>";
247
            $title = $d5_divstart."$title<br>";
248
            $title =~ s/%id%/$id/g;
249
            $d3_pathreplaceid++;
250
 
251
            $html = d5_gethtml($posbeg,$posend,$type);
252
            $d5_dumphtml_types .= $title.$html.$d5_divend;
253
 
254
        }
255
        return (1,$id);
256
    }
257
    return (0,-1);
258
}
259
 
260
sub d5_addconst_dumphtml()
261
{
262
    my ($type) = @_;
263
    my ($posbeg,$posend,$fname);
264
    my %tmp = ();
265
    my ($id,$html,$title);
266
    if (exists($d2_consts{$type})) {
267
        %tmp = @{$d2_consts{$type}};
268
        $posbeg = $tmp{posbeg};
269
        $posend = $tmp{posend};
270
        $id = $tmp{id};
271
        if (not (exists($d5_dumphtml_types_alloc{$id}))) {
272
            if ($dbgon == 1) {
273
                print ("Output const div [$id:$type]\n");
274
            }
275
            $d5_dumphtml_types_alloc{$id} = 1;
276
            $fname = d3_filename($posbeg);
277
            $d3_pathreplace{"%$d3_pathreplaceid%"} = d3_gethtmlname($fname);
278
            $title = "&nbsp;&nbsp;&nbsp;Constant <b>$type</b> defined in <a href=\"%$d3_pathreplaceid%#$type\">$fname</a>";
279
            $title = $d5_divstart."$title<br>";
280
            $title =~ s/%id%/$id/g;
281
            $d3_pathreplaceid++;
282
 
283
            $html = d5_gethtml($posbeg,$posend,$type);
284
            $d5_dumphtml_types .= $title.$html.$d5_divend;
285
 
286
        }
287
        return (1,$id);
288
    }
289
    return (0,-1);
290
}
291
 
292
 
293
sub d5_addtype_dumphtml
294
{
295
    my ($type) = @_;
296
    my ($posbeg,$posend,$fname);
297
    my %tmp = ();
298
    my ($id,$html,$title);
299
 
300
    if (exists($d2_records{$type})) {
301
        %tmp = @{$d2_records{$type}};
302
        $posbeg = $tmp{posbeg};
303
        $posend = $tmp{posend};
304
        $id = $tmp{id};
305
        if (not (exists($d5_dumphtml_types_alloc{$id}))) {
306
            if ($dbgon == 1) {
307
                print ("Output record div [$id:$type]\n");
308
            }
309
            $d5_dumphtml_types_alloc{$id} = 1;
310
            $fname = d3_filename($posbeg);
311
            $d3_pathreplace{"%$d3_pathreplaceid%"} = d3_gethtmlname($fname);
312
            $title = "&nbsp;&nbsp;&nbsp;Type <b>$type</b> defined in <a href=\"%$d3_pathreplaceid%#$type\">$fname</a>";
313
            $title = $d5_divstart."$title<br>";
314
            $title =~ s/%id%/$id/g;
315
            $d3_pathreplaceid++;
316
 
317
            $html = d5_gethtml($posbeg,$posend,$type);
318
            $d5_dumphtml_types .= $title.$html.$d5_divend;
319
        }
320
        return (1,$id);
321
    }
322
    return (0,-1);
323
}
324
 
325
sub d5_assemblehtml
326
{
327
    my ($filename,$html,$dhtml,$template,$header) = @_;
328
    my $body = d3_readfile($template,0);
329
    $body =~ s/%replace%/$html$dhtml/g;
330
    $body =~ s/%header%/$header/g;
331
    $body =~ s/%filename%/$filename/g;
332
    return $body;
333
}
334
 
335
1;

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.