From 30a575342c493ad308659d0b274bc2c423594d24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Luttringer?= Date: Sun, 12 Nov 2006 12:49:14 +0000 Subject: [PATCH] --- configure.ac | 17 +++++++------ src/exec/exec.h | 23 ++++++----------- src/exec/exec_and.c | 4 +-- src/exec/exec_if.c | 4 +-- src/exec/exec_node.c | 60 ++++++++++++++------------------------------ src/exec/exec_or.c | 4 +-- 6 files changed, 41 insertions(+), 71 deletions(-) diff --git a/configure.ac b/configure.ac index ff789bc..07a584e 100644 --- a/configure.ac +++ b/configure.ac @@ -15,19 +15,22 @@ echo "checking CFLAGS..." AC_CANONICAL_HOST case $host_os in - *osf*) + *osf*) CFLAGS='-Wall -W -ansi -pedantic -D_XOPEN_SOURCE=600' ;; - *solaris*) + *solaris*) CFLAGS='-Wall -W -ansi -pedantic -D_XOPEN_SOURCE=600' ;; - *linux*|*netbsd*) + *linux*|*netbsd*) CFLAGS='-Wall -Wextra -std=c99 -pedantic -D_XOPEN_SOURCE=600 -pipe' ;; - *) - pl="`uname -s`" - AC_MSG_ERROR([Platform $pl not supported.]) + *darwin*) + CFLAGS='-Wall -W -std=c99 -pedantic -D_XOPEN_SOURCE=600 -pipe' ;; + *) + pl="`uname -s`" + AC_MSG_ERROR([Platform $pl not supported.]) + ;; esac # Check for C compiler @@ -85,8 +88,6 @@ AC_CHECK_HEADERS([limits.h]) dnl Memo: dnl AC ARG WITH(package, help-string, [action-if-given], [action-if-not-given]) - - AC_ARG_WITH([noerror], [AS_HELP_STRING([--with-noerror], [Warning dont create compilation error])], [dnl action-if-given diff --git a/src/exec/exec.h b/src/exec/exec.h index 95d1d6a..cba632b 100644 --- a/src/exec/exec.h +++ b/src/exec/exec.h @@ -5,7 +5,7 @@ ** Login ** ** Started on Sun Mar 30 16:02:07 2006 Seblu -** Last update Sun Nov 12 03:43:20 2006 seblu +** Last update Sun Nov 12 13:29:49 2006 seblu */ #ifndef EXEC_H_ @@ -16,21 +16,12 @@ # include "../ast/ast.h" # include "../shell/shell.h" -void exec_node(s_ast_node *node); - -/* void exec_list(struct s_list *node, struct s_42sh *sh); */ -/* void exec_if(struct s_if *node, struct s_42sh *sh); */ -/* void exec_while(struct s_while *node, struct s_42sh *sh); */ -/* void exec_until(struct s_while *node, struct s_42sh *sh); */ -/* void exec_and(struct s_op *node, struct s_42sh *sh); */ -/* void exec_or(struct s_op *node, struct s_42sh *sh); */ -/* void exec_cmd(struct s_cmd *node, struct s_42sh *sh); */ -/* void exec_pipe(struct s_op *node, struct s_42sh *sh); */ -/* void exec_bang(struct s_op *node, struct s_42sh *sh); */ -/* void exec_sepand(struct s_op *node, struct s_42sh *sh); */ -/* void exec_sepsemicolon(struct s_op *node, struct s_42sh *sh); */ -/* void exec_line(struct s_op *node, struct s_42sh *sh); */ -/* void exec_subshell(struct s_subshell *node, struct s_42sh *sh); */ +void exec_node(s_ast_node *node); +void exec_and(s_bin_node *node); +void exec_or(s_bin_node *node); +void exec_bang(s_bin_node *node); +void exec_if(s_if_node *node); +void exec_while(s_while_node *node); /* FIXME */ diff --git a/src/exec/exec_and.c b/src/exec/exec_and.c index ae82302..89eab82 100644 --- a/src/exec/exec_and.c +++ b/src/exec/exec_and.c @@ -5,14 +5,14 @@ ** Login ** ** Started on Sat Mar 25 15:27:20 2006 Seblu -** Last update Sun Nov 12 03:43:57 2006 seblu +** Last update Sun Nov 12 13:40:37 2006 seblu */ #include "exec.h" void exec_and(s_bin_node *node) { - assert(node && node->lhs && node->rhs); + assert(node); exec_node(node->lhs); //FIXME: error with chained "or" and "and" if (!shell->status) diff --git a/src/exec/exec_if.c b/src/exec/exec_if.c index cc871ec..a86664c 100644 --- a/src/exec/exec_if.c +++ b/src/exec/exec_if.c @@ -5,12 +5,12 @@ ** Login ** ** Started on Sat Mar 25 15:27:20 2006 Seblu -** Last update Sun Nov 12 03:45:42 2006 seblu +** Last update Sun Nov 12 13:11:02 2006 seblu */ #include "exec.h" -void exec_if(s_if_node *node) +void exec_if(s_if_node *node) { assert(node); exec_node(node->cond); diff --git a/src/exec/exec_node.c b/src/exec/exec_node.c index 0243999..65551f1 100644 --- a/src/exec/exec_node.c +++ b/src/exec/exec_node.c @@ -5,51 +5,29 @@ ** Login ** ** Started on Sat Mar 25 14:51:09 2006 Seblu -** Last update Tue Aug 29 00:19:35 2006 Seblu +** Last update Sun Nov 12 13:36:41 2006 seblu */ #include "exec.h" -/*! -** Execute a node of ast by calling the good function -** -** @param node node to execute -** @param sh shell struct -*/ void exec_node(s_ast_node *node) { - node = node; + if (node == NULL) + return; + switch (node->type) { + case T_SEP: break; + case T_SEPAND: break; + case T_CMD: break; + case T_RED: break; + case T_PIPE: break; + case T_AND: exec_and(&node->body.child_and); break; + case T_OR: exec_or(&node->body.child_or); break; + case T_IF: exec_if(&node->body.child_if); break; + case T_WHILE: exec_while(&node->body.child_while); break; + case T_BANG: exec_bang(&node->body.child_bang); break; + case T_SUBSHELL: break; + case T_FUNCDEC: break; + case T_CASE: break; + default: assert(0); + } } - -/* { */ -/* if (node == NULL) */ -/* return; */ -/* else if (node->type == T_CMD) */ -/* exec_cmd(&node->data.node_cmd, sh); */ -/* else if (node->type == T_PIPE) */ -/* exec_pipe(&node->data.node_op, sh); */ -/* else if (node->type == T_LINE) */ -/* exec_line(&node->data.node_op, sh); */ -/* else if (node->type == T_SEP_AND) */ -/* exec_sepand(&node->data.node_op, sh); */ -/* else if (node->type == T_SEP_SEMICOMMA) */ -/* exec_sepsemicolon(&node->data.node_op, sh); */ -/* else if (node->type == T_IF) */ -/* exec_if(&node->data.node_if, sh); */ -/* else if (node->type == T_FOR) */ -/* exec_for(&node->data.node_for, sh); */ -/* else if (node->type == T_AND) */ -/* exec_and(&node->data.node_op, sh); */ -/* else if (node->type == T_OR) */ -/* exec_or(&node->data.node_op, sh); */ -/* else if (node->type == T_WHILE) */ -/* exec_while(&node->data.node_while, sh); */ -/* else if (node->type == T_UNTIL) */ -/* exec_until(&node->data.node_while, sh); */ -/* else if (node->type == T_BANG) */ -/* exec_bang(&node->data.node_op, sh); */ -/* else if (node->type == T_SUBSHELL) */ -/* exec_subshell(&node->data.node_subshell, sh); */ -/* else */ -/* assert(0); */ -/* } */ diff --git a/src/exec/exec_or.c b/src/exec/exec_or.c index ec689be..6b6587b 100644 --- a/src/exec/exec_or.c +++ b/src/exec/exec_or.c @@ -5,14 +5,14 @@ ** Login ** ** Started on Sat Mar 25 15:27:20 2006 Seblu -** Last update Sun Nov 12 03:45:03 2006 seblu +** Last update Sun Nov 12 13:40:45 2006 seblu */ #include "exec.h" void exec_or(s_bin_node *node) { - assert(node && node->lhs && node->rhs); + assert(node); exec_node(node->lhs); //FIXME: error with chained "or" and "and" if (shell->status) -- GitLab