Dear Scott,
I have an application in KEIL.
Is it possible to convert it completely into
SDCC using the keil2sdcc converter ??
One more doubt friend,
Is there something like sdcc2keil ???
Xpecting ur reply,
karthik bala guru.T
linladn@...
--- Scott Bronson <bronson@...> wrote:
> I really liked Bela Torok's keil2sdcc converter, but
> it was pretty
> easy to get incorrect header files. So, here's my
> version.
>
> This converts the header files on my machine, but I
> can virtually
> guarantee that it will need some tweaking to do
> others. I'm happy
> to offer whatever help I can.
>
> I've included the interleave script that I use to
> verify that the
> conversion worked OK. Here's an example usage:
>
> % perl keilconv.pl < fx2regs.orig.h > fx2regs.h
> % interleave fx2regs.orig.h fx2regs.h | less
>
> Hope they prove useful.
>
> --
> Scott Bronson <bronson@...>
> > #!/usr/bin/perl -w
>
> # hcat
> # Scott Bronson bronson@...
> # 19 Jul 2003
>
> # This utility does the same thing as the common
> "cat" Unix utility,
> # but alternates lines rather than keeping all the
> files grouped
> # together. You get:
> #
> # file1 line1
> # file2 line1
> # file3 line1
> # file1 line2
> # file2 line2
> # file3 line2
> # etc.
> #
>
> use strict;
> use FileHandle;
>
> my @FDs = ();
>
> for(@ARGV) {
> push @FDs, FileHandle->new("<$_") or die
> "Could not open $_: $!\n";
> }
>
> while( grep {!$_->eof()} @FDs ) {
> for my $fh (@FDs) {
> $_ = <$fh>, print unless $fh->eof();
> }
> }
>
> for(@FDs) { $_->close(); }
>
> > #!/usr/bin/perl -w
>
> # keilconv
> # Scott Bronson
> # 22 June 2003
>
> # This script converts Keil-style header files to
> SDCC. It tries to
> # be pedantic so don't be surprised if you need to
> munge it a bit to
> # get it to work. On the other hand, it doesn't
> fully parse the C
> # file (for obvious reasons).
>
> # It takes the Keil header file either as an
> argument or on
> # stdin and it produces the output on stdout.
>
> # This script is inspired by keil2sdcc.pl by Bela
> Torok.
>
> use strict;
>
>
> while(<>)
> {
> s/\r//g; # remove DOS line endings if necessary
>
> # external register (kind of a weird format)
>
>
if(/^(\s*)EXTERN\s*xdata\s*volatile\s*BYTE\s*(\w+(?:\s*\[\s*\d+\s*\])?)\s+_AT_\s*([^;]+);(.*)$/)
> {
> print "$1EXTERN xdata at $3 volatile BYTE
> $2;$4\n";
> next;
> }
>
> # sfr statement
> if(/^(\s*)sfr\s*(\w+)\s*=\s*([^;]+);(.*)$/) {
> print "$1sfr at $3 $2;$4\n";
> next;
> }
>
> # sbit statement
> if(/^(\s*)sbit\s*(\w+)\s*=\s*([^;]+);(.*)$/) {
> print "$1sbit at $3 $2;$4\n";
> next;
> }
>
> # entire line is a C++ comment
> if(/^(\s*)\/\/(.*)$/) {
> print "$1//$2\n";
> next;
> }
>
> # C comment
> if(/^(\s*)\/\*(.*)$/) {
> my($ws,$cmt) = ($1,"$2\n");
> $cmt .= <> while $cmt !~ /\*\/\s*$/;
> $cmt =~ s/\r//g;
> print "$ws/*$cmt";
> next;
> }
>
> # preprocessor statement
> if(/^(\s*)\#(.*)$/) {
> print "$1#$2\n";
> next;
> }
>
> # blank line
> if(/^(\s*)$/) {
> print "\n";
> next;
> }
>
> chomp;
> die "Unconvertable line: \"$_\"\n";
> }
>
>
__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com
|