aboutsummaryrefslogtreecommitdiff
path: root/src/checker/checker.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/checker/checker.h')
-rw-r--r--src/checker/checker.h37
1 files changed, 11 insertions, 26 deletions
diff --git a/src/checker/checker.h b/src/checker/checker.h
index a6a2cc3..e6973b6 100644
--- a/src/checker/checker.h
+++ b/src/checker/checker.h
@@ -6,9 +6,10 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/01/18 10:16:12 by cacharle #+# #+# */
-/* Updated: 2020/01/18 10:51:42 by cacharle ### ########.fr */
+/* Updated: 2020/01/18 12:01:00 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
+#include <stdio.h>
#ifndef CHECKER_H
# define CHECKER_H
@@ -17,6 +18,11 @@
# include "common.h"
# include "libft.h"
+# define FLAG_ARG_A (1 << 0)
+# define FLAG_ARG_B (1 << 1)
+# define FLAG_ARG_A_B (1 << 2)
+# define FLAG_ARG_B_A (1 << 3)
+
typedef enum
{
STATUS_SUCCESS,
@@ -25,35 +31,13 @@ typedef enum
STATUS_EOF,
} t_status;
-typedef enum
-{
- ACTION_SA,
- ACTION_SB,
- ACTION_SS,
- ACTION_PA,
- ACTION_PB,
- ACTION_RA,
- ACTION_RB,
- ACTION_RR,
- ACTION_RRA,
- ACTION_RRB,
- ACTION_RRR,
- ACTION_ERROR,
- ACTION_EOF
-} t_action_id;
-
-
-
-# define FLAG_ARG_A (1 << 0)
-# define FLAG_ARG_B (1 << 1)
-# define FLAG_ARG_A_B (1 << 2)
-# define FLAG_ARG_B_A (1 << 3)
+# define ACTION_ID_BUF_SIZE 4
typedef char t_flag_arg;
typedef struct
{
- char *id;
+ const char *id;
t_flag_arg args;
union
{
@@ -64,7 +48,8 @@ typedef struct
t_status check(t_stack *a, t_stack *b);
t_status read_action(t_stack *a, t_stack *b);
-t_status exec_action(char *action_id, t_stack *a, t_stack *b);
+t_status exec_action(char action_id[ACTION_ID_BUF_SIZE],
+ t_stack *a, t_stack *b);
t_bool stack_sorted(t_stack *stack);
#endif