Customizing gcc

Nirav_Shah <nshah@NetEdge.COM>
14 Jan 1997 20:19:06 -0500

          From comp.compilers

Related articles
Customizing gcc nshah@NetEdge.COM (Nirav_Shah) (1997-01-14)
Re: Customizing gcc cartegw@humsci.auburn.edu (Gerald Carter) (1997-01-19)
| List of all articles for this month |
From: Nirav_Shah <nshah@NetEdge.COM>
Newsgroups: comp.compilers,comp.lang.c++,gnu.g++.help
Date: 14 Jan 1997 20:19:06 -0500
Organization: "NetEdge Systems"
Keywords: C++, question, GCC

Hello all,


I am trying to develop a tool to generate C data structures given a C++
input file. Let me given an example:


My tool is expected to take in a C++ file like the one below:


class Base
{
    public:
      Base();
      ~Base();
      int data1;
      int data2;
      int method1(int arg1);
      int method2(int arg2);
};


and output a .h file like the one below:


typedef struct Base_Data
{
  int data1;
  int data2;


} Base_Data;


typedef struct Base_Methods {


    int (*Base_Constructor)();
    int (*Base_Destructor)();
    int (*method1)(int);
    int (*method2)(int);


} Base_Methods;




Now this header file can be used by a C program.


The tool is not expected to be a C++ compiler, but is expected to
support inheritance and other relationships so that a derived class can
have a derived method filled into its resulting C data strurctures.


My question is the following:


I have access to gcc-2.2.1 source code which compiles C++ programs.
Is it a reasonable task to modify this code so that I can pass it a
switch to generate a .h file as I described above?
I see this as adding support for another "assembly language"
(where I view the .h file output as the target "assembly language").


Is this possible to do by modifying GNU source code?


I'd greatly appreciate any help and suggestions.
Thanks very much in advance.


--
Nirav Shah E-Mail: nshah@netedge.com
NetEdge Systems, Inc. Voice: 508-670-7309
Billerica, Massachusetts Web: www.netedge.com


--


Post a followup to this message

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