Imagix 4D User Guide


Examples

The following is an annotated sample command file. This contains both the actual cmmdXXX commands and the surrounding "set" and "source" commands to specify variable settings. Lines in the command file that begin with "#" are treated as comments. Note that although the paths in the sample are for Windows, forward slashes "/" rather than backslashes "\" are still used as they are necessary to insure proper handling of path names.

# Open an initial project, regenerate the project so that the
# project reflects the current state of the source code, and then
# generate a couple of reports using two report settings from the
# command file (and the rest from the last gui settings).
cmmdOpenProject c:/test/projects/project_33.4D
cmmdRegenerateProjectData

set dfgRpt(Variables_Set_in_Multiple_Tasks.protected) 1
cmmdReport Task_Flow_Checks..Variables_Set_in_Multiple_Tasks c:/test/reports/msv.txt
set dfgRpt(Variable_Flow_Between_Tasks.ss_sr) 0
cmmdReport Task_Flow_Checks..Variable_Flow_Between_Tasks     c:/test/reports/vfbt.txt
set dfgRpt(Out_of_Step_Variables.global) 1
cmmdReport Task_Flow_Checks..Out_of_Step_(Z)_Variables       c:/test/reports/zvars.txt

# Open a second project.  Multiple projects can be opened within a
# single command file.  Opening a new project closes the currently
# open project.

# When a project path contains a space, quotes must be used.
cmmdOpenProject "c:/test/projects/space dir/project_600.4D"

# Generate all of the reports.  Read (source) the file rpt_settings,
# which extends the current command file.  This is equivalent to a
# "#include" statement in C/C++.  The rpt_settings file might contain
# a series of "set" commands, to specify a series of report settings
# that are shared among multiple command files.  Output the reports
# in .csv format to facilitate importing them into spreadsheets.
# Because the output location path contains a space, quotes must be
# used.
source c:/test/reports/rpt_settings
set vtgPrint(Format) csv
cmmdReportMultiple "c:/test/space dir/reports"

# Create an fprintf-like statement for debugging.
cmmdDebug Essentials 1 c:/test/trace.log
dbgf About to start report export - format is $vtgPrint(Format)
cmmdDebug Off

# Generate certain reports as .4dr reports so that they can be
# imported back into Imagix 4D (Report > Import) and appear with
# all symbols tagged to support navigation through the gui. Use
# ASCII format so that the reports are easily readable.
set vtgPrint(Format) ASCII
cmmdReportExport Source_Checks..Potential_Static_Function "c:/t/space dir/static.4dr"
cmmdReportExport Function_Flow_Checks..Unused_Code        "c:/t/space dir/unused.4dr"

# Create an HTML document. Apply a style sheet named my_style.dgn
# from the directory ../imagix/user/doc_gen to control the format
# and contents of the document. Delete and define an architecture
# so that it represents the current state of the source code as
# re-analyzed earlier in this command file. When the output location
# path contains a space, quotes must be used.
set dcgOptions(Style)   ApplyDocGenSheet
set dcgOptions(DocGenSheet)  my_style
cmmdDeleteArchitecture my_curr_dirs_with_vars
cmmdDefineArchitecture Directory FuncVar my_curr_dirs_with_vars
cmmdDocument "c:/test/space dir/demo.4DD"
This second sample command file would typically be run as part of a nightly code build. Users coming in the next day would find that the Imagix 4D database is up-to-date and loads very quickly.

# Open the project representing the code being built.
cmmdOpenProject c:/test/projects/project_dev.4D
# Analyze the current version of the source code.  This causes
# the Imagix 4D database to represent the latest source code and
# to load quickly the next time the project is opened.
cmmdRegenerateProjectData
# Calculate the metric data.  As long as setting for Imagix 4D
# project size is set to Very Large, the calculated metrics are
# stored in the disk database, and won't need to be recalculated
# when the project is next opened.
cmmdCalcMetrics
In the case where some of the Flow Check reports are being used on a regular basis, here's an alternate command file for nightly builds that would generate report file that could be imported quickly during later sessions, so that users could avoid waiting for the analysis.

# Open the project representing the code being built.
cmmdOpenProject c:/test/projects/project_dev.4D
# Analyze the current version of the source code.  This causes
# the Imagix 4D database to represent the latest source code and
# to load quickly the next time the project is opened.
cmmdRegenerateProjectData
# Generate certain reports as .4dr reports so that they can be
# imported back into Imagix 4D (Report > Import) and appear with
# all symbols tagged to support navigation through the gui. Use
# ASCII format so that the reports are easily readable.
set vtgPrint(Format) ASCII
cmmdReportExport Task_Flow_Checks..Reentrant_Functions "c:/t/s d/rf.4dr"