亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? arith.c

?? 手機嵌入式Linux下可用的busybox源碼
?? C
字號:
/* Copyright (c) 2001 Aaron Lehmann <aaronl@vitelus.com>      Permission is hereby granted, free of charge, to any person obtaining   a copy of this software and associated documentation files (the   "Software"), to deal in the Software without restriction, including   without limitation the rights to use, copy, modify, merge, publish,   distribute, sublicense, and/or sell copies of the Software, and to   permit persons to whom the Software is furnished to do so, subject to   the following conditions:      The above copyright notice and this permission notice shall be   included in all copies or substantial portions of the Software.      THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY   CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,   TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE   SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.*//* This is my infix parser/evaluator. It is optimized for size, intended * as a replacement for yacc-based parsers. However, it may well be faster * than a comparable parser writen in yacc. The supported operators are * listed in #defines below. Parens, order of operations, and error handling * are supported. This code is threadsafe. The exact expression format should * be that which POSIX specifies for shells. *//* The code uses a simple two-stack algorithm. See * http://www.onthenet.com.au/~grahamis/int2008/week02/lect02.html * for a detailed explaination of the infix-to-postfix algorithm on which * this is based (this code differs in that it applies operators immediately * to the stack instead of adding them to a queue to end up with an * expression). *//* To use the routine, call it with an expression string and error return * pointer *//* * Aug 24, 2001              Manuel Novoa III * * Reduced the generated code size by about 30% (i386) and fixed several bugs. * * 1) In arith_apply(): *    a) Cached values of *numptr and &(numptr[-1]). *    b) Removed redundant test for zero denominator. * * 2) In arith(): *    a) Eliminated redundant code for processing operator tokens by moving *       to a table-based implementation.  Also folded handling of parens *       into the table. *    b) Combined all 3 loops which called arith_apply to reduce generated *       code size at the cost of speed. * * 3) The following expressions were treated as valid by the original code: *       1()  ,    0!  ,    1 ( *3 )   . *    These bugs have been fixed by internally enclosing the expression in *    parens and then checking that all binary ops and right parens are *    preceded by a valid expression (NUM_TOKEN). * * Note: It may be desireable to replace Aaron's test for whitespace with * ctype's isspace() if it is used by another busybox applet or if additional * whitespace chars should be considered.  Look below the "#include"s for a * precompiler test. *//* * Aug 26, 2001              Manuel Novoa III * * Return 0 for null expressions.  Pointed out by vodz. * * Merge in Aaron's comments previously posted to the busybox list, * modified slightly to take account of my changes to the code. * * TODO: May want to allow access to variables in the arith code. *       This would: *       1) allow us to evaluate $A as 0 if A isn't set (although this *          would require changes to ash.c too). *       2) allow us to write expressions as $(( A + 2 )). *       This could be done using a callback function passed to the *       arith() function of by requiring such a function with fixed *       name as an extern. */#include <stdlib.h>#include <string.h>#include <ctype.h>#include <alloca.h>#include "libbb.h"/*  * Use "#if 1" below for Aaron's original test for whitespace. * Use "#if 0" for ctype's isspace(). * */#if 1#undef isspace#define isspace(arithval) \	(arithval == ' ' || arithval == '\n' || arithval == '\t')#endiftypedef char operator;/* An operator's token id is a bit of a bitfield. The lower 5 bits are the * precedence, and high 3 are an ID unique accross operators of that * precedence. The ID portion is so that multiple operators can have the * same precedence, ensuring that the leftmost one is evaluated first. * Consider * and /. */#define tok_decl(prec,id) (((id)<<5)|(prec))#define PREC(op) ((op)&0x1F)#define TOK_LPAREN tok_decl(0,0)#define TOK_OR tok_decl(1,0)#define TOK_AND tok_decl(2,0)#define TOK_BOR tok_decl(3,0)#define TOK_BXOR tok_decl(4,0)#define TOK_BAND tok_decl(5,0)#define TOK_EQ tok_decl(6,0)#define TOK_NE tok_decl(6,1)#define TOK_LT tok_decl(7,0)#define TOK_GT tok_decl(7,1)#define TOK_GE tok_decl(7,2)#define TOK_LE tok_decl(7,3)#define TOK_LSHIFT tok_decl(8,0)#define TOK_RSHIFT tok_decl(8,1)#define TOK_ADD tok_decl(9,0)#define TOK_SUB tok_decl(9,1)#define TOK_MUL tok_decl(10,0)#define TOK_DIV tok_decl(10,1)#define TOK_REM tok_decl(10,2)/* For now all unary operators have the same precedence, and that's used to * identify them as unary operators */#define UNARYPREC 14#define TOK_BNOT tok_decl(UNARYPREC,0)#define TOK_NOT tok_decl(UNARYPREC,1)#define TOK_UMINUS tok_decl(UNARYPREC,2)#define TOK_UPLUS tok_decl(UNARYPREC,3)#define TOK_NUM tok_decl(15,0)#define TOK_RPAREN tok_decl(15,1)#define TOK_ERROR  tok_decl(15,2)	/* just a place-holder really */#define ARITH_APPLY(op) arith_apply(op, numstack, &numstackptr)#define NUMPTR (*numstackptr)/* "applying" a token means performing it on the top elements on the integer * stack. For a unary operator it will only change the top element, but a * binary operator will pop two arguments and push a result */static short arith_apply(operator    op, long *numstack, long **numstackptr){	long numptr_val;	long *NUMPTR_M1;	if (NUMPTR == numstack) goto err; /* There is no operator that can work										 without arguments */	NUMPTR_M1 = NUMPTR - 1;	if (op == TOK_UMINUS)		*NUMPTR_M1 *= -1;	else if (op == TOK_NOT)		*NUMPTR_M1 = !(*NUMPTR_M1);	else if (op == TOK_BNOT)		*NUMPTR_M1 = ~(*NUMPTR_M1);	else if (op != TOK_UPLUS) {		/* Binary operators */	if (NUMPTR_M1 == numstack) goto err; /* ... and binary operators need two										   arguments */	numptr_val = *--NUMPTR;         /* ... and they pop one */		NUMPTR_M1 = NUMPTR - 1;	if (op == TOK_BOR)			*NUMPTR_M1 |= numptr_val;	else if (op == TOK_OR)			*NUMPTR_M1 = numptr_val || *NUMPTR_M1;	else if (op == TOK_BAND)			*NUMPTR_M1 &= numptr_val;	else if (op == TOK_AND)			*NUMPTR_M1 = *NUMPTR_M1 && numptr_val;	else if (op == TOK_EQ)			*NUMPTR_M1 = (*NUMPTR_M1 == numptr_val);	else if (op == TOK_NE)			*NUMPTR_M1 = (*NUMPTR_M1 != numptr_val);	else if (op == TOK_GE)			*NUMPTR_M1 = (*NUMPTR_M1 >= numptr_val);	else if (op == TOK_RSHIFT)			*NUMPTR_M1 >>= numptr_val;	else if (op == TOK_LSHIFT)			*NUMPTR_M1 <<= numptr_val;	else if (op == TOK_GT)			*NUMPTR_M1 = (*NUMPTR_M1 > numptr_val);	else if (op == TOK_LT)			*NUMPTR_M1 = (*NUMPTR_M1 < numptr_val);	else if (op == TOK_LE)			*NUMPTR_M1 = (*NUMPTR_M1 <= numptr_val);	else if (op == TOK_MUL)			*NUMPTR_M1 *= numptr_val;	else if (op == TOK_ADD)			*NUMPTR_M1 += numptr_val;	else if (op == TOK_SUB)			*NUMPTR_M1 -= numptr_val;	else if(numptr_val==0)          /* zero divisor check */			return -2;	else if (op == TOK_DIV)			*NUMPTR_M1 /= numptr_val;	else if (op == TOK_REM)			*NUMPTR_M1 %= numptr_val;		/* WARNING!!!  WARNING!!!  WARNING!!! */		/* Any new operators should be added BEFORE the zero divisor check! */	}	return 0;err: return(-1);}static const char endexpression[] = ")";/* + and - (in that order) must be last */static const char op_char[] = "!<>=|&*/%~()+-";static const char op_token[] = {	/* paired with equal */	TOK_NE, TOK_LE, TOK_GE,	/* paired with self -- note: ! is special-cased below*/	TOK_ERROR, TOK_LSHIFT, TOK_RSHIFT, TOK_EQ, TOK_OR, TOK_AND,	/* singles */	TOK_NOT, TOK_LT, TOK_GT, TOK_ERROR, TOK_BOR, TOK_BAND,	TOK_MUL, TOK_DIV, TOK_REM, TOK_BNOT, TOK_LPAREN, TOK_RPAREN,	TOK_ADD, TOK_SUB, TOK_UPLUS, TOK_UMINUS};#define NUM_PAIR_EQUAL  3#define NUM_PAIR_SAME   6extern long arith (const char *expr, int *errcode){	register char arithval;	/* Current character under analysis */	operator    lasttok, op;	unsigned char prec;	const char *p = endexpression;	size_t datasizes = strlen(expr) + 2;	/* Stack of integers */	/* The proof that there can be no more than strlen(startbuf)/2+1 integers	 * in any given correct or incorrect expression is left as an excersize to	 * the reader. */	long *numstack = alloca(((datasizes)/2)*sizeof(long)),		*numstackptr = numstack;	/* Stack of operator tokens */	operator *stack = alloca((datasizes) * sizeof(operator)),		*stackptr = stack;	*numstack = 0;	*stackptr++ = lasttok = TOK_LPAREN;     /* start off with a left paren */  loop:	if ((arithval = *expr) == 0) {		if (p == endexpression) { /* Null expression. */			*errcode = 0;			return *numstack;		}		/* This is only reached after all tokens have been extracted from the		 * input stream. If there are still tokens on the operator stack, they		 * are to be applied in order. At the end, there should be a final		 * result on the integer stack */		if (expr != endexpression + 1) {	/* If we haven't done so already, */			expr = endexpression;	/* append a closing right paren */			goto loop;	/* and let the loop process it. */		}		/* At this point, we're done with the expression. */		if (numstackptr != numstack+1) {/* ... but if there isn't, it's bad */		  err:			return (*errcode = -1);			/* NOTREACHED */		}		return *numstack;	} else {		/* Continue processing the expression.  */		if (isspace(arithval)) {			goto prologue;          /* Skip whitespace */		}		if ((unsigned)arithval-'0' <= 9) /* isdigit */ {			*numstackptr++ = strtol(expr, (char **) &expr, 10);			lasttok = TOK_NUM;			goto loop;		}#if 1		if ((p = strchr(op_char, arithval)) == NULL) {			goto err;		}#else	    for ( p=op_char ; *p != arithval ; p++ ) {			if (!*p) {				goto err;			}		}#endif		p = op_token + (int)(p - op_char);		++expr;		if ((p >= op_token + NUM_PAIR_EQUAL) || (*expr != '=')) {			p += NUM_PAIR_EQUAL;			if ((p >= op_token + NUM_PAIR_SAME + NUM_PAIR_EQUAL)				|| (*expr != arithval) || (arithval == '!')) {				--expr;				if (arithval == '=') { /* single = */					goto err;				}				p += NUM_PAIR_SAME;				/* Plus and minus are binary (not unary) _only_ if the last				 * token was as number, or a right paren (which pretends to be				 * a number, since it evaluates to one). Think about it.				 * It makes sense. */				if ((lasttok != TOK_NUM)					&& (p >= op_token + NUM_PAIR_SAME + NUM_PAIR_EQUAL						+ sizeof(op_char) - 2)) {					p += 2; /* Unary plus or minus */				}			}		}		op = *p;		/* We don't want a unary operator to cause recursive descent on the		 * stack, because there can be many in a row and it could cause an		 * operator to be evaluated before its argument is pushed onto the		 * integer stack. */		/* But for binary operators, "apply" everything on the operator		 * stack until we find an operator with a lesser priority than the		 * one we have just extracted. */		/* Left paren is given the lowest priority so it will never be		 * "applied" in this way */		prec = PREC(op);		if ((prec > 0) && (prec != UNARYPREC)) { /* not left paren or unary */			if (lasttok != TOK_NUM) { /* binary op must be preceded by a num */				goto err;			}			while (stackptr != stack) {				if (op == TOK_RPAREN) {					/* The algorithm employed here is simple: while we don't					 * hit an open paren nor the bottom of the stack, pop					 * tokens and apply them */					if (stackptr[-1] == TOK_LPAREN) {						--stackptr;						lasttok = TOK_NUM; /* Any operator directly after a */						/* close paren should consider itself binary */						goto prologue;					}				} else if (PREC(stackptr[-1]) < prec) {					break;				}				*errcode = ARITH_APPLY(*--stackptr);				if(*errcode) return *errcode;			}			if (op == TOK_RPAREN) {				goto err;			}		}		/* Push this operator to the stack and remember it. */		*stackptr++ = lasttok = op;	  prologue:		++expr;		goto loop;	}}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91在线观看一区二区| 精品理论电影在线| 日韩欧美成人激情| 国产精品久久久久影视| 日韩专区一卡二卡| 91一区二区在线| 久久麻豆一区二区| 蜜桃一区二区三区在线观看| 91免费国产在线| 精品av综合导航| 五月激情综合网| 色偷偷88欧美精品久久久| 久久精品人人做| 另类的小说在线视频另类成人小视频在线 | 国产欧美日韩三区| 免费观看日韩av| 欧美精三区欧美精三区| 亚洲桃色在线一区| 成av人片一区二区| 国产精品三级电影| 粉嫩久久99精品久久久久久夜| 欧美大片国产精品| 免费的国产精品| 在线电影欧美成精品| 日日夜夜免费精品| 5566中文字幕一区二区电影| 天天爽夜夜爽夜夜爽精品视频| 在线观看亚洲a| 亚洲已满18点击进入久久| 日本久久电影网| 亚洲激情网站免费观看| 日本乱人伦一区| 亚洲成人免费看| 欧美三级电影在线观看| 午夜精品一区在线观看| 91精品国产91热久久久做人人| 五月天久久比比资源色| 91精品国产高清一区二区三区| 免费xxxx性欧美18vr| 日韩美女主播在线视频一区二区三区| 日本中文字幕不卡| 欧美不卡激情三级在线观看| 国产伦精一区二区三区| 国产精品久久久久久久久久免费看| 成人免费视频免费观看| 日韩理论片网站| 欧美三区免费完整视频在线观看| 亚洲国产精品人人做人人爽| 91精品国产综合久久香蕉麻豆| 日韩vs国产vs欧美| 久久先锋影音av| jlzzjlzz亚洲日本少妇| 性久久久久久久久| 精品国产乱码91久久久久久网站| 国产在线看一区| 亚洲蜜桃精久久久久久久| 欧美乱妇23p| 国产一区二区久久| 亚洲女人的天堂| 91精品综合久久久久久| 国产福利一区在线观看| 最新中文字幕一区二区三区| 欧美三级在线视频| 国产美女久久久久| 亚洲综合一区二区精品导航| 日韩三级视频在线看| 99久久99久久精品免费看蜜桃| 亚洲福中文字幕伊人影院| 国产色综合久久| 欧美裸体bbwbbwbbw| 国产不卡免费视频| 亚洲一二三专区| 国产丝袜在线精品| 欧美日韩中文国产| av中文一区二区三区| 亚洲bdsm女犯bdsm网站| 国产精品沙发午睡系列990531| 欧美日韩电影一区| 成人免费高清视频在线观看| 亚洲成av人综合在线观看| 国产欧美一区二区精品久导航| 欧美三级视频在线| 91在线码无精品| 久久99久久99小草精品免视看| 一区二区三区在线视频免费| 国产日韩欧美高清在线| 在线播放国产精品二区一二区四区 | 日韩影院免费视频| 综合在线观看色| 久久精品水蜜桃av综合天堂| 欧美蜜桃一区二区三区| 91日韩一区二区三区| 国产成人aaaa| 久久99精品久久久久| 五月激情综合网| 亚洲一卡二卡三卡四卡无卡久久| 中文字幕av不卡| 国产亚洲精品精华液| 精品国产1区2区3区| 91精品国产日韩91久久久久久| 91老师片黄在线观看| 成人永久免费视频| 丁香网亚洲国际| 国产精品乡下勾搭老头1| 久久99国产精品久久99果冻传媒| 天天影视网天天综合色在线播放| 一二三区精品视频| 夜夜亚洲天天久久| 一区二区三区四区在线播放| 亚洲欧美一区二区三区久本道91 | 日韩视频一区在线观看| 在线综合亚洲欧美在线视频| 欧美日韩精品一区二区在线播放 | 91豆麻精品91久久久久久| 99久久精品免费看国产免费软件| 国产精品77777| 国产精品影视在线| 国产.欧美.日韩| 成人免费视频网站在线观看| av电影在线观看不卡| 97久久精品人人爽人人爽蜜臀| 色综合天天综合网天天狠天天| 成人avav影音| 色悠久久久久综合欧美99| 91久久精品国产91性色tv | 久久综合精品国产一区二区三区| 精品国产伦一区二区三区观看方式| 精品粉嫩超白一线天av| 久久久久久久久久久久久久久99 | 精品av综合导航| 中文字幕精品在线不卡| 一区二区三区四区乱视频| 亚洲一区二区不卡免费| 久久er99精品| 东方aⅴ免费观看久久av| 欧美午夜片在线观看| 日韩午夜激情av| 国产欧美中文在线| 亚洲精品久久7777| 另类调教123区| 99久久精品国产网站| 欧美精品一二三四| 久久人人爽人人爽| 一区二区三区加勒比av| 日产国产欧美视频一区精品| 成人午夜视频网站| 在线播放/欧美激情| 26uuu久久天堂性欧美| 夜夜嗨av一区二区三区网页| 奇米色777欧美一区二区| 国产成人鲁色资源国产91色综| 色婷婷一区二区三区四区| 日韩欧美一级在线播放| 中文字幕一区二区5566日韩| 日本三级亚洲精品| 成人在线一区二区三区| 欧美一级理论性理论a| 国产精品久久一卡二卡| 日韩av不卡在线观看| 99精品在线免费| 欧美mv和日韩mv的网站| 一区二区三区高清不卡| 国产精品一区二区视频| 欧美日韩国产综合一区二区| 欧美国产97人人爽人人喊| 蜜桃一区二区三区在线| 91免费看`日韩一区二区| 久久久777精品电影网影网| 丝瓜av网站精品一区二区| a美女胸又www黄视频久久| 亚洲精品在线三区| 日韩高清在线不卡| 色欧美片视频在线观看| 国产欧美日产一区| 久久疯狂做爰流白浆xx| 欧美伦理电影网| 一区二区三区**美女毛片| aaa欧美大片| 国产女主播一区| 国产美女视频91| 久久久亚洲精品一区二区三区 | 国产成a人无v码亚洲福利| 欧美一区二区福利在线| 午夜精品一区二区三区免费视频 | 青青草国产精品97视觉盛宴| 色综合久久88色综合天天6 | 日韩av中文字幕一区二区| 色一区在线观看| 亚洲日本护士毛茸茸| 成人a免费在线看| 中文字幕免费在线观看视频一区| 国产乱子伦视频一区二区三区| 精品国产露脸精彩对白| 毛片不卡一区二区| 91精品国产色综合久久不卡电影 | 国产成人av一区二区三区在线| 精品三级在线观看| 韩国一区二区三区| 久久久久国产精品麻豆ai换脸 | 欧美一区在线视频|