Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Tip
titleUse the gmBasic pre-compiler

gmBasic has a programmable pre-processor that allows migration teams to modify the source code in memory before it is processed for translation. Conceptually speaking it is a search and replace facility. In its simplest form, the pre-processor is invoked by the Compile/Fix or Refactor/EditFIle commands.

If you are changing your source solely to prepare it for migration, it is a best practice to use the pre-process command rather than doing them directly by hand. Using the pre-processor documents the changes, applies them systematically, and makes them repeatable and trackable. This is particularly important if the source code is under active maintenance outside of the migration effort.

 

Note: there are two forms for pre-editing codeIn its simplest form, the pre-processor may be invoked by the Compile/Fix or Refactor/EditFIle commands.

1) Compile\Fix\Replace commands in the Compile block of are loaded from your main translation script template

Code Block
<Compile ...>
<Fix host="AppUtilities" name="PreEdits">
   <Replace status="active" name="vbDouble used twice in same Select">
   <OldBlock><![CDATA[
   Case vbDecimal, vbCurrency, vbDouble, vbSingle
   ]]></OldBlock>
   <NewBlock><![CDATA[ 
   Case vbDecimal, vbCurrency, vbSingle 
   ]]></NewBlock>
   </Replace> 
</Fix>
...
</Compile>

 

2) Registry\Edit commands in a GlobalSettings files. This particularly useful for shared files like include files with web sites, and shared modules in VB6 systems.

Code Block
<GlobalImports>
<Storage Action="Create" Identifier="%UserFolder%\GlobalSettings" />
...
<Registry type="EditFile" Source="%VirtualRoot%Accounts\Litbuildings\lookup_addr.asp"><Fix name="Pre-Edits">
<Replace status="active" name="remove malformed javascript">
<OldBlock><![CDATA[//cal.setHolidays]]></OldBlock>
</Replace>
</Fix>
</Registry>
...
</GlobalSettings>

 

 

 

See Also

Support Statement: VB6 Refactoring