RT
Functions
parse_txt.c File Reference
#include "libft.h"
#include "tools.h"
#include "parse.h"
#include <unistd.h>
#include <stdlib.h>
#include <sys/errno.h>
Include dependency graph for parse_txt.c:

Functions

char * get_curr_line (t_parse_txt *scene_file)
 Check if the line_idx is in range and return the curr_line. More...
 
char * pop_line (t_parse_txt *scene_file)
 Return the curr_line and move line_idx to the next line. More...
 
void err_exit (char *err_msg, t_parse_txt *scene_file)
 Print the exit message and exit after cleaning the data allocated. More...
 
void err_set (t_parse_txt *scene_file, const char err_func[], int line_in_code, const char err_file[])
 Save data that produce the exit. More...
 
int load_parse_txt (t_parse_txt *scene_file, t_data *app, char *filename)
 : Load a file into the t_parse_txt & bind the hooks and t_data app More...
 

Function Documentation

◆ err_exit()

void err_exit ( char *  err_msg,
t_parse_txt scene_file 
)

Print the exit message and exit after cleaning the data allocated.

Parameters
err_msg: message to explain the error.
scene_file: data in txt to parse

◆ err_set()

void err_set ( t_parse_txt scene_file,
const char  err_func[],
int  line_in_code,
const char  err_file[] 
)

Save data that produce the exit.

Parameters
scene_file: data in txt to parse
err_func: function where the error occure
line_in_code: line where the error occure
err_file: file where the error occure

◆ get_curr_line()

char* get_curr_line ( t_parse_txt scene_file)

Check if the line_idx is in range and return the curr_line.

Parameters
scene_file: data in txt to parse
Returns
char* : curr_line

◆ load_parse_txt()

int load_parse_txt ( t_parse_txt scene_file,
t_data app,
char *  filename 
)

: Load a file into the t_parse_txt & bind the hooks and t_data app

Parameters
scene_file: data in txt to parse
app: link to the data
filename: file to load
Returns
int : status of the function

◆ pop_line()

char* pop_line ( t_parse_txt scene_file)

Return the curr_line and move line_idx to the next line.

Parameters
scene_file: data in txt to parse
Returns
char* : curr_line before the increment of line_idx