Browse Prior Art Database

A Tool Which Converts a C++ Program into a Java Program

IP.com Disclosure Number: IPCOM000123553D
Original Publication Date: 1999-Jan-01
Included in the Prior Art Database: 2005-Apr-05
Document File: 1 page(s) / 31K

Publishing Venue

IBM

Related People

Cheng, M: AUTHOR [+2]

Abstract

A program is disclosed that converts a C++ program into a Java program. If a user wants to convert a C++ program into a Java program for faster turn around, lots of manual conversion needs to be done. This is a tedious task without any tool support.

This text was extracted from an ASCII text file.
This is the abbreviated version, containing approximately 91% of the total text.

A Tool Which Converts a C++ Program into a Java Program

   A program is disclosed that converts a C++ program into a
Java program.  If a user wants to convert a C++ program into a Java
program for faster turn around, lots of manual conversion needs to be
done.  This is a tedious task without any tool support.

   To convert a C++ program into Java for 100% completeness
may be an impossible task.  Partial conversion without user
intervention may be desired.  The following list shows a set of
rules automatic conversion, takes the CORBA programming model into
account:
  1.  Add all the "import" at the beginning of the file
  2.  Add "org.omg." in front of the class name known to
      reside in the org.omg package in Java,
  3.  Change "->" to "."
  4.  Convert "cout" into "System.out.println"
  5.  Convert "cerr" into "System.err.println"
  6.  Remove "_ptr"
  7.  Remove "_var"
  8.  Convert "::" into "." except for outermost scope.
  9.  Convert "ScopedName::_narrow(...)" into
      "ScopedNameHelper.narrow(...)".
 10.  Remove calls to "_duplicate()" and "_release()", since
      Java is a garbage collected environment.
 11.  Remove calls to "delete".
 12.  Change strcmp(a, b) to a.CompareTo(b).
 13.  Change strlen(a) to a.length.
 14.  Change strcat(a, b) to a = a + b.

   Any un-converted C++ code still needs to be converted
manually.

   This tool will improve the speed with which a C++ program is
converted into Java code...