Saves compiled user-written procedures and functions in a file.
Filename Specifies the name of a file in which to save specified compiled routines. By default, a file named routine
.cpr
is saved in the current working directory.Verbose If present and nonzero, prints a message for each saved function and procedure.
When a compiled routine is called in a PV-WAVE application, the directories in the !Path system variable are searched for a
.cpr
file with the same name as the called routine. If the .cpr
file is found, it is loaded and immediately executed. If a .cpr
file is not found, PV-WAVE searches !Path for a .pro
file with the same name. If the .pro
file is found, it is executed instead. With a special runtime license, saved compiled applications can be executed from the operating system level using the runtime mode flag. For example:
wave -r filename
-r
flag signifies "runtime" mode. It is possible to set an environment variable so that the -r
flag is not needed.To do this enter the following command:
setenv WAVE_FEATURE_TYPE RT
DEFINE WAVE_FEATURE_TYPE RT
set
WAVE_FEATURE
= RT
wave
filename
.cpr
extension when you execute compiled routines from the operating system prompt.
NOTE: To execute a runtime mode application, you must have a runtime license. Without a runtime license for PV-WAVE, you will be unable to start PV-WAVE in runtime mode as described in this section. For information on obtaining a runtime license for PV-WAVE, please contact Visual Numerics.
log_plot.pro
:
PRO log_plot
x = FLTARR(256)
x(80:120) = 1
freq = FINDGEN(256)
freq = freq (256-freq)
fil = 1. / (1+(freq / 20) ^2)
PLOT_IO, freq, ABS(FFT(X,1)), Xtitle = $ 'Relative Frequency', Ytitle ='Power', $ Xstyle = 1
OPLOT, freq, fil
WAIT, 3
WDELETE
END
WAVE
prompt:, compile the procedure with .RUN, and save the compiled procedure in a file using the COMPILE procedure. Then, delete the compiled procedure from memory and run the compiled procedure that is stored in the file.
.RUN log_plot
COMPILE, 'log_plot'
$ls log_plot*
log_plot.cpr log_plot.pro
DELPROC, 'log_plot'
log_plot
EXIT
% wave -r -nohome log_plot
-r
flag signifies "runtime" mode.
Place the following code in a file called
comtool.pro
, and save the file in the current working directory:Widget commands:
PRO ComTool
top=WwInit('example2', 'Examples', layout)
button=WwButtonBox(layout, 'Command', 'CbuttonCB')
status=WwSetValue(top, /Display)
WwLoop
END
PRO CbuttonCB, wid, data
command = WwCommand(wid, 'CommandOK', $ 'CommandDone', Position=[300,300], $ Title = 'Command Entry Window')
END PRO CommandOK, wid, shell
value = WwGetValue(wid)
PRINT, value
END PRO CommandDone, wid, shell
status = WwSetValue(shell, /Close)
END
WAVE
prompt:
.RUN comtool
COMPILE, 'ComTool', 'CbuttonCB', 'CommandOK', 'CommandDone', $ Filename = 'comtool'
$ls comtool*
comtool.cpr comtool.pro
EXIT
% wave -r comtool
-r
flag signifies "runtime" mode.
See the PV-WAVE Programmer's Guide for more information about runtime mode.