Search | Synergex.com | Contact Us | Resource Center Login | Home|
News & Events

Spotlight on Synergy/DE 9.3: Developing xfServerPlus Applications Just Got Easier

By Galen Carpenter, Senior Programmer, Synergy/DE

If you’ve developed an xfServerPlus – xfNetLink application, you’re no doubt familiar with the Method Definition Utility (MDU) and its companion, the Synergy Method Catalog (SMC). Once your Synergy routines are written, you have to use the MDU to put the routine and parameter information into the SMC . And then, when a routine’s parameters or return type change, you have to remember to launch the MDU and modify the SMC files accordingly. Using the MDU can be tedious, time consuming, and potentially error prone, and it’s all too easy for your SMC to get out of sync with your code.

To make it easier for you to keep your SMC up-to-date, Synergy/DE 9.3 includes two new features : attributes and the dbl2xml utility. Attributes allow you to “decorate” your source code with additional information about the routines you want to use with xfServerPlus. xfServerPlus uses two attributes : xfMethod and xfParameter. Each of these has a number of properties, which are used to supply metadata about the routine. The xfMethod attribute is placed in front of any routine that you want included in the SMC. At a minimum, it must specify the interface name and the ELB name and location in its properties. The xfParameter attribute is placed in front of the parameter it describes. Depending on the type of parameter, it may be optional. Much of the information needed in the SMC can be taken directly from the existing code, with default values assumed in many cases, but sometimes additional information must be specified in the attribute lists.

The dbl2xml utility facilitates getting the necessary information out of the code and into the SMC. This utility reads the source file, finds the attributed code, extracts the necessary information from the attributes as well as from the code itself, and creates an XML file containing method definitions. This file is then imported into the SMC using the MDU’s import facility. This new process is supported on all platforms and can be used regardless of the xfNetLink client. You can even automate it by adding the commands to run dbl2xml and the MDU to your build script.

Here’s an example of a function to which we’ve added attributes:

{xfMethod(interface="myinterface", elb="XYZ:myfile")}
function myfunc
   {xfParameter(length=2)}
   arg1,  a
   arg2,  i
   arg3,  [*]a50
proc
   freturn(3)
end

When the dbl2xml utility is run on this example code, it will see that this function has an xfMethod attribute and gather the information about the routine that is needed in the SMC. The method ID and the method name default to the routine name of “myfunc”, and the return type is taken from the FRETURN statement. The data types of the parameters are taken from the formal arguments. If the parameter specification does not include a size, the default size for the type is used. For example, the second argument’s size will be four since that’s the default for an integer type. Alpha parameters must have the size specified either in the attribute (as shown for the first argument) or the parameter definition. For the third argument, the utility takes the type and size from the parameter definition.

continue >

Contact Synergex to learn more about  News and Events