⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 yystack.h

📁 compiler
💻 H
字号:
/*@A (C) 1992 Allen I. Holub                                                */

#ifndef __YYSTACK_H
#define __YYSTACK_H
/* yystack.h	Stack-maintenance macros --- yacc and llama version.
 */

#define yystk_cls    /* empty */

#define yystk_dcl(stack,type,size)  typedef type yyt_##stack;		    \
				    yystk_cls yyt_##stack stack[size];      \
				    yystk_cls yyt_##stack (*yyp_##stack)    \
							    = stack + (size)
#define yystk_clear(stack) (  (yyp_##stack)  = (stack + \
						sizeof(stack)/sizeof(*stack)) )

#define yystk_full(stack)  (  (yyp_##stack) <= stack )
#define yystk_empty(stack) (  (yyp_##stack) >= (stack + \
						sizeof(stack)/sizeof(*stack)) )

#define yystk_ele(stack)   ((sizeof(stack)/sizeof(*stack)) - \
							(yyp_##stack-stack))

#define yystk_item(stack,offset) ( *(yyp_##stack + (offset)) )
#define yystk_p(stack)	   	 yyp_##stack

#define yypush_(stack,x) ( *--yyp_##stack = (x)	)
#define yypop_(stack)	 ( *yyp_##stack++	)

#define yypush(stack,x)    ( yystk_full(stack)				\
				? ((yyt_##stack)(long)(yystk_err(1)))  	\
			        : yypush_(stack,x) 			)

#define yypop(stack)       ( yystk_empty(stack)				\
				? ((yyt_##stack)(long)(yystk_err(0)))	\
			        : yypop_(stack)				)

#define yypopn_(stack,amt) ( (yyp_##stack += amt)[-amt]  )
#define yypopn( stack,amt) ( (yystk_ele(stack) < amt)			\
				? ((yyt_##stack)(long)(yystk_err(0)))	\
			        : yypopn_(stack,amt)			)

#define yystk_err(o)	   ((o) ? ferr("Stack overflow\n" ) \
			        : ferr("Stack underflow\n") )
#endif /* __YYSTACK_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -