small improvements

* Update TOTO list
* Change the type of gint_vbr to comply with a new warning in GCC 9
* Add strcmp()
This commit is contained in:
Lephe 2019-09-19 15:59:38 +02:00
parent a05d3416f0
commit 86cd9b98d4
No known key found for this signature in database
GPG key ID: 1BBA026E13FC0495
4 changed files with 21 additions and 13 deletions

5
TODO
View file

@ -13,13 +13,12 @@ Complementary elements on existing code.
* topti: support unicode fonts * topti: support unicode fonts
* gray: find good values for more models than the Graph 35+E II * gray: find good values for more models than the Graph 35+E II
* render: get rid of GINT_NEED_VRAM and #define vram gint_vram if you need * render: get rid of GINT_NEED_VRAM and #define vram gint_vram if you need
* dma: dma_memcpy() and dma_memset(), possibly requiring alignment
* dma: maybe relax the 4-byte size constraint for dma_memset() * dma: maybe relax the 4-byte size constraint for dma_memset()
* core: try to leave add-in without reset in case of fatal exception * core: try to leave add-in without reset in case of panic
* topti: support Unicode fonts * topti: support Unicode fonts
* hardware: fill in the HWMEM_FITTLB flag * hardware: fill in the HWMEM_FITTLB flag
* keyboard: think of extended functions * keyboard: think of extended functions
* keyboard: add an intermediate-level API with some sort of IsKeyDown() * keyboard: implement keydown() in an event-compliant way
* cpg: spread spectrum on fxcg50 * cpg: spread spectrum on fxcg50
* bopti: blending modes for monochrome bitmaps (use topti assembler) * bopti: blending modes for monochrome bitmaps (use topti assembler)
* display: use more of topti's assembler in drect() * display: use more of topti's assembler in drect()

View file

@ -19,7 +19,10 @@ size_t strlen(char const *str);
/* strncpy(): Copy a string with a size limit */ /* strncpy(): Copy a string with a size limit */
char *strncpy(char *dst, char const *src, size_t n); char *strncpy(char *dst, char const *src, size_t n);
/* strcat(): Concatenation of src in dest*/ /* strcat(): Concatenation a string to a pre-allocated space */
char *strcat(char *dest, const char *src); char *strcat(char *dest, const char *src);
/* strcmp(): Compare NUL-terminated strings */
int strcmp(char const *s1, char const *s2);
#endif /* GINT_STD_STRING */ #endif /* GINT_STD_STRING */

View file

@ -10,7 +10,7 @@
#include <gint/mpu/intc.h> #include <gint/mpu/intc.h>
/* VBR address, from the linker script */ /* VBR address, from the linker script */
extern char gint_vbr; extern char gint_vbr[];
/* System's VBR address */ /* System's VBR address */
GBSS static uint32_t system_vbr; GBSS static uint32_t system_vbr;
/* Size of exception and TLB handler */ /* Size of exception and TLB handler */

View file

@ -6,24 +6,30 @@
#include <gint/defs/attributes.h> #include <gint/defs/attributes.h>
#include <stdarg.h> #include <stdarg.h>
GWEAK size_t strlen(const char *str) GWEAK size_t strlen(char const *str)
{ {
int len = 0; int len = 0;
while(str[len]) len++; while(str[len]) len++;
return len; return len;
} }
GWEAK char *strncpy(char *dst, const char *src, size_t n) GWEAK char *strncpy(char *dst, char const *src, size_t n)
{ {
size_t i = 0; size_t i = 0;
while(i < n && (dst[i] = src[i])) i++; while(i < n && (dst[i] = src[i])) i++;
return dst; return dst;
} }
GWEAK char *strcat(char *dest, const char *src) GWEAK char *strcat(char *dest, char const *src)
{ {
unsigned long fin_dest = strlen(dest); unsigned long fin_dest = strlen(dest);
unsigned int i; unsigned int i;
for (i = 0 ; i <= strlen(src) ; i++) dest[fin_dest + i] = src[i]; for (i = 0 ; i <= strlen(src) ; i++) dest[fin_dest + i] = src[i];
return dest; return dest;
} }
GWEAK int strcmp(char const *s1, char const *s2)
{
while(*s1 && *s1 == *s2) s1++, s2++;
return *s1 - *s2;
}