Browse Prior Art Database

Automatically Revising Function Prototypes in C and C++ Implementations of System Object Model Classes

IP.com Disclosure Number: IPCOM000113403D
Original Publication Date: 1994-Aug-01
Included in the Prior Art Database: 2005-Mar-27
Document File: 4 page(s) / 177K

Publishing Venue

IBM

Related People

Acker, LE: AUTHOR [+3]

Abstract

Disclosed is a programming technique for automatically revising function prototypes within a C or C++ implementation of a SOM class after the interface to some of the class's methods have been modified.

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

Automatically Revising Function Prototypes in C and C++ Implementations
of System Object Model Classes

      Disclosed is a programming technique for automatically revising
function prototypes within a C or C++ implementation of a SOM class
after the interface to some of the class's methods have been
modified.

      System Object Model (SOM) is a technology for object-oriented
programming whereby the programmer specifies the interface to a class
of objects in one language (IDL) and the implementation of the class
in his/her preferred programming language (e.g., C or C++).  The SOM
Compiler generates from the IDL interface specification a template
implementation file, a C or C++ module consisting of "stub" method
functions for each of the class's methods.  The programmer adds
application-specific code to each of the method functions in the
template, yielding a complete class implementation.

      The problem solved by this invention is as follows: after a
class implementation has been constructed by a programmer, the class
interface may be modified.  For example,  a parameter may be added to
a method, or the type of a parameter may be changed.  When this
occurs, the SOM Compiler cannot simply generate a new implementation
template, for then the existing implementation code would be lost.
Instead, the SOM Compiler generates a new implementation template and
automatically merges it with the existing implementation file,
modifying the prototypes of existing method functions as needed to
match changes in the method's interface.  It is not acceptable,
however, to simply replace the existing method-function prototype
with the new method-function prototype, for the following reason.
When a developer adds application-specific code to the stub method
procedures in the implementation file, he/she may change the names of
parameters in the prototypes.  While it would be preferable for the
developer to also change the method declaration in the class's IDL
specification,  so that the interface and implementation files are
consistent, developers often forget to make this change or simply do
not think it important.  As a result, the SOM Compiler must take care
when revising an implementation file to retain existing parameter
names as much as possible, even when replacing a method-function
prototype.  Otherwise, compilation errors could result when the
revised implementation file is compiled.  Even worse, changing
parameter names could introduce into the implementation file errors
not be detectable by the C/C++ compiler.

      The invention presented here consists of an algorithm for
revising method-function prototypes within a C or C++ implementation
of a SOM class after the interfaces to some of the class's methods
have been changed.  During the course of updating an existing class
implementation file, when the SOM Compiler detects different method
functions (for the same method) in the existing implementation file
and in the...