Jump to content

Using the CTOI Tool: Difference between revisions

From EDM2
Created page with "by Amy Conner Do you want to extend your SOM 1.0 programs to include multiple inheritance, or define methods that return structures? This is some of the new function provide..."
 
Ak120 (talk | contribs)
mNo edit summary
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
by [[Amy Conner]]
''by [[Amy Conner]]''


Do you want to extend your SOM 1.0 programs to include multiple inheritance, or define methods that return structures? This is some of the new function provided in the SOMobjects Developer Toolkit Version 2.0. To be able to extend your programs, you need to convert your programs from SOM 1.0 format to SOM 2.0 format.
''Do you want to extend your SOM 1.0 programs to include multiple inheritance, or define methods that return structures?'' This is some of the new function provided in the SOMobjects Developer Toolkit Version 2.0. To be able to extend your programs, you need to convert your programs from SOM 1.0 format to SOM 2.0 format.


The SOMobjects 2.0 toolkit contains the CTOI tool, which automates the conversion process from the SOM 1.0 format (.CSC) to SOM 2.0 format (.IDL). Unfortunately this tool is not magic, so you must prepare your program before you use the tool.
The SOMobjects 2.0 toolkit contains the CTOI tool, which automates the conversion process from the SOM 1.0 format (.CSC) to SOM 2.0 format (.IDL). Unfortunately this tool is not magic, so you must prepare your program before you use the tool.


So what's the preparation, you ask? Glad you want to know...  
''So what's the preparation, you ask? Glad you want to know...''


==Preparing for the Conversion==
==Preparing for the Conversion==
Set up the environment variables needed by the CTOI tool and the SOM compiler, as shown by the following sample code.
Set up the environment variables needed by the CTOI tool and the SOM compiler, as shown by the following sample code.
 
<code>
  SMINCLUDE=.;d:\.SOM\INCLUDE;d:\.toolkt2x\sc;
  SMINCLUDE=.;d:\.SOM\INCLUDE;d:\.toolkt2x\sc;
  SOMIR=d:\SOM\ETC\som.ir;som.ir
  SOMIR=d:\SOM\ETC\som.ir;som.ir
Line 17: Line 16:
  SMNOTC=1
  SMNOTC=1
  SMCLASSES=d:\som\bin\wptypes.idl;d:\toolkt2x\tlktbeta\samples\browse\browcls.idl;
  SMCLASSES=d:\som\bin\wptypes.idl;d:\toolkt2x\tlktbeta\samples\browse\browcls.idl;
 
</code>
You might need to create a file or be able to use the Workplace Shell class file, WPTYPES.IDL, if your program subclasses Workplace Shell classes. The BROWCLS.IDL file was created to define the LINERECORD structure:
You might need to create a file or be able to use the Workplace Shell class file, ''WPTYPES.IDL'', if your program subclasses Workplace Shell classes. The ''BROWCLS.IDL'' file was created to define the <tt>LINERECORD</tt> structure:
<PRe>
<code>
// ------------------------------------------------------------------
// ------------------------------------------------------------------
// File:  browcls.idl
// File:  browcls.idl
//
//
// This file contains the IDL type definitions for the foreign types
// This file contains the IDL type definitions for the foreign types
// defined in the Browse IDL files.
// defined in the Browse IDL files.
//
//
// ------------------------------------------------------------------
// ------------------------------------------------------------------
// interface Browse_O_Matic : WPDataFile
// interface Browse_O_Matic : WPDataFile
struct  S_LINERECORD
struct  S_LINERECORD
{
{
   PSZ  pszLine;      /* Pointer to beginning of each line of text */
   PSZ  pszLine;      /* Pointer to beginning of each line of text */
   UINT  unLength;      /* The length of each line of text */
   UINT  unLength;      /* The length of each line of text */
};
};
typedef S_LINERECORD LINERECORD;
typedef S_LINERECORD LINERECORD;
</PRe>
</code>


