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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? engine.cpp

?? 嵌入式Qt下的一個計算器源碼
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
/******************************************************************************** Copyright (C) 2000-2006 TROLLTECH ASA. All rights reserved.**** This file is part of the Phone Edition of the Qtopia Toolkit.**** Licensees holding a valid license agreement from Trolltech or any of its** authorized distributors may use this file in accordance with** the License Agreement provided with the Licensed Software.**** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for**   information about Trolltech's Commercial License Agreements.**** Contact info@trolltech.com if any conditions of this licensing are** not clear to you.********** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.******************************************************************************/#include <qtopia/qtopiaapplication.h>#include "engine.h"#include "doubleinstruction.h"#ifdef ENABLE_FRACTION#include "fractioninstruction.h"#endif#ifdef ENABLE_INTEGER#include "integerinstruction.h"#endif// Bracesclass iBraceOpen:public Instruction {public:    iBraceOpen():Instruction() {	name = "Open brace"; // No tr	precedence = 0;	displayString = "("; // No tr	argCount = 0;    };    ~iBraceOpen(){};    void eval(){ systemEngine->incBraceCount(); };};class iBraceOpenImpl:public Instruction {public:    iBraceOpenImpl():Instruction() {	name = "Open brace impl"; // No tr	precedence = 1;	displayString = "("; // No tr	argCount = 0;    };    ~iBraceOpenImpl(){};    void eval(){};};void Engine::openBrace () {    if (state == sError)	return;#ifdef QTOPIA_PHONE    if (!Qtopia::mousePreferred())        // prevents crash when x-y*(...) is entered => calc is not entirely correct        if (state == sAppend)	    return;#endif    pushInstruction("Open brace"); // No tr    if (state != sError)	changeState(sStart);}void Engine::closeBrace () {    if (braceCount) {	if (state == sStart) // this might be wrong here...	    executeInstructionOnStack("Factory"); // No tr	doEvalStack(0,true);	//braceCount--;    }}// Engine classEngine::Engine():QObject() {    // Variable initialisation    state = sAppend;    changeResetState(drNone);    mem = recoveredDStack = 0;    kDesc = 0;    lcd = 0;    memMark = kMark = 0;    braceCount = previousInstructionsPrecedence = 0;    currentType = wantedType = "NONE"; // No tr    // Register the common instructions    // System instructions - null, open/close braces    Instruction *da = new Instruction();    registerInstruction(da);    da = new iBraceOpen();    registerInstruction(da);    da = new iBraceOpenImpl();    registerInstruction(da);    if (Qtopia::mousePreferred()) {        // Factory        da = new iDoubleFactory();        registerInstruction(da);        // Normal instructions with full precedence        da = new iAddDoubleDouble();        registerInstruction(da);        da = new iMultiplyDoubleDouble();        registerInstruction(da);        da = new iSubtractDoubleDouble();        registerInstruction(da);        da = new iDivideDoubleDouble();        registerInstruction(da);        da = new iDoubleCopy();        registerInstruction(da);        da = new iDoubleNegate();        registerInstruction(da);#ifdef ENABLE_FRACTION        da = new iNegateFractionFraction();        registerInstruction(da);#endif#if !defined(QTOPIA_PHONE) && defined(ENABLE_SCIENCE)        da = new iDoublePow();        registerInstruction(da);        da = new iDoubleExp();        registerInstruction(da);        da = new iDoubleSinDeg();//Sin        registerInstruction(da);        da = new iDoubleSinRad();        registerInstruction(da);        da = new iDoubleSinGra();        registerInstruction(da);        da = new iDoubleCosDeg();//Cos        registerInstruction(da);        da = new iDoubleCosRad();        registerInstruction(da);        da = new iDoubleCosGra();         registerInstruction(da);        da = new iDoubleTanDeg();//Tan        registerInstruction(da);        da = new iDoubleTanRad();        registerInstruction(da);        da = new iDoubleTanGra();        registerInstruction(da);        da = new iDoubleASinDeg();//ASin        registerInstruction(da);        da = new iDoubleASinRad();        registerInstruction(da);        da = new iDoubleASinGra();        registerInstruction(da);        da = new iDoubleACosRad();//ACos        registerInstruction(da);        da = new iDoubleACosDeg();        registerInstruction(da);        da = new iDoubleACosGra();        registerInstruction(da);        da = new iDoubleATanDeg();//ATan        registerInstruction(da);        da = new iDoubleATanRad();        registerInstruction(da);        da = new iDoubleATanGra();        registerInstruction(da);        da = new iDoubleLog();        registerInstruction(da);        da = new iDoubleLn();        registerInstruction(da);        da = new iDoubleOneOverX();        registerInstruction(da);        da = new iDoubleFactorial();        registerInstruction(da);        da = new iDoubleSquareRoot();        registerInstruction(da);        da = new iDoubleCubeRoot();        registerInstruction(da);        da = new iDoubleXRootY();        registerInstruction(da);        da = new iDoubleSquare();        registerInstruction(da);#ifdef ENABLE_FRACTION        da = new iFractionCopy();        registerInstruction(da);        da = new iFractionFactory();        registerInstruction(da);        da = new iConvertDoubleFraction();        registerInstruction(da);        da = new iAddFractionFraction();        registerInstruction(da);        da = new iSubtractFractionFraction();        registerInstruction(da);        da = new iMultiplyFractionFraction();        registerInstruction(da);        da = new iDivideFractionFraction();        registerInstruction(da);        da = new iConvertFractionDouble();        registerInstruction(da);#endif#ifdef ENABLE_INTEGER        da = new iConvertIntDouble();        registerInstruction(da);#endif#endif    }}Engine::~Engine() {    while (!dStack.isEmpty())        delete dStack.pop();    dStack.clear();    while (!iStack.isEmpty())        delete iStack.pop();    iStack.clear();    delete mem;    while (!list.isEmpty())        delete list.takeLast();};void Engine::registerInstruction(Instruction *i) {     Instruction *it;    for (int c = 0; c < list.count(); c++) {	it = list.at(c);	if (it->name == i->name 		&& it->type == i->type		&& it->retType == i->retType)	    return;    }    list.append(i);}Instruction * Engine::resolve(QString name) {    // Create a shortlist of instructions with the same name    QList<Instruction*> shortList;    Instruction *it = 0;    int c = 0;    for (; c < list.count(); c++) {	it = list.at(c);	if (it->name == name) 	    shortList.append(list.at(c));    }    // No instructions by that name have been found    if (!shortList.count()) {	return resolve("NULL"); // No tr    }	// Should reuse "Factory" with a parameter?    if (name == "Convert") { // No tr	// Exact match	for (c = 0; c < shortList.count(); c++) {	    it = shortList.at(c);	    if (it->type == currentType && it->retType == wantedType)		return it;	}    } else {        if (wantedType != currentType)            currentType = wantedType;        	// Exact match	for (c = 0; c < shortList.count(); c++) {	    it = shortList.at(c);	    if (it->type == currentType && it->retType == currentType)		return it;	}	// Dont match return type to currentType	for (c = 0; c < shortList.count(); c++) {	    it = shortList.at(c);	    if (it->type == currentType )		return it;	}	// Dont match type to currentType	for (c = 0; c < shortList.count(); c++) {	    it = shortList.at(c);	    return it;	}    }    // Fail    return new Instruction();}void Engine::evaluate() {    if (!Qtopia::mousePreferred())        // this could go in doEvalStack but its more efficient here        if (!iStack.isEmpty() 		&& ((*iStack.top() == "EvaluateLine") || braceCount > 0)) // No tr	    return;    if (state == sStart)	executeInstructionOnStack("Factory"); // No tr    doEvalStack();    if (Qtopia::mousePreferred())        braceCount = 0;}void Engine::doEvalStack(int p,bool inbrace) {    if (state == sError || iStack.isEmpty())	return;    evalStack(p,inbrace);    if (!Qtopia::mousePreferred()) {        if (braceCount == 0)    	    iStack.push(new QString("EvaluateLine")); // No tr        if (braceCount > 0 && inbrace)	    --braceCount;    }    if (state != sError)	changeState(sAppend);    emit(stackChanged());}void Engine::evalStack(int p,bool inbrace) {    if (state != sError) {#ifdef QTOPIA_PHONE	QStack<QString*> tmpIStack;#endif	// could be more efficient and only resolve i once	Instruction *i;	while (!iStack.isEmpty ()		&& state != sError#ifdef QTOPIA_PHONE		&& *iStack.top() != "EvaluateLine" // No tr#endif		&& (p <= resolve(*iStack.top())->precedence)) {	    // Pop the next instruction	    QString *iString = iStack.pop();	    i = resolve(*iString);            if (Qtopia::mousePreferred())                 delete iString;#ifdef QTOPIA_PHONE            else	        tmpIStack.push(iString);#endif	    // Stop at the open brace	    if (i->name == "Open brace impl" && inbrace) { // No tr		i->eval();                if (Qtopia::mousePreferred())                     return;                else {#ifdef QTOPIA_PHONE		    //--braceCount;		    delete tmpIStack.pop(); // delete open brace instraction#endif		    return;                }	    }	    // Compare precedence with the next instruction on the stack	    if (!iStack.isEmpty ()) {		// Recurse into next instruction if necessary		int topPrec = resolve(*iStack.top())->precedence;		if ((p && p <= topPrec) || (!p && i->precedence <= topPrec)) {		    QStack<Data*> holdingStack;		    for (int c = 1;c < i->argCount;c++)			holdingStack.push(dStack.pop());		    evalStack(p,inbrace);		    for (int c = 1;c < i->argCount;c++)			dStack.push(holdingStack.pop());		}	    }	    // Evaluate 	    i->eval();#ifdef QTOPIA_PHONE            if (!Qtopia::mousePreferred()) {                if (!braceCount && !dStack.isEmpty()){                    Data *top = dStack.pop();                    for (int c = 0;c < i->argCount;c++)                        dStack.push(tmpDStack.pop());                    dStack.push(top);                } else {                    for (int c = 0;c < i->argCount;c++)                        delete tmpDStack.pop();                    delete tmpIStack.pop();                }            }#endif	}#ifdef QTOPIA_PHONE        if (!Qtopia::mousePreferred())    	    while (!tmpIStack.isEmpty())	        iStack.push(tmpIStack.pop());#endif    }}// Resetvoid Engine::dualReset() {    if (drs == drHard)	hardReset();    else	softReset();}void Engine::softReset() {    if (state == sStart && previousInstructionsPrecedence) {        if (!iStack.isEmpty())            delete iStack.pop();

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
www成人在线观看| 欧美一区二区视频在线观看 | 国产麻豆视频精品| 亚洲chinese男男1069| 亚洲综合图片区| 一二三区精品福利视频| 亚洲激情自拍偷拍| 伊人性伊人情综合网| 一区二区在线观看视频| 亚洲一二三级电影| 午夜免费欧美电影| 免费在线观看成人| 激情综合色综合久久综合| 国产乱子伦视频一区二区三区| 久久成人免费网| 国产成人8x视频一区二区| 成人免费精品视频| 91极品视觉盛宴| 91精品国产综合久久香蕉的特点 | 岛国精品在线观看| av在线一区二区三区| 欧美色区777第一页| 欧美精品乱人伦久久久久久| 欧美成人女星排行榜| 国产午夜亚洲精品午夜鲁丝片 | 欧美肥大bbwbbw高潮| 日韩手机在线导航| 国产精品午夜免费| 亚洲超碰精品一区二区| 狠狠色丁香婷婷综合久久片| 99久久777色| 91麻豆精品国产91久久久使用方法| 日韩欧美高清在线| 亚洲视频一区在线观看| 蜜臀av一级做a爰片久久| 高潮精品一区videoshd| 7777精品伊人久久久大香线蕉的| 久久亚洲一级片| 香蕉成人啪国产精品视频综合网| 七七婷婷婷婷精品国产| 99久久亚洲一区二区三区青草| 欧美日韩第一区日日骚| 国产精品久久三区| 日韩电影在线免费观看| 91美女视频网站| 久久亚洲一级片| 奇米777欧美一区二区| 色哟哟精品一区| 国产精品私人影院| 蜜臀久久久99精品久久久久久| 99久久精品国产网站| 久久久久久一级片| 日韩激情在线观看| 欧洲日韩一区二区三区| 国产精品乱码一区二三区小蝌蚪| 午夜精品久久久久久久久久久| 91蜜桃传媒精品久久久一区二区| 久久综合精品国产一区二区三区| 午夜亚洲国产au精品一区二区| 本田岬高潮一区二区三区| 精品久久久久一区二区国产| 午夜视频一区二区三区| 色94色欧美sute亚洲线路一久| 国产精品日韩精品欧美在线| 国产在线一区二区| 精品国产sm最大网站| 日韩精品亚洲一区二区三区免费| 91福利精品视频| 亚洲精品你懂的| 91黄视频在线| 一区二区三国产精华液| 99久久精品情趣| 国产精品成人免费在线| 99视频精品免费视频| 中文字幕 久热精品 视频在线| 国产精品一区二区久久不卡| 久久综合999| 国产成人综合在线观看| 国产亚洲婷婷免费| 大尺度一区二区| 国产精品福利一区二区| 99久久综合狠狠综合久久| 国产精品久久久久久久裸模| 色综合欧美在线视频区| 夜夜操天天操亚洲| 欧美日韩免费在线视频| 日韩av电影天堂| 久久综合色天天久久综合图片| 国产精品一卡二卡在线观看| 中文字幕欧美国产| 色吊一区二区三区 | 欧美日韩三级一区| 天堂午夜影视日韩欧美一区二区| 4438亚洲最大| 国产一区二区网址| 亚洲欧洲av另类| 欧美日本免费一区二区三区| 日本视频免费一区| 久久先锋影音av| 91黄色激情网站| 蜜臀av国产精品久久久久| 久久久久久久久久久电影| 99国产欧美另类久久久精品| 亚洲一区二区三区视频在线 | 精品久久一区二区| 国产福利精品一区| 亚洲色欲色欲www| 91精品国产综合久久久久久 | 中文字幕第一区二区| 在线观看日韩高清av| 久久99久久99| 亚洲男人的天堂在线aⅴ视频| 欧美高清视频一二三区| 国产v日产∨综合v精品视频| 亚洲午夜精品在线| 久久久三级国产网站| 在线观看亚洲专区| 国产一区二区在线看| 亚洲va欧美va天堂v国产综合| 国产午夜三级一区二区三| 精品视频在线免费观看| 成人精品鲁一区一区二区| 日韩高清不卡一区二区| 中文字幕在线观看一区二区| 日韩欧美色综合| 色菇凉天天综合网| 国产成人福利片| 久久99久久久久久久久久久| 亚洲精品成人在线| 欧美激情中文不卡| 精品伦理精品一区| 欧美区视频在线观看| 色哟哟亚洲精品| a级高清视频欧美日韩| 国产一区福利在线| 日韩综合小视频| 夜夜嗨av一区二区三区四季av| 国产精品久久久久久久岛一牛影视 | 欧美妇女性影城| 色天使色偷偷av一区二区| 成人免费不卡视频| 国产伦精品一区二区三区免费迷| 日韩制服丝袜av| 午夜视频在线观看一区二区 | 国产精品一区二区三区乱码| 日韩黄色免费网站| 午夜精品在线看| 亚洲第一福利一区| 亚洲国产另类精品专区| 一区二区三区免费网站| 亚洲日本va午夜在线影院| 中文字幕一区不卡| 日韩理论片中文av| 中文字幕日本不卡| 亚洲精品国产无天堂网2021| 亚洲同性同志一二三专区| 亚洲免费观看高清完整版在线观看| 国产精品久久久久永久免费观看| 国产精品色哟哟| 亚洲国产高清不卡| 亚洲人成网站精品片在线观看| 国产精品久久久久婷婷二区次| 国产精品乱码妇女bbbb| 国产精品国产馆在线真实露脸| 成人欧美一区二区三区小说| 亚洲品质自拍视频| 亚洲大片在线观看| 免费一区二区视频| 国产一区二区不卡老阿姨| 国产精品 欧美精品| 91在线云播放| 欧美中文字幕亚洲一区二区va在线 | 美女视频网站黄色亚洲| 九九久久精品视频| 懂色中文一区二区在线播放| 一本色道久久加勒比精品 | 91精品国产色综合久久| 久久综合色之久久综合| 中文成人综合网| 亚洲最快最全在线视频| 日韩精品久久理论片| 国产成人亚洲综合a∨猫咪| 一本大道久久a久久综合婷婷| 欧美日韩成人一区二区| 久久久精品国产免费观看同学| 亚洲欧洲韩国日本视频| 日韩国产欧美一区二区三区| 国产成人免费视频一区| 欧美视频在线观看一区二区| 精品捆绑美女sm三区| 18涩涩午夜精品.www| 日韩**一区毛片| av成人动漫在线观看| 欧美一级专区免费大片| 中文字幕一区二区三区在线不卡| 天堂精品中文字幕在线| av不卡免费在线观看| 精品国产一区二区精华| 亚洲精品日韩一| 国产999精品久久|