Archived
1
Fork 0
This repository has been archived on 2024-10-07. You can view files and clone it, but cannot push or open issues or pull requests.
kilo/include/buffer.h

35 lines
752 B
C
Raw Normal View History

2023-09-01 15:04:12 +00:00
#ifndef BUFFER_H
#define BUFFER_H
2023-09-04 03:56:00 +00:00
#include <stdbool.h>
#include <stddef.h>
2023-09-04 03:56:00 +00:00
#include "erow.h"
2023-09-08 20:32:29 +00:00
#include "utils.h"
struct erow;
2023-09-01 15:04:12 +00:00
struct buffer {
char *filename;
int cx, cy, rx;
int row_off, col_off;
struct erow **rows;
2023-09-01 15:04:12 +00:00
int n_rows;
2023-09-04 03:56:00 +00:00
bool modified;
2023-09-01 15:04:12 +00:00
};
struct buffer *buffer_create(void);
ERRCODE buffer_read_file(struct buffer *buffer, const char *filename);
ERRCODE buffer_write_file(struct buffer *buffer, size_t *bytes_written);
void buffer_insert_row(struct buffer *buffer, struct erow *erow, int at);
void buffer_delete_row(struct buffer *buffer, int at);
struct erow *buffer_get_crow(struct buffer *buffer);
2023-09-08 20:32:29 +00:00
size_t buffer_get_crow_len(struct buffer *buffer);
void buffer_free(struct buffer *buffer);
2023-09-01 15:04:12 +00:00
#endif // BUFFER_H