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

📄 tclcompexpr.c

📁 linux系统下的音频通信
💻 C
📖 第 1 页 / 共 5 页
字号:
    result = CompileBitXorExpr(interp, infoPtr, flags, envPtr);    if (result != TCL_OK) {	goto done;    }    maxDepth = envPtr->maxStackDepth;        while (infoPtr->token == BIT_OR) {	infoPtr->hasOperators = 1;	infoPtr->exprIsJustVarRef = 0;	result = GetToken(interp, infoPtr, envPtr); /* skip over the '|' */	if (result != TCL_OK) {	    goto done;	}	result = CompileBitXorExpr(interp, infoPtr, flags, envPtr);	if (result != TCL_OK) {	    goto done;	}	maxDepth = TclMax((envPtr->maxStackDepth + 1), maxDepth);		TclEmitOpcode(INST_BITOR, envPtr);	/*	 * A comparison is not the top-level operator in this expression.	 */	infoPtr->exprIsComparison = 0;    }    done:    envPtr->maxStackDepth = maxDepth;    return result;}/* *---------------------------------------------------------------------- * * CompileBitXorExpr -- * *	This procedure compiles a Tcl bitwise exclusive or expression: *	bitXorExpr ::= bitAndExpr {'^' bitAndExpr} * * Results: *	The return value is TCL_OK on a successful compilation and TCL_ERROR *	on failure. If TCL_ERROR is returned, then the interpreter's result *	contains an error message. * *	envPtr->maxStackDepth is updated with the maximum number of stack *	elements needed to execute the expression. * * Side effects: *	Adds instructions to envPtr to evaluate the expression at runtime. * *---------------------------------------------------------------------- */static intCompileBitXorExpr(interp, infoPtr, flags, envPtr)    Tcl_Interp *interp;		/* Used for error reporting. */    ExprInfo *infoPtr;		/* Describes the compilation state for the				 * expression being compiled. */    int flags;			/* Flags to control compilation (same as				 * passed to Tcl_Eval). */    CompileEnv *envPtr;		/* Holds resulting instructions. */{    int maxDepth = 0;		/* Maximum number of stack elements needed				 * to execute the expression. */    int result;    HERE("bitXorExpr", 5);    result = CompileBitAndExpr(interp, infoPtr, flags, envPtr);    if (result != TCL_OK) {	goto done;    }    maxDepth = envPtr->maxStackDepth;        while (infoPtr->token == BIT_XOR) {	infoPtr->hasOperators = 1;	infoPtr->exprIsJustVarRef = 0;	result = GetToken(interp, infoPtr, envPtr); /* skip over the '^' */	if (result != TCL_OK) {	    goto done;	}	result = CompileBitAndExpr(interp, infoPtr, flags, envPtr);	if (result != TCL_OK) {	    goto done;	}	maxDepth = TclMax((envPtr->maxStackDepth + 1), maxDepth);		TclEmitOpcode(INST_BITXOR, envPtr);	/*	 * A comparison is not the top-level operator in this expression.	 */	infoPtr->exprIsComparison = 0;    }    done:    envPtr->maxStackDepth = maxDepth;    return result;}/* *---------------------------------------------------------------------- * * CompileBitAndExpr -- * *	This procedure compiles a Tcl bitwise and expression: *	bitAndExpr ::= equalityExpr {'&' equalityExpr} * * Results: *	The return value is TCL_OK on a successful compilation and TCL_ERROR *	on failure. If TCL_ERROR is returned, then the interpreter's result *	contains an error message. * *	envPtr->maxStackDepth is updated with the maximum number of stack *	elements needed to execute the expression. * * Side effects: *	Adds instructions to envPtr to evaluate the expression at runtime. * *---------------------------------------------------------------------- */static intCompileBitAndExpr(interp, infoPtr, flags, envPtr)    Tcl_Interp *interp;		/* Used for error reporting. */    ExprInfo *infoPtr;		/* Describes the compilation state for the				 * expression being compiled. */    int flags;			/* Flags to control compilation (same as				 * passed to Tcl_Eval). */    CompileEnv *envPtr;		/* Holds resulting instructions. */{    int maxDepth = 0;		/* Maximum number of stack elements needed				 * to execute the expression. */    int result;    HERE("bitAndExpr", 6);    result = CompileEqualityExpr(interp, infoPtr, flags, envPtr);    if (result != TCL_OK) {	goto done;    }    maxDepth = envPtr->maxStackDepth;        while (infoPtr->token == BIT_AND) {	infoPtr->hasOperators = 1;	infoPtr->exprIsJustVarRef = 0;	result = GetToken(interp, infoPtr, envPtr); /* skip over the '&' */	if (result != TCL_OK) {	    goto done;	}	result = CompileEqualityExpr(interp, infoPtr, flags, envPtr);	if (result != TCL_OK) {	    goto done;	}	maxDepth = TclMax((envPtr->maxStackDepth + 1), maxDepth);		TclEmitOpcode(INST_BITAND, envPtr);	/*	 * A comparison is not the top-level operator in this expression.	 */	infoPtr->exprIsComparison = 0;    }    done:    envPtr->maxStackDepth = maxDepth;    return result;}/* *---------------------------------------------------------------------- * * CompileEqualityExpr -- * *	This procedure compiles a Tcl equality (inequality) expression: *	equalityExpr ::= relationalExpr {('==' | '!=') relationalExpr} * * Results: *	The return value is TCL_OK on a successful compilation and TCL_ERROR *	on failure. If TCL_ERROR is returned, then the interpreter's result *	contains an error message. * *	envPtr->maxStackDepth is updated with the maximum number of stack *	elements needed to execute the expression. * * Side effects: *	Adds instructions to envPtr to evaluate the expression at runtime. * *---------------------------------------------------------------------- */static intCompileEqualityExpr(interp, infoPtr, flags, envPtr)    Tcl_Interp *interp;		/* Used for error reporting. */    ExprInfo *infoPtr;		/* Describes the compilation state for the				 * expression being compiled. */    int flags;			/* Flags to control compilation (same as				 * passed to Tcl_Eval). */    CompileEnv *envPtr;		/* Holds resulting instructions. */{    int maxDepth = 0;		/* Maximum number of stack elements needed				 * to execute the expression. */    int op, result;    HERE("equalityExpr", 7);    result = CompileRelationalExpr(interp, infoPtr, flags, envPtr);    if (result != TCL_OK) {	goto done;    }    maxDepth = envPtr->maxStackDepth;    op = infoPtr->token;    while ((op == EQUAL) || (op == NEQ)) {	infoPtr->hasOperators = 1;	infoPtr->exprIsJustVarRef = 0;	result = GetToken(interp, infoPtr, envPtr); /* skip over == or != */	if (result != TCL_OK) {	    goto done;	}	result = CompileRelationalExpr(interp, infoPtr, flags, envPtr);	if (result != TCL_OK) {	    goto done;	}	maxDepth = TclMax((envPtr->maxStackDepth + 1), maxDepth);	if (op == EQUAL) {	    TclEmitOpcode(INST_EQ, envPtr);	} else {	    TclEmitOpcode(INST_NEQ, envPtr);	}		op = infoPtr->token;	/*	 * A comparison _is_ the top-level operator in this expression.	 */		infoPtr->exprIsComparison = 1;    }    done:    envPtr->maxStackDepth = maxDepth;    return result;}/* *---------------------------------------------------------------------- * * CompileRelationalExpr -- * *	This procedure compiles a Tcl relational expression: *	relationalExpr ::= shiftExpr {('<' | '>' | '<=' | '>=') shiftExpr} * * Results: *	The return value is TCL_OK on a successful compilation and TCL_ERROR *	on failure. If TCL_ERROR is returned, then the interpreter's result *	contains an error message. * *	envPtr->maxStackDepth is updated with the maximum number of stack *	elements needed to execute the expression. * * Side effects: *	Adds instructions to envPtr to evaluate the expression at runtime. * *---------------------------------------------------------------------- */static intCompileRelationalExpr(interp, infoPtr, flags, envPtr)    Tcl_Interp *interp;		/* Used for error reporting. */    ExprInfo *infoPtr;		/* Describes the compilation state for the				 * expression being compiled. */    int flags;			/* Flags to control compilation (same as				 * passed to Tcl_Eval). */    CompileEnv *envPtr;		/* Holds resulting instructions. */{    int maxDepth = 0;		/* Maximum number of stack elements needed				 * to execute the expression. */    int op, result;    HERE("relationalExpr", 8);    result = CompileShiftExpr(interp, infoPtr, flags, envPtr);    if (result != TCL_OK) {	goto done;    }    maxDepth = envPtr->maxStackDepth;    op = infoPtr->token;    while ((op == LESS) || (op == GREATER) || (op == LEQ) || (op == GEQ)) {	infoPtr->hasOperators = 1;	infoPtr->exprIsJustVarRef = 0;	result = GetToken(interp, infoPtr, envPtr); /* skip over the op */	if (result != TCL_OK) {	    goto done;	}	result = CompileShiftExpr(interp, infoPtr, flags, envPtr);	if (result != TCL_OK) {	    goto done;	}	maxDepth = TclMax((envPtr->maxStackDepth + 1), maxDepth);	switch (op) {	case LESS:	    TclEmitOpcode(INST_LT, envPtr);	    break;	case GREATER:	    TclEmitOpcode(INST_GT, envPtr);	    break;	case LEQ:	    TclEmitOpcode(INST_LE, envPtr);	    break;	case GEQ:	    TclEmitOpcode(INST_GE, envPtr);	    break;	}	op = infoPtr->token;	/*	 * A comparison _is_ the top-level operator in this expression.	 */		infoPtr->exprIsComparison = 1;    }    done:    envPtr->maxStackDepth = maxDepth;    return result;}/* *---------------------------------------------------------------------- * * CompileShiftExpr -- * *	This procedure compiles a Tcl shift expression: *	shiftExpr ::= addExpr {('<<' | '>>') addExpr} * * Results: *	The return value is TCL_OK on a successful compilation and TCL_ERROR *	on failure. If TCL_ERROR is returned, then the interpreter's result *	contains an error message. * *	envPtr->maxStackDepth is updated with the maximum number of stack *	elements needed to execute the expression. * * Side effects: *	Adds instructions to envPtr to evaluate the expression at runtime. * *---------------------------------------------------------------------- */static intCompileShiftExpr(interp, infoPtr, flags, envPtr)    Tcl_Interp *interp;		/* Used for error reporting. */    ExprInfo *infoPtr;		/* Describes the compilation state for the				 * expression being compiled. */    int flags;			/* Flags to control compilation (same as				 * passed to Tcl_Eval). */    CompileEnv *envPtr;		/* Holds resulting instructions. */{    int maxDepth = 0;		/* Maximum number of stack elements needed				 * to execute the expression. */    int op, result;    HERE("shiftExpr", 9);    result = CompileAddExpr(interp, infoPtr, flags, envPtr);    if (result != TCL_OK) {	goto done;    }    maxDepth = envPtr->maxStackDepth;    op = infoPtr->token;    while ((op == LEFT_SHIFT) || (op == RIGHT_SHIFT)) {	infoPtr->hasOperators = 1;	infoPtr->exprIsJustVarRef = 0;	result = GetToken(interp, infoPtr, envPtr); /* skip over << or >> */	if (result != TCL_OK) {	    goto done;	}	result = CompileAddExpr(interp, infoPtr, flags, envPtr);	if (result != TCL_OK) {	    goto done;	}	maxDepth = TclMax((envPtr->maxStackDepth + 1), maxDepth);	if (op == LEFT_SHIFT) {	    TclEmitOpcode(INST_LSHIFT, envPtr);	} else {	    TclEmitOpcode(INST_RSHIFT, envPtr);	}	op = infoPtr->token;	/*	 * A comparison is not the top-level operator in this expression.	 */	infoPtr->exprIsComparison = 0;    }    done:    envPtr->maxStackDepth = maxDepth;    return result;}/* *---------------------------------------------------------------------- * * CompileAddExpr -- * *	This procedure compiles a Tcl addition expression: *	addExpr ::= multiplyExpr {('+' | '-') multiplyExpr} * * Results: *	The return value is TCL_OK on a successful compilation and TCL_ERROR *	on failure. If TCL_ERROR is returned, then the interpreter's result *	contains an error message. * *	envPtr->maxStackDepth is updated with the maximum number of stack *	elements needed to execute the expression. * * Side effects: *	Adds instructions to envPtr to evaluate the expression at runtime. * *---------------------------------------------------------------------- */static intCompileAddExpr(interp, infoPtr, flags, envPtr)    Tcl_Interp *interp;		/* Used for error reporting. */    ExprInfo *infoPtr;		/* Describes the compilation state for the				 * expression being compiled. */    int flags;			/* Flags to control compilation (same as				 * passed to Tcl_Eval). */    CompileEnv *envPtr;		/* Holds resulting instructions. */{    int maxDepth = 0;		/* Maximum number of stack elements needed				 * to execute the expression. */    int op, result;

⌨️ 快捷键说明

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