#!F-adobe-helvetica-medium-r-normal--18*
#!N 
#!CNavyBlue #!N  #!Rtmodbld Using the Module Builder: A Quick Walk Through 
#!N #!EC #!N #!N In this example, you will use the 
Module Builder to create a simple module that adds a single 
number to each data value of a set. Note: This function 
is supplied with Data Explorer as part of the  #!F-adobe-times-bold-r-normal--18*   Compute 
#!EF module and is used here only for purposes of illustration. 
#!N #!I0 #!N  #!F-adobe-times-medium-r-normal--18*   #!N #!N #!I30 #!N 1. Start the 
Module Builder with the command dx -builder. The Module Builder dialog 
box appears. #!N #!I30 #!N 2. Fill in the  #!F-adobe-times-bold-r-normal--18*   Overall 
Module Description #!EF section as follows: #!N #!I0 #!N #!N #!I0 
#!N  #!F-adobe-times-bold-r-normal--18*    #!F-adobe-times-bold-r-normal--18*   Name #!EF #!EF #!I50 #!N Type in a 
name for the module (for this example, use "Add.") #!N #!I0 
#!N  #!F-adobe-times-bold-r-normal--18*    #!F-adobe-times-bold-r-normal--18*   Category #!EF #!EF #!I50 #!N Select a category 
for the new module, either by clicking on one of the 
entries in the  #!F-adobe-times-bold-r-normal--18*   Existing #!EF pull-down menu or by typing 
in a menu name or a name of your choosing. #!N 
#!I0 #!N  #!F-adobe-times-bold-r-normal--18*    #!F-adobe-times-bold-r-normal--18*   Description #!EF #!EF #!I50 #!N Type in 
a short description of the module. This description will appear in 
the module's configuration dialog box (in the VPE window). #!N #!I0 
#!N  #!F-adobe-times-bold-r-normal--18*    #!F-adobe-times-bold-r-normal--18*   Number of inputs #!EF #!EF #!I50 #!N Use 
the stepper buttons to set the value to "2." The two 
inputs of the new module will be a data Field and 
the number to be added to each data value. #!N #!I0 
#!N  #!F-adobe-times-bold-r-normal--18*    #!F-adobe-times-bold-r-normal--18*   Number of outputs #!EF #!EF #!I50 #!N The 
module generates a single output. Use the stepper buttons to set 
the value to "1" if that is not already the value. 
The output is the new Field (i.e., the data value plus 
the added value). #!N #!I0 #!N  #!F-adobe-times-bold-r-normal--18*    #!F-adobe-times-bold-r-normal--18*   Outboard #!EF #!EF 
#!I50 #!N Activate the  #!F-adobe-times-bold-r-normal--18*   outboard #!EF toggle button and type 
in "Add" in the  #!F-adobe-times-bold-r-normal--18*   Executable Name #!EF field. (Leave the 
other toggle buttons and fields as they are.) Note: In this 
example, the new ("outboard") module is an independent process. In contrast, 
an "inboard" module is compiled and incorporated as part of the 
Data Explorer executable; and a runtime-loadable module is compiled independently and 
loaded into Data Explorer at run time. #!I0 #!N #!N #!N 
#!I30 #!N 3. Fill in the  #!F-adobe-times-bold-r-normal--18*   Individual Parameter Information #!EF 
section as follows: #!N #!I0 #!N #!N #!I0 #!N  #!F-adobe-times-bold-r-normal--18*    #!F-adobe-times-bold-r-normal--18*   
Input Number < 1 > #!EF #!EF #!I50 #!N The first 
input is the data field. #!N #!I0 #!N  #!F-adobe-times-medium-r-normal--18*   #!N #!N 
#!I30 #!N a. Set the button in the top-left corner of 
the  #!F-adobe-times-bold-r-normal--18*   Individual Parameter Information #!EF section to  #!F-adobe-times-bold-r-normal--18*   Input #!EF 
if that is not already the setting. #!N #!I30 #!N b. 
Use the stepper buttons to set  #!F-adobe-times-bold-r-normal--18*   Number #!EF to "1" 
if that is not already the value. #!N #!I30 #!N c. 
Enter a name for this parameter in the  #!F-adobe-times-bold-r-normal--18*   Name #!EF 
field (e.g., "data"). #!N #!I30 #!N d. Enter a short description 
in the  #!F-adobe-times-bold-r-normal--18*   Description #!EF field. #!N #!I30 #!N e. Confirm 
that the  #!F-adobe-times-bold-r-normal--18*   Required #!EF toggle button for the first input 
is activated. #!N #!I30 #!N f. Confirm that the  #!F-adobe-times-bold-r-normal--18*   field 
object #!EF toggle button (below  #!F-adobe-times-bold-r-normal--18*   Object Type #!EF ) is 
activated. #!N #!I30 #!N g. On the right-hand side of the 
 #!F-adobe-times-bold-r-normal--18*   Individual Parameter Information #!EF section, select  #!F-adobe-times-bold-r-normal--18*   float #!EF ("floating 
