diff options
| author | Charles <sircharlesaze@gmail.com> | 2020-03-30 22:27:16 +0200 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2020-03-30 22:27:16 +0200 |
| commit | 941099778b59da6b904c284e8a82affe4766124b (patch) | |
| tree | 4457787a1b09408fcd1a5607109cc1c902c80af8 /include/ms_eval.h | |
| parent | 74787eefa2ac85d85b484d0ca5dffc6a2a13331d (diff) | |
| download | minishell-941099778b59da6b904c284e8a82affe4766124b.tar.gz minishell-941099778b59da6b904c284e8a82affe4766124b.tar.bz2 minishell-941099778b59da6b904c284e8a82affe4766124b.zip | |
Added doc
Diffstat (limited to 'include/ms_eval.h')
| -rw-r--r-- | include/ms_eval.h | 67 |
1 files changed, 46 insertions, 21 deletions
diff --git a/include/ms_eval.h b/include/ms_eval.h index 35e7355..12c2b7e 100644 --- a/include/ms_eval.h +++ b/include/ms_eval.h @@ -1,6 +1,11 @@ #ifndef MS_EVAL_H # define MS_EVAL_H +/** +** \file ms_eval.h +** \brief Evaluation module +*/ + /* ** arg: ** type ARG @@ -19,33 +24,53 @@ ** value fd */ -read state - if redir: - open file keep fd +/** +** \enum t_val_type +** \brief A type for an evaluation node +** +** \param VAL_ERR error +** \param VAL_ERR argument +** \param VAL_REDIR redirection +** \param VAL_SEXPR S-expression +*/ +typedef enum +{ + VAL_ERR, + VAL_ARG, + VAL_EXEC, + VAL_REDIR_IN, + VAL_REDIR_OUT, + VAL_REDIR_APPEND, + VAL_CMD, + VAL_SEXPR, +} t_val_type; + +/** +** \brief An evaluation node struct +** \param type type of node +** \param data union of possible data +** \param data::fd file descriptor for redirection node +** \param data::str string for error, arguments, command +*/ typedef struct { - t_status_type type; + t_val_type type; union { - char *str; - int code; - int fd; - } data; -} t_val; - - + char *str; + int code; + int fd; + } data; +} t_val; -typedef enum -{ - STYPE_ERROR, - STYPE_ARG, - STYPE_FILE, - STYPE_SEXPR, - // ... -} t_status_type; - -int ms_eval(t_path path, t_env env, t_ast *ast); +/** +** \brief evaluate an AST +** \param path path to commands executable +** \param env environment variables +** \param ast Abstract syntax tree to evaluate +*/ +int ms_eval(t_path path, t_env env, t_ast *ast); #endif |