==Converting the Program==
==Converting the Program==
Now you're ready to call on the conversion tool - CTOI. Either add the statement <tt>drive:som\bin</tt> (where <tt>drive</tt> is the drive on which you've installed the SOMobjects Toolkit) to the path directory or prefix the tool request with the path. You can try this on one of the SOM 1.0 samples found on The Developer Connection for OS/2, Volume 3 or the SOM 1.0 directory of OS/2 2.x toolkit samples in The Developer Connection for OS/2, Volume 4. From a command-line prompt, enter <tt>CTOI BROWSE.CSC</tt> to create a ''BROWSE.IDL'' file.


Now you're ready to call on the conversion tool -- CTOI. Either add the statement drive:som\bin (where drive is the drive on which you've installed the SOMobjects Toolkit) to the path directory or prefix the tool request with the path. You can try this on one of the SOM 1.0 samples found on The Developer Connection for OS/2, Volume 3 or the SOM 1.0 directory of OS/2 2.x toolkit samples in The Developer Connection for OS/2, Volume 4. From a command-line prompt, enter CTOI BROWSE.CSC to create a BROWSE.IDL file.
SOM 2.0 doesn't support the private header file (.PH). Instead, a private definition <tt>#define __PRIVATE__</tt> excludes information from the public header files. The next step in the conversion process is to convert any references of <tt>passthru C_ph</tt> to <tt>#ifdef __PRIVATE__, passthru C_h, #endif</tt> in the ''.CSC'' file. Also, passthru statements intended for ''.C'' files should be changed to ''.IH'' (implementation header). ''BROWSE.CSC'' original passthru statements follow:
 
<code>
SOM 2.0 doesn't support the private header file (.PH). Instead, a private definition #define __PRIVATE__ excludes information from the public header files. The next step in the conversion process is to convert any references of passthru C_ph to #ifdef __PRIVATE__, passthru C_h, #endif in the .CSC file. Also, passthru statements intended for .C files should be changed to .IH (implementation header). BROWSE.CSC original passthru statements follow:
#******************************************************************************
 
#  Passthru PRIVATE definitions to the .ph file
<PRE>
#******************************************************************************
#******************************************************************************
passthru: C.ph;
#  Passthru PRIVATE definitions to the .ph file
#******************************************************************************
passthru: C.ph;
         /***************/
         /***************/
         /* Window data */
         /* Window data */
Line 63: Line 60:
         } BROWSEDATA;
         } BROWSEDATA;
         typedef BROWSEDATA *PBROWSEDATA;
         typedef BROWSEDATA *PBROWSEDATA;
endpassthru;
endpassthru;
</PRE>
</code>
BROWSE.IDL with changed passthru statements follow:
BROWSE.IDL with changed passthru statements follow:
<PRE>
<code>
#ifdef __PRIVATE__
#ifdef __PRIVATE__
     passthru C_h_after =      ""
     passthru C_h_after =      ""
"        /*************************/"
"        /*************************/"
"        /* Main View window data */"
"        /* Main View window data */"
"        /*************************/"
"        /*************************/"
""
""
"        typedef struct _BROWSEDATA"
"        typedef struct _BROWSEDATA"
"        {"
"        {"
"                USHORT          cb;            /* Size of _BROWSEDATA struct */"
"                USHORT          cb;            /* Size of _BROWSEDATA struct */"
""
""
"                Browse_O_Matic* somSelf;      /* Pointer to instance */"
"                Browse_O_Matic* somSelf;      /* Pointer to instance */"
"                USEITEM        UseItem;      /* Use Item structure  */"
"                USEITEM        UseItem;      /* Use Item structure  */"
                                        .
                                        .
                                        .
                                        .
                                        .
                                        .
