mirror of
https://git.planet-casio.com/Lephenixnoir/gint.git
synced 2024-12-29 13:03:36 +01:00
std: remove string functions now in the fxlibc
This commit is contained in:
parent
6c12217777
commit
9e43dcb27a
5 changed files with 1 additions and 74 deletions
|
@ -68,8 +68,6 @@ set(SOURCES_COMMON
|
||||||
src/std/aprint.c
|
src/std/aprint.c
|
||||||
src/std/malloc.c
|
src/std/malloc.c
|
||||||
src/std/print.c
|
src/std/print.c
|
||||||
src/std/string.c
|
|
||||||
src/std/string-ext.c
|
|
||||||
src/tmu/inth-etmu.s
|
src/tmu/inth-etmu.s
|
||||||
src/tmu/inth-tmu.s
|
src/tmu/inth-tmu.s
|
||||||
src/tmu/sleep.c
|
src/tmu/sleep.c
|
||||||
|
|
|
@ -34,12 +34,6 @@
|
||||||
0; \
|
0; \
|
||||||
})
|
})
|
||||||
|
|
||||||
/* abs() (without double evaluation) */
|
|
||||||
#define abs(s) ({ \
|
|
||||||
GAUTOTYPE _s = (s); \
|
|
||||||
_s < 0 ? -s : s; \
|
|
||||||
})
|
|
||||||
|
|
||||||
/* swap() - exchange two variables of the same type */
|
/* swap() - exchange two variables of the same type */
|
||||||
#define swap(a, b) ({ \
|
#define swap(a, b) ({ \
|
||||||
GAUTOTYPE _tmp = (a); \
|
GAUTOTYPE _tmp = (a); \
|
||||||
|
|
|
@ -41,7 +41,7 @@ void dline(int x1, int y1, int x2, int y2, int color)
|
||||||
int dx = x2 - x1, dy = y2 - y1;
|
int dx = x2 - x1, dy = y2 - y1;
|
||||||
int sx = sgn(dx), sy = sgn(dy);
|
int sx = sgn(dx), sy = sgn(dy);
|
||||||
|
|
||||||
dx = abs(dx), dy = abs(dy);
|
dx = (dx >= 0 ? dx : -dx), dy = (dy >= 0 ? dy : -dy);
|
||||||
|
|
||||||
dpixel(x1, y1, color);
|
dpixel(x1, y1, color);
|
||||||
|
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
//---
|
|
||||||
// gint:std:string-ext: Extensions to the standard for <string.h>
|
|
||||||
//---
|
|
||||||
|
|
||||||
#include <gint/defs/attributes.h>
|
|
||||||
#include <gint/std/string.h>
|
|
||||||
|
|
||||||
GWEAK char *strchrnul(char const *s, int c)
|
|
||||||
{
|
|
||||||
while(*s && *s != c) s++;
|
|
||||||
return (char *)s;
|
|
||||||
}
|
|
|
@ -1,53 +0,0 @@
|
||||||
//---
|
|
||||||
// gint:core:string - replicas of a few string functions
|
|
||||||
//---
|
|
||||||
|
|
||||||
#include <gint/defs/types.h>
|
|
||||||
#include <gint/defs/attributes.h>
|
|
||||||
#include <gint/std/string.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
|
|
||||||
GWEAK size_t strlen(char const *str)
|
|
||||||
{
|
|
||||||
int len = 0;
|
|
||||||
while(str[len]) len++;
|
|
||||||
return len;
|
|
||||||
}
|
|
||||||
|
|
||||||
GWEAK char *strncpy(char *dst, char const *src, size_t n)
|
|
||||||
{
|
|
||||||
size_t i = 0;
|
|
||||||
while(i < n && (dst[i] = src[i])) i++;
|
|
||||||
return dst;
|
|
||||||
}
|
|
||||||
|
|
||||||
GWEAK char *strcat(char *dest, char const *src)
|
|
||||||
{
|
|
||||||
unsigned long fin_dest = strlen(dest);
|
|
||||||
unsigned int i;
|
|
||||||
for (i = 0 ; i <= strlen(src) ; i++) dest[fin_dest + i] = src[i];
|
|
||||||
return dest;
|
|
||||||
}
|
|
||||||
|
|
||||||
GWEAK int strcmp(char const *s1, char const *s2)
|
|
||||||
{
|
|
||||||
while(*s1 && *s1 == *s2) s1++, s2++;
|
|
||||||
return *s1 - *s2;
|
|
||||||
}
|
|
||||||
|
|
||||||
GWEAK char *strchr(char const *s, int c)
|
|
||||||
{
|
|
||||||
while(*s && *s != c) s++;
|
|
||||||
return (*s) ? (char *)s : NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
GWEAK char *strrchr(char const *s, int c)
|
|
||||||
{
|
|
||||||
char const *found = NULL;
|
|
||||||
while(*s)
|
|
||||||
{
|
|
||||||
if(*s == c) found = s;
|
|
||||||
s++;
|
|
||||||
}
|
|
||||||
return (char *)found;
|
|
||||||
}
|
|
Loading…
Reference in a new issue