41 lines
744 B
Markdown
41 lines
744 B
Markdown
# state.c
|
|
|
|
Initialize the transpilation state structure.
|
|
|
|
## Includes
|
|
```c
|
|
#include "internal/transpile_internal.h"
|
|
```
|
|
|
|
---
|
|
|
|
## Function Description
|
|
### `state_init`
|
|
|
|
Initialize the transpilation state structure.
|
|
|
|
#### Parameters
|
|
- `s`: Pointer to the state structure to initialize.
|
|
- `in`: Input file pointer.
|
|
- `out`: Output file pointer.
|
|
- `ext`: Pointer to the extracted code fence extension string.
|
|
- `map`: Pointer to the mapping structure.
|
|
|
|
#### Implementation
|
|
|
|
```c
|
|
void
|
|
state_init(t_state *s, FILE *in, FILE *out, const char *ext, t_map *map)
|
|
{
|
|
s->in = in;
|
|
s->out = out;
|
|
s->ext = ext;
|
|
s->map = map;
|
|
s->src_line = 0;
|
|
s->dst_line = 0;
|
|
s->block_src_start = 0;
|
|
s->block_dst_start = 0;
|
|
s->in_block = 0;
|
|
s->first_block = 1;
|
|
}
|
|
```
|