home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / lang / cplus / 16073 < prev    next >
Encoding:
Text File  |  1992-11-10  |  1.5 KB  |  54 lines

  1. Path: sparky!uunet!charon.amdahl.com!pacbell.com!decwrl!elroy.jpl.nasa.gov!usc!sol.ctr.columbia.edu!emory!ogicse!sequent!muncher.sequent.com!michael
  2. From: michael@sequent.com (Michael Squires)
  3. Newsgroups: comp.lang.c++
  4. Subject: Generate C++ from ANSI C?
  5. Message-ID: <1992Nov11.030317.14943@sequent.com>
  6. Date: 11 Nov 92 03:03:17 GMT
  7. Article-I.D.: sequent.1992Nov11.030317.14943
  8. Sender: usenet@sequent.com (usenet )
  9. Organization: Sequent Computer Systems Inc.
  10. Lines: 41
  11. Nntp-Posting-Host: eng2.sequent.com
  12.  
  13. I'm looking for a program which will read ANSI C header (.h) files
  14. and generate a C++ "class" with the listed functions as methods.
  15.  
  16. (I know that I don't need to do this in order to call the functions
  17. from C++. My problem is that I have some tools which read C++
  18. class definitions and do Good Things with them, and I want to 
  19. "objectify" some existing C API with minimal effort.)
  20.  
  21. That is, given a file - junk.h - with the following contents:
  22.  
  23.     int func1 (float x);
  24.     void sub1 (int i, char c);
  25.  
  26. I'd like to generate two files - a "myjunk.h" which looks like:
  27.  
  28.     class junk {
  29.     public:
  30.     int junk_func1 (float x);
  31.     void junk_sub1 (int i, char c);
  32.     }
  33.  
  34. (not too tough so far! :-) )
  35.  
  36. and a "myjunk.cpp" which looks like:
  37.  
  38.     int junk::junk_func1 (float x)
  39.     {
  40.     return func1 (x);
  41.     }
  42.  
  43.     void junk::junk_sub1 (int i, char c)
  44.     {
  45.     sub1 (i, c);
  46.     }
  47.  
  48. Any suggestions?
  49.  
  50.                 Thanks,
  51.                 Michael Squires
  52.                 INTERNET: michael@sequent.com
  53.                 CIS: 73510,1555
  54.