summaryrefslogtreecommitdiff
path: root/src/c/string
diff options
context:
space:
mode:
Diffstat (limited to 'src/c/string')
-rw-r--r--src/c/string/ascii/dasciia.c21
-rw-r--r--src/c/string/ascii/gasciia.c26
-rw-r--r--src/c/string/convstr/gconvstrs.c34
-rw-r--r--src/c/string/disp/ddispa.c2
-rw-r--r--src/c/string/disp/i16dispa.c24
-rw-r--r--src/c/string/disp/i16disps.c19
-rw-r--r--src/c/string/disp/i8dispa.c24
-rw-r--r--src/c/string/disp/i8disps.c19
-rw-r--r--src/c/string/disp/u16dispa.c24
-rw-r--r--src/c/string/disp/u16disps.c19
-rw-r--r--src/c/string/disp/u8dispa.c24
-rw-r--r--src/c/string/disp/u8disps.c19
-rw-r--r--src/c/string/disp/zdispa.c2
-rw-r--r--src/c/string/disp/zdisps.c2
-rw-r--r--src/c/string/includes/ascii.h27
-rw-r--r--src/c/string/includes/convstr.h26
-rw-r--r--src/c/string/includes/disp.h52
-rw-r--r--src/c/string/includes/str.h58
-rw-r--r--src/c/string/includes/strchr.h25
-rw-r--r--src/c/string/includes/strcspn.h26
-rw-r--r--src/c/string/includes/strncpy.h25
-rw-r--r--src/c/string/includes/strrchr.h26
-rw-r--r--src/c/string/includes/strrev.h27
-rw-r--r--src/c/string/includes/strspn.h26
-rw-r--r--src/c/string/includes/strsubst.h27
-rw-r--r--src/c/string/interfaces/int_ascii.h26
-rw-r--r--src/c/string/interfaces/int_convstr.h27
-rw-r--r--src/c/string/interfaces/int_disp.h38
-rw-r--r--src/c/string/interfaces/int_strchr.h25
-rw-r--r--src/c/string/interfaces/int_strcspn.h25
-rw-r--r--src/c/string/interfaces/int_string.h52
-rw-r--r--src/c/string/interfaces/int_strncpy.h26
-rw-r--r--src/c/string/interfaces/int_strrchr.h25
-rw-r--r--src/c/string/interfaces/int_strrev.h25
-rw-r--r--src/c/string/interfaces/int_strspn.h25
-rw-r--r--src/c/string/interfaces/int_strsubst.h28
-rw-r--r--src/c/string/strchr/gstrchra.c33
-rw-r--r--src/c/string/strcspn/gstrcspna.c41
-rw-r--r--src/c/string/string/i16stringa.c24
-rw-r--r--src/c/string/string/i16strings.c21
-rw-r--r--src/c/string/string/i8stringa.c24
-rw-r--r--src/c/string/string/i8strings.c21
-rw-r--r--src/c/string/string/u16stringa.c24
-rw-r--r--src/c/string/string/u16strings.c21
-rw-r--r--src/c/string/string/u8stringa.c24
-rw-r--r--src/c/string/string/u8strings.c21
-rw-r--r--src/c/string/strncpy/gstrncpya.c25
-rw-r--r--src/c/string/strrchr/gstrrchra.c32
-rw-r--r--src/c/string/strrev/gstrreva.c26
-rw-r--r--src/c/string/strspn/gstrspna.c44
-rw-r--r--src/c/string/strsubst/gstrsubsta.c69
51 files changed, 1362 insertions, 14 deletions
diff --git a/src/c/string/ascii/dasciia.c b/src/c/string/ascii/dasciia.c
new file mode 100644
index 00000000..d2452880
--- /dev/null
+++ b/src/c/string/ascii/dasciia.c
@@ -0,0 +1,21 @@
+/* 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: Ankit Raj
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+#include<stdio.h>
+#include "ascii.h"
+void dasciia(double* inp,int size,char* oup)
+{
+ int i;
+ for(i=0;i<size;i++)
+ {
+ oup[i]=(char)inp[i];
+ }
+}
diff --git a/src/c/string/ascii/gasciia.c b/src/c/string/ascii/gasciia.c
new file mode 100644
index 00000000..5fe95e07
--- /dev/null
+++ b/src/c/string/ascii/gasciia.c
@@ -0,0 +1,26 @@
+/* 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: Ankit Raj
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+#include<stdio.h>
+/* This is the "asciiconv" function which converts the given string
+ into its ascii equivalent.
+*/
+#include "ascii.h"
+void gasciia(char *str,int size,uint8* oup)
+{
+ int i;
+ for(i=0;i<size;i++)
+ {
+ *(oup+i)=str[i];
+ }
+
+}
+
diff --git a/src/c/string/convstr/gconvstrs.c b/src/c/string/convstr/gconvstrs.c
new file mode 100644
index 00000000..7c6e7f14
--- /dev/null
+++ b/src/c/string/convstr/gconvstrs.c
@@ -0,0 +1,34 @@
+/* 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
+ Organization: FOSSEE, IIT Bombay
+ Author: Shamik Guha
+ Email: toolbox@scilab.in
+*/
+
+#include <string.h>
+#include <ctype.h>
+#include "convstr.h"
+
+
+void gconvstrs(char* in, int size,char* flag,int size2,char* out)
+{
+ int i=0;//temp=0;
+ for(i=0;i<size;i++)
+ {
+ //temp= in[i];
+ if(flag[0]=='l' || flag[0]=='L')
+ { //temp=temp + 32;
+ out[i]=tolower(in[i]);
+ }
+ else if(flag[0]=='u' || flag[0]=='U')
+ {
+ //temp=temp - 32;
+ out[i]=toupper(in[i]);
+ }
+ }
+}
diff --git a/src/c/string/disp/ddispa.c b/src/c/string/disp/ddispa.c
index 5e6bb84e..29aaceeb 100644
--- a/src/c/string/disp/ddispa.c
+++ b/src/c/string/disp/ddispa.c
@@ -16,7 +16,7 @@ double ddispa (double* in, int rows, int columns){
int i = 0,j = 0;
for (i = 0; i < rows; ++i) {
- for (j=0;j<columns;j++) printf (" %1.20f ", in[i+j*rows]);
+ for (j=0;j<columns;j++) printf (" %e ", in[i+j*rows]);
printf("\n");
}
return 0;
diff --git a/src/c/string/disp/i16dispa.c b/src/c/string/disp/i16dispa.c
new file mode 100644
index 00000000..424d066d
--- /dev/null
+++ b/src/c/string/disp/i16dispa.c
@@ -0,0 +1,24 @@
+/* Copyright (C) 2016 - 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: Siddhesh Wani
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+
+#include "disp.h"
+
+double i16dispa (int16* in, int rows, int columns){
+ int i = 0,j = 0;
+
+ for (i = 0; i < rows; ++i) {
+ for (j=0;j<columns;j++) printf (" %d ", in[i+j*rows]);
+ printf("\n");
+ }
+ return 0;
+}
diff --git a/src/c/string/disp/i16disps.c b/src/c/string/disp/i16disps.c
new file mode 100644
index 00000000..70edda77
--- /dev/null
+++ b/src/c/string/disp/i16disps.c
@@ -0,0 +1,19 @@
+/* Copyright (C) 2016 - 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: Siddhesh Wani
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+
+#include "disp.h"
+
+double i16disps (int16 in) {
+ printf(" %d \n",in);
+ return 0;
+}
diff --git a/src/c/string/disp/i8dispa.c b/src/c/string/disp/i8dispa.c
new file mode 100644
index 00000000..9acd9674
--- /dev/null
+++ b/src/c/string/disp/i8dispa.c
@@ -0,0 +1,24 @@
+/* Copyright (C) 2016 - 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: Siddhesh Wani
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+
+#include "disp.h"
+
+double i8dispa (int8* in, int rows, int columns){
+ int i = 0,j = 0;
+
+ for (i = 0; i < rows; ++i) {
+ for (j=0;j<columns;j++) printf (" %d ", in[i+j*rows]);
+ printf("\n");
+ }
+ return 0;
+}
diff --git a/src/c/string/disp/i8disps.c b/src/c/string/disp/i8disps.c
new file mode 100644
index 00000000..07cc6c4f
--- /dev/null
+++ b/src/c/string/disp/i8disps.c
@@ -0,0 +1,19 @@
+/* Copyright (C) 2016 - 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: Siddhesh Wani
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+
+#include "disp.h"
+
+double i8disps (int8 in) {
+ printf(" %d \n",in);
+ return 0;
+}
diff --git a/src/c/string/disp/u16dispa.c b/src/c/string/disp/u16dispa.c
new file mode 100644
index 00000000..ad3685e2
--- /dev/null
+++ b/src/c/string/disp/u16dispa.c
@@ -0,0 +1,24 @@
+/* Copyright (C) 2016 - 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: Siddhesh Wani
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+
+#include "disp.h"
+
+double u16dispa (uint16* in, int rows, int columns){
+ int i = 0,j = 0;
+
+ for (i = 0; i < rows; ++i) {
+ for (j=0;j<columns;j++) printf (" %u ", in[i+j*rows]);
+ printf("\n");
+ }
+ return 0;
+}
diff --git a/src/c/string/disp/u16disps.c b/src/c/string/disp/u16disps.c
new file mode 100644
index 00000000..383dcfc0
--- /dev/null
+++ b/src/c/string/disp/u16disps.c
@@ -0,0 +1,19 @@
+/* Copyright (C) 2016 - 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: Siddhesh Wani
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+
+#include "disp.h"
+
+double u16disps (uint16 in) {
+ printf(" %u \n",in);
+ return 0;
+}
diff --git a/src/c/string/disp/u8dispa.c b/src/c/string/disp/u8dispa.c
new file mode 100644
index 00000000..f242b5c5
--- /dev/null
+++ b/src/c/string/disp/u8dispa.c
@@ -0,0 +1,24 @@
+/* Copyright (C) 2016 - 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: Siddhesh Wani
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+
+#include "disp.h"
+
+double u8dispa (uint8* in, int rows, int columns){
+ int i = 0,j = 0;
+
+ for (i = 0; i < rows; ++i) {
+ for (j=0;j<columns;j++) printf (" %d ", in[i+j*rows]);
+ printf("\n");
+ }
+ return 0;
+}
diff --git a/src/c/string/disp/u8disps.c b/src/c/string/disp/u8disps.c
new file mode 100644
index 00000000..2d3e78fa
--- /dev/null
+++ b/src/c/string/disp/u8disps.c
@@ -0,0 +1,19 @@
+/* Copyright (C) 2016 - 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: Siddhesh Wani
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+
+#include "disp.h"
+
+double u8disps (uint8 in) {
+ printf(" %d \n",in);
+ return 0;
+}
diff --git a/src/c/string/disp/zdispa.c b/src/c/string/disp/zdispa.c
index 5d085d32..94b24e98 100644
--- a/src/c/string/disp/zdispa.c
+++ b/src/c/string/disp/zdispa.c
@@ -16,7 +16,7 @@ double zdispa (doubleComplex* in, int rows, int columns){
int i = 0,j = 0;
for (i = 0; i < rows; ++i) {
- for (j=0;j<columns;j++) printf(" %1.20f + %1.20fi " ,zreals(in[i+j*rows]) ,zimags(in[i+j*rows]));
+ for (j=0;j<columns;j++) printf(" %e + %ei " ,zreals(in[i+j*rows]) ,zimags(in[i+j*rows]));
printf("\n");
}
return 0;
diff --git a/src/c/string/disp/zdisps.c b/src/c/string/disp/zdisps.c
index c4ec137f..4a040cd7 100644
--- a/src/c/string/disp/zdisps.c
+++ b/src/c/string/disp/zdisps.c
@@ -14,6 +14,6 @@
double zdisps (doubleComplex in) {
- printf(" %1.20f + %1.20fi \n" ,zreals(in) ,zimags(in));
+ printf(" %e + %ei \n" ,zreals(in) ,zimags(in));
return 0;
}
diff --git a/src/c/string/includes/ascii.h b/src/c/string/includes/ascii.h
new file mode 100644
index 00000000..39aeb835
--- /dev/null
+++ b/src/c/string/includes/ascii.h
@@ -0,0 +1,27 @@
+/* Copyright (C) 2016 - 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: Ankit Raj
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+#ifndef __ASCII_H__
+#define __ASCII_H__
+#include "types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void gasciia(char* str,int size,uint8* oup);
+void dasciia(double* inp,int size,char* oup);
+
+#ifdef __cplusplus
+}/* extern "C" */
+#endif
+
+#endif /*___ASCII_H__*/
diff --git a/src/c/string/includes/convstr.h b/src/c/string/includes/convstr.h
new file mode 100644
index 00000000..0737c546
--- /dev/null
+++ b/src/c/string/includes/convstr.h
@@ -0,0 +1,26 @@
+ /* Copyright (C) 2016 - 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: Shamik Guha
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+#ifndef __CONVSTR_H__
+#define __CONVSTR_H__
+
+
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
+
+void gconvstrs(char* in, int size,char* flag,int size2,char* out);
+
+ #ifdef __cplusplus
+ } /* extern "C" */
+ #endif
+
+#endif /*__CONVSTR_H__*/
diff --git a/src/c/string/includes/disp.h b/src/c/string/includes/disp.h
index 96ccb248..7b463906 100644
--- a/src/c/string/includes/disp.h
+++ b/src/c/string/includes/disp.h
@@ -19,6 +19,7 @@
#include "dynlib_string.h"
#include "floatComplex.h"
#include "doubleComplex.h"
+#include "types.h"
#ifdef __cplusplus
extern "C" {
@@ -44,6 +45,27 @@ EXTERN_STRING double cdisps (floatComplex in);
EXTERN_STRING double zdisps (doubleComplex in);
/*
+** \brief display of a uint8 scalar
+*/
+EXTERN_STRING double u8disps (uint8 in);
+
+/*
+** \brief display of a int8 scalar
+*/
+EXTERN_STRING double i8disps (int8 in);
+
+/*
+** \brief display of a uint16 scalar
+*/
+EXTERN_STRING double u16disps (uint16 in);
+
+/*
+** \brief display of a int16 scalar
+*/
+EXTERN_STRING double i16disps (int16 in);
+
+
+/*
** \brief display of a float scalar array
** \param in the float scalar array to display
** \param size the size of the array
@@ -71,11 +93,39 @@ EXTERN_STRING double cdispa (floatComplex* in, int rows, int columns);
*/
EXTERN_STRING double zdispa (doubleComplex* in, int rows, int columns);
-
+/*
+** \brief display of a uint8 scalar array
+** \param in the uint8 scalar array to display
+** \param size the size of the array
+*/
+EXTERN_STRING double u8dispa (uint8* in, int rows, int columns);
+
+/*
+** \brief display of a int8 scalar array
+** \param in the int8 scalar array to display
+** \param size the size of the array
+*/
+EXTERN_STRING double i8dispa (int8* in, int rows, int columns);
+
+/*
+** \brief display of a uint16 scalar array
+** \param in the uint16 scalar array to display
+** \param size the size of the array
+*/
+EXTERN_STRING double u16dispa (uint16* in, int rows, int columns);
+
+/*
+** \brief display of a int16 scalar array
+** \param in the int16 scalar array to display
+** \param size the size of the array
+*/
+EXTERN_STRING double i16dispa (int16* in, int rows, int columns);
+
EXTERN_STRING double ddisph (double *in, int rows, int cols, int levels);
EXTERN_STRING double g2dispd0(char *array,int* tmparraysize);
+
#ifdef __cplusplus
} /* extern "C" */
#endif
diff --git a/src/c/string/includes/str.h b/src/c/string/includes/str.h
index 434c68e0..79307b5f 100644
--- a/src/c/string/includes/str.h
+++ b/src/c/string/includes/str.h
@@ -19,6 +19,7 @@
#include "dynlib_string.h"
#include "floatComplex.h"
#include "doubleComplex.h"
+#include "types.h"
#ifdef __cplusplus
extern "C" {
@@ -54,6 +55,35 @@ EXTERN_STRING void zstrings (doubleComplex in, char* out);
/*
+** \brief convert of a uint8 scalar into a char array
+** \param in the uint8 scalar to convert
+** \param out the output char array
+*/
+EXTERN_STRING void u8strings (uint8 in, char* out);
+
+/*
+** \brief convert of a int8 scalar into a char array
+** \param in the int8 scalar to convert
+** \param out the output char array
+*/
+EXTERN_STRING void i8strings (int8 in, char* out);
+
+/*
+** \brief convert of a uint16 scalar into a char array
+** \param in the uint16 scalar to convert
+** \param out the output char array
+*/
+EXTERN_STRING void u16strings (uint16 in, char* out);
+
+/*
+** \brief convert of a int16 scalar into a char array
+** \param in the int16 scalar to convert
+** \param out the output char array
+*/
+EXTERN_STRING void i16strings (int16 in, char* out);
+
+
+/*
** \brief convert of a float scalar array into an array of char arrays
** \param in the float scalar array to convert
** \param out the output array of char arrays
@@ -81,6 +111,34 @@ EXTERN_STRING void cstringa (floatComplex* in, int size, char** out );
*/
EXTERN_STRING void zstringa (doubleComplex* in, int size, char** out);
+/*
+** \brief convert of a uint8 scalar array into an array of char arrays
+** \param in the uint8 scalar array to convert
+** \param out the output array of char arrays
+*/
+EXTERN_STRING void u8stringa (uint8* in, int size, char** out);
+
+/*
+** \brief convert of a int8 scalar array into an array of char arrays
+** \param in the int8 scalar array to convert
+** \param out the output array of char arrays
+*/
+EXTERN_STRING void i8stringa (int8* in, int size, char** out);
+
+/*
+** \brief convert of a uint16 scalar array into an array of char arrays
+** \param in the uint16 scalar array to convert
+** \param out the output array of char arrays
+*/
+EXTERN_STRING void u16stringa (uint16* in, int size, char** out);
+
+/*
+** \brief convert of a int16 scalar array into an array of char arrays
+** \param in the int16 scalar array to convert
+** \param out the output array of char arrays
+*/
+EXTERN_STRING void i16stringa (int16* in, int size, char** out);
+
#ifdef __cplusplus
} /* extern "C" */
#endif
diff --git a/src/c/string/includes/strchr.h b/src/c/string/includes/strchr.h
new file mode 100644
index 00000000..7e306413
--- /dev/null
+++ b/src/c/string/includes/strchr.h
@@ -0,0 +1,25 @@
+/* Copyright (C) 2016 - 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: Ankit Raj
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+#ifndef __STRCHR_H__
+#define __STRCHR_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void gstrchra(char* str,int size, char* key,int size2, char* out);
+
+#ifdef __cplusplus
+}/* extern "C" */
+#endif
+
+#endif /*__STRCHR_H__*/
diff --git a/src/c/string/includes/strcspn.h b/src/c/string/includes/strcspn.h
new file mode 100644
index 00000000..aa91fb47
--- /dev/null
+++ b/src/c/string/includes/strcspn.h
@@ -0,0 +1,26 @@
+/* Copyright (C) 2016 - 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: Ankit Raj
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+#ifndef __STRCSPN_H__
+#define __STRCSPN_H__
+#include "types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+uint8 gstrcspna(char* str1,int size1,char* str2,int size2);
+
+#ifdef __cplusplus
+}/* extern "C" */
+#endif
+
+#endif /* __STRCSPN_H */
diff --git a/src/c/string/includes/strncpy.h b/src/c/string/includes/strncpy.h
new file mode 100644
index 00000000..f2aa705b
--- /dev/null
+++ b/src/c/string/includes/strncpy.h
@@ -0,0 +1,25 @@
+/* Copyright (C) 2016 - 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: Ankit Raj
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+#ifndef __STRNCPY_H__
+#define __STRNCPY_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void gstrncpya(char* str,int size,double key,char* oup);
+
+#ifdef __cplusplus
+}/* extern "C" */
+#endif
+
+#endif /*__STRNCPY_H__*/
diff --git a/src/c/string/includes/strrchr.h b/src/c/string/includes/strrchr.h
new file mode 100644
index 00000000..d06460be
--- /dev/null
+++ b/src/c/string/includes/strrchr.h
@@ -0,0 +1,26 @@
+ /* Copyright (C) 2016 - 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: Shamik Guha
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+#ifndef __STRRCHR_H__
+#define __STRRCHR_H__
+
+
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
+
+void gstrrchr(char* str,int size,char* key,int size2,char* out);
+
+ #ifdef __cplusplus
+ } /* extern "C" */
+ #endif
+
+#endif /*__STRRCHR_H__*/
diff --git a/src/c/string/includes/strrev.h b/src/c/string/includes/strrev.h
new file mode 100644
index 00000000..c7e79570
--- /dev/null
+++ b/src/c/string/includes/strrev.h
@@ -0,0 +1,27 @@
+ /* Copyright (C) 2016 - 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: Shamik Guha
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+#ifndef __STRREV_H__
+#define __STRREV_H__
+
+
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
+
+void gstrreva(char* str,int size,char* out);
+//void gstrrevs(char* in, int size,char* search, int size2, char* rep, int size3, ,char* out);
+
+ #ifdef __cplusplus
+ } /* extern "C" */
+ #endif
+
+#endif /*__STRREV_H__*/
diff --git a/src/c/string/includes/strspn.h b/src/c/string/includes/strspn.h
new file mode 100644
index 00000000..427caa4c
--- /dev/null
+++ b/src/c/string/includes/strspn.h
@@ -0,0 +1,26 @@
+/* Copyright (C) 2016 - 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: Ankit Raj
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+#ifndef __STRSPN_H__
+#define __STRSPN_H__
+#include "types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+uint8 gstrspna(char* str1,int size1,char* str2,int size2);
+
+#ifdef __cplusplus
+}/* extern "C" */
+#endif
+
+#endif /* __STRSPN_H */
diff --git a/src/c/string/includes/strsubst.h b/src/c/string/includes/strsubst.h
new file mode 100644
index 00000000..e9eba429
--- /dev/null
+++ b/src/c/string/includes/strsubst.h
@@ -0,0 +1,27 @@
+ /* Copyright (C) 2016 - 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: Shamik Guha
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+#ifndef __STRSUBST_H__
+#define __STRSUBST_H__
+
+
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
+
+void gstrsubsta(char* str, int size, char* search, int size2, char* rep, int size3, char* flagmain,int size4, char* out);
+//void gstrsubsta(char* str, int size, char* search, int size2, char* rep, int size3, char* out,int size5);
+
+ #ifdef __cplusplus
+ } /* extern "C" */
+ #endif
+
+#endif /*__STRSUBST_H__*/
diff --git a/src/c/string/interfaces/int_ascii.h b/src/c/string/interfaces/int_ascii.h
new file mode 100644
index 00000000..87b1b125
--- /dev/null
+++ b/src/c/string/interfaces/int_ascii.h
@@ -0,0 +1,26 @@
+/* Copyright (C) 2016 - 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: Ankit Raj
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+#ifndef __INT_ASCII_H__
+#define __INT_ASCII_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define g2asciiu82(str,size,oup) gasciia(str,size[1],oup)
+#define d2asciig2(inp,size,oup) dasciia(inp,size[1],oup)
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__INT_ASCII_H__*/
diff --git a/src/c/string/interfaces/int_convstr.h b/src/c/string/interfaces/int_convstr.h
new file mode 100644
index 00000000..2eade501
--- /dev/null
+++ b/src/c/string/interfaces/int_convstr.h
@@ -0,0 +1,27 @@
+ /* Copyright (C) 2016 - 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: Shamik Guha
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+#ifndef __INT_CONVSTR_H__
+#define __INT_CONVSTR_H__
+
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
+
+#define g2g2convstrg2(in,size,flag,size2,out) gconvstrs(in,size[0]*size[1],flag,size2[1],out)
+/*#define g2g2convstrg0(in,size,type,typesize,out) (type=='u': \
+ gconvstrs(in,size[0]*size[1],0,out)?gconvstrs(in,size[0]*size[1],1,out))
+*/
+ #ifdef __cplusplus
+ } /* extern "C" */
+ #endif
+
+#endif /*__INT_CONVSTR_H__*/
diff --git a/src/c/string/interfaces/int_disp.h b/src/c/string/interfaces/int_disp.h
index 57f7bd45..26103326 100644
--- a/src/c/string/interfaces/int_disp.h
+++ b/src/c/string/interfaces/int_disp.h
@@ -17,25 +17,43 @@
#include <stdio.h>
-#define s0dispd0(in) sdisps(in)
+#define s0disp(in) sdisps(in)
-#define d0dispd0(in) ddisps(in)
+#define d0disp(in) ddisps(in)
-#define c0dispd0(in) cdisps(in)
+#define c0disp(in) cdisps(in)
-#define z0dispd0(in) zdisps(in)
+#define z0disp(in) zdisps(in)
-#define s2dispd0(in,size) sdispa(in,size[0],size[1])
+#define u80disp(in) u8disps(in)
-#define d2dispd0(in,size) ddispa(in,size[0],size[1])
+#define i80disp(in) i8disps(in)
-#define c2dispd0(in,size) cdispa(in,size[0],size[1])
+#define u160disp(in) u16disps(in)
-#define z2dispd0(in,size) zdispa(in,size[0],size[1])
+#define i160disp(in) i16disps(in)
-#define d3dispd0(in,size) ddisph(in,size[0],size[1],size[2])
+#define s2disp(in,size) sdispa(in,size[0],size[1])
-#define g2dispd0(in, size) printf("%s\n",in)
+#define d2disp(in,size) ddispa(in,size[0],size[1])
+
+#define c2disp(in,size) cdispa(in,size[0],size[1])
+
+#define z2disp(in,size) zdispa(in,size[0],size[1])
+
+#define u82disp(in,size) u8dispa(in,size[0],size[1])
+
+#define i82disp(in,size) i8dispa(in,size[0],size[1])
+
+#define u162disp(in,size) u16dispa(in,size[0],size[1])
+
+#define i162disp(in,size) i16dispa(in,size[0],size[1])
+
+#define d3disp(in,size) ddisph(in,size[0],size[1],size[2])
+
+#define g2disp(in, size) printf("%s\n", in)
+
+#define g0disp(in) printf("%c\n", in)
#endif /* __INT_DISP_H__ */
diff --git a/src/c/string/interfaces/int_strchr.h b/src/c/string/interfaces/int_strchr.h
new file mode 100644
index 00000000..8747545b
--- /dev/null
+++ b/src/c/string/interfaces/int_strchr.h
@@ -0,0 +1,25 @@
+/* Copyright (C) 2016 - 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: Ankit Raj
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+#ifndef __INT_STRCHR_H__
+#define __INT_STRCHR_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define g2g2strchrg2(str,size,key,size2,out) gstrchra(str,size[1],key,size2[1],out)
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /*__INT_STRCHR_H__*/
diff --git a/src/c/string/interfaces/int_strcspn.h b/src/c/string/interfaces/int_strcspn.h
new file mode 100644
index 00000000..74c6379f
--- /dev/null
+++ b/src/c/string/interfaces/int_strcspn.h
@@ -0,0 +1,25 @@
+/* Copyright (C) 2016 - 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: Ankit Raj
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+#ifndef __INT_STRCSPN_H__
+#define __INT_STRCSPN_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define g2g2strcspnu80(str1,size1,str2,size2) gstrcspna(str1,size1[1],str2,size2[1])
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* __INT_STRCSPN_H__*/
diff --git a/src/c/string/interfaces/int_string.h b/src/c/string/interfaces/int_string.h
new file mode 100644
index 00000000..7cea7799
--- /dev/null
+++ b/src/c/string/interfaces/int_string.h
@@ -0,0 +1,52 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2008-2008 - INRIA - Bruno JOFRET
+ *
+ * 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
+ *
+ */
+
+/* THIS IS AN AUTOMATICALLY GENERATED FILE : DO NOT EDIT BY HAND. */
+
+#ifndef __INT_STRING_H__
+#define __INT_STRING_H__
+
+#include <stdio.h>
+
+#define s0stringg0(in,out) sstrings(in,out)
+
+#define d0stringg0(in,out) dstrings(in,out)
+
+#define c0stringg0(in,out) cstrings(in,out)
+
+#define z0stringg0(in,out) zstrings(in,out)
+
+#define u80stringg0(in,out) u8strings(in,out)
+
+#define i80stringg0(in,out) i8strings(in,out)
+
+#define u160stringg0(in,out) u16strings(in,out)
+
+#define i160stringg0(in,out) i16strings(in,out)
+
+#define s2stringg2(in,size,out) sstringa(in,size[0]*size[1],out)
+
+#define d2stringg2(in,size,out) dstringa(in,size[0]*size[1],out)
+
+#define c2stringg2(in,size,out) cstringa(in,size[0]*size[1],out)
+
+#define z2stringg2(in,size,out) zstringa(in,size[0]*size[1],out)
+
+#define u82stringg2(in,size,out) u8stringa(in,size[0]*size[1],out)
+
+#define i82stringg2(in,size,out) i8stringa(in,size[0]*size[1],out)
+
+#define u162stringg2(in,size,out) u16stringa(in,size[0]*size[1],out)
+
+#define i162stringg2(in,size,out) i16stringa(in,size[0]*size[1],out)
+
+#endif /* __INT_STRING_H__ */
diff --git a/src/c/string/interfaces/int_strncpy.h b/src/c/string/interfaces/int_strncpy.h
new file mode 100644
index 00000000..e7ffdb42
--- /dev/null
+++ b/src/c/string/interfaces/int_strncpy.h
@@ -0,0 +1,26 @@
+/* Copyright (C) 2016 - 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: Ankit Raj
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+#ifndef __INT_STRNCPY_H__
+#define __INT_STRNCPY_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define g2d0strncpyg2(str,size,key,oup) gstrncpya(str,size[1],key,oup)
+
+#ifdef __cplusplus
+} /* extern "C"*/
+#endif
+
+#endif /*__INT_STRNCPY_H__*/
+
diff --git a/src/c/string/interfaces/int_strrchr.h b/src/c/string/interfaces/int_strrchr.h
new file mode 100644
index 00000000..7ec94ebe
--- /dev/null
+++ b/src/c/string/interfaces/int_strrchr.h
@@ -0,0 +1,25 @@
+ /* Copyright (C) 2016 - 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: Shamik Guha
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+#ifndef __INT_STRRCHR_H__
+#define __INT_STRRCHR_H__
+
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
+
+#define g2g2strrchrg2(str,size,key,size2,out) gstrrchra(str,size[1],key,size2[1],out)
+
+ #ifdef __cplusplus
+ } /* extern "C" */
+ #endif
+
+#endif /*__INT_STRRCHR_H__*/
diff --git a/src/c/string/interfaces/int_strrev.h b/src/c/string/interfaces/int_strrev.h
new file mode 100644
index 00000000..8429f6a1
--- /dev/null
+++ b/src/c/string/interfaces/int_strrev.h
@@ -0,0 +1,25 @@
+ /* Copyright (C) 2016 - 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: Shamik Guha
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+#ifndef __INT_STRREV_H__
+#define __INT_STRREV_H__
+
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
+
+#define g2strrevg2(str,size,out) gstrreva(str,size[1],out)
+
+ #ifdef __cplusplus
+ } /* extern "C" */
+ #endif
+
+#endif /*__INT_STRREV_H__*/
diff --git a/src/c/string/interfaces/int_strspn.h b/src/c/string/interfaces/int_strspn.h
new file mode 100644
index 00000000..e4b06f72
--- /dev/null
+++ b/src/c/string/interfaces/int_strspn.h
@@ -0,0 +1,25 @@
+/* Copyright (C) 2016 - 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: Ankit Raj
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+#ifndef __INT_STRSPN_H__
+#define __INT_STRSPN_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define g2g2strspnu80(str1,size1,str2,size2) gstrspna(str1,size1[1],str2,size2[1])
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* __INT_STRSPN_H__*/
diff --git a/src/c/string/interfaces/int_strsubst.h b/src/c/string/interfaces/int_strsubst.h
new file mode 100644
index 00000000..c8dd67a1
--- /dev/null
+++ b/src/c/string/interfaces/int_strsubst.h
@@ -0,0 +1,28 @@
+ /* Copyright (C) 2016 - 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: Shamik Guha
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+ */
+#ifndef __INT_STRSUBST_H__
+#define __INT_STRSUBST_H__
+
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
+
+#define g2g2g2g2strsubstg2(str,size,search,size2,rep,size3,flagmain,size4,out) gstrsubsta(str,size[1],search,size2[1],rep,size3[1],flagmain,size4[1],out)
+#define g2g2g2strsubstg2(in,size,search,size2,rep,size3,out) gstrsubsta(in,size[1],search,size2[1],rep,size3[1],'s',size3[1],out)
+
+
+
+ #ifdef __cplusplus
+ } /* extern "C" */
+ #endif
+
+#endif /*__INT_STRSUBST_H__*/
diff --git a/src/c/string/strchr/gstrchra.c b/src/c/string/strchr/gstrchra.c
new file mode 100644
index 00000000..f2f54359
--- /dev/null
+++ b/src/c/string/strchr/gstrchra.c
@@ -0,0 +1,33 @@
+/* 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
+ Organization: FOSSEE, IIT Bombay
+ Author: Ankit Raj
+ Email: toolbox@scilab.in
+*/
+#include <stdio.h>
+#include <string.h>
+#include "strchr.h"
+
+void gstrchra(char* str,int size,char* key,int size2,char* out)
+{
+ int ind,i=0,j,k;
+ for(j=0;j<size;j++)
+ {
+ if(str[j]==key[0])
+ {
+ ind=j;
+ break;
+ }
+ }
+ for(k=ind;k<size;k++)
+ {
+ out[i]=str[k];
+ i++;
+ }
+}
+
diff --git a/src/c/string/strcspn/gstrcspna.c b/src/c/string/strcspn/gstrcspna.c
new file mode 100644
index 00000000..91de8af7
--- /dev/null
+++ b/src/c/string/strcspn/gstrcspna.c
@@ -0,0 +1,41 @@
+/* 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
+ Organization: FOSSEE, IIT Bombay
+ Author: Ankit Raj
+ Email: toolbox@scilab.in
+*/
+#include<stdio.h>
+#include<string.h>
+#include "strcspn.h"
+uint8 gstrcspna(char *str1,int size1,char *str2,int size2)
+{
+
+ uint8 ind=size1+1;
+ int l,m;
+ for(m=0;m<size2;m++)
+ {
+ int tp;
+ for(l=0;l<size1;l++)
+ {
+ if(str2[m]==str1[l])
+ {
+ tp=l;
+ if(ind>tp)
+ {
+ ind=tp;
+ }
+ }
+ }
+ }
+ if(ind==size1+1)
+ {
+ ind=size1;
+ }
+ return ind;
+}
+
diff --git a/src/c/string/string/i16stringa.c b/src/c/string/string/i16stringa.c
new file mode 100644
index 00000000..f33f2cb5
--- /dev/null
+++ b/src/c/string/string/i16stringa.c
@@ -0,0 +1,24 @@
+/* Copyright (C) 2016 - 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: Siddhesh Wani
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+
+#include "str.h"
+#include "types.h"
+
+void i16stringa (int16* in, int size, char** out){
+
+ int i = 0;
+ for (i = 0; i < size; ++i)
+ {
+ i16strings (in[i], out[i]);
+ }
+}
diff --git a/src/c/string/string/i16strings.c b/src/c/string/string/i16strings.c
new file mode 100644
index 00000000..8644733c
--- /dev/null
+++ b/src/c/string/string/i16strings.c
@@ -0,0 +1,21 @@
+/* Copyright (C) 2016 - 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: Siddhesh Wani
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+
+#include <stdio.h>
+#include "str.h"
+#include "types.h"
+
+void i16strings (int16 in, char* out) {
+
+ sprintf (out, "%d" ,in );
+}
diff --git a/src/c/string/string/i8stringa.c b/src/c/string/string/i8stringa.c
new file mode 100644
index 00000000..37f4d8e8
--- /dev/null
+++ b/src/c/string/string/i8stringa.c
@@ -0,0 +1,24 @@
+/* Copyright (C) 2016 - 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: Siddhesh Wani
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+
+#include "str.h"
+#include "types.h"
+
+void i8stringa (int8* in, int size, char** out){
+
+ int i = 0;
+ for (i = 0; i < size; ++i)
+ {
+ i8strings (in[i], out[i]);
+ }
+}
diff --git a/src/c/string/string/i8strings.c b/src/c/string/string/i8strings.c
new file mode 100644
index 00000000..3f3c9e8f
--- /dev/null
+++ b/src/c/string/string/i8strings.c
@@ -0,0 +1,21 @@
+/* Copyright (C) 2016 - 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: Siddhesh Wani
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+
+#include <stdio.h>
+#include "str.h"
+#include "types.h"
+
+void i8strings (int8 in, char* out) {
+
+ sprintf (out, "%d" ,in );
+}
diff --git a/src/c/string/string/u16stringa.c b/src/c/string/string/u16stringa.c
new file mode 100644
index 00000000..ef6a0a97
--- /dev/null
+++ b/src/c/string/string/u16stringa.c
@@ -0,0 +1,24 @@
+/* Copyright (C) 2016 - 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: Siddhesh Wani
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+
+#include "str.h"
+#include "types.h"
+
+void u16stringa (uint16* in, int size, char** out){
+
+ int i = 0;
+ for (i = 0; i < size; ++i)
+ {
+ u16strings (in[i], out[i]);
+ }
+}
diff --git a/src/c/string/string/u16strings.c b/src/c/string/string/u16strings.c
new file mode 100644
index 00000000..f09ed971
--- /dev/null
+++ b/src/c/string/string/u16strings.c
@@ -0,0 +1,21 @@
+/* Copyright (C) 2016 - 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: Siddhesh Wani
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+
+#include <stdio.h>
+#include "str.h"
+#include "types.h"
+
+void u16strings (uint16 in, char* out) {
+
+ sprintf (out, "%d" ,in );
+}
diff --git a/src/c/string/string/u8stringa.c b/src/c/string/string/u8stringa.c
new file mode 100644
index 00000000..d605537c
--- /dev/null
+++ b/src/c/string/string/u8stringa.c
@@ -0,0 +1,24 @@
+/* Copyright (C) 2016 - 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: Siddhesh Wani
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+
+#include "str.h"
+#include "types.h"
+
+void u8stringa (uint8* in, int size, char** out){
+
+ int i = 0;
+ for (i = 0; i < size; ++i)
+ {
+ u8strings (in[i], out[i]);
+ }
+}
diff --git a/src/c/string/string/u8strings.c b/src/c/string/string/u8strings.c
new file mode 100644
index 00000000..07d07f36
--- /dev/null
+++ b/src/c/string/string/u8strings.c
@@ -0,0 +1,21 @@
+/* Copyright (C) 2016 - 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: Siddhesh Wani
+ Organization: FOSSEE, IIT Bombay
+ Email: toolbox@scilab.in
+*/
+
+
+#include <stdio.h>
+#include "str.h"
+#include "types.h"
+
+void u8strings (uint8 in, char* out) {
+
+ sprintf (out, "%d" ,in );
+}
diff --git a/src/c/string/strncpy/gstrncpya.c b/src/c/string/strncpy/gstrncpya.c
new file mode 100644
index 00000000..92801985
--- /dev/null
+++ b/src/c/string/strncpy/gstrncpya.c
@@ -0,0 +1,25 @@
+/* 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
+ Organization: FOSSEE, IIT Bombay
+ Author: Ankit Raj
+ Email: toolbox@scilab.in
+*/
+#include<stdio.h>
+#include "strncpy.h"
+void gstrncpya(char *str,int size,double key,char *oup)
+{
+ int j;
+ char c;
+ for(j=0;j<key;j++)
+ {
+ c=str[j];
+ oup[j]=c;
+ }
+}
+
+
diff --git a/src/c/string/strrchr/gstrrchra.c b/src/c/string/strrchr/gstrrchra.c
new file mode 100644
index 00000000..6a55fbd3
--- /dev/null
+++ b/src/c/string/strrchr/gstrrchra.c
@@ -0,0 +1,32 @@
+/* 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
+ Organization: FOSSEE, IIT Bombay
+ Author: Shamik Guha
+ Email: toolbox@scilab.in
+*/
+#include <stdio.h>
+#include <string.h>
+#include "strrchr.h"
+
+void gstrrchra(char* str,int size,char* key,int size2,char* out)
+{
+ int i,j, k=0, pos2;
+
+ for (i = 0;i<size;i++)
+ {
+ if (key[0] == str[i])
+ {
+ pos2 = i;
+ }
+ }
+ for(j=pos2;j<i;j++)
+ {
+ out[k]=str[j];
+ k++;
+ }
+}
diff --git a/src/c/string/strrev/gstrreva.c b/src/c/string/strrev/gstrreva.c
new file mode 100644
index 00000000..71a95725
--- /dev/null
+++ b/src/c/string/strrev/gstrreva.c
@@ -0,0 +1,26 @@
+/* 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
+ Organization: FOSSEE, IIT Bombay
+ Author: Shamik Guha
+ Email: toolbox@scilab.in
+*/
+#include <stdio.h>
+#include "strrev.h"
+
+void gstrreva(char* str,int size,char* out)
+{
+ int i=-1,j=0;
+
+ while(str[++i]!='\0');
+
+ while(i>=0)
+ out[j++] = str[--i];
+
+ out[j]='\0';
+
+}
diff --git a/src/c/string/strspn/gstrspna.c b/src/c/string/strspn/gstrspna.c
new file mode 100644
index 00000000..af1acbb8
--- /dev/null
+++ b/src/c/string/strspn/gstrspna.c
@@ -0,0 +1,44 @@
+/* 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
+ Organization: FOSSEE, IIT Bombay
+ Author: Ankit Raj
+ Email: toolbox@scilab.in
+*/
+#include<stdio.h>
+#include "strspn.h"
+
+int maxg(int a,int b){
+ if(a>b) return a;
+ return b;
+}
+uint8 gstrspna(char *str1,int size1,char *str2,int size2)
+{
+ int i,j,ct=0,k=0,m=0;
+ for(i=0;i<size2;i++)
+ {
+ if(str1[0]==str2[i])
+ {
+ k=i;
+ ct=0;
+ j=0;
+ while(str1[j]==str2[k])
+ {
+ ct++;
+ j++;
+ k++;
+ if(j >= size1) break;
+ }
+ if(j==size1)
+ {
+ ct=ct-1;
+ }
+ m = maxg(m,ct);
+ }
+ }
+return m;
+}
diff --git a/src/c/string/strsubst/gstrsubsta.c b/src/c/string/strsubst/gstrsubsta.c
new file mode 100644
index 00000000..6aee50ce
--- /dev/null
+++ b/src/c/string/strsubst/gstrsubsta.c
@@ -0,0 +1,69 @@
+/* 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
+ Organization: FOSSEE, IIT Bombay
+ Author: Shamik Guha
+ Email: toolbox@scilab.in
+*/
+
+#include <stdio.h>
+#include <string.h>
+#include "strsubst.h"
+
+void gstrsubsta(char* str,int size, char* search, int size2, char* rep, int size3, char* flagmain, int size4, char* out)
+{
+ int i = 0, j = 0, flag = 0, start = 0;
+
+ //if(flagmain[0]!='r')
+ //{
+ while (str[i] != '\0')
+ {
+ if (str[i] == search[j])
+ {
+ if (!flag)
+ start = i;
+ j++;
+ if (search[j] == '\0')
+ break;
+ flag = 1;
+ }
+ else
+ {
+ flag = start = j = 0;
+ }
+ i++;
+ }
+
+ if (search[j] == '\0' && flag)
+ {
+ for (i = 0; i < start; i++)
+ out[i] = str[i];
+ /* rep string with another string */
+ for (j = 0; j < strlen(rep); j++)
+ {
+ out[i] = rep[j];
+ i++;
+ }
+
+ /* copy remaining portion of the input string "str" */
+ for (j = start + strlen(search); j < strlen(str); j++)
+ {
+ out[i] = str[j];
+ i++;
+ }
+
+ /* print the out string */
+ out[i] = '\0';
+ //printf("Output: %s\n", out);
+ }
+ else
+ {
+ printf("%s is not a searching of %s\n", search, str);
+ }
+ // }
+
+}