aboutsummaryrefslogtreecommitdiff
path: root/include/ms_eval.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/ms_eval.h')
-rw-r--r--include/ms_eval.h67
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