summaryrefslogtreecommitdiff
path: root/src/c/string
diff options
context:
space:
mode:
Diffstat (limited to 'src/c/string')
-rw-r--r--src/c/string/ascii/gasciia.c4
-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.h2
-rw-r--r--src/c/string/includes/disp.h1
-rw-r--r--src/c/string/interfaces/int_disp.h4
-rw-r--r--src/c/string/strcspn/gstrcspna.c45
7 files changed, 27 insertions, 33 deletions
diff --git a/src/c/string/ascii/gasciia.c b/src/c/string/ascii/gasciia.c
index ec11d6e..5fe95e0 100644
--- a/src/c/string/ascii/gasciia.c
+++ b/src/c/string/ascii/gasciia.c
@@ -14,12 +14,12 @@
into its ascii equivalent.
*/
#include "ascii.h"
-void gasciia(char *str,int size,int* oup)
+void gasciia(char *str,int size,uint8* oup)
{
int i;
for(i=0;i<size;i++)
{
- *(oup+i)=(int)str[i];
+ *(oup+i)=str[i];
}
}
diff --git a/src/c/string/disp/zdispa.c b/src/c/string/disp/zdispa.c
index bc71de4..94b24e9 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.20lf + %1.20lfi " ,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 c4ec137..4a040cd 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
index fcf969d..39aeb83 100644
--- a/src/c/string/includes/ascii.h
+++ b/src/c/string/includes/ascii.h
@@ -17,7 +17,7 @@
extern "C" {
#endif
-void gasciia(char* str,int size,int* oup);
+void gasciia(char* str,int size,uint8* oup);
void dasciia(double* inp,int size,char* oup);
#ifdef __cplusplus
diff --git a/src/c/string/includes/disp.h b/src/c/string/includes/disp.h
index 88764f2..7b46390 100644
--- a/src/c/string/includes/disp.h
+++ b/src/c/string/includes/disp.h
@@ -125,6 +125,7 @@ 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/interfaces/int_disp.h b/src/c/string/interfaces/int_disp.h
index 3bb7852..2610332 100644
--- a/src/c/string/interfaces/int_disp.h
+++ b/src/c/string/interfaces/int_disp.h
@@ -51,7 +51,9 @@
#define d3disp(in,size) ddisph(in,size[0],size[1],size[2])
-#define g2disp(in, size) printf("%s\n",in)
+#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/strcspn/gstrcspna.c b/src/c/string/strcspn/gstrcspna.c
index 4dcdcdf..91de8af 100644
--- a/src/c/string/strcspn/gstrcspna.c
+++ b/src/c/string/strcspn/gstrcspna.c
@@ -14,37 +14,28 @@
#include "strcspn.h"
uint8 gstrcspna(char *str1,int size1,char *str2,int size2)
{
- int ind,i,j;;
-
- for(i=0;i<=size1;i++)
+
+ uint8 ind=size1+1;
+ int l,m;
+ for(m=0;m<size2;m++)
{
- for(j=0;j<=size2;j++)
- {
- if(str2[j]==str1[i])
+ int tp;
+ for(l=0;l<size1;l++)
{
- ind=j;
- break;
+ if(str2[m]==str1[l])
+ {
+ tp=l;
+ if(ind>tp)
+ {
+ ind=tp;
+ }
+ }
}
- }
}
- return (ind+1);
-}
-/*int main()
-{
- int n1,n2;
- char inp1[100000],inp2[100000];
- printf("Enter the length of the first string");
- scanf("%d",&n1);
- for(int i=0;i<=(n1+1);i++)
- {
- scanf("%c",&inp1[i]);
- }
- printf("Enter the length of the second string");
- scanf("%d",&n2 );
- for(int j=0;j<=(n2+1);j++)
+ if(ind==size1+1)
{
- scanf("%c",&inp2[j]);
+ ind=size1;
}
- strcspnfn(inp1,n1+1,inp2,n2+1);
+ return ind;
}
-*/
+