In the last issue of The Developer Connection News, Jeff English of One Up Corporation, expounded that "Migrating Windows source code to OS/2 is doable!" Then, Jeff went on to say that because of the sometimes significant differences in the operating systems, porting tools help to simplify this task.
This quarter, The Developer Connection for OS/2 CD-ROM contains a beta of the Source Migration and Reporting Tool (SMART), developed by One Up Corporation for IBM. SMART is an OS/2 2.1 application that can help you convert Windows 3.1 or OS/2 1.3 source code modules to native OS/2 2.1 32-bit source code modules.
This article reviews SMART and shows you how SMART can help ease a migration task.
How SMART Works
SMART takes as input an application that contains source code written for Windows 3.1 or OS/2 1.3. An application is either a complete set of source code modules used to build an application or a subset of those source code modules. SMART emits the set of source code modules with converted APIs, converted messages, and conversion assistance comments and information to the OS/2 2.1 source code. SMART offers user-selectable source code output format:
- Output of source code may allow conditional compilation of the source code for Windows 3.1 or OS/2 1.3, or OS/2 2.1. SMART accomplishes this by using #ifdef statements in the source code.
- Output of the flagged source code that points to the source code changes that would be needed to port the application to OS/2 2.1. SMART flags most of the source code on Windows 3.1 or OS/2 1.3 needing porting to OS/2 2 .1.
SMART consists of a single main executable module that provides a Presentation Manager (PM) user interface and one or more dynamic link libraries (DLL).
SMART has a main engine that uses Windows 3.1 or OS/2 1.3 and OS/2 2.1 dictionaries for the analysis and/or port of source code from one operating system platform to another. The porting issues in the dictionary are grouped into categories. These categor ies define the level of difficulty involved in porting a keyword from the Windows 3.1 or OS/2 1.3 to the OS/2 2.1 operating system. The categories are: informational only, literal replacement, replacement with parameter changes, change with more/less API calls, logic changes required, function does not exist, and items not yet defined in the porting dictionary.
The current release of SMART on The Developer Connection for OS/2 CD-ROM:
- Contains a stand-alone porting assistance tool with Presentation Manager interface
- Uses platform dictionary tables and databases
- Provides detailed analysis of source code
- Creates analysis reports for sizing assistance
- May automatically generate and flag your code using the migration facility.
- Performs most one-to-one literal changes automatically
- Provides selectable conversion options
- Can remove porting comments at user request
- Handles most direct blocked code #ifdef statements in source code.
- May detect and comment most of the changes for the port Contains an interface to most editors/browsers, including a powerful SourceLink product interface.
SMART provides the following porting options:
- An analysis of the level of difficulty required to migrate the Application, including total lines of code, count of lines of code needing port, average difficulty level of the port, percentage of the lines of code needing port and a list of specific problem areas. This analysis data or report is provided by SMART in ASCII text form and is presented on a window as well as sent to a user-selected editor or browser. This analysis report is optionally available from SMART to be sent to a printer.
- Automatic mapping of the Application source code from Windows 3.1 or OS/2 1.3 to OS/2 2.1, as provided within the porting dictionaries. This is equivalent to making the necessary changes to the source code to be ported.
- Inline comments, as provided within the porting dictionaries, containing the changes that would be required to port the source code to OS/2 2.1.
SMART provides these as individual options; however, combining them provides you with additional porting options. For example, you can combine the first option above with the second and third option. SMART also allows you to select the type of comments used in the source code.
SMART is designed and implemented so that an application ported from Windows 3.1 or OS/2 1.3 to the OS/2 2.1 operating system will have no requirements on the resultant ported source to use a proprietary vendor runtime module.
When there are minor differences between Windows 3.1 or OS/2 1.3 and OS/2 2.1 source code and, if you select the option of automatic mapping of the application source code during the porting process, SMART automatically ports source code, as provided wit hin the porting dictionaries. This may assist in minimizing additional programming.
SMART can also handle significant differences between Windows 3.1 or OS/2 1.3 and OS/2 2.1 (Significant differences are those differences which do not have a one-to-one correspondence between Windows 3.1 or OS/2 1.3 and OS /2 2.1.) This is because SMART is knowledge-based allowing an application port of the significant differences between Windows 3.1 or OS/2 1.3 source code to OS/2 2.1 source code as reasonable, or through inline comments.
Selecting the analysis option causes SMART to generate reports. The reports are provided in two sections: details by module and details by category.
The details by module section shows columns representing: size, lines in the file, lines of code, number of problem areas, percent number of problems based on the lines of code, instances of an individual problem, percent number of unique problems based on the lines of code, effort level (an arbitrary measure of the porting effort based on an arbitrary level of difficulty to code the Windows 3.1 capability), and the number of problems by category. Each column is subtotaled for each subdirectory of files.
The details by category section shows columns representing: number of problem areas, percent number of problems based on the lines of code, number of files having the same porting problem, instances of an individual problem, and percent number of unique problems based on the lines of code.
Should You Try SMART?
Absolutely! SMART will help you port your existing Windows 3.1 or OS/2 1.3 source code to OS/2 2.1 by allowing for substantial time to architect and design areas of the applications where OS/2 2.1 should be exploited. And, the analysis and reports produced by SMART can be very useful when allocating resources during the planning phase of your development cycle.
So, go ahead... give SMART a try! I look forward to your feedback. Send comments or suggestions to The Developer Connection section on the OS2DF2 Forum in Compuserve or to my internet ID firstname.lastname@example.org.
Reprint Courtesy of International Business Machines Corporation, © International Business Machines Corporation