Many macros require a special version number of VEDIT.
(For example while using features of a new VEDIT, that may not be
widely spread, aka beta test)
So they need a check whether the currently running VEDIT matches some
given version requirements.
To avoid reinventing the wheel every time I wrote a macro that can be
used in other macros to do that check.
Examples:
Reg_Set(103, "6.12") Call_File(Reg_Free, "CHECKVERS.VDM")
// checks for at least version 6.12
Reg_Set(103, "6131") Call_File(Reg_Free, "CHECKVERS.VDM")
// checks for at least version 6.13.1
Reg_Set(103, "6.12 2004-07-01") Call_File(Reg_Free, "CHECKVERS.VDM")
// or
Reg_Set(103, "612 20040701") Call_File(Reg_Free, "CHECKVERS.VDM")
// check for at least version 6.12 with
// release date 2004-07-01 or later
If the requirement isn't matched it displays an error dialog like:
"This macro requires a newer version of VEDIT than you are currently
using!"
"Current version: 6122 2004-05-24"
"Required: 6.13.1"
and sets the Return_Value > 0.
On success the Return_Value is set to 0.
So for example you can use a
if (Return_Value > 0) {
// do some cleaning up
return
}
just after the above call to quit the macro in question.
----------------------------------------------------------------------------
Note: This macro uses some new features of VEDIT 6.13
(Version_Num(EXTRA) and Version_Date)
But I implemented some code to let it work with VEDIT < 6.13 too.
Due to this compatibility code the macro is now much bigger than
technically necessary.
----------------------------------------------------------------------------
The macro is available here:
http://ziemski.privat.t-online.de/vedit/macros/checkvers.vdm
Comments are welcome, as usual.
Christian
|
|