[Coco] Converting ANSI-C to K&R(Microware) - Ansifront didn'twork

Lothan lothan at newsguy.com
Sun Jan 9 17:56:26 EST 2011


I see the problem. If you give it a complete function declaration on one 
line, it doesn't recognize it as a function declaration for some reason; 
e.g.

int main(int argc, char *argv[])
{
    return 0;
}

is output exactly as it is with no changes. Looks like you have to put the 
return type on a separate line; e.g.

int
main(int argc, char *argv[])
{
    return 0;
}

is output in K&R style:

int
main(argc, argv) int argc; char *argv[];
{
    return 0;
}

That seems lame to me. If you have to roll through the entire source 
splitting the return type from the declaration manually, it's not much more 
work to fix the entire declaration.

-----Original Message----- 
From: Michael Furman
Sent: Sunday, January 09, 2011 4:04 PM
To: CoCoList for Color Computer Enthusiasts
Subject: Re: [Coco] Converting ANSI-C to K&R(Microware) - Ansifront 
didn'twork


On Jan 8, 2011, at 10:26 PM, Lothan wrote:

> Arrgh... posted on the wrong thread.
>
> Search for ansi2knr for one possibility. This one runs on Linux and 
> allegedly has been ported to other platforms as well.
>


Thanks. I found a copy and tried it... but doesn't seem to have done much

$ ident ansi2knr.c
ansi2knr.c:
     $Id: ansi2knr.c,v 1.10 1998/12/02 12:42:23 tromey Exp $

$ ansi2knr virus.c virus-knr.c
$ diff -c virus.c virus-knr.c
*** virus.c 2003-09-08 04:46:04.000000000 -0700
--- virus-knr.c 2011-01-09 12:51:49.000000000 -0800
***************
*** 1,3 ****
--- 1,4 ----
+ #line 1 "virus.c"
  /* vi: set sw=8 ts=8: */
  /*
   * virus - vi resembling utility skeleton - based on

Yeah, I'm expecting at the very minimum:

extern int vi_main(int argc, char **argv)
{
   ...

to get turned into

extern int vi_main(argc, argv)
int argc;
char **argv;
{
   ...

Oh well, guess I get to chop it into smaller files and then try feeding to 
ansifront... or just do the conversion manually :(


--
Coco mailing list
Coco at maltedmedia.com
http://five.pairlist.net/mailman/listinfo/coco 




More information about the Coco mailing list