common: add generic input-line interface, and an implementation of it for text files

This commit is contained in:
2024-11-13 21:36:37 +00:00
parent bf2c9c1d90
commit cbd8639605
6 changed files with 96 additions and 11 deletions

15
common/include/ivy/file.h Normal file
View File

@@ -0,0 +1,15 @@
#ifndef IVY_COMMON_FILE_H_
#define IVY_COMMON_FILE_H_
#include <ivy/line-source.h>
#include <stdio.h>
struct ivy_file {
struct ivy_line_source f_base;
FILE *f_fp;
};
extern struct ivy_file *ivy_file_from_fp(FILE *fp);
extern void ivy_file_close(struct ivy_file *file);
#endif