diff options
51 files changed, 1343 insertions, 28 deletions
diff --git a/includes/sci2clib.h b/includes/sci2clib.h index 6485c01..c52f0d6 100644 --- a/includes/sci2clib.h +++ b/includes/sci2clib.h @@ -187,6 +187,30 @@ #include "int16.h" #include "int_int16.h" +/*interfacing bitand */ +#include "bitand.h" +#include "int_bitand.h" + +/*interfacing bitor */ +#include "bitor.h" +#include "int_bitor.h" + +/*interfacing bitxor */ +#include "bitxor.h" +#include "int_bitxor.h" + +/*interfacing bitcmp */ +#include "bitcmp.h" +#include "int_bitcmp.h" + +/*interfacing bitset */ +#include "bitset.h" +#include "int_bitset.h" + +/*interfacing bitget */ +#include "bitget.h" +#include "int_bitget.h" + /* IMPLICIT LISTS */ /* interfacing implicitList/OpColon */ @@ -329,6 +353,12 @@ #include "types.h" +/* STRING*? +/* interface for String */ +#include "int_string.h" +/*include for string */ +#include "str.h" + /*Scilab-arduino toolbox*/ #ifdef Arduino1 #include "int_cmd_digital_out.h" @@ -344,6 +374,10 @@ #include "cmd_dcmotor_setup.h" #include "int_sleep.h" #include "sleep.h" +#include "cmd_servo_attach.h" +#include "cmd_servo_detach.h" +#include "cmd_servo_move.h" +#include "int_cmd_servo.h" #endif /*AVR*/ diff --git a/macros/CCodeGeneration/C_GenerateMakefile.sci b/macros/CCodeGeneration/C_GenerateMakefile.sci index 424c821..1ef5a41 100644 --- a/macros/CCodeGeneration/C_GenerateMakefile.sci +++ b/macros/CCodeGeneration/C_GenerateMakefile.sci @@ -1,3 +1,5 @@ +//Removed 4 lines code from end that causes ot generate the Makefile.mak file that is not needed with cygwin +//Changed at line 52 function C_GenerateMakefile(FileInfo,SharedInfo) // function C_GenerateMakefile(FileInfo,SharedInfo) // ----------------------------------------------------------------- @@ -53,7 +55,9 @@ PrintStringInfo('ISRCDIR = '+makeisrcdir,FileInfo.MakefileFilename,'file','y PrintStringInfo('LIBDIR = '+makelibdir,FileInfo.MakefileFilename,'file','y','y'); PrintStringInfo('SCI2CDIR = .',FileInfo.MakefileFilename,'file','y','y'); -// Compiler definition +if getos() == 'Windows' then + + // Compiler definition if (target == 'RPi') PrintStringInfo('CC = arm-linux-gnueabihf-gcc ',FileInfo.MakefileFilename,'file','y','y'); else @@ -65,6 +69,12 @@ if (target == 'RPi') else PrintStringInfo('LDFLAGS = -lblas -llapack -lm ',FileInfo.MakefileFilename,'file','y','y'); end +else + // Compiler definition + PrintStringInfo('CC = gcc',FileInfo.MakefileFilename,'file','y','y'); + PrintStringInfo('CFLAGS = -Wall -pedantic -g -I $(HSRCDIR) -I $(ISRCDIR)',FileInfo.MakefileFilename,'file','y','y'); + PrintStringInfo('LDFLAGS = -lblas -llapack -lm',FileInfo.MakefileFilename,'file','y','y'); +end // Binary definition PrintStringInfo('EXEFILENAME = mytest.exe',FileInfo.MakefileFilename,'file','y','y'); PrintStringInfo('EXEFILE = $(SCI2CDIR)/$(EXEFILENAME)', FileInfo.MakefileFilename,'file','y','y'); @@ -118,8 +128,6 @@ PrintStringInfo('\t@echo ""==========================""',FileInfo.MakefileFilena PrintStringInfo('\trm -rf $(EXEFILE)',FileInfo.MakefileFilename,'file','y','y'); PrintStringInfo('\t@echo "" ""',FileInfo.MakefileFilename,'file','y','y'); -if getos() == 'Windows' then - C_GenerateMakefile_msvc(FileInfo,SharedInfo); -end + endfunction diff --git a/macros/Scilab-Arduino/GenerateSetupFunction.sci b/macros/Scilab-Arduino/GenerateSetupFunction.sci index 7322cea..33a515d 100644 --- a/macros/Scilab-Arduino/GenerateSetupFunction.sci +++ b/macros/Scilab-Arduino/GenerateSetupFunction.sci @@ -1,9 +1,10 @@ +//Scilab2C IITB FOSSEE function GenerateSetupFunction(FileInfo) SetupListFile = FileInfo.SetupListFile; - load(SetupListFile,'SetupList'); +SetupArduinoFile = fullfile(FileInfo.CStyleOutCCCodeDir,'setup_arduino.c'); SetupArduinoFile = fullfile(FileInfo.CStyleOutCCCodeDir,'setup_arduino.cpp'); C_SCI2CHeader(SetupArduinoFile); @@ -13,7 +14,6 @@ PrintStringInfo('int setup_arduino()',SetupArduinoFile,'file','y'); PrintStringInfo('{',SetupArduinoFile,'file','y'); nelements=size(SetupList); - for i=1:nelements funcall = ' '; funcall = funcall + SetupList(i)(1); diff --git a/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci b/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci index f449010..f95f39c 100644 --- a/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci +++ b/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci @@ -557,6 +557,157 @@ PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file', INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+
+
+
+// -------------------
+// --- Class bitand. ---
+// -------------------
+ClassName = 'bitand';
+
+// --- Class Annotation. ---
+PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+PrintStringInfo('NIN= 1',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).TP= 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');
+
+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');
+
+// --- Function List Class. ---
+ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
+
+
+PrintStringInfo('u80u80'+ArgSeparator+'u80',ClassFileName,'file','y');
+PrintStringInfo('u82u82'+ArgSeparator+'u82',ClassFileName,'file','y');
+PrintStringInfo('u160u160'+ArgSeparator+'u160',ClassFileName,'file','y');
+PrintStringInfo('u162u162'+ArgSeparator+'u162',ClassFileName,'file','y');
+
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'bitand';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'bitor';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'bitxor';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+
+
+
+// -------------------
+// --- Class bitcmp. ---
+// -------------------
+ClassName = 'bitcmp';
+
+// --- Class Annotation. ---
+PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+PrintStringInfo('NIN= 1',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).TP= 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');
+
+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');
+
+// --- Function List Class. ---
+ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
+
+
+PrintStringInfo('u80d0'+ArgSeparator+'u80',ClassFileName,'file','y');
+PrintStringInfo('u82d0'+ArgSeparator+'u82',ClassFileName,'file','y');
+PrintStringInfo('u160d0'+ArgSeparator+'u160',ClassFileName,'file','y');
+PrintStringInfo('u162d0'+ArgSeparator+'u162',ClassFileName,'file','y');
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'bitcmp';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+// -------------------
+// --- Class bitset. ---
+// -------------------
+ClassName = 'bitset';
+
+// --- 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= 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');
+
+// --- Function List Class. ---
+ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
+
+
+PrintStringInfo('u80d0d0'+ArgSeparator+'u80',ClassFileName,'file','y');
+PrintStringInfo('u160d0d0'+ArgSeparator+'u160',ClassFileName,'file','y');
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'bitset';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+
+
+// -------------------
+// --- Class bitget. ---
+// -------------------
+ClassName = 'bitget';
+
+// --- 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= 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');
+
+// --- Function List Class. ---
+ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
+
+
+PrintStringInfo('u80d0'+ArgSeparator+'u80',ClassFileName,'file','y');
+PrintStringInfo('u160d0'+ArgSeparator+'u160',ClassFileName,'file','y');
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'bitget';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+
+
+
// ------------------
// --- Class Sign ---
// ------------------
@@ -805,6 +956,7 @@ PrintStringInfo('i80'+ArgSeparator+'i80',ClassFileName,'file','y'); PrintStringInfo('u160'+ArgSeparator+'u160',ClassFileName,'file','y');
PrintStringInfo('i160'+ArgSeparator+'i160',ClassFileName,'file','y');
+
PrintStringInfo('s2'+ArgSeparator+'s2',ClassFileName,'file','y');
PrintStringInfo('d2'+ArgSeparator+'d2',ClassFileName,'file','y');
PrintStringInfo('c2'+ArgSeparator+'c2',ClassFileName,'file','y');
@@ -815,6 +967,7 @@ PrintStringInfo('u162'+ArgSeparator+'u162',ClassFileName,'file','y'); PrintStringInfo('i162'+ArgSeparator+'i162',ClassFileName,'file','y');
+
//NUT: no mixed input types are allowed.
PrintStringInfo('s0s0'+ArgSeparator+'s0',ClassFileName,'file','y');
PrintStringInfo('s0s0'+ArgSeparator+'d0',ClassFileName,'file','y');
@@ -835,6 +988,9 @@ PrintStringInfo('i160i160'+ArgSeparator+'i162',ClassFileName,'file','y'); PrintStringInfo('d0d0d0'+ArgSeparator+'d3',ClassFileName,'file','y');
+
+
+
// --- Annotation Function And Function List Function. ---
FunctionName = 'zeros'; // BJ : Done AS : Float_Done
PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
@@ -851,6 +1007,75 @@ PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file', INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+
+//---------------------
+//-----Class Rand.------
+//---------------------
+ ClassName = 'rand'
+
+// --- Class Annotation. ---
+PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+PrintStringInfo('NIN= 0',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1',ClassFileName,'file','y');
+//Was FA_TP_USER
+//Cause some trouble if user specify some precision and if input(and also output) is complex.
+PrintStringInfo('OUT(1).TP= ''d''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y');
+
+PrintStringInfo('NIN= 1',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1',ClassFileName,'file','y');
+//Was FA_TP_USER
+//Cause some trouble if user specify some precision and if input(and also output) is complex.
+PrintStringInfo('OUT(1).TP= ''d''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= FA_SZ_1(IN(1).SZ)',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= FA_SZ_2(IN(1).SZ)',ClassFileName,'file','y');
+
+PrintStringInfo('NIN= 2',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1',ClassFileName,'file','y');
+//Was FA_TP_USER
+//Cause some trouble if user specify some precision and if input(and also output) is complex.
+PrintStringInfo('OUT(1).TP= ''d''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= FA_SZ_FROM_VAL(IN(1).VAL,IN(1).TP)',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= FA_SZ_FROM_VAL(IN(2).VAL,IN(2).TP)',ClassFileName,'file','y');
+
+PrintStringInfo('NIN= 3',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1',ClassFileName,'file','y');
+//Was FA_TP_USER
+//Cause some trouble if user specify some precision and if input(and also output) is complex.
+PrintStringInfo('OUT(1).TP= ''d''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= FA_SZ_FROM_VAL(IN(1).VAL,IN(1).TP)',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= FA_SZ_FROM_VAL(IN(2).VAL,IN(2).TP)',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(3)= FA_SZ_FROM_VAL(IN(3).VAL,IN(3).TP)',ClassFileName,'file','y');
+
+// --- Function List Class. ---
+ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
+
+
+//For rand operator
+PrintStringInfo('d0'+ArgSeparator+'d0',ClassFileName,'file','y');
+PrintStringInfo('d0d0'+ArgSeparator+'d0',ClassFileName,'file','y');
+PrintStringInfo('d0d0'+ArgSeparator+'d2',ClassFileName,'file','y');
+PrintStringInfo('d2'+ArgSeparator+'d2',ClassFileName,'file','y');
+PrintStringInfo('u80'+ArgSeparator+'d0',ClassFileName,'file','y');
+PrintStringInfo('i80'+ArgSeparator+'d0',ClassFileName,'file','y');
+PrintStringInfo('u160'+ArgSeparator+'d0',ClassFileName,'file','y');
+PrintStringInfo('i160'+ArgSeparator+'d0',ClassFileName,'file','y');
+PrintStringInfo('u82'+ArgSeparator+'d2',ClassFileName,'file','y');
+PrintStringInfo('i82'+ArgSeparator+'d2',ClassFileName,'file','y');
+PrintStringInfo('u162'+ArgSeparator+'d2',ClassFileName,'file','y');
+PrintStringInfo('i162'+ArgSeparator+'d2',ClassFileName,'file','y');
+PrintStringInfo('u80u80'+ArgSeparator+'d0',ClassFileName,'file','y');
+PrintStringInfo('u80u80'+ArgSeparator+'d2',ClassFileName,'file','y');
+PrintStringInfo('i80i80'+ArgSeparator+'d0',ClassFileName,'file','y');
+PrintStringInfo('i80i80'+ArgSeparator+'d2',ClassFileName,'file','y');
+PrintStringInfo('u160u160'+ArgSeparator+'d0',ClassFileName,'file','y');
+PrintStringInfo('u160u160'+ArgSeparator+'d2',ClassFileName,'file','y');
+PrintStringInfo('i160i160'+ArgSeparator+'d0',ClassFileName,'file','y');
+PrintStringInfo('i160i160'+ArgSeparator+'d2',ClassFileName,'file','y');
+
//NUT rand function doesn't behave like zeros and ones functions.
FunctionName = 'rand'; // BJ : Done => rien pour f loat
PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
@@ -902,6 +1127,7 @@ PrintStringInfo('d0d0'+ArgSeparator+'d0',ClassFileName,'file','y'); PrintStringInfo('c0c0'+ArgSeparator+'c0',ClassFileName,'file','y');
PrintStringInfo('c0s0'+ArgSeparator+'c0',ClassFileName,'file','y');
PrintStringInfo('z0d0'+ArgSeparator+'z0',ClassFileName,'file','y');
+
PrintStringInfo('s2s0'+ArgSeparator+'s0',ClassFileName,'file','y'); //* possible ? */
PrintStringInfo('d2d0'+ArgSeparator+'d0',ClassFileName,'file','y'); //* possible ? */
PrintStringInfo('c2s0'+ArgSeparator+'c0',ClassFileName,'file','y'); //* possible ? */
@@ -1127,6 +1353,7 @@ PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file', INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
FunctionName = 'imag'; // BJ : Done AS : Float_Done
PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
@@ -1986,6 +2213,7 @@ PrintStringInfo('i162i162'+ArgSeparator+'i162',ClassFileName,'file','y'); // --- Annotation Function And Function List Function. ---
+
FunctionName = 'OpMinus'; // AS : Done AS : Float_Done
PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
@@ -2449,6 +2677,7 @@ PrintStringInfo('NIN= 2',ClassFileName,'file','y'); PrintStringInfo('NOUT= 1',ClassFileName,'file','y');
PrintStringInfo('OUT(1).TP= FA_TP_MIN_REAL(IN(1).TP,IN(2).TP)',ClassFileName,'file','y');
PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y');
+
PrintStringInfo('OUT(1).SZ(2)= FA_SZ_FROM_VAL(FA_ADD(FA_SUB(FA_REAL(IN(2).VAL,IN(2).TP),FA_REAL(IN(1).VAL,IN(1).TP)),''1''),FA_TP_REAL(IN(2).TP))',ClassFileName,'file','y');
PrintStringInfo('NIN= 3',ClassFileName,'file','y');
PrintStringInfo('NOUT= 1',ClassFileName,'file','y');
@@ -2842,29 +3071,32 @@ ClassName = 'String'; PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
PrintStringInfo('NIN= 1',ClassFileName,'file','y');
-PrintStringInfo('NOUT= 0',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).TP= ''g''',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= FA_SZ_1(IN.SZ)',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= FA_SZ_2(IN.SZ)',ClassFileName,'file','y');
// --- Function List Class. ---
ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
-PrintStringInfo('s0'+ArgSeparator,ClassFileName,'file','y');
-PrintStringInfo('d0'+ArgSeparator,ClassFileName,'file','y');
-PrintStringInfo('c0'+ArgSeparator,ClassFileName,'file','y');
-PrintStringInfo('z0'+ArgSeparator,ClassFileName,'file','y');
-PrintStringInfo('g0'+ArgSeparator,ClassFileName,'file','y');
-PrintStringInfo('u80'+ArgSeparator,ClassFileName,'file','y');
-PrintStringInfo('i80'+ArgSeparator,ClassFileName,'file','y');
-PrintStringInfo('u160'+ArgSeparator,ClassFileName,'file','y');
-PrintStringInfo('i160'+ArgSeparator,ClassFileName,'file','y');
-
-PrintStringInfo('s2'+ArgSeparator,ClassFileName,'file','y');
-PrintStringInfo('d2'+ArgSeparator,ClassFileName,'file','y');
-PrintStringInfo('c2'+ArgSeparator,ClassFileName,'file','y');
-PrintStringInfo('z2'+ArgSeparator,ClassFileName,'file','y');
-PrintStringInfo('g2'+ArgSeparator,ClassFileName,'file','y');
-PrintStringInfo('u82'+ArgSeparator,ClassFileName,'file','y');
-PrintStringInfo('i82'+ArgSeparator,ClassFileName,'file','y');
-PrintStringInfo('u162'+ArgSeparator,ClassFileName,'file','y');
-PrintStringInfo('i162'+ArgSeparator,ClassFileName,'file','y');
+PrintStringInfo('s0'+ArgSeparator+'g0',ClassFileName,'file','y');
+PrintStringInfo('d0'+ArgSeparator+'g0',ClassFileName,'file','y');
+PrintStringInfo('c0'+ArgSeparator+'g0',ClassFileName,'file','y');
+PrintStringInfo('z0'+ArgSeparator+'g0',ClassFileName,'file','y');
+PrintStringInfo('g0'+ArgSeparator+'g0',ClassFileName,'file','y');
+PrintStringInfo('u80'+ArgSeparator+'g0',ClassFileName,'file','y');
+PrintStringInfo('i80'+ArgSeparator+'g0',ClassFileName,'file','y');
+PrintStringInfo('u160'+ArgSeparator+'g0',ClassFileName,'file','y');
+PrintStringInfo('i160'+ArgSeparator+'g0',ClassFileName,'file','y');
+
+PrintStringInfo('s2'+ArgSeparator+'g2',ClassFileName,'file','y');
+PrintStringInfo('d2'+ArgSeparator+'g2',ClassFileName,'file','y');
+PrintStringInfo('c2'+ArgSeparator+'g2',ClassFileName,'file','y');
+PrintStringInfo('z2'+ArgSeparator+'g2',ClassFileName,'file','y');
+PrintStringInfo('g2'+ArgSeparator+'g2',ClassFileName,'file','y');
+PrintStringInfo('u82'+ArgSeparator+'g2',ClassFileName,'file','y');
+PrintStringInfo('i82'+ArgSeparator+'g2',ClassFileName,'file','y');
+PrintStringInfo('u162'+ArgSeparator+'g2',ClassFileName,'file','y');
+PrintStringInfo('i162'+ArgSeparator+'g2',ClassFileName,'file','y');
// --- Annotation Function And Function List Function. ---
@@ -3100,6 +3332,8 @@ PrintStringInfo('s0f0g2'+ArgSeparator,ClassFileName,'file','y'); //NUT da chiari PrintStringInfo('d0'+ArgSeparator,ClassFileName,'file','y'); //NUT da chiarire
PrintStringInfo('d0f0'+ArgSeparator,ClassFileName,'file','y'); //NUT da chiarire
+
+
PrintStringInfo('d0f0g2'+ArgSeparator,ClassFileName,'file','y'); //NUT da chiarire
// --- Annotation Function And Function List Function. ---
@@ -3680,6 +3914,7 @@ PrintStringInfo('d2d0'+ArgSeparator+'d2',ClassFileName,'file','y'); PrintStringInfo('d2d2'+ArgSeparator+'d2',ClassFileName,'file','y');
PrintStringInfo('u80u80'+ArgSeparator+'u80',ClassFileName,'file','y');
+
PrintStringInfo('u80u82'+ArgSeparator+'u82',ClassFileName,'file','y');
PrintStringInfo('u82u80'+ArgSeparator+'u82',ClassFileName,'file','y');
PrintStringInfo('u82u82'+ArgSeparator+'u82',ClassFileName,'file','y');
@@ -3912,6 +4147,7 @@ INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,Ex +
// ------------------
// --- Class Expm. ---
// ------------------
@@ -4011,6 +4247,7 @@ 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('d0d0u80'+ArgSeparator+'u80',ClassFileName,'file','y');
// --- Annotation Function And Function List Function. ---
FunctionName = 'cmd_analog_out';
@@ -4092,6 +4329,74 @@ PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file', INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+//---Class cmd_servo_attach.---
+ClassName = 'cmd_servo_attach';
+
+//----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 = 'cmd_servo_attach';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+
+//---Class cmd_servo_detach.---
+ClassName = 'cmd_servo_detach';
+
+//----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 = 'cmd_servo_detach';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+
+//---Class cmd_servo_move.---
+ClassName = 'cmd_servo_move';
+
+//----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');
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'cmd_servo_move';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
//------------------------------------
//---- Class Sleep -------------------
diff --git a/macros/findDeps/getAllHeaders.sci b/macros/findDeps/getAllHeaders.sci index 0f325bd..4061c04 100644 --- a/macros/findDeps/getAllHeaders.sci +++ b/macros/findDeps/getAllHeaders.sci @@ -87,6 +87,12 @@ function allHeaders = getAllHeaders(Target) "src/c/elementaryFunctions/includes/lnp1m1.h" "src/c/elementaryFunctions/includes/tanh.h" "src/c/elementaryFunctions/includes/sqrt.h" + "src/c/elementaryFunctions/includes/bitand.h" + "src/c/elementaryFunctions/includes/bitor.h" + "src/c/elementaryFunctions/includes/bitxor.h" + "src/c/elementaryFunctions/includes/bitcmp.h" + "src/c/elementaryFunctions/includes/bitset.h" + "src/c/elementaryFunctions/includes/bitget.h" "src/c/elementaryFunctions/includes/asinh.h" "src/c/elementaryFunctions/includes/atan2.h" "src/c/elementaryFunctions/includes/atanh.h" @@ -134,8 +140,11 @@ function allHeaders = getAllHeaders(Target) "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/cmd_dcmotor_setup.h" + "src/c/scilab-arduino/includes/cmd_dcmotor_run.h" + "src/c/scilab-arduino/includes/cmd_servo_attach.h" + "src/c/scilab-arduino/includes/cmd_servo_detach.h" + "src/c/scilab-arduino/includes/cmd_servo_move.h" "src/c/scilab-arduino/includes/sleep.h"]; AVR_headers = [ diff --git a/macros/findDeps/getAllInterfaces.sci b/macros/findDeps/getAllInterfaces.sci index e233353..d31376a 100644 --- a/macros/findDeps/getAllInterfaces.sci +++ b/macros/findDeps/getAllInterfaces.sci @@ -77,6 +77,12 @@ function allInterfaces = getAllInterfaces(Target) "src/c/elementaryFunctions/interfaces/int_asin.h" "src/c/elementaryFunctions/interfaces/int_atan.h" "src/c/elementaryFunctions/interfaces/int_ceil.h" + "src/c/elementaryFunctions/interfaces/int_bitand.h" + "src/c/elementaryFunctions/interfaces/int_bitor.h" + "src/c/elementaryFunctions/interfaces/int_bitxor.h" + "src/c/elementaryFunctions/interfaces/int_bitcmp.h" + "src/c/elementaryFunctions/interfaces/int_bitset.h" + "src/c/elementaryFunctions/interfaces/int_bitget.h" "src/c/elementaryFunctions/interfaces/int_cosh.h" "src/c/elementaryFunctions/interfaces/int_uint8.h" "src/c/elementaryFunctions/interfaces/int_int8.h" @@ -129,6 +135,7 @@ function allInterfaces = getAllInterfaces(Target) "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_cmd_servo.h" "src/c/scilab-arduino/interfaces/int_sleep.h"]; //Interface files required for "AVR" output diff --git a/macros/findDeps/getAllSources.sci b/macros/findDeps/getAllSources.sci index ca9ac8b..2fda753 100644 --- a/macros/findDeps/getAllSources.sci +++ b/macros/findDeps/getAllSources.sci @@ -44,6 +44,14 @@ function allSources = getAllSources(Target) "src/c/auxiliaryFunctions/rand/zrands.c" "src/c/auxiliaryFunctions/rand/cranda.c" "src/c/auxiliaryFunctions/rand/crands.c" + "src/c/auxiliaryFunctions/rand/u8randa.c" + "src/c/auxiliaryFunctions/rand/u8rands.c" + "src/c/auxiliaryFunctions/rand/u16randa.c" + "src/c/auxiliaryFunctions/rand/u16rands.c" + "src/c/auxiliaryFunctions/rand/i8randa.c" + "src/c/auxiliaryFunctions/rand/i8rands.c" + "src/c/auxiliaryFunctions/rand/i16randa.c" + "src/c/auxiliaryFunctions/rand/i16rands.c" "src/c/auxiliaryFunctions/sign/csigna.c" "src/c/auxiliaryFunctions/sign/csigns.c" "src/c/auxiliaryFunctions/sign/dsigna.c" @@ -562,6 +570,26 @@ function allSources = getAllSources(Target) "src/c/elementaryFunctions/int16/i8int16a.c" "src/c/elementaryFunctions/int16/u16int16s.c" "src/c/elementaryFunctions/int16/u16int16a.c" + "src/c/elementaryFunctions/bitand/u8bitands.c" + "src/c/elementaryFunctions/bitand/u8bitanda.c" + "src/c/elementaryFunctions/bitand/u16bitands.c" + "src/c/elementaryFunctions/bitand/u16bitanda.c" + "src/c/elementaryFunctions/bitor/u8bitors.c" + "src/c/elementaryFunctions/bitor/u8bitora.c" + "src/c/elementaryFunctions/bitor/u16bitors.c" + "src/c/elementaryFunctions/bitor/u16bitora.c" + "src/c/elementaryFunctions/bitxor/u8bitxors.c" + "src/c/elementaryFunctions/bitxor/u8bitxora.c" + "src/c/elementaryFunctions/bitxor/u16bitxors.c" + "src/c/elementaryFunctions/bitxor/u16bitxora.c" + "src/c/elementaryFunctions/bitcmp/u8bitcmps.c" + "src/c/elementaryFunctions/bitcmp/u8bitcmpa.c" + "src/c/elementaryFunctions/bitcmp/u16bitcmps.c" + "src/c/elementaryFunctions/bitcmp/u16bitcmpa.c" + "src/c/elementaryFunctions/bitset/u8bitsets.c" + "src/c/elementaryFunctions/bitset/u16bitsets.c" + "src/c/elementaryFunctions/bitget/u8bitgets.c" + "src/c/elementaryFunctions/bitget/u16bitgets.c" "src/c/statisticsFunctions/max/dmaxa.c" "src/c/statisticsFunctions/max/smaxa.c" "src/c/statisticsFunctions/max/srowmaxa.c" @@ -844,6 +872,9 @@ function allSources = getAllSources(Target) "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/cmd_servo_attach/u8cmd_servo_attach.cpp" + "src/c/scilab-arduino/cmd_servo_detach/u8cmd_servo_detach.cpp" + "src/c/scilab-arduino/cmd_servo_move/u8cmd_servo_move.cpp" "src/c/scilab-arduino/sleep/u16sleeps.c"]; //Files to be inserted only if output format selected is 'AVR'. diff --git a/macros/runsci2c.sci b/macros/runsci2c.sci index b55a7a1..41495cb 100644 --- a/macros/runsci2c.sci +++ b/macros/runsci2c.sci @@ -160,6 +160,7 @@ else if BuildTool == "make"
C_GenerateMakefile(FileInfo,SharedInfo);
+ copyBlasLapackLibs(FileInfo,SharedInfo); //Previously .dll files and blas,lapack library not creating for cygwin by additing this works fine
end
if BuildTool == "nmake"
copyBlasLapackLibs(FileInfo,SharedInfo);
diff --git a/src/c/auxiliaryFunctions/includes/rand.h b/src/c/auxiliaryFunctions/includes/rand.h index 4716cbb..d032a12 100644 --- a/src/c/auxiliaryFunctions/includes/rand.h +++ b/src/c/auxiliaryFunctions/includes/rand.h @@ -17,6 +17,7 @@ #include "dynlib_auxiliaryfunctions.h" #include "floatComplex.h" #include "doubleComplex.h" +#include "types.h" #ifdef __cplusplus extern "C" { @@ -46,6 +47,35 @@ EXTERN_AUXFUNCT floatComplex crands(void); **/ EXTERN_AUXFUNCT doubleComplex zrands(void); + +/** + ** \brief uint8 Rand function + ** \return A random double. + **/ +EXTERN_AUXFUNCT double u8rands(void); + + +/** + ** \brief uint16 Rand function + ** \return A random double. + **/ +EXTERN_AUXFUNCT double u16rands(void); + + +/** + ** \brief int8 Rand function + ** \return A random double. + **/ +EXTERN_AUXFUNCT double i8rands(void); + + +/** + ** \brief int16 Rand function + ** \return A random double. + **/ +EXTERN_AUXFUNCT double i16rands(void); + + /** ** \brief Float Array Rand function ** \return A random float array. @@ -70,6 +100,32 @@ EXTERN_AUXFUNCT void cranda(floatComplex *out, int size); **/ EXTERN_AUXFUNCT void zranda(doubleComplex *out, int size); +/** + ** \brief uint8 Array Rand function + ** \return A random double array. + **/ +EXTERN_AUXFUNCT void u8randa(double *out, int size); + +/** + ** \brief uint16 Array Rand function + ** \return A random double array. + **/ +EXTERN_AUXFUNCT void u16randa(double *out, int size); + + +/** + ** \brief int8 Array Rand function + ** \return A random double array. + **/ +EXTERN_AUXFUNCT void i8randa(double *out, int size); + +/** + ** \brief int16 Array Rand function + ** \return A random double array. + **/ +EXTERN_AUXFUNCT void i16randa(double *out, int size); + + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/c/auxiliaryFunctions/interfaces/int_rand.h b/src/c/auxiliaryFunctions/interfaces/int_rand.h index 597309a..85d08ea 100644 --- a/src/c/auxiliaryFunctions/interfaces/int_rand.h +++ b/src/c/auxiliaryFunctions/interfaces/int_rand.h @@ -20,6 +20,14 @@ #define randd0() drands() +#define randu80() u8rands() + +#define randu160() u16rands() + +#define randi80() i8rands() + +#define randi160() i16rands() + #define s0rands0(in) srands() @@ -30,16 +38,39 @@ #define z0randz0(in) zrands() +#define u80randd0(in) u8rands() + +#define u160randd0(in) u16rands() + +#define i80randd0(in) i8rands() + +#define i160randd0(in) i16rands() + #define s0s0rands0(in1,in2) srands() #define d0d0randd0(in,in2) drands() +#define u80u80randd0(in1,in2) u8rands() + +#define u160u160randd0(in1,in2) u16rands() + +#define i80i80randd0(in1,in2) i8rands() + +#define i160i160randd0(in1,in2) i16rands() + #define s0s0rands2(in1,in2,out) sranda(out,(int)in1*(int)in2) #define d0d0randd2(in1,in2,out) dranda(out,(int)in1*(int)in2) +#define u80u80randd2(in1,in2,out) u8randa(out,(int)in1*(int)in2) + +#define u160u160randd2(in1,in2,out) u16randa(out,(int)in1*(int)in2) + +#define i80i80randd2(in1,in2,out) i8randa(out,(int)in1*(int)in2) + +#define i160i160randd2(in1,in2,out) i16randa(out,(int)in1*(int)in2) #define s2rands2(in,size,out) sranda(out, size[0]*size[1]) @@ -49,5 +80,15 @@ #define z2randz2(in,size,out) zranda(out, size[0]*size[1]) +#define u82randd2(in,size,out) u8randa(out, size[0]*size[1]) + +#define u162randd2(in,size,out) u16randa(out, size[0]*size[1]) + +#define i82randd2(in,size,out) i8randa(out, size[0]*size[1]) + +#define i62randd2(in,size,out) i16randa(out, size[0]*size[1]) + + + #endif /* !__INT_RAND_H__ */ diff --git a/src/c/auxiliaryFunctions/rand/i16randa.c b/src/c/auxiliaryFunctions/rand/i16randa.c new file mode 100644 index 0000000..f3d8dd3 --- /dev/null +++ b/src/c/auxiliaryFunctions/rand/i16randa.c @@ -0,0 +1,12 @@ +/* Scilab2C FOSSEE IIT BOMBAY */ +#include "rand.h" + +void i16randa(double *out,int size) +{ + int i = 0; + for(i = 0 ; i < size ; ++i) + { + out[i] = i16rands(); + } + +} diff --git a/src/c/auxiliaryFunctions/rand/i16rands.c b/src/c/auxiliaryFunctions/rand/i16rands.c new file mode 100644 index 0000000..ca2ed9c --- /dev/null +++ b/src/c/auxiliaryFunctions/rand/i16rands.c @@ -0,0 +1,46 @@ +/* Scilab2C FOSSEE IIT Bombay */ +#include "rand.h" +#include <stdio.h> + +double i16rands(void) +{ + +int m=1; +const int itwo=2; +static int m2=0,halfm=0,ia=0,ic=0,mic=0,iy=0; +static double s=0.0; +if(m2==0) +{ + /*if first entry,compute machine integer word length*/ + while(m>m2) + { + m2=m; + m=itwo*m2; + } + halfm = m2; + /* compute multiplier and increment for linear congruential methos */ + ia = 8*(int)(halfm*atan(1.0)/8.0) + 5; + ic = 2*(int)(halfm*(0.5-sqrt(3.0)/6.0)) +1; + mic = (m2 - ic) + m2; + /* s is the scale factor for converting to floating point*/ + s = 0.5/halfm; + +} + +/* compute next random number */ + iy = iy*ia; +/* the following statement is for computers which do not allow interger overflow on addition*/ +if(iy > mic) iy = (iy - m2) - m2; + iy = iy + ic; + + /* the following statement is for computers where the word length for addition is greater than for multiplication */ + if(iy/2 > m2) iy = (iy - m2) - m2; + /* the following statement is for computers where integer overflow affects the sign bit */ + if(iy < 0) iy = (iy + m2) + m2; + return (double)iy*s; + + + + + +} diff --git a/src/c/auxiliaryFunctions/rand/i8randa.c b/src/c/auxiliaryFunctions/rand/i8randa.c new file mode 100644 index 0000000..d679c65 --- /dev/null +++ b/src/c/auxiliaryFunctions/rand/i8randa.c @@ -0,0 +1,12 @@ +/* Scilab2C FOSSEE IIT BOMBAY */ +#include "rand.h" + +void i8randa(double *out,int size) +{ + int i = 0; + for(i = 0 ; i < size ; ++i) + { + out[i] = i8rands(); + } + +} diff --git a/src/c/auxiliaryFunctions/rand/i8rands.c b/src/c/auxiliaryFunctions/rand/i8rands.c new file mode 100644 index 0000000..55df909 --- /dev/null +++ b/src/c/auxiliaryFunctions/rand/i8rands.c @@ -0,0 +1,42 @@ +/* Scilab2C FOSSEE IIT Bombay */ +#include "rand.h" +#include <stdio.h> + +double i8rands(void) +{ + +int m=1; +const int itwo=2; +static int m2=0,halfm=0,ia=0,ic=0,mic=0,iy=0; +static double s=0.0; +if(m2==0) +{ + /*if first entry,compute machine integer word length*/ + while(m>m2) + { + m2=m; + m=itwo*m2; + } + halfm = m2; + /* compute multiplier and increment for linear congruential methos */ + ia = 8*(int)(halfm*atan(1.0)/8.0) + 5; + ic = 2*(int)(halfm*(0.5-sqrt(3.0)/6.0)) +1; + mic = (m2 - ic) + m2; + /* s is the scale factor for converting to floating point*/ + s = 0.5/halfm; + +} + +/* compute next random number */ + iy = iy*ia; +/* the following statement is for computers which do not allow interger overflow on addition*/ +if(iy > mic) iy = (iy - m2) - m2; + iy = iy + ic; + + /* the following statement is for computers where the word length for addition is greater than for multiplication */ + if(iy/2 > m2) iy = (iy - m2) - m2; + /* the following statement is for computers where integer overflow affects the sign bit */ + if(iy < 0) iy = (iy + m2) + m2; + return (double)iy*s; + +} diff --git a/src/c/auxiliaryFunctions/rand/u16randa.c b/src/c/auxiliaryFunctions/rand/u16randa.c new file mode 100644 index 0000000..f539336 --- /dev/null +++ b/src/c/auxiliaryFunctions/rand/u16randa.c @@ -0,0 +1,12 @@ +/* Scilab2C FOSSEE IIT BOMBAY */ +#include "rand.h" + +void u16randa(double *out,int size) +{ + int i = 0; + for(i = 0 ; i < size ; ++i) + { + out[i] = u16rands(); + } + +} diff --git a/src/c/auxiliaryFunctions/rand/u16rands.c b/src/c/auxiliaryFunctions/rand/u16rands.c new file mode 100644 index 0000000..a08d6a8 --- /dev/null +++ b/src/c/auxiliaryFunctions/rand/u16rands.c @@ -0,0 +1,46 @@ +/* Scilab2C FOSSEE IIT Bombay */ +#include "rand.h" +#include <stdio.h> + +double u16rands(void) +{ + +int m=1; +const int itwo=2; +static int m2=0,halfm=0,ia=0,ic=0,mic=0,iy=0; +static double s=0; +if(m2==0) +{ + /*if first entry,compute machine integer word length*/ + while(m>m2) + { + m2=m; + m=itwo*m2; + } + halfm = m2; + /* compute multiplier and increment for linear congruential methos */ + ia = 8*(int)(halfm*atan(1.0)/8.0) + 5; + ic = 2*(int)(halfm*(0.5-sqrt(3.0)/6.0)) +1; + mic = (m2 - ic) + m2; + /* s is the scale factor for converting to floating point*/ + s = 0.5/halfm; + +} + +/* compute next random number */ + iy = iy*ia; +/* the following statement is for computers which do not allow interger overflow on addition*/ +if(iy > mic) iy = (iy - m2) - m2; + iy = iy + ic; + + /* the following statement is for computers where the word length for addition is greater than for multiplication */ + if(iy/2 > m2) iy = (iy - m2) - m2; + /* the following statement is for computers where integer overflow affects the sign bit */ + if(iy < 0) iy = (iy + m2) + m2; + return (double)iy*s; + + + +} + + diff --git a/src/c/auxiliaryFunctions/rand/u8randa.c b/src/c/auxiliaryFunctions/rand/u8randa.c new file mode 100644 index 0000000..4d7d3f8 --- /dev/null +++ b/src/c/auxiliaryFunctions/rand/u8randa.c @@ -0,0 +1,15 @@ +/* Scilab2C FOSSEE IIT BOMBAY */ +#include "rand.h" +#include<stdio.h> +void u8randa(double *out,int size) +{ + + int i = 0; + + for(i = 0 ; i < size ; ++i) + { + out[i] = u8rands(); + + } + +} diff --git a/src/c/auxiliaryFunctions/rand/u8rands.c b/src/c/auxiliaryFunctions/rand/u8rands.c new file mode 100644 index 0000000..bdf7f9a --- /dev/null +++ b/src/c/auxiliaryFunctions/rand/u8rands.c @@ -0,0 +1,68 @@ +/* Scilab2C FOSSEE IIT Bombay */ +#include "rand.h" +#include <stdio.h> + +double u8rands(void) +{ + +int m=1; +const int itwo=2; +static int m2=0,halfm=0,ia=0,ic=0,mic=0,iy=0; +static double s=0.0; +if(m2==0) +{ + /*if first entry,compute machine integer word length*/ + + while(m>m2) + { + + m2=m; + + m=itwo*m2; + + } + + halfm = m2; + /* compute multiplier and increment for linear congruential methos */ + ia = 8*(int)(halfm*atan(1.0)/8.0) + 5; + ic = 2*(int)(halfm*(0.5-sqrt(3.0)/6.0)) +1; + + mic = (m2 - ic) + m2; + + /* s is the scale factor for converting to floating point*/ + s = 0.5/halfm; + + +} + +/* compute next random number */ + iy = iy*ia; + +/* the following statement is for computers which do not allow interger overflow on addition*/ +if(iy > mic) +{ + iy = (iy - m2) - m2; + +} + iy = iy + ic; + + /* the following statement is for computers where the word length for addition is greater than for multiplication */ + if(iy/2 > m2) +{ + iy = (iy - m2) - m2; + +} + /* the following statement is for computers where integer overflow affects the sign bit */ + if(iy < 0) + { + iy = (iy + m2) + m2; + + } + + return (double)iy*s; + + + + + +} diff --git a/src/c/elementaryFunctions/bitand/u16bitanda.c b/src/c/elementaryFunctions/bitand/u16bitanda.c new file mode 100644 index 0000000..743161e --- /dev/null +++ b/src/c/elementaryFunctions/bitand/u16bitanda.c @@ -0,0 +1,14 @@ +/* Scilab2C FOSSEE IITB */ +#include "bitand.h" + +void u16bitanda(uint16* x,uint16* y,int size,uint16* out) +{ + int i = 0; + for(i=0;i<size;i++) + { + out[i] = u16bitands(x[i],y[i]); + } + + +} + diff --git a/src/c/elementaryFunctions/bitand/u16bitands.c b/src/c/elementaryFunctions/bitand/u16bitands.c new file mode 100644 index 0000000..7ba73c1 --- /dev/null +++ b/src/c/elementaryFunctions/bitand/u16bitands.c @@ -0,0 +1,9 @@ +/* Scilab2C FOSSEE IITB */ + +#include "bitand.h" + +uint16 u16bitands(uint16 x,uint16 y) +{ + return (x & y); + +} diff --git a/src/c/elementaryFunctions/bitand/u8bitanda.c b/src/c/elementaryFunctions/bitand/u8bitanda.c new file mode 100644 index 0000000..e1260a7 --- /dev/null +++ b/src/c/elementaryFunctions/bitand/u8bitanda.c @@ -0,0 +1,14 @@ +/* Scilab2C FOSSEE IITB */ +#include "bitand.h" + +void u8bitanda(uint8* x,uint8* y,int size,uint8* out) +{ + int i = 0; + for(i=0;i<size;i++) + { + out[i] = u8bitands(x[i],y[i]); + } + + +} + diff --git a/src/c/elementaryFunctions/bitand/u8bitands.c b/src/c/elementaryFunctions/bitand/u8bitands.c new file mode 100644 index 0000000..eda3ccc --- /dev/null +++ b/src/c/elementaryFunctions/bitand/u8bitands.c @@ -0,0 +1,9 @@ +/* Scilab2C FOSSEE IITB */ + +#include "bitand.h" + +uint8 u8bitands(uint8 x,uint8 y) +{ + return (x & y); + +} diff --git a/src/c/elementaryFunctions/bitcmp/u16bitcmpa.c b/src/c/elementaryFunctions/bitcmp/u16bitcmpa.c new file mode 100644 index 0000000..5581371 --- /dev/null +++ b/src/c/elementaryFunctions/bitcmp/u16bitcmpa.c @@ -0,0 +1,16 @@ +/* Scilab2C FOSSEE IITB */ + +#include "bitcmp.h" +void u16bitcmpa(uint16 *x,uint16 y,int size,uint16* out) +{ + int i=0; + for(i=0;i<size;i++) + { + out[i] = u16bitcmps(x[i],y); + + } + + +} + + diff --git a/src/c/elementaryFunctions/bitcmp/u16bitcmps.c b/src/c/elementaryFunctions/bitcmp/u16bitcmps.c new file mode 100644 index 0000000..fc43b37 --- /dev/null +++ b/src/c/elementaryFunctions/bitcmp/u16bitcmps.c @@ -0,0 +1,11 @@ +/* Scilab2C FOSSEE IITB */ + +#include "bitcmp.h" +uint16 u16bitcmps(uint16 x,uint16 y) +{ + + return (~x); + +} + + diff --git a/src/c/elementaryFunctions/bitcmp/u8bitcmpa.c b/src/c/elementaryFunctions/bitcmp/u8bitcmpa.c new file mode 100644 index 0000000..67bde28 --- /dev/null +++ b/src/c/elementaryFunctions/bitcmp/u8bitcmpa.c @@ -0,0 +1,16 @@ +/* Scilab2C FOSSEE IITB */ + +#include "bitcmp.h" +void u8bitcmpa(uint8 *x,uint8 y,int size,uint8* out) +{ + int i=0; + for(i=0;i<size;i++) + { + out[i] = u8bitcmps(x[i],y); + + } + + +} + + diff --git a/src/c/elementaryFunctions/bitcmp/u8bitcmps.c b/src/c/elementaryFunctions/bitcmp/u8bitcmps.c new file mode 100644 index 0000000..c3f18b1 --- /dev/null +++ b/src/c/elementaryFunctions/bitcmp/u8bitcmps.c @@ -0,0 +1,10 @@ +/* Scilab2C FOSSEE IITB */ + +#include "bitcmp.h" +uint8 u8bitcmps(uint8 x,uint8 y) +{ + return (~x); + +} + + diff --git a/src/c/elementaryFunctions/bitget/u16bitgets.c b/src/c/elementaryFunctions/bitget/u16bitgets.c new file mode 100644 index 0000000..20593bf --- /dev/null +++ b/src/c/elementaryFunctions/bitget/u16bitgets.c @@ -0,0 +1,24 @@ +/* Scilab2C FOSSEE IITB */ + +#include "bitget.h" +#include<stdio.h> + +uint16 u16bitgets(uint16 value,int position) +{ + + value = value >> (position -1); + value = value & 1; + return value; + + /*unsigned char mask = 1<<(position-1); + uint16 bit = value&mask; + if(bit > 0) + { + return 1; + } + else + { + return 0; + }*/ + +} diff --git a/src/c/elementaryFunctions/bitget/u8bitgets.c b/src/c/elementaryFunctions/bitget/u8bitgets.c new file mode 100644 index 0000000..130bff8 --- /dev/null +++ b/src/c/elementaryFunctions/bitget/u8bitgets.c @@ -0,0 +1,24 @@ +/* Scilab2C FOSSEE IITB */ + +#include "bitget.h" +#include<stdio.h> + +uint8 u8bitgets(uint8 value,int position) +{ + + value = value >> (position -1); + value = value & 1; + return value; + + /*unsigned char mask = 1<<(position-1); + uint8 bit = value&mask; + if(bit > 0) + { + return 1; + } + else + { + return 0; + }*/ + +} diff --git a/src/c/elementaryFunctions/bitor/u16bitora.c b/src/c/elementaryFunctions/bitor/u16bitora.c new file mode 100644 index 0000000..84722e1 --- /dev/null +++ b/src/c/elementaryFunctions/bitor/u16bitora.c @@ -0,0 +1,14 @@ +/* Scilab2C FOSSEE IITB */ +#include "bitor.h" + +void u16bitora(uint16* x,uint16* y,int size,uint16* out) +{ + int i = 0; + for(i=0;i<size;i++) + { + out[i] = u16bitors(x[i],y[i]); + } + + +} + diff --git a/src/c/elementaryFunctions/bitor/u16bitors.c b/src/c/elementaryFunctions/bitor/u16bitors.c new file mode 100644 index 0000000..e48e300 --- /dev/null +++ b/src/c/elementaryFunctions/bitor/u16bitors.c @@ -0,0 +1,9 @@ +/* Scilab2C FOSSEE IITB */ + +#include "bitor.h" + +uint16 u16bitors(uint16 x,uint16 y) +{ + return (x | y); + +} diff --git a/src/c/elementaryFunctions/bitor/u8bitora.c b/src/c/elementaryFunctions/bitor/u8bitora.c new file mode 100644 index 0000000..edda9bb --- /dev/null +++ b/src/c/elementaryFunctions/bitor/u8bitora.c @@ -0,0 +1,14 @@ +/* Scilab2C FOSSEE IITB */ +#include "bitor.h" + +void u8bitora(uint8* x,uint8* y,int size,uint8* out) +{ + int i = 0; + for(i=0;i<size;i++) + { + out[i] = u8bitors(x[i],y[i]); + } + + +} + diff --git a/src/c/elementaryFunctions/bitor/u8bitors.c b/src/c/elementaryFunctions/bitor/u8bitors.c new file mode 100644 index 0000000..56d3540 --- /dev/null +++ b/src/c/elementaryFunctions/bitor/u8bitors.c @@ -0,0 +1,9 @@ +/* Scilab2C FOSSEE IITB */ + +#include "bitor.h" + +uint8 u8bitors(uint8 x,uint8 y) +{ + return (x | y); + +} diff --git a/src/c/elementaryFunctions/bitset/u16bitsets.c b/src/c/elementaryFunctions/bitset/u16bitsets.c new file mode 100644 index 0000000..953e46c --- /dev/null +++ b/src/c/elementaryFunctions/bitset/u16bitsets.c @@ -0,0 +1,20 @@ +/* Scilab2C FOSSEE IITB */ + +#include "bitset.h" +#include<stdio.h> + +uint16 u16bitsets(uint16 value,int position,int bit_value) +{ + if(bit_value==1) + { + unsigned char mask1 = 1 << (position-1) ; // we could cast to unsigned char, just to be safe + return (mask1 | value); + } + else + { + unsigned char mask2 = ~(1 << (position-1)); // we could cast to unsigned char, just to be safe + return (mask2 & value); + + } + +} diff --git a/src/c/elementaryFunctions/bitset/u8bitsets.c b/src/c/elementaryFunctions/bitset/u8bitsets.c new file mode 100644 index 0000000..5f44dcd --- /dev/null +++ b/src/c/elementaryFunctions/bitset/u8bitsets.c @@ -0,0 +1,20 @@ +/* Scilab2C FOSSEE IITB */ + +#include "bitset.h" +#include<stdio.h> + +uint8 u8bitsets(uint8 value,int position,int bit_value) +{ + if(bit_value==1) + { + unsigned char mask1 = 1 << (position-1) ; // we could cast to unsigned char, just to be safe + return (mask1 | value); + } + else + { + unsigned char mask2 = ~(1 << (position-1)); // we could cast to unsigned char, just to be safe + return (mask2 & value); + + } + +} diff --git a/src/c/elementaryFunctions/bitxor/u16bitxora.c b/src/c/elementaryFunctions/bitxor/u16bitxora.c new file mode 100644 index 0000000..6f50f06 --- /dev/null +++ b/src/c/elementaryFunctions/bitxor/u16bitxora.c @@ -0,0 +1,14 @@ +/* Scilab2C FOSSEE IITB */ +#include "bitxor.h" + +void u16bitxora(uint16* x,uint16* y,int size,uint16* out) +{ + int i = 0; + for(i=0;i<size;i++) + { + out[i] = u16bitxors(x[i],y[i]); + } + + +} + diff --git a/src/c/elementaryFunctions/bitxor/u16bitxors.c b/src/c/elementaryFunctions/bitxor/u16bitxors.c new file mode 100644 index 0000000..03ca8f8 --- /dev/null +++ b/src/c/elementaryFunctions/bitxor/u16bitxors.c @@ -0,0 +1,9 @@ +/* Scilab2C FOSSEE IITB */ + +#include "bitxor.h" + +uint16 u16bitxors(uint16 x,uint16 y) +{ + return (x ^ y); + +} diff --git a/src/c/elementaryFunctions/bitxor/u8bitxora.c b/src/c/elementaryFunctions/bitxor/u8bitxora.c new file mode 100644 index 0000000..ad7cc24 --- /dev/null +++ b/src/c/elementaryFunctions/bitxor/u8bitxora.c @@ -0,0 +1,14 @@ +/* Scilab2C FOSSEE IITB */ +#include "bitxor.h" + +void u8bitxora(uint8* x,uint8* y,int size,uint8* out) +{ + int i = 0; + for(i=0;i<size;i++) + { + out[i] = u8bitxors(x[i],y[i]); + } + + +} + diff --git a/src/c/elementaryFunctions/bitxor/u8bitxors.c b/src/c/elementaryFunctions/bitxor/u8bitxors.c new file mode 100644 index 0000000..9a346ee --- /dev/null +++ b/src/c/elementaryFunctions/bitxor/u8bitxors.c @@ -0,0 +1,9 @@ +/* Scilab2C FOSSEE IITB */ + +#include "bitxor.h" + +uint8 u8bitxors(uint8 x,uint8 y) +{ + return (x ^ y); + +} diff --git a/src/c/elementaryFunctions/includes/bitand.h b/src/c/elementaryFunctions/includes/bitand.h new file mode 100644 index 0000000..8d98d9b --- /dev/null +++ b/src/c/elementaryFunctions/includes/bitand.h @@ -0,0 +1,39 @@ +/* Scilab2C FOSSEE IITB */ + +#ifndef __BITAND_H__ +#define __BITAND_H__ + + + +#include "dynlib_elementaryfunctions.h" +#include "types.h" + +#ifdef __cpluscplus +extern "C" { +#endif +/* bitand returns the logical AND operation + 12 = 00001100 (In Binary) + 25 = 00011001 (In Binary) + +Bit Operation of 12 and 25 + 00001100 +& 00011001 + ________ + 00001000 = 8 (In decimal) +*/ + +EXTERN_ELEMFUNCT uint8 u8bitands(uint8 in1,uint8 in2); + +EXTERN_ELEMFUNCT void u8bitanda(uint8* in1,uint8* in2,int size,uint8* out); + +EXTERN_ELEMFUNCT uint16 u16bitands(uint16 in1,uint16 in2); + +EXTERN_ELEMFUNCT void u16bitanda(uint16* in1,uint16* in2,int size,uint16* out); + + +#ifdef __cplusplus + +} /*extern "C" */ +#endif + +#endif /* !__BITAND_H__ */ diff --git a/src/c/elementaryFunctions/includes/bitcmp.h b/src/c/elementaryFunctions/includes/bitcmp.h new file mode 100644 index 0000000..8176681 --- /dev/null +++ b/src/c/elementaryFunctions/includes/bitcmp.h @@ -0,0 +1,38 @@ +/* Scilab2C FOSSEE IITB */ + +#ifndef __BITCMP_H__ +#define __BITCMP_H__ + + + +#include "dynlib_elementaryfunctions.h" +#include "types.h" + +#ifdef __cpluscplus +extern "C" { +#endif +/* bitcmp returns the complement +35=00100011 (In Binary) + +Bitwise complement Operation of 35 +~ 00100011 + ________ + 11011100 = 220 (In decimal) +*/ + +EXTERN_ELEMFUNCT uint8 u8bitcmps(uint8 in1,uint8 in2); + +EXTERN_ELEMFUNCT void u8bitcmpa(uint8* in1,uint8 in2,int size,uint8* out); + +EXTERN_ELEMFUNCT uint16 u16bitcmps(uint16 in1,uint16 in2); + +EXTERN_ELEMFUNCT void u16bitcmpa(uint16* in1,uint16 in2,int size,uint16* out); + + + +#ifdef __cplusplus + +} /*extern "C" */ +#endif + +#endif /* !__BITCMP_H__ */ diff --git a/src/c/elementaryFunctions/includes/bitget.h b/src/c/elementaryFunctions/includes/bitget.h new file mode 100644 index 0000000..0eaf57e --- /dev/null +++ b/src/c/elementaryFunctions/includes/bitget.h @@ -0,0 +1,25 @@ +/* Scilab2C FOSSEE IITB */ + +#ifndef __BITGET_H__ +#define __BITGET_H__ + + + +#include "dynlib_elementaryfunctions.h" +#include "types.h" + +#ifdef __cpluscplus +extern "C" { +#endif + + +EXTERN_ELEMFUNCT uint8 u8bitgets(uint8 value,int position); + +EXTERN_ELEMFUNCT uint16 u16bitgets(uint16 value,int position); + +#ifdef __cplusplus + +} /*extern "C" */ +#endif + +#endif /* !__BITGET_H__ */ diff --git a/src/c/elementaryFunctions/includes/bitor.h b/src/c/elementaryFunctions/includes/bitor.h new file mode 100644 index 0000000..16a6a3d --- /dev/null +++ b/src/c/elementaryFunctions/includes/bitor.h @@ -0,0 +1,38 @@ +/* Scilab2C FOSSEE IITB */ + +#ifndef __BITOR_H__ +#define __BITOR_H__ + + + +#include "dynlib_elementaryfunctions.h" +#include "types.h" + +#ifdef __cpluscplus +extern "C" { +#endif +/* bitor returns the logical OR operation + 12 = 00001100 (In Binary) +25 = 00011001 (In Binary) + +Bitwise OR Operation of 12 and 25 + 00001100 +| 00011001 + ________ + 00011101 = 29 (In decimal) */ + +EXTERN_ELEMFUNCT uint8 u8bitors(uint8 in1,uint8 in2); + +EXTERN_ELEMFUNCT void u8bitora(uint8* in1,uint8* in2,int size,uint8* out); + +EXTERN_ELEMFUNCT uint16 u16bitors(uint16 in1,uint16 in2); + +EXTERN_ELEMFUNCT void u16bitora(uint16* in1,uint16* in2,int size,uint16* out); + + +#ifdef __cplusplus + +} /*extern "C" */ +#endif + +#endif /* !__BITOR_H__ */ diff --git a/src/c/elementaryFunctions/includes/bitset.h b/src/c/elementaryFunctions/includes/bitset.h new file mode 100644 index 0000000..862a4c8 --- /dev/null +++ b/src/c/elementaryFunctions/includes/bitset.h @@ -0,0 +1,25 @@ +/* Scilab2C FOSSEE IITB */ + +#ifndef __BITSET_H__ +#define __BITSET_H__ + + + +#include "dynlib_elementaryfunctions.h" +#include "types.h" + +#ifdef __cpluscplus +extern "C" { +#endif + + +EXTERN_ELEMFUNCT uint8 u8bitsets(uint8 value,int position,int bit_value); + +EXTERN_ELEMFUNCT uint16 u16bitsets(uint16 value,int position,int bit_value); + +#ifdef __cplusplus + +} /*extern "C" */ +#endif + +#endif /* !__BITSET_H__ */ diff --git a/src/c/elementaryFunctions/includes/bitxor.h b/src/c/elementaryFunctions/includes/bitxor.h new file mode 100644 index 0000000..4e27635 --- /dev/null +++ b/src/c/elementaryFunctions/includes/bitxor.h @@ -0,0 +1,38 @@ +/* Scilab2C FOSSEE IITB */ + +#ifndef __BITXOR_H__ +#define __BITXOR_H__ + + + +#include "dynlib_elementaryfunctions.h" +#include "types.h" + +#ifdef __cpluscplus +extern "C" { +#endif +/* bitxor returns the logical OR operation + 12 = 00001100 (In Binary) +25 = 00011001 (In Binary) + +Bitwise XOR Operation of 12 and 25 + 00001100 +^ 00011001 + ________ + 00010101 = 21 (In decimal) */ + +EXTERN_ELEMFUNCT uint8 u8bitxors(uint8 in1,uint8 in2); + +EXTERN_ELEMFUNCT void u8bitxora(uint8* in1,uint8* in2,int size,uint8* out); + +EXTERN_ELEMFUNCT uint16 u16bitxors(uint16 in1,uint16 in2); + +EXTERN_ELEMFUNCT void u16bitxora(uint16* in1,uint16* in2,int size,uint16* out); + + +#ifdef __cplusplus + +} /*extern "C" */ +#endif + +#endif /* !__BITXOR_H__ */ diff --git a/src/c/elementaryFunctions/interfaces/int_bitand.h b/src/c/elementaryFunctions/interfaces/int_bitand.h new file mode 100644 index 0000000..26031ad --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_bitand.h @@ -0,0 +1,16 @@ +/* Scilab2C FOSSEE IITB */ + +#ifndef __INT_BITAND_H__ +#define __INT_BITAND_H__ + + +#define u80u80bitandu80(in1,in2) u8bitands(in1,in2) + +#define u82u82bitandu82(in1,size1,in2,size2,out) u8bitanda(in1,in2,size1[0]*size1[1],out) + +#define u160u160bitandu160(in1,in2) u16bitands(in1,in2) + +#define u162u162bitandu162(in1,size1,in2,size2,out) u16bitanda(in1,in2,size1[0]*size1[1],out) + + +#endif diff --git a/src/c/elementaryFunctions/interfaces/int_bitcmp.h b/src/c/elementaryFunctions/interfaces/int_bitcmp.h new file mode 100644 index 0000000..d72eb2e --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_bitcmp.h @@ -0,0 +1,16 @@ +/* Scilab2C FOSSEE IITB */ + +#ifndef __INT_BITCMP_H__ +#define __INT_BITCMP_H__ + + +#define u80d0bitcmpu80(in1,in2) u8bitcmps(in1,in2) + +#define u82d0bitcmpu82(in1,size1,in2,out) u8bitcmpa(in1,in2,size1[0]*size1[1],out) + +#define u160d0bitcmpu160(in1,in2) u16bitcmps(in1,in2) + +#define u162d0bitcmpu162(in1,size1,in2,out) u16bitcmpa(in1,in2,size1[0]*size1[1],out) + + +#endif diff --git a/src/c/elementaryFunctions/interfaces/int_bitget.h b/src/c/elementaryFunctions/interfaces/int_bitget.h new file mode 100644 index 0000000..7b6b8e9 --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_bitget.h @@ -0,0 +1,10 @@ +/* Scilab2C FOSSEE IITB */ + +#ifndef __INT_BITGET_H__ +#define __INT_BITGET_H__ + +#define u80d0bitgetu80(in1,in2) u8bitgets(in1,in2) + +#define u160d0bitgetu160(in1,in2) u16bitgets(in1,in2) + +#endif diff --git a/src/c/elementaryFunctions/interfaces/int_bitor.h b/src/c/elementaryFunctions/interfaces/int_bitor.h new file mode 100644 index 0000000..6a65c9f --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_bitor.h @@ -0,0 +1,16 @@ +/* Scilab2C FOSSEE IITB */ + +#ifndef __INT_BITOR_H__ +#define __INT_BITOR_H__ + + +#define u80u80bitoru80(in1,in2) u8bitors(in1,in2) + +#define u82u82bitoru82(in1,size1,in2,size2,out) u8bitora(in1,in2,size1[0]*size1[1],out) + +#define u160u160bitoru160(in1,in2) u16bitors(in1,in2) + +#define u162u162bitoru162(in1,size1,in2,size2,out) u16bitora(in1,in2,size1[0]*size1[1],out) + + +#endif diff --git a/src/c/elementaryFunctions/interfaces/int_bitset.h b/src/c/elementaryFunctions/interfaces/int_bitset.h new file mode 100644 index 0000000..e864325 --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_bitset.h @@ -0,0 +1,13 @@ +/* Scilab2C FOSSEE IITB */ + +#ifndef __INT_BITSET_H__ +#define __INT_BITSET_H__ + +#define u80d0d0bitsetu80(in1,in2,in3) u8bitsets(in1,in2,in3) + +#define u160d0d0bitsetu160(in1,in2,in3) u16bitsets(in1,in2,in3) + + + + +#endif diff --git a/src/c/elementaryFunctions/interfaces/int_bitxor.h b/src/c/elementaryFunctions/interfaces/int_bitxor.h new file mode 100644 index 0000000..30aea6c --- /dev/null +++ b/src/c/elementaryFunctions/interfaces/int_bitxor.h @@ -0,0 +1,16 @@ +/* Scilab2C FOSSEE IITB */ + +#ifndef __INT_BITXOR_H__ +#define __INT_BITXOR_H__ + + +#define u80u80bitxoru80(in1,in2) u8bitxors(in1,in2) + +#define u82u82bitxoru82(in1,size1,in2,size2,out) u8bitxora(in1,in2,size1[0]*size1[1],out) + +#define u160u160bitxoru160(in1,in2) u16bitxors(in1,in2) + +#define u162u162bitxoru162(in1,size1,in2,size2,out) u16bitxora(in1,in2,size1[0]*size1[1],out) + + +#endif diff --git a/src/c/scilab-arduino/cmd_digital_out/u8cmd_digital_outs.c b/src/c/scilab-arduino/cmd_digital_out/u8cmd_digital_outs.c index 621afc8..2e5c90d 100644 --- a/src/c/scilab-arduino/cmd_digital_out/u8cmd_digital_outs.c +++ b/src/c/scilab-arduino/cmd_digital_out/u8cmd_digital_outs.c @@ -11,6 +11,7 @@ */ #include "cmd_digital_out.h" +#include "Arduino.h" uint8 u8cmd_digital_outs(uint8 board_no, uint8 pin, uint8 value) |