summaryrefslogtreecommitdiff
path: root/2.3-1/macros/ASTManagement/AST_CheckLastFunc.sci
blob: 508435b79e5149bea0af4e7192b3848474fe39b3 (plain)
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
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 == '<EOL>')
         error(9999, 'Found <EOL> 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