diff options
Diffstat (limited to '2.3-1/macros/CCodeGeneration')
28 files changed, 156 insertions, 1 deletions
diff --git a/2.3-1/macros/CCodeGeneration/C_FinalizeCode.bin b/2.3-1/macros/CCodeGeneration/C_FinalizeCode.bin Binary files differnew file mode 100644 index 00000000..b4005914 --- /dev/null +++ b/2.3-1/macros/CCodeGeneration/C_FinalizeCode.bin diff --git a/2.3-1/macros/CCodeGeneration/C_ForExpression.bin b/2.3-1/macros/CCodeGeneration/C_ForExpression.bin Binary files differnew file mode 100644 index 00000000..1c3f6747 --- /dev/null +++ b/2.3-1/macros/CCodeGeneration/C_ForExpression.bin diff --git a/2.3-1/macros/CCodeGeneration/C_Funcall.bin b/2.3-1/macros/CCodeGeneration/C_Funcall.bin Binary files differnew file mode 100644 index 00000000..80fda7c4 --- /dev/null +++ b/2.3-1/macros/CCodeGeneration/C_Funcall.bin diff --git a/2.3-1/macros/CCodeGeneration/C_GenDeclarations.bin b/2.3-1/macros/CCodeGeneration/C_GenDeclarations.bin Binary files differnew file mode 100644 index 00000000..c3b36009 --- /dev/null +++ b/2.3-1/macros/CCodeGeneration/C_GenDeclarations.bin diff --git a/2.3-1/macros/CCodeGeneration/C_GenDeclarations_Dup.bin b/2.3-1/macros/CCodeGeneration/C_GenDeclarations_Dup.bin Binary files differnew file mode 100644 index 00000000..ab05955d --- /dev/null +++ b/2.3-1/macros/CCodeGeneration/C_GenDeclarations_Dup.bin diff --git a/2.3-1/macros/CCodeGeneration/C_GenDeclarations_Dup.sci b/2.3-1/macros/CCodeGeneration/C_GenDeclarations_Dup.sci new file mode 100644 index 00000000..46d9de78 --- /dev/null +++ b/2.3-1/macros/CCodeGeneration/C_GenDeclarations_Dup.sci @@ -0,0 +1,155 @@ +function Cdeclaration = C_GenDeclarations_Dup(InArg,NInArg,com_type,ArgStruct,CDeclarationFileName,IndentLevel,ReportFileName,FlagExt,ResizeApproach) +// function Cdeclaration = C_GenDeclarations(ArgStruct,CDeclarationFileName,IndentLevel,ReportFileName,FlagExt,ResizeApproach) +// ----------------------------------------------------------------- +// //NUT: add description here +// +// Input data: +// //NUT: add description here +// +// Output data: +// //NUT: add description here +// +// Status: +// 27-Oct-2007 -- Raffaele Nutricato: Author. +// 10-Jun-2008 -- Raffaele Nutricato: adapted to work with realloc function. +// +// Copyright 2007 Raffaele Nutricato. +// Contact: raffaele.nutricato@tiscali.it +// ----------------------------------------------------------------- + +// Generate C corresponding declaration given some information in ArgStruct +// + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ + //SCI2CNInArgCheck(argn(2),6,6); +// #RNU_RES_B +//NUT: ilnome di questa funzione va cambiato perche' le dichiarazioni le fanno anche i for e i while. + +PrintStringInfo(' ',ReportFileName,'file','y'); +PrintStringInfo('***Generating C declaration***',ReportFileName,'file','y'); +// #RNU_RES_E + +Cdeclaration = ''; +if (ArgStruct.Dimension > 0) + if (FlagExt == 1) + Cdeclaration(1) = 'extern '; + Cdeclaration(2) = 'extern '; + else + Cdeclaration(1) = ''; + Cdeclaration(2) = ''; + end +// #RNU_RES_B +//NUT: vedi Mem_Alloc_Out per maggiori info sulla rimozione della temp nella if +// if ((ArgStruct.Scope=='Temp') | (ArgStruct.FindLike == -1) | (isnum(ArgStruct.Size(1))==%F) | (isnum(ArgStruct.Size(2))==%F)) +// #RNU_RES_E + if (ArgStruct.Type=='g') +// if (isnan(ArgStruct.Value) ) + if ((isnum(ArgStruct.Size(1))==%F) | (isnum(ArgStruct.Size(2))==%F) ) + Cdeclaration(1) = Cdeclaration(1)+C_Type(ArgStruct.Type)+... + ' * '+ArgStruct.Name+';'; + else + if ((FlagExt == 1) | (isnan(ArgStruct.Value))) + Cdeclaration(1) = Cdeclaration(1)+C_Type(ArgStruct.Type)+... + ' '+ArgStruct.Name+'['+ArgStruct.Size(1)+'*'+ArgStruct.Size(2)+'];'; + else + Cdeclaration(1) = Cdeclaration(1)+C_Type(ArgStruct.Type)+... + ' '+ArgStruct.Name+'['+ArgStruct.Size(1)+'*'+ArgStruct.Size(2)+'] = {'+ArgStruct.Value+'};'; + end + end + Cdeclaration(2) = Cdeclaration(2)+C_Type('i')+' __'+ArgStruct.Name+'Size[2] = {'+ArgStruct.Size(1)+','+ArgStruct.Size(2)+'};'; + elseif ((ArgStruct.FindLike == -1) | ... + (isnum(ArgStruct.Size(1))==%F) | (isnum(ArgStruct.Size(2))==%F) | ... + (ResizeApproach=='REALLOC_ALL_RESIZE_ALL' & ArgStruct.Type~='g')) +// #RNU_RES_B +//RNU sulle stringhe non ho ancora deciso se applicare la realloc. +// Generate only the pointer that will be used by the malloc function. +// #RNU_RES_E + if (FlagExt == 1) + Cdeclaration(1) = Cdeclaration(1)+C_Type(ArgStruct.Type)+'* '+... + ArgStruct.Name+';'; + else + Cdeclaration(1) = Cdeclaration(1)+C_Type(ArgStruct.Type)+'* '+... + ArgStruct.Name+' = NULL;'; + end +// Declare the Size array + Cdeclaration(2) = Cdeclaration(2)+C_Type('i')+' __'+ArgStruct.Name+'Size[2];'; + else +// Declare the array with its size. + computedSize = ArgStruct.Size(1); + computedSizeLength = size(ArgStruct.Size, '*'); + computedSizeField = ArgStruct.Size(1); + for sizeIterator = 2:computedSizeLength; + computedSize = computedSize + ' * ' + ArgStruct.Size(sizeIterator); + computedSizeField = computedSizeField + ', ' + ArgStruct.Size(sizeIterator); + end + Cdeclaration(1) = Cdeclaration(1)+C_Type(ArgStruct.Type)+' '+ArgStruct.Name+'['+computedSize+']={'; + if com_type == 0 + for i = 1:NInArg-1 + Cdeclaration(1) = Cdeclaration(1)+InArg(i).Name+','; + end + Cdeclaration(1) = Cdeclaration(1)+InArg(NInArg).Name+'};'; + else + for i=1:NInArg-1 + if InArg(i).Type <> 'z' + Cdeclaration(1) = Cdeclaration(1)+InArg(i).Name+',0,'; + else + Cdeclaration(1) = Cdeclaration(1)+InArg(i).Name+','; + end + end + if InArg(NInArg).Type <> 'z' + Cdeclaration(1) = Cdeclaration(1) + InArg(NInArg).Name + ',0};' + else + Cdeclaration(1) = Cdeclaration(1) + InArg(NInArg).Name + '};' + end + end + Cdeclaration(2) = Cdeclaration(2)+C_Type('i')+' __'+ArgStruct.Name+'Size['+string(computedSizeLength)+']'; + if (FlagExt <> 1) + Cdeclaration(2) = Cdeclaration(2)+' = {'+computedSizeField+'};'; + end + Cdeclaration(2) = Cdeclaration(2)+';'; + end +else + if (ArgStruct.Type == 'fn') + //do nothing. This is a function name. Will be declared in header file. + else + if (FlagExt == 1) + Cdeclaration(1) = 'extern '; + 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); + else + 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 +end + + +// -------------------------------------------- +// --- Write C declaration into the C file. --- +// -------------------------------------------- +PrintStringInfo(' ',CDeclarationFileName,'file','y'); +for cntdecl = 1:size(Cdeclaration, '*') + PrintStringInfo(' '+Cdeclaration(cntdecl),ReportFileName,'file','y'); + PrintStringInfo(C_IndentBlanks(IndentLevel)+Cdeclaration(cntdecl),CDeclarationFileName,'file','y'); +end + +PrintStringInfo(' Writing C declaration in: '+CDeclarationFileName,ReportFileName,'file','y'); +PrintStringInfo(' ',CDeclarationFileName,'file','y'); + +endfunction +// #RNU_RES_B +//NUT: dove sta il controllo che verifica se dopo aver dichiarato una local A[10] essa viene utilizzata +//NUT: per memorizzare un A = sin(B) dove B[11]?? +// #RNU_RES_E diff --git a/2.3-1/macros/CCodeGeneration/C_GenerateFunName.bin b/2.3-1/macros/CCodeGeneration/C_GenerateFunName.bin Binary files differnew file mode 100644 index 00000000..1b723f16 --- /dev/null +++ b/2.3-1/macros/CCodeGeneration/C_GenerateFunName.bin diff --git a/2.3-1/macros/CCodeGeneration/C_GenerateLaunchScript.bin b/2.3-1/macros/CCodeGeneration/C_GenerateLaunchScript.bin Binary files differnew file mode 100644 index 00000000..587c1547 --- /dev/null +++ b/2.3-1/macros/CCodeGeneration/C_GenerateLaunchScript.bin diff --git a/2.3-1/macros/CCodeGeneration/C_GenerateMakefile.bin b/2.3-1/macros/CCodeGeneration/C_GenerateMakefile.bin Binary files differnew file mode 100644 index 00000000..cea86411 --- /dev/null +++ b/2.3-1/macros/CCodeGeneration/C_GenerateMakefile.bin diff --git a/2.3-1/macros/CCodeGeneration/C_GenerateMakefile_msvc.bin b/2.3-1/macros/CCodeGeneration/C_GenerateMakefile_msvc.bin Binary files differnew file mode 100644 index 00000000..838c674e --- /dev/null +++ b/2.3-1/macros/CCodeGeneration/C_GenerateMakefile_msvc.bin diff --git a/2.3-1/macros/CCodeGeneration/C_GenerateMkfle_arduino.bin b/2.3-1/macros/CCodeGeneration/C_GenerateMkfle_arduino.bin Binary files differnew file mode 100644 index 00000000..ce25219f --- /dev/null +++ b/2.3-1/macros/CCodeGeneration/C_GenerateMkfle_arduino.bin diff --git a/2.3-1/macros/CCodeGeneration/C_GenerateSCI2CHeader.bin b/2.3-1/macros/CCodeGeneration/C_GenerateSCI2CHeader.bin Binary files differnew file mode 100644 index 00000000..2e02cae4 --- /dev/null +++ b/2.3-1/macros/CCodeGeneration/C_GenerateSCI2CHeader.bin diff --git a/2.3-1/macros/CCodeGeneration/C_IfElseBlocks.bin b/2.3-1/macros/CCodeGeneration/C_IfElseBlocks.bin Binary files differnew file mode 100644 index 00000000..332e89bf --- /dev/null +++ b/2.3-1/macros/CCodeGeneration/C_IfElseBlocks.bin diff --git a/2.3-1/macros/CCodeGeneration/C_IfExpression.bin b/2.3-1/macros/CCodeGeneration/C_IfExpression.bin Binary files differnew file mode 100644 index 00000000..b1dc7370 --- /dev/null +++ b/2.3-1/macros/CCodeGeneration/C_IfExpression.bin diff --git a/2.3-1/macros/CCodeGeneration/C_IndentBlanks.bin b/2.3-1/macros/CCodeGeneration/C_IndentBlanks.bin Binary files differnew file mode 100644 index 00000000..77bfaebc --- /dev/null +++ b/2.3-1/macros/CCodeGeneration/C_IndentBlanks.bin diff --git a/2.3-1/macros/CCodeGeneration/C_InitHeader.bin b/2.3-1/macros/CCodeGeneration/C_InitHeader.bin Binary files differnew file mode 100644 index 00000000..567822c0 --- /dev/null +++ b/2.3-1/macros/CCodeGeneration/C_InitHeader.bin diff --git a/2.3-1/macros/CCodeGeneration/C_MemAllocOutTempVars.bin b/2.3-1/macros/CCodeGeneration/C_MemAllocOutTempVars.bin Binary files differnew file mode 100644 index 00000000..443ad3c1 --- /dev/null +++ b/2.3-1/macros/CCodeGeneration/C_MemAllocOutTempVars.bin diff --git a/2.3-1/macros/CCodeGeneration/C_SCI2CHeader.bin b/2.3-1/macros/CCodeGeneration/C_SCI2CHeader.bin Binary files differnew file mode 100644 index 00000000..1d3e6182 --- /dev/null +++ b/2.3-1/macros/CCodeGeneration/C_SCI2CHeader.bin diff --git a/2.3-1/macros/CCodeGeneration/C_Type.bin b/2.3-1/macros/CCodeGeneration/C_Type.bin Binary files differnew file mode 100644 index 00000000..7b5bf444 --- /dev/null +++ b/2.3-1/macros/CCodeGeneration/C_Type.bin diff --git a/2.3-1/macros/CCodeGeneration/C_WhileExpression.bin b/2.3-1/macros/CCodeGeneration/C_WhileExpression.bin Binary files differnew file mode 100644 index 00000000..5e426505 --- /dev/null +++ b/2.3-1/macros/CCodeGeneration/C_WhileExpression.bin diff --git a/2.3-1/macros/CCodeGeneration/GenCFunDatFiles.bin b/2.3-1/macros/CCodeGeneration/GenCFunDatFiles.bin Binary files differnew file mode 100644 index 00000000..6a374f5b --- /dev/null +++ b/2.3-1/macros/CCodeGeneration/GenCFunDatFiles.bin diff --git a/2.3-1/macros/CCodeGeneration/GetClsFileName.bin b/2.3-1/macros/CCodeGeneration/GetClsFileName.bin Binary files differnew file mode 100644 index 00000000..dda02933 --- /dev/null +++ b/2.3-1/macros/CCodeGeneration/GetClsFileName.bin diff --git a/2.3-1/macros/CCodeGeneration/GetSymbolDimension.bin b/2.3-1/macros/CCodeGeneration/GetSymbolDimension.bin Binary files differnew file mode 100644 index 00000000..5c73f435 --- /dev/null +++ b/2.3-1/macros/CCodeGeneration/GetSymbolDimension.bin diff --git a/2.3-1/macros/CCodeGeneration/GetWhileCondVariable.bin b/2.3-1/macros/CCodeGeneration/GetWhileCondVariable.bin Binary files differnew file mode 100644 index 00000000..6815fb4b --- /dev/null +++ b/2.3-1/macros/CCodeGeneration/GetWhileCondVariable.bin diff --git a/2.3-1/macros/CCodeGeneration/JoinDeclarAndCcode.bin b/2.3-1/macros/CCodeGeneration/JoinDeclarAndCcode.bin Binary files differnew file mode 100644 index 00000000..084ab085 --- /dev/null +++ b/2.3-1/macros/CCodeGeneration/JoinDeclarAndCcode.bin diff --git a/2.3-1/macros/CCodeGeneration/Sci2AnnotationFile.bin b/2.3-1/macros/CCodeGeneration/Sci2AnnotationFile.bin Binary files differnew file mode 100644 index 00000000..95fe5611 --- /dev/null +++ b/2.3-1/macros/CCodeGeneration/Sci2AnnotationFile.bin diff --git a/2.3-1/macros/CCodeGeneration/lib b/2.3-1/macros/CCodeGeneration/lib Binary files differindex 4e87a555..baf9dba6 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 c4dea610..bf9ced9b 100644 --- a/2.3-1/macros/CCodeGeneration/names +++ b/2.3-1/macros/CCodeGeneration/names @@ -2,6 +2,7 @@ C_FinalizeCode C_ForExpression C_Funcall C_GenDeclarations +C_GenDeclarations_Dup C_GenerateFunName C_GenerateLaunchScript C_GenerateMakefile @@ -12,7 +13,6 @@ C_IfExpression C_IndentBlanks C_InitHeader C_MemAllocOutTempVars -C_RCOperator C_SCI2CHeader C_Type C_WhileExpression |