/usr/share/psychtoolbox-3/PsychOneliners/AppleVersion.m is in psychtoolbox-3-common 3.0.11.20131230.dfsg1-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | function versionString=AppleVersion(gestaltString)
% versionString=AppleVersion(gestaltString)
%
% OS 9 and OS X: __________________________________________________________
%
% AppleVersion('qtim') % QuickTime
% AppleVersion('atkv') % AppleTalk
% Uses Gestalt to retrieve Apple version information and returns a string.
% Apple has a "standard" format for versions, e.g. 3.0f7 or 8.0.1, that
% they use for some of their software components. APPLEVERSION uses GESTALT
% to retrieve the information. However, this is only useful for the few
% Gestalt selectors that return information in this "standard" format.
% If the selector is undefined (possibly because that software is
% not present) APPLEVERSION returns an empty string.
%
% WINDOWS: ________________________________________________________________
%
% AppleVersion does not exist in Windows.
%
% _________________________________________________________________________
%
% see also: Gestalt, Screen('Computer?'), MacModelName
% Matlab bugs fixed in Matlab 5.2.1:
% eval('b=gestalt(gestaltString);','return;');
% error message is not suppressed. RETURN is ignored.
% eval('gestalt(''atkv'');','[]')
% semicolon causes first arg to be treated as error.
% AppleVersion('apvr') % gestaltAppearanceVersion
% AppleVersion('ascv') % gestaltAppleScriptVersion
% AppleVersion('csvr') % gestaltControlStripVersion
% AppleVersion('otrv') % gestaltOpenTptRemoteAccessVersion
% AppleVersion('sysu') % gestaltSystemUpdateVersion
% AppleVersion('cltn') % gestaltCollectionMgrVersion
% AppleVersion('walk') % gestaltALMVers
% AppleVersion('gestaltALMVers') % gestaltAutoBuildVersion
% #define gestaltATalkVersion 'atkv' /* AppleTalk version &AD01/M01 */
% WARNING:
% This selector returns the majorRev field of the NumVersion record as
% hexadecimal instead of the usual BCD.
%
% #define gestaltGestaltKaputVersion 'G�K�' /* Gestalt Kaput */
% NOTE: Both the t characters are actually the option-t character
% (0xA0).
%
% #define gestaltGestaltVersion 'G�st' /* Gestalt version */
% NOTE: The "a" is actually the option-u/a character (0x8A).
% #define gestaltUniversalDiskFormatVersion? 'kudf'
% HISTORY:
% 3/21/98 dgp wrote it.
% 5/19/99 dgp Check for "unavailable selector" error.
% 12/7/04 awi Capitalized "Gestalt". Divided help by platform.
% 1/29/05 dgp Cosmetic.
b=eval('Gestalt(gestaltString)','[]');
if isempty(b) || b==-5551
versionString='';
return
end
bb=0;
for i=1:32;
bb=2*bb+b(i);
end
majorVersion=floor(bb/256/256/256);
minorVersion=bitand(15,floor(bb/256/256/16));
bugVersion=bitand(15,floor(bb/256/256));
release=bitand(255,floor(bb/256));
nonRelRev=bitand(255,floor(bb));
switch(release/16)
case 2; x=sprintf('d%x',nonRelRev);
case 4; x=sprintf('a%x',nonRelRev);
case 6; x=sprintf('b%x',nonRelRev);
case 8;
if nonRelRev>0
x=sprintf('f%x',nonRelRev);
else
x='';
end
otherwise
error(sprintf('The Gestalt string ''%s'' does not yield a standard Apple version code.',gestaltString));
end
if bugVersion~=0
versionString=sprintf('%d.%d.%d%s',majorVersion,minorVersion,bugVersion,x);
else
versionString=sprintf('%d.%d%s',majorVersion,minorVersion,x);
end
|