wave_compile
Compiles a PV‑WAVE command.
 
note
Any Wave Variable Handle (WVH) or Wave Structure Definition Handle (WSDH) returned from such PV-WAVE OPI interface routines as wave_get_WVH(), wave_wsdh_from_WVH() or wsdh_element() must be freed by the calling routine via wave_free_WVH or wave_free_WSDH or resource leaks will develop.
C Usage
long wave_compile(any_wave_cmd, WCHptr)
char *any_wave_cmd;
WCH *WCHptr;
FORTRAN Usage
Not available.
Input Parameters
any_wave_cmd—A string containing a PV‑WAVE command to be executed.
Output Parameters
WCHptr—A pointer to a Wave Code Handle for the compiled code to be executed.
Returned Status
OPI_SUCCESS—Successful.
OPI_FAILURE—Errors occurred during compilation.
OPI_DO_NOT_PROCEED—Errors occurred and execution should not continue. The calling C-code should do its cleaning up (free malloc’s space, free handles, etc.) and return to its caller immediately.
In either of the error cases, PV‑WAVE has already done its normal error processing which includes printing a message and setting the appropriate system variables.
Discussion
wave_execute compiles the PV‑WAVE statement each time it is called. This is quite ineffective if wave_execute is called several times (e.g., in the loop) with the same PV‑WAVE statement. It is more efficient to compile the PV‑WAVE statement once using wave_compile, which returns the handle WCHptr. Then execute the compiled PV‑WAVE code pointed to by WCHptr several times using wave_interp.
The wave_compile function takes the string argument it is given and treats it as a PV‑WAVE statement. The statement will be compiled and WCHptr is returned. If the compilation of the PV‑WAVE statement fails, OPI_FAILURE is returned, and WCHptr is undefined.