Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!caip!princeton!allegra!mit-eddie!genrad!panda!enmasse!keith From: keith@enmasse.UUCP (Keith Crews) Newsgroups: net.sources Subject: ifdef filter Message-ID: <323@enmasse.UUCP> Date: Thu, 17-Jul-86 12:00:55 EDT Article-I.D.: enmasse.323 Posted: Thu Jul 17 12:00:55 1986 Date-Received: Sat, 19-Jul-86 00:45:37 EDT Organization: EnMasse Computer Corp., Acton, MA Lines: 38 It often happens that software packages are set up to run on so many configurations that it is hard to read the code because of all the ifdefs. I would like a filter for C programs that does something like the following: Invoke it like this: prog x.c.new -DSYSV -D68000 and it would take input of the form: #ifdef 68000 short i; #else int i; #endif #ifdef BSD blah #else blech #endif ... and produce or maybe #ifdef 68000 #ifdef 68000 short i; short i; #endif #else blech #endif #ifdef BSD #else blech #endif That is, filter out everything that is not going to be expanded by cpp while retaining the ifdefs that are going to be expanded, just for comment value. Ideally the output, when compiled, would produce exactly the same results as the original. Does anyone have anything like this?