norm
This commit is contained in:
@@ -3,10 +3,10 @@
|
||||
/* ::: :::::::: */
|
||||
/* drawio_ast_utils.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: nalebrun <nalebrun@student.s19.be> +#+ +:+ +#+ */
|
||||
/* By: nalebrun <nalebrun@student.s19.be> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/01/29 09:21:09 by nalebrun #+# #+# */
|
||||
/* Updated: 2025/01/29 09:21:09 by nalebrun ### ########.fr */
|
||||
/* Updated: 2025/02/07 18:02:51 by nalebrun ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -31,21 +31,6 @@ const char *translate_state(t_state state)
|
||||
return (out);
|
||||
}
|
||||
|
||||
// const char *translate_redir(t_redir redir)
|
||||
// {
|
||||
// const char *out;
|
||||
//
|
||||
// if (redir == _RED_L)
|
||||
// out = "redir : RED_L ";
|
||||
// else if (redir == _RED_R)
|
||||
// out = "redir : RED_R ";
|
||||
// else if (redir == _RED_DR)
|
||||
// out = "redir : _RED_DR ";
|
||||
// else
|
||||
// out = "Not redirected ";
|
||||
// return (out);
|
||||
// }
|
||||
|
||||
t_dio_node get_cmd_txt(t_ast_n *node)
|
||||
{
|
||||
t_dio_node txt;
|
||||
@@ -59,9 +44,6 @@ t_dio_node get_cmd_txt(t_ast_n *node)
|
||||
args = ft_tabstr(node->args);
|
||||
txt.args = ft_sprintf("%s%s%s", NL, args, NL);
|
||||
free(args);
|
||||
// txt.redir = translate_redir(node->redir);
|
||||
// txt.inf = ft_sprintf("Infile : %s%s", node->infile, NL);
|
||||
// txt.outf = ft_sprintf("Outfile : %s", node->outfile);
|
||||
txt.files = ft_sprintf("redir: UNCHECKED\n");
|
||||
}
|
||||
else
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
/* ::: :::::::: */
|
||||
/* drawio_print_ast.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: lderidde <lderidde@student.s19.be> +#+ +:+ +#+ */
|
||||
/* By: nalebrun <nalebrun@student.s19.be> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/01/29 09:54:31 by lderidde #+# #+# */
|
||||
/* Updated: 2025/02/07 09:09:01 by lderidde ### ########.fr */
|
||||
/* Updated: 2025/02/07 17:27:47 by nalebrun ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -15,16 +15,15 @@
|
||||
char *get_node_txt(t_ast_n *node)
|
||||
{
|
||||
t_dio_node txt;
|
||||
static char *subsh;
|
||||
char *out;
|
||||
static char *subsh;
|
||||
char *out;
|
||||
|
||||
txt = get_cmd_txt(node);
|
||||
if (node->sh == true)
|
||||
subsh = ft_strdup(" (subsh) ");
|
||||
else
|
||||
subsh = ft_strdup("");
|
||||
out = ft_sprintf("%s%s%s%s%s", txt.st, txt.cmd, txt.args,
|
||||
subsh, txt.files);
|
||||
if (node->sh == true)
|
||||
subsh = ft_strdup(" (subsh) ");
|
||||
else
|
||||
subsh = ft_strdup("");
|
||||
out = ft_sprintf("%s%s%s%s%s", txt.st, txt.cmd, txt.args, subsh, txt.files);
|
||||
free(txt.cmd);
|
||||
free(txt.args);
|
||||
free(txt.files);
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
/* ::: :::::::: */
|
||||
/* drawio_utils.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: nalebrun <nalebrun@student.s19.be> +#+ +:+ +#+ */
|
||||
/* By: nalebrun <nalebrun@student.s19.be> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/01/27 15:09:16 by nalebrun #+# #+# */
|
||||
/* Updated: 2025/01/27 15:09:16 by nalebrun ### ########.fr */
|
||||
/* Updated: 2025/02/07 17:36:08 by nalebrun ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -28,6 +28,15 @@ static int get_char_count(char *str, char c)
|
||||
return (count);
|
||||
}
|
||||
|
||||
void write_ampercent(char *out)
|
||||
{
|
||||
out[0] = '&';
|
||||
out[1] = 'a';
|
||||
out[2] = 'm';
|
||||
out[3] = 'p';
|
||||
out[4] = ';';
|
||||
}
|
||||
|
||||
char *replace_ampercent(char *src)
|
||||
{
|
||||
int i;
|
||||
@@ -43,11 +52,7 @@ char *replace_ampercent(char *src)
|
||||
{
|
||||
if (src[i] == '&')
|
||||
{
|
||||
out[j] = '&';
|
||||
out[j + 1] = 'a';
|
||||
out[j + 2] = 'm';
|
||||
out[j + 3] = 'p';
|
||||
out[j + 4] = ';';
|
||||
write_ampercent(&out[j]);
|
||||
j += 5;
|
||||
}
|
||||
else
|
||||
@@ -58,6 +63,18 @@ char *replace_ampercent(char *src)
|
||||
return (out);
|
||||
}
|
||||
|
||||
void write_left_redi(char *out)
|
||||
{
|
||||
out[0] = '&';
|
||||
out[1] = 'a';
|
||||
out[2] = 'm';
|
||||
out[3] = 'p';
|
||||
out[4] = ';';
|
||||
out[5] = 'l';
|
||||
out[6] = 't';
|
||||
out[7] = ';';
|
||||
}
|
||||
|
||||
char *replace_left_red(char *src)
|
||||
{
|
||||
int i;
|
||||
@@ -73,14 +90,7 @@ char *replace_left_red(char *src)
|
||||
{
|
||||
if (src[i] == '<')
|
||||
{
|
||||
out[j] = '&';
|
||||
out[j + 1] = 'a';
|
||||
out[j + 2] = 'm';
|
||||
out[j + 3] = 'p';
|
||||
out[j + 4] = ';';
|
||||
out[j + 5] = 'l';
|
||||
out[j + 6] = 't';
|
||||
out[j + 7] = ';';
|
||||
write_left_redi(&out[j]);
|
||||
j += 8;
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user