#!/usr/bin/perl -w
# David Rowe 16/1/03
# used to modify first pass sgml files to include hyperlinks to ref doc

($file_in,$file_out)=@ARGV;

print "input: $file_in output: $file_out\n";

open(FIN, $file_in) || die "Couldn't open $file_in: $!\n";
@text_in = <FIN>;
close(FIN);

foreach $s (@text_in) {
    if ($s=~ /<function>(vpb_.*)\(\)<\/function>/){
	$foo=$1;
	$foo =~ s/_/-/g;
	$s=~ s/<function>(vpb_.*)\(\)<\/function>/<function><link linkend=\"$foo\">$1\(\)<\/link><\/function>/;
    }

    @text_out = (@text_out, $s);
}

open(FOUT, ">$file_out") || die "Couldn't open $file_out: $!\n";
print FOUT @text_out;
close(FOUT);





