#!/usr/bin/perl
#----------------------------------------------------------------------------
#  Copyright (C) 1995-1996 James Macnicol
#
#   This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 1, or (at your option) any later
# version.
#
#   This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY
# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# for more details.
#-----------------------------------------------------------------------------
#
# Prints to the stdout a file suitable for use as bubbles_default.c for the
# bubbles screensaver (i.e. the default bubble which is compiled into the
# executable).  A list of XPMs is expected as input, e.g. output from the 
# pov2xpm script in this directory.
#
# Remember to change the path to your perl executable at the top of the
# script if it is wrong.
#
# Examples of usage:
#
#       pov2xpm sample.pov | xpm2default > bubbles_default.c
#
#  A new set of bubbles is first created with pov2xpm then passed to this
# script which places the C wrapper around the data and finally dumps the
# output into bubbles_default.c.
#
#       xpm2default < sample.xpm > bubbles_default.c
#
#  Same as the previous example except the XPM data came from a file rather
# than a pipe.
#
$numargs = @ARGV;
print "#include \"bubbles.h\"\n";
print "\n";
print "#ifndef NO_DEFAULT_BUBBLE\n";
print "\n";
print "char *default_ball_data[] = {\n";
while (<STDIN>) {
	chop;
	s/"/\\"/g;
	print "\"$_\",\n";	
}
print "(char *)0\n";
print "};\n";
print "\n";
print "#endif\n";
