#!/usr/bin/perl -w
use Switch;
if ($#ARGV != 2 ) {
	print "source and out should be specified\n";
	exit;
}
$vfloor=$ARGV[0];

$proto=$ARGV[1];

$macro=$ARGV[2];

open(VFLOOR,"<$vfloor");
open(PROTO,"<$proto");
open(MACRO,">$macro");
$proto_content="";
$valid=0;
while(<PROTO>)
{
$line=$_;
chop($line);
if ($line eq "~h \"proto\"") {$valid=1;}
if ($valid==0){
$proto_content=$proto_content.$line."\n";
}
}
$vfloor_content="";
while(<VFLOOR>)
{
$line=$_;
chop($line);
$vfloor_content=$vfloor_content.$line."\n";
}
print MACRO"$proto_content";
print MACRO"$vfloor_content";
