mirror of
https://git.stationery.faith/corn/corn.git
synced 2024-11-10 02:42:08 +00:00
139 lines
4.4 KiB
C
139 lines
4.4 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
|
|
*/
|
|
extern int isspace(int c);
|
|
|
|
/**
|
|
* @returns 1 if c is a digit (0 - 9)
|
|
*/
|
|
extern int isdigit(int c);
|
|
|
|
/**
|
|
* converts single digit int to base 36
|
|
* @param i - int
|
|
* @returns c - base 36 char
|
|
*/
|
|
extern char itoc(int i);
|
|
|
|
/**
|
|
* converts single base 36 chat into int
|
|
* @param c - base 36 char
|
|
* @returns i - int
|
|
*/
|
|
extern int ctoi(char c);
|
|
|
|
/**
|
|
* Converts the initial portiion of the string pointed to by s to int.
|
|
* @param s - the string to convert
|
|
* @returns the number inside s or 0 on error
|
|
*/
|
|
extern int atoi(const char* s);
|
|
|
|
/**
|
|
* Converts the initial portiion of the string pointed to by s to long.
|
|
* @param s - the string to convert
|
|
* @returns the number inside s or 0 on error
|
|
*/
|
|
extern long int atol(const char* s);
|
|
|
|
/**
|
|
* Converts the initial portiion of the string pointed to by s to long long.
|
|
* @param s - the string to convert
|
|
* @returns the number inside s or 0 on error
|
|
*/
|
|
extern long long int atoll(const char* s);
|
|
|
|
/**
|
|
* Converts a integer to asci inside a string with a given radix (base).
|
|
* @param n - the number to conver
|
|
* @param buffer - the string buffer
|
|
* @param radix - the base to convert
|
|
*/
|
|
extern char *itoa(int n, char *buffer, int radix);
|
|
|
|
/**
|
|
* Converts a long to asci inside a string with a given radix (base).
|
|
* @param n - the number to conver
|
|
* @param buffer - the string buffer
|
|
* @param radix - the base to convert
|
|
*/
|
|
extern char *ltoa(long int n, char *buffer, int radix);
|
|
|
|
/**
|
|
* Converts a unsigned integer to asci inside a string with a given radix (base).
|
|
* @param n - the number to conver
|
|
* @param buffer - the string buffer
|
|
* @param radix - the base to convert
|
|
*/
|
|
extern char *utoa(unsigned int n, char *buffer, int radix);
|
|
|
|
/**
|
|
* Converts a unsigned long to asci inside a string with a given radix (base).
|
|
* @param n - the number to conver
|
|
* @param buffer - the string buffer
|
|
* @param radix - the base to convert
|
|
*/
|
|
extern char *ultoa(unsigned long int n, char *buffer, int radix);
|
|
|
|
/**
|
|
* Converts the string in str to an int value based on the given base.
|
|
* The endptr is updated to where the string was no longer valid.
|
|
* @param str - the string buffer
|
|
* @param endptr - the endptr
|
|
* @param base - the base to convert to
|
|
* @returns 0 on error or success, error if endptr is still equal to str
|
|
*/
|
|
extern int strtoi(const char *str, char **endptr, int base);
|
|
|
|
/**
|
|
* Converts the string in str to an long value based on the given base.
|
|
* The endptr is updated to where the string was no longer valid.
|
|
* @param str - the string buffer
|
|
* @param endptr - the endptr
|
|
* @param base - the base to convert to
|
|
* @returns 0 on error or success, error if endptr is still equal to str
|
|
*/
|
|
extern long int strtol(const char *str, char **endptr, int base);
|
|
|
|
/**
|
|
* Converts the string in str to an long long value based on the given base.
|
|
* The endptr is updated to where the string was no longer valid.
|
|
* @param str - the string buffer
|
|
* @param endptr - the endptr
|
|
* @param base - the base to convert to
|
|
* @returns 0 on error or success, error if endptr is still equal to str
|
|
*/
|
|
extern long long int strtoll(const char *str, char **endptr, int base);
|