2024-04-09 23:46:56 +08:00
|
|
|
#ifndef CRASHPOWEROS_COMMON_H
|
|
|
|
#define CRASHPOWEROS_COMMON_H
|
|
|
|
|
2024-05-02 11:06:52 +08:00
|
|
|
#define OS_NAME "CoolPotOS"
|
2024-05-13 22:17:38 +08:00
|
|
|
#define OS_VERSION "v0.2.5"
|
2024-04-13 22:03:54 +08:00
|
|
|
|
|
|
|
#define LONG_MAX 9223372036854775807L
|
|
|
|
#define LONG_MIN -9223372036854775808L
|
2024-04-09 23:46:56 +08:00
|
|
|
|
2024-05-12 14:34:03 +08:00
|
|
|
#define UINT32_MAX 0xffffffff
|
|
|
|
#define INT32_MAX 0x7fffffff
|
|
|
|
|
2024-05-12 00:17:47 +08:00
|
|
|
#define swap32(x) \
|
|
|
|
((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) | \
|
|
|
|
(((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24))
|
|
|
|
#define swap16(x) ((((x) & 0xff00) >> 8) | (((x) & 0x00ff) << 8))
|
|
|
|
|
2024-04-09 23:46:56 +08:00
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
2024-05-03 20:32:10 +08:00
|
|
|
typedef int bool;
|
2024-05-12 14:34:03 +08:00
|
|
|
#define true 1
|
|
|
|
#define false 0
|
|
|
|
#define EOF -1
|
|
|
|
|
|
|
|
unsigned int rand(void);
|
|
|
|
void srand(unsigned long seed);
|
|
|
|
void insert_char(char* str, int pos, char ch);
|
|
|
|
void delete_char(char* str, int pos);
|
|
|
|
void strtoupper(char* str);
|
|
|
|
int strncmp(const char* s1, const char* s2, size_t n);
|
2024-04-09 23:46:56 +08:00
|
|
|
void assert(int b,char* message);
|
|
|
|
size_t strlen(const char* str);
|
|
|
|
int strcmp(const char *s1, const char *s2);
|
|
|
|
char *strcpy(char *dest, const char *src);
|
|
|
|
char* strcat(char *dest, const char*src);
|
2024-04-11 23:32:28 +08:00
|
|
|
size_t strnlen(const char *s, size_t maxlen);
|
2024-04-09 23:46:56 +08:00
|
|
|
void trim(char *s);
|
|
|
|
int isspace(int c);
|
|
|
|
int isdigit(int c);
|
|
|
|
int isalpha(int c);
|
|
|
|
int isupper(int c);
|
|
|
|
char *int32_to_str_dec(int32_t num, int flag, int width);
|
|
|
|
char *int64_to_str_dec(int64_t num, int flag, int width);
|
|
|
|
char *uint32_to_str_hex(uint32_t num, int flag, int width);
|
|
|
|
char *uint64_to_str_hex(uint64_t num, int flag, int width);
|
|
|
|
char *uint32_to_str_oct(uint32_t num, int flag, int width);
|
2024-05-18 23:44:25 +08:00
|
|
|
void insert_str(char *str, char *insert_str, int pos);
|
2024-04-09 23:46:56 +08:00
|
|
|
int vsprintf(char *buf, const char *fmt, va_list args);
|
|
|
|
int sprintf(char *buf, const char *fmt, ...);
|
2024-04-13 22:03:54 +08:00
|
|
|
long int strtol(const char *str,char **endptr,int base);
|
2024-04-09 23:46:56 +08:00
|
|
|
|
2024-04-13 22:22:25 +08:00
|
|
|
void reset_kernel();
|
|
|
|
void shutdown_kernel();
|
2024-04-15 00:24:36 +08:00
|
|
|
uint32_t memory_all();
|
2024-04-13 22:22:25 +08:00
|
|
|
|
2024-04-09 23:46:56 +08:00
|
|
|
#endif //CRASHPOWEROS_COMMON_H
|