summaryrefslogtreecommitdiff
path: root/2.3-1/macros
diff options
context:
space:
mode:
authorsiddhu89902016-05-27 11:50:04 +0530
committersiddhu89902016-05-27 11:50:04 +0530
commit49003250e69e4e500742614888e47db789bbe451 (patch)
tree44bdcb9f8a4989789bbab2e10cd43d114fb237b4 /2.3-1/macros
parent18587a5f0cf86d636ac23a5be567437cd822bbc2 (diff)
downloadScilab2C-49003250e69e4e500742614888e47db789bbe451.tar.gz
Scilab2C-49003250e69e4e500742614888e47db789bbe451.tar.bz2
Scilab2C-49003250e69e4e500742614888e47db789bbe451.zip
Support for basic ODE function added
Diffstat (limited to '2.3-1/macros')
-rw-r--r--2.3-1/macros/ASTManagement/AST_HandleEndGenFun.binbin87244 -> 88688 bytes
-rw-r--r--2.3-1/macros/ASTManagement/AST_HandleEndGenFun.sci23
-rw-r--r--2.3-1/macros/CCodeGeneration/C_FinalizeCode.binbin13584 -> 16292 bytes
-rw-r--r--2.3-1/macros/CCodeGeneration/C_FinalizeCode.sci18
-rw-r--r--2.3-1/macros/CCodeGeneration/C_Funcall.binbin62220 -> 71780 bytes
-rw-r--r--2.3-1/macros/CCodeGeneration/C_Funcall.sci109
-rw-r--r--2.3-1/macros/CCodeGeneration/C_GenDeclarations.binbin21532 -> 22000 bytes
-rw-r--r--2.3-1/macros/CCodeGeneration/C_GenDeclarations.sci28
-rw-r--r--2.3-1/macros/CCodeGeneration/C_GenerateFunName.binbin6436 -> 6736 bytes
-rw-r--r--2.3-1/macros/CCodeGeneration/C_GenerateFunName.sci5
-rw-r--r--2.3-1/macros/CCodeGeneration/C_GenerateMakefile.binbin26144 -> 26832 bytes
-rw-r--r--2.3-1/macros/CCodeGeneration/C_GenerateMakefile.sci4
-rw-r--r--2.3-1/macros/FunctionAnnotation/FA_SZ_PERMUTE_COL.binbin0 -> 592 bytes
-rw-r--r--2.3-1/macros/FunctionAnnotation/FA_SZ_PERMUTE_COL.sci9
-rw-r--r--2.3-1/macros/FunctionAnnotation/FA_SZ_PERMUTE_ROW.binbin0 -> 780 bytes
-rw-r--r--2.3-1/macros/FunctionAnnotation/FA_SZ_PERMUTE_ROW.sci9
-rw-r--r--2.3-1/macros/FunctionAnnotation/libbin2132 -> 2180 bytes
-rw-r--r--2.3-1/macros/FunctionAnnotation/names2
-rw-r--r--2.3-1/macros/SymbolTable/ST_GetInArgInfo.binbin28200 -> 30740 bytes
-rw-r--r--2.3-1/macros/SymbolTable/ST_GetInArgInfo.sci49
-rw-r--r--2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.binbin1119708 -> 1130680 bytes
-rw-r--r--2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci52
-rw-r--r--2.3-1/macros/ToolInitialization/INIT_GenSharedInfo.binbin20052 -> 20728 bytes
-rw-r--r--2.3-1/macros/ToolInitialization/INIT_GenSharedInfo.sci5
-rw-r--r--2.3-1/macros/findDeps/getAllHeaders.binbin29572 -> 29572 bytes
-rw-r--r--2.3-1/macros/findDeps/getAllHeaders.sci4
-rw-r--r--2.3-1/macros/findDeps/getAllInterfaces.binbin30808 -> 31024 bytes
-rw-r--r--2.3-1/macros/findDeps/getAllInterfaces.sci5
-rw-r--r--2.3-1/macros/findDeps/getAllSources.binbin182728 -> 182736 bytes
-rw-r--r--2.3-1/macros/findDeps/getAllSources.sci6
-rw-r--r--2.3-1/macros/runsci2c.binbin28820 -> 28740 bytes
-rw-r--r--2.3-1/macros/runsci2c.sci9
32 files changed, 232 insertions, 105 deletions
diff --git a/2.3-1/macros/ASTManagement/AST_HandleEndGenFun.bin b/2.3-1/macros/ASTManagement/AST_HandleEndGenFun.bin
index 27c8880b..414942c3 100644
--- a/2.3-1/macros/ASTManagement/AST_HandleEndGenFun.bin
+++ b/2.3-1/macros/ASTManagement/AST_HandleEndGenFun.bin
Binary files differ
diff --git a/2.3-1/macros/ASTManagement/AST_HandleEndGenFun.sci b/2.3-1/macros/ASTManagement/AST_HandleEndGenFun.sci
index b08ab398..41c4cb40 100644
--- a/2.3-1/macros/ASTManagement/AST_HandleEndGenFun.sci
+++ b/2.3-1/macros/ASTManagement/AST_HandleEndGenFun.sci
@@ -197,14 +197,18 @@ global STACKDEDUG
//as it is passed as string to C function. Also enter this function in conversion list also.
if(ASTFunName == 'ode')
if NInArg == 4
- InArg(4).Scope = 'String';
- ODEFunName = InArg(4).Name;
+ //InArg(4).Scope = 'String';
+ ODEFunName = InArg(4).Name;
+ InArg(4).Name = 'odefn'+ InArg(4).Name
+ //To differentiate functions containing differential equations,
+ //'odefn' is added at the beginning of the function name.
+ SharedInfo.ODElist($+1) = InArg(4).Name;
+ //Add ode function in list. this will be used to add corresponding
+ //header file in main function.
end
end
- [InArg,SharedInfo] = ST_GetInArgInfo(InArg,NInArg,FileInfo,SharedInfo);
- if(ASTFunName == 'ode')
- disp(InArg(4).Name);
- end
+ [InArg,SharedInfo] = ST_GetInArgInfo(InArg,NInArg,FileInfo,SharedInfo,ASTFunName);
+
end
// #RNU_RES_B
@@ -361,11 +365,12 @@ global STACKDEDUG
ODE_InArg(1) = InArg(3)
ODE_InArg(2) = InArg(1)
ODE_OutArg(1) = OutArg(1)
- ODE_CFunName = C_GenerateFunName(ODEFunName,ODE_InArg,2,ODE_OutArg,1);
-
+ ODE_CFunName = C_GenerateFunName('odefn'+ODEFunName,ODE_InArg,2,ODE_OutArg,1);
+ //Functions containing differential equations that are used with 'ode'
+ //function need to be handled differently.
+
[FunFound, FunType, FunSize, FunValue, FunFindLike, FunDimension] = ...
ST_Get(InArg(4).Name,FileInfo.GlobalVarFileName);
- disp(FunFound);
//ST_Del(InArg(4).Name,FileInfo.GlobalVarFileName);
//ST_Set(ODE_CFunName, FunType, FunSize, FunValue, FunFindLike, FunDimension);
end
diff --git a/2.3-1/macros/CCodeGeneration/C_FinalizeCode.bin b/2.3-1/macros/CCodeGeneration/C_FinalizeCode.bin
index 5cc21487..44c534e5 100644
--- a/2.3-1/macros/CCodeGeneration/C_FinalizeCode.bin
+++ b/2.3-1/macros/CCodeGeneration/C_FinalizeCode.bin
Binary files differ
diff --git a/2.3-1/macros/CCodeGeneration/C_FinalizeCode.sci b/2.3-1/macros/CCodeGeneration/C_FinalizeCode.sci
index 69cad558..1f3c6b58 100644
--- a/2.3-1/macros/CCodeGeneration/C_FinalizeCode.sci
+++ b/2.3-1/macros/CCodeGeneration/C_FinalizeCode.sci
@@ -73,6 +73,24 @@ PrintStringInfo('** ----------------- ',FinalCFileName,'file','y');
PrintStringInfo('*/',FinalCFileName,'file','y');
PrintStringInfo('#include ""'+tmphdrname+tmphdrext+'""',...
FinalCFileName,'file','y');
+//If current file is main C file, include header files corresponding to ODE
+//functions, if any.
+if(SharedInfo.NextSCIFunName == SharedInfo.SCIMainFunName)
+ if(size(SharedInfo.ODElist) <> 0) //check if list is empty
+ //If not empty, add those header files here.
+ for cntlist = 1:size(SharedInfo.ODElist)
+ PrintStringInfo('#include ""'+SharedInfo.ODElist(cntlist)+'.h""',...
+ FinalCFileName,'file','y');
+ end
+
+ end
+end
+
+//If current function contains ODEs, add gsl/gsl_errno.h.
+if (mtlb_strcmp(part(SharedInfo.CurrentFunInfo.CFunctionName,1:5),'odefn') == %T)
+ PrintStringInfo('#include <gsl/gsl_errno.h>',...
+ FinalCFileName,'file','y');
+end
PrintStringInfo('/*',FinalCFileName,'file','y');
PrintStringInfo('** --------------------- ',FinalCFileName,'file','y');
PrintStringInfo('** --- End Includes. --- ',FinalCFileName,'file','y');
diff --git a/2.3-1/macros/CCodeGeneration/C_Funcall.bin b/2.3-1/macros/CCodeGeneration/C_Funcall.bin
index 36823876..f54c0c3d 100644
--- a/2.3-1/macros/CCodeGeneration/C_Funcall.bin
+++ b/2.3-1/macros/CCodeGeneration/C_Funcall.bin
Binary files differ
diff --git a/2.3-1/macros/CCodeGeneration/C_Funcall.sci b/2.3-1/macros/CCodeGeneration/C_Funcall.sci
index 3669e54d..eec20c70 100644
--- a/2.3-1/macros/CCodeGeneration/C_Funcall.sci
+++ b/2.3-1/macros/CCodeGeneration/C_Funcall.sci
@@ -180,6 +180,9 @@ if (FunInfo.CFunctionName == SharedInfo.CMainFunName)
else
CCall =CCall+'int ';
end
+elseif (mtlb_strcmp(part(CFunName,1:5),'odefn') == %T)
+ //Return type of function containing ODEs must be int.
+ CCall = CCall + 'int ';
else
if (PosFirstOutScalar >= 1)
if (FlagCall == 1)
@@ -207,39 +210,84 @@ end
PrintStringInfo(' C call after output scalar args check: '+CCall,ReportFileName,'file','y');
// #RNU_RES_E
clear counterin
-for counterin = 1:NInArg
-
- if (InArg(counterin).Type == 'g' & InArg(counterin).Scope == 'String')
- TmpInArgName = '""'+InArg(counterin).Name+'""';
- elseif (InArg(counterin).Type == 'z' & (InArg(counterin).Scope == 'Number'))
- TmpInArgName = 'DoubleComplex('+SCI2Cstring(real(InArg(counterin).Value))+','+SCI2Cstring(imag(InArg(counterin).Value))+')';
- elseif (InArg(counterin).Type == 'c' & (InArg(counterin).Scope == 'Number'))
- TmpInArgName = 'FloatComplex('+SCI2Cstring(real(InArg(counterin).Value))+','+SCI2Cstring(imag(InArg(counterin).Value))+')';
- else
- TmpInArgName = InArg(counterin).Name;
- end
+if(mtlb_strcmp(part(CFunName,1:5),'odefn') == %F)
+ for counterin = 1:NInArg
- TmpInArgType = C_Type(InArg(counterin).Type);
+ if (InArg(counterin).Type == 'g' & InArg(counterin).Scope == 'String')
+ TmpInArgName = '""'+InArg(counterin).Name+'""';
+ elseif (InArg(counterin).Type == 'z' & (InArg(counterin).Scope == 'Number'))
+ TmpInArgName = 'DoubleComplex('+SCI2Cstring(real(InArg(counterin).Value))+','+SCI2Cstring(imag(InArg(counterin).Value))+')';
+ elseif (InArg(counterin).Type == 'c' & (InArg(counterin).Scope == 'Number'))
+ TmpInArgName = 'FloatComplex('+SCI2Cstring(real(InArg(counterin).Value))+','+SCI2Cstring(imag(InArg(counterin).Value))+')';
+ else
+ TmpInArgName = InArg(counterin).Name;
+ end
- //if (FunctionName == 'OpEqual')
- // TmpInArgSizeVar = '__'+OutArg(counterin).Name+'Size';
- // else
- TmpInArgSizeVar = '__'+InArg(counterin).Name+'Size';
- //end
+ TmpInArgType = C_Type(InArg(counterin).Type);
- if (InArg(counterin).Dimension == 0)
- if (FlagCall == 0)
- CCall = CCall+TmpInArgType+' ';
- end
- CCall = CCall+TmpInArgName+',';
- else
- if (FlagCall == 0)
- CCall = CCall+TmpInArgType+'* '+TmpInArgName+', int* __'+TmpInArgName+'Size,';
+ //if (FunctionName == 'OpEqual')
+ // TmpInArgSizeVar = '__'+OutArg(counterin).Name+'Size';
+ // else
+ TmpInArgSizeVar = '__'+InArg(counterin).Name+'Size';
+ //end
+
+ if (InArg(counterin).Dimension == 0)
+ if (FlagCall == 0)
+ CCall = CCall+TmpInArgType+' ';
+ end
+ CCall = CCall+TmpInArgName+',';
else
- CCall = CCall+TmpInArgName+', '+TmpInArgSizeVar+',';
+ if (FlagCall == 0)
+ CCall = CCall+TmpInArgType+'* '+TmpInArgName+', int* __'+TmpInArgName+'Size,';
+ else
+ CCall = CCall+TmpInArgName+', '+TmpInArgSizeVar+',';
+ end
+ end
+ end
+else
+ //If current function contains 'odefn' at the beginning, then it contains
+ //differnetial equations and its function call need to be differnt than
+ //other function call. GSL library being used for solving ODEs, requires
+ //function containing odes in specific format which is differnt than generated
+ //above.
+ for counterin = 1:NInArg
+
+ if(counterin <> 3) //Skip third argument
+ if (InArg(counterin).Type == 'g' & InArg(counterin).Scope == 'String')
+ TmpInArgName = '""'+InArg(counterin).Name+'""';
+ elseif (InArg(counterin).Type == 'z' & (InArg(counterin).Scope == 'Number'))
+ TmpInArgName = 'DoubleComplex('+SCI2Cstring(real(InArg(counterin).Value))+','+SCI2Cstring(imag(InArg(counterin).Value))+')';
+ elseif (InArg(counterin).Type == 'c' & (InArg(counterin).Scope == 'Number'))
+ TmpInArgName = 'FloatComplex('+SCI2Cstring(real(InArg(counterin).Value))+','+SCI2Cstring(imag(InArg(counterin).Value))+')';
+ else
+ TmpInArgName = InArg(counterin).Name;
+ end
+
+ TmpInArgType = C_Type(InArg(counterin).Type);
+
+ //if (FunctionName == 'OpEqual')
+ // TmpInArgSizeVar = '__'+OutArg(counterin).Name+'Size';
+ // else
+ TmpInArgSizeVar = '__'+InArg(counterin).Name+'Size';
+ //end
+
+ if (InArg(counterin).Dimension == 0)
+ if (FlagCall == 0)
+ CCall = CCall+TmpInArgType+' ';
+ end
+ CCall = CCall+TmpInArgName+',';
+ else
+ if (FlagCall == 0)
+ CCall = CCall+TmpInArgType+'* '+TmpInArgName+', ';//int* __'+TmpInArgName+'Size,';
+ else
+ CCall = CCall+TmpInArgName+', ';//+TmpInArgSizeVar+',';
+ end
+ end
end
end
+
end
+
// #RNU_RES_B
PrintStringInfo(' C call after input args analysis: '+CCall,ReportFileName,'file','y');
// #RNU_RES_E
@@ -308,6 +356,11 @@ if (part(CCall,length(CCall):length(CCall)) == ',')
CCall = part(CCall,1:length(CCall)-1);
end
+//__ysize is added to input arguments at last to comply with form required by GSL
+if(mtlb_strcmp(part(CFunName,1:5),'odefn') == %T)
+ CCall = CCall + ', int* '+TmpInArgSizeVar;
+end
+
CCall = CCall+')';
if (FlagCall == 1)
CCall = CCall+';';
@@ -352,8 +405,12 @@ if mtlb_strcmp(FunctionName,'return')
PrintStringInfo(' return function of the AST is skipped.',ReportFileName,'file','y');
//RN provo a non skippare e a mettere la return.
// #RNU_RES_E
+
if (SharedInfo.CurrentFunInfo.CFunctionName == SharedInfo.CMainFunName)
CCall = CCall+'return(0);';
+ elseif (mtlb_strcmp(part(SharedInfo.CurrentFunInfo.CFunctionName,1:5),'odefn') == %T)
+ //For GSL library, function containing ODEs must return GSL_SUCCESS
+ CCall = CCall + 'return GSL_SUCCESS;'
else
if (SharedInfo.CurrentFunInfo.PosFirstOutScalar > 0)
CCall = CCall+'return('+SharedInfo.CurrentFunInfo.OutArg(SharedInfo.CurrentFunInfo.PosFirstOutScalar).Name+');'
diff --git a/2.3-1/macros/CCodeGeneration/C_GenDeclarations.bin b/2.3-1/macros/CCodeGeneration/C_GenDeclarations.bin
index 8bd7257e..1e6c4553 100644
--- a/2.3-1/macros/CCodeGeneration/C_GenDeclarations.bin
+++ b/2.3-1/macros/CCodeGeneration/C_GenDeclarations.bin
Binary files differ
diff --git a/2.3-1/macros/CCodeGeneration/C_GenDeclarations.sci b/2.3-1/macros/CCodeGeneration/C_GenDeclarations.sci
index 7a6565ec..eb61723d 100644
--- a/2.3-1/macros/CCodeGeneration/C_GenDeclarations.sci
+++ b/2.3-1/macros/CCodeGeneration/C_GenDeclarations.sci
@@ -92,24 +92,28 @@ if (ArgStruct.Dimension > 0)
Cdeclaration(2) = Cdeclaration(2)+';';
end
else
- if (FlagExt == 1)
- Cdeclaration(1) = 'extern ';
+ if (ArgStruct.Type == 'f')
+ //do nothing. This is a function name. Will be declared in header file.
else
- Cdeclaration(1) = '';
- end
- Cdeclaration(1) = Cdeclaration(1)+C_Type(ArgStruct.Type)+' '+ArgStruct.Name;
- if (~isnan(ArgStruct.Value) & (FlagExt == 0))
- if isreal(ArgStruct.Value)
- Cdeclaration(1) = Cdeclaration(1)+' = '+SCI2Cstring(ArgStruct.Value);
+ if (FlagExt == 1)
+ Cdeclaration(1) = 'extern ';
else
- if (ArgStruct.Type == 'z')
- Cdeclaration(1) = Cdeclaration(1)+' = DoubleComplex('+SCI2Cstring(real(ArgStruct.Value))+','+SCI2Cstring(imag(ArgStruct.Value))+')';
+ Cdeclaration(1) = '';
+ end
+ Cdeclaration(1) = Cdeclaration(1)+C_Type(ArgStruct.Type)+' '+ArgStruct.Name;
+ if (~isnan(ArgStruct.Value) & (FlagExt == 0))
+ if isreal(ArgStruct.Value)
+ Cdeclaration(1) = Cdeclaration(1)+' = '+SCI2Cstring(ArgStruct.Value);
else
- Cdeclaration(1) = Cdeclaration(1)+' = FloatComplex('+SCI2Cstring(real(ArgStruct.Value))+','+SCI2Cstring(imag(ArgStruct.Value))+')';
+ if (ArgStruct.Type == 'z')
+ Cdeclaration(1) = Cdeclaration(1)+' = DoubleComplex('+SCI2Cstring(real(ArgStruct.Value))+','+SCI2Cstring(imag(ArgStruct.Value))+')';
+ else
+ Cdeclaration(1) = Cdeclaration(1)+' = FloatComplex('+SCI2Cstring(real(ArgStruct.Value))+','+SCI2Cstring(imag(ArgStruct.Value))+')';
+ end
end
end
+ Cdeclaration(1) = Cdeclaration(1)+';';
end
- Cdeclaration(1) = Cdeclaration(1)+';';
end
diff --git a/2.3-1/macros/CCodeGeneration/C_GenerateFunName.bin b/2.3-1/macros/CCodeGeneration/C_GenerateFunName.bin
index 9a4af082..8486a3b2 100644
--- a/2.3-1/macros/CCodeGeneration/C_GenerateFunName.bin
+++ b/2.3-1/macros/CCodeGeneration/C_GenerateFunName.bin
Binary files differ
diff --git a/2.3-1/macros/CCodeGeneration/C_GenerateFunName.sci b/2.3-1/macros/CCodeGeneration/C_GenerateFunName.sci
index 54c641f2..d87fb9c1 100644
--- a/2.3-1/macros/CCodeGeneration/C_GenerateFunName.sci
+++ b/2.3-1/macros/CCodeGeneration/C_GenerateFunName.sci
@@ -23,14 +23,14 @@ function CFunName = C_GenerateFunName(FunctionName,InArg,NInArg,OutArg,NOutArg)
// ------------------------------
SCI2CNInArgCheck(argn(2),5,5);
CFunName = '';
-if((IsAVRSupportFunction(FunctionName)) | (IsRPISupportFunction(FunctionName)))
+if((IsAVRSupportFunction(FunctionName)) | (IsRPISupportFunction(FunctionName)) | ...
+ (mtlb_strcmp(part(FunctionName,1:5),'odefn') == %T))
//If current function is an AVR or RPi function, then function name can be just
//plain function name without any input/output arguments types
CFunName = CFunName+FunctionName;
else
-
for tmpcnt = 1:NInArg
if (InArg(tmpcnt).Dimension == 1)
CFunName = CFunName+InArg(tmpcnt).Type+'2';
@@ -48,5 +48,6 @@ else
CFunName = CFunName+OutArg(tmpcnt).Type+SCI2Cstring(OutArg(tmpcnt).Dimension);
end
end
+
end
endfunction
diff --git a/2.3-1/macros/CCodeGeneration/C_GenerateMakefile.bin b/2.3-1/macros/CCodeGeneration/C_GenerateMakefile.bin
index 43de2290..76090baa 100644
--- a/2.3-1/macros/CCodeGeneration/C_GenerateMakefile.bin
+++ b/2.3-1/macros/CCodeGeneration/C_GenerateMakefile.bin
Binary files differ
diff --git a/2.3-1/macros/CCodeGeneration/C_GenerateMakefile.sci b/2.3-1/macros/CCodeGeneration/C_GenerateMakefile.sci
index 4817af1e..fecbf915 100644
--- a/2.3-1/macros/CCodeGeneration/C_GenerateMakefile.sci
+++ b/2.3-1/macros/CCodeGeneration/C_GenerateMakefile.sci
@@ -75,6 +75,10 @@ else
PrintStringInfo('LDFLAGS = -lblas -llapack -lm ',FileInfo.MakefileFilename,'file','y','y');
end
end
+//If ode function is used, add libgsl.
+if(size(SharedInfo.ODElist) <> 0)
+ PrintStringInfo('LDFLAGS += -lgsl',FileInfo.MakefileFilename,'file','y','y');
+end
// Binary definition
PrintStringInfo('EXEFILENAME = mytest.exe',FileInfo.MakefileFilename,'file','y','y');
diff --git a/2.3-1/macros/FunctionAnnotation/FA_SZ_PERMUTE_COL.bin b/2.3-1/macros/FunctionAnnotation/FA_SZ_PERMUTE_COL.bin
new file mode 100644
index 00000000..c5a806a2
--- /dev/null
+++ b/2.3-1/macros/FunctionAnnotation/FA_SZ_PERMUTE_COL.bin
Binary files differ
diff --git a/2.3-1/macros/FunctionAnnotation/FA_SZ_PERMUTE_COL.sci b/2.3-1/macros/FunctionAnnotation/FA_SZ_PERMUTE_COL.sci
new file mode 100644
index 00000000..de063e60
--- /dev/null
+++ b/2.3-1/macros/FunctionAnnotation/FA_SZ_PERMUTE_COL.sci
@@ -0,0 +1,9 @@
+function outsize=FA_SZ_PERMUTE_COL(insize, val)
+
+outsize = 4;
+//if((val(0) == '1') & (val(1) == '2'))
+// outsize = insize(2);
+//else
+// outsize = insize(1);
+//end
+endfunction \ No newline at end of file
diff --git a/2.3-1/macros/FunctionAnnotation/FA_SZ_PERMUTE_ROW.bin b/2.3-1/macros/FunctionAnnotation/FA_SZ_PERMUTE_ROW.bin
new file mode 100644
index 00000000..747a31d3
--- /dev/null
+++ b/2.3-1/macros/FunctionAnnotation/FA_SZ_PERMUTE_ROW.bin
Binary files differ
diff --git a/2.3-1/macros/FunctionAnnotation/FA_SZ_PERMUTE_ROW.sci b/2.3-1/macros/FunctionAnnotation/FA_SZ_PERMUTE_ROW.sci
new file mode 100644
index 00000000..3dd4e604
--- /dev/null
+++ b/2.3-1/macros/FunctionAnnotation/FA_SZ_PERMUTE_ROW.sci
@@ -0,0 +1,9 @@
+function outsize=FA_SZ_PERMUTE_ROW(insize, val)
+disp(size(val))
+outsize = 3;
+//if((val(0) == '1') & (val(1) == '2'))
+// outsize = insize(1);
+//else
+// outsize = insize(2);
+//end
+endfunction \ No newline at end of file
diff --git a/2.3-1/macros/FunctionAnnotation/lib b/2.3-1/macros/FunctionAnnotation/lib
index a31bc1a7..81fa5d45 100644
--- a/2.3-1/macros/FunctionAnnotation/lib
+++ b/2.3-1/macros/FunctionAnnotation/lib
Binary files differ
diff --git a/2.3-1/macros/FunctionAnnotation/names b/2.3-1/macros/FunctionAnnotation/names
index 4fc53d40..5658291f 100644
--- a/2.3-1/macros/FunctionAnnotation/names
+++ b/2.3-1/macros/FunctionAnnotation/names
@@ -40,6 +40,8 @@ FA_SZ_OPPLUSA
FA_SZ_OPRC
FA_SZ_OPSLASH
FA_SZ_OPSTAR
+FA_SZ_PERMUTE_COL
+FA_SZ_PERMUTE_ROW
FA_SZ_ROW_COLUMN
FA_SZ_ROW_COLUMN_CAT
FA_SZ_ROW_DIAG
diff --git a/2.3-1/macros/SymbolTable/ST_GetInArgInfo.bin b/2.3-1/macros/SymbolTable/ST_GetInArgInfo.bin
index 46c21548..61be39aa 100644
--- a/2.3-1/macros/SymbolTable/ST_GetInArgInfo.bin
+++ b/2.3-1/macros/SymbolTable/ST_GetInArgInfo.bin
Binary files differ
diff --git a/2.3-1/macros/SymbolTable/ST_GetInArgInfo.sci b/2.3-1/macros/SymbolTable/ST_GetInArgInfo.sci
index 1fe060a5..5f1a6cfc 100644
--- a/2.3-1/macros/SymbolTable/ST_GetInArgInfo.sci
+++ b/2.3-1/macros/SymbolTable/ST_GetInArgInfo.sci
@@ -1,4 +1,4 @@
-function [UpdatedInArg,SharedInfo] = ST_GetInArgInfo(InArg,NInArg,FileInfo,SharedInfo)
+function [UpdatedInArg,SharedInfo] = ST_GetInArgInfo(InArg,NInArg,FileInfo,SharedInfo,ASTFunName)
// function UpdatedInArg = ST_GetInArgInfo(InArg,NInArg,FileInfo,SharedInfo)
// -----------------------------------------------------------------
// #RNU_RES_B
@@ -26,7 +26,7 @@ function [UpdatedInArg,SharedInfo] = ST_GetInArgInfo(InArg,NInArg,FileInfo,Share
// ------------------------------
// --- Check input arguments. ---
// ------------------------------
-SCI2CNInArgCheck(argn(2),4,4);
+SCI2CNInArgCheck(argn(2),5,5);
// -----------------------
// --- Initialization. ---
@@ -115,7 +115,7 @@ for cntinarg = 1:NInArg
UpdatedInArg(cntinarg).Size(2) = string(length(tmpname)+1); //+1 = (\0)
UpdatedInArg(cntinarg).Value = '""'+tmpname+'""';
UpdatedInArg(cntinarg).FindLike = 0;
- UpdatedInArg(cntinarg).Dimension = 2; //NUT: in future releases you can set this field to 1.
+ UpdatedInArg(cntinarg).Dimension = 2; //Keep it zero to avoid extra argument 'funcnameSize'.
UpdatedInArg(cntinarg).Scope = 'Temp';
// #RNU_RES_B
@@ -130,21 +130,36 @@ for cntinarg = 1:NInArg
// #RNU_RES_E
[TBFlagfound,TBType,TBSize,TBValue,TBFindLike,TBDimension,TBScope] = ST_GetSymbolInfo(tmpname,FileInfo,SharedInfo);
if (TBFlagfound == 0)
- PrintStringInfo(' ',ReportFileName,'both','y');
- PrintStringInfo('SCI2CERROR: Unknown symbol ""'+tmpname+'"".',ReportFileName,'both','y');
- PrintStringInfo('SCI2CERROR: Be sure to initialize every symbol you are using.',ReportFileName,'both','y');
- PrintStringInfo('SCI2CERROR: Before running the SCI2C translator, remember to run the code you are trying',ReportFileName,'both','y');
- PrintStringInfo('SCI2CERROR: to translate in order to check syntax errors.',ReportFileName,'both','y');
- PrintStringInfo(' ',ReportFileName,'both','y');
- error(9999, 'SCI2CERROR: Unknown symbol ""'+tmpname+'"".');
+ if(ASTFunName == 'ode')
+ if(NInArg == 4 & cntinarg == 4)
+ //incase of 4 arguments, fourth argument is function name
+ UpdatedInArg(cntinarg).Name = tmpname; // Change the name.
+ UpdatedInArg(cntinarg).Type = 'f'; //it is a function name
+ UpdatedInArg(cntinarg).Size(1) = '1';
+ UpdatedInArg(cntinarg).Size(2) = '1'; //+1 = (\0)
+ UpdatedInArg(cntinarg).Value = '&'+tmpname;
+ UpdatedInArg(cntinarg).FindLike = 0;
+ UpdatedInArg(cntinarg).Dimension = 0; //NUT: in future releases you can set this field to 1.
+ UpdatedInArg(cntinarg).Scope = 'Temp';
+ ST_InsOutArg(UpdatedInArg(cntinarg),1,FileInfo,SharedInfo,'all');
+ end
+ else
+ PrintStringInfo(' ',ReportFileName,'both','y');
+ PrintStringInfo('SCI2CERROR: Unknown symbol ""'+tmpname+'"".',ReportFileName,'both','y');
+ PrintStringInfo('SCI2CERROR: Be sure to initialize every symbol you are using.',ReportFileName,'both','y');
+ PrintStringInfo('SCI2CERROR: Before running the SCI2C translator, remember to run the code you are trying',ReportFileName,'both','y');
+ PrintStringInfo('SCI2CERROR: to translate in order to check syntax errors.',ReportFileName,'both','y');
+ PrintStringInfo(' ',ReportFileName,'both','y');
+ error(9999, 'SCI2CERROR: Unknown symbol ""'+tmpname+'"".');
+ end
+ else
+ UpdatedInArg(cntinarg).Type = TBType;
+ UpdatedInArg(cntinarg).Size = TBSize;
+ UpdatedInArg(cntinarg).Value = TBValue;
+ UpdatedInArg(cntinarg).FindLike = TBFindLike;
+ UpdatedInArg(cntinarg).Dimension = TBDimension;
+ UpdatedInArg(cntinarg).Scope = TBScope;
end
- UpdatedInArg(cntinarg).Type = TBType;
- UpdatedInArg(cntinarg).Size = TBSize;
- UpdatedInArg(cntinarg).Value = TBValue;
- UpdatedInArg(cntinarg).FindLike = TBFindLike;
- UpdatedInArg(cntinarg).Dimension = TBDimension;
- UpdatedInArg(cntinarg).Scope = TBScope;
-
else
error(9999, 'Unknown scope identifier ""'+tmpscope+'"" for variable ""'+tmpname+'"".');
end
diff --git a/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.bin b/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.bin
index 6a319d99..dce28bc5 100644
--- a/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.bin
+++ b/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.bin
Binary files differ
diff --git a/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci b/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci
index caf9e32e..2d6c99c5 100644
--- a/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci
+++ b/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci
@@ -4858,7 +4858,7 @@ ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
PrintStringInfo('d0d0d2g2'+ArgSeparator+'d2',ClassFileName,'file','y');
PrintStringInfo('d0d0d0g2'+ArgSeparator+'d0',ClassFileName,'file','y');
PrintStringInfo('d2d0d2g2'+ArgSeparator+'d2',ClassFileName,'file','y');
-PrintStringInfo('d2d0d0g2'+ArgSeparator+'d2',ClassFileName,'file','y');
+PrintStringInfo('d2d0d0f0'+ArgSeparator+'d2',ClassFileName,'file','y');
// --- Annotation Function And Function List Function. ---
FunctionName = 'ode';
@@ -5086,37 +5086,37 @@ INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,Ex
//------------------------------------
//---- Class PERMUTE -----------------
//------------------------------------
-ClassName = 'PERMUTE';
+//ClassName = 'PERMUTE';
// --- Class Annotation. ---
-PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
-ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+//PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+//ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
//Arguements specified: initial value, start time, time vector, ode function
-PrintStringInfo('NIN= 2',ClassFileName,'file','y');
-PrintStringInfo('NOUT= 1',ClassFileName,'file','y');
-PrintStringInfo('OUT(1).TP= IN(1).TP',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');
-
-ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
-PrintStringInfo('d2d2'+ArgSeparator+'d0',ClassFileName,'file','y');
-PrintStringInfo('s0s2'+ArgSeparator+'s0',ClassFileName,'file','y');
-PrintStringInfo('u80u82'+ArgSeparator+'u80',ClassFileName,'file','y');
-PrintStringInfo('i80i82'+ArgSeparator+'i80',ClassFileName,'file','y');
-PrintStringInfo('u160u162'+ArgSeparator+'u160',ClassFileName,'file','y');
-PrintStringInfo('i160i162'+ArgSeparator+'i160',ClassFileName,'file','y');
-PrintStringInfo('s0d2'+ArgSeparator+'s0',ClassFileName,'file','y');
-PrintStringInfo('u80d2'+ArgSeparator+'u80',ClassFileName,'file','y');
-PrintStringInfo('i80d2'+ArgSeparator+'i80',ClassFileName,'file','y');
-PrintStringInfo('u160d2'+ArgSeparator+'u160',ClassFileName,'file','y');
-PrintStringInfo('i160d2'+ArgSeparator+'i160',ClassFileName,'file','y');
+//PrintStringInfo('NIN= 2',ClassFileName,'file','y');
+//PrintStringInfo('NOUT= 1',ClassFileName,'file','y');
+//PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y');
+//PrintStringInfo('OUT(1).SZ(1)= FA_SZ_PERMUTE_ROW(IN(1).SZ, IN(2).VAL)',ClassFileName,'file','y');
+//PrintStringInfo('OUT(1).SZ(2)= FA_SZ_PERMUTE_COL(IN(1).SZ, IN(2).VAL)',ClassFileName,'file','y');
+
+//ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
+//PrintStringInfo('d2d2'+ArgSeparator+'d2',ClassFileName,'file','y');
+//PrintStringInfo('s2s2'+ArgSeparator+'s2',ClassFileName,'file','y');
+//PrintStringInfo('u82u82'+ArgSeparator+'u82',ClassFileName,'file','y');
+//PrintStringInfo('i82i82'+ArgSeparator+'i82',ClassFileName,'file','y');
+//PrintStringInfo('u162u162'+ArgSeparator+'u162',ClassFileName,'file','y');
+//PrintStringInfo('i162i162'+ArgSeparator+'i162',ClassFileName,'file','y');
+//PrintStringInfo('s2d2'+ArgSeparator+'s0',ClassFileName,'file','y');
+//PrintStringInfo('u82d2'+ArgSeparator+'u80',ClassFileName,'file','y');
+//PrintStringInfo('i82d2'+ArgSeparator+'i80',ClassFileName,'file','y');
+//PrintStringInfo('u162d2'+ArgSeparator+'u160',ClassFileName,'file','y');
+//PrintStringInfo('i162d2'+ArgSeparator+'i160',ClassFileName,'file','y');
// --- Annotation Function And Function List Function. ---
-FunctionName = 'permute';
-PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
-INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
-INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+//FunctionName = 'permute';
+//PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+//INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+//INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
// ////////////////////////////////////////////
// /////PARTE INTRODOTTA DA ALBERTO MOREA
diff --git a/2.3-1/macros/ToolInitialization/INIT_GenSharedInfo.bin b/2.3-1/macros/ToolInitialization/INIT_GenSharedInfo.bin
index 8a5667d5..c7182880 100644
--- a/2.3-1/macros/ToolInitialization/INIT_GenSharedInfo.bin
+++ b/2.3-1/macros/ToolInitialization/INIT_GenSharedInfo.bin
Binary files differ
diff --git a/2.3-1/macros/ToolInitialization/INIT_GenSharedInfo.sci b/2.3-1/macros/ToolInitialization/INIT_GenSharedInfo.sci
index c24d4a1a..bee68d19 100644
--- a/2.3-1/macros/ToolInitialization/INIT_GenSharedInfo.sci
+++ b/2.3-1/macros/ToolInitialization/INIT_GenSharedInfo.sci
@@ -126,6 +126,9 @@ SharedInfo.Extension.FuncListClasses = '.lcls'; // Stands for list class
// ------------------------
SharedInfo.ResizeApproach = 'NO_RESIZE'; // 'NO_RESIZE', 'RESIZE_ALL', 'RESIZE_TEMP', 'RESIZE_LOCAL', 'RESIZE_GLOBAL', 'REALLOC_ALL_RESIZE_ALL'
-SharedInfo.Target = Target;
+SharedInfo.Target = Target; // Specifies code generation target.
+
+SharedInfo.ODElist = list(); //Maintains list of ode functions being used in code
+ // to add their header files to main function.
endfunction
diff --git a/2.3-1/macros/findDeps/getAllHeaders.bin b/2.3-1/macros/findDeps/getAllHeaders.bin
index 9f0ca086..a053d51a 100644
--- a/2.3-1/macros/findDeps/getAllHeaders.bin
+++ b/2.3-1/macros/findDeps/getAllHeaders.bin
Binary files differ
diff --git a/2.3-1/macros/findDeps/getAllHeaders.sci b/2.3-1/macros/findDeps/getAllHeaders.sci
index a8c23a15..06ef5487 100644
--- a/2.3-1/macros/findDeps/getAllHeaders.sci
+++ b/2.3-1/macros/findDeps/getAllHeaders.sci
@@ -141,8 +141,8 @@ function allHeaders = getAllHeaders(Target)
"src/c/signalProcessing/includes/dynlib_signalprocessing.h"
"src/c/signalProcessing/includes/crossCorr.h"
"src/c/implicitList/dynlib_implicitlist.h"
- "src/c/implicitList/implicitList.h"];
- //"src/c/differential_calculus/includes/ode.h"];
+ "src/c/implicitList/implicitList.h"
+ "src/c/differential_calculus/includes/ode.h"];
//Header files required for "Arduino" output
Arduino_headers = [
diff --git a/2.3-1/macros/findDeps/getAllInterfaces.bin b/2.3-1/macros/findDeps/getAllInterfaces.bin
index 0b9ed8c6..53aaebe2 100644
--- a/2.3-1/macros/findDeps/getAllInterfaces.bin
+++ b/2.3-1/macros/findDeps/getAllInterfaces.bin
Binary files differ
diff --git a/2.3-1/macros/findDeps/getAllInterfaces.sci b/2.3-1/macros/findDeps/getAllInterfaces.sci
index 7574cc7f..8fd8f8d9 100644
--- a/2.3-1/macros/findDeps/getAllInterfaces.sci
+++ b/2.3-1/macros/findDeps/getAllInterfaces.sci
@@ -58,6 +58,7 @@ function allInterfaces = getAllInterfaces(Target)
"src/c/matrixOperations/interfaces/int_tril.h"
"src/c/matrixOperations/interfaces/int_kron.h"
"src/c/matrixOperations/interfaces/int_flipdim.h"
+ "src/c/matrixOperations/interfaces/int_permute.h"
"src/c/elementaryFunctions/interfaces/int_asinh.h"
"src/c/elementaryFunctions/interfaces/int_atanh.h"
"src/c/elementaryFunctions/interfaces/int_sinh.h"
@@ -135,8 +136,8 @@ function allInterfaces = getAllInterfaces(Target)
"src/c/signalProcessing/interfaces/int_fftshift.h"
"src/c/signalProcessing/interfaces/int_fft.h"
"src/c/signalProcessing/interfaces/int_lev.h"
- "src/c/implicitList/int_OpColon.h"];
- //"src/c/differential_calculus/interfaces/int_ode.h"];
+ "src/c/implicitList/int_OpColon.h"
+ "src/c/differential_calculus/interfaces/int_ode.h"];
//Interface files required for "Arduino" output
Arduino_interfaces = [
diff --git a/2.3-1/macros/findDeps/getAllSources.bin b/2.3-1/macros/findDeps/getAllSources.bin
index 75c2b579..5a7dc92e 100644
--- a/2.3-1/macros/findDeps/getAllSources.bin
+++ b/2.3-1/macros/findDeps/getAllSources.bin
Binary files differ
diff --git a/2.3-1/macros/findDeps/getAllSources.sci b/2.3-1/macros/findDeps/getAllSources.sci
index d8730781..5cac7bde 100644
--- a/2.3-1/macros/findDeps/getAllSources.sci
+++ b/2.3-1/macros/findDeps/getAllSources.sci
@@ -953,9 +953,9 @@ function allSources = getAllSources(Target)
"src/c/implicitList/zimplicitLists.c"
"src/c/implicitList/dimplicitLists.c"
"src/c/implicitList/cimplicitLists.c"
- "src/c/implicitList/simplicitLists.c"];
- //"src/c/differential_calculus/ode/dodes.c"
- //"src/c/differential_calculus/ode/doded.c"];
+ "src/c/implicitList/simplicitLists.c"
+ "src/c/differential_calculus/ode/dodes.c"
+ "src/c/differential_calculus/ode/dodea.c"];
//Files to be inserted only if output format selected is 'Arduino'.
Arduino_files = ["src/c/scilab-arduino/cmd_digital_out/u8cmd_digital_outs.c"
diff --git a/2.3-1/macros/runsci2c.bin b/2.3-1/macros/runsci2c.bin
index f5b80872..0adbe899 100644
--- a/2.3-1/macros/runsci2c.bin
+++ b/2.3-1/macros/runsci2c.bin
Binary files differ
diff --git a/2.3-1/macros/runsci2c.sci b/2.3-1/macros/runsci2c.sci
index 206a362f..da2ba4d3 100644
--- a/2.3-1/macros/runsci2c.sci
+++ b/2.3-1/macros/runsci2c.sci
@@ -74,7 +74,7 @@ INIT_LoadLibraries(FileInfoDatFile);
// ----------------------------------
// --- Perform SCI2C Translation. ---
// ----------------------------------
-if (RunMode == 'All' | RunMode == 'Translate' | RunMode == "FunCall")
+if (RunMode == 'All' | RunMode == 'Translate')
FlagContinueTranslation = 1;
while(FlagContinueTranslation == 1)
UpdateSCI2CInfo(FileInfoDatFile);
@@ -85,12 +85,11 @@ if (RunMode == 'All' | RunMode == 'Translate' | RunMode == "FunCall")
end
end
-
-
+load(SharedInfoDatFile,'SharedInfo');
// ---------------------------
// --- Copy library files. ---
// ---------------------------
-if (RunMode <> 'FunCall')
+
global SCI2CHOME
allSources = SCI2CHOME + "/" + getAllSources(Target);
@@ -176,7 +175,7 @@ end
// FIXME : Give the user the ability to set this prefix
FunctionPrefix = "SCI2C";
C_GenerateSCI2CHeader(SCI2COutputPath+"/includes/", FunctionPrefix);
-end
+
// -----------------
// --- Epilogue. ---
// -----------------