head	1.3;
access;
symbols
	r2_1:1.3;
locks; strict;
comment	@# @;


1.3
date	94.08.26.19.27.04;	author gmt;	state Exp;
branches;
next	1.2;

1.2
date	94.08.26.19.00.10;	author gmt;	state Exp;
branches;
next	1.1;

1.1
date	94.08.17.01.45.57;	author gmt;	state Exp;
branches;
next	;


desc
@This is a program to take ANSI template instantiation files and generate
the proper template instantiation files for Symantec C++ on the Mac.
@


1.3
log
@Added ability to drop closure file on icon to run script in the
directory of the closure file.
@
text
@#!/local/bin/perl

# Copyright 1994, Center for Computer Vision and Visualization,
#	University of Florida.  All rights reserved.

# $Log: genmactmplinst.perl,v $
# Revision 1.2  1994/08/26  19:00:10  gmt
# fixed the comment character. . .
#
# Revision 1.1  1994/08/17  01:45:57  gmt
# Initial revision
#

# $Id: genmactmplinst.perl,v 1.2 1994/08/26 19:00:10 gmt Exp gmt $

#$path_prefix = 'instances:';
#$include_prefix = "";

$closure_file = shift( @@ARGV );

open( IN, "<$closure_file" );

#print STDERR $closure_file, "\n";

$path_prefix = $closure_file;

$path_prefix =~ s/^(.*:)[^:]*$/$1/;

open( FILES, ">$path_prefix" . "tmpl.lst" );

#print STDERR $path_prefix;

while( <IN> )
{
    # Check on the "def" before removing any comments since it contains
    # the comment string.
    if( m,\s*//\s*def\s+(["<].*[">]), )
    {
	$def = $1;
	next;
    }

    # Remove comments.
    s,//.*$,,;

    if( /^\s*$/ )
    {
	next;
    }
    elsif( /^\s*#\s*include\s+.*$/ )
    {
	$includes .= $_;
    }
    elsif( /\s*template\s+class\s+(.*);/ )
    {
	# class instantiation
	print FILES "$path_prefix$1.c\n";
	open( OUT, ">$path_prefix$1.c" );
	print OUT $includes;
	print OUT "#include $def\n";
	print OUT "#pragma template_access public\n";
	print OUT "#pragma template $1\n";
	close( OUT );
    }
    elsif( /\s*template\s+\S+\s+(.*)::(.*);/ )
    {
	# Member function.
	print FILES "$path_prefix$1__$2.c\n";
	open( OUT, ">$path_prefix$1__$2.c" );
	print OUT $includes;
	print OUT "#include $def\n";
	print OUT "#pragma template_access public\n";
	print OUT "#pragma template $1::$2\n";
	close( OUT );
    }
    elsif( /\s*template\s+\S+\s+(.*);/ )
    {
	# Regular function
	print FILES "$path_prefix$1.c\n";
	open( OUT, ">$path_prefix$1.c" );
	print OUT $includes;
	print OUT "#include $def\n";
	print OUT "#pragma template_access public\n";
	print OUT "#pragma template $1\n";
	close( OUT );
    }
    else
    {
	print STDERR "Do not under stand the following line, ignoring:\n";
	print "$_\n";
    }
}

close( FILES );
@


1.2
log
@fixed the comment character. . .
@
text
@d7 3
d14 1
a14 1
# $Id: genmactmplinst.perl,v 1.1 1994/08/17 01:45:57 gmt Exp gmt $
d19 11
a29 1
open( FILES, ">tmpl.lst" );
d31 1
a31 1
open( IN, "<closure.desc" );
@


1.1
log
@Initial revision
@
text
@d3 2
a4 2
// 	Copyright 1994, Center for Computer Vision and Visualization,
// 	University of Florida.  All rights reserved.
d6 4
a9 1
# $Log$
d11 1
a11 1
# $Id$
a81 1

@
