AST_ReadASTHeader.sci · 2479 B · ext
.sci · seen 93× in SWHvia unique-primary
swh:1:cnt:7a52b1f26606b67f1f056a639ebb59cea03b2d3c;origin=https://github.com/siddhu8990/Scilab2C;anchor=swh:1:rev:6a320264c2de3d6dd8cc1d1327b3c30df4c8cb26;path=/2.3-1/macros/ASTManagement/AST_ReadASTHeader.sci
Show source
function ASTHeader = AST_ReadASTHeader(fidAST,ReportFileName)
// function ASTHeader = AST_ReadASTHeader(fidAST,ReportFileName)
// -----------------------------------------------------------------
// Reads the AST header
// txt=['Program'
// 'Name : '+p.name
// 'Outputs: '+strcat(objectlist2string(p.outputs),' ')
// 'Inputs : '+strcat(objectlist2string(p.inputs),' ')
// 'Statements '
//
// Input data:
// //NUT: add description here
//
//
// Output data:
// //NUT: add description here
//
//
// Status:
// 11-Apr-2007 -- Raffaele Nutricato: Author.
//
// Copyright 2007 Raffaele Nutricato.
// Contact: raffaele.nutricato@tiscali.it
// -----------------------------------------------------------------
// ------------------------------
// --- Check input arguments. ---
// ------------------------------
SCI2CNInArgCheck(argn(2),2,2);
ASTHeader = [];
tline = mgetl(fidAST,1);
AST_CheckLineLength(tline);
treeline = stripblanks(tline);
if STACKDEDUG == 1
disp('Read AST Line: '+treeline);
end
if (SCI2Cstrncmps1size('Program',treeline) == %F)
error(9999, 'Expected ""Program"" label in the AST');
end
tline = mgetl(fidAST,1);
AST_CheckLineLength(tline);
treeline = stripblanks(tline);
if STACKDEDUG == 1
disp('Read AST Line: '+treeline);
end
if (SCI2Cstrncmps1size('Name : ',treeline) == %F)
error(9999, 'Expected ""Name : "" label in the AST');
else
ASTHeader.Name = stripblanks(part(treeline,length('Name : ')+1:length(treeline)));
end
tline = mgetl(fidAST,1);
AST_CheckLineLength(tline);
treeline = stripblanks(tline);
if STACKDEDUG == 1
disp('Read AST Line: '+treeline);
end
if (SCI2Cstrncmps1size('Outputs: ',treeline) == %F)
error(9999, 'Expected ""Outputs: "" label in the AST');
else
ASTHeader.Outputs = stripblanks(part(treeline,length('Outputs: ')+1:length(treeline)));
end
tline = mgetl(fidAST,1);
AST_CheckLineLength(tline);
treeline = stripblanks(tline);
if STACKDEDUG == 1
disp('Read AST Line: '+treeline);
end
if (SCI2Cstrncmps1size('Inputs : ',treeline) == %F)
error(9999, 'Expected ""Inputs : "" label in the AST');
else
ASTHeader.Inputs = stripblanks(part(treeline,length('Inputs : ')+1:length(treeline)));
end
tline = mgetl(fidAST,1);
AST_CheckLineLength(tline);
treeline = stripblanks(tline);
if STACKDEDUG == 1
disp('Read AST Line: '+treeline);
end
if (SCI2Cstrncmps1size('Statements ',treeline) == %F)
error(9999, 'Expected ""Statements "" label in the AST');
end
endfunction