xref: /titanic_50/usr/src/tools/scripts/wdiff.pl (revision daaffb314aae330855b7faea7a653244767ed744)
1*daaffb31Sdp#!/usr/bin/perl -w
27c478bd9Sstevel@tonic-gate#
37c478bd9Sstevel@tonic-gate# CDDL HEADER START
47c478bd9Sstevel@tonic-gate#
57c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the
6*daaffb31Sdp# Common Development and Distribution License (the "License").
7*daaffb31Sdp# You may not use this file except in compliance with the License.
87c478bd9Sstevel@tonic-gate#
97c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate# and limitations under the License.
137c478bd9Sstevel@tonic-gate#
147c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate#
207c478bd9Sstevel@tonic-gate# CDDL HEADER END
217c478bd9Sstevel@tonic-gate#
227c478bd9Sstevel@tonic-gate#
237c478bd9Sstevel@tonic-gate# ident	"%Z%%M%	%I%	%E% SMI"
247c478bd9Sstevel@tonic-gate#
25*daaffb31Sdp# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
267c478bd9Sstevel@tonic-gate# Use is subject to license terms.
277c478bd9Sstevel@tonic-gate#
287c478bd9Sstevel@tonic-gate# Make a dynamic HTML page for the unified diffs between two (C) files.
297c478bd9Sstevel@tonic-gate#
307c478bd9Sstevel@tonic-gate
317c478bd9Sstevel@tonic-gateuse Getopt::Std;
327c478bd9Sstevel@tonic-gate
337c478bd9Sstevel@tonic-gate$diffword = "wdiff";
347c478bd9Sstevel@tonic-gate$context = 10;
357c478bd9Sstevel@tonic-gate
36*daaffb31Sdpgetopt('t:c:');
377c478bd9Sstevel@tonic-gate
387c478bd9Sstevel@tonic-gateif ($#ARGV + 1 == 1) {
397c478bd9Sstevel@tonic-gate	$diffword = $ARGV[0];
407c478bd9Sstevel@tonic-gate	open DIFF, "<&STDIN";
417c478bd9Sstevel@tonic-gate	$ARGV[0] = '-';
427c478bd9Sstevel@tonic-gate	$ARGV[1] = '-';
437c478bd9Sstevel@tonic-gate} elsif ($#ARGV + 1 == 2) {
447c478bd9Sstevel@tonic-gate	open DIFF, "diff -D $diffword $ARGV[0] $ARGV[1] | expand |";
457c478bd9Sstevel@tonic-gate} else {
46*daaffb31Sdp	print "Usage: $0 [-t title] [-c comment] file1 file2\n";
477c478bd9Sstevel@tonic-gate	exit 2;
487c478bd9Sstevel@tonic-gate}
497c478bd9Sstevel@tonic-gate
507c478bd9Sstevel@tonic-gate$title = $opt_t ? $opt_t : "Differences between $ARGV[0] and $ARGV[1]";
51*daaffb31Sdp$comment = "";
52*daaffb31Sdpif (defined $opt_c) {
53*daaffb31Sdp	$comment = "<pre>\n" . $opt_c . "\n</pre>\n<hr />";
54*daaffb31Sdp}
557c478bd9Sstevel@tonic-gate
567c478bd9Sstevel@tonic-gate$indiff = 0;
577c478bd9Sstevel@tonic-gate$line1 = 0;
587c478bd9Sstevel@tonic-gate$line2 = 0;
597c478bd9Sstevel@tonic-gate@pretext = ();		# Speculative pretext buffer (code)
607c478bd9Sstevel@tonic-gate$posttext = 0;		# Lines of posttext to print
617c478bd9Sstevel@tonic-gate$nelided = 0;		# Number of elided chunks
627c478bd9Sstevel@tonic-gate$endfunc = 0;		# Seen end of function?
637c478bd9Sstevel@tonic-gate$inelided = 0;		# Elided section open?
647c478bd9Sstevel@tonic-gate$elided_lines = 0;
657c478bd9Sstevel@tonic-gate
667c478bd9Sstevel@tonic-gateprint <<END;
67*daaffb31Sdp<?xml version="1.0"?>
68*daaffb31Sdp<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
69*daaffb31Sdp    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
70*daaffb31Sdp<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
717c478bd9Sstevel@tonic-gate  <head>
727c478bd9Sstevel@tonic-gate    <title>$title</title>
737c478bd9Sstevel@tonic-gate
74*daaffb31Sdp    <meta http-equiv="cache-control" content="no-cache" />
75*daaffb31Sdp
76*daaffb31Sdp    <style type='text/css' media='screen'>
77*daaffb31Sdp      pre	{ margin: 2px; }
78*daaffb31Sdp
79*daaffb31Sdp      body	{ background-color: #eeeeee; }
80*daaffb31Sdp
81*daaffb31Sdp      hr	{ border: none 0; border-top: 1px solid #aaa; height: 1px; }
82*daaffb31Sdp
83*daaffb31Sdp      .subtracted { color: brown }
847c478bd9Sstevel@tonic-gate      .added	{ color: blue }
857c478bd9Sstevel@tonic-gate
86*daaffb31Sdp      .elided	{ border: 1px solid #444; cursor: pointer; margin: 1px }
877c478bd9Sstevel@tonic-gate
88*daaffb31Sdp      table.hidebar { border: 1px solid #ff9900; background-color: #eee;
89*daaffb31Sdp      		  text-align: center; border-collapse: collapse; }
907c478bd9Sstevel@tonic-gate
91*daaffb31Sdp      .hidebar td.active-down { border: 1px solid #ff9900;
92*daaffb31Sdp		border-right: 1px solid #ccc; cursor: s-resize }
937c478bd9Sstevel@tonic-gate
94*daaffb31Sdp      .hidebar td.active-down:hover { background-color: #ffcc99; }
957c478bd9Sstevel@tonic-gate
96*daaffb31Sdp      .hidebar td.active-up { border: 1px solid #ff9900; cursor: n-resize;
97*daaffb31Sdp		border-left: 1px solid #ccc; }
987c478bd9Sstevel@tonic-gate
99*daaffb31Sdp      .hidebar td.active-up:hover { background-color: #ffcc99; }
100*daaffb31Sdp
101*daaffb31Sdp      .hidebar td.elided-label { font-style: italic; width: 12em; }
102*daaffb31Sdp
103*daaffb31Sdp      .cmdbox	{ position: fixed; top: 0; right: 0;
104*daaffb31Sdp	          border-left: solid 1px #444;
105*daaffb31Sdp	          border-bottom: solid 1px #444;
106*daaffb31Sdp      		  background-color: #ccc; text-align: center }
107*daaffb31Sdp
108*daaffb31Sdp      .cmdbox td { background-color: #eee; border: 1px #444 outset;
109*daaffb31Sdp		   cursor: pointer; padding: 3px 4px; }
110*daaffb31Sdp      .cmdbox td:hover { background-color: #ffcc99;
111*daaffb31Sdp 		outline: thin solid #ff9900; }
112*daaffb31Sdp
113*daaffb31Sdp      a:hover { background-color: #ffcc99; }
114*daaffb31Sdp
115*daaffb31Sdp      a.print { font-size: x-small; }
1167c478bd9Sstevel@tonic-gate    </style>
117*daaffb31Sdp
118*daaffb31Sdp    <style type='text/css' media='print'>
119*daaffb31Sdp	pre { font-family: courier, monospace; font-size: 0.8em; }
120*daaffb31Sdp	.cmdbox { display: none; }
121*daaffb31Sdp        a.print { display: none; }
122*daaffb31Sdp	.hidebar td.active-down { display: none; }
123*daaffb31Sdp	.hidebar td.active-up { display: none; }
124*daaffb31Sdp        .hidebar td.elided-label { font-style: italic; font-size: small; }
125*daaffb31Sdp	table.hidebar { border: none; border-bottom: 1px dotted #000000; }
126*daaffb31Sdp	span.added { font-weight: bold;
127*daaffb31Sdp	         background-color: #eee; width: 100%; display: block; }
128*daaffb31Sdp	span.subtracted { font-style: italic;
129*daaffb31Sdp		 background-color: #eee; width: 100%; display: block; }
130*daaffb31Sdp	.elided { display: none; }
131*daaffb31Sdp        hr { border: none 0; border-top: 1px solid #aaa; height: 1px; }
132*daaffb31Sdp    </style>
133*daaffb31Sdp
134*daaffb31Sdp    <script type="text/javascript">
1357c478bd9Sstevel@tonic-gate      function show_n_hide_dir(id_to_show, id_to_hide, dir) {
1367c478bd9Sstevel@tonic-gate	      var elt_to_show = document.getElementById(id_to_show);
1377c478bd9Sstevel@tonic-gate	      var elt_to_hide = document.getElementById(id_to_hide);
1387c478bd9Sstevel@tonic-gate	      // When we're opening up, we need to make the bottoms of the
1397c478bd9Sstevel@tonic-gate	      // elements appear to be the same.  So our invariant should be
1407c478bd9Sstevel@tonic-gate	      // elt.offsetBottom - window.scrollY.
1417c478bd9Sstevel@tonic-gate	      var preinvar = elt_to_hide.offsetHeight - window.scrollY;
1427c478bd9Sstevel@tonic-gate	      elt_to_show.style.setProperty('display', '', '');
1437c478bd9Sstevel@tonic-gate	      elt_to_hide.style.setProperty('display', 'none', '');
1447c478bd9Sstevel@tonic-gate	      if (dir == 'up') {
1457c478bd9Sstevel@tonic-gate		      var postinvar = elt_to_show.offsetHeight - window.scrollY;
1467c478bd9Sstevel@tonic-gate		      window.scrollBy(0, postinvar - preinvar);
1477c478bd9Sstevel@tonic-gate	      }
1487c478bd9Sstevel@tonic-gate      }
1497c478bd9Sstevel@tonic-gate
1507c478bd9Sstevel@tonic-gate      function handle_click(e) {
1517c478bd9Sstevel@tonic-gate	      var eh = e.target;
1527c478bd9Sstevel@tonic-gate	      var es = document.getElementById("hb-" + e.target.id);
1537c478bd9Sstevel@tonic-gate	      eh.style.setProperty('display', 'none', '');
1547c478bd9Sstevel@tonic-gate	      es.style.setProperty('display', '', '');
1557c478bd9Sstevel@tonic-gate	      /* Scroll so new element is at cursor. */
1567c478bd9Sstevel@tonic-gate	      window.scroll(0, es.offsetTop + (es.offsetHeight / 2)
1577c478bd9Sstevel@tonic-gate	          - e.clientY);
1587c478bd9Sstevel@tonic-gate      }
1597c478bd9Sstevel@tonic-gate
1607c478bd9Sstevel@tonic-gate      function stripsearch(str) {
1617c478bd9Sstevel@tonic-gate	q = str.indexOf("?");
1627c478bd9Sstevel@tonic-gate	if (q != -1)
1637c478bd9Sstevel@tonic-gate	  str = str.substr(0, q);
1647c478bd9Sstevel@tonic-gate	return (str);
1657c478bd9Sstevel@tonic-gate      }
1667c478bd9Sstevel@tonic-gate
1677c478bd9Sstevel@tonic-gate      function split() {
1687c478bd9Sstevel@tonic-gate        page = stripsearch(location.href);
1697c478bd9Sstevel@tonic-gate	halfway = window.scrollY + window.innerHeight / 2 - 5;
1707c478bd9Sstevel@tonic-gate	document.write('<frameset rows="50%,*">' +
1717c478bd9Sstevel@tonic-gate	  '<frame src="' + page + "?" + window.scrollY + '" />' +
1727c478bd9Sstevel@tonic-gate	  '<frame src="' + page + "?" + halfway + '" />' +
1737c478bd9Sstevel@tonic-gate	  '</frameset>');
1747c478bd9Sstevel@tonic-gate	document.close();
1757c478bd9Sstevel@tonic-gate      }
1767c478bd9Sstevel@tonic-gate
1777c478bd9Sstevel@tonic-gate      function closeframe() {
1787c478bd9Sstevel@tonic-gate	page = stripsearch(location.href);
1797c478bd9Sstevel@tonic-gate
1807c478bd9Sstevel@tonic-gate	otherf = window.parent.frames[0];
1817c478bd9Sstevel@tonic-gate	if (otherf == window)
1827c478bd9Sstevel@tonic-gate	  otherf = window.parent.frames[1];
1837c478bd9Sstevel@tonic-gate
184*daaffb31Sdp	parent.location.replace(page + "?" + otherf.scrollY);
1857c478bd9Sstevel@tonic-gate      }
1867c478bd9Sstevel@tonic-gate    </script>
1877c478bd9Sstevel@tonic-gate  </head>
188*daaffb31Sdp  <body id='SUNWwebrev'>
189*daaffb31Sdp    <a class="print" href="javascript:print()">Print this page</a>
190*daaffb31Sdp    $comment
1917c478bd9Sstevel@tonic-gate    <table class='cmdbox'>
1927c478bd9Sstevel@tonic-gate      <tr>
1937c478bd9Sstevel@tonic-gate        <td onclick='split()'>Split</td>
1947c478bd9Sstevel@tonic-gate	<td id='close' onclick='closeframe()'>Close</td>
1957c478bd9Sstevel@tonic-gate      </tr>
196*daaffb31Sdp      <tr><td colspan="2" onclick='open_or_close_all(1)'>Expand all</td></tr>
197*daaffb31Sdp      <tr><td colspan="2" onclick='open_or_close_all(0)'>Collapse all</td></tr>
1987c478bd9Sstevel@tonic-gate    </table>
199*daaffb31Sdp
2007c478bd9Sstevel@tonic-gate    <script type='text/javascript'>
2017c478bd9Sstevel@tonic-gate      if (window == top)
2027c478bd9Sstevel@tonic-gate        document.getElementById('close').style.setProperty('display', 'none', '');
2037c478bd9Sstevel@tonic-gate    </script>
2047c478bd9Sstevel@tonic-gateEND
2057c478bd9Sstevel@tonic-gate
2067c478bd9Sstevel@tonic-gateprint "<pre><span class='subtracted'>          --- $ARGV[0]
2077c478bd9Sstevel@tonic-gate</span><span class='added'>          +++ $ARGV[1]
2087c478bd9Sstevel@tonic-gate</span>";
2097c478bd9Sstevel@tonic-gate
2107c478bd9Sstevel@tonic-gatesub begin_elided {
2117c478bd9Sstevel@tonic-gate	++$nelided;
2127c478bd9Sstevel@tonic-gate	# onclick handler assigned at bottom
2137c478bd9Sstevel@tonic-gate	print "<pre id='elided$nelided' class='elided' style='display: none'>";
2147c478bd9Sstevel@tonic-gate	$inelided = 1;
2157c478bd9Sstevel@tonic-gate	$elided_lines = 0;
2167c478bd9Sstevel@tonic-gate}
2177c478bd9Sstevel@tonic-gate
2187c478bd9Sstevel@tonic-gatesub end_elided {
2197c478bd9Sstevel@tonic-gate	print "</pre>\n";
2207c478bd9Sstevel@tonic-gate
2217c478bd9Sstevel@tonic-gate	print <<END;
2227c478bd9Sstevel@tonic-gate<table id='hb-elided$nelided' class='hidebar'>
2237c478bd9Sstevel@tonic-gate  <tr>
224*daaffb31Sdp    <td class='active-down'
225*daaffb31Sdp      onclick='show_n_hide_dir("elided$nelided", "hb-elided$nelided", "down")'>
226*daaffb31Sdp      &darr;&nbsp;open down&nbsp;&darr;</td>
227*daaffb31Sdp    <td class="elided-label">$elided_lines lines elided</td>
228*daaffb31Sdp    <td class='active-up'
229*daaffb31Sdp      onclick='show_n_hide_dir("elided$nelided", "hb-elided$nelided", "up")'>
230*daaffb31Sdp      &uarr;&nbsp;open up&nbsp;&uarr;</td>
2317c478bd9Sstevel@tonic-gate  </tr>
232*daaffb31Sdp</table>
2337c478bd9Sstevel@tonic-gateEND
2347c478bd9Sstevel@tonic-gate	$inelided = 0;
2357c478bd9Sstevel@tonic-gate}
2367c478bd9Sstevel@tonic-gate
2377c478bd9Sstevel@tonic-gatewhile (<DIFF>) {
2387c478bd9Sstevel@tonic-gate	chomp;
2397c478bd9Sstevel@tonic-gate
2407c478bd9Sstevel@tonic-gate	# Change detection
2417c478bd9Sstevel@tonic-gate	$previndiff = $indiff;
2427c478bd9Sstevel@tonic-gate
2437c478bd9Sstevel@tonic-gate	if (!$indiff) {
2447c478bd9Sstevel@tonic-gate		if (/^#ifdef $diffword$/) {
2457c478bd9Sstevel@tonic-gate			$indiff = 1;
2467c478bd9Sstevel@tonic-gate		} elsif (/^#ifndef $diffword$/) {
2477c478bd9Sstevel@tonic-gate			$indiff = -1;
2487c478bd9Sstevel@tonic-gate		}
2497c478bd9Sstevel@tonic-gate	} else {
2507c478bd9Sstevel@tonic-gate		if (/^#else \/\* $diffword \*\/$/) {
2517c478bd9Sstevel@tonic-gate			$indiff = -$indiff;
2527c478bd9Sstevel@tonic-gate			print "</span>";
2537c478bd9Sstevel@tonic-gate			printf "<span class='%s'>",
2547c478bd9Sstevel@tonic-gate			    ($indiff > 0 ? "added" : "subtracted");
2557c478bd9Sstevel@tonic-gate			next;
2567c478bd9Sstevel@tonic-gate		} elsif (/^#endif \/\* (! )?$diffword \*\/$/) {
2577c478bd9Sstevel@tonic-gate			$indiff = 0;
2587c478bd9Sstevel@tonic-gate			$posttext = $context;
2597c478bd9Sstevel@tonic-gate			print "</span>";
2607c478bd9Sstevel@tonic-gate			next;
2617c478bd9Sstevel@tonic-gate		}
2627c478bd9Sstevel@tonic-gate	}
2637c478bd9Sstevel@tonic-gate
2647c478bd9Sstevel@tonic-gate	if (!$previndiff && $indiff) {
2657c478bd9Sstevel@tonic-gate		# Beginning of a change: If we have an elided section open,
2667c478bd9Sstevel@tonic-gate		# end it.  Print the pretext and continue.
2677c478bd9Sstevel@tonic-gate
2687c478bd9Sstevel@tonic-gate		if ($inelided) {
2697c478bd9Sstevel@tonic-gate			end_elided;
2707c478bd9Sstevel@tonic-gate			print "<pre>";
2717c478bd9Sstevel@tonic-gate		}
2727c478bd9Sstevel@tonic-gate
2737c478bd9Sstevel@tonic-gate		print @pretext;
2747c478bd9Sstevel@tonic-gate		@pretext = ();
2757c478bd9Sstevel@tonic-gate		$endfunc = 0;
2767c478bd9Sstevel@tonic-gate
2777c478bd9Sstevel@tonic-gate		printf "<span class='%s'>",
2787c478bd9Sstevel@tonic-gate		    ($indiff > 0 ? "added" : "subtracted");
2797c478bd9Sstevel@tonic-gate		next;
2807c478bd9Sstevel@tonic-gate	}
2817c478bd9Sstevel@tonic-gate
2827c478bd9Sstevel@tonic-gate	# Line of code
2837c478bd9Sstevel@tonic-gate
2847c478bd9Sstevel@tonic-gate	# Quote for HTML
2857c478bd9Sstevel@tonic-gate	s/&/&amp;/g;
2867c478bd9Sstevel@tonic-gate	s/</&lt;/g;
2877c478bd9Sstevel@tonic-gate	s/>/&gt;/g;
2887c478bd9Sstevel@tonic-gate
2897c478bd9Sstevel@tonic-gate	# Format the line according to $indiff, and print it or put it into
2907c478bd9Sstevel@tonic-gate	# a buffer.
2917c478bd9Sstevel@tonic-gate	if ($indiff == -1) {
2927c478bd9Sstevel@tonic-gate		++$line1;
2937c478bd9Sstevel@tonic-gate		printf "%4d %4s -%s\n", $line1, "", $_;
2947c478bd9Sstevel@tonic-gate	} elsif ($indiff == 0) {
2957c478bd9Sstevel@tonic-gate		++$line1;
2967c478bd9Sstevel@tonic-gate		++$line2;
2977c478bd9Sstevel@tonic-gate
2987c478bd9Sstevel@tonic-gate		$str = sprintf "%4d %4d  %s\n", $line1, $line2, $_;
2997c478bd9Sstevel@tonic-gate
3007c478bd9Sstevel@tonic-gate		if ($posttext > 0) {
3017c478bd9Sstevel@tonic-gate			print $str;
3027c478bd9Sstevel@tonic-gate			--$posttext;
3037c478bd9Sstevel@tonic-gate		} else {
3047c478bd9Sstevel@tonic-gate			push @pretext, $str;
3057c478bd9Sstevel@tonic-gate			if ($#pretext + 1 > $context) {
3067c478bd9Sstevel@tonic-gate				$str = shift @pretext;
3077c478bd9Sstevel@tonic-gate
3087c478bd9Sstevel@tonic-gate				if (!$inelided) {
3097c478bd9Sstevel@tonic-gate					print "</pre>\n";
3107c478bd9Sstevel@tonic-gate					begin_elided;
3117c478bd9Sstevel@tonic-gate				}
3127c478bd9Sstevel@tonic-gate
3137c478bd9Sstevel@tonic-gate				++$elided_lines;
3147c478bd9Sstevel@tonic-gate
3157c478bd9Sstevel@tonic-gate				print $str;
3167c478bd9Sstevel@tonic-gate			}
3177c478bd9Sstevel@tonic-gate		}
3187c478bd9Sstevel@tonic-gate	} elsif ($indiff == 1) {
3197c478bd9Sstevel@tonic-gate		++$line2;
3207c478bd9Sstevel@tonic-gate		printf "%4s %4d +%s\n", "", $line2, $_;
3217c478bd9Sstevel@tonic-gate	}
3227c478bd9Sstevel@tonic-gate}
3237c478bd9Sstevel@tonic-gate
3247c478bd9Sstevel@tonic-gateprint @pretext;
3257c478bd9Sstevel@tonic-gate
3267c478bd9Sstevel@tonic-gateif ($inelided) {
3277c478bd9Sstevel@tonic-gate	$elided_lines += @pretext;
3287c478bd9Sstevel@tonic-gate	end_elided;
3297c478bd9Sstevel@tonic-gate} else {
3307c478bd9Sstevel@tonic-gate	print "    </pre>\n";
3317c478bd9Sstevel@tonic-gate}
3327c478bd9Sstevel@tonic-gate
333*daaffb31Sdpprint "<pre id='linerefpre'><span id='lineref'>", 'X' x (4 + 1 + 4 + 2 + 80),
3347c478bd9Sstevel@tonic-gate    "</span></pre>\n";
3357c478bd9Sstevel@tonic-gate
3367c478bd9Sstevel@tonic-gateprint <<END;
337*daaffb31Sdp    <br clear="all" />
338*daaffb31Sdp    <br />
339*daaffb31Sdp
340*daaffb31Sdp    <script type="text/javascript">
3417c478bd9Sstevel@tonic-gate      /* Assign event handlers and widths. */
3427c478bd9Sstevel@tonic-gate      var w = document.getElementById('lineref').offsetWidth;
3437c478bd9Sstevel@tonic-gate      for (var i = 1; i <= $nelided; ++i) {
3447c478bd9Sstevel@tonic-gate	      var e = document.getElementById("elided" + i);
3457c478bd9Sstevel@tonic-gate	      e.onclick = handle_click;
346*daaffb31Sdp              e.style.setProperty('width', w + "px", '');
3477c478bd9Sstevel@tonic-gate
3487c478bd9Sstevel@tonic-gate	      e = document.getElementById("hb-elided" + i);
349*daaffb31Sdp              e.style.setProperty('width', w + "px", '');
3507c478bd9Sstevel@tonic-gate      }
3517c478bd9Sstevel@tonic-gate
3527c478bd9Sstevel@tonic-gate      /* Hide our line size reference. */
353*daaffb31Sdp      document.getElementById('linerefpre').style.setProperty('display',
354*daaffb31Sdp          'none', '');
3557c478bd9Sstevel@tonic-gate
3567c478bd9Sstevel@tonic-gate      /* Scroll as indicated. */
3577c478bd9Sstevel@tonic-gate      str = location.search;
3587c478bd9Sstevel@tonic-gate      s = str.substring(1, str.length);
3597c478bd9Sstevel@tonic-gate      if (s > 0)
3607c478bd9Sstevel@tonic-gate        window.scroll(0, s);
3617c478bd9Sstevel@tonic-gate
3627c478bd9Sstevel@tonic-gate      function open_or_close_all(open) {
3637c478bd9Sstevel@tonic-gate	      for (var i = 1; i <= $nelided; ++i) {
3647c478bd9Sstevel@tonic-gate		      var e = document.getElementById("hb-elided" + i);
3657c478bd9Sstevel@tonic-gate		      e.style.setProperty("display", open ? "none" : "", "");
3667c478bd9Sstevel@tonic-gate
3677c478bd9Sstevel@tonic-gate		      e = document.getElementById("elided" + i);
3687c478bd9Sstevel@tonic-gate		      e.style.setProperty("display", open ? "" : "none", "");
3697c478bd9Sstevel@tonic-gate	      }
3707c478bd9Sstevel@tonic-gate      }
3717c478bd9Sstevel@tonic-gate    </script>
3727c478bd9Sstevel@tonic-gate  </body>
3737c478bd9Sstevel@tonic-gate</html>
3747c478bd9Sstevel@tonic-gateEND
375