예제 #1
0
/**
* @brief 应用交易菜单选择
* @param 无
* @return
* @li APP_SUCC
* @li APP_QUIT
* @li APP_TIMEOUT
*/
static int MenuFuncSel(void)
{
	int nTrueInput = INPUT_NO;
	int nSelect = 0;
	
	while(1)
	{
		//PubCloseShowStatusBar();
		nTrueInput = INPUT_NO;
		nSelect = PubLuaDisplay("LuaMenuFuncSel");	
		//PubShowStatusBar();
		switch(nSelect)
		{
		case KEY_ESC:
			return APP_QUIT;
		case KEY_FUNC_APP_SELECT:
			return KEY_FUNC_APP_SELECT;
		case 0:
		case KEY_ENTER:
			return APP_TIMEOUT;
			break;
		case KEY_1:
			MagTelnoVeriCoupon(&nTrueInput);
			break;
		case KEY_2:
			MagIDVeriCoupon(&nTrueInput);
			break;
		case KEY_3:
			MagCardVeriCoupon(&nTrueInput);
			break;
		case KEY_4:
			VoidSale();
			break;
		case KEY_5:
			MagRefund();
			break;
		case KEY_6:
			Reprint();
			return APP_SUCC;
			break;
		case KEY_7:
			MenuManage();
			return APP_SUCC;
			break;
		default:
			break;
		}
	}
	return APP_SUCC;
}
예제 #2
0
/**
* @brief 应用交易菜单选择
* @param 无
* @return 
* @li APP_SUCC
* @li APP_QUIT
* @li APP_TIMEOUT
* @author 
* @date
*/
static int MenuFuncSel(void)
{
	int nRet = 0;
	char szMenuResource[3072];
	char szPrm[3072];
	
	memset(szMenuResource, 0, sizeof(szMenuResource));
	DoMenu(szMenuResource);
	
	sprintf(szPrm, "'%s'", szMenuResource);
	while(1)
	{
		AutoDoReversal();	/*自动冲正*/
		nRet = PubLuaDisplay2("LuaMenuFunc", szPrm);
		
		switch(nRet)
		{
		case APP_FUNCQUIT:
			return KEY_FUNC_APP_SELECT;
		case -5://确认
		case APP_TIMEOUT:
		case APP_QUIT:
			return nRet;
		case COUPON_VERIFY_MENU:
			MagIDVeriCoupon();
			break;
		case TEL_VERIFY_MENU:
			MagTelnoVeriCoupon();
			break;
		case CARD_VERIFY_MENU:
			MagCardVeriCoupon();
			break;
		case PRECREATE_MENU:
			MagScanQrCodePay();
			break;
		case CREATEANDPAY:
			MagBarcodePay();
			break;
		case WX_VOIDPAY_MENU:
			break;
		case PRINT_MENU:
			Reprint();
			break;
		case MANAGE_MENU:
			MenuManage();
			return APP_SUCC;
			break;

		case BAIDU_PRECREATE_MENU:
			MagScanQrCodePayBaidu();
			break;
		case BAIDU_CREATEANDPAY_MENU:
			MagBarcodeBaidu();
			break;

		case JD_PRECREATE_MENU:
			MagJDScanQrCodePay();
			break;
		case JD_CREATEANDPAY_MENU:
			MagJDBarcode();
			break;

		case ALIPAY_PRECREATE_MENU:
			MagAlipayScanQrCodePay();
			break;
		case ALI_CREATEANDPAY_MENU:
			MagAliBarcode();
			break;
		
		case MEITUAN_COUPON_MENU:
			MagMeituanVeriCoupon();
			break;
			
		case DZ_PRECREATE_MENU:
			MagDazhongScanQrCodePay();
			break;
		case DZ_CREATEANDPAY_MENU:
			MagDazhongBarcode();
			break;
			
		case DZ_COUPON_MENU:
			MagDazhongVeriCoupon();
			break;
		case DZ_COUPONCONFIRM_MENU:
			MagDazhongConfirm();
			break;
			
		case BESTPAY_CREATEANDPAY_MENU:
			MagBestpayBarcode();
			break;
			
		case ALLPAY_CREATEANDPAY_MENU:
			MagAllpayBarcode();
			break;
		case OTHERS:
			MenuOther();
			break;		
		case ALLPAY_REFUND_MENU:
			MagAllPayRefund();
			break;		
		case ALLPAY_BALANCE_MENU:
			MagBalance(TRANS_BALANCE_ALLPAY);
			break;	
		default:
			break;
		}
	}
	return APP_SUCC;
}
예제 #3
0
파일: main.c 프로젝트: longde123/lemon
/* The main program.  Parse the command line and do it... */
int main(int argc, char **argv)
{
    static int version = 0;
    static int rpflag = 0;
    static int basisflag = 0;
    static int compress = 0;
    static int quiet = 0;
    static int statistics = 0;
    static int mhflag = 0;
    static struct s_options options[] = {
        {OPT_FLAG, "b", (char*)&basisflag, "Print only the basis in report."},
        {OPT_FLAG, "c", (char*)&compress, "Don't compress the action table."},
        {OPT_FSTR, "D", (char*)handle_D_option, "Define an %ifdef macro."},
        {OPT_FLAG, "g", (char*)&rpflag, "Print grammar without actions."},
        {OPT_FSTR, "l", (char*)handle_l_option, "Set an output language (c, c++, d)."},
        {OPT_FLAG, "m", (char*)&mhflag, "Output a makeheaders compatible file"},
        {OPT_FLAG, "q", (char*)&quiet, "(Quiet) Don't print the report file."},
        {OPT_FLAG, "s", (char*)&statistics,
            "Print parser stats to standard output."},
        {OPT_FLAG, "x", (char*)&version, "Print the version number."},
        {OPT_FLAG,0,0,0}
    };
    int i;
    struct lemon lem;
    
    OptInit(argv,options,stderr);
    if( version ){
        printf("Lemon version 1.0\n");
        exit(0);
    }
    if( OptNArgs()!=1 ){
        ErrorMsg("lemon", LINENO_NONE, "Exactly one filename argument is required.\n");
        exit(1);
    }
    memset(&lem, 0, sizeof(lem));
    lem.errorcnt = 0;
    
    /* Initialize the machine */
    Strsafe_init();
    Symbol_init();
    State_init();
    lem.argv0 = argv[0];
    lem.filename = OptArg(0);
    lem.basisflag = basisflag;
    Symbol_new("$");
    lem.errsym = Symbol_new("error");
    lem.errsym->useCnt = 0;
    
    /* Parse the input file */
    Parse(&lem);
    if( lem.errorcnt ) exit(lem.errorcnt);
        if( lem.nrule==0 ){
            ErrorMsg(lem.filename, LINENO_NONE, "Empty grammar.\n");
            exit(1);
        }
    
    /* Count and index the symbols of the grammar */
    lem.nsymbol = Symbol_count();
    Symbol_new("{default}");
    lem.symbols = Symbol_arrayof();
    for(i=0; i<=lem.nsymbol; i++) lem.symbols[i]->index = i;
        qsort(lem.symbols,lem.nsymbol+1,sizeof(struct symbol*),
              (int(*)())Symbolcmpp);
        for(i=0; i<=lem.nsymbol; i++) lem.symbols[i]->index = i;
            for(i=1; isupper(lem.symbols[i]->name[0]); i++);
    lem.nterminal = i;
    
    /* Generate a reprint of the grammar, if requested on the command line */
    if( rpflag ){
        Reprint(&lem);
    }else{
        /* Initialize the size for all follow and first sets */
        SetSize(lem.nterminal+1);
        
        /* Find the precedence for every production rule (that has one) */
        FindRulePrecedences(&lem);
        
        /* Compute the lambda-nonterminals and the first-sets for every
         ** nonterminal */
        FindFirstSets(&lem);
        
        /* Compute all LR(0) states.  Also record follow-set propagation
         ** links so that the follow-set can be computed later */
        lem.nstate = 0;
        FindStates(&lem);
        lem.sorted = State_arrayof();
        
        /* Tie up loose ends on the propagation links */
        FindLinks(&lem);
        
        /* Compute the follow set of every reducible configuration */
        FindFollowSets(&lem);
        
        /* Compute the action tables */
        FindActions(&lem);
        
        /* Compress the action tables */
        if( compress==0 ) CompressTables(&lem);
        
        /* Reorder and renumber the states so that states with fewer choices
         ** occur at the end. */
        ResortStates(&lem);
        
        /* Generate a report of the parser generated.  (the "y.output" file) */
        if( !quiet ) ReportOutput(&lem);
        
        /* Generate the source code for the parser */
        ReportTable(&lem, mhflag);
        
        /* Produce a header file for use by the scanner.  (This step is
         ** omitted if the "-m" option is used because makeheaders will
         ** generate the file for us.) */
        if (! mhflag && language != LANG_D)
            ReportHeader(&lem);
    }
    if( statistics ){
        LogMsg(LOGLEVEL_INFO, lem.filename, LINENO_NONE,
               "Parser statistics: %d terminals, %d nonterminals, %d rules\n",
               lem.nterminal, lem.nsymbol - lem.nterminal, lem.nrule);
        LogMsg(LOGLEVEL_INFO, lem.filename, LINENO_NONE,
               "                   %d states, %d parser table entries, %d conflicts\n",
               lem.nstate, lem.tablesize, lem.nconflict);
    }
    if( lem.nconflict ){
        LogMsg(LOGLEVEL_WARNING, lem.filename, LINENO_NONE, "%d parsing conflicts.\n", lem.nconflict);
    }
    exit(lem.errorcnt + lem.nconflict);
    return (lem.errorcnt + lem.nconflict);
}