예제 #1
0
Command *Command::next(bool chk_child) const
{
    if (chk_child && m_child != 0)
        return m_child;
    else if (m_next != 0)
        return m_next;
    else if (tutor() != 0)
        return tutor()->next(false);
    return 0;
}
예제 #2
0
int pianWHOA::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: key1(); break;
        case 1: key2(); break;
        case 2: key3(); break;
        case 3: key4(); break;
        case 4: key5(); break;
        case 5: key6(); break;
        case 6: key7(); break;
        case 7: key8(); break;
        case 8: key9(); break;
        case 9: key10(); break;
        case 10: key11(); break;
        case 11: key12(); break;
        case 12: key13(); break;
        case 13: key14(); break;
        case 14: key15(); break;
        case 15: key16(); break;
        case 16: key17(); break;
        case 17: key18(); break;
        case 18: tutor(); break;
        default: ;
        }
        _id -= 19;
    }
    return _id;
}
예제 #3
0
int Command::nesting() const
{
    int result = 0;
    Command * p = tutor();
    while (p != 0)
    {
        result +=1;
        p = p->tutor();
    }
    return result;
}
예제 #4
0
파일: teach.c 프로젝트: aalm/obsd-src
int
main(int argc, char *argv[])
{
	int     i;

	if (pledge("stdio rpath tty exec", NULL) == -1)
		err(1, "pledge");

	signal(SIGINT, getout);
	initcurses();
	text(hello);
	text(list);
	i = text(contin);
	if (i == 0)
		i = 2;
	init();
	while (i)
		switch (i) {
		case 1:
			leave();	/* Does not return */
			break;

		case 2:
			if ((i = text(intro1)))
				break;
			wrboard();
			if ((i = text(intro2)))
				break;
		
		case 3:
			if ((i = text(moves)))
				break;
		
		case 4:
			if ((i = text(removepiece)))
				break;
		
		case 5:
			if ((i = text(hits)))
				break;
		
		case 6:
			if ((i = text(endgame)))
				break;
		
		case 7:
			if ((i = text(doubl)))
				break;
		
		case 8:
			if ((i = text(stragy)))
				break;
		
		case 9:
			if ((i = text(prog)))
				break;
		
		case 10:
			if ((i = text(lastch)))
				break;
		}
	tutor();
	/* NOT REACHED */
}
예제 #5
0
int main(int argc UNUSED, char **argv)
{
    int i;

    // revoke setgid privileges
    setregid(getgid(), getgid());

    signal(SIGINT, getout);
    if (tcgetattr(0, &old) == -1)	// get old tty mode
	errexit("teachgammon(gtty)");
    noech = old;
    noech.c_lflag &= ~ECHO;
    bg_raw = noech;
    bg_raw.c_lflag &= ~ICANON; // set up modes
    ospeed = cfgetospeed(&old);	// for termlib
    tflag = getcaps(getenv("TERM"));
    while (*++argv != 0)
	getarg(&argv);
    if (tflag) {
	noech.c_oflag &= ~ONLCR;
	bg_raw.c_oflag &= ~ONLCR;
	clear();
    }
    text(hello);
    text(list);
    i = text(contin);
    if (i == 0)
	i = 2;
    init();
    while (i)
	switch (i) {
	    case 1:
		leave();

	    case 2:
		if ((i = text(intro1)) != 0)
		    break;
		wrboard();
		if ((i = text(intro2)) != 0)
		    break;

	    case 3:
		if ((i = text(moves)) != 0)
		    break;

	    case 4:
		if ((i = text(removepiece)) != 0)
		    break;

	    case 5:
		if ((i = text(hits)) != 0)
		    break;

	    case 6:
		if ((i = text(endgame)) != 0)
		    break;

	    case 7:
		if ((i = text(doubl)) != 0)
		    break;

	    case 8:
		if ((i = text(stragy)) != 0)
		    break;

	    case 9:
		if ((i = text(prog)) != 0)
		    break;

	    case 10:
		if ((i = text(lastch)) != 0)
		    break;
	}
    tutor();
    // NOTREACHED
    return (0);
}
예제 #6
0
파일: teach.c 프로젝트: wan721/DragonFlyBSD
int
main(int argc, char **argv)
{
	int i;

	/* revoke privs */
	setgid(getgid());

	acnt = 1;
	signal(SIGINT, getout);
	if (tcgetattr(0, &tty) == -1)			/* get old tty mode */
		errexit("teachgammon(tcgetattr)");
	old = tty.c_lflag;
	raw = ((noech = old & ~ECHO) & ~ICANON);	/* set up modes */
	ospeed = cfgetospeed(&tty);			/* for termlib */
	tflag = getcaps(getenv("TERM"));
	getarg(argc, argv);
	if (tflag) {
		noech &= ~(ICRNL | OXTABS);
		raw &= ~(ICRNL | OXTABS);
		clear();
	}
	text(hello);
	text(list);
	i = text(contin);
	if (i == 0)
		i = 2;
	init();
	while (i)
		switch (i) {
		case 1:
			leave();

		case 2:
			if ((i = text(intro1)) != 0)
				break;
			wrboard();
			if ((i = text(intro2)) != 0)
				break;

		case 3:
			if ((i = text(moves)) != 0)
				break;

		case 4:
			if ((i = text(remove)) != 0)
				break;

		case 5:
			if ((i = text(hits)) != 0)
				break;

		case 6:
			if ((i = text(endgame)) != 0)
				break;

		case 7:
			if ((i = text(doubl)) != 0)
				break;

		case 8:
			if ((i = text(stragy)) != 0)
				break;

		case 9:
			if ((i = text(prog)) != 0)
				break;

		case 10:
			if ((i = text(lastch)) != 0)
				break;
		}
	tutor();
	/* NOTREACHED */
	return (0);
}