summaryrefslogtreecommitdiff
path: root/macros/CCodeGeneration
diff options
context:
space:
mode:
authoryash11122017-07-07 22:03:16 +0530
committeryash11122017-07-07 22:03:16 +0530
commit69c573fe2e59236f063aaa94dcd44b556f945cbc (patch)
tree08fa381bec620e38c7a3d2a34448d30160d861eb /macros/CCodeGeneration
parent87823db220f4c3b8bee16c0b2e08027704de1efe (diff)
parent3f52712f806fbd80d66dfdcaff401e5cf94dcca4 (diff)
downloadscilab2c-69c573fe2e59236f063aaa94dcd44b556f945cbc.tar.gz
scilab2c-69c573fe2e59236f063aaa94dcd44b556f945cbc.tar.bz2
scilab2c-69c573fe2e59236f063aaa94dcd44b556f945cbc.zip
Scilab2C Arduino Updated
Diffstat (limited to 'macros/CCodeGeneration')
-rw-r--r--macros/CCodeGeneration/C_GenerateMakefile.sci7
-rw-r--r--macros/CCodeGeneration/C_GenerateMkfle_arduino.sci15
-rw-r--r--macros/CCodeGeneration/C_IfExpression.sci24
-rw-r--r--macros/CCodeGeneration/C_WhileExpression.sci16
-rw-r--r--macros/CCodeGeneration/GetClsFileName.sci12
-rw-r--r--macros/CCodeGeneration/JoinDeclarAndCcode.sci7
-rw-r--r--macros/CCodeGeneration/names3
7 files changed, 84 insertions, 0 deletions
diff --git a/macros/CCodeGeneration/C_GenerateMakefile.sci b/macros/CCodeGeneration/C_GenerateMakefile.sci
index 3b977bd6..e2899bd9 100644
--- a/macros/CCodeGeneration/C_GenerateMakefile.sci
+++ b/macros/CCodeGeneration/C_GenerateMakefile.sci
@@ -70,7 +70,11 @@ else
PrintStringInfo('CXX = arm-linux-gnueabihf-g++ ',FileInfo.MakefileFilename,'file','y','y');
PrintStringInfo('CFLAGS = -Wall -pedantic -g -I $(HSRCDIR) -I $(ISRCDIR) -L $(LIBDIR)',FileInfo.MakefileFilename,'file','y','y');
PrintStringInfo('CXXFLAGS = -Wall -pedantic -g -I $(HSRCDIR) -I $(ISRCDIR) -L $(LIBDIR)',FileInfo.MakefileFilename,'file','y','y');
+<<<<<<< HEAD
PrintStringInfo('LDFLAGS = -llapack -lrefblas -lgfortran -lwiringPi -lwiringPiDev -lrt -lpthread',FileInfo.MakefileFilename,'file','y','y');
+=======
+ PrintStringInfo('LDFLAGS = -llapack -lrefblas -lgfortran -lwiringPi',FileInfo.MakefileFilename,'file','y','y');
+>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0
else
PrintStringInfo('CC = gcc',FileInfo.MakefileFilename,'file','y','y');
PrintStringInfo('CXX = g++',FileInfo.MakefileFilename,'file','y','y');
@@ -78,6 +82,7 @@ else
PrintStringInfo('CXXFLAGS = -Wall -pedantic -g -I $(HSRCDIR) -I $(ISRCDIR) -L $(LIBDIR)',FileInfo.MakefileFilename,'file','y','y');
PrintStringInfo('LDFLAGS = -lblas -llapack -lm ',FileInfo.MakefileFilename,'file','y','y');
end
+<<<<<<< HEAD
//If ode function is used, add libgsl.
if(size(SharedInfo.Includelist) <> 0)
@@ -97,6 +102,8 @@ else
PrintStringInfo('LDFLAGS += -lblas -llapack -lm ',FileInfo.MakefileFilename,'file','y','y');
end
+=======
+>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0
if(SharedInfo.OpenCVUsed == %T)
PrintStringInfo('LDFLAGS += -lopencv_calib3d -lopencv_contrib -lopencv_features2d -lopencv_flann -lopencv_gpu',FileInfo.MakefileFilename,'file','y','y');
PrintStringInfo('LDFLAGS += -lopencv_highgui -lopencv_imgproc -lopencv_legacy -lopencv_ml -lopencv_nonfree',FileInfo.MakefileFilename,'file','y','y');
diff --git a/macros/CCodeGeneration/C_GenerateMkfle_arduino.sci b/macros/CCodeGeneration/C_GenerateMkfle_arduino.sci
index b43eb442..2b9ca6c9 100644
--- a/macros/CCodeGeneration/C_GenerateMkfle_arduino.sci
+++ b/macros/CCodeGeneration/C_GenerateMkfle_arduino.sci
@@ -1,3 +1,18 @@
+<<<<<<< HEAD
+=======
+// Copyright (C) 2017 - IIT Bombay - FOSSEE
+
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+// Author: Yash Pratap Singh Tomar
+// Organization: FOSSEE, IIT Bombay
+// Email: toolbox@scilab.in
+
+
+>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0
function C_GenerateMkfle_arduino(FileInfo,SharedInfo)
PrintStringInfo('ARDUINO_DIR = /usr/share/arduino',FileInfo.MakefileFilename,'file','y','y');
diff --git a/macros/CCodeGeneration/C_IfExpression.sci b/macros/CCodeGeneration/C_IfExpression.sci
index 359b7882..23be4522 100644
--- a/macros/CCodeGeneration/C_IfExpression.sci
+++ b/macros/CCodeGeneration/C_IfExpression.sci
@@ -1,4 +1,8 @@
+<<<<<<< HEAD
function SharedInfo = C_IfExpression(IfCondArg,NIfCondArg,Op,NOp,ASTIfExpType,FileInfo,SharedInfo)
+=======
+function SharedInfo = C_IfExpression(IfCondArg,NIfCondArg,ASTIfExpType,FileInfo,SharedInfo)
+>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0
// function SharedInfo = C_IfExpression(IfCondArg,NIfCondArg,ASTIfExpType,FileInfo,SharedInfo)
// -----------------------------------------------------------------
// //NUT: add description here
@@ -19,6 +23,7 @@ function SharedInfo = C_IfExpression(IfCondArg,NIfCondArg,Op,NOp,ASTIfExpType,Fi
// ------------------------------
// --- Check input arguments. ---
// ------------------------------
+<<<<<<< HEAD
SCI2CNInArgCheck(argn(2),7,7);
//global SCI2CSTACK
@@ -29,6 +34,14 @@ SCI2CNInArgCheck(argn(2),7,7);
//if ((NIfCondArg ~= 1) & (ASTIfExpType~='else'))
// error(9999, 'Cannot manage ""if/elseif"" with a number of condition variables not equal to 1.');
//end
+=======
+SCI2CNInArgCheck(argn(2),5,5);
+
+// --- Check NIfCondArg value. ---
+if ((NIfCondArg ~= 1) & (ASTIfExpType~='else'))
+ error(9999, 'Cannot manage ""if/elseif"" with a number of condition variables not equal to 1.');
+end
+>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0
// -----------------------
// --- Initialization. ---
@@ -41,7 +54,11 @@ CPass1FileName = FileInfo.Funct(nxtscifunnumber).CPass1FileName;
// #RNU_RES_B
PrintStringInfo(' ',ReportFileName,'file','y');
+<<<<<<< HEAD
PrintStringInfo('***Generating C code***'+ string(NIfCondArg),ReportFileName,'file','y');
+=======
+PrintStringInfo('***Generating C code***',ReportFileName,'file','y');
+>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0
// #RNU_RES_E
// ---------------------------
// --- End Initialization. ---
@@ -70,6 +87,7 @@ if SCI2Cstrncmps1size(ASTIfExpType,'else')
SharedInfo = C_IfElseBlocks(FileInfo,SharedInfo,'out');
end
+<<<<<<< HEAD
i=1;
k=1;
CCall ='';
@@ -87,6 +105,12 @@ if (ASTIfExpType~='else')
i = i + 1;
end
CCall = CCall+')';
+=======
+CCall ='';
+CCall = CCall+CFunName;
+if (ASTIfExpType~='else')
+ CCall = CCall+'('+IfCondArg(1)+')';
+>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0
end
PrintStringInfo(' '+CCall,ReportFileName,'file','y');
PrintStringInfo(C_IndentBlanks(SharedInfo.NIndent)+CCall,CPass1FileName,'file','y');
diff --git a/macros/CCodeGeneration/C_WhileExpression.sci b/macros/CCodeGeneration/C_WhileExpression.sci
index 368ccffa..c63b9e80 100644
--- a/macros/CCodeGeneration/C_WhileExpression.sci
+++ b/macros/CCodeGeneration/C_WhileExpression.sci
@@ -1,4 +1,8 @@
+<<<<<<< HEAD
function SharedInfo = C_WhileExpression(IfCondArg,NIfCondArg,Op,NOp,FileInfo,SharedInfo)
+=======
+function SharedInfo = C_WhileExpression(FileInfo,SharedInfo)
+>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0
// function SharedInfo = C_WhileExpression(FileInfo,SharedInfo)
// -----------------------------------------------------------------
// //NUT: add description here
@@ -19,7 +23,11 @@ function SharedInfo = C_WhileExpression(IfCondArg,NIfCondArg,Op,NOp,FileInfo,Sha
// ------------------------------
// --- Check input arguments. ---
// ------------------------------
+<<<<<<< HEAD
SCI2CNInArgCheck(argn(2),6,6);
+=======
+SCI2CNInArgCheck(argn(2),2,2);
+>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0
// -----------------------
// --- Initialization. ---
@@ -63,7 +71,11 @@ for cntstr = 1:NumCStrings
// Epilogue
if (length(C_Strings(cntstr)) == 0)
C_Strings(cntstr) = ' '; // RNU for Bruno: If I don't do that I get a PrintStringInfo error related to mputstr.
+<<<<<<< HEAD
// Function not defined for given argument type(s),
+=======
+ // Function not defined for given argument type(s),
+>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0
// check arguments or define function %0_mputstr for overloading.
end
PrintStringInfo(C_Strings(cntstr),CPass1WhileEpilFileName ,'file','y','n');
@@ -76,6 +88,7 @@ PrintStringInfo('}',CPass1WhileEpilFileName ,'file','y');
// ------------------------------
// --- Insert for expression. ---
// ------------------------------
+<<<<<<< HEAD
//CCall = 'while('+SharedInfo.WhileExpr.CondVar+')';
//PrintStringInfo(C_IndentBlanks(SharedInfo.NIndent)+CCall,CPass1FileName,'file','y');
@@ -97,6 +110,9 @@ CCall = CCall+'while';
CCall = CCall+')';
PrintStringInfo(' '+CCall,ReportFileName,'file','y');
+=======
+CCall = 'while('+SharedInfo.WhileExpr.CondVar+')';
+>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0
PrintStringInfo(C_IndentBlanks(SharedInfo.NIndent)+CCall,CPass1FileName,'file','y');
// -------------------
diff --git a/macros/CCodeGeneration/GetClsFileName.sci b/macros/CCodeGeneration/GetClsFileName.sci
index d92a431c..4d899717 100644
--- a/macros/CCodeGeneration/GetClsFileName.sci
+++ b/macros/CCodeGeneration/GetClsFileName.sci
@@ -45,7 +45,10 @@ if SCI2Cfileexist(FileInfo.USER2CLibCAnnFun,tmpannfilename)
// #RNU_RES_B
// It is a C function of the USER2C library.
// #RNU_RES_E
+<<<<<<< HEAD
PrintStringInfo('cUser2c',ReportFileName,'file','y');
+=======
+>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0
FlagFoundAnnFile = 1;
AnnFileName = fullfile(FileInfo.USER2CLibCAnnFun,tmpannfilename);
SCI2CClassName = FL_GetFunctionClass(AnnFileName,SCI2CClassSpecifier,ReportFileName);
@@ -54,7 +57,10 @@ elseif SCI2Cfileexist(FileInfo.USER2CLibSCIAnnFun,tmpannfilename)
// #RNU_RES_B
// It is a scilab function of the USER2C library.
// #RNU_RES_E
+<<<<<<< HEAD
PrintStringInfo('fUser2c',ReportFileName,'file','y');
+=======
+>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0
FlagFoundAnnFile = 1;
AnnFileName = fullfile(FileInfo.USER2CLibSCIAnnFun,tmpannfilename);
SCI2CClassName = FL_GetFunctionClass(AnnFileName,SCI2CClassSpecifier,ReportFileName);
@@ -63,7 +69,10 @@ elseif (SCI2Cfileexist(FileInfo.SCI2CLibCAnnFun,tmpannfilename))
// #RNU_RES_B
// It is a C function of the SCI2C library.
// #RNU_RES_E
+<<<<<<< HEAD
PrintStringInfo('csci2c',ReportFileName,'file','y');
+=======
+>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0
FlagFoundAnnFile = 1;
AnnFileName = fullfile(FileInfo.SCI2CLibCAnnFun,tmpannfilename);
SCI2CClassName = FL_GetFunctionClass(AnnFileName,SCI2CClassSpecifier,ReportFileName);
@@ -72,7 +81,10 @@ elseif (SCI2Cfileexist(FileInfo.SCI2CLibSCIAnnFun,tmpannfilename))
// #RNU_RES_B
// It is a scilab function of the SCI2C library.
// #RNU_RES_E
+<<<<<<< HEAD
PrintStringInfo('fsci2c',ReportFileName,'file','y');
+=======
+>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0
FlagFoundAnnFile = 1;
AnnFileName = fullfile(FileInfo.SCI2CLibSCIAnnFun,tmpannfilename);
SCI2CClassName = FL_GetFunctionClass(AnnFileName,SCI2CClassSpecifier,ReportFileName);
diff --git a/macros/CCodeGeneration/JoinDeclarAndCcode.sci b/macros/CCodeGeneration/JoinDeclarAndCcode.sci
index 35607f6d..4a2906c0 100644
--- a/macros/CCodeGeneration/JoinDeclarAndCcode.sci
+++ b/macros/CCodeGeneration/JoinDeclarAndCcode.sci
@@ -146,10 +146,17 @@ PrintStringInfo('** --- C code. ---',CPass2FileName,'file','y');
PrintStringInfo('** ---------------',CPass2FileName,'file','y');
PrintStringInfo('*/',CPass2FileName,'file','y');
+<<<<<<< HEAD
//if((SharedInfo.Target == "RPi") & (nxtscifunname == SharedInfo.SCIMainFunName))
//Add wiringPiSetup() function as it is required
// PrintStringInfo('wiringPiSetup();',CPass2FileName,'file','y');
//end
+=======
+if((SharedInfo.Target == "RPi") & (nxtscifunname == SharedInfo.SCIMainFunName))
+ //Add wiringPiSetup() function as it is required
+ PrintStringInfo('wiringPiSetup();',CPass2FileName,'file','y');
+end
+>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0
// --- Copy the remaining part of V1 in V2. ---
while (~meof(CPass1V1FileFid))
// #RNU_RES_B
diff --git a/macros/CCodeGeneration/names b/macros/CCodeGeneration/names
index 56caa81d..96b24bdd 100644
--- a/macros/CCodeGeneration/names
+++ b/macros/CCodeGeneration/names
@@ -2,7 +2,10 @@ C_FinalizeCode
C_ForExpression
C_Funcall
C_GenDeclarations
+<<<<<<< HEAD
C_GenDeclarations_Dup
+=======
+>>>>>>> 9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0
C_GenerateFunName
C_GenerateLaunchScript
C_GenerateMakefile