how to get a list of variable types

tb06@PL118f.CC.Lehigh.EDU (TERRENCE BRANNON)
Wed, 30 Oct 91 18:33:08 -0500

          From comp.compilers

Related articles
how to get a list of variable types tb06@PL118f.CC.Lehigh.EDU (1991-10-30)
| List of all articles for this month |

Newsgroups: comp.compilers
From: tb06@PL118f.CC.Lehigh.EDU (TERRENCE BRANNON)
Keywords: parallel, question
Organization: Compilers Central
Date: Wed, 30 Oct 91 18:33:08 -0500

I am writing a parallel program simulator and I am doing the following:


After parallel source is written, I will go through the source on a
uniprocessor machine with the following steps:
1) run the source through cc -E to remove all the programmer's #defines and
      also to remove the comments from the program
2) now with GNU m4 take the source files and at each point in the C
      language source code where a statement nread( X );
      occurs, I want to replace it with TMACS_nread ( X , bytes_in_x_datatype );


The actual m4 define is no problem for the first argument, however, I need
some method of determining the number of bytes in X's datatype. NOTE: I
said the number of bytes in X's datatype, not in X.


For example if X is declared as int X[14]; the statement: nread ( X );
will be macro-redefined as TMACS_nread ( X , sizeof (int) );


if X is declared as struct L X[200]; the statement nread ( X ); will be
macro-redefined as TMACS_nread ( X , sizeof (struct L) );


tb06@pl118f.cc.lehigh.edu
Terrence Brannon
[It's not easy without understanding the whole program. Perhaps you
can fake something with gcc's typeof. -John]
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.