Automatically Adding Function Prefixes to C/C++ Method Functions for System Object Model Classes
Original Publication Date: 1994-Feb-01
Included in the Prior Art Database: 2005-Mar-26
Acker, LE: AUTHOR [+1]
Disclosed is a programming technique for automatically adding function prefixes to the prototypes of C or C++ method functions implementing the methods of SOM classes.
Automatically Adding Function Prefixes to C/C++ Method
for System Object Model Classes
a programming technique for automatically adding
function prefixes to the prototypes of C or C++ method functions
implementing the methods of SOM classes.
Model (SOM) is a technology for object-oriented
programming whereby the programmer specifies the interface to a class
of objects in one language (Interface Definition Language, or IDL)
and implements 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. This template
implementation file is 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.
specifying the interface to a SOM class in SOM IDL (SOM's
implementation of the IDL language), the programmer has the option of
specifying a "function prefix" for the class's method functions. If
the programmer specifies a function prefix, then as the SOM Compiler
generates stub method functions in the template implementation file,
the SOM Compiler will construct method function names by prepending
the specified prefix to the corresponding method name. If no
function prefix is specified, then the SOM Compiler uses the method
name as the method function name in the implementation template it
generates. The function-prefix facility is useful for avoiding name
collisions among the method functions of different SOM classes.
cases, a programmer will construct an initial IDL
specification for a class without specifying a function prefix,
generate a template implementation file using the SOM Compiler from
that specification, fill in the stub method functions with
application code, and then determine that is it necessary to begin
using a function prefix to avoid name collisions. Previously, the
programmer's only option was to manually edit every method function
in the implementation file and add the new function prefix to the
name of every method function.
described here automatically updates the method
functions in the implementation file so that all existing method
functions have the new function prefix prepended to their names.
This is done by the SOM Compiler as it updates the implementation
file, adding new method functions for any new methods added to the
class and updating existing method function prototypes to match
changes in the signatures of previously existing methods.
presented here consists of an algorithm for
automatically adding function prefixes to the names of method
functions in a C or C++ implementation file for a SOM class. The
basic approach is as follows. When the developer invokes the SOM
Compiler to update a C or...