summaryrefslogtreecommitdiff
path: root/2.3-1/macros
diff options
context:
space:
mode:
authorsiddhu89902015-12-17 14:48:36 +0530
committersiddhu89902015-12-17 14:48:36 +0530
commit02f2862023bb34146f6a0a96c2795bebe97e7c47 (patch)
tree9d2075243dcba13e417edb0929846f49b03aeac3 /2.3-1/macros
parenteac39cdc77ad5fdaf7b245cbce5c92f105ac75bf (diff)
downloadScilab2C-02f2862023bb34146f6a0a96c2795bebe97e7c47.tar.gz
Scilab2C-02f2862023bb34146f6a0a96c2795bebe97e7c47.tar.bz2
Scilab2C-02f2862023bb34146f6a0a96c2795bebe97e7c47.zip
Code generation for Arduino changed. DC motor added to Arduino
Diffstat (limited to '2.3-1/macros')
-rw-r--r--2.3-1/macros/ASTManagement/AST_HandleEndGenFun.binbin78824 -> 81440 bytes
-rw-r--r--2.3-1/macros/ASTManagement/AST_HandleEndGenFun.sci757
-rw-r--r--2.3-1/macros/FunctionList/FL_ExtractFuncList.sci2
-rw-r--r--2.3-1/macros/Hardware/AVR/AVRPWMSetDuty.binbin0 -> 2428 bytes
-rw-r--r--2.3-1/macros/Hardware/AVR/AVRPWMSetDuty.sci24
-rw-r--r--2.3-1/macros/Hardware/AVR/libbin860 -> 884 bytes
-rw-r--r--2.3-1/macros/Hardware/AVR/names1
-rw-r--r--2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.binbin932856 -> 950836 bytes
-rw-r--r--2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci101
-rw-r--r--2.3-1/macros/ToolInitialization/INIT_GenFileInfo.binbin19356 -> 19628 bytes
-rw-r--r--2.3-1/macros/ToolInitialization/INIT_GenFileInfo.sci2
-rw-r--r--2.3-1/macros/ToolInitialization/INIT_LoadLibraries.binbin8844 -> 8940 bytes
-rw-r--r--2.3-1/macros/ToolInitialization/INIT_LoadLibraries.sci2
-rw-r--r--2.3-1/macros/ToolInitialization/INIT_SCI2C.binbin23840 -> 24408 bytes
-rw-r--r--2.3-1/macros/ToolInitialization/INIT_SCI2C.sci9
-rw-r--r--2.3-1/macros/ToolInitialization/ManageNextConversion.binbin11012 -> 11016 bytes
-rw-r--r--2.3-1/macros/ToolInitialization/ManageNextConversion.sci1
-rw-r--r--2.3-1/macros/buildmacros.sce3
-rw-r--r--2.3-1/macros/findDeps/getAllHeaders.binbin24256 -> 24908 bytes
-rw-r--r--2.3-1/macros/findDeps/getAllHeaders.sci3
-rw-r--r--2.3-1/macros/findDeps/getAllInterfaces.binbin25584 -> 26044 bytes
-rw-r--r--2.3-1/macros/findDeps/getAllInterfaces.sci2
-rw-r--r--2.3-1/macros/findDeps/getAllSources.binbin152368 -> 153272 bytes
-rw-r--r--2.3-1/macros/findDeps/getAllSources.sci4
-rw-r--r--2.3-1/macros/findDeps/getArduinoFiles.binbin544 -> 772 bytes
-rw-r--r--2.3-1/macros/findDeps/getArduinoFiles.sci1
-rw-r--r--2.3-1/macros/runsci2c.binbin26048 -> 26392 bytes
-rw-r--r--2.3-1/macros/runsci2c.sci5
28 files changed, 540 insertions, 377 deletions
diff --git a/2.3-1/macros/ASTManagement/AST_HandleEndGenFun.bin b/2.3-1/macros/ASTManagement/AST_HandleEndGenFun.bin
index 8b3ce654..d5d2e4ab 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 f9515cd1..f6ae58e7 100644
--- a/2.3-1/macros/ASTManagement/AST_HandleEndGenFun.sci
+++ b/2.3-1/macros/ASTManagement/AST_HandleEndGenFun.sci
@@ -46,7 +46,11 @@ ReportFileName = FileInfo.Funct(nxtscifunnumber).ReportFileName;
Pass1HeaderFileName = FileInfo.Funct(nxtscifunnumber).Pass1HeaderFileName;
FunInfoDatDir = FileInfo.FunctionList.FunInfoDatDir;
CGblDeclarFileName = FileInfo.Funct(nxtscifunnumber).CGblDeclarFileName;
-PeripheralInitListFile = FileInfo.PeripheralInitListFile;
+if(SharedInfo.OutFormat == 'AVR')
+ PeripheralInitListFile = FileInfo.PeripheralInitListFile;
+elseif (SharedInfo.OutFormat == 'Arduino')
+ SetupListFile = FileInfo.SetupListFile;
+end
Flag_FunAlreadyCalled = 0;
// #RNU_RES_B
@@ -67,382 +71,395 @@ global STACKDEDUG
//NUT: verifica se ASTFunType e' veramente importante
// #RNU_RES_E
[ASTFunName,InArg,NInArg,OutArg,NOutArg] = AST_GetFuncallPrm(FileInfo,SharedInfo,ASTFunType);
-if (ASTFunName == 'OpIns')
- SharedInfo.SkipNextEqual = 1;
- SharedInfo.Equal.Nins = SharedInfo.Equal.Nins + 1;
- //NUT: Force ins to have 0 args. Double check it.
- NOutArg = 0;
- // #RNU_RES_B
- //NUT: io aumenterei qui gli argomenti in ingresso della ins cosi qui vengono fatte tutte le modifiche del
- //NUT: caso e la C_FunCall non se ne deve preoccupare, vedi se lo stesso vale per le altre funzioni
- //NUT: speciali presenti nell C_FunCall.
-
- // 1 more input argument containing the values to be inserted in the matrix.
- // #RNU_RES_E
- NInArg = NInArg + 1;
- InArg(NInArg).Name = SharedInfo.Equal.InArg(SharedInfo.Equal.Nins).Name;
- InArg(NInArg).Scope = SharedInfo.Equal.InArg(SharedInfo.Equal.Nins).Scope;
-elseif (ASTFunName == 'global')
- SharedInfo.SkipNextEqual = 1;
- SharedInfo.SkipNextFun = 1;
- if (NInArg ~= 1)
- PrintStringInfo(' ',ReportFileName,'both','y');
- PrintStringInfo('SCI2CERROR: Multiple declaration of global variables is not allowed.',ReportFileName,'both','y');
- PrintStringInfo('SCI2CERROR: See example below:',ReportFileName,'both','y');
- PrintStringInfo('SCI2CERROR: global var1 var2; //NOT ALLOWED',ReportFileName,'both','y');
- PrintStringInfo('SCI2CERROR: global var1; //ALLOWED',ReportFileName,'both','y');
- PrintStringInfo('SCI2CERROR: global var2; //ALLOWED',ReportFileName,'both','y');
- PrintStringInfo(' ',ReportFileName,'both','y');
- error(9999, 'SCI2CERROR: Multiple declaration of global variables is not allowed.');
- end
- if (NOutArg ~= 1)
- PrintStringInfo(' ',ReportFileName,'both','y');
- PrintStringInfo('SCI2CERROR: Unexpected number of output arguments for global function.',ReportFileName,'both','y');
- PrintStringInfo('SCI2CERROR: Please report this error to: http://forge.scilab.org/index.php/p/scilab2c/issues/',ReportFileName,'both','y');
- PrintStringInfo(' ',ReportFileName,'both','y');
- error(9999, 'SCI2CERROR: Unexpected number of output arguments for global function.');
- end
-//elseif(IsAVRSupportFunction(ASTFunName))
- //Get the peripheral from function name and input arguements, insert it in
- //list of used peripherals.
- // PeripheralUsed=GetPeripheral(ASTFunName,InArg);
- // InsertPeripheralInList(PeripheralUsed,PeripheralInitListFile);
-end
-// #RNU_RES_B
-// --------------------------------------
-// --- Read the function annotations. ---
-// --------------------------------------
-// #RNU_RES_E
-if (ASTFunName == 'OpEqual')
- FunTypeAnnot = '';
- FunSizeAnnot = '';
-else
- [FunTypeAnnot,FunSizeAnnot] = FA_GetFunAnn(NInArg,NOutArg,ASTFunName,FileInfo,SharedInfo);
-end
+ if (ASTFunName == 'OpIns')
+ SharedInfo.SkipNextEqual = 1;
+ SharedInfo.Equal.Nins = SharedInfo.Equal.Nins + 1;
+ //NUT: Force ins to have 0 args. Double check it.
+ NOutArg = 0;
+ // #RNU_RES_B
+ //NUT: io aumenterei qui gli argomenti in ingresso della ins cosi qui vengono fatte tutte le modifiche del
+ //NUT: caso e la C_FunCall non se ne deve preoccupare, vedi se lo stesso vale per le altre funzioni
+ //NUT: speciali presenti nell C_FunCall.
-// #RNU_RES_B
-// -------------------------------------------------------------------------------------------
-// --- Search for Equal Lhs and precision specifier to be applied to the current function. ---
-// -------------------------------------------------------------------------------------------
-// #RNU_RES_E
-[LhsArg,NLhsArg,FunPrecSpecifier,SharedInfo] = AST_GetPrecAndLhsArg(OutArg,NOutArg,ASTFunName,FunTypeAnnot,FunSizeAnnot,ASTFunType,FileInfo,SharedInfo);
-//NUT: questa funzione contiene troppi parametri e mi sembra disordinata.
+ // 1 more input argument containing the values to be inserted in the matrix.
+ // #RNU_RES_E
+ NInArg = NInArg + 1;
+ InArg(NInArg).Name = SharedInfo.Equal.InArg(SharedInfo.Equal.Nins).Name;
+ InArg(NInArg).Scope = SharedInfo.Equal.InArg(SharedInfo.Equal.Nins).Scope;
+ elseif (ASTFunName == 'global')
+ SharedInfo.SkipNextEqual = 1;
+ SharedInfo.SkipNextFun = 1;
+ if (NInArg ~= 1)
+ PrintStringInfo(' ',ReportFileName,'both','y');
+ PrintStringInfo('SCI2CERROR: Multiple declaration of global variables is not allowed.',ReportFileName,'both','y');
+ PrintStringInfo('SCI2CERROR: See example below:',ReportFileName,'both','y');
+ PrintStringInfo('SCI2CERROR: global var1 var2; //NOT ALLOWED',ReportFileName,'both','y');
+ PrintStringInfo('SCI2CERROR: global var1; //ALLOWED',ReportFileName,'both','y');
+ PrintStringInfo('SCI2CERROR: global var2; //ALLOWED',ReportFileName,'both','y');
+ PrintStringInfo(' ',ReportFileName,'both','y');
+ error(9999, 'SCI2CERROR: Multiple declaration of global variables is not allowed.');
+ end
+ if (NOutArg ~= 1)
+ PrintStringInfo(' ',ReportFileName,'both','y');
+ PrintStringInfo('SCI2CERROR: Unexpected number of output arguments for global function.',ReportFileName,'both','y');
+ PrintStringInfo('SCI2CERROR: Please report this error to: http://forge.scilab.org/index.php/p/scilab2c/issues/',ReportFileName,'both','y');
+ PrintStringInfo(' ',ReportFileName,'both','y');
+ error(9999, 'SCI2CERROR: Unexpected number of output arguments for global function.');
+ end
+ //elseif(IsAVRSupportFunction(ASTFunName))
+ //Get the peripheral from function name and input arguements, insert it in
+ //list of used peripherals.
+ // PeripheralUsed=GetPeripheral(ASTFunName,InArg);
+ // InsertPeripheralInList(PeripheralUsed,PeripheralInitListFile);
+ end
-// #RNU_RES_B
-// --------------------------------
-// --- Input Arguments Section. ---
-// --------------------------------
-// --- Get Input Arguments info from their numerical value or from the symbol table. ---
-// #RNU_RES_E
-if (ASTFunName == 'global')
- [TBFlagfound,TBType,TBSize,TBValue,TBFindLike,TBDimension,TBScope] = ...
- ST_GetSymbolInfo(InArg(1).Name,FileInfo,SharedInfo);
- if (TBFlagfound == 1)
- InArg(1).Type = TBType;
- InArg(1).Size = TBSize;
- InArg(1).Value = TBValue;
- InArg(1).FindLike = TBFindLike;
- InArg(1).Dimension = TBDimension;
- InArg(1).Scope = TBScope;
- IndentLevelGlobal = 0; //NUT: forced always to 1
- FlagExt = 1;
- C_GenDeclarations(InArg(1),CGblDeclarFileName,IndentLevelGlobal,ReportFileName,FlagExt,SharedInfo.ResizeApproach);
- else
- // #RNU_RES_B
- // That means it is the first time we encounter
- // this global variable and in C this means that
- // we don't have to do nothing.
- // #RNU_RES_E
- // SharedInfo.SkipNextFun = SharedInfo.SkipNextFun + 1;
- SharedInfo.SkipNextFun = 1;
-
- InArg(1).Type = 'GBLToBeDefined';
- InArg(1).Size(1) = 'GBLToBeDefined';
- InArg(1).Size(2) = 'GBLToBeDefined';
- InArg(1).Value = %nan;
- InArg(1).FindLike = %nan;
- InArg(1).Dimension = %nan;
- InArg(1).Scope = 'Global';
-
- // #RNU_RES_B
- PrintStringInfo('***Putting global variable in the symbol table***',ReportFileName,'file','y');
- PrintStringInfo(' Symbol ""'+InArg(1).Name+'""',ReportFileName,'file','y');
-
- PrintStringInfo(' Type: '+InArg(1).Type,ReportFileName,'file','y');
- PrintStringInfo(' Size(1): '+string(InArg(1).Size(1)),ReportFileName,'file','y');
- PrintStringInfo(' Size(2): '+string(InArg(1).Size(2)),ReportFileName,'file','y');
- PrintStringInfo(' Value: '+string(InArg(1).Value),ReportFileName,'file','y');
- PrintStringInfo(' FindLike: '+string(InArg(1).FindLike),ReportFileName,'file','y');
- PrintStringInfo(' Dimension: '+string(InArg(1).Dimension),ReportFileName,'file','y');
- PrintStringInfo(' Scope: '+string(InArg(1).Scope),ReportFileName,'file','y');
- PrintStringInfo(' ',ReportFileName,'file','y');
- // #RNU_RES_E
-
- ST_Set(InArg(1).Name,...
- InArg(1).Type,...
- InArg(1).Size,...
- InArg(1).Value,...
- InArg(1).FindLike,...
- InArg(1).Dimension,...
- FileInfo.GlobalVarFileName);
- end
-else
- [InArg,SharedInfo] = ST_GetInArgInfo(InArg,NInArg,FileInfo,SharedInfo);
-end
+ // #RNU_RES_B
+ // --------------------------------------
+ // --- Read the function annotations. ---
+ // --------------------------------------
+ // #RNU_RES_E
+ if (ASTFunName == 'OpEqual')
+ FunTypeAnnot = '';
+ FunSizeAnnot = '';
+ else
+ [FunTypeAnnot,FunSizeAnnot] = FA_GetFunAnn(NInArg,NOutArg,ASTFunName,FileInfo,SharedInfo);
+ end
-// #RNU_RES_B
-// -------------------------------------------------------------------
-// --- Change info of Input Argument according to resize approach. ---
-// -------------------------------------------------------------------
-//RNU toglimi nella versione da dare ad hartes.
-//RNU per ora gestisco solo la resize all con tutte realloc.
-//RNU global variables are still coded with fixed size.
-// #RNU_RES_E
-if (SharedInfo.ResizeApproach=='REALLOC_ALL_RESIZE_ALL')
- for cntin = 1:NInArg
- if ((InArg(cntin).Dimension > 0))
- // if ((InArg(cntin).Dimension > 0) & (InArg(cntin).Scope ~= 'Global'))
- InArg(cntin).Size(1) = '__'+InArg(cntin).Name+'Size[0]';
- InArg(cntin).Size(2) = '__'+InArg(cntin).Name+'Size[1]';
- end
- //#RNUREM_MERNU vedi se la seguente fa casino l'ho aggiunta in modo che agia=ones(1,3) sia generata come realloc ma non ho verificato.
- tmpscope = InArg(cntin).Scope;
- lengthNumber = length('Number_');
- if (part(tmpscope,1:lengthNumber) == 'Number_')
- //#RNUREM_ME RNU il problema e' che ones(3,1) allora l'output e' 3,1 e come faccio a trasformare 3 e 1 in simboli in modo tale che realloco anziche' allocare
- InArg(cntin).Value = %nan; //RNU non va bene dove per esempio hai problemi di 1:3:4 se al posto dei numeri metti nan ti impalli
- //#RNUREM_ME Credo che dove c'e' uan allocazione secca ones(3,1) non vada lasciata cosi' ma tutto vada ricondotto a realloc
- //#RNUREM_ME quindi devo vedere nella dichiarazione delle variabili come forzare la dichiarazione dei null pointer.
- //#RNUREM_ME successivamente devo vedere come fare a riscrivere la size dell'output.
- else
- end
- end
-end
+ // #RNU_RES_B
+ // -------------------------------------------------------------------------------------------
+ // --- Search for Equal Lhs and precision specifier to be applied to the current function. ---
+ // -------------------------------------------------------------------------------------------
+ // #RNU_RES_E
+ [LhsArg,NLhsArg,FunPrecSpecifier,SharedInfo] = AST_GetPrecAndLhsArg(OutArg,NOutArg,ASTFunName,FunTypeAnnot,FunSizeAnnot,ASTFunType,FileInfo,SharedInfo);
+ //NUT: questa funzione contiene troppi parametri e mi sembra disordinata.
-// #RNU_RES_B
-// ---------------------------------
-// --- Output Arguments Section. ---
-// ---------------------------------
-// --- Update Out arg structure with info stored in the function annotations. ---
-// #RNU_RES_E
-if (ASTFunName == 'OpEqual')
- for cntin = 1:NInArg
- OutArg(cntin).Type = InArg(cntin).Type;
- OutArg(cntin).Size = InArg(cntin).Size;
- OutArg(cntin).Dimension = InArg(cntin).Dimension;
- OutArg(cntin).Value = InArg(cntin).Value;
- OutArg(cntin).FindLike = InArg(cntin).FindLike;
- //NUT: forse qui occorre aggiungere lo scope che dovrebbe essere local or global.
- //NUT: per ora lo scope viene settato da AST_ParseEqualStruct
- end
-elseif ((ASTFunName == 'OpMinus') & (NInArg == 1) & (InArg(1).Dimension == 0)&(InArg(1).Scope == 'Number'))
- // #RNU_RES_B
- // --- Manage OpMinus when applied to scalars. ---
- // -1 is not translated as tmp = OpMinus(1), but
- // it is considered as a single entity "-1"
- // #RNU_RES_E
- SharedInfo.SkipNextFun = 1; //RN: SISTEMAMI
- OutArg(1).Type = InArg(1).Type;
- OutArg(1).Size = InArg(1).Size;
- OutArg(1).Dimension = InArg(1).Dimension;
- OutArg(1).Value = -InArg(1).Value;
- OutArg(1).FindLike = InArg(1).FindLike;
- OutArg(1).Scope = 'Number_'+InArg(1).Type;
-elseif ((ASTFunName == 'float') & (NInArg == 1) & (InArg(1).Dimension == 0) & (InArg(1).Scope == 'Number'))
- // #RNU_RES_B
- // --- Manage OpMinus when applied to scalars. ---
- // -1 is not translated as tmp = OpMinus(1), but
- // it is considered as a single entity "-1"
- // #RNU_RES_E
- SharedInfo.SkipNextFun = 1; //RN: SISTEMAMI
- OutArg(1).Type = InArg(1).Type;
- OutArg(1).Size = InArg(1).Size;
- OutArg(1).Dimension = InArg(1).Dimension;
- OutArg(1).Value = InArg(1).Value;
- OutArg(1).FindLike = InArg(1).FindLike;
- OutArg(1).Scope = 'Number_s';
-elseif ((ASTFunName == 'double') & (NInArg == 1) & (InArg(1).Dimension == 0) & (InArg(1).Scope == 'Number'))
- // #RNU_RES_B
- // --- Manage OpMinus when applied to scalars. ---
- // -1 is not translated as tmp = OpMinus(1), but
- // it is considered as a single entity "-1"
- // #RNU_RES_E
- SharedInfo.SkipNextFun = 1;
- //RN: SISTEMAMI
- SharedInfo.SkipNextFun = 1; //RN: SISTEMAMI
- OutArg(1).Type = InArg(1).Type;
- OutArg(1).Size = InArg(1).Size;
- OutArg(1).Dimension = InArg(1).Dimension;
- OutArg(1).Value = InArg(1).Value;
- OutArg(1).FindLike = InArg(1).FindLike;
- OutArg(1).Scope = 'Number_d';
-else
- OutArg = FA_GetOutArgInfo(InArg,NInArg,OutArg,NOutArg,SharedInfo,FunPrecSpecifier,FunTypeAnnot,FunSizeAnnot,ReportFileName);
-end
+ // #RNU_RES_B
+ // --------------------------------
+ // --- Input Arguments Section. ---
+ // --------------------------------
+ // --- Get Input Arguments info from their numerical value or from the symbol table. ---
+ // #RNU_RES_E
+ if (ASTFunName == 'global')
+ [TBFlagfound,TBType,TBSize,TBValue,TBFindLike,TBDimension,TBScope] = ...
+ ST_GetSymbolInfo(InArg(1).Name,FileInfo,SharedInfo);
+ if (TBFlagfound == 1)
+ InArg(1).Type = TBType;
+ InArg(1).Size = TBSize;
+ InArg(1).Value = TBValue;
+ InArg(1).FindLike = TBFindLike;
+ InArg(1).Dimension = TBDimension;
+ InArg(1).Scope = TBScope;
+ IndentLevelGlobal = 0; //NUT: forced always to 1
+ FlagExt = 1;
+ C_GenDeclarations(InArg(1),CGblDeclarFileName,IndentLevelGlobal,ReportFileName,FlagExt,SharedInfo.ResizeApproach);
+ else
+ // #RNU_RES_B
+ // That means it is the first time we encounter
+ // this global variable and in C this means that
+ // we don't have to do nothing.
+ // #RNU_RES_E
+ // SharedInfo.SkipNextFun = SharedInfo.SkipNextFun + 1;
+ SharedInfo.SkipNextFun = 1;
-// #RNU_RES_B
-// --- Generate the names for the output arguments. ---
-// Update of OutArg.Name and OutArg.Scope fields.
-// #RNU_RES_E
-if ((ASTFunName == 'OpMinus') & (NInArg == 1) & (InArg(1).Dimension == 0) & (InArg(1).Scope == 'Number'))
- OutArg(1).Name = string(OutArg(1).Value);
-elseif ((ASTFunName == 'float') & (NInArg == 1) & (InArg(1).Dimension == 0) & (InArg(1).Scope == 'Number'))
- 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);
-else
- [OutArg,SharedInfo] = GenOutArgNames(ASTFunName,InArg,NInArg,OutArg,NOutArg,LhsArg,NLhsArg,FileInfo,SharedInfo);
-end
+ InArg(1).Type = 'GBLToBeDefined';
+ InArg(1).Size(1) = 'GBLToBeDefined';
+ InArg(1).Size(2) = 'GBLToBeDefined';
+ InArg(1).Value = %nan;
+ InArg(1).FindLike = %nan;
+ InArg(1).Dimension = %nan;
+ InArg(1).Scope = 'Global';
-// #RNU_RES_B
-// --- Push in the AST stack the Output arguments. ---
-// #RNU_RES_E
-if (ASTFunName == 'OpEqual')
- // Do nothing
-else
- for counteroutargs = 1:NOutArg
- tmppushstack = OutArg(counteroutargs).Scope+': '+OutArg(counteroutargs).Name;
- // #RNU_RES_B
- PrintStringInfo(' Pushing in the AST stack: ""'+tmppushstack+'"".',ReportFileName,'file','y');
- // #RNU_RES_E
- AST_PushASTStack(tmppushstack);
- end
-end
+ // #RNU_RES_B
+ PrintStringInfo('***Putting global variable in the symbol table***',ReportFileName,'file','y');
+ PrintStringInfo(' Symbol ""'+InArg(1).Name+'""',ReportFileName,'file','y');
-// #RNU_RES_B
-//NUT: verificare se si puo' accorpare qualcosa qui sotto
-//RN: non capisco come mai analizzo lo scope dopo che faccio il push nello stack dove lo utilizzo!!!
-// --- Scope analysis of the output arguments. ---
-// #RNU_RES_E
-if (ASTFunName == 'OpMinus' & NInArg == 1 & (InArg(1).Dimension == 0) & (InArg(1).Scope == 'Number'))
- // Scope already set above.
-elseif (ASTFunName == 'float' & NInArg == 1 & (InArg(1).Dimension == 0) & (InArg(1).Scope == 'Number'))
- // Scope already set above.
-elseif (ASTFunName == 'double' & NInArg == 1 & (InArg(1).Dimension == 0) & (InArg(1).Scope == 'Number'))
- // Scope already set above.
-else
- OutArg = ST_AnalyzeScope(OutArg,NOutArg,FileInfo,SharedInfo);
-end
-
-//#RNUREM_ME --- Check if the current function is handling for counter variables. ---
-[OutArg,SharedInfo] = ST_InsForCntVars(InArg,NInArg,OutArg,NOutArg,ASTFunName,FileInfo,SharedInfo);
-
-//#RNUREM_ME --- Store the while condition variable (if any). ---
-SharedInfo = GetWhileCondVariable(OutArg,NOutArg,ASTFunName,FileInfo,SharedInfo);
-
-//#RNUREM_ME --- Update Symbol Table with output arguments. ---
-if ((ASTFunName == 'OpMinus') & (NInArg == 1) & (InArg(1).Dimension == 0) & (InArg(1).Scope == 'Number'))
- //#RNUREM_ME A number is not inserted in the symbol table.
-elseif ((ASTFunName == 'float') & (NInArg == 1) & (InArg(1).Dimension == 0) & (InArg(1).Scope == 'Number'))
- //#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.
-else
- ST_InsOutArg(OutArg,NOutArg,FileInfo,SharedInfo,'all');
-end
-//#RNUREM_ME NUT: per risparmiare tempo di esecuzione puoi mettere delle if sulle funzioni che devono
-//#RNUREM_ME NUT: essere skippate.
-
-//#RNU_RES_B
-// --------------------------------------------
-// --- Generate the C name of the function. ---
-// --------------------------------------------
-//#RNU_RES_E
-
-CFunName = C_GenerateFunName(ASTFunName,InArg,NInArg,OutArg,NOutArg);
-//#RNU_RES_B
-PrintStringInfo(' C Function Name: '+CFunName,ReportFileName,'file','y');
-// -------------------------------------------------------------------------
-// --- Determine which library the function belongs to: USER2C or SCI2C. ---
-// -------------------------------------------------------------------------
-//#RNU_RES_E
-if SCI2Cfileexist(FileInfo.SCI2CLibCAnnFun,ASTFunName+'.ann')
- LibTypeInfo = 'SCI2C';
-else
- LibTypeInfo = 'USER2C';
-end
-
-//#RNU_RES_B
-// ------------------------------------------------------------------------------------
-// --- Check whether the function has been already called in the current .sci file. ---
-// ------------------------------------------------------------------------------------
-//#RNU_RES_E
-if (sum(SharedInfo.CFunctsAlreadyCalled == CFunName) == 1)
- Flag_FunAlreadyCalled = 1;
-else
-
- //#RNUREM_ME Add the C function name to the list of C functions called in the current .sci file.
- SharedInfo.CFunctsAlreadyCalled(size(SharedInfo.CFunctsAlreadyCalled,1)+1) = CFunName;
-end
-
-//#RNU_RES_B
-// ----------------------------------
-// --- Generate FunInfo dat file. ---
-// ----------------------------------
-//NUT: questo .dat deve essere generato sempre perche' cambiano i nomi degli argomenti mentre il resto dovrebbe
-//NUT: essere tutto uguale
-//NUT: magari posso fare una funzione che inserisce solo i campi diversi e fa un check su quelli che
-//NUT: dovrebbero essere identici.
-//#RNU_RES_E
-GenCFunDatFiles(ASTFunName,FunPrecSpecifier,FunTypeAnnot,FunSizeAnnot,InArg,NInArg,OutArg,NOutArg,CFunName,LibTypeInfo,FunInfoDatDir);
-
-//#RNU_RES_B
-// -----------------------------------
-// --- Update SCI2C Function List. ---
-// -----------------------------------
-// Functions that are not already available in C are stored
-// in the SCI2C Function List and converted in C at the end of
-// the translation of the current .sci file.
-//NUT: il problema della d0d0OpEqual dovrebbe essere legato al fatto che cerco di fare la opequal legata alla ins...
-//NUT: devo evitare di scriveral dentro la lsista delle funzioni da tradurre.
-//#RNU_RES_E
-SharedInfo = FL_UpdateToBeConv(ASTFunName,CFunName,FunPrecSpecifier,FunTypeAnnot,FunSizeAnnot,InArg,NInArg,OutArg,NOutArg,FileInfo,SharedInfo);
-
-//#RNU_RES_B
-// -----------------------------------------------
-// --- Check on common input/output arguments. ---
-// -----------------------------------------------
-//#RNU_RES_E
-if (((ASTFunName=='OpEqual') & (SharedInfo.SkipNextEqual == 1)) | ...
- SharedInfo.SkipNextFun > 0 | ...
- ((sum(mtlb_strcmp(ASTFunName,SharedInfo.Annotations.DataPrec)) > 0) & (SharedInfo.SkipNextPrec == 1)))
- // Do nothing
-else
- AST_CheckCommonInOutArgs(InArg,NInArg,OutArg,NOutArg,ReportFileName);
-end
-
-//#RNU_RES_B
-// -----------------------------
-// --- C Generation Section. ---
-// -----------------------------
-// --- Load FunInfo structure. ---
-//#RNU_RES_E
-FunInfoDatFileName = fullfile(FunInfoDatDir,CFunName+'.dat');
-load(FunInfoDatFileName,'FunInfo');
-
-//#RNU_RES_B
-// --- Generate include. ---
-//#RNU_RES_E
-if ((Flag_FunAlreadyCalled == 0) & (FunInfo.LibTypeInfo == 'USER2C') & (SharedInfo.NextCFunName ~= CFunName))
- // (SharedInfo.NextCFunName ~= CFunName) I don't want an include in the same file. Ex. in main.h I don't want include "main.h"
- // #RNU_RES_B
- PrintStringInfo('Adding include',ReportFileName,'file','y');
- PrintStringInfo('#include ""'+CFunName+'.h""',...
- ReportFileName,'file','y');
- // #RNU_RES_E
- PrintStringInfo('#include ""'+CFunName+'.h""',...
- Pass1HeaderFileName,'file','y');
-end
-
-//#RNU_RES_B
-// --- Generate the C code for the current function. ---
-//#RNU_RES_E
-FlagCall = 1;
-SharedInfo = C_Funcall(FunInfo,FileInfo,SharedInfo,FlagCall);
-//#RNU_RES_B
-//NUT: anziche farla fare alla cfuncall l'aggiornamento delle skip metti qui una funzione dedicata a cio'
-//NUT: e' piu' ordinato.
-//#RNU_RES_E
+ PrintStringInfo(' Type: '+InArg(1).Type,ReportFileName,'file','y');
+ PrintStringInfo(' Size(1): '+string(InArg(1).Size(1)),ReportFileName,'file','y');
+ PrintStringInfo(' Size(2): '+string(InArg(1).Size(2)),ReportFileName,'file','y');
+ PrintStringInfo(' Value: '+string(InArg(1).Value),ReportFileName,'file','y');
+ PrintStringInfo(' FindLike: '+string(InArg(1).FindLike),ReportFileName,'file','y');
+ PrintStringInfo(' Dimension: '+string(InArg(1).Dimension),ReportFileName,'file','y');
+ PrintStringInfo(' Scope: '+string(InArg(1).Scope),ReportFileName,'file','y');
+ PrintStringInfo(' ',ReportFileName,'file','y');
+ // #RNU_RES_E
+
+ ST_Set(InArg(1).Name,...
+ InArg(1).Type,...
+ InArg(1).Size,...
+ InArg(1).Value,...
+ InArg(1).FindLike,...
+ InArg(1).Dimension,...
+ FileInfo.GlobalVarFileName);
+ end
+ else
+ [InArg,SharedInfo] = ST_GetInArgInfo(InArg,NInArg,FileInfo,SharedInfo);
+ end
+
+ // #RNU_RES_B
+ // -------------------------------------------------------------------
+ // --- Change info of Input Argument according to resize approach. ---
+ // -------------------------------------------------------------------
+ //RNU toglimi nella versione da dare ad hartes.
+ //RNU per ora gestisco solo la resize all con tutte realloc.
+ //RNU global variables are still coded with fixed size.
+ // #RNU_RES_E
+ if (SharedInfo.ResizeApproach=='REALLOC_ALL_RESIZE_ALL')
+ for cntin = 1:NInArg
+ if ((InArg(cntin).Dimension > 0))
+ // if ((InArg(cntin).Dimension > 0) & (InArg(cntin).Scope ~= 'Global'))
+ InArg(cntin).Size(1) = '__'+InArg(cntin).Name+'Size[0]';
+ InArg(cntin).Size(2) = '__'+InArg(cntin).Name+'Size[1]';
+ end
+ //#RNUREM_MERNU vedi se la seguente fa casino l'ho aggiunta in modo che agia=ones(1,3) sia generata come realloc ma non ho verificato.
+ tmpscope = InArg(cntin).Scope;
+ lengthNumber = length('Number_');
+ if (part(tmpscope,1:lengthNumber) == 'Number_')
+ //#RNUREM_ME RNU il problema e' che ones(3,1) allora l'output e' 3,1 e come faccio a trasformare 3 e 1 in simboli in modo tale che realloco anziche' allocare
+ InArg(cntin).Value = %nan; //RNU non va bene dove per esempio hai problemi di 1:3:4 se al posto dei numeri metti nan ti impalli
+ //#RNUREM_ME Credo che dove c'e' uan allocazione secca ones(3,1) non vada lasciata cosi' ma tutto vada ricondotto a realloc
+ //#RNUREM_ME quindi devo vedere nella dichiarazione delle variabili come forzare la dichiarazione dei null pointer.
+ //#RNUREM_ME successivamente devo vedere come fare a riscrivere la size dell'output.
+ else
+ end
+ end
+ end
+
+ // #RNU_RES_B
+ // ---------------------------------
+ // --- Output Arguments Section. ---
+ // ---------------------------------
+ // --- Update Out arg structure with info stored in the function annotations. ---
+ // #RNU_RES_E
+ if (ASTFunName == 'OpEqual')
+ for cntin = 1:NInArg
+ OutArg(cntin).Type = InArg(cntin).Type;
+ OutArg(cntin).Size = InArg(cntin).Size;
+ OutArg(cntin).Dimension = InArg(cntin).Dimension;
+ OutArg(cntin).Value = InArg(cntin).Value;
+ OutArg(cntin).FindLike = InArg(cntin).FindLike;
+ //NUT: forse qui occorre aggiungere lo scope che dovrebbe essere local or global.
+ //NUT: per ora lo scope viene settato da AST_ParseEqualStruct
+ end
+ elseif ((ASTFunName == 'OpMinus') & (NInArg == 1) & (InArg(1).Dimension == 0)&(InArg(1).Scope == 'Number'))
+ // #RNU_RES_B
+ // --- Manage OpMinus when applied to scalars. ---
+ // -1 is not translated as tmp = OpMinus(1), but
+ // it is considered as a single entity "-1"
+ // #RNU_RES_E
+ SharedInfo.SkipNextFun = 1; //RN: SISTEMAMI
+ OutArg(1).Type = InArg(1).Type;
+ OutArg(1).Size = InArg(1).Size;
+ OutArg(1).Dimension = InArg(1).Dimension;
+ OutArg(1).Value = -InArg(1).Value;
+ OutArg(1).FindLike = InArg(1).FindLike;
+ OutArg(1).Scope = 'Number_'+InArg(1).Type;
+ elseif ((ASTFunName == 'float') & (NInArg == 1) & (InArg(1).Dimension == 0) & (InArg(1).Scope == 'Number'))
+ // #RNU_RES_B
+ // --- Manage OpMinus when applied to scalars. ---
+ // -1 is not translated as tmp = OpMinus(1), but
+ // it is considered as a single entity "-1"
+ // #RNU_RES_E
+ SharedInfo.SkipNextFun = 1; //RN: SISTEMAMI
+ OutArg(1).Type = InArg(1).Type;
+ OutArg(1).Size = InArg(1).Size;
+ OutArg(1).Dimension = InArg(1).Dimension;
+ OutArg(1).Value = InArg(1).Value;
+ OutArg(1).FindLike = InArg(1).FindLike;
+ OutArg(1).Scope = 'Number_s';
+ elseif ((ASTFunName == 'double') & (NInArg == 1) & (InArg(1).Dimension == 0) & (InArg(1).Scope == 'Number'))
+ // #RNU_RES_B
+ // --- Manage OpMinus when applied to scalars. ---
+ // -1 is not translated as tmp = OpMinus(1), but
+ // it is considered as a single entity "-1"
+ // #RNU_RES_E
+ SharedInfo.SkipNextFun = 1;
+ //RN: SISTEMAMI
+ SharedInfo.SkipNextFun = 1; //RN: SISTEMAMI
+ OutArg(1).Type = InArg(1).Type;
+ OutArg(1).Size = InArg(1).Size;
+ OutArg(1).Dimension = InArg(1).Dimension;
+ OutArg(1).Value = InArg(1).Value;
+ OutArg(1).FindLike = InArg(1).FindLike;
+ OutArg(1).Scope = 'Number_d';
+ else
+ OutArg = FA_GetOutArgInfo(InArg,NInArg,OutArg,NOutArg,SharedInfo,FunPrecSpecifier,FunTypeAnnot,FunSizeAnnot,ReportFileName);
+ end
+
+ // #RNU_RES_B
+ // --- Generate the names for the output arguments. ---
+ // Update of OutArg.Name and OutArg.Scope fields.
+ // #RNU_RES_E
+ if ((ASTFunName == 'OpMinus') & (NInArg == 1) & (InArg(1).Dimension == 0) & (InArg(1).Scope == 'Number'))
+ OutArg(1).Name = string(OutArg(1).Value);
+ elseif ((ASTFunName == 'float') & (NInArg == 1) & (InArg(1).Dimension == 0) & (InArg(1).Scope == 'Number'))
+ 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);
+ else
+ [OutArg,SharedInfo] = GenOutArgNames(ASTFunName,InArg,NInArg,OutArg,NOutArg,LhsArg,NLhsArg,FileInfo,SharedInfo);
+ end
+
+ // #RNU_RES_B
+ // --- Push in the AST stack the Output arguments. ---
+ // #RNU_RES_E
+ if (ASTFunName == 'OpEqual')
+ // Do nothing
+ else
+ for counteroutargs = 1:NOutArg
+ tmppushstack = OutArg(counteroutargs).Scope+': '+OutArg(counteroutargs).Name;
+ // #RNU_RES_B
+ PrintStringInfo(' Pushing in the AST stack: ""'+tmppushstack+'"".',ReportFileName,'file','y');
+ // #RNU_RES_E
+ AST_PushASTStack(tmppushstack);
+ end
+ end
+
+ // #RNU_RES_B
+ //NUT: verificare se si puo' accorpare qualcosa qui sotto
+ //RN: non capisco come mai analizzo lo scope dopo che faccio il push nello stack dove lo utilizzo!!!
+ // --- Scope analysis of the output arguments. ---
+ // #RNU_RES_E
+ if (ASTFunName == 'OpMinus' & NInArg == 1 & (InArg(1).Dimension == 0) & (InArg(1).Scope == 'Number'))
+ // Scope already set above.
+ elseif (ASTFunName == 'float' & NInArg == 1 & (InArg(1).Dimension == 0) & (InArg(1).Scope == 'Number'))
+ // Scope already set above.
+ elseif (ASTFunName == 'double' & NInArg == 1 & (InArg(1).Dimension == 0) & (InArg(1).Scope == 'Number'))
+ // Scope already set above.
+ else
+ OutArg = ST_AnalyzeScope(OutArg,NOutArg,FileInfo,SharedInfo);
+ end
+
+ //#RNUREM_ME --- Check if the current function is handling for counter variables. ---
+ [OutArg,SharedInfo] = ST_InsForCntVars(InArg,NInArg,OutArg,NOutArg,ASTFunName,FileInfo,SharedInfo);
+
+ //#RNUREM_ME --- Store the while condition variable (if any). ---
+ SharedInfo = GetWhileCondVariable(OutArg,NOutArg,ASTFunName,FileInfo,SharedInfo);
+
+ //#RNUREM_ME --- Update Symbol Table with output arguments. ---
+ if ((ASTFunName == 'OpMinus') & (NInArg == 1) & (InArg(1).Dimension == 0) & (InArg(1).Scope == 'Number'))
+ //#RNUREM_ME A number is not inserted in the symbol table.
+ elseif ((ASTFunName == 'float') & (NInArg == 1) & (InArg(1).Dimension == 0) & (InArg(1).Scope == 'Number'))
+ //#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.
+ else
+ ST_InsOutArg(OutArg,NOutArg,FileInfo,SharedInfo,'all');
+ end
+ //#RNUREM_ME NUT: per risparmiare tempo di esecuzione puoi mettere delle if sulle funzioni che devono
+ //#RNUREM_ME NUT: essere skippate.
+
+ //#RNU_RES_B
+ // --------------------------------------------
+ // --- Generate the C name of the function. ---
+ // --------------------------------------------
+ //#RNU_RES_E
+
+ CFunName = C_GenerateFunName(ASTFunName,InArg,NInArg,OutArg,NOutArg);
+ //#RNU_RES_B
+ PrintStringInfo(' C Function Name: '+CFunName,ReportFileName,'file','y');
+ if(IsArduinoFunction(ASTFunName))
+ if(IsArduinoSetupFunction(ASTFunName))
+ //If current function is an arduino setup function (like 'dc_motor_setup'), it
+ //should not be converted and inserted here. It is inserted in a list now and
+ //added to 'setup_arduino.c' later
+ InsertSetupInList(CFunName,InArg,NInArg,SetupListFile,'Setup');
+ SharedInfo.SkipNextFun = SharedInfo.SkipNextFun + 1;
+ else //Currnet arduino function is not a setup function, so init function must be added
+ InsertSetupInList(ASTFunName,InArg,NInArg,SetupListFile,'Init');
+ end
+ end
+
+ // -------------------------------------------------------------------------
+ // --- Determine which library the function belongs to: USER2C or SCI2C. ---
+ // -------------------------------------------------------------------------
+ //#RNU_RES_E
+ if SCI2Cfileexist(FileInfo.SCI2CLibCAnnFun,ASTFunName+'.ann')
+ LibTypeInfo = 'SCI2C';
+ else
+ LibTypeInfo = 'USER2C';
+ end
+
+ //#RNU_RES_B
+ // ------------------------------------------------------------------------------------
+ // --- Check whether the function has been already called in the current .sci file. ---
+ // ------------------------------------------------------------------------------------
+ //#RNU_RES_E
+ if (sum(SharedInfo.CFunctsAlreadyCalled == CFunName) == 1)
+ Flag_FunAlreadyCalled = 1;
+ else
+
+ //#RNUREM_ME Add the C function name to the list of C functions called in the current .sci file.
+ SharedInfo.CFunctsAlreadyCalled(size(SharedInfo.CFunctsAlreadyCalled,1)+1) = CFunName;
+ end
+
+ //#RNU_RES_B
+ // ----------------------------------
+ // --- Generate FunInfo dat file. ---
+ // ----------------------------------
+ //NUT: questo .dat deve essere generato sempre perche' cambiano i nomi degli argomenti mentre il resto dovrebbe
+ //NUT: essere tutto uguale
+ //NUT: magari posso fare una funzione che inserisce solo i campi diversi e fa un check su quelli che
+ //NUT: dovrebbero essere identici.
+ //#RNU_RES_E
+ GenCFunDatFiles(ASTFunName,FunPrecSpecifier,FunTypeAnnot,FunSizeAnnot,InArg,NInArg,OutArg,NOutArg,CFunName,LibTypeInfo,FunInfoDatDir);
+
+ //#RNU_RES_B
+ // -----------------------------------
+ // --- Update SCI2C Function List. ---
+ // -----------------------------------
+ // Functions that are not already available in C are stored
+ // in the SCI2C Function List and converted in C at the end of
+ // the translation of the current .sci file.
+ //NUT: il problema della d0d0OpEqual dovrebbe essere legato al fatto che cerco di fare la opequal legata alla ins...
+ //NUT: devo evitare di scriveral dentro la lsista delle funzioni da tradurre.
+ //#RNU_RES_E
+ SharedInfo = FL_UpdateToBeConv(ASTFunName,CFunName,FunPrecSpecifier,FunTypeAnnot,FunSizeAnnot,InArg,NInArg,OutArg,NOutArg,FileInfo,SharedInfo);
+
+ //#RNU_RES_B
+ // -----------------------------------------------
+ // --- Check on common input/output arguments. ---
+ // -----------------------------------------------
+ //#RNU_RES_E
+ if (((ASTFunName=='OpEqual') & (SharedInfo.SkipNextEqual == 1)) | ...
+ SharedInfo.SkipNextFun > 0 | ...
+ ((sum(mtlb_strcmp(ASTFunName,SharedInfo.Annotations.DataPrec)) > 0) & (SharedInfo.SkipNextPrec == 1)))
+ // Do nothing
+ else
+ AST_CheckCommonInOutArgs(InArg,NInArg,OutArg,NOutArg,ReportFileName);
+ end
+
+ //#RNU_RES_B
+ // -----------------------------
+ // --- C Generation Section. ---
+ // -----------------------------
+ // --- Load FunInfo structure. ---
+ //#RNU_RES_E
+ FunInfoDatFileName = fullfile(FunInfoDatDir,CFunName+'.dat');
+ load(FunInfoDatFileName,'FunInfo');
+
+ //#RNU_RES_B
+ // --- Generate include. ---
+ //#RNU_RES_E
+ if ((Flag_FunAlreadyCalled == 0) & (FunInfo.LibTypeInfo == 'USER2C') & (SharedInfo.NextCFunName ~= CFunName))
+ // (SharedInfo.NextCFunName ~= CFunName) I don't want an include in the same file. Ex. in main.h I don't want include "main.h"
+ // #RNU_RES_B
+ PrintStringInfo('Adding include',ReportFileName,'file','y');
+ PrintStringInfo('#include ""'+CFunName+'.h""',...
+ ReportFileName,'file','y');
+ // #RNU_RES_E
+ PrintStringInfo('#include ""'+CFunName+'.h""',...
+ Pass1HeaderFileName,'file','y');
+ end
+
+ //#RNU_RES_B
+ // --- Generate the C code for the current function. ---
+ //#RNU_RES_E
+ FlagCall = 1;
+ SharedInfo = C_Funcall(FunInfo,FileInfo,SharedInfo,FlagCall);
+ //#RNU_RES_B
+ //NUT: anziche farla fare alla cfuncall l'aggiornamento delle skip metti qui una funzione dedicata a cio'
+ //NUT: e' piu' ordinato.
+ //#RNU_RES_E
endfunction
diff --git a/2.3-1/macros/FunctionList/FL_ExtractFuncList.sci b/2.3-1/macros/FunctionList/FL_ExtractFuncList.sci
index 9e951d9c..cbc14655 100644
--- a/2.3-1/macros/FunctionList/FL_ExtractFuncList.sci
+++ b/2.3-1/macros/FunctionList/FL_ExtractFuncList.sci
@@ -34,7 +34,7 @@ SCI2CNInArgCheck(argn(2),5,5);
tmppwd = pwd();
cd(FunctionDir);
// funfiles = ls();
-funfiles = listfiles();
+funfiles = listfiles();
cd(tmppwd);
NFunFiles = size(funfiles,1);
diff --git a/2.3-1/macros/Hardware/AVR/AVRPWMSetDuty.bin b/2.3-1/macros/Hardware/AVR/AVRPWMSetDuty.bin
new file mode 100644
index 00000000..f3c9e3e4
--- /dev/null
+++ b/2.3-1/macros/Hardware/AVR/AVRPWMSetDuty.bin
Binary files differ
diff --git a/2.3-1/macros/Hardware/AVR/AVRPWMSetDuty.sci b/2.3-1/macros/Hardware/AVR/AVRPWMSetDuty.sci
new file mode 100644
index 00000000..0042540a
--- /dev/null
+++ b/2.3-1/macros/Hardware/AVR/AVRPWMSetDuty.sci
@@ -0,0 +1,24 @@
+function AVRPWMSetDuty(timer, duty)
+// Function to set duty for PWM of AVR
+//
+// Calling Sequence
+// AVRPWMSetDuty(uint8 timer, uint8 duty)
+//
+// Parameters
+// timer: timer to be used for PWM generation (0,1,2)
+// duty: duty for PWM waveform (0-100)
+//
+// Description
+// This function sets duty for PWM waveform according to given parameters.
+//
+// Examples
+// AVRPWMSetDuty(0,10) //Sets 10% duty for timer 0 output.
+//
+// Authors
+// Siddhesh Wani
+//
+//
+
+// This is curretly dummy function. It provides no functionality but is required
+// for providing support for generating C code for AVR.
+endfunction
diff --git a/2.3-1/macros/Hardware/AVR/lib b/2.3-1/macros/Hardware/AVR/lib
index aa4d6113..3e0137c5 100644
--- a/2.3-1/macros/Hardware/AVR/lib
+++ b/2.3-1/macros/Hardware/AVR/lib
Binary files differ
diff --git a/2.3-1/macros/Hardware/AVR/names b/2.3-1/macros/Hardware/AVR/names
index afd171ec..0e6aa636 100644
--- a/2.3-1/macros/Hardware/AVR/names
+++ b/2.3-1/macros/Hardware/AVR/names
@@ -2,6 +2,7 @@ AVRADCSetup
AVRDigitalIn
AVRDigitalOut
AVRDigitalSetup
+AVRPWMSetDuty
AVRPWMSetup
AVRReadADC
GetAVRSupportFunctions
diff --git a/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.bin b/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.bin
index f790c5e8..be0c48fb 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 c6423531..c3981a49 100644
--- a/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci
+++ b/2.3-1/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci
@@ -3952,6 +3952,56 @@ INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,Ex
//------------------------------------
+//---- Class cmd_dcmotor_setup -------
+//------------------------------------
+ClassName = 'cmd_dcmotor_setup';
+
+// --- Class Annotation. ---
+PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+PrintStringInfo('NIN= 5',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).TP= ''u8''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y');
+
+// --- Function List Class. ---
+ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
+PrintStringInfo('d0d0d0d0d0'+ArgSeparator+'u80',ClassFileName,'file','y');
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'cmd_dcmotor_setup';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+//------------------------------------
+//---- Class cmd_dcmotor_run -------
+//------------------------------------
+ClassName = 'cmd_dcmotor_run';
+
+// --- Class Annotation. ---
+PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+PrintStringInfo('NIN= 3',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).TP= ''u8''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y');
+
+// --- Function List Class. ---
+ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
+PrintStringInfo('d0d0d0'+ArgSeparator+'u80',ClassFileName,'file','y');
+PrintStringInfo('d0d0i160'+ArgSeparator+'u80',ClassFileName,'file','y');
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'cmd_dcmotor_run';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+
+//------------------------------------
//---- Class Sleep -------------------
//------------------------------------
ClassName = 'sleep';
@@ -4109,6 +4159,57 @@ INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,E
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+//------------------------------------
+//---- Class AVRPWMSetup -------------
+//------------------------------------
+ClassName = 'AVRPWMSetup';
+
+// --- Class Annotation. ---
+PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+PrintStringInfo('NIN= 4',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).TP= ''u8''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y');
+
+// --- Function List Class. ---
+ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
+PrintStringInfo('d0d0d0d0'+ArgSeparator+'u80',ClassFileName,'file','y');
+
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'AVRPWMSetup';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+//------------------------------------
+//---- Class AVRPWMSetDuty -----------
+//------------------------------------
+ClassName = 'AVRPWMSetDuty';
+
+// --- Class Annotation. ---
+PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+PrintStringInfo('NIN= 2',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).TP= ''u8''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y');
+
+// --- Function List Class. ---
+ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
+PrintStringInfo('d0d0'+ArgSeparator+'u80',ClassFileName,'file','y');
+
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'AVRPWMSetDuty';
+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_GenFileInfo.bin b/2.3-1/macros/ToolInitialization/INIT_GenFileInfo.bin
index 8f114a72..a8d47222 100644
--- a/2.3-1/macros/ToolInitialization/INIT_GenFileInfo.bin
+++ b/2.3-1/macros/ToolInitialization/INIT_GenFileInfo.bin
Binary files differ
diff --git a/2.3-1/macros/ToolInitialization/INIT_GenFileInfo.sci b/2.3-1/macros/ToolInitialization/INIT_GenFileInfo.sci
index 753509e3..21fe7a72 100644
--- a/2.3-1/macros/ToolInitialization/INIT_GenFileInfo.sci
+++ b/2.3-1/macros/ToolInitialization/INIT_GenFileInfo.sci
@@ -113,5 +113,5 @@ FileInfo.MakefileFilename = fullfile(FileInfo.CStyleOutCCCodeDir,'Makefile');
//----Hardware related-----
//-------------------------
FileInfo.PeripheralInitListFile = fullfile(FileInfo.WorkingDir,'PeripheralInit.dat');
-
+FileInfo.SetupListFile = fullfile(FileInfo.WorkingDir,'SetupList.dat');
endfunction
diff --git a/2.3-1/macros/ToolInitialization/INIT_LoadLibraries.bin b/2.3-1/macros/ToolInitialization/INIT_LoadLibraries.bin
index 4cf02836..c85aac6e 100644
--- a/2.3-1/macros/ToolInitialization/INIT_LoadLibraries.bin
+++ b/2.3-1/macros/ToolInitialization/INIT_LoadLibraries.bin
Binary files differ
diff --git a/2.3-1/macros/ToolInitialization/INIT_LoadLibraries.sci b/2.3-1/macros/ToolInitialization/INIT_LoadLibraries.sci
index 1ef9ee00..28eb34f5 100644
--- a/2.3-1/macros/ToolInitialization/INIT_LoadLibraries.sci
+++ b/2.3-1/macros/ToolInitialization/INIT_LoadLibraries.sci
@@ -49,7 +49,7 @@ ToBeConverted(1).CFunctionName = SharedInfo.NextCFunName;
// --- Read the list of library functions available. ---
[SCI2CAvailableC,SCI2CNElem] = FL_ExtractFuncList(FileInfo.SCI2CLibCFLFun,FileInfo.SCI2CLibCFLCls,...
SharedInfo.Annotations.FUNCLASS,SharedInfo.Extension.FuncListClasses,FileInfo.GeneralReport);
-
+//disp (SCI2CAvailable);
[USER2CAvailableC,USER2CNElem] = FL_ExtractFuncList(FileInfo.USER2CLibCFLFun,FileInfo.USER2CLibCFLCls,...
SharedInfo.Annotations.FUNCLASS,SharedInfo.Extension.FuncListClasses,FileInfo.GeneralReport);
diff --git a/2.3-1/macros/ToolInitialization/INIT_SCI2C.bin b/2.3-1/macros/ToolInitialization/INIT_SCI2C.bin
index 72623b28..c6141d61 100644
--- a/2.3-1/macros/ToolInitialization/INIT_SCI2C.bin
+++ b/2.3-1/macros/ToolInitialization/INIT_SCI2C.bin
Binary files differ
diff --git a/2.3-1/macros/ToolInitialization/INIT_SCI2C.sci b/2.3-1/macros/ToolInitialization/INIT_SCI2C.sci
index 0340d6ff..6dde05de 100644
--- a/2.3-1/macros/ToolInitialization/INIT_SCI2C.sci
+++ b/2.3-1/macros/ToolInitialization/INIT_SCI2C.sci
@@ -147,8 +147,13 @@ anscounter = 0;
//--------------------------------------------
//---Hardware related initialisation----------
//--------------------------------------------
-PeripheralList = list();
-save(FileInfo.PeripheralInitListFile, 'PeripheralList');
+if (OutFormat == 'AVR')
+ PeripheralList = list();
+ save(FileInfo.PeripheralInitListFile, 'PeripheralList');
+elseif (OutFormat == 'Arduino')
+ SetupList = list();
+ save(FileInfo.SetupListFile, 'SetupList');
+end
endfunction
// #RNU_RES_B
diff --git a/2.3-1/macros/ToolInitialization/ManageNextConversion.bin b/2.3-1/macros/ToolInitialization/ManageNextConversion.bin
index a34ee4f6..bf43562a 100644
--- a/2.3-1/macros/ToolInitialization/ManageNextConversion.bin
+++ b/2.3-1/macros/ToolInitialization/ManageNextConversion.bin
Binary files differ
diff --git a/2.3-1/macros/ToolInitialization/ManageNextConversion.sci b/2.3-1/macros/ToolInitialization/ManageNextConversion.sci
index 04ec9dbc..a1524766 100644
--- a/2.3-1/macros/ToolInitialization/ManageNextConversion.sci
+++ b/2.3-1/macros/ToolInitialization/ManageNextConversion.sci
@@ -49,6 +49,7 @@ C_FinalizeCode(FileInfo,SharedInfo);
// --- Identify the next function to translate. ---
// ------------------------------------------------
SharedInfo.NFilesToTranslate = SharedInfo.NFilesToTranslate - 1;
+
if (SharedInfo.NFilesToTranslate >= 1)
// Remove the translated C function from the ToBeConverted list
ToBeConverted(1) = [];
diff --git a/2.3-1/macros/buildmacros.sce b/2.3-1/macros/buildmacros.sce
index 627e6384..dfeb4755 100644
--- a/2.3-1/macros/buildmacros.sce
+++ b/2.3-1/macros/buildmacros.sce
@@ -9,7 +9,8 @@ Directories = [ "ASTManagement", ...
"GeneralFunctions", ...
"SymbolTable", ...
"ToolInitialization"...
- "Hardware" ];
+ "Hardware/AVR"...
+ "Scilab-Arduino" ];
current_path_buildmacros = get_absolute_file_path("buildmacros.sce");
diff --git a/2.3-1/macros/findDeps/getAllHeaders.bin b/2.3-1/macros/findDeps/getAllHeaders.bin
index 50ce832f..4ed973e7 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 697a0fa6..7cddce29 100644
--- a/2.3-1/macros/findDeps/getAllHeaders.sci
+++ b/2.3-1/macros/findDeps/getAllHeaders.sci
@@ -134,11 +134,14 @@ function allHeaders = getAllHeaders(OutFormat)
"src/c/scilab-arduino/includes/cmd_digital_in.h"
"src/c/scilab-arduino/includes/cmd_analog_out.h"
"src/c/scilab-arduino/includes/cmd_analog_in.h"
+ "src/c/scilab-arduino/includes/cmd_dcmotor_setup.h"
+ "src/c/scilab-arduino/includes/cmd_dcmotor_run.h"
"src/c/scilab-arduino/includes/sleep.h"];
AVR_headers = [
"src/c/hardware/avr/includes/AVRPeripheralGPIO.h"
"src/c/hardware/avr/includes/AVRPeripheralADC.h"
+ "src/c/hardware/avr/includes/AVRPeripheralPWM.h"
"src/c/hardware/avr/includes/AVRUtil.h"
];
diff --git a/2.3-1/macros/findDeps/getAllInterfaces.bin b/2.3-1/macros/findDeps/getAllInterfaces.bin
index c28ac331..368b84ab 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 14249d08..78138093 100644
--- a/2.3-1/macros/findDeps/getAllInterfaces.sci
+++ b/2.3-1/macros/findDeps/getAllInterfaces.sci
@@ -127,12 +127,14 @@ function allInterfaces = getAllInterfaces(OutFormat)
"src/c/scilab-arduino/interfaces/int_cmd_digital_in.h"
"src/c/scilab-arduino/interfaces/int_cmd_analog_out.h"
"src/c/scilab-arduino/interfaces/int_cmd_analog_in.h"
+ "src/c/scilab-arduino/interfaces/int_cmd_dcmotor.h"
"src/c/scilab-arduino/interfaces/int_sleep.h"];
//Interface files required for "AVR" output
AVR_interfaces = [
"src/c/hardware/avr/interfaces/int_AVRPeripheralGPIO.h"
"src/c/hardware/avr/interfaces/int_AVRPeripheralADC.h"
+ "src/c/hardware/avr/interfaces/int_AVRPeripheralADC.h"
"src/c/hardware/avr/interfaces/int_AVRUtil.h"
];
diff --git a/2.3-1/macros/findDeps/getAllSources.bin b/2.3-1/macros/findDeps/getAllSources.bin
index b1591ac4..a81e474e 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 325d4b23..c8d6d0b4 100644
--- a/2.3-1/macros/findDeps/getAllSources.sci
+++ b/2.3-1/macros/findDeps/getAllSources.sci
@@ -822,6 +822,8 @@ function allSources = getAllSources(OutFormat)
"src/c/scilab-arduino/cmd_digital_in/u8cmd_digital_ins.c"
"src/c/scilab-arduino/cmd_analog_out/u8cmd_analog_outs.c"
"src/c/scilab-arduino/cmd_analog_in/u8cmd_analog_ins.c"
+ "src/c/scilab-arduino/cmd_dcmotor_setup/u8cmd_dcmotor_setups.c"
+ "src/c/scilab-arduino/cmd_dcmotor_run/u8cmd_dcmotor_runs.c"
"src/c/scilab-arduino/sleep/u16sleeps.c"];
//Files to be inserted only if output format selected is 'AVR'.
@@ -831,6 +833,8 @@ function allSources = getAllSources(OutFormat)
"src/c/hardware/avr/gpio/u8AVRDigitalIns.c"
"src/c/hardware/avr/adc/u8AVRADCSetups.c"
"src/c/hardware/avr/adc/u8AVRReadADCs.c"
+ "src/c/hardware/avr/pwm/u8AVRPWMSetups.c"
+ "src/c/hardware/avr/pwm/u8AVRPWMSetDutys.c"
"src/c/hardware/avr/util/u16AVRSleeps.c"
];
diff --git a/2.3-1/macros/findDeps/getArduinoFiles.bin b/2.3-1/macros/findDeps/getArduinoFiles.bin
index f8937bfe..651b8f3d 100644
--- a/2.3-1/macros/findDeps/getArduinoFiles.bin
+++ b/2.3-1/macros/findDeps/getArduinoFiles.bin
Binary files differ
diff --git a/2.3-1/macros/findDeps/getArduinoFiles.sci b/2.3-1/macros/findDeps/getArduinoFiles.sci
index a51d9b52..89033d00 100644
--- a/2.3-1/macros/findDeps/getArduinoFiles.sci
+++ b/2.3-1/macros/findDeps/getArduinoFiles.sci
@@ -12,6 +12,7 @@
function arduinoFiles = getArduinoFiles()
arduinoFiles = [
+ "src/c/scilab-arduino/default_files/setup_arduino.h"
"src/c/scilab-arduino/default_files/Makefile"
"src/c/scilab-arduino/default_files/sci2c_arduino.ino"];
endfunction
diff --git a/2.3-1/macros/runsci2c.bin b/2.3-1/macros/runsci2c.bin
index afe6e7d6..6c09823e 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 91587031..4620705c 100644
--- a/2.3-1/macros/runsci2c.sci
+++ b/2.3-1/macros/runsci2c.sci
@@ -133,12 +133,15 @@ end
//default folder, else generate makefile for standalone c code
if (OutFormat == 'Arduino')
+
+ GenerateSetupFunction(FileInfo);
mkdir(SCI2COutputPath+"/arduino/");
mkdir(SCI2COutputPath+"/arduino/sci2c_arduino");
//Copy arduino makefile
arduinoFiles = SCI2CHOME + "/" + getArduinoFiles();
PrintStepInfo('Copying arduino files', FileInfo.GeneralReport,'both');
- for i = 1:size(arduinoFiles, "*")
+ copyfile(arduinoFiles(1), SCI2COutputPath);
+ for i = 2:size(arduinoFiles, "*")
// DEBUG only
//disp("Copying "+arduinoFiles(i)+" in "+SCI2COutputPath+"/arduino/sci2carduino");
copyfile(arduinoFiles(i), SCI2COutputPath+"/arduino/sci2c_arduino/");