summaryrefslogtreecommitdiff
path: root/macros/FunctionAnnotation
diff options
context:
space:
mode:
authorjofret2010-06-21 07:19:27 +0000
committerjofret2010-06-21 07:19:27 +0000
commit6d7c1d87455053bb11082198f747eb9445f59675 (patch)
tree78dd24dbab90140633ee33850990d6abf6d9e9ea /macros/FunctionAnnotation
parent7a35f83fa20927d71dd1b1f792dea35c7e9d5f47 (diff)
downloadscilab2c-6d7c1d87455053bb11082198f747eb9445f59675.tar.gz
scilab2c-6d7c1d87455053bb11082198f747eb9445f59675.tar.bz2
scilab2c-6d7c1d87455053bb11082198f747eb9445f59675.zip
Hypermatrix management : detect variables with more than 2 dimensions
Diffstat (limited to 'macros/FunctionAnnotation')
-rw-r--r--macros/FunctionAnnotation/FA_GetFunAnn.sci52
-rw-r--r--macros/FunctionAnnotation/FA_GetOutArgInfo.sci55
2 files changed, 37 insertions, 70 deletions
diff --git a/macros/FunctionAnnotation/FA_GetFunAnn.sci b/macros/FunctionAnnotation/FA_GetFunAnn.sci
index b3d842ab..98956785 100644
--- a/macros/FunctionAnnotation/FA_GetFunAnn.sci
+++ b/macros/FunctionAnnotation/FA_GetFunAnn.sci
@@ -159,42 +159,28 @@ else
// #RNU_RES_B
// --- Read the Fun size annotation. ---
// #RNU_RES_E
- SCI2C_nelem = 1; // Useful for eval.
- line_position = line_position + 1;
- if (isempty(check_string) == %F)
- tmpannstring = eval(SharedInfo.Annotations.FUNSIZE);
- check_string = stripblanks(mgetl(inclsfid,1));
- if (SCI2Cstrncmps1size(tmpannstring,check_string))
+ SCI2C_nelem = 0; // Useful for eval.
+ while(SCI2C_nelem < 2 | isempty(check_string) == %F)
+ SCI2C_nelem = SCI2C_nelem + 1
+ line_position = line_position + 1;
+ if (isempty(check_string) == %F)
+ tmpannstring = eval(SharedInfo.Annotations.FUNSIZE);
+ check_string = stripblanks(mgetl(inclsfid,1));
+ if (SCI2Cstrncmps1size(tmpannstring,check_string))
// #RNU_RES_B
PrintStringInfo(' Line '+string(line_position)+' - Function Size Annotation: '+' ""'+check_string+' ""',...
- ReportFileName,'file','y');
+ ReportFileName,'file','y');
// #RNU_RES_E
- FunSizeAnnot(cntout,1) = ...
- stripblanks(part(check_string,length(tmpannstring)+1:length(check_string)));
- end
- else
- PrintStringInfo(' ',ReportFileName,'both','y');
- PrintStringInfo('SCI2CERROR: Line '+string(line_position)+' Function size annotation not found in file: '+SCI2CClassFileName,ReportFileName,'both','y');
- PrintStringInfo(' ',ReportFileName,'both','y');
- SCI2Cerror(' ');
- end
- SCI2C_nelem = 2; // Useful for eval.
- line_position = line_position + 1;
- if (isempty(check_string) == %F)
- tmpannstring = eval(SharedInfo.Annotations.FUNSIZE);
- check_string = stripblanks(mgetl(inclsfid,1));
- if (SCI2Cstrncmps1size(tmpannstring,check_string))
- PrintStringInfo(' Line '+string(line_position)+' - Function Size Annotation: '+' ""'+check_string+' ""',...
- ReportFileName,'file','y');
- FunSizeAnnot(cntout,2) = ...
- stripblanks(part(check_string,length(tmpannstring)+1:length(check_string)));
- end
- else
- PrintStringInfo(' ',ReportFileName,'both','y');
- PrintStringInfo('SCI2CERROR: Line '+string(line_position)+' Function type annotation (//_SCI2C_FUNSIZE:) not found in file: '+SCI2CClassFileName,ReportFileName,'both','y');
- PrintStringInfo(' ',ReportFileName,'both','y');
- SCI2Cerror(' ');
- end
+ FunSizeAnnot(cntout,SCI2C_nelem) = ...
+ stripblanks(part(check_string,length(tmpannstring)+1:length(check_string)));
+ end
+ else
+ PrintStringInfo(' ',ReportFileName,'both','y');
+ PrintStringInfo('SCI2CERROR: Line '+string(line_position)+' Function size annotation not found in file: '+SCI2CClassFileName,ReportFileName,'both','y');
+ PrintStringInfo(' ',ReportFileName,'both','y');
+ SCI2Cerror(' ');
+ end
+ end
end
end
// --- End loop over the lines of the input file. ---
diff --git a/macros/FunctionAnnotation/FA_GetOutArgInfo.sci b/macros/FunctionAnnotation/FA_GetOutArgInfo.sci
index 0cdba234..8b379a54 100644
--- a/macros/FunctionAnnotation/FA_GetOutArgInfo.sci
+++ b/macros/FunctionAnnotation/FA_GetOutArgInfo.sci
@@ -24,15 +24,15 @@ function UpdatedOutArg = ...
// --- Check input arguments. ---
// ------------------------------
SCI2CNInArgCheck(argn(2),9,9);
-
// -----------------------
// --- Initialization. ---
// -----------------------
UpdatedOutArg = OutArg;
for cntin = 1:NInArg
IN(cntin).TP = InArg(cntin).Type;
- IN(cntin).SZ(1) = InArg(cntin).Size(1);
- IN(cntin).SZ(2) = InArg(cntin).Size(2);
+ for _InArgSize=1:size(InArg(cntin).Size, '*')
+ IN(cntin).SZ(_InArgSize) = InArg(cntin).Size(_InArgSize);
+ end
if ((isnan(InArg(cntin).Value)) & (GetSymbolDimension(InArg(cntin).Size) == 0))
// #RNU_RES_B
// IN(cntin).VAL = '__SCI2CNANSIZE'; //RNU: toglimi
@@ -97,46 +97,27 @@ for counterout = 1:NOutArg
// This is a dynamic memory extension of a local variable and for the moment
// we issue an error according to SCI2C specifications
// #RNU_RES_E
- tmpeval = eval(FunSizeAnnot(counterout,1));
- if (IsNanSize(tmpeval))
- if SharedInfo.ForExpr.OnExec == 0
+ for iterOutputPosition=1:size(FunSizeAnnot, '*')
+ tmpeval = eval(FunSizeAnnot(counterout,iterOutputPosition));
+ if (IsNanSize(tmpeval))
+ if SharedInfo.ForExpr.OnExec == 0
EM_NanSize(ReportFileName);
- else
- UpdatedOutArg(counterout).Size(1) = string(tmpeval);
- end
- elseif(isnum(tmpeval))
- if (eval(tmpeval) <= 0)
+ else
+ UpdatedOutArg(counterout).Size(iterOutputPosition) = string(tmpeval);
+ end
+ elseif(isnum(tmpeval))
+ if (eval(tmpeval) <= 0)
EM_ZeroSize(ReportFileName);
- else
- UpdatedOutArg(counterout).Size(1) = string(tmpeval);
- end
- else
- UpdatedOutArg(counterout).Size(1) = string(tmpeval);
- end
-
- tmpeval = eval(FunSizeAnnot(counterout,2));
- if (IsNanSize(tmpeval))
- if SharedInfo.ForExpr.OnExec == 0
- EM_NanSize(ReportFileName);
- else
- // #RNU_RES_B
- // If we are in for expression I prefer to issue the error later.
- // #RNU_RES_E
- UpdatedOutArg(counterout).Size(2) = string(tmpeval);
- end
- elseif(isnum(tmpeval))
- if (eval(tmpeval) <= 0)
- EM_ZeroSize(ReportFileName);
- else
- UpdatedOutArg(counterout).Size(2) = string(tmpeval);
- end
- else
- UpdatedOutArg(counterout).Size(2) = string(tmpeval);
+ else
+ UpdatedOutArg(counterout).Size(iterOutputPosition) = string(tmpeval);
+ end
+ else
+ UpdatedOutArg(counterout).Size(iterOutputPosition) = string(tmpeval);
+ end
end
UpdatedOutArg(counterout).Value = %nan;
UpdatedOutArg(counterout).Dimension = GetSymbolDimension(UpdatedOutArg(counterout).Size);
UpdatedOutArg(counterout).Scope = 'Temp';//NUT anche su questo si puo' ragionare verifica anche la handleoperation.
end
-
endfunction