📄 findrevision.m
字号:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Property of Freescale
% Freescale Confidential Proprietary
% Freescale Copyright (C) 2005 All rights reserved
% ----------------------------------------------------------------------------
% $RCSfile: FindRevision.m.rca $
% $Revision: 1.1 $
% $Date: Wed Oct 18 13:45:52 2006 $
% Target: Matlab
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [s,v]=FindRevision(file,N)
% retreive the Revision number of the selected file
%
% INPUT ARGUMENTS
% file : input file name in which we should look for
% for example file='../source/SBX_FPULSPK_MRC.c';
% N : (optional) input number of lines to have a look at
%
% OUTPUT ARGUMENTS
% s : information string: see code below
% v : (optional) string: version (part of s)
ok=0;
s='';
v='notFound';
fid=fopen(file);
if fid==-1
s = [ file ' could not be opened - check file name please / make sure you have included path in file name : for example "s=FindRevision(../source/SBX_FPULSPK_MRC.c)" '];
error(s)
end
if nargin==1 %define N if undefined
N=30; %number of lines to look for revision tag
end
for i=1:N
str = fgetl(fid);
if ~ischar(str), break, end
if length(str)>=18
for j=1:length(str)-9
if all(str(1+j:9+j)=='Revision:') %look for 'Revision'
%disp(str) ;
v=str(14:18);
ok=1;
break
end
end
end
end
%-- Display info
switch ok
case 0
s=['Error: ' '"Revision" tag not found in the first ' int2str(N) ' lines of ' file];
disp(s);
case 1
s=['Revision of ' file ' used: ' v ];
disp(s);
end
fclose(fid);
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -