From 08b7804b3a81f71c5bc946497c5cae92e0563905 Mon Sep 17 00:00:00 2001 From: jofret Date: Thu, 17 Jun 2010 10:10:04 +0000 Subject: Remove SCI2Cisnum wrapping around isnum function --- scilab2c/macros/ASTManagement/%cste_string.sci | 2 +- .../macros/CCodeGeneration/C_GenDeclarations.sci | 8 +- .../CCodeGeneration/C_MemAllocOutTempVars.sci | 4 +- .../macros/CCodeGeneration/GetSymbolDimension.sci | 2 +- scilab2c/macros/FunctionAnnotation/FA_ADD.sci | 4 +- scilab2c/macros/FunctionAnnotation/FA_DIV.sci | 4 +- .../macros/FunctionAnnotation/FA_GetOutArgInfo.sci | 22 ++--- scilab2c/macros/FunctionAnnotation/FA_INT.sci | 4 +- scilab2c/macros/FunctionAnnotation/FA_MAX.sci | 104 ++++++++++----------- scilab2c/macros/FunctionAnnotation/FA_MIN.sci | 88 ++++++++--------- scilab2c/macros/FunctionAnnotation/FA_MUL.sci | 4 +- scilab2c/macros/FunctionAnnotation/FA_REAL.sci | 92 +++++++++--------- scilab2c/macros/FunctionAnnotation/FA_SUB.sci | 4 +- .../macros/FunctionAnnotation/FA_SZ_FROM_VAL.sci | 26 +++--- scilab2c/macros/FunctionAnnotation/FA_SZ_OPCC.sci | 6 +- .../macros/FunctionAnnotation/FA_SZ_OPPLUS.sci | 20 ++-- scilab2c/macros/FunctionAnnotation/FA_SZ_OPRC.sci | 6 +- scilab2c/macros/GeneralFunctions/SCI2Cisnum.sci | 30 ------ scilab2c/macros/SymbolTable/ST_MatchSymbol.sci | 8 +- 19 files changed, 204 insertions(+), 234 deletions(-) delete mode 100644 scilab2c/macros/GeneralFunctions/SCI2Cisnum.sci diff --git a/scilab2c/macros/ASTManagement/%cste_string.sci b/scilab2c/macros/ASTManagement/%cste_string.sci index 04b05b6e..ba9971d2 100644 --- a/scilab2c/macros/ASTManagement/%cste_string.sci +++ b/scilab2c/macros/ASTManagement/%cste_string.sci @@ -15,7 +15,7 @@ function txt=%cste_string(c) stringcvalue == "%e" | ... stringcvalue == "%pi") txt=['Number_x: '+stringcvalue]; - elseif (SCI2Cisnum(stringcvalue)) + elseif (isnum(stringcvalue)) //NUT needed to convert format 1D-14 into 1d-14 txt=['Number_x: '+strsubst(stringcvalue,'D','e')]; elseif (stringcvalue == "%i") diff --git a/scilab2c/macros/CCodeGeneration/C_GenDeclarations.sci b/scilab2c/macros/CCodeGeneration/C_GenDeclarations.sci index 242bafd9..936280b8 100644 --- a/scilab2c/macros/CCodeGeneration/C_GenDeclarations.sci +++ b/scilab2c/macros/CCodeGeneration/C_GenDeclarations.sci @@ -41,13 +41,13 @@ if (ArgStruct.Dimension > 0) end // #RNU_RES_B //NUT: vedi Mem_Alloc_Out per maggiori info sulla rimozione della temp nella if - // if ((ArgStruct.Scope=='Temp') | (ArgStruct.FindLike == -1) | (SCI2Cisnum(ArgStruct.Size(1))==%F) | (SCI2Cisnum(ArgStruct.Size(2))==%F)) + // if ((ArgStruct.Scope=='Temp') | (ArgStruct.FindLike == -1) | (isnum(ArgStruct.Size(1))==%F) | (isnum(ArgStruct.Size(2))==%F)) // #RNU_RES_E if (ArgStruct.Type=='g') // if (isnan(ArgStruct.Value) ) - if ((SCI2Cisnum(ArgStruct.Size(1))==%F) | (SCI2Cisnum(ArgStruct.Size(2))==%F) ) + if ((isnum(ArgStruct.Size(1))==%F) | (isnum(ArgStruct.Size(2))==%F) ) Cdeclaration(1) = Cdeclaration(1)+C_Type(ArgStruct.Type)+... - ' * '+ArgStruct.Name+';'; + ' * '+ArgStruct.Name+';'; else if ((FlagExt == 1) | (isnan(ArgStruct.Value))) Cdeclaration(1) = Cdeclaration(1)+C_Type(ArgStruct.Type)+... @@ -60,7 +60,7 @@ if (ArgStruct.Dimension > 0) Cdeclaration(2) = Cdeclaration(2)+C_Type('i')+' __'+ArgStruct.Name+'Size[2] = {'+ArgStruct.Size(1)+','+ArgStruct.Size(2)+'};'; NDeclarations = 2; elseif ((ArgStruct.FindLike == -1) | ... - (SCI2Cisnum(ArgStruct.Size(1))==%F) | (SCI2Cisnum(ArgStruct.Size(2))==%F) | ... + (isnum(ArgStruct.Size(1))==%F) | (isnum(ArgStruct.Size(2))==%F) | ... (ResizeApproach=='REALLOC_ALL_RESIZE_ALL' & ArgStruct.Type~='g')) // #RNU_RES_B //RNU sulle stringhe non ho ancora deciso se applicare la realloc. diff --git a/scilab2c/macros/CCodeGeneration/C_MemAllocOutTempVars.sci b/scilab2c/macros/CCodeGeneration/C_MemAllocOutTempVars.sci index 5d92d4c8..dedcfd33 100644 --- a/scilab2c/macros/CCodeGeneration/C_MemAllocOutTempVars.sci +++ b/scilab2c/macros/CCodeGeneration/C_MemAllocOutTempVars.sci @@ -34,7 +34,7 @@ for counterout = 1:NOutArg if (OutArg(counterout).Dimension > 0) // #RNU_RES_B // if ((OutArg(counterout).Scope == 'Temp') | (OutArg(counterout).FindLike == -1) | ... - // (SCI2Cisnum(OutArg(counterout).Size(1))==%F) | (SCI2Cisnum(OutArg(counterout).Size(2))==%F)) + // (isnum(OutArg(counterout).Size(1))==%F) | (isnum(OutArg(counterout).Size(2))==%F)) //NUT: qui forse ci vuole un check per verificare se per caso la variabile e' globale e non se ne conosce la size numerica. //NUT infatti. Per ora se la size numerica assumo che la variabile globale e' da reallocare. Secondo me occorre aggiungere //NUT un campo negli argomenti che specifichi la presenza di realloc da fare. @@ -42,7 +42,7 @@ for counterout = 1:NOutArg //RNU sulle stringhe ancora non applico realloc // #RNU_RES_E if ((OutArg(counterout).FindLike == -1) | ... - (SCI2Cisnum(OutArg(counterout).Size(1))==%F) | (SCI2Cisnum(OutArg(counterout).Size(2))==%F)| ... + (isnum(OutArg(counterout).Size(1))==%F) | (isnum(OutArg(counterout).Size(2))==%F)| ... (ResizeApproach=='REALLOC_ALL_RESIZE_ALL' & OutArg(counterout).Type ~= 'g')) OutArgName = OutArg(counterout).Name; tmpcode = '__'+OutArgName+'Size[0]='+OutArg(counterout).Size(1)+';'; diff --git a/scilab2c/macros/CCodeGeneration/GetSymbolDimension.sci b/scilab2c/macros/CCodeGeneration/GetSymbolDimension.sci index 6f4010ac..4fe3cc8d 100644 --- a/scilab2c/macros/CCodeGeneration/GetSymbolDimension.sci +++ b/scilab2c/macros/CCodeGeneration/GetSymbolDimension.sci @@ -41,7 +41,7 @@ for countersize = 1:Nelem // A symbol is column or row if the sum of the Field_Type elements is one. // A symbol is a matrix if the sum of the Field_Type elements is > 1. // #RNU_RES_E - if (SCI2Cisnum(Field_Size(countersize))) + if (isnum(Field_Size(countersize))) tmpnum = eval(Field_Size(countersize)); if (tmpnum == 0) SCI2Cerror('Found a symbol that has zeros elements. 0xN or Nx0 matrices are not allowed.'); diff --git a/scilab2c/macros/FunctionAnnotation/FA_ADD.sci b/scilab2c/macros/FunctionAnnotation/FA_ADD.sci index 1973f8d7..4193422b 100644 --- a/scilab2c/macros/FunctionAnnotation/FA_ADD.sci +++ b/scilab2c/macros/FunctionAnnotation/FA_ADD.sci @@ -27,7 +27,7 @@ SCI2CNInArgCheck(argn(2),2,2); // ------------------------ // --- Generate Output. --- // ------------------------ -if (SCI2Cisnum(in1) & SCI2Cisnum(in2)) +if (isnum(in1) & isnum(in2)) in1num = eval(in1); in2num = eval(in2); outnum = in1num+in2num; @@ -38,6 +38,6 @@ if (SCI2Cisnum(in1) & SCI2Cisnum(in2)) end else opout = string('('+in1+'+'+in2+')'); -end +end endfunction diff --git a/scilab2c/macros/FunctionAnnotation/FA_DIV.sci b/scilab2c/macros/FunctionAnnotation/FA_DIV.sci index bce6966d..d4ec0ccd 100644 --- a/scilab2c/macros/FunctionAnnotation/FA_DIV.sci +++ b/scilab2c/macros/FunctionAnnotation/FA_DIV.sci @@ -26,7 +26,7 @@ SCI2CNInArgCheck(argn(2),2,2); // ------------------------ // --- Generate Output. --- // ------------------------ -if (SCI2Cisnum(in1) & SCI2Cisnum(in2)) +if (isnum(in1) & isnum(in2)) in1num = eval(in1); in2num = eval(in2); outnum = in1num/in2num; @@ -37,5 +37,5 @@ if (SCI2Cisnum(in1) & SCI2Cisnum(in2)) end else opout = '('+string(in1)+'/'+string(in2)+')'; -end +end endfunction diff --git a/scilab2c/macros/FunctionAnnotation/FA_GetOutArgInfo.sci b/scilab2c/macros/FunctionAnnotation/FA_GetOutArgInfo.sci index 6566b2ee..0cdba234 100644 --- a/scilab2c/macros/FunctionAnnotation/FA_GetOutArgInfo.sci +++ b/scilab2c/macros/FunctionAnnotation/FA_GetOutArgInfo.sci @@ -38,7 +38,7 @@ for cntin = 1:NInArg // IN(cntin).VAL = '__SCI2CNANSIZE'; //RNU: toglimi //RNU: Replace the value of the variable with its name, in case it is a scalar variable. // #RNU_RES_E - IN(cntin).VAL = InArg(cntin).Name; + IN(cntin).VAL = InArg(cntin).Name; else IN(cntin).VAL = string(InArg(cntin).Value); end @@ -58,7 +58,7 @@ flagfindlike = 0; for counterin = 1:NInArg if (InArg(counterin).FindLike == 1 | InArg(counterin).FindLike == -1) // #RNU_RES_B - // Then we must assume that the output will be findlike + // Then we must assume that the output will be findlike // 0 = no find-like // 1 = pure find-like //-1 = similar to find-like (out=fun(in)) where in is find-like. @@ -73,14 +73,14 @@ for counterout = 1:NOutArg else UpdatedOutArg(counterout).Type = eval(FunTypeAnnot(counterout)); end - UpdatedOutArg(counterout).FindLike = 0; + 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))); @@ -89,10 +89,10 @@ for counterout = 1:NOutArg if (flagfindlike == -1) UpdatedOutArg(counterout).FindLike = -1; end - + // #RNU_RES_B // When the size is given by e IN(x).VAL annotation we can have two cases: - // IN(x).VAL is a number or IN(x).VAL is %nan. When it is %nan the + // IN(x).VAL is a number or IN(x).VAL is %nan. When it is %nan the // size is equal to the name of IN(x). // This is a dynamic memory extension of a local variable and for the moment // we issue an error according to SCI2C specifications @@ -104,7 +104,7 @@ for counterout = 1:NOutArg else UpdatedOutArg(counterout).Size(1) = string(tmpeval); end - elseif(SCI2Cisnum(tmpeval)) + elseif(isnum(tmpeval)) if (eval(tmpeval) <= 0) EM_ZeroSize(ReportFileName); else @@ -113,7 +113,7 @@ for counterout = 1:NOutArg else UpdatedOutArg(counterout).Size(1) = string(tmpeval); end - + tmpeval = eval(FunSizeAnnot(counterout,2)); if (IsNanSize(tmpeval)) if SharedInfo.ForExpr.OnExec == 0 @@ -124,7 +124,7 @@ for counterout = 1:NOutArg // #RNU_RES_E UpdatedOutArg(counterout).Size(2) = string(tmpeval); end - elseif(SCI2Cisnum(tmpeval)) + elseif(isnum(tmpeval)) if (eval(tmpeval) <= 0) EM_ZeroSize(ReportFileName); else @@ -133,7 +133,7 @@ for counterout = 1:NOutArg 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. diff --git a/scilab2c/macros/FunctionAnnotation/FA_INT.sci b/scilab2c/macros/FunctionAnnotation/FA_INT.sci index c4e2cc3d..e1bdba33 100644 --- a/scilab2c/macros/FunctionAnnotation/FA_INT.sci +++ b/scilab2c/macros/FunctionAnnotation/FA_INT.sci @@ -27,7 +27,7 @@ SCI2CNInArgCheck(argn(2),1,1); // ------------------------ // --- Generate Output. --- // ------------------------ -if (SCI2Cisnum(in1)) +if (isnum(in1)) outnum = int(eval(in1)); if isnan(outnum) opout = '__SCI2CNANSIZE'; @@ -36,5 +36,5 @@ if (SCI2Cisnum(in1)) end else opout = in1; -end +end endfunction diff --git a/scilab2c/macros/FunctionAnnotation/FA_MAX.sci b/scilab2c/macros/FunctionAnnotation/FA_MAX.sci index 2ecfc6ac..c725dd23 100644 --- a/scilab2c/macros/FunctionAnnotation/FA_MAX.sci +++ b/scilab2c/macros/FunctionAnnotation/FA_MAX.sci @@ -1,52 +1,52 @@ -function opout = FA_MAX(in1,in2) -// function opout = FA_MAX(in1,in2) -// ----------------------------------------------------------------- -// Maximum function for Function Annotations. -// When in1 and in2 are both symbols this function returns -// in1. -// -// Input data: -// in1: string specifying a number or a symbol. -// in2: string specifying a number or a symbol. -// -// Output data: -// opout: string containing the computed result. -// -// 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 -// ----------------------------------------------------------------- - -// ------------------------------ -// --- Check input arguments. --- -// ------------------------------ -SCI2CNInArgCheck(argn(2),2,2); - -//SCI2Cerror('Not allowed to use FA_MAX in this release.'); - -// ------------------------ -// --- Generate Output. --- -// ------------------------ -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 +function opout = FA_MAX(in1,in2) +// function opout = FA_MAX(in1,in2) +// ----------------------------------------------------------------- +// Maximum function for Function Annotations. +// When in1 and in2 are both symbols this function returns +// in1. +// +// Input data: +// in1: string specifying a number or a symbol. +// in2: string specifying a number or a symbol. +// +// Output data: +// opout: string containing the computed result. +// +// 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 +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + +//SCI2Cerror('Not allowed to use FA_MAX in this release.'); + +// ------------------------ +// --- Generate Output. --- +// ------------------------ +if (isnum(in1)) + in1num = eval(in1); + if (isnum(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/scilab2c/macros/FunctionAnnotation/FA_MIN.sci b/scilab2c/macros/FunctionAnnotation/FA_MIN.sci index 874cee8a..e1539103 100644 --- a/scilab2c/macros/FunctionAnnotation/FA_MIN.sci +++ b/scilab2c/macros/FunctionAnnotation/FA_MIN.sci @@ -1,45 +1,45 @@ -function opout = FA_MIN(in1,in2) -// function opout = FA_MIN(in1,in2) -// ----------------------------------------------------------------- -// Minimum function for Function Annotations. -// When in1 and in2 are both symbols this function returns -// in1. -// -// Input data: -// in1: string specifying a number or a symbol. -// in2: string specifying a number or a symbol. -// -// Output data: -// opout: string containing the computed result. - -// ----------------------------------------------------------------- - -// ------------------------------ -// --- Check input arguments. --- -// ------------------------------ -SCI2CNInArgCheck(argn(2),2,2); - - -// ------------------------ -// --- Generate Output. --- -// ------------------------ -if (SCI2Cisnum(in1)) - in1num = eval(in1); - if (SCI2Cisnum(in2)) - in2num = eval(in2); - outnum = min(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 - +function opout = FA_MIN(in1,in2) +// function opout = FA_MIN(in1,in2) +// ----------------------------------------------------------------- +// Minimum function for Function Annotations. +// When in1 and in2 are both symbols this function returns +// in1. +// +// Input data: +// in1: string specifying a number or a symbol. +// in2: string specifying a number or a symbol. +// +// Output data: +// opout: string containing the computed result. + +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + + +// ------------------------ +// --- Generate Output. --- +// ------------------------ +if (isnum(in1)) + in1num = eval(in1); + if (isnum(in2)) + in2num = eval(in2); + outnum = min(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/scilab2c/macros/FunctionAnnotation/FA_MUL.sci b/scilab2c/macros/FunctionAnnotation/FA_MUL.sci index d3495a02..8c9a930a 100644 --- a/scilab2c/macros/FunctionAnnotation/FA_MUL.sci +++ b/scilab2c/macros/FunctionAnnotation/FA_MUL.sci @@ -27,7 +27,7 @@ SCI2CNInArgCheck(argn(2),2,2); // ------------------------ // --- Generate Output. --- // ------------------------ -if (SCI2Cisnum(in1) & SCI2Cisnum(in2)) +if (isnum(in1) & isnum(in2)) in1num = eval(in1); in2num = eval(in2); outnum = in1num*in2num; @@ -38,5 +38,5 @@ if (SCI2Cisnum(in1) & SCI2Cisnum(in2)) end else opout = '('+string(in1)+'*'+string(in2)+')'; -end +end endfunction diff --git a/scilab2c/macros/FunctionAnnotation/FA_REAL.sci b/scilab2c/macros/FunctionAnnotation/FA_REAL.sci index e55583d7..7b8c0fda 100644 --- a/scilab2c/macros/FunctionAnnotation/FA_REAL.sci +++ b/scilab2c/macros/FunctionAnnotation/FA_REAL.sci @@ -1,50 +1,50 @@ -// -// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab -// Copyright (C) 2009-2009 - DIGITEO - Bruno JOFRET -// -// This file must be used under the terms of the CeCILL. -// This source file is licensed as described in the file COPYING, which -// you should have received as part of this distribution. The terms -// are also available at -// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt -// -// -function opout = FA_REAL(in1, in2) -// function opout = FA_REAL(in1, in2) -// ----------------------------------------------------------------- -// Real function for Function Annotations. -// When in1 is a number opout = real(in1); where real returns in1 -// real part. If in1 is string opout = in1. -// -// Input data: -// in1: string specifying a number or a symbol. -// in2: string specifying in1 type -// -// Output data: -// opout: string containing the computed result. -// -// ----------------------------------------------------------------- - -// ------------------------------ -// --- Check input arguments. --- -// ------------------------------ -SCI2CNInArgCheck(argn(2),2,2); - -// ------------------------ -// --- Generate Output. --- -// ------------------------ -if (SCI2Cisnum(in1)) - outnum = real(eval(in1)); - if isnan(outnum) - opout = '__SCI2CNANSIZE'; - else - opout = string(outnum); - end +// +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2009 - DIGITEO - Bruno JOFRET +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// +// +function opout = FA_REAL(in1, in2) +// function opout = FA_REAL(in1, in2) +// ----------------------------------------------------------------- +// Real function for Function Annotations. +// When in1 is a number opout = real(in1); where real returns in1 +// real part. If in1 is string opout = in1. +// +// Input data: +// in1: string specifying a number or a symbol. +// in2: string specifying in1 type +// +// Output data: +// opout: string containing the computed result. +// +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),2,2); + +// ------------------------ +// --- Generate Output. --- +// ------------------------ +if (isnum(in1)) + outnum = real(eval(in1)); + if isnan(outnum) + opout = '__SCI2CNANSIZE'; + else + opout = string(outnum); + end else if (in1 == "%i") opout = " 0 "; - else + else opout = in2+"0real"+FA_TP_REAL(in2)+"0"+"("+in1+")"; - end -end -endfunction + end +end +endfunction diff --git a/scilab2c/macros/FunctionAnnotation/FA_SUB.sci b/scilab2c/macros/FunctionAnnotation/FA_SUB.sci index 039ff1af..1ef0ad46 100644 --- a/scilab2c/macros/FunctionAnnotation/FA_SUB.sci +++ b/scilab2c/macros/FunctionAnnotation/FA_SUB.sci @@ -26,7 +26,7 @@ SCI2CNInArgCheck(argn(2),2,2); // ------------------------ // --- Generate Output. --- // ------------------------ -if (SCI2Cisnum(in1) & SCI2Cisnum(in2)) +if (isnum(in1) & isnum(in2)) in1num = eval(in1); in2num = eval(in2); outnum = in1num-in2num; @@ -37,5 +37,5 @@ if (SCI2Cisnum(in1) & SCI2Cisnum(in2)) end else opout = '('+string(in1)+'-'+string(in2)+')'; -end +end endfunction diff --git a/scilab2c/macros/FunctionAnnotation/FA_SZ_FROM_VAL.sci b/scilab2c/macros/FunctionAnnotation/FA_SZ_FROM_VAL.sci index b1f8f982..c3cae536 100644 --- a/scilab2c/macros/FunctionAnnotation/FA_SZ_FROM_VAL.sci +++ b/scilab2c/macros/FunctionAnnotation/FA_SZ_FROM_VAL.sci @@ -1,20 +1,20 @@ function opout = FA_SZ_FROM_VAL(in1,in2) -// function opout = FA_SZ_FROM_VAL(in1,in2) +// function opout = FA_SZ_FROM_VAL(in1,in2) // ----------------------------------------------------------------- -// Return a size according to the floored value of the first argument -// -// Input data: -// in1: string specifying a number . // -// -// Output data: -// opout: string containing the computed result. -// +// Return a size according to the floored value of the first argument +// +// Input data: +// in1: string specifying a number . +// +// Output data: +// opout: string containing the computed result. +// // ----------------------------------------------------------------- SCI2CNInArgCheck(argn(2),2,2); - -if (SCI2Cisnum(in1)) + +if (isnum(in1)) in1num = eval(in1) ; if isnan(in1num) opout = '__SCI2CNANSIZE'; @@ -22,7 +22,7 @@ if (SCI2Cisnum(in1)) opout= '0' ; else opout = string ( floor (abs(in1num))) ; - + end @@ -30,7 +30,7 @@ else opout = in2+"0floor"+in2+"0"+"("+in1+")"; opout = in2+"0abs"+in2+"0"+"("+opout+")"; -end +end endfunction: diff --git a/scilab2c/macros/FunctionAnnotation/FA_SZ_OPCC.sci b/scilab2c/macros/FunctionAnnotation/FA_SZ_OPCC.sci index cc532e24..50527771 100644 --- a/scilab2c/macros/FunctionAnnotation/FA_SZ_OPCC.sci +++ b/scilab2c/macros/FunctionAnnotation/FA_SZ_OPCC.sci @@ -2,7 +2,7 @@ function opoutsize = FA_SZ_OPCC(in1size,in2size) // function opoutsize = FA_SZ_OPCC(in1size,in2size) // ----------------------------------------------------------------- // Returns the size of the output computed by OPCC operator. -// +// // // Status: // 08-Mar-2008 -- Raffaele Nutricato: Author. @@ -27,11 +27,11 @@ in2size = string(in2size); in1dim = GetSymbolDimension(in1size); in2dim = GetSymbolDimension(in2size); -if (SCI2Cisnum(in1size(1)) & SCI2Cisnum(in2size(1))) +if (isnum(in1size(1)) & isnum(in2size(1))) in1num = eval(in1size(1)); in2num = eval(in2size(1)); opoutsize(1) = string(in1num+in2num); -else +else opoutsize(1) = '('+string(in1size(1))+'+'+string(in2size(1))+')'; end diff --git a/scilab2c/macros/FunctionAnnotation/FA_SZ_OPPLUS.sci b/scilab2c/macros/FunctionAnnotation/FA_SZ_OPPLUS.sci index d0df4c6c..aae50af6 100644 --- a/scilab2c/macros/FunctionAnnotation/FA_SZ_OPPLUS.sci +++ b/scilab2c/macros/FunctionAnnotation/FA_SZ_OPPLUS.sci @@ -3,7 +3,7 @@ function opoutsize = FA_SZ_OPPLUS(in1size,in2size,in1type,in2type) // ----------------------------------------------------------------- // Returns the size of the output computed by OPPLUS operator, // including the string operations. -// +// // Assuming: // size(in1) = [in1r,in1c] // size(in2) = [in2r,in2c] @@ -12,7 +12,7 @@ function opoutsize = FA_SZ_OPPLUS(in1size,in2size,in1type,in2type) // we have the following combinations: // in1 in2 outr outc // ----------------------- -// S S in2r in2c +// S S in2r in2c // S M in2r in2c // M S in1r in1c // M M in1r in1c @@ -23,18 +23,18 @@ function opoutsize = FA_SZ_OPPLUS(in1size,in2size,in1type,in2type) // This is the main difference between - and + operators. // // Input data: -// in1size: size of input number 1. It is an array of 2 strings. +// 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. +// +// 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. +// 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. +// The second string specifies the number of columns. // // Status: // 08-Dec-2007 -- Raffaele Nutricato: Author. @@ -63,7 +63,7 @@ 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))) + if (isnum(in1size(1)) & isnum(in2size(1))) in1num = eval(in1size(1)); in2num = eval(in2size(1)); if (in1num > 1 | in2num > 1) @@ -74,7 +74,7 @@ elseif ((in1type == 'g') & (in2type == 'g')) //NUT: ho provato in scilab a fare la trasposta di una stringa e ottengo sempre 1x1. end end - if (SCI2Cisnum(in1size(2)) & SCI2Cisnum(in2size(2))) + if (isnum(in1size(2)) & isnum(in2size(2))) in1num = eval(in1size(2)); in2num = eval(in2size(2)); opoutsize(2) = string(in1num+in2num-1); @@ -83,7 +83,7 @@ elseif ((in1type == 'g') & (in2type == 'g')) else opoutsize(2) = string(opoutsize(2)); end - else + else opoutsize(2) = '('+string(in1size(2))+'+'+string(in2size(2))+'-1)'; end else diff --git a/scilab2c/macros/FunctionAnnotation/FA_SZ_OPRC.sci b/scilab2c/macros/FunctionAnnotation/FA_SZ_OPRC.sci index 2c9f1c18..c4da4a0f 100644 --- a/scilab2c/macros/FunctionAnnotation/FA_SZ_OPRC.sci +++ b/scilab2c/macros/FunctionAnnotation/FA_SZ_OPRC.sci @@ -2,7 +2,7 @@ function opoutsize = FA_SZ_OPRC(in1size,in2size) // function opoutsize = FA_SZ_OPRC(in1size,in2size) // ----------------------------------------------------------------- // Returns the size of the output computed by OPRC operator. -// +// // // Status: // 08-Mar-2008 -- Raffaele Nutricato: Author. @@ -29,11 +29,11 @@ in2dim = GetSymbolDimension(in2size); opoutsize(1) = in1size(1); -if (SCI2Cisnum(in1size(2)) & SCI2Cisnum(in2size(2))) +if (isnum(in1size(2)) & isnum(in2size(2))) in1num = eval(in1size(2)); in2num = eval(in2size(2)); opoutsize(2) = string(in1num+in2num); -else +else opoutsize(2) = '('+string(in1size(2))+'+'+string(in2size(2))+')'; end diff --git a/scilab2c/macros/GeneralFunctions/SCI2Cisnum.sci b/scilab2c/macros/GeneralFunctions/SCI2Cisnum.sci deleted file mode 100644 index 50a5c14e..00000000 --- a/scilab2c/macros/GeneralFunctions/SCI2Cisnum.sci +++ /dev/null @@ -1,30 +0,0 @@ -function outbool = SCI2Cisnum(instring) -// function outbool = SCI2Cisnum(instring) -// ----------------------------------------------------------------- -// It fixes the bug of isnum. isnum('d') -> %T!!! -// -// Input data: -// instring: string to analyze. -// -// Output data: -// outbool: %T if instring is a number. -// -// Status: -// 12-Apr-2007 -- Nutricato Raffaele: Author. -// -// Copyright 2007 Raffaele Nutricato. -// Contact: raffaele.nutricato@tiscali.it -// ----------------------------------------------------------------- - -// ------------------------------ -// --- Check input arguments. --- -// ------------------------------ -SCI2CNInArgCheck(argn(2),1,1); - -instring = convstr(instring,'l'); -outbool = isnum(instring); -firstchar = part(instring,1:1); -if (firstchar == 'd' | firstchar == 'e') - outbool = %F; -end -endfunction diff --git a/scilab2c/macros/SymbolTable/ST_MatchSymbol.sci b/scilab2c/macros/SymbolTable/ST_MatchSymbol.sci index 621739fb..20f0bbe8 100644 --- a/scilab2c/macros/SymbolTable/ST_MatchSymbol.sci +++ b/scilab2c/macros/SymbolTable/ST_MatchSymbol.sci @@ -12,7 +12,7 @@ function [TBFlagfound,TBFlagEqualSymbols] = ST_MatchSymbol(TBName,TBType,TBSize, // 1 = the symbol exits. // 2 = the symbol exists but it is a non-initialized global variable. // TBFlagEqualSymbols: 0 if the two symbols don't have the same settings, -// 1 if the two symbols have the same settings. +// 1 if the two symbols have the same settings. // // Status: // 26-Oct-2007 -- Raffaele Nutricato: Author. @@ -53,12 +53,12 @@ if (TBFlagfound == 1) TBFlagEqualSymbols = 0; end // Then if the size is a number also its value is compared. - if (SCI2Cisnum(tmpSize(1))) & (SCI2Cisnum(TBSize(1))) + if (isnum(tmpSize(1))) & (isnum(TBSize(1))) if (mtlb_strcmp(tmpSize(1),TBSize(1)) == %F) TBFlagEqualSymbols = 0; end end - if (SCI2Cisnum(tmpSize(2))) & (SCI2Cisnum(TBSize(2))) + if (isnum(tmpSize(2))) & (isnum(TBSize(2))) if (mtlb_strcmp(tmpSize(2),TBSize(2)) == %F) TBFlagEqualSymbols = 0; end @@ -66,5 +66,5 @@ if (TBFlagfound == 1) end end end - + endfunction -- cgit