How can I find out cc or cpp symbols?
Root Boy Jim
rbj at dsys.icst.nbs.gov
Sat Apr 22 04:49:30 AEST 1989
? Is there a way to find out what macros are defined? It's particularly hard
? to predict which names will be _predefined_.
? What I want is a way to find out *all* the names that are defined.
You can do this by a somewhat roundabout route. First you run the command
`strings' (if you have it) on the cpp binary. You then grep out only the
legal preprocessor strings (only alphanumeric or underscores not starting
with a digit). Then pipe it to an awk command which turns `foo' into
#ifdef foo
printf("foo\n");
#endif
and brackets the whole thing with "main () {" and "}". Sen the output
to a file, compile it, link it, and run it. Voila!
? I don't believe that the current cpp implementations have a way to do this,
? so I am really proposing defining a ``standard option'' which could be
? implemented in future cpp's.
? My proposals are:
? 1) #dump [rest of proposals deleted]
I would suggest a command line option rather than input source.
? Q1: Has anyone else wanted this capacity?
Obviously, since I didn't make it up. I forget where I saw it.
? Q2: Has anyone used a system with this capacity?
? Q3: What other uses can you think of for this capacity? (Besides verifying
? the honesty of the documentation?)
Larry Wall has a script called "Configure", which he distributes with
"patch" (and probably everything else he writes). Its purpose is to
determine what kind of system you are running on and set up flags
correctly for his makefiles and program source.
His approach is to catalogue all possible variants that might affect
automation of program compilation/installation and minimal tailoring.
Thus, he keeps a static list of preprocessor symbols that *he* cares
about, and challenges anyone to break (and then fix) his script.
? Q4: Are there similar problems in other tools?
Undoubtedly.
? I'm mostly thinking of interactive tools:
? o editors
? - vi has ":set all",
? - GNUemacs has a slew of "apropos" and "describe" features
? o debuggers
? - dbx (some versions) has variable and command expansion
? - sdb has variable matching, but I'm not sure it will list them for you
? o shells
? - sh and ksh have printenv
? - csh has set, alias and printenv commands.
? but they won't describe their own command syntax.
Try the `man' command :-)
? o databases
? - catalogs and views of the tables and views.
? Bernard A. Badger Jr. 407/984-6385 |``Use the Source, Luke!''
? Secure Computer Products |``Get a LIFE!'' -- J.H. Conway
? Harris GISD, Melbourne, FL 32902 |Buddy, can you paradigm?
? Internet: bbadger%x102c at trantor.harris-atd.com|'s/./&&/g' Tom sed expansively
Root Boy Jim is what I am
Are you what you are or what?
More information about the Comp.unix.questions
mailing list