Title: MC Version Testing
Hi

I don't know if this will be of any help to anyone, but I find it helps me when running stacks upgraded to use features from new versions of MetaCard. In order to avoid problems whilst running a stack I always include a call to a handler to check that the current MetaCard engine is late enough to support necessary features.  Typically I call:

        if MCearlierThan("2.3.1",true) then quit

With the following handler to test the current MC version including beta and gamma releases:

function MCearlierThan minVersion, showMsg
  set the itemDelimiter to "."
  put the version into currVers
  put item 1 of currVers into mcVers
  put toLower(item 2 to -1 of currVers) into theVers
  repeat with i = number of chars in theVers down to 1
    put offset(char i of theVers, ".abcdefghijklmnopqrstuvwxyz") into posn
    if posn <> 0 then delete char i of theVers
  end repeat
  put (mcVers & "." & theVers) + 0 into mcVers
  put item 1 of minVersion into minMCvers
  put toLower(item 2 to -1 of minVersion) into theVers
  repeat with i = number of chars in theVers down to 1
    put offset(char i of theVers, ".abcdefghijklmnopqrstuvwxyz") into posn
    if posn <> 0 then delete char i of theVers
  end repeat
  put (minMCvers & "." & theVers) + 0 into minMCvers
  if mcVers < minMCvers then
    if showMsg then
        answer "Oops, this stack needs version MetaCard " & minVersion & return & \
            " or later (you're using version " & currVers & ")!" with "Quit"
    end if     
    return true
  else
    return false
  end if
end MCearlierThan

The above avoids problems when trying to use recent features not supported in earlier versions of MC.  IF you find it useful, then help yourself!

Cheers

Peter
--
--------------------------------------------------------
Peter Reid
Reid-IT Limited, Loughborough, Leics., UK
Tel: +44 (0)1509 268843 Fax: +44 (0)870 052 7576
E-mail: [EMAIL PROTECTED]
Web: http://www.reidit.co.uk
Archives: http://www.mail-archive.com/metacard%40lists.best.com/ Info: http://www.xworlds.com/metacard/mailinglist.htm Please send bug reports to <[EMAIL PROTECTED]>, not this list.

Reply via email to