point") and  #!F-adobe-times-bold-r-normal--18*   Scalar #!EF for  #!F-adobe-times-bold-r-normal--18*   Data type #!EF and 
 #!F-adobe-times-bold-r-normal--18*   Data shape #!EF respectively. #!N #!I30 #!N h. Set  #!F-adobe-times-bold-r-normal--18*   
Positions #!EF and  #!F-adobe-times-bold-r-normal--18*   Connections #!EF to  #!F-adobe-times-bold-r-normal--18*   Not required #!EF 
(information about these components is not needed). #!N #!I30 #!N i. 
For this example, since the dependency of the data on positions 
or connections in the output Object will be the same as 
it was in the input Object, select  #!F-adobe-times-bold-r-normal--18*   Positions or Connections 
#!EF . #!N #!I0 #!N #!EF #!N #!N #!I0 #!N  #!F-adobe-times-bold-r-normal--18*   
 #!F-adobe-times-bold-r-normal--18*   Input Number < 2 > #!EF #!EF #!I50 #!N The 
second input is the value to be added to each data 
value. #!N #!I0 #!N  #!F-adobe-times-medium-r-normal--18*   #!N #!N #!I30 #!N a. Confirm 
that the button in the top-left corner of the  #!F-adobe-times-bold-r-normal--18*   Individual 
Parameter Information #!EF section is set to  #!F-adobe-times-bold-r-normal--18*   Input #!EF . 
#!N #!I30 #!N b. Use the stepper buttons to set  #!F-adobe-times-bold-r-normal--18*   
Number #!EF to "2." #!N #!I30 #!N c. Enter a name 
for this parameter in the  #!F-adobe-times-bold-r-normal--18*   Name #!EF field (e.g., "value"). 
#!N #!I30 #!N d. Enter a short description in the  #!F-adobe-times-bold-r-normal--18*   
Description #!EF field. #!N #!I30 #!N e. Confirm that the  #!F-adobe-times-bold-r-normal--18*   
Required #!EF toggle button is deactivated. #!N #!I30 #!N f. Specify 
a default value, such as "0." #!N #!I30 #!N g. If 
the default value is meant to be descriptive, activate the  #!F-adobe-times-bold-r-normal--18*   
Descriptive #!EF toggle button. #!N #!I30 #!N h. Under  #!F-adobe-times-bold-r-normal--18*   Object 
Type #!EF , activate the  #!F-adobe-times-bold-r-normal--18*   simple parameter #!EF toggle button. 
#!N #!I30 #!N i. Now activate the  #!F-adobe-times-bold-r-normal--18*   Scalar #!EF toggle 
button (below  #!F-adobe-times-bold-r-normal--18*   Type #!EF on the right-hand side). #!N #!I0 
#!N #!EF #!N #!N #!I0 #!N  #!F-adobe-times-bold-r-normal--18*    #!F-adobe-times-bold-r-normal--18*   Output Number < 
1 > #!EF #!EF #!I50 #!N Now describe the output of 
the module. #!N #!I0 #!N  #!F-adobe-times-medium-r-normal--18*   #!N #!N #!I30 #!N a. 
Change  #!F-adobe-times-bold-r-normal--18*   Input #!EF to  #!F-adobe-times-bold-r-normal--18*   Output #!EF (top-left corner of 
the  #!F-adobe-times-bold-r-normal--18*   Individual Parameter Information #!EF section). The  #!F-adobe-times-bold-r-normal--18*   Number #!EF 
setting changes to "1" automatically. #!N #!I30 #!N b. Enter a 
name for this parameter in the  #!F-adobe-times-bold-r-normal--18*   Name #!EF field (e.g., 
"result"). #!N #!I30 #!N c. Enter a short description in the 
 #!F-adobe-times-bold-r-normal--18*   Description #!EF field. #!N #!I30 #!N d. Confirm that the 
 #!F-adobe-times-bold-r-normal--18*   field object #!EF toggle button (below  #!F-adobe-times-bold-r-normal--18*   Object Type #!EF 
) is activated. #!N #!I30 #!N e. Confirm that  #!F-adobe-times-bold-r-normal--18*   Data 
type #!EF and  #!F-adobe-times-bold-r-normal--18*   Data Shape #!EF are set to  #!F-adobe-times-bold-r-normal--18*   
float #!EF and  #!F-adobe-times-bold-r-normal--18*   Scalar #!EF respectively. #!N #!I30 #!N f. 
Confirm that  #!F-adobe-times-bold-r-normal--18*   Dependency #!EF is set to  #!F-adobe-times-bold-r-normal--18*   Positions or 
connections #!EF . #!N #!I0 #!N #!EF #!N #!I0 #!N #!N 
#!N #!N You can now create the necessary files: #!N #!I0 
#!N  #!F-adobe-times-medium-r-normal--18*   #!N #!N #!I30 #!N a. Click on  #!F-adobe-times-bold-r-normal--18*   Build 
#!EF in the dialog box menu bar and select  #!F-adobe-times-bold-r-normal--18*   Create 
All #!EF in the pull-down menu. #!N #!N The Module Builder 
creates three files for the Add module: Add.c, Add.mdf, and Add.make. 
#!N #!I30 #!N b. To insert the necessary user-specific code in 
Add.c, use an editor. Look for the phrase "User's code goes 
here" at the bottom of the file, and type in the 
following: #!CForestGreen #!N #!N  #!F-adobe-courier-bold-r-normal--18*   #!N int i; #!N float value; 
#!N #!N if (value_knt==0) #!N value = 0; #!N else #!N 
value = value_data[0]; #!N #!N for (i=0; i<data_knt; i++) { #!N 
result_data[i] = data_data[i]+value; #!N } #!EF #!N #!N #!EC #!N #!N 
First, variables i and value are declared. Next, the default value 
of 0 is enforced by checking whether a number has been 
passed as the value parameter. If value_knt is equal to 0, 
the user did not pass a number, and value is set 
to 0. Otherwise, the passed number is used. Finally, the data 
component of the output is modified by adding value to every 
data item in the input. #!N #!N Alternatively, you could have 
put this information in a separate file and used the  #!F-adobe-times-bold-r-normal--18*   
Include File Name #!EF option in the  #!F-adobe-times-bold-r-normal--18*   Overall Module Description 
#!EF section. #!N #!I0 #!N #!EF #!N #!N #!N To create 
a version of Data Explorer that uses this module, type #!CForestGreen 
#!N #!N  #!F-adobe-courier-bold-r-normal--18*   #!N make -f Add.make #!EF #!N #!N #!EC 
To run Data Explorer using this module, type #!CForestGreen #!N #!N 
 #!F-adobe-courier-bold-r-normal--18*   #!N dx -edit -mdf Add.mdf #!EF #!N #!N #!EC If 
you were creating an inboard module instead, the only difference would 
be in the command to run Data Explorer: #!CForestGreen #!N #!N 
 #!F-adobe-courier-bold-r-normal--18*   #!N dx -edit -mdf Add.mdf -exec ./dxexec #!EF #!N #!N 
#!EC #!N #!I0 #!N #!EF #!N #!N #!N #!N  #!F-adobe-times-medium-i-normal--18*   Next 
Topic #!EF #!N #!N  #!Lall1006,dxall1007 h Module Builder: Menu Bar  #!EL  #!N  #!F-adobe-times-medium-i-normal--18*   #!N 
