summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--demos/scilab2c.dem.gateway.sce2
-rw-r--r--demos/test_dct.dem.sce18
-rw-r--r--demos/test_idct.dem.sce18
-rw-r--r--macros/ASTManagement/%funcall_string.sci2
-rw-r--r--macros/ASTManagement/AST2Ccode.sci15
-rw-r--r--macros/ASTManagement/AST_HandleCC.sci14
-rw-r--r--macros/ASTManagement/AST_HandleEndGenFun.sci3
-rw-r--r--macros/ASTManagement/AST_HandleFunCC.sci81
-rw-r--r--macros/ASTManagement/AST_HandleFunRC.sci79
-rw-r--r--macros/ASTManagement/AST_HandleFuncArray.sci63
-rw-r--r--macros/ASTManagement/AST_HandleFuncArray2D.sci69
-rw-r--r--macros/ASTManagement/AST_HandleRC.sci52
-rw-r--r--macros/ASTManagement/AST_ParseIfExprStruct.sci2
-rw-r--r--macros/ASTManagement/AST_ParseOperStruct.sci1
-rw-r--r--macros/ASTManagement/_funcall_string.sci1
-rw-r--r--macros/ASTManagement/names2
-rw-r--r--macros/CCodeGeneration/C_GenDeclarations_Dup.sci7
-rw-r--r--macros/CCodeGeneration/C_IfExpression.sci1
-rw-r--r--macros/CCodeGeneration/C_WhileExpression.sci1
-rw-r--r--macros/FunctionAnnotation/FA_GetOutArgInfo.sci15
-rw-r--r--macros/SymbolTable/ST_GetInArgInfo.sci2
-rw-r--r--macros/SymbolTable/ST_InsOutArg_Dup.sci2
-rw-r--r--tests/unit_tests/test001_LinearRegression/scilabcode/mainfunction.sci2
-rw-r--r--tests/unit_tests/test01_DCT/scilabcode/main.sci7
-rw-r--r--tests/unit_tests/test02_IDCT/scilabcode/testidct.sci7
25 files changed, 356 insertions, 110 deletions
diff --git a/demos/scilab2c.dem.gateway.sce b/demos/scilab2c.dem.gateway.sce
index 011e474..bb5d4d8 100644
--- a/demos/scilab2c.dem.gateway.sce
+++ b/demos/scilab2c.dem.gateway.sce
@@ -18,6 +18,8 @@ subdemolist = ["Trigonometric Identity" , "TrigonometricIdentity.dem.sce";
"High Pass Filter", "Filter.dem.sce";
"Jacobi functions","Jacobi.dem.sce";
"Analog Filters","analogFilter.dem.sce";
+ "Discrete Cosine Transform" , "test_dct.dem.sce";
+ "Inverse Cosine Transform" , "test_idct.dem.sce";
"String Functions","string.dem.sce";
"Filter Responses","FilterResponse.dem.sce";
];
diff --git a/demos/test_dct.dem.sce b/demos/test_dct.dem.sce
new file mode 100644
index 0000000..b1b6247
--- /dev/null
+++ b/demos/test_dct.dem.sce
@@ -0,0 +1,18 @@
+//
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2010-2010 - 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
+// Author : Ukasha Noor
+//
+
+lines(0);
+
+global SCI2CHOME
+
+scilab2c(SCI2CHOME + "/tests/unit_tests/test01_DCT/scilabcode/main.sci", TMPDIR,SCI2CHOME + "/tests/unit_tests/test01_DCT/scilabcode");
+
diff --git a/demos/test_idct.dem.sce b/demos/test_idct.dem.sce
new file mode 100644
index 0000000..b1d3339
--- /dev/null
+++ b/demos/test_idct.dem.sce
@@ -0,0 +1,18 @@
+//
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2010-2010 - 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
+// Author : Ukasha Noor
+//
+
+lines(0);
+
+global SCI2CHOME
+
+scilab2c(SCI2CHOME + "/tests/unit_tests/test02_IDCT/scilabcode/testidct.sci", TMPDIR,SCI2CHOME + "/tests/unit_tests/test02_IDCT/scilabcode");
+
diff --git a/macros/ASTManagement/%funcall_string.sci b/macros/ASTManagement/%funcall_string.sci
index 0ee9701..fc4b929 100644
--- a/macros/ASTManagement/%funcall_string.sci
+++ b/macros/ASTManagement/%funcall_string.sci
@@ -5,6 +5,8 @@ function txt=%funcall_string(F)
// rhs : a list
// name : string, the name of the function
// lhsnb: number, the number of function lhs
+// Modified By: Ukasha Noor
+
if F.name <> 'disp'
txt=['Funcall : '+F.name
diff --git a/macros/ASTManagement/AST2Ccode.sci b/macros/ASTManagement/AST2Ccode.sci
index 6fe190e..516291a 100644
--- a/macros/ASTManagement/AST2Ccode.sci
+++ b/macros/ASTManagement/AST2Ccode.sci
@@ -11,6 +11,7 @@ function AST2Ccode(FileInfoDatFile)
//
// Status:
// 11-May-2007 -- Raffaele Nutricato: Author.
+// 15-June-2017 -- Ukasha Noor: Revised By
//
// Copyright 2007 Raffaele Nutricato.
// Contact: raffaele.nutricato@tiscali.it
@@ -64,6 +65,8 @@ STACKDEDUG = 0; // 1 -> Every Pop and Push operation on the stack, the stack con
global disp_isthere
disp_isthere = 0;
+
+FName = null
// -------------------------------------
// --- End parameter Initialization. ---
// -------------------------------------
@@ -144,8 +147,13 @@ while ~meof(fidAST)
case 'EndOperation' then
[disp_isthere,FileInfo,SharedInfo] = AST_HandleEndGenFun(disp_isthere,FileInfo,SharedInfo,'Operation');
case 'EndFuncall' then
+ if rc_count > 0 & cc_count == 0
+ [EqualInArgName,EqualInArgScope,EqualNInArg,FName] = AST_HandleFuncArray(FileInfo,SharedInfo);
+ elseif cc_count > 0
+ [EqualInArgName,EqualInArgScope,EqualNInArg,FName] = AST_HandleFuncArray2D(FileInfo,SharedInfo);
+ else
[disp_isthere,FileInfo,SharedInfo] = AST_HandleEndGenFun(disp_isthere,FileInfo,SharedInfo,'Funcall');
-
+ end
// --------------
// --- Equal. ---
// --------------
@@ -155,10 +163,10 @@ while ~meof(fidAST)
//NUT: ho miste ins e variabili, per esempio [c(1,1), a] = twooutfun();
//NUT: in questo caso solo una delle due equal va scartata.
if rc_count > 0 & cc_count == 0
- [FileInfo,SharedInfo] = AST_HandleFunRC(FileInfo,SharedInfo);
+ [FileInfo,SharedInfo] = AST_HandleFunRC(FName,FileInfo,SharedInfo);
rc_count = 0;
elseif cc_count > 0
- [FileInfo,SharedInfo] = AST_HandleFunCC(cc_count,FileInfo,SharedInfo);
+ [FileInfo,SharedInfo] = AST_HandleFunCC(FName,cc_count,FileInfo,SharedInfo);
rc_count = 0;
cc_count = 0;
else
@@ -168,6 +176,7 @@ while ~meof(fidAST)
end
end
disp_isthere = 0;
+ FName = null
case 'Equal' then
SharedInfo.Equal.Enabled = 1; // 1 means enabled -> we are inside an equal AST block.
diff --git a/macros/ASTManagement/AST_HandleCC.sci b/macros/ASTManagement/AST_HandleCC.sci
index cc41154..897a06f 100644
--- a/macros/ASTManagement/AST_HandleCC.sci
+++ b/macros/ASTManagement/AST_HandleCC.sci
@@ -8,7 +8,9 @@
// Author: Ukasha Noor
// Organization: FOSSEE, IIT Bombay
// Email: toolbox@scilab.in
-
+// This function is used for 2D array declaration
+// This function extracts the input arguments in the array and check there Name and Scope.
+// Then repush everything back to stack
function [RhsNames,RhsScope,NRhs] = AST_HandleCC(FileInfo,SharedInfo)
SCI2CNInArgCheck(argn(2),2,2)
@@ -56,14 +58,6 @@ for cntpush = cntpop:-1:1
end
-//for counterinputargs = 1:NRhs
- //#RNU_RES_B
- //disp(counterinputargs);
- //PrintStringInfo('Input Argument Number '+string(counterinputargs)+': '+RhsNames(counterinputargs).Name,...
- // ReportFileName,'file','y');
- //PrintStringInfo(' Scope: '+RhsNames(counterinputargs).Scope,...
- // ReportFileName,'file','y');
- //#RNU_RES_E
-//end
+
endfunction
diff --git a/macros/ASTManagement/AST_HandleEndGenFun.sci b/macros/ASTManagement/AST_HandleEndGenFun.sci
index 41caa2a..e191f10 100644
--- a/macros/ASTManagement/AST_HandleEndGenFun.sci
+++ b/macros/ASTManagement/AST_HandleEndGenFun.sci
@@ -1,4 +1,3 @@
-
function [disp_isthere,FileInfo,SharedInfo] = AST_HandleEndGenFun(disp_isthere,FileInfo,SharedInfo,ASTFunType)
// function [FileInfo,SharedInfo] = AST_HandleEndGenFun(FileInfo,SharedInfo,ASTFunType)
// -----------------------------------------------------------------
@@ -28,11 +27,13 @@ function [disp_isthere,FileInfo,SharedInfo] = AST_HandleEndGenFun(disp_isthere,F
//
// Status:
// 11-Apr-2007 -- Raffaele Nutricato: Author.
+// 15-June-2017 -- Ukasha Noor : Revised By
//
// Copyright 2007 Raffaele Nutricato.
// Contact: raffaele.nutricato@tiscali.it
// -----------------------------------------------------------------
+
// ------------------------------
// --- Check input arguments. ---
// ------------------------------
diff --git a/macros/ASTManagement/AST_HandleFunCC.sci b/macros/ASTManagement/AST_HandleFunCC.sci
index 1942c74..8669ad1 100644
--- a/macros/ASTManagement/AST_HandleFunCC.sci
+++ b/macros/ASTManagement/AST_HandleFunCC.sci
@@ -8,11 +8,14 @@
// Author: Ukasha Noor
// Organization: FOSSEE, IIT Bombay
// Email: toolbox@scilab.in
+// This function put the input elements of array in InArg and
+// output in OutArg from the stack.
+// Then finds the number of columns and rows in matrix and the type of matrix.
+// The call the function to generate the C code for declaration.
+function [FileInfo,SharedInfo] = AST_HandleFunCC(FName,NCol,FileInfo,SharedInfo)
-function [FileInfo,SharedInfo] = AST_HandleFunCC(NCol,FileInfo,SharedInfo)
-
-SCI2CNInArgCheck(argn(2),3,3)
+SCI2CNInArgCheck(argn(2),4,4)
// ------------------------------
// --- Check input arguments. ---
@@ -140,30 +143,56 @@ for i = 1:NInArg
end
-if com_type == 0
- PrintStringInfo(' Generating Out Arg names.',ReportFileName,'file','y');
- OutArg(1).Type = InArg(1).Type;
- OutArg(1).Size(1) = string(NCol);
- OutArg(1).Size(2) = string(NRow);
- OutArg(1).Dimension = 2;
- OutArg(1).Value = InArg(1).Value;
- OutArg(1).FindLike = InArg(1).FindLike;
-elseif com_type == 1
- PrintStringInfo(' Generating Out Arg names.',ReportFileName,'file','y');
- OutArg(1).Type = 'z';
- OutArg(1).Size(1) = string(NCol);
- OutArg(1).Size(2) = string(NRow);
- OutArg(1).Dimension = 2;
- OutArg(1).Value = InArg(1).Value;
- OutArg(1).FindLike = InArg(1).FindLike;
+if FName <> null
+ PrintStringInfo(' Generating Out Arg names.',ReportFileName,'file','y');
+ if FName == 'float'
+ OutArg(1).Type = 's';
+ elseif FName == 'uint8'
+ OutArg(1).Type = 'u8';
+ elseif FName == 'int16'
+ OutArg(1).Type = 'i16';
+ elseif FName == 'uint16'
+ OutArg(1).Type = 'u16';
+ elseif FName == 'int8'
+ OutArg(1).Type = 'i8';
+ elseif FName == 'uint32'
+ OutArg(1).Type = 'u32';
+ elseif FName == 'int32'
+ OutArg(1).Type = 'i32';
+ else
+ OutArg(1).Type = 'd';
+ end
+ OutArg(1).Size(1) = string(NCol);
+ OutArg(1).Size(2) = string(NRow);
+ OutArg(1).Dimension = 2;
+ OutArg(1).Value = InArg(1).Value;
+ OutArg(1).FindLike = InArg(1).FindLike;
else
- PrintStringInfo(' Generating Out Arg names.',ReportFileName,'file','y');
- OutArg(1).Type = 'c';
- OutArg(1).Size(1) = string(NCol);
- OutArg(1).Size(2) = string(NRow);
- OutArg(1).Dimension = 2;
- OutArg(1).Value = InArg(1).Value;
- OutArg(1).FindLike = InArg(1).FindLike;
+ if com_type == 0
+ PrintStringInfo(' Generating Out Arg names.',ReportFileName,'file','y');
+ OutArg(1).Type = InArg(1).Type;
+ OutArg(1).Size(1) = string(NCol);
+ OutArg(1).Size(2) = string(NRow);
+ OutArg(1).Dimension = 2;
+ OutArg(1).Value = InArg(1).Value;
+ OutArg(1).FindLike = InArg(1).FindLike;
+ elseif com_type == 1
+ PrintStringInfo(' Generating Out Arg names.',ReportFileName,'file','y');
+ OutArg(1).Type = 'z';
+ OutArg(1).Size(1) = string(NCol);
+ OutArg(1).Size(2) = string(NRow);
+ OutArg(1).Dimension = 2;
+ OutArg(1).Value = InArg(1).Value;
+ OutArg(1).FindLike = InArg(1).FindLike;
+ else
+ PrintStringInfo(' Generating Out Arg names.',ReportFileName,'file','y');
+ OutArg(1).Type = 'c';
+ OutArg(1).Size(1) = string(NCol);
+ OutArg(1).Size(2) = string(NRow);
+ OutArg(1).Dimension = 2;
+ OutArg(1).Value = InArg(1).Value;
+ OutArg(1).FindLike = InArg(1).FindLike;
+ end
end
//--- Check for output Argument in symbol table ---//
diff --git a/macros/ASTManagement/AST_HandleFunRC.sci b/macros/ASTManagement/AST_HandleFunRC.sci
index d316924..a5885d5 100644
--- a/macros/ASTManagement/AST_HandleFunRC.sci
+++ b/macros/ASTManagement/AST_HandleFunRC.sci
@@ -8,10 +8,13 @@
// Author: Ukasha Noor
// Organization: FOSSEE, IIT Bombay
// Email: toolbox@scilab.in
+// This function is used for 1D array declaration.
+// Checks the input and output argumnets and put them in respective variables.
+// Then calls the function to generate the C code for 1D array declaration.
-function [FileInfo,SharedInfo] = AST_HandleFunRC(FileInfo,SharedInfo)
+function [FileInfo,SharedInfo] = AST_HandleFunRC(FName,FileInfo,SharedInfo)
-SCI2CNInArgCheck(argn(2),2,2)
+SCI2CNInArgCheck(argn(2),3,3)
// ------------------------------
// --- Check input arguments. ---
@@ -142,30 +145,56 @@ for i = 1:NInArg
end
-if com_type == 0
- PrintStringInfo(' Generating Out Arg names.',ReportFileName,'file','y');
- OutArg(1).Type = InArg(1).Type;
- OutArg(1).Size(1) = '1'
- OutArg(1).Size(2) = string(size_count);
- OutArg(1).Dimension = 2;
- OutArg(1).Value = InArg(1).Value;
- OutArg(1).FindLike = InArg(1).FindLike;
-elseif com_type == 1
- PrintStringInfo(' Generating Out Arg names.',ReportFileName,'file','y');
- OutArg(1).Type = 'z';
- OutArg(1).Size(1) = '1'
- OutArg(1).Size(2) = string(size_count);
- OutArg(1).Dimension = 2;
- OutArg(1).Value = InArg(1).Value;
- OutArg(1).FindLike = InArg(1).FindLike;
+if FName <> null
+ PrintStringInfo(' Generating Out Arg names.',ReportFileName,'file','y');
+ if FName == 'float'
+ OutArg(1).Type = 's';
+ elseif FName == 'uint8'
+ OutArg(1).Type = 'u8';
+ elseif FName == 'int16'
+ OutArg(1).Type = 'i16';
+ elseif FName == 'uint16'
+ OutArg(1).Type = 'u16';
+ elseif FName == 'int8'
+ OutArg(1).Type = 'i8';
+ elseif FName == 'uint32'
+ OutArg(1).Type = 'u32';
+ elseif FName == 'int32'
+ OutArg(1).Type = 'i32';
+ else
+ OutArg(1).Type = 'd';
+ end
+ OutArg(1).Size(1) = '1'
+ OutArg(1).Size(2) = string(size_count);
+ OutArg(1).Dimension = 2;
+ OutArg(1).Value = InArg(1).Value;
+ OutArg(1).FindLike = InArg(1).FindLike;
else
- PrintStringInfo(' Generating Out Arg names.',ReportFileName,'file','y');
- OutArg(1).Type = 'c';
- OutArg(1).Size(1) = '1'
- OutArg(1).Size(2) = string(size_count);
- OutArg(1).Dimension = 2;
- OutArg(1).Value = InArg(1).Value;
- OutArg(1).FindLike = InArg(1).FindLike;
+ if com_type == 0
+ PrintStringInfo(' Generating Out Arg names.',ReportFileName,'file','y');
+ OutArg(1).Type = InArg(1).Type;
+ OutArg(1).Size(1) = '1'
+ OutArg(1).Size(2) = string(size_count);
+ OutArg(1).Dimension = 2;
+ OutArg(1).Value = InArg(1).Value;
+ OutArg(1).FindLike = InArg(1).FindLike;
+ elseif com_type == 1
+ PrintStringInfo(' Generating Out Arg names.',ReportFileName,'file','y');
+ OutArg(1).Type = 'z';
+ OutArg(1).Size(1) = '1'
+ OutArg(1).Size(2) = string(size_count);
+ OutArg(1).Dimension = 2;
+ OutArg(1).Value = InArg(1).Value;
+ OutArg(1).FindLike = InArg(1).FindLike;
+ else
+ PrintStringInfo(' Generating Out Arg names.',ReportFileName,'file','y');
+ OutArg(1).Type = 'c';
+ OutArg(1).Size(1) = '1'
+ OutArg(1).Size(2) = string(size_count);
+ OutArg(1).Dimension = 2;
+ OutArg(1).Value = InArg(1).Value;
+ OutArg(1).FindLike = InArg(1).FindLike;
+ end
end
//--- Check for output Argument in symbol table ---//
diff --git a/macros/ASTManagement/AST_HandleFuncArray.sci b/macros/ASTManagement/AST_HandleFuncArray.sci
new file mode 100644
index 0000000..364e305
--- /dev/null
+++ b/macros/ASTManagement/AST_HandleFuncArray.sci
@@ -0,0 +1,63 @@
+function [RhsNames,RhsScope,NRhs,FName] = AST_HandleFuncArray(FileInfo,SharedInfo)
+// Copyright (C) 2017 - IIT Bombay - FOSSEE
+
+// 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
+// Author: Ukasha Noor
+// Organization: FOSSEE, IIT Bombay
+// Email: toolbox@scilab.in
+// This function is used for 1D array declaration.
+
+SCI2CNInArgCheck(argn(2),2,2)
+
+ReportFileName = FileInfo.Funct(nxtscifunnumber).ReportFileName;
+
+// ------------------------------
+// --- Check input arguments. ---
+// ------------------------------
+
+
+global SCI2CSTACK
+global StackPosition;
+global STACKDEDUG
+// ---------------------------
+// --- End Initialization. ---
+// ---------------------------
+
+
+// ------------------------------
+// --- Read input parameters. ---
+// ------------------------------
+cntpop = 1;
+NRhs = 0;
+RhsField(cntpop) = AST_PopASTStack();
+RhsNames = [];
+while (RhsField(cntpop) ~= 'Rhs :')
+ NRhs = NRhs + 1;
+ if RhsField(cntpop) <> 'Operands:'
+ [RhsNames(NRhs),RhsScope(NRhs)] = AST_ExtractNameAndScope(RhsField(cntpop));
+ end
+ cntpop = cntpop + 1;
+ RhsField(cntpop) = AST_PopASTStack();
+end
+first = AST_PopASTStack();
+second = AST_PopASTStack();
+
+FName = stripblanks(part(second,12:length(second)));
+
+RhsNames = SCI2Cflipud(RhsNames);
+RhsScope = SCI2Cflipud(RhsScope);
+
+// --- Repush everything into the stack. ---
+for cntpush = cntpop:-1:1
+ if RhsField(cntpush) <> 'Operands:' & RhsField(cntpush) <> 'Rhs :'
+ AST_PushASTStack(RhsField(cntpush));
+ end
+end
+
+
+
+endfunction
diff --git a/macros/ASTManagement/AST_HandleFuncArray2D.sci b/macros/ASTManagement/AST_HandleFuncArray2D.sci
new file mode 100644
index 0000000..859c994
--- /dev/null
+++ b/macros/ASTManagement/AST_HandleFuncArray2D.sci
@@ -0,0 +1,69 @@
+// Copyright (C) 2017 - IIT Bombay - FOSSEE
+
+// 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
+// Author: Ukasha Noor
+// Organization: FOSSEE, IIT Bombay
+// Email: toolbox@scilab.in
+// This function is used for 2D array declaration
+// This function extracts the input arguments in the array and check there Name and Scope.
+// Then repush everything back to stack
+function [RhsNames,RhsScope,NRhs,FName] = AST_HandleFuncArray2D(FileInfo,SharedInfo)
+
+SCI2CNInArgCheck(argn(2),2,2)
+
+ReportFileName = FileInfo.Funct(nxtscifunnumber).ReportFileName;
+
+// ------------------------------
+// --- Check input arguments. ---
+// ------------------------------
+
+
+global SCI2CSTACK
+global StackPosition;
+global STACKDEDUG
+// ---------------------------
+// --- End Initialization. ---
+// ---------------------------
+
+
+// ------------------------------
+// --- Read input parameters. ---
+// ------------------------------
+cntpop = 1;
+NRhs = 0;
+RhsField(cntpop) = AST_PopASTStack();
+RhsNames = [];
+while (RhsField(cntpop) ~= 'Rhs :')
+ if RhsField(cntpop) <> 'Operands:' & RhsField(cntpop) <> 'Begin:'
+ NRhs = NRhs + 1;
+
+ [RhsNames(NRhs),RhsScope(NRhs)] = AST_ExtractNameAndScope(RhsField(cntpop));
+ end
+ cntpop = cntpop + 1;
+ RhsField(cntpop) = AST_PopASTStack();
+end
+
+first = AST_PopASTStack();
+second = AST_PopASTStack();
+
+FName = stripblanks(part(second,12:length(second)));
+
+RhsNames = SCI2Cflipud(RhsNames);
+RhsScope = SCI2Cflipud(RhsScope);
+
+// --- Repush everything into the stack. ---
+for cntpush = cntpop:-1:1
+ if RhsField(cntpush) <> 'Operands:' & RhsField(cntpush) <> 'Begin:' & RhsField(cntpush) <> 'Rhs :'
+ PrintStringInfo(' ' + RhsField(cntpush),ReportFileName,'file','y');
+ AST_PushASTStack(RhsField(cntpush));
+ end
+end
+
+
+
+
+endfunction
diff --git a/macros/ASTManagement/AST_HandleRC.sci b/macros/ASTManagement/AST_HandleRC.sci
index 2a6cbc3..7056861 100644
--- a/macros/ASTManagement/AST_HandleRC.sci
+++ b/macros/ASTManagement/AST_HandleRC.sci
@@ -1,36 +1,15 @@
function [RhsNames,RhsScope,NRhs] = AST_HandleRC(FileInfo,SharedInfo)
-// function [FileInfo,SharedInfo] = AST_HandleEndGenFun(FileInfo,SharedInfo,ASTFunType)
-// -----------------------------------------------------------------
-// #RNU_RES_B
-// Handles the EndFuncall, EndOperation and EndEqual tags of the AST.
-// ASTFunType can be 'Funcall', 'Operation', 'Equal'
-// Structure of Funcall:
-// overloading function for "funcall" type tlist string function
-// this is a node of the AST
-// fields:
-// rhs : a list
-// name : string, the name of the function
-// lhsnb: number, the number of function lhs
-// txt=['Funcall : '+F.name
-// ' #lhs : '+string(F.lhsnb)
-// ' Rhs : '
-// ' '+objectlist2string(F.rhs)
-// 'EndFuncall'
-// ]
-// #RNU_RES_E
-//
-// Input data:
-// //NUT: add description here
-//
-// Output data:
-// //NUT: add description here
-//
-// Status:
-// 11-Apr-2007 -- Raffaele Nutricato: Author.
-//
-// Copyright 2007 Raffaele Nutricato.
-// Contact: raffaele.nutricato@tiscali.it
-// -----------------------------------------------------------------
+// Copyright (C) 2017 - IIT Bombay - FOSSEE
+
+// 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
+// Author: Ukasha Noor
+// Organization: FOSSEE, IIT Bombay
+// Email: toolbox@scilab.in
+// This function is used for 1D array declaration.
SCI2CNInArgCheck(argn(2),2,2)
@@ -75,14 +54,5 @@ for cntpush = cntpop:-1:1
end
-//for counterinputargs = 1:NRhs
- //#RNU_RES_B
- //disp(counterinputargs);
- // PrintStringInfo('Input Argument Number '+string(counterinputargs)+': '+RhsNames(counterinputargs).Name,...
- // ReportFileName,'file','y');
- //PrintStringInfo(' Scope: '+RhsNames(counterinputargs).Scope,...
- // ReportFileName,'file','y');
- //#RNU_RES_E
-//end
endfunction
diff --git a/macros/ASTManagement/AST_ParseIfExprStruct.sci b/macros/ASTManagement/AST_ParseIfExprStruct.sci
index 2bfb08d..88ba2e9 100644
--- a/macros/ASTManagement/AST_ParseIfExprStruct.sci
+++ b/macros/ASTManagement/AST_ParseIfExprStruct.sci
@@ -31,6 +31,8 @@ function [IfCondArg,NIfCondArg,Op,NOp] = AST_ParseIfExprStruct(FileInfo,SharedIn
//
// Status:
// 11-Apr-2007 -- Raffaele Nutricato: Author.
+// 25-June-2017 -- Ukasha Noor: Revised By
+// This function is counting the number of logical operators and there operands.
//
// Copyright 2007 Raffaele Nutricato.
// Contact: raffaele.nutricato@tiscali.it
diff --git a/macros/ASTManagement/AST_ParseOperStruct.sci b/macros/ASTManagement/AST_ParseOperStruct.sci
index 903f095..ce0bcc7 100644
--- a/macros/ASTManagement/AST_ParseOperStruct.sci
+++ b/macros/ASTManagement/AST_ParseOperStruct.sci
@@ -26,6 +26,7 @@ function [FunctionName,InArg,NInArg,NOutArg] = AST_ParseOperStruct(FileInfo,Shar
//
// Status:
// 11-Apr-2007 -- Raffaele Nutricato: Author.
+// 25-June-2017 -- Ukasha Noor: Revised By
//
// Copyright 2007 Raffaele Nutricato.
// Contact: raffaele.nutricato@tiscali.it
diff --git a/macros/ASTManagement/_funcall_string.sci b/macros/ASTManagement/_funcall_string.sci
index 0ee9701..7c0b0ab 100644
--- a/macros/ASTManagement/_funcall_string.sci
+++ b/macros/ASTManagement/_funcall_string.sci
@@ -5,6 +5,7 @@ function txt=%funcall_string(F)
// rhs : a list
// name : string, the name of the function
// lhsnb: number, the number of function lhs
+// Modified By: Ukasha Noor
if F.name <> 'disp'
txt=['Funcall : '+F.name
diff --git a/macros/ASTManagement/names b/macros/ASTManagement/names
index 6deb883..9ba83f7 100644
--- a/macros/ASTManagement/names
+++ b/macros/ASTManagement/names
@@ -31,6 +31,8 @@ AST_HandleFor
AST_HandleForStatem
AST_HandleFunCC
AST_HandleFunRC
+AST_HandleFuncArray
+AST_HandleFuncArray2D
AST_HandleHeader
AST_HandleIfElse
AST_HandleRC
diff --git a/macros/CCodeGeneration/C_GenDeclarations_Dup.sci b/macros/CCodeGeneration/C_GenDeclarations_Dup.sci
index 475e2e0..bdaf9c0 100644
--- a/macros/CCodeGeneration/C_GenDeclarations_Dup.sci
+++ b/macros/CCodeGeneration/C_GenDeclarations_Dup.sci
@@ -11,6 +11,10 @@ function Cdeclaration = C_GenDeclarations_Dup(InArg,NInArg,com_type,ArgStruct,CD
//
// Status:
// 27-Oct-2007 -- Raffaele Nutricato: Author.
+//
+// 25-June-2017 -- Ukasha Noor: Modified it.
+// This function is called for array declaration in C.
+//
// 10-Jun-2008 -- Raffaele Nutricato: adapted to work with realloc function.
//
// Copyright 2007 Raffaele Nutricato.
@@ -84,6 +88,9 @@ if (ArgStruct.Dimension > 0)
computedSize = computedSize + ' * ' + ArgStruct.Size(sizeIterator);
computedSizeField = computedSizeField + ', ' + ArgStruct.Size(sizeIterator);
end
+// Modified Changes: row tells number of rows and col is number of columns in array.
+// col_type tells whether it is floatComplex or doubleComplex or real.
+// and accordingly it declares the array.
Cdeclaration(1) = Cdeclaration(1)+C_Type(ArgStruct.Type)+' '+ArgStruct.Name+'['+computedSize+']={';
row = eval(ArgStruct.Size(1))
col = eval(ArgStruct.Size(2))
diff --git a/macros/CCodeGeneration/C_IfExpression.sci b/macros/CCodeGeneration/C_IfExpression.sci
index 359b788..630134e 100644
--- a/macros/CCodeGeneration/C_IfExpression.sci
+++ b/macros/CCodeGeneration/C_IfExpression.sci
@@ -11,6 +11,7 @@ function SharedInfo = C_IfExpression(IfCondArg,NIfCondArg,Op,NOp,ASTIfExpType,Fi
//
// Status:
// 27-Oct-2007 -- Raffaele Nutricato: Author.
+// 28-June-2017 -- Ukasha Noor: Modified By
//
// Copyright 2007 Raffaele Nutricato.
// Contact: raffaele.nutricato@tiscali.it
diff --git a/macros/CCodeGeneration/C_WhileExpression.sci b/macros/CCodeGeneration/C_WhileExpression.sci
index 368ccff..36fcc4f 100644
--- a/macros/CCodeGeneration/C_WhileExpression.sci
+++ b/macros/CCodeGeneration/C_WhileExpression.sci
@@ -11,6 +11,7 @@ function SharedInfo = C_WhileExpression(IfCondArg,NIfCondArg,Op,NOp,FileInfo,Sha
//
// Status:
// 15-Nov-2007 -- Raffaele Nutricato: Author.
+// 27-June-2017 -- Ukasha Noor: Modified by
//
// Copyright 2007 Raffaele Nutricato.
// Contact: raffaele.nutricato@tiscali.it
diff --git a/macros/FunctionAnnotation/FA_GetOutArgInfo.sci b/macros/FunctionAnnotation/FA_GetOutArgInfo.sci
index 99eaaa5..4d1113e 100644
--- a/macros/FunctionAnnotation/FA_GetOutArgInfo.sci
+++ b/macros/FunctionAnnotation/FA_GetOutArgInfo.sci
@@ -29,6 +29,7 @@ SCI2CNInArgCheck(argn(2),10,10);
// --- Initialization. ---
// -----------------------
+
UpdatedOutArg = OutArg;
for cntin = 1:NInArg
IN(cntin).TP = InArg(cntin).Type;
@@ -101,7 +102,19 @@ for counterout = 1:NOutArg
// This is a dynamic memory extension of a local variable and for the moment
// we issue an error according to SCI2C specifications
// #RNU_RES_E
- //disp(FunSizeAnnot)
+ //disp(FunSizeAnnot(2),FunSizeAnnot(1))
+ //Ukasha
+// if ASTFunName == svd
+// x=1;
+// for i=1:InArg(1).Size(1)
+// for j=1:InArg(1).Size(2)
+// A(i)(j)=InArg(1).Value(x);
+// end
+// end
+// [U,S,V]=svd(A,"e");
+
+
+
for iterOutputPosition=1:size(FunSizeAnnot, 'c')
tmpeval = eval(FunSizeAnnot(counterout, iterOutputPosition));
if (IsNanSize(tmpeval))
diff --git a/macros/SymbolTable/ST_GetInArgInfo.sci b/macros/SymbolTable/ST_GetInArgInfo.sci
index 4c85408..69885dd 100644
--- a/macros/SymbolTable/ST_GetInArgInfo.sci
+++ b/macros/SymbolTable/ST_GetInArgInfo.sci
@@ -210,7 +210,7 @@ for cntinarg = 1:NInArg
PrintStringInfo(' Type: '+UpdatedInArg(cntinarg).Type,FileInfo.Funct(nxtscifunnumber).ReportFileName,'file');
PrintStringInfo(' Size(1): '+string(UpdatedInArg(cntinarg).Size(1)),FileInfo.Funct(nxtscifunnumber).ReportFileName,'file');
PrintStringInfo(' Size(2): '+string(UpdatedInArg(cntinarg).Size(2)),FileInfo.Funct(nxtscifunnumber).ReportFileName,'file');
- PrintStringInfo(' Value: '+string(UpdatedInArg(cntinarg).Value),FileInfo.Funct(nxtscifunnumber).ReportFileName,'file');
+ //PrintStringInfo(' Value: '+string(UpdatedInArg(cntinarg).Value),FileInfo.Funct(nxtscifunnumber).ReportFileName,'file');
PrintStringInfo(' FindLike: '+string(UpdatedInArg(cntinarg).FindLike),FileInfo.Funct(nxtscifunnumber).ReportFileName,'file');
PrintStringInfo(' Dimension: '+string(UpdatedInArg(cntinarg).Dimension),FileInfo.Funct(nxtscifunnumber).ReportFileName,'file');
PrintStringInfo(' Scope: '+UpdatedInArg(cntinarg).Scope,FileInfo.Funct(nxtscifunnumber).ReportFileName,'file');
diff --git a/macros/SymbolTable/ST_InsOutArg_Dup.sci b/macros/SymbolTable/ST_InsOutArg_Dup.sci
index bca6623..67554bd 100644
--- a/macros/SymbolTable/ST_InsOutArg_Dup.sci
+++ b/macros/SymbolTable/ST_InsOutArg_Dup.sci
@@ -175,7 +175,7 @@ for counteroutput = 1:NOutArg
ST_Set(OutArg(counteroutput).Name,...
OutArg(counteroutput).Type,...
TmpOutArgSize,...
- OutArg(counteroutput).Value,...
+ InArg,...
OutArg(counteroutput).FindLike,...
OutArg(counteroutput).Dimension,...
SymbTableFileName);
diff --git a/tests/unit_tests/test001_LinearRegression/scilabcode/mainfunction.sci b/tests/unit_tests/test001_LinearRegression/scilabcode/mainfunction.sci
index 13624cf..c6e09a0 100644
--- a/tests/unit_tests/test001_LinearRegression/scilabcode/mainfunction.sci
+++ b/tests/unit_tests/test001_LinearRegression/scilabcode/mainfunction.sci
@@ -1,4 +1,4 @@
-//SCI2C: DEFAULT_PRECISION= DOUBLE
+//SCI2C: DEFAULT_PRECISION= FLOAT
function mainfunction()
diff --git a/tests/unit_tests/test01_DCT/scilabcode/main.sci b/tests/unit_tests/test01_DCT/scilabcode/main.sci
new file mode 100644
index 0000000..33c4462
--- /dev/null
+++ b/tests/unit_tests/test01_DCT/scilabcode/main.sci
@@ -0,0 +1,7 @@
+//SCI2C: DEFAULT_PRECISION= FLOAT
+//test for discrete cosine tranform using precision as float
+function main()
+ b=([5 2 6 7;1 9 7 6+%i])
+ y=dct(b,1) //calling dct
+ disp(y)
+endfunction
diff --git a/tests/unit_tests/test02_IDCT/scilabcode/testidct.sci b/tests/unit_tests/test02_IDCT/scilabcode/testidct.sci
new file mode 100644
index 0000000..deed0f9
--- /dev/null
+++ b/tests/unit_tests/test02_IDCT/scilabcode/testidct.sci
@@ -0,0 +1,7 @@
+//SCI2C: DEFAULT_PRECISION= FLOAT
+//test for inverse discrete cosine tranfrom
+function testidct()
+ b=[1 2 3;4 5 6+%i] //declaring complex matrix
+ y=idct(b) //calling idct
+ disp(y)
+endfunction