split heredoc handling in the scanner

This commit is contained in:
Maieul BOYER 2024-09-01 19:56:22 +00:00
parent 8be7417a61
commit 7e1e51e90b
30 changed files with 663 additions and 416 deletions

View file

@ -120,4 +120,14 @@ void vec_C__PREFIX___sort(t_vec_C__PREFIX__ *vec, t_vec_C__PREFIX___sort_fn i
/// @return true if the operation failed, false otherwise
t_error vec_C__PREFIX___back(t_vec_C__PREFIX__ *vec, C__TYPENAME__ **out);
/// @brief Get a pointer to the i'th element, or NULL otherwise
/// @param vec The vec_C__PREFIX__ to get the element from
/// @return A pointer to the element or NULL
C__TYPENAME__ *vec_C__PREFIX___get(t_vec_C__PREFIX__ *vec, t_usize i);
/// @brief Get a pointer to the last element, or NULL otherwise
/// @param vec The vec_C__PREFIX__ to get the element from
/// @return A pointer to the last element or NULL
C__TYPENAME__ *vec_C__PREFIX___last(t_vec_C__PREFIX__ *vec);
#endif

View file

@ -10,8 +10,6 @@
/* */
/* ************************************************************************** */
#include "me/mem/mem.h"
#include "me/mem/mem.h"
#include "me/mem/mem.h"
#include "me/types.h"
#include "me/vec/vec_C__PREFIX__.h"

View file

@ -0,0 +1,30 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* vec_C__PREFIX__.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/12/30 17:59:28 by maiboyer #+# #+# */
/* Updated: 2023/12/30 17:59:28 by maiboyer ### ########.fr */
/* */
/* ************************************************************************** */
#include "me/mem/mem.h"
#include "me/types.h"
#include "me/vec/vec_C__PREFIX__.h"
#include <stdlib.h>
C__TYPENAME__ *vec_C__PREFIX___get(t_vec_C__PREFIX__ *vec, t_usize i)
{
if (vec->len >= i)
return (NULL);
return (&vec->buffer[i]);
}
C__TYPENAME__ *vec_C__PREFIX___last(t_vec_C__PREFIX__ *vec)
{
if (vec->len == 0)
return (NULL);
return (&vec->buffer[vec->len - 1]);
}

View file

@ -5,6 +5,7 @@ sources = [
"generic_sources/src/vec/C__PREFIX___sort.c__TEMPLATE__",
"generic_sources/src/vec/C__PREFIX___functions2.c__TEMPLATE__",
"generic_sources/src/vec/C__PREFIX___functions3.c__TEMPLATE__",
"generic_sources/src/vec/C__PREFIX___functions4.c__TEMPLATE__",
]
replace.C__TYPENAME__ = "type"
replace.C__TYPEHEADER__ = "header_include"