"                USHORT usNumberOfTextLines; /* Maximum number of lines    */"
"                USHORT usNumberOfTextLines; /* Maximum number of lines    */"
"                                            /* of object displayed as text*/"
"                                            /* of object displayed as text*/"
"                ULONG  ulFileLength;        /* Length of file system object*/"
"                ULONG  ulFileLength;        /* Length of file system object*/"
""
""
"        } BROWSEDATA;"
"        } BROWSEDATA;"
""
""
"        typedef BROWSEDATA *PBROWSEDATA;"
"        typedef BROWSEDATA *PBROWSEDATA;"
#endif /*__PRIVATE__ */
#endif /*__PRIVATE__ */
</PRE>
</code>
Now, use the SOM compiler to create the .H, .IH, and .C files. Add an environment variable SET SMEMIT=h,ih,sc,c to set the emitters that will be used to create the header, implementation header, and source files. At a command-line prompt, enter sc -sh browse to create the header file. If you need to include private defintions, enter sc -D__PRIVATE__ -sh browse. The following sample shows BROWSE.H emitted from BROWSE.IDL using the private definition:
Now, use the SOM compiler to create the ''.H, .IH'', and ''.C'' files. Add an environment variable <tt>SET SMEMIT=h,ih,sc,c</tt> to set the emitters that will be used to create the header, implementation header, and source files. At a command-line prompt, enter <tt>sc -sh browse</tt> to create the header file. If you need to include private definitions, enter <tt>sc -D__PRIVATE__ -sh browse</tt>. The following sample shows ''BROWSE.H'' emitted from ''BROWSE.IDL'' using the private definition:
<PRE>
<code>
#ifndef SOM_Browse_O_Matic_h
#ifndef SOM_Browse_O_Matic_h
#define SOM_Browse_O_Matic_h
#define SOM_Browse_O_Matic_h
#include <som.h>
#include <som.h>
...
...
 
/*
/*
* Define the class name as an object type
  * Define the class name as an object type
*/
  */
#ifndef Browse_O_Matic
#ifndef Browse_O_Matic
#define Browse_O_Matic SOMObject
#define Browse_O_Matic SOMObject
#endif
#endif
#include <wpdataf.h>
#include <wpdataf.h>
...
...
 
/*
/*
* Passthru lines: File: "C.h", "after"
  * Passthru lines: File: "C.h", "after"
*/
  */
         /*************************/
         /*************************/
         /* Main View window data */
         /* Main View window data */
Line 126: Line 123:
         } BROWSEDATA;
         } BROWSEDATA;
         typedef BROWSEDATA *PBROWSEDATA;
         typedef BROWSEDATA *PBROWSEDATA;
</PRE>
</code>
To create the implementation header file, enter sc -sih browse; to create the implementation header file, and if you need to include private defintions, enter sc D__PRIVATE__ -sih browse . The following shows BROWSE.IH emitted from BROWSE.IDL:
To create the implementation header file, enter <tt>sc -sih browse</tt>; to create the implementation header file, and if you need to include private definitions, enter <tt>sc D__PRIVATE__ -sih browse</tt>. The following shows ''BROWSE.IH'' emitted from ''BROWSE.IDL'':
<PRE>
<code>
#ifndef SOM_Browse_O_Matic_ih
#ifndef SOM_Browse_O_Matic_ih
#define SOM_Browse_O_Matic_ih
#define SOM_Browse_O_Matic_ih
#pragma checkout(suspend)
#pragma checkout(suspend)
/*
/*
* Passthru lines: File: "C.ih", "before"
  * Passthru lines: File: "C.ih", "before"
*/
  */
         #define  INCL_WIN
         #define  INCL_WIN
         #define  INCL_DOS
         #define  INCL_DOS
Line 152: Line 149:
         } LINERECORD;
         } LINERECORD;
         typedef LINERECORD    *PLINERECORD; /* AMC 050494 */
         typedef LINERECORD    *PLINERECORD; /* AMC 050494 */
