Project

General

Profile

FWD-VERSION Preprocessor Define

Starting in FWD v3.2, the preprocessor contains an implicit global define named FWD-VERSION. This is a version string that allows detecting the specific version number of the FWD installation being used for conversion. It is very useful for implementing conditionally preprocessing different 4GL code depending on whether the code is running in FWD or in OpenEdge.

Here is an example:

&if defined(FWD-VERSION) &then
   /* Message from fwd_version.p#2 ==> Running in FWD (FWD-VERSION = FWD v3.2.0_p2j_3435a_11233). */
   &message Running in FWD (FWD-VERSION = {&FWD-VERSION}).

   /* Running in FWD (FWD-VERSION = FWD v3.2.0_p2j_3435a_11233). */
   message "Running in FWD (FWD-VERSION = {&FWD-VERSION}).".
&else
   /*
    * ┌───────── Error ──────────┐
    * │ Running in 'Native' 4GL. │
    * │                          │
    * │ ──────────────────────── │
    * │           <OK>           │
    * └──────────────────────────┘
    */
   &message Running in 'Native' 4GL.

   /* Running 'Native' 4GL (10.2B). */
   message "Running 'Native' 4GL (" + proversion + ")." 
&endif

The definition is designed to be overridden if needed. It is deliberately registered as a global define for this reason. The value is the same as the string returned from com.goldencode.p2j.Version.gewtFWDVersion().

An example of how to exclude code from FWD but include it when running in OpenEdge/Progress 4GL:

&if defined(FWD-VERSION) eq 0 &then
   /* code here would only be used in OpenEdge, but not in FWD */
&endif

© 2018 Golden Code Development Corporation. ALL RIGHTS RESERVED.