summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjofret2010-08-13 09:01:22 +0000
committerjofret2010-08-13 09:01:22 +0000
commitc0c57568b0756235fc17184fb8e7f421ff1a2201 (patch)
tree12a681460ecd354f4bd643e2a84cff41a963ad04
parentb2e624d80751811779a36d2ff2bd9ec047b42a93 (diff)
downloadscilab2c-c0c57568b0756235fc17184fb8e7f421ff1a2201.tar.gz
scilab2c-c0c57568b0756235fc17184fb8e7f421ff1a2201.tar.bz2
scilab2c-c0c57568b0756235fc17184fb8e7f421ff1a2201.zip
Allow variable to have more than 2 dimensions
-rw-r--r--scilab2c/macros/FunctionAnnotation/FA_GetFunAnn.sci216
1 files changed, 114 insertions, 102 deletions
diff --git a/scilab2c/macros/FunctionAnnotation/FA_GetFunAnn.sci b/scilab2c/macros/FunctionAnnotation/FA_GetFunAnn.sci
index 7c0ed937..e5fb8ac8 100644
--- a/scilab2c/macros/FunctionAnnotation/FA_GetFunAnn.sci
+++ b/scilab2c/macros/FunctionAnnotation/FA_GetFunAnn.sci
@@ -1,5 +1,5 @@
function [FunTypeAnnot,FunSizeAnnot] = ...
- FA_GetFunAnn(NInArg,NOutArg,FunName,FileInfo,SharedInfo)
+ FA_GetFunAnn(NInArg,NOutArg,FunName,FileInfo,SharedInfo)
// function [FunTypeAnnot,FunSizeAnnot] = ...
// FA_GetFunAnn(NInArg,NOutArg,FunName,FileInfo,SharedInfo)
// -----------------------------------------------------------------
@@ -62,126 +62,138 @@ FoundNIn = 0;
FoundNOut = 0;
line_position = 0;
while ((meof(inclsfid) == 0) & (FoundNIn == 0) & (FoundNOut == 0))
- check_string = stripblanks(mgetl(inclsfid,1));
- line_position = line_position + 1;
- if (~isempty(check_string))
+ check_string = stripblanks(mgetl(inclsfid,1));
+ line_position = line_position + 1;
+ if (~isempty(check_string))
- // #RNU_RES_B
- // --- Search for the NIN annotation. ---
- // #RNU_RES_E
- if (SCI2Cstrncmps1size(SharedInfo.Annotations.FUNNIN,check_string))
- FUNNINAnnot = part(check_string,length(SharedInfo.Annotations.FUNNIN)+1:length(check_string));
- // #RNU_RES_B
- // --- Check NIN value. ---
- // #RNU_RES_E
- if (eval(FUNNINAnnot) == NInArg)
- // #RNU_RES_B
- PrintStringInfo(' Line '+string(line_position)+' - Function NInArg Annotation: '+' ""'+check_string+' ""',...
- ReportFileName,'file','y');
- // #RNU_RES_E
- FoundNIn = 1;
- check_string = stripblanks(mgetl(inclsfid,1));
- line_position = line_position + 1;
- if (~isempty(check_string))
+// #RNU_RES_B
+// --- Search for the NIN annotation. ---
+// #RNU_RES_E
+ if (SCI2Cstrncmps1size(SharedInfo.Annotations.FUNNIN,check_string))
+ FUNNINAnnot = part(check_string,length(SharedInfo.Annotations.FUNNIN)+1:length(check_string));
+// #RNU_RES_B
+// --- Check NIN value. ---
+// #RNU_RES_E
+ if (eval(FUNNINAnnot) == NInArg)
+// #RNU_RES_B
+ PrintStringInfo(' Line '+string(line_position)+' - Function NInArg Annotation: '+' ""'+check_string+' ""',...
+ ReportFileName,'file','y');
+// #RNU_RES_E
+ FoundNIn = 1;
+ check_string = stripblanks(mgetl(inclsfid,1));
+ line_position = line_position + 1;
+ if (~isempty(check_string))
- // #RNU_RES_B
- // --- Search for the NOUT annotation. ---
- // #RNU_RES_E
- if (SCI2Cstrncmps1size(SharedInfo.Annotations.FUNNOUT,check_string))
- FUNNOUTAnnot = part(check_string,length(SharedInfo.Annotations.FUNNOUT)+1:length(check_string));
+// #RNU_RES_B
+// --- Search for the NOUT annotation. ---
+// #RNU_RES_E
+ if (SCI2Cstrncmps1size(SharedInfo.Annotations.FUNNOUT,check_string))
+ FUNNOUTAnnot = part(check_string,length(SharedInfo.Annotations.FUNNOUT)+1:length(check_string));
- // #RNU_RES_B
- // --- Check NOUT value. ---
- // #RNU_RES_E
- if (eval(FUNNOUTAnnot) == NOutArg)
- // #RNU_RES_B
- PrintStringInfo(' Line '+string(line_position)+' - Function NOutArg Annotation: '+' ""'+check_string+' ""',...
- ReportFileName,'file','y');
- // #RNU_RES_E
- FoundNOut = 1;
- else
- FoundNIn = 0;
- end
- else
- PrintStringInfo(' ',ReportFileName,'both','y');
- PrintStringInfo('SCI2CERROR: Incorrect format for function annotation.',ReportFileName,'both','y');
- PrintStringInfo('SCI2CERROR: Expected '+SharedInfo.Annotations.FUNNIN+' field in the annotations of the function.',ReportFileName,'both','y');
- PrintStringInfo(' ',ReportFileName,'both','y');
- error(9999, 'SCI2CERROR: Incorrect format for function annotation.');
- end
+// #RNU_RES_B
+// --- Check NOUT value. ---
+// #RNU_RES_E
+ if (eval(FUNNOUTAnnot) == NOutArg)
+// #RNU_RES_B
+ PrintStringInfo(' Line '+string(line_position)+' - Function NOutArg Annotation: '+' ""'+check_string+' ""',...
+ ReportFileName,'file','y');
+// #RNU_RES_E
+ FoundNOut = 1;
else
- PrintStringInfo(' ',ReportFileName,'both','y');
- PrintStringInfo('SCI2CERROR: Incorrect format for function annotation.',ReportFileName,'both','y');
- PrintStringInfo('SCI2CERROR: Expected '+SharedInfo.Annotations.FUNNIN+' field in the annotations of the function.',ReportFileName,'both','y');
- PrintStringInfo(' ',ReportFileName,'both','y');
- error(9999, 'SCI2CERROR: Incorrect format for function annotation.');
+ FoundNIn = 0;
end
- end
+ else
+ PrintStringInfo(' ',ReportFileName,'both','y');
+ PrintStringInfo('SCI2CERROR: Incorrect format for function annotation.',ReportFileName,'both','y');
+ PrintStringInfo('SCI2CERROR: Expected '+SharedInfo.Annotations.FUNNIN+' field in the annotations of the function.',ReportFileName,'both','y');
+ PrintStringInfo(' ',ReportFileName,'both','y');
+ error(9999, 'SCI2CERROR: Incorrect format for function annotation.');
+ end
+ else
+ PrintStringInfo(' ',ReportFileName,'both','y');
+ PrintStringInfo('SCI2CERROR: Incorrect format for function annotation.',ReportFileName,'both','y');
+ PrintStringInfo('SCI2CERROR: Expected '+SharedInfo.Annotations.FUNNIN+' field in the annotations of the function.',ReportFileName,'both','y');
+ PrintStringInfo(' ',ReportFileName,'both','y');
+ error(9999, 'SCI2CERROR: Incorrect format for function annotation.');
+ end
end
- end
+ end
+ end
end
if (FoundNOut*FoundNIn == 0)
- PrintStringInfo(' ',ReportFileName,'both','y');
- PrintStringInfo('SCI2CERROR: Please check file: '+SCI2CClassFileName,ReportFileName,'both','y');
- PrintStringInfo('SCI2CERROR: Incorrect function annotation.',ReportFileName,'both','y');
- PrintStringInfo('SCI2CERROR: There are two possibilities:',ReportFileName,'both','y');
- PrintStringInfo('SCI2CERROR: 1. Syntax error in function annotations.',ReportFileName,'both','y');
- PrintStringInfo('SCI2CERROR: 2. Missing the right combination of NIN/NOUT annotations: ""'+SharedInfo.Annotations.FUNNIN+string(NInArg)+','+SharedInfo.Annotations.FUNNOUT+' '+string(NOutArg)+'"".',ReportFileName,'both','y');
- PrintStringInfo(' ',ReportFileName,'both','y');
- error(9999, 'SCI2CERROR: Incorrect function annotation.');
+ PrintStringInfo(' ',ReportFileName,'both','y');
+ PrintStringInfo('SCI2CERROR: Please check file: '+SCI2CClassFileName,ReportFileName,'both','y');
+ PrintStringInfo('SCI2CERROR: Incorrect function annotation.',ReportFileName,'both','y');
+ PrintStringInfo('SCI2CERROR: There are two possibilities:',ReportFileName,'both','y');
+ PrintStringInfo('SCI2CERROR: 1. Syntax error in function annotations.',ReportFileName,'both','y');
+ PrintStringInfo('SCI2CERROR: 2. Missing the right combination of NIN/NOUT annotations: ""'+SharedInfo.Annotations.FUNNIN+string(NInArg)+','+SharedInfo.Annotations.FUNNOUT+' '+string(NOutArg)+'"".',ReportFileName,'both','y');
+ PrintStringInfo(' ',ReportFileName,'both','y');
+ error(9999, 'SCI2CERROR: Incorrect function annotation.');
else
- for cntout = 1:NOutArg
- SCI2C_nout=cntout; // Useful for eval.
- // #RNU_RES_B
- // Read the Fun type annotation.
- // #RNU_RES_E
+ // In case we are reading to much informations
+ readNewLine = %t;
+
+ for cntout = 1:NOutArg
+ SCI2C_nout=cntout; // Useful for eval.
+
+// #RNU_RES_B
+// Read the Fun type annotation.
+// #RNU_RES_E
+ if (readNewLine == %t)
check_string = stripblanks(mgetl(inclsfid,1));
line_position = line_position + 1;
- if (isempty(check_string) == %F)
- tmpannstring = eval(SharedInfo.Annotations.FUNTYPE);
- if (SCI2Cstrncmps1size(tmpannstring,check_string))
- // #RNU_RES_B
- PrintStringInfo(' Line '+string(line_position)+' - Function Type Annotation: '+' ""'+check_string+' ""',...
- ReportFileName,'file','y');
- // #RNU_RES_E
- FunTypeAnnot(cntout) = ...
- 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 not found in file: '+SCI2CClassFileName,ReportFileName,'both','y');
- PrintStringInfo(' ',ReportFileName,'both','y');
- error(9999, 'SCI2CERROR: Line '+string(line_position)+' Function type annotation not found in file: '+SCI2CClassFileName);
+ else
+ // reset state
+ readNewLine = %t;
+ end
+ if (isempty(check_string) == %F)
+ tmpannstring = eval(SharedInfo.Annotations.FUNTYPE);
+ if (SCI2Cstrncmps1size(tmpannstring,check_string))
+// #RNU_RES_B
+ PrintStringInfo(' Line '+string(line_position)+' - Function Type Annotation: '+' ""'+check_string+' ""',...
+ ReportFileName,'file','y');
+// #RNU_RES_E
+ FunTypeAnnot(cntout) = ...
+ 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 not found in file: '+SCI2CClassFileName,ReportFileName,'both','y');
+ PrintStringInfo(' ',ReportFileName,'both','y');
+ error(9999, 'SCI2CERROR: Line '+string(line_position)+' Function type annotation not found in file: '+SCI2CClassFileName);
+ end
- // #RNU_RES_B
- // --- Read the Fun size annotation. ---
- // #RNU_RES_E
- SCI2C_nelem = 0; // Useful for eval.
- while(SCI2C_nelem < 2 & isempty(check_string) == %F)
- SCI2C_nelem = SCI2C_nelem + 1
- line_position = line_position + 1;
+// #RNU_RES_B
+// --- Read the Fun size annotation. ---
+// #RNU_RES_E
+ SCI2C_nelem = 0; // Useful for eval.
+// while(SCI2C_nelem < 2 & isempty(check_string) == %F)
+ while(SCI2C_nelem < 3 & isempty(check_string) == %F)
+ line_position = line_position + 1;
+// #RNU_RES_B
+ PrintStringInfo(' Line '+string(line_position)+' - Function Size Annotation: '+' ""'+check_string+' ""',...
+ ReportFileName,'file','y');
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');
- // #RNU_RES_E
- FunSizeAnnot(cntout,SCI2C_nelem) = ...
- stripblanks(part(check_string,length(tmpannstring)+1:length(check_string)));
- end
+ SCI2C_nelem = SCI2C_nelem + 1
+ tmpannstring = eval(SharedInfo.Annotations.FUNSIZE);
+ check_string = stripblanks(mgetl(inclsfid,1));
+ if (SCI2Cstrncmps1size(tmpannstring,check_string))
+// #RNU_RES_E
+ FunSizeAnnot(cntout,SCI2C_nelem) = ...
+ stripblanks(part(check_string,length(tmpannstring)+1:length(check_string)));
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');
- error(9999, 'SCI2CERROR: Line '+string(line_position)+' Function size annotation not found in file: '+SCI2CClassFileName);
+ readNewLine = %f;
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');
+ error(9999, 'SCI2CERROR: Line '+string(line_position)+' Function size annotation not found in file: '+SCI2CClassFileName);
end
- end
+ end
+ end
end
// --- End loop over the lines of the input file. ---
mclose(inclsfid);