From 3f52712f806fbd80d66dfdcaff401e5cf94dcca4 Mon Sep 17 00:00:00 2001 From: yash1112 Date: Fri, 7 Jul 2017 21:20:49 +0530 Subject: sci2c arduino updated --- macros/ASTManagement/AST_CheckLastFunc.sci | 77 ++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 macros/ASTManagement/AST_CheckLastFunc.sci (limited to 'macros/ASTManagement/AST_CheckLastFunc.sci') diff --git a/macros/ASTManagement/AST_CheckLastFunc.sci b/macros/ASTManagement/AST_CheckLastFunc.sci new file mode 100644 index 00000000..508435b7 --- /dev/null +++ b/macros/ASTManagement/AST_CheckLastFunc.sci @@ -0,0 +1,77 @@ +function [LhsArgNames,LhsArgScope,NLhsArg] = AST_CheckLastFunc(fidAST,SearchLevel) +// function [LhsArgNames,LhsArgScope,NLhsArg] = AST_CheckLastFunc(fidAST,SearchLevel) +// ----------------------------------------------------------------- +// //NUT: add description here +// +// 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); + +// ----------------------- +// --- Initialization. --- +// ----------------------- +astfilepos = mtell(fidAST); +NLhsArg = 0; +LhsArgNames = ''; +LhsArgScope = ''; +FlagLastFunc = 0; +// --------------------------- +// --- End Initialization. --- +// --------------------------- + +//NUT: non capisco come mai tu non faccia il flipud degli argometi letti. +//NUT: Level 1 e' quando abbiamo una equal float fun +//NUT: level 0 quando abbiamo equal fun +tline = mgetl(fidAST,1); +AST_CheckLineLength(tline); +LhsField = stripblanks(tline); +if ((SearchLevel == 1) & (LhsField == 'EndFuncall')) + SearchLevel = 0; + tline = mgetl(fidAST,1); + AST_CheckLineLength(tline); + LhsField = stripblanks(tline); +end +if ((SearchLevel == 0) & (LhsField == 'Lhs :')) + tline = mgetl(fidAST,1); + AST_CheckLineLength(tline); + LhsField = stripblanks(tline); + while(LhsField ~= 'EndEqual') + NLhsArg = NLhsArg + 1; + if (LhsField == '') + error(9999, 'Found before EndEqual'); + elseif (LhsField == 'EndProgram') + error(9999, 'Found EndProgram before EndEqual'); + end + if (LhsField == 'Operation') + // if (LhsField == 'Operator: ins') + // It means that we have to store the results of the function in temp vars. + LhsField = 'EndEqual'; // Force the exit from the while. + NLhsArg = 0; + LhsArgNames = ''; + LhsArgScope = ''; + else + [LhsArgNames(NLhsArg),LhsArgScope(NLhsArg)] = AST_ExtractNameAndScope(LhsField); + tline = mgetl(fidAST,1); + AST_CheckLineLength(tline); + LhsField = stripblanks(tline); + end + end +end +mseek(astfilepos,fidAST,'set'); + +endfunction -- cgit