c-md/includes/internal/transpile_internal.h.md

66 lines
1.2 KiB
Markdown

# transpile_internal.h
## Include Guard
```c
#ifndef TRANSPILE_INTERNAL_H
# define TRANSPILE_INTERNAL_H
# include <stdio.h>
# include <stdint.h>
# include "map.h"
```
## Types
### `t_state`
Struct to hold the state of the transpilation process.
```c
typedef struct s_state
{
FILE *in;
FILE *out;
const char *ext;
t_map *map;
uint32_t src_line;
uint32_t dst_line;
uint32_t block_src_start;
uint32_t block_dst_start;
uint8_t in_block;
uint8_t first_block;
} t_state;
```
## Functions
### [`state_init`](/srcs/transpile/state.c.md#state_init)
Initializes the transpilation state.
```c
void
state_init(t_state *s, FILE *in, FILE *out, const char *ext, t_map *map);
```
### [`handle_fence_open`](/srcs/transpile/fence.c.md#handle_fence_open)
Handles the opening of a code fence in the input.
```c
int8_t
handle_fence_open(t_state *s, char *line);
```
### [`handle_fence_close`](/srcs/transpile/fence.c.md#handle_fence_open)
Handles the closing of a code fence in the input.
```c
int8_t
handle_fence_close(t_state *s);
```
### [`handle_code_line`](/srcs/transpile/code.c.md#handle_code_line)
Handles a regular line of code in the input.
```c
int8_t
handle_code_line(t_state *s, char *line);
```
## End Guard
```c
#endif
```