|
BFC-Compiler
A C23 Brainfuck compiler
|
Source-file loading and source-line access. More...
Go to the source code of this file.
Data Structures | |
| struct | bfc_program_t |
| Owning representation of a loaded source file. More... | |
Typedefs | |
| typedef struct bfc_program_t | bfc_program_t |
| Owning representation of a loaded source file. | |
Functions | |
| bfc_error_t | bfc_program_create (bfc_program_t **program, char const *file_path) |
| Loads an entire source file into memory. | |
| void | bfc_program_destroy (bfc_program_t **pprogram) |
| Releases a source program and nulls the caller pointer. | |
| char const * | bfc_program_getname (bfc_program_t const *const program) |
| Returns the base name of the source path. | |
| char * | bfc_program_getline (bfc_program_t const *const program, size_t const n) |
| Copies one source line into a new allocation. | |
Source-file loading and source-line access.
Defines the owning source-program object and its lifecycle.
| typedef struct bfc_program_t bfc_program_t |
Owning representation of a loaded source file.
| bfc_error_t bfc_program_create | ( | bfc_program_t ** | program, |
| char const * | file_path ) |
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. |
Loads an entire source file into memory.
| void bfc_program_destroy | ( | bfc_program_t ** | pprogram | ) |
Releases a source program and nulls the caller pointer.
Releases the source path, source bytes, and program object.
Releases a source program and nulls the caller pointer.
|
nodiscard |
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. |
Copies one source line into a new allocation.
|
nodiscard |
Returns the base name of the source path.
Returns a borrowed pointer to the final path component.
Returns the base name of the source path.