diff options
Diffstat (limited to 'src/Scilab2C/FunctionTableManagement')
-rw-r--r-- | src/Scilab2C/FunctionTableManagement/AddBranch.sci | 2 | ||||
-rw-r--r-- | src/Scilab2C/FunctionTableManagement/CinfoI1AO1A.sci | 55 | ||||
-rw-r--r-- | src/Scilab2C/FunctionTableManagement/CinfoI1SO1S.sci | 49 | ||||
-rw-r--r-- | src/Scilab2C/FunctionTableManagement/Example.sce | 150 | ||||
-rw-r--r-- | src/Scilab2C/FunctionTableManagement/GenerateLeafElementary.sci | 148 | ||||
-rw-r--r-- | src/Scilab2C/FunctionTableManagement/GenerateLeafElementary.sci.bak | 86 | ||||
-rw-r--r-- | src/Scilab2C/FunctionTableManagement/GetCFunCall.sci | 48 | ||||
-rw-r--r-- | src/Scilab2C/FunctionTableManagement/InitializeLibraries.sci | 32 | ||||
-rw-r--r-- | src/Scilab2C/FunctionTableManagement/Pass1ASTReader.txt | 13 | ||||
-rw-r--r-- | src/Scilab2C/FunctionTableManagement/SCI2CLib.dat | bin | 0 -> 17064 bytes | |||
-rw-r--r-- | src/Scilab2C/FunctionTableManagement/USER2CLib.dat | bin | 0 -> 100 bytes |
11 files changed, 501 insertions, 82 deletions
diff --git a/src/Scilab2C/FunctionTableManagement/AddBranch.sci b/src/Scilab2C/FunctionTableManagement/AddBranch.sci index a03e7193..9b870677 100644 --- a/src/Scilab2C/FunctionTableManagement/AddBranch.sci +++ b/src/Scilab2C/FunctionTableManagement/AddBranch.sci @@ -1,4 +1,4 @@ -function TreeBase = AddBranch(TreeBase, Branch, CINFO )
+function TreeBase = AddBranch(TreeBase, Branch, CINFO)
// To understand how this software works the steps are:
//
diff --git a/src/Scilab2C/FunctionTableManagement/CinfoI1AO1A.sci b/src/Scilab2C/FunctionTableManagement/CinfoI1AO1A.sci new file mode 100644 index 00000000..d5e4342e --- /dev/null +++ b/src/Scilab2C/FunctionTableManagement/CinfoI1AO1A.sci @@ -0,0 +1,55 @@ +function CINFO = CinfoI1AO1A(Pfx,FunctionName,Sfx,ArgType,InStr,OutStr); +// -----------------------------------------------------------------
+// Returns the CINFO structure for elementary functions that work
+// with one input and one output array arguments.
+//
+// Function name prefixes.
+// FunPfx = [...
+// "s",...
+// "d",...
+// "c",...
+// "z"];
+// Function name suffixes.
+// FunSfx = [...
+// "s",...
+// "a",...
+// "m"];
+// Types of the function arguments.
+// FunArgTypes = [...
+// "float ",... +// "double ",... +// "floatComplex ",... +// "doubleComplex ",... +// "float* ",... +// "double* ",... +// "floatComplex* ",... +// "doubleComplex* ",... +// "int "]; +//
+// Status:
+// 19-Mar-2006 -- Intelligente Fabio: Author.
+// 19-Apr-2002 -- Nutricato Raffaele: Changed code into a function.
+// -----------------------------------------------------------------
+
+a = """"; // apex
+b = " "; // blank
+c = ","; // comma
+so = "["; // square open
+sc = "]"; // square close
+
+CINFO.NAME = Pfx + FunctionName + Sfx; +CINFO.ARGLIST = ...
+ so+a+ArgType+a+c+ ...
+ InStr.Name+c+ ...
+ a+c+a+c+ ...
+ a+ArgType+a+c+ ...
+ OutStr.Name+c+ ...
+ a+c+a+c+ ...
+ a+"int "+a+c+ ...
+ "mtlb_num2str(prod(InArg(1).Size))"+sc;
+CINFO.SIZE = Sfx; +CINFO.TYPE = Pfx; +CINFO.DIM = "O1Sz = I1Sz";
+CINFO.NOut = 1; +
+endfunction
diff --git a/src/Scilab2C/FunctionTableManagement/CinfoI1SO1S.sci b/src/Scilab2C/FunctionTableManagement/CinfoI1SO1S.sci new file mode 100644 index 00000000..71d53e99 --- /dev/null +++ b/src/Scilab2C/FunctionTableManagement/CinfoI1SO1S.sci @@ -0,0 +1,49 @@ +function CINFO = CinfoI1SO1S(Pfx,FunctionName,Sfx,ArgType,InStr) +// -----------------------------------------------------------------
+// Returns the CINFO structure for elementary functions that work
+// with one input and one output scalar arguments.
+//
+// Function name prefixes.
+// FunPfx = [...
+// "s",...
+// "d",...
+// "c",...
+// "z"];
+// Function name suffixes.
+// FunSfx = [...
+// "s",...
+// "a",...
+// "m"];
+// Types of the function arguments.
+// FunArgTypes = [...
+// "float ",... +// "double ",... +// "floatComplex ",... +// "doubleComplex ",... +// "float* ",... +// "double* ",... +// "floatComplex* ",... +// "doubleComplex* ",... +// "int "]; +//
+// Status:
+// 19-Mar-2006 -- Intelligente Fabio: Author.
+// 19-Apr-2002 -- Nutricato Raffaele: Changed code into a function.
+// -----------------------------------------------------------------
+
+a = """"; // apex
+b = " "; // blank
+c = ","; // comma
+so = "["; // square open
+sc = "]"; // square close
+
+CINFO.NAME = Pfx + FunctionName + Sfx; +CINFO.ARGLIST = ...
+ so+a+ArgType+a+c+ ...
+ InStr.Name+sc; +CINFO.SIZE = Sfx; +CINFO.TYPE = Pfx; +CINFO.DIM = "O1Sz = I1Sz";
+CINFO.NOut = 1; +
+endfunction diff --git a/src/Scilab2C/FunctionTableManagement/Example.sce b/src/Scilab2C/FunctionTableManagement/Example.sce index 4d69b601..114544aa 100644 --- a/src/Scilab2C/FunctionTableManagement/Example.sce +++ b/src/Scilab2C/FunctionTableManagement/Example.sce @@ -6,10 +6,156 @@ clear;
clc;
-
+mode(0);
getf("InitializeLibraries.sci");
+getf("GetCFunCall.sci");
[SCI2CLib, USER2CLib] = InitializeLibraries();
+save('SCI2CLib.dat',SCI2CLib);
+save('USER2CLib.dat',USER2CLib);
+
+disp("Scalar Version:")
+FunName = "cos";
+InArg.Name="inscalar";
+InArg.Type="z";
+InArg.Size=[1,1];
+OutArg.Name = "outscalar";
+CFunCall = GetCFunCall(FunName,InArg,OutArg);
+disp(CFunCall)
+disp(" ")
+disp(" ")
+
+disp("Array Version:")
+FunName = "sin";
+InArg.Name="inmtx";
+InArg.Type="s";
+InArg.Size=[10,7];
+OutArg.Name = "outmtx";
+CFunCall = GetCFunCall(FunName,InArg,OutArg);
+disp(CFunCall)
+disp(" ")
+disp(" ")
+
+
+
+
+// Let's consider the following example
+
+// **************************************
+// The input function to be traslated is:
+// --------------------------------------
+// function y=foo(x)
+
+// y = sin(cos(x));
+
+// endfunction
+// --------------------------------------
+
+// **************************************
+// The corresponding AST is:
+// --------------------------------------
+// Equal
+// Expression:
+// Funcall : sin
+// #lhs : 1
+// Rhs :
+// Funcall : cos
+// #lhs : 1
+// Rhs :
+// x
+// EndFuncall
+// EndFuncall
+// Lhs :
+// y
+// EndEqual
+
+// **************************************
+// The AST reader generates the following User-readable Intermediate Representation:
+// --------------------------------------
+// __temp1 = cos(x);
+// __temp2 = sin(__temp1);
+// y = __temp2;
+
+// **************************************
+// The AST reader generates also the following internal Intermediate Representation:
+// --------------------------------------
+FunName = "cos";
+InArg.Name="x";
+InArg.Type="s"; // This parameter is retrieved from annotations.
+InArg.Size=[10,7]; // This parameter is retrieved from annotations.
+OutArg.Number = 1;
+OutArg.Name = "__temp1";
+CFunCall = GetCFunCall(FunName,InArg,OutArg);
+disp(CFunCall)
+disp(" ")
+disp(" ")
+
+FunName = "sin";
+InArg.Name="__temp1";
+InArg.Type="s"; // This parameter is retrieved from annotations.
+InArg.Size=[10,7]; // This parameter is retrieved from annotations.
+OutArg.Number = 1;
+OutArg.Name = "__temp2";
+CFunCall = GetCFunCall(FunName,InArg,OutArg);
+disp(CFunCall)
+disp(" ")
+disp(" ")
+
+
+
+
+
+adf
+
+// Test Scalar Function
+clear In1
+clear Out1
+In1.Name = "inscalar";
+disp("Scalar Version:")
+disp([SCI2CLib.cos.S.C.D.CINFO.NAME,"(",eval(SCI2CLib.cos.S.C.D.CINFO.ARGLIST),")"])
+disp(" ")
+disp(" ")
+
+// Test Array Function
+clear In1
+clear Out1
+In1.Name = "inarray";
+In1.Size = [10,7];
+Out1.Name = "outarray";
+disp("Array Version:")
+disp([SCI2CLib.sin.A.C.D.CINFO.NAME,"(",eval(SCI2CLib.sin.A.C.D.CINFO.ARGLIST),")"])
+
+
+
+
+disp(" ")
+disp(" ")
+disp(" ")
+disp(" ")
+
+stoppami
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
// ------------------
// --- Example 1. ---
// ------------------
@@ -124,7 +270,7 @@ end //
// I add the same function with two outputs:
// 1. the first output is S.R.D
-// 2. the second output is M.R.D.
+// 2. the second output is A.R.D.
//
// Branch=FunctionStructure;
// TREE="USER2CLib";
diff --git a/src/Scilab2C/FunctionTableManagement/GenerateLeafElementary.sci b/src/Scilab2C/FunctionTableManagement/GenerateLeafElementary.sci index f9c39345..f7365094 100644 --- a/src/Scilab2C/FunctionTableManagement/GenerateLeafElementary.sci +++ b/src/Scilab2C/FunctionTableManagement/GenerateLeafElementary.sci @@ -1,86 +1,108 @@ -function [FuncStruct, CINFO, NumFunc] = GenerateLeafElementary(FunctionName) -// This function generates the leaf for the
-// "FunctionName" elementary function.
+function [FuncStruct, CINFO, NumFunc] = GenerateLeafElementary(FunctionName); +// -----------------------------------------------------------------
+// This function generates the leaf for the "FunctionName" elementary function.
+// Rules used for the function names:
+// s = float
+// d = double
+// c = complex float
+// z = complex double
+// ---
+// s = scalar
+// a = array (element wise functions)
+// m = array (matrix functions)
+//
+// CINFO is an array of structures containing info of the output arguments.
+// The number of elements of the CINFO array is equal to the number
+// of output arguments.
+//
+// Status:
+// 09-Apr-2006 -- Intelligente Fabio: Author.
+// 09-Apr-2006 -- Nutricato Raffaele: Tests + Minor changes.
+// -----------------------------------------------------------------
+
+// ------------
+// --- getf ---
+// ------------
+getf("CinfoI1SO1S.sci");
+getf("CinfoI1AO1A.sci");
+// ----------------
+// --- End getf ---
+// ----------------
+
+// Combinations for the elementary functions:
+// 1: S,R,F +// 2: S,R,D
+// 3: S,C,F
+// 4: S,C,D
+// 5: A,R,F
+// 6: A.R.D
+// 7: A,C,F
+// 8: A,C,D
+// 9: M,R,F NOT IMPLEMENTED YET
+// 10: M.R.D NOT IMPLEMENTED YET
+// 11: M,C,F NOT IMPLEMENTED YET
+// 12: M,C,D NOT IMPLEMENTED YET
+
+// Function name prefixes.
+FunPfx = [...
+ "s",...
+ "d",...
+ "c",...
+ "z"];
+
+// Function name suffixes.
+FunSfx = [...
+ "s",...
+ "a",...
+ "m"];
+
+// Types of the function arguments.
+FunArgTypes = [...
+ "float ",... + "double ",... + "floatComplex ",... + "doubleComplex ",... + "float* ",... + "double* ",... + "floatComplex* ",... + "doubleComplex* ",... + "int "]; +
+InputStruct.Name = "InArg(1).Name";
+OutputStruct.Name = "OutArg(1).Name";
NumFunc = 0;
NumFunc = NumFunc + 1;
-
-FuncStruct(NumFunc) = FunctionName + ".S.R.F.CINFO"; -CINFO(NumFunc).CPROT = "y=SRF" + FunctionName + "SRF(x)"; -CINFO(NumFunc).SIZE = "S"; -CINFO(NumFunc).TYPE = "R"; -CINFO(NumFunc).PREC = "F";
-CINFO(NumFunc).DIM = "O1Sz = I1Sz";
-CINFO(NumFunc).NOut = 1; +FuncStruct(NumFunc) = FunctionName + ".S.R.F.CINFO";
+CINFO = CinfoI1SO1S(FunPfx(1),FunctionName,FunSfx(1),FunArgTypes(1),InputStruct);
NumFunc = NumFunc + 1;
-
FuncStruct(NumFunc) = FunctionName + ".S.R.D.CINFO";
-CINFO(NumFunc).CPROT = "y=SRD" + FunctionName + "SRD(x)"; -CINFO(NumFunc).SIZE = "S"; -CINFO(NumFunc).TYPE = "R"; -CINFO(NumFunc).PREC = "D";
-CINFO(NumFunc).DIM = "O1Sz = I1Sz";
-CINFO(NumFunc).NOut = 1; +CINFO(NumFunc) = CinfoI1SO1S(FunPfx(2),FunctionName,FunSfx(1),FunArgTypes(2),InputStruct);
NumFunc = NumFunc + 1;
-
FuncStruct(NumFunc) = FunctionName + ".S.C.F.CINFO";
-CINFO(NumFunc).CPROT = "y=SCF" + FunctionName + "SCF(x)"; -CINFO(NumFunc).SIZE = "S"; -CINFO(NumFunc).TYPE = "C"; -CINFO(NumFunc).PREC = "F"; -CINFO(NumFunc).DIM = "O1Sz = I1Sz";
-CINFO(NumFunc).NOut = 1;
+CINFO(NumFunc) = CinfoI1SO1S(FunPfx(3),FunctionName,FunSfx(1),FunArgTypes(3),InputStruct);
NumFunc = NumFunc + 1;
-
FuncStruct(NumFunc) = FunctionName + ".S.C.D.CINFO";
-CINFO(NumFunc).CPROT = "y=SCD" + FunctionName + "SCD(x)"; -CINFO(NumFunc).SIZE = "S"; -CINFO(NumFunc).TYPE = "C"; -CINFO(NumFunc).PREC = "D"; -CINFO(NumFunc).DIM = "O1Sz = I1Sz";
-CINFO(NumFunc).NOut = 1;
+CINFO(NumFunc) = CinfoI1SO1S(FunPfx(4),FunctionName,FunSfx(1),FunArgTypes(4),InputStruct);
NumFunc = NumFunc + 1;
-
-FuncStruct(NumFunc) = FunctionName + ".M.R.F.CINFO";
-CINFO(NumFunc).CPROT = "MRF" + FunctionName + "MRF(*X, strideX, *Y, strideY, Nelements)"; -CINFO(NumFunc).SIZE = "M"; -CINFO(NumFunc).TYPE = "R"; -CINFO(NumFunc).PREC = "F";
-CINFO(NumFunc).DIM = "O1Sz = I1Sz";
-CINFO(NumFunc).NOut = 1; +FuncStruct(NumFunc) = FunctionName + ".A.R.F.CINFO";
+CINFO(NumFunc) = CinfoI1AO1A(FunPfx(1),FunctionName,FunSfx(2),FunArgTypes(5),InputStruct,OutputStruct);
NumFunc = NumFunc + 1;
-
-FuncStruct(NumFunc) = FunctionName + ".M.R.D.CINFO";
-CINFO(NumFunc).CPROT = "MRD" + FunctionName + "MRD(*X, strideX, *Y, strideY, Nelements)"; -CINFO(NumFunc).SIZE = "M"; -CINFO(NumFunc).TYPE = "R"; -CINFO(NumFunc).PREC = "D";
-CINFO(NumFunc).DIM = "O1Sz = I1Sz";
-CINFO(NumFunc).NOut = 1; +FuncStruct(NumFunc) = FunctionName + ".A.R.D.CINFO";
+CINFO(NumFunc) = CinfoI1AO1A(FunPfx(2),FunctionName,FunSfx(2),FunArgTypes(6),InputStruct,OutputStruct);
NumFunc = NumFunc + 1;
-
-FuncStruct(NumFunc) = FunctionName + ".M.C.F.CINFO";
-CINFO(NumFunc).CPROT = "MCF" + FunctionName + "MCF(*X, strideX, *Y, strideY, Nelements)"; -CINFO(NumFunc).SIZE = "M"; -CINFO(NumFunc).TYPE = "C"; -CINFO(NumFunc).PREC = "F";
-CINFO(NumFunc).DIM = "O1Sz = I1Sz";
-CINFO(NumFunc).NOut = 1; +FuncStruct(NumFunc) = FunctionName + ".A.C.F.CINFO";
+CINFO(NumFunc) = CinfoI1AO1A(FunPfx(3),FunctionName,FunSfx(2),FunArgTypes(7),InputStruct,OutputStruct);
NumFunc = NumFunc + 1;
+FuncStruct(NumFunc) = FunctionName + ".A.C.D.CINFO";
+CINFO(NumFunc) = CinfoI1AO1A(FunPfx(4),FunctionName,FunSfx(2),FunArgTypes(8),InputStruct,OutputStruct);
-FuncStruct(NumFunc) = FunctionName + ".M.C.D.CINFO";
-CINFO(NumFunc).CPROT = "MCD" + FunctionName + "MCD(*X, strideX, *Y, strideY, Nelements)"; -CINFO(NumFunc).SIZE = "M"; -CINFO(NumFunc).TYPE = "C"; -CINFO(NumFunc).PREC = "D";
-CINFO(NumFunc).DIM = "O1Sz = I1Sz";
-CINFO(NumFunc).NOut = 1;
endfunction diff --git a/src/Scilab2C/FunctionTableManagement/GenerateLeafElementary.sci.bak b/src/Scilab2C/FunctionTableManagement/GenerateLeafElementary.sci.bak new file mode 100644 index 00000000..f9c39345 --- /dev/null +++ b/src/Scilab2C/FunctionTableManagement/GenerateLeafElementary.sci.bak @@ -0,0 +1,86 @@ +function [FuncStruct, CINFO, NumFunc] = GenerateLeafElementary(FunctionName) +// This function generates the leaf for the
+// "FunctionName" elementary function.
+
+NumFunc = 0;
+
+NumFunc = NumFunc + 1;
+
+FuncStruct(NumFunc) = FunctionName + ".S.R.F.CINFO"; +CINFO(NumFunc).CPROT = "y=SRF" + FunctionName + "SRF(x)"; +CINFO(NumFunc).SIZE = "S"; +CINFO(NumFunc).TYPE = "R"; +CINFO(NumFunc).PREC = "F";
+CINFO(NumFunc).DIM = "O1Sz = I1Sz";
+CINFO(NumFunc).NOut = 1; +
+NumFunc = NumFunc + 1;
+
+FuncStruct(NumFunc) = FunctionName + ".S.R.D.CINFO";
+CINFO(NumFunc).CPROT = "y=SRD" + FunctionName + "SRD(x)"; +CINFO(NumFunc).SIZE = "S"; +CINFO(NumFunc).TYPE = "R"; +CINFO(NumFunc).PREC = "D";
+CINFO(NumFunc).DIM = "O1Sz = I1Sz";
+CINFO(NumFunc).NOut = 1; +
+NumFunc = NumFunc + 1;
+
+FuncStruct(NumFunc) = FunctionName + ".S.C.F.CINFO";
+CINFO(NumFunc).CPROT = "y=SCF" + FunctionName + "SCF(x)"; +CINFO(NumFunc).SIZE = "S"; +CINFO(NumFunc).TYPE = "C"; +CINFO(NumFunc).PREC = "F"; +CINFO(NumFunc).DIM = "O1Sz = I1Sz";
+CINFO(NumFunc).NOut = 1;
+
+NumFunc = NumFunc + 1;
+
+FuncStruct(NumFunc) = FunctionName + ".S.C.D.CINFO";
+CINFO(NumFunc).CPROT = "y=SCD" + FunctionName + "SCD(x)"; +CINFO(NumFunc).SIZE = "S"; +CINFO(NumFunc).TYPE = "C"; +CINFO(NumFunc).PREC = "D"; +CINFO(NumFunc).DIM = "O1Sz = I1Sz";
+CINFO(NumFunc).NOut = 1;
+
+NumFunc = NumFunc + 1;
+
+FuncStruct(NumFunc) = FunctionName + ".M.R.F.CINFO";
+CINFO(NumFunc).CPROT = "MRF" + FunctionName + "MRF(*X, strideX, *Y, strideY, Nelements)"; +CINFO(NumFunc).SIZE = "M"; +CINFO(NumFunc).TYPE = "R"; +CINFO(NumFunc).PREC = "F";
+CINFO(NumFunc).DIM = "O1Sz = I1Sz";
+CINFO(NumFunc).NOut = 1; +
+NumFunc = NumFunc + 1;
+
+FuncStruct(NumFunc) = FunctionName + ".M.R.D.CINFO";
+CINFO(NumFunc).CPROT = "MRD" + FunctionName + "MRD(*X, strideX, *Y, strideY, Nelements)"; +CINFO(NumFunc).SIZE = "M"; +CINFO(NumFunc).TYPE = "R"; +CINFO(NumFunc).PREC = "D";
+CINFO(NumFunc).DIM = "O1Sz = I1Sz";
+CINFO(NumFunc).NOut = 1; +
+NumFunc = NumFunc + 1;
+
+FuncStruct(NumFunc) = FunctionName + ".M.C.F.CINFO";
+CINFO(NumFunc).CPROT = "MCF" + FunctionName + "MCF(*X, strideX, *Y, strideY, Nelements)"; +CINFO(NumFunc).SIZE = "M"; +CINFO(NumFunc).TYPE = "C"; +CINFO(NumFunc).PREC = "F";
+CINFO(NumFunc).DIM = "O1Sz = I1Sz";
+CINFO(NumFunc).NOut = 1; +
+NumFunc = NumFunc + 1;
+
+FuncStruct(NumFunc) = FunctionName + ".M.C.D.CINFO";
+CINFO(NumFunc).CPROT = "MCD" + FunctionName + "MCD(*X, strideX, *Y, strideY, Nelements)"; +CINFO(NumFunc).SIZE = "M"; +CINFO(NumFunc).TYPE = "C"; +CINFO(NumFunc).PREC = "D";
+CINFO(NumFunc).DIM = "O1Sz = I1Sz";
+CINFO(NumFunc).NOut = 1;
+endfunction diff --git a/src/Scilab2C/FunctionTableManagement/GetCFunCall.sci b/src/Scilab2C/FunctionTableManagement/GetCFunCall.sci new file mode 100644 index 00000000..2535e4ad --- /dev/null +++ b/src/Scilab2C/FunctionTableManagement/GetCFunCall.sci @@ -0,0 +1,48 @@ +function CFunCall = GetCFunCall(FunTree,FunName,InArg,OutArg); +// -----------------------------------------------------------------
+// Returns the C function call.
+//
+// FunTree is the name of the tree passed as string. Ex.: 'SCI2CLib'.
+// Status:
+// 06-Apr-2006 -- Nutricato Raffaele: Author.
+// -----------------------------------------------------------------
+
+// ------------
+// --- getf ---
+// ------------
+// ----------------
+// --- End getf ---
+// ----------------
+
+NInputs = size(InArg,1);
+NOutputs = size(OutArg,1);
+
+// Generate the string to access the tree.
+TreeAccessString = FunName;
+
+for counterinput = 1:NInputs
+ if prod(InArg(counterinput).Size) == 1
+ TreeAccessString = TreeAccessString+".S";
+ else
+ TreeAccessString = TreeAccessString+".A";
+ end
+
+ if InArg(counterinput).Type == "s"
+ TreeAccessString = TreeAccessString+".R.F";
+ elseif InArg(counterinput).Type == "d"
+ TreeAccessString = TreeAccessString+".R.D";
+ elseif InArg(counterinput).Type == "c"
+ TreeAccessString = TreeAccessString+".C.F";
+ elseif InArg(counterinput).Type == "z"
+ TreeAccessString = TreeAccessString+".C.D";
+ else
+ error("Unknown input argument type");
+ end
+end
+
+CFunName = FunTree+"."+TreeAccessString+".CINFO("+mtlb_num2str(NOutputs)+").NAME";
+CFunArgList = FunTree+"."+TreeAccessString+".CINFO("+mtlb_num2str(NOutputs)+").ARGLIST";
+
+CFunCall = [eval(CFunName),"(",eval(eval(CFunArgList)),")"];
+// CFunCall = [execstr(CFunName),"(",eval(eval(CFunArgList)),")"];
+endfunction diff --git a/src/Scilab2C/FunctionTableManagement/InitializeLibraries.sci b/src/Scilab2C/FunctionTableManagement/InitializeLibraries.sci index a2a71fab..6d62c816 100644 --- a/src/Scilab2C/FunctionTableManagement/InitializeLibraries.sci +++ b/src/Scilab2C/FunctionTableManagement/InitializeLibraries.sci @@ -36,22 +36,22 @@ disp('--> Adding the elementary functions to the SCI2C library tree.'); getf("AddElementaryFunction.sci");
SCI2CLib = AddElementaryFunction("sin",SCI2CLib);
SCI2CLib = AddElementaryFunction("cos",SCI2CLib);
-SCI2CLib = AddElementaryFunction("tan",SCI2CLib);
-SCI2CLib = AddElementaryFunction("cotg",SCI2CLib);
-SCI2CLib = AddElementaryFunction("asin",SCI2CLib);
-SCI2CLib = AddElementaryFunction("acos",SCI2CLib);
-SCI2CLib = AddElementaryFunction("sinh",SCI2CLib);
-SCI2CLib = AddElementaryFunction("cosh",SCI2CLib);
-SCI2CLib = AddElementaryFunction("tanh",SCI2CLib);
-SCI2CLib = AddElementaryFunction("asinh",SCI2CLib);
-SCI2CLib = AddElementaryFunction("acosh",SCI2CLib);
-SCI2CLib = AddElementaryFunction("atanh",SCI2CLib);
-SCI2CLib = AddElementaryFunction("exp",SCI2CLib);
-SCI2CLib = AddElementaryFunction("log",SCI2CLib);
-SCI2CLib = AddElementaryFunction("log10",SCI2CLib);
-SCI2CLib = AddElementaryFunction("abs",SCI2CLib);
-SCI2CLib = AddElementaryFunction("inv",SCI2CLib);
-SCI2CLib = AddElementaryFunction("sqrtR",SCI2CLib);
+// SCI2CLib = AddElementaryFunction("tan",SCI2CLib);
+// SCI2CLib = AddElementaryFunction("cotg",SCI2CLib);
+// SCI2CLib = AddElementaryFunction("asin",SCI2CLib);
+// SCI2CLib = AddElementaryFunction("acos",SCI2CLib);
+// SCI2CLib = AddElementaryFunction("sinh",SCI2CLib);
+// SCI2CLib = AddElementaryFunction("cosh",SCI2CLib);
+// SCI2CLib = AddElementaryFunction("tanh",SCI2CLib);
+// SCI2CLib = AddElementaryFunction("asinh",SCI2CLib);
+// SCI2CLib = AddElementaryFunction("acosh",SCI2CLib);
+// SCI2CLib = AddElementaryFunction("atanh",SCI2CLib);
+// SCI2CLib = AddElementaryFunction("exp",SCI2CLib);
+// SCI2CLib = AddElementaryFunction("log",SCI2CLib);
+// SCI2CLib = AddElementaryFunction("log10",SCI2CLib);
+// SCI2CLib = AddElementaryFunction("abs",SCI2CLib);
+// SCI2CLib = AddElementaryFunction("inv",SCI2CLib);
+// SCI2CLib = AddElementaryFunction("sqrtR",SCI2CLib);
// -------------------------------------------------------------------
// --- End add the elementary functions to the SCI2C library tree. ---
// -------------------------------------------------------------------
diff --git a/src/Scilab2C/FunctionTableManagement/Pass1ASTReader.txt b/src/Scilab2C/FunctionTableManagement/Pass1ASTReader.txt new file mode 100644 index 00000000..c235731b --- /dev/null +++ b/src/Scilab2C/FunctionTableManagement/Pass1ASTReader.txt @@ -0,0 +1,13 @@ +
+
+__temp1 = x * 2;
+__temp1 = 3 + __temp1;
+y = __temp1;
+
+Result = return(<empty>)
+
+zcoss
+zcoss
+zcoss
+zcosa
+zcosa
diff --git a/src/Scilab2C/FunctionTableManagement/SCI2CLib.dat b/src/Scilab2C/FunctionTableManagement/SCI2CLib.dat Binary files differnew file mode 100644 index 00000000..b8785bce --- /dev/null +++ b/src/Scilab2C/FunctionTableManagement/SCI2CLib.dat diff --git a/src/Scilab2C/FunctionTableManagement/USER2CLib.dat b/src/Scilab2C/FunctionTableManagement/USER2CLib.dat Binary files differnew file mode 100644 index 00000000..16818ee7 --- /dev/null +++ b/src/Scilab2C/FunctionTableManagement/USER2CLib.dat |