diff options
author | jofret | 2008-06-06 15:47:53 +0000 |
---|---|---|
committer | jofret | 2008-06-06 15:47:53 +0000 |
commit | 3a477408251a39565b2ed8df875fa1ae385c1ba1 (patch) | |
tree | 99233355471cd51fc5c38cec10cc7b825bc21212 /src | |
parent | 01bef206502b1526f0935b9326207d49ad9de3fb (diff) | |
download | scilab2c-3a477408251a39565b2ed8df875fa1ae385c1ba1.tar.gz scilab2c-3a477408251a39565b2ed8df875fa1ae385c1ba1.tar.bz2 scilab2c-3a477408251a39565b2ed8df875fa1ae385c1ba1.zip |
- Clean Add for Raffaele
- Correct missing endfunction
Diffstat (limited to 'src')
45 files changed, 1261 insertions, 0 deletions
diff --git a/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_ADD.sci b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_ADD.sci new file mode 100644 index 00000000..4eb9700d --- /dev/null +++ b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_ADD.sci @@ -0,0 +1,29 @@ +function opout = FA_ADD(in1,in2) +// function opout = FA_ADD(in1,in2) +// ----------------------------------------------------------------- +// +// Status: +// 26-Oct-2007 -- Raffaele Nutricato: Author. +// 26-Oct-2007 -- Alberto Morea: Test Ok. +// +// Copyright 2007 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +SCI2CNInArgCheck(argn(2),2,2); + + +if (SCI2Cisnum(in1) & SCI2Cisnum(in2)) + in1num = eval(in1); + in2num = eval(in2); + outnum = in1num+in2num; + if isnan(outnum) + opout = '__SCI2CNANSIZE'; + else + opout = string(outnum); + end +else + opout = string(in1+'+'+in2); +end + +endfunction diff --git a/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_DIV.sci b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_DIV.sci new file mode 100644 index 00000000..788ac45f --- /dev/null +++ b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_DIV.sci @@ -0,0 +1,27 @@ +function opout = FA_DIV(in1,in2) +// function opout = FA_DIV(in1,in2) +// ----------------------------------------------------------------- +// +// Status: +// 26-Oct-2007 -- Raffaele Nutricato: Author. +// 26-Oct-2007 -- Alberto Morea: Test Ok. +// +// Copyright 2008 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +SCI2CNInArgCheck(argn(2),2,2); + +if (SCI2Cisnum(in1) & SCI2Cisnum(in2)) + in1num = eval(in1); + in2num = eval(in2); + outnum = in1num/in2num; + if isnan(outnum) + opout = '__SCI2CNANSIZE'; + else + opout = string(outnum); + end +else + opout = string(in1)+'/'+string(in2); +end +endfunction diff --git a/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_GetDefaultPrecision.sci b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_GetDefaultPrecision.sci new file mode 100644 index 00000000..5d74effd --- /dev/null +++ b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_GetDefaultPrecision.sci @@ -0,0 +1,43 @@ +function defaultprecision = FA_GetDefaultPrecision(scifilename,ReportFileName) +// function defaultprecision = FA_GetDefaultPrecision(scifilename,ReportFileName) +// ----------------------------------------------------------------- +// +// Status: +// 12-Feb-2008 -- Raffaele Nutricato: Author. +// 12-Feb-2008 -- Alberto Morea: Test Ok. +// +// Copyright 2008 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +SCI2CNInArgCheck(argn(2),2,2); + +defaultprecision = 'd'; +annotationstring = '//SCI2C: DEFAULT_PRECISION=' + +scifid = SCI2COpenFileRead(scifilename); + +foundannotation = 0; +line_position = 0; +while ((meof(scifid) == 0) & (foundannotation == 0)) + check_string = stripblanks(mgetl(scifid,1)); + line_position = line_position + 1; + if (~isempty(check_string)) + + if (SCI2Cstrncmps1size(annotationstring,check_string)) + tmpprecision = stripblanks(part(check_string,length(annotationstring)+1:length(check_string))); + foundannotation = 1; + end + end +end + +if (foundannotation == 0) +else + if (tmpprecision == 'FLOAT') + defaultprecision = 's'; + elseif (tmpprecision == 'DOUBLE') + defaultprecision = 'd'; + end +end + +endfunction diff --git a/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_GetFunAnn.sci b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_GetFunAnn.sci new file mode 100644 index 00000000..1954e773 --- /dev/null +++ b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_GetFunAnn.sci @@ -0,0 +1,129 @@ +function [FunTypeAnnot,FunSizeAnnot] = ... + FA_GetFunAnn(NInArg,NOutArg,FunName,FileInfo,SharedInfo) +// function [FunTypeAnnot,FunSizeAnnot] = ... +// FA_GetFunAnn(NInArg,NOutArg,FunName,FileInfo,SharedInfo) +// ----------------------------------------------------------------- +// +// Status: +// 11-Jul-2007 -- Nutricato Raffaele: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +SCI2CNInArgCheck(argn(2),5,5); + +nxtscifunname = SharedInfo.NextSCIFunName; +nxtscifunnumber = SharedInfo.NextSCIFunNumber; +ReportFileName = FileInfo.Funct(nxtscifunnumber).ReportFileName; +SCI2CClassFileName = GetClsFileName(FunName,FileInfo,SharedInfo); +FunTypeAnnot = ''; +FunSizeAnnot = ''; +inclsfid = SCI2COpenFileRead(SCI2CClassFileName); + +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)) + + if (SCI2Cstrncmps1size(SharedInfo.Annotations.FUNNIN,check_string)) + FUNNINAnnot = part(check_string,length(SharedInfo.Annotations.FUNNIN)+1:length(check_string)); + if (eval(FUNNINAnnot) == NInArg) + FoundNIn = 1; + check_string = stripblanks(mgetl(inclsfid,1)); + line_position = line_position + 1; + if (~isempty(check_string)) + + if (SCI2Cstrncmps1size(SharedInfo.Annotations.FUNNOUT,check_string)) + FUNNOUTAnnot = part(check_string,length(SharedInfo.Annotations.FUNNOUT)+1:length(check_string)); + + if (eval(FUNNOUTAnnot) == NOutArg) + 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'); + SCI2Cerror(' '); + 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'); + SCI2Cerror(' '); + 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'); + SCI2Cerror(' '); +else + for cntout = 1:NOutArg + SCI2C_nout=cntout; // Useful for eval. + + 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)) + 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'); + SCI2Cerror(' '); + end + + 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)) + 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; + 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)) + 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 + end +end +mclose(inclsfid); + +endfunction diff --git a/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_GetOutArgInfo.sci b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_GetOutArgInfo.sci new file mode 100644 index 00000000..6a4628de --- /dev/null +++ b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_GetOutArgInfo.sci @@ -0,0 +1,104 @@ +function UpdatedOutArg = ... + FA_GetOutArgInfo(InArg,NInArg,OutArg,NOutArg,SharedInfo,FunPrecSpecifier,FunTypeAnnot,FunSizeAnnot,ReportFileName) +// function UpdatedOutArg = ... +// FA_GetOutArgInfo(InArg,NInArg,OutArg,NOutArg,SharedInfo,FunPrecSpecifier,FunTypeAnnot,FunSizeAnnot,ReportFileName) +// ----------------------------------------------------------------- +// +// Status: +// 25-Oct-2007 -- Raffaele Nutricato: Author. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +SCI2CNInArgCheck(argn(2),9,9); + +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); + if ((isnan(InArg(cntin).Value)) & (GetSymbolDimension(InArg(cntin).Size) == 0)) + IN(cntin).VAL = InArg(cntin).Name; + else + IN(cntin).VAL = string(InArg(cntin).Value); + end +end +DefaultPrecision = SharedInfo.DefaultPrecision; + +if (mtlb_strcmp(FunTypeAnnot(1),'')) + NOutArg = 0; +else + NOutArg = max(size(FunTypeAnnot)); +end + +flagfindlike = 0; +for counterin = 1:NInArg + if (InArg(counterin).FindLike == 1 | InArg(counterin).FindLike == -1) + flagfindlike = -1; + end +end + +for counterout = 1:NOutArg + if(mtlb_strcmp(FunTypeAnnot,'FA_TP_USER')) + UpdatedOutArg(counterout).Type = FA_TP_USER(FunPrecSpecifier,DefaultPrecision); + else + UpdatedOutArg(counterout).Type = eval(FunTypeAnnot(counterout)); + end + UpdatedOutArg(counterout).FindLike = 0; + lengthFA_SZ_RTMAX = length('FA_SZ_RTMAX'); + + if (SCI2Cstrncmps1size('FA_SZ_RTMAX',FunSizeAnnot(counterout,1))) + UpdatedOutArg(counterout).FindLike = 1; + FunSizeAnnot(counterout,1) = part(FunSizeAnnot(counterout,1),lengthFA_SZ_RTMAX+1:length(FunSizeAnnot(counterout,1))); + end + + if (SCI2Cstrncmps1size('FA_SZ_RTMAX',FunSizeAnnot(counterout,2))) + UpdatedOutArg(counterout).FindLike = 1; + FunSizeAnnot(counterout,2) = part(FunSizeAnnot(counterout,2),lengthFA_SZ_RTMAX+1:length(FunSizeAnnot(counterout,2))); + end + + if (flagfindlike == -1) + UpdatedOutArg(counterout).FindLike = -1; + end + + tmpeval = eval(FunSizeAnnot(counterout,1)); + if (IsNanSize(tmpeval)) + if SharedInfo.ForExpr.OnExec == 0 + EM_NanSize(ReportFileName); + else + UpdatedOutArg(counterout).Size(1) = string(tmpeval); + end + elseif(SCI2Cisnum(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 + UpdatedOutArg(counterout).Size(2) = string(tmpeval); + end + elseif(SCI2Cisnum(tmpeval)) + if (eval(tmpeval) <= 0) + EM_ZeroSize(ReportFileName); + else + UpdatedOutArg(counterout).Size(2) = string(tmpeval); + end + else + UpdatedOutArg(counterout).Size(2) = string(tmpeval); + 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 diff --git a/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_INT.sci b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_INT.sci new file mode 100644 index 00000000..4bc2fde7 --- /dev/null +++ b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_INT.sci @@ -0,0 +1,25 @@ +function opout = FA_INT(in1) +// function opout = FA_INT(in1) +// ----------------------------------------------------------------- +// +// Status: +// 26-Oct-2007 -- Raffaele Nutricato: Author. +// 26-Oct-2007 -- Alberto Morea: Test Ok. +// +// Copyright 2008 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +SCI2CNInArgCheck(argn(2),1,1); + +if (SCI2Cisnum(in1)) + outnum = int(eval(in1)); + if isnan(outnum) + opout = '__SCI2CNANSIZE'; + else + opout = string(outnum); + end +else + opout = in1; +end +endfunction diff --git a/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_MAX.sci b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_MAX.sci new file mode 100644 index 00000000..769ef5d2 --- /dev/null +++ b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_MAX.sci @@ -0,0 +1,35 @@ +function opout = FA_MAX(in1,in2) +// function opout = FA_MAX(in1,in2) +// ----------------------------------------------------------------- +// +// Status: +// 26-Oct-2007 -- Raffaele Nutricato: Author. +// 26-Oct-2007 -- Alberto Morea: Test Ok. +// +// Copyright 2008 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +SCI2CNInArgCheck(argn(2),2,2); + +SCI2Cerror('Not allowed to use FA_MAX in this release.'); + +if (SCI2Cisnum(in1)) + in1num = eval(in1); + if (SCI2Cisnum(in2)) + in2num = eval(in2); + outnum = max(in1num,in2num); + if isnan(outnum) + opout = '__SCI2CNANSIZE'; + else + opout = string(outnum); + end + else + if (in1num == 1) + opout = string(in2); + end + end +else + opout = string(in1); +end +endfunction diff --git a/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_MUL.sci b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_MUL.sci new file mode 100644 index 00000000..750afc79 --- /dev/null +++ b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_MUL.sci @@ -0,0 +1,34 @@ +function opout = FA_MUL(in1,in2) +// function opout = FA_MUL(in1,in2) +// ----------------------------------------------------------------- +// +// Status: +// 26-Oct-2007 -- Raffaele Nutricato: Author. +// 26-Oct-2007 -- Alberto Morea: Test Ok. +// +// Copyright 2007 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + + +// ------------------------ +// --- Generate Output. --- +// ------------------------ +if (SCI2Cisnum(in1) & SCI2Cisnum(in2)) + in1num = eval(in1); + in2num = eval(in2); + outnum = in1num*in2num; + if isnan(outnum) + opout = '__SCI2CNANSIZE'; + else + opout = string(outnum); + end +else + opout = string(in1)+'*'+string(in2); +end +endfunction diff --git a/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SUB.sci b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SUB.sci new file mode 100644 index 00000000..fc8c828a --- /dev/null +++ b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SUB.sci @@ -0,0 +1,33 @@ +function opout = FA_SUB(in1,in2) +// function opout = FA_SUB(in1,in2) +// ----------------------------------------------------------------- +// +// Status: +// 26-Oct-2007 -- Raffaele Nutricato: Author. +// 26-Oct-2007 -- Alberto Morea: Test Ok. +// +// Copyright 2007 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + +// ------------------------ +// --- Generate Output. --- +// ------------------------ +if (SCI2Cisnum(in1) & SCI2Cisnum(in2)) + in1num = eval(in1); + in2num = eval(in2); + outnum = in1num-in2num; + if isnan(outnum) + opout = '__SCI2CNANSIZE'; + else + opout = string(outnum); + end +else + opout = string(in1)+'-'+string(in2); +end +endfunction diff --git a/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_1.sci b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_1.sci new file mode 100644 index 00000000..65a11ca0 --- /dev/null +++ b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_1.sci @@ -0,0 +1,11 @@ +function outsize = FA_SZ_1(insize) +// function outsize = FA_SZ_1(insize) +// ----------------------------------------------------------------- +// +// Status: +// 08-Dec-2007 -- Raffaele Nutricato: Author. +// 08-Dec-2007 -- Alberto Morea: Test Ok. +// ----------------------------------------------------------------- + +outsize = insize(1); +endfunction
\ No newline at end of file diff --git a/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_2.sci b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_2.sci new file mode 100644 index 00000000..f363996a --- /dev/null +++ b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_2.sci @@ -0,0 +1,11 @@ +function outsize = FA_SZ_2(insize) +// function outsize = FA_SZ_2(insize) +// ----------------------------------------------------------------- +// +// Status: +// 08-Dec-2007 -- Raffaele Nutricato: Author. +// 08-Dec-2007 -- Alberto Morea: Test Ok. +// ----------------------------------------------------------------- + +outsize = insize(2); +endfunction
\ No newline at end of file diff --git a/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPAPEX.sci b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPAPEX.sci new file mode 100644 index 00000000..7f676b19 --- /dev/null +++ b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPAPEX.sci @@ -0,0 +1,24 @@ +function opoutsize = FA_SZ_OPAPEX(in1size) +// function opoutsize = FA_SZ_OPAPEX(in1size) +// ----------------------------------------------------------------- +// +// Status: +// 08-Jan-2008 -- Raffaele Nutricato: Author. +// 08-Jan-2008 -- Alberto Morea: Test Ok. +// +// Copyright 2008 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),1,1); + +// ------------------------ +// --- Generate Output. --- +// ------------------------ +opoutsize(1) = string(in1size(2)); +opoutsize(2) = string(in1size(1)); + +endfunction diff --git a/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPBACKSLASH.sci b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPBACKSLASH.sci new file mode 100644 index 00000000..7338654a --- /dev/null +++ b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPBACKSLASH.sci @@ -0,0 +1,37 @@ +function opoutsize = FA_SZ_OPBACKSLASH(in1size,in2size) +// function opoutsize = FA_SZ_OPBACKSLASH(in1size,in2size) +// ----------------------------------------------------------------- +// +// Status: +// 08-Mar-2008 -- Alberto Morea: Author. +// 08-Mar-2008 -- Raffaele Nutricato: Test Ok. +// +// Copyright 2008 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + +// ------------------------ +// --- Generate Output. --- +// ------------------------ +in1size=string(in1size); +in2size=string(in2size); + +// --- Get dimensions of input arguments. --- +in1dim = GetSymbolDimension(in1size); +in2dim = GetSymbolDimension(in2size); + +if (in1dim == 0) + opoutsize = in2size; +elseif (in2dim == 0) + opoutsize = in1size; +else + opoutsize(1) = in1size(2); + opoutsize(2) = in2size(2); +end + +endfunction diff --git a/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPCC.sci b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPCC.sci new file mode 100644 index 00000000..13809368 --- /dev/null +++ b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPCC.sci @@ -0,0 +1,38 @@ +function opoutsize = FA_SZ_OPCC(in1size,in2size) +// function opoutsize = FA_SZ_OPCC(in1size,in2size) +// ----------------------------------------------------------------- +// +// Status: +// 08-Mar-2008 -- Raffaele Nutricato: Author. +// 08-Mar-2008 -- Alberto Morea: Test Ok. +// +// Copyright 2008 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + +in1size = string(in1size); +in2size = string(in2size); + +// ------------------------ +// --- Generate Output. --- +// ------------------------ +// --- Get dimensions of input arguments. --- +in1dim = GetSymbolDimension(in1size); +in2dim = GetSymbolDimension(in2size); + +if (SCI2Cisnum(in1size(1)) & SCI2Cisnum(in2size(1))) + in1num = eval(in1size(1)); + in2num = eval(in2size(1)); + opoutsize(1) = string(in1num+in2num); +else + opoutsize(1) = string(in1size(1))+'+'+string(in2size(1)); +end + +opoutsize(2) = in1size(2); + +endfunction diff --git a/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPDOTAPEX.sci b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPDOTAPEX.sci new file mode 100644 index 00000000..9e540bb9 --- /dev/null +++ b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPDOTAPEX.sci @@ -0,0 +1,13 @@ +function opoutsize = FA_SZ_OPDOTAPEX(in1size) +// function opoutsize = FA_SZ_OPDOTAPEX(in1size) +// ----------------------------------------------------------------- +// Status: +// 08-Mar-2008 -- Raffaele Nutricato: Author. +// 08-Mar-2008 -- Alberto Morea: Test Ok. +// +// Copyright 2008 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +opoutsize = FA_SZ_OPDOTAPEX(in1size,in2size); +endfunction diff --git a/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPDOTBACKSLASH.sci b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPDOTBACKSLASH.sci new file mode 100644 index 00000000..66dd1abf --- /dev/null +++ b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPDOTBACKSLASH.sci @@ -0,0 +1,14 @@ +function opoutsize = FA_SZ_OPDOTBACKSLASH(in1size,in2size) +// function opoutsize = FA_SZ_OPDOTBACKSLASH(in1size,in2size) +// ----------------------------------------------------------------- +// +// Status: +// 08-Mar-2008 -- Raffaele Nutricato: Author. +// 08-Mar-2008 -- Alberto Morea: Test Ok. +// +// Copyright 2008 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +opoutsize = FA_SZ_OPDOTSTAR(in1size,in2size); +endfunction diff --git a/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPDOTHAT.sci b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPDOTHAT.sci new file mode 100644 index 00000000..024284e2 --- /dev/null +++ b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPDOTHAT.sci @@ -0,0 +1,43 @@ +function opoutsize = FA_SZ_OPDOTHAT(in1size,in2size) +// function opoutsize = FA_SZ_OPDOTHAT(in1size,in2size) +// ----------------------------------------------------------------- +// Returns the size of the output computed by OPDOTHAT operator. +// +// Assuming: +// size(in1) = [in1r,in1c] +// size(in2) = [in2r,in2c] +// size(out) = [outr,outc] +// +// we have the following combinations: +// in1 in2 outr outc +// ----------------------- +// S S in2r in2c +// S M in2r in2c +// M S in1r in1c +// M M in1r in1c +// +// Where S means that the input is a scalar +// and M means that the input is a matrix. +// +// Input data: +// in1size: size of input number 1. It is an array of 2 strings. +// The first string specifies the number of rows. +// The second string specifies the number of columns. +// +// in2size: size of input number 2. It is an array of 2 strings. +// The first string specifies the number of rows. +// The second string specifies the number of columns. +// +// Output data: +// opoutsize: size of output. It is an array of 2 strings. +// The first string specifies the number of rows. +// The second string specifies the number of columns. +// +// Status: +// 10-Dec-2007 -- Raffaele Nutricato: Author. +// 10-Dec-2007 -- Alberto Morea: Test Ok. +// ----------------------------------------------------------------- + +opoutsize = FA_SZ_OPDOTSTAR(in1size,in2size); + +endfunction diff --git a/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPDOTSLASH.sci b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPDOTSLASH.sci new file mode 100644 index 00000000..c62196d8 --- /dev/null +++ b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPDOTSLASH.sci @@ -0,0 +1,15 @@ +function opoutsize = FA_SZ_OPDOTSLASH(in1size,in2size) +// function opoutsize = FA_SZ_OPDOTSLASH(in1size,in2size) +// ----------------------------------------------------------------- +// +// +// Status: +// 08-Mar-2008 -- Raffaele Nutricato: Author. +// 08-Mar-2008 -- Alberto Morea: Test Ok. +// +// Copyright 2008 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +opoutsize = FA_SZ_OPDOTSTAR(in1size,in2size); +endfunction diff --git a/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPDOTSTAR.sci b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPDOTSTAR.sci new file mode 100644 index 00000000..805b3de8 --- /dev/null +++ b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPDOTSTAR.sci @@ -0,0 +1,22 @@ +function opoutsize = FA_SZ_OPDOTSTAR(in1size,in2size) +// function opoutsize = FA_SZ_OPDOTSTAR(in1size,in2size) +// ----------------------------------------------------------------- +// Status: +// 08-Jan-2008 -- Raffaele Nutricato: Author. +// 08-Jan-2008 -- Alberto Morea: Test Ok. +// +// Copyright 2008 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +SCI2CNInArgCheck(argn(2),2,2); + +in1dim = GetSymbolDimension(in1size); + +if (in1dim == 0) + opoutsize = string(in2size); +else + opoutsize = string(in1size); +end + +endfunction diff --git a/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPHAT.sci b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPHAT.sci new file mode 100644 index 00000000..2e372508 --- /dev/null +++ b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPHAT.sci @@ -0,0 +1,12 @@ +function opoutsize = FA_SZ_OPHAT(in1size,in2size) +// function opoutsize = FA_SZ_OPHAT(in1size,in2size) +// ----------------------------------------------------------------- +// +// Status: +// 10-Dec-2007 -- Raffaele Nutricato: Author. +// 10-Dec-2007 -- Alberto Morea: Test Ok. +// ----------------------------------------------------------------- + +opoutsize = FA_SZ_OPDOTSTAR(in1size,in2size); + +endfunction diff --git a/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPLOGAND.sci b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPLOGAND.sci new file mode 100644 index 00000000..86ae5235 --- /dev/null +++ b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPLOGAND.sci @@ -0,0 +1,15 @@ +function opoutsize = FA_SZ_OPLOGAND(in1size,in2size) +// function opoutsize = FA_SZ_OPLOGAND(in1size,in2size) +// ----------------------------------------------------------------- +// +// +// Status: +// 08-Mar-2008 -- Raffaele Nutricato: Author. +// 08-Mar-2008 -- Alberto Morea: Test Ok. +// +// Copyright 2008 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +opoutsize = FA_SZ_OPDOTSTAR(in1size,in2size); +endfunction diff --git a/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPLOGEQ.sci b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPLOGEQ.sci new file mode 100644 index 00000000..19bcd47a --- /dev/null +++ b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPLOGEQ.sci @@ -0,0 +1,13 @@ +function opoutsize = FA_SZ_OPLOGEQ(in1size,in2size) +// function opoutsize = FA_SZ_OPLOGEQ(in1size,in2size) +// ----------------------------------------------------------------- +// Status: +// 08-Mar-2008 -- Raffaele Nutricato: Author. +// 08-Mar-2008 -- Alberto Morea: Test Ok. +// +// Copyright 2008 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +opoutsize = FA_SZ_OPDOTSTAR(in1size,in2size); +endfunction diff --git a/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPLOGGE.sci b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPLOGGE.sci new file mode 100644 index 00000000..0391c4b4 --- /dev/null +++ b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPLOGGE.sci @@ -0,0 +1,14 @@ +function opoutsize = FA_SZ_OPLOGGE(in1size,in2size) +// function opoutsize = FA_SZ_OPLOGGE(in1size,in2size) +// ----------------------------------------------------------------- +// +// Status: +// 08-Mar-2008 -- Raffaele Nutricato: Author. +// 08-Mar-2008 -- Alberto Morea: Test Ok. +// +// Copyright 2008 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +opoutsize = FA_SZ_OPDOTSTAR(in1size,in2size); +endfunction diff --git a/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPLOGGT.sci b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPLOGGT.sci new file mode 100644 index 00000000..334448b4 --- /dev/null +++ b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPLOGGT.sci @@ -0,0 +1,14 @@ +function opoutsize = FA_SZ_OPLOGGT(in1size,in2size) +// function opoutsize = FA_SZ_OPLOGGT(in1size,in2size) +// ----------------------------------------------------------------- +// +// Status: +// 08-Mar-2008 -- Raffaele Nutricato: Author. +// 08-Mar-2008 -- Alberto Morea: Test Ok. +// +// Copyright 2008 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +opoutsize = FA_SZ_OPDOTSTAR(in1size,in2size); +endfunction diff --git a/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPLOGLE.sci b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPLOGLE.sci new file mode 100644 index 00000000..2e2e8621 --- /dev/null +++ b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPLOGLE.sci @@ -0,0 +1,16 @@ +function opoutsize = FA_SZ_OPLOGLE(in1size,in2size) +// function opoutsize = FA_SZ_OPLOGLE(in1size,in2size) +// ----------------------------------------------------------------- +// Alias of FA_SZ_OPDOTSTAR. +// +// +// Status: +// 08-Mar-2008 -- Raffaele Nutricato: Author. +// 08-Mar-2008 -- Alberto Morea: Test Ok. +// +// Copyright 2008 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +opoutsize = FA_SZ_OPDOTSTAR(in1size,in2size); +endfunction diff --git a/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPLOGLT.sci b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPLOGLT.sci new file mode 100644 index 00000000..92fe9305 --- /dev/null +++ b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPLOGLT.sci @@ -0,0 +1,16 @@ +function opoutsize = FA_SZ_OPLOGLT(in1size,in2size) +// function opoutsize = FA_SZ_OPLOGLT(in1size,in2size) +// ----------------------------------------------------------------- +// Alias of FA_SZ_OPDOTSTAR. +// +// +// Status: +// 08-Mar-2008 -- Raffaele Nutricato: Author. +// 08-Mar-2008 -- Alberto Morea: Test Ok. +// +// Copyright 2008 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +opoutsize = FA_SZ_OPDOTSTAR(in1size,in2size); +endfunction diff --git a/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPLOGNE.sci b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPLOGNE.sci new file mode 100644 index 00000000..785c6b3c --- /dev/null +++ b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPLOGNE.sci @@ -0,0 +1,16 @@ +function opoutsize = FA_SZ_OPLOGNE(in1size,in2size) +// function opoutsize = FA_SZ_OPLOGNE(in1size,in2size) +// ----------------------------------------------------------------- +// Alias of FA_SZ_OPDOTSTAR. +// +// +// Status: +// 08-Mar-2008 -- Raffaele Nutricato: Author. +// 08-Mar-2008 -- Alberto Morea: Test Ok. +// +// Copyright 2008 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +opoutsize = FA_SZ_OPDOTSTAR(in1size,in2size); +endfunction diff --git a/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPLOGNOT.sci b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPLOGNOT.sci new file mode 100644 index 00000000..540be9dc --- /dev/null +++ b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPLOGNOT.sci @@ -0,0 +1,16 @@ +function opoutsize = FA_SZ_OPLOGNOT(in1size) +// function opoutsize = FA_SZ_OPLOGNOT(in1size) +// ----------------------------------------------------------------- +// Alias of FA_SZ_OPDOTAPEX. +// +// +// Status: +// 08-Mar-2008 -- Raffaele Nutricato: Author. +// 08-Mar-2008 -- Alberto Morea: Test Ok. +// +// Copyright 2008 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +opoutsize = FA_SZ_OPDOTAPEX(in1size,in2size); +endfunction diff --git a/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPLOGOR.sci b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPLOGOR.sci new file mode 100644 index 00000000..ccdf1e4a --- /dev/null +++ b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPLOGOR.sci @@ -0,0 +1,14 @@ +function opoutsize = FA_SZ_OPLOGOR(in1size,in2size) +// function opoutsize = FA_SZ_OPLOGOR(in1size,in2size) +// ----------------------------------------------------------------- +// +// Status: +// 08-Mar-2008 -- Raffaele Nutricato: Author. +// 08-Mar-2008 -- Alberto Morea: Test Ok. +// +// Copyright 2008 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +opoutsize = FA_SZ_OPDOTSTAR(in1size,in2size); +endfunction diff --git a/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPMINUS.sci b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPMINUS.sci new file mode 100644 index 00000000..ca5dbb75 --- /dev/null +++ b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPMINUS.sci @@ -0,0 +1,17 @@ +function opoutsize = FA_SZ_OPMINUS(in1size,in2size) +// function opoutsize = FA_SZ_OPMINUS(in1size,in2size) +// ----------------------------------------------------------------- +// +// Status: +// 08-Dec-2007 -- Raffaele Nutricato: Author. +// 08-Dec-2007 -- Alberto Morea: Test Ok. +// +// Copyright 2007 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +SCI2CNInArgCheck(argn(2),2,2); + +opoutsize = FA_SZ_OPPLUSA(in1size,in2size); + +endfunction diff --git a/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPPLUS.sci b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPPLUS.sci new file mode 100644 index 00000000..d93d3d96 --- /dev/null +++ b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPPLUS.sci @@ -0,0 +1,50 @@ +function opoutsize = FA_SZ_OPPLUS(in1size,in2size,in1type,in2type) +// function opoutsize = FA_SZ_OPPLUS(in1size,in2size,in1type,in2type) +// ----------------------------------------------------------------- +// Status: +// 08-Dec-2007 -- Raffaele Nutricato: Author. +// 08-Dec-2007 -- Alberto Morea: Test Ok. +// +// Copyright 2007 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),4,4); + +in1size = string(in1size); +in2size = string(in2size); +in1type = string(in1type); +in2type = string(in2type); +in1dim = GetSymbolDimension(in1size); + +if ((in1type ~= 'g') & (in2type ~= 'g')) + opoutsize = FA_SZ_OPPLUSA(in1size,in2size); +elseif ((in1type == 'g') & (in2type == 'g')) + opoutsize(1) = '1'; + if (SCI2Cisnum(in1size(1)) & SCI2Cisnum(in2size(1))) + in1num = eval(in1size(1)); + in2num = eval(in2size(1)); + if (in1num > 1 | in2num > 1) + SCI2Cerror('String catenation can be performed only on strings of 1 x N size not N x 1 size'); + end + end + if (SCI2Cisnum(in1size(2)) & SCI2Cisnum(in2size(2))) + in1num = eval(in1size(2)); + in2num = eval(in2size(2)); + opoutsize(2) = string(in1num+in2num-1); + if isnan(opoutsize(2)) + opoutsize(2) = '__SCI2CNANSIZE'; + else + opoutsize(2) = string(opoutsize(2)); + end + else + opoutsize(2) = string(in1size(2))+'+'+string(in2size(2))+'-1'; + end +else + SCI2Cerror('Unexpected type combination for ""+"" operator (type1,type2): ('+in1type+in2type+').'); +end + +endfunction diff --git a/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPPLUSA.sci b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPPLUSA.sci new file mode 100644 index 00000000..cdfdcf0a --- /dev/null +++ b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPPLUSA.sci @@ -0,0 +1,28 @@ +function opoutsize = FA_SZ_OPPLUSA(in1size,in2size) +// function opoutsize = FA_SZ_OPPLUSA(in1size,in2size) +// ----------------------------------------------------------------- +// +// Status: +// 18-Mar-2008 -- Raffaele Nutricato: Author. +// 18-Mar-2008 -- Alberto Morea: Test Ok. +// +// Copyright 2008 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + +in1size = string(in1size); +in2size = string(in2size); +in1dim = GetSymbolDimension(in1size); + +if (in1dim == 0) + opoutsize = in2size; +else + opoutsize = in1size; +end + +endfunction diff --git a/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPRC.sci b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPRC.sci new file mode 100644 index 00000000..e276f166 --- /dev/null +++ b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPRC.sci @@ -0,0 +1,32 @@ +function opoutsize = FA_SZ_OPRC(in1size,in2size) +// function opoutsize = FA_SZ_OPRC(in1size,in2size) +// ----------------------------------------------------------------- +// +// +// Status: +// 08-Mar-2008 -- Raffaele Nutricato: Author. +// 08-Mar-2008 -- Alberto Morea: Test Ok. +// +// Copyright 2008 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +SCI2CNInArgCheck(argn(2),2,2); + +in1size = string(in1size); +in2size = string(in2size); + +in1dim = GetSymbolDimension(in1size); +in2dim = GetSymbolDimension(in2size); + +opoutsize(1) = in1size(1); + +if (SCI2Cisnum(in1size(2)) & SCI2Cisnum(in2size(2))) + in1num = eval(in1size(2)); + in2num = eval(in2size(2)); + opoutsize(2) = string(in1num+in2num); +else + opoutsize(2) = string(in1size(2))+'+'+string(in2size(2)); +end + +endfunction diff --git a/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPSTAR.sci b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPSTAR.sci new file mode 100644 index 00000000..7324ee69 --- /dev/null +++ b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_OPSTAR.sci @@ -0,0 +1,30 @@ +function opoutsize = FA_SZ_OPSTAR(in1size,in2size) +// function opoutsize = FA_SZ_OPSTAR(in1size,in2size) +// ----------------------------------------------------------------- +// +// Status: +// 08-Dec-2007 -- Raffaele Nutricato: Author. +// 08-Dec-2007 -- Alberto Morea: Test Ok. +// +// Copyright 2007 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +SCI2CNInArgCheck(argn(2),2,2); + +in1size = string(in1size); +in2size = string(in2size); + +in1dim = GetSymbolDimension(in1size); +in2dim = GetSymbolDimension(in2size); + +if (in1dim == 0) + opoutsize = in2size; +elseif (in2dim == 0) + opoutsize = in1size; +else + opoutsize(1) = in1size(1); + opoutsize(2) = in2size(2); +end + +endfunction diff --git a/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_SEL1.sci b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_SEL1.sci new file mode 100644 index 00000000..f2de8943 --- /dev/null +++ b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_SEL1.sci @@ -0,0 +1,29 @@ +function opout = FA_SZ_SEL1(in1,in2) +// function opout = FA_SZ_SEL1(in1,in2) +// ----------------------------------------------------------------- +// +// Status: +// 16-Mar-2008 -- Raffaele Nutricato: Author. +// 16-Mar-2008 -- Alberto Morea: Test Ok. +// +// Copyright 2008 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +SCI2CNInArgCheck(argn(2),2,2); +ReportFileName = ''; +in2 = string(in2); + +if (in2 == '1') + opout = '1'; +elseif (in2 == '2') + opout = in1; +else + PrintStringInfo(' ',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: Cannot associate the second input argument to a known specifier.',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: Please rearrange your code by using one of the following specifiers:',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: 1 or 2.',ReportFileName,'both','y'); + PrintStringInfo(' ',ReportFileName,'both','y'); + SCI2Cerror(' '); +end +endfunction diff --git a/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_SEL2.sci b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_SEL2.sci new file mode 100644 index 00000000..c33bbdb8 --- /dev/null +++ b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_SZ_SEL2.sci @@ -0,0 +1,29 @@ +function opout = FA_SZ_SEL2(in1,in2) +// function opout = FA_SZ_SEL2(in1,in2) +// ----------------------------------------------------------------- +// +// Status: +// 16-Mar-2008 -- Raffaele Nutricato: Author. +// 16-Mar-2008 -- Alberto Morea: Test Ok. +// +// Copyright 2008 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +SCI2CNInArgCheck(argn(2),2,2); +ReportFileName = ''; +in2 = string(in2); + +if (in2 == '1') + opout = in1; +elseif (in2 == '2') + opout = '1'; +else + PrintStringInfo(' ',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: Cannot associate the second input argument to a known specifier.',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: Please rearrange your code by using one of the following specifiers:',ReportFileName,'both','y'); + PrintStringInfo('SCI2CERROR: 1 or 2.',ReportFileName,'both','y'); + PrintStringInfo(' ',ReportFileName,'both','y'); + SCI2Cerror(' '); +end +endfunction diff --git a/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_TP_C.sci b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_TP_C.sci new file mode 100644 index 00000000..ffa797f1 --- /dev/null +++ b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_TP_C.sci @@ -0,0 +1,21 @@ +function typeout = FA_TP_C() +// function typeout = FA_TP_C() +// ----------------------------------------------------------------- +// +// Status: +// 26-Oct-2007 -- Raffaele Nutricato: Author. +// 26-Oct-2007 -- Alberto Morea: Test Ok. +// +// Copyright 2007 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),0,0); + + +typeout = 'c'; + +endfunction diff --git a/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_TP_COMPLEX.sci b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_TP_COMPLEX.sci new file mode 100644 index 00000000..be4100d3 --- /dev/null +++ b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_TP_COMPLEX.sci @@ -0,0 +1,26 @@ +function typeout = FA_TP_COMPLEX(in1) +// function typeout = FA_TP_COMPLEX(in1) +// ----------------------------------------------------------------- +// +// Status: +// 26-Jan-2008 -- Raffaele Nutricato: Author. +// 26-Jan-2008 -- Alberto Morea: Test Ok. +// +// Copyright 2008 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),1,1); + + +if (in1 == 's') + typeout = 'c'; +elseif (in1 == 'd') + typeout = 'z'; +else + typeout = in1; +end +endfunction diff --git a/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_TP_D.sci b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_TP_D.sci new file mode 100644 index 00000000..37c0bce0 --- /dev/null +++ b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_TP_D.sci @@ -0,0 +1,21 @@ +function typeout = FA_TP_D() +// function typeout = FA_TP_D() +// ----------------------------------------------------------------- +// +// Status: +// 26-Oct-2007 -- Raffaele Nutricato: Author. +// 26-Oct-2007 -- Alberto Morea: Test Ok. +// +// Copyright 2007 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),0,0); + + +typeout = 'd'; + +endfunction diff --git a/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_TP_I.sci b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_TP_I.sci new file mode 100644 index 00000000..5059abb9 --- /dev/null +++ b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_TP_I.sci @@ -0,0 +1,21 @@ +function typeout = FA_TP_I() +// function typeout = FA_TP_I() +// ----------------------------------------------------------------- +// +// Status: +// 26-Oct-2007 -- Raffaele Nutricato: Author. +// 26-Oct-2007 -- Alberto Morea: Test Ok. +// +// Copyright 2007 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),0,0); + + +typeout = 'i'; + +endfunction diff --git a/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_TP_MAX.sci b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_TP_MAX.sci new file mode 100644 index 00000000..07f7ddb5 --- /dev/null +++ b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_TP_MAX.sci @@ -0,0 +1,31 @@ +function opout = FA_TP_MAX(in1,in2) +// function opout = FA_TP_MAX(in1,in2) +// ----------------------------------------------------------------- +// +// Status: +// 26-Oct-2007 -- Raffaele Nutricato: Author. +// 26-Oct-2007 -- Alberto Morea: Test Ok. +// +// Copyright 2007 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + +in1Pin2 = in1+in2; +opout = in1; + +if (in2 == 'z') + opout = 'z'; +elseif (in1Pin2 == 'sd') + opout = 'd'; +elseif (in1Pin2 == 'sc') + opout = 'c'; +elseif (in1Pin2 == 'dc') + opout = 'z'; +end + +endfunction diff --git a/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_TP_REAL.sci b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_TP_REAL.sci new file mode 100644 index 00000000..b9c4069a --- /dev/null +++ b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_TP_REAL.sci @@ -0,0 +1,26 @@ +function opout = FA_TP_REAL(in1) +// function opout = FA_TP_REAL(in1) +// ----------------------------------------------------------------- +// +// Status: +// 26-Mar-2008 -- Raffaele Nutricato: Author. +// 26-Mar-2008 -- Alberto Morea: Test Ok. +// +// Copyright 2008 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),1,1); + +opout = in1; + +if (in1 == 'c') + opout = 's'; +elseif (in1 == 'z') + opout = 'd'; +end + +endfunction diff --git a/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_TP_S.sci b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_TP_S.sci new file mode 100644 index 00000000..0bbdd03c --- /dev/null +++ b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_TP_S.sci @@ -0,0 +1,20 @@ +function typeout = FA_TP_S() +// function typeout = FA_TP_S() +// ----------------------------------------------------------------- +// Status: +// 26-Oct-2007 -- Raffaele Nutricato: Author. +// 26-Oct-2007 -- Alberto Morea: Test Ok. +// +// Copyright 2007 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),0,0); + + +typeout = 's'; + +endfunction diff --git a/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_TP_USER.sci b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_TP_USER.sci new file mode 100644 index 00000000..6b295d95 --- /dev/null +++ b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_TP_USER.sci @@ -0,0 +1,23 @@ +function type_out = FA_TP_USER(PrecisionSpecifier,DefaultType) +// function type_out = FA_TP_USER(PrecisionSpecifier,DefaultType) +// ----------------------------------------------------------------- +// +// Status: +// 26-Oct-2007 -- Raffaele Nutricato: Author. +// 26-Oct-2007 -- Alberto Morea: Test Ok. +// ----------------------------------------------------------------- + +SCI2CNInArgCheck(argn(2),2,2); + +if (mtlb_strcmp(PrecisionSpecifier,'int')) + type_out = 'i'; +elseif (mtlb_strcmp(PrecisionSpecifier,'float')) + type_out = 's'; +elseif (mtlb_strcmp(PrecisionSpecifier,'double')) + type_out = 'd'; +elseif (mtlb_strcmp(PrecisionSpecifier,'default')) + type_out = DefaultType; +else + SCI2Cerror('Unknown precision function: ""'+AnnotationFnc+'"".'); +end +endfunction diff --git a/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_TP_Z.sci b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_TP_Z.sci new file mode 100644 index 00000000..1c152d8d --- /dev/null +++ b/src/Scilab2C/Scilab2C/FunctionAnnotation/FA_TP_Z.sci @@ -0,0 +1,24 @@ +function typeout = FA_TP_Z() +// function typeout = FA_TP_Z() +// ----------------------------------------------------------------- +// +// Status: +// 26-Oct-2007 -- Raffaele Nutricato: Author. +// 26-Oct-2007 -- Alberto Morea: Test Ok. +// +// Copyright 2007 Raffaele Nutricato & Alberto Morea. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),0,0); + + +// ------------------------ +// --- Generate Output. --- +// ------------------------ +typeout = 'z'; + +endfunction |