40 lines
958 B
C
40 lines
958 B
C
#ifndef LINE_SOURCE_H_
|
|
#define LINE_SOURCE_H_
|
|
|
|
#include "file-span.h"
|
|
#include "status.h"
|
|
|
|
#include <blue/core/stream.h>
|
|
#include <blue/ds/array.h>
|
|
#include <blue/ds/string.h>
|
|
|
|
struct line_source {
|
|
b_stream *s_stream;
|
|
const char *s_path;
|
|
b_string *s_linebuf;
|
|
b_iterator *s_linebuf_ptr;
|
|
b_array *s_lines;
|
|
|
|
struct file_cell s_cursor;
|
|
};
|
|
|
|
extern enum status line_source_init(
|
|
struct line_source *src,
|
|
const char *path,
|
|
b_stream *stream);
|
|
extern void line_source_cleanup(struct line_source *src);
|
|
|
|
extern const char *line_source_get_path(const struct line_source *src);
|
|
extern const struct file_cell *line_source_get_cursor(
|
|
const struct line_source *src);
|
|
extern b_wchar line_source_peekc(struct line_source *src);
|
|
extern b_wchar line_source_getc(struct line_source *src);
|
|
extern enum status line_source_get_row(
|
|
struct line_source *src,
|
|
size_t row,
|
|
const b_string **out);
|
|
|
|
extern bool line_source_input_available(struct line_source *src);
|
|
|
|
#endif
|