A toy operating system written in C.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
freywaros/src/kernel/stream.h

36 lines
1.0 KiB

#pragma once
#include <stdint.h>
#define STREAM_SEQ_UP "\x1B[A"
#define STREAM_SEQ_DOWN "\x1B[B"
#define STREAM_SEQ_RIGHT "\x1B[C"
#define STREAM_SEQ_LEFT "\x1B[D"
#define STREAM_SEQ_HOME "\x1B[H"
#define STREAM_SEQ_END "\x1B[F"
#define STREAM_SEQ_INSERT "\x1B[2~"
#define STREAM_SEQ_DELETE "\x1B[3~"
#define STREAM_SEQ_PAGE_UP "\x1B[5~"
#define STREAM_SEQ_PAGE_DOWN "\x1B[6~"
#define STREAM_SEQ_F1 "\x1B[11~"
#define STREAM_SEQ_F2 "\x1B[12~"
#define STREAM_SEQ_F3 "\x1B[13~"
#define STREAM_SEQ_F4 "\x1B[14~"
#define STREAM_SEQ_F5 "\x1B[15~"
#define STREAM_SEQ_F6 "\x1B[16~"
#define STREAM_SEQ_F7 "\x1B[17~"
#define STREAM_SEQ_F8 "\x1B[18~"
#define STREAM_SEQ_F9 "\x1B[19~"
#define STREAM_SEQ_F10 "\x1B[1A~"
#define STREAM_SEQ_F11 "\x1B[1B~"
#define STREAM_SEQ_F12 "\x1B[1C~"
typedef struct stream stream_t;
typedef uint64_t (*stream_write_t)(const stream_t *self, const char *from, uint64_t bytes);
typedef uint64_t (*stream_read_t)(const stream_t *self, uint64_t max, char *to);
typedef struct stream {
stream_write_t write;
stream_read_t read;
} stream_t;