Page tree

Versions Compared

Key

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

...

Tip
titleUse the gmBasic pre-processor

gmBasic has a programmable pre-editor that is fast and precise. It allows migration teams to modify the source code in memory before it is processed for translation. Conceptually speaking, this is a search-and-replace facility. The original source code on disk is not modified.

If you are changing your source solely to prepare it for migration, it is a best practice to make changes "by tool" rather than doing them directly "by hand". Using the preprocessor 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.

In its simplest form, the preprocessor may be invoked by the Compile/Fix or Refactor/EditFile commands.

1) Compile/Fix/Replace commands may placed in your translation script template or in a ScriptRules file:

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-EditFile commands may be placed in a GlobalSettings file. This is particularly useful for shared files – like #include files with web sites or 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>
<Fix name="Pre-Edits">
  <Replace status="active" name="remove malformed javascript">
  <OldBlock><![CDATA[//cal.setHolidays]]></OldBlock>
</Replace>
</Fix>
</Registry>
...
</GlobalSettings>

...

  • Adding <Select Progress="1"> will provide a summary log of what the fixes are applied (or not)
  • Adding <Select Progress="2"> will provide a detailed log of what the fixes are applied (or not)
  • gmStudio can help you audit and report the fixes using the Translation Log report.

...