1 #pragma once
2 
3 #include <sys/types.h>
4 #include <stdarg.h>
5 
6 #if defined(__cplusplus)
7 extern  "C"  {
8 #endif
9 
10 // 字体颜色的宏定义
11 #define COLOR_WHITE 0x00ffffff  //白
12 #define COLOR_BLACK 0x00000000  //黑
13 #define COLOR_RED 0x00ff0000    //红
14 #define COLOR_ORANGE 0x00ff8000 //橙
15 #define COLOR_YELLOW 0x00ffff00 //黄
16 #define COLOR_GREEN 0x0000ff00  //绿
17 #define COLOR_BLUE 0x000000ff   //蓝
18 #define COLOR_INDIGO 0x0000ffff //靛
19 #define COLOR_PURPLE 0x008000ff //紫
20 
21 #define SEEK_SET 0 /* Seek relative to start-of-file */
22 #define SEEK_CUR 1 /* Seek relative to current position */
23 #define SEEK_END 2 /* Seek relative to end-of-file */
24 
25 #define SEEK_MAX 3
26 
27 /* The value returned by fgetc and similar functions to indicate the
28    end of the file.  */
29 #define EOF (-1)
30 
31 typedef struct {
32     int fd;  // 文件描述符
33 } FILE;
34 
35 extern FILE* stdin;
36 extern FILE* stdout;
37 extern FILE* stderr;
38 
39 /**
40  * @brief 往屏幕上输出字符串
41  *
42  * @param str 字符串指针
43  * @param front_color 前景色
44  * @param bg_color 背景色
45  * @return int64_t
46  */
47 int64_t put_string(char *str, uint64_t front_color, uint64_t bg_color);
48 
49 int printf(const char *fmt, ...);
50 int sprintf(char *buf, const char *fmt, ...);
51 int vsprintf(char *buf, const char *fmt, va_list args);
52 
53 int fflush(FILE *stream);
54 int fprintf(FILE *restrict stream, const char *restrict format, ...);
55 int ferror(FILE *stream);
56 FILE *fopen(const char *restrict pathname, const char *restrict mode);
57 int fclose(FILE *stream);
58 int puts(const char *s);
59 int putchar(int c);
60 int getchar(void);
61 #if defined(__cplusplus)
62 }  /* extern "C" */
63 #endif
64