?? mwmparse.c
字號:
yystate = 0; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ yyssp = yyss; yyvsp = yyvs; goto yysetstate;/*------------------------------------------------------------.| yynewstate -- Push a new state, which is found in yystate. |`------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. so pushing a state here evens the stacks. */ yyssp++; yysetstate: *yyssp = yystate; if (yyss + yystacksize - 1 <= yyssp) { /* Get the current used size of the three stacks, in elements. */ YYSIZE_T yysize = yyssp - yyss + 1;#ifdef yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; short *yyss1 = yyss; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow ("parser stack overflow", &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), &yystacksize); yyss = yyss1; yyvs = yyvs1; }#else /* no yyoverflow */# ifndef YYSTACK_RELOCATE goto yyoverflowlab;# else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) goto yyoverflowlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { short *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyoverflowlab; YYSTACK_RELOCATE (yyss); YYSTACK_RELOCATE (yyvs);# undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); }# endif#endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); goto yybackup;/*-----------.| yybackup. |`-----------*/yybackup:/* Do appropriate processing given the current state. *//* Read a lookahead token if we need one and don't already have one. *//* yyresume: */ /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); yychar = YYLEX; } if (yychar <= YYEOF) { yychar = yytoken = YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } else { yytoken = YYTRANSLATE (yychar); YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to detect an error, take that action. */ yyn += yytoken; if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) goto yydefault; yyn = yytable[yyn]; if (yyn <= 0) { if (yyn == 0 || yyn == YYTABLE_NINF) goto yyerrlab; yyn = -yyn; goto yyreduce; } if (yyn == YYFINAL) YYACCEPT; /* Shift the lookahead token. */ YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken])); /* Discard the token being shifted unless it is eof. */ if (yychar != YYEOF) yychar = YYEMPTY; *++yyvsp = yylval; /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; yystate = yyn; goto yynewstate;/*-----------------------------------------------------------.| yydefault -- do the default action for the current state. |`-----------------------------------------------------------*/yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; goto yyreduce;/*-----------------------------.| yyreduce -- Do a reduction. |`-----------------------------*/yyreduce: /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: `$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison users should not rely upon it. Assigning to YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that YYVAL may be used uninitialized. */ yyval = yyvsp[1-yylen]; YY_REDUCE_PRINT (yyn); switch (yyn) { case 7:#line 264 "mwmparse.y" { if (!skip_test) { if (button_bind_found == False) { if (strcmp(yyvsp[0].string, pscr->button_bindings) == 0) button_bind_match = True; else button_bind_match = False; } else if (strcmp(yyvsp[0].string, pscr->button_bindings) == 0) { yyerror("Ignoring duplicate button bindings"); button_bind_match = False; } else button_bind_match = False; } else button_bind_match = True; } break; case 10:#line 287 "mwmparse.y" { yyerror("Invalid button binding"); yyerrok; yyclearin; } break; case 12:#line 296 "mwmparse.y" { int contexts = yyvsp[-1].number; int mods, func; MenuItem *mi = NULL; MouseButton *temp = NULL, *ptr; if (!button_bind_match) break; mods = yyvsp[-2].button.modifiers; if ((contexts & C_WINDOW) && (((mods == 0) || mods == AnyModifier))) { pscr->buttons2grab &= ~(yyvsp[-2].button.button); } func = yyvsp[0].function.func; if ((func == F_EXEC) || (func == F_RESTART) || (func == F_CIRCULATE_UP) || (func == F_CIRCULATE_DOWN) || (func == F_WARP)) { mi = (MenuItem *)XtMalloc(sizeof(MenuItem)); mi->next = (MenuItem *) NULL; mi->prev = (MenuItem *) NULL; if ((func == F_EXEC) || (func == F_RESTART)) { mi->item = XtNewString("DOIT"); mi->action = yyvsp[0].function.arg; } else { mi->item = XtNewString("DONT DOIT"); mi->action = yyvsp[0].function.arg; } mi->item2 = ""; mi->state = 0; mi->func = func; mi->strlen = strlen(mi->item); mi->strlen2 = 0; mi->val1 = 0; mi->val2 = 0; mi->val1_unit = 1; mi->val2_unit = 1; } temp = pscr->buttons; pscr->buttons = (MouseButton *)XtMalloc(sizeof(MouseButton)); pscr->buttons->func = func; if (func == F_POPUP) pscr->buttons->menu = (MenuRoot *)yyvsp[0].function.arg; else if (func == F_W_POPUP) pscr->buttons->menu = (MenuRoot *)DEFAULT_WIN_MENU_NAME; else pscr->buttons->menu = NULL; pscr->buttons->item = mi; pscr->buttons->button = ffs(yyvsp[-2].button.button) - 8; pscr->buttons->context = contexts; pscr->buttons->modifier = mods; pscr->buttons->mask = yyvsp[-2].button.event; pscr->buttons->count = yyvsp[-2].button.count; pscr->buttons->val1 = 0; pscr->buttons->val2 = 0; pscr->buttons->val1_unit = pscr->d_width; pscr->buttons->val2_unit = pscr->d_height; /* if duplicate, skip second */ for (ptr = temp; ptr != NULL; ptr = ptr->next) { /* If everything is the same except for having func's F_POPUP and F_WINDOWLIST, the second is a duplicate */ if (((ptr->func == F_POPUP || ptr->func == F_WINDOWLIST) && (pscr->buttons->func == F_POPUP || pscr->buttons->func == F_WINDOWLIST)) && ptr->modifier == pscr->buttons->modifier && ptr->mask == pscr->buttons->mask && ptr->count == pscr->buttons->count && ptr->context == pscr->buttons->context && ptr->button == pscr->buttons->button) { XtFree((char *)pscr->buttons); pscr->buttons = temp; break; } if (ptr->func == pscr->buttons->func && ptr->modifier == pscr->buttons->modifier && ptr->mask == pscr->buttons->mask && ptr->count == pscr->buttons->count && ptr->button == pscr->buttons->button) { ptr->context |= pscr->buttons->context; XtFree((char *)pscr->buttons); pscr->buttons = temp; break; } } if (ptr == NULL) pscr->buttons->next = temp; } break; case 13:#line 402 "mwmparse.y" { if (!skip_test) { if (key_bind_found == False) { if (strcmp(yyvsp[0].string, pscr->key_bindings) == 0) key_bind_match = True; else key_bind_match = False; } else if (strcmp(yyvsp[0].string, pscr->key_bindings) == 0) { yyerror("Ignoring duplicate key bindings"); key_bind_match = False; } else key_bind_match = False; } else key_bind_match = True; } break; case 16:#line 425 "mwmparse.y" { yyerror("Invalid key binding"); yyerrok; yyclearin; } break; case 18:#line 434 "mwmparse.y" { FuncKey *tmp = NULL; KeySym keysym; KeyCode keycode; int i, min, max; int func, contexts; char *ptr; if (!key_bind_match) break; ptr = yyvsp[0].function.arg; func = yyvsp[0].function.func; contexts = yyvsp[-1].number; /* * Don't let a 0 keycode go through, since that * means AnyKey to the XGrabKey call in GrabKeys(). */ keysym = yyvsp[-2].hotkey.key; if (keysym == 0) break; if ((keycode = XKeysymToKeycode(dpy, yyvsp[-2].hotkey.key)) == 0) break; XDisplayKeycodes(dpy, &min, &max); for (i = min; i <= max; i++) { if (XKeycodeToKeysym(dpy, i, 0) == keysym) { tmp = (FuncKey *)XtMalloc(sizeof(FuncKey)); tmp->next = pscr->keys; pscr->keys = tmp; tmp->name = "HOTKEY"; tmp->keycode = i; tmp->cont = contexts; tmp->mods = yyvsp[-2].hotkey.modifiers; tmp->func = func; if (func == F_W_POPUP) tmp->action = DEFAULT_WIN_MENU_NAME; else tmp->action = ptr; tmp->val1 = 0; tmp->val2 = 0; tmp->val1_unit = pscr->d_width; tmp->val2_unit = pscr->d_height; tmp->menu = NULL; } } } break; case 19:#line 486 "mwmparse.y" { num_items = 0; cur_menu = MENU_Create(yyvsp[0].string); } break; case 20:
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -