Skip to content
Snippets Groups Projects
Commit cf5cd6b6 authored by Cristian Galperti's avatar Cristian Galperti
Browse files

algo info header file generated via a matlab function

parent f77a66ee
No related branches found
No related tags found
No related merge requests found
function writegitinfoheader()
% first we get TCV current shot number, to be used for tagging
mdsconnect('tcvdata');
curshot=mdsvalue('current_shot("tcv_shot")');
% then we try to tag the current rtccode repo
tagname = ['builds/TCV' num2str(curshot)];
str=sprintf('Going to try this git tag: %s [(Y)es/(N)o/A(p)pend]?',tagname);
answ=input(str,'s');
switch upper(answ)
case 'P'
nameapp = input('Type what to append to tag name: ','s');
tagname = [tagname nameapp];
case 'Y'
otherwise
return
end
tagmsg = input('Type git tag message here: ','s');
tagcmd = ['git tag ' tagname ' -m "' tagmsg '"'];
answ = input('Ok to tag [(Y)es/(N)o]?','s');
switch upper(answ)
case 'Y'
otherwise
return
end
[status,result] = system(tagcmd);
if status~=0
fprintf('could not tag, git error: \n%s\n', result);
return
end
taginfocmd = ['git for-each-ref refs/tags/' tagname ' --format="%(objectname) %(objecttype) %(refname) %(taggername) %(taggerdate) %(contents:subject)"'];
[status,result] = system(taginfocmd);
if status~=0
fprintf('could not retrieve tag info, git error: \n%s\n', result);
return
end
fprintf('Code decription string will be set to:\n%s\n', result);
fd=fopen('scdalgoinfo.h','w');
fprintf(fd, '/* scdalgoinfo.h */\n');
fprintf(fd, '/* generated on: %s */\n',char(datetime));
fprintf(fd, '\n');
fprintf(fd, '#ifndef SCDALGOINFO\n');
fprintf(fd, '#define SCDALGOINFO\n');
fprintf(fd, ['#define ALGOINFOSTR "' result(1:end-1) '"\n']);
fprintf(fd, ['#define ALGOINFOLEN ' num2str(numel(result)) '\n']);
fprintf(fd, '\n');
fprintf(fd, 'struct algoinfo {\n');
fprintf(fd, ' char text[ALGOINFOLEN];\n');
fprintf(fd, ' unsigned int len;\n');
fprintf(fd, '}\n');
fprintf(fd, '\n');
fprintf(fd, '#endif\n');
fclose(fd);
end
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment