#!/usr/bin/perl
#
# $Id$
#
# This file is part of the RHexLib Robot Control Software
#  Copyright (c) 2003  Regents of The University of Michigan
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the RHexLib License version 1.0. You
# should have received a copy of this license along with this
# program; if not, write to <ulucs+rhexlib@cs.cmu.edu>.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# LICENSE file for more details.  
#
# Uluc Saranli <ulucs+rhexlib@cs.cmu.edu>

######################################################################
# $Id$
#
# Sets up state machine header (*.hh) and code (*.cc) files 
# from a transition table.
#
# Created       : Eric Klavins, 02/04/2001
# Last Modified : Eric Klavins, 06/27/2001
#
# cc2d.pl <filename>
#
# Takes a *.cc file that hopefully has a single state machine setup section
# and outputs a *.dsc file.
#

$file = $ARGV[0];

open ( FILE, $file ) || die ( "Cannot open $file: $!" );

$i=0;

while ( <FILE> ) {

  chop;
  s/[,\)]//g;
  @line = split ( ' ' );

  if ( $line[0] =~ /Transition/ ) {

    print "Transition $line[2] $line[3] $line[4]\n";

  }

  elsif ( $line[0] =~ /initialize/ ) {

    print "Initial $line[2]\n";

  }

}
