|
BFC-Compiler
A C23 Brainfuck compiler
|
Source-file input and line extraction. More...
#include "bfc_io.h"#include "bfc_error.h"#include <stdint.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include "bfc_memory.h"Functions | |
| bfc_error_t | bfc_program_create (bfc_program_t **program, char const *file_path) |
| Loads a source file, copies its path, and counts addressable source lines. | |
| void | bfc_program_destroy (bfc_program_t **pprogram) |
| Releases the source path, source bytes, and program object. | |
| char const * | bfc_program_getname (bfc_program_t const *program) |
| Returns a borrowed pointer to the final path component. | |
| char * | bfc_program_getline (bfc_program_t const *const program, size_t const n) |
| Copies one requested source line for diagnostic rendering. | |
Source-file input and line extraction.
Loads the complete source file, tracks line count, stores the source path, and returns allocated diagnostic lines.
| bfc_error_t bfc_program_create | ( | bfc_program_t ** | program, |
| char const * | file_path ) |
Loads a source file, copies its path, and counts addressable source lines.
Loads an entire source file into memory.
Loads a source file, copies its path, and counts addressable source lines.
| [out] | program | Receives the allocated source object. |
| [in] | file_path | Path of the source file to load. |
| void bfc_program_destroy | ( | bfc_program_t ** | pprogram | ) |
Releases the source path, source bytes, and program object.
Releases a source program and nulls the caller pointer.
Releases the source path, source bytes, and program object.
|
nodiscard |
Copies one requested source line for diagnostic rendering.
Copies one source line into a new allocation.
Copies one requested source line for diagnostic rendering.
| [in] | program | Loaded source program. |
| [in] | n | One-based line number. |
|
nodiscard |
Returns a borrowed pointer to the final path component.
Returns the base name of the source path.
Returns a borrowed pointer to the final path component.