1 /* Various types of operations. Keeping things grouped nicely
2 * (unary,binary) makes switch() statements more efficient.
5 TO_NONOP
= 0, /* non-operator */
7 TO_STNZE
, TO_STZER
, TO_OPTION
,
10 TO_FILREG
, TO_FILBDEV
, TO_FILCDEV
, TO_FILSYM
, TO_FILFIFO
, TO_FILSOCK
,
11 TO_FILCDF
, TO_FILID
, TO_FILGID
, TO_FILSETG
, TO_FILSTCK
, TO_FILUID
,
12 TO_FILRD
, TO_FILGZ
, TO_FILTT
, TO_FILSETU
, TO_FILWR
, TO_FILEX
,
13 /* binary operators */
14 TO_STEQL
, TO_STNEQ
, TO_STLT
, TO_STGT
, TO_INTEQ
, TO_INTNE
, TO_INTGT
,
15 TO_INTGE
, TO_INTLT
, TO_INTLE
, TO_FILEQ
, TO_FILNT
, TO_FILOT
17 typedef enum Test_op Test_op
;
19 /* Used by Test_env.isa() (order important - used to index *_tokens[] arrays) */
22 TM_AND
, /* -a or && */
26 TM_UNOP
, /* unary operator */
27 TM_BINOP
, /* binary operator */
28 TM_END
/* end of input */
30 typedef enum Test_meta Test_meta
;
32 #define TEF_ERROR BIT(0) /* set if we've hit an error */
33 #define TEF_DBRACKET BIT(1) /* set if [[ .. ]] test */
35 typedef struct test_env Test_env
;
37 int flags
; /* TEF_* */
39 char **wp
; /* used by ptest_* */
40 XPtrV
*av
; /* used by dbtestp_* */
42 char **wp_end
; /* used by ptest_* */
43 int (*isa
)(Test_env
*, Test_meta
);
44 const char *(*getopnd
)(Test_env
*, Test_op
, int);
45 int (*eval
)(Test_env
*, Test_op
, const char *, const char *, int);
46 void (*error
)(Test_env
*, int, const char *);
49 Test_op
test_isop(Test_env
*, Test_meta
, const char *);
50 int test_eval(Test_env
*, Test_op
, const char *, const char *, int);
51 int test_parse(Test_env
*);