#include <browse.h>
#include <browse.h>
...
...
</PRE>
</code>
At a command-line prompt, enter sc -sc browse to create the stub source file (if you already have a source file from the .CSC format, this step will update the source file). You will have to put in the function code. To add private definitions, enter sc -D__PRIVATE__ -sc browse.
At a command-line prompt, enter <tt>sc -sc browse</tt> to create the stub source file (if you already have a source file from the ''.CSC'' format, this step will update the source file). You will have to put in the function code. To add private definitions, enter <tt>sc -D__PRIVATE__ -sc browse</tt>.


BROWSE.C already is created, so the file is modified:
''BROWSE.C'' already is created, so the file is modified:
<PRE>
<code>
#define Browse_O_Matic_Class_Source
#define Browse_O_Matic_Class_Source
#include "browse.ih"
#include "browse.ih"
#include "pmbrowse.h"
#include "pmbrowse.h"
HMODULE hModule = NULLHANDLE;
HMODULE hModule = NULLHANDLE;
/*
/*
* SOM_Scope VOID  SOMLINK Browse_O_Maticwps_BrowseOMatic(Browse_O_Matic *somSelf,
  * SOM_Scope VOID  SOMLINK Browse_O_Maticwps_BrowseOMatic(Browse_O_Matic *somSelf,
*                BOOL bMode,
  *                BOOL bMode,
*                PSZ pszName)
  *                PSZ pszName)
*/
  */
/*
/*
* The prototype for Browse_O_Maticwps_BrowseOMatic was replaced by the following prototype:
  * The prototype for Browse_O_Maticwps_BrowseOMatic was replaced by the following prototype:
*/
  */
SOM_Scope void  SOMLINK Browse_O_Maticwps_BrowseOMatic(Browse_O_Matic *somSelf,
SOM_Scope void  SOMLINK Browse_O_Maticwps_BrowseOMatic(Browse_O_Matic *somSelf,
                                                      BOOL bMode,
                                                        BOOL bMode,
                                                      PSZ pszName)
                                                        PSZ pszName)
{
{
     HAB          hab;
     HAB          hab;
     HWND          hwndClient = NULLHANDLE;
     HWND          hwndClient = NULLHANDLE;
Line 186: Line 183:
                                 .
                                 .
     WinShowWindow( hwndFrame, TRUE);  /* Make the window visible */
     WinShowWindow( hwndFrame, TRUE);  /* Make the window visible */
}
}
</PRE>
</code>
Now, you're ready to update your program's makefile to reflect the .IDL file types. Remove any references to the .PH (private header), change any references of .CSC to .IDL, and update the paths to point to the .IDL files, rather than the .SC class files. You will also need to reference the new library, SOMTK.LIB, instead of SOM.LIB. You can add the SOM compilation to your makefile. However, be sure that this comes before the compilation of any source files. Then, invoke the makefile and create your SOM 2.0 executable.
Now, you're ready to update your program's makefile to reflect the ''.IDL'' file types. Remove any references to the ''.PH'' (private header), change any references of ''.CSC'' to ''.IDL'', and update the paths to point to the ''.IDL'' files, rather than the ''.SC'' class files. You will also need to reference the new library, ''SOMTK.LIB'', instead of ''SOM.LIB''. You can add the SOM compilation to your makefile. However, be sure that this comes before the compilation of any source files. Then, invoke the makefile and create your SOM 2.0 executable.
<PRE>
<code>
INCLUDEP = d:\som\include;d:\toolkt2x\c\os2h
INCLUDEP = d:\som\include;d:\toolkt2x\c\os2h
!if [set INCLUDE=.;$(INCLUDEP);%include%] || \
!if [set INCLUDE=.;$(INCLUDEP);%include%] || \
    [set PATH=d:\som\bin;%path%] || \
    [set PATH=d:\som\bin;%path%] || \
    [set LIB=d:\som\lib;%lib%] || \
    [set LIB=d:\som\lib;%lib%] || \
    [set SMEMIT=h;ih;c] || \
    [set SMEMIT=h;ih;c] || \
    [set DPATH=d:\som\msg;%dpath%]
    [set DPATH=d:\som\msg;%dpath%]
