corn/include/lib.h
2024-01-27 03:02:02 -05:00

61 lines
2 KiB
C

#pragma once
/**
* The memcmp() function compares the first n bytes (each interpreted as unsigned char) of the memory
* areas s1 and s2.
*/
extern int memcmp(const void *restrict s1, const void *restrict s2, unsigned long n);
/**
* The memcpy() function copies n bytes from memory area src to memory area dest.
* The memory areas must not overlap.
*/
extern void *memcpy(void *restrict dest, const void *restrict src, unsigned long n);
/**
* The memmove() function copies n bytes from memory area src to memory area dest. The memory areas
* may overlap: copying takes place as though the bytes in src are first copied into a temporary array
* that does not overlap src or dest, and the bytes are then copied from the temporary array to dest.
*/
extern void *memmove(void *dest, const void *src, unsigned long n);
/**
* The memset() function fills the first n bytes of the memory area pointed to by s with the constant
* byte c.
*/
extern void *memset(void *restrict dest, int c, unsigned long n);
/**
* The strcmp() function compares the two strings s1 and s2. The locale is not taken into account
* (for a locale-aware comparison, see strcoll(3)). The comparison is done using unsigned characters.
*/
extern int strncmp(const char *restrict s1, const char *restrict s2, unsigned long n);
/**
* @returns 1 if c is a space
*/
int isspace(int c);
/**
* @returns 1 if c is a digit (0 - 9)
*/
int isdigit(int c);
char itoc(int i);
int ctoi(char c);
int atoi(const char* s);
long int atol(const char* s);
long long int atoll(const char* s);
char *itoa(int n, char *buffer, int radix);
char *ltoa(long int n, char *buffer, int radix);
char *utoa(unsigned int n, char *buffer, int radix);
char *ultoa(unsigned long int n, char *buffer, int radix);
char *ftoa(float f, char *buffer);
int strtoi(const char *str, char **endptr, int base);
long int strtol(const char *str, char **endptr, int base);
long long int strtoll(const char *str, char **endptr, int base);