2018-12-31 10:49:08 +01:00
|
|
|
//----------------------------------------------------------------------------//
|
|
|
|
// GNU GPL OS/K //
|
|
|
|
// //
|
|
|
|
// Authors: spectral` //
|
|
|
|
// NeoX //
|
|
|
|
// //
|
2019-01-01 13:09:57 +01:00
|
|
|
// Desc: Kaleid C runtime library //
|
2018-12-31 10:49:08 +01:00
|
|
|
//----------------------------------------------------------------------------//
|
|
|
|
|
2019-01-01 13:09:57 +01:00
|
|
|
#ifndef _KALCRT_H
|
|
|
|
#define _KALCRT_H
|
2018-12-31 10:49:08 +01:00
|
|
|
|
2019-01-01 13:09:57 +01:00
|
|
|
//------------------------------------------//
|
|
|
|
// Typedefs //
|
|
|
|
//------------------------------------------//
|
|
|
|
|
|
|
|
#ifndef __size_t
|
|
|
|
#define __size_t
|
|
|
|
typedef unsigned long size_t;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __va_list
|
|
|
|
#define __va_list
|
|
|
|
typedef __builtin_va_list va_list;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __status_t
|
|
|
|
#define __status_t
|
|
|
|
typedef signed long status_t;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
//------------------------------------------//
|
|
|
|
// Macros //
|
|
|
|
//------------------------------------------//
|
2018-12-31 10:49:08 +01:00
|
|
|
|
2019-01-01 13:09:57 +01:00
|
|
|
#ifndef _NO_MASK
|
|
|
|
#define _NO_MASK
|
2018-12-31 10:49:08 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
//------------------------------------------//
|
2019-01-01 13:09:57 +01:00
|
|
|
// va_list utilities //
|
2018-12-31 10:49:08 +01:00
|
|
|
//------------------------------------------//
|
|
|
|
|
2019-01-01 13:09:57 +01:00
|
|
|
#ifndef va_start
|
|
|
|
#define va_start __builtin_va_start
|
2018-12-31 10:49:08 +01:00
|
|
|
#endif
|
|
|
|
|
2019-01-01 13:09:57 +01:00
|
|
|
#ifndef va_next
|
|
|
|
#define va_next __builtin_va_next
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef va_end
|
|
|
|
#define va_end __builtin_va_end
|
|
|
|
#endif
|
|
|
|
|
|
|
|
//------------------------------------------//
|
|
|
|
// Memory management utilities //
|
|
|
|
//------------------------------------------//
|
|
|
|
|
|
|
|
#if !defined(memset) && !defined(_KALMASK_H)
|
|
|
|
# define memset memsetb
|
|
|
|
#endif
|
|
|
|
void *memsetb(void *, int, size_t);
|
2018-12-31 15:08:56 +01:00
|
|
|
void *memsetw(void *, int, size_t);
|
|
|
|
void *memsetd(void *, int, size_t);
|
|
|
|
void *memsetq(void *, long, size_t);
|
|
|
|
|
2018-12-31 10:49:08 +01:00
|
|
|
void *memzero(void *, size_t);
|
|
|
|
|
|
|
|
//------------------------------------------//
|
2019-01-01 13:09:57 +01:00
|
|
|
// String manipulation utilities //
|
2018-12-31 10:49:08 +01:00
|
|
|
//------------------------------------------//
|
|
|
|
|
|
|
|
size_t strlen(const char *);
|
|
|
|
char *strcpy(char *, const char *);
|
|
|
|
char *strncpy(char *, const char *, size_t);
|
2019-01-01 13:09:57 +01:00
|
|
|
char *strrev(char *, const char *);
|
2018-12-31 10:49:08 +01:00
|
|
|
char *reverse(char *);
|
|
|
|
|
|
|
|
int sprintf(char *, const char *, ...);
|
|
|
|
int snprintf(char *, size_t, const char *, ...);
|
|
|
|
int vsprintf(char *, const char *, va_list);
|
|
|
|
int vsnprintf(char *, size_t, const char *, va_list);
|
|
|
|
|
|
|
|
//------------------------------------------//
|
|
|
|
// Type conversion utilities //
|
|
|
|
//------------------------------------------//
|
|
|
|
|
|
|
|
char *itoa(int, char *, int);
|
|
|
|
|
|
|
|
//------------------------------------------//
|
2019-01-01 13:09:57 +01:00
|
|
|
// Diverse utilities //
|
|
|
|
//------------------------------------------//
|
|
|
|
|
|
|
|
const char *describe_status(status_t) _NO_MASK;
|
|
|
|
|
|
|
|
//------------------------------------------//
|
|
|
|
// End of <kalcrt.h> //
|
2018-12-31 10:49:08 +01:00
|
|
|
//------------------------------------------//
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|