!endif
!endif
DLLLIBS = $(DLLLIBS) somtk.lib
DLLLIBS = $(DLLLIBS) somtk.lib
</PRE>
</code>
Note: Change any references to .CSC and .SC to .IDL.
'''Note:''' Change any references to ''.CSC'' and ''.SC'' to ''.IDL''.


To install your application, copy an installation and de-installation command file from the sample subdirectory in the Developer's Toolkit for OS/2 2.1. These command files will properly register your classes and objects at installation time and de-register your classes and objects after application execution. Simply replace the sample names with your application names.  
To install your application, copy an installation and de-installation command file from the sample subdirectory in the Developer's Toolkit for OS/2 2.1. These command files will properly register your classes and objects at installation time and de-register your classes and objects after application execution. Simply replace the sample names with your application names.


==Conclusion==
==Conclusion==
''Now that you have converted your program to SOM 2.0. How about adding multiple inheritance and methods that return structures?'' Refer to the ''SOMobjects Developer Toolkit User's Guide'' for more information on these and other SOM 2.0 functions.


Now that you have converted your program to SOM 2.0. How about adding multiple inheritance and methods that return structures? Refer to the SOMobjects Developer Toolkit User's Guide for more information on these and other SOM 2.0 functions.
Happy converting and programming!
 
Happy converting and programming!  
 
'''Reprint Courtesy of International Business Machines Corporation, © International Business Machines Corporation'''


[[Category:SOM Articles]]
{{IBM-Reprint}}
[[Category:Developer Connection News Volume 5]][[Category:SOM Articles]]

Latest revision as of 03:55, 7 December 2019

by Amy Conner

Do you want to extend your SOM 1.0 programs to include multiple inheritance, or define methods that return structures? This is some of the new function provided in the SOMobjects Developer Toolkit Version 2.0. To be able to extend your programs, you need to convert your programs from SOM 1.0 format to SOM 2.0 format.

The SOMobjects 2.0 toolkit contains the CTOI tool, which automates the conversion process from the SOM 1.0 format (.CSC) to SOM 2.0 format (.IDL). Unfortunately this tool is not magic, so you must prepare your program before you use the tool.

So what's the preparation, you ask? Glad you want to know...

Preparing for the Conversion

Set up the environment variables needed by the CTOI tool and the SOM compiler, as shown by the following sample code.

SMINCLUDE=.;d:\.SOM\INCLUDE;d:\.toolkt2x\sc;
SOMIR=d:\SOM\ETC\som.ir;som.ir
SMTMP=d:\SOM\TMP
SMADDSTAR=1
SMNOTC=1
SMCLASSES=d:\som\bin\wptypes.idl;d:\toolkt2x\tlktbeta\samples\browse\browcls.idl;

You might need to create a file or be able to use the Workplace Shell class file, WPTYPES.IDL, if your program subclasses Workplace Shell classes. The BROWCLS.IDL file was created to define the LINERECORD structure:

// ------------------------------------------------------------------
// File:  browcls.idl
//
// This file contains the IDL type definitions for the foreign types
// defined in the Browse IDL files.
//
// ------------------------------------------------------------------
// interface Browse_O_Matic : WPDataFile
struct   S_LINERECORD
{
  PSZ   pszLine;       /* Pointer to beginning of each line of text */
  UINT  unLength;      /* The length of each line of text */
};
typedef S_LINERECORD LINERECORD;

Converting the Program

