Exemplo n.º 1
0
void DB_Set::interpret(token t)
{
	token tmp = t;
	vector<Table*> relations;
	while(tmp.get_type() == program)
	{
		if(tmp[0].get_type() == query)
		{
			query_interpret(tmp[0], relations);
		}
		else if(tmp[0].get_type() == command)
		{
			command_interpret(tmp[0], relations);
		}
		else if(tmp[0].get_type() == fail)
		{
			cout << "Invalid command (make sure you have semicolon)." << endl;
		}
		tmp = tmp[1];
	}
}
int command_handle(char *buf)
{
	int cmd = command_interpret(buf); /* get the command index */

	switch (cmd) {
	case 0:
		break;
	case 6:
		nand_query();
		break;
	case 7:	
		handle_nerase();
		break;
	case 8:	/* nread */
		nand_read(NAND_READ);
		break;
	case 9:	/* nreadraw */
		nand_read(NAND_READ_RAW);
		break;
	case 10: /* nreadoob */
		nand_read(NAND_READ_OOB);
		break;
	case 11:
		nand_prog();
		break;
	case 12:
		handle_help();
		break;
	case 13:
		handle_version();
		break;
	case 14:
		debug_go();
		break;
	case 16:		/* exit */
		printf(" exiting usbboot software\n");
		return -1;	/* return -1 to break the main.c while
				 * then run usb_ingenic_cleanup*/
		/*case 17:
		nand_read(NAND_READ_TO_RAM); */
		break;
	case 18:
		handle_gpio(2);
		break;
	case 19:
		handle_gpio(3);
		break;
	case 20:
		boot(STAGE1_FILE_PATH, STAGE2_FILE_PATH);
		break;
	case 26:
		handle_nmark();
		break;
	case 28:
		handle_load();
		break;
	case 29:
		handle_memtest();
		break;
	default:
		printf(" command not support or input error!\n");
		break;
	}

	return 1;
}