amull@Morgan.COM (Andrew P. Mullhaupt) (08/27/89)
Can anyone recommend a filter through which I can run a source program devised by a brilliant hieroglyphist with an over-active macro imagination, utter disregard for indentation, and a penchant for constructions of questionable portability? Thanks Andrew Mullhaupt
decot@hpisod2.HP.COM (Dave Decot) (08/28/89)
> Can anyone recommend a filter through which I can run a source > program devised by a brilliant hieroglyphist with an over-active > macro imagination, utter disregard for indentation, and a penchant > for constructions of questionable portability? Figuratively (i.e., this is not a literal command line): unifdef -D... | indent | lint Dave
flaps@dgp.toronto.edu (Alan J Rosenthal) (08/28/89)
amull@Morgan.COM (Andrew P. Mullhaupt) writes: >Can anyone recommend a filter through which I can run a source >program devised by a brilliant hieroglyphist with an over-active >macro imagination, utter disregard for indentation, and a penchant >for constructions of questionable portability? Re macros: If you remove #include instructions (and any other macros you *don't* want de-macro-ified), then run it through the preprocessor alone, then re-add the #include instructions, you should be able to solve the macro problem. There is usually some compiler option to run your source through the preprocessor alone. It is often -E. (If you don't remove the #include instructions, the macros in the include files will get expanded as well, which you don't want.) You may find lines beginning with "# " inserted into your file, which you can delete with a global command in an editor. Re indentation: There are a variety of formatters, mostly bizarre. The most common opinion among C wizards seems to be that formatters are not generally a good thing. I agree with that sentiment, but have found formatters useful for unravelling bizarre code. The one I use for such purposes is indent. Indent is bizarre, but not as bizarre as some of the more hacky C programs out there, so sometimes it's an improvement. Probably all unix systems have cb, but that doesn't do as much. However, it does set every line to the correct indentation, which may be all you need. Outside of unix, I'm not aware of any C formatters, but I'm sure they must exist. Some editors probably do C formatting for you, especially on the ibm-pc, due to the trend in software development on that machine. Re questionable portability: The reason that most unportable constructs are unportable is because of unclear semantics. To ask a computer to improve on this is asking a bit much, like mind reading or something. To merely identify questionable constructs, use lint. There is a version of lint for the ibm-pc, commercially available from somewhere or other. All unix systems (that I've heard of) have lint. Alternatively, find a C interpreter, which provides facilities which are similar in concept but often quite different in practice. ajr
gwyn@smoke.BRL.MIL (Doug Gwyn) (08/28/89)
In article <355@s6.Morgan.COM> amull@Morgan.COM (Andrew P. Mullhaupt) writes:
-Can anyone recommend a filter through which I can run a source
-program devised by a brilliant hieroglyphist with an over-active
-macro imagination, utter disregard for indentation, and a penchant
-for constructions of questionable portability?
"cc -E", "indent", and "rm" come to mind.
guido@piring.cwi.nl (Guido van Rossum) (08/28/89)
amull@Morgan.COM (Andrew P. Mullhaupt) writes: >Can anyone recommend a filter through which I can run a source >program devised by a brilliant hieroglyphist with an over-active >macro imagination, utter disregard for indentation, and a penchant >for constructions of questionable portability? I once saved a program called 'scpp' posted to the net, for selective CPP. It does quite a good job of expanding macros you'd like to get rid of; much better than cc -E. Indent would help with the rest of your problems. --Guido -- Guido van Rossum, Centre for Mathematics and Computer Science (CWI), Amsterdam guido@cwi.nl or mcvax!guido or guido%cwi.nl@uunet.uu.net "You're so *digital*, girl!" -- Neneh Cherry
diamond@csl.sony.co.jp (Norman Diamond) (08/29/89)
In article <355@s6.Morgan.COM> amull@Morgan.COM (Andrew P. Mullhaupt) writes: -Can anyone recommend a filter through which I can run a source -program devised by a brilliant hieroglyphist with an over-active -macro imagination, utter disregard for indentation, and a penchant -for constructions of questionable portability? In article <10832@smoke.BRL.MIL> gwyn@brl.arpa (Doug Gwyn) writes: >"cc -E", "indent", and "rm" come to mind. But when you "rm" the hieroglyphist, you still have her source programs to contend with.... -- Norman Diamond, Sony Corporation (diamond@ws.sony.junet) The above opinions are inherited by your machine's init process (pid 1), after being disowned and orphaned. However, if you see this at Waterloo or Anterior, then their administrators must have approved of these opinions.