Now you're ready to call on the conversion tool - CTOI. Either add the statement drive:som\bin (where drive is the drive on which you've installed the SOMobjects Toolkit) to the path directory or prefix the tool request with the path. You can try this on one of the SOM 1.0 samples found on The Developer Connection for OS/2, Volume 3 or the SOM 1.0 directory of OS/2 2.x toolkit samples in The Developer Connection for OS/2, Volume 4. From a command-line prompt, enter CTOI BROWSE.CSC to create a BROWSE.IDL file.

SOM 2.0 doesn't support the private header file (.PH). Instead, a private definition #define __PRIVATE__ excludes information from the public header files. The next step in the conversion process is to convert any references of passthru C_ph to #ifdef __PRIVATE__, passthru C_h, #endif in the .CSC file. Also, passthru statements intended for .C files should be changed to .IH (implementation header). BROWSE.CSC original passthru statements follow:

#******************************************************************************
#   Passthru PRIVATE definitions to the .ph file
#******************************************************************************
passthru: C.ph;
       /***************/
       /* Window data */
       /***************/
       typedef struct _BROWSEDATA
       {
               USHORT          cb;            /* Size of _BROWSEDATA struct    */
               Browse_O_Matic* somSelf;       /* Pointer to instance           */
               USEITEM         UseItem;       /* Use Item structure            */
                                               .
                                               .
                                               .
               USHORT          usNumberOfTextLines; /* Maximum number of lines */
                                              /* of object displayed as text   */
               ULONG           ulFileLength;  /* Length of file system object  */
       } BROWSEDATA;
       typedef BROWSEDATA *PBROWSEDATA;
endpassthru;

BROWSE.IDL with changed passthru statements follow:

#ifdef __PRIVATE__
   passthru C_h_after =      ""
"        /*************************/"
"        /* Main View window data */"
"        /*************************/"
""
"        typedef struct _BROWSEDATA"
"        {"
"                USHORT          cb;            /* Size of _BROWSEDATA struct */"
""
"                Browse_O_Matic* somSelf;       /* Pointer to instance */"
"                USEITEM         UseItem;       /* Use Item structure  */"
                                        .
                                        .
                                        .
"                USHORT usNumberOfTextLines; /* Maximum number of lines    */"
"                                            /* of object displayed as text*/"
"                ULONG  ulFileLength;        /* Length of file system object*/"
""
"        } BROWSEDATA;"
""
"        typedef BROWSEDATA *PBROWSEDATA;"
#endif /*__PRIVATE__ */

Now, use the SOM compiler to create the .H, .IH, and .C files. Add an environment variable SET SMEMIT=h,ih,sc,c to set the emitters that will be used to create the header, implementation header, and source files. At a command-line prompt, enter sc -sh browse to create the header file. If you need to include private definitions, enter sc -D__PRIVATE__ -sh browse. The following sample shows BROWSE.H emitted from BROWSE.IDL using the private definition:

#ifndef SOM_Browse_O_Matic_h
#define SOM_Browse_O_Matic_h
#include <som.h>
...

/*
 * Define the class name as an object type
 */
#ifndef Browse_O_Matic
#define Browse_O_Matic SOMObject
#endif
#include <wpdataf.h>
...

/*
 * Passthru lines: File: "C.h", "after"
 */
       /*************************/
       /* Main View window data */
       /*************************/
       typedef struct _BROWSEDATA
       {
               USHORT          cb;            /* Size of _BROWSEDATA struct */
               Browse_O_Matic* somSelf;       /* Pointer to instance */
               USEITEM         UseItem;       /* Use Item structure */
                                       .
                                       .
                                       .
               USHORT          usNumberOfTextLines; /* Maximum number of lines
                                              /* of object displayed as text*/
               ULONG           ulFileLength;  /* Length of file system object*/
       } BROWSEDATA;
       typedef BROWSEDATA *PBROWSEDATA;

To create the implementation header file, enter sc -sih browse; to create the implementation header file, and if you need to include private definitions, enter sc D__PRIVATE__ -sih browse. The following shows BROWSE.IH emitted from BROWSE.IDL:

