i3
|
00001 /* A Bison parser, made by GNU Bison 2.5. */ 00002 00003 /* Bison implementation for Yacc-like parsers in C 00004 00005 Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. 00006 00007 This program is free software: you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License as published by 00009 the Free Software Foundation, either version 3 of the License, or 00010 (at your option) any later version. 00011 00012 This program is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 00019 00020 /* As a special exception, you may create a larger work that contains 00021 part or all of the Bison parser skeleton and distribute that work 00022 under terms of your choice, so long as that work isn't itself a 00023 parser generator using the skeleton or a modified version thereof 00024 as a parser skeleton. Alternatively, if you modify or redistribute 00025 the parser skeleton itself, you may (at your option) remove this 00026 special exception, which will cause the skeleton and the resulting 00027 Bison output files to be licensed under the GNU General Public 00028 License without this special exception. 00029 00030 This special exception was added by the Free Software Foundation in 00031 version 2.2 of Bison. */ 00032 00033 /* C LALR(1) parser skeleton written by Richard Stallman, by 00034 simplifying the original so-called "semantic" parser. */ 00035 00036 /* All symbols defined below should begin with yy or YY, to avoid 00037 infringing on user name space. This should be done even for local 00038 variables, as they might otherwise be expanded by user macros. 00039 There are some unavoidable exceptions within include files to 00040 define necessary library symbols; they are noted "INFRINGES ON 00041 USER NAME SPACE" below. */ 00042 00043 /* Identify Bison output. */ 00044 #define YYBISON 1 00045 00046 /* Bison version. */ 00047 #define YYBISON_VERSION "2.5" 00048 00049 /* Skeleton name. */ 00050 #define YYSKELETON_NAME "yacc.c" 00051 00052 /* Pure parsers. */ 00053 #define YYPURE 0 00054 00055 /* Push parsers. */ 00056 #define YYPUSH 0 00057 00058 /* Pull parsers. */ 00059 #define YYPULL 1 00060 00061 /* Using locations. */ 00062 #define YYLSP_NEEDED 0 00063 00064 /* Substitute the variable and function names. */ 00065 #define yyparse cmdyyparse 00066 #define yylex cmdyylex 00067 #define yyerror cmdyyerror 00068 #define yylval cmdyylval 00069 #define yychar cmdyychar 00070 #define yydebug cmdyydebug 00071 #define yynerrs cmdyynerrs 00072 00073 00074 /* Copy the first part of user declarations. */ 00075 00076 /* Line 268 of yacc.c */ 00077 #line 1 "src/cmdparse.y" 00078 00079 /* 00080 * vim:ts=4:sw=4:expandtab 00081 * 00082 * i3 - an improved dynamic tiling window manager 00083 * © 2009-2011 Michael Stapelberg and contributors (see also: LICENSE) 00084 * 00085 * cmdparse.y: the parser for commands you send to i3 (or bind on keys) 00086 * 00087 */ 00088 #include <sys/types.h> 00089 #include <sys/stat.h> 00090 #include <unistd.h> 00091 #include <fcntl.h> 00092 #include <float.h> 00093 00094 #include "all.h" 00095 00101 #define HANDLE_EMPTY_MATCH do { \ 00102 if (match_is_empty(¤t_match)) { \ 00103 owindow *ow = smalloc(sizeof(owindow)); \ 00104 ow->con = focused; \ 00105 TAILQ_INIT(&owindows); \ 00106 TAILQ_INSERT_TAIL(&owindows, ow, owindows); \ 00107 } \ 00108 } while (0) 00109 00110 typedef struct yy_buffer_state *YY_BUFFER_STATE; 00111 extern int cmdyylex(struct context *context); 00112 extern int cmdyyparse(void); 00113 extern int cmdyylex_destroy(void); 00114 extern FILE *cmdyyin; 00115 YY_BUFFER_STATE cmdyy_scan_string(const char *); 00116 00117 static struct context *context; 00118 static Match current_match; 00119 00120 /* 00121 * Helper data structure for an operation window (window on which the operation 00122 * will be performed). Used to build the TAILQ owindows. 00123 * 00124 */ 00125 typedef struct owindow { 00126 Con *con; 00127 TAILQ_ENTRY(owindow) owindows; 00128 } owindow; 00129 static TAILQ_HEAD(owindows_head, owindow) owindows; 00130 00131 /* Holds the JSON which will be returned via IPC or NULL for the default return 00132 * message */ 00133 static char *json_output; 00134 00135 /* We don’t need yydebug for now, as we got decent error messages using 00136 * yyerror(). Should you ever want to extend the parser, it might be handy 00137 * to just comment it in again, so it stays here. */ 00138 //int cmdyydebug = 1; 00139 00140 void cmdyyerror(const char *error_message) { 00141 ELOG("\n"); 00142 ELOG("CMD: %s\n", error_message); 00143 ELOG("CMD: in command:\n"); 00144 ELOG("CMD: %s\n", context->line_copy); 00145 ELOG("CMD: "); 00146 for (int c = 1; c <= context->last_column; c++) 00147 if (c >= context->first_column) 00148 printf("^"); 00149 else printf(" "); 00150 printf("\n"); 00151 ELOG("\n"); 00152 context->compact_error = sstrdup(error_message); 00153 } 00154 00155 int cmdyywrap() { 00156 return 1; 00157 } 00158 00159 char *parse_cmd(const char *new) { 00160 json_output = NULL; 00161 LOG("COMMAND: *%s*\n", new); 00162 cmdyy_scan_string(new); 00163 00164 match_init(¤t_match); 00165 context = scalloc(sizeof(struct context)); 00166 context->filename = "cmd"; 00167 if (cmdyyparse() != 0) { 00168 fprintf(stderr, "Could not parse command\n"); 00169 sasprintf(&json_output, "{\"success\":false, \"error\":\"%s at position %d\"}", 00170 context->compact_error, context->first_column); 00171 FREE(context->line_copy); 00172 FREE(context->compact_error); 00173 free(context); 00174 return json_output; 00175 } 00176 printf("done, json output = %s\n", json_output); 00177 00178 cmdyylex_destroy(); 00179 FREE(context->line_copy); 00180 FREE(context->compact_error); 00181 free(context); 00182 return json_output; 00183 } 00184 00185 /* 00186 * Returns true if a is definitely greater than b (using the given epsilon) 00187 * 00188 */ 00189 bool definitelyGreaterThan(float a, float b, float epsilon) { 00190 return (a - b) > ( (fabs(a) < fabs(b) ? fabs(b) : fabs(a)) * epsilon); 00191 } 00192 00193 00194 00195 /* Line 268 of yacc.c */ 00196 #line 197 "src/cmdparse.tab.c" 00197 00198 /* Enabling traces. */ 00199 #ifndef YYDEBUG 00200 # define YYDEBUG 1 00201 #endif 00202 00203 /* Enabling verbose error messages. */ 00204 #ifdef YYERROR_VERBOSE 00205 # undef YYERROR_VERBOSE 00206 # define YYERROR_VERBOSE 1 00207 #else 00208 # define YYERROR_VERBOSE 1 00209 #endif 00210 00211 /* Enabling the token table. */ 00212 #ifndef YYTOKEN_TABLE 00213 # define YYTOKEN_TABLE 0 00214 #endif 00215 00216 00217 /* Tokens. */ 00218 #ifndef YYTOKENTYPE 00219 # define YYTOKENTYPE 00220 /* Put the tokens into the symbol table, so that GDB and other debuggers 00221 know about them. */ 00222 enum yytokentype { 00223 TOK_EXEC = 258, 00224 TOK_EXIT = 259, 00225 TOK_RELOAD = 260, 00226 TOK_RESTART = 261, 00227 TOK_KILL = 262, 00228 TOK_WINDOW = 263, 00229 TOK_CLIENT = 264, 00230 TOK_FULLSCREEN = 265, 00231 TOK_GLOBAL = 266, 00232 TOK_LAYOUT = 267, 00233 TOK_DEFAULT = 268, 00234 TOK_STACKED = 269, 00235 TOK_TABBED = 270, 00236 TOK_BORDER = 271, 00237 TOK_NORMAL = 272, 00238 TOK_NONE = 273, 00239 TOK_1PIXEL = 274, 00240 TOK_MODE = 275, 00241 TOK_TILING = 276, 00242 TOK_FLOATING = 277, 00243 TOK_MODE_TOGGLE = 278, 00244 TOK_ENABLE = 279, 00245 TOK_DISABLE = 280, 00246 TOK_WORKSPACE = 281, 00247 TOK_OUTPUT = 282, 00248 TOK_TOGGLE = 283, 00249 TOK_FOCUS = 284, 00250 TOK_MOVE = 285, 00251 TOK_OPEN = 286, 00252 TOK_NEXT = 287, 00253 TOK_PREV = 288, 00254 TOK_SPLIT = 289, 00255 TOK_HORIZONTAL = 290, 00256 TOK_VERTICAL = 291, 00257 TOK_UP = 292, 00258 TOK_DOWN = 293, 00259 TOK_LEFT = 294, 00260 TOK_RIGHT = 295, 00261 TOK_PARENT = 296, 00262 TOK_CHILD = 297, 00263 TOK_APPEND_LAYOUT = 298, 00264 TOK_MARK = 299, 00265 TOK_RESIZE = 300, 00266 TOK_GROW = 301, 00267 TOK_SHRINK = 302, 00268 TOK_PX = 303, 00269 TOK_OR = 304, 00270 TOK_PPT = 305, 00271 TOK_NOP = 306, 00272 TOK_BACK_AND_FORTH = 307, 00273 TOK_NO_STARTUP_ID = 308, 00274 TOK_CLASS = 309, 00275 TOK_INSTANCE = 310, 00276 TOK_WINDOW_ROLE = 311, 00277 TOK_ID = 312, 00278 TOK_CON_ID = 313, 00279 TOK_TITLE = 314, 00280 STR = 315, 00281 NUMBER = 316 00282 }; 00283 #endif 00284 00285 00286 00287 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED 00288 typedef union YYSTYPE 00289 { 00290 00291 /* Line 293 of yacc.c */ 00292 #line 121 "src/cmdparse.y" 00293 00294 char *string; 00295 char chr; 00296 int number; 00297 00298 00299 00300 /* Line 293 of yacc.c */ 00301 #line 302 "src/cmdparse.tab.c" 00302 } YYSTYPE; 00303 # define YYSTYPE_IS_TRIVIAL 1 00304 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ 00305 # define YYSTYPE_IS_DECLARED 1 00306 #endif 00307 00308 00309 /* Copy the second part of user declarations. */ 00310 00311 00312 /* Line 343 of yacc.c */ 00313 #line 314 "src/cmdparse.tab.c" 00314 00315 #ifdef short 00316 # undef short 00317 #endif 00318 00319 #ifdef YYTYPE_UINT8 00320 typedef YYTYPE_UINT8 yytype_uint8; 00321 #else 00322 typedef unsigned char yytype_uint8; 00323 #endif 00324 00325 #ifdef YYTYPE_INT8 00326 typedef YYTYPE_INT8 yytype_int8; 00327 #elif (defined __STDC__ || defined __C99__FUNC__ \ 00328 || defined __cplusplus || defined _MSC_VER) 00329 typedef signed char yytype_int8; 00330 #else 00331 typedef short int yytype_int8; 00332 #endif 00333 00334 #ifdef YYTYPE_UINT16 00335 typedef YYTYPE_UINT16 yytype_uint16; 00336 #else 00337 typedef unsigned short int yytype_uint16; 00338 #endif 00339 00340 #ifdef YYTYPE_INT16 00341 typedef YYTYPE_INT16 yytype_int16; 00342 #else 00343 typedef short int yytype_int16; 00344 #endif 00345 00346 #ifndef YYSIZE_T 00347 # ifdef __SIZE_TYPE__ 00348 # define YYSIZE_T __SIZE_TYPE__ 00349 # elif defined size_t 00350 # define YYSIZE_T size_t 00351 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ 00352 || defined __cplusplus || defined _MSC_VER) 00353 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ 00354 # define YYSIZE_T size_t 00355 # else 00356 # define YYSIZE_T unsigned int 00357 # endif 00358 #endif 00359 00360 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) 00361 00362 #ifndef YY_ 00363 # if defined YYENABLE_NLS && YYENABLE_NLS 00364 # if ENABLE_NLS 00365 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ 00366 # define YY_(msgid) dgettext ("bison-runtime", msgid) 00367 # endif 00368 # endif 00369 # ifndef YY_ 00370 # define YY_(msgid) msgid 00371 # endif 00372 #endif 00373 00374 /* Suppress unused-variable warnings by "using" E. */ 00375 #if ! defined lint || defined __GNUC__ 00376 # define YYUSE(e) ((void) (e)) 00377 #else 00378 # define YYUSE(e) /* empty */ 00379 #endif 00380 00381 /* Identity function, used to suppress warnings about constant conditions. */ 00382 #ifndef lint 00383 # define YYID(n) (n) 00384 #else 00385 #if (defined __STDC__ || defined __C99__FUNC__ \ 00386 || defined __cplusplus || defined _MSC_VER) 00387 static int 00388 YYID (int yyi) 00389 #else 00390 static int 00391 YYID (yyi) 00392 int yyi; 00393 #endif 00394 { 00395 return yyi; 00396 } 00397 #endif 00398 00399 #if ! defined yyoverflow || YYERROR_VERBOSE 00400 00401 /* The parser invokes alloca or malloc; define the necessary symbols. */ 00402 00403 # ifdef YYSTACK_USE_ALLOCA 00404 # if YYSTACK_USE_ALLOCA 00405 # ifdef __GNUC__ 00406 # define YYSTACK_ALLOC __builtin_alloca 00407 # elif defined __BUILTIN_VA_ARG_INCR 00408 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */ 00409 # elif defined _AIX 00410 # define YYSTACK_ALLOC __alloca 00411 # elif defined _MSC_VER 00412 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */ 00413 # define alloca _alloca 00414 # else 00415 # define YYSTACK_ALLOC alloca 00416 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ 00417 || defined __cplusplus || defined _MSC_VER) 00418 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 00419 # ifndef EXIT_SUCCESS 00420 # define EXIT_SUCCESS 0 00421 # endif 00422 # endif 00423 # endif 00424 # endif 00425 # endif 00426 00427 # ifdef YYSTACK_ALLOC 00428 /* Pacify GCC's `empty if-body' warning. */ 00429 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) 00430 # ifndef YYSTACK_ALLOC_MAXIMUM 00431 /* The OS might guarantee only one guard page at the bottom of the stack, 00432 and a page size can be as small as 4096 bytes. So we cannot safely 00433 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number 00434 to allow for a few compiler-allocated temporary stack slots. */ 00435 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ 00436 # endif 00437 # else 00438 # define YYSTACK_ALLOC YYMALLOC 00439 # define YYSTACK_FREE YYFREE 00440 # ifndef YYSTACK_ALLOC_MAXIMUM 00441 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM 00442 # endif 00443 # if (defined __cplusplus && ! defined EXIT_SUCCESS \ 00444 && ! ((defined YYMALLOC || defined malloc) \ 00445 && (defined YYFREE || defined free))) 00446 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 00447 # ifndef EXIT_SUCCESS 00448 # define EXIT_SUCCESS 0 00449 # endif 00450 # endif 00451 # ifndef YYMALLOC 00452 # define YYMALLOC malloc 00453 # if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ 00454 || defined __cplusplus || defined _MSC_VER) 00455 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ 00456 # endif 00457 # endif 00458 # ifndef YYFREE 00459 # define YYFREE free 00460 # if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ 00461 || defined __cplusplus || defined _MSC_VER) 00462 void free (void *); /* INFRINGES ON USER NAME SPACE */ 00463 # endif 00464 # endif 00465 # endif 00466 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ 00467 00468 00469 #if (! defined yyoverflow \ 00470 && (! defined __cplusplus \ 00471 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) 00472 00473 /* A type that is properly aligned for any stack member. */ 00474 union yyalloc 00475 { 00476 yytype_int16 yyss_alloc; 00477 YYSTYPE yyvs_alloc; 00478 }; 00479 00480 /* The size of the maximum gap between one aligned stack and the next. */ 00481 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) 00482 00483 /* The size of an array large to enough to hold all stacks, each with 00484 N elements. */ 00485 # define YYSTACK_BYTES(N) \ 00486 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ 00487 + YYSTACK_GAP_MAXIMUM) 00488 00489 # define YYCOPY_NEEDED 1 00490 00491 /* Relocate STACK from its old location to the new one. The 00492 local variables YYSIZE and YYSTACKSIZE give the old and new number of 00493 elements in the stack, and YYPTR gives the new location of the 00494 stack. Advance YYPTR to a properly aligned location for the next 00495 stack. */ 00496 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ 00497 do \ 00498 { \ 00499 YYSIZE_T yynewbytes; \ 00500 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ 00501 Stack = &yyptr->Stack_alloc; \ 00502 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ 00503 yyptr += yynewbytes / sizeof (*yyptr); \ 00504 } \ 00505 while (YYID (0)) 00506 00507 #endif 00508 00509 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED 00510 /* Copy COUNT objects from FROM to TO. The source and destination do 00511 not overlap. */ 00512 # ifndef YYCOPY 00513 # if defined __GNUC__ && 1 < __GNUC__ 00514 # define YYCOPY(To, From, Count) \ 00515 __builtin_memcpy (To, From, (Count) * sizeof (*(From))) 00516 # else 00517 # define YYCOPY(To, From, Count) \ 00518 do \ 00519 { \ 00520 YYSIZE_T yyi; \ 00521 for (yyi = 0; yyi < (Count); yyi++) \ 00522 (To)[yyi] = (From)[yyi]; \ 00523 } \ 00524 while (YYID (0)) 00525 # endif 00526 # endif 00527 #endif /* !YYCOPY_NEEDED */ 00528 00529 /* YYFINAL -- State number of the termination state. */ 00530 #define YYFINAL 6 00531 /* YYLAST -- Last index in YYTABLE. */ 00532 #define YYLAST 115 00533 00534 /* YYNTOKENS -- Number of terminals. */ 00535 #define YYNTOKENS 69 00536 /* YYNNTS -- Number of nonterminals. */ 00537 #define YYNNTS 42 00538 /* YYNRULES -- Number of rules. */ 00539 #define YYNRULES 103 00540 /* YYNRULES -- Number of states. */ 00541 #define YYNSTATES 142 00542 00543 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ 00544 #define YYUNDEFTOK 2 00545 #define YYMAXUTOK 316 00546 00547 #define YYTRANSLATE(YYX) \ 00548 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) 00549 00550 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ 00551 static const yytype_uint8 yytranslate[] = 00552 { 00553 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00554 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00555 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00556 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00557 2, 2, 2, 2, 66, 2, 2, 2, 2, 2, 00558 2, 2, 2, 2, 2, 2, 2, 2, 2, 62, 00559 2, 65, 2, 2, 2, 2, 2, 2, 2, 2, 00560 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00561 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00562 2, 63, 2, 64, 2, 2, 2, 2, 2, 2, 00563 2, 2, 2, 2, 67, 2, 2, 2, 2, 2, 00564 2, 2, 2, 2, 2, 2, 2, 2, 68, 2, 00565 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00566 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00567 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00568 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00569 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00570 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00571 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00572 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00573 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00574 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00575 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00576 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00577 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00578 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 00579 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 00580 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 00581 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 00582 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 00583 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 00584 55, 56, 57, 58, 59, 60, 61 00585 }; 00586 00587 #if YYDEBUG 00588 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in 00589 YYRHS. */ 00590 static const yytype_uint16 yyprhs[] = 00591 { 00592 0, 0, 3, 7, 9, 12, 13, 17, 19, 21, 00593 24, 26, 30, 34, 38, 42, 46, 50, 54, 56, 00594 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 00595 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 00596 102, 103, 105, 107, 109, 111, 113, 116, 119, 122, 00597 124, 126, 128, 130, 132, 135, 136, 138, 140, 143, 00598 146, 149, 152, 154, 157, 158, 160, 163, 165, 167, 00599 169, 171, 174, 176, 178, 180, 183, 185, 187, 189, 00600 191, 195, 199, 203, 207, 211, 214, 217, 219, 221, 00601 223, 226, 229, 235, 236, 239, 240, 244, 246, 248, 00602 250, 252, 254, 256 00603 }; 00604 00605 /* YYRHS -- A `-1'-separated list of the rules' RHS. */ 00606 static const yytype_int8 yyrhs[] = 00607 { 00608 70, 0, -1, 70, 62, 71, -1, 71, -1, 72, 00609 77, -1, -1, 73, 75, 74, -1, 63, -1, 64, 00610 -1, 75, 76, -1, 76, -1, 54, 65, 60, -1, 00611 55, 65, 60, -1, 56, 65, 60, -1, 58, 65, 00612 60, -1, 57, 65, 60, -1, 44, 65, 60, -1, 00613 59, 65, 60, -1, 78, -1, 77, 66, 78, -1, 00614 79, -1, 81, -1, 83, -1, 82, -1, 97, -1, 00615 101, -1, 100, -1, 99, -1, 89, -1, 84, -1, 00616 87, -1, 90, -1, 91, -1, 93, -1, 95, -1, 00617 103, -1, 105, -1, 104, -1, 110, -1, 3, 80, 00618 60, -1, -1, 53, -1, 4, -1, 5, -1, 6, 00619 -1, 29, -1, 29, 109, -1, 29, 85, -1, 29, 00620 86, -1, 21, -1, 22, -1, 23, -1, 41, -1, 00621 42, -1, 7, 88, -1, -1, 8, -1, 9, -1, 00622 26, 32, -1, 26, 33, -1, 26, 52, -1, 26, 00623 60, -1, 31, -1, 10, 92, -1, -1, 11, -1, 00624 34, 94, -1, 35, -1, 67, -1, 36, -1, 68, 00625 -1, 22, 96, -1, 24, -1, 25, -1, 28, -1, 00626 16, 98, -1, 17, -1, 18, -1, 19, -1, 28, 00627 -1, 30, 109, 106, -1, 30, 26, 60, -1, 30, 00628 26, 32, -1, 30, 26, 33, -1, 30, 27, 60, 00629 -1, 43, 60, -1, 12, 102, -1, 13, -1, 14, 00630 -1, 15, -1, 44, 60, -1, 51, 60, -1, 45, 00631 108, 109, 106, 107, -1, -1, 61, 48, -1, -1, 00632 49, 61, 50, -1, 46, -1, 47, -1, 37, -1, 00633 38, -1, 39, -1, 40, -1, 20, 60, -1 00634 }; 00635 00636 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ 00637 static const yytype_uint16 yyrline[] = 00638 { 00639 0, 206, 206, 207, 222, 225, 226, 233, 249, 297, 00640 298, 302, 308, 314, 320, 335, 350, 356, 365, 366, 00641 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 00642 380, 381, 382, 383, 384, 385, 386, 387, 388, 392, 00643 404, 405, 409, 417, 429, 437, 494, 528, 567, 585, 00644 586, 587, 591, 592, 596, 616, 617, 618, 622, 627, 00645 632, 637, 662, 674, 691, 692, 696, 707, 708, 709, 00646 710, 714, 739, 740, 741, 745, 767, 768, 769, 770, 00647 774, 799, 822, 838, 854, 902, 912, 932, 933, 934, 00648 938, 963, 973, 1072, 1075, 1083, 1086, 1093, 1094, 1098, 00649 1099, 1100, 1101, 1105 00650 }; 00651 #endif 00652 00653 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE 00654 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. 00655 First, the terminals, then, starting at YYNTOKENS, nonterminals. */ 00656 static const char *const yytname[] = 00657 { 00658 "$end", "error", "$undefined", "\"exec\"", "\"exit\"", "\"reload\"", 00659 "\"restart\"", "\"kill\"", "\"window\"", "\"client\"", "\"fullscreen\"", 00660 "\"global\"", "\"layout\"", "\"default\"", "\"stacked\"", "\"tabbed\"", 00661 "\"border\"", "\"normal\"", "\"none\"", "\"1pixel\"", "\"mode\"", 00662 "\"tiling\"", "\"floating\"", "\"mode_toggle\"", "\"enable\"", 00663 "\"disable\"", "\"workspace\"", "\"output\"", "\"toggle\"", "\"focus\"", 00664 "\"move\"", "\"open\"", "\"next\"", "\"prev\"", "\"split\"", 00665 "\"horizontal\"", "\"vertical\"", "\"up\"", "\"down\"", "\"left\"", 00666 "\"right\"", "\"parent\"", "\"child\"", "\"append_layout\"", "\"mark\"", 00667 "\"resize\"", "\"grow\"", "\"shrink\"", "\"px\"", "\"or\"", "\"ppt\"", 00668 "\"nop\"", "\"back_and_forth\"", "\"--no-startup-id\"", "\"class\"", 00669 "\"instance\"", "\"window_role\"", "\"id\"", "\"con_id\"", "\"title\"", 00670 "\"<string>\"", "\"<number>\"", "';'", "'['", "']'", "'='", "','", "'h'", 00671 "'v'", "$accept", "commands", "command", "match", "matchstart", 00672 "matchend", "criteria", "criterion", "operations", "operation", "exec", 00673 "optional_no_startup_id", "exit", "reload", "restart", "focus", 00674 "window_mode", "level", "kill", "optional_kill_mode", "workspace", 00675 "open", "fullscreen", "fullscreen_mode", "split", "split_direction", 00676 "floating", "boolean", "border", "border_style", "move", "append_layout", 00677 "layout", "layout_mode", "mark", "nop", "resize", "resize_px", 00678 "resize_tiling", "resize_way", "direction", "mode", 0 00679 }; 00680 #endif 00681 00682 # ifdef YYPRINT 00683 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to 00684 token YYLEX-NUM. */ 00685 static const yytype_uint16 yytoknum[] = 00686 { 00687 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 00688 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 00689 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 00690 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 00691 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 00692 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 00693 315, 316, 59, 91, 93, 61, 44, 104, 118 00694 }; 00695 # endif 00696 00697 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ 00698 static const yytype_uint8 yyr1[] = 00699 { 00700 0, 69, 70, 70, 71, 72, 72, 73, 74, 75, 00701 75, 76, 76, 76, 76, 76, 76, 76, 77, 77, 00702 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 00703 78, 78, 78, 78, 78, 78, 78, 78, 78, 79, 00704 80, 80, 81, 82, 83, 84, 84, 84, 84, 85, 00705 85, 85, 86, 86, 87, 88, 88, 88, 89, 89, 00706 89, 89, 90, 91, 92, 92, 93, 94, 94, 94, 00707 94, 95, 96, 96, 96, 97, 98, 98, 98, 98, 00708 99, 99, 99, 99, 99, 100, 101, 102, 102, 102, 00709 103, 104, 105, 106, 106, 107, 107, 108, 108, 109, 00710 109, 109, 109, 110 00711 }; 00712 00713 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ 00714 static const yytype_uint8 yyr2[] = 00715 { 00716 0, 2, 3, 1, 2, 0, 3, 1, 1, 2, 00717 1, 3, 3, 3, 3, 3, 3, 3, 1, 3, 00718 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00719 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 00720 0, 1, 1, 1, 1, 1, 2, 2, 2, 1, 00721 1, 1, 1, 1, 2, 0, 1, 1, 2, 2, 00722 2, 2, 1, 2, 0, 1, 2, 1, 1, 1, 00723 1, 2, 1, 1, 1, 2, 1, 1, 1, 1, 00724 3, 3, 3, 3, 3, 2, 2, 1, 1, 1, 00725 2, 2, 5, 0, 2, 0, 3, 1, 1, 1, 00726 1, 1, 1, 2 00727 }; 00728 00729 /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. 00730 Performed when YYTABLE doesn't specify something else to do. Zero 00731 means the default is an error. */ 00732 static const yytype_uint8 yydefact[] = 00733 { 00734 5, 7, 0, 3, 0, 0, 1, 5, 40, 42, 00735 43, 44, 55, 64, 0, 0, 0, 0, 0, 45, 00736 0, 62, 0, 0, 0, 0, 0, 4, 18, 20, 00737 21, 23, 22, 29, 30, 28, 31, 32, 33, 34, 00738 24, 27, 26, 25, 35, 37, 36, 38, 0, 0, 00739 0, 0, 0, 0, 0, 0, 10, 2, 41, 0, 00740 56, 57, 54, 65, 63, 87, 88, 89, 86, 76, 00741 77, 78, 79, 75, 103, 72, 73, 74, 71, 58, 00742 59, 60, 61, 49, 50, 51, 99, 100, 101, 102, 00743 52, 53, 47, 48, 46, 0, 0, 93, 67, 69, 00744 68, 70, 66, 85, 90, 97, 98, 0, 91, 0, 00745 0, 0, 0, 0, 0, 0, 0, 8, 6, 9, 00746 39, 82, 83, 81, 84, 0, 80, 93, 19, 16, 00747 11, 12, 13, 15, 14, 17, 94, 95, 0, 92, 00748 0, 96 00749 }; 00750 00751 /* YYDEFGOTO[NTERM-NUM]. */ 00752 static const yytype_int16 yydefgoto[] = 00753 { 00754 -1, 2, 3, 4, 5, 118, 55, 56, 27, 28, 00755 29, 59, 30, 31, 32, 33, 92, 93, 34, 62, 00756 35, 36, 37, 64, 38, 102, 39, 78, 40, 73, 00757 41, 42, 43, 68, 44, 45, 46, 126, 139, 107, 00758 94, 47 00759 }; 00760 00761 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing 00762 STATE-NUM. */ 00763 #define YYPACT_NINF -54 00764 static const yytype_int8 yypact[] = 00765 { 00766 -53, -54, 1, -54, -1, 20, -54, -53, -41, -54, 00767 -54, -54, 23, 5, 21, 67, -40, -2, -15, 30, 00768 54, -54, -28, -36, -33, 8, -22, -18, -54, -54, 00769 -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, 00770 -54, -54, -54, -54, -54, -54, -54, -54, -16, -3, 00771 0, 17, 18, 24, 25, 2, -54, -54, -54, -13, 00772 -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, 00773 -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, 00774 -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, 00775 -54, -54, -54, -54, -54, -19, 13, 27, -54, -54, 00776 -54, -54, -54, -54, -54, -54, -54, 59, -54, -1, 00777 40, 41, 42, 43, 44, 45, 46, -54, -54, -54, 00778 -54, -54, -54, -54, -54, 60, -54, 27, -54, -54, 00779 -54, -54, -54, -54, -54, -54, -54, 58, 48, -54, 00780 61, -54 00781 }; 00782 00783 /* YYPGOTO[NTERM-NUM]. */ 00784 static const yytype_int8 yypgoto[] = 00785 { 00786 -54, -54, 103, -54, -54, -54, -54, 57, -54, 4, 00787 -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, 00788 -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, 00789 -54, -54, -54, -54, -54, -54, -54, -12, -54, -54, 00790 -20, -54 00791 }; 00792 00793 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If 00794 positive, shift that token. If negative, reduce the rule which 00795 number is the opposite. If YYTABLE_NINF, syntax error. */ 00796 #define YYTABLE_NINF -1 00797 static const yytype_uint8 yytable[] = 00798 { 00799 97, 6, 8, 9, 10, 11, 12, 98, 99, 13, 00800 1, 14, 58, 121, 122, 15, 63, 79, 80, 16, 00801 74, 17, 75, 76, 103, 18, 77, 104, 19, 20, 00802 21, 60, 61, 22, 65, 66, 67, 81, 108, 100, 00803 101, 123, 23, 24, 25, 82, 48, 120, 109, 110, 00804 26, 83, 84, 85, 105, 106, 49, 50, 51, 52, 00805 53, 54, 111, 7, 48, 112, 117, 86, 87, 88, 00806 89, 90, 91, 124, 49, 50, 51, 52, 53, 54, 00807 95, 96, 113, 114, 69, 70, 71, 127, 125, 115, 00808 116, 86, 87, 88, 89, 72, 86, 87, 88, 89, 00809 129, 130, 131, 132, 133, 134, 135, 138, 136, 140, 00810 57, 141, 119, 128, 0, 137 00811 }; 00812 00813 #define yypact_value_is_default(yystate) \ 00814 ((yystate) == (-54)) 00815 00816 #define yytable_value_is_error(yytable_value) \ 00817 YYID (0) 00818 00819 static const yytype_int8 yycheck[] = 00820 { 00821 20, 0, 3, 4, 5, 6, 7, 35, 36, 10, 00822 63, 12, 53, 32, 33, 16, 11, 32, 33, 20, 00823 60, 22, 24, 25, 60, 26, 28, 60, 29, 30, 00824 31, 8, 9, 34, 13, 14, 15, 52, 60, 67, 00825 68, 60, 43, 44, 45, 60, 44, 60, 66, 65, 00826 51, 21, 22, 23, 46, 47, 54, 55, 56, 57, 00827 58, 59, 65, 62, 44, 65, 64, 37, 38, 39, 00828 40, 41, 42, 60, 54, 55, 56, 57, 58, 59, 00829 26, 27, 65, 65, 17, 18, 19, 107, 61, 65, 00830 65, 37, 38, 39, 40, 28, 37, 38, 39, 40, 00831 60, 60, 60, 60, 60, 60, 60, 49, 48, 61, 00832 7, 50, 55, 109, -1, 127 00833 }; 00834 00835 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing 00836 symbol of state STATE-NUM. */ 00837 static const yytype_uint8 yystos[] = 00838 { 00839 0, 63, 70, 71, 72, 73, 0, 62, 3, 4, 00840 5, 6, 7, 10, 12, 16, 20, 22, 26, 29, 00841 30, 31, 34, 43, 44, 45, 51, 77, 78, 79, 00842 81, 82, 83, 84, 87, 89, 90, 91, 93, 95, 00843 97, 99, 100, 101, 103, 104, 105, 110, 44, 54, 00844 55, 56, 57, 58, 59, 75, 76, 71, 53, 80, 00845 8, 9, 88, 11, 92, 13, 14, 15, 102, 17, 00846 18, 19, 28, 98, 60, 24, 25, 28, 96, 32, 00847 33, 52, 60, 21, 22, 23, 37, 38, 39, 40, 00848 41, 42, 85, 86, 109, 26, 27, 109, 35, 36, 00849 67, 68, 94, 60, 60, 46, 47, 108, 60, 66, 00850 65, 65, 65, 65, 65, 65, 65, 64, 74, 76, 00851 60, 32, 33, 60, 60, 61, 106, 109, 78, 60, 00852 60, 60, 60, 60, 60, 60, 48, 106, 49, 107, 00853 61, 50 00854 }; 00855 00856 #define yyerrok (yyerrstatus = 0) 00857 #define yyclearin (yychar = YYEMPTY) 00858 #define YYEMPTY (-2) 00859 #define YYEOF 0 00860 00861 #define YYACCEPT goto yyacceptlab 00862 #define YYABORT goto yyabortlab 00863 #define YYERROR goto yyerrorlab 00864 00865 00866 /* Like YYERROR except do call yyerror. This remains here temporarily 00867 to ease the transition to the new meaning of YYERROR, for GCC. 00868 Once GCC version 2 has supplanted version 1, this can go. However, 00869 YYFAIL appears to be in use. Nevertheless, it is formally deprecated 00870 in Bison 2.4.2's NEWS entry, where a plan to phase it out is 00871 discussed. */ 00872 00873 #define YYFAIL goto yyerrlab 00874 #if defined YYFAIL 00875 /* This is here to suppress warnings from the GCC cpp's 00876 -Wunused-macros. Normally we don't worry about that warning, but 00877 some users do, and we want to make it easy for users to remove 00878 YYFAIL uses, which will produce warnings from Bison 2.5. */ 00879 #endif 00880 00881 #define YYRECOVERING() (!!yyerrstatus) 00882 00883 #define YYBACKUP(Token, Value) \ 00884 do \ 00885 if (yychar == YYEMPTY && yylen == 1) \ 00886 { \ 00887 yychar = (Token); \ 00888 yylval = (Value); \ 00889 YYPOPSTACK (1); \ 00890 goto yybackup; \ 00891 } \ 00892 else \ 00893 { \ 00894 yyerror (YY_("syntax error: cannot back up")); \ 00895 YYERROR; \ 00896 } \ 00897 while (YYID (0)) 00898 00899 00900 #define YYTERROR 1 00901 #define YYERRCODE 256 00902 00903 00904 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. 00905 If N is 0, then set CURRENT to the empty location which ends 00906 the previous symbol: RHS[0] (always defined). */ 00907 00908 #define YYRHSLOC(Rhs, K) ((Rhs)[K]) 00909 #ifndef YYLLOC_DEFAULT 00910 # define YYLLOC_DEFAULT(Current, Rhs, N) \ 00911 do \ 00912 if (YYID (N)) \ 00913 { \ 00914 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ 00915 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ 00916 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ 00917 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ 00918 } \ 00919 else \ 00920 { \ 00921 (Current).first_line = (Current).last_line = \ 00922 YYRHSLOC (Rhs, 0).last_line; \ 00923 (Current).first_column = (Current).last_column = \ 00924 YYRHSLOC (Rhs, 0).last_column; \ 00925 } \ 00926 while (YYID (0)) 00927 #endif 00928 00929 00930 /* This macro is provided for backward compatibility. */ 00931 00932 #ifndef YY_LOCATION_PRINT 00933 # define YY_LOCATION_PRINT(File, Loc) ((void) 0) 00934 #endif 00935 00936 00937 /* YYLEX -- calling `yylex' with the right arguments. */ 00938 00939 #ifdef YYLEX_PARAM 00940 # define YYLEX yylex (YYLEX_PARAM) 00941 #else 00942 # define YYLEX yylex (context) 00943 #endif 00944 00945 /* Enable debugging if requested. */ 00946 #if YYDEBUG 00947 00948 # ifndef YYFPRINTF 00949 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ 00950 # define YYFPRINTF fprintf 00951 # endif 00952 00953 # define YYDPRINTF(Args) \ 00954 do { \ 00955 if (yydebug) \ 00956 YYFPRINTF Args; \ 00957 } while (YYID (0)) 00958 00959 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ 00960 do { \ 00961 if (yydebug) \ 00962 { \ 00963 YYFPRINTF (stderr, "%s ", Title); \ 00964 yy_symbol_print (stderr, \ 00965 Type, Value); \ 00966 YYFPRINTF (stderr, "\n"); \ 00967 } \ 00968 } while (YYID (0)) 00969 00970 00971 /*--------------------------------. 00972 | Print this symbol on YYOUTPUT. | 00973 `--------------------------------*/ 00974 00975 /*ARGSUSED*/ 00976 #if (defined __STDC__ || defined __C99__FUNC__ \ 00977 || defined __cplusplus || defined _MSC_VER) 00978 static void 00979 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) 00980 #else 00981 static void 00982 yy_symbol_value_print (yyoutput, yytype, yyvaluep) 00983 FILE *yyoutput; 00984 int yytype; 00985 YYSTYPE const * const yyvaluep; 00986 #endif 00987 { 00988 if (!yyvaluep) 00989 return; 00990 # ifdef YYPRINT 00991 if (yytype < YYNTOKENS) 00992 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); 00993 # else 00994 YYUSE (yyoutput); 00995 # endif 00996 switch (yytype) 00997 { 00998 default: 00999 break; 01000 } 01001 } 01002 01003 01004 /*--------------------------------. 01005 | Print this symbol on YYOUTPUT. | 01006 `--------------------------------*/ 01007 01008 #if (defined __STDC__ || defined __C99__FUNC__ \ 01009 || defined __cplusplus || defined _MSC_VER) 01010 static void 01011 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) 01012 #else 01013 static void 01014 yy_symbol_print (yyoutput, yytype, yyvaluep) 01015 FILE *yyoutput; 01016 int yytype; 01017 YYSTYPE const * const yyvaluep; 01018 #endif 01019 { 01020 if (yytype < YYNTOKENS) 01021 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); 01022 else 01023 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); 01024 01025 yy_symbol_value_print (yyoutput, yytype, yyvaluep); 01026 YYFPRINTF (yyoutput, ")"); 01027 } 01028 01029 /*------------------------------------------------------------------. 01030 | yy_stack_print -- Print the state stack from its BOTTOM up to its | 01031 | TOP (included). | 01032 `------------------------------------------------------------------*/ 01033 01034 #if (defined __STDC__ || defined __C99__FUNC__ \ 01035 || defined __cplusplus || defined _MSC_VER) 01036 static void 01037 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) 01038 #else 01039 static void 01040 yy_stack_print (yybottom, yytop) 01041 yytype_int16 *yybottom; 01042 yytype_int16 *yytop; 01043 #endif 01044 { 01045 YYFPRINTF (stderr, "Stack now"); 01046 for (; yybottom <= yytop; yybottom++) 01047 { 01048 int yybot = *yybottom; 01049 YYFPRINTF (stderr, " %d", yybot); 01050 } 01051 YYFPRINTF (stderr, "\n"); 01052 } 01053 01054 # define YY_STACK_PRINT(Bottom, Top) \ 01055 do { \ 01056 if (yydebug) \ 01057 yy_stack_print ((Bottom), (Top)); \ 01058 } while (YYID (0)) 01059 01060 01061 /*------------------------------------------------. 01062 | Report that the YYRULE is going to be reduced. | 01063 `------------------------------------------------*/ 01064 01065 #if (defined __STDC__ || defined __C99__FUNC__ \ 01066 || defined __cplusplus || defined _MSC_VER) 01067 static void 01068 yy_reduce_print (YYSTYPE *yyvsp, int yyrule) 01069 #else 01070 static void 01071 yy_reduce_print (yyvsp, yyrule) 01072 YYSTYPE *yyvsp; 01073 int yyrule; 01074 #endif 01075 { 01076 int yynrhs = yyr2[yyrule]; 01077 int yyi; 01078 unsigned long int yylno = yyrline[yyrule]; 01079 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", 01080 yyrule - 1, yylno); 01081 /* The symbols being reduced. */ 01082 for (yyi = 0; yyi < yynrhs; yyi++) 01083 { 01084 YYFPRINTF (stderr, " $%d = ", yyi + 1); 01085 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], 01086 &(yyvsp[(yyi + 1) - (yynrhs)]) 01087 ); 01088 YYFPRINTF (stderr, "\n"); 01089 } 01090 } 01091 01092 # define YY_REDUCE_PRINT(Rule) \ 01093 do { \ 01094 if (yydebug) \ 01095 yy_reduce_print (yyvsp, Rule); \ 01096 } while (YYID (0)) 01097 01098 /* Nonzero means print parse trace. It is left uninitialized so that 01099 multiple parsers can coexist. */ 01100 int yydebug; 01101 #else /* !YYDEBUG */ 01102 # define YYDPRINTF(Args) 01103 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) 01104 # define YY_STACK_PRINT(Bottom, Top) 01105 # define YY_REDUCE_PRINT(Rule) 01106 #endif /* !YYDEBUG */ 01107 01108 01109 /* YYINITDEPTH -- initial size of the parser's stacks. */ 01110 #ifndef YYINITDEPTH 01111 # define YYINITDEPTH 200 01112 #endif 01113 01114 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only 01115 if the built-in stack extension method is used). 01116 01117 Do not make this value too large; the results are undefined if 01118 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) 01119 evaluated with infinite-precision integer arithmetic. */ 01120 01121 #ifndef YYMAXDEPTH 01122 # define YYMAXDEPTH 10000 01123 #endif 01124 01125 01126 #if YYERROR_VERBOSE 01127 01128 # ifndef yystrlen 01129 # if defined __GLIBC__ && defined _STRING_H 01130 # define yystrlen strlen 01131 # else 01132 /* Return the length of YYSTR. */ 01133 #if (defined __STDC__ || defined __C99__FUNC__ \ 01134 || defined __cplusplus || defined _MSC_VER) 01135 static YYSIZE_T 01136 yystrlen (const char *yystr) 01137 #else 01138 static YYSIZE_T 01139 yystrlen (yystr) 01140 const char *yystr; 01141 #endif 01142 { 01143 YYSIZE_T yylen; 01144 for (yylen = 0; yystr[yylen]; yylen++) 01145 continue; 01146 return yylen; 01147 } 01148 # endif 01149 # endif 01150 01151 # ifndef yystpcpy 01152 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE 01153 # define yystpcpy stpcpy 01154 # else 01155 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in 01156 YYDEST. */ 01157 #if (defined __STDC__ || defined __C99__FUNC__ \ 01158 || defined __cplusplus || defined _MSC_VER) 01159 static char * 01160 yystpcpy (char *yydest, const char *yysrc) 01161 #else 01162 static char * 01163 yystpcpy (yydest, yysrc) 01164 char *yydest; 01165 const char *yysrc; 01166 #endif 01167 { 01168 char *yyd = yydest; 01169 const char *yys = yysrc; 01170 01171 while ((*yyd++ = *yys++) != '\0') 01172 continue; 01173 01174 return yyd - 1; 01175 } 01176 # endif 01177 # endif 01178 01179 # ifndef yytnamerr 01180 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary 01181 quotes and backslashes, so that it's suitable for yyerror. The 01182 heuristic is that double-quoting is unnecessary unless the string 01183 contains an apostrophe, a comma, or backslash (other than 01184 backslash-backslash). YYSTR is taken from yytname. If YYRES is 01185 null, do not copy; instead, return the length of what the result 01186 would have been. */ 01187 static YYSIZE_T 01188 yytnamerr (char *yyres, const char *yystr) 01189 { 01190 if (*yystr == '"') 01191 { 01192 YYSIZE_T yyn = 0; 01193 char const *yyp = yystr; 01194 01195 for (;;) 01196 switch (*++yyp) 01197 { 01198 case '\'': 01199 case ',': 01200 goto do_not_strip_quotes; 01201 01202 case '\\': 01203 if (*++yyp != '\\') 01204 goto do_not_strip_quotes; 01205 /* Fall through. */ 01206 default: 01207 if (yyres) 01208 yyres[yyn] = *yyp; 01209 yyn++; 01210 break; 01211 01212 case '"': 01213 if (yyres) 01214 yyres[yyn] = '\0'; 01215 return yyn; 01216 } 01217 do_not_strip_quotes: ; 01218 } 01219 01220 if (! yyres) 01221 return yystrlen (yystr); 01222 01223 return yystpcpy (yyres, yystr) - yyres; 01224 } 01225 # endif 01226 01227 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message 01228 about the unexpected token YYTOKEN for the state stack whose top is 01229 YYSSP. 01230 01231 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is 01232 not large enough to hold the message. In that case, also set 01233 *YYMSG_ALLOC to the required number of bytes. Return 2 if the 01234 required number of bytes is too large to store. */ 01235 static int 01236 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, 01237 yytype_int16 *yyssp, int yytoken) 01238 { 01239 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]); 01240 YYSIZE_T yysize = yysize0; 01241 YYSIZE_T yysize1; 01242 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; 01243 /* Internationalized format string. */ 01244 const char *yyformat = 0; 01245 /* Arguments of yyformat. */ 01246 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; 01247 /* Number of reported tokens (one for the "unexpected", one per 01248 "expected"). */ 01249 int yycount = 0; 01250 01251 /* There are many possibilities here to consider: 01252 - Assume YYFAIL is not used. It's too flawed to consider. See 01253 <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html> 01254 for details. YYERROR is fine as it does not invoke this 01255 function. 01256 - If this state is a consistent state with a default action, then 01257 the only way this function was invoked is if the default action 01258 is an error action. In that case, don't check for expected 01259 tokens because there are none. 01260 - The only way there can be no lookahead present (in yychar) is if 01261 this state is a consistent state with a default action. Thus, 01262 detecting the absence of a lookahead is sufficient to determine 01263 that there is no unexpected or expected token to report. In that 01264 case, just report a simple "syntax error". 01265 - Don't assume there isn't a lookahead just because this state is a 01266 consistent state with a default action. There might have been a 01267 previous inconsistent state, consistent state with a non-default 01268 action, or user semantic action that manipulated yychar. 01269 - Of course, the expected token list depends on states to have 01270 correct lookahead information, and it depends on the parser not 01271 to perform extra reductions after fetching a lookahead from the 01272 scanner and before detecting a syntax error. Thus, state merging 01273 (from LALR or IELR) and default reductions corrupt the expected 01274 token list. However, the list is correct for canonical LR with 01275 one exception: it will still contain any token that will not be 01276 accepted due to an error action in a later state. 01277 */ 01278 if (yytoken != YYEMPTY) 01279 { 01280 int yyn = yypact[*yyssp]; 01281 yyarg[yycount++] = yytname[yytoken]; 01282 if (!yypact_value_is_default (yyn)) 01283 { 01284 /* Start YYX at -YYN if negative to avoid negative indexes in 01285 YYCHECK. In other words, skip the first -YYN actions for 01286 this state because they are default actions. */ 01287 int yyxbegin = yyn < 0 ? -yyn : 0; 01288 /* Stay within bounds of both yycheck and yytname. */ 01289 int yychecklim = YYLAST - yyn + 1; 01290 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; 01291 int yyx; 01292 01293 for (yyx = yyxbegin; yyx < yyxend; ++yyx) 01294 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR 01295 && !yytable_value_is_error (yytable[yyx + yyn])) 01296 { 01297 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) 01298 { 01299 yycount = 1; 01300 yysize = yysize0; 01301 break; 01302 } 01303 yyarg[yycount++] = yytname[yyx]; 01304 yysize1 = yysize + yytnamerr (0, yytname[yyx]); 01305 if (! (yysize <= yysize1 01306 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) 01307 return 2; 01308 yysize = yysize1; 01309 } 01310 } 01311 } 01312 01313 switch (yycount) 01314 { 01315 # define YYCASE_(N, S) \ 01316 case N: \ 01317 yyformat = S; \ 01318 break 01319 YYCASE_(0, YY_("syntax error")); 01320 YYCASE_(1, YY_("syntax error, unexpected %s")); 01321 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); 01322 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); 01323 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); 01324 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); 01325 # undef YYCASE_ 01326 } 01327 01328 yysize1 = yysize + yystrlen (yyformat); 01329 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) 01330 return 2; 01331 yysize = yysize1; 01332 01333 if (*yymsg_alloc < yysize) 01334 { 01335 *yymsg_alloc = 2 * yysize; 01336 if (! (yysize <= *yymsg_alloc 01337 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) 01338 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; 01339 return 1; 01340 } 01341 01342 /* Avoid sprintf, as that infringes on the user's name space. 01343 Don't have undefined behavior even if the translation 01344 produced a string with the wrong number of "%s"s. */ 01345 { 01346 char *yyp = *yymsg; 01347 int yyi = 0; 01348 while ((*yyp = *yyformat) != '\0') 01349 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) 01350 { 01351 yyp += yytnamerr (yyp, yyarg[yyi++]); 01352 yyformat += 2; 01353 } 01354 else 01355 { 01356 yyp++; 01357 yyformat++; 01358 } 01359 } 01360 return 0; 01361 } 01362 #endif /* YYERROR_VERBOSE */ 01363 01364 /*-----------------------------------------------. 01365 | Release the memory associated to this symbol. | 01366 `-----------------------------------------------*/ 01367 01368 /*ARGSUSED*/ 01369 #if (defined __STDC__ || defined __C99__FUNC__ \ 01370 || defined __cplusplus || defined _MSC_VER) 01371 static void 01372 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) 01373 #else 01374 static void 01375 yydestruct (yymsg, yytype, yyvaluep) 01376 const char *yymsg; 01377 int yytype; 01378 YYSTYPE *yyvaluep; 01379 #endif 01380 { 01381 YYUSE (yyvaluep); 01382 01383 if (!yymsg) 01384 yymsg = "Deleting"; 01385 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); 01386 01387 switch (yytype) 01388 { 01389 01390 default: 01391 break; 01392 } 01393 } 01394 01395 01396 /* Prevent warnings from -Wmissing-prototypes. */ 01397 #ifdef YYPARSE_PARAM 01398 #if defined __STDC__ || defined __cplusplus 01399 int yyparse (void *YYPARSE_PARAM); 01400 #else 01401 int yyparse (); 01402 #endif 01403 #else /* ! YYPARSE_PARAM */ 01404 #if defined __STDC__ || defined __cplusplus 01405 int yyparse (void); 01406 #else 01407 int yyparse (); 01408 #endif 01409 #endif /* ! YYPARSE_PARAM */ 01410 01411 01412 /* The lookahead symbol. */ 01413 int yychar; 01414 01415 /* The semantic value of the lookahead symbol. */ 01416 YYSTYPE yylval; 01417 01418 /* Number of syntax errors so far. */ 01419 int yynerrs; 01420 01421 01422 /*----------. 01423 | yyparse. | 01424 `----------*/ 01425 01426 #ifdef YYPARSE_PARAM 01427 #if (defined __STDC__ || defined __C99__FUNC__ \ 01428 || defined __cplusplus || defined _MSC_VER) 01429 int 01430 yyparse (void *YYPARSE_PARAM) 01431 #else 01432 int 01433 yyparse (YYPARSE_PARAM) 01434 void *YYPARSE_PARAM; 01435 #endif 01436 #else /* ! YYPARSE_PARAM */ 01437 #if (defined __STDC__ || defined __C99__FUNC__ \ 01438 || defined __cplusplus || defined _MSC_VER) 01439 int 01440 yyparse (void) 01441 #else 01442 int 01443 yyparse () 01444 01445 #endif 01446 #endif 01447 { 01448 int yystate; 01449 /* Number of tokens to shift before error messages enabled. */ 01450 int yyerrstatus; 01451 01452 /* The stacks and their tools: 01453 `yyss': related to states. 01454 `yyvs': related to semantic values. 01455 01456 Refer to the stacks thru separate pointers, to allow yyoverflow 01457 to reallocate them elsewhere. */ 01458 01459 /* The state stack. */ 01460 yytype_int16 yyssa[YYINITDEPTH]; 01461 yytype_int16 *yyss; 01462 yytype_int16 *yyssp; 01463 01464 /* The semantic value stack. */ 01465 YYSTYPE yyvsa[YYINITDEPTH]; 01466 YYSTYPE *yyvs; 01467 YYSTYPE *yyvsp; 01468 01469 YYSIZE_T yystacksize; 01470 01471 int yyn; 01472 int yyresult; 01473 /* Lookahead token as an internal (translated) token number. */ 01474 int yytoken; 01475 /* The variables used to return semantic value and location from the 01476 action routines. */ 01477 YYSTYPE yyval; 01478 01479 #if YYERROR_VERBOSE 01480 /* Buffer for error messages, and its allocated size. */ 01481 char yymsgbuf[128]; 01482 char *yymsg = yymsgbuf; 01483 YYSIZE_T yymsg_alloc = sizeof yymsgbuf; 01484 #endif 01485 01486 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) 01487 01488 /* The number of symbols on the RHS of the reduced rule. 01489 Keep to zero when no symbol should be popped. */ 01490 int yylen = 0; 01491 01492 yytoken = 0; 01493 yyss = yyssa; 01494 yyvs = yyvsa; 01495 yystacksize = YYINITDEPTH; 01496 01497 YYDPRINTF ((stderr, "Starting parse\n")); 01498 01499 yystate = 0; 01500 yyerrstatus = 0; 01501 yynerrs = 0; 01502 yychar = YYEMPTY; /* Cause a token to be read. */ 01503 01504 /* Initialize stack pointers. 01505 Waste one element of value and location stack 01506 so that they stay on the same level as the state stack. 01507 The wasted elements are never initialized. */ 01508 yyssp = yyss; 01509 yyvsp = yyvs; 01510 01511 goto yysetstate; 01512 01513 /*------------------------------------------------------------. 01514 | yynewstate -- Push a new state, which is found in yystate. | 01515 `------------------------------------------------------------*/ 01516 yynewstate: 01517 /* In all cases, when you get here, the value and location stacks 01518 have just been pushed. So pushing a state here evens the stacks. */ 01519 yyssp++; 01520 01521 yysetstate: 01522 *yyssp = yystate; 01523 01524 if (yyss + yystacksize - 1 <= yyssp) 01525 { 01526 /* Get the current used size of the three stacks, in elements. */ 01527 YYSIZE_T yysize = yyssp - yyss + 1; 01528 01529 #ifdef yyoverflow 01530 { 01531 /* Give user a chance to reallocate the stack. Use copies of 01532 these so that the &'s don't force the real ones into 01533 memory. */ 01534 YYSTYPE *yyvs1 = yyvs; 01535 yytype_int16 *yyss1 = yyss; 01536 01537 /* Each stack pointer address is followed by the size of the 01538 data in use in that stack, in bytes. This used to be a 01539 conditional around just the two extra args, but that might 01540 be undefined if yyoverflow is a macro. */ 01541 yyoverflow (YY_("memory exhausted"), 01542 &yyss1, yysize * sizeof (*yyssp), 01543 &yyvs1, yysize * sizeof (*yyvsp), 01544 &yystacksize); 01545 01546 yyss = yyss1; 01547 yyvs = yyvs1; 01548 } 01549 #else /* no yyoverflow */ 01550 # ifndef YYSTACK_RELOCATE 01551 goto yyexhaustedlab; 01552 # else 01553 /* Extend the stack our own way. */ 01554 if (YYMAXDEPTH <= yystacksize) 01555 goto yyexhaustedlab; 01556 yystacksize *= 2; 01557 if (YYMAXDEPTH < yystacksize) 01558 yystacksize = YYMAXDEPTH; 01559 01560 { 01561 yytype_int16 *yyss1 = yyss; 01562 union yyalloc *yyptr = 01563 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); 01564 if (! yyptr) 01565 goto yyexhaustedlab; 01566 YYSTACK_RELOCATE (yyss_alloc, yyss); 01567 YYSTACK_RELOCATE (yyvs_alloc, yyvs); 01568 # undef YYSTACK_RELOCATE 01569 if (yyss1 != yyssa) 01570 YYSTACK_FREE (yyss1); 01571 } 01572 # endif 01573 #endif /* no yyoverflow */ 01574 01575 yyssp = yyss + yysize - 1; 01576 yyvsp = yyvs + yysize - 1; 01577 01578 YYDPRINTF ((stderr, "Stack size increased to %lu\n", 01579 (unsigned long int) yystacksize)); 01580 01581 if (yyss + yystacksize - 1 <= yyssp) 01582 YYABORT; 01583 } 01584 01585 YYDPRINTF ((stderr, "Entering state %d\n", yystate)); 01586 01587 if (yystate == YYFINAL) 01588 YYACCEPT; 01589 01590 goto yybackup; 01591 01592 /*-----------. 01593 | yybackup. | 01594 `-----------*/ 01595 yybackup: 01596 01597 /* Do appropriate processing given the current state. Read a 01598 lookahead token if we need one and don't already have one. */ 01599 01600 /* First try to decide what to do without reference to lookahead token. */ 01601 yyn = yypact[yystate]; 01602 if (yypact_value_is_default (yyn)) 01603 goto yydefault; 01604 01605 /* Not known => get a lookahead token if don't already have one. */ 01606 01607 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ 01608 if (yychar == YYEMPTY) 01609 { 01610 YYDPRINTF ((stderr, "Reading a token: ")); 01611 yychar = YYLEX; 01612 } 01613 01614 if (yychar <= YYEOF) 01615 { 01616 yychar = yytoken = YYEOF; 01617 YYDPRINTF ((stderr, "Now at end of input.\n")); 01618 } 01619 else 01620 { 01621 yytoken = YYTRANSLATE (yychar); 01622 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); 01623 } 01624 01625 /* If the proper action on seeing token YYTOKEN is to reduce or to 01626 detect an error, take that action. */ 01627 yyn += yytoken; 01628 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) 01629 goto yydefault; 01630 yyn = yytable[yyn]; 01631 if (yyn <= 0) 01632 { 01633 if (yytable_value_is_error (yyn)) 01634 goto yyerrlab; 01635 yyn = -yyn; 01636 goto yyreduce; 01637 } 01638 01639 /* Count tokens shifted since error; after three, turn off error 01640 status. */ 01641 if (yyerrstatus) 01642 yyerrstatus--; 01643 01644 /* Shift the lookahead token. */ 01645 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); 01646 01647 /* Discard the shifted token. */ 01648 yychar = YYEMPTY; 01649 01650 yystate = yyn; 01651 *++yyvsp = yylval; 01652 01653 goto yynewstate; 01654 01655 01656 /*-----------------------------------------------------------. 01657 | yydefault -- do the default action for the current state. | 01658 `-----------------------------------------------------------*/ 01659 yydefault: 01660 yyn = yydefact[yystate]; 01661 if (yyn == 0) 01662 goto yyerrlab; 01663 goto yyreduce; 01664 01665 01666 /*-----------------------------. 01667 | yyreduce -- Do a reduction. | 01668 `-----------------------------*/ 01669 yyreduce: 01670 /* yyn is the number of a rule to reduce with. */ 01671 yylen = yyr2[yyn]; 01672 01673 /* If YYLEN is nonzero, implement the default value of the action: 01674 `$$ = $1'. 01675 01676 Otherwise, the following line sets YYVAL to garbage. 01677 This behavior is undocumented and Bison 01678 users should not rely upon it. Assigning to YYVAL 01679 unconditionally makes the parser a bit smaller, and it avoids a 01680 GCC warning that YYVAL may be used uninitialized. */ 01681 yyval = yyvsp[1-yylen]; 01682 01683 01684 YY_REDUCE_PRINT (yyn); 01685 switch (yyn) 01686 { 01687 case 3: 01688 01689 /* Line 1806 of yacc.c */ 01690 #line 208 "src/cmdparse.y" 01691 { 01692 owindow *current; 01693 01694 printf("single command completely parsed, dropping state...\n"); 01695 while (!TAILQ_EMPTY(&owindows)) { 01696 current = TAILQ_FIRST(&owindows); 01697 TAILQ_REMOVE(&owindows, current, owindows); 01698 free(current); 01699 } 01700 match_init(¤t_match); 01701 } 01702 break; 01703 01704 case 6: 01705 01706 /* Line 1806 of yacc.c */ 01707 #line 227 "src/cmdparse.y" 01708 { 01709 printf("match parsed\n"); 01710 } 01711 break; 01712 01713 case 7: 01714 01715 /* Line 1806 of yacc.c */ 01716 #line 234 "src/cmdparse.y" 01717 { 01718 printf("start\n"); 01719 match_init(¤t_match); 01720 TAILQ_INIT(&owindows); 01721 /* copy all_cons */ 01722 Con *con; 01723 TAILQ_FOREACH(con, &all_cons, all_cons) { 01724 owindow *ow = smalloc(sizeof(owindow)); 01725 ow->con = con; 01726 TAILQ_INSERT_TAIL(&owindows, ow, owindows); 01727 } 01728 } 01729 break; 01730 01731 case 8: 01732 01733 /* Line 1806 of yacc.c */ 01734 #line 250 "src/cmdparse.y" 01735 { 01736 owindow *next, *current; 01737 01738 printf("match specification finished, matching...\n"); 01739 /* copy the old list head to iterate through it and start with a fresh 01740 * list which will contain only matching windows */ 01741 struct owindows_head old = owindows; 01742 TAILQ_INIT(&owindows); 01743 for (next = TAILQ_FIRST(&old); next != TAILQ_END(&old);) { 01744 /* make a copy of the next pointer and advance the pointer to the 01745 * next element as we are going to invalidate the element’s 01746 * next/prev pointers by calling TAILQ_INSERT_TAIL later */ 01747 current = next; 01748 next = TAILQ_NEXT(next, owindows); 01749 01750 printf("checking if con %p / %s matches\n", current->con, current->con->name); 01751 if (current_match.con_id != NULL) { 01752 if (current_match.con_id == current->con) { 01753 printf("matches container!\n"); 01754 TAILQ_INSERT_TAIL(&owindows, current, owindows); 01755 01756 } 01757 } else if (current_match.mark != NULL && current->con->mark != NULL && 01758 regex_matches(current_match.mark, current->con->mark)) { 01759 printf("match by mark\n"); 01760 TAILQ_INSERT_TAIL(&owindows, current, owindows); 01761 } else { 01762 if (current->con->window == NULL) 01763 continue; 01764 if (match_matches_window(¤t_match, current->con->window)) { 01765 printf("matches window!\n"); 01766 TAILQ_INSERT_TAIL(&owindows, current, owindows); 01767 } else { 01768 printf("doesnt match\n"); 01769 free(current); 01770 } 01771 } 01772 } 01773 01774 TAILQ_FOREACH(current, &owindows, owindows) { 01775 printf("matching: %p / %s\n", current->con, current->con->name); 01776 } 01777 01778 } 01779 break; 01780 01781 case 11: 01782 01783 /* Line 1806 of yacc.c */ 01784 #line 303 "src/cmdparse.y" 01785 { 01786 printf("criteria: class = %s\n", (yyvsp[(3) - (3)].string)); 01787 current_match.class = regex_new((yyvsp[(3) - (3)].string)); 01788 free((yyvsp[(3) - (3)].string)); 01789 } 01790 break; 01791 01792 case 12: 01793 01794 /* Line 1806 of yacc.c */ 01795 #line 309 "src/cmdparse.y" 01796 { 01797 printf("criteria: instance = %s\n", (yyvsp[(3) - (3)].string)); 01798 current_match.instance = regex_new((yyvsp[(3) - (3)].string)); 01799 free((yyvsp[(3) - (3)].string)); 01800 } 01801 break; 01802 01803 case 13: 01804 01805 /* Line 1806 of yacc.c */ 01806 #line 315 "src/cmdparse.y" 01807 { 01808 printf("criteria: window_role = %s\n", (yyvsp[(3) - (3)].string)); 01809 current_match.role = regex_new((yyvsp[(3) - (3)].string)); 01810 free((yyvsp[(3) - (3)].string)); 01811 } 01812 break; 01813 01814 case 14: 01815 01816 /* Line 1806 of yacc.c */ 01817 #line 321 "src/cmdparse.y" 01818 { 01819 printf("criteria: id = %s\n", (yyvsp[(3) - (3)].string)); 01820 char *end; 01821 long parsed = strtol((yyvsp[(3) - (3)].string), &end, 10); 01822 if (parsed == LONG_MIN || 01823 parsed == LONG_MAX || 01824 parsed < 0 || 01825 (end && *end != '\0')) { 01826 ELOG("Could not parse con id \"%s\"\n", (yyvsp[(3) - (3)].string)); 01827 } else { 01828 current_match.con_id = (Con*)parsed; 01829 printf("id as int = %p\n", current_match.con_id); 01830 } 01831 } 01832 break; 01833 01834 case 15: 01835 01836 /* Line 1806 of yacc.c */ 01837 #line 336 "src/cmdparse.y" 01838 { 01839 printf("criteria: window id = %s\n", (yyvsp[(3) - (3)].string)); 01840 char *end; 01841 long parsed = strtol((yyvsp[(3) - (3)].string), &end, 10); 01842 if (parsed == LONG_MIN || 01843 parsed == LONG_MAX || 01844 parsed < 0 || 01845 (end && *end != '\0')) { 01846 ELOG("Could not parse window id \"%s\"\n", (yyvsp[(3) - (3)].string)); 01847 } else { 01848 current_match.id = parsed; 01849 printf("window id as int = %d\n", current_match.id); 01850 } 01851 } 01852 break; 01853 01854 case 16: 01855 01856 /* Line 1806 of yacc.c */ 01857 #line 351 "src/cmdparse.y" 01858 { 01859 printf("criteria: mark = %s\n", (yyvsp[(3) - (3)].string)); 01860 current_match.mark = regex_new((yyvsp[(3) - (3)].string)); 01861 free((yyvsp[(3) - (3)].string)); 01862 } 01863 break; 01864 01865 case 17: 01866 01867 /* Line 1806 of yacc.c */ 01868 #line 357 "src/cmdparse.y" 01869 { 01870 printf("criteria: title = %s\n", (yyvsp[(3) - (3)].string)); 01871 current_match.title = regex_new((yyvsp[(3) - (3)].string)); 01872 free((yyvsp[(3) - (3)].string)); 01873 } 01874 break; 01875 01876 case 39: 01877 01878 /* Line 1806 of yacc.c */ 01879 #line 393 "src/cmdparse.y" 01880 { 01881 char *command = (yyvsp[(3) - (3)].string); 01882 bool no_startup_id = (yyvsp[(2) - (3)].number); 01883 01884 printf("should execute %s, no_startup_id = %d\n", command, no_startup_id); 01885 start_application(command, no_startup_id); 01886 free((yyvsp[(3) - (3)].string)); 01887 } 01888 break; 01889 01890 case 40: 01891 01892 /* Line 1806 of yacc.c */ 01893 #line 404 "src/cmdparse.y" 01894 { (yyval.number) = false; } 01895 break; 01896 01897 case 41: 01898 01899 /* Line 1806 of yacc.c */ 01900 #line 405 "src/cmdparse.y" 01901 { (yyval.number) = true; } 01902 break; 01903 01904 case 42: 01905 01906 /* Line 1806 of yacc.c */ 01907 #line 410 "src/cmdparse.y" 01908 { 01909 printf("exit, bye bye\n"); 01910 exit(0); 01911 } 01912 break; 01913 01914 case 43: 01915 01916 /* Line 1806 of yacc.c */ 01917 #line 418 "src/cmdparse.y" 01918 { 01919 printf("reloading\n"); 01920 kill_configerror_nagbar(false); 01921 load_configuration(conn, NULL, true); 01922 x_set_i3_atoms(); 01923 /* Send an IPC event just in case the ws names have changed */ 01924 ipc_send_event("workspace", I3_IPC_EVENT_WORKSPACE, "{\"change\":\"reload\"}"); 01925 } 01926 break; 01927 01928 case 44: 01929 01930 /* Line 1806 of yacc.c */ 01931 #line 430 "src/cmdparse.y" 01932 { 01933 printf("restarting i3\n"); 01934 i3_restart(false); 01935 } 01936 break; 01937 01938 case 45: 01939 01940 /* Line 1806 of yacc.c */ 01941 #line 438 "src/cmdparse.y" 01942 { 01943 if (focused && 01944 focused->type != CT_WORKSPACE && 01945 focused->fullscreen_mode != CF_NONE) { 01946 LOG("Cannot change focus while in fullscreen mode.\n"); 01947 break; 01948 } 01949 01950 owindow *current; 01951 01952 if (match_is_empty(¤t_match)) { 01953 ELOG("You have to specify which window/container should be focused.\n"); 01954 ELOG("Example: [class=\"urxvt\" title=\"irssi\"] focus\n"); 01955 01956 sasprintf(&json_output, "{\"success\":false, \"error\":\"You have to " 01957 "specify which window/container should be focused\"}"); 01958 break; 01959 } 01960 01961 int count = 0; 01962 TAILQ_FOREACH(current, &owindows, owindows) { 01963 Con *ws = con_get_workspace(current->con); 01964 /* If no workspace could be found, this was a dock window. 01965 * Just skip it, you cannot focus dock windows. */ 01966 if (!ws) 01967 continue; 01968 01969 /* If the container is not on the current workspace, 01970 * workspace_show() will switch to a different workspace and (if 01971 * enabled) trigger a mouse pointer warp to the currently focused 01972 * container (!) on the target workspace. 01973 * 01974 * Therefore, before calling workspace_show(), we make sure that 01975 * 'current' will be focused on the workspace. However, we cannot 01976 * just con_focus(current) because then the pointer will not be 01977 * warped at all (the code thinks we are already there). 01978 * 01979 * So we focus 'current' to make it the currently focused window of 01980 * the target workspace, then revert focus. */ 01981 Con *currently_focused = focused; 01982 con_focus(current->con); 01983 con_focus(currently_focused); 01984 01985 /* Now switch to the workspace, then focus */ 01986 workspace_show(ws); 01987 LOG("focusing %p / %s\n", current->con, current->con->name); 01988 con_focus(current->con); 01989 count++; 01990 } 01991 01992 if (count > 1) 01993 LOG("WARNING: Your criteria for the focus command matches %d containers, " 01994 "while only exactly one container can be focused at a time.\n", count); 01995 01996 tree_render(); 01997 } 01998 break; 01999 02000 case 46: 02001 02002 /* Line 1806 of yacc.c */ 02003 #line 495 "src/cmdparse.y" 02004 { 02005 if (focused && 02006 focused->type != CT_WORKSPACE && 02007 focused->fullscreen_mode != CF_NONE) { 02008 LOG("Cannot change focus while in fullscreen mode.\n"); 02009 break; 02010 } 02011 02012 int direction = (yyvsp[(2) - (2)].number); 02013 switch (direction) { 02014 case TOK_LEFT: 02015 LOG("Focusing left\n"); 02016 tree_next('p', HORIZ); 02017 break; 02018 case TOK_RIGHT: 02019 LOG("Focusing right\n"); 02020 tree_next('n', HORIZ); 02021 break; 02022 case TOK_UP: 02023 LOG("Focusing up\n"); 02024 tree_next('p', VERT); 02025 break; 02026 case TOK_DOWN: 02027 LOG("Focusing down\n"); 02028 tree_next('n', VERT); 02029 break; 02030 default: 02031 ELOG("Invalid focus direction (%d)\n", direction); 02032 break; 02033 } 02034 02035 tree_render(); 02036 } 02037 break; 02038 02039 case 47: 02040 02041 /* Line 1806 of yacc.c */ 02042 #line 529 "src/cmdparse.y" 02043 { 02044 if (focused && 02045 focused->type != CT_WORKSPACE && 02046 focused->fullscreen_mode != CF_NONE) { 02047 LOG("Cannot change focus while in fullscreen mode.\n"); 02048 break; 02049 } 02050 02051 printf("should focus: "); 02052 02053 if ((yyvsp[(2) - (2)].number) == TOK_TILING) 02054 printf("tiling\n"); 02055 else if ((yyvsp[(2) - (2)].number) == TOK_FLOATING) 02056 printf("floating\n"); 02057 else printf("mode toggle\n"); 02058 02059 Con *ws = con_get_workspace(focused); 02060 Con *current; 02061 if (ws != NULL) { 02062 int to_focus = (yyvsp[(2) - (2)].number); 02063 if ((yyvsp[(2) - (2)].number) == TOK_MODE_TOGGLE) { 02064 current = TAILQ_FIRST(&(ws->focus_head)); 02065 if (current != NULL && current->type == CT_FLOATING_CON) 02066 to_focus = TOK_TILING; 02067 else to_focus = TOK_FLOATING; 02068 } 02069 TAILQ_FOREACH(current, &(ws->focus_head), focused) { 02070 if ((to_focus == TOK_FLOATING && current->type != CT_FLOATING_CON) || 02071 (to_focus == TOK_TILING && current->type == CT_FLOATING_CON)) 02072 continue; 02073 02074 con_focus(con_descend_focused(current)); 02075 break; 02076 } 02077 } 02078 02079 tree_render(); 02080 } 02081 break; 02082 02083 case 48: 02084 02085 /* Line 1806 of yacc.c */ 02086 #line 568 "src/cmdparse.y" 02087 { 02088 if (focused && 02089 focused->type != CT_WORKSPACE && 02090 focused->fullscreen_mode != CF_NONE) { 02091 LOG("Cannot change focus while in fullscreen mode.\n"); 02092 break; 02093 } 02094 02095 if ((yyvsp[(2) - (2)].number) == TOK_PARENT) 02096 level_up(); 02097 else level_down(); 02098 02099 tree_render(); 02100 } 02101 break; 02102 02103 case 49: 02104 02105 /* Line 1806 of yacc.c */ 02106 #line 585 "src/cmdparse.y" 02107 { (yyval.number) = TOK_TILING; } 02108 break; 02109 02110 case 50: 02111 02112 /* Line 1806 of yacc.c */ 02113 #line 586 "src/cmdparse.y" 02114 { (yyval.number) = TOK_FLOATING; } 02115 break; 02116 02117 case 51: 02118 02119 /* Line 1806 of yacc.c */ 02120 #line 587 "src/cmdparse.y" 02121 { (yyval.number) = TOK_MODE_TOGGLE; } 02122 break; 02123 02124 case 52: 02125 02126 /* Line 1806 of yacc.c */ 02127 #line 591 "src/cmdparse.y" 02128 { (yyval.number) = TOK_PARENT; } 02129 break; 02130 02131 case 53: 02132 02133 /* Line 1806 of yacc.c */ 02134 #line 592 "src/cmdparse.y" 02135 { (yyval.number) = TOK_CHILD; } 02136 break; 02137 02138 case 54: 02139 02140 /* Line 1806 of yacc.c */ 02141 #line 597 "src/cmdparse.y" 02142 { 02143 owindow *current; 02144 02145 printf("killing!\n"); 02146 /* check if the match is empty, not if the result is empty */ 02147 if (match_is_empty(¤t_match)) 02148 tree_close_con((yyvsp[(2) - (2)].number)); 02149 else { 02150 TAILQ_FOREACH(current, &owindows, owindows) { 02151 printf("matching: %p / %s\n", current->con, current->con->name); 02152 tree_close(current->con, (yyvsp[(2) - (2)].number), false, false); 02153 } 02154 } 02155 02156 tree_render(); 02157 } 02158 break; 02159 02160 case 55: 02161 02162 /* Line 1806 of yacc.c */ 02163 #line 616 "src/cmdparse.y" 02164 { (yyval.number) = KILL_WINDOW; } 02165 break; 02166 02167 case 56: 02168 02169 /* Line 1806 of yacc.c */ 02170 #line 617 "src/cmdparse.y" 02171 { (yyval.number) = KILL_WINDOW; } 02172 break; 02173 02174 case 57: 02175 02176 /* Line 1806 of yacc.c */ 02177 #line 618 "src/cmdparse.y" 02178 { (yyval.number) = KILL_CLIENT; } 02179 break; 02180 02181 case 58: 02182 02183 /* Line 1806 of yacc.c */ 02184 #line 623 "src/cmdparse.y" 02185 { 02186 workspace_show(workspace_next()); 02187 tree_render(); 02188 } 02189 break; 02190 02191 case 59: 02192 02193 /* Line 1806 of yacc.c */ 02194 #line 628 "src/cmdparse.y" 02195 { 02196 workspace_show(workspace_prev()); 02197 tree_render(); 02198 } 02199 break; 02200 02201 case 60: 02202 02203 /* Line 1806 of yacc.c */ 02204 #line 633 "src/cmdparse.y" 02205 { 02206 workspace_back_and_forth(); 02207 tree_render(); 02208 } 02209 break; 02210 02211 case 61: 02212 02213 /* Line 1806 of yacc.c */ 02214 #line 638 "src/cmdparse.y" 02215 { 02216 printf("should switch to workspace %s\n", (yyvsp[(2) - (2)].string)); 02217 02218 Con *ws = con_get_workspace(focused); 02219 02220 /* Check if the command wants to switch to the current workspace */ 02221 if (strcmp(ws->name, (yyvsp[(2) - (2)].string)) == 0) { 02222 printf("This workspace is already focused.\n"); 02223 if (config.workspace_auto_back_and_forth) { 02224 workspace_back_and_forth(); 02225 free((yyvsp[(2) - (2)].string)); 02226 tree_render(); 02227 } 02228 break; 02229 } 02230 02231 workspace_show_by_name((yyvsp[(2) - (2)].string)); 02232 free((yyvsp[(2) - (2)].string)); 02233 02234 tree_render(); 02235 } 02236 break; 02237 02238 case 62: 02239 02240 /* Line 1806 of yacc.c */ 02241 #line 663 "src/cmdparse.y" 02242 { 02243 printf("opening new container\n"); 02244 Con *con = tree_open_con(NULL, NULL); 02245 con_focus(con); 02246 sasprintf(&json_output, "{\"success\":true, \"id\":%ld}", (long int)con); 02247 02248 tree_render(); 02249 } 02250 break; 02251 02252 case 63: 02253 02254 /* Line 1806 of yacc.c */ 02255 #line 675 "src/cmdparse.y" 02256 { 02257 printf("toggling fullscreen, mode = %s\n", ((yyvsp[(2) - (2)].number) == CF_OUTPUT ? "normal" : "global")); 02258 owindow *current; 02259 02260 HANDLE_EMPTY_MATCH; 02261 02262 TAILQ_FOREACH(current, &owindows, owindows) { 02263 printf("matching: %p / %s\n", current->con, current->con->name); 02264 con_toggle_fullscreen(current->con, (yyvsp[(2) - (2)].number)); 02265 } 02266 02267 tree_render(); 02268 } 02269 break; 02270 02271 case 64: 02272 02273 /* Line 1806 of yacc.c */ 02274 #line 691 "src/cmdparse.y" 02275 { (yyval.number) = CF_OUTPUT; } 02276 break; 02277 02278 case 65: 02279 02280 /* Line 1806 of yacc.c */ 02281 #line 692 "src/cmdparse.y" 02282 { (yyval.number) = CF_GLOBAL; } 02283 break; 02284 02285 case 66: 02286 02287 /* Line 1806 of yacc.c */ 02288 #line 697 "src/cmdparse.y" 02289 { 02290 /* TODO: use matches */ 02291 printf("splitting in direction %c\n", (yyvsp[(2) - (2)].number)); 02292 tree_split(focused, ((yyvsp[(2) - (2)].number) == 'v' ? VERT : HORIZ)); 02293 02294 tree_render(); 02295 } 02296 break; 02297 02298 case 67: 02299 02300 /* Line 1806 of yacc.c */ 02301 #line 707 "src/cmdparse.y" 02302 { (yyval.number) = 'h'; } 02303 break; 02304 02305 case 68: 02306 02307 /* Line 1806 of yacc.c */ 02308 #line 708 "src/cmdparse.y" 02309 { (yyval.number) = 'h'; } 02310 break; 02311 02312 case 69: 02313 02314 /* Line 1806 of yacc.c */ 02315 #line 709 "src/cmdparse.y" 02316 { (yyval.number) = 'v'; } 02317 break; 02318 02319 case 70: 02320 02321 /* Line 1806 of yacc.c */ 02322 #line 710 "src/cmdparse.y" 02323 { (yyval.number) = 'v'; } 02324 break; 02325 02326 case 71: 02327 02328 /* Line 1806 of yacc.c */ 02329 #line 715 "src/cmdparse.y" 02330 { 02331 HANDLE_EMPTY_MATCH; 02332 02333 owindow *current; 02334 TAILQ_FOREACH(current, &owindows, owindows) { 02335 printf("matching: %p / %s\n", current->con, current->con->name); 02336 if ((yyvsp[(2) - (2)].number) == TOK_TOGGLE) { 02337 printf("should toggle mode\n"); 02338 toggle_floating_mode(current->con, false); 02339 } else { 02340 printf("should switch mode to %s\n", ((yyvsp[(2) - (2)].number) == TOK_FLOATING ? "floating" : "tiling")); 02341 if ((yyvsp[(2) - (2)].number) == TOK_ENABLE) { 02342 floating_enable(current->con, false); 02343 } else { 02344 floating_disable(current->con, false); 02345 } 02346 } 02347 } 02348 02349 tree_render(); 02350 } 02351 break; 02352 02353 case 72: 02354 02355 /* Line 1806 of yacc.c */ 02356 #line 739 "src/cmdparse.y" 02357 { (yyval.number) = TOK_ENABLE; } 02358 break; 02359 02360 case 73: 02361 02362 /* Line 1806 of yacc.c */ 02363 #line 740 "src/cmdparse.y" 02364 { (yyval.number) = TOK_DISABLE; } 02365 break; 02366 02367 case 74: 02368 02369 /* Line 1806 of yacc.c */ 02370 #line 741 "src/cmdparse.y" 02371 { (yyval.number) = TOK_TOGGLE; } 02372 break; 02373 02374 case 75: 02375 02376 /* Line 1806 of yacc.c */ 02377 #line 746 "src/cmdparse.y" 02378 { 02379 printf("border style should be changed to %d\n", (yyvsp[(2) - (2)].number)); 02380 owindow *current; 02381 02382 HANDLE_EMPTY_MATCH; 02383 02384 TAILQ_FOREACH(current, &owindows, owindows) { 02385 printf("matching: %p / %s\n", current->con, current->con->name); 02386 int border_style = current->con->border_style; 02387 if ((yyvsp[(2) - (2)].number) == TOK_TOGGLE) { 02388 border_style++; 02389 border_style %= 3; 02390 } else border_style = (yyvsp[(2) - (2)].number); 02391 con_set_border_style(current->con, border_style); 02392 } 02393 02394 tree_render(); 02395 } 02396 break; 02397 02398 case 76: 02399 02400 /* Line 1806 of yacc.c */ 02401 #line 767 "src/cmdparse.y" 02402 { (yyval.number) = BS_NORMAL; } 02403 break; 02404 02405 case 77: 02406 02407 /* Line 1806 of yacc.c */ 02408 #line 768 "src/cmdparse.y" 02409 { (yyval.number) = BS_NONE; } 02410 break; 02411 02412 case 78: 02413 02414 /* Line 1806 of yacc.c */ 02415 #line 769 "src/cmdparse.y" 02416 { (yyval.number) = BS_1PIXEL; } 02417 break; 02418 02419 case 79: 02420 02421 /* Line 1806 of yacc.c */ 02422 #line 770 "src/cmdparse.y" 02423 { (yyval.number) = TOK_TOGGLE; } 02424 break; 02425 02426 case 80: 02427 02428 /* Line 1806 of yacc.c */ 02429 #line 775 "src/cmdparse.y" 02430 { 02431 int direction = (yyvsp[(2) - (3)].number); 02432 int px = (yyvsp[(3) - (3)].number); 02433 02434 /* TODO: make 'move' work with criteria. */ 02435 printf("moving in direction %d\n", direction); 02436 if (con_is_floating(focused)) { 02437 printf("floating move with %d pixels\n", px); 02438 Rect newrect = focused->parent->rect; 02439 if (direction == TOK_LEFT) { 02440 newrect.x -= px; 02441 } else if (direction == TOK_RIGHT) { 02442 newrect.x += px; 02443 } else if (direction == TOK_UP) { 02444 newrect.y -= px; 02445 } else if (direction == TOK_DOWN) { 02446 newrect.y += px; 02447 } 02448 floating_reposition(focused->parent, newrect); 02449 } else { 02450 tree_move(direction); 02451 tree_render(); 02452 } 02453 } 02454 break; 02455 02456 case 81: 02457 02458 /* Line 1806 of yacc.c */ 02459 #line 800 "src/cmdparse.y" 02460 { 02461 owindow *current; 02462 02463 /* Error out early to not create a non-existing workspace (in 02464 * workspace_get()) if we are not actually able to move anything. */ 02465 if (match_is_empty(¤t_match) && focused->type == CT_WORKSPACE) 02466 break; 02467 02468 printf("should move window to workspace %s\n", (yyvsp[(3) - (3)].string)); 02469 /* get the workspace */ 02470 Con *ws = workspace_get((yyvsp[(3) - (3)].string), NULL); 02471 free((yyvsp[(3) - (3)].string)); 02472 02473 HANDLE_EMPTY_MATCH; 02474 02475 TAILQ_FOREACH(current, &owindows, owindows) { 02476 printf("matching: %p / %s\n", current->con, current->con->name); 02477 con_move_to_workspace(current->con, ws, true, false); 02478 } 02479 02480 tree_render(); 02481 } 02482 break; 02483 02484 case 82: 02485 02486 /* Line 1806 of yacc.c */ 02487 #line 823 "src/cmdparse.y" 02488 { 02489 owindow *current; 02490 02491 /* get the workspace */ 02492 Con *ws = workspace_next(); 02493 02494 HANDLE_EMPTY_MATCH; 02495 02496 TAILQ_FOREACH(current, &owindows, owindows) { 02497 printf("matching: %p / %s\n", current->con, current->con->name); 02498 con_move_to_workspace(current->con, ws, true, false); 02499 } 02500 02501 tree_render(); 02502 } 02503 break; 02504 02505 case 83: 02506 02507 /* Line 1806 of yacc.c */ 02508 #line 839 "src/cmdparse.y" 02509 { 02510 owindow *current; 02511 02512 /* get the workspace */ 02513 Con *ws = workspace_prev(); 02514 02515 HANDLE_EMPTY_MATCH; 02516 02517 TAILQ_FOREACH(current, &owindows, owindows) { 02518 printf("matching: %p / %s\n", current->con, current->con->name); 02519 con_move_to_workspace(current->con, ws, true, false); 02520 } 02521 02522 tree_render(); 02523 } 02524 break; 02525 02526 case 84: 02527 02528 /* Line 1806 of yacc.c */ 02529 #line 855 "src/cmdparse.y" 02530 { 02531 owindow *current; 02532 02533 printf("should move window to output %s", (yyvsp[(3) - (3)].string)); 02534 02535 HANDLE_EMPTY_MATCH; 02536 02537 /* get the output */ 02538 Output *current_output = NULL; 02539 Output *output; 02540 02541 TAILQ_FOREACH(current, &owindows, owindows) 02542 current_output = get_output_containing(current->con->rect.x, current->con->rect.y); 02543 02544 assert(current_output != NULL); 02545 02546 if (strcasecmp((yyvsp[(3) - (3)].string), "up") == 0) 02547 output = get_output_next(D_UP, current_output); 02548 else if (strcasecmp((yyvsp[(3) - (3)].string), "down") == 0) 02549 output = get_output_next(D_DOWN, current_output); 02550 else if (strcasecmp((yyvsp[(3) - (3)].string), "left") == 0) 02551 output = get_output_next(D_LEFT, current_output); 02552 else if (strcasecmp((yyvsp[(3) - (3)].string), "right") == 0) 02553 output = get_output_next(D_RIGHT, current_output); 02554 else 02555 output = get_output_by_name((yyvsp[(3) - (3)].string)); 02556 free((yyvsp[(3) - (3)].string)); 02557 02558 if (!output) 02559 break; 02560 02561 /* get visible workspace on output */ 02562 Con *ws = NULL; 02563 GREP_FIRST(ws, output_get_content(output->con), workspace_is_visible(child)); 02564 if (!ws) 02565 break; 02566 02567 TAILQ_FOREACH(current, &owindows, owindows) { 02568 printf("matching: %p / %s\n", current->con, current->con->name); 02569 con_move_to_workspace(current->con, ws, true, false); 02570 } 02571 02572 tree_render(); 02573 } 02574 break; 02575 02576 case 85: 02577 02578 /* Line 1806 of yacc.c */ 02579 #line 903 "src/cmdparse.y" 02580 { 02581 printf("restoring \"%s\"\n", (yyvsp[(2) - (2)].string)); 02582 tree_append_json((yyvsp[(2) - (2)].string)); 02583 free((yyvsp[(2) - (2)].string)); 02584 tree_render(); 02585 } 02586 break; 02587 02588 case 86: 02589 02590 /* Line 1806 of yacc.c */ 02591 #line 913 "src/cmdparse.y" 02592 { 02593 printf("changing layout to %d\n", (yyvsp[(2) - (2)].number)); 02594 owindow *current; 02595 02596 /* check if the match is empty, not if the result is empty */ 02597 if (match_is_empty(¤t_match)) 02598 con_set_layout(focused->parent, (yyvsp[(2) - (2)].number)); 02599 else { 02600 TAILQ_FOREACH(current, &owindows, owindows) { 02601 printf("matching: %p / %s\n", current->con, current->con->name); 02602 con_set_layout(current->con, (yyvsp[(2) - (2)].number)); 02603 } 02604 } 02605 02606 tree_render(); 02607 } 02608 break; 02609 02610 case 87: 02611 02612 /* Line 1806 of yacc.c */ 02613 #line 932 "src/cmdparse.y" 02614 { (yyval.number) = L_DEFAULT; } 02615 break; 02616 02617 case 88: 02618 02619 /* Line 1806 of yacc.c */ 02620 #line 933 "src/cmdparse.y" 02621 { (yyval.number) = L_STACKED; } 02622 break; 02623 02624 case 89: 02625 02626 /* Line 1806 of yacc.c */ 02627 #line 934 "src/cmdparse.y" 02628 { (yyval.number) = L_TABBED; } 02629 break; 02630 02631 case 90: 02632 02633 /* Line 1806 of yacc.c */ 02634 #line 939 "src/cmdparse.y" 02635 { 02636 printf("Clearing all windows which have that mark first\n"); 02637 02638 Con *con; 02639 TAILQ_FOREACH(con, &all_cons, all_cons) { 02640 if (con->mark && strcmp(con->mark, (yyvsp[(2) - (2)].string)) == 0) 02641 FREE(con->mark); 02642 } 02643 02644 printf("marking window with str %s\n", (yyvsp[(2) - (2)].string)); 02645 owindow *current; 02646 02647 HANDLE_EMPTY_MATCH; 02648 02649 TAILQ_FOREACH(current, &owindows, owindows) { 02650 printf("matching: %p / %s\n", current->con, current->con->name); 02651 current->con->mark = (yyvsp[(2) - (2)].string); 02652 } 02653 02654 tree_render(); 02655 } 02656 break; 02657 02658 case 91: 02659 02660 /* Line 1806 of yacc.c */ 02661 #line 964 "src/cmdparse.y" 02662 { 02663 printf("-------------------------------------------------\n"); 02664 printf(" NOP: %s\n", (yyvsp[(2) - (2)].string)); 02665 printf("-------------------------------------------------\n"); 02666 free((yyvsp[(2) - (2)].string)); 02667 } 02668 break; 02669 02670 case 92: 02671 02672 /* Line 1806 of yacc.c */ 02673 #line 974 "src/cmdparse.y" 02674 { 02675 /* resize <grow|shrink> <direction> [<px> px] [or <ppt> ppt] */ 02676 printf("resizing in way %d, direction %d, px %d or ppt %d\n", (yyvsp[(2) - (5)].number), (yyvsp[(3) - (5)].number), (yyvsp[(4) - (5)].number), (yyvsp[(5) - (5)].number)); 02677 int direction = (yyvsp[(3) - (5)].number); 02678 int px = (yyvsp[(4) - (5)].number); 02679 int ppt = (yyvsp[(5) - (5)].number); 02680 if ((yyvsp[(2) - (5)].number) == TOK_SHRINK) { 02681 px *= -1; 02682 ppt *= -1; 02683 } 02684 02685 Con *floating_con; 02686 if ((floating_con = con_inside_floating(focused))) { 02687 printf("floating resize\n"); 02688 if (direction == TOK_UP) { 02689 floating_con->rect.y -= px; 02690 floating_con->rect.height += px; 02691 } else if (direction == TOK_DOWN) { 02692 floating_con->rect.height += px; 02693 } else if (direction == TOK_LEFT) { 02694 floating_con->rect.x -= px; 02695 floating_con->rect.width += px; 02696 } else { 02697 floating_con->rect.width += px; 02698 } 02699 } else { 02700 LOG("tiling resize\n"); 02701 /* get the appropriate current container (skip stacked/tabbed cons) */ 02702 Con *current = focused; 02703 while (current->parent->layout == L_STACKED || 02704 current->parent->layout == L_TABBED) 02705 current = current->parent; 02706 02707 /* Then further go up until we find one with the matching orientation. */ 02708 orientation_t search_orientation = 02709 (direction == TOK_LEFT || direction == TOK_RIGHT ? HORIZ : VERT); 02710 02711 while (current->type != CT_WORKSPACE && 02712 current->type != CT_FLOATING_CON && 02713 current->parent->orientation != search_orientation) 02714 current = current->parent; 02715 02716 /* get the default percentage */ 02717 int children = con_num_children(current->parent); 02718 Con *other; 02719 LOG("ins. %d children\n", children); 02720 double percentage = 1.0 / children; 02721 LOG("default percentage = %f\n", percentage); 02722 02723 orientation_t orientation = current->parent->orientation; 02724 02725 if ((orientation == HORIZ && 02726 (direction == TOK_UP || direction == TOK_DOWN)) || 02727 (orientation == VERT && 02728 (direction == TOK_LEFT || direction == TOK_RIGHT))) { 02729 LOG("You cannot resize in that direction. Your focus is in a %s split container currently.\n", 02730 (orientation == HORIZ ? "horizontal" : "vertical")); 02731 break; 02732 } 02733 02734 if (direction == TOK_UP || direction == TOK_LEFT) { 02735 other = TAILQ_PREV(current, nodes_head, nodes); 02736 } else { 02737 other = TAILQ_NEXT(current, nodes); 02738 } 02739 if (other == TAILQ_END(workspaces)) { 02740 LOG("No other container in this direction found, cannot resize.\n"); 02741 break; 02742 } 02743 LOG("other->percent = %f\n", other->percent); 02744 LOG("current->percent before = %f\n", current->percent); 02745 if (current->percent == 0.0) 02746 current->percent = percentage; 02747 if (other->percent == 0.0) 02748 other->percent = percentage; 02749 double new_current_percent = current->percent + ((double)ppt / 100.0); 02750 double new_other_percent = other->percent - ((double)ppt / 100.0); 02751 LOG("new_current_percent = %f\n", new_current_percent); 02752 LOG("new_other_percent = %f\n", new_other_percent); 02753 /* Ensure that the new percentages are positive and greater than 02754 * 0.05 to have a reasonable minimum size. */ 02755 if (definitelyGreaterThan(new_current_percent, 0.05, DBL_EPSILON) && 02756 definitelyGreaterThan(new_other_percent, 0.05, DBL_EPSILON)) { 02757 current->percent += ((double)ppt / 100.0); 02758 other->percent -= ((double)ppt / 100.0); 02759 LOG("current->percent after = %f\n", current->percent); 02760 LOG("other->percent after = %f\n", other->percent); 02761 } else { 02762 LOG("Not resizing, already at minimum size\n"); 02763 } 02764 } 02765 02766 tree_render(); 02767 } 02768 break; 02769 02770 case 93: 02771 02772 /* Line 1806 of yacc.c */ 02773 #line 1072 "src/cmdparse.y" 02774 { 02775 (yyval.number) = 10; 02776 } 02777 break; 02778 02779 case 94: 02780 02781 /* Line 1806 of yacc.c */ 02782 #line 1076 "src/cmdparse.y" 02783 { 02784 (yyval.number) = (yyvsp[(1) - (2)].number); 02785 } 02786 break; 02787 02788 case 95: 02789 02790 /* Line 1806 of yacc.c */ 02791 #line 1083 "src/cmdparse.y" 02792 { 02793 (yyval.number) = 10; 02794 } 02795 break; 02796 02797 case 96: 02798 02799 /* Line 1806 of yacc.c */ 02800 #line 1087 "src/cmdparse.y" 02801 { 02802 (yyval.number) = (yyvsp[(2) - (3)].number); 02803 } 02804 break; 02805 02806 case 97: 02807 02808 /* Line 1806 of yacc.c */ 02809 #line 1093 "src/cmdparse.y" 02810 { (yyval.number) = TOK_GROW; } 02811 break; 02812 02813 case 98: 02814 02815 /* Line 1806 of yacc.c */ 02816 #line 1094 "src/cmdparse.y" 02817 { (yyval.number) = TOK_SHRINK; } 02818 break; 02819 02820 case 99: 02821 02822 /* Line 1806 of yacc.c */ 02823 #line 1098 "src/cmdparse.y" 02824 { (yyval.number) = TOK_UP; } 02825 break; 02826 02827 case 100: 02828 02829 /* Line 1806 of yacc.c */ 02830 #line 1099 "src/cmdparse.y" 02831 { (yyval.number) = TOK_DOWN; } 02832 break; 02833 02834 case 101: 02835 02836 /* Line 1806 of yacc.c */ 02837 #line 1100 "src/cmdparse.y" 02838 { (yyval.number) = TOK_LEFT; } 02839 break; 02840 02841 case 102: 02842 02843 /* Line 1806 of yacc.c */ 02844 #line 1101 "src/cmdparse.y" 02845 { (yyval.number) = TOK_RIGHT; } 02846 break; 02847 02848 case 103: 02849 02850 /* Line 1806 of yacc.c */ 02851 #line 1106 "src/cmdparse.y" 02852 { 02853 switch_mode((yyvsp[(2) - (2)].string)); 02854 } 02855 break; 02856 02857 02858 02859 /* Line 1806 of yacc.c */ 02860 #line 2861 "src/cmdparse.tab.c" 02861 default: break; 02862 } 02863 /* User semantic actions sometimes alter yychar, and that requires 02864 that yytoken be updated with the new translation. We take the 02865 approach of translating immediately before every use of yytoken. 02866 One alternative is translating here after every semantic action, 02867 but that translation would be missed if the semantic action invokes 02868 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or 02869 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an 02870 incorrect destructor might then be invoked immediately. In the 02871 case of YYERROR or YYBACKUP, subsequent parser actions might lead 02872 to an incorrect destructor call or verbose syntax error message 02873 before the lookahead is translated. */ 02874 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); 02875 02876 YYPOPSTACK (yylen); 02877 yylen = 0; 02878 YY_STACK_PRINT (yyss, yyssp); 02879 02880 *++yyvsp = yyval; 02881 02882 /* Now `shift' the result of the reduction. Determine what state 02883 that goes to, based on the state we popped back to and the rule 02884 number reduced by. */ 02885 02886 yyn = yyr1[yyn]; 02887 02888 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; 02889 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) 02890 yystate = yytable[yystate]; 02891 else 02892 yystate = yydefgoto[yyn - YYNTOKENS]; 02893 02894 goto yynewstate; 02895 02896 02897 /*------------------------------------. 02898 | yyerrlab -- here on detecting error | 02899 `------------------------------------*/ 02900 yyerrlab: 02901 /* Make sure we have latest lookahead translation. See comments at 02902 user semantic actions for why this is necessary. */ 02903 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); 02904 02905 /* If not already recovering from an error, report this error. */ 02906 if (!yyerrstatus) 02907 { 02908 ++yynerrs; 02909 #if ! YYERROR_VERBOSE 02910 yyerror (YY_("syntax error")); 02911 #else 02912 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ 02913 yyssp, yytoken) 02914 { 02915 char const *yymsgp = YY_("syntax error"); 02916 int yysyntax_error_status; 02917 yysyntax_error_status = YYSYNTAX_ERROR; 02918 if (yysyntax_error_status == 0) 02919 yymsgp = yymsg; 02920 else if (yysyntax_error_status == 1) 02921 { 02922 if (yymsg != yymsgbuf) 02923 YYSTACK_FREE (yymsg); 02924 yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); 02925 if (!yymsg) 02926 { 02927 yymsg = yymsgbuf; 02928 yymsg_alloc = sizeof yymsgbuf; 02929 yysyntax_error_status = 2; 02930 } 02931 else 02932 { 02933 yysyntax_error_status = YYSYNTAX_ERROR; 02934 yymsgp = yymsg; 02935 } 02936 } 02937 yyerror (yymsgp); 02938 if (yysyntax_error_status == 2) 02939 goto yyexhaustedlab; 02940 } 02941 # undef YYSYNTAX_ERROR 02942 #endif 02943 } 02944 02945 02946 02947 if (yyerrstatus == 3) 02948 { 02949 /* If just tried and failed to reuse lookahead token after an 02950 error, discard it. */ 02951 02952 if (yychar <= YYEOF) 02953 { 02954 /* Return failure if at end of input. */ 02955 if (yychar == YYEOF) 02956 YYABORT; 02957 } 02958 else 02959 { 02960 yydestruct ("Error: discarding", 02961 yytoken, &yylval); 02962 yychar = YYEMPTY; 02963 } 02964 } 02965 02966 /* Else will try to reuse lookahead token after shifting the error 02967 token. */ 02968 goto yyerrlab1; 02969 02970 02971 /*---------------------------------------------------. 02972 | yyerrorlab -- error raised explicitly by YYERROR. | 02973 `---------------------------------------------------*/ 02974 yyerrorlab: 02975 02976 /* Pacify compilers like GCC when the user code never invokes 02977 YYERROR and the label yyerrorlab therefore never appears in user 02978 code. */ 02979 if (/*CONSTCOND*/ 0) 02980 goto yyerrorlab; 02981 02982 /* Do not reclaim the symbols of the rule which action triggered 02983 this YYERROR. */ 02984 YYPOPSTACK (yylen); 02985 yylen = 0; 02986 YY_STACK_PRINT (yyss, yyssp); 02987 yystate = *yyssp; 02988 goto yyerrlab1; 02989 02990 02991 /*-------------------------------------------------------------. 02992 | yyerrlab1 -- common code for both syntax error and YYERROR. | 02993 `-------------------------------------------------------------*/ 02994 yyerrlab1: 02995 yyerrstatus = 3; /* Each real token shifted decrements this. */ 02996 02997 for (;;) 02998 { 02999 yyn = yypact[yystate]; 03000 if (!yypact_value_is_default (yyn)) 03001 { 03002 yyn += YYTERROR; 03003 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) 03004 { 03005 yyn = yytable[yyn]; 03006 if (0 < yyn) 03007 break; 03008 } 03009 } 03010 03011 /* Pop the current state because it cannot handle the error token. */ 03012 if (yyssp == yyss) 03013 YYABORT; 03014 03015 03016 yydestruct ("Error: popping", 03017 yystos[yystate], yyvsp); 03018 YYPOPSTACK (1); 03019 yystate = *yyssp; 03020 YY_STACK_PRINT (yyss, yyssp); 03021 } 03022 03023 *++yyvsp = yylval; 03024 03025 03026 /* Shift the error token. */ 03027 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); 03028 03029 yystate = yyn; 03030 goto yynewstate; 03031 03032 03033 /*-------------------------------------. 03034 | yyacceptlab -- YYACCEPT comes here. | 03035 `-------------------------------------*/ 03036 yyacceptlab: 03037 yyresult = 0; 03038 goto yyreturn; 03039 03040 /*-----------------------------------. 03041 | yyabortlab -- YYABORT comes here. | 03042 `-----------------------------------*/ 03043 yyabortlab: 03044 yyresult = 1; 03045 goto yyreturn; 03046 03047 #if !defined(yyoverflow) || YYERROR_VERBOSE 03048 /*-------------------------------------------------. 03049 | yyexhaustedlab -- memory exhaustion comes here. | 03050 `-------------------------------------------------*/ 03051 yyexhaustedlab: 03052 yyerror (YY_("memory exhausted")); 03053 yyresult = 2; 03054 /* Fall through. */ 03055 #endif 03056 03057 yyreturn: 03058 if (yychar != YYEMPTY) 03059 { 03060 /* Make sure we have latest lookahead translation. See comments at 03061 user semantic actions for why this is necessary. */ 03062 yytoken = YYTRANSLATE (yychar); 03063 yydestruct ("Cleanup: discarding lookahead", 03064 yytoken, &yylval); 03065 } 03066 /* Do not reclaim the symbols of the rule which action triggered 03067 this YYABORT or YYACCEPT. */ 03068 YYPOPSTACK (yylen); 03069 YY_STACK_PRINT (yyss, yyssp); 03070 while (yyssp != yyss) 03071 { 03072 yydestruct ("Cleanup: popping", 03073 yystos[*yyssp], yyvsp); 03074 YYPOPSTACK (1); 03075 } 03076 #ifndef yyoverflow 03077 if (yyss != yyssa) 03078 YYSTACK_FREE (yyss); 03079 #endif 03080 #if YYERROR_VERBOSE 03081 if (yymsg != yymsgbuf) 03082 YYSTACK_FREE (yymsg); 03083 #endif 03084 /* Make sure YYID is used. */ 03085 return YYID (yyresult); 03086 } 03087 03088 03089