finding procedure version
Tue, 01/11/2022 - 09:03 am
Might it be possible to create an easy way to query the version number of a procedure from within a function in that procedure?
Here is how I have done it using existing functions:
static function GetThisProcVersion()
int noversion = 0 // default value when no version is found
string strStack = GetRTStackInfo(3)
string strProc = StringFromList(ItemsInList(strStack, ",") - 2, strStack, ",")
wave /T ProcText = ListToTextWave(ProcedureText("",0,strProc), "\r")
Grep /Q/E="(?i)^#pragma[\s]*version[\s]*=" /LIST/Z ProcText
s_value = LowerStr(TrimString(s_value, 1))
sscanf s_value, "#pragma version = %f", versionVar
if (V_flag!=1 || versionVar<=0)
versionVar *= 100
int version = versionVar
Why would I want to do this?
When a package is initialized and a control panel is created, save the procedure file version associated with that panel.
When a control procedure runs, check that the current procedure version matches the init version.
If an saved experiment contains an out-of-date control panel that was created with an earlier version of the package, the version check will allow me to avoid errors arising from mismatch between new code and old initialisation state.
There are other ways to do it, but it would be nice to have something like a GetProcedureVersion(winName) function where GetProcedureVersion("") returns the version of the host file.