#ifndef SOM_Browse_O_Matic_ih
#define SOM_Browse_O_Matic_ih
#pragma checkout(suspend)
/*
 * Passthru lines: File: "C.ih", "before"
 */
       #define   INCL_WIN
       #define   INCL_DOS
       #define   INCL_DOSERRORS
       #define   INCL_DOSMODULEMGR
       #define   INCL_WINSTDDRG
       #define   INCL_WPCLASS
       #include  <os2.h>
       #define   HELP_FILE     "browse.hlp"
       /*****************************/
       /* Text object record format */
       /*****************************/
       typedef  struct   _LINERECORD
       {
          PSZ   pszLine;       /* Pointer to beginning of each line of text */
          UINT  unLength;      /* The length of each line of text */
       } LINERECORD;
       typedef LINERECORD     *PLINERECORD; /* AMC 050494 */
#include <browse.h>
...

At a command-line prompt, enter sc -sc browse to create the stub source file (if you already have a source file from the .CSC format, this step will update the source file). You will have to put in the function code. To add private definitions, enter sc -D__PRIVATE__ -sc browse.

BROWSE.C already is created, so the file is modified:

#define Browse_O_Matic_Class_Source
#include "browse.ih"
#include "pmbrowse.h"
HMODULE hModule = NULLHANDLE;
/*
 * SOM_Scope VOID  SOMLINK Browse_O_Maticwps_BrowseOMatic(Browse_O_Matic *somSelf,
 *                 BOOL bMode,
 *                 PSZ pszName)
 */
/*
 * The prototype for Browse_O_Maticwps_BrowseOMatic was replaced by the following prototype:
 */
SOM_Scope void  SOMLINK Browse_O_Maticwps_BrowseOMatic(Browse_O_Matic *somSelf,
                                                       BOOL bMode,
                                                       PSZ pszName)
{
   HAB           hab;
   HWND          hwndClient = NULLHANDLE;
   HWND          hwndFrame  = NULLHANDLE;
   FRAMECDATA    flFrameData;
   PBROWSEDATA   pWindowData;
   /* Browse_O_MaticData *somThis = Browse_O_MaticGetData(somSelf); */
   Browse_O_MaticMethodDebug("Browse_O_Matic","Browse_O_Maticwps_BrowseOMatic");
                               .
                               .
                               .
   WinShowWindow( hwndFrame, TRUE);   /* Make the window visible */
}

Now, you're ready to update your program's makefile to reflect the .IDL file types. Remove any references to the .PH (private header), change any references of .CSC to .IDL, and update the paths to point to the .IDL files, rather than the .SC class files. You will also need to reference the new library, SOMTK.LIB, instead of SOM.LIB. You can add the SOM compilation to your makefile. However, be sure that this comes before the compilation of any source files. Then, invoke the makefile and create your SOM 2.0 executable.

INCLUDEP = d:\som\include;d:\toolkt2x\c\os2h
!if [set INCLUDE=.;$(INCLUDEP);%include%] || \
    [set PATH=d:\som\bin;%path%] || \
    [set LIB=d:\som\lib;%lib%] || \
    [set SMEMIT=h;ih;c] || \
    [set DPATH=d:\som\msg;%dpath%]
!endif
DLLLIBS = $(DLLLIBS) somtk.lib

Note: Change any references to .CSC and .SC to .IDL.

To install your application, copy an installation and de-installation command file from the sample subdirectory in the Developer's Toolkit for OS/2 2.1. These command files will properly register your classes and objects at installation time and de-register your classes and objects after application execution. Simply replace the sample names with your application names.

Conclusion

Now that you have converted your program to SOM 2.0. How about adding multiple inheritance and methods that return structures? Refer to the SOMobjects Developer Toolkit User's Guide for more information on these and other SOM 2.0 functions.

Happy converting and programming!

Reprint Courtesy of International Business Machines Corporation, © International Business Machines Corporation