⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 v2html

📁 v2html - verilog to html converter 主要为FPGA和ASIC工作人员
💻
📖 第 1 页 / 共 5 页
字号:
    print F "---output files\n";    foreach $file (@output_files) {	print F "$file\n";    }    print F "---options\n";    foreach $opt (@args) {	print F "$opt\n";    }    close(F);}################################################################################ Print out the footer#  arguments: $out: output file handle#              $src: name of source file (to put in footer)#              $js:  flag telling it whether to print it, or#                     to generate javascript to print itsub print_footer {    my ($out,$src,$narrow,$js) = @_;    print_h_or_js($out,"<hr>\n",$js);    print_h_or_js($out,"<table>\n <tr><td><i>This page:<\/i><\/td>\n",$js);    print_h_or_js($out,"<td> </td></tr><tr>\n",$js) if $narrow;    if ($maint ne '') {	print_h_or_js($out,"  <td><i>Maintained by:<\/i><\/td>\n",$js);	print_h_or_js($out,"  <td><i><a href=\"mailto:" . $maint . "\">\n",$js);	print_h_or_js($out,"  " . $maint . "<\/a><\/i><\/tr>\n<tr>\n",$js);	print_h_or_js($out,"<td> </td>\n",$js) if !$narrow;    }    print_h_or_js($out,"  <td><i>Created:<\/i><\/td><td><i>" . 	localtime() . "<\/i><\/td><\/tr>\n",$js);        if ($src ne '') {	print_h_or_js($out,"<tr>\n",$js);	print_h_or_js($out," <td> </td>\n",$js) if !$narrow;	print_h_or_js($out," <td><i>From:<\/i><\/td><td><i>\n",$js);	if ($link_to_source) {	    print_h_or_js($out,"  <a href=\"" . $src . "\">\n",$js);	    quote_html(\$src);	    print_h_or_js($out,$src . "<\/a>",$js);	}	else {	    quote_html(\$src);	    print_h_or_js($out,$src,$js);	}	print_h_or_js($out, "<\/i><\/td><\/tr>\n",$js);    }    print_h_or_js($out,"</table>\n<hr>\n",$js);    ##################################################################    #             Do not alter any of this footer information        #    ##################################################################    print_h_or_js($out,'<table width="100%"><tr><td><i>Verilog converted to html by ',$js);    print_h_or_js($out,' <a target="_top" '.		  'href="http://www.burbleland.com/v2html/v2html.html">',$js);    print_h_or_js($out,"  v2html $version<\/a> \n",$js);    print_h_or_js($out," (written by",$js);    print_h_or_js($out," <a href=\"mailto:v2html730\@burbleland.com\">",$js);    print_h_or_js($out,"Costas Calamvokis<\/a>).<\/i></td>",$js);    print_h_or_js($out,'<td align="right"><b>'.		  '<a href="http://www.burbleland.com/v2html/help_7_30.html?'.		  $help_info.'">Help</a></b></td>',$js) if !$narrow;    print_h_or_js($out,'</tr></table>',$js);    ##################################################################    #                    End of footer information                   #    ##################################################################    # put a big blank table (90% of the size of the window) at the    # bottom of the page to make it scroll better    print_h_or_js($out, "<table height=\"90%\"><tr><td></td></tr></table>\n" , $js);}################################################################################   Print out a navigation bar###############################################################################sub print_navbar {    my ($out,$js,$type,$data,$prevnext,$prevnext_file,$narrow) = @_;    my ($elem,$col,$elem_num);    $col = @{$data->{order}};    # skip hierarchy if frames are on - it'll always be in top frame    if ($frames) {	foreach $elem (@{$data->{order}}) {	    $col-- if $elem eq 'Hierarchy';	}    }    if ($type eq 'Hierarchy' && ($cgi_script||$js_hier)) {	$col+=2; # put in two extra buttons for the show all/hide all    }    # prev next takes an extra column    $col++ if $prevnext;    return unless ($col);    my $width = $narrow ? 33 : int(100/$col);    my $td_code="<td align=\"center\" width=\"$width\%\" ".           "onmousedown=\"this.style.border=\\'inset\\';\" ". 	       "onmouseup=\"this.style.border=\\'outset\\';\" ";    # if we are framed then we can't just set location when a table    #  element is clicked, have to set parent.middle.location to put    #  code into the middle frame, and     my $frame_code_js;    my $frame_top_js;    ($frame_code_js = $frame_code) =~ s/^.*"(.*)".*$/parent.$1./;    $frame_code_js="" if $frame_code_js =~ m/_top/;    ($frame_top_js  = $frame_top)  =~ s/^.*"(.*)".*$/parent.$1./;    print_h_or_js($out,"<center><table class=$classes{navbar} cols=$col ".		  "><tr>",$js);    if ($prevnext) {	print_h_or_js($out,"$td_code onclick=\"${frame_code_js}location=\\'$prevnext_file\\';\">".		      "<a $frame_code href=\"$prevnext_file\">$prevnext</a></td>",		      $js);    }    $elem_num=0;    foreach $elem (@{$data->{order}}) {	if ($type eq 'Hierarchy' && $elem eq 'Hierarchy') {	    if ($cgi_script) {		print_h_or_js($out,"$td_code onclick=\"${frame_top_js}location=\\'$cgi_script$web_base/?k=$cgi_key&x=C&in=$hier_file&f=$frames\\';\"><a $frame_top " . 		    "href=\"$cgi_script$web_base/?k=$cgi_key&x=C&in=$hier_file&f=$frames\">" .			"Hide All</a></td>\n",0);		print_h_or_js($out,"$td_code onclick=\"${frame_top_js}location=\\'$cgi_script$web_base/?k=$cgi_key&x=A&in=$hier_file&f=$frames\\';\"><a $frame_top " . 		    "href=\"$cgi_script$web_base/?k=$cgi_key&x=A&in=$hier_file&f=$frames\">" .			"Show All</a></td>\n",0);		$elem_num+=2;	    }	    if ($js_hier && $js) {		print_h_or_js($out,"$td_code onclick=\"javascript:parent.printIt(\\'C\\',-1)\">".			      "<a href=\"javascript:parent.printIt(\\'C\\',-1);\">".			      "Hide All</a></td>\n",1);		print_h_or_js($out,"$td_code onclick=\"javascript:parent.printIt(\\'A\\',-1);\">".			      "<a href=\"javascript:parent.printIt(\\'A\\',-1)\">".			      "Show All</a></td>\n",1);		$elem_num+=2;	    }	}	# skip hierarchy if frames are on - it'll always be in top frame	next if (($elem eq 'Hierarchy') && $frames);	if ($narrow && ($elem_num!=0) && (($elem_num%3)==0)) {  	    print_h_or_js($out,"</tr><tr>",$js); 	}	$elem_num++;	if ( $elem eq $type ) {	    print_h_or_js($out,"$td_code>".			  "<font color=\"#808080\">$elem</font></td>",$js);	}	else {	    my $i = $data->{$elem};	    $i =~ s|\\|\\\\|;	    print_h_or_js($out,"$td_code onclick=\"${frame_code_js}location=\\'$i\\';\">".			  "<a $frame_code href=\"$data->{$elem}\">$elem</a></td>",			  $js);	}    }    print_h_or_js($out,"<\/tr><\/table><\/center>\n",$js);}################################################################################   Index printing############################################################################################################################################################### Collect the data and print all indexes#sub print_indexes {    my ($fdata,$js) = @_;    my (@files,@modules,@signals,@tasks,@functions,$m,$sig,$tf,$t_type,$indl);    # this stores the mapping between index letter and index file name    #  for each of the indexes, as well as the nav bar    $index_info = {};    # approx line count we'd like for an index, divide be expected lines    #  per entry to give number of elements per index that we need to    #  call print index    $indl = 1000;     @files = &rvp::get_files($fdata);           # get the files    @modules = &rvp::get_modules($fdata);       # get the modules    # get the signals    @signals = ();    foreach $m (&rvp::get_modules($fdata)) {	foreach $sig (&rvp::get_modules_signals($fdata,$m)) {	    push (@signals,"$sig $m");	}    }    # get the tasks and functions    @tasks = @functions = ();    foreach $m (&rvp::get_modules($fdata)) {	foreach $tf (&rvp::get_modules_t_and_f($fdata,$m)) {	    ($t_type)=&rvp::get_modules_t_or_f($fdata,$m,$tf);	    if ($t_type eq 'task') {  push (@tasks,"$tf $m");     }	    else {                    push (@functions,"$tf $m"); }	}    }    # sort and split them across files    $index_info->{Files}    = calc_index($fdata,$navbar{Files},\@files, $indl/4);    $index_info->{Modules}  = calc_index($fdata,$navbar{Modules},\@modules,$indl/8);    $index_info->{Signals}  = calc_index($fdata,$navbar{Signals},\@signals, $indl/20);    $index_info->{Tasks}    = calc_index($fdata,$navbar{Tasks},\@tasks, $indl/3);    $index_info->{Functions}= calc_index($fdata,$navbar{Functions},\@functions, $indl/3);    # now print all the indexes    print_index($fdata,$index_info->{Files},'Files',\@files,\&print_file_index);    print_index($fdata,$index_info->{Modules},'Modules',\@modules,\&print_module_index);    print_index($fdata,$index_info->{Signals},'Signals',\@signals,\&print_signal_index);    print_index($fdata,$index_info->{Tasks},'Tasks',\@tasks,\&print_tf_index);    print_index($fdata,$index_info->{Functions},'Functions',\@functions,\&print_tf_index);}################################################################################ calculate all sorts of stuff about the index (also sorts the data)#  returns a hash for the that is stored in $index_info->{type}#sub calc_index {    my ($fdata,$fname, $data, $items_per_index) = @_;    my ($first_char,$elem_first_char,$info,$page,$ofile,$i,$items);    # do a case insensitive sort (but make sure it is determinate if the    #  items only differ in case)    @{$data} = sort { (uc($a) ne uc($b)) ? uc($a) cmp uc($b)  : 		                           $a cmp $b            } @{$data};    # work out the indexes    $first_char=""; # make sure it will not match    $page=$items=0;    $info            = {};    $info->{nb}        = {}; # navbar, labels and links eg {A}='hierarchy-fn#index--A'    $info->{nb}{order} = []; #  the navbar order, array of other keys (A,B...)    $info->{letters}   = {}; # hash mapping start letters to index files    $info->{pages}     = 0;  # number of pages    $info->{files}     = []; # array of hashes { name, start, end } indexed 1,2...    for ($i=0;$i<scalar(@{$data});$i++) { 	$elem_first_char=uc(substr($data->[$i],0,1));	if ($elem_first_char ne $first_char) {	    if ($items==0 || $items_per_index<$items) {		if ($page) { $info->{files}[$page]{end} = $i; }		$page++;		$ofile=$fname;		$ofile =~ s/.html$/.p$page.html/ if ($page != 1);		$info->{files}[$page] = { name => $ofile, start => $i};		$items=0;	    }	    $info->{letters}{$elem_first_char} = $ofile;	    $first_char=$elem_first_char;	    push(@{$info->{nb}{order}},$first_char);	    $info->{nb}{$first_char} = "$ofile#index--$first_char";	}	$items++;    }    if ($page) {	$info->{pages}=$page;	$info->{files}[$page]{end} = $i;    }    else { # handle case where there was no data	$info->{pages}=1;	$info->{files}[1] = { name => $fname , start => 0 , end => 0 };    }    return $info;}################################################################################ Print one index - calls out to printfn to print each entry#sub print_index {    my ($fdata,$info, $type, $data, $printfn) = @_;    my ($i,$first_char,$elem_first_char,$page,$ofile);    local (*OUT);    for ($page=1;$page<=$info->{pages};$page++) {	$ofile=$info->{files}[$page]{name};		open(OUT,">$out_dir$ofile") || 	    die "Error: can not open file $out_dir$ofile to write: $!\n";	push(@output_files,"$out_dir$ofile");	print OUT "<!-- v2html $type index  -->\n";	print OUT "<html><head>\n";	print OUT "<title>$type index".(($page==1)?"":" page $page")."</title>\n";	print OUT $style_sheet_link;	print OUT "</head>\n";	if ($js_sigs) {	    # dummy function in case someone tries to do a search in the index 	    print OUT "<script language=\"JavaScript\" type=\"text\/javascript\"><!--\n";	    print_js_common(*OUT);	    print OUT "function search ()     { return false; }\n";	    print OUT "// -->\n";	    print OUT "</script>\n";	}	print OUT "<body>\n";		print OUT "<a name=\"top_of_page\"></a>\n";	if ($page==1) { print_navbar(*OUT,0,$type,\%navbar,'','',0); }	else          { print_navbar(*OUT,0,$type,\%navbar,"Prev Page",				     $info->{files}[$page-1]{name}.'#bottom_of_page',				     0); }	print_navbar(*OUT,0,'',$info->{nb},'','',0);	print OUT "<center><h3>$type index</h3></center>\n";		$first_char=""; # make sure it will not match 		for ($i=$info->{files}[$page]{start};$i<$info->{files}[$page]{end};$i++) {	    $elem_first_char=uc(substr($data->[$i],0,1));	    if ($elem_first_char ne $first_char) {		$first_char=$elem_first_char;		print OUT "<a name=\"index--$first_char\"></a>\n";		print_navbar(*OUT,0,'',			     { order=>[$first_char], $first_char=>"#top_of_page"},			     '','',0);	    }	    &{$printfn}(*OUT,$fdata,$data->[$i]);	}		print_navbar(*OUT,0,'',$info->{nb},'','',0);	if ($page==$info->{pages}) { print_navbar(*OUT,0,$type,\%navbar,'',''); }	else          { print_navbar(*OUT,0,$type,\%navbar,"Next Page",				     $info->{files}[$page+1]{name},0); }	print_footer(*OUT,'',0,0);	print OUT "</body>\n";	print OUT "</html>\n";	close(OUT);    }}################################################################################ Called to print on entry in the file index#sub print_file_index {    my ($out,$fdata,$data) = @_;    my ($m,$ms,$qword,$title,$inc,$i,$comma,$inc_by);    $title  = "<b><a name=\"$data\"></a>".	"<a $frame_middle href=\"".hfile($data,1)."\">$data</a></b>\n";    $ms=$comma='';    foreach $m (sort &rvp::get_files_modules($fdata,$data)) {	$qword = $m; quote_html(\$qword);	if (&rvp::module_exists($fdata,$m)) {	    $ms .= "$comma<a href=\"".index_link("Modules",$m)."\">$qword</a>&nbsp;";	}	else { $ms .= "$comma$qword&nbsp;"; }	$comma=', ';    }    $inc=$comma='';    foreach $i (sort &rvp::get_files_includes($fdata,$data)) {	$qword = $i; quote_html(\$qword);	if (&rvp::file_exists($fdata,$i)) {	    $inc .= "$comma<a href=\"".index_link("Files",$i)."\">$qword</a>&nbsp;";	}	else { $inc .= "$comma$qword&nbsp;"; }	$comma=', ';    }    $inc_by=$comma='';    foreach $i (sort &rvp::get_files_included_by($fdata,$data)) {	$qword = $i; quote_html(\$qword);	if (&rvp::file_exists($fdata,$i)) {	    $inc_by .= "$comma<a href=\"".index_link("Files",$i)."\">$qword</a>&nbsp;";	}	else { $inc_by .= "$comma$qword&nbsp;"; }	$comma=', ';    }    print_itable( $out , $title  ,		 [ "Full name:"  , &rvp::get_files_full_name($fdata,$data) ,		   "Modules:"    , $ms  ,		   "Includes:"   , $inc ,		   "Included by:", $inc_by ]);}################################################################################ Called to print on entry in the module index

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -