#ifndef	ACL_TEST_STRUCT_INCLUDE_H
#define	ACL_TEST_STRUCT_INCLUDE_H

# ifdef	__cplusplus
extern "C" {
# endif

#include "../stdlib/acl_array.h"

typedef struct AUT_LINE {
	char  cmd_name[128];	/*  */
	int   result;		/* ִн */
	int   argc;		/*  */
	ACL_ARRAY *argv;	/* б */
	char *args_str;		/* бı */
	int   valid_line_idx;	/* ЧЧек */
	int   line_number;	/* Чļек */
	void *arg_inner;	/* ڲעԼĲýṹ */
	void (*free_arg_inner)(void*);
	void *arg_outer;	/* ⲿӦעԼĲýṹ */
	int   obj_type;		/* ڲⲿ־λ,
				 * defined as: AUT_OBJ_
				 */
} AUT_LINE;

typedef int (*AUT_FN) (AUT_LINE *test_line, void *arg);

/**
 * ˵: Ԫõһµݽṹ
 */
typedef struct AUT_FN_ITEM {
	const char *cmd_name;		/*  */
	const char *fn_name;		/*  */
	AUT_FN fn_callback;		/* ûص */
	void *arg;			/* ԻصõĲ */
	int   inner;			/* Ƿڲ */
} AUT_FN_ITEM;

/* ڲݽṹ */
typedef struct {
	char *name;
	char *value;
} AUT_ARG_ITEM;

typedef struct {
	int match_number;		/* ɶ໥ƥ,
					 * : loop_begin  loop_end ֮
					 * ԷǳɶԵЧ, :
					 * stop .
					 */
	AUT_LINE *peer;			/* ЧгɶԵһ */
	int flag;			/* define as: AUT_FLAG_ */
	int status;			/* define as: AUT_STAT_ */
	int valid_line_idx;		/* Че±λ */

	/* ˽Ͷ */
	/* ѭִ */
	int nloop_max;			/* ѭ, ļл */
	int nloop_cur;			/* ǰѭĴ */
	int offset_valid_line_idx;	/* Ч± */
	int loop_sleep;			/* ѭִʱϢ */
} AUT_CMD_TOKEN;

#define	AUT_OBJ_OUTER		0	/* ĬΪⲿ */
#define	AUT_OBJ_INNER		1	/* Ϊڲ */

#define	AUT_FLAG_LOOP_BEGIN	1
#define	AUT_FLAG_LOOP_BREAK	2
#define	AUT_FLAG_LOOP_CONTINUE	3
#define	AUT_FLAG_LOOP_END	4

#define	AUT_FLAG_IF		5
#define	AUT_FLAG_ELSE		6
#define	AUT_FLAG_ELIF		7
#define	AUT_FLAG_ENDIF		8

#define	AUT_FLAG_STOP		9

#define	AUT_STAT_FREE		0
#define	AUT_STAT_BUSY		1


#define	AUT_LOOP_BREAK			-100

#define	VAR_AUT_LOG_PRINT	0x0001
#define	VAR_AUT_LOG_FPRINT	0x0010

/* ļеĹؼ */
/* ־¼ */
#define	VAR_AUT_LOG			"LOG"

/* ִֹͣ־λ */
#define	VAR_AUT_STOP			"STOP"

/* Ϣ־λ */
#define	VAR_AUT_SLEEP			"SLEEP"

/* ͣ־λ */
#define	VAR_AUT_PAUSE			"PAUSE"

/* ѭִпʼ־λ */
#define	VAR_AUT_LOOP_BEGIN		"LOOP_BEGIN"

/* ѭִֹͣ־λ */
#define	VAR_AUT_LOOP_END		"LOOP_END"

/* ѭִ */
#define	VAR_AUT_LOOP_BREAK		"LOOP_BREAK"

/* ѭ */
#define	VAR_AUT_LOOP_CONTINUE		"LOOP_CONTINUE"

/* жϿʼ */
#define	VAR_AUT_IF			"IF"

/* ж else  */
#define	VAR_AUT_ELSE			"ELSE"

/* жϽ */
#define	VAR_AUT_ENDIF			"ENDIF"

/* תִ */
#define	VAR_AUT_GOTO			"GOTO"

/*----------------- ڲһЩļ -----------------------------*/
/**
 * ͨõֵ:
 *
 *  VAR_AUT_SLEEP ʾΪϢֵ;
 *  VAR_AUT_LOOP_BEGIN ʾѭĴ
 */

#define	VAR_AUT_ITEM_COUNT		"COUNT"


# ifdef	__cplusplus
}
# endif

#endif

