Files
rosetta/toolchain/ifc/line-source.h
Max Wash b631fca0fd toolchain: add a program for compiling ipc interface definitions
ifc can be used to compile .if files into self-contained header-only C
libraries, which can be used to send/receive messages that conform
to the described interface.
2026-02-26 19:44:32 +00:00

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