diff options
70 files changed, 2318 insertions, 111 deletions
diff --git a/2.3-1/includes/sci2clib.h b/2.3-1/includes/sci2clib.h index 55b6a349..f662325c 100644 --- a/2.3-1/includes/sci2clib.h +++ b/2.3-1/includes/sci2clib.h @@ -65,8 +65,22 @@ extern "C" { #include "rand.h" #include "int_rand.h" +/* INTERPOLATION FUNCTIONS*/ + +/*interfacing interp1*/ +#include "interp1.h" +#include "int_interp1.h" + /* ELEMENTARY FUNCTIONS */ +#include "nextpow2.h" +#include "int_nextpow2.h" +/*interfacing gcd*/ +#include "gcd.h" +#include "int_gcd.h" +/* interfacing isreal*/ +#include "isreal.h" +#include "int_isreal.h" /* interfacing atand */ #include "atand.h" #include "int_atand.h" @@ -412,6 +426,18 @@ extern "C" { #include "norm.h" /* SIGNAL PROCESSING */ + + +#include "modk.h" +#include "int_modk.h" +/* interfacing idct */ +#include "idct.h" +#include "int_idct.h" + +/* interfacing dct */ +#include "dct.h" +#include "int_dct.h" + /* interfacing convol */ #include "conv.h" #include "conv2d.h" diff --git a/2.3-1/macros/ASTManagement/%equal_string.sci b/2.3-1/macros/ASTManagement/%equal_string.sci index 9678f0e0..041fb84a 100644 --- a/2.3-1/macros/ASTManagement/%equal_string.sci +++ b/2.3-1/macros/ASTManagement/%equal_string.sci @@ -13,4 +13,4 @@ function txt=%equal_string(e) ' '+objectlist2string(e.lhs) 'EndEqual' ] -endfunction
\ No newline at end of file +endfunction diff --git a/2.3-1/macros/ASTManagement/%operatio_string.sci b/2.3-1/macros/ASTManagement/%operatio_string.sci index 8421a3f4..c0ecb478 100644 --- a/2.3-1/macros/ASTManagement/%operatio_string.sci +++ b/2.3-1/macros/ASTManagement/%operatio_string.sci @@ -4,10 +4,17 @@ function txt=%operatio_string(O) //fields: // operands: a list // operator: a string +if O.operator <> 'rc' txt=['Operation' ' Operands:' ' '+objectlist2string(O.operands) ' Operator: '+O.operator 'EndOperation' ] -endfunction
\ No newline at end of file +else + txt=[' Operands:' + ' '+objectlist2string(O.operands) + 'Endrc' + ] +end +endfunction diff --git a/2.3-1/macros/ASTManagement/AST2Ccode.sci b/2.3-1/macros/ASTManagement/AST2Ccode.sci index e3177be8..af07c5f1 100644 --- a/2.3-1/macros/ASTManagement/AST2Ccode.sci +++ b/2.3-1/macros/ASTManagement/AST2Ccode.sci @@ -46,6 +46,9 @@ ReportFileName = FileInfo.Funct(nxtscifunnumber).ReportFileName; // --------------------------------- // --- Parameter Initialization. --- // --------------------------------- +global rc_count +rc_count = 0; + global SCI2CSTACK SCI2CSTACK = ['EMPTYSTACK']; @@ -144,25 +147,45 @@ while ~meof(fidAST) //NUT: per fare in modo di coprire le ins, anche se ci puo' essere qualche rischio quando //NUT: ho miste ins e variabili, per esempio [c(1,1), a] = twooutfun(); //NUT: in questo caso solo una delle due equal va scartata. - [FileInfo,SharedInfo] = AST_HandleEndGenFun(FileInfo,SharedInfo,'Equal'); - SharedInfo = INIT_SharedInfoEqual(SharedInfo); + if rc_count > 0 + [FileInfo,SharedInfo] = AST_HandleFunRC(FileInfo,SharedInfo); + else + [FileInfo,SharedInfo] = AST_HandleEndGenFun(FileInfo,SharedInfo,'Equal'); + SharedInfo = INIT_SharedInfoEqual(SharedInfo); + end case 'Equal' then SharedInfo.Equal.Enabled = 1; // 1 means enabled -> we are inside an equal AST block. AST_PushASTStack(treeline); case 'Lhs :' then - SharedInfo.Equal.Lhs = 1; // 1 means that we are inside the Lhs block of the Equal - [EqualInArgName,EqualInArgScope,EqualNInArg] = AST_ReadEqualRhsNames(FileInfo,SharedInfo); - - // lengthNumber = length('Number_'); - // if (part(EqualInArgScope,1:lengthNumber) == 'Number_') - // SharedInfo.SkipNextEqual = 1 - // end - SharedInfo.Equal.NInArg = EqualNInArg; - for tmpcnt = 1:SharedInfo.Equal.NInArg - SharedInfo.Equal.InArg(tmpcnt).Name = EqualInArgName(tmpcnt); - SharedInfo.Equal.InArg(tmpcnt).Scope = EqualInArgScope(tmpcnt); - end - AST_PushASTStack(treeline); + disp(rc_count); + if rc_count > 0 + SharedInfo.Equal.Lhs = 1; + [EqualInArgName,EqualInArgScope,EqualNInArg] = AST_HandleRC(FileInfo,SharedInfo); + SharedInfo.Equal.NInArg = EqualNInArg; + AST_PushASTStack(treeline); + for tmpcnt = 1:SharedInfo.Equal.NInArg + SharedInfo.Equal.InArg(tmpcnt).Name = EqualInArgName(tmpcnt); + SharedInfo.Equal.InArg(tmpcnt).Scope = EqualInArgScope(tmpcnt); + end + else + SharedInfo.Equal.Lhs = 1; // 1 means that we are inside the Lhs block of the Equal + //if SharedInfo.Equal.NOutArg > 0 + [EqualInArgName,EqualInArgScope,EqualNInArg] = AST_ReadEqualRhsNames(FileInfo,SharedInfo); + SharedInfo.Equal.NInArg = EqualNInArg; + //end + + // lengthNumber = length('Number_'); + // if (part(EqualInArgScope,1:lengthNumber) == 'Number_') + // SharedInfo.SkipNextEqual = 1 + // end + + for tmpcnt = 1:SharedInfo.Equal.NInArg + SharedInfo.Equal.InArg(tmpcnt).Name = EqualInArgName(tmpcnt); + SharedInfo.Equal.InArg(tmpcnt).Scope = EqualInArgScope(tmpcnt); + end + //end + AST_PushASTStack(treeline); + end // ---------------- // --- If/Else. --- @@ -229,6 +252,11 @@ while ~meof(fidAST) SharedInfo = AST_HandleEndWhile(FileInfo,SharedInfo); SharedInfo.While.Level = SharedInfo.While.Level - 1; + + case 'Endrc' then + rc_count = rc_count + 1; + //[FileInfo,SharedInfo] = AST_HandleRC(FileInfo,SharedInfo); + // ---------------- // --- Default. --- // ---------------- diff --git a/2.3-1/macros/ASTManagement/AST_HandleEndGenFun.sci b/2.3-1/macros/ASTManagement/AST_HandleEndGenFun.sci index 65446679..57c0c5ee 100644 --- a/2.3-1/macros/ASTManagement/AST_HandleEndGenFun.sci +++ b/2.3-1/macros/ASTManagement/AST_HandleEndGenFun.sci @@ -73,6 +73,14 @@ global STACKDEDUG // #RNU_RES_E [ASTFunName,InArg,NInArg,OutArg,NOutArg] = AST_GetFuncallPrm(FileInfo,SharedInfo,ASTFunType); NOutArg_mod = NOutArg + if ASTFunName == 'OpLogAnd' + AST_PushASTStack('&&'); + return ; + end + if ASTFunName == 'OpLogOr' + AST_PushASTStack('||'); + return; + end if(mtlb_strcmp(part(ASTFunName,1:2),'CV') == %T) SharedInfo.OpenCVUsed = %T; end @@ -119,6 +127,9 @@ NOutArg_mod = NOutArg // --- Read the function annotations. --- // -------------------------------------- // #RNU_RES_E + if ASTFunName == '%k' + ASTFunName='modk'; + end if (ASTFunName == 'OpEqual') FunTypeAnnot = ''; @@ -132,6 +143,7 @@ NOutArg_mod = NOutArg // --- Search for Equal Lhs and precision specifier to be applied to the current function. --- // ------------------------------------------------------------------------------------------- // #RNU_RES_E + PrintStringInfo(' no of out arguments' + string(NOutArg),ReportFileName,'file','y'); [LhsArg,NLhsArg,FunPrecSpecifier,SharedInfo] = AST_GetPrecAndLhsArg(OutArg,NOutArg,ASTFunName,FunTypeAnnot,FunSizeAnnot,ASTFunType,FileInfo,SharedInfo); //NUT: questa funzione contiene troppi parametri e mi sembra disordinata. @@ -329,8 +341,13 @@ NOutArg_mod = NOutArg OutArg(1).Name = string(OutArg(1).Value); elseif ((ASTFunName == 'double') & (NInArg == 1) & (InArg(1).Dimension == 0) & (InArg(1).Scope == 'Number')) OutArg(1).Name = string(OutArg(1).Value); + //elseif ASTFunName == 'disp' else [OutArg,SharedInfo] = GenOutArgNames(ASTFunName,InArg,NInArg,OutArg,NOutArg,LhsArg,NLhsArg,FileInfo,SharedInfo); + if ( ASTFunName == 'OpLogGt' | ASTFunName == 'OpLogLt' | ASTFunName == 'OpLogLe' | ASTFunName == 'OpLogGe' | ASTFunName == 'OpLogNe' | ASTFunName == 'OpLogEq') + PrintStringInfo(' returning back due logical function',ReportFileName,'file','y'); + return; + end end if ((ASTFunName == 'uint8') & (NInArg == 1) & (InArg(1).Dimension == 0) & (InArg(1).Scope == 'Number')) @@ -374,6 +391,8 @@ NOutArg_mod = NOutArg // Scope already set above. elseif (ASTFunName == 'double' & NInArg == 1 & (InArg(1).Dimension == 0) & (InArg(1).Scope == 'Number')) // Scope already set above. + //elseif ASTFunName == 'disp' + //do nothing else OutArg = ST_AnalyzeScope(OutArg,NOutArg,FileInfo,SharedInfo); end @@ -392,6 +411,8 @@ NOutArg_mod = NOutArg //#RNUREM_ME A number is not inserted in the symbol table. elseif ((ASTFunName == 'double') & (NInArg == 1) & (InArg(1).Dimension == 0) & (InArg(1).Scope == 'Number')) //#RNUREM_ME A number is not inserted in the symbol table. + //elseif ASTFunName == 'disp' + //do nothing else ST_InsOutArg(OutArg,NOutArg,FileInfo,SharedInfo,'all'); end @@ -424,8 +445,9 @@ NOutArg_mod = NOutArg // -------------------------------------------- //#RNU_RES_E //disp(OutArg,InArg,ASTFunName) + CFunName = C_GenerateFunName(ASTFunName,InArg,NInArg,OutArg,NOutArg_mod); - + //#RNU_RES_B PrintStringInfo(' C Function Name: '+CFunName,ReportFileName,'file','y'); if(IsArduinoFunction(ASTFunName)) @@ -497,6 +519,8 @@ NOutArg_mod = NOutArg SharedInfo.SkipNextFun > 0 | ... ((sum(mtlb_strcmp(ASTFunName,SharedInfo.Annotations.DataPrec)) > 0) & (SharedInfo.SkipNextPrec == 1))) // Do nothing + //elseif ASTFunName == 'disp' + // Do nothing else AST_CheckCommonInOutArgs(InArg,NInArg,OutArg,NOutArg,ReportFileName); end diff --git a/2.3-1/macros/ASTManagement/AST_HandleFunRC.sci b/2.3-1/macros/ASTManagement/AST_HandleFunRC.sci new file mode 100644 index 00000000..a70155a7 --- /dev/null +++ b/2.3-1/macros/ASTManagement/AST_HandleFunRC.sci @@ -0,0 +1,165 @@ +function [FileInfo,SharedInfo] = AST_HandleEndGenFun(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 +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ + +// ----------------------- +// --- Initialization. --- +// ----------------------- +nxtscifunname = SharedInfo.NextSCIFunName; +nxtscifunnumber = SharedInfo.NextSCIFunNumber; +ReportFileName = FileInfo.Funct(nxtscifunnumber).ReportFileName; + +global SCI2CSTACK +global StackPosition; +global STACKDEDUG +// --------------------------- +// --- End Initialization. --- +// --------------------------- + +// ------------------------------ +// --- Read output parameters. -- +// ------------------------------ +LhsField = AST_PopASTStack(); +NOutArg = 0; +OutputArgumentNames = []; +OutputArgumentScope = []; +while (LhsField ~= 'Lhs :') + NOutArg = NOutArg + 1; + [OutputArgumentNames(NOutArg),OutputArgumentScope(NOutArg)] = AST_ExtractNameAndScope(LhsField); + LhsField = AST_PopASTStack(); + if (LhsField == 'Expression:') + error(9999, 'Found Expression: before Lhs'); + elseif (LhsField == 'Equal') + error(9999, 'Found Equal before Lhs'); + end +end + +// ------------------------------ +// --- Read input parameters. --- +// ------------------------------ + + +RhsField = AST_PopASTStack(); +NInArg = 0; +InArg = []; +while (RhsField ~= 'Expression:') + NInArg = NInArg + 1; + InArg(NInArg) = RhsField; + RhsField = AST_PopASTStack(); +end +InputArgumentNames = SCI2Cflipud(InputArgumentNames); +InputArgumentScope = SCI2Cflipud(InputArgumentScope); + + +// ------------------------------------- +// --- Generate the InArg structure. --- +// ------------------------------------- +//#RNU_RES_E +InArg = []; +for counterinputargs = 1:NInArg + InArg(counterinputargs).Name=InputArgumentNames(counterinputargs); + InArg(counterinputargs).Scope=InputArgumentScope(counterinputargs); +end + +//#RNU_RES_B +// ------------------------------------- +// --- Generate the InArg structure. --- +// ------------------------------------- +//#RNU_RES_E +OutArg = []; +for counteroutputargs = 1:NOutArg + OutArg(counteroutputargs).Name=OutputArgumentNames(counteroutputargs); + OutArg(counteroutputargs).Scope=OutputArgumentScope(counteroutputargs); +end + +// ------------------------ +// --- Print Some Info. --- +// ------------------------ + +PrintStringInfo('N Input Arguments: '+string(NInArg),ReportFileName,'file','y','n'); +PrintStringInfo('N Output Arguments: '+string(NOutArg),ReportFileName,'file','y'); + //#RNU_RES_E + for counterinputargs = 1:NInArg + //#RNU_RES_B + PrintStringInfo('Input Argument Number '+string(counterinputargs)+': '+InArg(counterinputargs).Name,... + ReportFileName,'file','y','n'); + PrintStringInfo(' Scope: '+InArg(counterinputargs).Scope,... + ReportFileName,'file','y','n'); + //#RNU_RES_E + end + for counteroutputargs = 1:NOutArg + //#RNU_RES_B + PrintStringInfo('Output Argument Number '+string(counteroutputargs)+': '+OutArg(counteroutputargs).Name,... + ReportFileName,'file','y','n'); + PrintStringInfo(' Scope: '+OutArg(counterinputargs).Scope,... + ReportFileName,'file','y','n'); + //#RNU_RES_E + end + +NOutArg_mod = NOutArg; + +FunTypeAnnot = ''; +FunSizeAnnot = ''; +NLhsArg = 0; +LhsArg = []; +PrintStringInfo('...Equal not found.',ReportFileName,'file','y'); + +PrintStringInfo('***Analyzing Input Arguments***',ReportFileName,'file','y'); +UpdatedInArg = InArg; +[InArg,SharedInfo] = ST_GetInArgInfo(InArg,NInArg,FileInfo,SharedInfo,'OpEqual'); + +size_count = 0; +for i = 1:NInArg + size_count = size_count + InArg(i).Size(2); +end + +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 = InArg(1).Dimension; +OutArg(1).Value = InArg(1).Value; +OutArg(1).FindLike = InArg(1).FindLike; + +//--- Check for output Argument in symbol table ---// +OutArg = ST_AnalyzeScope(OutArg,NOutArg,FileInfo,SharedInfo); + +//--- Put the output Argument in symbol table ---// +ST_InsOutArg(OutArg,NOutArg,FileInfo,SharedInfo,'all'); + + +endfunction diff --git a/2.3-1/macros/ASTManagement/AST_HandleIfElse.sci b/2.3-1/macros/ASTManagement/AST_HandleIfElse.sci index 5373adf6..2b549ed6 100644 --- a/2.3-1/macros/ASTManagement/AST_HandleIfElse.sci +++ b/2.3-1/macros/ASTManagement/AST_HandleIfElse.sci @@ -74,11 +74,13 @@ global STACKDEDUG // --------------------------------------------------- //#RNU_RES_E if (ASTIfExpType~='else') - [IfCondArg,NIfCondArg] = AST_ParseIfExprStruct(FileInfo,SharedInfo,ASTIfExpType); + [IfCondArg,NIfCondArg,Op,NOp] = AST_ParseIfExprStruct(FileInfo,SharedInfo,ASTIfExpType); else // "else" type doesn't contain any condition to test. IfCondArg = ''; NIfCondArg = 0; + Op = ''; + NOp = 0; end //#RNU_RES_B @@ -87,6 +89,6 @@ end // ----------------------------- // --- Generate the C code for if/elseif Expression. --- //#RNU_RES_E -SharedInfo = C_IfExpression(IfCondArg,NIfCondArg,ASTIfExpType,FileInfo,SharedInfo); +SharedInfo = C_IfExpression(IfCondArg,NIfCondArg,Op,NOp,ASTIfExpType,FileInfo,SharedInfo); endfunction diff --git a/2.3-1/macros/ASTManagement/AST_HandleRC.sci b/2.3-1/macros/ASTManagement/AST_HandleRC.sci new file mode 100644 index 00000000..b1a1003f --- /dev/null +++ b/2.3-1/macros/ASTManagement/AST_HandleRC.sci @@ -0,0 +1,81 @@ +function [RhsNames,RhsScope,NRhs] = AST_ReadEqualRhsNames(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 +// ----------------------------------------------------------------- + +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) ~= 'Operands:') + NRhs = NRhs + 1; + [RhsNames(NRhs),RhsScope(NRhs)] = AST_ExtractNameAndScope(RhsField(cntpop)); + cntpop = cntpop + 1; + RhsField(cntpop) = AST_PopASTStack(); +end +RhsNames = SCI2Cflipud(RhsNames); +RhsScope = SCI2Cflipud(RhsScope); + +// --- Repush everything into the stack. --- +for cntpush = cntpop:-1:1 + AST_PushASTStack(RhsField(cntpush)); +end + + +for counterinputargs = 1:NRhs + //#RNU_RES_B + PrintStringInfo('Input Argument Number '+string(counterinputargs)+': '+InArg(counterinputargs).Name,... + ReportFileName,'file','y'); + PrintStringInfo(' Scope: '+InArg(counterinputargs).Scope,... + ReportFileName,'file','y'); + //#RNU_RES_E +end + +endfunction diff --git a/2.3-1/macros/ASTManagement/AST_HandleWhileStatem.sci b/2.3-1/macros/ASTManagement/AST_HandleWhileStatem.sci index 79fb516d..d8c2f73c 100644 --- a/2.3-1/macros/ASTManagement/AST_HandleWhileStatem.sci +++ b/2.3-1/macros/ASTManagement/AST_HandleWhileStatem.sci @@ -36,6 +36,8 @@ global SCI2CSTACK global StackPosition; global STACKDEDUG +IfCondArg = []; +NIfCondArg = 0; // ------------------------------ // --- Check input arguments. --- @@ -70,36 +72,40 @@ PrintStringInfo(' Redirecting C code to: '+FileInfo.Funct(nxtscifunnumber).CPa // --- Generate C code. --- // ------------------------ //#RNU_RES_E -if(SharedInfo.WhileExpr.CondVar == '') - //#RNU_RES_B - // It means that we are handling something like while(a) or while(1) - // The while condition variable is generated by the HandleEndGenFun. - //#RNU_RES_E - - // --- Pop the name of the condition variable or number. --- - Pop1 = AST_PopASTStack(); - - [ArgName,ArgScope] = AST_ExtractNameAndScope(Pop1); - if (length(ArgName) == 0) - PrintStringInfo(' ',ReportFileName,'both','y'); - PrintStringInfo('SCI2CERROR: Expected while(variable) or while(number).','','stdout','y'); - PrintStringInfo('SCI2CERROR: Expected a variable or number in the AST while expression.','','stdout','y'); - PrintStringInfo('SCI2CERROR: Report this error to http://forge.scilab.org/index.php/p/scilab2c/issues/.','','stdout','y'); - PrintStringInfo(' ',ReportFileName,'both','y'); - error(9999, 'Expected a conditional variable in the while expression'); +flagendpop = 0; +IfExprField = AST_PopASTStack(); + +NOp=0; +Op=[]; +while (flagendpop == 0) + if (IfExprField~='<EOL>') + if (IfExprField=='WhileExpression:') + flagendpop = 1; + // Pop Again the If tag from the AST. + IfExprField = AST_PopASTStack(); + elseif (IfExprField=='Operands:') + flagendpop = 0; + g = AST_PopASTStack(); + else + if (IfExprField=='&&' | IfExprField=='||') + NOp = NOp + 1; + Op(NOp) = IfExprField; + //PrintStringInfo('operators are '+Op(NOp),ReportFileName,'file','y'); + else + NIfCondArg = NIfCondArg + 1; + IfCondArg(NIfCondArg) = IfExprField; + end + //[IfCondArg(NIfCondArg),tmpscope] = AST_ExtractNameAndScope(IfExprField); + //[IfCondArg(NIfCondArg),tmpscope] = AST_ExtractNameAndScope(IfExprField); + end end + IfExprField = AST_PopASTStack(); + PrintStringInfo('operators are '+IfExprField,ReportFileName,'file','y'); +end - SharedInfo.WhileExpr.CondVar = ArgName; - //#RNU_RES_B - // --- Repush strings into the AST stack. --- - //#RNU_RES_E - - AST_PushASTStack(Pop1); +IfCondArg = SCI2Cflipud(IfCondArg); -elseif (SharedInfo.WhileExpr.DimCondVar > 0) - error(9999, 'Cannot manage while with matrix conditions'); -end -SharedInfo = C_WhileExpression(FileInfo,SharedInfo); +SharedInfo = C_WhileExpression(IfCondArg,NIfCondArg,Op,NOp,FileInfo,SharedInfo); // -------------------------- // --- Update SharedInfo. --- diff --git a/2.3-1/macros/ASTManagement/AST_ParseEqualStruct.sci b/2.3-1/macros/ASTManagement/AST_ParseEqualStruct.sci index fa76a01d..68bc3da7 100644 --- a/2.3-1/macros/ASTManagement/AST_ParseEqualStruct.sci +++ b/2.3-1/macros/ASTManagement/AST_ParseEqualStruct.sci @@ -123,7 +123,7 @@ end // ------------------------ //#RNU_RES_B PrintStringInfo('Function Name: '+FunctionName,ReportFileName,'file','y','n'); -PrintStringInfo('N Intput Arguments: '+string(NInArg),ReportFileName,'file','y','n'); +PrintStringInfo('N Input Arguments: '+string(NInArg),ReportFileName,'file','y','n'); //#RNU_RES_E if (SharedInfo.Equal.Nins > 0) //#RNU_RES_B diff --git a/2.3-1/macros/ASTManagement/AST_ParseFuncallStruct.sci b/2.3-1/macros/ASTManagement/AST_ParseFuncallStruct.sci index 647a70d7..3c322dd5 100644 --- a/2.3-1/macros/ASTManagement/AST_ParseFuncallStruct.sci +++ b/2.3-1/macros/ASTManagement/AST_ParseFuncallStruct.sci @@ -87,6 +87,10 @@ NOutArg = eval(stripblanks(part(buffstring,10:length(buffstring)))); buffstring = AST_PopASTStack(); FunctionName = stripblanks(part(buffstring,12:length(buffstring))); +//if (FunctionName == 'disp') + // NOutArg = 0; +//end + // ------------------------------------- // --- Generate the InArg structure. --- // ------------------------------------- diff --git a/2.3-1/macros/ASTManagement/AST_ParseIfExprStruct.sci b/2.3-1/macros/ASTManagement/AST_ParseIfExprStruct.sci index a7da0128..3ed1b5b6 100644 --- a/2.3-1/macros/ASTManagement/AST_ParseIfExprStruct.sci +++ b/2.3-1/macros/ASTManagement/AST_ParseIfExprStruct.sci @@ -1,4 +1,4 @@ -function [IfCondArg,NIfCondArg] = AST_ParseIfExprStruct(FileInfo,SharedInfo,ASTIfExpType) +function [IfCondArg,NIfCondArg,Op,NOp] = AST_ParseIfExprStruct(FileInfo,SharedInfo,ASTIfExpType) // function [IfCondArg,NIfCondArg] = AST_ParseIfExprStruct(FileInfo,SharedInfo,ASTIfExpType) // ----------------------------------------------------------------- //#RNU_RES_B @@ -63,13 +63,26 @@ global STACKDEDUG // ------------------------------------ // --- Read if condition variables. --- // ------------------------------------ +//OutArgOld=[]; +//OutArgNew=[]; + +//for i = 1:3 + // OutArgOld(i)=AST_PopASTStack(); + //PrintStringInfo(' '+OutArgOld(i),ReportFileName,'file','y'); +//end +//x = AST_PopASTStack(); + +//OutArgNew = SCI2Cflipud(OutArgOld); + flagendpop = 0; IfExprField = AST_PopASTStack(); +PrintStringInfo(' '+IfExprField+' '+ASTIfExpType,ReportFileName,'file','y'); if (ASTIfExpType=='if') if (IfExprField=='Expression:') flagendpop = 1; // Pop Again the If tag from the AST. IfExprField = AST_PopASTStack(); + PrintStringInfo(' '+IfExprField,ReportFileName,'file','y'); end elseif (ASTIfExpType=='elseif') if (IfExprField=='Else If Expression') @@ -78,7 +91,8 @@ elseif (ASTIfExpType=='elseif') else error(9999, 'Unknown ASTIfExpType ""'+ASTIfExpType+'"".'); end - +NOp=0; +Op=[]; while (flagendpop == 0) if (IfExprField~='<EOL>') if (ASTIfExpType=='if') @@ -86,23 +100,41 @@ while (flagendpop == 0) flagendpop = 1; // Pop Again the If tag from the AST. IfExprField = AST_PopASTStack(); + elseif (IfExprField=='Operands:') + flagendpop = 0; + g = AST_PopASTStack(); else + if (IfExprField=='&&' | IfExprField=='||') + NOp = NOp + 1; + Op(NOp) = IfExprField; + //PrintStringInfo('operators are '+Op(NOp),ReportFileName,'file','y'); + else NIfCondArg = NIfCondArg + 1; - [IfCondArg(NIfCondArg),tmpscope] = AST_ExtractNameAndScope(IfExprField); + IfCondArg(NIfCondArg) = IfExprField; + end + //[IfCondArg(NIfCondArg),tmpscope] = AST_ExtractNameAndScope(IfExprField); end elseif (ASTIfExpType=='elseif') if (IfExprField=='Else If Expression') flagendpop = 1; else - NIfCondArg = NIfCondArg + 1; - IfCondArg(NIfCondArg) = IfExprField; - [IfCondArg(NIfCondArg),tmpscope] = AST_ExtractNameAndScope(IfExprField); + if (IfExprField=='&&') + NOp = NOp + 1; + Op(NOp) = IfExprField; + else + NIfCondArg = NIfCondArg + 1; + IfCondArg(NIfCondArg) = IfExprField; + end + //[IfCondArg(NIfCondArg),tmpscope] = AST_ExtractNameAndScope(IfExprField); end end end IfExprField = AST_PopASTStack(); + PrintStringInfo('operators are '+IfExprField,ReportFileName,'file','y'); end +IfCondArg = SCI2Cflipud(IfCondArg); + //#RNU_RES_B // ------------------------------------------- // --- Print some info in the report file. --- diff --git a/2.3-1/macros/ASTManagement/AST_ParseOperStruct.sci b/2.3-1/macros/ASTManagement/AST_ParseOperStruct.sci index a77317bd..903f0958 100644 --- a/2.3-1/macros/ASTManagement/AST_ParseOperStruct.sci +++ b/2.3-1/macros/ASTManagement/AST_ParseOperStruct.sci @@ -61,6 +61,17 @@ LabelFunctName = 'Operator: '; FunctionName = stripblanks(part(buffstring,length(LabelFunctName)+1:length(buffstring))); // Generate the proper function name. FunctionName = Operator2FunName(FunctionName); +PrintStringInfo(' '+FunctionName,ReportFileName,'file','y'); + +if (FunctionName == 'OpLogAnd' | FunctionName=='OpLogOr') + NInArg = 0; + NOutArg = 0; + InArg=[]; + //RhsField = AST_PopASTStack(); + //PrintStringInfo('hello'+RhsField,ReportFileName,'file','y'); + //RhsField = AST_PopASTStack(); + return ; +end // ------------------------------ // --- Read input parameters. --- diff --git a/2.3-1/macros/ASTManagement/GenOutArgNames.sci b/2.3-1/macros/ASTManagement/GenOutArgNames.sci index 0e683835..7b62c794 100644 --- a/2.3-1/macros/ASTManagement/GenOutArgNames.sci +++ b/2.3-1/macros/ASTManagement/GenOutArgNames.sci @@ -32,6 +32,12 @@ SCI2CNInArgCheck(argn(2),9,9); nxtscifunname = SharedInfo.NextSCIFunName; nxtscifunnumber = SharedInfo.NextSCIFunNumber; ReportFileName = FileInfo.Funct(nxtscifunnumber).ReportFileName; + + +global SCI2CSTACK +global StackPosition; +global STACKDEDUG + // #RNU_RES_B PrintStringInfo(' Generating Out Arg names.',ReportFileName,'file','y'); // #RNU_RES_E @@ -43,47 +49,69 @@ OutArg = OldOutArg; // --------------------------------------------------------------------------------------- // At this step only the name of the output arguments can be generated. --- //#RNU_RES_E -if (NLhsArg > 0) - //#RNU_RES_B - // Use the equal Lhs names. - PrintStringInfo('Using Equal Lhs names.',ReportFileName,'file','y'); - //#RNU_RES_E - if (NLhsArg ~= NOutArg) - error(9999, 'NLhsArg='+string(NLhsArg)+' must be equal to NOutArg='+string(NOutArg)+'.'); - end - for counteroutputargs = 1:NOutArg - OutArg(counteroutputargs).Name=LhsArg(counteroutputargs).Name; - OutArg(counteroutputargs).Scope=LhsArg(counteroutputargs).Scope; - end +if (FunctionName ~= 'OpLogGt' & FunctionName ~= 'OpLogLt' & FunctionName ~= 'OpLogGe' & FunctionName ~= 'OpLogLe' & FunctionName ~= 'OpLogNe' & FunctionName ~= 'OpLogEq') + if (NLhsArg > 0) + //#RNU_RES_B + // Use the equal Lhs names. + PrintStringInfo('Using Equal Lhs names.',ReportFileName,'file','y'); + //#RNU_RES_E + if (NLhsArg ~= NOutArg) + error(9999, 'NLhsArg='+string(NLhsArg)+' must be equal to NOutArg='+string(NOutArg)+'.'); + end + for counteroutputargs = 1:NOutArg + OutArg(counteroutputargs).Name=LhsArg(counteroutputargs).Name; + OutArg(counteroutputargs).Scope=LhsArg(counteroutputargs).Scope; + end + else + //#RNU_RES_B + // Generate temporary variables. + PrintStringInfo('Generating temporary variables.',ReportFileName,'file','y'); + //#RNU_RES_E + if ((sum(mtlb_strcmp(FunctionName,SharedInfo.Annotations.DataPrec)) > 0) & ... + (SharedInfo.SkipNextPrec == 1)) + //#RNU_RES_B + PrintStringInfo(' Skipping code generating because already generated in the previous function.',ReportFileName,'file','y'); + //#RNU_RES_E + for counteroutputargs = 1:NOutArg + OutArg(counteroutputargs).Name = InArg(counteroutputargs).Name; + end + elseif (mtlb_strcmp(FunctionName,'OpEqual')) + // do nothing. + //NUT: verifica questa parte di codice. e' sicuro che se ho equal gli oldoutarg contengono gia' il nome? + else + for counteroutputargs = 1:NOutArg + if ((SharedInfo.ASTReader.EnableTempVarsReuse == 1) & ... + (length(SharedInfo.ASTReader.ReusableTempVars) > 0)) + TmpOutArgName = strcat([SharedInfo.ASTReader.TempVarsName,string(SharedInfo.ASTReader.ReusableTempVars(1))]); + SharedInfo.ASTReader.ReusableTempVars = SharedInfo.ASTReader.ReusableTempVars(2:$); + else + SharedInfo.ASTReader.UsedTempVars = SharedInfo.ASTReader.UsedTempVars + 1; + TmpOutArgName = strcat([SharedInfo.ASTReader.TempVarsName,string(SharedInfo.ASTReader.UsedTempVars)]); + end + OutArg(counteroutputargs).Name=TmpOutArgName; + end + end + end else - //#RNU_RES_B - // Generate temporary variables. - PrintStringInfo('Generating temporary variables.',ReportFileName,'file','y'); - //#RNU_RES_E - if ((sum(mtlb_strcmp(FunctionName,SharedInfo.Annotations.DataPrec)) > 0) & ... - (SharedInfo.SkipNextPrec == 1)) - //#RNU_RES_B - PrintStringInfo(' Skipping code generating because already generated in the previous function.',ReportFileName,'file','y'); - //#RNU_RES_E - for counteroutputargs = 1:NOutArg - OutArg(counteroutputargs).Name = InArg(counteroutputargs).Name; - end - elseif (mtlb_strcmp(FunctionName,'OpEqual')) - // do nothing. - //NUT: verifica questa parte di codice. e' sicuro che se ho equal gli oldoutarg contengono gia' il nome? - else - for counteroutputargs = 1:NOutArg - if ((SharedInfo.ASTReader.EnableTempVarsReuse == 1) & ... - (length(SharedInfo.ASTReader.ReusableTempVars) > 0)) - TmpOutArgName = strcat([SharedInfo.ASTReader.TempVarsName,string(SharedInfo.ASTReader.ReusableTempVars(1))]); - SharedInfo.ASTReader.ReusableTempVars = SharedInfo.ASTReader.ReusableTempVars(2:$); - else - SharedInfo.ASTReader.UsedTempVars = SharedInfo.ASTReader.UsedTempVars + 1; - TmpOutArgName = strcat([SharedInfo.ASTReader.TempVarsName,string(SharedInfo.ASTReader.UsedTempVars)]); - end - OutArg(counteroutputargs).Name=TmpOutArgName; - end - end + for counterinputargs = 1:NInArg + tmppushstack=InArg(counterinputargs).Name; + PrintStringInfo(' Pushing in the AST stack: ""'+tmppushstack+'"".',ReportFileName,'file','y'); + AST_PushASTStack(tmppushstack); + if FunctionName=='OpLogGt' + AST_PushASTStack('>'); + elseif FunctionName=='OpLogGe' + AST_PushASTStack('>='); + elseif FunctionName=='OpLogLt' + AST_PushASTStack('<'); + elseif FunctionName=='OpLogLe' + AST_PushASTStack('<='); + elseif FunctionName=='OpLogEq' + AST_PushASTStack('=='); + elseif FunctionName=='OpLogNe' + AST_PushASTStack('!='); + end + end + s = AST_PopASTStack(); + PrintStringInfo(' Pushing in the AST stack: ""'+s+'"".',ReportFileName,'file','y'); end - endfunction diff --git a/2.3-1/macros/ASTManagement/lib b/2.3-1/macros/ASTManagement/lib Binary files differindex 67ea09be..c73eb6b2 100644 --- a/2.3-1/macros/ASTManagement/lib +++ b/2.3-1/macros/ASTManagement/lib diff --git a/2.3-1/macros/ASTManagement/names b/2.3-1/macros/ASTManagement/names index a1aafbc1..26edaf7c 100644 --- a/2.3-1/macros/ASTManagement/names +++ b/2.3-1/macros/ASTManagement/names @@ -28,8 +28,10 @@ AST_HandleEndProgram AST_HandleEndWhile AST_HandleFor AST_HandleForStatem +AST_HandleFunRC AST_HandleHeader AST_HandleIfElse +AST_HandleRC AST_HandleWhileExpr AST_HandleWhileStatem AST_ParseEqualStruct @@ -57,3 +59,5 @@ _program_string _variable_string _while_string objectlist2string +AST_HandleRC +AST_HandleFunRC diff --git a/2.3-1/macros/CCodeGeneration/C_IfExpression.sci b/2.3-1/macros/CCodeGeneration/C_IfExpression.sci index 48a05383..c723d95a 100644 --- a/2.3-1/macros/CCodeGeneration/C_IfExpression.sci +++ b/2.3-1/macros/CCodeGeneration/C_IfExpression.sci @@ -1,4 +1,4 @@ -function SharedInfo = C_IfExpression(IfCondArg,NIfCondArg,ASTIfExpType,FileInfo,SharedInfo) +function SharedInfo = C_IfExpression(IfCondArg,NIfCondArg,Op,NOp,ASTIfExpType,FileInfo,SharedInfo) // function SharedInfo = C_IfExpression(IfCondArg,NIfCondArg,ASTIfExpType,FileInfo,SharedInfo) // ----------------------------------------------------------------- // //NUT: add description here @@ -19,12 +19,16 @@ function SharedInfo = C_IfExpression(IfCondArg,NIfCondArg,ASTIfExpType,FileInfo, // ------------------------------ // --- Check input arguments. --- // ------------------------------ -SCI2CNInArgCheck(argn(2),5,5); +//SCI2CNInArgCheck(argn(4),7,7); + +//global SCI2CSTACK +//global StackPosition; +//global STACKDEDUG // --- Check NIfCondArg value. --- -if ((NIfCondArg ~= 1) & (ASTIfExpType~='else')) - error(9999, 'Cannot manage ""if/elseif"" with a number of condition variables not equal to 1.'); -end +//if ((NIfCondArg ~= 1) & (ASTIfExpType~='else')) + // error(9999, 'Cannot manage ""if/elseif"" with a number of condition variables not equal to 1.'); +//end // ----------------------- // --- Initialization. --- @@ -37,7 +41,7 @@ CPass1FileName = FileInfo.Funct(nxtscifunnumber).CPass1FileName; // #RNU_RES_B PrintStringInfo(' ',ReportFileName,'file','y'); -PrintStringInfo('***Generating C code***',ReportFileName,'file','y'); +PrintStringInfo('***Generating C code***'+ string(NIfCondArg),ReportFileName,'file','y'); // #RNU_RES_E // --------------------------- // --- End Initialization. --- @@ -66,10 +70,23 @@ if SCI2Cstrncmps1size(ASTIfExpType,'else') SharedInfo = C_IfElseBlocks(FileInfo,SharedInfo,'out'); end +i=1; +k=1; CCall =''; CCall = CCall+CFunName; if (ASTIfExpType~='else') - CCall = CCall+'('+IfCondArg(1)+')'; + CCall = CCall+'('; + while i <= NIfCondArg + CCall = CCall + IfCondArg(i) + ' '; + //d = modulo(i,3); + //PrintStringInfo(' '+string(i)+string(d),'file','y'); + if (modulo(i,3)==0 & i<>NIfCondArg) + CCall = CCall + Op(k) + ' '; + k = k + 1; + end + i = i + 1; + end + CCall = CCall+')'; end PrintStringInfo(' '+CCall,ReportFileName,'file','y'); PrintStringInfo(C_IndentBlanks(SharedInfo.NIndent)+CCall,CPass1FileName,'file','y'); diff --git a/2.3-1/macros/CCodeGeneration/C_WhileExpression.sci b/2.3-1/macros/CCodeGeneration/C_WhileExpression.sci index edd2830e..d7cf70ec 100644 --- a/2.3-1/macros/CCodeGeneration/C_WhileExpression.sci +++ b/2.3-1/macros/CCodeGeneration/C_WhileExpression.sci @@ -1,4 +1,4 @@ -function SharedInfo = C_WhileExpression(FileInfo,SharedInfo) +function SharedInfo = C_WhileExpression(IfCondArg,NIfCondArg,Op,NOp,FileInfo,SharedInfo) // function SharedInfo = C_WhileExpression(FileInfo,SharedInfo) // ----------------------------------------------------------------- // //NUT: add description here @@ -19,7 +19,7 @@ function SharedInfo = C_WhileExpression(FileInfo,SharedInfo) // ------------------------------ // --- Check input arguments. --- // ------------------------------ -SCI2CNInArgCheck(argn(2),2,2); +//SCI2CNInArgCheck(argn(2),2,2); // ----------------------- // --- Initialization. --- @@ -63,7 +63,7 @@ for cntstr = 1:NumCStrings // Epilogue if (length(C_Strings(cntstr)) == 0) C_Strings(cntstr) = ' '; // RNU for Bruno: If I don't do that I get a PrintStringInfo error related to mputstr. - // Function not defined for given argument type(s),
+ // Function not defined for given argument type(s), // check arguments or define function %0_mputstr for overloading. end PrintStringInfo(C_Strings(cntstr),CPass1WhileEpilFileName ,'file','y','n'); @@ -76,7 +76,27 @@ PrintStringInfo('}',CPass1WhileEpilFileName ,'file','y'); // ------------------------------ // --- Insert for expression. --- // ------------------------------ -CCall = 'while('+SharedInfo.WhileExpr.CondVar+')'; +//CCall = 'while('+SharedInfo.WhileExpr.CondVar+')'; +//PrintStringInfo(C_IndentBlanks(SharedInfo.NIndent)+CCall,CPass1FileName,'file','y'); + +i=1; +k=1; +CCall =''; +CCall = CCall+'while'; + CCall = CCall+'('; + while i <= NIfCondArg + CCall = CCall + IfCondArg(i) + ' '; + //d = modulo(i,3); + //PrintStringInfo(' '+string(i)+string(d),'file','y'); + if (modulo(i,3)==0 & i<>NIfCondArg) + CCall = CCall + Op(k) + ' '; + k = k + 1; + end + i = i + 1; + end + CCall = CCall+')'; + +PrintStringInfo(' '+CCall,ReportFileName,'file','y'); PrintStringInfo(C_IndentBlanks(SharedInfo.NIndent)+CCall,CPass1FileName,'file','y'); // ------------------- diff --git a/2.3-1/macros/CCodeGeneration/GetClsFileName.sci b/2.3-1/macros/CCodeGeneration/GetClsFileName.sci index 46f08201..d92a431c 100644 --- a/2.3-1/macros/CCodeGeneration/GetClsFileName.sci +++ b/2.3-1/macros/CCodeGeneration/GetClsFileName.sci @@ -45,6 +45,7 @@ if SCI2Cfileexist(FileInfo.USER2CLibCAnnFun,tmpannfilename) // #RNU_RES_B // It is a C function of the USER2C library. // #RNU_RES_E + PrintStringInfo('cUser2c',ReportFileName,'file','y'); FlagFoundAnnFile = 1; AnnFileName = fullfile(FileInfo.USER2CLibCAnnFun,tmpannfilename); SCI2CClassName = FL_GetFunctionClass(AnnFileName,SCI2CClassSpecifier,ReportFileName); @@ -53,6 +54,7 @@ elseif SCI2Cfileexist(FileInfo.USER2CLibSCIAnnFun,tmpannfilename) // #RNU_RES_B // It is a scilab function of the USER2C library. // #RNU_RES_E + PrintStringInfo('fUser2c',ReportFileName,'file','y'); FlagFoundAnnFile = 1; AnnFileName = fullfile(FileInfo.USER2CLibSCIAnnFun,tmpannfilename); SCI2CClassName = FL_GetFunctionClass(AnnFileName,SCI2CClassSpecifier,ReportFileName); @@ -61,6 +63,7 @@ elseif (SCI2Cfileexist(FileInfo.SCI2CLibCAnnFun,tmpannfilename)) // #RNU_RES_B // It is a C function of the SCI2C library. // #RNU_RES_E + PrintStringInfo('csci2c',ReportFileName,'file','y'); FlagFoundAnnFile = 1; AnnFileName = fullfile(FileInfo.SCI2CLibCAnnFun,tmpannfilename); SCI2CClassName = FL_GetFunctionClass(AnnFileName,SCI2CClassSpecifier,ReportFileName); @@ -69,6 +72,7 @@ elseif (SCI2Cfileexist(FileInfo.SCI2CLibSCIAnnFun,tmpannfilename)) // #RNU_RES_B // It is a scilab function of the SCI2C library. // #RNU_RES_E + PrintStringInfo('fsci2c',ReportFileName,'file','y'); FlagFoundAnnFile = 1; AnnFileName = fullfile(FileInfo.SCI2CLibSCIAnnFun,tmpannfilename); SCI2CClassName = FL_GetFunctionClass(AnnFileName,SCI2CClassSpecifier,ReportFileName); diff --git a/2.3-1/macros/CCodeGeneration/lib b/2.3-1/macros/CCodeGeneration/lib Binary files differindex 2db4b8c8..4e87a555 100644 --- a/2.3-1/macros/CCodeGeneration/lib +++ b/2.3-1/macros/CCodeGeneration/lib diff --git a/2.3-1/macros/CCodeGeneration/names b/2.3-1/macros/CCodeGeneration/names index 5311c7fd..4d76299e 100644 --- a/2.3-1/macros/CCodeGeneration/names +++ b/2.3-1/macros/CCodeGeneration/names @@ -13,6 +13,7 @@ C_IfExpression C_IndentBlanks C_InitHeader C_MemAllocOutTempVars +C_RCOperator C_SCI2CHeader C_Type C_WhileExpression diff --git a/2.3-1/macros/ErrorMessages/lib b/2.3-1/macros/ErrorMessages/lib Binary files differindex 5370e124..0a9f8913 100644 --- a/2.3-1/macros/ErrorMessages/lib +++ b/2.3-1/macros/ErrorMessages/lib diff --git a/2.3-1/macros/FunctionAnnotation/FA_GetFunAnn.sci b/2.3-1/macros/FunctionAnnotation/FA_GetFunAnn.sci index d11e3cee..3fadd1f2 100644 --- a/2.3-1/macros/FunctionAnnotation/FA_GetFunAnn.sci +++ b/2.3-1/macros/FunctionAnnotation/FA_GetFunAnn.sci @@ -52,7 +52,7 @@ FunSizeAnnot = ''; // ---------------------------------------------
// --- Open the .sci file (read only). ---
inclsfid = SCI2COpenFileRead(SCI2CClassFileName);
-
+PrintStringInfo(' '+string(inclsfid),ReportFileName,'file','y');
// #RNU_RES_B
// --- Loop over the lines of the input file. ---
// Position file pointer to the desired NInArg/NOutArg section,
@@ -212,5 +212,6 @@ mclose(inclsfid); // -------------------------------------------------
// --- End Read the annotations of the function. ---
// -------------------------------------------------
+PrintStringInfo(' end of annotation '+string(NOutArg_mod),ReportFileName,'file','y');
endfunction
diff --git a/2.3-1/macros/FunctionAnnotation/lib b/2.3-1/macros/FunctionAnnotation/lib Binary files differindex 3608981c..f02997b0 100644 --- a/2.3-1/macros/FunctionAnnotation/lib +++ b/2.3-1/macros/FunctionAnnotation/lib diff --git a/2.3-1/macros/FunctionList/lib b/2.3-1/macros/FunctionList/lib Binary files differindex f5a84d5f..2bbf0cbe 100644 --- a/2.3-1/macros/FunctionList/lib +++ b/2.3-1/macros/FunctionList/lib diff --git a/2.3-1/macros/GeneralFunctions/lib b/2.3-1/macros/GeneralFunctions/lib Binary files differindex 9d57416d..e1d6f0fb 100644 --- a/2.3-1/macros/GeneralFunctions/lib +++ b/2.3-1/macros/GeneralFunctions/lib diff --git a/2.3-1/macros/Hardware/AVR/lib b/2.3-1/macros/Hardware/AVR/lib Binary files differindex 7631c354..5c8f0da2 100644 --- a/2.3-1/macros/Hardware/AVR/lib +++ b/2.3-1/macros/Hardware/AVR/lib diff --git a/2.3-1/macros/Hardware/RasberryPi/lib b/2.3-1/macros/Hardware/RasberryPi/lib Binary files differindex c238317e..9afd77da 100644 --- a/2.3-1/macros/Hardware/RasberryPi/lib +++ b/2.3-1/macros/Hardware/RasberryPi/lib diff --git a/2.3-1/macros/ImageProcessing/core/lib b/2.3-1/macros/ImageProcessing/core/lib Binary files differindex fedf05e1..56053510 100644 --- a/2.3-1/macros/ImageProcessing/core/lib +++ b/2.3-1/macros/ImageProcessing/core/lib diff --git a/2.3-1/macros/ImageProcessing/highgui/lib b/2.3-1/macros/ImageProcessing/highgui/lib Binary files differindex 30217607..a46d5d87 100644 --- a/2.3-1/macros/ImageProcessing/highgui/lib +++ b/2.3-1/macros/ImageProcessing/highgui/lib diff --git a/2.3-1/macros/ImageProcessing/imgproc/lib b/2.3-1/macros/ImageProcessing/imgproc/lib Binary files differindex ac605c04..4863059b 100644 --- a/2.3-1/macros/ImageProcessing/imgproc/lib +++ b/2.3-1/macros/ImageProcessing/imgproc/lib diff --git a/2.3-1/macros/Scilab-Arduino/lib b/2.3-1/macros/Scilab-Arduino/lib Binary files differindex 83baacde..0304cade 100644 --- a/2.3-1/macros/Scilab-Arduino/lib +++ b/2.3-1/macros/Scilab-Arduino/lib diff --git a/2.3-1/macros/SymbolTable/lib b/2.3-1/macros/SymbolTable/lib Binary files differindex 59ce4653..dbc603e2 100644 --- a/2.3-1/macros/SymbolTable/lib +++ b/2.3-1/macros/SymbolTable/lib diff --git a/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci b/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci index 313d25b2..3ec6d13e 100644 --- a/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci +++ b/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci @@ -844,6 +844,207 @@ INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,E INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
// -------------------
+// --- Class Isreal. ---
+// -------------------
+ClassName = 'Isreal';
+
+// --- Class Annotation. ---
+PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+PrintStringInfo('NIN= 1',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y');
+//Was FA_TP_USER
+//Cause some trouble if user specify some precision and if input(and also output) is complex.
+PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y'); //FOR INRIA changed from IN(1).TP to FA_TP_USER
+PrintStringInfo('OUT(1).SZ(1)= IN(1).SZ(1)',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= IN(1).SZ(2)',ClassFileName,'file','y');
+//---Function list class. ----
+ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
+PrintStringInfo('s0'+ArgSeparator+'s0',ClassFileName,'file','y');
+PrintStringInfo('d0'+ArgSeparator+'d0',ClassFileName,'file','y');
+//PrintStringInfo('z0'+ArgSeparator+'d0',ClassFileName,'file','y');
+//PrintStringInfo('z0'+ArgSeparator+'z0',ClassFileName,'file','y');
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'isreal';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+
+ClassName = 'gcd';
+
+// --- Class Annotation. ---
+PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+PrintStringInfo('NIN= 1',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y');
+//Was FA_TP_USER
+//Cause some trouble if user specify some precision and if input(and also output) is complex.
+PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y'); //FOR INRIA changed from IN(1).TP to FA_TP_USER
+PrintStringInfo('OUT(1).SZ(1)= IN(1).SZ(1)',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= IN(1).SZ(2)',ClassFileName,'file','y');
+//---Function list class. ----
+ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
+PrintStringInfo('u82'+ArgSeparator+'u80',ClassFileName,'file','y');
+PrintStringInfo('u80'+ArgSeparator+'u80',ClassFileName,'file','y');
+//PrintStringInfo('d2'+ArgSeparator+'d0',ClassFileName,'file','y');
+PrintStringInfo('d2'+ArgSeparator+'d2',ClassFileName,'file','y');
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'gcd';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+ClassName = 'nextpow2';
+
+// --- Class Annotation. ---
+PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+PrintStringInfo('NIN= 1',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y');
+//Was FA_TP_USER
+//Cause some trouble if user specify some precision and if input(and also output) is complex.
+PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y'); //FOR INRIA changed from IN(1).TP to FA_TP_USER
+PrintStringInfo('OUT(1).SZ(1)= IN(1).SZ(1)',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= IN(1).SZ(2)',ClassFileName,'file','y');
+
+ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
+//PrintStringInfo('u82'+ArgSeparator+'u80',ClassFileName,'file','y');
+//PrintStringInfo('u80'+ArgSeparator+'u80',ClassFileName,'file','y');
+PrintStringInfo('d0'+ArgSeparator+'d0',ClassFileName,'file','y');
+PrintStringInfo('d2'+ArgSeparator+'d2',ClassFileName,'file','y');
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'nextpow2';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+
+
+ClassName = 'interp1';
+
+// --- Class Annotation. ---
+PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+PrintStringInfo('NIN= 1',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y');
+//Was FA_TP_USER
+//Cause some trouble if user specify some precision and if input(and also output) is complex.
+PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y'); //FOR INRIA changed from IN(1).TP to FA_TP_USER
+PrintStringInfo('OUT(1).SZ(1)= IN(1).SZ(1)',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= IN(1).SZ(2)',ClassFileName,'file','y');
+
+PrintStringInfo('NIN= 2',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y');
+//Was FA_TP_USER
+//Cause some trouble if user specify some precision and if input(and also output) is complex.
+PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y'); //FOR INRIA changed from IN(1).TP to FA_TP_USER
+PrintStringInfo('OUT(1).SZ(1)= IN(1).SZ(1)',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= IN(1).SZ(2)',ClassFileName,'file','y');
+
+PrintStringInfo('NIN= 3',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y');
+//Was FA_TP_USER
+//Cause some trouble if user specify some precision and if input(and also output) is complex.
+PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y'); //FOR INRIA changed from IN(1).TP to FA_TP_USER
+PrintStringInfo('OUT(1).SZ(1)= IN(3).SZ(1)',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= IN(3).SZ(2)',ClassFileName,'file','y');
+
+PrintStringInfo('NIN= 4',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y');
+//Was FA_TP_USER
+//Cause some trouble if user specify some precision and if input(and also output) is complex.
+PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y'); //FOR INRIA changed from IN(1).TP to FA_TP_USER
+PrintStringInfo('OUT(1).SZ(1)= IN(1).SZ(1)',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= IN(1).SZ(2)',ClassFileName,'file','y');
+
+//---Function list class. ----
+ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
+//PrintStringInfo('u82'+ArgSeparator+'u80',ClassFileName,'file','y');
+//PrintStringInfo('u80'+ArgSeparator+'u80',ClassFileName,'file','y');
+//PrintStringInfo('d2'+ArgSeparator+'d0',ClassFileName,'file','y');
+PrintStringInfo('d2d2d2'+ArgSeparator+'d2',ClassFileName,'file','y');
+PrintStringInfo('d2d2d2g2'+ArgSeparator+'d2',ClassFileName,'file','y');
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'interp1';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+
+// -------------------
+// --- Class DCT. ---
+// -------------------
+ClassName = 'dct';
+
+// --- Class Annotation. ---
+PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+PrintStringInfo('NIN= 1',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y');
+//Was FA_TP_USER
+//Cause some trouble if user specify some precision and if input(and also output) is complex.
+PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y'); //FOR INRIA changed from IN(1).TP to FA_TP_USER
+PrintStringInfo('OUT(1).SZ(1)= IN(1).SZ(1)',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= IN(1).SZ(2)',ClassFileName,'file','y');
+
+PrintStringInfo('NIN= 2',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y');
+//Was FA_TP_USER
+//Cause some trouble if user specify some precision and if input(and also output) is complex.
+PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y'); //FOR INRIA changed from IN(1).TP to FA_TP_USER
+PrintStringInfo('OUT(1).SZ(1)= IN(1).SZ(1)',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= IN(1).SZ(2)',ClassFileName,'file','y');
+
+// --- Function List Class. ---
+ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
+
+PrintStringInfo('d2'+ArgSeparator+'d2',ClassFileName,'file','y');
+PrintStringInfo('d2d0'+ArgSeparator+'d2',ClassFileName,'file','y');
+PrintStringInfo('z2'+ArgSeparator+'z2',ClassFileName,'file','y');
+PrintStringInfo('z2d0'+ArgSeparator+'z2',ClassFileName,'file','y');
+PrintStringInfo('c2'+ArgSeparator+'c2',ClassFileName,'file','y');
+PrintStringInfo('c2s0'+ArgSeparator+'c2',ClassFileName,'file','y');
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'dct';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+// -------------------
+// --- Class IDCT. ---
+// -------------------
+ClassName = 'idct';
+
+// --- Class Annotation. ---
+PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+PrintStringInfo('NIN= 1',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y');
+//Was FA_TP_USER
+//Cause some trouble if user specify some precision and if input(and also output) is complex.
+PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y'); //FOR INRIA changed from IN(1).TP to FA_TP_USER
+PrintStringInfo('OUT(1).SZ(1)= IN(1).SZ(1)',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= IN(1).SZ(2)',ClassFileName,'file','y');
+// --- Function List Class. ---
+ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
+
+PrintStringInfo('d2'+ArgSeparator+'d2',ClassFileName,'file','y');
+PrintStringInfo('z2'+ArgSeparator+'z2',ClassFileName,'file','y');
+PrintStringInfo('c2'+ArgSeparator+'c2',ClassFileName,'file','y');
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'idct';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+
+
+// -------------------
// --- Class Sqrt. ---
// -------------------
ClassName = 'Sqrt';
@@ -7685,6 +7886,7 @@ PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y'); // --- Function List Class. ---
ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
+PrintStringInfo('d2d2d2'+ArgSeparator+'d0',ClassFileName,'file','y');
PrintStringInfo('d2d2d0g2'+ArgSeparator+'d0',ClassFileName,'file','y');
//PrintStringInfo('d2'+ArgSeparator+'d2',ClassFileName,'file','y');
//PrintStringInfo('s0'+ArgSeparator+'s0',ClassFileName,'file','y');
@@ -7702,6 +7904,36 @@ INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,E INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+// --- Class Modk. ---
+// ------------------
+ClassName = 'Modk';
+
+// --- Class Annotation. ---
+PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+PrintStringInfo('NIN= 1',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).TP= ''d''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= IN(1).SZ(1)',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= IN(1).SZ(2)',ClassFileName,'file','y');
+
+// --- Function List Class. ---
+ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
+PrintStringInfo('d2'+ArgSeparator+'d2',ClassFileName,'file','y');
+//PrintStringInfo('s0'+ArgSeparator+'s0',ClassFileName,'file','y');
+//PrintStringInfo('s2'+ArgSeparator+'s2',ClassFileName,'file','y');
+
+//PrintStringInfo('z2'+ArgSeparator+'z2',ClassFileName,'file','y');
+//PrintStringInfo('z0'+ArgSeparator+'z0',ClassFileName,'file','y');
+//PrintStringInfo('c2'+ArgSeparator+'c2',ClassFileName,'file','y');
+//PrintStringInfo('c0'+ArgSeparator+'c0',ClassFileName,'file','y');
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'modk';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
//------------------------------------
//---- Class PRIMES --------------------
diff --git a/2.3-1/macros/ToolInitialization/lib b/2.3-1/macros/ToolInitialization/lib Binary files differindex 4d03bdc5..b7e8685b 100644 --- a/2.3-1/macros/ToolInitialization/lib +++ b/2.3-1/macros/ToolInitialization/lib diff --git a/2.3-1/macros/findDeps/getAllHeaders.sci b/2.3-1/macros/findDeps/getAllHeaders.sci index e9214a24..7788f2c4 100644 --- a/2.3-1/macros/findDeps/getAllHeaders.sci +++ b/2.3-1/macros/findDeps/getAllHeaders.sci @@ -72,6 +72,10 @@ function allHeaders = getAllHeaders(SharedInfo) "src/c/matrixOperations/includes/kron.h" "src/c/matrixOperations/includes/flipdim.h" "src/c/matrixOperations/includes/norm.h" + "src/c/interpolation/includes/interp1.h" + "src/c/elementaryFunctions/includes/nextpow2.h" + "src/c/elementaryFunctions/includes/gcd.h" + "src/c/elementaryFunctions/includes/isreal.h" "src/c/elementaryFunctions/includes/cos.h" "src/c/elementaryFunctions/includes/fix.h" "src/c/elementaryFunctions/includes/exp.h" @@ -140,6 +144,9 @@ function allHeaders = getAllHeaders(SharedInfo) "src/c/string/includes/dynlib_string.h" "src/c/string/includes/disp.h" "src/c/string/includes/str.h" + "src/c/signalProcessing/includes/modk.h" + "src/c/signalProcessing/includes/idct.h" + "src/c/signalProcessing/includes/dct.h" "src/c/signalProcessing/fft/fft_internal.h" "src/c/signalProcessing/ifft/ifft_internal.h" "src/c/signalProcessing/levin/levinUtils.h" diff --git a/2.3-1/macros/findDeps/getAllInterfaces.sci b/2.3-1/macros/findDeps/getAllInterfaces.sci index e5c7e0a5..9086ba10 100644 --- a/2.3-1/macros/findDeps/getAllInterfaces.sci +++ b/2.3-1/macros/findDeps/getAllInterfaces.sci @@ -61,6 +61,10 @@ function allInterfaces = getAllInterfaces(SharedInfo) "src/c/matrixOperations/interfaces/int_flipdim.h" "src/c/matrixOperations/interfaces/int_permute.h" "src/c/matrixOperations/interfaces/int_norm.h" + "src/c/interpolation/interfaces/int_interp1.h" + "src/c/elementaryFunctions/interfaces/int_nextpow2.h" + "src/c/elementaryFunctions/interfaces/int_gcd.h" + "src/c/elementaryFunctions/interfaces/int_isreal.h" "src/c/elementaryFunctions/interfaces/int_asinh.h" "src/c/elementaryFunctions/interfaces/int_atanh.h" "src/c/elementaryFunctions/interfaces/int_sinh.h" @@ -140,6 +144,9 @@ function allInterfaces = getAllInterfaces(SharedInfo) "src/c/operations/interfaces/int_OpIns.h" "src/c/string/interfaces/int_disp.h" "src/c/string/interfaces/int_string.h" + "src/c/signalProcessing/interfaces/int_modk.h" + "src/c/signalProcessing/interfaces/int_idct.h" + "src/c/signalProcessing/interfaces/int_dct.h" "src/c/signalProcessing/interfaces/int_ifft.h" "src/c/signalProcessing/interfaces/int_lpc2cep.h" "src/c/signalProcessing/interfaces/int_cepstrum.h" diff --git a/2.3-1/macros/findDeps/getAllSources.sci b/2.3-1/macros/findDeps/getAllSources.sci index 826f670d..0a724926 100644 --- a/2.3-1/macros/findDeps/getAllSources.sci +++ b/2.3-1/macros/findDeps/getAllSources.sci @@ -330,6 +330,9 @@ function allSources = getAllSources(SharedInfo) "src/c/matrixOperations/kron/skrona.c" "src/c/matrixOperations/norm/dnormv.c" "src/c/matrixOperations/norm/dnorma.c" + "src/c/elementaryFunctions/nextpow2/dnextpow2a.c" + "src/c/elementaryFunctions/isreal/sisreals.c" + "src/c/elementaryFunctions/isreal/disreals.c" "src/c/elementaryFunctions/cos/dcosa.c" "src/c/elementaryFunctions/cos/dcoss.c" "src/c/elementaryFunctions/cos/scosa.c" @@ -960,6 +963,13 @@ function allSources = getAllSources(SharedInfo) "src/c/string/string/u16strings.c" "src/c/string/string/i16stringa.c" "src/c/string/string/i16strings.c" + "src/c/signalProcessing/modk/dmodka.c" + "src/c/signalProcessing/transforms/idct/cidcta.c" + "src/c/signalProcessing/transforms/idct/zidcta.c" + "src/c/signalProcessing/transforms/idct/didcta.c" + "src/c/signalProcessing/transforms/dct/cdcta.c" + "src/c/signalProcessing/transforms/dct/zdcta.c" + "src/c/signalProcessing/transforms/dct/ddcta.c" "src/c/signalProcessing/fft/dfft2.c" "src/c/signalProcessing/fft/cfftma.c" "src/c/signalProcessing/fft/r2tx.c" @@ -1171,6 +1181,9 @@ function allSources = getAllSources(SharedInfo) "src/c/elementaryFunctions/Trigonometry/sech/zsechs.c" "src/c/elementaryFunctions/Trigonometry/sech/csecha.c" "src/c/elementaryFunctions/Trigonometry/sech/csechs.c" + "src/c/interpolation/interp1/dinterp13a.c" + "src/c/elementaryFunctions/discrete_mathematics/gcd/u8gcds.c" + "src/c/elementaryFunctions/discrete_mathematics/gcd/dgcda.c" "src/c/elementaryFunctions/discrete_mathematics/factorial/dfactorials.c" "src/c/elementaryFunctions/discrete_mathematics/factorial/dfactoriala.c" "src/c/elementaryFunctions/discrete_mathematics/factorial/sfactorials.c" diff --git a/2.3-1/macros/findDeps/lib b/2.3-1/macros/findDeps/lib Binary files differindex a49dc793..d94232c2 100644 --- a/2.3-1/macros/findDeps/lib +++ b/2.3-1/macros/findDeps/lib diff --git a/2.3-1/macros/lib b/2.3-1/macros/lib Binary files differindex f2931549..d818e184 100644 --- a/2.3-1/macros/lib +++ b/2.3-1/macros/lib diff --git a/2.3-1/macros/runsci2c.sci b/2.3-1/macros/runsci2c.sci index f05cb83d..ae38e57f 100644 --- a/2.3-1/macros/runsci2c.sci +++ b/2.3-1/macros/runsci2c.sci @@ -113,7 +113,7 @@ PrintStepInfo('Copying sources', FileInfo.GeneralReport,'both'); for i = 1:size(allSources, "*")
// DEBUG only
- //disp("Copying "+allSources(i)+" in "+SCI2COutputPath+"/src/c/");
+ disp("Copying "+allSources(i)+" in "+SCI2COutputPath+"/src/c/");
//Copy ode related functions only if 'ode' function is used.
if(~isempty(strstr(allSources(i),'dode')))
if(size(SharedInfo.Includelist) <> 0)
@@ -130,7 +130,7 @@ end PrintStepInfo('Copying headers', FileInfo.GeneralReport,'both');
for i = 1:size(allHeaders, "*")
// DEBUG only
- //disp("Copying "+allHeaders(i)+" in "+SCI2COutputPath+"/includes/");
+ disp("Copying "+allHeaders(i)+" in "+SCI2COutputPath+"/includes/");
copyfile(allHeaders(i), SCI2COutputPath+"/includes/");
end
diff --git a/2.3-1/src/c/elementaryFunctions/discrete_mathematics/gcd/dgcda.c b/2.3-1/src/c/elementaryFunctions/discrete_mathematics/gcd/dgcda.c new file mode 100644 index 00000000..a32ed773 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/discrete_mathematics/gcd/dgcda.c @@ -0,0 +1,32 @@ +/* Copyright (C) 2016 - 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 +*/ + +#include "gcd.h" +#include "types.h" + +void dgcda(double *in,int size,double *out) +{ + double a=in[0]; + double b=in[1]; + while(a!=b && a!=0 && b!=0) + { + if(a>b) + { + a=a-b; + } + else + { + b=b-a; + } + } + out[0]=b; +} diff --git a/2.3-1/src/c/elementaryFunctions/discrete_mathematics/gcd/u8gcds.c b/2.3-1/src/c/elementaryFunctions/discrete_mathematics/gcd/u8gcds.c new file mode 100644 index 00000000..75f831fc --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/discrete_mathematics/gcd/u8gcds.c @@ -0,0 +1,32 @@ +/* Copyright (C) 2016 - 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 +*/ + +#include "gcd.h" +#include "types.h" + +int8 u8gcds(int8 *in,int size) +{ + int a=in[0]; + int b=in[1]; + while(a!=b && a!=0 && b!=0) + { + if(a>b) + { + a=a-b; + } + else + { + b=b-a; + } + } + return b; +} diff --git a/2.3-1/src/c/elementaryFunctions/includes/gcd.h b/2.3-1/src/c/elementaryFunctions/includes/gcd.h new file mode 100644 index 00000000..eb75c973 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/includes/gcd.h @@ -0,0 +1,31 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2007-2008 - INRIA - 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 + * Author: Ukasha Noor + * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + * + */ + +#ifndef __GCD_H__ +#define __GCD_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +int8 u8gcds(int8 *in,int size); + +void dgcda(double *in,int size,double *out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif diff --git a/2.3-1/src/c/elementaryFunctions/includes/isreal.h b/2.3-1/src/c/elementaryFunctions/includes/isreal.h new file mode 100644 index 00000000..0183ebce --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/includes/isreal.h @@ -0,0 +1,30 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2007-2008 - INRIA - 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 + * + */ + +#ifndef __ISREAL_H__ +#define __ISREAL_H__ + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +float sisreals(float a); + +double disreals(double a); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif diff --git a/2.3-1/src/c/elementaryFunctions/includes/nextpow2.h b/2.3-1/src/c/elementaryFunctions/includes/nextpow2.h new file mode 100644 index 00000000..c86bea01 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/includes/nextpow2.h @@ -0,0 +1,28 @@ +/* Copyright (C) 2016 - 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 +*/ + + +#ifndef __NEXTPOW2_H__ +#define __NEXTPOW2_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +void dnextpow2a(double *in,int size,double *out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif + diff --git a/2.3-1/src/c/elementaryFunctions/interfaces/int_gcd.h b/2.3-1/src/c/elementaryFunctions/interfaces/int_gcd.h new file mode 100644 index 00000000..c2135b70 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/interfaces/int_gcd.h @@ -0,0 +1,25 @@ +/* Copyright (C) 2016 - 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 IS AN AUTOMATICALLY GENERATED FILE : DO NOT EDIT BY HAND. */ + +#ifndef __INT_GCD_H__ +#define __INT_GCD_H__ + +#include "gcd.h" + +#define u82gcdu80(in,size) u8gcds(in,size) + +#define d2gcdd2(in,size,out) dgcda(in,size[0]*size[1],out) + +#endif + diff --git a/2.3-1/src/c/elementaryFunctions/interfaces/int_isreal.h b/2.3-1/src/c/elementaryFunctions/interfaces/int_isreal.h new file mode 100644 index 00000000..cebbf6db --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/interfaces/int_isreal.h @@ -0,0 +1,22 @@ +/* Copyright (C) 2016 - 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 +*/ + + + +#ifndef __INT_ISREAL_H__ +#define __INT_ISREAL_H__ + +#define s0isreals0(in) sisreals(in) + +#define d0isreald0(in) disreals(in) + +#endif diff --git a/2.3-1/src/c/elementaryFunctions/interfaces/int_nextpow2.h b/2.3-1/src/c/elementaryFunctions/interfaces/int_nextpow2.h new file mode 100644 index 00000000..6ae4747b --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/interfaces/int_nextpow2.h @@ -0,0 +1,26 @@ +/* Copyright (C) 2016 - 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 IS AN AUTOMATICALLY GENERATED FILE : DO NOT EDIT BY HAND. */ + + +#ifndef __INT_NEXTPOW2_H__ +#define __INT_NEXTPOW2_H__ + + +#include "nextpow2.h" + +#define d0nextpow2d0(in,size,out) dnextpow2a(in,size[0]*size[1],out) + +#define d2nextpow2d2(in,size,out) dnextpow2a(in,size[0]*size[1],out) + +#endif diff --git a/2.3-1/src/c/elementaryFunctions/isreal/disreals.c b/2.3-1/src/c/elementaryFunctions/isreal/disreals.c new file mode 100644 index 00000000..8c7c8201 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/isreal/disreals.c @@ -0,0 +1,17 @@ +/* Copyright (C) 2016 - 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 +*/ + +#include "isreal.h" + +double disreals(double a){ + return 1; +} diff --git a/2.3-1/src/c/elementaryFunctions/isreal/sisreals.c b/2.3-1/src/c/elementaryFunctions/isreal/sisreals.c new file mode 100644 index 00000000..4b93c02c --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/isreal/sisreals.c @@ -0,0 +1,17 @@ +/* Copyright (C) 2016 - 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 +*/ + +#include "isreal.h" + +float sisreals(float a){ + return 1; +} diff --git a/2.3-1/src/c/elementaryFunctions/nextpow2/dnextpow2a.c b/2.3-1/src/c/elementaryFunctions/nextpow2/dnextpow2a.c new file mode 100644 index 00000000..46f7eb80 --- /dev/null +++ b/2.3-1/src/c/elementaryFunctions/nextpow2/dnextpow2a.c @@ -0,0 +1,30 @@ +/* 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 + Organization: FOSSEE, IIT Bombay + Author: Ukasha Noor + Email: toolbox@scilab.in +*/ + +#include "nextpow2.h" +#include <math.h> + +void dnextpow2a(double *in,int size,double *out) +{ + int i,j,s; + double k; + i=2; + for(s=0;s<size;s++) + { + j=-1; + do{ + j++; + k=pow(i,j); + }while(in[s]>k); + out[s]=j; + } +} diff --git a/2.3-1/src/c/interpolation/includes/interp1.h b/2.3-1/src/c/interpolation/includes/interp1.h new file mode 100644 index 00000000..1c01417e --- /dev/null +++ b/2.3-1/src/c/interpolation/includes/interp1.h @@ -0,0 +1,30 @@ +/* Copyright (C) 2016 - 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 +*/ + +#ifndef __INTERP1_H__ +#define __INTERP1_H__ + +#include <string.h> + +#ifdef __cplusplus +extern "C" { +#endif + + +//void dinterp13a(double *x,double *fx,double *q,int size,double *out); +void dinterp13a(double *x,int size1,double *fx,int size2,double *q,int size3,char *a,int size4,double *out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif diff --git a/2.3-1/src/c/interpolation/interfaces/int_interp1.h b/2.3-1/src/c/interpolation/interfaces/int_interp1.h new file mode 100644 index 00000000..6d579e10 --- /dev/null +++ b/2.3-1/src/c/interpolation/interfaces/int_interp1.h @@ -0,0 +1,28 @@ +/* Copyright (C) 2016 - 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 IS AN AUTOMATICALLY GENERATED FILE : DO NOT EDIT BY HAND. */ + + +#ifndef __INT_INTERP1_H__ +#define __INT_INTERP1_H__ + +#include "interp1.h" +#include <string.h> + +#define d2d2d2interp1d2(x,size1,fx,size2,q,size3,out) dinterp13a(x,size1[0]*size1[1],fx,size2[0]*size1[1],q,size3[0]*size3[1],"linear",6,out) + +#define d2d2d2g2interp1d2(x,size1,fx,size2,q,size3,ch,size4,out) dinterp13a(x,size1[0]*size1[1],fx,size2[0]*size1[1],q,size3[0]*size3[1],ch,size4[0]*size4[1],out) + + +#endif + diff --git a/2.3-1/src/c/interpolation/interp1/dinterp13a.c b/2.3-1/src/c/interpolation/interp1/dinterp13a.c new file mode 100644 index 00000000..7b755e1c --- /dev/null +++ b/2.3-1/src/c/interpolation/interp1/dinterp13a.c @@ -0,0 +1,75 @@ +/* Copyright (C) 2016 - 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 +*/ + + +#include "interp1.h" +#include <string.h> + +void dinterp13a(double *x,int size1,double *fx,int size2,double *q,int size3,char *ch,int size4,double *out) +{ + int i,j,k,f; + double a,b; + if(strcmp(ch,"linear")==0) + { + for(i=0;i<size3;i++) + { + f=0; + for(j=0;j<size1;j++) + { + if(q[i]==x[j]) + { + out[i]=fx[j]; + f=1; + break; + } + } + if(f==0) + { + j=0; + while(q[i]>x[j]) + { + j++; + } + a=x[j-1]; + b=x[j]; + out[i]=fx[j-1]+(q[i]-a)*((fx[j]-fx[j-1])/(b-a)); + } + } + } + else if(strcmp(ch,"nearest")==0) + { + for(i=0;i<size3;i++) + { + f=0; + for(j=0;j<size1;j++) + { + if(q[i]==x[j]) + { + out[i]=fx[j]; + f=1; + break; + } + } + if(f==0) + { + j=0; + while(q[i]>x[j]) + { + j++; + } + out[i]=fx[j]; + } + } + } +} + + diff --git a/2.3-1/src/c/matrixOperations/cat/ccata.c b/2.3-1/src/c/matrixOperations/cat/ccata.c index a6ac6cf0..cd2b4c92 100644 --- a/2.3-1/src/c/matrixOperations/cat/ccata.c +++ b/2.3-1/src/c/matrixOperations/cat/ccata.c @@ -26,7 +26,7 @@ void crowcata(floatComplex *in1, int lines1, int columns1, floatComplex *in2, i { for (j = 0 ; j < lines1 ; ++j) { - /*out[i*(lines1 + lines2) + j] = in1[i*lines1 + j];*/ + out[i*(lines1 + lines2) + j] = in1[i*lines1 + j]; } for (j = 0 ; j < lines2 ; ++j) { diff --git a/2.3-1/src/c/matrixOperations/cat/zcata.c b/2.3-1/src/c/matrixOperations/cat/zcata.c index bfb6e922..485553d7 100644 --- a/2.3-1/src/c/matrixOperations/cat/zcata.c +++ b/2.3-1/src/c/matrixOperations/cat/zcata.c @@ -26,7 +26,7 @@ void zrowcata(doubleComplex *in1, int lines1, int columns1, doubleComplex *in2, { for (j = 0 ; j < lines1 ; ++j) { - /*out[i*(lines1 + lines2) + j] = in1[i*lines1 + j];*/ + out[i*(lines1 + lines2) + j] = in1[i*lines1 + j]; } for (j = 0 ; j < lines2 ; ++j) { diff --git a/2.3-1/src/c/signalProcessing/includes/dct.h b/2.3-1/src/c/signalProcessing/includes/dct.h new file mode 100644 index 00000000..5255241e --- /dev/null +++ b/2.3-1/src/c/signalProcessing/includes/dct.h @@ -0,0 +1,36 @@ +/* Copyright (C) 2016 - 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 +*/ + + +#ifndef __DCT_H__ +#define __DCT_H__ + +#include <math.h> +#include "types.h" +#include "doubleComplex.h" +#include "addition.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void ddcta(double *in,int row,int col,int sign,double *out); + +void zdcta(doubleComplex *in,int row,int col,int sign,doubleComplex *out); + +void cdcta(floatComplex *in,int row,int col,int sign,floatComplex *out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif diff --git a/2.3-1/src/c/signalProcessing/includes/idct.h b/2.3-1/src/c/signalProcessing/includes/idct.h new file mode 100644 index 00000000..13458b7d --- /dev/null +++ b/2.3-1/src/c/signalProcessing/includes/idct.h @@ -0,0 +1,36 @@ +/* Copyright (C) 2016 - 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 +*/ + + +#ifndef __IDCT_H__ +#define __IDCT_H__ + +#include <math.h> +#include "types.h" +#include "doubleComplex.h" +#include "addition.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void didcta(double *in,int row,int col,double *out); + +void zidcta(doubleComplex *in,int row,int col,doubleComplex *out); + +void cidcta(floatComplex *in,int row,int col,floatComplex *out); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif diff --git a/2.3-1/src/c/signalProcessing/includes/modk.h b/2.3-1/src/c/signalProcessing/includes/modk.h new file mode 100644 index 00000000..5040eb7f --- /dev/null +++ b/2.3-1/src/c/signalProcessing/includes/modk.h @@ -0,0 +1,28 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __MODK_H__ +#define __MODK_H__ +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void dmodka(double* inp,int size,double* oup); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __MODK_H__ */ + diff --git a/2.3-1/src/c/signalProcessing/interfaces/int_dct.h b/2.3-1/src/c/signalProcessing/interfaces/int_dct.h new file mode 100644 index 00000000..6cfb21c7 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/interfaces/int_dct.h @@ -0,0 +1,32 @@ +/* Copyright (C) 2016 - 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 +*/ + + + +#ifndef __INT_DCT_H__ +#define __INT_DCT_H__ + + + +#define d2dctd2(in,size,out) ddcta(in,size[0],size[1],-1,out) + +#define d2d0dctd2(in,size,sign,out) ddcta(in,size[0],size[1],sign,out) + +#define z2dctz2(in,size,out) zdcta(in,size[0],size[1],-1,out) + +#define z2d0dctz2(in,size,sign,out) zdcta(in,size[0],size[1],sign,out) + +#define c2dctc2(in,size,out) cdcta(in,size[0],size[1],-1,out) + +#define c2s0dctc2(in,size,sign,out) cdcta(in,size[0],size[1],sign,out) + +#endif diff --git a/2.3-1/src/c/signalProcessing/interfaces/int_idct.h b/2.3-1/src/c/signalProcessing/interfaces/int_idct.h new file mode 100644 index 00000000..c3a174ac --- /dev/null +++ b/2.3-1/src/c/signalProcessing/interfaces/int_idct.h @@ -0,0 +1,26 @@ +/* Copyright (C) 2016 - 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 +*/ + + + +#ifndef __INT_IDCT_H__ +#define __INT_IDCT_H__ + + + +#define d2idctd2(in,size,out) didcta(in,size[0],size[1],out) + +#define z2idctz2(in,size,out) zidcta(in,size[0],size[1],out) + +#define c2idctc2(in,size,out) cidcta(in,size[0],size[1],out) + +#endif diff --git a/2.3-1/src/c/signalProcessing/interfaces/int_modk.h b/2.3-1/src/c/signalProcessing/interfaces/int_modk.h new file mode 100644 index 00000000..441b9b13 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/interfaces/int_modk.h @@ -0,0 +1,18 @@ +/* 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: Ankit Raj + Organization: FOSSEE, IIT Bombay + Email: toolbox@scilab.in + */ + +#ifndef __INT_MODK_H__ +#define __INT_MODK_H__ + +#define d2modkd2(inp,size,oup) dmodka(inp,size[1],oup) + +#endif /* !INT_MODK_H__! */ diff --git a/2.3-1/src/c/signalProcessing/modk/dmodka.c b/2.3-1/src/c/signalProcessing/modk/dmodka.c new file mode 100644 index 00000000..c0630ec0 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/modk/dmodka.c @@ -0,0 +1,97 @@ +#include<stdio.h> +#include<math.h> +#include "modk.h" +double max_calc(double* ptr,int sz) +{ + int i=0; + double mx; + if(ptr[0]<0) + { + ptr[0]=-1*ptr[0]; + } + mx=(ptr[0]); + //printf("%lf\n",mx); + for(i=1;i<sz;i++) + { + if(ptr[i]<0) + { + ptr[i]=-1*ptr[i]; + } + if(mx<(ptr[i])) + mx=(ptr[i]); + } + return mx; +} +void dmodka(double* inp,int size,double* oup) +{ + double ones[size],PI=M_PI; + double eps=pow(2,-52); + int i; + for(i=0;i<size;i++) + { + ones[i]=1; + } + double a[size],b[size],c[size],an[size],bn[size],cn[size],kans[size]; + + int j,kk,l,m; + for(j=0;j<size;j++) + { + a[j]=1; + } + for(kk=0;kk<size;kk++) + { + b[kk]=sqrt(ones[kk]-inp[kk]); + } + for(l=0;l<size;l++) + { + c[l]=sqrt(inp[l]); + + } + int x=0; + //double maxi; + //maxi=max_calc(c,size); + //printf("%lf",maxi); + + while(max_calc(c,size)>eps) + { + int q,w,r; + for(q=0;q<size;q++) + { + an[q]=0.5*(a[q]+b[q]); + } + for(w=0;w<size;w++) + { + bn[w]=sqrt(a[w]*b[w]); + } + for(r=0;r<size;r++) + { + cn[r]=0.5*(a[r]-b[r]); + } + int x,y,z; + for(x=0;x<size;x++) + { + a[x]=an[x]; + } + for(y=0;y<size;y++) + { + b[y]=bn[y]; + } + for(z=0;z<size;z++) + { + c[z]=cn[z]; + } + } + int q,w; + for(q=0;q<size;q++) + { + oup[q]=PI*(ones[q]/(2*a[q])); + } + +} +/* +int main() +{ + double m[3]={0.1,0.2,0.3}; + dka(m,3); +} +*/ diff --git a/2.3-1/src/c/signalProcessing/transforms/dct/cdcta.c b/2.3-1/src/c/signalProcessing/transforms/dct/cdcta.c new file mode 100644 index 00000000..5bc27929 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/transforms/dct/cdcta.c @@ -0,0 +1,177 @@ +/* Copyright (C) 2016 - 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 +*/ + + +#include "dct.h" +#include "addition.h" +#include "types.h" +#include "floatComplex.h" +/*#include "matrixMultiplication"*/ +/*#include <fftw3.h>*/ +#include <math.h> + +void cdcta(floatComplex *in,int row,int col,int sign,floatComplex *out) +{ + int i,j,k,u,v; + int n; + int x,y; + float res,ress; + float re,z,q,m; + floatComplex accu = DoubleComplex(0, 0); + floatComplex temp,mm; + if(sign==-1) + { + if(row==1) + { + n=col; + for(u=0;u<row;u++) + { + for(v=0;v<col;v++) + { + x=v*row+u; + out[x]=FloatComplex(0,0); + for(i=0;i<row;i++) + { + for(j=0;j<col;j++) + { + y=row*j+i; + temp=in[y]*(cos(((M_PI)*(y+1-1./2.)*(x))/n)); + out[x]=cadds(out[x],temp); + } + } + if(x==0) + out[x]*=1./(sqrt(n)); + else + { + float res=2./n; + out[x]*=sqrt(res); + } + } + } + } + else + { + n=col*row; + for(u=0;u<row;u++) + { + for(v=0;v<col;v++) + { + x=v*row+u; + out[x]=FloatComplex(0,0); + for(i=0;i<row;i++) + { + temp=FloatComplex(0,0); + mm=FloatComplex(0,0); + for(j=0;j<col;j++) + { + y=j*row+i; + z=(float)(((float)j+1.0/2.0)*(float)v); + q=(float)(M_PI/(float)col); + mm=in[y]*(cos(q*z)); + temp=cadds(temp,mm); + } + z=(float)(((float)i+1.0/2.0)*(float)u); + q=(float)(M_PI/(float)row); + temp*=cos(q*z); + out[x]=cadds(out[x],temp); + } + if(u==0) + { + out[x]*=1./sqrt((float)row); + if(v==0) + out[x]*=1./sqrt((float)col); + else + out[x]*=sqrt(2./col); + } + else + { + out[x]*=sqrt(2./row); + if(v==0) + out[x]*=1./sqrt((float)col); + else + out[x]*=sqrt(2./col); + } + } + } + } + } + else if(sign==1) + { + n=col; + if(row==1) + { + res=1./sqrt(n); + ress=sqrt(2./n); + for(u=0;u<row;u++) + { + for(v=0;v<col;v++) + { + x=v*row+u; + out[x]=FloatComplex(0,0); + for(i=0;i<row;i++) + { + for(j=0;j<col;j++) + { + y=row*j+i; + if(y==0) + { + q=res*(cos(((M_PI)*(j)*(v+1./2.))/n)); + out[x]=cadds(out[x],in[y]*q); + } + else + { + q=ress*(cos(((M_PI)*(j)*(v+1./2.))/n)); + out[x]=cadds(out[x],in[y]*q); + } + } + } + } + + } + } + else + { + for(u=0;u<row;u++) + { + for(v=0;v<col;v++) + { + x=v*row+u; + out[x]=FloatComplex(0,0); + for(i=0;i<row;i++) + { + re=0; + mm=FloatComplex(0,0); + temp=FloatComplex(0,0); + for(j=0;j<col;j++) + { + y=row*j+i; + mm=in[j*row+i]; + z=(float)(((float)v+1.0/2.0)*(float)j); + q=(float)(M_PI/(float)col); + mm=mm*(cos(q*z)); + if(j==0) + temp=cadds(temp,mm*(1./sqrt((float)col))); + else + temp=cadds(temp,mm*sqrt(2./col)); + } + z=(float)(((float)u+1.0/2.0)*(float)i); + q=(float)(M_PI/(float)row); + if(i==0) + out[x]=cadds(out[x],temp*((cos(z*q))*(1./sqrt(row)))); + else + out[x]=cadds(out[x],temp*((cos(z*q))*sqrt(2./row))); + } + } + } + } + } +} diff --git a/2.3-1/src/c/signalProcessing/transforms/dct/ddcta.c b/2.3-1/src/c/signalProcessing/transforms/dct/ddcta.c new file mode 100644 index 00000000..3802c816 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/transforms/dct/ddcta.c @@ -0,0 +1,160 @@ +/* Copyright (C) 2016 - 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 +*/ + + +#include "dct.h" +/*#include <fftw3.h>*/ +#include <math.h> + +void ddcta(double *in,int row,int col,int sign,double *out) +{ + int i,j,k,u,v; + int n; + int x,y; + double res,ress; + double re,z,q,m; + if(sign==-1) + { + if(row==1) + { + n=col; + for(u=0;u<row;u++) + { + for(v=0;v<col;v++) + { + x=v*row+u; + out[x]=0; + for(i=0;i<row;i++) + { + for(j=0;j<col;j++) + { + y=row*j+i; + out[x]+=in[y]*(cos(((M_PI)*(y+1-1./2.)*(x))/n)); + } + } + if(x==0) + out[x]*=1./(sqrt(n)); + else + { + double res=2./n; + out[x]*=sqrt(res); + } + } + } + } + else + { + n=col*row; + for(u=0;u<row;u++) + { + for(v=0;v<col;v++) + { + x=v*row+u; + out[x]=0; + for(i=0;i<row;i++) + { + re=0; + for(j=0;j<col;j++) + { + m=(double)in[j*row+i]; + z=(double)(((double)j+1.0/2.0)*(double)v); + q=(double)(M_PI/(double)col); + re+=m*(cos(q*z)); + } + z=(double)(((double)i+1.0/2.0)*(double)u); + q=(double)(M_PI/(double)row); + out[x]+=re*(cos(q*z)); + } + if(u==0) + { + out[x]/=sqrt((double)row); + if(v==0) + out[x]/=sqrt((double)col); + else + out[x]*=sqrt(2./col); + } + else + { + out[x]*=sqrt(2./row); + if(v==0) + out[x]/=sqrt((double)col); + else + out[x]*=sqrt(2./col); + } + } + } + + } + } + else if(sign==1) + { + n=col; + if(row==1) + { + res=1./sqrt(n); + ress=sqrt(2./n); + for(u=0;u<row;u++) + { + for(v=0;v<col;v++) + { + x=v*row+u; + out[x]=0; + for(i=0;i<row;i++) + { + for(j=0;j<col;j++) + { + y=row*j+i; + if(y==0) + out[x]+=res*in[y]*(cos(((M_PI)*(j)*(v+1./2.))/n)); + else + out[x]+=ress*in[y]*(cos(((M_PI)*(j)*(v+1./2.))/n)); + } + } + } + + } + } + else + { + for(u=0;u<row;u++) + { + for(v=0;v<col;v++) + { + x=v*row+u; + out[x]=0; + for(i=0;i<row;i++) + { + re=0; + for(j=0;j<col;j++) + { + y=row*j+i; + m=(double)in[j*row+i]; + z=(double)(((double)v+1.0/2.0)*(double)j); + q=(double)(M_PI/(double)col); + m=m*(cos(q*z)); + if(j==0) + re+=m/sqrt((double)col); + else + re+=m*sqrt(2./col); + } + z=(double)(((double)u+1.0/2.0)*(double)i); + q=(double)(M_PI/(double)row); + if(i==0) + out[x]+=(re*(cos(z*q)))/sqrt((double)row); + else + out[x]+=(re*(cos(z*q))*sqrt(2./row)); + } + } + } + } + } +} diff --git a/2.3-1/src/c/signalProcessing/transforms/dct/zdcta.c b/2.3-1/src/c/signalProcessing/transforms/dct/zdcta.c new file mode 100644 index 00000000..0204d682 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/transforms/dct/zdcta.c @@ -0,0 +1,177 @@ +/* Copyright (C) 2016 - 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 +*/ + + +#include "dct.h" +#include "addition.h" +#include "types.h" +#include "doubleComplex.h" +/*#include "matrixMultiplication"*/ +/*#include <fftw3.h>*/ +#include <math.h> + +void zdcta(doubleComplex *in,int row,int col,int sign,doubleComplex *out) +{ + int i,j,k,u,v; + int n; + int x,y; + double res,ress; + double re,z,q,m; + doubleComplex accu = DoubleComplex(0, 0); + doubleComplex temp,mm; + if(sign==-1) + { + if(row==1) + { + n=col; + for(u=0;u<row;u++) + { + for(v=0;v<col;v++) + { + x=v*row+u; + out[x]=DoubleComplex(0,0); + for(i=0;i<row;i++) + { + for(j=0;j<col;j++) + { + y=row*j+i; + temp=in[y]*(cos(((M_PI)*(y+1-1./2.)*(x))/n)); + out[x]=zadds(out[x],temp); + } + } + if(x==0) + out[x]*=1./(sqrt(n)); + else + { + double res=2./n; + out[x]*=sqrt(res); + } + } + } + } + else + { + n=col*row; + for(u=0;u<row;u++) + { + for(v=0;v<col;v++) + { + x=v*row+u; + out[x]=DoubleComplex(0,0); + for(i=0;i<row;i++) + { + temp=DoubleComplex(0,0); + mm=DoubleComplex(0,0); + for(j=0;j<col;j++) + { + y=j*row+i; + z=(double)(((double)j+1.0/2.0)*(double)v); + q=(double)(M_PI/(double)col); + mm=in[y]*(cos(q*z)); + temp=zadds(temp,mm); + } + z=(double)(((double)i+1.0/2.0)*(double)u); + q=(double)(M_PI/(double)row); + temp*=cos(q*z); + out[x]=zadds(out[x],temp); + } + if(u==0) + { + out[x]*=1./sqrt((double)row); + if(v==0) + out[x]*=1./sqrt((double)col); + else + out[x]*=sqrt(2./col); + } + else + { + out[x]*=sqrt(2./row); + if(v==0) + out[x]*=1./sqrt((double)col); + else + out[x]*=sqrt(2./col); + } + } + } + } + } + else if(sign==1) + { + n=col; + if(row==1) + { + res=1./sqrt(n); + ress=sqrt(2./n); + for(u=0;u<row;u++) + { + for(v=0;v<col;v++) + { + x=v*row+u; + out[x]=DoubleComplex(0,0); + for(i=0;i<row;i++) + { + for(j=0;j<col;j++) + { + y=row*j+i; + if(y==0) + { + q=res*(cos(((M_PI)*(j)*(v+1./2.))/n)); + out[x]=zadds(out[x],in[y]*q); + } + else + { + q=ress*(cos(((M_PI)*(j)*(v+1./2.))/n)); + out[x]=zadds(out[x],in[y]*q); + } + } + } + } + + } + } + else + { + for(u=0;u<row;u++) + { + for(v=0;v<col;v++) + { + x=v*row+u; + out[x]=DoubleComplex(0,0); + for(i=0;i<row;i++) + { + re=0; + mm=DoubleComplex(0,0); + temp=DoubleComplex(0,0); + for(j=0;j<col;j++) + { + y=row*j+i; + mm=in[j*row+i]; + z=(double)(((double)v+1.0/2.0)*(double)j); + q=(double)(M_PI/(double)col); + mm=mm*(cos(q*z)); + if(j==0) + temp=zadds(temp,mm*(1./sqrt((double)col))); + else + temp=zadds(temp,mm*sqrt(2./col)); + } + z=(double)(((double)u+1.0/2.0)*(double)i); + q=(double)(M_PI/(double)row); + if(i==0) + out[x]=zadds(out[x],temp*((cos(z*q))*(1./sqrt(row)))); + else + out[x]=zadds(out[x],temp*((cos(z*q))*sqrt(2./row))); + } + } + } + } + } +} diff --git a/2.3-1/src/c/signalProcessing/transforms/idct/cidcta.c b/2.3-1/src/c/signalProcessing/transforms/idct/cidcta.c new file mode 100644 index 00000000..ec0df0c7 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/transforms/idct/cidcta.c @@ -0,0 +1,97 @@ +/* Copyright (C) 2016 - 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 +*/ + + +#include "idct.h" +#include "addition.h" +#include "types.h" +#include "floatComplex.h" +/*#include "matrixMultiplication"*/ +/*#include <fftw3.h>*/ +#include <math.h> + +void cidcta(floatComplex *in,int row,int col,floatComplex *out) +{ + int i,j,k,u,v; + int n=col; + int x,y; + float res,ress; + float re,z,q,m; + floatComplex accu = DoubleComplex(0, 0); + floatComplex temp,mm; + if(row==1) + { + res=1./sqrt(n); + ress=sqrt(2./n); + for(u=0;u<row;u++) + { + for(v=0;v<col;v++) + { + x=v*row+u; + out[x]=FloatComplex(0,0); + for(i=0;i<row;i++) + { + for(j=0;j<col;j++) + { + y=row*j+i; + if(y==0) + { + q=res*(cos(((M_PI)*(j)*(v+1./2.))/n)); + out[x]=cadds(out[x],in[y]*q); + } + else + { + q=ress*(cos(((M_PI)*(j)*(v+1./2.))/n)); + out[x]=cadds(out[x],in[y]*q); + } + } + } + } + + } + } + else + { + for(u=0;u<row;u++) + { + for(v=0;v<col;v++) + { + x=v*row+u; + out[x]=FloatComplex(0,0); + for(i=0;i<row;i++) + { + re=0; + mm=FloatComplex(0,0); + temp=FloatComplex(0,0); + for(j=0;j<col;j++) + { + y=row*j+i; + mm=in[j*row+i]; + z=(float)(((float)v+1.0/2.0)*(float)j); + q=(float)(M_PI/(float)col); + mm=mm*(cos(q*z)); + if(j==0) + temp=cadds(temp,mm*(1./sqrt((float)col))); + else + temp=cadds(temp,mm*sqrt(2./col)); + } + z=(float)(((float)u+1.0/2.0)*(float)i); + q=(float)(M_PI/(float)row); + if(i==0) + out[x]=cadds(out[x],temp*((cos(z*q))*(1./sqrt(row)))); + else + out[x]=cadds(out[x],temp*((cos(z*q))*sqrt(2./row))); + } + } + } + } +} diff --git a/2.3-1/src/c/signalProcessing/transforms/idct/didcta.c b/2.3-1/src/c/signalProcessing/transforms/idct/didcta.c new file mode 100644 index 00000000..5f475160 --- /dev/null +++ b/2.3-1/src/c/signalProcessing/transforms/idct/didcta.c @@ -0,0 +1,83 @@ +/* Copyright (C) 2016 - 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 +*/ + + +#include "idct.h" +/*#include <fftw3.h>*/ +#include <math.h> + +void didcta(double *in,int row,int col,double *out) +{ + int i,j,k,u,v; + int n=col; + int x,y; + double res,ress; + double re,z,q,m; + if(row==1) + { + res=1./sqrt(n); + ress=sqrt(2./n); + for(u=0;u<row;u++) + { + for(v=0;v<col;v++) + { + x=v*row+u; + out[x]=0; + for(i=0;i<row;i++) + { + for(j=0;j<col;j++) + { + y=row*j+i; + if(y==0) + out[x]+=res*in[y]*(cos(((M_PI)*(j)*(v+1./2.))/n)); + else + out[x]+=ress*in[y]*(cos(((M_PI)*(j)*(v+1./2.))/n)); + } + } + } + + } + } + else + { + for(u=0;u<row;u++) + { + for(v=0;v<col;v++) + { + x=v*row+u; + out[x]=0; + for(i=0;i<row;i++) + { + re=0; + for(j=0;j<col;j++) + { + y=row*j+i; + m=(double)in[j*row+i]; + z=(double)(((double)v+1.0/2.0)*(double)j); + q=(double)(M_PI/(double)col); + m=m*(cos(q*z)); + if(j==0) + re+=m/sqrt((double)col); + else + re+=m*sqrt(2./col); + } + z=(double)(((double)u+1.0/2.0)*(double)i); + q=(double)(M_PI/(double)row); + if(i==0) + out[x]+=(re*(cos(z*q)))/sqrt((double)row); + else + out[x]+=(re*(cos(z*q))*sqrt(2./row)); + } + } + } + } +} diff --git a/2.3-1/src/c/signalProcessing/transforms/idct/zidcta.c b/2.3-1/src/c/signalProcessing/transforms/idct/zidcta.c new file mode 100644 index 00000000..2177b18c --- /dev/null +++ b/2.3-1/src/c/signalProcessing/transforms/idct/zidcta.c @@ -0,0 +1,97 @@ +/* Copyright (C) 2016 - 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 +*/ + + +#include "idct.h" +#include "addition.h" +#include "types.h" +#include "doubleComplex.h" +/*#include "matrixMultiplication"*/ +/*#include <fftw3.h>*/ +#include <math.h> + +void zidcta(doubleComplex *in,int row,int col,doubleComplex *out) +{ + int i,j,k,u,v; + int n=col; + int x,y; + double res,ress; + double re,z,q,m; + doubleComplex accu = DoubleComplex(0, 0); + doubleComplex temp,mm; + if(row==1) + { + res=1./sqrt(n); + ress=sqrt(2./n); + for(u=0;u<row;u++) + { + for(v=0;v<col;v++) + { + x=v*row+u; + out[x]=DoubleComplex(0,0); + for(i=0;i<row;i++) + { + for(j=0;j<col;j++) + { + y=row*j+i; + if(y==0) + { + q=res*(cos(((M_PI)*(j)*(v+1./2.))/n)); + out[x]=zadds(out[x],in[y]*q); + } + else + { + q=ress*(cos(((M_PI)*(j)*(v+1./2.))/n)); + out[x]=zadds(out[x],in[y]*q); + } + } + } + } + + } + } + else + { + for(u=0;u<row;u++) + { + for(v=0;v<col;v++) + { + x=v*row+u; + out[x]=DoubleComplex(0,0); + for(i=0;i<row;i++) + { + re=0; + mm=DoubleComplex(0,0); + temp=DoubleComplex(0,0); + for(j=0;j<col;j++) + { + y=row*j+i; + mm=in[j*row+i]; + z=(double)(((double)v+1.0/2.0)*(double)j); + q=(double)(M_PI/(double)col); + mm=mm*(cos(q*z)); + if(j==0) + temp=zadds(temp,mm*(1./sqrt((double)col))); + else + temp=zadds(temp,mm*sqrt(2./col)); + } + z=(double)(((double)u+1.0/2.0)*(double)i); + q=(double)(M_PI/(double)row); + if(i==0) + out[x]=zadds(out[x],temp*((cos(z*q))*(1./sqrt(row)))); + else + out[x]=zadds(out[x],temp*((cos(z*q))*sqrt(2./row))); + } + } + } + } +} |