BFC-Compiler
A C23 Brainfuck compiler
Toggle main menu visibility
Loading...
Searching...
No Matches
bfc_io.h
Go to the documentation of this file.
1
8
#ifndef BFC_IO_H
9
#define BFC_IO_H
10
11
#include <stddef.h>
12
13
#include "
bfc_error.h
"
14
20
typedef
struct
bfc_program_t
21
{
22
char
* path;
23
char
* buffer;
24
size_t
file_size;
25
size_t
line_count;
26
}
bfc_program_t
;
27
38
[[gnu::nonnull(1, 2)]]
39
bfc_error_t
bfc_program_create
(
bfc_program_t
** program,
char
const
* file_path);
40
44
void
bfc_program_destroy
(
bfc_program_t
** pprogram);
45
51
[[nodiscard, gnu::pure, gnu::nonnull(1), gnu::returns_nonnull]]
52
char
const
*
bfc_program_getname
(
bfc_program_t
const
*
const
program);
53
64
[[nodiscard, gnu::malloc, gnu::nonnull(1)]]
65
char
*
bfc_program_getline
(
bfc_program_t
const
*
const
program,
size_t
const
n);
66
67
#endif
// BFC_IO_H
bfc_error.h
Compiler error values and diagnostics.
bfc_program_create
bfc_error_t bfc_program_create(bfc_program_t **program, char const *file_path)
Loads an entire source file into memory.
Definition
bfc_io.c:21
bfc_program_getline
char * bfc_program_getline(bfc_program_t const *const program, size_t const n)
Copies one source line into a new allocation.
Definition
bfc_io.c:170
bfc_program_destroy
void bfc_program_destroy(bfc_program_t **pprogram)
Releases a source program and nulls the caller pointer.
Definition
bfc_io.c:135
bfc_program_getname
char const * bfc_program_getname(bfc_program_t const *const program)
Returns the base name of the source path.
Definition
bfc_io.c:152
bfc_error_t
Error value propagated through compiler stages.
Definition
bfc_error.h:42
bfc_program_t
Owning representation of a loaded source file.
Definition
bfc_io.h:21
include
bfc_io.h
Generated by
1.17.0