From 728b0468bd5148b1cc1a0a5b8c9419080b28dc88 Mon Sep 17 00:00:00 2001 From: bela Date: Wed, 13 Jun 2001 09:55:33 +0000 Subject: [PATCH] Converts Keil-style header files to sdcc format git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@885 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- support/scripts/keil2sdcc.pl | 72 ++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100755 support/scripts/keil2sdcc.pl diff --git a/support/scripts/keil2sdcc.pl b/support/scripts/keil2sdcc.pl new file mode 100755 index 00000000..6a8b3273 --- /dev/null +++ b/support/scripts/keil2sdcc.pl @@ -0,0 +1,72 @@ +#!/usr/bin/perl +# keil2sdcc.pl +# converts Keil compatible header files to sdcc-compatible format +# call (path)/keil2sdcc.pl keil_file_name sdcc_file_name +# +# Bela Torok - bela.torok@kssg.ch +# Version: June 2001 +# +# Limitation: Keil-style sfr and sbit definitions should begin +# in the first column! +# + +$keil_file = $ARGV[0]; +$sdcc_file = $ARGV[1]; + +if (open (KEIL_FILE , "<" . $keil_file)) { +# printf("Opening file: %s for output!\n", $keil_file); +} else { + printf("Cannot open file: %s !\n", $keil_file); + exit (0); +} + +if (open (SDCC_FILE ,">" . $sdcc_file)) { +# printf("Opening file: %s for output!\n", $sdcc_file); +} else { + printf("Cannot open file: %s !\n", $sdcc_file); + exit (0); +} + +while ($input_buffer = ) { + + if( substr($input_buffer, 0, 3) eq 'sfr') + { + &convert( substr($input_buffer, 4) ); + print SDCC_FILE "sfr at", $value, " ", $name, ";", $comment; + } + elsif( substr($input_buffer, 0, 4) eq 'sbit') + { + &convert( substr($input_buffer, 5) ); + print SDCC_FILE "sbit at", $value, " ", $name, ";", $comment; + } + else { + print SDCC_FILE $input_buffer; + } + +} + +close (KEIL_FILE); +close (SDCC_FILE); +exit (0); + +sub convert +{ + local($arg) = @_; + + ($command, $comment) = split(';' , $arg); + + ($name, $value) = split('=' , $command); + +} + + + + + + + + + + + + -- 2.30.2