コード例 #1
0
void MainWindow::on_normalpush_clicked()//普通客户到达抽号
{
    int oks=pnumber('G');
    if(oks==1) QMessageBox::information(this,QString::fromLocal8Bit("抽号"),
                         QString::fromLocal8Bit("您抽到的号码为")+QString::number(maxnumber/100)+QString::number((maxnumber%100)/10)+QString::number(maxnumber%10)+QString::fromLocal8Bit(",请排队等待叫号。"),QMessageBox::Yes);
    else if(oks==2) QMessageBox::warning(this,QString::fromLocal8Bit("警告"),QString::fromLocal8Bit("营业厅正在下班,请明天再来!"),QMessageBox::Yes);
    else QMessageBox::warning(this,QString::fromLocal8Bit("警告"),QString::fromLocal8Bit("到达队列最大等待长度,请稍后再来!"),QMessageBox::Yes);
}
コード例 #2
0
void MainWindow::on_vippush_clicked()//vip客户到达抽号
{
    QString vipidstr=this->ui->vipidtext->text();
    QByteArray vipidstr2=vipidstr.toLatin1();
    char* vipids= vipidstr2.data();
    strcpy(vipid,vipids);
    int oks=pnumber('V');
    if(oks==0) QMessageBox::warning(this,QString::fromLocal8Bit("警告"),QString::fromLocal8Bit("到达队列最大等待长度,请稍后再来!"),QMessageBox::Yes);
    else if(oks==-1) QMessageBox::warning(this,QString::fromLocal8Bit("警告"),QString::fromLocal8Bit("请您输入正确的VIP客户ID!"),QMessageBox::Yes);
    else if(oks==1) QMessageBox::information(this,QString::fromLocal8Bit("抽号"),
                              QString::fromLocal8Bit("您抽到的号码为V")+QString::number(vmaxnumber/10)+QString::number(vmaxnumber%10)+QString::fromLocal8Bit(",请排队等待叫号。"),QMessageBox::Yes);
    else if(oks==-2) QMessageBox::warning(this,QString::fromLocal8Bit("警告"),QString::fromLocal8Bit("无法打开vip客户资料!"),QMessageBox::Yes);
    else if(oks==2) QMessageBox::warning(this,QString::fromLocal8Bit("警告"),QString::fromLocal8Bit("营业厅正在下班,请明天再来!"),QMessageBox::Yes);
}
コード例 #3
0
ファイル: LuaMat.cpp プロジェクト: JohnCrash/iRobot
static int toRadian(lua_State*L)
{
	pnumber(Ogre::Degree(tonumber(1)).valueRadians());
	return 1;
}
コード例 #4
0
ファイル: LuaMat.cpp プロジェクト: JohnCrash/iRobot
static int toDegree(lua_State*L)
{
	pnumber(Ogre::Radian(tonumber(1)).valueDegrees());
	return 1;
}
コード例 #5
0
ファイル: xlread.c プロジェクト: andreipaga/audacity
/* rmhash - read macro for '#' */
LVAL rmhash(void)
{
    LVAL fptr,mch,val;
    int escflag,ch;

    /* protect some pointers */
    xlsave1(val);

    /* get the file and macro character */
    fptr = xlgetfile();
    mch = xlgachar();
    xllastarg();

    /* make the return value */
    val = consa(NIL);

    /* check the next character */
    switch (ch = xlgetc(fptr)) {
    case '\'':
                rplaca(val,pquote(fptr,s_function));
                break;
    case '(':
                rplaca(val,pvector(fptr));
                break;
    case 'b':
    case 'B':
                rplaca(val,pnumber(fptr,2));
                break;
    case 'o':
    case 'O':
                rplaca(val,pnumber(fptr,8));
                break;
    case 'x':
    case 'X':
                    rplaca(val,pnumber(fptr,16));
                break;
    case '\\':
                xlungetc(fptr,ch);
                pname(fptr,&escflag);
                ch = buf[0];
                if (strlen(buf) > 1) {
                    upcase((char *) buf);
                    if (strcmp(buf,"NEWLINE") == 0)
                        ch = '\n';
                    else if (strcmp(buf,"SPACE") == 0)
                        ch = ' ';
                    else if (strcmp(buf,"TAB") == 0)
                        ch = '\t';
                    else
                        xlerror("unknown character name",cvstring(buf));
                }
                rplaca(val,cvchar(ch));
                break;
    case ':':
                rplaca(val,punintern(fptr));
                break;
    case '|':
                    pcomment(fptr);
                val = NIL;
                break;
    default:
                xlerror("illegal character after #",cvfixnum((FIXTYPE)ch));
    }

    /* restore the stack */
    xlpop();

    /* return the value */
    return (val);
}
コード例 #6
0
ファイル: advexe.c プロジェクト: dbremner/advsys
/* exe_one - execute one instruction */
void exe_one(void)
{
    /* get the opcode */
    opcode = getcbyte(pc); pc++;

    /* execute the instruction */
    switch (opcode) {
    case OP_CALL:
		*--sp = getboperand();
		*--sp = pc;
		*--sp = (int)(top - fp);
		fp = sp;
		pc = getafield(fp[fp[2]+3],A_CODE);
		break;
    case OP_SEND:
		*--sp = getboperand();
		*--sp = pc;
		*--sp = (int)(top - fp);
		fp = sp;
		if (p2 = fp[fp[2]+3])
		    p2 = getofield(p2,O_CLASS);
		else
		    p2 = fp[fp[2]+2];
		if (p2 && (p2 = getp(p2,fp[fp[2]+1]))) {
		    pc = getafield(p2,A_CODE);
		    break;
		}
		*sp = NIL;
		/* return NIL if there is no method for this message */
    case OP_RETURN:
		if (fp == top)
		    sts = CHAIN;
		else {
		    p2 = *sp;
		    sp = fp;
		    fp = top - *sp++;
		    pc = *sp++;
		    p3 = *sp++;
		    sp += p3;
		    *sp = p2;
		}
		break;
    case OP_TSPACE:
		sp -= getboperand();
		break;
    case OP_TMP:
		p2 = getboperand();
		*sp = fp[-p2-1];
		break;
    case OP_TSET:
		p2 = getboperand();
		fp[-p2-1] = *sp;
		break;
    case OP_ARG:
		p2 = getboperand();
		if (p2 >= fp[2])
		    error("too few arguments");
		*sp = fp[p2+3];
		break;
    case OP_ASET:
		p2 = getboperand();
		if (p2 >= fp[2])
		    error("too few arguments");
		fp[p2+3] = *sp;
		break;
    case OP_BRT:
		pc = (*sp ? getwoperand() : pc+2);
		break;
    case OP_BRF:
		pc = (*sp ? pc+2 : getwoperand());
		break;
    case OP_BR:
		pc = getwoperand();
		break;
    case OP_T:
		*sp = T;
		break;
    case OP_NIL:
		*sp = NIL;
		break;
    case OP_PUSH:
		*--sp = NIL;
		break;
    case OP_NOT:
		*sp = (*sp ? NIL : T);
		break;
    case OP_ADD:
		p2 = *sp++;
		*sp += p2;
		break;
    case OP_SUB:
		p2 = *sp++;
		*sp -= p2;
		break;
    case OP_MUL:
		p2 = *sp++;
		*sp *= p2;
		break;
    case OP_DIV:
		p2 = *sp++;
		*sp = (p2 == 0 ? 0 : *sp / p2);
		break;
    case OP_REM:
		p2 = *sp++;
		*sp = (p2 == 0 ? 0 : *sp % p2);
		break;
    case OP_BAND:
		p2 = *sp++;
		*sp &= p2;
		break;
    case OP_BOR:
		p2 = *sp++;
		*sp |= p2;
		break;
    case OP_BNOT:
		*sp = ~*sp;
		break;
    case OP_LT:
		p2 = *sp++;
		*sp = (*sp < p2 ? T : NIL);
		break;
    case OP_EQ:
		p2 = *sp++;
		*sp = (*sp == p2 ? T : NIL);
		break;
    case OP_GT:
		p2 = *sp++;
		*sp = (*sp > p2 ? T : NIL);
		break;
    case OP_LIT:
		*sp = getwoperand();
		break;
    case OP_SPLIT:
		*sp = getboperand();
		break;
    case OP_SNLIT:
		*sp = -getboperand();
		break;
    case OP_VAR:
		*sp = getvalue(getwoperand());
		break;
    case OP_SVAR:
		*sp = getvalue(getboperand());
		break;
    case OP_SET:
		setvalue(getwoperand(),*sp);
		break;
    case OP_SSET:
		setvalue(getboperand(),*sp);
		break;
    case OP_GETP:
		p2 = *sp++;
		*sp = getp(*sp,p2);
		break;
    case OP_SETP:
		p3 = *sp++;
		p2 = *sp++;
		*sp = setp(*sp,p2,p3);
		break;
    case OP_PRINT:
		print(*sp);
		break;
    case OP_PNUMBER:
    		pnumber(*sp);
    		break;
    case OP_PNOUN:
		show_noun(*sp);
		break;
    case OP_TERPRI:
		trm_chr('\n');
		break;
    case OP_FINISH:
		sts = FINISH;
		break;
    case OP_CHAIN:
		sts = CHAIN;
		break;
    case OP_ABORT:
		sts = ABORT;
		break;
    case OP_EXIT:
#ifdef MAC
		macpause();
#endif
		trm_done();
		exit();
		break;
    case OP_YORN:
		trm_get(line);
		*sp = (line[0] == 'Y' || line[0] == 'y' ? T : NIL);
    		break;
    case OP_CLASS:
		*sp = getofield(*sp,O_CLASS);
		break;
    case OP_MATCH:
		p2 = *sp++;
		*sp = (match(*sp,nouns[p2-1],adjectives[p2-1]) ? T : NIL);
		break;
    case OP_SAVE:
		*sp = db_save();
		break;
    case OP_RESTORE:
		*sp = db_restore();
		break;
    case OP_RESTART:
		*sp = db_restart();
		break;
    case OP_RAND:
		*sp = getrand(*sp);
		break;
    case OP_RNDMIZE:
		setrand(time(0L));
		*sp = NIL;
		break;
    default:
	    if (opcode >= OP_XVAR && opcode < OP_XSET)
		*sp = getvalue(opcode - OP_XVAR);
	    else if (opcode >= OP_XSET && opcode < OP_XPLIT)
		setvalue(opcode - OP_XSET,*sp);
	    else if (opcode >= OP_XPLIT && opcode < OP_XNLIT)
		*sp = opcode - OP_XPLIT;
	    else if (opcode >= OP_XNLIT && opcode < 256)
		*sp = OP_XNLIT - opcode;
	    else
		trm_str("Bad opcode\n");
	    break;
    }
}