Xbase to Xbase DBMS C++ Converter

Program Xb2cpp.pl V0.1 26-11-98

Author

Hubertus Kehl, kehl@informatik.tu-muenchen.de, kehlh@hotmail.com
Please send suggestions, bug reports, patches, etc. one of these email adresses.

Language

Perl 5.0

Purpose

Convert Dbase, Clipper, FOXPRO Source Code to XBASE C++ Code for use with XBASE DBMS Library

Output

.cpp File and .h File

Arguments

1st arg = filename

Remarks

The script tries to keep track of the databases used in different workareas. But the flow through your program cannot be determined, so in some cases you have to help the script a bit by giving additional info.

Three special comments have been designed to add this info:

* XB2CPP(SelectedArea)
or  * XB2CPP(SelectedArea,Workarea1,Alias1,Wa2,Al2...)
or  * XB2CPP(SelA,WA1,Al1[Total1, Active1],Wa2, Al2[Tot2,Act2])

e.g. * XB2CPP(3,3,ZP,2,PL) will inform the script for example at the beginning of a PROCEDURE that a database with Alias ZP is opened in workarea 3 and a database with alias PL is opened in workarea2 and when calling this procedure always workarea 3 is selected.

The third alternative of this statement makes it possible to define the number of open indices and which one is the active index, as given by a previous SET INDEX TO or USE and SET ORDER TO statements. The script cannot know, which procedures, statements have been executed before and opened indices.... So * XB2CPP(2,2,ZP[2,1]) will inform the script about an open database alias ZP in workarea 2 which is currently selected and has two open indices where the first one is the active one.

Hints

  1. Always give an ALIAS in USE-Statements this is needed for generation of the Database Classnames
  2. Give the above described additional infos where necessary.
  3. Use ALIASes in Expressions with database fields, this helps the script in knowing where database references are.
  4. Replace the XXX in PutXXXField or GetXXXField manually the script is not able to determine variable or field types. The code for getting a Textfield (GetField) must also be corrected. Xbase DBMS Syntax requires the buffer as second parameter, the string will not be returned ! You may use a C++ String wrapper for this job.
  5. PROCEDURES that will operate on two different databases where some statements are used for both cannot be converted The script needs to know everytime on which database the statements are operating. Either duplicate such procedures, (one for each database), or write a generic C++ routine with pointers to databases.
  6. Don't assume any compilable or even working C++ source code as output. The ambigous DBASE language, which lacks type and variable definitions is one reason for this. This script only will help you for about 10-30% of the conversion. The rest (which remained uppercase) has to be done manually :)

Copyright

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation (version 2 of the License)

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.


Hubertus Kehl,29-11-1998